ReceivingController.java 4.12 KB
package com.huaheng.pc.receipt.receiving.controller;

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.receipt.receiptContainerDetail.service.ReceiptContainerDetailService;
import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderService;
import com.huaheng.pc.receipt.receiving.service.ReceivingService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author mahua
 * @ClassName ReceivingController
 * @projectName huaheng
 * @description: 入库组盘
 * @date 2019/8/31 15:51
 */
@Controller
@RequestMapping("/receipt/receiving")
public class ReceivingController extends BaseController {

    private String prefix = "receipt/receiving";

    @Resource
    private ReceivingService receivingService;
    @Resource
    private ReceiptContainerDetailService receiptContainerDetailService;
    @Resource
    private ReceiptContainerHeaderService receiptContainerHeaderService;

    @RequiresPermissions("receipt:receiving:view")
    @GetMapping()
    public String receiving() {
        return prefix + "/receiving";
    }

    /**
     * 获取订单明细
     */
    @ResponseBody
    @PostMapping("/scanBill")
    @RequiresPermissions("receipt:receiving:receiving")
    @Log(title = "入库-获取订单明细", operating ="PC端扫描收货单号", action = BusinessType.OTHER)
    public AjaxResult scanBill(String code)  {
        AjaxResult result = receivingService.scanReceiptCode(code);
        return result;
    }

    /**
     * 获取收货信息
     */
    @ResponseBody
    @PostMapping("/getReceiptInfoByBill")
    @RequiresPermissions("receipt:receiving:receiving")
    @Log(title = "入库-获取收货信息", operating ="获取收货信息", action = BusinessType.OTHER)
    public AjaxResult getReceiptInfoByBill(String code)  {
        AjaxResult result = receiptContainerDetailService.getReceiptInfoByBill(code);
        return result;
    }


    @GetMapping("/add")
    public String add() {
        return prefix + "/add";
    }

    /**
     * 保存收货
     */
    @ApiOperation(value="保存收货 ", notes="保存收货 ", httpMethod = "POST")
    @ResponseBody
    @PostMapping("/save")
    @RequiresPermissions("receipt:receiving:receiving")
    @Log(title = "入库-保存收货", operating ="PC端保存收货", action = BusinessType.OTHER)
    public AjaxResult save(
            @ApiParam(name="receiptCode",value="入库单编码") String receiptCode,
            @ApiParam(name="containerCode",value="容器编码")String containerCode,
            @ApiParam(name="receiptDetailId",value="入库单详情id")Integer receiptDetailId,
            @ApiParam(name="locationCode",value="库位编码", required = false)String locationCode,
            @ApiParam(name="qty",value="收货数量")Integer qty,
            @ApiParam(name="localtionRule",value="定位规则", required = false)String locatingRule){
//        LambdaQueryWrapper<TaskHeader> lambdaQueryWrapper = Wrappers.lambdaQuery();
//        lambdaQueryWrapper.eq(TaskHeader::getTaskType, 900)
//                .lt(TaskHeader::getStatus, 100)
//                .eq(TaskHeader::getWarehouseCode, ShiroUtils.getWarehouseCode());
//        int count = taskHeaderService.count(lambdaQueryWrapper);
//        if (count > 0)  {
//            return AjaxResult.error("仓库有“出库查看”任务没有完成,请先完成任务");
//        }
        AjaxResult result = receiptContainerHeaderService.saveCountain(receiptCode, containerCode, receiptDetailId,
                 locationCode, qty, locatingRule);
        return result;
    }
}