diff --git a/oms_web/oms_vue/src/api/project/order.js b/oms_web/oms_vue/src/api/project/order.js index 8a745ef6..5c7b0aa9 100644 --- a/oms_web/oms_vue/src/api/project/order.js +++ b/oms_web/oms_vue/src/api/project/order.js @@ -123,10 +123,10 @@ export function purchaseSnList(purchaseNo, orderCode) { } // 订单绑定SN码 -export function bindOrderSnCodes(orderCode, productCode, productSnList) { +export function bindOrderSnCodes(orderCode, productCode, purchaseNo, orderId, purchaseId, productSnList) { return request({ url: '/project/order/vue/bindOrderSnCodes', method: 'post', - data: { orderCode, productCode, productSnList } + data: { orderCode, productCode, purchaseNo, orderId, purchaseId, productSnList } }) } diff --git a/oms_web/oms_vue/src/views/inventory/execution/index.vue b/oms_web/oms_vue/src/views/inventory/execution/index.vue index 67470eb2..0f06b574 100644 --- a/oms_web/oms_vue/src/views/inventory/execution/index.vue +++ b/oms_web/oms_vue/src/views/inventory/execution/index.vue @@ -277,10 +277,10 @@ type="number" :disabled="String(scope.row.status) === '0'" :min="scope.row.bhNum || 0" - :max="scope.row.cgNum || 0" + :max="calculateMaxPhNum(scope.row, item)" size="small" class="stocking-bind-input" - @input="handleBindNumInput(scope.row)" + @input="handleBindNumInput(scope.row, item)" @change="handleBindNumChange(scope.row, item)" > @@ -321,7 +321,7 @@
关 闭 - 保存修改 +
@@ -664,7 +664,7 @@ export default { }, /** 撤单按钮操作 */ handleRecall(row) { - this.$modal.confirm('撤回此单后,该合同下所有出库单以及关联的发货纪录将同步删除,操作不可恢复,请确认后执行!').then(function() { + this.$modal.confirm('撤回此单后,该合同绑定的采购单和SN码信息将同步解除,该合同所有出库单以及关联的发货纪录将同步删除,操作不可恢复,请确认后执行!').then(function() { return recallExecution(row.id); }).then(() => { this.getList(); @@ -711,8 +711,36 @@ export default { } return defaultValue; }, - handleBindNumInput(row) { - this.$set(this.stockingBindDraftMap, row.purchaseId, row.phNum); + handleBindNumInput(row, item) { + const rawValue = row.phNum === '' || row.phNum === null || row.phNum === undefined ? 0 : Number(row.phNum); + const minValue = row.bhNum === '' || row.bhNum === null || row.bhNum === undefined ? 0 : Number(row.bhNum); + const maxValue = this.calculateMaxPhNum(row, item); + + const validValue = Math.max(minValue, Math.min(rawValue, maxValue)); + + row.phNum = validValue; + this.$set(this.stockingBindDraftMap, row.purchaseId, validValue); + }, + calculateMaxPhNum(row, item) { + const originalPhNum = row.originalPhNum === '' || row.originalPhNum === null || row.originalPhNum === undefined ? 0 : Number(row.originalPhNum); + const originalKyNum = row.originalKyNum === '' || row.originalKyNum === null || row.originalKyNum === undefined ? 0 : Number(row.originalKyNum); + const orderNum = item ? (item.orderNum === '' || item.orderNum === null || item.orderNum === undefined ? 0 : Number(item.orderNum)) : 0; + + const maxPhysical = originalPhNum + originalKyNum; + + let otherRowsPhNumSum = 0; + if (item && item.bindList) { + item.bindList.forEach(b => { + if (b.purchaseId !== row.purchaseId) { + const p = Number(b.phNum) || 0; + otherRowsPhNumSum += p; + } + }); + } + + const maxAllowedByOrder = orderNum - otherRowsPhNumSum; + + return Math.min(maxPhysical, maxAllowedByOrder); }, loadBindPageData(orderCode, item) { return productMatchBindList(orderCode, item.productCode, { @@ -756,50 +784,20 @@ export default { }, handleBindNumChange(row, item) { const rawValue = row.phNum === '' || row.phNum === null || row.phNum === undefined ? 0 : Number(row.phNum); - const cgNum = row.cgNum === '' || row.cgNum === null || row.cgNum === undefined ? 0 : Number(row.cgNum); - const originalKyNum = row.originalKyNum === '' || row.originalKyNum === null || row.originalKyNum === undefined ? 0 : Number(row.originalKyNum); - const bhNum = row.bhNum === '' || row.bhNum === null || row.bhNum === undefined ? 0 : Number(row.bhNum); const originalPhNum = row.originalPhNum === '' || row.originalPhNum === null || row.originalPhNum === undefined ? 0 : Number(row.originalPhNum); + const originalKyNum = row.originalKyNum === '' || row.originalKyNum === null || row.originalKyNum === undefined ? 0 : Number(row.originalKyNum); + const minValue = row.bhNum === '' || row.bhNum === null || row.bhNum === undefined ? 0 : Number(row.bhNum); + const maxValue = this.calculateMaxPhNum(row, item); - const orderNum = item ? (item.orderNum === '' || item.orderNum === null || item.orderNum === undefined ? 0 : Number(item.orderNum)) : 0; - const originalTotalPhNum = item ? (item.originalTotalPhNum === '' || item.originalTotalPhNum === null || item.originalTotalPhNum === undefined ? 0 : Number(item.originalTotalPhNum)) : 0; - - let nextValue = Math.max(rawValue, bhNum); - - const maxPhysical = originalPhNum + originalKyNum; - - let otherRowsDiffSum = 0; - if (item && item.bindList) { - item.bindList.forEach(b => { - if (b.purchaseId !== row.purchaseId) { - const p = Number(b.phNum) || 0; - const op = Number(b.originalPhNum) || 0; - otherRowsDiffSum += (p - op); - } - }); - } - - const maxAllowedDiff = orderNum - originalTotalPhNum - otherRowsDiffSum; - const maxAllowedByOrder = originalPhNum + maxAllowedDiff; - - let upperLimit = Math.min(maxPhysical, maxAllowedByOrder); - - if (nextValue > upperLimit) { - nextValue = upperLimit; - } - if (nextValue < bhNum) { - nextValue = bhNum; - } - if (nextValue < 0) { - nextValue = 0; - } + const nextValue = Math.max(minValue, Math.min(rawValue, maxValue)); row.phNum = nextValue; const diff = nextValue - originalPhNum; row.kyNum = originalKyNum - diff; - this.$set(this.stockingBindDraftMap, row.purchaseId, nextValue); }, + this.$set(this.stockingBindDraftMap, row.purchaseId, nextValue); + }, handleSaveStockingBind() { const changedList = []; this.stockingDetailList.forEach(item => { @@ -1032,7 +1030,7 @@ export default { } saveQuotaPromise.then(() => { - return bindOrderSnCodes(this.stockingDetailRow.orderCode, this.outerSnProductRow.productCode, this.outerSnSelectedList); + return bindOrderSnCodes(this.stockingDetailRow.orderCode, this.outerSnProductRow.productCode, this.outerSnBindRow.purchaseNo, this.stockingDetailRow.id, this.outerSnBindRow.purchaseId, this.outerSnSelectedList); }).then(response => { loading.close(); this.$message.success(`成功分配 ${this.outerSnSelectedList.length} 个SN码` + (changedList.length > 0 ? ',并同步保存了配额修改' : '')); @@ -1282,20 +1280,6 @@ export default { margin-bottom: 8px; } -.outer-sn-info { - font-size: 13px; - color: #606266; -} - -.outer-sn-info-label { - color: #909399; -} - -.outer-sn-info-value { - color: #303133; - font-weight: 500; -} - .outer-sn-stats { display: flex; align-items: center; @@ -1449,14 +1433,6 @@ export default { color: #909399; } -.outer-sn-summary { - margin-bottom: 12px; -} - -.outer-sn-warehouse-table { - margin-bottom: 12px; -} - .stocking-status { display: inline-flex; align-items: center; @@ -1488,66 +1464,6 @@ export default { border: 1px solid #d9ecff; } -.stocking-status--green { - color: #67c23a; - background: #f0f9eb; - border: 1px solid #e1f3d8; -} - -.stocking-status--green { - color: #67c23a; - background: #f0f9eb; - border: 1px solid #e1f3d8; -} - -9399; -} - -.outer-sn-summary { - margin-bottom: 12px; -} - -.outer-sn-warehouse-table { - margin-bottom: 12px; -} - -.stocking-status { - display: inline-flex; - align-items: center; - justify-content: center; - min-width: 64px; - height: 24px; - padding: 0 10px; - border-radius: 12px; - font-size: 12px; - line-height: 1; - font-weight: 500; -} - -.stocking-status--yellow { - color: #e6a23c; - background: #fdf6ec; - border: 1px solid #faecd8; -} - -.stocking-status--purple { - color: #8a4f83; - background: #f6f0f7; - border: 1px solid #eadfec; -} - -.stocking-status--blue { - color: #409eff; - background: #ecf5ff; - border: 1px solid #d9ecff; -} - -.stocking-status--green { - color: #67c23a; - background: #f0f9eb; - border: 1px solid #e1f3d8; -} - .stocking-status--green { color: #67c23a; background: #f0f9eb; diff --git a/oms_web/oms_wb_vue/public/index.html b/oms_web/oms_wb_vue/public/index.html index f5061708..97cc559f 100644 --- a/oms_web/oms_wb_vue/public/index.html +++ b/oms_web/oms_wb_vue/public/index.html @@ -5,7 +5,7 @@ - <%= htmlWebpackPlugin.options.title %> + 紫光汇智售后查询系统