ICSShipmentAPIService.java
26.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
package com.huaheng.api.U8.Service;
import com.alibaba.fastjson.JSON;
import com.huaheng.api.U8.domain.ICSShipmentDetail;
import com.huaheng.api.U8.domain.ICSShipmentHeader;
import com.huaheng.api.U8.domain.ICSShipmentModel;
import com.huaheng.api.general.service.ShipmentAPIService;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.http.HttpUtils;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.general.company.domain.CompanyWu;
import com.huaheng.pc.general.company.service.ICompanyService;
import com.huaheng.pc.general.material.domain.Material;
import com.huaheng.pc.general.material.service.IMaterialService;
import com.huaheng.pc.general.warehouse.domain.WarehouseWu;
import com.huaheng.pc.general.warehouse.service.IWarehouseService;
import com.huaheng.pc.inventory.inventory.domain.Inventory;
import com.huaheng.pc.inventory.inventory.service.IInventoryService;
import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail;
import com.huaheng.pc.shipment.shipmentDetail.service.IShipmentDetailService;
import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader;
import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentModel;
import com.huaheng.pc.shipment.shipmentHeader.service.IShipmentHeaderService;
import com.huaheng.pc.task.taskDetail.domain.TaskDetail;
import com.huaheng.pc.task.taskDetail.service.ITaskDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Service
public class ICSShipmentAPIService {
@Autowired
private IShipmentHeaderService shipmentHeaderService;
@Autowired
IShipmentDetailService shipmentDetailService;
@Autowired
private ICompanyService companyService;
@Autowired
private IMaterialService materialService;
@Autowired
private ICSShipmentHeaderService icsShipmentHeaderService;
@Autowired
private ICSShipmentDetailService icsShipmentDetailService;
@Autowired
private ShipmentAPIService shipmentAPIService;
@Autowired
private IWarehouseService warehouseService;
@Autowired
private ITaskDetailService taskDetailService;
@Autowired
private IInventoryService inventoryService;
//u8-wms出库下发
@Transactional
public AjaxResult insertICSShipment(ICSShipmentModel icsShipmentModel){
//获取主单和子单列
ICSShipmentHeader icsShipmentHeader=icsShipmentModel.getIcsShipmentHeader();
List<ICSShipmentDetail> icsShipmentDetails=icsShipmentModel.getIcsShipmentDetails();
if(!icsShipmentHeader.getType().equals("QO") && !icsShipmentHeader.getType().equals("MO") &&
!icsShipmentHeader.getType().equals("OO") && !icsShipmentHeader.getType().equals("PKO") && !icsShipmentHeader.getType().equals("TO")){
return AjaxResult.error("出库类型不匹配");
}
//判断系统中有没有该货主
CompanyWu companyWu=new CompanyWu();
companyWu.setuCompanyCode(icsShipmentHeader.getCompanyCode());
companyWu=companyService.selectCompanyWu(companyWu);
if(companyWu==null){
return AjaxResult.error("货主不存在");
}
companyService.checkwarehouseCompany(companyWu.getCompanyCode());
//根据icsShipmentHeader生成shipmentHeader
String type=icsShipmentHeader.getType();
ShipmentHeader shipmentHeader=new ShipmentHeader();
String warehouseCode=null;
if(!type.equals("OO") && !type.equals("PKO")) {
if (type.equals("TO")) {
warehouseCode = icsShipmentHeader.getoWHCode();
} else {
warehouseCode = icsShipmentHeader.getcWHCode();
}
//通过u8的货主和仓库匹配wms的仓库
WarehouseWu warehouseWu=new WarehouseWu();
warehouseWu.setuCompanyCode(icsShipmentHeader.getCompanyCode());
if(StringUtils.isEmpty(warehouseCode)){
throw new ServiceException("仓库编码为空");
}
warehouseWu.setuWarehouseCode(warehouseCode);
warehouseWu=warehouseService.selectWarehouseWu(warehouseWu);
if(warehouseWu==null){
throw new ServiceException("系统没有该仓库");
}
String maker = icsShipmentHeader.getcMaker();
shipmentHeader.setType(type);
shipmentHeader.setId(null);
shipmentHeader.setLastUpdatedBy(maker);
shipmentHeader.setCreatedBy(maker);
shipmentHeader.setRemark(icsShipmentHeader.getcMemo());
shipmentHeader.setWarehouseCode(warehouseWu.getWarehouseCode());
shipmentHeader.setuWarehouseCode(warehouseCode);
shipmentHeader.setCompanyCode(companyWu.getCompanyCode());
if (type.equals("OO")) {
shipmentHeader.setSourceCode(icsShipmentHeader.getMoCode());
} else if (type.equals("TO")) {
shipmentHeader.setSourceCode(icsShipmentHeader.getcTVCode());
} else {
shipmentHeader.setSourceCode(icsShipmentHeader.getcCode());
}
if (StringUtils.isEmpty(shipmentHeader.getSourceCode())) {
throw new ServiceException("没有单号");
}
ShipmentHeader receiptHeaderB = new ShipmentHeader();
receiptHeaderB.setSourceCode(shipmentHeader.getSourceCode());
if (shipmentHeaderService.selectFirstEntity(receiptHeaderB) != null) {
return AjaxResult.success("单号重复,已跳过");
}
//将主表插入到新的接收主表里去
int result=icsShipmentHeaderService.insertModel(icsShipmentHeader);
if(result<1){
throw new ServiceException("出库主单传输失败!");
}
//将子表插入到新的接收子表里去
for(ICSShipmentDetail item : icsShipmentDetails){
if(icsShipmentHeader.getType().equals("PKO")){
item.setcCode(icsShipmentHeader.getcTVCode());
}else {
item.setcCode(icsShipmentHeader.getcCode());
}
int result1=icsShipmentDetailService.insertModel(item);
if(result1<1){
throw new ServiceException("出库子单传输失败!");
}
}
//根据icsShipmentDetail生成shipmentAetail
List<ShipmentDetail> shipmentDetails = new ArrayList<ShipmentDetail>();
for (ICSShipmentDetail icsShipmentDetail : icsShipmentDetails) {
//查找物料
Material material = new Material();
material.setCode(icsShipmentDetail.getcInvCode());
material.setWarehouseCode(warehouseWu.getWarehouseCode());
material = materialService.selectFirstEntity(material);
if (material == null) {
throw new ServiceException("该物料不存在:" + icsShipmentDetail.getcInvCode());
}
ShipmentDetail shipmentDetail = new ShipmentDetail();
shipmentDetail.setId(null);
shipmentDetail.setWarehouseCode(warehouseWu.getWarehouseCode());
shipmentDetail.setMaterialCode(icsShipmentDetail.getcInvCode());
shipmentDetail.setZoneCode(material.getZoneCode());
shipmentDetail.setCreated(null);
shipmentDetail.setUnit(icsShipmentDetail.getcComUnitName());
shipmentDetail.setCreatedBy(maker);
shipmentDetail.setLastUpdated(null);
shipmentDetail.setLastUpdatedBy(maker);
if (!icsShipmentDetail.getCompanyCode().equals(icsShipmentHeader.getCompanyCode())) {
throw new ServiceException("子单货主与主单不对应");
}
shipmentDetail.setCompanyCode(companyWu.getCompanyCode());
shipmentDetail.setProject(icsShipmentDetail.getcItemName());
shipmentDetail.setQty((icsShipmentDetail.getiQuantity()).abs());
// shipmentDetail.setQtyCompleted(icsShipmentDetail.getiQuantity());
shipmentDetail.setInventoryStatus("good");
if (icsShipmentDetail.getIrowno() != null && StringUtils.isNotEmpty(icsShipmentDetail.getIrowno().toString())) {
shipmentDetail.setSourceLine(icsShipmentDetail.getIrowno().toString());
}
if (icsShipmentDetail.getSortSeq() != null && StringUtils.isNotEmpty(icsShipmentDetail.getSortSeq().toString())) {
shipmentDetail.setSourceLine(icsShipmentDetail.getSortSeq().toString());
}
shipmentDetails.add(shipmentDetail);
}
//调用公共API
ShipmentModel shipmentModel = new ShipmentModel();
shipmentModel.setShipmentHeader(shipmentHeader);
shipmentModel.setShipmentDetails(shipmentDetails);
return shipmentAPIService.insertShipment(shipmentModel);
}
return AjaxResult.success("出库单下发成功");
}
//出库单为销售出库或采购退货单时
@Transactional
public AjaxResult insertICSShipments(ICSShipmentModel icsShipmentModel){
ICSShipmentHeader icsShipmentHeader=icsShipmentModel.getIcsShipmentHeader();
List<ICSShipmentDetail> icsShipmentDetails=icsShipmentModel.getIcsShipmentDetails();
if(!icsShipmentHeader.getType().equals("SO") && !icsShipmentHeader.getType().equals("PRO")){
return AjaxResult.error("出库类型不匹配");
}
String code=null;
if(icsShipmentHeader.getType().equals("SO")) {
code=icsShipmentHeader.getcDLCode();
}else {
code=icsShipmentHeader.getcCode();
}
if(StringUtils.isEmpty(code)){
throw new ServiceException("没有单号");
}
ShipmentHeader shipmentHeaderB=new ShipmentHeader();
shipmentHeaderB.setSourceCode(code);
if(shipmentHeaderService.selectFirstEntity(shipmentHeaderB)!=null){
return AjaxResult.success("单号重复,已跳过");
}
//判断系统中有没有该货主
CompanyWu companyWu=new CompanyWu();
companyWu.setuCompanyCode(icsShipmentHeader.getCompanyCode());
companyWu=companyService.selectCompanyWu(companyWu);
if(companyWu==null){
return AjaxResult.error("货主不存在");
}
companyService.checkwarehouseCompany(companyWu.getCompanyCode());
//判断仓库是否存在单据的物料编码
WarehouseWu warehouseWu=new WarehouseWu();
ShipmentHeader shipmentHeader;
List<ShipmentDetail> shipmentDetails;
Set<String> warehouseCodes=new HashSet<>();
Set<String> uwarehouseCodes = new HashSet<>();
for(ICSShipmentDetail item:icsShipmentDetails){
//通过u8的货主和仓库匹配wms的仓库
warehouseWu.setuCompanyCode(item.getCompanyCode());
warehouseWu.setuWarehouseCode(item.getcWHCode());
warehouseWu=warehouseService.selectWarehouseWu(warehouseWu);
if(warehouseWu==null){
throw new ServiceException("系统没有该仓库");
}
uwarehouseCodes.add(item.getcWHCode());
warehouseCodes.add(warehouseWu.getWarehouseCode());
}
//将主表插入到新的接收主表里去
int result=icsShipmentHeaderService.insertModel(icsShipmentHeader);
if(result<1){
throw new ServiceException("出库主单传输失败!");
}
//将子表插入到新的接收子表里去
for(ICSShipmentDetail item : icsShipmentDetails){
item.setcCode(code);
int result1=icsShipmentDetailService.insertModel(item);
if(result1<1){
throw new ServiceException("出库子单传输失败!");
}
}
if(icsShipmentHeader.getType().equals("SO")) {
String maker = icsShipmentHeader.getcMaker();
for (String warehouseCode : warehouseCodes) {
for (String uwarehouseCode : uwarehouseCodes) {
shipmentDetails = new ArrayList<>();
//出库主单
shipmentHeader = new ShipmentHeader();
shipmentHeader.setType(icsShipmentHeader.getType());
shipmentHeader.setId(null);
shipmentHeader.setLastUpdatedBy(maker);
shipmentHeader.setCreatedBy(maker);
shipmentHeader.setSourceCode(code);
shipmentHeader.setRemark(icsShipmentHeader.getcMemo());
shipmentHeader.setWarehouseCode(warehouseCode);
shipmentHeader.setuWarehouseCode(uwarehouseCode);
shipmentHeader.setCompanyCode(companyWu.getCompanyCode());
//细单
for (ICSShipmentDetail item : icsShipmentDetails) {
//匹配仓库
if (uwarehouseCode.equals(item.getcWHCode())) {
//查找物料
Material material = new Material();
material.setCode(item.getcInvCode());
material.setWarehouseCode(warehouseCode);
material=materialService.selectFirstEntity(material);
if(material==null){
throw new ServiceException("该物料不存在:"+item.getcInvCode());
}
ShipmentDetail shipmentDetail = new ShipmentDetail();
shipmentDetail.setId(null);
shipmentDetail.setWarehouseCode(warehouseCode);
shipmentDetail.setMaterialCode(item.getcInvCode());
shipmentDetail.setZoneCode(material.getZoneCode());
shipmentDetail.setCreated(null);
shipmentDetail.setCreatedBy(maker);
shipmentDetail.setUnit(item.getcComUnitName());
shipmentDetail.setLastUpdated(null);
shipmentDetail.setLastUpdatedBy(maker);
if (!item.getCompanyCode().equals(icsShipmentHeader.getCompanyCode())) {
throw new ServiceException("子单货主与主单不对应");
}
shipmentDetail.setCompanyCode(companyWu.getCompanyCode());
shipmentDetail.setProject(item.getcItemName());
shipmentDetail.setQty((item.getiQuantity()).abs());
// shipmentDetail.setQtyCompleted(item.getiQuantity());
shipmentDetail.setInventoryStatus("good");
shipmentDetails.add(shipmentDetail);
}
}
//调用公共API
ShipmentModel shipmentModel = new ShipmentModel();
shipmentModel.setShipmentHeader(shipmentHeader);
shipmentModel.setShipmentDetails(shipmentDetails);
shipmentAPIService.insertShipment(shipmentModel);
}
}
}
return AjaxResult.success("下发成功");
}
//wms-u8出库回传
public AjaxResult ConfirmICSShipment(String url){
AjaxResult ajaxResult=new AjaxResult();
//先找出处于完成状态的taskDetail
TaskDetail taskDetail=new TaskDetail();
taskDetail.setStatus((short)40);
taskDetail=taskDetailService.selectFirstEntity(taskDetail);
if(taskDetail==null){
return AjaxResult.success("没有完成状态的子任务");
}
//根据子任务查找主单
ShipmentHeader shipmentHeader = new ShipmentHeader();
shipmentHeader.setCode(taskDetail.getBillCode());
shipmentHeader = shipmentHeaderService.selectFirstEntity(shipmentHeader);
if(shipmentHeader==null){
return AjaxResult.success("入库单上传中");
}
String type=shipmentHeader.getType();
String code=shipmentHeader.getSourceCode();
if (!type.equals("PRO") && !type.equals("MO") && !type.equals("QO") && !type.equals("SO") ) {
taskDetail.setStatus((short) 45);
taskDetailService.updateByModel(taskDetail);
return AjaxResult.success("该子任务所属单据无需上传");
}
//查看该物料是在哪个库存出库,是中间区的话,不上传u8
// Inventory inventory=new Inventory();
// inventory.setWarehouseCode(taskDetail.getWarehouseCode());
// inventory.setMaterialCode(taskDetail.getMaterialCode());
// inventory.setContainerCode(taskDetail.getContainerCode());
// inventory = inventoryService.selectFirstEntity(inventory);
// if(StringUtils.isNotEmpty(inventory.getReceiptCode()) && inventory.getReceiptCode().substring(0,2).equals("ZO")){
// taskDetail.setStatus((short) 45);
// taskDetailService.updateByModel(taskDetail);
// return AjaxResult.success("该子任务的物料在中间区无需上传");
// }
//查找相同单号的状态为40的子任务
TaskDetail detail=new TaskDetail();
detail.setStatus((short)40);
detail.setBillCode(shipmentHeader.getCode());
List<TaskDetail> taskDetails=taskDetailService.selectListEntityByEqual(detail);
//根据子任务查找子单
List<ShipmentDetail> shipmentDetails=new ArrayList<>();
for(TaskDetail item:taskDetails) {
ShipmentDetail shipmentDetail = shipmentDetailService.selectEntityById(item.getBillDetailId());
shipmentDetail.setQtyCompleted(item.getQty());
shipmentDetails.add(shipmentDetail);
}
CompanyWu companyWu=new CompanyWu();
companyWu.setCompanyCode(shipmentHeader.getCompanyCode());
companyWu=companyService.selectCompanyWu(companyWu);
ICSShipmentHeader icsShipmentHeader=new ICSShipmentHeader();
List<ICSShipmentDetail> icsShipmentDetails=new ArrayList<ICSShipmentDetail>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
String dt = simpleDateFormat.format(shipmentHeader.getLastUpdated());
//出库类型为采购的主单和子单
if(type.equals("PRO")){
icsShipmentHeader.setcCode(code);
icsShipmentHeader.setcWHCode(shipmentHeader.getuWarehouseCode());
icsShipmentHeader.setCompanyCode(companyWu.getuCompanyCode());
icsShipmentHeader=icsShipmentHeaderService.selectModel(icsShipmentHeader);
icsShipmentHeader.setdPODate(dt);
icsShipmentHeader.setcMaker(taskDetail.getLastUpdatedBy());
icsShipmentHeader.setID(shipmentHeader.getId());
icsShipmentHeader.setVoucherType("CreateICSRdRecord_01_Return");
//子单
for(ShipmentDetail item:shipmentDetails){
ICSShipmentDetail icsShipmentDetail=new ICSShipmentDetail();
icsShipmentDetail.setcCode(code);
icsShipmentDetail.setCompanyCode(companyWu.getuCompanyCode());
icsShipmentDetail.setcInvCode(item.getMaterialCode());
icsShipmentDetail=icsShipmentDetailService.selectModel(icsShipmentDetail);
icsShipmentDetail.setID(item.getId());
icsShipmentDetail.setiArrsId(icsShipmentDetail.getAutoID());
icsShipmentDetail.setiPOsID(icsShipmentDetail.getPODID());
icsShipmentDetail.setiQuantity(item.getQtyCompleted());
icsShipmentDetails.add(icsShipmentDetail);
}
// icsShipmentDetail.setcCode(code);
// icsShipmentDetail.setCompanyCode(companyWu.getuCompanyCode());
// icsShipmentDetails=icsShipmentDetailService.selectList(icsShipmentDetail);
// for(ICSShipmentDetail item :icsShipmentDetails){
// shipmentDetail.setShipmentCode(code);
// shipmentDetail.setSourceLine(item.getIrowno().toString());
// shipmentDetailService.selectFirstEntity(shipmentDetail);
// item.setID(shipmentDetail.getId());
// item.setiArrsId(item.getAutoID());
// item.setiPOsID(item.getPODID());
// }
}
//出库类型为材料或其他的主单和子单
if(type.equals("MO") || type.equals("QO")){
icsShipmentHeader.setcCode(code);
icsShipmentHeader.setcWHCode(shipmentHeader.getuWarehouseCode());
icsShipmentHeader.setCompanyCode(companyWu.getuCompanyCode());
icsShipmentHeader=icsShipmentHeaderService.selectModel(icsShipmentHeader);
icsShipmentHeader.setdDate(dt);
icsShipmentHeader.setcMaker(taskDetail.getLastUpdatedBy());
for(ShipmentDetail item:shipmentDetails){
ICSShipmentDetail icsShipmentDetailA=new ICSShipmentDetail();
icsShipmentDetailA.setcCode(code);
icsShipmentDetailA.setCompanyCode(companyWu.getuCompanyCode());
icsShipmentDetailA.setcInvCode(item.getMaterialCode());
icsShipmentDetailA=icsShipmentDetailService.selectModel(icsShipmentDetailA);
icsShipmentDetailA.setiQuantity(item.getQtyCompleted());
icsShipmentDetails.add(icsShipmentDetailA);
}
}
if(type.equals("MO")){
icsShipmentHeader.setVoucherType("UpdateICSRdRecord_11_Confirm");
}
if(type.equals("QO")){
icsShipmentHeader.setVoucherType("UpdateICSRdRecord_09_Confirm");
}
//出库类型为销售的主单和子单
if(type.equals("SO")){
icsShipmentHeader.setcDLCode (code);
icsShipmentHeader.setCompanyCode(companyWu.getuCompanyCode());
icsShipmentHeader=icsShipmentHeaderService.selectModel(icsShipmentHeader);
icsShipmentHeader.setdDate(dt);
icsShipmentHeader.setcMaker(taskDetail.getLastUpdatedBy());
icsShipmentHeader.setcWHCode(shipmentHeader.getuWarehouseCode());
WarehouseWu warehousewu=new WarehouseWu();
warehousewu.setuWarehouseCode(shipmentHeader.getuWarehouseCode());
warehousewu.setuCompanyCode(companyWu.getuCompanyCode());
icsShipmentHeader.setcWHName(warehouseService.selectWarehouseWu(warehousewu).getuWarehouseName());
icsShipmentHeader.setcCode(shipmentHeader.getSourceCode());
icsShipmentHeader.setVoucherType("CreateICSRdRecord_32");
icsShipmentHeader.setID(icsShipmentHeader.getDLID());
for(ShipmentDetail item:shipmentDetails){
ICSShipmentDetail icsShipmentDetailB=new ICSShipmentDetail();
icsShipmentDetailB.setcCode(code);
icsShipmentDetailB.setCompanyCode(companyWu.getuCompanyCode());
icsShipmentDetailB.setcInvCode(item.getMaterialCode());
icsShipmentDetailB=icsShipmentDetailService.selectModel(icsShipmentDetailB);
icsShipmentDetailB.setcCode(code);
icsShipmentDetailB.setID(icsShipmentDetailB.getDLID());
icsShipmentDetailB.setAutoID(icsShipmentDetailB.getAutoID());
icsShipmentDetailB.setiQuantity(item.getQtyCompleted());
icsShipmentDetails.add(icsShipmentDetailB);
}
// icsShipmentDetail.setDLID(icsShipmentHeader.getDLID());
// icsShipmentDetail.setcWHName(shipmentHeader.getuWarehouseCode());
// icsShipmentDetail.setCompanyCode(companyWu.getuCompanyCode());
// icsShipmentDetails=icsShipmentDetailService.selectList(icsShipmentDetail);
// String name=null;
// for(ICSShipmentDetail item :icsShipmentDetails){
// item.setcCode(code);
// item.setID(item.getDLID());
// item.setAutoID(item.getAutoID());
// name=item.getcWHName();
// }
}
// //出库类型为调拨的主单和子单
// if(type.equals("TO")){
// icsShipmentHeader.setcTVCode (code);
// icsShipmentHeader.setoWHCode(shipmentHeader.getWarehouseCode());
// icsShipmentHeader=icsShipmentHeaderService.selectModel(icsShipmentHeader);
// icsShipmentHeader.setcCode(shipmentHeader.getSourceCode());
// icsShipmentHeader.setcWHCode(icsShipmentHeader.getoWHCode());
// icsShipmentHeader.setcWHName(icsShipmentHeader.getoWHName());
//
// icsShipmentDetail.setcCode(code);
// icsShipmentDetail.setID(icsShipmentHeader.getID());
// icsShipmentDetails=icsShipmentDetailService.selectList(icsShipmentDetail);
// }
ICSShipmentModel model = new ICSShipmentModel();
model.setIcsShipmentHeader(icsShipmentHeader);
model.setIcsShipmentDetails(icsShipmentDetails);
String JsonParam = JSON.toJSONString(model);
String result = HttpUtils.bodypost(url, JsonParam);
ajaxResult = JSON.parseObject(result, AjaxResult.class);
if (!ajaxResult.hasErr()) {
for(TaskDetail item: taskDetails) {
item.setStatus((short) 50);
taskDetailService.updateByModel(item);
}
if (shipmentHeader.getFirstStatus() == 300 && shipmentHeader.getLastStatus() != 300) {
shipmentHeader.setUploadStatus(15);
shipmentHeaderService.updateByModel(shipmentHeader);
}
if (shipmentHeader.getFirstStatus() == 300 && shipmentHeader.getLastStatus() == 300) {
shipmentHeader.setFirstStatus(900);
shipmentHeader.setLastStatus(900);
shipmentHeader.setUploadStatus(20);
shipmentHeaderService.updateByModel(shipmentHeader);
}
}
return ajaxResult;
}
}