|
|
@ -12,6 +12,8 @@ import com.spring.common.utils.PageUtils; |
|
|
import com.spring.ifs.api.IfsServer; |
|
|
import com.spring.ifs.api.IfsServer; |
|
|
import com.spring.ifs.bean.BomServiceBean; |
|
|
import com.spring.ifs.bean.BomServiceBean; |
|
|
import com.spring.ifs.bean.RecipeServiceBean; |
|
|
import com.spring.ifs.bean.RecipeServiceBean; |
|
|
|
|
|
import com.spring.ifs.bean.InventoryServiceBean; |
|
|
|
|
|
import com.spring.ifs.data.CopyBomStructureData; |
|
|
import com.spring.modules.base.utils.DataUtils; |
|
|
import com.spring.modules.base.utils.DataUtils; |
|
|
import com.spring.modules.base.utils.HttpClientUtil; |
|
|
import com.spring.modules.base.utils.HttpClientUtil; |
|
|
import com.spring.modules.base.utils.ResponseData; |
|
|
import com.spring.modules.base.utils.ResponseData; |
|
|
@ -48,6 +50,8 @@ public class RecipeManagementServiceImpl extends ServiceImpl<RecipeManagementMap |
|
|
@Autowired |
|
|
@Autowired |
|
|
private PartInformationMapper partInformationMapper; |
|
|
private PartInformationMapper partInformationMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
|
|
|
private com.spring.modules.part.mapper.BomManagementMapper bomManagementMapper; |
|
|
|
|
|
@Autowired |
|
|
private ProcedureDao procedureDao; |
|
|
private ProcedureDao procedureDao; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IfsServer ifsServer; |
|
|
private IfsServer ifsServer; |
|
|
@ -968,6 +972,16 @@ public class RecipeManagementServiceImpl extends ServiceImpl<RecipeManagementMap |
|
|
if (!"Manufactured Recipe".equals(partInformationEntity.getPartType())) { |
|
|
if (!"Manufactured Recipe".equals(partInformationEntity.getPartType())) { |
|
|
throw new RuntimeException("该物料类型不支持创建Recipe!"); |
|
|
throw new RuntimeException("该物料类型不支持创建Recipe!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 判断是否同步IFS |
|
|
|
|
|
PartInformationEntity fromPartInfo = partInformationMapper.selectOne(new QueryWrapper<PartInformationEntity>().eq("site", data.getPreviousVersion().getSite()).eq("part_no", data.getPreviousVersion().getPartNo())); |
|
|
|
|
|
boolean isFromPartFormal = fromPartInfo != null && "Y".equals(fromPartInfo.getStatus()); |
|
|
|
|
|
boolean isToPartFormal = "Y".equals(partInformationEntity.getStatus()); |
|
|
|
|
|
boolean callIfsCopy = isFromPartFormal && isToPartFormal; |
|
|
|
|
|
|
|
|
|
|
|
if (callIfsCopy) { |
|
|
|
|
|
data.setOfficialFlag("Y"); |
|
|
|
|
|
} |
|
|
// 1、创建recipeHeader |
|
|
// 1、创建recipeHeader |
|
|
RecipeHeaderEntity header = recipeManagementMapper.queryRecipeHeader(data.getPreviousVersion()); |
|
|
RecipeHeaderEntity header = recipeManagementMapper.queryRecipeHeader(data.getPreviousVersion()); |
|
|
data.setNoteText(header.getNoteText()); |
|
|
data.setNoteText(header.getNoteText()); |
|
|
@ -1030,8 +1044,13 @@ public class RecipeManagementServiceImpl extends ServiceImpl<RecipeManagementMap |
|
|
detailEntity.setPartNo(data.getPartNo()); |
|
|
detailEntity.setPartNo(data.getPartNo()); |
|
|
detailEntity.setBomType(data.getBomType()); |
|
|
detailEntity.setBomType(data.getBomType()); |
|
|
detailEntity.setEngChgLevel(data.getEngChgLevel()); |
|
|
detailEntity.setEngChgLevel(data.getEngChgLevel()); |
|
|
detailEntity.setOfficialFlag("N"); |
|
|
|
|
|
detailEntity.setStatus("Tentative"); |
|
|
|
|
|
|
|
|
if (callIfsCopy) { |
|
|
|
|
|
detailEntity.setOfficialFlag("Y"); |
|
|
|
|
|
detailEntity.setStatus("Tentative"); |
|
|
|
|
|
} else { |
|
|
|
|
|
detailEntity.setOfficialFlag("N"); |
|
|
|
|
|
detailEntity.setStatus("Tentative"); |
|
|
|
|
|
} |
|
|
recipeManagementMapper.recipeDetailSave(detailEntity); |
|
|
recipeManagementMapper.recipeDetailSave(detailEntity); |
|
|
// 创建recipeComponent |
|
|
// 创建recipeComponent |
|
|
if (!componentDataList.isEmpty()) { |
|
|
if (!componentDataList.isEmpty()) { |
|
|
@ -1054,6 +1073,38 @@ public class RecipeManagementServiceImpl extends ServiceImpl<RecipeManagementMap |
|
|
recipeManagementMapper.saveRecipeManufStructCostDistrib(collect1); |
|
|
recipeManagementMapper.saveRecipeManufStructCostDistrib(collect1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 3、调用IFS复制接口 |
|
|
|
|
|
if (callIfsCopy && dataUrl) { |
|
|
|
|
|
Server srv = getIfsServer(data.getCreateBy()); |
|
|
|
|
|
// 3.2 调用复制接口 |
|
|
|
|
|
java.text.SimpleDateFormat ifsDateFormat = new java.text.SimpleDateFormat("dd-MMM-yyyy", java.util.Locale.ENGLISH); |
|
|
|
|
|
for (RecipeDetailEntity detailEntity : detailDataList) { |
|
|
|
|
|
CopyBomStructureData copyData = new CopyBomStructureData(); |
|
|
|
|
|
copyData.setFromContract(data.getPreviousVersion().getSite()); |
|
|
|
|
|
copyData.setFromPartNo(data.getPreviousVersion().getPartNo()); |
|
|
|
|
|
copyData.setFromEngChgLevel(data.getPreviousVersion().getEngChgLevel().toString()); |
|
|
|
|
|
copyData.setFromBomType(data.getPreviousVersion().getBomType()); |
|
|
|
|
|
copyData.setFromAlternativeNo(detailEntity.getAlternativeNo()); |
|
|
|
|
|
copyData.setToContract(data.getSite()); |
|
|
|
|
|
copyData.setToPartNo(data.getPartNo()); |
|
|
|
|
|
copyData.setToEngChgLevel(data.getEngChgLevel().toString()); |
|
|
|
|
|
copyData.setToBomType(data.getBomType()); |
|
|
|
|
|
copyData.setToAlternativeNo(detailEntity.getAlternativeNo()); |
|
|
|
|
|
copyData.setToEffPhaseInDate(ifsDateFormat.format(data.getEffPhaseInDate())); |
|
|
|
|
|
copyData.setToEffPhaseOutDate(data.getEffPhaseOutDate() == null ? "" : ifsDateFormat.format(data.getEffPhaseOutDate())); |
|
|
|
|
|
copyData.setCopyAttachDocuments("0"); |
|
|
|
|
|
try { |
|
|
|
|
|
Map<String, String> copyResult = recipeServiceBean.copyRecipeStructure(srv, copyData); |
|
|
|
|
|
if (!"200".equals(copyResult.get("resultCode"))) { |
|
|
|
|
|
throw new RuntimeException("IFS Recipe复制异常:" + copyResult.get("resultMsg")); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
throw new RuntimeException("IFS Recipe复制异常:" + e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return data; |
|
|
return data; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|