|
@@ -5,15 +5,20 @@ 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;
|
|
10
|
+import com.th.demo.mapping.ware.MoveRecordMapper;
|
9
|
11
|
import com.th.demo.mapping.ware.StoreMapper;
|
10
|
12
|
import com.th.demo.model.maint.Customer;
|
11
|
13
|
import com.th.demo.model.maint.Stack;
|
|
14
|
+import com.th.demo.model.system.SysUser;
|
12
|
15
|
import com.th.demo.model.system.Type;
|
13
|
16
|
import com.th.demo.model.ware.ChangeRecord;
|
|
17
|
+import com.th.demo.model.ware.MoveRecord;
|
14
|
18
|
import com.th.demo.model.ware.SplitRecord;
|
15
|
19
|
import com.th.demo.model.ware.Store;
|
16
|
20
|
import com.th.demo.service.maint.CustomerService;
|
|
21
|
+import com.th.demo.service.ware.MoveService;
|
17
|
22
|
import com.th.demo.service.ware.StoreService;
|
18
|
23
|
import com.th.demo.tools.JSONTools;
|
19
|
24
|
import com.th.demo.tools.Tools;
|
|
@@ -33,6 +38,10 @@ public class StoreServiceImpl implements StoreService {
|
33
|
38
|
public ChangeRecordMapper changeRecordMapper;
|
34
|
39
|
@Autowired//自动注入Mapper
|
35
|
40
|
public StoreMapper storeMapper;
|
|
41
|
+ @Autowired//自动注入Mapper
|
|
42
|
+ public StackMapper stackMapper;
|
|
43
|
+ @Autowired//自动注入Mapper
|
|
44
|
+ public MoveRecordMapper moveRecordMapper;
|
36
|
45
|
String result = Type.FAIL;
|
37
|
46
|
int num = 0;
|
38
|
47
|
|
|
@@ -86,7 +95,7 @@ public class StoreServiceImpl implements StoreService {
|
86
|
95
|
String fkcustmerName,
|
87
|
96
|
String userId,
|
88
|
97
|
String belongId) {
|
89
|
|
- PageHelper.startPage(page, rows);
|
|
98
|
+
|
90
|
99
|
List<String> pltNos =new ArrayList<>() ;
|
91
|
100
|
List<String> ordNos =new ArrayList<>() ;
|
92
|
101
|
if (plateNo.indexOf(",") != -1){
|
|
@@ -100,6 +109,7 @@ public class StoreServiceImpl implements StoreService {
|
100
|
109
|
customerName, plateNo,ordNo, pltNos,ordNos, userId,belongId,remark1,fkcustmerName);
|
101
|
110
|
|
102
|
111
|
if(page != -1){
|
|
112
|
+ PageHelper.startPage(page, rows);
|
103
|
113
|
PageInfo<Store> pageInfo = new PageInfo<>(list);
|
104
|
114
|
result = JSONTools.toStringyyyyMMddHHmmss(pageInfo);
|
105
|
115
|
}else {
|
|
@@ -237,4 +247,83 @@ public class StoreServiceImpl implements StoreService {
|
237
|
247
|
// return result;
|
238
|
248
|
//
|
239
|
249
|
// }
|
|
250
|
+
|
|
251
|
+ @Override
|
|
252
|
+ public String changeStack(String json,String newWare,String newStack,String newRemark1,String userId,String belongId) {
|
|
253
|
+ List<Store> listStore = JSON.parseObject(json, new TypeReference<List<Store>>() {});
|
|
254
|
+
|
|
255
|
+ int layerNew = 0;
|
|
256
|
+ int layerOld = 0;
|
|
257
|
+ int layer = 0;
|
|
258
|
+ if (!newWare.equals("") && newWare!=null && !newStack.equals("") && newStack!=null){
|
|
259
|
+ Stack toStack = stackMapper.selectByWareNameStackName(newWare,newStack,userId,belongId);
|
|
260
|
+ int currentLayer = Integer.parseInt(storeMapper.selectLayerByStackId(toStack.getId(), belongId));
|
|
261
|
+ if (toStack==null){
|
|
262
|
+ return JSONTools.toString(1,"没有找到该垛位信息");
|
|
263
|
+ }else{
|
|
264
|
+ for (int i = 0; i < listStore.size(); i++) {
|
|
265
|
+ layerOld = listStore.get(i).getLayer();
|
|
266
|
+
|
|
267
|
+ if (toStack.getIsLayer().equals("0")) {
|
|
268
|
+ layerNew = 0;
|
|
269
|
+ } else if (toStack.getIsLayer().equals("1")) {
|
|
270
|
+ layerNew = currentLayer + 1 + i;
|
|
271
|
+ } else if (toStack.getIsLayer().equals("2")) {
|
|
272
|
+ layerNew = layer;
|
|
273
|
+ }
|
|
274
|
+
|
|
275
|
+ listStore.get(i).setWare(toStack.getWare());
|
|
276
|
+ listStore.get(i).setStack(toStack);
|
|
277
|
+ listStore.get(i).setLayer(layerNew);
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+ MoveRecord moveRecord = getMoveRecord(listStore.get(i), listStore.get(i).getStack(), toStack, layerNew, layerOld, userId);
|
|
281
|
+ num = moveRecordMapper.insert(moveRecord);
|
|
282
|
+
|
|
283
|
+ num += storeMapper.updateByPrimaryKey(listStore.get(i));
|
|
284
|
+ }
|
|
285
|
+ }
|
|
286
|
+ }
|
|
287
|
+
|
|
288
|
+ for (int i = 0; i < listStore.size(); i++) {
|
|
289
|
+ if (!newRemark1.equals("") && newRemark1!=null){
|
|
290
|
+ if (newRemark1.equals("0")){
|
|
291
|
+ listStore.get(i).setRemark1("");
|
|
292
|
+ }else {
|
|
293
|
+ listStore.get(i).setRemark1(newRemark1);
|
|
294
|
+ }
|
|
295
|
+ }
|
|
296
|
+ num = storeMapper.updateByPrimaryKey(listStore.get(i));
|
|
297
|
+ }
|
|
298
|
+ return result;
|
|
299
|
+ }
|
|
300
|
+
|
|
301
|
+ private MoveRecord getMoveRecord(Store store, Stack fromStack, Stack toStack, int layerNew, int layerOld, String userId) {
|
|
302
|
+ MoveRecord moveRecord = new MoveRecord();
|
|
303
|
+ moveRecord.setWareNameOld(fromStack.getWare().getName());
|
|
304
|
+ moveRecord.setWareNameNew(toStack.getWare().getName());
|
|
305
|
+ moveRecord.setStackNameOld(fromStack.getName());
|
|
306
|
+ moveRecord.setStackNameNew(toStack.getName());
|
|
307
|
+ moveRecord.setLayerOld(layerOld);
|
|
308
|
+ moveRecord.setLayerNew(layerNew);
|
|
309
|
+ moveRecord.setMaterialName(store.getMaterial().getName());
|
|
310
|
+ // moveRecord.setMaterialNo(store.getMaterialNo());
|
|
311
|
+ moveRecord.setStandard(store.getMaterial().getStandard());
|
|
312
|
+ moveRecord.setModel(store.getModel());
|
|
313
|
+ moveRecord.setCustomerName(store.getCustomer().getName());
|
|
314
|
+ // moveRecord.setCustomerNo(store.getCustomerNo());
|
|
315
|
+ moveRecord.setCount(store.getCount());
|
|
316
|
+ moveRecord.setWeight(store.getWeight());
|
|
317
|
+ moveRecord.setRemark(store.getRemark());
|
|
318
|
+ moveRecord.setBelongId(store.getBelongId());
|
|
319
|
+ moveRecord.setPlateNo(store.getPlateNo());
|
|
320
|
+ moveRecord.setAddUser(new SysUser(userId));
|
|
321
|
+ moveRecord.setAddTime(new Date());
|
|
322
|
+ moveRecord.setReceiveAddress(store.getReceiveAddress());
|
|
323
|
+ moveRecord.setWgtDcnMtcCd(store.getWgtDcnMtcCd());
|
|
324
|
+ moveRecord.setEdgeTy(store.getEdgeTy());
|
|
325
|
+ moveRecord.setProductionPlace(store.getProductionPlace());
|
|
326
|
+ moveRecord.setCancelFlag("0");
|
|
327
|
+ return moveRecord;
|
|
328
|
+ }
|
240
|
329
|
}
|