Browse Source

以PN为准

master
han\hanst 6 days ago
parent
commit
d6ca0116d5
  1. 20
      src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelServiceImpl.java

20
src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelServiceImpl.java

@ -458,6 +458,13 @@ public class CoDelExcelServiceImpl implements CoDelExcelService {
continue;
}
// 获取pn列索引
Integer pnIdx = columnMap.get("PN");
if (pnIdx == null) {
log.warn("Sheet [{}] 中未找到 'PN' 列,跳过该Sheet", sheetName);
continue;
}
// Cargo Ready Date 列存在说明要处理这个 sheet验证其他必填列
String[] requiredColumns = {
"PO#", // 必填
@ -543,11 +550,10 @@ public class CoDelExcelServiceImpl implements CoDelExcelService {
continue;
}
// 检查Cargo Ready Date列如果没有值则跳过该行
if (row.getCell(cargoReadyDateIdx) == null
|| row.getCell(cargoReadyDateIdx).getCellType() == CellType.BLANK
|| row.getCell(cargoReadyDateIdx).getCellType() == CellType.ERROR) {
log.debug("第{}行的Cargo Ready Date列为空,跳过该行", j+1);
// 检查PN列如果没有值则跳过该行
if (row.getCell(pnIdx) == null || row.getCell(pnIdx).getCellType() == CellType.BLANK
|| row.getCell(pnIdx).getCellType() == CellType.ERROR) {
log.debug("第{}行的PN列为空,跳过该行", j+1);
continue;
}
@ -566,7 +572,7 @@ public class CoDelExcelServiceImpl implements CoDelExcelService {
continue; // 跳过这一行继续处理下一行
}
Integer pnIdx = columnMap.get("PN");
//Integer pnIdx = columnMap.get("PN");
if (row.getCell(pnIdx) == null) {
currentSheetError.addErrorDetail("第" + (j+1) + "行的 [PN] 列不能为空");
hasRowError = true;
@ -624,7 +630,7 @@ public class CoDelExcelServiceImpl implements CoDelExcelService {
String formatted = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
readDate = DateUtils.getDateByParten(formatted, "yyyy-MM-dd");
} catch (Exception e) {
currentSheetError.addErrorDetail("第" + (j+1) + "行的 [Cargo Ready Date] 列格式有误: " + e.getMessage());
currentSheetError.addErrorDetail("第" + (j+1) + "行的 [Cargo Ready Date] 列格式有误");
hasRowError = true;
continue;
}

Loading…
Cancel
Save