import { request } from 'umi';

/** 获取设备列表  */
export async function GetDeviceInfoPage(data) {
  return request(`/kitchen/api/Device/GetDeviceInfoPage`, {
    method: 'POST',
    data: data,
  });
}
/**获取设备类型 */
export async function GetDicList(TypeCode) {
  return request(`/kitchen/api/dict-data/dic-list/${TypeCode}`, {
    method: 'Get',
  });
}
/** 添加设备  */
export async function AddDeviceInfo(data) {
  return request(`/kitchen/api/Device/AddDeviceInfo`, {
    method: 'POST',
    data: data,
  });
}

/** 修改  */
export async function UpdateDeviceInfo(data) {
  return request(`/kitchen/api/Device/UpdateDeviceInfo`, {
    method: 'POST',
    data: data,
  });
}
/** 修改  */
export async function CopyDevice(data) {
  return request(`/kitchen/api/Device/CopyDevice`, {
    method: 'POST',
    data: data,
  });
}
/** 删除  */
export async function DelDeviceInfo(data) {
  return request(`​​/kitchen/api/Device/DelDeviceInfo`, {
    method: 'POST',
    data: data,
  });
}
/** 获取所有设备类型  */
export async function GetDeviceType(data) {
  return request(`​/kitchen/api/Device/GetDeviceType`, {
    method: 'GET',
  });
}

/** 获取所有设备版本  */
export async function GetDeviceVersions() {
  return request(`​/kitchen/api/Device/GetDeviceVersions`, {
    method: 'post',
  });
}

/**
 * 获取当前设备绑定的商品
 * @param {*} params 
 * @param {*} options 
 * @returns 
 */
export async function GetDeviceGoods(params, options) {
  return request('/kitchen/api/Device/GetDeviceGoods', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 为设备添加商品 
 * @param {*} params 
 * @returns 
 */
export async function AddDeviceGood(params) {
  return request('/kitchen/api/Device/AddDeviceGood', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 获取所有商品
 * @param {*} params 
 * @returns 
 */
export async function GetGoods(params) {
  return request('/kitchen/​api/Device/GetGoods', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/**
 * 获取所有商品
 * @param {*} params 
 * @returns 
 */
export async function GetByDeviceGoods(params) {
  return request('/kitchen/​api/Device/GetByDeviceGoods', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

/** 获取商品物料库存  */
export async function GetDeviceStorePage(data) {
  return request(`/kitchen/api/Device/GetDeviceStorePage`, {
    method: 'POST',
    data: data,
  });
}

/**
 * 删除库存原料
 * @param {*} data 
 * @returns 
 */
export async function removeSingleStockAdjust(data) {
  return request(`/kitchen/api/Device/DelStockAdjust?Id=${data}`, {
    method: 'DELETE',
    // data: data,
    // ...(options || {}),
  });
}

/** 添加商品物料库存  */
export async function AddStoreBatchingStocAsync(data) {
  return request(`/kitchen/api/Device/AddUpdateDeviceStocAsync`, {
    method: 'POST',
    data: data,
  });
}

/** 修改商品物料库存  */
export async function UpdateStoreBatchingStocAsync(data) {
  return request(`/kitchen/api/Device/AddUpdateDeviceStocAsync`, {
    method: 'put',
    data: data,
  });
}

/**获取位置配置 */
export async function getloc(data) {
  return request(`/kitchen/api/deviceconfig/getlocs?Code=${data}`, {
    method: 'GET',
  });
}

/** 获取原料  */
export async function GetBatchingAsync(data) {
  return request(`/kitchen/api/Device/GetProductList`, {
    method: 'post',
    data: data,
  });
}

/**
 * 获取菜谱列表
 * @param {*} params 
 * @returns 
 */
export async function getFoodMenuList(params) {
  return request('/kitchen/​api/FoodMenu/tree', {
    data: {
      ...params,
    },
  });
}

/** 同步库存  */
export async function PushStockAsync(data) {
  return request(`/kitchen/api/Device/PushDevice?DeviceId=${data}`, {
    method: 'post',
  });
}

/** 获取实时库存  */
export async function CheckStockAdjust(data) {
  return request(`/kitchen/api/Device/CheckStockAdjust?DeviceId=${data}`, {
    method: 'POST',
  });
}
