Explorar o código

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-mes into dev

LAPTOP-16IUEB3P\Lenovo %!s(int64=2) %!d(string=hai) anos
pai
achega
5798280dbf

+ 10 - 4
src/views/produceOrder/components/materialDialog.vue

@@ -13,7 +13,6 @@
     <ele-pro-table
       ref="tableRef"
       :columns="columns"
-      @done="handleDone"
       row-key="id"
       toolKit="[ 'size', 'columns', 'fullscreen']"
       cache-key="materialDialogtable"
@@ -86,12 +85,17 @@
       reload () {
         this.$refs.tableRef.reload();
       },
-      handleDone ({ data }) {
-        if (this.memo?.id) {
+      handleDone (data) {
+        if (this.memo?.id || this.memo?.sourceCategoryId) {
           this.$nextTick(() => {
             this.$refs.tableRef.setCurrentRow(
-              data.find((item) => item.id == this.memo.id)
+              data.find(
+                (item) =>
+                  item.id == (this.memo.id || this.memo.sourceCategoryId)
+              )
             );
+
+            console.log(data, this.memo);
           });
         }
       },
@@ -101,6 +105,7 @@
         });
 
         this.datasource = res;
+        this.handleDone(res);
       },
       confirm () {
         if (!this.current) return this.$message.error('请选择数据');
@@ -111,6 +116,7 @@
       },
       cancel () {
         this.$refs.tableRef.clearSelection();
+        this.$refs.tableRef.setCurrentRow();
         this.searchKey = '';
         this.current = null;
         this.visible = false;

+ 16 - 13
src/views/produceOrder/components/report/Common.vue

@@ -299,19 +299,22 @@
       report (fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
-            this.categoryMsg = Object.assign(this.categoryMsg, {
-              brandNum: this.infoData.brandNo,
-              sourceCategoryId: this.infoData.categoryId,
-              name: this.infoData.productName,
-              code: this.infoData.productCode
-            });
-            fun({
-              checkState: 1,
-              workReport: this.workReport,
-              workReportDeviceList: [this.workReportDeviceList],
-              workReportCategoryList: [this.categoryMsg]
-            }).then((res) => {
-              this.getReportCount();
+            this.$confirm('是否确定要报工?', '提示').then(() => {
+              this.categoryMsg = Object.assign(this.categoryMsg, {
+                brandNum: this.infoData.brandNo,
+                sourceCategoryId: this.infoData.categoryId,
+                name: this.infoData.productName,
+                code: this.infoData.productCode
+              });
+              fun({
+                checkState: 1,
+                workReport: this.workReport,
+                workReportDeviceList: [this.workReportDeviceList],
+                workReportCategoryList: [this.categoryMsg]
+              }).then((res) => {
+                this.$message.success('报工成功!');
+                this.getReportCount();
+              });
             });
           }
         });

+ 16 - 13
src/views/produceOrder/components/report/Drying.vue

@@ -333,19 +333,22 @@
       report (fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
-            this.categoryMsg = Object.assign(this.categoryMsg, {
-              brandNum: this.infoData.brandNo,
-              sourceCategoryId: this.infoData.categoryId,
-              name: this.infoData.productName,
-              code: this.infoData.productCode
-            });
-            fun({
-              checkState: 1,
-              workReport: this.workReport,
-              workReportDeviceList: [this.workReportDeviceList],
-              workReportCategoryList: [this.categoryMsg]
-            }).then((res) => {
-              this.getReportCount();
+            this.$confirm('是否确定要报工?', '提示').then(() => {
+              this.categoryMsg = Object.assign(this.categoryMsg, {
+                brandNum: this.infoData.brandNo,
+                sourceCategoryId: this.infoData.categoryId,
+                name: this.infoData.productName,
+                code: this.infoData.productCode
+              });
+              fun({
+                checkState: 1,
+                workReport: this.workReport,
+                workReportDeviceList: [this.workReportDeviceList],
+                workReportCategoryList: [this.categoryMsg]
+              }).then((res) => {
+                this.$message.success('报工成功!');
+                this.getReportCount();
+              });
             });
           }
         });

+ 21 - 18
src/views/produceOrder/components/report/Extrusion.vue

@@ -54,7 +54,7 @@
             required
             label-width="0"
             class="w100"
-            prop="categoryMsg.packNum"
+            prop="categoryMsg.code"
           >
             <el-input
               placeholder="请输入"
@@ -422,23 +422,26 @@
       report (fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
-            const workReportDeviceList = [];
-            if (this.workReportDeviceList.code) {
-              workReportDeviceList.push(this.workReportDeviceList);
-            }
-            if (this.moduleMsg.code) {
-              workReportDeviceList.push(this.moduleMsg);
-            }
-            if (this.boatMsg.code) {
-              workReportDeviceList.push(this.boatMsg);
-            }
-            fun({
-              checkState: 1,
-              workReport: this.workReport,
-              workReportCategoryList: [this.categoryMsg],
-              workReportDeviceList
-            }).then(() => {
-              this.getReportCount();
+            this.$confirm('是否确定要报工?', '提示').then(() => {
+              const workReportDeviceList = [];
+              if (this.workReportDeviceList.code) {
+                workReportDeviceList.push(this.workReportDeviceList);
+              }
+              if (this.moduleMsg.code) {
+                workReportDeviceList.push(this.moduleMsg);
+              }
+              if (this.boatMsg.code) {
+                workReportDeviceList.push(this.boatMsg);
+              }
+              fun({
+                checkState: 1,
+                workReport: this.workReport,
+                workReportCategoryList: [this.categoryMsg],
+                workReportDeviceList
+              }).then(() => {
+                this.$message.success('报工成功!');
+                this.getReportCount();
+              });
             });
           }
         });

+ 16 - 13
src/views/produceOrder/components/report/Furnace.vue

@@ -176,19 +176,22 @@
       report (fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
-            this.categoryMsg = Object.assign(this.categoryMsg, {
-              brandNum: this.infoData.brandNo,
-              sourceCategoryId: this.infoData.categoryId,
-              name: this.infoData.productName,
-              code: this.infoData.productCode
-            });
-            fun({
-              checkState: 1,
-              workReport: this.workReport,
-              workReportDeviceList: [this.workReportDeviceList],
-              workReportCategoryList: [this.categoryMsg]
-            }).then((res) => {
-              this.getReportCount();
+            this.$confirm('是否确定要报工?', '提示').then(() => {
+              this.categoryMsg = Object.assign(this.categoryMsg, {
+                brandNum: this.infoData.brandNo,
+                sourceCategoryId: this.infoData.categoryId,
+                name: this.infoData.productName,
+                code: this.infoData.productCode
+              });
+              fun({
+                checkState: 1,
+                workReport: this.workReport,
+                workReportDeviceList: [this.workReportDeviceList],
+                workReportCategoryList: [this.categoryMsg]
+              }).then((res) => {
+                this.$message.success('报工成功!');
+                this.getReportCount();
+              });
             });
           }
         });

+ 16 - 13
src/views/produceOrder/components/report/HalfAdded.vue

@@ -340,19 +340,22 @@
       report (fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
-            this.categoryMsg = Object.assign(this.categoryMsg, {
-              brandNum: this.infoData.brandNo,
-              sourceCategoryId: this.infoData.categoryId,
-              name: this.infoData.productName,
-              code: this.infoData.productCode
-            });
-            fun({
-              checkState: 1,
-              workReport: this.workReport,
-              workReportDeviceList: [this.workReportDeviceList],
-              workReportCategoryList: [this.categoryMsg]
-            }).then((res) => {
-              this.getReportCount();
+            this.$confirm('是否确定要报工?', '提示').then(() => {
+              this.categoryMsg = Object.assign(this.categoryMsg, {
+                brandNum: this.infoData.brandNo,
+                sourceCategoryId: this.infoData.categoryId,
+                name: this.infoData.productName,
+                code: this.infoData.productCode
+              });
+              fun({
+                checkState: 1,
+                workReport: this.workReport,
+                workReportDeviceList: [this.workReportDeviceList],
+                workReportCategoryList: [this.categoryMsg]
+              }).then((res) => {
+                this.$message.success('报工成功!');
+                this.getReportCount();
+              });
             });
           }
         });

+ 16 - 13
src/views/produceOrder/components/report/Heating.vue

@@ -349,19 +349,22 @@
       report (fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
-            this.categoryMsg = Object.assign(this.categoryMsg, {
-              brandNum: this.infoData.brandNo,
-              sourceCategoryId: this.infoData.categoryId,
-              name: this.infoData.productName,
-              code: this.infoData.productCode
-            });
-            fun({
-              checkState: 1,
-              workReport: this.workReport,
-              workReportDeviceList: [this.workReportDeviceList],
-              workReportCategoryList: [this.categoryMsg]
-            }).then((res) => {
-              this.getReportCount();
+            this.$confirm('是否确定要报工?', '提示').then(() => {
+              this.categoryMsg = Object.assign(this.categoryMsg, {
+                brandNum: this.infoData.brandNo,
+                sourceCategoryId: this.infoData.categoryId,
+                name: this.infoData.productName,
+                code: this.infoData.productCode
+              });
+              fun({
+                checkState: 1,
+                workReport: this.workReport,
+                workReportDeviceList: [this.workReportDeviceList],
+                workReportCategoryList: [this.categoryMsg]
+              }).then((res) => {
+                this.$message.success('报工成功!');
+                this.getReportCount();
+              });
             });
           }
         });

+ 18 - 15
src/views/produceOrder/components/report/Package.vue

@@ -332,21 +332,24 @@
             if (!this.workReportCategoryList?.length) {
               return this.$message.error('请添加物料');
             }
-            this.categoryMsg = Object.assign(this.categoryMsg, {
-              brandNum: this.infoData.brandNo,
-              sourceCategoryId: this.infoData.categoryId,
-              name: this.infoData.productName,
-              code: this.infoData.productCode
-            });
-            fun({
-              checkState: 1,
-              workReport: this.workReport,
-              workReportCategoryList: [
-                ...this.workReportCategoryList,
-                this.categoryMsg
-              ]
-            }).then((res) => {
-              this.getReportCount();
+            this.$confirm('是否确定要报工?', '提示').then(() => {
+              this.categoryMsg = Object.assign(this.categoryMsg, {
+                brandNum: this.infoData.brandNo,
+                sourceCategoryId: this.infoData.categoryId,
+                name: this.infoData.productName,
+                code: this.infoData.productCode
+              });
+              fun({
+                checkState: 1,
+                workReport: this.workReport,
+                workReportCategoryList: [
+                  ...this.workReportCategoryList,
+                  this.categoryMsg
+                ]
+              }).then((res) => {
+                this.$message.success('报工成功!');
+                this.getReportCount();
+              });
             });
           }
         });

+ 9 - 7
src/views/produceOrder/components/report/Sinter.vue

@@ -155,13 +155,15 @@
       report (fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
-            fun({
-              checkState: 1,
-              workReport: this.workReport,
-              workReportDeviceList: [this.workReportDeviceList]
-            }).then((res) => {
-              console.log(res);
-              this.getMsg();
+            this.$confirm('是否确定要报工?', '提示').then(() => {
+              fun({
+                checkState: 1,
+                workReport: this.workReport,
+                workReportDeviceList: [this.workReportDeviceList]
+              }).then((res) => {
+                this.$message.success('报工成功!');
+                this.getMsg();
+              });
             });
           }
         });

+ 15 - 12
src/views/produceOrder/components/report/Warehousing.vue

@@ -181,18 +181,21 @@
       report (fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
-            this.categoryMsg = Object.assign(this.categoryMsg, {
-              brandNum: this.infoData.brandNo,
-              sourceCategoryId: this.infoData.categoryId,
-              name: this.infoData.productName,
-              code: this.infoData.productCode
-            });
-            fun({
-              checkState: 1,
-              workReport: this.workReport,
-              workReportCategoryList: [this.categoryMsg]
-            }).then((res) => {
-              this.getReportCount();
+            this.$confirm('是否确定要报工?', '提示').then(() => {
+              this.categoryMsg = Object.assign(this.categoryMsg, {
+                brandNum: this.infoData.brandNo,
+                sourceCategoryId: this.infoData.categoryId,
+                name: this.infoData.productName,
+                code: this.infoData.productCode
+              });
+              fun({
+                checkState: 1,
+                workReport: this.workReport,
+                workReportCategoryList: [this.categoryMsg]
+              }).then((res) => {
+                this.$message.success('报工成功!');
+                this.getReportCount();
+              });
             });
           }
         });

+ 25 - 27
src/views/produceOrder/report.vue

@@ -194,34 +194,32 @@
     },
     methods: {
       handleReport () {
-        this.$confirm('是否确定要报工?', '提示').then(() => {
-          this.$refs.reportRef.report(async (data) => {
-            // data.workReportCategoryList = data.workReportCategoryList || [
-            //   {
-            //     code: this.infoData.productCode,
-            //     name: this.infoData.productName,
-            //     rootCategoryLevelId: '1',
-            //     batchNo: '',
-            //     brandNum: this.infoData.brandNo
-            //   }
-            // ];
-            if (data.workReport) {
-              data.workReport.taskCode = this.tabList[this.activeName].code;
-              data.workReport.taskName = this.tabList[this.activeName].name;
-              data.workReport.taskSort = this.tabList[this.activeName].sortNum;
-              data.workReport.workOrderId = this.infoData.id;
-            }
+        this.$refs.reportRef.report(async (data) => {
+          // data.workReportCategoryList = data.workReportCategoryList || [
+          //   {
+          //     code: this.infoData.productCode,
+          //     name: this.infoData.productName,
+          //     rootCategoryLevelId: '1',
+          //     batchNo: '',
+          //     brandNum: this.infoData.brandNo
+          //   }
+          // ];
+          if (data.workReport) {
+            data.workReport.taskCode = this.tabList[this.activeName].code;
+            data.workReport.taskName = this.tabList[this.activeName].name;
+            data.workReport.taskSort = this.tabList[this.activeName].sortNum;
+            data.workReport.workOrderId = this.infoData.id;
+          }
 
-            const params = {
-              isSapReportState: 0,
-              lastTaskCode:
-                this.tabList[
-                  this.activeName > 0 ? this.activeName - 1 : this.activeName
-                ].code,
-              ...data
-            };
-            await report(params);
-          });
+          const params = {
+            isSapReportState: 0,
+            lastTaskCode:
+              this.tabList[
+                this.activeName > 0 ? this.activeName - 1 : this.activeName
+              ].code,
+            ...data
+          };
+          await report(params);
         });
       },
       async getDetail (id) {