2025-03-24

main
sunhao 2 weeks ago
parent ddd519abeb
commit 74ba155697

@ -200,7 +200,7 @@ public class SubController {
@ApiOperation("求解处理")
@PostMapping("Solver")
@Permission(level = ResourceLevel.ORGANIZATION)
public JsonData Solver() {
public JsonData Solver(@RequestBody PmSubHis pmSubHis) {
// 测试数据
long[] values = {360, 83, 59, 130, 431, 67, 230, 52, 93, 125, 670, 892, 600, 38, 48, 147,
78, 256, 63, 17, 120, 164, 432, 35, 92, 110, 22, 42, 50, 323, 514, 28, 87, 73, 78, 15, 26,
@ -228,90 +228,118 @@ public class SubController {
@ApiOperation("数据处理")
@PostMapping("/SubData1")
@Permission(level = ResourceLevel.ORGANIZATION)
public JsonData SubData1(@RequestBody PmSubHis dtoListpr, @PathVariable Long organizationId) {
public JsonData SubData1( PmSubHis dtoListpr, @PathVariable Long organizationId) {
SecurityTokenHelper.validTokenIgnoreInsert(dtoListpr);
String strSlab = dtoListpr.getSlabNo();
SubParams subParams = new SubParams();
subParams.setSlabNo(strSlab);
//获取所有数据
GetDataInfo(subParams);
plistChmChkRsult=new ArrayList<>();
plistLowChkRsult=new ArrayList<>();
plistSlab.forEach(p -> {
try {
List<List<QdMatchParamDTO>> listOfDtoLists = new ArrayList<>();
List<QdMatchParamDTO> dtoListChm = new ArrayList<QdMatchParamDTO>();
for (PmProCont gpo : plistOrder) {
QdMatchParamDTO phyFurnaceChemicalMatchDTO = new QdMatchParamDTO();
if (gpo.getOrderNo() == null || gpo.getOrderNo().equals("")) {
}
//验证过不需要再验证
if (plistChmChkRsult.stream().anyMatch(dto -> dto.getOrderNo().equals(gpo.getOrderNo()) && dto.getPono().equals(p.getPono()))){
continue;
}
QdMatchParamDTO phyFurnaceChemicalMatchDTO = new QdMatchParamDTO();
phyFurnaceChemicalMatchDTO.setOrderNo(gpo.getOrderNo());
phyFurnaceChemicalMatchDTO.setPono(p.getPono());
dtoListChm.add(phyFurnaceChemicalMatchDTO);
if (dtoListChm.size() == 500) {
listOfDtoLists.add(new ArrayList<>(dtoListChm));
dtoListChm.clear();
}
}
// 如果 dtoListChm 中还有剩余的元素,将其添加到 listOfDtoLists 中
if (!dtoListChm.isEmpty()) {
listOfDtoLists.add(new ArrayList<>(dtoListChm));
}
logger.info("数量:" + dtoListChm.size());
logger.info("数量:" + dtoListChm.size());
logger.info("数量:" + dtoListChm.size());
logger.info("数量:" + dtoListChm.size());
listOfDtoLists.forEach(dtoList -> {
List<QdMatchParamDTO> reslutChm = qdOrderClient.phyFurnaceChemicalMatchApi(organizationId,
dtoListChm);
if (reslutChm != null && !reslutChm.isEmpty()) {
List<QdMatchParamDTO> reslutChm = qdOrderClient.phyFurnaceChemicalMatchApi(organizationId,
dtoList);
if (reslutChm != null && !reslutChm.isEmpty()) {
for (QdMatchParamDTO qdMatchParamDTO : reslutChm) {
if (!plistChmChkRsult.stream().anyMatch(m -> m.getPono().equals(p.getPono()) && m.getOrderNo().equals(qdMatchParamDTO.getOrderNo()))) {
ChkChmResult CR = new ChkChmResult();
CR.setPono(p.getPono());
CR.setOrderNo(qdMatchParamDTO.getOrderNo());
CR.setChmresult(qdMatchParamDTO.getResult());
plistChmChkRsult.add(CR);
if (reslutChm != null && !reslutChm.isEmpty()) {
for (QdMatchParamDTO qdMatchParamDTO : reslutChm) {
if (!plistChmChkRsult.stream().anyMatch(m -> m.getPono().equals(p.getPono()) && m.getOrderNo().equals(qdMatchParamDTO.getOrderNo()))) {
ChkChmResult CR = new ChkChmResult();
CR.setPono(p.getPono());
CR.setOrderNo(qdMatchParamDTO.getOrderNo());
CR.setChmresult(qdMatchParamDTO.getResult());
plistChmChkRsult.add(CR);
}
}
}
}
}
});
} catch (Exception e) {
logger.info("错误信息:"+e);
}
try {
List<List<QdSurplusLowMagnificationDTO>> listOfDtoLists = new ArrayList<>();
List<QdSurplusLowMagnificationDTO> dtoListLow = new ArrayList<QdSurplusLowMagnificationDTO>();
for (PmProCont gpo : plistOrder) {
if (gpo.getOrderNo() == null || gpo.getOrderNo().equals("")) {
continue;
}
//验证过不需要再验证
if (plistLowChkRsult.stream().anyMatch(dto -> dto.getOrderNo().equals(gpo.getOrderNo()) && dto.getPono().equals(p.getPono()))){
continue;
}
QdSurplusLowMagnificationDTO phyFurnaceChemicalMatchDTO = new QdSurplusLowMagnificationDTO();
phyFurnaceChemicalMatchDTO.setOrderNo(gpo.getOrderNo());
phyFurnaceChemicalMatchDTO.setPono(p.getPono());
dtoListLow.add(phyFurnaceChemicalMatchDTO);
if (dtoListLow.size() == 500) {
listOfDtoLists.add(new ArrayList<>(dtoListLow));
dtoListLow.clear();
}
}
// 如果 dtoListChm 中还有剩余的元素,将其添加到 listOfDtoLists 中
if (!dtoListLow.isEmpty()) {
listOfDtoLists.add(new ArrayList<>(dtoListLow));
}
List<QdSurplusLowMagnificationDTO> reslutLow = qdOrderClient.surplusLowMagnificationMatchApi(organizationId,
dtoListLow);
if (reslutLow != null && !reslutLow.isEmpty()) {
listOfDtoLists.forEach(dtoList -> {
List<QdSurplusLowMagnificationDTO> reslutLow = qdOrderClient.surplusLowMagnificationMatchApi(organizationId,
dtoList);
if (reslutLow != null && !reslutLow.isEmpty()) {
for (QdSurplusLowMagnificationDTO qdSurplusLowMagnificationDTO : reslutLow) {
if (!plistLowChkRsult.stream().anyMatch(m -> m.getPono().equals(p.getPono()) && m.getOrderNo().equals(qdSurplusLowMagnificationDTO.getOrderNo()))) {
ChkLowResult CR = new ChkLowResult();
CR.setPono(p.getPono());
CR.setOrderNo(qdSurplusLowMagnificationDTO.getOrderNo());
CR.setLowresult(qdSurplusLowMagnificationDTO.getResult());
plistLowChkRsult.add(CR);
if (reslutLow != null && !reslutLow.isEmpty()) {
for (QdSurplusLowMagnificationDTO qdSurplusLowMagnificationDTO : reslutLow) {
if (!plistLowChkRsult.stream().anyMatch(m -> m.getPono().equals(p.getPono()) && m.getOrderNo().equals(qdSurplusLowMagnificationDTO.getOrderNo()))) {
ChkLowResult CR = new ChkLowResult();
CR.setPono(p.getPono());
CR.setOrderNo(qdSurplusLowMagnificationDTO.getOrderNo());
CR.setLowresult(qdSurplusLowMagnificationDTO.getResult());
plistLowChkRsult.add(CR);
}
}
}
}
}
});
} catch (Exception e) {
logger.info("错误信息:"+e);
}
});
System.out.println("调用成功");
JsonData xx = new JsonData();
xx.setCode(0);
@ -324,26 +352,34 @@ public class SubController {
@ApiOperation("数据处理")
@PostMapping("/SubData")
@Permission(level = ResourceLevel.ORGANIZATION)
public JsonData SubData(@RequestBody PmSubHis pmSubHis, @PathVariable Long organizationId) {
public JsonData SubData( PmSubHis pmSubHis, @PathVariable Long organizationId) {
SecurityTokenHelper.validTokenIgnoreInsert(pmSubHis);
String strSlab = pmSubHis.getSlabNo();
long subMode = 1;
if (strSlab == null || strSlab == "") {
subMode = 2;
}
long finalSubMode = subMode;
SubParams subParams = new SubParams();
subParams.setSlabNo(strSlab);
//测试阶段需要指定板坯号
if (strSlab==null || strSlab=="")
{
return null;
}
// //测试阶段需要指定板坯号
// if (strSlab==null || strSlab=="")
// {
// return null;
// }
//获取所有数据
GetDataInfo(subParams);
// //化学成分低倍验证
// chkChmAndLowApi(organizationId,);
//数据预处理
SetPreData();
@ -354,6 +390,7 @@ public class SubController {
//循环板坯
plistSlab.forEach(p -> {
PmSubLog subLog = new PmSubLog();
subLog.setSlabNo(p.getSlabNo());
subLog.setSubMode(finalSubMode);
@ -401,6 +438,9 @@ public class SubController {
gltGCalGrp = new ArrayList<>();
gltGCal2Grp = new ArrayList<>();
chkChmAndLowApi(organizationId,p);
//二次分组
SetGrpDataBySlab(p);
//数据小的情况,计算拼板。数据量大不计算
@ -475,22 +515,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) {
@ -507,7 +547,6 @@ public class SubController {
return JsonData.buildSuccess();
}
public void SaveHisData(SlabInfoDO SInfo) {
String strMaxSeq = subService.GetMaxSeq(SInfo.getPono());
@ -583,8 +622,6 @@ public class SubController {
*/
public void GetDataInfo(SubParams subParams) {
logger.info("*****开始获取数据******");
//region ***多线程获取基础数据***
@ -922,6 +959,7 @@ public class SubController {
e.getLtInfoGPreOrder().forEach(f -> {
try {
//同钢种判断
if (!SInfo.getStNo().equals(f.getInfoPmContMscTechDO().getStNo()))
{
@ -933,19 +971,39 @@ public class SubController {
return;
}
//化学成分 chemical composition
if (!ChkChemical(SInfo, f)) {
return;
}
//不存在或者合格都是成功不合格返回false
if(plistChmChkRsult.stream().anyMatch(m -> m.getPono().equals(SInfo.getPono()) && m.getOrderNo().equals(f.getOrderNo())))
{
if (plistChmChkRsult.stream().anyMatch(m -> m.getPono().equals(SInfo.getPono()) && m.getOrderNo().equals(f.getOrderNo()) && m.getChmresult().equals("不合格"))){
return;
}
}
// plistChmChkRsult
// plistLowChkRsult
// //化学成分 chemical composition
// if (!ChkChemical(SInfo, f)) {
// return;
// }
} catch (Exception e1) {
log.error("化学成分", e1);
return;
}
try {
//低倍检测 low-power check
if (!ChkLowPower(SInfo, f)) {
return;
//不存在或者合格都是成功不合格返回false
if(plistLowChkRsult.stream().anyMatch(m -> m.getPono().equals(SInfo.getPono()) && m.getOrderNo().equals(f.getOrderNo())))
{
if (plistLowChkRsult.stream().anyMatch(m -> m.getPono().equals(SInfo.getPono()) && m.getOrderNo().equals(f.getOrderNo()) && m.getLowresult().equals("不合格"))){
return;
}
}
//
// //低倍检测 low-power check
// if (!ChkLowPower(SInfo, f)) {
// return;
// }
} catch (Exception e1) {
log.error("低倍检测", e1);
return;
@ -1467,6 +1525,115 @@ public class SubController {
}
/**
*
* @param organizationId
*/
public void chkChmAndLowApi(Long organizationId, SlabInfoDO p) {
// plistSlab.forEach(p -> {
try {
List<List<QdMatchParamDTO>> listOfDtoLists = new ArrayList<>();
List<QdMatchParamDTO> dtoListChm = new ArrayList<QdMatchParamDTO>();
for (PmProCont gpo : plistOrder) {
if (gpo.getOrderNo() == null || gpo.getOrderNo().equals("")) {
}
//验证过不需要再验证
if (plistChmChkRsult.stream().anyMatch(dto -> dto.getOrderNo().equals(gpo.getOrderNo()) && dto.getPono().equals(p.getPono()))) {
continue;
}
QdMatchParamDTO phyFurnaceChemicalMatchDTO = new QdMatchParamDTO();
phyFurnaceChemicalMatchDTO.setOrderNo(gpo.getOrderNo());
phyFurnaceChemicalMatchDTO.setPono(p.getPono());
dtoListChm.add(phyFurnaceChemicalMatchDTO);
if (dtoListChm.size() == 500) {
listOfDtoLists.add(new ArrayList<>(dtoListChm));
dtoListChm.clear();
}
}
// 如果 dtoListChm 中还有剩余的元素,将其添加到 listOfDtoLists 中
if (!dtoListChm.isEmpty()) {
listOfDtoLists.add(new ArrayList<>(dtoListChm));
}
listOfDtoLists.forEach(dtoList -> {
List<QdMatchParamDTO> reslutChm = qdOrderClient.phyFurnaceChemicalMatchApi(organizationId,
dtoList);
if (reslutChm != null && !reslutChm.isEmpty()) {
if (reslutChm != null && !reslutChm.isEmpty()) {
for (QdMatchParamDTO qdMatchParamDTO : reslutChm) {
if (!plistChmChkRsult.stream().anyMatch(m -> m.getPono().equals(p.getPono()) && m.getOrderNo().equals(qdMatchParamDTO.getOrderNo()))) {
ChkChmResult CR = new ChkChmResult();
CR.setPono(p.getPono());
CR.setOrderNo(qdMatchParamDTO.getOrderNo());
CR.setChmresult(qdMatchParamDTO.getResult());
plistChmChkRsult.add(CR);
}
}
}
}
});
} catch (Exception e) {
logger.info("错误信息:" + e);
}
try {
List<List<QdSurplusLowMagnificationDTO>> listOfDtoLists = new ArrayList<>();
List<QdSurplusLowMagnificationDTO> dtoListLow = new ArrayList<QdSurplusLowMagnificationDTO>();
for (PmProCont gpo : plistOrder) {
if (gpo.getOrderNo() == null || gpo.getOrderNo().equals("")) {
continue;
}
//验证过不需要再验证
if (plistLowChkRsult.stream().anyMatch(dto -> dto.getOrderNo().equals(gpo.getOrderNo()) && dto.getPono().equals(p.getPono()))) {
continue;
}
QdSurplusLowMagnificationDTO phyFurnaceChemicalMatchDTO = new QdSurplusLowMagnificationDTO();
phyFurnaceChemicalMatchDTO.setOrderNo(gpo.getOrderNo());
phyFurnaceChemicalMatchDTO.setPono(p.getPono());
dtoListLow.add(phyFurnaceChemicalMatchDTO);
if (dtoListLow.size() == 500) {
listOfDtoLists.add(new ArrayList<>(dtoListLow));
dtoListLow.clear();
}
}
// 如果 dtoListChm 中还有剩余的元素,将其添加到 listOfDtoLists 中
if (!dtoListLow.isEmpty()) {
listOfDtoLists.add(new ArrayList<>(dtoListLow));
}
listOfDtoLists.forEach(dtoList -> {
List<QdSurplusLowMagnificationDTO> reslutLow = qdOrderClient.surplusLowMagnificationMatchApi(organizationId,
dtoList);
if (reslutLow != null && !reslutLow.isEmpty()) {
if (reslutLow != null && !reslutLow.isEmpty()) {
for (QdSurplusLowMagnificationDTO qdSurplusLowMagnificationDTO : reslutLow) {
if (!plistLowChkRsult.stream().anyMatch(m -> m.getPono().equals(p.getPono()) && m.getOrderNo().equals(qdSurplusLowMagnificationDTO.getOrderNo()))) {
ChkLowResult CR = new ChkLowResult();
CR.setPono(p.getPono());
CR.setOrderNo(qdSurplusLowMagnificationDTO.getOrderNo());
CR.setLowresult(qdSurplusLowMagnificationDTO.getResult());
plistLowChkRsult.add(CR);
}
}
}
}
});
} catch (Exception e) {
logger.info("错误信息:" + e);
}
// });
}
//region 验证方法
@ -2249,7 +2416,7 @@ public class SubController {
// logger.info("***交叉分组ID" + e.getIDValue() + "--" + f.getIDValue());
// logger.info("***交叉分组Wid" + e.getWid() + "--" + f.getWid());
//e和f的宽度差绝对值小于500宽度合小于4980厚度相同
if (Math.abs(e.getWid() - f.getWid()) <500
if (Math.abs(e.getWid() - f.getWid()) <200
&& Math.max(e.getWid(),f.getWid()) < 4900
&& e.getThk().compareTo(f.getThk()) == 0
&& e.getST_NO().equals(f.getST_NO())

@ -83,7 +83,7 @@
WHERE 1=1
AND pcmt.MSC_LINE_NO LIKE '%30' --5米轧线
-- AND ppc.ORDER_NO IN ('J2502001208')
AND ppc.ORDER_NO IN ('52500095215','52500096023')
-- AND ppc.ORDER_NO IN ('52500095215','52500096023')
AND PCMT.FUR_TYPE ='C' --加热炉类型 C 没有注解C和S 都代表什么
AND ppcpa.ORDER_TYPE_CODE != 'QFH'
AND PPC.ON_PD_FLAG != 1 --不用验证操作者
@ -104,7 +104,7 @@
-- AND cm.MSC_LINE_NO = pcmt.MSC_LINE_NO --PM_PRO_CONT没有MSC_LINE_NO
WHERE 1=1
AND pcmt.MSC_LINE_NO LIKE '%30' --5米轧线
AND ppc.ORDER_NO IN ('52500095215','52500096023')
-- AND ppc.ORDER_NO IN ('52500095215','52500096023')
AND PCMT.FUR_TYPE ='C' --加热炉类型 C 没有注解C和S 都代表什么
AND ppcpa.ORDER_TYPE_CODE != 'QFH'
AND PPC.ON_PD_FLAG != 1 --不用验证操作者

Loading…
Cancel
Save