MobileTaskForASRSController2.java 3.41 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.ShipmentAutoCombinationModel;
import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentCombinationModel;
import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader;
import com.huaheng.pc.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService;
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.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
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;
    @Resource
    private IShipmentContainerHeaderService shipmentContainerHeaderService;

    @PostMapping("/getTaskDetail")
    @ApiOperation("移动端扫描出库单")
    @Log(title = "移动端扫描出库单", action = BusinessType.OTHER)
    public AjaxResult getTaskDetail(@RequestBody @ApiParam(value = "出库单号") Map<String, String> param)  {
        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 = "出库任务") ShipmentTaskCreateModel model)  {
        AjaxResult result = taskService.createTaskFromShipmentContainers(model);
        return result;
    }

    @PostMapping("/combination")
    @ApiOperation("移动端生成出库组盘")
    @Log(title = "移动端出库组盘", action = BusinessType.OTHER)
    public AjaxResult combination(@RequestBody @ApiParam(value = "出库组盘") List<ShipmentCombinationModel> shipmentCombinationModels)  {
        AjaxResult result = shipmentContainerHeaderService.Batchcombination(shipmentCombinationModels);
        return result;
    }

    @PostMapping("/autoCombination")
    @ApiOperation("移动端生产自动出库组盘")
    @Log(title = "移动端自动出库组盘", action = BusinessType.OTHER)
    public AjaxResult autoCombination(@RequestBody @ApiParam(value = "出库组盘") List<ShipmentAutoCombinationModel> shipmentAutoCombinationModels)  {
        AjaxResult result = shipmentContainerHeaderService.autoCombination(shipmentAutoCombinationModels);
        return result;
    }
}