|
|
|
@ -42,6 +42,7 @@ import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class MasterPartInformationServiceImpl extends ServiceImpl<MasterPartInformationMapper, MasterPartInformationEntity> implements MasterPartInformationService { |
|
|
|
@ -161,28 +162,6 @@ public class MasterPartInformationServiceImpl extends ServiceImpl<MasterPartInfo |
|
|
|
throw new XJException(msg, Integer.parseInt(code)); |
|
|
|
} |
|
|
|
masterPartInformationMapper.insert(data); |
|
|
|
|
|
|
|
if (dataUrl) { // 正式库 |
|
|
|
// 同步ifs |
|
|
|
PartIfsCatalog partIfsCatalog = getPartIfsCatalog(data); |
|
|
|
// 判断ifs是否已存在物料件 |
|
|
|
String queryURL = apiUrl + "/part/ifs/getPartCatalog"; |
|
|
|
ResponseData queryResponse = HttpClientUtil.doPostByRawWithPLM(queryURL, partIfsCatalog); |
|
|
|
if ("200".equals(queryResponse.getCode())) { // 物料件已存在,调用修改接口 |
|
|
|
String updateURL = apiUrl + "/part/ifs/modifyPartCatalogToIfs"; |
|
|
|
ResponseData updateResponse = HttpClientUtil.doPostByRawWithPLM(updateURL, partIfsCatalog); |
|
|
|
if (!"200".equals(updateResponse.getCode())) { |
|
|
|
throw new RuntimeException("ifs 物料件异常信息:" + updateResponse.getMsg()); |
|
|
|
} |
|
|
|
} else { // 调用新增接口 |
|
|
|
String addURL = apiUrl + "/part/ifs/syncPartCatalogToIfs"; |
|
|
|
ResponseData addResponse = HttpClientUtil.doPostByRawWithPLM(addURL, partIfsCatalog); |
|
|
|
if (!"200".equals(addResponse.getCode())) { |
|
|
|
throw new RuntimeException("ifs 物料件异常信息:" + addResponse.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -244,34 +223,42 @@ public class MasterPartInformationServiceImpl extends ServiceImpl<MasterPartInfo |
|
|
|
List<PartInformationEntity> partList = partInformationMapper.selectList(new QueryWrapper<PartInformationEntity>().eq("part_no", data.getPartNo())); |
|
|
|
if (!partList.isEmpty()) { |
|
|
|
masterPartInformationMapper.updateWeightAndVolume(data); |
|
|
|
// // 判断是否有正式inventoryPart |
|
|
|
// List<PartInformationEntity> collect = partList.stream().filter(x -> "Y".equals(x.getStatus())).collect(Collectors.toList()); |
|
|
|
// if (!collect.isEmpty()) { |
|
|
|
// |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
if (dataUrl) { // 正式库 |
|
|
|
// 同步ifs |
|
|
|
// 修改物料件 |
|
|
|
PartIfsCatalog partIfsCatalog = getPartIfsCatalog(data); |
|
|
|
String updateURL = apiUrl + "/part/ifs/modifyPartCatalogToIfs"; |
|
|
|
ResponseData updateResponse = HttpClientUtil.doPostByRawWithPLM(updateURL, partIfsCatalog); |
|
|
|
if (!"200".equals(updateResponse.getCode())) { |
|
|
|
throw new RuntimeException("ifs 物料件异常信息:" + updateResponse.getMsg()); |
|
|
|
} |
|
|
|
// 修改库存件的体积和净重 |
|
|
|
for (PartInformationEntity partData : partList) { |
|
|
|
if ("Y".equals(partData.getStatus())) { // 正式物料,调用库存件的修改接口 |
|
|
|
PartIfsInventory partIfsInventory = getPartIfsInventory(partData); |
|
|
|
partIfsInventory.setWeightNet(data.getWeightNet().toString()); |
|
|
|
partIfsInventory.setUomForWeightNet(data.getUomForWeightNet()); |
|
|
|
partIfsInventory.setVolumeNet(data.getVolumeNet().toString()); |
|
|
|
partIfsInventory.setUomForVolumeNet(data.getUomForVolumeNet()); |
|
|
|
String inventoryPartUpdateURL = apiUrl + "/part/ifs/syncInventoryPartToIfs"; |
|
|
|
ResponseData inventoryPartUpdateResponse = HttpClientUtil.doPostByRawWithPLM(inventoryPartUpdateURL, partIfsInventory); |
|
|
|
if (!"200".equals(inventoryPartUpdateResponse.getCode())) { |
|
|
|
throw new RuntimeException("ifs 物料件异常信息:" + updateResponse.getMsg()); |
|
|
|
} |
|
|
|
// 判断是否为正式物料 |
|
|
|
MasterPartInformationEntity masterPartInformation = masterPartInformationMapper.selectOne(new QueryWrapper<MasterPartInformationEntity>().eq("part_no", data.getPartNo())); |
|
|
|
if ("Y".equals(masterPartInformation.getOfficialFlag())) { |
|
|
|
if (dataUrl) { // 正式库 |
|
|
|
// 同步ifs |
|
|
|
// 修改物料件 |
|
|
|
PartIfsCatalog partIfsCatalog = getPartIfsCatalog(data); |
|
|
|
String updateURL = apiUrl + "/part/ifs/modifyPartCatalogToIfs"; |
|
|
|
ResponseData updateResponse = HttpClientUtil.doPostByRawWithPLM(updateURL, partIfsCatalog); |
|
|
|
if (!"200".equals(updateResponse.getCode())) { |
|
|
|
throw new RuntimeException("ifs 物料件异常信息:" + updateResponse.getMsg()); |
|
|
|
} |
|
|
|
// 修改库存件的体积和净重 |
|
|
|
// for (PartInformationEntity partData : partList) { |
|
|
|
// if ("Y".equals(partData.getStatus())) { // 正式物料,调用库存件的修改接口 |
|
|
|
// PartIfsInventory partIfsInventory = getPartIfsInventory(partData); |
|
|
|
// partIfsInventory.setWeightNet(data.getWeightNet().toString()); |
|
|
|
// partIfsInventory.setUomForWeightNet(data.getUomForWeightNet()); |
|
|
|
// partIfsInventory.setVolumeNet(data.getVolumeNet().toString()); |
|
|
|
// partIfsInventory.setUomForVolumeNet(data.getUomForVolumeNet()); |
|
|
|
// String inventoryPartUpdateURL = apiUrl + "/part/ifs/syncInventoryPartToIfs"; |
|
|
|
// ResponseData inventoryPartUpdateResponse = HttpClientUtil.doPostByRawWithPLM(inventoryPartUpdateURL, partIfsInventory); |
|
|
|
// if (!"200".equals(inventoryPartUpdateResponse.getCode())) { |
|
|
|
// throw new RuntimeException("ifs 物料件异常信息:" + updateResponse.getMsg()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -416,4 +403,40 @@ public class MasterPartInformationServiceImpl extends ServiceImpl<MasterPartInfo |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 转正式物料 |
|
|
|
* @param inData |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void toBecomeOfficialMasterPart(MasterPartInformationEntity inData) { |
|
|
|
MasterPartInformationEntity masterPart = masterPartInformationMapper.selectOne(new QueryWrapper<MasterPartInformationEntity>().eq("part_no", inData.getPartNo())); |
|
|
|
if ("Y".equals(masterPart.getOfficialFlag())) { |
|
|
|
return; |
|
|
|
} |
|
|
|
// 1、正式状态改为Y |
|
|
|
inData.setOfficialFlag("Y"); |
|
|
|
masterPartInformationMapper.updatePartOfficialFlag(inData); |
|
|
|
|
|
|
|
if (dataUrl) { // 正式库 |
|
|
|
// 同步ifs |
|
|
|
PartIfsCatalog partIfsCatalog = getPartIfsCatalog(inData); |
|
|
|
// 判断ifs是否已存在物料件 |
|
|
|
String queryURL = apiUrl + "/part/ifs/getPartCatalog"; |
|
|
|
ResponseData queryResponse = HttpClientUtil.doPostByRawWithPLM(queryURL, partIfsCatalog); |
|
|
|
if ("200".equals(queryResponse.getCode())) { // 物料件已存在,调用修改接口 |
|
|
|
String updateURL = apiUrl + "/part/ifs/modifyPartCatalogToIfs"; |
|
|
|
ResponseData updateResponse = HttpClientUtil.doPostByRawWithPLM(updateURL, partIfsCatalog); |
|
|
|
if (!"200".equals(updateResponse.getCode())) { |
|
|
|
throw new RuntimeException("ifs 物料件异常信息:" + updateResponse.getMsg()); |
|
|
|
} |
|
|
|
} else { // 调用新增接口 |
|
|
|
String addURL = apiUrl + "/part/ifs/syncPartCatalogToIfs"; |
|
|
|
ResponseData addResponse = HttpClientUtil.doPostByRawWithPLM(addURL, partIfsCatalog); |
|
|
|
if (!"200".equals(addResponse.getCode())) { |
|
|
|
throw new RuntimeException("ifs 物料件异常信息:" + addResponse.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |