import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HppStorageDetailVO, HppStorageDetailForm, HppStorageDetailQuery } from '@/api/wms/hppStorageDetail/types';

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

export const listHppStorageDetail = (query?: HppStorageDetailQuery): AxiosPromise<HppStorageDetailVO[]> => {
  return request({
    url: '/wms/hppStorageDetail/list',
    method: 'get',
    params: query
  });
};

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

/**
 * 新增半成品库存
 * @param data
 */
export const addHppStorageDetail = (data: HppStorageDetailForm) => {
  return request({
    url: '/wms/hppStorageDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改半成品库存
 * @param data
 */
export const updateHppStorageDetail = (data: HppStorageDetailForm) => {
  return request({
    url: '/wms/hppStorageDetail',
    method: 'put',
    data: data
  });
};

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


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