|
|
|
@ -258,17 +258,28 @@ public class MasterPartInformationServiceImpl extends ServiceImpl<MasterPartInfo |
|
|
|
MasterPartInformationEntity masterPartInformation = masterPartInformationMapper.selectOne(new QueryWrapper<MasterPartInformationEntity>().eq("part_no", data.getPartNo())); |
|
|
|
// 检查物料模板 |
|
|
|
List<PartSubPropertiesValueData> mpData = masterPartInformationMapper.queryCodeNo(data); |
|
|
|
if (mpData.isEmpty() || !mpData.get(0).getCodeNo().equals(data.getCodeNo())) { |
|
|
|
// 修改了物料模板 |
|
|
|
PartSubPropertiesValueData valueData = new PartSubPropertiesValueData(); |
|
|
|
BeanUtils.copyProperties(data,valueData); |
|
|
|
PartSubPropertiesValueData valueData = new PartSubPropertiesValueData(); |
|
|
|
BeanUtils.copyProperties(data,valueData); |
|
|
|
// 如果前端传空值 则删除PLM数据 |
|
|
|
// 原有,新没有:删除明细 |
|
|
|
if (!StringUtils.isNotBlank(data.getCodeNo())) { |
|
|
|
// 删除物料的属性和属性值 |
|
|
|
partInformationMapper.deletePartSubPropertiesValueHeader(valueData); |
|
|
|
partInformationMapper.deletePartSubPropertiesValue(valueData); |
|
|
|
// 重新加载属性和属性值 |
|
|
|
partInformationMapper.savePartSubPropertiesValueHeader(valueData); |
|
|
|
partInformationMapper.savePartSubPropertiesValue(valueData); |
|
|
|
} else { |
|
|
|
// 前端有选择模板 之前是空值 或者 有值但修改了 |
|
|
|
// 原没有、新有:插入明细 || 原有,新有,不一样,删除明细,然后插入新模板的明细 |
|
|
|
if (mpData.isEmpty() || !mpData.get(0).getCodeNo().equals(data.getCodeNo())) { |
|
|
|
// 修改了物料模板 |
|
|
|
// 删除物料的属性和属性值 |
|
|
|
partInformationMapper.deletePartSubPropertiesValueHeader(valueData); |
|
|
|
partInformationMapper.deletePartSubPropertiesValue(valueData); |
|
|
|
// 重新加载属性和属性值 |
|
|
|
partInformationMapper.savePartSubPropertiesValueHeader(valueData); |
|
|
|
partInformationMapper.savePartSubPropertiesValue(valueData); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 修改物料 |
|
|
|
masterPartInformationMapper.masterPartInformationEdit(data); |
|
|
|
// 判断有没有 inventPart,有则修改 inventPart 净重和体积 |
|
|
|
@ -295,31 +306,50 @@ public class MasterPartInformationServiceImpl extends ServiceImpl<MasterPartInfo |
|
|
|
throw new RuntimeException("IFS 物料件编辑异常信息:" + updateResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
|
|
|
|
// 2025-06-03 如果修改了模板 则调用技术等级修改接口 |
|
|
|
if (mpData.isEmpty() || !mpData.get(0).getCodeNo().equals(data.getCodeNo())) { |
|
|
|
// 先调用查询 有则修改 无则新增 |
|
|
|
PartIfsCatalogModel partIfsCatalogModel = new PartIfsCatalogModel(); // 模板对象 |
|
|
|
partIfsCatalogModel.setLuName(luName); |
|
|
|
partIfsCatalogModel.setKeyRef("PART_NO=" + data.getPartNo() + "^"); // 物料编码 |
|
|
|
partIfsCatalogModel.setTechnicalSpecNo(technicalSpecNo); |
|
|
|
partIfsCatalogModel.setTechnicalClass(data.getCodeNo()); // 模板编码 |
|
|
|
partIfsCatalogModel.setOkYesNo(okYesNo); |
|
|
|
partIfsCatalogModel.setOkSign(ifsUser.getIfsUsername()); |
|
|
|
partIfsCatalogModel.setDtOk(DateUtils.getStringNow2()); |
|
|
|
Map<String, String> getMasterPartModelResponse = technicalClassBean.getTechnicalClass(srv, partIfsCatalogModel); |
|
|
|
if (!"200".equals(getMasterPartModelResponse.get("resultCode"))) { |
|
|
|
// 新增 |
|
|
|
Map<String, String> addMasterPartModelResponse = technicalClassBean.syncTechnicalClass(srv, partIfsCatalogModel); |
|
|
|
if (!"200".equals(addMasterPartModelResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("IFS 物料件模板新增异常:" + addMasterPartModelResponse.get("resultMsg")); |
|
|
|
PartIfsCatalogModel partIfsCatalogModel = new PartIfsCatalogModel(); // 模板对象 |
|
|
|
partIfsCatalogModel.setLuName(luName); |
|
|
|
partIfsCatalogModel.setKeyRef("PART_NO=" + data.getPartNo() + "^"); // 物料编码 |
|
|
|
partIfsCatalogModel.setTechnicalSpecNo(technicalSpecNo); |
|
|
|
partIfsCatalogModel.setTechnicalClass(data.getCodeNo()); // 模板编码 |
|
|
|
partIfsCatalogModel.setOkYesNo(okYesNo); |
|
|
|
partIfsCatalogModel.setOkSign(ifsUser.getIfsUsername()); |
|
|
|
partIfsCatalogModel.setDtOk(DateUtils.getStringNow2()); |
|
|
|
// PLM修改前无模板 PLM修改后有模板 调新增 |
|
|
|
if (StringUtils.isNotBlank(data.getCodeNo()) && mpData.isEmpty()) { |
|
|
|
Map<String, String> addMasterPartModelResponse = technicalClassBean.syncTechnicalClass(srv, partIfsCatalogModel); |
|
|
|
if (!"200".equals(addMasterPartModelResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("IFS 物料件模板新增异常:" + addMasterPartModelResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
} else if (!mpData.isEmpty() && !StringUtils.isNotBlank(data.getCodeNo())) { |
|
|
|
// PLM修改前有模板 PLM修改后无模板 删除属性明细 删除模板主记录 |
|
|
|
List<PartIfsCatalogProperty> propertyList = partInformationMapper.getMasterPartPropertyList(data.getSite(), data.getPartNo(), data.getCodeNo(), "MP"); |
|
|
|
if (!propertyList.isEmpty()) { |
|
|
|
Map<String, String> deleteMasterPartPropertyResponse = technicalClassBean.removeTechnicalClassAttributes(srv, propertyList); |
|
|
|
if (!"200".equals(deleteMasterPartPropertyResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("IFS物料属性删除异常:" + deleteMasterPartPropertyResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 修改 |
|
|
|
Map<String, String> updateMasterPartModelResponse = technicalClassBean.modifyTechnicalClass(srv, partIfsCatalogModel); |
|
|
|
if (!"200".equals(updateMasterPartModelResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("IFS 物料件模板修改异常:" + updateMasterPartModelResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
Map<String, String> deleteMasterPartModelResponse = technicalClassBean.removeTechnicalClass(srv, partIfsCatalogModel); |
|
|
|
if (!"200".equals(deleteMasterPartModelResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("IFS 物料件模板删除异常:" + deleteMasterPartModelResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
} else if (!mpData.isEmpty() && StringUtils.isNotBlank(data.getCodeNo()) && !mpData.get(0).getCodeNo().equals(data.getCodeNo())) { |
|
|
|
// PLM修改前有模板 PLM修改后有模板 不一样 删除属性明细 删除模板主记录 新增主记录 |
|
|
|
List<PartIfsCatalogProperty> propertyList = partInformationMapper.getMasterPartPropertyList(data.getSite(), data.getPartNo(), data.getCodeNo(), "MP"); |
|
|
|
if (!propertyList.isEmpty()) { |
|
|
|
Map<String, String> deleteMasterPartPropertyResponse = technicalClassBean.removeTechnicalClassAttributes(srv, propertyList); |
|
|
|
if (!"200".equals(deleteMasterPartPropertyResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("IFS物料属性删除异常:" + deleteMasterPartPropertyResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, String> deleteMasterPartModelResponse = technicalClassBean.removeTechnicalClass(srv, partIfsCatalogModel); |
|
|
|
if (!"200".equals(deleteMasterPartModelResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("IFS 物料件模板删除异常:" + deleteMasterPartModelResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
Map<String, String> addMasterPartModelResponse = technicalClassBean.syncTechnicalClass(srv, partIfsCatalogModel); |
|
|
|
if (!"200".equals(addMasterPartModelResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("IFS 物料件模板新增异常:" + addMasterPartModelResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|