MobileBatchReceiptController.java 2.63 KB
package com.huaheng.mobile.receipt;

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.general.container.service.IContainerService;
import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerView;
import com.huaheng.pc.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService;
import com.huaheng.pc.receipt.receiptHeader.service.IReceiptHeaderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/mobile/receipt/batch")
@Api(tags = {"MobileBatchReceiptController"}, description = "移动端收货")
public class MobileBatchReceiptController {

    @Resource
    private IContainerService containerService;
    @Resource
    private IReceiptHeaderService receiptHeaderService;
    @Resource
    private IReceiptContainerHeaderService receiptContainerHeaderService;


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

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

    @PostMapping("/save")
    @ApiOperation("移动端收货保存")
    @Log(title = "移动端收货保存", action = BusinessType.OTHER)
    public AjaxResult save(@RequestBody @ApiParam(value="容器号") List<ReceiptContainerView> record) throws Exception {
        AjaxResult result = receiptContainerHeaderService.batchSave(record);
        return result;
    }

}