From ca3e4977395bc02c5d147dffdff7381333fdfbca Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期四, 09 四月 2026 14:39:37 +0800
Subject: [PATCH] 空箱跨区域移库

---
 项目代码/WIDESEA_WMSClient/src/views/outbound/printForm.vue |   83 +++++++++++++++++++++++++++++------------
 1 files changed, 58 insertions(+), 25 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/printForm.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/printForm.vue"
index 9490e6a..14f0b8f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/printForm.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/printForm.vue"
@@ -45,6 +45,8 @@
                 v-model="printForm.barcode"
                 placeholder="璇疯緭鍏ユ壒鍙凤紙鐢熸垚浜岀淮鐮佺敤锛�"
                 clearable
+                @keyup.enter="fetchBarcodeData"  
+                :loading="fetchingData"    
               />
             </el-form-item>
 
@@ -57,7 +59,7 @@
             </el-form-item>
           </el-col>
 
-          <!-- 绗簩鍒� -->
+          
           <el-col :span="12">
             <el-form-item label="渚涘簲鍟嗙紪鐮�" prop="suplierCode">
               <el-input
@@ -104,7 +106,7 @@
           </el-col>
         </el-row>
 
-        <!-- 鎵归噺娣诲姞锛堝彲閫夛級 -->
+        
         <el-form-item label="鎵撳嵃浠芥暟">
           <el-input-number
             v-model="printCopyCount"
@@ -115,7 +117,7 @@
           />
         </el-form-item>
 
-        <!-- 鎿嶄綔鎸夐挳 -->
+        
         <el-form-item class="form-actions">
           <el-button type="primary" @click="submitForm">纭骞舵墦寮�鎵撳嵃寮圭獥</el-button>
           <el-button @click="resetForm">閲嶇疆琛ㄥ崟</el-button>
@@ -123,52 +125,87 @@
       </el-form>
     </el-card>
 
-    <!-- 寮曞叆鎵撳嵃寮圭獥缁勪欢 -->
+    
     <print-view ref="printViewRef" />
   </div>
 </template>
 
 <script>
-// 寮曞叆鎵撳嵃寮圭獥缁勪欢
+
 import printView from "@/extension/outbound/extend/printView.vue";
 import { ElMessage } from "element-plus";
+import http from '@/api/http.js'
 
 export default {
   name: "PrintInputPage",
   components: { printView },
   data() {
     return {
-      // 琛ㄥ崟鏁版嵁锛堝搴攑rintView鎵�闇�鐨勫弬鏁帮級
       printForm: {
-        materialCode: "", // 鏂欏彿
-        suplierCode: "", // 渚涘簲鍟嗙紪鐮�
-        materialName: "", // 鍝佸悕
-        pruchaseOrderNo: "", // 閲囪喘鍗曞彿
-        materialSpec: "", // 瑙勬牸
-        quantity: "", // 鏁伴噺/鎬绘暟
-        barcode: "", // 鎵瑰彿锛堜簩缁寸爜鍐呭锛�
-        batchNo: "", // 鎵规
-        factoryArea: "", // 鍘傚尯
-        date: "", // 鏃ユ湡锛堥粯璁ゅ綋鍓嶆棩鏈燂級
+        materialCode: "", 
+        suplierCode: "", 
+        materialName: "", 
+        pruchaseOrderNo: "", 
+        materialSpec: "", 
+        quantity: "", 
+        barcode: "", 
+        batchNo: "", 
+        factoryArea: "", 
+        date: "", 
       },
-      // 鎵撳嵃浠芥暟锛堟敮鎸佹壒閲忕敓鎴愬鏉$浉鍚屾暟鎹級
+      
       printCopyCount: 1,
-      // 琛ㄥ崟楠岃瘉瑙勫垯
+      
       formRules: {
         materialCode: [{ required: true, message: "璇疯緭鍏ユ枡鍙�", trigger: "blur" }],
         materialName: [{ required: true, message: "璇疯緭鍏ュ搧鍚�", trigger: "blur" }],
         barcode: [{ required: true, message: "璇疯緭鍏ユ壒鍙�", trigger: "blur" }],
         date: [{ required: true, message: "璇烽�夋嫨鏃ユ湡", trigger: "change" }],
       },
+      
+      fetchingData: false
     };
   },
   mounted() {
-    // 鍒濆鍖栭粯璁ゆ棩鏈熶负褰撳ぉ
     const today = new Date();
     this.printForm.date = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`;
   },
   methods: {
-    // 鎻愪氦琛ㄥ崟锛屾墦寮�鎵撳嵃寮圭獥
+    async fetchBarcodeData() {
+      if (!this.printForm.barcode.trim()) {
+        return;
+      }
+
+      try {
+        
+        this.fetchingData = true;
+        
+        const response = await http.post(
+          `/api/Outbound/PrintFromData?barcode=` + this.printForm.barcode.trim()
+        );
+        const data = response.data;
+        if (data) {
+          this.printForm.materialCode = data.materialCode || "";
+          this.printForm.suplierCode = data.suplierCode || "";
+          this.printForm.materialName = data.materialName || "";
+          this.printForm.pruchaseOrderNo = data.pruchaseOrderNo || "";
+          this.printForm.materialSpec = data.materialSpec || "";
+          this.printForm.quantity = data.quantity || "";
+          this.printForm.batchNo = data.batchNo || "";
+          this.printForm.factoryArea = data.factoryArea || "";
+          
+          
+          ElMessage.success("宸叉牴鎹壒鍙疯嚜鍔ㄥ~鍏呮暟鎹�");
+        } else {
+          ElMessage.info("鏈煡璇㈠埌璇ユ壒鍙峰搴旂殑鐗╂枡鏁版嵁");
+        }
+      } catch (error) {
+        console.error("鑾峰彇鎵瑰彿鏁版嵁澶辫触锛�", error);
+        ElMessage.error("鑾峰彇鏁版嵁澶辫触锛岃妫�鏌ョ綉缁滄垨鎵瑰彿鏄惁姝g‘");
+      } finally {
+        this.fetchingData = false;
+      }
+    },
     submitForm() {
       this.$refs.printFormRef.validate((valid) => {
         if (!valid) {
@@ -177,13 +214,10 @@
         }
 
         try {
-          // 鏋勯�犳墦鍗版暟鎹紙鏀寔澶氫唤锛�
           const printData = [];
           for (let i = 0; i < this.printCopyCount; i++) {
             printData.push({ ...this.printForm });
           }
-
-          // 璋冪敤printView鐨刼pen鏂规硶锛屼紶閫掑弬鏁板苟鎵撳紑寮圭獥
           this.$refs.printViewRef.open(printData);
           ElMessage.success(`宸茬敓鎴� ${this.printCopyCount} 浠芥墦鍗版暟鎹紝鍗冲皢鎵撳紑鎵撳嵃寮圭獥`);
         } catch (error) {
@@ -193,10 +227,9 @@
       });
     },
 
-    // 閲嶇疆琛ㄥ崟
+    
     resetForm() {
       this.$refs.printFormRef.resetFields();
-      // 閲嶇疆鍚庢仮澶嶉粯璁ゆ棩鏈�
       const today = new Date();
       this.printForm.date = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`;
       this.printCopyCount = 1;

--
Gitblit v1.9.3