Browse Source

2024-10-12

优化
master
fengyuan_yang 1 year ago
parent
commit
1ce1043688
  1. 30
      src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java
  2. 2
      src/main/resources/mapper/part/PartInformationMapper.xml

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

@ -1805,10 +1805,11 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
masterPartInformation.setPlmPartNo(data.getPartNo()); masterPartInformation.setPlmPartNo(data.getPartNo());
masterPartInformationService.toBecomeOfficialMasterPart(masterPartInformation); masterPartInformationService.toBecomeOfficialMasterPart(masterPartInformation);
// 同步数据到 IFS
if (dataUrl) {
// 1库存件 // 1库存件
PartIfsInventory partIfsInventory = getPartIfsInventory(ifsPart); // 主表对象 PartIfsInventory partIfsInventory = getPartIfsInventory(ifsPart); // 主表对象
try {
// 同步数据到 IFS
if (dataUrl) {
PartIfsInventoryConfig partIfsInventoryConfig = getPartIfsInventoryConfig(ifsPart); // costs对象 PartIfsInventoryConfig partIfsInventoryConfig = getPartIfsInventoryConfig(ifsPart); // costs对象
PartIfsInventoryManufacture partIfsInventoryManufacture = getPartIfsInventoryManufacture(ifsPart); // Manufacturing对象 PartIfsInventoryManufacture partIfsInventoryManufacture = getPartIfsInventoryManufacture(ifsPart); // Manufacturing对象
PartIfsInventoryPlan partIfsInventoryPlan = getPartIfsInventoryPlan(ifsPart); // planning对象 PartIfsInventoryPlan partIfsInventoryPlan = getPartIfsInventoryPlan(ifsPart); // planning对象
@ -1821,7 +1822,7 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
} }
// 1.1 库存件主表数据 // 1.1 库存件主表数据
String getInventoryPartURL = apiUrl + "/part/ifs/getInventoryPartToIfs";
String getInventoryPartURL = apiUrl + "/part/ifs/getInventoryPart";
ResponseData getInventoryPartResponse = HttpClientUtil.doPostByRawWithPLM(getInventoryPartURL, partIfsInventory); ResponseData getInventoryPartResponse = HttpClientUtil.doPostByRawWithPLM(getInventoryPartURL, partIfsInventory);
if (!"200".equals(getInventoryPartResponse.getCode())) { // 新增 if (!"200".equals(getInventoryPartResponse.getCode())) { // 新增
String addInventoryPartURL = apiUrl + "/part/ifs/syncInventoryPartToIfs"; String addInventoryPartURL = apiUrl + "/part/ifs/syncInventoryPartToIfs";
@ -1864,7 +1865,19 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
if (!"200".equals(savePartRevisionResponse.getCode())) { if (!"200".equals(savePartRevisionResponse.getCode())) {
throw new RuntimeException("IFS库存件版本新增异常:" + savePartRevisionResponse.getMsg()); throw new RuntimeException("IFS库存件版本新增异常:" + savePartRevisionResponse.getMsg());
} }
} else { // 修改
} else {
// // 删除再新增
// String deletePartRevisionURL = apiUrl + "/part/ifs/removeInventoryPartRevisionToIfs";
// ResponseData deletePartRevisionResponse = HttpClientUtil.doPostByRawWithPLM(deletePartRevisionURL, revision);
// if (!"200".equals(deletePartRevisionResponse.getCode())) {
// throw new RuntimeException("IFS库存件版本删除异常:" + deletePartRevisionResponse.getMsg());
// }
// String savePartRevisionURL = apiUrl + "/part/ifs/syncInventoryPartRevisionToIfs";
// ResponseData savePartRevisionResponse = HttpClientUtil.doPostByRawWithPLM(savePartRevisionURL, revision);
// if (!"200".equals(savePartRevisionResponse.getCode())) {
// throw new RuntimeException("IFS库存件版本新增异常:" + savePartRevisionResponse.getMsg());
// }
// 修改
String updatePartRevisionURL = apiUrl + "/part/ifs/modifyInventoryPartRevisionToIfs"; String updatePartRevisionURL = apiUrl + "/part/ifs/modifyInventoryPartRevisionToIfs";
ResponseData updatePartRevisionResponse = HttpClientUtil.doPostByRawWithPLM(updatePartRevisionURL, revision); ResponseData updatePartRevisionResponse = HttpClientUtil.doPostByRawWithPLM(updatePartRevisionURL, revision);
if (!"200".equals(updatePartRevisionResponse.getCode())) { if (!"200".equals(updatePartRevisionResponse.getCode())) {
@ -2243,6 +2256,15 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
}).collect(Collectors.toList()); }).collect(Collectors.toList());
partInformationMapper.savePartFile(ifsFiles); partInformationMapper.savePartFile(ifsFiles);
} }
} catch (Exception e) {
// 删除inventoryPart
String deleteInventoryPartURL = apiUrl + "/part/ifs/removeInventoryPartToIfs";
ResponseData deleteInventoryPartResponse = HttpClientUtil.doPostByRawWithPLM(deleteInventoryPartURL, partIfsInventory);
if (!"200".equals(deleteInventoryPartResponse.getCode())) {
throw new RuntimeException("IFS库存件删除异常:" + deleteInventoryPartResponse.getMsg());
}
throw new RuntimeException(e.getMessage());
}
} }
/** /**

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

@ -1416,7 +1416,7 @@
b.eng_revision b.eng_revision
FROM plm_bom_detail as a FROM plm_bom_detail as a
LEFT JOIN plm_bom_header as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level and a.bom_type = b.bom_type LEFT JOIN plm_bom_header as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level and a.bom_type = b.bom_type
WHERE a.site = #{site} and a.part_no = #{partNo} and a.bom_type = 'Manufacturing' and (b.eff_phase_out_date is null or b.eff_phase_out_date = '')
WHERE a.site = #{site} and a.part_no = #{partNo} and a.bom_type = 'Manufacturing' and b.eff_phase_out_date <![CDATA[>=]]> getDate()
</select> </select>
<!-- 查询Routing替代 --> <!-- 查询Routing替代 -->

Loading…
Cancel
Save