From 9f225bb1f1e26d25c1652d3e1ec2a8f239f69615 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 18 三月 2025 10:41:29 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js |   62 ++++++++++++++++++++++++++++---
 1 files changed, 56 insertions(+), 6 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
index 5acb9bc..c624a5c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
@@ -17,6 +17,21 @@
   tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓)
   buttons: { view: [], box: [], detail: [] }, //鎵╁睍鐨勬寜閽�
   methods: {
+    //鑾峰彇琛ㄥ崟閰嶇疆
+    getOption(field) {
+      let option;
+      this.detailOptions.columns.forEach(x => {
+        if (x.field == field) {
+          option = x;
+        }
+        // x.forEach(item => {
+        //   if (item.field == field) {
+        //     option = item;
+        //   }
+        // })
+      })
+      return option;
+    },
     //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄�
     onInit() {
       // let enableBtn = this.buttons.find(x => x.value == 'Add');
@@ -32,6 +47,7 @@
       //妗嗘灦鍒濆鍖栭厤缃悗
       //濡傛灉瑕侀厤缃槑缁嗚〃,鍦ㄦ鏂规硶鎿嶄綔
       this.detailOptions.columns.forEach(x => {
+
         if (x.field == 'materielCode') {
           x.onChange = (val, option) => {
             // this.$error(val.materielCode)
@@ -42,9 +58,19 @@
                 // this.$success(source.data.materielName);
                 this.refresh();
               })
+            // let locationCodes = this.getOption("locationCode");
+            // locationCodes.bind.data.splice(0);
+            // this.http.post("/api/LocationInfo/GetLocationCodes", { Extra: val.materielCode }, true).then(
+            //   source => {
+            //     if (!source.status) return this.$error(source.message);
+            //     val.materielName = source.message;
+            //     for (let i = 0; i < source.data.length; i++) {
+            //       locationCodes.bind.data.push({ key: source.data[i], value: source.data[i] });
+            //     }
+            //     this.refresh();
+            //   })
           }
         }
-
       });
     },
     searchBefore(param) {
@@ -58,8 +84,23 @@
     },
     addBefore(formData) {
       //鏂板缓淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛紝鍙互缁欑粰琛ㄥ崟璁剧疆鍊硷紝鑷繁杈撳嚭鐪媐ormData鐨勫��
+      let req = true;
+      // let locationCodes = formData.detailData.map(x=>{
+      //   // this.$error(x.locationCode);
+      //   return x.locationCode
+      // });
+
+      formData.detailData.forEach(x => {
+        // if ('locationCode' in x) {
+        //   //  return this.$error(x.batchNo);
+        // }
+        if (!x.hasOwnProperty('batchNo')) {
+          req = false;
+          return this.$error("鏌滃彿涓嶈兘涓虹┖");
+        }
+      })
       if (formData.detailData.length > 3) return this.$error("鍏ュ簱鍗曟槑缁嗕笉鑳借秴杩�3涓�");
-      return true;
+      return req;
     },
     updateBefore(formData) {
       //缂栬緫淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛ㄣ�佸垹闄よ鐨処d
@@ -78,17 +119,26 @@
       //(3)this.editFormFields.瀛楁='xxx';
       //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊�
       //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions)
-
       if (this.currentAction == 'Add') {
+      let locationCodes=this.getOption("locationCode");
+      locationCodes.bind.data.splice(0);
+      this.http.post("/api/LocationInfo/GetLocationCodes", null, true).then(
+        source => {
+          if (!source.status) return this.$error(source.message);
+          for (let i = 0; i < source.data.length; i++) {
+            locationCodes.bind.data.push({ key: source.data[i], value: source.data[i] });
+          }
+          this.refresh();
+        })
         this.detailOptions.columns.forEach(x => {
-          if (x.field == 'materielCode' || x.field == 'batchNo' || x.field == 'orderQuantity'||x.field=='locationCode') {
+          if (x.field == 'materielCode' || x.field == 'batchNo' || x.field == 'orderQuantity' || x.field == 'locationCode') {
             x.readonly = false
           }
         });
       } else {
         this.detailOptions.columns.forEach(x => {
-          if (x.field == 'materielCode' || x.field == 'batchNo' || x.field == 'orderQuantity'||x.field=='locationCode') {
-            x.readonly =true// row.orderStatus > 0
+          if (x.field == 'materielCode' || x.field == 'batchNo' || x.field == 'orderQuantity' || x.field == 'locationCode') {
+            x.readonly = true// row.orderStatus > 0
           }
         });
       }

--
Gitblit v1.9.3