package com.sunda.spmsweb.wmscontroller;


import com.sunda.spmscommon.ResponseResult;
import com.sunda.spmswms.service.IWhsInventoryInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 仓库库存信息表 前端控制器
 * </p>
 *
 * @author Wayne
 * @since 2021-01-28
 */
@RestController
@RequestMapping("/whsInventoryInfo")
@Api(tags = "仓库库存信息", description = "仓库库存信息接口")
public class WhsInventoryInfoController {

    @Autowired
    IWhsInventoryInfoService iWhsInventoryInfoService;

    @RequestMapping("/getWerksInventory")
    @ApiOperation(value = "获取工厂全部仓库库存信息",notes = "获取工厂全部仓库库存信息\n werks = CH01", httpMethod = "POST")
    public ResponseResult getWhsList(String werks,
                                     @RequestParam(defaultValue = "1") int pageNo,
                                     @RequestParam(defaultValue = "20") int pageSize){
        try {
            return ResponseResult.success().add("whsList", iWhsInventoryInfoService.getWhsInventory(werks, pageNo, pageSize));
        }catch (Exception e){
            return ResponseResult.error("获取仓库库存信息出错");
        }
    }
}
