|
|
|
@ -496,7 +496,7 @@ public class SampleProofTrackingServiceImpl implements SampleProofTrackingServic |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
ProofTrackingBuProcessConfigData row = |
|
|
|
buildBuProcessConfigRow(DEFAULT_PROCESS_CONFIG_SITE, DEFAULT_PROCESS_CONFIG_BU, defaultRows); |
|
|
|
buildBuProcessConfigRow(DEFAULT_PROCESS_CONFIG_SITE, DEFAULT_PROCESS_CONFIG_BU, defaultRows, null); |
|
|
|
List<ProofTrackingBuProcessConfigData> rows = new ArrayList<>(); |
|
|
|
if (row != null) { |
|
|
|
rows.add(row); |
|
|
|
@ -513,11 +513,14 @@ public class SampleProofTrackingServiceImpl implements SampleProofTrackingServic |
|
|
|
if (isBlank(buNo)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
// 仅将 BU 专属落库行视为“已勾选”;默认模板新增工序若未在 BU 落库,应回显为未勾选。 |
|
|
|
List<ProofTrackingProcessColumnData> buRows = fetchAllProcessColumns(site, buNo); |
|
|
|
List<ProofTrackingProcessColumnData> processRows = resolveProcessColumnsForBuConfig(site, buNo); |
|
|
|
if (processRows.isEmpty()) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
ProofTrackingBuProcessConfigData row = buildBuProcessConfigRow(site, buNo, processRows); |
|
|
|
List<String> activeCodes = buRows.isEmpty() ? null : extractActiveProcessCodes(buRows); |
|
|
|
ProofTrackingBuProcessConfigData row = buildBuProcessConfigRow(site, buNo, processRows, activeCodes); |
|
|
|
if (row != null) { |
|
|
|
rows.add(row); |
|
|
|
} |
|
|
|
@ -584,7 +587,8 @@ public class SampleProofTrackingServiceImpl implements SampleProofTrackingServic |
|
|
|
|
|
|
|
private ProofTrackingBuProcessConfigData buildBuProcessConfigRow(String site, |
|
|
|
String buNo, |
|
|
|
List<ProofTrackingProcessColumnData> processRows) { |
|
|
|
List<ProofTrackingProcessColumnData> processRows, |
|
|
|
List<String> preferredActiveCodes) { |
|
|
|
if (isBlank(buNo) || processRows == null || processRows.isEmpty()) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
@ -592,7 +596,25 @@ public class SampleProofTrackingServiceImpl implements SampleProofTrackingServic |
|
|
|
if (processOrderCodes.isEmpty()) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
List<String> activeCodes = (preferredActiveCodes == null || preferredActiveCodes.isEmpty()) |
|
|
|
? extractActiveProcessCodes(processRows) |
|
|
|
: preferredActiveCodes; |
|
|
|
List<String> validCodes = normalizeProcessCodes(activeCodes, processOrderCodes); |
|
|
|
boolean showAll = validCodes.size() >= processOrderCodes.size(); |
|
|
|
ProofTrackingBuProcessConfigData row = new ProofTrackingBuProcessConfigData(); |
|
|
|
row.setSite(site); |
|
|
|
row.setBuNo(buNo); |
|
|
|
row.setShowAll(showAll); |
|
|
|
row.setProcessOrderCodes(new ArrayList<>(processOrderCodes)); |
|
|
|
row.setProcessCodes(showAll ? new ArrayList<>(processOrderCodes) : validCodes); |
|
|
|
return row; |
|
|
|
} |
|
|
|
|
|
|
|
private List<String> extractActiveProcessCodes(List<ProofTrackingProcessColumnData> processRows) { |
|
|
|
List<String> activeCodes = new ArrayList<>(); |
|
|
|
if (processRows == null || processRows.isEmpty()) { |
|
|
|
return activeCodes; |
|
|
|
} |
|
|
|
for (ProofTrackingProcessColumnData item : processRows) { |
|
|
|
if (item == null || isBlank(item.getCode())) { |
|
|
|
continue; |
|
|
|
@ -602,15 +624,7 @@ public class SampleProofTrackingServiceImpl implements SampleProofTrackingServic |
|
|
|
activeCodes.add(item.getCode().trim()); |
|
|
|
} |
|
|
|
} |
|
|
|
List<String> validCodes = normalizeProcessCodes(activeCodes, processOrderCodes); |
|
|
|
boolean showAll = validCodes.size() >= processOrderCodes.size(); |
|
|
|
ProofTrackingBuProcessConfigData row = new ProofTrackingBuProcessConfigData(); |
|
|
|
row.setSite(site); |
|
|
|
row.setBuNo(buNo); |
|
|
|
row.setShowAll(showAll); |
|
|
|
row.setProcessOrderCodes(new ArrayList<>(processOrderCodes)); |
|
|
|
row.setProcessCodes(showAll ? new ArrayList<>(processOrderCodes) : validCodes); |
|
|
|
return row; |
|
|
|
return activeCodes; |
|
|
|
} |
|
|
|
|
|
|
|
private void saveProcessColumnConfig(String site, |
|
|
|
|