Browse Source

2026-09-17

项目物料在新增或导入时,正式物料不需要校验“应用描述”和“产品类别”必填
master
fengyuan_yang 3 days ago
parent
commit
32b7ab41b0
  1. 33
      src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java
  2. 2
      src/main/resources/mapper/part/PartInformationMapper.xml

33
src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java

@ -5603,14 +5603,7 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
part.setCustomerPartNo(getStringCellValue(row, 2)); part.setCustomerPartNo(getStringCellValue(row, 2));
part.setApplicationDesc(getStringCellValue(row, 3)); part.setApplicationDesc(getStringCellValue(row, 3));
part.setProductCategory(getStringCellValue(row, 4)); part.setProductCategory(getStringCellValue(row, 4));
if (!StringUtils.hasText(part.getApplicationDesc())) {
flag = false;
emptyApplicationDescRows.add(j + 1);
}
if (!StringUtils.hasText(part.getProductCategory())) {
flag = false;
emptyProductCategoryRows.add(j + 1);
} else if (!isValidProjectPartProductCategory(part.getProductCategory())) {
if (StringUtils.hasText(part.getProductCategory()) && !isValidProjectPartProductCategory(part.getProductCategory())) {
flag = false; flag = false;
wrongProductCategoryRows.add(j + 1); wrongProductCategoryRows.add(j + 1);
} }
@ -5646,6 +5639,16 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
vo.setCustomerPartNo(part.getCustomerPartNo()); vo.setCustomerPartNo(part.getCustomerPartNo());
vo.setApplicationDesc(part.getApplicationDesc()); vo.setApplicationDesc(part.getApplicationDesc());
vo.setProductCategory(StringUtils.hasText(part.getProductCategory()) ? part.getProductCategory().trim() : null); vo.setProductCategory(StringUtils.hasText(part.getProductCategory()) ? part.getProductCategory().trim() : null);
if (isTemporaryPart(vo.getSite(), vo)) {
if (!StringUtils.hasText(vo.getApplicationDesc())) {
flag = false;
emptyApplicationDescRows.add(ifsPartNoMap.get(part.getFinalPartNo()));
}
if (!StringUtils.hasText(vo.getProductCategory())) {
flag = false;
emptyProductCategoryRows.add(ifsPartNoMap.get(part.getFinalPartNo()));
}
}
list1.add(vo); list1.add(vo);
} }
if (flag){ if (flag){
@ -5788,10 +5791,18 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
} }
for (int i = 0; i < partList.size(); i++) { for (int i = 0; i < partList.size(); i++) {
PartInformationVo part = partList.get(i); PartInformationVo part = partList.get(i);
String partNo = part == null ? null : (StringUtils.hasText(part.getPartNo()) ? part.getPartNo() : part.getPlmPartNo());
if (part == null) {
continue;
}
String partNo = StringUtils.hasText(part.getPartNo()) ? part.getPartNo() : part.getPlmPartNo();
String prefix = StringUtils.hasText(partNo) ? "物料[" + partNo + "]:" : "第" + (i + 1) + "条物料:"; String prefix = StringUtils.hasText(partNo) ? "物料[" + partNo + "]:" : "第" + (i + 1) + "条物料:";
validateProjectPartRequiredFields(part == null ? null : part.getApplicationDesc(),
part == null ? null : part.getProductCategory(), prefix);
if (!isTemporaryPart(part.getSite(), part)) {
if (StringUtils.hasText(part.getProductCategory()) && !isValidProjectPartProductCategory(part.getProductCategory())) {
throw new RuntimeException(prefix + "产品类别无效,仅支持 Label/Diecut/Decoration/Material");
}
continue;
}
validateProjectPartRequiredFields(part.getApplicationDesc(), part.getProductCategory(), prefix);
} }
} }

2
src/main/resources/mapper/part/PartInformationMapper.xml

@ -1390,6 +1390,8 @@
<!-- dbo.plm_get_bu_desc(a.site,a.bu_no) buDesc,--> <!-- dbo.plm_get_bu_desc(a.site,a.bu_no) buDesc,-->
c.ifs_part_no as finalPartNo, c.ifs_part_no as finalPartNo,
c.plm_part_no, c.plm_part_no,
c.status,
c.temporary_part_flag,
dbo.get_customer_part_no(a.site, a.test_part_no, #{query.customerId}, 'ProjectPart') as customer_part_no dbo.get_customer_part_no(a.site, a.test_part_no, #{query.customerId}, 'ProjectPart') as customer_part_no
from plm_project_part a from plm_project_part a
left join plm_project_part b on a.site = b.site and a.bu_no = b.bu_no and a.project_id = b.project_id left join plm_project_part b on a.site = b.site and a.bu_no = b.bu_no and a.project_id = b.project_id

Loading…
Cancel
Save