From 2aaad88fd7af2e31bf365f93910564472ea18e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com> Date: Wed, 24 Jul 2024 14:07:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/productOrder/productionScheduling.vue | 487 +++++++++++++++++- 1 file changed, 482 insertions(+), 5 deletions(-) diff --git a/hw-ui/src/views/mes/productOrder/productionScheduling.vue b/hw-ui/src/views/mes/productOrder/productionScheduling.vue index 89bdd52..ce72958 100644 --- a/hw-ui/src/views/mes/productOrder/productionScheduling.vue +++ b/hw-ui/src/views/mes/productOrder/productionScheduling.vue @@ -114,6 +114,7 @@ @@ -296,6 +297,465 @@ import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import {parseTime} from "@/utils/ruoyi"; +let deepSearch = (arr, target) => { + let results = [] + arr.forEach((element,k) => { + if (element.productOrderId === target) { + results = results.concat(arr.slice(k,arr.length)) + } else if (Array.isArray(element.children)) { + results = results.concat( deepSearch(element.children,target)) + } + // if (Array.isArray(element.children)) { + // results = results.concat(deepSearch(element.children, target)) + // } else if (element.id === target) { + // results.push(element) + // } + }) + return results +} +let a = { + "msg": "操作成功", + "code": 200, + "data": [ + { + "createBy": "admin", + "createTime": "2024-06-14 17:41:27", + "updateBy": "admin", + "updateTime": "2024-07-22 17:18:35", + "remark": null, + "productOrderId": 1, + "orderCode": "20240614174053OC001", + "saleOrderId": null, + "saleorderCode": "", + "saleorderLinenumber": null, + "projectNo": null, + "saleType": "1", + "materialId": 1, + "materialBomId": 1, + "materialBomDesc": "列管换热器-列管换热器", + "dispatchType": "2", + "dispatchId": 3, + "saleAmount": 2, + "planAmount": 2, + "dispatchAmount": 0, + "completeAmount": 0, + "releaseTime": "2024-06-17 16:34:20", + "planBeginTime": "2024-06-10 00:00:00", + "planEndTime": "2024-06-30 00:00:00", + "realBeginTime": "2024-06-25 14:33:24", + "realEndTime": null, + "planDeliveryDate": "2024-06-21 00:00:00", + "orderStatus": "1", + "stockLockFlag": "0", + "saleOrderFlag": "", + "dispatchName": "四楼工艺路线", + "materialCode": "01010001", + "materialName": "列管换热器", + "productionTime": 0, + "preOrderId": 0, + "preOrderCode": null, + "planId": null, + "planCode": null, + "planDateRange": [ + "2024-06-10 00:00:00", + "2024-06-30 00:00:00" + ] + }, + { + "createBy": "admin", + "createTime": "2024-07-04 14:43:10", + "updateBy": "admin", + "updateTime": "2024-07-22 17:18:35", + "remark": null, + "productOrderId": 9, + "orderCode": "20240704144248OC005", + "saleOrderId": null, + "saleorderCode": null, + "saleorderLinenumber": null, + "projectNo": null, + "saleType": "1", + "materialId": 1, + "materialBomId": 1, + "materialBomDesc": "列管换热器-列管换热器", + "dispatchType": "2", + "dispatchId": 3, + "saleAmount": 3, + "planAmount": 3, + "dispatchAmount": 1, + "completeAmount": 0, + "releaseTime": "2024-07-04 14:43:29", + "planBeginTime": "2024-07-01 00:00:00", + "planEndTime": "2024-07-18 00:00:00", + "realBeginTime": null, + "realEndTime": null, + "planDeliveryDate": "2024-08-09 00:00:00", + "orderStatus": "1", + "stockLockFlag": "0", + "saleOrderFlag": "0", + "dispatchName": "四楼工艺路线", + "materialCode": "01010001", + "materialName": "列管换热器", + "productionTime": 0, + "preOrderId": 0, + "preOrderCode": "20240614174053OC001", + "planId": null, + "planCode": null, + "planDateRange": [ + "2024-07-01 00:00:00", + "2024-07-18 00:00:00" + ] + }, + { + "createBy": "admin", + "createTime": "2024-07-05 17:53:08", + "updateBy": "admin", + "updateTime": "2024-07-22 17:18:35", + "remark": null, + "productOrderId": 10, + "orderCode": "20240705175249OC001", + "saleOrderId": null, + "saleorderCode": null, + "saleorderLinenumber": null, + "projectNo": null, + "saleType": "1", + "materialId": 1, + "materialBomId": 1, + "materialBomDesc": "列管换热器-列管换热器", + "dispatchType": "2", + "dispatchId": 1, + "saleAmount": 10, + "planAmount": 10, + "dispatchAmount": 0, + "completeAmount": 0, + "releaseTime": "2024-07-05 17:53:17", + "planBeginTime": "2024-07-19 00:00:00", + "planEndTime": "2024-08-02 00:00:00", + "realBeginTime": null, + "realEndTime": null, + "planDeliveryDate": "2024-08-09 00:00:00", + "orderStatus": "1", + "stockLockFlag": "0", + "saleOrderFlag": "0", + "dispatchName": "一楼工艺路线", + "materialCode": "01010001", + "materialName": "列管换热器", + "productionTime": 0, + "preOrderId": 0, + "preOrderCode": "20240704144248OC005", + "planId": null, + "planCode": null, + "planDateRange": [ + "2024-07-19 00:00:00", + "2024-08-02 00:00:00" + ] + }, + { + "createBy": "admin", + "createTime": "2024-07-16 09:21:38", + "updateBy": "admin", + "updateTime": "2024-07-23 09:36:21", + "remark": null, + "productOrderId": 11, + "orderCode": "20240716092020OC001", + "saleOrderId": 24, + "saleorderCode": "XSDD000001", + "saleorderLinenumber": null, + "projectNo": null, + "saleType": "1", + "materialId": 1, + "materialBomId": 1, + "materialBomDesc": "列管换热器-列管换热器", + "dispatchType": "2", + "dispatchId": 1, + "saleAmount": 10, + "planAmount": 5, + "dispatchAmount": 5, + "completeAmount": 0, + "releaseTime": "2024-07-23 09:33:43", + "planBeginTime": "2024-08-03 00:00:00", + "planEndTime": "2024-08-03 00:00:00", + "realBeginTime": null, + "realEndTime": null, + "planDeliveryDate": "2023-12-21 00:00:00", + "orderStatus": "1", + "stockLockFlag": "0", + "saleOrderFlag": "1", + "dispatchName": "一楼工艺路线", + "materialCode": "01010001", + "materialName": "列管换热器", + "productionTime": 0, + "preOrderId": 0, + "preOrderCode": "20240614174053OC001", + "planId": null, + "planCode": null, + "planDateRange": [ + "2024-08-03 00:00:00", + "2024-08-03 00:00:00" + ] + }, + { + "createBy": null, + "createTime": null, + "updateBy": null, + "updateTime": null, + "remark": null, + "productOrderId": 92, + "orderCode": null, + "saleOrderId": null, + "saleorderCode": null, + "saleorderLinenumber": null, + "projectNo": null, + "saleType": null, + "materialId": null, + "materialBomId": null, + "materialBomDesc": null, + "dispatchType": null, + "dispatchId": null, + "saleAmount": null, + "planAmount": 1, + "dispatchAmount": null, + "completeAmount": null, + "releaseTime": null, + "planBeginTime": "2024-07-01 00:00:00", + "planEndTime": "2024-07-10 00:00:00", + "realBeginTime": null, + "realEndTime": null, + "planDeliveryDate": null, + "orderStatus": null, + "stockLockFlag": null, + "saleOrderFlag": null, + "dispatchName": null, + "materialCode": null, + "materialName": null, + "productionTime": null, + "preOrderId": 9, + "preOrderCode": null, + "planId": 92, + "planCode": "20240711162036JL008", + "planDateRange": [ + "2024-07-01 00:00:00", + "2024-07-10 00:00:00" + ] + }, + { + "createBy": null, + "createTime": null, + "updateBy": null, + "updateTime": null, + "remark": null, + "productOrderId": 93, + "orderCode": null, + "saleOrderId": null, + "saleorderCode": null, + "saleorderLinenumber": null, + "projectNo": null, + "saleType": null, + "materialId": null, + "materialBomId": null, + "materialBomDesc": null, + "dispatchType": null, + "dispatchId": null, + "saleAmount": null, + "planAmount": 1, + "dispatchAmount": null, + "completeAmount": null, + "releaseTime": null, + "planBeginTime": "2024-07-11 00:00:00", + "planEndTime": "2024-07-13 00:00:00", + "realBeginTime": null, + "realEndTime": null, + "planDeliveryDate": null, + "orderStatus": null, + "stockLockFlag": null, + "saleOrderFlag": null, + "dispatchName": null, + "materialCode": null, + "materialName": null, + "productionTime": null, + "preOrderId": 9, + "preOrderCode": null, + "planId": 93, + "planCode": "20240711162036JL009", + "planDateRange": [ + "2024-07-11 00:00:00", + "2024-07-13 00:00:00" + ] + }, + { + "createBy": null, + "createTime": null, + "updateBy": null, + "updateTime": null, + "remark": null, + "productOrderId": 94, + "orderCode": null, + "saleOrderId": null, + "saleorderCode": null, + "saleorderLinenumber": null, + "projectNo": null, + "saleType": null, + "materialId": null, + "materialBomId": null, + "materialBomDesc": null, + "dispatchType": null, + "dispatchId": null, + "saleAmount": null, + "planAmount": 1, + "dispatchAmount": null, + "completeAmount": null, + "releaseTime": null, + "planBeginTime": "2024-07-17 00:00:00", + "planEndTime": "2024-07-18 00:00:00", + "realBeginTime": null, + "realEndTime": null, + "planDeliveryDate": null, + "orderStatus": null, + "stockLockFlag": null, + "saleOrderFlag": null, + "dispatchName": null, + "materialCode": null, + "materialName": null, + "productionTime": null, + "preOrderId": 9, + "preOrderCode": null, + "planId": 94, + "planCode": "20240711162036JL010", + "planDateRange": [ + "2024-07-17 00:00:00", + "2024-07-18 00:00:00" + ] + }, + { + "createBy": null, + "createTime": null, + "updateBy": null, + "updateTime": null, + "remark": null, + "productOrderId": 95, + "orderCode": null, + "saleOrderId": null, + "saleorderCode": null, + "saleorderLinenumber": null, + "projectNo": null, + "saleType": null, + "materialId": null, + "materialBomId": null, + "materialBomDesc": null, + "dispatchType": null, + "dispatchId": null, + "saleAmount": null, + "planAmount": 1, + "dispatchAmount": null, + "completeAmount": null, + "releaseTime": null, + "planBeginTime": null, + "planEndTime": null, + "realBeginTime": null, + "realEndTime": null, + "planDeliveryDate": null, + "orderStatus": null, + "stockLockFlag": null, + "saleOrderFlag": null, + "dispatchName": null, + "materialCode": null, + "materialName": null, + "productionTime": null, + "preOrderId": 9, + "preOrderCode": null, + "planId": 95, + "planCode": "20240711162036JL011", + "planDateRange": [] + }, + { + "createBy": null, + "createTime": null, + "updateBy": null, + "updateTime": null, + "remark": null, + "productOrderId": 104, + "orderCode": null, + "saleOrderId": null, + "saleorderCode": null, + "saleorderLinenumber": null, + "projectNo": null, + "saleType": null, + "materialId": null, + "materialBomId": null, + "materialBomDesc": null, + "dispatchType": null, + "dispatchId": null, + "saleAmount": null, + "planAmount": 5, + "dispatchAmount": null, + "completeAmount": null, + "releaseTime": null, + "planBeginTime": "2024-07-19 00:00:00", + "planEndTime": "2024-07-20 00:00:00", + "realBeginTime": null, + "realEndTime": null, + "planDeliveryDate": null, + "orderStatus": null, + "stockLockFlag": null, + "saleOrderFlag": null, + "dispatchName": null, + "materialCode": null, + "materialName": null, + "productionTime": null, + "preOrderId": 11, + "preOrderCode": null, + "planId": 104, + "planCode": "20240723093620JL001", + "planDateRange": [ + "2024-07-19 00:00:00", + "2024-07-20 00:00:00" + ] + }, + { + "createBy": null, + "createTime": null, + "updateBy": null, + "updateTime": null, + "remark": null, + "productOrderId": 105, + "orderCode": null, + "saleOrderId": null, + "saleorderCode": null, + "saleorderLinenumber": null, + "projectNo": null, + "saleType": null, + "materialId": null, + "materialBomId": null, + "materialBomDesc": null, + "dispatchType": null, + "dispatchId": null, + "saleAmount": null, + "planAmount": 5, + "dispatchAmount": null, + "completeAmount": null, + "releaseTime": null, + "planBeginTime": "2024-07-21 00:00:00", + "planEndTime": "2024-07-23 00:00:00", + "realBeginTime": null, + "realEndTime": null, + "planDeliveryDate": null, + "orderStatus": null, + "stockLockFlag": null, + "saleOrderFlag": null, + "dispatchName": null, + "materialCode": null, + "materialName": null, + "productionTime": null, + "preOrderId": 11, + "preOrderCode": null, + "planId": 105, + "planCode": "20240723093621JL002", + "planDateRange": [ + "2024-07-21 00:00:00", + "2024-07-23 00:00:00" + ] + } + ] +} export default { name: "ProductionScheduling", dicts: ['active_flag', 'plan_status', 'dispatch_type', 'mes_sale_type'], @@ -414,7 +874,7 @@ export default { watch: { productOrderList: { handler(newVal) { - this.filteredList = this.extractFields(newVal); + this.filteredList = this.extractFields(this.productOrderList); }, deep: true, immediate: true @@ -424,10 +884,11 @@ export default { /** 查询生产工单;生产工单列表 */ getList() { this.loading = true; - allListProductOrder(this.queryParams).then(response => { + // allListProductOrder(this.queryParams).then(response => { + let response = a this.productOrderList = this.handleTree(response.data, "productOrderId", "preOrderId"); this.loading = false; - }); + // }); }, /** 转换生产工单;生产工单数据结构 */ normalizer(node) { @@ -442,12 +903,13 @@ export default { }, /** 查询生产工单;生产工单下拉树结构 */ getTreeselect() { - allListProductOrder().then(response => { + // allListProductOrder().then(response => { + let response = a this.productOrderOptions = []; const data = {productOrderId: 0, orderCode: '顶级节点', children: []}; data.children = this.handleTree(response.data, "productOrderId", "preOrderId"); this.productOrderOptions.push(data); - }); + // }); }, // 取消按钮 cancel() { @@ -617,6 +1079,21 @@ export default { this.$modal.msgSuccess("删除成功"); }).catch(() => { }); + }, + timeChange(e){ + let data = deepSearch(this.productOrderList,e.productOrderId) + let arr = data.slice(1,data.length) + let time =new Date(e.planDateRange[1]) + time.setDate(time.getDate() + 1); + arr.forEach((i)=>{ + if(i.duration){ + // debugger + let time1 = new Date(time) + time1.setDate(time1.getDate() + parseFloat(i.duration)); + i.planDateRange = [parseTime(time),parseTime(time1)] + time = new Date(time1.setDate(time1.getDate() + 1)) + } + }) } } };