import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InStockBillForm, InStockBillQuery, InStockBillVO } from '@/api/wms/inStockBill/types';

/**
 * 查询物料入库列表
 * @param query
 * @returns {*}
 */

export const listInStockBill = (query?: InStockBillQuery): AxiosPromise<InStockBillVO[]> => {
  return request({
    url: '/wms/inStockBill/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物料入库详细
 * @param inStockBillId
 */
export const getInStockBill = (inStockBillId: string | number): AxiosPromise<InStockBillVO> => {
  return request({
    url: '/wms/inStockBill/' + inStockBillId,
    method: 'get'
  });
};

/**
 * 新增物料入库
 * @param data
 */
export const addInStockBill = (data: InStockBillForm) => {
  return request({
    url: '/wms/inStockBill',
    method: 'post',
    data: data
  });
};

/**
 * 修改物料入库
 * @param data
 */
export const updateInStockBill = (data: InStockBillForm) => {
  return request({
    url: '/wms/inStockBill',
    method: 'put',
    data: data
  });
};

/**
 * 删除物料入库
 * @param inStockBillId
 */
export const delInStockBill = (inStockBillId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/inStockBill/' + inStockBillId,
    method: 'delete'
  });
};

/**
 * 下拉框查询物料入库列表
 * @param query
 * @returns {*}
 */
export function getWmsInStockBillList(query) {
  return request({
    url: '/wms/inStockBill/getWmsInStockBillList',
    method: 'get',
    params: query
  });
}
/**
 * 提交物料入库并发起流程
 * @param data
 */
export const submitFlowData = (data: InStockBillForm) => {
  return request({
    url: '/wms/inStockBill/submitFlowData',
    method: 'post',
    data: data
  });
};
