Browse Source

2024-03-29 更新

master
fengyuan_yang 3 years ago
parent
commit
9d89926441
  1. 12
      src/main/java/com/spring/modules/part/controller/MasterPartInformationController.java
  2. 4
      src/main/java/com/spring/modules/part/entity/MasterPartInformationEntity.java
  3. 2
      src/main/java/com/spring/modules/part/mapper/MasterPartInformationMapper.java
  4. 2
      src/main/java/com/spring/modules/part/service/MasterPartInformationService.java
  5. 113
      src/main/java/com/spring/modules/part/service/impl/MasterPartInformationServiceImpl.java
  6. 24
      src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java
  7. 12
      src/main/resources/mapper/part/MasterPartInformationMapper.xml

12
src/main/java/com/spring/modules/part/controller/MasterPartInformationController.java

@ -156,4 +156,16 @@ public class MasterPartInformationController {
List<PlmPropertiesItemData> list = masterPartInformationService.getItemLists(inData);
return R.ok().put("rows", list);
}
/**
* 临时物料转为正式物料
* @param inData
* @return
*/
@PostMapping("/toBecomeOfficialMasterPart")
@ResponseBody
public R toBecomeOfficialMasterPart(@RequestBody MasterPartInformationEntity inData){
masterPartInformationService.toBecomeOfficialMasterPart(inData);
return R.ok();
}
}

4
src/main/java/com/spring/modules/part/entity/MasterPartInformationEntity.java

@ -102,4 +102,8 @@ public class MasterPartInformationEntity extends QueryPage implements Serializab
*/
@TableField(exist = false)
private List<MasterPartInformationEntity> informationList;
/**
* 正式物料标识
**/
private String officialFlag;
}

2
src/main/java/com/spring/modules/part/mapper/MasterPartInformationMapper.java

@ -29,4 +29,6 @@ public interface MasterPartInformationMapper extends BaseMapper<MasterPartInform
List<PartSubPropertiesValueData> queryCodeNo(MasterPartInformationVo data);
void updateWeightAndVolume(MasterPartInformationVo data);
void updatePartOfficialFlag(MasterPartInformationEntity inData);
}

2
src/main/java/com/spring/modules/part/service/MasterPartInformationService.java

@ -34,4 +34,6 @@ public interface MasterPartInformationService {
void deleteMasterPartItem(PartSubPropertiesValueData inData);
void commitItemValue(PartSubPropertiesValueData data);
void toBecomeOfficialMasterPart(MasterPartInformationEntity inData);
}

113
src/main/java/com/spring/modules/part/service/impl/MasterPartInformationServiceImpl.java

@ -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());
}
}
}
}
}

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

@ -242,22 +242,12 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
masterPartEntity.setPartNo(data.getPartNo());
masterPartEntity.setPartDesc(data.getPartDesc());
masterPartEntity.setUmId(data.getUmId());
masterPartEntity.setOfficialFlag("N");
masterPartEntity.setLotTrackingCode("Not Lot Tracking");
masterPartEntity.setLotQuantityRule("One Lot Per Production Order");
masterPartEntity.setSubLotRule("No Sub Lots Allowed");
masterPartEntity.setComponentLotRule("Many Lots Allowed");
masterPartInformationMapper.insert(masterPartEntity);
if (dataUrl) { // 正式库
// 同步ifs
// 物料件
PartIfsCatalog partIfsCatalog = getPartIfsCatalog(masterPartEntity);
String addMasterPartURL = apiUrl + "/part/ifs/syncPartCatalogToIfs";
ResponseData addMasterPartResponse = HttpClientUtil.doPostByRawWithPLM(addMasterPartURL, partIfsCatalog);
if (!"200".equals(addMasterPartResponse.getCode())) {
throw new RuntimeException("ifs 物料件异常信息:" + addMasterPartResponse.getMsg());
}
}
}
partInformationMapper.insert(data);
// 创建物料的默认revision
@ -342,22 +332,12 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
masterPartEntity.setPartNo(data.getPartNo());
masterPartEntity.setPartDesc(data.getPartDesc());
masterPartEntity.setUmId(data.getUmId());
masterPartEntity.setOfficialFlag("N");
masterPartEntity.setLotTrackingCode("Not Lot Tracking");
masterPartEntity.setLotQuantityRule("One Lot Per Production Order");
masterPartEntity.setSubLotRule("No Sub Lots Allowed");
masterPartEntity.setComponentLotRule("Many Lots Allowed");
masterPartInformationMapper.insert(masterPartEntity);
if (dataUrl) { // 正式库
// 同步ifs
// 物料件
PartIfsCatalog partIfsCatalog = getPartIfsCatalog(masterPartEntity);
String addMasterPartURL = apiUrl + "/part/ifs/syncPartCatalogToIfs";
ResponseData addMasterPartResponse = HttpClientUtil.doPostByRawWithPLM(addMasterPartURL, partIfsCatalog);
if (!"200".equals(addMasterPartResponse.getCode())) {
throw new RuntimeException("ifs 物料件异常信息:" + addMasterPartResponse.getMsg());
}
}
}
partInformationMapper.insert(data);
// 创建物料的默认revision

12
src/main/resources/mapper/part/MasterPartInformationMapper.xml

@ -27,7 +27,8 @@
create_date,
create_by,
update_date,
update_by
update_by,
case when official_flag = 'Y' then 'Y' else 'N' end as officialFlag
FROM part_catalog
<where>
<if test = "query.partNo != null and query.partNo != ''">
@ -82,4 +83,13 @@
uom_for_volume_net = #{uomForVolumeNet}
WHERE part_no = #{partNo}
</update>
<!-- 物料信息编辑 -->
<update id="updatePartOfficialFlag" parameterType="MasterPartInformationEntity">
UPDATE part_catalog
SET official_flag = #{officialFlag},
update_date = getDate(),
update_by = #{updateBy}
WHERE part_no = #{partNo}
</update>
</mapper>
Loading…
Cancel
Save