You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

57 lines
1.7 KiB

/**
* PO 订单行状态选项(静态数据,查询下拉用,不查库)
*/
export const PO_ORDER_STATUS_OPTIONS = [
{ label: '已下达', value: '已下达' },
{ label: '待验货', value: '待验货' },
{ label: '验货中', value: '验货中' },
{ label: '验货完成', value: '验货完成' },
{ label: '已取消', value: '已取消' },
{ label: '已关闭', value: '已关闭' }
]
/** 是否可「关闭」 */
export function canClosePoOrder (status) {
return !!status && status !== '已关闭' && status !== '已取消'
}
/** 是否可「打开」(仅已关闭) */
export function canOpenPoOrder (status) {
return status === '已关闭'
}
/**
* 打开时根据验货数量推算恢复状态(与后端 PoDetailStatusSupport 规则一致)
*/
export function resolvePoOrderStatusByInspectQty (row) {
const toInspect = Number(row.toInspectQty != null ? row.toInspectQty : 0)
const approve = Number(row.inspectApproveQty != null ? row.inspectApproveQty : (row.inspectionCompletedQty != null ? row.inspectionCompletedQty : 0))
const qty = Number(row.qty != null ? row.qty : 0)
if (toInspect === 0) {
return '已下达'
}
if (toInspect > 0 && approve === 0) {
return '待验货'
}
if (qty > 0 && approve === qty) {
return '验货完成'
}
if (approve > 0 && (qty === 0 || approve < qty)) {
return '验货中'
}
if (approve > 0 && qty > 0 && approve >= qty) {
return '验货完成'
}
return '待验货'
}
/** 关闭/打开接口入参(id 为空时用 orderNo+site+itemNo 定位) */
export function buildPoDetailActionParams (row, site) {
return {
id: row.id != null && row.id !== '' ? row.id : undefined,
orderNo: row.orderNo,
site: row.site || site,
itemNo: row.itemNo
}
}