Browse Source

单证调整

java8
han\hanst 5 days ago
parent
commit
d893821e26
  1. 24
      src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelServiceImpl.java
  2. 6
      src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java
  3. 2
      src/main/resources/mapper/ecss/CoDelMapper.xml

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

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

6
src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java

@ -4206,7 +4206,9 @@ public class CoDelServiceImpl implements CoDelService {
} }
Object detailRollsObj = detail.get("detailRolls"); Object detailRollsObj = detail.get("detailRolls");
if (detailRollsObj instanceof BigDecimal) {
if (detailRollsObj == null || "".equals(detailRollsObj)) {
palletDetailData.setRolls(BigDecimal.valueOf(0));
} else if (detailRollsObj instanceof BigDecimal) {
palletDetailData.setRolls((BigDecimal) detailRollsObj); palletDetailData.setRolls((BigDecimal) detailRollsObj);
} else if (detailRollsObj instanceof Integer) { } else if (detailRollsObj instanceof Integer) {
palletDetailData.setRolls(BigDecimal.valueOf((Integer) detailRollsObj)); palletDetailData.setRolls(BigDecimal.valueOf((Integer) detailRollsObj));
@ -4214,7 +4216,7 @@ public class CoDelServiceImpl implements CoDelService {
palletDetailData.setRolls(BigDecimal.valueOf((Double) detailRollsObj)); palletDetailData.setRolls(BigDecimal.valueOf((Double) detailRollsObj));
} else if (detailRollsObj instanceof String) { } else if (detailRollsObj instanceof String) {
palletDetailData.setRolls(new BigDecimal((String) detailRollsObj)); palletDetailData.setRolls(new BigDecimal((String) detailRollsObj));
} else if (detailRollsObj != null) {
} else {
palletDetailData.setRolls(BigDecimal.valueOf(((Number) detailRollsObj).doubleValue())); palletDetailData.setRolls(BigDecimal.valueOf(((Number) detailRollsObj).doubleValue()));
} }

2
src/main/resources/mapper/ecss/CoDelMapper.xml

@ -881,7 +881,7 @@ left join ecss_CoDelNotifyHeader noHeader on a.site=noHeader.site and a.delNo=no
</select> </select>
<select id="exportEcssCoDelNotifyDetail" resultType="java.util.Map"> <select id="exportEcssCoDelNotifyDetail" resultType="java.util.Map">
select a.customerPO,a.part_no,a.part_description,a.currency,
select a.customerPO,a.part_no,a.part_description,LEFT(a.currency, 3) as currency,
CONVERT(DECIMAL(20, 0), a.qty) as qty,CONVERT(DECIMAL(20, 6), a.tp) as unitPrice,b.hsCode, CONVERT(DECIMAL(20, 0), a.qty) as qty,CONVERT(DECIMAL(20, 6), a.tp) as unitPrice,b.hsCode,
a.upc,a.so,a.ttl_amount,a.pn,h.hsCodeDesc,h.hsCodeDescEn,a.salesOrder a.upc,a.so,a.ttl_amount,a.pn,h.hsCodeDesc,h.hsCodeDescEn,a.salesOrder
from ecss_CoDelNotifydetail a from ecss_CoDelNotifydetail a

Loading…
Cancel
Save