import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { InstockPrintVO, InstockPrintForm, InstockPrintQuery } from '@/api/wms/instockPrint/types';

/**
 * 查询入库单-物料打印条码列表
 * @param query
 * @returns {*}
 */

export const listInstockPrint = (query?: InstockPrintQuery): AxiosPromise<InstockPrintVO[]> => {
  return request({
    url: '/wms/instockPrint/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询入库单-物料打印条码详细
 * @param instockPrintId
 */
export const getInstockPrint = (instockPrintId: string | number): AxiosPromise<InstockPrintVO> => {
  return request({
    url: '/wms/instockPrint/' + instockPrintId,
    method: 'get'
  });
};

/**
 * 新增入库单-物料打印条码
 * @param data
 */
export const addInstockPrint = (data: InstockPrintForm) => {
  return request({
    url: '/wms/instockPrint',
    method: 'post',
    data: data
  });
};

/**
 * 修改入库单-物料打印条码
 * @param data
 */
export const updateInstockPrint = (data: InstockPrintForm) => {
  return request({
    url: '/wms/instockPrint',
    method: 'put',
    data: data
  });
};

/**
 * 删除入库单-物料打印条码
 * @param instockPrintId
 */
export const delInstockPrint = (instockPrintId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/instockPrint/' + instockPrintId,
    method: 'delete'
  });
};

/**
 * 打印入库单-物料打印条码
 * @param instockPrintId
 */
export const printInstockPrint = (data: Array<InstockPrintVO>) => {
  return request({
    url: '/wms/instockPrint/print',
    method: 'post',
    data: data
  });
};
