Compare commits

...

2 Commits

Author SHA1 Message Date
sunhao c9826c3e96 2025-03-25 1 week ago
sunhao 093e7614c9 循环数量 2 weeks ago

@ -44,8 +44,8 @@ public class SubController {
@Autowired
private QdOrderClient qdOrderClient;
// @Autowired
// private TransactionService transactionService;
// @Autowired
// private TransactionService transactionService;
private final static Logger logger = LoggerFactory.getLogger(SubController.class);
@ -377,9 +377,6 @@ public class SubController {
//获取所有数据
GetDataInfo(subParams);
// //化学成分低倍验证
// chkChmAndLowApi(organizationId,);
//数据预处理
SetPreData();
@ -388,6 +385,8 @@ public class SubController {
//被使用的订单数据实例化
plistOrdHis = new ArrayList<>();
// int intSlabCount = 0;
// 使用 AtomicInteger 替代 int 类型
AtomicInteger intSlabCount = new AtomicInteger(0);
//循环板坯
plistSlab.forEach(p -> {
@ -398,10 +397,10 @@ public class SubController {
subLog.setTenantId(organizationId);
String subLogStr = "";
// int intSlabCountAdd=intSlabCount;
logger.info("*************--板坯开始{}************* ", p.getSlabNo());
// 获取当前计数值
int intSlabCountAdd = intSlabCount.getAndIncrement();
// intSlabCount++;
logger.info("*************{}--板坯开始{}************* ",intSlabCountAdd, p.getSlabNo());
logger.info("***板坯信息:{} 厚宽长:{}*{}*{} 钢种:{} ", p.getSlabNo(), p.getSlabActThk(), p.getSlabActWid(), p.getSlabActLen(), p.getStNo());
//执行日志保存
@ -443,17 +442,25 @@ public class SubController {
gltGCal2Grp = new ArrayList<>();
//低倍化学成分验证
chkChmAndLowApi(organizationId,p);
//二次分组
SetGrpDataBySlab(p);
logger.info("***一次次分组1数量*** " + gltGCalGrp.size());
//数据小的情况,计算拼板。数据量大不计算
if (gltGCalGrp.size()<=100)
{
SetGrpConBinDataBySlab(p);
}
try {
SetGrpConBinDataBySlab(p);
} catch (Exception e) {
logger.info("***二次分组1数量*** " + gltGCalGrp.size());
}
}
//
// logger.info("***二次分组1数量*** " + gltGCalGrp.size());
//执行日志保存
subLogStr += "-----二次分组1数量" + gltGCalGrp.size();
@ -964,13 +971,23 @@ public class SubController {
try {
//同钢种判断
//压缩比
if (!ChkCompress(SInfo, f)) {
return;
}
//宽展比
if (!ChkWid(SInfo, f)) {
return;
}
//同钢种判断 TODO:同钢种验证,低代高需验证效率值
if (!SInfo.getStNo().equals(f.getInfoPmContMscTechDO().getStNo()))
{
return;
}
//产线相同
//产线相同 TODO同产线不同产线需更改后续产线规则
if (!SInfo.getMscLineNo().equals(f.getInfoPmContMscTechDO().getMscLineNo())) {
return;
}
@ -1198,7 +1215,7 @@ public class SubController {
*/
public void SetGrpConBinDataBySlab(SlabInfoDO SInfo) {
//组合的分组ID+1000000
//组合的分组ID+1000000 .parallelStream()
intGrp2Num=intGrp2Num+1000000;
synchronized (gltGCal2Grp) {
gltGCalGrp.parallelStream().forEach(e -> {
@ -1296,8 +1313,23 @@ public class SubController {
ltInfoOrder.add(GPO1.getOrderNo() + "_" + GPO2.getOrderNo());
try {
//
if (gltGCal2Grp.stream().filter(p -> p.getLtInfoGPreOrder().stream().anyMatch(q -> q.getOrderNo().contains(GPO1.getOrderNo())
try {
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) {
}
} catch (Exception ex) {
return;
}
if (gltGCal2Grp.stream().filter(p ->
p.getLtInfoGPreOrder()!=null
&& p.getLtInfoGPreOrder().size()>0
&& 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())))
@ -1305,10 +1337,13 @@ public class SubController {
try {
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();
Optional<GCalGrp> GCG = gltGCal2Grp.stream().filter(p ->
p.getLtInfoGPreOrder() != null
&& p.getLtInfoGPreOrder().size() > 0
&& 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();
GCG.ifPresent(gcg -> {
gcg.getLtInfoGPreOrder().add(GPO);
@ -1500,18 +1535,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());
});
}
});
// logger.info("分组处理报错:{}",ex);
// logger.info("分组处理报错:{}",GPO1.getOrderNo());
// logger.info("分组处理报错:{}",GPO2.getOrderNo());
//
// gltGCal2Grp.forEach(n -> {
// if (n.getLtInfoGPreOrder().size() > 0) {
//// logger.info(n.getIDValue().toString());
// n.getLtInfoGPreOrder().forEach(g -> {
// logger.info(n.getIDValue()+ "--" + g.getOrderNo());
// });
// }
// });
}
@ -1542,6 +1577,7 @@ public class SubController {
if (gpo.getOrderNo() == null || gpo.getOrderNo().equals("")) {
}
//验证过不需要再验证
if (plistChmChkRsult.stream().anyMatch(dto -> dto.getOrderNo().equals(gpo.getOrderNo()) && dto.getPono().equals(p.getPono()))) {
continue;
@ -2124,14 +2160,21 @@ public class SubController {
BigDecimal decCompressRate = new BigDecimal(0);
//SInfo的厚度除以GrpOrd的厚度等于压缩比decCompressRate
decCompressRate = GrpOrd.getThk().divide(SInfo.getSlabActThk(), 2, BigDecimal.ROUND_HALF_UP);
decCompressRate = SInfo.getSlabActThk().divide(GrpOrd.getThk(), 2, BigDecimal.ROUND_HALF_UP);
//压下比大于产线要求的下限值
if (decCompressRate.compareTo(GrpOrd.getInfoPmContMscTechDO().getCompressMin()) < 0) {
return false;
} else {
return true;
if (nvl(GrpOrd.getInfoPmContMscTechDO().getSlabThkMin(), new BigDecimal(0)).compareTo(new BigDecimal(0))!=0 ) {
if (decCompressRate.compareTo( nvl(GrpOrd.getInfoPmContMscTechDO().getSlabThkMin(), new BigDecimal(0))) < 0) {
return false;
}
}
if (nvl(GrpOrd.getInfoPmContMscTechDO().getSlabThkMax(), new BigDecimal(0)).compareTo(new BigDecimal(0))!=0 ) {
if (decCompressRate.compareTo( nvl(GrpOrd.getInfoPmContMscTechDO().getSlabThkMax(), new BigDecimal(0))) > 0) {
return false;
}
}
return true;
} catch (Exception e) {
logger.error("压缩比验证出错", e);
return false;
@ -2144,8 +2187,22 @@ public class SubController {
*/
public boolean ChkWid(SlabInfoDO SInfo, GPreOrder GrpOrd) {
try {
//宽展比 保留2位小数
BigDecimal decWidRate = BigDecimal.valueOf(GrpOrd.getWid()).divide(SInfo.getSlabActWid(), 2, RoundingMode.HALF_UP);
return true;
if(nvl(GrpOrd.getInfoPmContMscTechDO().getWidenMin(),new BigDecimal(0)).compareTo(new BigDecimal(0))!=0){
//展宽比小于最小值
if (decWidRate.compareTo( nvl(GrpOrd.getInfoPmContMscTechDO().getWidenMin(),new BigDecimal(0))) < 0) {
return false;
}
}
return true;
} catch (Exception e) {
logger.error("展宽比验证出错", e);
return false;
}
}
//endregion
@ -4004,10 +4061,13 @@ public class SubController {
Optional<PmProContProdTtr> resultPmProContProdAttrDO = plistPmProContProdAttrDO.stream()
.filter(item -> gGrpCalRslt.getLtActInfoGPreOrder().get(0).getOrderNo().equals(item.getOrderNo())) //TODO 根据轴合同号查询生产合同产品属性表 暂时取第一条合同
.findFirst();
pmCmdLargePltDO.setSampleLenGive(resultPmProContProdAttrDO.get().getSampleLenGive());
pmCmdLargePltDO.setProdDensity(resultPmProContProdAttrDO.get().getProdDensity());
if (resultPmProContProdAttrDO.isPresent()){
pmCmdLargePltDO.setSampleLenGive(resultPmProContProdAttrDO.get().getSampleLenGive());
pmCmdLargePltDO.setProdDensity(resultPmProContProdAttrDO.get().getProdDensity());
pmCmdLargePltDO.setWithSideFlag(resultPmProContProdAttrDO.get().getProdSideMark());
}
pmCmdLargePltDO.setPlateDtCode(pmContMscTechDO.getPlateDtCode());
pmCmdLargePltDO.setWithSideFlag(resultPmProContProdAttrDO.get().getProdSideMark());
pmCmdLargePltDO.setRsCode(pmPdSlabDO.getRsCode());
pmCmdLargePltDO.setBroadFlag(pmPdSlabDO.getBroadFlag());

@ -496,63 +496,63 @@ public class SubServiceImpl implements SubService {
pmSubOrdRepository.batchInsertSelective(plistpmSubOrdDO);
System.out.println("pmSubOrd表 保存成功");
}
////
// if (pmPdSlabDOList.size() > 0) {
// pmPdSlabRepository.batchInsertSelective(pmPdSlabDOList);
// System.out.println("PmPdSlab表 保存成功");
// }
// if (pmPdPlateCutDOList.size() > 0) {
// pmPdPlateCutRepository.batchInsertSelective(pmPdPlateCutDOList);
// System.out.println("PmPdPlateCut 大板粗切位置 保存成功");
// }
// if (pmPdBlockPosDOList.size() > 0) {
// pmPdBlockPosRepository.batchInsertSelective(pmPdBlockPosDOList);
// System.out.println("PmPdBlockPos 组合子板位置表 保存成功");
// }
// if (pmPdContSumDOList.size() > 0) {
// pmPdContSumRepository.batchInsertSelective(pmPdContSumDOList);
// System.out.println("PmPdContSum 合同总量表 保存成功");
// }
// if (pmSmallPltPosDOList.size() > 0) {
// pmSmallPltPosRepository.batchInsertSelective(pmSmallPltPosDOList);
// System.out.println("PmSmallPltPos 命令小板位置表 保存成功");
// }
// if (pmCmdSlabDOList.size() > 0) {
// pmCmdSlabRepository.batchInsertSelective(pmCmdSlabDOList);
// System.out.println("PmCmdSlab 保存成功");
// }
// if (pmCmdLargePltDOList.size() > 0) {
// pmCmdLargePltRepository.batchInsertSelective(pmCmdLargePltDOList);
// System.out.println("pmCmdLargePltDO 命令大板 保存成功");
// }
// if (pmCmdContDOList.size() > 0) {
// pmCmdContRepository.batchInsertSelective(pmCmdContDOList);
// System.out.println("PmCmdCont 命令参数 保存成功");
// }
// 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表 保存成功");
//
// // 轧钢模块“在制品材料管理封锁事件接口"
// callMatStatusModify(pmPdSlabInfo);
// System.out.println("mm模块接口 调用成功");
// System.out.println("程序执行完成!");
//
// //抛合同
// zbCtEventRec(organizationId, pmPdSlabDOList, pmCmdLargePltDOList, pmCmdSlabDOList, pmSmallPltPosDOList);
// System.out.println("抛合同事件完成");
//
if (pmPdSlabDOList.size() > 0) {
pmPdSlabRepository.batchInsertSelective(pmPdSlabDOList);
System.out.println("PmPdSlab表 保存成功");
}
if (pmPdPlateCutDOList.size() > 0) {
pmPdPlateCutRepository.batchInsertSelective(pmPdPlateCutDOList);
System.out.println("PmPdPlateCut 大板粗切位置 保存成功");
}
if (pmPdBlockPosDOList.size() > 0) {
pmPdBlockPosRepository.batchInsertSelective(pmPdBlockPosDOList);
System.out.println("PmPdBlockPos 组合子板位置表 保存成功");
}
if (pmPdContSumDOList.size() > 0) {
pmPdContSumRepository.batchInsertSelective(pmPdContSumDOList);
System.out.println("PmPdContSum 合同总量表 保存成功");
}
if (pmSmallPltPosDOList.size() > 0) {
pmSmallPltPosRepository.batchInsertSelective(pmSmallPltPosDOList);
System.out.println("PmSmallPltPos 命令小板位置表 保存成功");
}
if (pmCmdSlabDOList.size() > 0) {
pmCmdSlabRepository.batchInsertSelective(pmCmdSlabDOList);
System.out.println("PmCmdSlab 保存成功");
}
if (pmCmdLargePltDOList.size() > 0) {
pmCmdLargePltRepository.batchInsertSelective(pmCmdLargePltDOList);
System.out.println("pmCmdLargePltDO 命令大板 保存成功");
}
if (pmCmdContDOList.size() > 0) {
pmCmdContRepository.batchInsertSelective(pmCmdContDOList);
System.out.println("PmCmdCont 命令参数 保存成功");
}
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表 保存成功");
// 轧钢模块“在制品材料管理封锁事件接口"
callMatStatusModify(pmPdSlabInfo);
System.out.println("mm模块接口 调用成功");
System.out.println("程序执行完成!");
//抛合同
zbCtEventRec(organizationId, pmPdSlabDOList, pmCmdLargePltDOList, pmCmdSlabDOList, pmSmallPltPosDOList);
System.out.println("抛合同事件完成");
}

Loading…
Cancel
Save