From d11b1f9c98e8765d3cee15abd4474b0e05a5acbc Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 01 三月 2025 10:33:56 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn

---
 代码管理/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js |  100 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 80 insertions(+), 20 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js"
index dc5728a..87fa048 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js"
@@ -26,29 +26,79 @@
       })
       return option;
     },
+    formatDate(dateStr) {
+      let date = new Date(dateStr);
+      let year = date.getFullYear();
+      let month = String(date.getMonth() + 1).padStart(2, "0");
+      let day = String(date.getDate()).padStart(2, "0");
+      return year + "-" + month + "-" + day;
+    },
+    // 鏂板鏂规硶锛氬姞杞界墿鏂欑紪鍙锋暟鎹�
+    async loadMaterielCodes(option) {
+      try {
+        option.loading = true;
+        const { page, pageSize, keyword } = option.pagination;
+        const res = await this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderDetailMaterielCode", {
+          warehouseId: this.editFormFields.warehouseId,
+          keyword,
+          page,
+          pageSize
+        }, true);
+    
+        if (res.status) {
+          option.pagination.total = res.total || res.data.length;
+          const newData = res.data.map(item => ({ key: item, value: item }));
+          option.data = page === 1 ? newData : [...option.data, ...newData];
+        }
+      } catch (error) {
+        this.$error("鏁版嵁鍔犺浇澶辫触");
+      } finally {
+        option.loading = false;
+      }
+    },
     //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄�
     onInit() {  //妗嗘灦鍒濆鍖栭厤缃墠锛�
-      let materielCodeOption = this.getOption("materielCode");
-      let purchaseOrderNoOption = this.getOption("purchaseOrderNo");
-      purchaseOrderNoOption.onChange = (val, option) => {
-        this.editFormFields.materielCode = "";
-        materielCodeOption.data = [];
-        if (val == null || val == 0) {
-          return this.$error("璇烽�夋嫨鐗╂枡缂栧彿锛�")
+      this.$nextTick(() => {
+        let warehouseIdOption = this.getOption("warehouseId");
+        let materielCodeOption = this.getOption("materielCode");
+        let purchaseOrderNoOption = this.getOption("purchaseOrderNo");
+        let materielQueryOption = this.getOption("materielQuery");
+        warehouseIdOption.onChange = (val, option) => {
+          this.editFormFields.materielCode = "";
+          materielCodeOption.data = [];
+          this.editFormFields.purchaseOrderNo = "";
+          purchaseOrderNoOption.data = [];
+          if (val == null || val == 0) {
+            return this.$error("璇烽�夋嫨浠撳簱锛�")
+          }
+          this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderDetailMaterielCode?warehouseId=" + val, {}, true).then(
+            source => {
+              if (!source.status) return this.$error(source.message);
+              this.$nextTick(() => {
+
+                for (let i = 0; i < source.data.length; i++) {
+                  materielCodeOption.data.push({ key: source.data[i], value: source.data[i] })
+                }
+              })
+            })
         }
-        // console.log(val)
-        // console.log(option)
-        this.http.post("/api/PurchaseOrder/GetPurchaseOrderInfo?purchaseOrderNo=" + val, {}, true).then(
-          source => {
-            if (!source.status) return this.$error(source.message);
-            for (let i = 0; i < source.data.length; i++) {
-              materielCodeOption.data.push({ key: i, value: source.data[i] })
-            }
-            // this.editFormFields.InputOder_itemname = source.data.itemName;
-            // this.$success(source.data.itemName);
-            this.refresh();
-          })
-      }
+        materielCodeOption.onChange = (val, option) => {
+          this.editFormFields.purchaseOrderNo = "";
+          purchaseOrderNoOption.data = [];
+          if (val == null || val == 0) {
+            return this.$error("璇烽�夋嫨鐗╂枡缂栧彿锛�")
+          }
+          this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderNos?materielCode=" + val, {}, true).then(
+            source => {
+              if (!source.status) return this.$error(source.message);
+              this.$nextTick(() => {
+                for (let i = 0; i < source.data.length; i++) {
+                  purchaseOrderNoOption.data.push({ key: source.data[i], value: source.data[i] })
+                }
+              });
+            })
+        }
+      });
 
       this.columns.push({
         field: '鎿嶄綔',
@@ -99,6 +149,16 @@
       //(3)this.editFormFields.瀛楁='xxx';
       //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊�
       //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions)
+      let isAdd = this.currentAction == 'Add';
+      if (isAdd) {
+        let date = new Date();
+        let year = date.getFullYear();
+        let month = String(date.getMonth() + 1).padStart(2, "0");
+        let day = String(date.getDate()).padStart(2, "0");
+        this.editFormFields.lotNo = year + month + day;
+        this.editFormFields.productionDate = year + "-" + month + "-" + day;
+        this.editFormFields.effectiveDate = year + 2 + "-" + month + "-" + day;
+      }
     }
   }
 };

--
Gitblit v1.9.3