diff --git a/src/api/production/dailyPlan.js b/src/api/production/dailyPlan.js
index eda5ed3..c53dac6 100644
--- a/src/api/production/dailyPlan.js
+++ b/src/api/production/dailyPlan.js
@@ -31,6 +31,8 @@ export const changeSoScheduledListSeqNo=data => createAPI(`/dailyPlan/changeSoS
export const resourceCapacityLoadingData=data => createAPI(`/dailyPlan/resourceCapacityLoadingData`,'post',data)
//
export const checkScheduleLoad=data => createAPI(`/dailyPlan/checkScheduleLoad`,'post',data)
+
+export const soScheduleCheckRmStock = data => createAPI(`/dailyPlan/soScheduleCheckRmStock`, 'post', data)
// 获取
export const getProduceScheduleList = data => createAPI('/dailyPlan/getProduceScheduleData', 'POST', data)
// 物料缺料检查
diff --git a/src/views/modules/production/dailyPlan.vue b/src/views/modules/production/dailyPlan.vue
index 4d3453a..383d269 100644
--- a/src/views/modules/production/dailyPlan.vue
+++ b/src/views/modules/production/dailyPlan.vue
@@ -608,6 +608,27 @@
+
+
+ 以下物料在原料仓库存不足,是否仍要继续排产?
+
+
+
+
+
+
+
+
@@ -629,6 +650,7 @@
rescheduleData,
changeSoScheduledListSeqNo,
checkScheduleLoad,
+ soScheduleCheckRmStock,
} from '@/api/production/dailyPlan.js'
import {
@@ -719,6 +741,10 @@
languageCode: this.$i18n.locale
},
visible:false,
+ shortageDialogVisible: false,
+ shortageTableData: [],
+ shortageResolve: null,
+ shortageReject: null,
// ------动态列 end------
columnList:[
{
@@ -1401,7 +1427,70 @@
return 'customer-row-3'
}
},
- startScheduleOperation (row, $event, column) {
+ /** 缺少数量展示(兼容 shortQty / ShortQty;无值时空) */
+ formatShortQty (r) {
+ if (!r) return ''
+ const v = r.shortQty !== undefined && r.shortQty !== null ? r.shortQty : r.ShortQty
+ if (v === '' || v === undefined || v === null) return ''
+ return v
+ },
+ onShortageContinue () {
+ const ok = this.shortageResolve
+ this.shortageResolve = null
+ this.shortageReject = null
+ if (ok) ok()
+ this.shortageDialogVisible = false
+ },
+ onShortageCancel () {
+ const rj = this.shortageReject
+ this.shortageResolve = null
+ this.shortageReject = null
+ if (rj) rj(new Error('cancel'))
+ this.shortageDialogVisible = false
+ },
+ onShortageDialogClosed () {
+ if (this.shortageReject) {
+ const rj = this.shortageReject
+ this.shortageResolve = null
+ this.shortageReject = null
+ rj(new Error('cancel'))
+ }
+ },
+ /**
+ * 按 site + orderNo + scheduleQty 调 SO_Schedule_CheckRMStock;无缺料直接 resolve;有缺料则表格弹窗确认
+ */
+ ensureRmStockOkOrConfirm (site, orderNo, scheduleQty) {
+ const qty = Number(scheduleQty)
+ if (!site) {
+ this.$alert('工厂不能为空,无法检查原料库存', '错误', { confirmButtonText: '确定' })
+ return Promise.reject(new Error('no-site'))
+ }
+ if (!orderNo) {
+ this.$alert('订单号不能为空', '错误', { confirmButtonText: '确定' })
+ return Promise.reject(new Error('no-order'))
+ }
+ if (!qty || qty <= 0) {
+ this.$alert('排产数量无效', '错误', { confirmButtonText: '确定' })
+ return Promise.reject(new Error('bad-qty'))
+ }
+ return soScheduleCheckRmStock({ site, orderNo, scheduleQty: qty }).then(({ data }) => {
+ if (!data || data.code !== 0) {
+ this.$alert((data && data.msg) || '原料库存检查失败', '错误', { confirmButtonText: '确定' })
+ return Promise.reject(new Error('check-fail'))
+ }
+ const rows = data.rows || []
+ if (rows.length === 0) {
+ return Promise.resolve()
+ }
+ return new Promise((resolve, reject) => {
+ this.shortageTableData = rows
+ this.shortageResolve = resolve
+ this.shortageReject = reject
+ this.shortageDialogVisible = true
+ })
+ })
+ },
+ async startScheduleOperation (row, $event, column) {
if (this.searchData.site == '' || this.searchData.site == null) {
this.$alert('请输入工厂!', '错误', {
confirmButtonText: '确定'
@@ -1426,6 +1515,15 @@
})
return false
}
+ try {
+ await this.ensureRmStockOkOrConfirm(
+ this.$store.state.user.site,
+ row.orderNo,
+ row.qtyToSchedule
+ )
+ } catch (e) {
+ return
+ }
let inData = {
site: this.$store.state.user.site,
orderNo: row.orderNo,
@@ -1473,10 +1571,6 @@
})
}
})
-
- //自己赋值给自己
- //this.shopOrderList = JSON.parse(JSON.stringify(this.shopOrderList));
- //this.$message.error('字段time_required找不到!');
},
changeSum () {
@@ -1537,9 +1631,15 @@
}
inList.push(thisData)
}
- // this.checkId=0;
- // this.checkList=inList;
- // this.checkScheduledList();
+ try {
+ await this.ensureRmStockOkOrConfirm(
+ this.$store.state.user.site,
+ this.schedulingModalData.orderNo,
+ Number(this.schedulingModalData.sumQty)
+ )
+ } catch (e) {
+ return false
+ }
let flag = true
for (let i = 0; i < this.schedulingModalTableData.length; i++) {
if (flag === false) {