EmptyInController.java
4.05 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
package com.huaheng.api.pda.controller;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.huaheng.api.wcs.domain.ManyEmptyDomain;
import com.huaheng.api.wcs.service.taskAssignService.TaskAssignService;
import com.huaheng.api.wcs.service.warecellAllocation.LocationAllocationService;
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.config.address.service.AddressService;
import com.huaheng.pc.config.container.service.ContainerService;
import com.huaheng.pc.config.containerType.service.ContainerTypeService;
import com.huaheng.pc.config.location.service.LocationService;
import com.huaheng.pc.config.locationHigh.service.LocationHighService;
import com.huaheng.pc.config.locationType.service.LocationTypeService;
import com.huaheng.pc.config.zone.service.ZoneService;
import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService;
import com.huaheng.pc.system.dict.service.IDictDataService;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
import com.huaheng.pc.task.taskHeader.service.WorkTaskEmptyContainerService;
import com.huaheng.pc.task.taskHeader.service.WorkTaskService;
@RestController
@RequestMapping("/API/WMS/v2")
public class EmptyInController extends BaseController {
    @Resource
    private WorkTaskService workTaskService;
    @Resource
    private LocationAllocationService allocationService;
    @Resource
    private WorkTaskEmptyContainerService workTaskEmptyContainerService;
    @Resource
    private ZoneService zoneService;
    @Resource
    private LocationService locationService;
    @Resource
    private LocationTypeService locationTypeService;
    @Resource
    private LocationHighService locationHighService;
    @Resource
    private ContainerService containerService;
    @Resource
    private ContainerTypeService containerTypeService;
    @Autowired
    private AddressService addressService;
    @Resource
    private TaskHeaderService taskHeaderService;
    @Resource
    private TaskAssignService taskAssignService;
    @Resource
    private InventoryHeaderService inventoryHeaderService;
    @Resource
    private IDictDataService iDictDataService;
    /**
     * 生成空托盘入库任务
     * pda扫码托盘,找到对应上游发的空托入库任务,更新托盘号
     * @return
     */
    @PostMapping("/emptyInByContaienr")
    @Log(title = "任务-任务管理", operating = "生成空托盘入库任务", action = BusinessType.INSERT)
    @ResponseBody
    @ApiLogger(apiName = "PDA空托入库", from = "PDA")
    public AjaxResult emptyInByContaienr(@RequestBody ManyEmptyDomain manyEmptyDomain) {
        String containerCode = manyEmptyDomain.getContainerCode();
        // 特殊情况 解析容器号 TPR0A001
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("容器号不能为空");
        }
        if (ShiroUtils.getUser() == null) {
            return AjaxResult.error("登录超时,请重新登录");
        } else {
            if (StringUtils.isEmpty(ShiroUtils.getZoneCode())) {
                return AjaxResult.error("登录超时,请重新登录");
            }
        }
        // 校验用户操作容器是否合法
        containerTypeService.userOperatorContainerLegal(containerCode);
        AjaxResult ajaxResult = handleMultiProcess("emptyInByContaienr", new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                AjaxResult ajaxResult = inventoryHeaderService.createEmptyIn(containerCode, "", ShiroUtils.getArea(), manyEmptyDomain.getPort());
                return ajaxResult;
            }
        });
        return ajaxResult;
    }
}