import request from '@/utils/request';
import { download } from '@/utils/file';
/**
 * 获取信息列表
 */
export async function getReceiveTableList(params) {
  const res = await request.get(`/eom/purchaseorderreceive/page`, { params });
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 获取信息详情
 */
export async function getReceiveSaleOrderrecordDetail(id) {
  const res = await request.get(`/eom/purchaseorderreceive/getById/${id}`, {});
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

/**
 * 更新信息
 */
export async function UpdateReceiveInformation(data) {
  const res = await request.put(`/eom/purchaseorderreceive/update`, data);
  return res.data
}





// /**
//  * 通过销售发货获取发货清单
//  */
// export async function getProductListByRecordId(recordId) {
//     const res = await request.get(`/eom/purchaseorderreceive/getProductListByRecordId/${recordId}`, {});
//     if (res.data.code == 0) {
//       return res.data.data;
//     }
//     return Promise.reject(new Error(res.data.message));
//   }


/**
 * 流程作废
 */
export async function cancel(data) {
  const res = await request.put(`/bpm/purchaseReceiveApprove/cancel`, data);
  if (res.data.code == 0) {
    return Promise.resolve(res.data);
  }
  return Promise.reject(new Error(res.data.message));
}
