luguang преди 2 седмици
родител
ревизия
23688bba3e
променени са 1 файла, в които са добавени 56 реда и са изтрити 10 реда
  1. 56 10
      src/main/java/com/sy/coinage/workshop/component/ScreenComponent.java

+ 56 - 10
src/main/java/com/sy/coinage/workshop/component/ScreenComponent.java

@@ -164,20 +164,51 @@ public class ScreenComponent {
                     Integer totalQty = accountListOut.stream().filter(item -> item.getWareId().intValue() == stock.getWareId().intValue() && item.getSecuritiesId().intValue() == stock.getSecuritiesId().intValue()).collect(Collectors.toList()).stream().mapToInt(item -> item.getPayQty()).sum();
                     vo.setDayOutQty(totalQty / p.getAmountPerBox());
                 }
-                if (vo.getQty() + vo.getDayInQty() + vo.getDayOutQty() > 0) {
-                    list.add(vo);
-                }
                 if (screenDataList != null && screenDataList.size() > 0) {
-                    for (ScreenWareVO screenWareVO : list) {
+                    for (int i = screenDataList.size() - 1; i >= 0; i--) {
+                        ScreenWareVO screenWareVO = screenDataList.get(i);
                         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()));
+                            screenDataList.remove(i);
+                        }
+                    }
+                }
+                if (vo.getQty() + vo.getDayInQty() + vo.getDayOutQty() > 0) {
+                    list.add(vo);
+                }
+                if (screenDataList != null && screenDataList.size() > 0) {
+                    for (int i = screenDataList.size() - 1; i >= 0; i--) {
+                        ScreenWareVO screenWareVO = screenDataList.get(i);
+                        if (vo.getWareCn().equals(screenWareVO.getWareCn())) {
+                            ScreenWareVO vo1 = new ScreenWareVO();
+                            vo1.setWareCn(screenWareVO.getWareCn());
+                            vo1.setSecurities(screenWareVO.getSecurities());
+                            vo1.setQty((screenWareVO.getQty() == null ? 0 : screenWareVO.getQty()));
+                            vo1.setDayInQty((screenWareVO.getDayInQty() == null ? 0 : screenWareVO.getDayInQty()));
+                            vo1.setDayOutQty((screenWareVO.getDayOutQty() == null ? 0 : screenWareVO.getDayOutQty()));
+                            screenDataList.remove(i);
+                            if (vo1.getQty() + vo1.getDayInQty() + vo1.getDayOutQty() > 0) {
+                                list.add(vo1);
+                            }
                         }
                     }
                 }
-
-
+            }
+            if (screenDataList != null && screenDataList.size() > 0) {
+                for (int i = screenDataList.size() - 1; i >= 0; i--) {
+                    ScreenWareVO screenWareVO = screenDataList.get(i);
+                    ScreenWareVO vo1 = new ScreenWareVO();
+                    vo1.setWareCn(screenWareVO.getWareCn());
+                    vo1.setSecurities(screenWareVO.getSecurities());
+                    vo1.setQty((screenWareVO.getQty() == null ? 0 : screenWareVO.getQty()));
+                    vo1.setDayInQty((screenWareVO.getDayInQty() == null ? 0 : screenWareVO.getDayInQty()));
+                    vo1.setDayOutQty((screenWareVO.getDayOutQty() == null ? 0 : screenWareVO.getDayOutQty()));
+                    if (vo1.getQty() + vo1.getDayInQty() + vo1.getDayOutQty() > 0) {
+                        list.add(vo1);
+                    }
+                }
             }
         }
         this.redisService.set("screen_ware", JSON.toJSONString(list));
@@ -208,18 +239,33 @@ public class ScreenComponent {
                     Integer totalQty = accountListOut.stream().filter(item -> item.getSecuritiesId().intValue() == stock.getSecuritiesId().intValue()).collect(Collectors.toList()).stream().mapToInt(item -> item.getPayQty()).sum();
                     vo.setDayOutQty(totalQty / p.getAmountPerBox());
                 }
-                if (vo.getQty() + vo.getDayInQty() + vo.getDayOutQty() > 0) {
-                    list.add(vo);
-                }
                 if (screenDataList != null && screenDataList.size() > 0) {
-                    for (ScreenWareVO screenWareVO : list) {
+                    for (int i = screenDataList.size() - 1; i >= 0; i--) {
+                        ScreenWareVO screenWareVO = screenDataList.get(i);
                         if (vo.getSecurities().equals(screenWareVO.getSecurities())) {
                             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()));
+                            screenDataList.remove(i);
                         }
                     }
                 }
+                if (vo.getQty() + vo.getDayInQty() + vo.getDayOutQty() > 0) {
+                    list.add(vo);
+                }
+            }
+            if (screenDataList != null && screenDataList.size() > 0) {
+                for (int i = screenDataList.size() - 1; i >= 0; i--) {
+                    ScreenWareVO screenWareVO = screenDataList.get(i);
+                    ScreenWareVO vo = new ScreenWareVO();
+                    vo.setSecurities(screenWareVO.getSecurities());
+                    vo.setQty((screenWareVO.getQty() == null ? 0 : screenWareVO.getQty()));
+                    vo.setDayInQty((screenWareVO.getDayInQty() == null ? 0 : screenWareVO.getDayInQty()));
+                    vo.setDayOutQty((screenWareVO.getDayOutQty() == null ? 0 : screenWareVO.getDayOutQty()));
+                    if (vo.getQty() + vo.getDayInQty() + vo.getDayOutQty() > 0) {
+                        list.add(vo);
+                    }
+                }
             }
         }
         // 取手动管理的大屏数据