|
@@ -5,16 +5,16 @@ import com.alibaba.fastjson.TypeReference;
|
5
|
5
|
import com.github.pagehelper.PageHelper;
|
6
|
6
|
import com.github.pagehelper.PageInfo;
|
7
|
7
|
import com.th.demo.mapping.maint.CustomerMapper;
|
|
8
|
+import com.th.demo.mapping.maint.StackMapper;
|
8
|
9
|
import com.th.demo.mapping.ware.ChangeRecordMapper;
|
9
|
10
|
import com.th.demo.mapping.ware.InRecordMapper;
|
|
11
|
+import com.th.demo.mapping.ware.MoveRecordMapper;
|
10
|
12
|
import com.th.demo.mapping.ware.StoreMapper;
|
11
|
13
|
import com.th.demo.model.maint.Customer;
|
12
|
14
|
import com.th.demo.model.maint.Stack;
|
|
15
|
+import com.th.demo.model.system.SysUser;
|
13
|
16
|
import com.th.demo.model.system.Type;
|
14
|
|
-import com.th.demo.model.ware.ChangeRecord;
|
15
|
|
-import com.th.demo.model.ware.InRecord;
|
16
|
|
-import com.th.demo.model.ware.SplitRecord;
|
17
|
|
-import com.th.demo.model.ware.Store;
|
|
17
|
+import com.th.demo.model.ware.*;
|
18
|
18
|
import com.th.demo.service.maint.CustomerService;
|
19
|
19
|
import com.th.demo.service.ware.StoreService;
|
20
|
20
|
import com.th.demo.tools.JSONTools;
|
|
@@ -39,6 +39,10 @@ public class StoreServiceImpl implements StoreService {
|
39
|
39
|
public CustomerMapper customerMapper;
|
40
|
40
|
@Autowired//自动注入Mapper
|
41
|
41
|
public InRecordMapper inRecordMapper;
|
|
42
|
+ @Autowired//自动注入Mapper
|
|
43
|
+ public MoveRecordMapper moveRecordMapper;
|
|
44
|
+ @Autowired//自动注入Mapper
|
|
45
|
+ public StackMapper stackMapper;
|
42
|
46
|
String result = Type.FAIL;
|
43
|
47
|
int num = 0;
|
44
|
48
|
|
|
@@ -338,4 +342,71 @@ public class StoreServiceImpl implements StoreService {
|
338
|
342
|
}
|
339
|
343
|
return Tools.moreThanZeroResultJSON(num);
|
340
|
344
|
}
|
|
345
|
+
|
|
346
|
+ @Override
|
|
347
|
+ public String changeStack(String json, String newWare, String newStack, String newRemark1, String newRemark, String userId, String belongId) {
|
|
348
|
+ List<Store> listStore = JSON.parseObject(json, new TypeReference<List<Store>>() {});
|
|
349
|
+
|
|
350
|
+ int layerNew = 0;
|
|
351
|
+ int layerOld = 0;
|
|
352
|
+ int layer = 0;
|
|
353
|
+ if (!newWare.equals("") && newWare!=null && !newStack.equals("") && newStack!=null){
|
|
354
|
+ Stack toStack = stackMapper.selectByWareNameStackName(newWare,newStack,userId,belongId);
|
|
355
|
+ int currentLayer = Integer.parseInt(storeMapper.selectLayerByStackId(toStack.getId(), belongId));
|
|
356
|
+ if (toStack==null){
|
|
357
|
+ return JSONTools.toString(1,"没有找到该垛位信息");
|
|
358
|
+ }else{
|
|
359
|
+ for (int i = 0; i < listStore.size(); i++) {
|
|
360
|
+ layerOld = listStore.get(i).getLayer();
|
|
361
|
+
|
|
362
|
+ if (toStack.getIsLayer().equals("0")) {
|
|
363
|
+ layerNew = 0;
|
|
364
|
+ } else if (toStack.getIsLayer().equals("1")) {
|
|
365
|
+ layerNew = currentLayer + 1 + i;
|
|
366
|
+ } else if (toStack.getIsLayer().equals("2")) {
|
|
367
|
+ layerNew = layer;
|
|
368
|
+ }
|
|
369
|
+
|
|
370
|
+ MoveRecord moveRecord = getMoveRecord(listStore.get(i), listStore.get(i).getStack(), toStack, layerNew, layerOld, userId);
|
|
371
|
+
|
|
372
|
+ listStore.get(i).setWare(toStack.getWare());
|
|
373
|
+ listStore.get(i).setStack(toStack);
|
|
374
|
+ listStore.get(i).setLayer(layerNew);
|
|
375
|
+ num = moveRecordMapper.insert(moveRecord);
|
|
376
|
+
|
|
377
|
+ num += storeMapper.updateByPrimaryKey(listStore.get(i));
|
|
378
|
+ }
|
|
379
|
+ }
|
|
380
|
+ }
|
|
381
|
+ return result;
|
|
382
|
+ }
|
|
383
|
+
|
|
384
|
+ private MoveRecord getMoveRecord(Store store, Stack fromStack, Stack toStack, int layerNew, int layerOld, String userId) {
|
|
385
|
+ MoveRecord moveRecord = new MoveRecord();
|
|
386
|
+ moveRecord.setWareNameOld(fromStack.getWare().getName());
|
|
387
|
+ moveRecord.setWareNameNew(toStack.getWare().getName());
|
|
388
|
+ moveRecord.setStackNameOld(fromStack.getName());
|
|
389
|
+ moveRecord.setStackNameNew(toStack.getName());
|
|
390
|
+ moveRecord.setLayerOld(layerOld);
|
|
391
|
+ moveRecord.setLayerNew(layerNew);
|
|
392
|
+ moveRecord.setMaterialName(store.getMaterial().getName());
|
|
393
|
+ // moveRecord.setMaterialNo(store.getMaterialNo());
|
|
394
|
+ moveRecord.setStandard(store.getMaterial().getStandard());
|
|
395
|
+ moveRecord.setModel(store.getModel());
|
|
396
|
+ moveRecord.setCustomerName(store.getCustomer().getName());
|
|
397
|
+ // moveRecord.setCustomerNo(store.getCustomerNo());
|
|
398
|
+ moveRecord.setCount(store.getCount());
|
|
399
|
+ moveRecord.setWeight(store.getWeight());
|
|
400
|
+ moveRecord.setRemark(store.getRemark());
|
|
401
|
+ moveRecord.setBelongId(store.getBelongId());
|
|
402
|
+ moveRecord.setPlateNo(store.getPlateNo());
|
|
403
|
+ moveRecord.setAddUser(new SysUser(userId));
|
|
404
|
+ moveRecord.setAddTime(new Date());
|
|
405
|
+ moveRecord.setReceiveAddress(store.getReceiveAddress());
|
|
406
|
+ moveRecord.setWgtDcnMtcCd(store.getWgtDcnMtcCd());
|
|
407
|
+ moveRecord.setEdgeTy(store.getEdgeTy());
|
|
408
|
+ moveRecord.setProductionPlace(store.getProductionPlace());
|
|
409
|
+ moveRecord.setCancelFlag("0");
|
|
410
|
+ return moveRecord;
|
|
411
|
+ }
|
341
|
412
|
}
|