Browse Source

2025-10-11

订单排产-排产优化 支持批量排产
master
fengyuan_yang 3 months ago
parent
commit
9c7a172df8
  1. 306
      src/views/modules/schedule/com_schedule_order_expand.vue

306
src/views/modules/schedule/com_schedule_order_expand.vue

@ -1,8 +1,6 @@
<template> <template>
<div class="customer-css" > <div class="customer-css" >
<el-dialog v-drag
width="975px" class="customer-dialog"
:title="titleCon" v-bind="$attrs" v-on="$listeners">
<el-dialog v-drag width="1000px" class="customer-dialog" :title="titleCon" v-bind="$attrs" v-on="$listeners">
<!-- 显示信息 --> <!-- 显示信息 -->
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -5px;" > <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -5px;" >
<el-row style="width: 560px;"> <el-row style="width: 560px;">
@ -29,23 +27,10 @@
<el-form-item :label=labels.waitScheduleQty> <el-form-item :label=labels.waitScheduleQty>
<el-input v-model="pageData.qtyToSchedule" readonly="readonly" style="width: 120px"></el-input> <el-input v-model="pageData.qtyToSchedule" readonly="readonly" style="width: 120px"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label=labels.availableResourceId>
<el-select v-model="pageData.resourceId" @change="refreshPageTables" style="width: 120px" placeholder="请选择">
<el-option
v-for="(item, index) in resourceList"
:key="index"
:label="item.resourceDesc"
:value="item.resourceId">
</el-option>
</el-select>
</el-form-item>
</el-row> </el-row>
<el-row style="width: 560px;"> <el-row style="width: 560px;">
<el-form-item :label=labels.scheduledDate> <el-form-item :label=labels.scheduledDate>
<el-date-picker class="el-time-width"
style=""
v-model="pageData.scheduleDate"
value-format="yyyy-MM-dd">
<el-date-picker class="el-time-width" v-model="pageData.scheduleDate" value-format="yyyy-MM-dd">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item :label="''" style="margin-top: -5px;"> <el-form-item :label="''" style="margin-top: -5px;">
@ -58,23 +43,13 @@
value-format="HH:mm"> value-format="HH:mm">
</el-time-picker> </el-time-picker>
</el-form-item> </el-form-item>
<el-form-item :label="''" style="margin-left: 0px; margin-top: 20px;">
<el-checkbox v-model="pageData.closeModal" class="customer-checkbox" true-label="Y" false-label="N" style="margin-top: 5px;"
:label=labels.scheduleThanClosedDialog></el-checkbox>
</el-form-item>
<el-form-item :label=labels.thisScheduleQty style="margin-left: 0px;">
<el-input v-model="pageData.scheduledQty" style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="''" style="margin-top: 20px;">
<el-button class="customer-bun-min" type="primary" @click="startScheduleOrderBun" style="margin-left: 10px; margin-bottom: 5px;">{{buttons.scheduleButton}}</el-button>
</el-form-item>
</el-row> </el-row>
</el-form> </el-form>
<!-- 机台班次信息 --> <!-- 机台班次信息 -->
<el-main style="margin-left: 520px; margin-top: -160px; width: 452px;">
<el-main style="margin-left: 520px; margin-top: -150px; width: 452px;">
<el-table <el-table
height="145"
height="130"
:data="resourceShiftList" :data="resourceShiftList"
border border
v-loading="dataListLoading" v-loading="dataListLoading"
@ -91,19 +66,120 @@
:label="item.columnLabel"> :label="item.columnLabel">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span> <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
</el-main>
<!-- 本次排产明细 -->
<el-main style="margin-top: 0px; width: 100%; padding: 0px;">
<el-form :inline="true" label-position="top" label-width="100px">
<el-form-item label="本次排产明细"></el-form-item>
<el-button type="primary" size="small" @click="addScheduleDetail" style="margin-left: 10px; margin-bottom: 5px;">新增</el-button>
</el-form>
<div class="rq">
<el-table
height="150"
:data="scheduleDetailList"
border
style="margin-top: -20px; width: 980px;">
<el-table-column
type="index"
label="序号"
width="55"
align="center">
</el-table-column>
<el-table-column
prop="orderNo"
label="生产订单"
min-width="100"
align="center">
</el-table-column>
<el-table-column
prop="itemNo"
label="生产工序"
min-width="80"
align="center">
</el-table-column>
<el-table-column
prop="resourceId"
label="生产机台"
min-width="150"
align="center">
<template slot-scope="scope">
<el-select v-model="scope.row.resourceId" size="small" style="width: 100%;">
<el-option
v-for="(item, index) in resourceList"
:key="index"
:label="item.resourceDesc"
:value="item.resourceId">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column
prop="qtyRequired"
label="需求数量"
min-width="100"
align="center">
<template slot-scope="scope">
<el-input-number :controls="false" :step="0" v-model="scope.row.qtyRequired"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop="rowCount"
label="排数"
min-width="100"
align="center">
<template slot-scope="scope">
<el-input-number :controls="false" :step="0" v-model="scope.row.rowCount"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop="rollCount"
label="卷数"
min-width="100"
align="center">
<template slot-scope="scope">
<el-input-number :controls="false" :step="0" v-model="scope.row.rollCount"></el-input-number>
</template>
</el-table-column>
<el-table-column
label="操作"
width="80"
align="center">
<template slot-scope="scope">
<el-button type="text" size="small" @click="deleteScheduleDetail(scope.$index)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
</el-main> </el-main>
<!-- 工单明细表信息 --> <!-- 工单明细表信息 -->
<el-main style="margin-top: -15px; width: 100%; padding: 0px;">
<el-main style="margin-top: 10px; width: 100%; padding: 0px;">
<el-row>
<el-col :span="3">
<el-form :inline="true" label-position="top" label-width="100px"> <el-form :inline="true" label-position="top" label-width="100px">
<el-form-item :label=labels.detailHist>
<el-form-item :label=labels.detailHist></el-form-item>
</el-form>
</el-col>
<el-col :span="8">
<el-form :inline="true" label-position="top" label-width="80px">
<el-form-item :label=labels.availableResourceId>
<el-select v-model="pageData.resourceId" @change="refreshPageTables" style="width: 120px" placeholder="请选择">
<el-option
v-for="(item, index) in resourceList"
:key="index"
:label="item.resourceDesc"
:value="item.resourceId">
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col>
</el-row>
<el-table class="schedule-table" <el-table class="schedule-table"
:height="height" :height="height"
:data="orderScheduleList" :data="orderScheduleList"
@ -113,7 +189,7 @@
@row-dblclick="warnCancelScheduleConfirm" @row-dblclick="warnCancelScheduleConfirm"
:row-style="controlRowStyle" :row-style="controlRowStyle"
v-loading="dataListLoading" v-loading="dataListLoading"
style="margin-top: -20px; width: 955px;">
style="margin-top: -20px; width: 980px;">
<el-table-column <el-table-column
v-for="(item,index) in columnOrderScheduleArray" :key="index" v-for="(item,index) in columnOrderScheduleArray" :key="index"
:sortable="item.columnSortable" :sortable="item.columnSortable"
@ -126,12 +202,18 @@
:label="item.columnLabel"> :label="item.columnLabel">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span> <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-main> </el-main>
<!-- 底部按钮 -->
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="applyScheduleBatch">应用</el-button>
<el-button type="primary" @click="saveAndClose">保存</el-button>
<el-button @click="closeDialog">关闭</el-button>
</span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -163,7 +245,7 @@ var functionId = 'C10000038';
export default { export default {
data() { data() {
return { return {
height: 320,
height: 220,
titleCon: '排产扩展', titleCon: '排产扩展',
showDefault: false, showDefault: false,
buttons: { buttons: {
@ -358,6 +440,7 @@ export default {
}, },
resourceShiftList: [], resourceShiftList: [],
orderScheduleList: [], orderScheduleList: [],
scheduleDetailList: [],
dataListLoading: false, dataListLoading: false,
columnTimeArray: [ columnTimeArray: [
{ {
@ -1174,6 +1257,7 @@ export default {
// //
this.resourceList = []; this.resourceList = [];
this.resourceShiftList = []; this.resourceShiftList = [];
this.scheduleDetailList = [];
this.pageData.resourceId = ''; this.pageData.resourceId = '';
this.pageData.workCenterNo = ''; this.pageData.workCenterNo = '';
this.orderScheduleList = []; this.orderScheduleList = [];
@ -1245,6 +1329,145 @@ export default {
this.getResourceShiftData(); this.getResourceShiftData();
}, },
/*新增排产明细行*/
addScheduleDetail(){
//
if(this.resourceList.length === 0){
this.$message.warning('请先获取可用机台信息');
return;
}
//
let defaultResourceId = this.resourceList.length > 0 ? this.resourceList[0].resourceId : '';
this.scheduleDetailList.push({
orderNo: this.pageData.orderNo,
itemNo: this.pageData.itemNo,
resourceId: defaultResourceId,
qtyRequired: 0,
rowCount: 0,
rollCount: 0
});
},
/*删除排产明细行*/
deleteScheduleDetail(index){
this.scheduleDetailList.splice(index, 1);
},
/*批量应用排产*/
applyScheduleBatch(){
//
if(this.scheduleDetailList.length === 0){
this.$message.warning('请先添加排产明细');
return;
}
//
for(let i = 0; i < this.scheduleDetailList.length; i++){
let item = this.scheduleDetailList[i];
if(!item.resourceId || item.resourceId === ''){
this.$message.error(`${i+1}行:请选择机台`);
return;
}
if(!item.qtyRequired || item.qtyRequired <= 0){
this.$message.error(`${i+1}行:需求数量必须大于0`);
return;
}
}
//
this.executeBatchSchedule(0, false);
},
/*保存并关闭*/
saveAndClose(){
//
if(this.scheduleDetailList.length === 0){
this.$message.warning('请先添加排产明细');
return;
}
//
for(let i = 0; i < this.scheduleDetailList.length; i++){
let item = this.scheduleDetailList[i];
if(!item.resourceId || item.resourceId === ''){
this.$message.error(`${i+1}行:请选择机台`);
return;
}
if(!item.qtyRequired || item.qtyRequired <= 0){
this.$message.error(`${i+1}行:需求数量必须大于0`);
return;
}
}
//
this.executeBatchSchedule(0, true);
},
/*执行批量排产(递归调用)*/
executeBatchSchedule(index, closeAfterFinish){
if(index >= this.scheduleDetailList.length){
//
this.$message.success('批量排产完成');
//
this.scheduleDetailList = [];
//
this.refreshShopOrderData();
this.getOrderScheduleList();
//
if(closeAfterFinish){
this.closeDialog();
//
this.$emit('refreshPageTables');
}
return;
}
let item = this.scheduleDetailList[index];
//
let scheduleData = {
site: this.pageData.site,
username: this.pageData.username,
orderNo: item.orderNo,
itemNo: item.itemNo,
resourceId: item.resourceId,
workCenterNo: this.pageData.workCenterNo,
scheduleDate: this.pageData.scheduleDate,
scheduleTime: this.pageData.scheduleTime,
specifiedTime: this.pageData.specifiedTime,
scheduledQty: item.qtyRequired,
calendarId: this.pageData.calendarId,
checkFlag: true,
rowCount: item.rowCount,
rollCount: item.rollCount
};
//
scheduleOrderWithExpand(scheduleData).then(({data}) => {
if(data.code == 500){
this.$message.error(`${index+1}行排产失败:${data.msg}`);
//
return;
}else if(data.code == 201){
//
this.$message.warning(`${index+1}行:${data.msg}`);
this.executeBatchSchedule(index + 1, closeAfterFinish);
}else{
//
this.executeBatchSchedule(index + 1, closeAfterFinish);
}
}).catch(error => {
this.$message.error(`${index+1}行排产异常`);
console.error(error);
});
},
/*开始排产*/ /*开始排产*/
startScheduleOrderBun(){ startScheduleOrderBun(){
let scheduledQty = this.pageData.scheduledQty; let scheduledQty = this.pageData.scheduledQty;
@ -1508,4 +1731,13 @@ div.customer-el-card-blue {
background-color: unset !important; background-color: unset !important;
} }
/*对话框底部按钮样式*/
.dialog-footer {
text-align: center;
}
.dialog-footer .el-button {
margin: 0 10px;
}
</style> </style>
Loading…
Cancel
Save