EmptyInController.java 4.05 KB
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;
    }

}