2025-03-14

DEV
main
sunhao 2 weeks ago
parent fce4ec5909
commit e293896930

@ -13,6 +13,14 @@
<name>xisc-pm</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hzero.boot</groupId>
<artifactId>hzero-boot-interface</artifactId>
@ -95,6 +103,14 @@
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>

@ -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;

@ -0,0 +1,20 @@
package com.xisc.pm.api.dto.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class ChkChmResult {
//命令号
private String pono;
// //板坯号
// private String SlabNo;
//订单号
private String orderNo;
//化学成分验证接口返回结果
private String Chmresult;
// //低倍验证接口返回结果
// private String Lowresult;
}

@ -0,0 +1,20 @@
package com.xisc.pm.api.dto.model;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class ChkLowResult {
//命令号
private String pono;
// //板坯号
// private String SlabNo;
//订单号
private String orderNo;
//化学成分验证接口返回结果
private String Lowresult;
// //低倍验证接口返回结果
// private String Lowresult;
}

@ -20,6 +20,9 @@ public class GPreOrder {
//合同号
private String orderNo;
//合同产线
private String Line ;
//实际长度
private Integer intActLen;

@ -1,6 +1,6 @@
spring:
application:
name: ${SPRING_APPLICATION_NAME:xisc-zb}
name: ${SPRING_APPLICATION_NAME:xisc-zb-sunh}
datasource:
url: ${SPRING_DATASOURCE_URL:jdbc:oracle:thin:@172.18.15.50:1521:momdev}
username: ${SPRING_DATASOURCE_USERNAME:xisc_pm}
@ -12,6 +12,10 @@ spring:
maximum-pool-size: ${SPRING_DATASOURCE_MAXIMUM_POOL_SIZE:200}
# 等待连接池分配连接的最大时长(毫秒)
connection-timeout: ${SPRING_DATASOURCE_CONNECTION_TIMEOUT:30000}
devtools:
restart:
enabled: true # 启用自动重启功能
interval: 5000 # 设置检查类路径变化的间隔时间为 5 秒5000 毫秒)
redis:
host: ${SPRING_REDIS_HOST:172.18.15.29}
port: ${SPRING_REDIS_PORT:6379}
@ -94,9 +98,9 @@ mybatis:
hzero:
service:
current:
name: ${HZERO_ROUTER_NAME:xisc-zb}
path: ${HZERO_SERVICE_PATH:/zb/**}
service-name: ${HZERO_SERVICE_NAME:xisc-zb}
name: ${HZERO_ROUTER_NAME:xisc-zb-sunh}
path: ${HZERO_SERVICE_PATH:/zb-sunh/**}
service-name: ${HZERO_SERVICE_NAME:xisc-zb-sunh}
scheduler:
auto-register: ${SCHEDULER_AUTO_REGISTER:true}
executor-code: ${SCHEDULER_EXECUTOR_CODE:PM_EXECUTOR}

@ -12,6 +12,10 @@ spring:
maximum-pool-size: ${SPRING_DATASOURCE_MAXIMUM_POOL_SIZE:200}
# 等待连接池分配连接的最大时长(毫秒)
connection-timeout: ${SPRING_DATASOURCE_CONNECTION_TIMEOUT:30000}
devtools:
restart:
enabled: true # 启用自动重启功能
interval: 5000 # 设置检查类路径变化的间隔时间为 5 秒5000 毫秒)
redis:
host: ${SPRING_REDIS_HOST:172.18.15.29}
port: ${SPRING_REDIS_PORT:6379}
@ -100,6 +104,8 @@ hzero:
executor-code: ${SCHEDULER_EXECUTOR_CODE:ZB_EXECUTOR}
upload-log: false
#seata 配置
seata:
enabled: ${SEATA_ENABLED:true}

@ -74,15 +74,16 @@
<select id="getOrderInfo" resultType="com.xisc.pm.domain.entity.PmProCont">
SELECT ppc.* FROM PM_PRO_CONT ppc
SELECT distinct ppc.* FROM PM_PRO_CONT ppc
LEFT JOIN XISC_CT.CT_MAIN CM ON PPC.ORDER_NO = CM.ORDER_NO
LEFT JOIN PM_PRO_CONT_PROD_ATTR ppcpa ON ppcpa.ORDER_NO = ppc.ORDER_NO
LEFT JOIN PM_CONT_MSC_TECH PCMT ON PCMT.ORDER_NO = ppc.ORDER_NO
AND ppc.PRO_CONT_ID = pcmt.PRO_CONT_ID
-- AND ppc.PRO_CONT_ID = pcmt.PRO_CONT_ID
-- AND cm.MSC_LINE_NO = pcmt.MSC_LINE_NO --PM_PRO_CONT没有MSC_LINE_NO
WHERE 1=1
-- AND pcmt.MSC_LINE_NO = '1030' --5米轧线
-- AND ppc.ORDER_NO IN ('J2502001208')
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 --不用验证操作者
@ -94,16 +95,16 @@
<select id="getQdToPoOrder" resultType="com.xisc.pm.domain.entity.QdToPoOrder">
SELECT QTPO.* FROM XISC_QD.QD_TO_PO_ORDER QTPO
SELECT distinct QTPO.* FROM XISC_QD.QD_TO_PO_ORDER QTPO
LEFT JOIN PM_PRO_CONT ppc ON QTPO.ORDER_NO = PPC.ORDER_NO
LEFT JOIN XISC_CT.CT_MAIN CM ON PPC.ORDER_NO = CM.ORDER_NO
LEFT JOIN PM_PRO_CONT_PROD_ATTR ppcpa ON ppcpa.ORDER_NO = ppc.ORDER_NO
LEFT JOIN PM_CONT_MSC_TECH PCMT ON PCMT.ORDER_NO = ppc.ORDER_NO
AND ppc.PRO_CONT_ID = pcmt.PRO_CONT_ID
-- AND ppc.PRO_CONT_ID = pcmt.PRO_CONT_ID
-- AND cm.MSC_LINE_NO = pcmt.MSC_LINE_NO --PM_PRO_CONT没有MSC_LINE_NO
WHERE 1=1
-- AND pcmt.MSC_LINE_NO = '1030' --5米轧线
-- AND ppc.ORDER_NO IN ('52500037002')
-- 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