|
|
|
@ -1,13 +1,19 @@
|
|
|
|
|
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.PmProductionPlanReqDTO;
|
|
|
|
|
import com.xisc.pm.api.dto.QdMatchParamDTO;
|
|
|
|
|
import com.xisc.pm.api.dto.QdSurplusLowMagnificationDTO;
|
|
|
|
|
import com.xisc.pm.api.dto.model.*;
|
|
|
|
|
import com.xisc.pm.domain.entity.*;
|
|
|
|
|
import com.xisc.pm.domain.vo.util.JsonData;
|
|
|
|
|
import com.xisc.pm.infra.client.QdOrderClient;
|
|
|
|
|
import io.choerodon.core.iam.ResourceLevel;
|
|
|
|
|
import io.choerodon.core.oauth.CustomUserDetails;
|
|
|
|
|
import io.choerodon.core.oauth.DetailsHelper;
|
|
|
|
|
import io.choerodon.swagger.annotation.Permission;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
|
@ -15,6 +21,7 @@ import org.hzero.mybatis.helper.SecurityTokenHelper;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
@ -30,6 +37,7 @@ import static com.xisc.pm.tool.Tool.nvl;
|
|
|
|
|
|
|
|
|
|
import com.xisc.pm.app.service.SubService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RestController("subController.v1")
|
|
|
|
|
@Slf4j(topic = "xt-special1")
|
|
|
|
|
@RequestMapping("/v1/{organizationId}/Sub")
|
|
|
|
@ -37,6 +45,8 @@ public class SubController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private SubService subService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private QdOrderClient qdOrderClient;
|
|
|
|
|
// @Autowired
|
|
|
|
|
// private TransactionService transactionService;
|
|
|
|
|
|
|
|
|
@ -185,10 +195,13 @@ public class SubController {
|
|
|
|
|
//记录已被使用的订单号
|
|
|
|
|
private static List<GPreOrder> plistOrdHis = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
private static List<ChkChmResult> plistChkRsult= new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
@ApiOperation("求解处理")
|
|
|
|
|
@PostMapping("Solver")
|
|
|
|
|
@Permission(level = ResourceLevel.ORGANIZATION)
|
|
|
|
|
public JsonData Solver() {
|
|
|
|
|
// 测试数据
|
|
|
|
|
long[] values = {360, 83, 59, 130, 431, 67, 230, 52, 93, 125, 670, 892, 600, 38, 48, 147,
|
|
|
|
@ -216,18 +229,104 @@ public class SubController {
|
|
|
|
|
|
|
|
|
|
@ApiOperation("数据处理")
|
|
|
|
|
@PostMapping("/SubData1")
|
|
|
|
|
public JsonData SubData1( PmProductionPlanReqDTO dtoList, @PathVariable Long organizationId) {
|
|
|
|
|
@Permission(level = ResourceLevel.ORGANIZATION)
|
|
|
|
|
public JsonData SubData1( PmSubHis dtoListpr, @PathVariable Long organizationId) {
|
|
|
|
|
SecurityTokenHelper.validTokenIgnoreInsert(dtoListpr);
|
|
|
|
|
String strSlab = dtoListpr.getSlabNo();
|
|
|
|
|
SubParams subParams = new SubParams();
|
|
|
|
|
subParams.setSlabNo(strSlab);
|
|
|
|
|
//获取所有数据
|
|
|
|
|
GetDataInfo(subParams);
|
|
|
|
|
|
|
|
|
|
plistSlab.forEach(p -> {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
List<QdMatchParamDTO> dtoListChm = new ArrayList<QdMatchParamDTO>();
|
|
|
|
|
for (PmProCont gpo : plistOrder) {
|
|
|
|
|
QdMatchParamDTO phyFurnaceChemicalMatchDTO = new QdMatchParamDTO();
|
|
|
|
|
if (gpo.getOrderNo() == null || gpo.getOrderNo().equals("")) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
phyFurnaceChemicalMatchDTO.setOrderNo(gpo.getOrderNo());
|
|
|
|
|
phyFurnaceChemicalMatchDTO.setPono(p.getPono());
|
|
|
|
|
dtoListChm.add(phyFurnaceChemicalMatchDTO);
|
|
|
|
|
if (dtoListChm.size()==100)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<QdMatchParamDTO> reslutChm = qdOrderClient.phyFurnaceChemicalMatchApi(organizationId,
|
|
|
|
|
dtoListChm);
|
|
|
|
|
if (reslutChm != null && !reslutChm.isEmpty()) {
|
|
|
|
|
if (reslutChm != null && !reslutChm.isEmpty()) {
|
|
|
|
|
for (QdMatchParamDTO qdMatchParamDTO : reslutChm) {
|
|
|
|
|
if (!plistChkRsult.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.setOrderNo(qdMatchParamDTO.getResult());
|
|
|
|
|
plistChkRsult.add(CR);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.info("错误信息:"+e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
List<QdSurplusLowMagnificationDTO> dtoListLow = new ArrayList<QdSurplusLowMagnificationDTO>();
|
|
|
|
|
for (PmProCont gpo : plistOrder) {
|
|
|
|
|
if (gpo.getOrderNo() == null || gpo.getOrderNo().equals("")) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
QdSurplusLowMagnificationDTO phyFurnaceChemicalMatchDTO = new QdSurplusLowMagnificationDTO();
|
|
|
|
|
phyFurnaceChemicalMatchDTO.setOrderNo(gpo.getOrderNo());
|
|
|
|
|
phyFurnaceChemicalMatchDTO.setPono(p.getPono());
|
|
|
|
|
dtoListLow.add(phyFurnaceChemicalMatchDTO);
|
|
|
|
|
if (dtoListLow.size()==100)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<QdSurplusLowMagnificationDTO> reslutLow = qdOrderClient.surplusLowMagnificationMatchApi(organizationId,
|
|
|
|
|
dtoListLow);
|
|
|
|
|
|
|
|
|
|
if (reslutLow != null && !reslutLow.isEmpty()) {
|
|
|
|
|
if (reslutLow != null && !reslutLow.isEmpty()) {
|
|
|
|
|
for (QdSurplusLowMagnificationDTO qdSurplusLowMagnificationDTO : reslutLow) {
|
|
|
|
|
if (!plistChkRsult.stream().anyMatch(m -> m.getPono().equals(p.getPono()) && m.getOrderNo().equals(qdSurplusLowMagnificationDTO.getOrderNo()))) {
|
|
|
|
|
ChkChmResult CR = new ChkChmResult();
|
|
|
|
|
CR.setPono(p.getPono());
|
|
|
|
|
CR.setOrderNo(qdSurplusLowMagnificationDTO.getOrderNo());
|
|
|
|
|
CR.setOrderNo(qdSurplusLowMagnificationDTO.getResult());
|
|
|
|
|
plistChkRsult.add(CR);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.info("错误信息:"+e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("调用成功");
|
|
|
|
|
JsonData xx = new JsonData();
|
|
|
|
|
xx.setCode(0);
|
|
|
|
|
xx.setData(null);
|
|
|
|
|
xx.setMsg("123");
|
|
|
|
|
|
|
|
|
|
return xx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation("数据处理")
|
|
|
|
|
@PostMapping("/SubData")
|
|
|
|
|
public JsonData SubData(@RequestBody PmSubHis pmSubHis, @PathVariable Long organizationId) {
|
|
|
|
|
@Permission(level = ResourceLevel.ORGANIZATION)
|
|
|
|
|
public JsonData SubData( PmSubHis pmSubHis, @PathVariable Long organizationId) {
|
|
|
|
|
SecurityTokenHelper.validTokenIgnoreInsert(pmSubHis);
|
|
|
|
|
String strSlab = pmSubHis.getSlabNo();
|
|
|
|
|
SubParams subParams = new SubParams();
|
|
|
|
@ -284,6 +383,7 @@ public class SubController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
gltGCalGrp = new ArrayList<>();
|
|
|
|
|
//二次分组
|
|
|
|
|
SetGrpDataBySlab(p);
|
|
|
|
@ -292,10 +392,11 @@ public class SubController {
|
|
|
|
|
|
|
|
|
|
logger.info("***二次分组1数量*** " + gltGCalGrp.size());
|
|
|
|
|
|
|
|
|
|
logger.info("***二次分组2数量*** " + gltGCal2Grp.size());
|
|
|
|
|
logger.info("***二次分组21数量*** " + gltGCal2Grp.size());
|
|
|
|
|
|
|
|
|
|
gltGCalGrp.addAll(gltGCal2Grp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//分组设置ID
|
|
|
|
|
for (int i = 0; i < gltGCalGrp.size(); i++) {
|
|
|
|
|
|
|
|
|
@ -343,8 +444,8 @@ public class SubController {
|
|
|
|
|
|
|
|
|
|
SetGroupCalRslt(p);
|
|
|
|
|
|
|
|
|
|
logger.info("结果数据板坯号:{};数量:{}", p.getSlabNo(), gltGGrpCalRslt.size());
|
|
|
|
|
logger.info("结果数据板坯号:{};数量:{}", p.getSlabNo(), gltSelGGrpCalRslt.size());
|
|
|
|
|
logger.info("所有结果数据板坯号:{};数量:{}", p.getSlabNo(), gltGGrpCalRslt.size());
|
|
|
|
|
logger.info("选择结果数据板坯号:{};数量:{}", p.getSlabNo(), gltSelGGrpCalRslt.size());
|
|
|
|
|
}
|
|
|
|
|
if (gltSelGGrpCalRslt.size() > 0) {
|
|
|
|
|
now = new Date();
|
|
|
|
@ -796,6 +897,16 @@ public class SubController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (f.getOrderNo().equals("52500095215") ) {
|
|
|
|
|
|
|
|
|
|
logger.info("52500095215");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (f.getOrderNo().equals("52500096023") ) {
|
|
|
|
|
|
|
|
|
|
logger.info("52500096023");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//同钢种判断
|
|
|
|
|
if (!SInfo.getStNo().equals(f.getInfoPmContMscTechDO().getStNo()))
|
|
|
|
|
{
|
|
|
|
@ -1352,9 +1463,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 false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<QeTqHeatcheStandResultDO> ltQthsr = plistQeTqHeatcheStandResultDO.stream().filter(p -> p.getPono().equals(SInfo.getPono())).collect(Collectors.toList());
|
|
|
|
@ -1416,9 +1527,9 @@ public class SubController {
|
|
|
|
|
ltSmr = plistQeTqSlabMacroResultDO.stream().filter(p -> p.getPono().equals(SInfo.getPono())).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//信息不存在返回
|
|
|
|
|
//信息不存在返回 TODO: 坯料低倍委托实绩表没有要求按照正确处理
|
|
|
|
|
if (ltSmr.size() == 0) {
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//实例一个新的结果数据
|
|
|
|
|
List<QeTqSlabMacroResultDO> ltSmrReslt = ltSmr;
|
|
|
|
|