PdaCallSomeOut.java
3.4 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
package com.huaheng.api.pda.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.security.ShiroUtils;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService;
import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderForShipmentService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/API/WMS/v2")
public class PdaCallSomeOut extends BaseController {
@Resource
private InventoryDetailService inventoryDetailService;
@Resource
private InventoryHeaderForShipmentService inventoryHeaderForShipmentService;
/**
* 生成空托出库任务
* @return
*/
@PostMapping("/PdaCallSomeOut")
@Log(title = "任务-任务管理", operating = "PDA生成有料托盘出库", action = BusinessType.INSERT)
@ResponseBody
@ApiLogger(apiName = "PDA生成有料托盘出库", from="PDA")
public AjaxResult wcsCallEmptyOut(String batch, String port) {
AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
@Override
public AjaxResult doProcess() {
AjaxResult ajaxResult = innerWcsCallEmptyOut(batch,port);
return ajaxResult;
}
});
return ajaxResult;
}
private AjaxResult innerWcsCallEmptyOut(String batch,String port) {
if(StringUtils.isEmpty(ShiroUtils.getWarehouseCode())){
return AjaxResult.error("未登录或登录超时,请先登录");
}
if (StringUtils.isEmpty(batch)){
return AjaxResult.error("批次号为空");
}
if(StringUtils.isEmpty(port)){
return AjaxResult.error("请输入站台");
}
if (!port.equals("P2001") && !port.equals("P1001")){
return AjaxResult.error(port+"站台不存在");
}
LambdaQueryWrapper<InventoryDetail> inventoryDetail= Wrappers.lambdaQuery();
inventoryDetail.eq(InventoryDetail::getWarehouseCode,"CS0001")
.eq(InventoryDetail::getBatch,batch);
List<InventoryDetail> list = inventoryDetailService.list(inventoryDetail);
if (list.size()>1){
return AjaxResult.error(batch+"批次号库内有"+list.size()+"个");
}
InventoryDetail inventoryDetails = inventoryDetailService.getOne(inventoryDetail);
if (inventoryDetails==null){
return AjaxResult.error("批次号"+batch+"不在库存内");
}
String inventoryHeaderId = inventoryDetails.getInventoryHeaderId().toString();
inventoryHeaderForShipmentService.shipmentContainer(inventoryHeaderId, port);
return AjaxResult.success();
}
}