2025-03-25

main
sunhao 2 weeks ago
parent 4125e6fdc2
commit d3538a982a

@ -387,23 +387,27 @@ public class SubController {
//被使用的订单数据实例化
plistOrdHis = new ArrayList<>();
// int intSlabCount = 0;
//循环板坯
plistSlab.forEach(p -> {
PmSubLog subLog = new PmSubLog();
subLog.setSlabNo(p.getSlabNo());
subLog.setSubMode(finalSubMode);
subLog.setSubRslt("成功");
subLog.setTenantId(organizationId);
PmSubLog subLog = new PmSubLog();
subLog.setSlabNo(p.getSlabNo());
subLog.setSubMode(finalSubMode);
subLog.setSubRslt("成功");
subLog.setTenantId(organizationId);
String subLogStr = "";
// int intSlabCountAdd=intSlabCount;
logger.info("*************--板坯开始{}************* ", p.getSlabNo());
String subLogStr = "";
logger.info("*************板坯开始{}************* ", p.getSlabNo());
logger.info("***板坯信息:{} 厚宽长:{}*{}*{} ", p.getSlabNo(), p.getSlabActThk(), p.getSlabActWid(), p.getSlabActLen());
//执行日志保存
subLogStr = "板坯信息 厚宽长:" + p.getSlabActThk() + "*" + p.getSlabActWid() + "*" + p.getSlabActLen();
// intSlabCount++;
// 判断板坯的长度是否在plistpmAutoSubSettingDO配置的范围内
logger.info("***板坯信息:{} 厚宽长:{}*{}*{} 钢种:{} ", p.getSlabNo(), p.getSlabActThk(), p.getSlabActWid(), p.getSlabActLen(), p.getStNo());
//执行日志保存
subLogStr = "板坯信息 厚宽长:" + p.getSlabActThk() + "*" + p.getSlabActWid() + "*" + p.getSlabActLen();
// 判断板坯的长度是否在plistpmAutoSubSettingDO配置的范围内
if (p.getSlabActLen().compareTo(plistpmAutoSubSettingDO.get(0).getMatLenMin()) < 0 && p.getSlabActLen().compareTo(plistpmAutoSubSettingDO.get(0).getMatLenMax()) > 0) {
logger.info("***板坯信息被排除:{} 长度不在范围内 ", p.getSlabNo());
return;
@ -515,22 +519,22 @@ public class SubController {
}
subLog.setSubLog(subLogStr);
if (gltSelGGrpCalRslt.size() > 0) {
// now = new Date();
// //存储数据,组板结果
// SaveHisData(p);
// //数据整理
// SetSaveDate(p,organizationId);
// //开启事务
// //TransactionStatus transactionStatus = transactionService.begin();
// try {
// //保存数据
// SaveData(p,organizationId,subLog);
// //transactionService.commit(transactionStatus);
// } catch (Exception e) {
// logger.error("保存事务回滚:" + p.getSlabNo(), e);
// //回滚事务
// //transactionService.rollback(transactionStatus);
// }
now = new Date();
//存储数据,组板结果
SaveHisData(p);
//数据整理
SetSaveDate(p,organizationId);
//开启事务
//TransactionStatus transactionStatus = transactionService.begin();
try {
//保存数据
SaveData(p,organizationId,subLog);
//transactionService.commit(transactionStatus);
} catch (Exception e) {
logger.error("保存事务回滚:" + p.getSlabNo(), e);
//回滚事务
//transactionService.rollback(transactionStatus);
}
}
} catch (Exception e) {
@ -1293,39 +1297,25 @@ public class SubController {
try {
//
if (gltGCal2Grp.stream().filter(p ->
p.getLtInfoGPreOrder().stream().anyMatch(q ->
q.getLtInfoCombGPreOrder().stream().anyMatch(r ->
r.getInfoGPreOrder()!=null
&& r.getInfoGPreOrder().getOrderNo().equals(GPO1.getOrderNo()) )
&& q.getLtInfoCombGPreOrder().stream().anyMatch(r ->
r.getInfoGPreOrder()!=null
&& r.getInfoGPreOrder().getOrderNo().equals(GPO2.getOrderNo()))))
.count() > 0) {
if (gltGCal2Grp.stream().filter(p -> p.getLtInfoGPreOrder().stream().anyMatch(q -> q.getOrderNo().contains(GPO1.getOrderNo())
&& q.getOrderNo().contains(GPO2.getOrderNo())
&& (q.getOrderNo().equals(GPO1.getOrderNo() + "_" + GPO2.getOrderNo())
|| q.getOrderNo().equals(GPO2.getOrderNo() + "_" + GPO1.getOrderNo())))
).count() > 0) {
try {
if (gltGCal2Grp.stream().filter(p ->
p.getLtInfoGPreOrder().stream().anyMatch(q ->
q.getLtInfoCombGPreOrder().stream().anyMatch(r ->
r.getInfoGPreOrder()!=null && r.getInfoGPreOrder().getIDValue()==GPO1.getIDValue())
|| q.getLtInfoCombGPreOrder().stream().anyMatch(r ->
r.getInfoGPreOrder()!=null && r.getInfoGPreOrder().getIDValue()==GPO2.getIDValue()))).count()== 0) {
Optional<GCalGrp> GCG = gltGCal2Grp.stream().filter(p ->
p.getLtInfoGPreOrder().stream().anyMatch(q ->
q.getLtInfoCombGPreOrder().stream().anyMatch(r ->
r.getInfoGPreOrder()!=null && r.getInfoGPreOrder().getOrderNo().equals(GPO1.getOrderNo()))
&& q.getLtInfoCombGPreOrder().stream().anyMatch(r ->
r.getInfoGPreOrder()!=null && r.getInfoGPreOrder().getOrderNo().equals(GPO2.getOrderNo())))).collect(Collectors.toList()).stream().findFirst();
GCG.ifPresent(gcg -> {
gcg.getLtInfoGPreOrder().add(GPO);
});
}
Optional<GCalGrp> GCG = gltGCal2Grp.stream().filter(p -> p.getLtInfoGPreOrder().stream().anyMatch(q -> q.getOrderNo().contains(GPO1.getOrderNo())
&& q.getOrderNo().contains(GPO2.getOrderNo())
&& (q.getOrderNo().equals(GPO1.getOrderNo() + "_" + GPO2.getOrderNo())
|| q.getOrderNo().equals(GPO2.getOrderNo() + "_" + GPO1.getOrderNo())))).collect(Collectors.toList()).stream().findFirst();
} catch (Exception ex) {
GCG.ifPresent(gcg -> {
gcg.getLtInfoGPreOrder().add(GPO);
});
} catch (Exception ex) {
logger.info("添加2分组报错");
}
} else {
@ -1511,6 +1501,18 @@ public class SubController {
}
} catch (Exception ex) {
logger.info("分组处理报错:{}",ex);
logger.info("分组处理报错:{}",GPO1.getOrderNo());
logger.info("分组处理报错:{}",GPO2.getOrderNo());
gltGCal2Grp.forEach(n -> {
if (n.getLtInfoGPreOrder().size() > 0) {
n.getIDValue();
n.getLtInfoGPreOrder().forEach(g -> {
logger.info(g.getOrderNo());
});
}
});
}
});
@ -2459,10 +2461,18 @@ public class SubController {
GGCR.setThk(e.getLtInfoGPreOrder().get(0).getThk());
//最大长度
GGCR.setCal_Len(intMaxLen);
//订单信息
GGCR.setLtInfoGPreOrder(e.getLtInfoGPreOrder());
//合并订单信息
GGCR.getLtInfoGPreOrder().addAll(f.getLtInfoGPreOrder());
// 合并 e 和 f 的 LtInfoGPreOrder 列表
CopyOnWriteArrayList<GPreOrder> combinedList = new CopyOnWriteArrayList<>(e.getLtInfoGPreOrder());
combinedList.addAll(f.getLtInfoGPreOrder());
// 设置合并后的列表到 GGCR
GGCR.setLtInfoGPreOrder(combinedList);
//
// //合并订单信息
// GGCR.setLtInfoGPreOrder(e.getLtInfoGPreOrder() (f.getLtInfoGPreOrder()));
// //合并订单信息
// GGCR.getLtInfoGPreOrder().addAll();
ltTempGrp.add(GGCR);
@ -2812,6 +2822,8 @@ public class SubController {
log.error("new1", e);
}
});
logger.info("计算gltGGrpCalRslt:" + gltGGrpCalRslt.size());
//判断结果数据是否存在
if (gltGGrpCalRslt.size() == 0) {
return;

@ -447,45 +447,45 @@ public class SubServiceImpl implements SubService {
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)) {
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);
}
// //抛合同事件
// String bizId = pmPdRecDTOList.get(0).getKeyvalue1();
// 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) {

Loading…
Cancel
Save