|
|
|
@ -220,7 +220,8 @@ |
|
|
|
width="110" |
|
|
|
label="操作"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a type="text" size="small" v-if="currentRow && currentRow.status==='ISSUE'" @click="openNoOrderMaterialAllocDialog(scope.row)">指定物料</a> |
|
|
|
<!-- 指定物料跟本行订单是否已推送WCS走,已推送的订单行不能再改分配 - rqrq --> |
|
|
|
<a type="text" size="small" v-if="canSpecifyMaterial(scope.row)" @click="openNoOrderMaterialAllocDialog(scope.row)">指定物料</a> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
@ -2344,9 +2345,8 @@ export default { |
|
|
|
this.dataList2 = data && data.code === 0 ? (data.rows || []) : [] |
|
|
|
}) |
|
|
|
} else if (this.activeName === 'sub') { |
|
|
|
haiAnSearchNotifyMaterialListNew(queryData).then(({ data }) => { |
|
|
|
this.dataList3 = data && data.code === 0 ? (data.rows || []) : [] |
|
|
|
}) |
|
|
|
// 材料明细指定权限要看本行订单是否已推送,订单行和材料行一起取 - rqrq |
|
|
|
this.loadMaterialListWithOrderPushFlag(queryData) |
|
|
|
} else if (this.activeName === 'change') { |
|
|
|
haiAnSearchNotifyLogNew(queryData).then(({ data }) => { |
|
|
|
this.dataList5 = data && data.code === 0 ? (data.rows || []) : [] |
|
|
|
@ -2654,6 +2654,66 @@ export default { |
|
|
|
}).finally(() => { |
|
|
|
this.allocDetailLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 材料明细和订单行一起查询。按订单序号把本行是否已推送WCS写回材料行,已推送的行不能指定物料。- rqrq |
|
|
|
* @param queryData 当前申请单查询条件,必须带登录site和申请单号 |
|
|
|
*/ |
|
|
|
loadMaterialListWithOrderPushFlag (queryData) { |
|
|
|
const materialRequest = haiAnSearchNotifyMaterialListNew(queryData).then(({ data }) => { |
|
|
|
return data && data.code === 0 ? (data.rows || []) : [] |
|
|
|
}).catch(() => []) |
|
|
|
const orderRequest = haiAnSearchNotifyOrderListNew(queryData).then(({ data }) => { |
|
|
|
return data && data.code === 0 ? (data.rows || []) : [] |
|
|
|
}).catch(() => []) |
|
|
|
Promise.all([materialRequest, orderRequest]).then(([materialRows, orderRows]) => { |
|
|
|
const pushFlagByItemNo = {} |
|
|
|
orderRows.forEach(orderRow => { |
|
|
|
pushFlagByItemNo[this.normalizeNotifyItemNo(orderRow.itemNo)] = orderRow.pushWmsFlag |
|
|
|
}) |
|
|
|
materialRows.forEach(materialRow => { |
|
|
|
const orderPushFlag = pushFlagByItemNo[this.normalizeNotifyItemNo(materialRow.itemNo)] |
|
|
|
if (orderPushFlag) { |
|
|
|
materialRow.pushWmsFlag = orderPushFlag |
|
|
|
} |
|
|
|
}) |
|
|
|
this.dataList2 = orderRows |
|
|
|
this.dataList3 = materialRows |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 订单序号统一成可比较文本,避免 1 和 1.0 对不上导致已推送行仍能指定。- rqrq |
|
|
|
*/ |
|
|
|
normalizeNotifyItemNo (value) { |
|
|
|
if (value === null || value === undefined || value === '') { |
|
|
|
return '' |
|
|
|
} |
|
|
|
const text = String(value).trim() |
|
|
|
if (text === '') { |
|
|
|
return '' |
|
|
|
} |
|
|
|
const numberValue = Number(text) |
|
|
|
return Number.isNaN(numberValue) ? text : String(numberValue) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 取材料行所属订单的推送标记。同一申请单下按订单序号匹配申请单明细,匹配不到再用材料行自带标记。- rqrq |
|
|
|
*/ |
|
|
|
resolveMaterialOrderPushFlag (row) { |
|
|
|
if (!row) { |
|
|
|
return '' |
|
|
|
} |
|
|
|
const itemKey = this.normalizeNotifyItemNo(row.itemNo) |
|
|
|
const orderRow = (this.dataList2 || []).find(item => this.normalizeNotifyItemNo(item.itemNo) === itemKey) |
|
|
|
if (orderRow && orderRow.pushWmsFlag) { |
|
|
|
return orderRow.pushWmsFlag |
|
|
|
} |
|
|
|
return row.pushWmsFlag || '' |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 材料行能否指定物料:申请单已下达,且本行订单未推送WCS。- rqrq |
|
|
|
*/ |
|
|
|
canSpecifyMaterial (row) { |
|
|
|
return !!(this.currentRow && this.currentRow.status === 'ISSUE' && this.resolveMaterialOrderPushFlag(row) !== 'Y') |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 打开指定物料策略弹窗:以订单行itemNo+BOM行号隔离当前物料;未下达不允许指定 - rqrq |
|
|
|
@ -2664,6 +2724,11 @@ export default { |
|
|
|
this.$alert('未下达申请单不允许指定物料', '提示', { confirmButtonText: '确定' }) |
|
|
|
return |
|
|
|
} |
|
|
|
// 本行订单已推送WCS时拒绝打开指定弹框,避免立库已接单后改分配 - rqrq |
|
|
|
if (this.resolveMaterialOrderPushFlag(row) === 'Y') { |
|
|
|
this.$alert('该订单行已推送WCS,不允许指定物料', '提示', { confirmButtonText: '确定' }) |
|
|
|
return |
|
|
|
} |
|
|
|
const parentItemNo = row.itemNo |
|
|
|
const bomItemNo = row.bOMItemNo || row.BOMItemNo || row.bomItemNo || row.bomitemNo |
|
|
|
if (parentItemNo == null || parentItemNo === '') { |
|
|
|
|