diff --git a/src/api/schedule/order_schedule_fqc.js b/src/api/schedule/order_schedule_fqc.js index f7f20c2..22e113e 100644 --- a/src/api/schedule/order_schedule_fqc.js +++ b/src/api/schedule/order_schedule_fqc.js @@ -9,18 +9,12 @@ export const getOperatorListWithFqc = data => createAPI('scheduling/getOperatorL // 获取FQC的排产记录 export const getOrderScheduleListWithFqc = data => createAPI('scheduling/getOrderScheduleListWithFqc', 'POST', data) -//获取当前加工中心对应的机台数据 -export const getCurrentWorkCenterNoByResourceId = data => createAPI('scheduling/getCurrentWorkCenterNoByResourceId', 'POST', data) - -//排产生产工单的操作 -export const scheduleWorkOrder = data => createAPI('scheduling/scheduleWorkOrder', 'POST', data) +//FQC操作员排产 +export const scheduleFqcOperators = data => createAPI('scheduling/scheduleFqcOperators', 'POST', data) //取消排产生产工单的操作 export const cancelSoSchedule = data => createAPI('scheduling/cancelSoSchedule', 'POST', data) -//取消排产生产工单的操作 -export const addWaitSchedule = data => createAPI('scheduling/addWaitSchedule', 'POST', data) - //重新排产生产工单的操作 export const reScheduleWorkOrders = data => createAPI('scheduling/reScheduleWorkOrders', 'POST', data) diff --git a/src/views/modules/schedule/order_schedule_fqc.vue b/src/views/modules/schedule/order_schedule_fqc.vue index 6833346..cf2d219 100644 --- a/src/views/modules/schedule/order_schedule_fqc.vue +++ b/src/views/modules/schedule/order_schedule_fqc.vue @@ -115,7 +115,7 @@ 可用操作员 - 排产 @@ -141,6 +141,7 @@ border :cell-style="customerCellStyle" :cell-class-name="customerCellClassName" @row-click="setCurrentOperatorRow" + @current-change="changeCurrentOperatorRow" highlight-current-row ref="operatorTable" v-loading="dataListLoading" @@ -172,18 +173,24 @@
已排产记录 - - + 上移 - - + 下移 + + + 重新排产 + + @@ -192,8 +199,11 @@ :data="orderScheduleList" border ref="scheduleTable" + highlight-current-row + :row-class-name="scheduleRowClassName" @row-click="setCurrentScheduleRow" @current-change="changeScheduleRow" + @row-dblclick="warnCancelScheduleConfirm" v-loading="dataListLoading" style="margin-left: -15px; margin-top: -5px;"> = 0){ + //设置选中行 + this.$refs.operatorTable.setCurrentRow(this.operatorList[this.operatorIndex]); //选中当前是的行 setTimeout(() =>{ - this.$refs.operatorTable.setCurrentRow(this.operatorList[this.operatorIndex]); //设置默认选中的人员 this.searchData.resourceId = this.operatorList[this.operatorIndex].operatorId; + this.pageData.resourceId = this.operatorList[this.operatorIndex].operatorId; //刷新当前的派工单记录 this.getOrderScheduleList(); },500); @@ -1395,17 +1414,6 @@ export default { }) }, - /*区分不同的菜单 调用不同的方法 调用不同的方法*/ - handleCommand(menuName) { - //区分是哪一个方法调用 - if ('分批排产' === menuName) { - this.openSplitScheduleModal(); - } else if ('重新排产' === menuName) { - //调用提示的方法 - this.warnReScheduleConfirm(); - } - }, - /*设置工艺的行*/ setCurrentRoutingRow(row, column, event) { this.currentRoutingRow = row; @@ -1437,10 +1445,21 @@ export default { this.currentOperatorRow = JSON.parse(JSON.stringify(row)); //设置查询的条件 this.searchData.resourceId = row.operatorId; + this.pageData.resourceId = row.operatorId; //刷新table this.getOrderScheduleList(); }, + /*当前值发生变化的时候修改*/ + changeCurrentOperatorRow(row, oldRow){ + //判断是否是获取焦点的事件 + if(row){ + this.currentOperatorRow = JSON.parse(JSON.stringify(row)); + //设置当前的序号 + //this.operatorIndex = row.index; + } + }, + /*设置当前派工单行的下标*/ scheduleRowClassName({row, rowIndex}){ row.index = rowIndex; @@ -1472,68 +1491,35 @@ export default { //判断是否是获取焦点的事件 if(row){ this.currentScheduleRow = JSON.parse(JSON.stringify(row)); - //设置当前的序号 - this.scheduleIndex = row.index; } }, /*开始排产的操作*/ - startScheduleOperation(row, $event, column) { - //判断排产的加工中心和机台是否为空 - if (this.pageData.workCenterNo == null || '' == this.pageData.workCenterNo) { - this.$message.error('加工中心不能为空!') - return false; - } - if (this.pageData.resourceId == null || '' == this.pageData.resourceId) { - this.$message.error('机台不能为空!') - return false; - } - //赋值排产的数量 - let scheduledQty = row.qtyToSchedule; - row.qtyScheduled = scheduledQty; - row.qtyToSchedule = parseFloat(row.qtyToSchedule) - parseFloat(row.qtyScheduled); - this.pageData.scheduledQty = scheduledQty; - //设置工单和工序 - this.pageData.orderNo = row.orderNo; - this.pageData.itemNo = row.itemNo; - //执行排产的方法 - this.scheduleWorkOrderOperation(scheduledQty); - }, - - /*分批排产*/ - initAddSplitSchedule(scheduledQty) { - //设置工单和工序 - this.pageData.orderNo = this.currentRoutingRow.orderNo; - this.pageData.itemNo = this.currentRoutingRow.itemNo; - //判断排产的加工中心和机台是否为空 - if (this.pageData.workCenterNo == null || '' == this.pageData.workCenterNo) { - this.$message.error('加工中心不能为空!') - return false; + scheduleOperatorsBun() { + //循环判断是否存在需要排产 + let scheduleOperators = []; + //处理需要排产的数据 + for(let i = 0; i < this.operatorList.length; i++){ + let tempOperator = this.operatorList[i]; + if(parseFloat(tempOperator.qtyToSchedule) > 0){ + scheduleOperators.push(tempOperator); + } } - if (this.pageData.resourceId == null || '' == this.pageData.resourceId) { - this.$message.error('机台不能为空!') + //判断是否存在需要排产的操作员 + if(scheduleOperators.length == 0){ + this.$message.error('暂无可排产的操作员!'); return false; } - this.currentRoutingRow.qtyScheduled = parseFloat(this.currentRoutingRow.qtyScheduled) + parseFloat(scheduledQty); - this.currentRoutingRow.qtyToSchedule = parseFloat(this.currentRoutingRow.qtyToSchedule) - parseFloat(scheduledQty); - //执行排产的方法 - this.scheduleWorkOrderOperation(scheduledQty); - }, - - /*排产生产工单*/ - scheduleWorkOrderOperation(scheduledQty) { - //重置请求的参数 - this.pageData.scheduledQty = scheduledQty; - scheduleWorkOrder(this.pageData).then(({data}) => { + //处理参数 + let postData = {'pageData': JSON.stringify(this.pageData), 'operatorList': JSON.stringify(scheduleOperators)} + //提交后台的数据 + scheduleFqcOperators(postData).then(({data}) => { if (data.code == 500) { - this.currentRoutingRow.qtyScheduled = parseFloat(this.currentRoutingRow.qtyScheduled) - parseFloat(scheduledQty); - this.currentRoutingRow.qtyToSchedule = parseFloat(this.currentRoutingRow.qtyToSchedule) + parseFloat(scheduledQty); this.$message.error(data.msg); - this.pageData.scheduledQty = 0; } else { this.$message.success(data.msg); - //刷新明细的报工页面 - this.getOrderScheduleList(); + //刷新明FQC操作员 + this.getOperatorList(); } }); }, @@ -1560,6 +1546,8 @@ export default { this.pageData.scheduledQty = scheduleRow.qtyRequired; this.pageData.workCenterNo = scheduleRow.workCenterNo; this.pageData.resourceId = scheduleRow.resourceId; + this.pageData.scheduleSeqNo = scheduleRow.scheduleSeqNo; + this.pageData.planStartTime = scheduleRow.planStartTime; //取消排产 cancelSoSchedule(this.pageData).then(({data}) => { if (data.code == 500) { @@ -1572,31 +1560,24 @@ export default { }); }, - /*分批排产*/ - addWaitScheduleBun() { - //重置请求的参数 - let waitTimes = this.pageData.waitTimes; - if (waitTimes <= 0) { - this.$message.error('等待时间必须大于零!') - return false; - } - //发送请求 - //判断排产的加工中心和机台是否为空 - if (this.pageData.workCenterNo == null || '' == this.pageData.workCenterNo) { - this.$message.error('加工中心不能为空!') - return false; - } - if (this.pageData.resourceId == null || '' == this.pageData.resourceId) { - this.$message.error('机台不能为空!') - return false; - } - //执行排产的方法 - this.addWaitScheduleOperation(); + /*提示是否重新排产*/ + warnReScheduleConfirm() { + //提示操作 + this.$confirm('确实要对排产清单中的未完成派工单进行排产吗?', '提示', { + confirmButtonText: '确认', + celButtonText: '取消', + type: 'warning' + }).then(() => { + //执行创建新卷的操作 + this.reScheduleFqcOperator(); + }); }, - /*插入等待的派工单信息*/ - addWaitScheduleOperation() { - addWaitSchedule(this.pageData).then(({data}) => { + /*重新排产的方法*/ + reScheduleFqcOperator() { + //设置重新排产的人员 + this.pageData.resourceId = this.currentOperatorRow.operatorId; + reScheduleWorkOrders(this.pageData).then(({data}) => { if (data.code == 500) { this.$message.error(data.msg); } else { @@ -1607,37 +1588,66 @@ export default { }); }, - /*提示取消派工单*/ - warnReScheduleConfirm() { - //判断加工中心和机台 - //判断排产的加工中心和机台是否为空 - if (this.pageData.workCenterNo == null || '' == this.pageData.workCenterNo) { - this.$message.error('加工中心不能为空!') + /*上移派工单*/ + moveUpScheduleBun(){ + //判断是否选择好了移动的行 + let scheduleRow = this.currentScheduleRow; + if(null == scheduleRow || scheduleRow == ''){ + this.$message.error('请先选择处理的行!'); return false; } - if (this.pageData.resourceId == null || '' == this.pageData.resourceId) { - this.$message.error('机台不能为空!') + //判断是否是第一行 + if(scheduleRow.index == 0){ + this.$message.error('已经是首行,无法继续上行!'); return false; } - //提示操作 - this.$confirm('确实要对排产清单中的未完成派工单进行排产吗?', '提示', { - confirmButtonText: '确认', - celButtonText: '取消', - type: 'warning' - }).then(() => { - //执行创建新卷的操作 - this.initReScheduleWorkOrders(); + //请求的参数 + let requestData = {'site': this.pageData.site, + 'workCenterNo': this.pageData.workCenterNo, + 'resourceId': this.pageData.resourceId, + 'scheduleSeqNo': scheduleRow.scheduledSeqNo}; + //请求处理当前的参数 + moveUpSchedule(requestData).then(({data}) => { + if(data.code == 500){ + this.$message.error(data.msg); + }else{ + this.$message.success(data.msg); + //重置当前行 + this.scheduleIndex = this.scheduleIndex - 1; + //刷新派工单的数据 + this.getOrderScheduleList(); + } }); }, - /*重新排产的方法*/ - initReScheduleWorkOrders() { - reScheduleWorkOrders(this.pageData).then(({data}) => { - if (data.code == 500) { + /*上移派工单*/ + moveDownScheduleBun(){ + //判断是否选择好了移动的行 + let scheduleRow = this.currentScheduleRow; + if(null == scheduleRow || scheduleRow == ''){ + this.$message.error('请先选择处理的行!'); + return false; + } + let countNums = this.orderScheduleList.length; + //判断是否是第一行 + if(scheduleRow.index == countNums - 1){ + this.$message.error('已经是末行,无法继续下行!'); + return false; + } + //请求的参数 + let requestData = {'site': this.pageData.site, + 'workCenterNo': this.pageData.workCenterNo, + 'resourceId': this.pageData.resourceId, + 'scheduleSeqNo': scheduleRow.scheduledSeqNo}; + //请求处理当前的参数 + moveDownSchedule(requestData).then(({data}) => { + if(data.code == 500){ this.$message.error(data.msg); - } else { + }else{ this.$message.success(data.msg); - //刷新明细的报工页面 + //重置当前行 + this.scheduleIndex = this.scheduleIndex + 1; + //刷新派工单的数据 this.getOrderScheduleList(); } }); @@ -1764,8 +1774,8 @@ div.customer-el-card-blue { .customer-css .customer-left-main { width: calc(50vw - 360px) !important; padding: 0px; - margin-left: -10px; - margin-right: -25px; + margin-left: -5px; + margin-right: -20px; margin-bottom: -5px; } @@ -1773,8 +1783,8 @@ div.customer-el-card-blue { .customer-css .customer-right-main { width: calc(50vw - 240px) !important; padding: 0px; - margin-left: -10px; - margin-right: -25px; + margin-left: -5px; + margin-right: -20px; margin-bottom: -5px; }