PmPdSlab 更新数据处理

main
BKGY_MYT 4 days ago
parent b719f3c309
commit 736664a4bb

@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import static net.xdclass.shopmanager.tool.Tool.nvl;
import static net.xdclass.shopmanager.util.Knapsack.solve;
@RestController
@ -47,6 +48,26 @@ public class SubController {
//计算结果数据
private static List<GGrpCalRslt> gltGGrpCalRslt = new CopyOnWriteArrayList<>();
//组板板坯表
private static List<PmPdSlabDO> pmPdSlabDOList = new ArrayList<>();
//大板粗切位置表
private static List<PmPdPlateCutDO> pmPdPlateCutDOList = new ArrayList<>();
//组合子板位置表
private static List<PmPdBlockPosDO> pmPdBlockPosDOList = new ArrayList<>();
//组板合同总量表
private static List<PmPdContSumDO> pmPdContSumDOList = new ArrayList<>();
//组板小板位置表
private static List<PmSmallPltPosDO> pmSmallPltPosDOList = new ArrayList<>();
//命令板坯表
private static List<PmCmdSlabDO> pmCmdSlabDOList = new ArrayList<>();
//命令大板表
private static List<PmCmdLargePltDO> pmCmdLargePltDOList = new ArrayList<>();
//命令参数表
private static List<PmCmdContDO> pmCmdContDOList = new ArrayList<>();
//命令小板表
private static List<PmCmdSmallPltDO> pmCmdSmallPltDOList = new ArrayList<>();
private static int intOrdNum = 0;
@ -100,6 +121,8 @@ public class SubController {
private static List<QeTqPonoWaitTestDO> plistQeTqPonoWaitTestDO;
//坯料低倍委托实绩表
private static List<QeTqSlabMacroResultDO> plistQeTqSlabMacroResultDO;
//板坯信息表
private static List<PmPdSlabInfoDO> plistPmPdSlabInfoDO; //TODO 需要添加此表信息的查询
//endregion
@ -150,6 +173,9 @@ public class SubController {
SetGroupCalRslt(p);
}
if(gltGGrpCalRslt.size()>0){
SetSaveDate(p);
}
}
@ -1252,4 +1278,181 @@ public class SubController {
}
//设置保存数据
public void SetSaveDate(SlabInfoDO SInfo){
SetPmPdSlab(SInfo);
}
public void SetPmPdSlab(SlabInfoDO SInfo){
for(int i = 0; i < gltGGrpCalRslt.size(); i++){
GGrpCalRslt GGCR=gltGGrpCalRslt.get(i);
PmPdSlabDO pmPdSlabDO = new PmPdSlabDO();
pmPdSlabDO.setPono(SInfo.getPono());
pmPdSlabDO.setSlabDivNo(BigDecimal.ZERO); //TODO 板坯分割号 未赋值 查询板坯号等于slab_no的组板板坯表的记录数+1
pmPdSlabDO.setVirtualSlabNo(GGCR.getVirtualSlabNo());
pmPdSlabDO.setSlabNo(GGCR.getSlabNo());
pmPdSlabDO.setMatDesignKind("S");
pmPdSlabDO.setPdStatusHp("12");
pmPdSlabDO.setPdResp("12"); // TODO 组板责任者 未赋值 操作人id
pmPdSlabDO.setFormPlateMode("FormPlateMode"); //TODO 组板方式 未赋值
pmPdSlabDO.setPickModeLenDir(BigDecimal.ZERO); //TODO 取板方式_长度方向 未赋值
pmPdSlabDO.setPickModeWidDir(BigDecimal.ZERO); //TODO 取板方式_宽度方向 未赋值
pmPdSlabDO.setFurType("FurType"); //TODO 加热炉类型 未赋值
pmPdSlabDO.setAutoManualFlag("M");
pmPdSlabDO.setOrderRemainDiv("1");
pmPdSlabDO.setCanDelFlag("1");
List<String> orderNoList = GGCR.getLtActInfoGPreOrder().stream().map(GPreOrder::getOrderNo).distinct().collect(Collectors.toList());//根据实际合同信息 的合同号去重 取出板内合同个数
pmPdSlabDO.setOrderNumInPlate(BigDecimal.valueOf(orderNoList.size()));
pmPdSlabDO.setTotSmallPlateNum(BigDecimal.valueOf(GGCR.getLtActInfoGPreOrder().size()));
Optional<PmContMscTechDO> resultPmContMscTechDO = plistPmContMscTechDO.stream()
.filter(item -> GGCR.getLtActInfoGPreOrder().get(0).getOrderNo().equals(item.getOrderNo())) //TODO 根据轴合同号查询合同工艺表 暂时取第一条合同
.findFirst();
pmPdSlabDO.setAdTypeCode(resultPmContMscTechDO.get().getAdTypeCode());
pmPdSlabDO.setAdModeCode(resultPmContMscTechDO.get().getAdModeCode());
pmPdSlabDO.setCtrlRollCode(resultPmContMscTechDO.get().getCtrlRollCode());
pmPdSlabDO.setCutModeCode(resultPmContMscTechDO.get().getCutModeCode());
//TODO 缺少质量模块MES合同主档QD_TO_PO_ORDER
pmPdSlabDO.setUltCode(resultPmContMscTechDO.get().getUltCode());//TODO 遍历组板合同根据合同号从质量模块MES合同主档QD_TO_PO_ORDER读取ERP_UT_SPEC1探伤标准1、ERP_UT_SPEC2超声探伤标2、ERP_UT_SPEC3超声探伤标3去重后所有数据拼接成一条记录
String ultDetectMethodCode = "";
String coolCode = "";
// 遍历 组板合同列表
for (GPreOrder gPreOrder : GGCR.getLtActInfoGPreOrder()) {
String orderNo = gPreOrder.getOrderNo();
String mscLineNo = gPreOrder.getInfoPmContMscTechDO().getMscLineNo();
// 根据 orderNo 和 mscLineNo 在 plistPmContMscTechDO 中查找匹配项
Optional<PmContMscTechDO> matchingItem = plistPmContMscTechDO.stream()
.filter(item -> orderNo.equals(item.getOrderNo()) && mscLineNo.equals(item.getMscLineNo()))
.findFirst();
if (!ultDetectMethodCode.isEmpty()) {
if(!coolCode.isEmpty()){
break;
}else{
coolCode = nvl(matchingItem.get().getCoolCode(),"");
}
}else{
ultDetectMethodCode = nvl(matchingItem.get().getUltDetectMethodCode(),"");
if (coolCode.isEmpty()){
coolCode = nvl(matchingItem.get().getCoolCode(),"");
}
}
}
pmPdSlabDO.setUltDetectMethodCode(ultDetectMethodCode);
pmPdSlabDO.setCoolCode(coolCode);
Optional<PmProContProdAttrDO> resultPmProContProdAttrDO = plistPmProContProdAttrDO.stream()
.filter(item -> GGCR.getLtActInfoGPreOrder().get(0).getOrderNo().equals(item.getOrderNo())) //TODO 根据轴合同号查询生产合同产品属性表 暂时取第一条合同
.findFirst();
pmPdSlabDO.setWithSideFlag(resultPmProContProdAttrDO.get().getProdSideMark());
pmPdSlabDO.setHeadCut(BigDecimal.valueOf(GGCR.getHead_Len()));
pmPdSlabDO.setTailCut(BigDecimal.valueOf(GGCR.getTail_Len()));
String urgOrderFlag = "";
for (GPreOrder gPreOrder : GGCR.getLtActInfoGPreOrder()) {
String orderNo = gPreOrder.getOrderNo();
// 根据 orderNo 和 mscLineNo 在 plistPmContMscTechDO 中查找匹配项
Optional<PmProContProdAttrDO> pmProContProdAttrDOItem = plistPmProContProdAttrDO.stream()
.filter(item -> orderNo.equals(item.getOrderNo()))
.findFirst();
urgOrderFlag = String.valueOf(nvl(pmProContProdAttrDOItem.get().getUrgOrderFlag(),""));
if(!urgOrderFlag.isEmpty()){
break;
}
}
pmPdSlabDO.setUrgOrderFlag(urgOrderFlag);
pmPdSlabDO.setSgSign(SInfo.getSgSign());
pmPdSlabDO.setStNo(SInfo.getStNo());
pmPdSlabDO.setOutSgNo(SInfo.getStNo());
pmPdSlabDO.setPreCleanSlabThick(SInfo.getSlabActThk());
pmPdSlabDO.setPreCleanSlabWidth(SInfo.getSlabActWid());
pmPdSlabDO.setPreCleanSlabLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len()));
pmPdSlabDO.setPreCleanSlabMaxLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len()));
pmPdSlabDO.setPreCleanSlabMinLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len()));
BigDecimal weight = SInfo.getSlabActThk().multiply(SInfo.getSlabActWid()).multiply(BigDecimal.valueOf(GGCR.getVirtualSlab_Len())).multiply(BigDecimal.valueOf(7.85));
pmPdSlabDO.setPreCleanSlabWt(weight);
pmPdSlabDO.setPreCleanSlabMaxWt(weight);
pmPdSlabDO.setPreCleanSlabMinWt(weight);
pmPdSlabDO.setInfurSlabThick(SInfo.getSlabActThk());
pmPdSlabDO.setInfurSlabWid(SInfo.getSlabActWid());
pmPdSlabDO.setInfurSlabLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len()));
pmPdSlabDO.setInfurSlabMaxLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len()));
pmPdSlabDO.setInfurSlabMinLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len()));
pmPdSlabDO.setInfurSlabWt(weight);
pmPdSlabDO.setInfurSlabMaxWt(weight);
pmPdSlabDO.setInfurSlabMinWt(weight);
pmPdSlabDO.setFixSlabLenFlag(0);
pmPdSlabDO.setFixSlabLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len()));
Optional<PmContMscTechDO> resultPmContMscTechDO1 = plistPmContMscTechDO.stream()
.filter(item -> GGCR.getLtActInfoGPreOrder().get(0).getOrderNo().equals(item.getOrderNo()) && GGCR.getLtActInfoGPreOrder().get(0).getInfoPmContMscTechDO().getMscLineNo().equals(item.getMscLineNo())) //TODO 根据轴合同号和产线号查询合同工艺表 暂时取第一条合同
.findFirst();
pmPdSlabDO.setHpFlameCleanDiv(resultPmContMscTechDO1.get().getFlameCleanDiv());
pmPdSlabDO.setSlabFinishCode(resultPmContMscTechDO1.get().getSlabFinishCode());
Optional<PmPdSlabInfoDO> resultPmPdSlabInfoDO = plistPmPdSlabInfoDO.stream()
.filter(item -> GGCR.getSlabNo().equals(item.getSlabNo()))
.findFirst();
pmPdSlabDO.setSlabPlaceCode(resultPmPdSlabInfoDO.get().getSlabPlaceCode());
pmPdSlabDO.setRollAimThick(GGCR.getCal_Thk());
pmPdSlabDO.setRollAimWidth(BigDecimal.valueOf(GGCR.getCal_Wid()));
pmPdSlabDO.setRollAimLen(BigDecimal.valueOf(GGCR.getCal_Len()));
pmPdSlabDO.setOrderThickAxis(GGCR.getLtActInfoGPreOrder().get(0).getThk());
pmPdSlabDO.setCombinePlateWidth(BigDecimal.valueOf(GGCR.getLtActInfoGPreOrder().get(0).getWid()));
pmPdSlabDO.setCombinePlateLen(BigDecimal.valueOf(GGCR.getLtActInfoGPreOrder().get(0).getLen()));
pmPdSlabDO.setRollWtHp(weight);
BigDecimal minThickTolMax = GGCR.getLtActInfoGPreOrder().stream()
.map(GPreOrder::getThickTolMax)
.min(BigDecimal::compareTo)
.orElse(BigDecimal.ZERO);
pmPdSlabDO.setRollThickTolMax(minThickTolMax);
BigDecimal maxThickTolMin = GGCR.getLtActInfoGPreOrder().stream()
.map(GPreOrder::getThickTolMin)
.max(BigDecimal::compareTo)
.orElse(BigDecimal.ZERO);
pmPdSlabDO.setRollThickTolMin(maxThickTolMin);
BigDecimal yield = (GGCR.getLtActInfoGPreOrder().stream()
.map(gPreOrder -> BigDecimal.valueOf(gPreOrder.getWid()).multiply(gPreOrder.getThk()).multiply(BigDecimal.valueOf(gPreOrder.getLen())))
.reduce(BigDecimal.ZERO, BigDecimal::add))
.multiply(BigDecimal.valueOf(7.85))
.divide(weight, 2, RoundingMode.HALF_UP);
pmPdSlabDO.setCommandYield(yield);
pmPdSlabDO.setNormYield(yield);
pmPdSlabDO.setRollYield(yield);
pmPdSlabDO.setEdgerUseFlag("Y");
pmPdSlabDO.setBroadMasUseFlag("N");
pmPdSlabDO.setFormMasUseFlag("N");
pmPdSlabDO.setRollDirectCode("L"); //TODO 轧制方向代码 横轧C纵轧L 暂时默认L
pmPdSlabDO.setSampleLenHead(GGCR.getSmp_Len());//TODO 头尾中 试样长度 暂时默认试样长度
pmPdSlabDO.setSampleLenTail(GGCR.getSmp_Len());
pmPdSlabDO.setSampleLenMid(GGCR.getSmp_Len());
pmPdSlabDO.setRsCode("0");
if(BigDecimal.valueOf(GGCR.getCal_Wid()).compareTo(SInfo.getSlabActWid()) > 0){
pmPdSlabDO.setBroadFlag("1"); //需要展宽
}else{
pmPdSlabDO.setBroadFlag("0");
}
pmPdSlabDO.setOrderNoAxis(GGCR.getLtActInfoGPreOrder().get(0).getOrderNo());//TODO 轴合同号 暂时取第一个订单号
pmPdSlabDO.setMscLineNo("1030"); //TODO 产线号暂时默认1030
pmPdSlabDO.setTransFlag(BigDecimal.valueOf(0));
pmPdSlabDOList.add(pmPdSlabDO);
}
}
}

@ -25,7 +25,7 @@ public class GGrpCalRslt {
//虚拟板坯厚度
private BigDecimal VirtualSlab_Thk;
//宽度
//轧制宽度
private int Cal_Wid;
//厚度
private BigDecimal Cal_Thk;

@ -0,0 +1,22 @@
package net.xdclass.shopmanager.tool;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class Tool {
public static <T> T nvl(T value, T defaultValue){
return value != null ? value : defaultValue;
}
public static void main(String[] args) throws Exception {
String str = null;
String ddd = "123";
String XX = nvl(null, ddd);
System.out.println("创建的新流程id" + XX);
System.out.println("asdfghjkl--" );
}
}
Loading…
Cancel
Save