Commit 95cab42686f8d656b525f7ee5872e394c05c5c1c
1 parent
21b88bf0
添加移动端呼叫料盒接口
Showing
5 changed files
with
246 additions
and
0 deletions
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mobile/controller/ReceiptController.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.mobile.controller; | ||
2 | + | ||
3 | +import io.swagger.annotations.Api; | ||
4 | +import io.swagger.annotations.ApiOperation; | ||
5 | +import io.swagger.annotations.ApiParam; | ||
6 | +import org.jeecg.common.api.vo.Result; | ||
7 | +import org.jeecg.common.aspect.annotation.AutoLog; | ||
8 | +import org.jeecg.common.system.base.controller.JeecgController; | ||
9 | +import org.jeecg.common.system.util.JwtUtil; | ||
10 | +import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; | ||
11 | +import org.jeecg.modules.wms.api.mobile.service.IMobileService; | ||
12 | +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; | ||
13 | +import org.jeecg.modules.wms.framework.controller.BaseController; | ||
14 | +import org.jeecg.utils.constant.QuantityConstant; | ||
15 | +import org.springframework.web.bind.annotation.*; | ||
16 | +import javax.annotation.Resource; | ||
17 | +import javax.servlet.http.HttpServletRequest; | ||
18 | + | ||
19 | +/** | ||
20 | + * PDA入库接口,整合复用PC端service层接口 | ||
21 | + */ | ||
22 | +@Api(tags="Mobile") | ||
23 | +@RestController | ||
24 | +@RequestMapping("/mobile/receipt") | ||
25 | +public class ReceiptController extends BaseController { | ||
26 | + | ||
27 | + @Resource | ||
28 | + private IMobileService mobileService; | ||
29 | + | ||
30 | + @AutoLog(value = "PDA入库-呼叫料盒") | ||
31 | + @ApiOperation(value="PDA入库-呼叫料盒", notes="创建空的补充入库任务,并返回任务id") | ||
32 | + @PostMapping("/callbox") | ||
33 | + @ResponseBody | ||
34 | + @ApiLogger(apiName = "PDA入库-呼叫料盒", from="PDA") | ||
35 | + public Result<Integer> callBox(@RequestBody CallBoxBean bean, HttpServletRequest req) { | ||
36 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
37 | + | ||
38 | + //补充入库类型 | ||
39 | + bean.setType(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT); | ||
40 | + | ||
41 | + Result result = handleMultiProcess("callBox", new JeecgController.MultiProcessListener() { | ||
42 | + @Override | ||
43 | + public Result doProcess() { | ||
44 | + return mobileService.callBox(bean, warehouseCode); | ||
45 | + } | ||
46 | + }); | ||
47 | + return result; | ||
48 | + } | ||
49 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mobile/controller/ShipmentController.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.mobile.controller; | ||
2 | + | ||
3 | + | ||
4 | +import com.aliyun.oss.ServiceException; | ||
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
6 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
7 | +import org.apache.commons.lang3.StringUtils; | ||
8 | +import org.jeecg.common.api.vo.Result; | ||
9 | +import org.jeecg.common.system.base.controller.JeecgController; | ||
10 | +import org.jeecg.common.system.util.JwtUtil; | ||
11 | +import org.jeecg.modules.wms.api.erp.service.IErpService; | ||
12 | +import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; | ||
13 | +import org.jeecg.modules.wms.api.mobile.service.IMobileService; | ||
14 | +import org.jeecg.modules.wms.config.container.entity.Container; | ||
15 | +import org.jeecg.modules.wms.config.container.service.IContainerService; | ||
16 | +import org.jeecg.modules.wms.config.location.entity.Location; | ||
17 | +import org.jeecg.modules.wms.config.location.service.ILocationService; | ||
18 | +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; | ||
19 | +import org.jeecg.modules.wms.framework.controller.BaseController; | ||
20 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | ||
21 | +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; | ||
22 | +import org.jeecg.utils.constant.QuantityConstant; | ||
23 | +import org.springframework.web.bind.annotation.*; | ||
24 | + | ||
25 | +import javax.annotation.Resource; | ||
26 | +import javax.servlet.http.HttpServletRequest; | ||
27 | + | ||
28 | +/** | ||
29 | + * @author 游杰 | ||
30 | + */ | ||
31 | +@RestController | ||
32 | +@RequestMapping("/mobile/receipt") | ||
33 | +public class ReceiptController extends BaseController { | ||
34 | + | ||
35 | + | ||
36 | + @Resource | ||
37 | + private IMobileService mobileService; | ||
38 | + | ||
39 | + @PostMapping("/callbox") | ||
40 | + @ResponseBody | ||
41 | + @ApiLogger(apiName = "呼叫入库料盒", from="PDA") | ||
42 | + public Result callBox(@RequestBody CallBoxBean bean, HttpServletRequest req) { | ||
43 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
44 | + | ||
45 | + if(StringUtils.isEmpty(bean.getContainerCode())){ | ||
46 | + return Result.error("托盘号containerCode不能为空"); | ||
47 | + } | ||
48 | + | ||
49 | + if(StringUtils.isEmpty(bean.getLocationCode())){ | ||
50 | + return Result.error("库位locationCode不能为空"); | ||
51 | + } | ||
52 | + | ||
53 | + if(StringUtils.isEmpty(bean.getCompanyCode())){ | ||
54 | + return Result.error("货主companyCode不能为空"); | ||
55 | + } | ||
56 | + | ||
57 | + //补充入库类型 | ||
58 | + bean.setType(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT); | ||
59 | + | ||
60 | + Result result = handleMultiProcess("receipt", new JeecgController.MultiProcessListener() { | ||
61 | + @Override | ||
62 | + public Result doProcess() { | ||
63 | + return mobileService.callBox(bean, warehouseCode); | ||
64 | + } | ||
65 | + }); | ||
66 | + return result; | ||
67 | + } | ||
68 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mobile/entity/CallBoxBean.java
0 → 100644
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mobile/service/IMobileService.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.mobile.service; | ||
2 | + | ||
3 | +import org.jeecg.common.api.vo.Result; | ||
4 | +import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; | ||
5 | +import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | ||
6 | +import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; | ||
7 | +import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; | ||
8 | + | ||
9 | +public interface IMobileService { | ||
10 | + | ||
11 | + Result callBox(CallBoxBean bean, String warehouseCode); | ||
12 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mobile/service/impl/MobileService.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.mobile.service.impl; | ||
2 | + | ||
3 | +import com.aliyun.oss.ServiceException; | ||
4 | +import org.apache.commons.lang3.StringUtils; | ||
5 | +import org.jeecg.common.api.vo.Result; | ||
6 | +import org.jeecg.modules.wms.api.erp.service.IErpService; | ||
7 | +import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; | ||
8 | +import org.jeecg.modules.wms.api.mobile.service.IMobileService; | ||
9 | +import org.jeecg.modules.wms.config.container.entity.Container; | ||
10 | +import org.jeecg.modules.wms.config.container.service.IContainerService; | ||
11 | +import org.jeecg.modules.wms.config.location.entity.Location; | ||
12 | +import org.jeecg.modules.wms.config.location.service.ILocationService; | ||
13 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | ||
14 | +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; | ||
15 | +import org.jeecg.utils.constant.QuantityConstant; | ||
16 | +import org.springframework.stereotype.Service; | ||
17 | +import org.springframework.transaction.annotation.Transactional; | ||
18 | + | ||
19 | +import javax.annotation.Resource; | ||
20 | + | ||
21 | +/** | ||
22 | + * @author 游杰 | ||
23 | + */ | ||
24 | +@Service | ||
25 | +public class MobileService implements IMobileService { | ||
26 | + | ||
27 | + @Resource | ||
28 | + private IErpService erpService; | ||
29 | + | ||
30 | + @Resource | ||
31 | + private IContainerService containerService; | ||
32 | + | ||
33 | + @Resource | ||
34 | + private ILocationService locationService; | ||
35 | + | ||
36 | + @Resource | ||
37 | + private ITaskHeaderService taskHeaderService; | ||
38 | + | ||
39 | + @Override | ||
40 | + @Transactional(rollbackFor = Exception.class) | ||
41 | + public Result callBox(CallBoxBean bean, String warehouseCode) { | ||
42 | + if(StringUtils.isEmpty(bean.getContainerCode())){ | ||
43 | + return Result.error("托盘号containerCode不能为空"); | ||
44 | + } | ||
45 | + | ||
46 | + if(StringUtils.isEmpty(bean.getLocationCode())){ | ||
47 | + return Result.error("库位locationCode不能为空"); | ||
48 | + } | ||
49 | + | ||
50 | + if(StringUtils.isEmpty(bean.getCompanyCode())){ | ||
51 | + return Result.error("货主companyCode不能为空"); | ||
52 | + } | ||
53 | + | ||
54 | + Container container = containerService.getContainerByCode(bean.getContainerCode(), warehouseCode); | ||
55 | + if (container == null) { | ||
56 | + return Result.error(bean.getContainerCode() + " " + warehouseCode + "容器不存在"); | ||
57 | + } | ||
58 | + | ||
59 | + if (StringUtils.isEmpty(container.getLocationCode())) { | ||
60 | + return Result.error(bean.getContainerCode() + "容器不在库位上"); | ||
61 | + } | ||
62 | + | ||
63 | + if (!container.getLocationCode().equals(bean.getLocationCode())) { | ||
64 | + return Result.error(bean.getContainerCode() + "容器不在库位[" + bean.getLocationCode() + "]上"); | ||
65 | + } | ||
66 | + | ||
67 | + Location loc = locationService.getLocationByCode(bean.getLocationCode(), warehouseCode); | ||
68 | + //校验目标地址 | ||
69 | + if (loc == null) { | ||
70 | + return Result.error("目标库位不存在"); | ||
71 | + } | ||
72 | + if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(loc.getStatus())) { | ||
73 | + return Result.error("目标库位非空闲"); | ||
74 | + } | ||
75 | + //判断托盘是否已经存在任务 | ||
76 | + TaskHeader taskHeader = taskHeaderService.getUnCompleteTaskByContainerCode(bean.getContainerCode(), warehouseCode); | ||
77 | + if (taskHeader != null) { | ||
78 | + return Result.error("容器已存在任务"); | ||
79 | + } | ||
80 | + | ||
81 | + //创建主任务 | ||
82 | + taskHeader = new TaskHeader(); | ||
83 | + taskHeader.setWarehouseCode(loc.getWarehouseCode()); | ||
84 | + taskHeader.setCompanyCode(bean.getCompanyCode()); | ||
85 | + if (bean.getType() == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | ||
86 | + //补充入库任务 | ||
87 | + taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); | ||
88 | + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT); | ||
89 | + } else if(bean.getType() == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) { | ||
90 | + //分拣任务 | ||
91 | + taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); | ||
92 | + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT); | ||
93 | + } | ||
94 | + taskHeader.setContainerCode(container.getCode()); | ||
95 | + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); | ||
96 | + taskHeader.setFromLocationCode(loc.getCode()); | ||
97 | + if (taskHeaderService.save(taskHeader)) { | ||
98 | + //锁定库位状态 | ||
99 | + locationService.updateStatus(loc.getCode(), QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); | ||
100 | + } else { | ||
101 | + throw new ServiceException("补充入库主表生成失败!"); | ||
102 | + } | ||
103 | + | ||
104 | + return Result.OK("呼叫料盒成功", taskHeader.getId()); | ||
105 | + } | ||
106 | +} |