From e6b95b867105e7be676510c248638ecb41dd6f87 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 15 一月 2025 13:35:57 +0800
Subject: [PATCH] 优化物料码查询

---
 代码管理/WMS/WIDESEA_WMSClient/src/extension/basic/materielCodeInfo.js |   45 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 38 insertions(+), 7 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 7956968..1e93c31 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,26 +26,47 @@
       })
       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;
+    },
     //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄�
     onInit() {  //妗嗘灦鍒濆鍖栭厤缃墠锛�
+      let warehouseIdOption = this.getOption("warehouseId");
       let materielCodeOption = this.getOption("materielCode");
       let purchaseOrderNoOption = this.getOption("purchaseOrderNo");
-      purchaseOrderNoOption.onChange = (val, option) => {
+      warehouseIdOption.onChange=(val,option)=>{
         this.editFormFields.materielCode = "";
         materielCodeOption.data = [];
+        this.editFormFields.purchaseOrderNo = "";
+        purchaseOrderNoOption.data = [];
         if (val == null || val == 0) {
-          return this.$error("璇烽�夋嫨鐗╂枡缂栧彿锛�")
+          return this.$error("璇烽�夋嫨浠撳簱锛�")
         }
-        // console.log(val)
-        // console.log(option)
-        this.http.post("/api/PurchaseOrder/GetPurchaseOrderInfo?purchaseOrderNo=" + val, {}, true).then(
+        this.http.post("/api/PurchaseOrderDetail/GetPurchaseOrderDetailMaterielCode?warehouseId=" + 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: source.data[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);
+            for (let i = 0; i < source.data.length; i++) {
+              purchaseOrderNoOption.data.push({ key: source.data[i], value: source.data[i] })
+            }
             this.refresh();
           })
       }
@@ -99,6 +120,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