import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MoveOrderVO, MoveOrderForm, MoveOrderQuery } from '@/api/wms/moveOrder/types';

/**
 * 查询移库工单列表
 * @param query
 * @returns {*}
 */

export const listMoveOrder = (query?: MoveOrderQuery): AxiosPromise<MoveOrderVO[]> => {
  return request({
    url: '/wms/moveOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询移库工单详细
 * @param moveId
 */
export const getMoveOrder = (moveId: string | number): AxiosPromise<MoveOrderVO> => {
  return request({
    url: '/wms/moveOrder/' + moveId,
    method: 'get'
  });
};

/**
 * 新增移库工单
 * @param data
 */
export const addMoveOrder = (data: MoveOrderForm) => {
  return request({
    url: '/wms/moveOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改移库工单
 * @param data
 */
export const updateMoveOrder = (data: MoveOrderForm) => {
  return request({
    url: '/wms/moveOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除移库工单
 * @param moveId
 */
export const delMoveOrder = (moveId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/moveOrder/' + moveId,
    method: 'delete'
  });
};


/**
 * 下拉框查询移库工单列表
 * @param query
 * @returns {*}
 */
export function getMoveOrderList (query) {
    return request({
        url: '/wms/moveOrder/getMoveOrderList',
        method: 'get',
        params: query
    });
};
