|
|
|
@ -1,5 +1,7 @@ |
|
|
|
package com.spring.modules.part.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
@ -1319,4 +1321,75 @@ public class RecipeManagementServiceImpl extends ServiceImpl<RecipeManagementMap |
|
|
|
IPage<RecipeHeaderVo> resultList = recipeManagementMapper.recipeManagementSearchAny(new Page<RecipeHeaderVo>(data.getNo(), data.getSize()), params); |
|
|
|
return new PageUtils(resultList); |
|
|
|
} |
|
|
|
|
|
|
|
// 反向同步替代下的数据 IFS->PLM |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public Map<String, Object> syncRecipeInfoIfsToPlm(RecipeDetailVo data) { |
|
|
|
Server srv = getIfsServer(data.getUpdateBy()); |
|
|
|
// 更新Recipe替代的状态 |
|
|
|
RecipeIfsAlternative recipeIfsAlternative = new RecipeIfsAlternative(); |
|
|
|
recipeIfsAlternative.setContract(data.getSite()); |
|
|
|
recipeIfsAlternative.setPartNo(data.getPartNo()); |
|
|
|
recipeIfsAlternative.setEngChgLevel(data.getEngChgLevel().toString()); |
|
|
|
recipeIfsAlternative.setBomType(data.getBomType()); |
|
|
|
recipeIfsAlternative.setAlternativeNo(data.getAlternativeNo()); |
|
|
|
Map<String, String> getAlternativeResponse = recipeServiceBean.getRecipeAlternative(srv, recipeIfsAlternative); |
|
|
|
if ("200".equals(getAlternativeResponse.get("resultCode"))) { |
|
|
|
RecipeIfsAlternative ifsAlternative = JSON.parseObject(getAlternativeResponse.get("obj"), RecipeIfsAlternative.class); |
|
|
|
if (ifsAlternative != null) { |
|
|
|
data.setStatus(ifsAlternative.getState()); |
|
|
|
recipeManagementMapper.updateAlternativeStatus(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 根据替代删除PLM的Recipe子明细 |
|
|
|
RecipeAllFieldEntity recipeAllField = new RecipeAllFieldEntity(); |
|
|
|
BeanUtils.copyProperties(data, recipeAllField); |
|
|
|
recipeManagementMapper.deleteRecipeComponent(recipeAllField); |
|
|
|
|
|
|
|
// 根据替代获取IFS的Recipe子物料 |
|
|
|
RecipeIfsItem recipeIfsItem = new RecipeIfsItem(); |
|
|
|
recipeIfsItem.setContract(data.getSite()); |
|
|
|
recipeIfsItem.setPartNo(data.getPartNo()); |
|
|
|
recipeIfsItem.setEngChgLevel(data.getEngChgLevel().toString()); |
|
|
|
recipeIfsItem.setBomType(data.getBomType()); |
|
|
|
recipeIfsItem.setAlternativeNo(data.getAlternativeNo()); |
|
|
|
Map<String, String> getRecipeItemsResponse = recipeServiceBean.getRecipeItemsForSync(srv, recipeIfsItem); |
|
|
|
if (!"200".equals(getRecipeItemsResponse.get("resultCode"))) { |
|
|
|
throw new RuntimeException("IFS Recipe子物料查询异常:" + getRecipeItemsResponse.get("resultMsg")); |
|
|
|
} |
|
|
|
|
|
|
|
String items = String.valueOf(getRecipeItemsResponse.get("obj")); |
|
|
|
List<RecipeIfsItem> ifsItems = JSON.parseArray(items, RecipeIfsItem.class); |
|
|
|
for (RecipeIfsItem ifsItem : ifsItems) { |
|
|
|
RecipeComponentEntity plmItem = new RecipeComponentEntity(); |
|
|
|
plmItem.setSite(ifsItem.getContract()); |
|
|
|
plmItem.setPartNo(ifsItem.getPartNo()); |
|
|
|
plmItem.setEngChgLevel(Integer.valueOf(ifsItem.getEngChgLevel())); |
|
|
|
plmItem.setBomType(ifsItem.getBomType()); |
|
|
|
plmItem.setAlternativeNo(ifsItem.getAlternativeNo()); |
|
|
|
plmItem.setComponentPart(ifsItem.getComponentPart()); |
|
|
|
plmItem.setLineItemNo(StringUtils.isEmpty(ifsItem.getLineItemNo()) ? null : Integer.valueOf(ifsItem.getLineItemNo())); |
|
|
|
plmItem.setPrintUnit(ifsItem.getPrintUnit()); |
|
|
|
plmItem.setQtyPerAssembly(StringUtils.isEmpty(ifsItem.getQtyPerAssembly()) ? null : new BigDecimal(ifsItem.getQtyPerAssembly())); |
|
|
|
plmItem.setComponentScrap(StringUtils.isEmpty(ifsItem.getComponentScrap()) ? null : new BigDecimal(ifsItem.getComponentScrap())); |
|
|
|
plmItem.setShrinkageFactor(StringUtils.isEmpty(ifsItem.getShrinkageFactor()) ? null : new BigDecimal(ifsItem.getShrinkageFactor())); |
|
|
|
plmItem.setIssueType(ifsItem.getIssueType()); |
|
|
|
plmItem.setIssueToLoc(""); |
|
|
|
plmItem.setOperationNo(StringUtils.isEmpty(ifsItem.getOperationNo()) ? null : Integer.valueOf(ifsItem.getOperationNo())); |
|
|
|
plmItem.setNoteText(ifsItem.getNoteText()); |
|
|
|
plmItem.setLineSequence(StringUtils.isEmpty(ifsItem.getLineSequence()) ? null : Integer.valueOf(ifsItem.getLineSequence())); |
|
|
|
plmItem.setConsumptionItem(ifsItem.getConsumptionItem()); |
|
|
|
plmItem.setPartsByWeight(StringUtils.isEmpty(ifsItem.getPartsByWeight()) ? null : new BigDecimal(ifsItem.getPartsByWeight())); |
|
|
|
plmItem.setWeightShare(StringUtils.isEmpty(ifsItem.getWeightShare()) ? null : new BigDecimal(ifsItem.getWeightShare())); |
|
|
|
plmItem.setCreateBy(data.getUpdateBy()); |
|
|
|
recipeManagementMapper.saveRecipeComponent(plmItem); |
|
|
|
} |
|
|
|
|
|
|
|
HashMap<String, Object> map = new HashMap<>(); |
|
|
|
RecipeDetailEntity recipeAlternative = recipeManagementMapper.queryDetailDataByNo(data); |
|
|
|
map.put("detailData", recipeAlternative); |
|
|
|
return map; |
|
|
|
} |
|
|
|
} |