|
|
@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
@ -43,6 +44,9 @@ public class SubController {
|
|
|
|
//二次计算分组
|
|
|
|
//二次计算分组
|
|
|
|
private static List<GCalGrp> gltGCalGrp = new CopyOnWriteArrayList<>();
|
|
|
|
private static List<GCalGrp> gltGCalGrp = new CopyOnWriteArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//计算结果数据
|
|
|
|
|
|
|
|
private static List<GGrpCalRslt> gltGGrpCalRslt = new CopyOnWriteArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
private static int intOrdNum = 0;
|
|
|
|
private static int intOrdNum = 0;
|
|
|
|
|
|
|
|
|
|
|
|
private static int intGrpNum = 0;
|
|
|
|
private static int intGrpNum = 0;
|
|
|
@ -139,6 +143,8 @@ public class SubController {
|
|
|
|
|
|
|
|
|
|
|
|
if (gltGCalGrp.size()>0){
|
|
|
|
if (gltGCalGrp.size()>0){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetGroupCalRslt(p);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("***二次分组数量*** " + gltGCalGrp.size());
|
|
|
|
logger.info("***二次分组数量*** " + gltGCalGrp.size());
|
|
|
@ -1041,9 +1047,109 @@ public class SubController {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetGroupCalRslt(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void SetGroupCalRslt(SlabInfoDO SInfo){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//轧机最大长度
|
|
|
|
|
|
|
|
int intRollMaxLen = plistPmPdConstBtDO.stream().filter(p->p.getRollLineNo()=="30").findFirst().orElse(null).getHpmMaxPLen().intValue();
|
|
|
|
|
|
|
|
//轧机最小长度
|
|
|
|
|
|
|
|
int intRollMinLen = plistPmPdConstBtDO.stream().filter(p->p.getRollLineNo()=="30").findFirst().orElse(null).getHpmMinPLen().intValue();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gltGCalGrp.parallelStream().forEach(e->{
|
|
|
|
|
|
|
|
//实例化计算结果数组
|
|
|
|
|
|
|
|
GGrpCalRslt GGCR=new GGrpCalRslt();
|
|
|
|
|
|
|
|
//可轧制最大长度
|
|
|
|
|
|
|
|
int intMaxLen =0;
|
|
|
|
|
|
|
|
//轧制最大宽度
|
|
|
|
|
|
|
|
int intWid= e.getWid();
|
|
|
|
|
|
|
|
//轧制最大厚度
|
|
|
|
|
|
|
|
BigDecimal intThk = e.getThk();
|
|
|
|
|
|
|
|
//板坯长度
|
|
|
|
|
|
|
|
int intSlabLen =SInfo.getSlabActLen().intValue();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断可轧制最大长度 TODO:厚度计算Decimal取整计算,会有误差,后续判断误差值修正计算
|
|
|
|
|
|
|
|
if ((BigDecimal.valueOf(intSlabLen).divide(intThk.multiply(BigDecimal.valueOf(intWid)), RoundingMode.HALF_UP)).compareTo(BigDecimal.valueOf(intRollMaxLen))>0 ){
|
|
|
|
|
|
|
|
intMaxLen=intRollMaxLen;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
intMaxLen=(BigDecimal.valueOf(intSlabLen).divide(intThk.multiply(BigDecimal.valueOf(intWid)), RoundingMode.HALF_UP)).intValue();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//不能小于可轧制的最小长度
|
|
|
|
|
|
|
|
if (intMaxLen<intRollMinLen)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GGCR.setCal_Wid(intWid);
|
|
|
|
|
|
|
|
GGCR.setCal_Thk(intThk);
|
|
|
|
|
|
|
|
GGCR.setCal_Len(intMaxLen);
|
|
|
|
|
|
|
|
GGCR.setLtInfoGPreOrder(e.getLtInfoGPreOrder()) ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gltGGrpCalRslt.add(GGCR);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//分组计算
|
|
|
|
|
|
|
|
gltGGrpCalRslt.parallelStream().forEach(p->{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 测试数据
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 生成 values 和 weights 数组
|
|
|
|
|
|
|
|
long[] values = new long[p.getLtInfoGPreOrder().size()];
|
|
|
|
|
|
|
|
long[][] weights = new long[0][p.getLtInfoGPreOrder().size()];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < p.getLtInfoGPreOrder().size(); i++) {
|
|
|
|
|
|
|
|
values[i] = p.getLtInfoGPreOrder().get(i).getIDValue(); // 从订单中获取 value
|
|
|
|
|
|
|
|
weights[0][i] = (long)p.getLtInfoGPreOrder().get(i).getInfoPmProContProdAttrDO().getOrderLen()+5; // 从订单中获取 weights
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//是否展宽
|
|
|
|
|
|
|
|
//String brnNeed="";
|
|
|
|
|
|
|
|
//if (p.getCal_Wid()>SInfo.getSlabActWid().intValue()){
|
|
|
|
|
|
|
|
// brnNeed="1";//展宽
|
|
|
|
|
|
|
|
//}else {
|
|
|
|
|
|
|
|
// brnNeed="0";//不展宽
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO:轧制方向,轧制模式 没有其他值暂不考虑,之后数据完善后需要考虑
|
|
|
|
|
|
|
|
PmPlateCutLenBtDO PPCLB = plistPmPlateCutLenBtDO.stream().
|
|
|
|
|
|
|
|
filter(f -> f.getMscLineNo() == "1030"
|
|
|
|
|
|
|
|
&& f.getBrrNeed() ==((p.getCal_Wid()>SInfo.getSlabActWid().intValue())?"1":"0")
|
|
|
|
|
|
|
|
&& f.getPlateThickFrom().compareTo(p.getCal_Thk())<=0
|
|
|
|
|
|
|
|
&& f.getPlateThickTo().compareTo(p.getCal_Thk())>=0
|
|
|
|
|
|
|
|
&& f.getSlabThickFrom().compareTo(SInfo.getSlabActThk())<=0
|
|
|
|
|
|
|
|
&& f.getSlabThickFrom().compareTo(SInfo.getSlabActThk())>=0
|
|
|
|
|
|
|
|
&& f.getCombinePlateWidthFrom().compareTo(BigDecimal.valueOf(p.getCal_Wid()))<=0
|
|
|
|
|
|
|
|
&& f.getCombinePlateWidthTo().compareTo(BigDecimal.valueOf(p.getCal_Wid()))<=0
|
|
|
|
|
|
|
|
).findFirst().orElse(null);
|
|
|
|
|
|
|
|
//切头
|
|
|
|
|
|
|
|
int intHead = PPCLB.getHeadCut().intValue();
|
|
|
|
|
|
|
|
//切尾
|
|
|
|
|
|
|
|
int intTail=PPCLB.getTailCut().intValue();
|
|
|
|
|
|
|
|
//去掉切头尾长度
|
|
|
|
|
|
|
|
int intCap =p.getCal_Len()-intHead-intTail;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long[] capacities = {intCap};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//初始化方案
|
|
|
|
|
|
|
|
Loader.loadNativeLibraries();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 调用 solve 方法来解决问题
|
|
|
|
|
|
|
|
ArrayList<Long> ltInt = solve(values, weights, capacities);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//循环返回的订单插入到实际数组中
|
|
|
|
|
|
|
|
for (int i = 0; i < ltInt.size(); i++) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//实例化实际订单号
|
|
|
|
|
|
|
|
p.setLtActInfoGPreOrder(new ArrayList<>());
|
|
|
|
|
|
|
|
int indexi=i;
|
|
|
|
|
|
|
|
p.getLtActInfoGPreOrder().add(p.getLtInfoGPreOrder().stream().filter(m-> m.getIDValue()== ltInt.get(indexi)).collect(Collectors.toList()).get(0));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据实际订单再计算
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|