Explorar o código

货位编号不能重复

yusheng hai 1 ano
pai
achega
0ed253c641

+ 1 - 1
src/main.js

@@ -22,7 +22,7 @@ import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';
 import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css';
 import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css';
 import { create, all } from 'mathjs'; // 引入mathjs工具并初始化
-import authSelection from '@/components/AuthSelection';
+import authSelection from '@/components/authSelection';
 import Print from 'vue-printjs';
 Vue.use(Print);
 Vue.use(elTableInfiniteScroll);

+ 1 - 1
src/views/warehouseManagement/inboundRequests/components/search.vue

@@ -134,7 +134,7 @@
 </template>
 
 <script>
-  import AuthSelection from '@/components/AuthSelection';
+  import AuthSelection from '@/components/authSelection';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
   export default {
     components: { AuthSelection },

+ 24 - 13
src/views/warehouseManagement/warehouseDefinition/add.vue

@@ -1613,22 +1613,33 @@
           return this.$message.error('货架总体积不能大于库区体积!');
         }
 
-        let obj = {};
-        for (const item of this.areaForm.allocationReqList) {
-          const area = this.areaForm.areaGoodsshelvesList.find((itm) => {
-            return itm.reservoirAreaCode === item.code;
-          });
+        // let obj = {};
+        // for (const item of this.areaForm.allocationReqList) {
+        //   const area = this.areaForm.areaGoodsshelvesList.find((itm) => {
+        //     return itm.reservoirAreaCode === item.code;
+        //   });
 
-          const id = `${
-            area && area.reservoirAreaCode + '-' + item.goodsShelvesCode
-          }-${item.code}`;
+        //   const id = `${
+        //     area && area.reservoirAreaCode + '-' + item.goodsShelvesCode
+        //   }-${item.code}`;
 
-          if (obj[id]) {
-            return this.$message.error('货位编号不能重复!');
-          } else {
-            obj[id] = 1;
-          }
+        //   if (obj[id]) {
+        //    
+        //   } else {
+        //     obj[id] = 1;
+        //   }
+        // }
+        
+        let codeS=this.areaForm.allocationReqList?.map(item=>{
+          return item.reservoirAreaCode+'_'+item.goodsShelvesCode+'_'+item.goodsAllocationCode
+        })
+        if(codeS){
+          codeS=Array.from(new Set(codeS)) 
+        }
+        if(codeS?.length!=this.areaForm.allocationReqList?.length){
+          return this.$message.error('货位编号不能重复!');
         }
+   
 
         this.$refs.areaFormName.validate(async (valid) => {
           if (valid) {