Browse Source

取消配车,取消出库合计减少程序检查

wangchenchen 1 month ago
parent
commit
db2e7fd56b

+ 17
- 4
src/main/java/com/th/demo/service/impl/ware/DistributionServiceImpl.java View File

79
         });
79
         });
80
         List<Store> list = JSON.parseObject(jsonList, new TypeReference<List<Store>>() {
80
         List<Store> list = JSON.parseObject(jsonList, new TypeReference<List<Store>>() {
81
         });
81
         });
82
-        if (distribution.getListDetail().size() == list.size()) {
83
-            distribution.setOutFlag("2");
84
-            num += distributionMapper.updateByPrimaryKey(distribution);
85
-        }
82
+
83
+        double cancelWeight = 0;
84
+        double cancelNum = 0;
85
+
86
         for (int i = 0; i < list.size(); i++) {
86
         for (int i = 0; i < list.size(); i++) {
87
+            cancelWeight+=list.get(i).getWeight();
88
+            cancelNum+=list.get(i).getCount();
87
             list.get(i).setLockFlag("0");
89
             list.get(i).setLockFlag("0");
88
             num += storeMapper.updateByPrimaryKey(list.get(i));
90
             num += storeMapper.updateByPrimaryKey(list.get(i));
89
         }
91
         }
92
+        if (distribution.getListDetail().size() == list.size()) {
93
+            distribution.setOutFlag("2");
94
+            distribution.setSumCount(distribution.getSumCount()-cancelNum);
95
+            distribution.setSumWeight(distribution.getSumWeight()-cancelWeight);
96
+            num += distributionMapper.updateByPrimaryKey(distribution);
97
+        }else{
98
+            distribution.setSumCount(distribution.getSumCount()-cancelNum);
99
+            distribution.setSumWeight(distribution.getSumWeight()-cancelWeight);
100
+            num += distributionMapper.updateByPrimaryKey(distribution);
101
+
102
+        }
90
         for (int i = 0; i < distribution.getListDetail().size(); i++) {
103
         for (int i = 0; i < distribution.getListDetail().size(); i++) {
91
             for (int j = 0; j < list.size(); j++) {
104
             for (int j = 0; j < list.size(); j++) {
92
                 if (distribution.getListDetail().get(i).getStore().getId().equals(list.get(j).getId())) {
105
                 if (distribution.getListDetail().get(i).getStore().getId().equals(list.get(j).getId())) {

+ 8
- 0
src/main/java/com/th/demo/service/impl/ware/OutServiceImpl.java View File

113
                 OutRecord outRecord = getOutRecord(store, "", "0", userId);
113
                 OutRecord outRecord = getOutRecord(store, "", "0", userId);
114
                 num += outRecordMapper.insert(outRecord);
114
                 num += outRecordMapper.insert(outRecord);
115
                 num += storeMapper.insert(store);
115
                 num += storeMapper.insert(store);
116
+                Distribution distribution = distributionMapper.selectByPrimaryKey(listOutRecord.get(i).getDistributionId());
117
+                distribution.setSumWeight(distribution.getSumWeight()- store.getWeight());
118
+                distribution.setSumCount(distribution.getSumCount()- store.getCount());
119
+                num=distributionMapper.updateByPrimaryKey(distribution);
116
             }
120
             }
117
             result = Tools.moreThanZeroResultJSON(num);
121
             result = Tools.moreThanZeroResultJSON(num);
118
         } else {
122
         } else {
129
                 OutRecord outRecord = getOutRecord(store, "", "0", userId);
133
                 OutRecord outRecord = getOutRecord(store, "", "0", userId);
130
                 num += outRecordMapper.insert(outRecord);
134
                 num += outRecordMapper.insert(outRecord);
131
                 num += storeMapper.insert(store);
135
                 num += storeMapper.insert(store);
136
+                Distribution distribution = distributionMapper.selectByPrimaryKey(listOutRecord.get(i).getDistributionId());
137
+                distribution.setSumWeight(distribution.getSumWeight()- store.getWeight());
138
+                distribution.setSumCount(distribution.getSumCount()- store.getCount());
139
+                num=distributionMapper.updateByPrimaryKey(distribution);
132
             }
140
             }
133
             result = Tools.moreThanZeroResultJSON(num);
141
             result = Tools.moreThanZeroResultJSON(num);
134
         }
142
         }

Loading…
Cancel
Save