Browse Source

增加重复配车校验

Zhangqy 2 months ago
parent
commit
4ca5e82f3b

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

@@ -105,12 +105,16 @@ public class DistributionServiceImpl implements DistributionService {
105 105
 
106 106
 public void lockAndInsertDetail(  List<Store> list,  Distribution distribution , String userId, String belongId){
107 107
     for (int i = 0; i < list.size(); i++) {
108
-        list.get(i).setLockFlag("1");
109
-        num += storeMapper.updateByPrimaryKey(list.get(i));
110
-        DistributionDetail detail = getDistributionDetail(distribution, list.get(i), userId, belongId);
111
-        num += distributionDetailMapper.insert(detail);
112
-        DistributionRecord record  = getDistributionRecord(distribution, list.get(i), "1",userId, belongId);
113
-        num += distributionRecordMapper.insert(record);
108
+        Store store = storeMapper.selectByPrimaryKey(list.get(i).getId());
109
+        if (!store.getLockFlag().equals("1") && distribution.getId()!= null && !distribution.getId().equals("")){
110
+            list.get(i).setLockFlag("1");
111
+            num += storeMapper.updateByPrimaryKey(list.get(i));
112
+            DistributionDetail detail = getDistributionDetail(distribution, list.get(i), userId, belongId);
113
+            num += distributionDetailMapper.insert(detail);
114
+            DistributionRecord record  = getDistributionRecord(distribution, list.get(i), "1",userId, belongId);
115
+            num += distributionRecordMapper.insert(record);
116
+        }
117
+
114 118
     }
115 119
 }
116 120
     public DistributionDetail getDistributionDetail(Distribution distribution, Store store, String userId, String belongId) {

Loading…
Cancel
Save