import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HsmToolingVO, HsmToolingForm, HsmToolingQuery } from '@/api/wms/hsmTooling/types';

/**
 * 查询半成品工装列表
 * @param query
 * @returns {*}
 */

export const listHsmTooling = (query?: HsmToolingQuery): AxiosPromise<HsmToolingVO[]> => {
  return request({
    url: '/wms/hsmTooling/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询半成品工装详细
 * @param OBJID
 */
export const getHsmTooling = (OBJID: string | number): AxiosPromise<HsmToolingVO> => {
  return request({
    url: '/wms/hsmTooling/' + OBJID,
    method: 'get'
  });
};

/**
 * 新增半成品工装
 * @param data
 */
export const addHsmTooling = (data: HsmToolingForm) => {
  return request({
    url: '/wms/hsmTooling',
    method: 'post',
    data: data
  });
};

/**
 * 修改半成品工装
 * @param data
 */
export const updateHsmTooling = (data: HsmToolingForm) => {
  return request({
    url: '/wms/hsmTooling',
    method: 'put',
    data: data
  });
};

/**
 * 删除半成品工装
 * @param OBJID
 */
export const delHsmTooling = (OBJID: string | number | Array<string | number>) => {
  return request({
    url: '/wms/hsmTooling/' + OBJID,
    method: 'delete'
  });
};


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