Explorar el Código

设备运行跟踪 车间报工分配系数精度优化

zck hace 1 año
padre
commit
560b80c10a

+ 3 - 5
src/view/job/processSheet/processSheet.vue

@@ -5383,12 +5383,10 @@ const selectpYj = (event) => {
   // hiprint.init()
   const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondata1 })
 
-      console.log("打印前",workData.value.start_liucheng)//这个是1
-      console.log("打印前",workData.value.liucheng_total)//这个是2 就是打印两次
       for (let i = workData.value.start_liucheng; i <= workData.value.liucheng_total; i++) {
         (function(currentIndex) {
         // 创建一个基于当前索引的延迟
-        const delay = (currentIndex - 1) * 3600; // 毫秒
+        const delay = (currentIndex - 1) * 3600; // 延迟时间
           setTimeout(() => {
             const printdata = {
               "scpch": getDocumentInfos.data[0].Gd_gdbh,
@@ -5400,11 +5398,11 @@ const selectpYj = (event) => {
               "cpmc": getDocumentInfos.data[0].Gd_cpmc,
               "ztzs": workData.value.num,
               'table': getDocumentInfos.data.gy_data.map(item => ({
-                gxmc: item // 注意这里可能有问题,因为item没有被正确使用,你可能需要item的某个属性
+                gxmc: item 
               }))
             };
           hiprintTemplate.print2(printdata);
-          // hiprintTemplate.toPdf(printdata,'流程单'); // 如果需要,可以取消注释这行代码
+          // hiprintTemplate.toPdf(printdata,'流程单');
           }, delay);
         })(i); // 立即执行函数,传入当前的i值作为currentIndex
       }

+ 7 - 6
src/view/performance/chejianbaogong.vue

@@ -2742,7 +2742,7 @@ const ybupdateCompanyFunc = async (row) => {
       }
       dbformData.value.code10 = currentBz.value[9].split(' ')[0];
       dbformData.value.name10 = currentBz.value[9].split(' ')[1]
-      dbformData.value.percentage10 = parseFloat(currentBz.value[9].split(' ')[2].split('(')[1].split(')')[0])/100
+	  dbformData.value.percentage10 = Math.round((parseFloat(currentBz.value[9].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
       for (let i = 1; i <= Math.min(Object.keys(currentBz.value).length - 4, 6); i++) {
         sczl_bhkey = `sczl_bh${i}`
         sczl_namekey = `sczl_name${i}`
@@ -2752,7 +2752,8 @@ const ybupdateCompanyFunc = async (row) => {
         if(isNaN(parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]))){
           dbformData.value[percentagekey] = currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0];
         }else{
-          dbformData.value[percentagekey] = parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0])/100;
+		  dbformData.value[percentagekey] = Math.round((parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
+
         }
       }
     } else {
@@ -2773,7 +2774,7 @@ const ybupdateCompanyFunc = async (row) => {
         if(isNaN(parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]))){
           dbformData.value[percentagekey] = currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0];
         }else{
-          dbformData.value[percentagekey] = parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0])/100;
+		  dbformData.value[percentagekey] = Math.round((parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
         }
       }
     }
@@ -5307,7 +5308,7 @@ const BZhandle = (val) => {
     }
     formDatas.value.code8 = currentBz.value[9].split(' ')[0];
     formDatas.value.name8 = currentBz.value[9].split(' ')[1]
-    formDatas.value.percentage8 = parseFloat(currentBz.value[9].split(' ')[2].split('(')[1].split(')')[0])/100
+    formDatas.value.percentage8 = Math.round((parseFloat(currentBz.value[9].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
     for (let i = 1; i <= Math.min(Object.keys(currentBz.value).length - 5, 6); i++) {
       sczl_bhkey = `code${i}`
       sczl_namekey = `name${i}`
@@ -5317,7 +5318,7 @@ const BZhandle = (val) => {
       if(isNaN(parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]))){
         formDatas.value[percentagekey] = currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0];
       }else{
-        formDatas.value[percentagekey] = parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0])/100;
+        formDatas.value[percentagekey] = Math.round((parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
       }
     }
   } else {
@@ -5338,7 +5339,7 @@ const BZhandle = (val) => {
       if(isNaN(parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]))){
         formDatas.value[percentagekey] = currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0];
       }else{
-        formDatas.value[percentagekey] = parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0])/100;
+        formDatas.value[percentagekey] = Math.round((parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
       }
     }
   }

+ 13 - 11
src/view/yunyin/shengchanguanli/shebeiyunxing.vue

@@ -5342,7 +5342,8 @@ const BZhandle_rcl = (val) => {
     }
     formDatas_rcl.value.code8 = currentBz_rcl.value[9].split(' ')[0];
     formDatas_rcl.value.name8 = currentBz_rcl.value[9].split(' ')[1]
-    formDatas_rcl.value.percentage8 = parseFloat(currentBz_rcl.value[9].split(' ')[2].split('(')[1].split(')')[0])/100
+    formDatas_rcl.value.percentage8 = Math.round((parseFloat(currentBz_rcl.value[9].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
+
     for (let i = 1; i <= Math.min(Object.keys(currentBz_rcl.value).length - 5, 6); i++) {
       sczl_bhkey_rcl = `code${i}`
       sczl_namekey_rcl = `name${i}`
@@ -5352,7 +5353,7 @@ const BZhandle_rcl = (val) => {
       if(isNaN(parseFloat(currentBz_rcl.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]))){
         formDatas_rcl.value[percentagekey_rcl] = currentBz_rcl.value[i - 1].split(' ')[2].split('(')[1].split(')')[0];
       }else{
-        formDatas_rcl.value[percentagekey_rcl] = parseFloat(currentBz_rcl.value[i - 1].split(' ')[2].split('(')[1].split(')')[0])/100;
+		formDatas_rcl.value[percentagekey_rcl] = Math.round((parseFloat(currentBz_rcl.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
       }
     }
   } else {
@@ -5373,7 +5374,7 @@ const BZhandle_rcl = (val) => {
       if(isNaN(parseFloat(currentBz_rcl.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]))){
         formDatas_rcl.value[percentagekey_rcl] = currentBz_rcl.value[i - 1].split(' ')[2].split('(')[1].split(')')[0];
       }else{
-        formDatas_rcl.value[percentagekey_rcl] = parseFloat(currentBz_rcl.value[i - 1].split(' ')[2].split('(')[1].split(')')[0])/100;
+        formDatas_rcl.value[percentagekey_rcl] = Math.round((parseFloat(currentBz_rcl.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
       }
     }
   }
@@ -5774,14 +5775,14 @@ const fpsum2 = ref();
 //自动计算分配系数和
 function updateTotal() {
   //机台班组维护中分配系数字段
-  const relevantKeys = ['percentage1', 'percentage2', 'percentage3', 'percentage4', 'percentage5', 'percentage6', 'percentage7',];  
-  const values = relevantKeys.map(key => Math.round(parseFloat(formDatas.value[key], 10) * 100) || 0); // 转换为整数
-  const sum = values.reduce((sum, value) => sum + value, 0); 
-  fpsum.value = sum / 100;// 转换回小数 
+  const relevantKeys = ['percentage1', 'percentage2', 'percentage3', 'percentage4', 'percentage5', 'percentage6', 'percentage7'];  
+  const values = relevantKeys.map(key => parseFloat(formDatas.value[key], 10) * 100 || 0); // 转换为百分比
+  const sum = values.reduce((sum, value) => sum + value, 0);
+  fpsum.value = sum / 100; // 转换回小数;
   
   //修改中分配系数字段
   const relevantKeys2 = ['组员1', '组员2','组员3','组员4','组员5','组员6','组员7','组员8','组员9',];  
-  const valuess = relevantKeys2.map(key => Math.round(parseFloat(formdata3.value[key]['比例'], 10) * 100) || 0); 
+  const valuess = relevantKeys2.map(key => parseFloat(formdata3.value[key]['比例'], 10) * 100 || 0); 
   const sum2 = valuess.reduce((sum, value) => sum + value, 0);
   fpsum2.value = sum2 / 100; // 转换回小数  
 }
@@ -6164,6 +6165,7 @@ const BZhandle = (val) => {
   let sczl_bhkey = ''
   let sczl_namekey = ''
   let percentagekey = ''
+  console.log(currentBz.value)
   if (currentBz.value[9]) {
     for (let i = 1; i <= 9; i++) {
       sczl_bhkey = `code${i}`
@@ -6175,7 +6177,7 @@ const BZhandle = (val) => {
     }
     formDatas.value.code8 = currentBz.value[9].split(' ')[0];
     formDatas.value.name8 = currentBz.value[9].split(' ')[1]
-    formDatas.value.percentage8 = parseFloat(currentBz.value[9].split(' ')[2].split('(')[1].split(')')[0])/100
+	formDatas.value.percentage8 = Math.round((parseFloat(currentBz.value[9].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
     for (let i = 1; i <= Math.min(Object.keys(currentBz.value).length - 5, 6); i++) {
       sczl_bhkey = `code${i}`
       sczl_namekey = `name${i}`
@@ -6185,7 +6187,7 @@ const BZhandle = (val) => {
       if(isNaN(parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]))){
         formDatas.value[percentagekey] = currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0];
       }else{
-        formDatas.value[percentagekey] = parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0])/100;
+        formDatas.value[percentagekey] = Math.round((parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
       }
     }
   } else {
@@ -6206,7 +6208,7 @@ const BZhandle = (val) => {
       if(isNaN(parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]))){
         formDatas.value[percentagekey] = currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0];
       }else{
-        formDatas.value[percentagekey] = parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0])/100;
+		formDatas.value[percentagekey] = Math.round((parseFloat(currentBz.value[i - 1].split(' ')[2].split('(')[1].split(')')[0]) / 100 * 10000)) / 10000;
       }
     }
   }