fangpy 10 mēneši atpakaļ
vecāks
revīzija
f4c40dcdb5

+ 11 - 0
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/domain/ProductionProcesses.java

@@ -274,6 +274,9 @@ public class ProductionProcesses implements Serializable {
     // 合金状态
     private String volumeMetalstate;
 
+    // 合金加合金状态
+    private String volumeMetalAndState;
+
     // 产品类型
     private String producttype;
 
@@ -979,6 +982,14 @@ public class ProductionProcesses implements Serializable {
         this.iffullth = iffullth;
     }
 
+    public String getVolumeMetalAndState() {
+        return volumeMetalAndState;
+    }
+
+    public void setVolumeMetalAndState(String volumeMetalAndState) {
+        this.volumeMetalAndState = volumeMetalAndState;
+    }
+
     public String getSeriSort(){
         String sortStr = this.getId();
         if(this.getStartTime() != null){

+ 93 - 2
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/service/impl/ApsServiceImpl.java

@@ -373,8 +373,99 @@ public class ApsServiceImpl implements ApsService {
     /**
      * 不同坯料计划之间的退火合并
      */
-    private void mergeBlanksTh(List<ProductionProcesses> mergeprocesses){
-        // 过滤不满炉的
+    private List<ProductionProcesses> mergeBlanksTh(List<ProductionProcesses> mergeprocesses){
+        // 合并后最终返回的订单列表
+        List<ProductionProcesses> allBlankMerges = new ArrayList<>();
+        // 待合并的订单列表
+        List<ProductionProcesses> toMerges = new ArrayList<>();
+        // 过滤不满炉的退火
+        for (ProductionProcesses mergeprocess : mergeprocesses) {
+            if(StrUtil.isNotBlank(mergeprocess.getIffullth()) && "y".equals(mergeprocess.getIffullth())){
+                toMerges.add(mergeprocess);
+            }else{
+                allBlankMerges.add(mergeprocess);
+            }
+        }
+        // 按照合金、合金状态、产品类型分组
+        Map<String, List<ProductionProcesses>> volumePros = toMerges.stream().collect(Collectors.groupingBy(ProductionProcesses::getVolumeMetalAndState));
+        volumePros.forEach((k,v)->{
+            if(v.size()>1){
+                // 待合并不满炉的数量大于1的系统合并
+                // 根据工序类型不同,以不同规则合并
+                String processType = v.get(0).getProcessType();
+                if("成退".equals(processType) || "中退".equals(processType)){
+                    // 计算总重量,总宽度,最大、最小重量宽度厚度
+                    BigDecimal totalWidth = new BigDecimal("0");
+                    BigDecimal totalWeight = new BigDecimal("0");
+                    // 最大、最小宽度
+                    BigDecimal maxVolumeWidth = null;
+                    BigDecimal minVolumeWidth = null;
+                    // 最大、最小厚度
+                    BigDecimal maxVolumeThickness = null;
+                    BigDecimal minVolumeThickness = null;
+                    // 最大、最小重量
+                    BigDecimal maxSinglerollweight = null;
+                    BigDecimal minSinglerollweight = null;
+
+                    for (ProductionProcesses productionProcesses : v) {
+                        totalWidth = totalWidth.add(productionProcesses.getVolumeWidth()).add(productionProcesses.getEquipment().getEquipmentParameter().getFurnace());
+                        totalWeight = totalWeight.add(productionProcesses.getSinglerollweight());
+                        // 宽度
+                        if(maxVolumeWidth == null){
+                            maxVolumeWidth = productionProcesses.getVolumeWidth();
+                        }else{
+                            if(productionProcesses.getVolumeWidth().compareTo(maxVolumeWidth)>0){
+                                maxVolumeWidth = productionProcesses.getVolumeWidth();
+                            }
+                        }
+                        if(minVolumeWidth == null){
+                            minVolumeWidth = productionProcesses.getVolumeWidth();
+                        }else{
+                            if(productionProcesses.getVolumeWidth().compareTo(minVolumeWidth)<0){
+                                minVolumeWidth = productionProcesses.getVolumeWidth();
+                            }
+                        }
+                        // 厚度
+                        if(maxVolumeThickness == null){
+                            maxVolumeThickness = productionProcesses.getVolumeThickness();
+                        }else{
+                            if(productionProcesses.getVolumeThickness().compareTo(maxVolumeThickness)>0){
+                                maxVolumeThickness = productionProcesses.getVolumeThickness();
+                            }
+                        }
+                        if(minVolumeThickness == null){
+                            minVolumeThickness = productionProcesses.getVolumeThickness();
+                        }else{
+                            if(productionProcesses.getVolumeThickness().compareTo(minVolumeThickness)<0){
+                                minVolumeThickness = productionProcesses.getVolumeThickness();
+                            }
+                        }
+                        // 重量
+                        if(maxSinglerollweight == null){
+                            maxSinglerollweight = productionProcesses.getSinglerollweight();
+                        }else{
+                            if(productionProcesses.getSinglerollweight().compareTo(maxSinglerollweight)>0){
+                                maxSinglerollweight = productionProcesses.getSinglerollweight();
+                            }
+                        }
+                        if(minSinglerollweight == null){
+                            minSinglerollweight = productionProcesses.getSinglerollweight();
+                        }else{
+                            if(productionProcesses.getSinglerollweight().compareTo(minSinglerollweight)<0){
+                                minSinglerollweight = productionProcesses.getSinglerollweight();
+                            }
+                        }
+                    }
+
+                } else if ("小卷成退".equals(processType)) {
+
+                }
+            }else{
+                allBlankMerges.addAll(v);
+            }
+        });
+
+        return allBlankMerges;
     }
 
     /**

+ 1 - 0
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/service/impl/ProductionScheduleServiceImpl.java

@@ -931,6 +931,7 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
             if(process.getUnitProduceTime() == null){
                 process.setUnitProduceTime((int)(Math.ceil((double)process.getProduceTime()/process.getProducePcNum())));
             }
+            process.setVolumeMetalAndState(process.getVolumeMetal() + process.getVolumeMetalstate() == null ? "" : process.getVolumeMetalstate() + process.getProcessType());
             // 可选设备初始化
             if(process.getOptionalEquipments() != null){
                 List<Equipment> providedEq = new ArrayList<>();