import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HppStorePlaceVO, HppStorePlaceForm, HppStorePlaceQuery } from '@/api/wms/hppStorePlace/types';

/**
 * 查询半成品库位列表
 * @param query
 * @returns {*}
 */

export const listHppStorePlace = (query?: HppStorePlaceQuery): AxiosPromise<HppStorePlaceVO[]> => {
  return request({
    url: '/wms/hppStorePlace/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询半成品库位详细
 * @param objId
 */
export const getHppStorePlace = (objId: string | number): AxiosPromise<HppStorePlaceVO> => {
  return request({
    url: '/wms/hppStorePlace/' + objId,
    method: 'get'
  });
};

/**
 * 新增半成品库位
 * @param data
 */
export const addHppStorePlace = (data: HppStorePlaceForm) => {
  return request({
    url: '/wms/hppStorePlace',
    method: 'post',
    data: data
  });
};

/**
 * 修改半成品库位
 * @param data
 */
export const updateHppStorePlace = (data: HppStorePlaceForm) => {
  return request({
    url: '/wms/hppStorePlace',
    method: 'put',
    data: data
  });
};

/**
 * 删除半成品库位
 * @param objId
 */
export const delHppStorePlace = (objId: string | number | Array<string | number>) => {
  return request({
    url: '/wms/hppStorePlace/' + objId,
    method: 'delete'
  });
};


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