hs码修改

This commit is contained in:
秦鸿展
2026-05-07 21:14:55 +08:00
parent 84fdb36465
commit ea2f070bfc
@@ -444,6 +444,8 @@ public class MaterialBaseInfoApplicationService {
if (StringUtils.isBlank(row.getHsCode()) && StringUtils.isNotBlank(row.getHsCodeImport())) {
row.setHsCode(row.getHsCodeImport().trim());
}
// Excel 表头错位或重复时,HS 可能被读入「物料条形码」列;与 HS 完全相同时视为误填,保留 hsCode、清空条码
normalizeImportBarCodeWhenDuplicateOfHs(row);
fillOrganizationName(row, loginUser);
String shipperCode = StringUtils.defaultString(row.getShipperCode(), "");
@@ -964,6 +966,25 @@ public class MaterialBaseInfoApplicationService {
}
}
/**
* 导入约定:「HS码/HS编码」与「物料条形码」为不同列。模板表头错位或两列误填相同 HS 时,
* barCode 会与 hsCode 相同;此时保留 hsCode,清空主表/子表条码,避免 HS 写入 bar_code。
*/
private void normalizeImportBarCodeWhenDuplicateOfHs(MaterialBaseInfoDTO row) {
if (row == null) {
return;
}
if (StringUtils.isBlank(row.getBarCode())) {
row.setBarCode(null);
return;
}
row.setBarCode(row.getBarCode().trim());
String hs = StringUtils.isNotBlank(row.getHsCode()) ? row.getHsCode().trim() : "";
if (StringUtils.isNotBlank(hs) && row.getBarCode().equals(hs)) {
row.setBarCode(null);
}
}
private List<MaterialBarCodeDO> buildImportBarCodeList(MaterialBaseInfoDTO row) {
if (StringUtils.isBlank(row.getBarCode())) {
return null;