import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderInfoVO, OrderInfoForm, OrderInfoQuery } from '@/api/wms/orderInfo/types';

/**
 * 查询生产订单信息列表
 * @param query
 * @returns {*}
 */

export const listOrderInfo = (query?: OrderInfoQuery): AxiosPromise<OrderInfoVO[]> => {
  return request({
    url: '/wms/orderInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询生产订单信息详细
 * @param productOrderId
 */
export const getOrderInfo = (productOrderId: string | number): AxiosPromise<OrderInfoVO> => {
  return request({
    url: '/wms/orderInfo/' + productOrderId,
    method: 'get'
  });
};

/**
 * 新增生产订单信息
 * @param data
 */
export const addOrderInfo = (data: OrderInfoForm) => {
  return request({
    url: '/wms/orderInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改生产订单信息
 * @param data
 */
export const updateOrderInfo = (data: OrderInfoForm) => {
  return request({
    url: '/wms/orderInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除生产订单信息
 * @param productOrderId
 */
export const delOrderInfo = (productOrderId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/orderInfo/' + productOrderId,
    method: 'delete'
  });
};


/**
 * 下拉框查询生产订单信息列表
 * @param query
 * @returns {*}
 */
export function getProdOrderInfoList(query) {
  return request({
    url: '/wms/orderInfo/getProdOrderInfoList',
    method: 'get',
    params: query
  });
};
