package com.hw.wms.controller;

import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.wms.domain.WmsRawOutstock;
import com.hw.wms.domain.WmsRawOutstockDetail;
import com.hw.wms.domain.WmsRawReturn;
import com.hw.wms.domain.WmsRawReturnDetail;
import com.hw.wms.domain.vo.*;
import com.hw.wms.service.IWmsRawInstockService;
import com.hw.wms.service.IWmsRawOutstockService;
import com.hw.wms.service.IWmsRawReturnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Api Controller,提供给其他Module调用使用
 *
 * @author xins
 * @date 2023-12-26
 */
@RestController
@RequestMapping("/wms/api")
public class WmsApiController extends BaseController {

    @Autowired
    private IWmsRawOutstockService wmsRawOutstockService;

    @Autowired
    private IWmsRawReturnService wmsRawReturnService;


    /**
     * 申请领料
     */
//    @RequiresPermissions("wms:mobile:addrawinstock")
    @Log(title = "原材料出库记录", businessType = BusinessType.APPLY)
    @PostMapping(("/applyRawOutstock"))
    public AjaxResult applyRawOutstock(@Validated @RequestBody WmsRawOutstock wmsRawOutstock) {
        return toAjax(wmsRawOutstockService.applyRawOutstock(wmsRawOutstock));
    }


    /**
     * 申请退库
     */
    @Log(title = "原材料退库记录", businessType = BusinessType.APPLY)
    @PostMapping(("/applyRawReturn"))
    public AjaxResult applyRawReturn(@Validated @RequestBody WmsRawReturn wmsRawReturn) {
        return toAjax(wmsRawReturnService.applyRawReturn(wmsRawReturn));
    }

}
