import request from "@/benyun/utils/request";

// 获取树形导航分类
function treeList(url: any) {
  return request({
    url: "/maindata/" + url + "/treeList",
    method: "GET",
  });
}
// 树形查询不包含禁用
function treeUseList(url: any) {
  return request({
    url: "/maindata/" + url + "/treeUseList",
    method: "GET",
  });
}
// 通过父级id查子集
function childrenTreeList(data: any, url: any) {
  return request({
    url: "/maindata/" + url + "/childrenTreeList",
    method: "GET",
    params: data,
  });
}
// 根据分类ID（数组）分页查询数据
function byCategoryPage(data: any, url: any) {
  return request({
    url: "/maindata/" + url + "/ByCategoryPage",
    method: "GET",
    params: data,
  });
}
// 通过主建id查单条数据
function single(data: any, url: any) {
  return request({
    url: "/maindata/" + url + "/single",
    method: "GET",
    params: data,
  });
}
// 分页查询数据
function pageList(data: any, url: any) {
  return request({
    url: "/maindata/" + url + "/page",
    method: "GET",
    params: data,
  });
}
// 新增数据
function saveList(data: any, url: any) {
  return request({
    url: "/maindata/" + url + "/save",
    method: "POST",
    data: data,
  });
}
// 修改数据
function updateList(data: any, url: any) {
  return request({
    url: "/maindata/" + url + "/update",
    method: "POST",
    data: data,
  });
}
// 删除数据
function deleteList(data: any, url: any) {
  return request({
    url: "/maindata/" + url + "/delete",
    method: "POST",
    params: data,
  });
}
// 删除数据
function delCategoryId(data: any, url: any) {
  return request({
    url: "/maindata/" + url + "/delete",
    method: "delete",
    params: data,
  });
}
// 物料同步财务系统
function WMSPushProducts(data: any) {
  return request({
    url: "/omsOrder/WMSwork/WMSPushProducts",
    method: "POST",
    params: data,
  });
}
// 获取所有物料所在仓库库存
function getMaterialInventory(data?: any) {
  return request({
    url: "/maindata/maindataStorehouse/getMaterialInventory",
    method: "GET",
    params: data,
  });
}

// 同步财务系统物料到OMS
function syncMaterialByKingdeeToOms(data?: any) {
  return request({
    url: "/supply/financeApi/syncMaterialByKingdeeToOms",
    method: "GET",
    params: data,
  });
}

// 根据时间段获取财务系统物料信息(获取金蝶物料列表)
function getFinancialCode(data?: any) {
  return request({
    url: "/supply/financeApi/getFinancialCode",
    method: "GET",
    params: data,
  });
}
//订单记录
function queryByProductId(data?: any) {
  return request({
    url: "/omsOrder/omsOrder/queryByProductId",
    method: "POST",
    params: data,
  });
}
//入库记录
function inQueryBySku(data?: any) {
  return request({
    url: "/supply/supplyEntrySuborder/queryBySku",
    method: "GET",
    params: data,
  });
}
function outQueryBySku(data?: any) {
  return request({
    url: "/supply/supplyOutSuborder/queryBySku",
    method: "GET",
    params: data,
  });
}

//查wms库存
function wmsStore(ids: any) {
  return request({
    url: "/omsOrder/WMSwork/WMSInventory",
    method: "POST",
    params: ids,
  });
}

//查询极智嘉商品库存
function getJZJInventory(data: { wareHouseCode: string; items: string[] }) {
  return request({
    url: "/omsOrder/customProduct/queryProductInventory",
    method: "POST",
    data,
  });
}

//查看生命周期
function showLifeCycle(params: { id: number }) {
  return request({
    url: "/omsOrder/customProduct/showLifeCycle",
    method: "GET",
    params,
  }) as Promise<{ code: number; data: any; msg: string }>;
}

export default {
  treeList,
  treeUseList,
  childrenTreeList,
  byCategoryPage,
  single,
  pageList,
  saveList,
  updateList,
  deleteList,
  delCategoryId,
  WMSPushProducts,
  getMaterialInventory,
  syncMaterialByKingdeeToOms,
  getFinancialCode,
  queryByProductId,
  inQueryBySku,
  outQueryBySku,
  wmsStore,
  getJZJInventory,
  showLifeCycle,
};
