Просмотр исходного кода

修复首件两检bug和任务报工的bug

695593266@qq.com 5 месяцев назад
Родитель
Сommit
52c005ac1e

+ 4 - 2
src/views/produce/components/bom/qualityTesting/inspectionTemplate.vue

@@ -178,7 +178,8 @@
         ],
         where: { ...defaultWhere },
         typeList: [],
-        isFirst: false
+        isFirst: false,
+        typeName: ''
       };
     },
 
@@ -255,7 +256,7 @@
         this.where = {
           qualitySchemeTemplateCode: '',
           qualitySchemeTemplateName: '',
-          type: ''
+          type: this.isFirst ? this.typeName : ''
         };
         this.reload();
       },
@@ -273,6 +274,7 @@
           )?.value;
 
           if (this.isFirst) {
+            this.typeName = name ? name : '';
             this.where.type = name ? name : '';
             this.reload();
           }

+ 0 - 1
src/views/produce/components/jobBooking/index.vue

@@ -1357,7 +1357,6 @@
                 item.workReportInfo.formedNum
               );
               const totalReportNum = this.add(reportNum, Number(res));
-              console.log(totalReportNum, totalNum, '1111');
               if (totalReportNum > totalNum) {
                 this.$confirm('报工数量大于生产数量, 是否继续报工?', '提示', {
                   confirmButtonText: '确定',

+ 2 - 5
src/views/produce/components/picking/wokePopup.vue

@@ -161,10 +161,8 @@
       // },
 
       open(req) {
+        this.workList = [];
         craftFiles(req).then((res) => {
-          // this.$refs.fileTable.setDate(res);
-          // this.workList = res;
-          console.log(res, 'res');
           let _ids = [];
           if (res.length != 0) {
             res.forEach((e) => {
@@ -179,7 +177,7 @@
       },
 
       openTwo(req) {
-        console.log(req);
+        this.workList = [];
         fileReleaseAPI({
           fileType: 0,
           isQueryAll: 1,
@@ -190,7 +188,6 @@
           pageNum: 1,
           size: 10
         }).then((res) => {
-          console.log(res, '13123131');
           this.workList = res.list;
         });
 

+ 20 - 3
src/views/produce/components/qualityInspection/components/selfInspectionRequest.vue

@@ -35,7 +35,14 @@
           </el-form-item>
         </el-col>
 
-        <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
+        <el-col
+          :lg="8"
+          :md="12"
+          :sm="12"
+          :xl="8"
+          :xs="12"
+          v-if="clientEnvironmentId != 9"
+        >
           <el-form-item label="执行部门:" prop="beEntrustedDeptId">
             <deptSelect
               v-model="form.beEntrustedDeptId"
@@ -44,7 +51,14 @@
           </el-form-item>
         </el-col>
 
-        <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
+        <el-col
+          :lg="8"
+          :md="12"
+          :sm="12"
+          :xl="8"
+          :xs="12"
+          v-if="clientEnvironmentId != 9"
+        >
           <el-form-item label="执行人员:" prop="executeUserId">
             <el-select
               style="width: 100%"
@@ -238,7 +252,8 @@
           beEntrustedDeptName: '',
           executeUserName: '',
           id: '',
-          itemIds: []
+          itemIds: [],
+          clientEnvironmentId: ''
         },
         rules: {
           name: [{ required: true, message: '请输入', trigger: 'change' }],
@@ -335,6 +350,8 @@
     methods: {
       open(item) {
         this.visible = true;
+        this.clientEnvironmentId =
+          this.$store.state.user.info.clientEnvironmentId;
         this.isAdd = false;
         this.item = this.deepCopy(item);
         this.getData();

+ 8 - 8
src/views/produce/components/taskReport.vue

@@ -51,7 +51,7 @@
             ></el-date-picker>
           </el-form-item>
         </el-col>
-        <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
+        <!-- <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
           <el-form-item label="合格数量" prop="qualifiedQuantity">
             <el-input
               v-model.number="form.qualifiedQuantity"
@@ -61,8 +61,8 @@
               @input="(e) => handleQuantityInput(e, 'qualifiedQuantity')"
             ></el-input>
           </el-form-item>
-        </el-col>
-        <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
+        </el-col> -->
+        <!-- <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
           <el-form-item label="不合格数量" prop="unqualifiedQuantity">
             <el-input
               v-model.number="form.unqualifiedQuantity"
@@ -72,8 +72,8 @@
               @input="(e) => handleQuantityInput(e, 'unqualifiedQuantity')"
             ></el-input>
           </el-form-item>
-        </el-col>
-        <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
+        </el-col> -->
+        <!-- <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
           <el-form-item label="合格重量" prop="qualifiedWeight">
             <el-input
               v-model.number="form.qualifiedWeight"
@@ -83,8 +83,8 @@
               @input="(e) => handleWeightInput(e, 'qualifiedWeight')"
             ></el-input>
           </el-form-item>
-        </el-col>
-        <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
+        </el-col> -->
+        <!-- <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
           <el-form-item label="不合格重量" prop="unqualifiedWeight">
             <el-input
               v-model.number="form.unqualifiedWeight"
@@ -94,7 +94,7 @@
               @input="(e) => handleWeightInput(e, 'unqualifiedWeight')"
             ></el-input>
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
           <el-form-item label="报工数" prop="reportQuantity">
             <el-input

+ 43 - 2
src/views/produce/index.vue

@@ -1823,6 +1823,13 @@
       },
 
       buildForm(row) {
+        console.log();
+        const actualQuantity = this.add(
+          row.reportQuantity ? row.reportQuantity : 0,
+          row.lossQuantity ? row.lossQuantity : 0
+        );
+        const remainingQuantity = this.sub(row.formingNum, actualQuantity);
+
         return {
           realStartTime: row.realStartTime,
           realEndTime: row.realEndTime,
@@ -1830,8 +1837,10 @@
           qualifiedWeight: row.qualifiedWeight,
           unqualifiedQuantity: row.unqualifiedQuantity,
           unqualifiedWeight: row.unqualifiedWeight,
-          reportQuantity: row.reportQuantity,
-          lossQuantity: row.lossQuantity,
+          reportQuantity: row.reportQuantity
+            ? remainingQuantity
+            : row.formingNum,
+          lossQuantity: 0,
           remark: row.assigneeRemark
         };
       },
@@ -2237,6 +2246,38 @@
         });
       },
 
+      getDecimalLength(num) {
+        return (num.toString().split('.')[1] || '').length;
+      },
+
+      toInteger(num) {
+        const len = this.getDecimalLength(num);
+        return {
+          int: Math.round(num * Math.pow(10, len)),
+          factor: Math.pow(10, len)
+        };
+      },
+
+      add(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
+      sub(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) - bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
       //获取工单列表
       getTaskInstanceByIdFn(workOrderId) {
         getTaskInstanceById(workOrderId).then((res) => {

+ 1 - 1
src/views/produceOrder/workReport.vue

@@ -825,7 +825,7 @@
 
           if (!this.$store.state.user.info.workCenterIds) {
             return this.$message.warning('该用户没有权限报工');
-          }
+          }3
 
           const isWorkCenter =
             this.$store.state.user.info.workCenterIds.includes(

+ 8 - 8
src/views/taskList/components/Ddtails.vue

@@ -60,7 +60,7 @@
             ></el-date-picker>
           </el-form-item>
         </el-col>
-        <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
+        <!-- <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
           <el-form-item label="合格数量" prop="qualifiedQuantity">
             <el-input
               v-model.number="form.qualifiedQuantity"
@@ -70,8 +70,8 @@
               @input="(e) => handleQuantityInput(e, 'qualifiedQuantity')"
             ></el-input>
           </el-form-item>
-        </el-col>
-        <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
+        </el-col> -->
+        <!-- <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
           <el-form-item label="不合格数量" prop="unqualifiedQuantity">
             <el-input
               v-model.number="form.unqualifiedQuantity"
@@ -81,8 +81,8 @@
               @input="(e) => handleQuantityInput(e, 'unqualifiedQuantity')"
             ></el-input>
           </el-form-item>
-        </el-col>
-        <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
+        </el-col> -->
+        <!-- <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
           <el-form-item label="合格重量" prop="qualifiedWeight">
             <el-input
               v-model.number="form.qualifiedWeight"
@@ -92,8 +92,8 @@
               @input="(e) => handleWeightInput(e, 'qualifiedWeight')"
             ></el-input>
           </el-form-item>
-        </el-col>
-        <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
+        </el-col> -->
+        <!-- <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
           <el-form-item label="不合格重量" prop="unqualifiedWeight">
             <el-input
               v-model.number="form.unqualifiedWeight"
@@ -103,7 +103,7 @@
               @input="(e) => handleWeightInput(e, 'unqualifiedWeight')"
             ></el-input>
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :lg="12" :md="12" :sm="12" :xl="12" :xs="12">
           <el-form-item label="报工数" prop="reportQuantity">
             <el-input

+ 40 - 2
src/views/taskList/index.vue

@@ -887,6 +887,11 @@
           newWeightUnit: row.newWeightUnit,
           measuringUnit: row.measuringUnit
         };
+        const actualQuantity = this.add(
+          row.reportQuantity ? row.reportQuantity : 0,
+          row.lossQuantity ? row.lossQuantity : 0
+        );
+        const remainingQuantity = this.sub(row.formingNum, actualQuantity);
         let form = {
           realEndTime: row.realEndTime,
           realStartTime: row.realStartTime,
@@ -896,9 +901,9 @@
           remark: row.assigneeRemark,
           qualifiedQuantity: row.qualifiedQuantity,
           reportQuantity: row.reportQuantity
-            ? row.reportQuantity
+            ? remainingQuantity
             : row.formingNum,
-          lossQuantity: row.lossQuantity ? row.lossQuantity : 0
+          lossQuantity: 0
         };
         if (this.tabValue == '4') {
           const data = {
@@ -924,6 +929,39 @@
           this.$refs.detailsRef.open(type, currentRow, form);
         }
       },
+
+      getDecimalLength(num) {
+        return (num.toString().split('.')[1] || '').length;
+      },
+
+      toInteger(num) {
+        const len = this.getDecimalLength(num);
+        return {
+          int: Math.round(num * Math.pow(10, len)),
+          factor: Math.pow(10, len)
+        };
+      },
+
+      add(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
+      sub(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) - bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
       viewRecords(apsAssigneeId) {
         listUpdateRealTimeRecord(apsAssigneeId)
           .then((res) => {