From 2acfc2d2a0e956910c51bd996f443b3cb9bd3dc9 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期日, 22 三月 2026 14:27:21 +0800
Subject: [PATCH] 优化找库位规则

---
 src/main/webapp/static/js/basDevp/basDevp.js |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/main/webapp/static/js/basDevp/basDevp.js b/src/main/webapp/static/js/basDevp/basDevp.js
index c970277..f67d853 100644
--- a/src/main/webapp/static/js/basDevp/basDevp.js
+++ b/src/main/webapp/static/js/basDevp/basDevp.js
@@ -596,9 +596,13 @@
 function setFormVal(el, data, showImg) {
     for (var val in data) {
         var find = el.find(":input[id='" + val + "']");
+        var currentVal = data[val];
+        if (val === 'area') {
+            currentVal = normalizeAreaValue(currentVal);
+        }
         if (find[0]!=null){
             if (find[0].type === 'checkbox'){
-                if (data[val]==='Y'){
+                if (currentVal==='Y'){
                     find.attr("checked","checked");
                     find.val('Y');
                 } else {
@@ -608,13 +612,13 @@
                 continue;
             }
         }
-        find.val(data[val]);
+        find.val(currentVal);
         if (showImg){
             var next = find.next();
             if (next.get(0)){
                 if (next.get(0).localName === "img") {
                     find.hide();
-                    next.attr("src", data[val]);
+                    next.attr("src", currentVal);
                     next.show();
                 }
             }
@@ -622,6 +626,23 @@
     }
 }
 
+function normalizeAreaValue(value) {
+    if (value === undefined || value === null) {
+        return value;
+    }
+    var normalized = String(value).replace(/\s+/g, '').toUpperCase();
+    if (normalized === '1' || normalized === 'A' || normalized === 'A鍖�' || normalized === 'A搴�' || normalized === 'A搴撳尯') {
+        return 'A';
+    }
+    if (normalized === '2' || normalized === 'B' || normalized === 'B鍖�' || normalized === 'B搴�' || normalized === 'B搴撳尯') {
+        return 'B';
+    }
+    if (normalized === '3' || normalized === 'C' || normalized === 'C鍖�' || normalized === 'C搴�' || normalized === 'C搴撳尯') {
+        return 'C';
+    }
+    return value;
+}
+
 function clearFormVal(el) {
     $(':input', el)
         .val('')

--
Gitblit v1.9.1