YL2767 2 weeks ago
parent
commit
fd3802c350

+ 34
- 0
src/main/java/com/th/demo/controller/ware/StoreController.java View File

@@ -204,4 +204,38 @@ public class StoreController {
204 204
         }
205 205
     }
206 206
 
207
+    @RequestMapping(value = "/lockAndUnlock.do")
208
+    public String lockAndUnlock(String json,String lockFlag,
209
+                              HttpServletRequest request) {
210
+
211
+        try {
212
+            String userId = (String) request.getAttribute("userId");
213
+            String belongId = (String) request.getAttribute("belongId");
214
+            result=storeService.lockAndUnlock(json,lockFlag,userId,belongId);
215
+
216
+        } catch (Exception ex) {
217
+            ex.printStackTrace();
218
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
219
+        } finally {
220
+            return result;
221
+        }
222
+    }
223
+
224
+    @RequestMapping(value = "/Outbound.do")
225
+    public String Outbound(String json,String outbound,
226
+                       HttpServletRequest request) {
227
+
228
+        try {
229
+            String userId = (String) request.getAttribute("userId");
230
+            String belongId = (String) request.getAttribute("belongId");
231
+            result=storeService.Outbound(json,outbound,userId,belongId);
232
+
233
+        } catch (Exception ex) {
234
+            ex.printStackTrace();
235
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
236
+        } finally {
237
+            return result;
238
+        }
239
+    }
240
+
207 241
 }

+ 2
- 0
src/main/java/com/th/demo/mapping/ware/DistributionDetailMapper.java View File

@@ -21,4 +21,6 @@ public interface DistributionDetailMapper {
21 21
    List<DistributionDetail> selectByFid(String distributionId);
22 22
 
23 23
     int updateCancelFlagById(Map<String,Object> map);
24
+
25
+    List<DistributionDetail> selectByStoreId(String storeId);
24 26
 }

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

@@ -6,10 +6,7 @@ import com.github.pagehelper.PageHelper;
6 6
 import com.github.pagehelper.PageInfo;
7 7
 import com.th.demo.mapping.maint.CustomerMapper;
8 8
 import com.th.demo.mapping.maint.StackMapper;
9
-import com.th.demo.mapping.ware.ChangeRecordMapper;
10
-import com.th.demo.mapping.ware.InRecordMapper;
11
-import com.th.demo.mapping.ware.MoveRecordMapper;
12
-import com.th.demo.mapping.ware.StoreMapper;
9
+import com.th.demo.mapping.ware.*;
13 10
 import com.th.demo.model.maint.Customer;
14 11
 import com.th.demo.model.maint.Stack;
15 12
 import com.th.demo.model.system.SysUser;
@@ -43,6 +40,8 @@ public class StoreServiceImpl implements StoreService {
43 40
     public MoveRecordMapper moveRecordMapper;
44 41
     @Autowired//自动注入Mapper
45 42
     public StackMapper stackMapper;
43
+    @Autowired//自动注入Mapper
44
+    public DistributionDetailMapper distributionDetailMapper;
46 45
     String result = Type.FAIL;
47 46
     int num = 0;
48 47
 
@@ -391,6 +390,39 @@ public class StoreServiceImpl implements StoreService {
391 390
         return result;
392 391
     }
393 392
 
393
+    @Override
394
+    public String lockAndUnlock(String json,String lockFlag,String userId,String belongId) {
395
+        List<Store> listStore = JSON.parseObject(json, new TypeReference<List<Store>>() {});
396
+        if (lockFlag.equals("0")  ){
397
+            for (int i = 0; i < listStore.size(); i++) {
398
+                List<DistributionDetail> distributionDetailList = distributionDetailMapper.selectByStoreId(listStore.get(i).getId());
399
+                if (distributionDetailList.size()>0){
400
+                    return JSONTools.toString(1,"存在配车封锁,此类封锁无法解封,请配车取消解除封锁");
401
+                }
402
+                listStore.get(i).setLockFlag(lockFlag);
403
+                num += storeMapper.updateByPrimaryKey(listStore.get(i));
404
+            }
405
+        } else if (lockFlag.equals("1")) {
406
+            for (int i = 0; i < listStore.size(); i++) {
407
+                listStore.get(i).setLockFlag(lockFlag);
408
+                num += storeMapper.updateByPrimaryKey(listStore.get(i));
409
+            }
410
+        }
411
+        result = Tools.moreThanZeroResultJSON(num);
412
+        return result;
413
+    }
414
+
415
+    @Override
416
+    public String Outbound(String json,String outbound,String userId,String belongId) {
417
+        List<Store> listStore = JSON.parseObject(json, new TypeReference<List<Store>>() {});
418
+        for (int i = 0; i < listStore.size(); i++) {
419
+            listStore.get(i).setOutBound(outbound);
420
+            num += storeMapper.updateOutBoundByPrimaryKey(listStore.get(i));
421
+        }
422
+        result = Tools.moreThanZeroResultJSON(num);
423
+        return result;
424
+    }
425
+
394 426
     private MoveRecord getMoveRecord(Store store, Stack fromStack, Stack toStack, int layerNew, int layerOld, String userId) {
395 427
         MoveRecord moveRecord = new MoveRecord();
396 428
         moveRecord.setWareNameOld(fromStack.getWare().getName());

+ 7
- 0
src/main/resource/mapper/ware/DistributionDetailMapper.xml View File

@@ -115,4 +115,11 @@
115 115
     and ifnull(cancel_flag,'0') = '0'
116 116
   </select>
117 117
 
118
+  <select id="selectByStoreId" resultMap="BaseResultMap">
119
+    select *
120
+    from t_ware_distribution_detail
121
+    where store_id = #{param1,jdbcType=VARCHAR}
122
+    and ifnull(cancel_flag,'0') = '0'
123
+  </select>
124
+
118 125
 </mapper>

Loading…
Cancel
Save