MobileTaskForASRSController2.java 2.59 KB
package com.huaheng.mobile.shipment;

import com.alibaba.fastjson.JSONException;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.receipt.receiptHeader.service.IReceiptHeaderService;
import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader;
import com.huaheng.pc.shipment.shipmentHeader.service.IShipmentHeaderService;
import com.huaheng.pc.task.task.domain.ShipmentTaskCreateModel;
import com.huaheng.pc.task.task.service.ITaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/mobile/task/taskForShip")
@Api(tags = {"MobileTaskForShipController"}, description = "手机立体库任务拣货相关")
public class MobileTaskForASRSController2 {

    @Resource
    private IShipmentHeaderService shipmentHeaderService;
    @Resource
    private ITaskService taskService;

    @PostMapping("/getTaskDetail")
    @ApiOperation("移动端扫描出库单")
    @Log(title = "移动端扫描出库单", action = BusinessType.OTHER)
    public AjaxResult getTaskDetail(@RequestBody @ApiParam(value = "出库单号") Map<String, String> param) throws IllegalAccessException {
        if  (param.get("code") == null || param.get("code").trim().length() < 1)
            throw new JSONException("出库单号(code)不能为空");
        AjaxResult result = shipmentHeaderService.getShipDetail(param.get("code"));
        return result;
    }

    @PostMapping("/createShipTask")
    @ApiOperation("移动端生成出库任务")
    @Log(title = "移动端扫描出库单", action = BusinessType.OTHER)
    public AjaxResult createShipTask(@RequestBody @ApiParam(value = "出库任务") Map<String, String> param) throws IllegalAccessException {
        if  (param.get("containerCode") == null || param.get("containerCode").trim().length() < 1)
            throw new JSONException("容器号(containerCode)不能为空");
        String containerCode = param.get("containerCode");
        int[] ids = {4};
        ShipmentTaskCreateModel model = new ShipmentTaskCreateModel();
        model.setTaskType(1);
        model.setPriority((short)10);
        model.setShipmentContainerHeaderIds(ids);
        AjaxResult result = taskService.createTaskFromShipmentContainers(model);
        return result;
    }



}