import request from '@/utils/request'

/**
 * 获取销售订单主列表
 * @param params
 * @returns
 */
export function getSellList(params : Record<string, any>) {
	return request.get(`erp/sell/sell`, params);
}
/**
 * 出库
 * @param params
 * @returns
 */
export function outWarehouseSell(params : Record<string, any>) {
	return request.get(`erp/sell/sellout`, params);
}
/**
 * 获取销售订单主列表
 * @param params
 * @returns
 */
export function getSellSelect(params : Record<string, any>) {
	return request.get(`erp/sell/sell/select`, params);
}

/**
 * 获取销售订单状态
 * @param params
 * @returns
 */
export function getSellStatus() {
	return request.get(`erp/sell/sell/getStatus`);
}

/**
 * 获取销售订单主详情
 * @param id 销售订单主id
 * @returns
 */
export function getSellInfo(id : number) {
	return request.get(`erp/sell/sell/${id}`);
}

/**
 * 添加销售订单主
 * @param params
 * @returns
 */
export function addSell(params : Record<string, any>) {
	return request.post("erp/sell/sell", params, {
		showErrorMessage: true,
		showSuccessMessage: true,
	});
}

/**
 * 删除销售订单主
 * @param id
 * @returns
 */
export function deleteSell(id : number) {
	return request.delete(`erp/sell/sell/${id}`, {
		showErrorMessage: true,
		showSuccessMessage: true,
	});
}


/**
 * 获取销售出库单列表
 * @param params
 * @returns
 */
export function getDeliveryList(params : Record<string, any>) {
	return request.get(`erp/sell/delivery`, params);
}

export function getDeliveryStatusList() {
	return request.get(`erp/sell/delivery/getStatus`);
}

// 获取销售单详情
export function getDeliverySellInfo(sell_id : number) {
	return request.get(`erp/sell/delivery/getSellInfo/${sell_id}`);
}

/**
 * 获取销售出库单详情
 * @param id 销售出库单id
 * @returns
 */
export function getDeliveryInfo(id : number) {
	return request.get(`erp/sell/delivery/${id}`);
}

/**
 * 添加销售出库单
 * @param params
 * @returns
 */
export function addDelivery(params : Record<string, any>) {
	return request.post("erp/sell/delivery", params, {
		showErrorMessage: true,
		showSuccessMessage: true,
	});
}


/**
 * 获取销售退货单列表
 * @param params
 * @returns
 */
export function getSellReturnList(params : Record<string, any>) {
	return request.get(`erp/sell/sellreturn`, params);
}
/**
 * 修改
 * @param params
 * @returns
 */
export function updateSellReturn(id : number,params : Record<string, any>) {
	return request.post(`erp/sell/sellreturn/${id}`, params,{
		showErrorMessage: true,
		showSuccessMessage: true,
	});
}

/**
 * 获取销售退货单详情
 * @param id 销售退货单id
 * @returns
 */
export function getSellReturnInfo(id : number) {
	return request.get(`erp/sell/sellreturn/${id}`);
}

/**
 * 添加销售退货单
 * @param params
 * @returns
 */
export function addSellReturn(params : Record<string, any>) {
	return request.post("erp/sell/sellreturn", params, {
		showErrorMessage: true,
		showSuccessMessage: true,
	});
}
/*-------------------------------------------------new----------------------------------------------------------*/
/**
 * 出库单列表
 * @param params
 * @returns
 */
export function getManualList(params: Record<string, any>) {
    return request.get('erp/outbound/manual', params)
}
/**
 * 获取出库单详情
 * @param id 出库单id
 * @returns
 */
export function getManualInfo(id: number) {
  return request.get(`erp/outbound/manual/${id}`);
}
/**
 * 添加出库
 * @param params
 * @returns
 */
export function addManual(params: Record<string, any>) {
    return request.post('erp/outbound/manual', params, {
        showErrorMessage: true,
        showSuccessMessage: true
    })
}
/**
 * 出库单出库
 * @param id 出库id
 * @returns
 */
export function takeOutOfStorage(id: any) {
  return request.post(
    `erp/outbound/manual/takeOutOfStorage/${id}`,
    {},
    {
      showErrorMessage: true,
      showSuccessMessage: true,
    }
  );
}
/**
 * 获取手工出库单列表
 * @param params
 * @returns
 */
export function getOutboundManualSelect(id: number) {
  return request.get(`erp/outbound/manual/select/${id}`);
}
export function getOutboundManualInfo(id: number) {
  return request.get(`erp/outbound/manual/${id}`);
}
/**
 * 获取食堂退货单列表
 * @param params
 * @returns
 */
export function getManualReturnList(params: Record<string, any>) {
  return request.get(`erp/inbound/inbound/return`, params);
}

/**
 * 获取食堂退货订单状态
 * @param params
 * @returns
 */
export function getManualReturnStatus(params: Record<string, any>) {
  return request.get(`erp/inbound/inbound/return/getStatus`, params);
}

/**
 * 获取食堂退货单详情
 * @param id 食堂退货单id
 * @returns
 */
export function getManualReturnInfo(id: number) {
  return request.get(`erp/inbound/inbound/return/${id}`);
}

/**
 * 添加食堂退货单
 * @param params
 * @returns
 */
export function addManualReturn(params: Record<string, any>) {
  return request.post("erp/inbound/inbound/return", params, {
    showErrorMessage: true,
    showSuccessMessage: true,
  });
}


/**
 * 审核食堂退货单
 * @param id
 * @returns
 */
export function updateManualReturnStatus(params: Record<string, any>) {
  return request.put(`erp/inbound/inbound/return/updateStatus/${params.id}`, params, {
    showErrorMessage: true,
    showSuccessMessage: true,
  });
}

/**
 * 审核食堂退货单
 * @param id
 * @returns
 */
export function updateManualReturnStorageStatus(params: Record<string, any>) {
  return request.put(
    `erp/inbound/inbound/return/updateStorageStatus/${params.id}`,
    params,
    {
      showErrorMessage: true,
      showSuccessMessage: true,
    }
  );
}

/**
 * 反审核食堂退货订单
 * @param id
 * @returns
 */
export function antiManualReturnStatus(id: number) {
    return request.put(
        `erp/inbound/inbound/return/anti/${id}`,
        {},
        {
            showErrorMessage: true,
            showSuccessMessage: true
        }
    )
}