Merge remote-tracking branch 'origin/main'

# Conflicts:
#	XG_Project1/src/main/java/com/xisc/pm/api/controller/v1/SubController.java
main
sunhao 2 weeks ago
commit a8aacbd692

@ -3,6 +3,7 @@ package com.xisc.pm.api.controller.v1;
import com.google.common.collect.Maps;
import com.google.ortools.Loader;
import com.xisc.pm.api.dto.PmPdRecDTO;
import com.xisc.pm.api.dto.PmProContFilterResposeDTO;
import com.xisc.pm.api.dto.PmProductionPlanReqDTO;
import com.xisc.pm.api.dto.QdMatchParamDTO;
import com.xisc.pm.api.dto.QdSurplusLowMagnificationDTO;
@ -567,6 +568,7 @@ public class SubController {
//初始化方案
Loader.loadNativeLibraries();
// System.load("E:/XTGT/ortools-win32-x86-64-9.7.2996/ortools-win32-x86-64/jniortools.dll");
// 创建多个任务
List<Callable<Void>> tasks = new ArrayList<>();
@ -883,34 +885,20 @@ public class SubController {
//压缩比 Compression ratio
//宽展比 Wide ratio
//GCG.getLtInfoGPreOrder().stream().filter(e->e.)
//最大宽度
//钢种标准对比
//产线相同的
if (!SInfo.getMscLineNo().equals(e.getLine()))
{
return;
}
GCalGrp GCG = new GCalGrp();
GCG.setLtInfoGPreOrder(new CopyOnWriteArrayList<>());
e.getLtInfoGPreOrder().forEach(f -> {
try {
// if (f.getOrderNo().equals("52500095215") ) {
////
//// logger.info("52500095215");
//// }
// if (f.getOrderNo().equals("52500096023") ) {
//
// logger.info("52500096023");
// }
try {
//同钢种判断
if (!SInfo.getStNo().equals(f.getInfoPmContMscTechDO().getStNo()))
{
@ -1467,9 +1455,9 @@ public class SubController {
ltLrc = plistQdToLineupResultCheDO.stream().filter(p -> p.getOrderNo().equals(GrpOrd.getOrderNo()) && p.getCheType().equals("RX")).collect(Collectors.toList());
}
//信息不存在返回 TODO: 化学成分订单没有要求按照正确处理
//信息不存在返回
if (ltLrc.size() == 0) {
return true;
return false;
}
List<QeTqHeatcheStandResultDO> ltQthsr = plistQeTqHeatcheStandResultDO.stream().filter(p -> p.getPono().equals(SInfo.getPono())).collect(Collectors.toList());
@ -1531,9 +1519,9 @@ public class SubController {
ltSmr = plistQeTqSlabMacroResultDO.stream().filter(p -> p.getPono().equals(SInfo.getPono())).collect(Collectors.toList());
}
//信息不存在返回 TODO: 坯料低倍委托实绩表没有要求按照正确处理
//信息不存在返回
if (ltSmr.size() == 0) {
return true;
return false;
}
//实例一个新的结果数据
List<QeTqSlabMacroResultDO> ltSmrReslt = ltSmr;
@ -1975,8 +1963,6 @@ public class SubController {
GPO.setThickTolMax(ppcpa.getThickTolMax());
// 设置订单号
GPO.setOrderNo(prPmProContDO.getOrderNo());
// 设置产线号
GPO.setLine(pcmt.getMscLineNo());
// 关联订单信息对象
GPO.setInfoPmProContDo(prPmProContDO);
// 关联订单产品属性对象
@ -2077,8 +2063,7 @@ public class SubController {
// 检查当前订单是否与已有的分组匹配
if (gltGrpOrderFir.stream().anyMatch(e -> e.getWid().equals(p.getInfoPmProContProdAttrDO().getOrderWidth()) &&
e.getThk().equals(p.getInfoPmProContProdAttrDO().getOrderThick()) &&
e.getSG_STD().equals(p.getInfoPmProContProdAttrDO().getSgStd()) &&
e.getLine().equals(p.getLine()) )) {
e.getSG_STD().equals(p.getInfoPmProContProdAttrDO().getSgStd()))) {
// 如果匹配成功,将订单添加到相应的分组中
GGrpOrderFir GGOF = gltGrpOrderFir.stream().filter(e -> e.getWid().equals(p.getInfoPmProContProdAttrDO().getOrderWidth())
@ -2099,7 +2084,7 @@ public class SubController {
GGOF.setThk(p.getInfoPmProContProdAttrDO().getOrderThick());
//GGOF.setLen(p.getInfoPmProContProdAttrDO().getOrderLen());
GGOF.setSG_STD(p.getInfoPmProContProdAttrDO().getSgStd());
GGOF.setLine(p.getLine());
GGOF.setLtInfoGPreOrder(new ArrayList<>()); // 初始化列表
GGOF.getLtInfoGPreOrder().add(p);
gltGrpOrderFir.add(GGOF);
@ -2412,24 +2397,7 @@ public class SubController {
&& e.getCombinePlateWidthFrom().compareTo(BigDecimal.valueOf(maxWidth.orElse(0) + maxAddWidth.orElse(0))) <= 0
&& e.getCombinePlateWidthTo().compareTo(BigDecimal.valueOf(maxWidth.orElse(0) + maxAddWidth.orElse(0))) >= 0
)) {
if (p.getLtInfoGPreOrder().get(0)==null)
{
}
if (p.getLtInfoGPreOrder().get(0).getInfoPmContMscTechDO()==null)
{
}
if (p.getLtInfoGPreOrder().get(0).getInfoPmContMscTechDO().getWholeHeatTreatmentType()==null)
{
}
if (p.getLtInfoGPreOrder().get(0).getInfoPmContMscTechDO().getWholeHeatTreatmentType()!=null &&
p.getLtInfoGPreOrder().get(0).getInfoPmContMscTechDO().getWholeHeatTreatmentType().contains("Q")) {
if (p.getLtInfoGPreOrder().get(0).getInfoPmContMscTechDO().getWholeHeatTreatmentType().contains("Q")) {
decThkAdd = plistPmThickAddvBtDO.stream().filter(e -> e.getMscLineNo().equals(SInfo.getMscLineNo())
&& e.getTolTypeCode().equals(strThkTolType)
// && e.getTolTypeCode().equals(p.getLtInfoGPreOrder().get(0).getInfoQdToPoOrderDO().getThkTolType())
@ -3964,6 +3932,9 @@ public class SubController {
pmPdRecDTO.setQty(BigDecimal.ZERO);
pmPdRecs.add(pmPdRecDTO);
}
//抛合同
// subService.zbCtEventRec(orderNoList, organizationId,mscLineNo,virtualSlabNo,pmSmallPltPosDOList);
}
public void SaveData(SlabInfoDO p,Long organizationId) {

@ -126,5 +126,6 @@ public interface SubService {
void SaveData(SlabInfoDO p, List<PmPdSlab> pmPdSlabDOList, List<PmPdPlateCut> pmPdPlateCutDOList, List<PmPdBlockPos> pmPdBlockPosDOList, List<PmPdContSum> pmPdContSumDOList, List<PmSmallPltPos> pmSmallPltPosDOList, List<PmCmdSlab> pmCmdSlabDOList, List<PmCmdLargePlt> pmCmdLargePltDOList, List<PmCmdCont> pmCmdContDOList, List<PmCmdSmallPlt> pmCmdSmallPltDOList, List<PmSubHis> plistpmSubHisDO, List<PmSubOrd> plistpmSubOrdDO, List<PmPdRecDTO> pmPdRecDTOList, Long organizationId);
// void SaveData(List<PmPdSlab> pmPdSlabDOList, List<PmPdPlateCut> pmPdPlateCutDOList, List<PmPdBlockPos> pmPdBlockPosDOList, List<PmPdContSum> pmPdContSumDOList, List<PmSmallPltPos> pmSmallPltPosDOList, List<PmCmdSlab> pmCmdSlabDOList, List<PmCmdLargePlt> pmCmdLargePltDOList, List<PmCmdCont> pmCmdContDOList, List<PmCmdSmallPlt> pmCmdSmallPltDOList);
}

@ -1,9 +1,10 @@
package com.xisc.pm.app.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.xisc.pm.api.dto.PmPdRecDTO;
import com.xisc.pm.api.dto.PmPdSlabSplitDTO;
import com.xisc.pm.api.dto.PmProContYieldDTO;
import com.google.common.collect.Maps;
import com.xisc.pm.api.dto.*;
import com.xisc.pm.api.dto.ctevent.ProContBoardEndDTO;
import com.xisc.pm.api.dto.ctevent.ProContOverDTO;
import com.xisc.pm.api.dto.model.*;
import com.xisc.pm.app.service.PmPdRecService;
import com.xisc.pm.app.service.strategy.PdMatTypeStrategyFactory;
@ -11,10 +12,13 @@ import com.xisc.pm.app.service.strategy.pdmattype.PdMatTypeStrategy;
import com.xisc.pm.domain.entity.*;
import com.xisc.pm.domain.repository.*;
import com.xisc.pm.domain.vo.MatStatusModifyVO;
import com.xisc.pm.infra.client.EventClient;
import com.xisc.pm.infra.client.MmEventClient;
import com.xisc.pm.infra.constant.Constants;
import com.xisc.pm.infra.constant.CtEventConstants;
import com.xisc.pm.infra.constant.PmPlateConstants;
import com.xisc.pm.infra.enums.PdEventType;
import com.xisc.pm.infra.enums.PdProdFlag;
import com.xisc.pm.infra.mapper.SubMapper;
import com.xisc.pm.app.service.SubService;
import com.xisc.pm.infra.util.BeanUtils;
@ -28,8 +32,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service
public class SubServiceImpl implements SubService {
@ -82,11 +88,17 @@ public class SubServiceImpl implements SubService {
@Autowired
private PmPdRecService pmPdRecService;
@Autowired
private PmProContRepository pmProContRepository;
@Autowired
protected EventClient eventClient;
// 获取板坯信息
@Override
public List<SlabInfoDO> getSlabInfo(SubParams subParams) {
return subMapper.getSlabInfo(subParams);
return subMapper.getSlabInfo(subParams);
}
@ -94,7 +106,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmProCont> getOrderInfo() {
return subMapper.getOrderInfo();
return subMapper.getOrderInfo();
}
@ -102,7 +114,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmProContProdTtr> getPmProCountProdAttr() {
return subMapper.getPmProCountProdAttr();
return subMapper.getPmProCountProdAttr();
}
@ -110,7 +122,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmContMscTech> getPmContMscTech() {
return subMapper.getPmContMscTech();
return subMapper.getPmContMscTech();
}
@ -118,7 +130,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmPdRuleSet> getPmPdRuleSet() {
return subMapper.getPmPdRuleSet();
return subMapper.getPmPdRuleSet();
}
@ -126,7 +138,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmPdRuleItem> getPmPdRuleItem() {
return subMapper.getPmPdRuleItem();
return subMapper.getPmPdRuleItem();
}
@ -134,7 +146,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmMinThickTolBt> getPmMinThickTolBt() {
return subMapper.getPmMinThickTolBt();
return subMapper.getPmMinThickTolBt();
}
@ -142,7 +154,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmPlateSpecYieldBt> getPmPlateSpecYieldBt() {
return subMapper.getPmPlateSpecYieldBt();
return subMapper.getPmPlateSpecYieldBt();
}
@ -150,7 +162,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmStCodeBt> getPmStCodeBt() {
return subMapper.getPmStCodeBt();
return subMapper.getPmStCodeBt();
}
@ -158,7 +170,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmCutPlaceBt> getPmCutPlaceBt() {
return subMapper.getPmCutPlaceBt();
return subMapper.getPmCutPlaceBt();
}
@ -166,7 +178,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmPdConstBt> getPmPdConstBt() {
return subMapper.getPmPdConstBt();
return subMapper.getPmPdConstBt();
}
@ -174,7 +186,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmPlateCutLenBt> getPmPlateCutLenBt() {
return subMapper.getPmPlateCutLenBt();
return subMapper.getPmPlateCutLenBt();
}
@ -182,7 +194,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmPdTmpYieldBt> getPmPdTmpYieldBt() {
return subMapper.getPmPdTmpYieldBt();
return subMapper.getPmPdTmpYieldBt();
}
@ -190,7 +202,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmPlateTrimBt> getPmPlateTrimBt() {
return subMapper.getPmPlateTrimBt();
return subMapper.getPmPlateTrimBt();
}
@ -198,7 +210,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmSlabReplBt> getPmSlabReplBt() {
return subMapper.getPmSlabReplBt();
return subMapper.getPmSlabReplBt();
}
@ -206,7 +218,7 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmHeatTreatFurnaceBt> getPmHeatTreatFurnaceBt() {
return subMapper.getPmHeatTreatFurnaceBt();
return subMapper.getPmHeatTreatFurnaceBt();
}
@ -214,44 +226,44 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmSpeStAddvBt> getPmSpeStAddvBt() {
return subMapper.getPmSpeStAddvBt();
return subMapper.getPmSpeStAddvBt();
}
//合同处理成分结果数据
@Override
public List<QdToLineupResultCheDO> getQdToLineupResultChe() {
return subMapper.getQdToLineupResultChe();
return subMapper.getQdToLineupResultChe();
}
//合同处理坯料性能要求
@Override
public List<QdToLineupResultSlabphyDO> getQdToLineupResultSlabphy() {
return subMapper.getQdToLineupResultSlabphy();
return subMapper.getQdToLineupResultSlabphy();
}
//炉次工序成分代表实绩表
@Override
public List<QeTqHeatcheStandResultDO> getQeTqHeatcheStandResult(){
return subMapper.getQeTqHeatcheStandResult();
public List<QeTqHeatcheStandResultDO> getQeTqHeatcheStandResult() {
return subMapper.getQeTqHeatcheStandResult();
}
//炉次待委托表
@Override
public List<QeTqPonoWaitTestDO> getQeTqPonoWaitTest(){
return subMapper.getQeTqPonoWaitTest();
public List<QeTqPonoWaitTestDO> getQeTqPonoWaitTest() {
return subMapper.getQeTqPonoWaitTest();
}
//坯料低倍委托实绩表
@Override
public List<QeTqSlabMacroResultDO> getQeTqSlabMacroResult(){
return subMapper.getQeTqSlabMacroResult();
public List<QeTqSlabMacroResultDO> getQeTqSlabMacroResult() {
return subMapper.getQeTqSlabMacroResult();
}
//连铸板坯生产规格基准表
@Override
public List<PmSlabSpecBt> getPmSlabSpecBt(){
return subMapper.getPmSlabSpecBt();
public List<PmSlabSpecBt> getPmSlabSpecBt() {
return subMapper.getPmSlabSpecBt();
}
@Override
@ -276,37 +288,37 @@ public class SubServiceImpl implements SubService {
@Override
public List<PmIrsubableCont> getPmIrsubableCont() {
return subMapper.getPmIrsubableCont();
return subMapper.getPmIrsubableCont();
}
@Override
public List<PmIrsubableSlab> getPmIrsubableSlab() {
return subMapper.getPmIrsubableSlab();
return subMapper.getPmIrsubableSlab();
}
@Override
public List<PmAutoSubSetting> getPmAutoSubSetting() {
return subMapper.getPmAutoSubSetting();
return subMapper.getPmAutoSubSetting();
}
@Override
public List<PmRetainSt> getPmRetainSt() {
return subMapper.getPmRetainSt();
return subMapper.getPmRetainSt();
}
@Override
public List<PmRetainStack> getPmRetainStack() {
return subMapper.getPmRetainStack();
return subMapper.getPmRetainStack();
}
@Override
public List<PmPdSlabInfo> getPmPdSlabInfo(SubParams subParams) {
return subMapper.getPmPdSlabInfo(subParams);
return subMapper.getPmPdSlabInfo(subParams);
}
@Override
public List<QdToPoOrder> getQdToPoOrder() {
return subMapper.getQdToPoOrder();
return subMapper.getQdToPoOrder();
}
@ -418,112 +430,198 @@ public class SubServiceImpl implements SubService {
@Override
public String GetMaxSeq(String pono) {
return subMapper.GetMaxSeq(pono);
return subMapper.GetMaxSeq(pono);
}
@Override
public List<PmThickAddvBt> getPmThickAddvBt() {
return subMapper.getPmThickAddvBt();
return subMapper.getPmThickAddvBt();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void SaveData(SlabInfoDO p,List<PmPdSlab> pmPdSlabDOList, List<PmPdPlateCut> pmPdPlateCutDOList, List<PmPdBlockPos> pmPdBlockPosDOList, List<PmPdContSum> pmPdContSumDOList, List<PmSmallPltPos> pmSmallPltPosDOList, List<PmCmdSlab> pmCmdSlabDOList, List<PmCmdLargePlt> pmCmdLargePltDOList, List<PmCmdCont> pmCmdContDOList, List<PmCmdSmallPlt> pmCmdSmallPltDOList, List<PmSubHis> plistpmSubHisDO, List<PmSubOrd> plistpmSubOrdDO, List<PmPdRecDTO> pmPdRecDTOList, Long organizationId) {
// 调用mm接口
// 查询MM_SLAB 信息获取板坯信息
PmPdSlabSplitDTO pmPdSlabSplitDTO = pmPdSlabRepository.selectMmSlabBySlabId(p.getSlabId(),p.getTenantId());
// 查询板坯信息表。第一次查询可能无值
PmPdSlabInfo pmPdSlabInfo = pmPdSlabInfoRepository.selectBySlabNo(p.getSlabNo(), p.getTenantId());
if (pmPdSlabInfo == null) {
pmPdSlabInfo = buildPmPdSlabInfo(pmPdSlabSplitDTO , p.getSlabNo() , p.getMscLineNo() , p.getTenantId());
pmPdSlabInfoRepository.insertSelective(pmPdSlabInfo);
System.out.println("pmPdSlabInfo表 保存成功");
// 轧钢模块“在制品材料管理封锁事件接口"
callMatStatusModify(pmPdSlabInfo);
System.out.println("mm模块接口 调用成功");
}
public void SaveData(SlabInfoDO p, List<PmPdSlab> pmPdSlabDOList, List<PmPdPlateCut> pmPdPlateCutDOList, List<PmPdBlockPos> pmPdBlockPosDOList, List<PmPdContSum> pmPdContSumDOList, List<PmSmallPltPos> pmSmallPltPosDOList, List<PmCmdSlab> pmCmdSlabDOList, List<PmCmdLargePlt> pmCmdLargePltDOList, List<PmCmdCont> pmCmdContDOList, List<PmCmdSmallPlt> pmCmdSmallPltDOList, List<PmSubHis> plistpmSubHisDO, List<PmSubOrd> plistpmSubOrdDO, List<PmPdRecDTO> pmPdRecDTOList, Long organizationId) {
//抛合同事件
String bizId = pmPdRecDTOList.get(0).getKeyvalue1();
String key = String.format(PmPlateConstants.YIELD_EXEC_LOCK_KEY, organizationId.toString() , bizId);
if(redisHelper.hasKey(key)) {
String key = String.format(PmPlateConstants.YIELD_EXEC_LOCK_KEY, organizationId.toString(), bizId);
if (redisHelper.hasKey(key)) {
throw new CommonException("pm.pm_pro_cont_043", bizId);
}
PdMatTypeStrategy pdMatTypeStrategy = PdMatTypeStrategyFactory.matchStrategy("S");
try {
// 抛合同组板事件
pmPdRecService.createEvent(organizationId, pmPdRecDTOList
, PdEventType.HP04, Constants.SYSTEM_PD_CODE, pdMatTypeStrategy.pdProgram());
redisHelper.strSet(key, "1", 30L, TimeUnit.SECONDS);
// 抛组板履历事件
List<PmPdRecDTO> pmPdRecs = new ArrayList<>();
CustomUserDetails userDetails = DetailsHelper.getUserDetails();
for (PmPdContSum contSum : pmPdContSumDOList) {
PmPdRecDTO pmPdRecDTO = new PmPdRecDTO();
pmPdRecDTO.setOrderNo(contSum.getOrderNo());
pmPdRecDTO.setEventMaker(userDetails == null ? "" : userDetails.getUserId().toString());
pmPdRecDTO.setMscLineNo(pmPdRecDTOList.get(0).getMscLineNo());
pmPdRecDTO.setKeyvalue1(bizId);
pmPdRecDTO.setKeyvalue1Desc(PmPdRecDTO.DESC_VIRTUAL_SLAB_NO);
pmPdRecDTO.setMatNo(bizId);
pmPdRecDTO.setQty(contSum.getOrderPlateNum());
pmPdRecs.add(pmPdRecDTO);
}
pmPdRecService.createEvent(organizationId, pmPdRecs, PdEventType.HP10,
Constants.SYSTEM_PD_CODE, "余材板坯组板");
System.out.println("抛合同组板事件 执行成功");
// 抛合同
} finally {
// 抛合同组板释放事件
pmPdRecService.createEvent(organizationId, pmPdRecDTOList
, PdEventType.HP05, Constants.SYSTEM_PD_CODE, pdMatTypeStrategy.pdProgram());
redisHelper.delKey(key);
}
//抛合同事件
if(plistpmSubHisDO.size() > 0){
if (plistpmSubHisDO.size() > 0) {
pmSubHisRepository.batchInsertSelective(plistpmSubHisDO);
System.out.println("pmSubHis表 保存成功");
}
if(plistpmSubOrdDO.size() > 0){
if (plistpmSubOrdDO.size() > 0) {
pmSubOrdRepository.batchInsertSelective(plistpmSubOrdDO);
System.out.println("pmSubOrd表 保存成功");
}
//
if(pmPdSlabDOList.size()>0){
if (pmPdSlabDOList.size() > 0) {
pmPdSlabRepository.batchInsertSelective(pmPdSlabDOList);
System.out.println("PmPdSlab表 保存成功");
}
if(pmPdPlateCutDOList.size()>0){
if (pmPdPlateCutDOList.size() > 0) {
pmPdPlateCutRepository.batchInsertSelective(pmPdPlateCutDOList);
System.out.println("PmPdPlateCut 大板粗切位置 保存成功");
}
if(pmPdBlockPosDOList.size()>0){
if (pmPdBlockPosDOList.size() > 0) {
pmPdBlockPosRepository.batchInsertSelective(pmPdBlockPosDOList);
System.out.println("PmPdBlockPos 组合子板位置表 保存成功");
}
if(pmPdContSumDOList.size()>0){
if (pmPdContSumDOList.size() > 0) {
pmPdContSumRepository.batchInsertSelective(pmPdContSumDOList);
System.out.println("PmPdContSum 合同总量表 保存成功");
}
if(pmSmallPltPosDOList.size()>0){
if (pmSmallPltPosDOList.size() > 0) {
pmSmallPltPosRepository.batchInsertSelective(pmSmallPltPosDOList);
System.out.println("PmSmallPltPos 命令小板位置表 保存成功");
}
if(pmCmdSlabDOList.size()>0){
if (pmCmdSlabDOList.size() > 0) {
pmCmdSlabRepository.batchInsertSelective(pmCmdSlabDOList);
System.out.println("PmCmdSlab 保存成功");
}
if(pmCmdLargePltDOList.size()>0){
if (pmCmdLargePltDOList.size() > 0) {
pmCmdLargePltRepository.batchInsertSelective(pmCmdLargePltDOList);
System.out.println("pmCmdLargePltDO 命令大板 保存成功");
}
if(pmCmdContDOList.size()>0){
if (pmCmdContDOList.size() > 0) {
pmCmdContRepository.batchInsertSelective(pmCmdContDOList);
System.out.println("PmCmdCont 命令参数 保存成功");
}
if(pmCmdSmallPltDOList.size()>0){
if (pmCmdSmallPltDOList.size() > 0) {
pmCmdSmallPltRepository.batchInsertSelective(pmCmdSmallPltDOList);
System.out.println("PmCmdSmallPlt 命令小板表 保存成功");
}
// 调用mm接口
// 查询MM_SLAB 信息获取板坯信息
PmPdSlabSplitDTO pmPdSlabSplitDTO = pmPdSlabRepository.selectMmSlabBySlabId(p.getSlabId(), p.getTenantId());
// 查询板坯信息表。第一次查询可能无值
PmPdSlabInfo pmPdSlabInfo = pmPdSlabInfoRepository.selectBySlabNo(p.getSlabNo(), p.getTenantId());
pmPdSlabInfo = buildPmPdSlabInfo(pmPdSlabSplitDTO, p.getSlabNo(), p.getMscLineNo(), p.getTenantId());
pmPdSlabInfoRepository.insertSelective(pmPdSlabInfo);
System.out.println("pmPdSlabInfo表 保存成功");
//抛合同
zbCtEventRec(organizationId, pmPdSlabDOList, pmCmdLargePltDOList, pmCmdSlabDOList, pmSmallPltPosDOList);
System.out.println("抛合同事件完成");
// 轧钢模块“在制品材料管理封锁事件接口"
callMatStatusModify(pmPdSlabInfo);
System.out.println("mm模块接口 调用成功");
System.out.println("程序执行完成!");
}
public void zbCtEventRec(Long organizationId, List<PmPdSlab> pmPdSlabDOList, List<PmCmdLargePlt> pmCmdLargePltDOList, List<PmCmdSlab> pmCmdSlabDOList, List<PmSmallPltPos> pmSmallPltPosDOList) {
for (PmPdSlab pmPdSlab : pmPdSlabDOList) {
List<PmSmallPltPos> smallPltPosList = pmSmallPltPosDOList.stream()
.filter(p -> p.getPdMatNo().equals(pmPdSlab.getVirtualSlabNo()))
.collect(Collectors.toList());
List<PmCmdLargePlt> largePltList = pmCmdLargePltDOList.stream()
.filter(p -> p.getPonoSlabNo().equals(pmPdSlab.getVirtualSlabNo()))
.collect(Collectors.toList());
List<PmCmdSlab> slabList = pmCmdSlabDOList.stream()
.filter(p -> p.getVirtualSlabNo().equals(pmPdSlab.getVirtualSlabNo()))
.collect(Collectors.toList());
List<String> orderNoList = smallPltPosList.stream().map(p -> p.getOrderNo()).collect(Collectors.toList());
Map<String, PmProContFilterResposeDTO> filterOrderMap = pmProContRepository.orderFilterMap(orderNoList, organizationId, pmPdSlab.getMscLineNo());
List<ProContBoardEndDTO> boardEndEventList = new ArrayList<>();
PmProContFilterResposeDTO axisPmProCont = filterOrderMap.get(orderNoList.get(0));
// 虚拟板坯维度
boardEndEventList.add(new ProContBoardEndDTO(axisPmProCont.getOrderNo()).setMatNo(pmPdSlab.getVirtualSlabNo())
.setLen(pmPdSlab.getPreCleanSlabLen()).setMoMatNo(null)
.setMscLineNo(pmPdSlab.getMscLineNo())
.setPdMatStatus(Constants.PdStatusHp.PD_STATUS_HP_12).setPpFlag(PdProdFlag.VIRTUAL_SLAB.getCode())
.setThk(slabList.get(0).getMoldThick())
.setWid(slabList.get(0).getMoldWid())
.setWgt(pmPdSlab.getPreCleanSlabWt())
.setWholeBacklogCode(axisPmProCont.getWholeBacklogCode())
.setStNo(axisPmProCont.getStNo())
.setSgSign(axisPmProCont.getSgSign())
.setProcCd(Constants.ProdcCd.CD_13B));
BigDecimal weight = largePltList.get(0).getRollAimLen().multiply(largePltList.get(0).getRollAimThick()).multiply(largePltList.get(0).getRollAimWidth()).multiply(new BigDecimal(7.85)).divide(new BigDecimal(1000000000), PmPlateConstants.WT_SCALE, RoundingMode.HALF_UP);
// 大板维度
boardEndEventList.add(new ProContBoardEndDTO(axisPmProCont.getOrderNo()).setMatNo(pmPdSlab.getVirtualSlabNo())
.setLen(largePltList.get(0).getRollAimLen()).setMoMatNo(null)
.setMscLineNo(pmPdSlab.getMscLineNo())
.setPdMatStatus(Constants.PdStatusHp.PD_STATUS_HP_12).setPpFlag(PdProdFlag.VIRTUAL_COMPOSITE_SLAB.getCode())
.setThk(largePltList.get(0).getRollAimThick())
.setWid(largePltList.get(0).getRollAimWidth())
.setWgt(weight)
.setWholeBacklogCode(axisPmProCont.getWholeBacklogCode())
.setStNo(axisPmProCont.getStNo())
.setSgSign(axisPmProCont.getSgSign())
.setProcCd(Constants.ProdcCd.CD_13B));
for (PmSmallPltPos pmSmallPltPos : pmSmallPltPosDOList) {
PmProContFilterResposeDTO pmProContFilterResposeDTO = filterOrderMap.get(pmSmallPltPos.getOrderNo());
// 小板维度
boardEndEventList
.add(new ProContBoardEndDTO(pmSmallPltPos.getOrderNo()).setMatNo(pmPdSlab.getVirtualSlabNo() + pmSmallPltPos.getSmallPlateDivNo())
.setLen(pmSmallPltPos.getOrderLen()).setMoMatNo(pmSmallPltPos.getPdMatNo())
.setMscLineNo(pmPdSlab.getMscLineNo())
.setPdMatStatus(Constants.PdStatusHp.PD_STATUS_HP_12).setPpFlag(PdProdFlag.SMALL_POS_VIRTUAL_SLAB.getCode())
.setThk(pmSmallPltPos.getOrderThick()).setWid(pmSmallPltPos.getOrderWidth())
.setWgt(pmProContFilterResposeDTO.getOrderUnitAimWt())
.setWholeBacklogCode(axisPmProCont.getWholeBacklogCode())
.setStNo(pmProContFilterResposeDTO.getStNo())
.setSgSign(pmProContFilterResposeDTO.getSgSign())
.setProcCd(Constants.ProdcCd.CD_13B));
}
eventClient.addEvent(CtEventConstants.PM_CONTRACT_RESIDUE_BOARD_END, boardEndEventList);
eventClient.sendEvent(organizationId);
System.out.println("抛合同接口 执行成功");
}
}
/**
*
*
* @param pmPdSlabSplitDTO
* @return
*/
private PmPdSlabInfo buildPmPdSlabInfo(PmPdSlabSplitDTO pmPdSlabSplitDTO , String slabNo , String mscLineNo , Long tenantId) {
private PmPdSlabInfo buildPmPdSlabInfo(PmPdSlabSplitDTO pmPdSlabSplitDTO, String slabNo, String mscLineNo, Long tenantId) {
PmPdSlabInfo pmPdSlabInfo = BeanUtils.copy(pmPdSlabSplitDTO, PmPdSlabInfo.class);
pmPdSlabInfo.setOuBacklogCode("3");
pmPdSlabInfo.setOuBacklogSeq(13L);
@ -547,7 +645,7 @@ public class SubServiceImpl implements SubService {
pmPdSlabInfo.setTenantId(tenantId);
// 若MAT_NO首位为G或第三位为5则为A否则为1
String matNo = pmPdSlabSplitDTO.getSlabNo();
if(matNo.charAt(0) == 'G' || matNo.charAt(2) == '5') {
if (matNo.charAt(0) == 'G' || matNo.charAt(2) == '5') {
pmPdSlabInfo.setCcType("A");
} else {
pmPdSlabInfo.setCcType(Constants.CcType.TYPE_1);
@ -573,7 +671,7 @@ public class SubServiceImpl implements SubService {
informationMap.put("holdMaker", DetailsHelper.getUserDetails().getUserId());
informationMap.put("plateLockRegion", "Q77");
matStatusModifyVO.setMatInformationString(JSONObject.toJSONString(informationMap));
mmEventClient.matStatusModify(pmPdSlabInfo.getTenantId(), Constants.EventCode.MM_PM_PROD_MANAGEMENT_BLOCKED_IN_PROCESS_MATERIAL,matStatusModifyVO);
mmEventClient.matStatusModify(pmPdSlabInfo.getTenantId(), Constants.EventCode.MM_PM_PROD_MANAGEMENT_BLOCKED_IN_PROCESS_MATERIAL, matStatusModifyVO);
}

Loading…
Cancel
Save