Преглед изворни кода

2024-11-05 合并大屏数据

luguang пре 2 недеља
родитељ
комит
f2b0f093a2
1 измењених фајлова са 34 додато и 12 уклоњено
  1. 34 12
      src/main/java/com/sy/coinage/workshop/component/ScreenComponent.java

+ 34 - 12
src/main/java/com/sy/coinage/workshop/component/ScreenComponent.java

@@ -128,6 +128,8 @@ public class ScreenComponent {
         // 取实物收发卡付出
         List<WorkshopAccount> accountListOut = this.workshopAccountList(2, date, dept);
         List<Stock> stockList = this.getStockList(2);
+        // 取手动管理的大屏数据
+        List<ScreenWareVO> screenDataList = this.listScreenData();
         List<ScreenWareVO> list = new ArrayList<>();
         if (stockList != null && stockList.size() > 0) {
             for (Stock stock : stockList) {
@@ -165,6 +167,15 @@ public class ScreenComponent {
                 if (vo.getQty() + vo.getDayInQty() + vo.getDayOutQty() > 0) {
                     list.add(vo);
                 }
+                if (screenDataList != null && screenDataList.size() > 0) {
+                    for (ScreenWareVO screenWareVO : list) {
+                        if (vo.getSecurities().equals(screenWareVO.getSecurities()) && vo.getWareCn().equals(screenWareVO.getWareCn())) {
+                            vo.setQty(vo.getQty() + (screenWareVO.getQty() == null ? 0 : screenWareVO.getQty()));
+                            vo.setDayInQty(vo.getDayInQty() + (screenWareVO.getDayInQty() == null ? 0 : screenWareVO.getDayInQty()));
+                            vo.setDayOutQty(vo.getDayOutQty() + (screenWareVO.getDayOutQty() == null ? 0 : screenWareVO.getDayOutQty()));
+                        }
+                    }
+                }
             }
         }
         this.redisService.set("screen_ware", JSON.toJSONString(list));
@@ -177,6 +188,8 @@ public class ScreenComponent {
         List<WorkshopAccount> accountListOut = this.workshopAccountList(2, date, dept);
         List<Stock> stockList = this.getStockList(1);
         List<ScreenWareVO> list = new ArrayList<>();
+        // 取手动管理的大屏数据
+        List<ScreenWareVO> screenDataList = this.listScreenData();
         if (stockList != null && stockList.size() > 0) {
             for (Stock stock : stockList) {
                 ScreenWareVO vo = new ScreenWareVO();
@@ -196,24 +209,33 @@ public class ScreenComponent {
                 if (vo.getQty() + vo.getDayInQty() + vo.getDayOutQty() > 0) {
                     list.add(vo);
                 }
-            }
-        }
-        // 取手动管理的大屏数据
-        List<ScreenWareVO> screenDataList = this.listScreenData();
-        if (screenDataList != null && screenDataList.size() > 0) {
-            if (list != null && list.size() > 0) {
-                for (ScreenWareVO screenWareVO : list) {
-                    for (int i = screenDataList.size() - 1; i >= 0; i--) {
-                        ScreenWareVO vo = screenDataList.get(i);
+                if (screenDataList != null && screenDataList.size() > 0) {
+                    for (ScreenWareVO screenWareVO : list) {
                         if (vo.getSecurities().equals(screenWareVO.getSecurities())) {
-                            screenDataList.remove(i);
-                            break;
+                            vo.setQty(vo.getQty() + (screenWareVO.getQty() == null ? 0 : screenWareVO.getQty()));
+                            vo.setDayInQty(vo.getDayInQty() + (screenWareVO.getDayInQty() == null ? 0 : screenWareVO.getDayInQty()));
+                            vo.setDayOutQty(vo.getDayOutQty() + (screenWareVO.getDayOutQty() == null ? 0 : screenWareVO.getDayOutQty()));
                         }
                     }
                 }
             }
-            list.addAll(screenDataList);
         }
+        // 取手动管理的大屏数据
+//        List<ScreenWareVO> screenDataList = this.listScreenData();
+//        if (screenDataList != null && screenDataList.size() > 0) {
+//            if (list != null && list.size() > 0) {
+//                for (ScreenWareVO screenWareVO : list) {
+//                    for (int i = screenDataList.size() - 1; i >= 0; i--) {
+//                        ScreenWareVO vo = screenDataList.get(i);
+//                        if (vo.getSecurities().equals(screenWareVO.getSecurities())) {
+//                            screenDataList.remove(i);
+//                            break;
+//                        }
+//                    }
+//                }
+//            }
+//            list.addAll(screenDataList);
+//        }
         this.redisService.set("screen_day", JSON.toJSONString(list));
     }