Browse Source

排产移库

master
常熟吴彦祖 3 days ago
parent
commit
4667cdd960
  1. 2
      src/api/production/dailyPlan.js
  2. 116
      src/views/modules/production/dailyPlan.vue

2
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 resourceCapacityLoadingData=data => createAPI(`/dailyPlan/resourceCapacityLoadingData`,'post',data)
// //
export const checkScheduleLoad=data => createAPI(`/dailyPlan/checkScheduleLoad`,'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) export const getProduceScheduleList = data => createAPI('/dailyPlan/getProduceScheduleData', 'POST', data)
// 物料缺料检查 // 物料缺料检查

116
src/views/modules/production/dailyPlan.vue

@ -608,6 +608,27 @@
</el-dialog> </el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> <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> <column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
</div> </div>
@ -629,6 +650,7 @@
rescheduleData, rescheduleData,
changeSoScheduledListSeqNo, changeSoScheduledListSeqNo,
checkScheduleLoad, checkScheduleLoad,
soScheduleCheckRmStock,
} from '@/api/production/dailyPlan.js' } from '@/api/production/dailyPlan.js'
import { import {
@ -719,6 +741,10 @@
languageCode: this.$i18n.locale languageCode: this.$i18n.locale
}, },
visible:false, visible:false,
shortageDialogVisible: false,
shortageTableData: [],
shortageResolve: null,
shortageReject: null,
// ------ end------ // ------ end------
columnList:[ columnList:[
{ {
@ -1401,7 +1427,70 @@
return 'customer-row-3' 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) { if (this.searchData.site == '' || this.searchData.site == null) {
this.$alert('请输入工厂!', '错误', { this.$alert('请输入工厂!', '错误', {
confirmButtonText: '确定' confirmButtonText: '确定'
@ -1426,6 +1515,15 @@
}) })
return false return false
} }
try {
await this.ensureRmStockOkOrConfirm(
this.$store.state.user.site,
row.orderNo,
row.qtyToSchedule
)
} catch (e) {
return
}
let inData = { let inData = {
site: this.$store.state.user.site, site: this.$store.state.user.site,
orderNo: row.orderNo, orderNo: row.orderNo,
@ -1473,10 +1571,6 @@
}) })
} }
}) })
//
//this.shopOrderList = JSON.parse(JSON.stringify(this.shopOrderList));
//this.$message.error('time_required!');
}, },
changeSum () { changeSum () {
@ -1537,9 +1631,15 @@
} }
inList.push(thisData) 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 let flag = true
for (let i = 0; i < this.schedulingModalTableData.length; i++) { for (let i = 0; i < this.schedulingModalTableData.length; i++) {
if (flag === false) { if (flag === false) {

Loading…
Cancel
Save