import request from '@/utils/request'


/**
 * 获取库存盘点单列表
 * @param params
 * @returns
 */
export function getInventoryList(params : Record<string, any>) {
	return request.get(`erp/inventory/inventory`, params);
}

/**
 * 获取库存盘点单详情
 * @param id 库存盘点单id
 * @returns
 */
export function getInventoryInfo(id : number) {
	return request.get(`erp/inventory/inventory/${id}`);
}
/**
 * 获取库存盘点单状态
 * @returns
 */
export function getInventoryTypeList() {
	return request.get(`erp/inventory/inventory/typeList`);
}
/**
 * 获取库存盘点单状态
 * @returns
 */
export function getInventoryProduct(params : Record<string, any>) {
	return request.get(`erp/inventory/inventory/product`, params);
}

/**
 * 添加库存盘点单
 * @param params
 * @returns
 */
export function addInventory(params : Record<string, any>) {
	return request.post("erp/inventory/inventory", params, {
		showErrorMessage: true,
		showSuccessMessage: true,
	});
}


/**
 * 获取库存流水列表
 * @param params
 * @returns
 */
export function getStatementList(params : Record<string, any>) {
	return request.get(`erp/inventory/statement`, params);
}


/**
 * 获取食材与库存的关联列表
 * @param params
 * @returns
 */
export function getWpRelationshipList(params : Record<string, any>) {
	return request.get(`erp/inventory/wprelationship`, params);
}

/**
 * 获取食材与库存的关联详情
 * @param id 食材与库存的关联id
 * @returns
 */
export function getWpRelationshipInfo(id : number) {
	return request.get(`erp/inventory/wprelationship/${id}`);
}


/*--------------------------------new------------------------------*/
/**
 * 获取库存盘点单列表
 * @param params
 * @returns
 */
export function getCheckList(params: Record<string, any>) {
  return request.get(`erp/inventory/check`, params);
}

/**
 * 获取库存盘点单状态
 * @returns
 */
export function getCheckTypeList(params: Record<string, any>) {
  return request.get(`erp/inventory/check/typeList`,params);
}
/**
 * 根据库存获取食材
 * @returns
 */
export function getCheckProduct(params: Record<string, any>) {
  return request.get(`erp/inventory/check/product`,params);
}

/**
 * 添加库存盘点单
 * @param params
 * @returns
 */
export function addCheck(params: Record<string, any>) {
  return request.post("erp/inventory/check", params, {
    showErrorMessage: true,
    showSuccessMessage: true,
  });
}

// 库存盘点-审核
export function updateCheckStatus(params: Record<string, any>) {
  return request.post(`erp/inventory/check/updateStatus/${params.id}`, params, {
    showErrorMessage: true,
    showSuccessMessage: true,
  });
}

// 库存盘点-入库
export function putInStorage(id: number) {
  return request.post(`erp/inventory/check/putInStorage/${id}`, {},
    {
      showErrorMessage: true,
      showSuccessMessage: true,
    }
  );
}