Quellcode durchsuchen

白坯布投放量处理

wukai vor 1 Monat
Ursprung
Commit
8e7d50babe

+ 13 - 0
jjt-biz/src/main/java/com/jjt/biz/service/impl/ApiYrServiceImpl.java

@@ -28,6 +28,7 @@ import java.time.LocalDateTime;
 import java.time.ZoneOffset;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
 /**
@@ -237,6 +238,18 @@ public class ApiYrServiceImpl implements IApiYrService {
             }
         }
         status.setOpenProd(open);
+
+        //白坯投放量处理--start
+        Map<String, Object> result = redisCache.getCacheObject(CacheConstants.VMS_STOCK);
+        Map<String, Long> lineMap = (Map<String, Long>) result.get("out-rz-line");
+        lineMap.remove("@type"); // 手动移除多余字段
+        AtomicReference<Long> baiPei = new AtomicReference<>(0L);
+        lineMap.forEach((key, value) -> {
+            baiPei.updateAndGet(v -> v + value);
+        });
+        status.setBaiPei(BigDecimal.valueOf(baiPei.get()));
+        //白坯投放量处理--end
+
         vo.setEff(effList);
         TwinRzCalcMonth calcMonth = new TwinRzCalcMonth();
         Map<String, Object> params = new HashMap<>(16);

+ 1 - 1
jjt-biz/src/main/java/com/jjt/utils/MssqlService.java

@@ -187,7 +187,7 @@ public class MssqlService {
                         String type = rs.getString("TYPE");
                         String date = rs.getString("TIME");
                         String target = rs.getString("TARGET");
-                        Long total = rs.getLong("TOTAL");
+                        Long total = rs.getLong("NUM");
 
                         MesStock mesStock = new MesStock();
                         mesStock.setCode(code);

+ 2 - 2
jjt-biz/src/main/java/com/jjt/vms/service/impl/WmsServiceImpl.java

@@ -49,7 +49,7 @@ public class WmsServiceImpl implements IWmsService {
         mapping.put("WH03", "pt");
         mapping.put("WH04", "bpb");
         mapping.put("WH08", "cp");
-        Map<String, Double> lineMap = new HashMap<>(16);
+        Map<String, Long> lineMap = new HashMap<>(16);
         Map<String, Object> result = new HashMap<>(16);
         result.put("ycl", initMap.clone());
         result.put("cp", initMap.clone());
@@ -66,7 +66,7 @@ public class WmsServiceImpl implements IWmsService {
         Map<String, List<MesStock>> bpTargetMap = wmsOutTargetList.stream().collect(Collectors.groupingBy(MesStock::getTarget));
         bpTargetMap.forEach((target, targetList) -> {
             //统计出库总量
-            double sum = targetList.stream().mapToDouble(MesStock::getTotal).sum();
+            long sum = targetList.stream().mapToLong(MesStock::getTotal).sum();
             //“染整白坯7#上料点”,解析产线
             String line = target.replace("染整白坯", "").replace("#上料点", "");
             lineMap.put(line, sum);