package com.prolog.cs.biz.inbound.remote;

import com.prolog.framework.bz.core.collection.ValidList;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.pojo.Page;
import com.prolog.upcloud.base.inventory.model.WmsInvBatchNumbers;
import com.prolog.upcloud.base.inventory.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author Xiong
 * @ClassName: BaseInventoryRemoteCaller
 * @Description: 库存远程调用
 * @date 2021年4月19日 下午4:02:00
 */
@FeignClient(value = "${prolog.service.inventory}")
public interface BaseInventoryRemoteCaller {

    /**
     * 入库
     *
     * @param invStock 入库信息(质检推荐货位预占)
     * @return 执行结果
     */
    @PostMapping("stock/v1/in")
    public RestMessage inStock(@RequestBody ValidList<InvStockIn> invStock);

    /**
     * 入库调整处理(上架拆分生成新的预占)
     *
     * @param invStock 入库信息
     * @return 执行结果
     */
    @PostMapping("stock/v1/in/adjust")
    public RestMessage adjustPreStock(@RequestBody ValidList<InvStockIn> invStock);

    /**
     * 入库(已经预占过的)
     *
     * @param check 入库单编码
     * @return 执行结果
     */
    @PostMapping("stock/v1/in/check")
    public RestMessage inStockCheck(@RequestBody InvStockCheck check);

    /**
     * 批量入库(不预占直接入库存)
     *
     * @param invStock 批量入库确认信息
     * @return 执行结果
     */
    @PostMapping("stock/v1/in/check-batch")
    //    @ApiOperation(value = "批量入库确认")
    public RestMessage inStockBatchCheck(@RequestBody ValidList<InvStockIn> invStock);

    //	@ApiOperation("批量生成批次信息")
    @PostMapping("batch-number/v1/gen")
    public RestMessage<List<InvStockBatchNumberResult>> genBatchNumber(@RequestBody ValidList<InvStockBatchNumber> batchNumbers);

    //	@ApiOperation("批量修改批次信息")
    @PostMapping("batch-number/v1/update")
    public RestMessage updateBatchNumber(@RequestBody ValidList<InvStockBatchNumberUpdate> batchNumbers);

    @PostMapping("batch-number/v1/updateBack")
    public RestMessage<List<WmsInvBatchNumbers>> updateBatchNumberBack(@RequestBody ValidList<InvStockBatchNumberUpdate> batchNumbers);

    @PostMapping("batch-number/v1/getBatchInfos")
    public RestMessage<List<WmsInvBatchNumbers>> getBatchInfoBybatchId(@RequestBody String[] batchId);

    //	@ApiOperation("分页查询商品库存批次列表")
    @GetMapping("batch-number/v1/page")
    public RestMessage<Page<BatchNumberListVO>> getBatchNumber(@RequestParam("warehouseId") String warehouseId, @RequestParam("cargoOwnerId") String cargoOwnerId, @RequestParam("itemId") String itemId, @RequestParam("manufacturerLotNum") String manufacturerLotNum, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum") Integer pageNum);

    @GetMapping("batch-number/v1/exists")
    //    @ApiOperation("查询商品库存批次是否存在")
    public RestMessage<List<BatchExistsVO>> getBatchNumbersExists(@RequestParam("warehouseId") String warehouseId, @RequestParam("batchIds") String[] batchIds);

    @PostMapping("batch-number/v1/del")
    //    @ApiOperation("删除无库存商品批次")
    public RestMessage deleteBatchNumbersNotExists(@RequestBody BatchExistsDelVO delVO);

    /**
     * 入库取消
     *
     * @param stockCancel 入库单编码
     * @return 执行结果
     */
    @PostMapping("stock/v1/in/cancel")
    //    @ApiOperation(value = "入库取消")
    RestMessage inCancel(@RequestBody InvStockCancel stockCancel);

    /**
     * 分页查询商品库存批次基础信息列表
     */
    @GetMapping("/batch-number/v1/basic/list")
    RestMessage<List<BatchNumberListVO>> getBatchNumberBasicInfo(@RequestParam("batchIds") String[] batchIds);

    @PostMapping("/integration/v1/ask")
    public RestMessage<?> askIntegration(@RequestBody AskIntegrationVo vo);

    @PostMapping("stock/v1/qty/avl-list")
    public RestMessage<List<WmsInvStockQtyVO>> getAvailableQuantity(@RequestBody List<WmsInvStockQtyQueryVO> qtyQueryVO);
}
