import request from '@/utils/request';



// 生成编码
export async function getCode(code) {
  const res = await request.get(`/main/codemanage/getCode/` + code, {});
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}


// 工单列表
export async function workorderPage(data) {
  const res = await request.post('/pda/mes/workorder/page', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}



// 工单列表 ()
export async function workorderPage2(data) {
  const res = await request.post('/mes/workorder/taskReportPage', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}







// 查询库存台账首页列表

export async function pageeLedgerMain(data) {
  const res = await request.get('/wms/outInDetailPda/page', {
    params: data
  });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 资产
export async function assetPage(data) {
  const res = await request.get('/main/asset/pdaPage', {
    params: data
  });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 在制品
export async function listInProduct(data) {
  const res = await request.post('/pda/mes/feed/listInProduct', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}






// 父级ID查询分类树
export async function treeByPid(data) {
  const res = await request.get('/pda/main/categoryLevel/pdaTreeByPid', {
    params: data
  });
  if (res.data.code == 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}


// 根据工单ids获取工单列表
export async function workorderList(data) {
  const res = await request.post('/mes/workorder/list', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}




// pda报工保存

export async function jobSave(data) {
  const res = await request.post('/mes/workreport/save', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}



// pda报工保存缓存

export async function saveCache(data) {
  const res = await request.post('/mes/workreport/saveCache', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}



// pda报工查缓存



export async function getCache(data) {
  const res = await request.post('/mes/workreport/getCache', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}





// 清空缓存
export async function removeCache(data) {
  const res = await request.post('/mes/workreport/removeCache', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}




// PDA  碳谷 入库查询

export async function listPcToWarehouseTG(data) {
  const res = await request.post('/mes/workreport/listPCToWarehouseTG', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}



// pda根据工单id和工序id查询报工详情
export async function listWorkReport(data) {
  const res = await request.post('/pda/mes/workreport/listWorkReport', data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}



// pda根据工单id和工序id查询报工详情  (入库)
export async function listApplystorage(data) {
  const res = await request.get('/mes/applystorage/list', {
    params: data
  });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

