diff --git a/src/api/plan/order.js b/src/api/plan/order.js index 4d0f992..04fedd3 100644 --- a/src/api/plan/order.js +++ b/src/api/plan/order.js @@ -71,6 +71,14 @@ export function getWorkOrderList(id) { }) } +//排产预览 +export function getWorkOrderListCG(id) { + return request({ + url: '/plan/order/getWorkOrderListCG/' + id, + method: 'get' + }) +} + // 通过母订单id查询最新订单列表 export function getOrderList(id) { return request({ @@ -184,3 +192,21 @@ export function autoSplitOrder(data) { data: data }); } + +//关闭窗口 +export function autoSplitOrderCancel(data) { + return request({ + url: '/plan/order/autoSplitOrderCancel', + method: 'post', + data: data + }); +} + +//确认排产 +export function autoSplitOrderOk(data) { + return request({ + url: '/plan/order/autoSplitOrderOk', + method: 'post', + data: data + }); +} diff --git a/src/views/plan/order/index.vue b/src/views/plan/order/index.vue index c87df29..a81502b 100644 --- a/src/views/plan/order/index.vue +++ b/src/views/plan/order/index.vue @@ -115,14 +115,14 @@ >导出 - - 辅助排产 - ---> + @@ -584,7 +584,7 @@ @@ -597,14 +597,14 @@ import { getProEquipment, getProRoutes,getProSortNo, getProShifts, - getWorkOrderList, + getWorkOrderList,getWorkOrderListCG, subSplitOrder,checkRepeatBatchCodes, listOrder, addOrder, updateOrder, syncSAP, selectMaterielList,getAutoSplitList, deleteOrder,getCanProductLine, - autoSplitOrder + autoSplitOrder,autoSplitOrderCancel,autoSplitOrderOk } from '@/api/plan/order' import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' @@ -726,10 +726,11 @@ export default { openAutoSplit:false, orderCodes:[], autoSplitList:[], - autoSplitLoading: true, + openAutoSplit: false, activeSplit: 0, autoSplitform1:{ - productDate:new Date() + productDate:null, + sortNo:null }, autoSplitform2: {lineCodes:[]}, lineCodes:[] @@ -1374,6 +1375,9 @@ export default { this.dialogVisible = false; this.splitOpen = false; this.reset(); + this.openAutoSplit = false; + this.activeSplit = 0; + autoSplitOrderCancel(Object.assign({},this.autoSplitList[0])).then(response => {}); }, // 判空、空串 checkNull(entity) { @@ -1492,17 +1496,23 @@ export default { }, //排产优先级 handleAutoSplit(row) { - this.autoSplitLoading = true; + this.openAutoSplit = true; this.autoSplitList = this.orderCodes; + if(this.autoSplitList[0] == 'o2'){ + this.$modal.msgError("已经拆分结束!"); + } + + this.autoSplitform1.productDate = this.autoSplitList[0].planProDate; // 获取工艺信息(工艺选最新的) getProRoutes(this.autoSplitList[0].prodCode).then(response => { this.routes = response.data; - this.autoSplitform1.routeCode = response.data[0].routeCode + this.autoSplitform1.routeCode = response.data[0].routeCode; + }) - var ymd = moment(this.autoSplitform1.productDate).format('YYYY-MM-DD') + //var ymd = moment(this.autoSplitform1.productDate).format('YYYY-MM-DD') // 获取工单生产顺序 - getProSortNo(ymd).then(response => { + getProSortNo(this.autoSplitform1.productDate).then(response => { this.autoSplitform1.sortNo = response }) // 获取生产线体列表 @@ -1513,7 +1523,6 @@ export default { this.openAutoSplit = true; - this.autoSplitLoading = false; }, //判断勾选 selectable(row, index) { @@ -1555,9 +1564,20 @@ export default { if (this.activeSplit++ > 2) this.activeSplit = 0; //选完线体后的下一步,会进行模拟拆分 if(this.activeSplit == 2){ - debugger - autoSplitOrder(Object.assign({},this.autoSplitform1,this.autoSplitform2,this.autoSplitList[0])).then(response => { - + autoSplitOrder(Object.assign({},this.autoSplitList[0],this.autoSplitform1,this.autoSplitform2)).then(response => { + this.workerLoading = true // 设置加载状态为true,表示正在加载 + // 获取历史拆分工单信息 + getWorkOrderListCG(this.autoSplitList[0].id).then(response => { + var data = response.data + this.splitData = data + + this.refreshWorkerTable = false // 先将refreshProTable设置为false,隐藏表格 + this.$nextTick(() => { + // 使用$nextTick来等待DOM更新完成 + this.refreshWorkerTable = true // 立即将refreshProTable设置为true,显示表格 + this.workerLoading = false // 设置加载状态为false,表示加载完成 + }) + }) }); } }, @@ -1565,10 +1585,17 @@ export default { if (this.activeSplit-- > 2) this.activeSplit = 2; //会进行模拟拆分的取消 if(this.activeSplit == 1){ - autoSplitOrderCancel(Object.assign({},autoSplitform2)).then(response => { - + autoSplitOrderCancel(Object.assign({},this.autoSplitList[0])).then(response => { }); } + }, + autoSplitCommit(){ + autoSplitOrderOk(Object.assign({},this.autoSplitList[0])).then(response => { + this.$modal.msgSuccess('提交成功') + this.getList(); + this.openAutoSplit = false; + this.activeSplit = 0; + }); } }