import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HppTransferVO, HppTransferForm, HppTransferQuery } from '@/api/wms/hppTransfer/types';

/**
 * 查询半成品调拨列表
 * @param query
 * @returns {*}
 */

export const listHppTransfer = (query?: HppTransferQuery): AxiosPromise<HppTransferVO[]> => {
  return request({
    url: '/wms/hppTransfer/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询半成品调拨详细
 * @param transferId
 */
export const getHppTransfer = (transferId: string | number): AxiosPromise<HppTransferVO> => {
  return request({
    url: '/wms/hppTransfer/' + transferId,
    method: 'get'
  });
};

/**
 * 新增半成品调拨
 * @param data
 */
export const addHppTransfer = (data: HppTransferForm) => {
  return request({
    url: '/wms/hppTransfer',
    method: 'post',
    data: data
  });
};

/**
 * 修改半成品调拨
 * @param data
 */
export const updateHppTransfer = (data: HppTransferForm) => {
  return request({
    url: '/wms/hppTransfer',
    method: 'put',
    data: data
  });
};

/**
 * 删除半成品调拨
 * @param transferId
 */
export const delHppTransfer = (transferId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/hppTransfer/' + transferId,
    method: 'delete'
  });
};


/**
 * 下拉框查询半成品调拨列表
 * @param query
 * @returns {*}
 */
export function getWmsHppTransferList (query) {
    return request({
        url: '/wms/hppTransfer/getWmsHppTransferList',
        method: 'get',
        params: query
    });
};
