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

fix: 添加同产品工序批次号颜色重复校验

yusheng 1 месяц назад
Родитель
Сommit
993ea441fc

+ 15 - 14
src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

@@ -2154,16 +2154,17 @@
             if (!v.productCode) {
               isTemporary.push(v.productName);
             }
-            // tabList.forEach((v2, j) => {
-            //   if (
-            //     v.productCode == v2.productCode &&
-            //     v.taskId == v2.taskId &&
-            //     v.batchNo == v2.batchNo &&
-            //     i != j
-            //   ) {
-            //     is = true;
-            //   }
-            // });
+            tabList.forEach((v2, j) => {
+              if (
+                v.productCode == v2.productCode &&
+                v.taskId == v2.taskId &&
+                v.batchNo == v2.batchNo &&
+                v.colorKey == v2.colorKey &&
+                i != j
+              ) {
+                is = true;
+              }
+            });
           });
 
           if (isTemporary.length > 0) {
@@ -2175,10 +2176,10 @@
             return;
           }
 
-          // if (is) {
-          //   this.$message.error('同产品,工序、批次号不能完全一致!');
-          //   return;
-          // }
+          if (is) {
+            this.$message.error('同产品,工序、批次号、颜色不能完全一致!');
+            return;
+          }
           let productList = [
             ...tabList,
             ...rawDetailList.map((item) => {

+ 18 - 1
src/views/purchasingManage/purchaseOrder/invoice/components/addInvoiceDialog.vue

@@ -292,7 +292,7 @@
             if (productList && productList.length > 0) {
               productList.forEach((v) => {
                 v.orderTotalCount = v.orderTotalCount || v.totalCount;
-                v.orderProductId=v.id
+                v.orderProductId = v.id;
               });
             }
             this.form = Object.assign({}, this.form, {
@@ -515,7 +515,24 @@
           let commitData = Object.assign({}, this.form, {
             productList: this.$refs.inventoryTableref.getTableValue()
           });
+          productList.forEach((v, i) => {
+            productList.forEach((v2, j) => {
+              if (
+                v.productCode == v2.productCode &&
+                v.taskId == v2.taskId &&
+                v.batchNo == v2.batchNo &&
+                v.colorKey == v2.colorKey &&
+                i != j
+              ) {
+                is = true;
+              }
+            });
+          });
 
+          if (is) {
+            this.$message.error('同产品,工序、批次号、颜色不能完全一致!');
+            return;
+          }
           if (this.isUpdate) {
             UpdateReceiveInformation(commitData)
               .then(async (res) => {

+ 27 - 0
src/views/saleManage/saleOrder/components/addDialogNew.vue

@@ -2036,7 +2036,34 @@
               this.$message.error('比例合计不能超过100%');
               return;
             }
+            let is = false;
+            commitData.productList.forEach((v, i) => {
+              commitData.productList.forEach((v2, j) => {
+                if (
+                  v.productCode == v2.productCode &&
+                  v.taskId == v2.taskId &&
+                  v.batchNo == v2.batchNo &&
+                  v.colorKey == v2.colorKey &&
+                  i != j
+                ) {
+                  is = true;
+                }
+              });
+            });
 
+            if (isTemporary.length > 0) {
+              this.$message.error(
+                isTemporary.toString() +
+                  '是临时产品,无法创建订单,请先去主数据维护!'
+              );
+
+              return;
+            }
+
+            if (is) {
+              this.$message.error('同产品,工序、批次号、颜色不能完全一致!');
+              return;
+            }
             // if(+ratioSum != 100){
             //   this.$message.error('比例合计必须为100%');
             //   return;

+ 23 - 5
src/views/saleManage/saleOrder/invoice/components/addInvoiceDialog.vue

@@ -216,12 +216,14 @@
     </el-tabs>
 
     <div slot="footer" class="footer">
-      <el-button type="primary" @click="save" :loading="loading" v-click-once>保存</el-button>
+      <el-button type="primary" @click="save" :loading="loading" v-click-once
+        >保存</el-button
+      >
       <el-button
         type="primary"
         v-if="isNeed_process_is_close"
         @click="save('sub')"
-         :loading="loading"
+        :loading="loading"
         v-click-once
         >提交</el-button
       >
@@ -1025,6 +1027,22 @@
             trakNoteList: this.$refs.taskInfoTableRef.getTableValue()
           });
           commitData.carNo = commitData.carNo.toString();
+
+          let is = false;
+          commitData.productList.forEach((v, i) => {
+            commitData.productList.forEach((v2, j) => {
+              if (
+                v.productCode == v2.productCode &&
+                v.taskId == v2.taskId &&
+                v.batchNo == v2.batchNo &&
+                v.colorKey == v2.colorKey &&
+                i != j
+              ) {
+                is = true;
+              }
+            });
+          });
+
           if (this.isUpdate) {
             UpdateSendInformation(commitData)
               .then((res) => {
@@ -1075,12 +1093,12 @@
         }
 
         // 当ids数组去重去空后有不同的值时,设置isSpecialeSubmit为true
-        const filteredIds = ids.filter(id => id !== undefined && id !== null && id !== '');
+        const filteredIds = ids.filter(
+          (id) => id !== undefined && id !== null && id !== ''
+        );
         const uniqueIds = [...new Set(filteredIds)];
         this.isSpecialeSubmit = uniqueIds.length > 1;
 
-        
-
         this.processSubmitDialogFlag = true;
 
         this.$nextTick(() => {