|
|
|
@ -608,6 +608,27 @@ |
|
|
|
</el-dialog> |
|
|
|
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> |
|
|
|
|
|
|
|
<!-- 原料缺料确认(表格展示) --> |
|
|
|
<el-dialog |
|
|
|
title="原料库存不足" |
|
|
|
:visible.sync="shortageDialogVisible" |
|
|
|
width="780px" |
|
|
|
:close-on-click-modal="false" |
|
|
|
v-drag |
|
|
|
append-to-body |
|
|
|
@closed="onShortageDialogClosed"> |
|
|
|
<p style="margin: 0 0 12px 0; line-height: 1.5;">以下物料在原料仓库存不足,是否仍要继续排产?</p> |
|
|
|
<el-table :data="shortageTableData" border size="small" height="300" style="width: 100%"> |
|
|
|
<el-table-column prop="partNo" label="料号" min-width="120" show-overflow-tooltip></el-table-column> |
|
|
|
<el-table-column prop="partDescription" label="名称" min-width="200" show-overflow-tooltip></el-table-column> |
|
|
|
<el-table-column prop="spec" label="规格" min-width="120" show-overflow-tooltip></el-table-column> |
|
|
|
</el-table> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" @click="onShortageContinue">继续排产</el-button> |
|
|
|
<el-button @click="onShortageCancel">取消</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 动态列 --> |
|
|
|
<column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column> |
|
|
|
</div> |
|
|
|
@ -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) { |
|
|
|
|