jingshuyong 10 месяцев назад
Родитель
Сommit
1ced3c30c5

+ 1 - 1
src/views/inspectionPlan/components/baseInfo.vue

@@ -764,7 +764,7 @@
 
       //   根据来源得到产品
       handleChoose(val) {
-        console.log(val, '根据来源得到产品');
+        console.log(val, '根据来源得到产品 3');
         if (!val) return;
         this.form.planSourceCode = val.receiveNo;
         // *** 之前未对生产检验进行判断 当类型是生产检验的时候 productId 是 undefined

+ 5 - 4
src/views/inspectionPlan/components/new-baseInfo.vue

@@ -675,19 +675,20 @@
 
       //主数据根据来源得到产品
       handleMainChoose(val) {
-        console.log(val, '主数据根据来源得到产品');
+        console.log(val, '主数据根据来源得到产品 1');
         if (!val) return;
 
         this.form.productName = val.name; //名称
         this.form.productCode = val.code; //编码
         this.form.specification = val.specification; //规格
         this.form.modelType = val.modelType; //型号
-        this.form.brandNo = val.brandNum; //牌号
+        this.form.brandNo = val.brandNum; //牌号 brandNum
         this.form.totalWeight = val.totalWeight; //总重量
         this.form.inspectionStandards = val.inspectionStandards; //检验标准
         this.form.isConsumable = val.isConsumable; //0 单件 1 批量
         this.form.productId = val.id;
         this.form.netWeight = val.netWeight; //净重
+        console.log(this.form,'00000000000000000')
         // console.log(this.form.type)
         console.log('----------------->>>>');
         this.getProductDetails(this.form.productId);
@@ -736,7 +737,7 @@
 
       //   根据来源得到产品
       handleChoose(val) {
-        console.log(val, '根据来源得到产品');
+        console.log(val, '根据来源得到产品 9');
         if (!val) return;
         this.form.planSourceCode = val.receiveNo;
         // *** 之前未对生产检验进行判断 当类型是生产检验的时候 productId 是 undefined
@@ -759,7 +760,7 @@
         this.form.batchNo = val.batchNo;
         this.form.specification = val.specification;
         this.form.modelType = val.modelType;
-        this.form.brandNo = val.brandNo;
+        this.form.brandNo = val.productBrand;
         this.form.productNumber = val.totalCount;
         this.form.qualifiedNumber = val.qualifiedNumber;
         this.form.unqualifiedNumber = val.unqualifiedNumber;

+ 47 - 34
src/views/inspectionPlan/components/new-edit.vue

@@ -640,11 +640,11 @@
         handler(newVal) {
           // 计算重量跟数量
           this.calculate(newVal);
-          newVal.map(async(el)=>{
-            if(!el.sampleCode){
-               el.sampleCode = await this.getSampleCode();
+          newVal.map(async (el) => {
+            if (!el.sampleCode) {
+              el.sampleCode = await this.getSampleCode();
             }
-          })
+          });
         },
         deep: true,
         immediate: true
@@ -2148,12 +2148,14 @@
             : item['measureQuantity'], // 剩余可取样数量
           maxPossible: item['measureQuantity'] / sampleQuantity // 最大取样次数
         }));
-
+        console.log(items, 'items items items');
+        console.log(sampleQuantity, 'sampleQuantity sampleQuantity [[[]]]');
         const result = [];
         let remainingCount = sampleCount;
-
+        console.log(remainingCount, 'remainingCount ========');
         // 尽可能均匀地从各条目取样
         while (remainingCount > 0) {
+          
           // 按剩余可取样比例排序
           items.sort(
             (a, b) =>
@@ -2164,6 +2166,9 @@
           let distributed = false;
 
           for (const item of items) {
+            let values = remainingCount > 1 ? 1 : remainingCount;
+            // sampleQuantity = remainingCount > 1 ? 1 : remainingCount;
+            console.log(sampleQuantity, 'sampleQuantity ----');
             if (
               (!isUnitMismatch && remainingCount > 0) ||
               (item.remainingQuantity >= sampleQuantity && remainingCount > 0)
@@ -2175,12 +2180,14 @@
                 this.conditionType == 1 &&
                 this.baseForm.inspectionStandards == 1
               ) {
-                result.push({ ...item, measureQuantity: 1, sampleCode });
+                console.log('进来1')
+                result.push({ ...item, measureQuantity: values, sampleCode });
               } else if (
                 this.conditionType == 2 &&
                 (this.baseForm.inspectionStandards == 1 ||
                   this.baseForm.inspectionStandards == 2)
               ) {
+                console.log('进来2')
                 let weight = (item.weight / item.maxPossible).toFixed(2);
                 result.push({
                   ...item,
@@ -2695,6 +2702,8 @@
           this.baseForm.sampleMeasureUnit = this.formData.sampleUnit;
           this.sampleList = [];
           const sampleCount = Number(this.formData.portion);
+          console.log(sampleCount, 'sampleCount sampleCount == p');
+          console.log(this.formData, 'this.formData 000');
           const measureQ = this.formData.number || 1;
           const unit = this.formData.sampleUnit;
           let specifications = this.packingSpecificationOption.find(
@@ -2716,16 +2725,19 @@
               }
               // ***
               //抽检计量整样小样或者抽检计重小样
-              if (!this.validateMeasureQuantity(measureQ, unit, sampleCount))
-                return;
+              // if (!this.validateMeasureQuantity(measureQ, unit, sampleCount))
+              //   return;
               if (unit === 'KG' && !this.validateWeight(measureQ, sampleCount))
                 return; // 若计量单位为重量,还需验证总重量是否足够
               console.log('getNewFullSampleList');
               if (this.conditionType == '1' && this.baseForm.type == '3') {
+                console.log(1111111111111111111);
                 await this.handleWeightFullSample(sampleCount, specifications);
               } else {
+                console.log('2222222222222 --', Math.ceil(sampleCount));
                 await this.getNewFullSampleList(
-                  Math.ceil(sampleCount),
+                  // Math.ceil(sampleCount),
+                  sampleCount,
                   measureQ,
                   unit,
                   specifications
@@ -2791,31 +2803,32 @@
       },
 
       validateMeasureQuantity(measureQ, unit, sampleCount) {
-        if (this.conditionType == 2 && measureQ <= 0) {
-          this.$message.info('取样计量数量必须大于0');
-          return false;
-        }
-
-        const totalQuantity = this.selectedList.reduce(
-          (sum, item) => sum + item.measureQuantity,
-          0
-        );
-        if (
-          (this.selectedList[0].measureUnit === unit ||
-            this.conditionType == 1) &&
-          measureQ * sampleCount > totalQuantity
-        ) {
-          this.$message.info('取样计量数量不能大于总计量数量');
-          return false;
-        }
+        // if (this.conditionType == 2 && measureQ <= 0) {
+        //   this.$message.info('取样计量数量必须大于0');
+        //   return false;
+        // }
 
-        const invalidItem = this.selectedList.find(
-          (item) => item.measureQuantity < measureQ
-        );
-        if (invalidItem) {
-          this.$message.info('条目计量数量小于取样计量数量');
-          return false;
-        }
+        // const totalQuantity = this.selectedList.reduce(
+        //   (sum, item) => sum + item.measureQuantity,
+        //   0
+        // );
+        // if (
+        //   (this.selectedList[0].measureUnit === unit ||
+        //     this.conditionType == 1) &&
+        //   measureQ * sampleCount > totalQuantity
+        // ) {
+        //   this.$message.info('取样计量数量不能大于总计量数量');
+        //   return false;
+        // }
+        // console.log(this.selectedList,'33333333333')
+        // console.log(measureQ,'measureQ 0000')
+        // const invalidItem = this.selectedList.find(
+        //   (item) => item.measureQuantity < measureQ
+        // );
+        // if (invalidItem) {
+        //   this.$message.info('条目计量数量小于取样计量数量');
+        //   return false;
+        // }
 
         return true;
       },

+ 1 - 0
src/views/inspectionPlan/components/warehousing.vue

@@ -213,6 +213,7 @@
 
         //   return item;
         // });
+        console.log(this.current,'------------------')
         this.$emit('choose', this.current);
         this.handleClose();
       },

+ 2 - 1
src/views/inspectionProject/components/user-edit.vue

@@ -448,7 +448,8 @@
     },
     methods: {
       defaultInput(value) {
-        if(this.form.symbol !== '1'){
+        console.log(this.form.symbol,'0000 symbol')
+        if(this.form.textType !== '1'){
           return;
         }
         // 1. 过滤非法字符(只保留数字、负号和小数点)

+ 2 - 1
src/views/inspectionWork/edit.vue

@@ -1454,6 +1454,7 @@
           let distributed = false;
 
           for (const item of items) {
+            let values = remainingCount > 1 ? 1 : remainingCount;
             if (
               !isUnitMismatch ||
               (item.remainingQuantity >= sampleQuantity && remainingCount > 0)
@@ -1478,7 +1479,7 @@
               ) {
                 result.push({
                   ...item,
-                  measureQuantity: 1,
+                  measureQuantity: values,
                   sampleCode,
                   qualitySampleTemplateList
                 });