ICSReceiptApi.java 7.11 KB
package com.huaheng.api.U8.controller;

import com.huaheng.api.U8.Service.ICSReceiptAPIService;
import com.huaheng.api.U8.domain.ICSReceiptDetail;
import com.huaheng.api.U8.domain.ICSReceiptHeader;
import com.huaheng.api.U8.domain.ICSReceiptModel;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.junit.platform.commons.logging.Logger;
import org.junit.platform.commons.logging.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * u8-wms入库下发或回传接口
 *  @author huaheng
 *  @date 2019-1-4
 *
 */
@RestController
@RequestMapping("/api/icsReceipt")
@Api(tags = {"icsReceipt"}, description = "ICS入库下发或回传接口")
public class ICSReceiptApi extends BaseController {
    private static final Logger logger = LoggerFactory.getLogger(ICSReceiptApi.class);

    @Autowired
    private ICSReceiptAPIService icsReceiptAPIService;

    @Log(title = "采购订单", action = BusinessType.INSERT)
    @PostMapping("/GetICSPO_PO")
    @ApiOperation("ICS采购订单接口")
    @ResponseBody
    public AjaxResult GetICSPO_PO(@RequestBody ICSReceiptModel icsReceiptModel){
        ICSReceiptHeader icsReceiptHeader=icsReceiptModel.getIcsReceiptHeader();
        List<ICSReceiptDetail> icsReceiptDetails = icsReceiptModel.getIcsReceiptDetails();
        if(icsReceiptHeader==null ){
            return AjaxResult.error("缺少主单据");
        }
        if(icsReceiptDetails==null){
            return AjaxResult.error("缺少子单据");
        }
        icsReceiptHeader.setType("PCI");
        AjaxResult ajaxResult = icsReceiptAPIService.insertICSReceipt(icsReceiptModel);
        return ajaxResult;
    }



    @Log(title = "采购到货单下发", action = BusinessType.INSERT)
    @PostMapping("/GetICSPU_ArrivalVouch")
    @ApiOperation("ICS采购到货单下发接口")
    @ResponseBody
    public AjaxResult GetICSPU_ArrivalVouch(@RequestBody ICSReceiptModel icsReceiptModel){
        ICSReceiptHeader icsReceiptHeader=icsReceiptModel.getIcsReceiptHeader();
        List<ICSReceiptDetail> icsReceiptDetails = icsReceiptModel.getIcsReceiptDetails();
        if(icsReceiptHeader==null ){
            return AjaxResult.error("缺少主单据");
        }
        if(icsReceiptDetails==null){
            return AjaxResult.error("缺少子单据");
        }
        icsReceiptHeader.setType("PI");
        AjaxResult ajaxResult = icsReceiptAPIService.insertICSReceipts(icsReceiptModel);
        return ajaxResult;
    }

    @Log(title = "材料出库单(红字)", action = BusinessType.INSERT)
    @PostMapping("/GetICSRdRecord_11_Return")
    @ApiOperation("ICS材料出库单(红字)下发接口")
    @ResponseBody
    public AjaxResult GetICSRdRecord_11_Return(@RequestBody ICSReceiptModel icsReceiptModel){
        ICSReceiptHeader icsReceiptHeader=icsReceiptModel.getIcsReceiptHeader();
        List<ICSReceiptDetail> icsReceiptDetails = icsReceiptModel.getIcsReceiptDetails();
        if(icsReceiptHeader==null ){
            return AjaxResult.error("缺少主单据");
        }
        if(icsReceiptDetails==null){
            return AjaxResult.error("缺少子单据");
        }
        icsReceiptHeader.setType("CI");
        AjaxResult ajaxResult = icsReceiptAPIService.insertICSReceipt(icsReceiptModel);
        return ajaxResult;
    }

//    @Log(title = "产成品入库单", action = BusinessType.INSERT)
//    @PostMapping("/CreateICSRdRecord_10")
//    @ApiOperation("ICS产成品入库单下发接口")
//    @ResponseBody
//    public AjaxResult CreateICSRdRecord_10(@RequestBody ICSReceiptModel icsReceiptModel){
//        ICSReceiptHeader icsReceiptHeader=icsReceiptModel.getIcsReceiptHeader();
//        List<ICSReceiptDetail> icsReceiptDetails = icsReceiptModel.getIcsReceiptDetails();
//        if(icsReceiptHeader==null ){
//            return AjaxResult.error("缺少主单据");
//        }
//        if(icsReceiptDetails==null){
//            return AjaxResult.error("缺少子单据");
//        }
//        icsReceiptHeader.setType("SI");
//        AjaxResult ajaxResult = icsReceiptAPIService.insertICSReceipt(icsReceiptModel);
//        return ajaxResult;
//    }

    @Log(title = "销售退货入库单", action = BusinessType.INSERT)
    @PostMapping("/GetICSDispatchList_Return")
    @ApiOperation("ICS销售退货入库单下发接口")
    @ResponseBody
    public AjaxResult GetICSDispatchList_Return(@RequestBody ICSReceiptModel icsReceiptModel){
        ICSReceiptHeader icsReceiptHeader=icsReceiptModel.getIcsReceiptHeader();
        List<ICSReceiptDetail> icsReceiptDetails = icsReceiptModel.getIcsReceiptDetails();
        if(icsReceiptHeader==null ){
            return AjaxResult.error("缺少主单据");
        }
        if(icsReceiptDetails==null){
            return AjaxResult.error("缺少子单据");
        }
        icsReceiptHeader.setType("SRI");
        AjaxResult ajaxResult = icsReceiptAPIService.insertICSReceipts(icsReceiptModel);
        return ajaxResult;
    }

    @Log(title = "其他入库单", action = BusinessType.INSERT)
    @PostMapping("/GetICSRdRecord_08")
    @ApiOperation("ICS其他入库单下发接口")
    @ResponseBody
    public AjaxResult GetICSRdRecord_08(@RequestBody ICSReceiptModel icsReceiptModel){
        ICSReceiptHeader icsReceiptHeader=icsReceiptModel.getIcsReceiptHeader();
        List<ICSReceiptDetail> icsReceiptDetails = icsReceiptModel.getIcsReceiptDetails();
        if(icsReceiptHeader==null ){
            return AjaxResult.error("缺少主单据");
        }
        if(icsReceiptDetails==null){
            return AjaxResult.error("缺少子单据");
        }
        icsReceiptHeader.setType("QI");
        AjaxResult ajaxResult = icsReceiptAPIService.insertICSReceipt(icsReceiptModel);
        return ajaxResult;
    }

    @Log(title = "调拨入库单", action = BusinessType.INSERT)
    @PostMapping("/TransVouch")
    @ApiOperation("ICS调拨入库单下发接口")
    @ResponseBody
    public AjaxResult TransVouch(@RequestBody ICSReceiptModel icsReceiptModel){
        ICSReceiptHeader icsReceiptHeader=icsReceiptModel.getIcsReceiptHeader();
        List<ICSReceiptDetail> icsReceiptDetails = icsReceiptModel.getIcsReceiptDetails();
        if(icsReceiptHeader==null ){
            return AjaxResult.error("缺少主单据");
        }
        if(icsReceiptDetails==null){
            return AjaxResult.error("缺少子单据");
        }
        icsReceiptHeader.setType("TI");
        AjaxResult ajaxResult = icsReceiptAPIService.insertICSReceipt(icsReceiptModel);
        return ajaxResult;
    }


//    @Log(title = "入库回传", action = BusinessType.GRANT)
//    @PostMapping("/ConfirmICSReceipt")
//    @ApiOperation("ICS入库回传接口")
//    @ResponseBody
//    public AjaxResult ConfirmICSReceipt(String url){
//        AjaxResult ajaxResult = icsReceiptAPIService.ConfirmICSReceipt(url);
//        return ajaxResult;
//    }
}