|
|
@ -148,9 +148,9 @@ |
|
|
min-width="120" |
|
|
min-width="120" |
|
|
align="center"> |
|
|
align="center"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-input |
|
|
|
|
|
v-model="scope.row.carrierNo" |
|
|
|
|
|
readonly |
|
|
|
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model="scope.row.carrierNo" |
|
|
|
|
|
readonly |
|
|
placeholder="双击选择" |
|
|
placeholder="双击选择" |
|
|
@dblclick.native="openCarrierDialog(scope.$index)" |
|
|
@dblclick.native="openCarrierDialog(scope.$index)" |
|
|
style="cursor: pointer;"> |
|
|
style="cursor: pointer;"> |
|
|
@ -536,6 +536,7 @@ export default { |
|
|
resourceShiftList: [], |
|
|
resourceShiftList: [], |
|
|
orderScheduleList: [], |
|
|
orderScheduleList: [], |
|
|
scheduleDetailList: [], |
|
|
scheduleDetailList: [], |
|
|
|
|
|
successScheduledList: [], // 批量排产中已成功的记录(用于回滚) |
|
|
dataListLoading: false, |
|
|
dataListLoading: false, |
|
|
// 固定载具相关 |
|
|
// 固定载具相关 |
|
|
carrierDialogVisible: false, // 固定载具对话框 |
|
|
carrierDialogVisible: false, // 固定载具对话框 |
|
|
@ -1512,6 +1513,18 @@ export default { |
|
|
this.$message.error(`第${i+1}行:需求数量必须大于0`); |
|
|
this.$message.error(`第${i+1}行:需求数量必须大于0`); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 校验排数不能为负数 |
|
|
|
|
|
if(item.rowCount != null && item.rowCount < 0){ |
|
|
|
|
|
this.$message.error(`第${i+1}行:排数不能为负数`); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 校验卷数不能为负数 |
|
|
|
|
|
if(item.rollCount != null && item.rollCount < 0){ |
|
|
|
|
|
this.$message.error(`第${i+1}行:卷数不能为负数`); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 循环调用排产接口(不关闭对话框) |
|
|
// 循环调用排产接口(不关闭对话框) |
|
|
@ -1539,8 +1552,22 @@ export default { |
|
|
this.$message.error(`第${i+1}行:需求数量必须大于0`); |
|
|
this.$message.error(`第${i+1}行:需求数量必须大于0`); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 校验排数不能为负数 |
|
|
|
|
|
if(item.rowCount != null && item.rowCount < 0){ |
|
|
|
|
|
this.$message.error(`第${i+1}行:排数不能为负数`); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 校验卷数不能为负数 |
|
|
|
|
|
if(item.rollCount != null && item.rollCount < 0){ |
|
|
|
|
|
this.$message.error(`第${i+1}行:卷数不能为负数`); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 初始化成功排产记录数组 |
|
|
|
|
|
this.successScheduledList = []; |
|
|
// 循环调用排产接口(完成后关闭对话框) |
|
|
// 循环调用排产接口(完成后关闭对话框) |
|
|
this.executeBatchSchedule(0, true); |
|
|
this.executeBatchSchedule(0, true); |
|
|
}, |
|
|
}, |
|
|
@ -1593,11 +1620,49 @@ export default { |
|
|
// 停止继续排产 |
|
|
// 停止继续排产 |
|
|
return; |
|
|
return; |
|
|
}else if(data.code == 201){ |
|
|
}else if(data.code == 201){ |
|
|
// 有警告信息,跳过此条继续下一条 |
|
|
|
|
|
this.$message.warning(`第${index+1}行:${data.msg}`); |
|
|
|
|
|
this.executeBatchSchedule(index + 1, closeAfterFinish); |
|
|
|
|
|
|
|
|
// 有警告信息,弹出确认对话框让用户选择是否继续 |
|
|
|
|
|
this.$confirm(`第${index+1}行:${data.msg},是否继续执行?`, '提示', { |
|
|
|
|
|
confirmButtonText: '继续执行', |
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
type: 'warning' |
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
// 用户选择继续,不校验数量,重新执行当前行的排产 |
|
|
|
|
|
scheduleData.checkFlag = false; |
|
|
|
|
|
scheduleOrderWithExpand(scheduleData).then(({data: retryData}) => { |
|
|
|
|
|
if(retryData.code == 0){ |
|
|
|
|
|
this.$message.success(`第${index+1}行排产成功`); |
|
|
|
|
|
// 记录成功排产的信息 |
|
|
|
|
|
this.successScheduledList.push({ |
|
|
|
|
|
orderNo: scheduleData.orderNo, |
|
|
|
|
|
itemNo: scheduleData.itemNo, |
|
|
|
|
|
resourceId: scheduleData.resourceId, |
|
|
|
|
|
workCenterNo: scheduleData.workCenterNo |
|
|
|
|
|
}); |
|
|
|
|
|
// 继续下一条 |
|
|
|
|
|
this.executeBatchSchedule(index + 1, closeAfterFinish); |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.$message.error(`第${index+1}行排产失败:${retryData.msg}`); |
|
|
|
|
|
// 停止继续排产 |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
this.$message.error(`第${index+1}行排产异常`); |
|
|
|
|
|
console.error(error); |
|
|
|
|
|
}); |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
// 用户选择取消,当前行(返回201的)未执行排产 |
|
|
|
|
|
// 删除之前已成功排产的记录,保留当前行及后续未执行的记录 |
|
|
|
|
|
this.rollbackSuccessSchedules(index); |
|
|
|
|
|
}); |
|
|
}else{ |
|
|
}else{ |
|
|
// 排产成功,继续下一条 |
|
|
|
|
|
|
|
|
// 排产成功,记录成功排产的信息 |
|
|
|
|
|
this.successScheduledList.push({ |
|
|
|
|
|
orderNo: scheduleData.orderNo, |
|
|
|
|
|
itemNo: scheduleData.itemNo, |
|
|
|
|
|
resourceId: scheduleData.resourceId, |
|
|
|
|
|
workCenterNo: scheduleData.workCenterNo |
|
|
|
|
|
}); |
|
|
|
|
|
// 继续下一条 |
|
|
this.executeBatchSchedule(index + 1, closeAfterFinish); |
|
|
this.executeBatchSchedule(index + 1, closeAfterFinish); |
|
|
} |
|
|
} |
|
|
}).catch(error => { |
|
|
}).catch(error => { |
|
|
@ -1707,6 +1772,31 @@ export default { |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/*回滚批量排产中已成功的记录*/ |
|
|
|
|
|
rollbackSuccessSchedules(currentIndex) { |
|
|
|
|
|
// 用户点击取消,说明不想要这次批量排产 |
|
|
|
|
|
// 已成功排产的记录保留在数据库中(不删除) |
|
|
|
|
|
// 只需要从排产明细列表中删除已执行的行,保留未执行的行 |
|
|
|
|
|
|
|
|
|
|
|
this.$message.warning(`已取消批量排产,已成功排产 ${this.successScheduledList.length} 条记录保留`); |
|
|
|
|
|
|
|
|
|
|
|
// 从排产明细列表中删除已成功排产的行 |
|
|
|
|
|
// 保留从 currentIndex 开始的所有未执行的记录 |
|
|
|
|
|
this.scheduleDetailList = this.scheduleDetailList.slice(currentIndex); |
|
|
|
|
|
|
|
|
|
|
|
// 清空成功记录列表 |
|
|
|
|
|
this.successScheduledList = []; |
|
|
|
|
|
|
|
|
|
|
|
// 刷新页面数据 |
|
|
|
|
|
this.refreshShopOrderData(); |
|
|
|
|
|
this.getOrderScheduleList(); |
|
|
|
|
|
|
|
|
|
|
|
// 提示用户可以修改数量后继续 |
|
|
|
|
|
if(this.scheduleDetailList.length > 0){ |
|
|
|
|
|
this.$message.warning(`已保留 ${this.scheduleDetailList.length} 条未执行的记录,请修改后继续操作`); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
/*控制单行的背景颜色*/ |
|
|
/*控制单行的背景颜色*/ |
|
|
controlRowStyle({row, rowIndex}){ |
|
|
controlRowStyle({row, rowIndex}){ |
|
|
let colorStyle = row.colorStyle; |
|
|
let colorStyle = row.colorStyle; |
|
|
|