From 22906e3b0f3b3cf8527736715efbd97c1291acf6 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期二, 16 九月 2025 11:00:31 +0800
Subject: [PATCH] 采购退料:添加库位隔离

---
 H5/Js/Cpbdsj.js |  122 ++++++++++++++++++++++++++++++++++------
 1 files changed, 102 insertions(+), 20 deletions(-)

diff --git a/H5/Js/Cpbdsj.js b/H5/Js/Cpbdsj.js
index dd9009b..329bdf8 100644
--- a/H5/Js/Cpbdsj.js
+++ b/H5/Js/Cpbdsj.js
@@ -32,7 +32,10 @@
             actions: [],//鍒楄〃鐨勫��
             xtName: "",//绾夸綋鍚嶇О
             xtNum: "",//绾夸綋缂栧彿
+            AgvDw: "",//AGV鐐逛綅
             agvChecked: false,//鏄惁鍕鹃�堿GV
+            showAgvDw: false,//鐐逛綅灞曠ず
+            actionsAgvDw: [],//鍒楄〃AGV鐐逛綅
         }
     },
     mounted() {
@@ -43,6 +46,17 @@
         };
     },
     methods: {
+        handleAgvPositions(positionStr) {
+            if (!positionStr) return [];
+
+            // 妫�鏌ユ槸鍚﹀瓨鍦ㄩ�楀彿锛屽鏋滀笉瀛樺湪鍒欒繑鍥炵┖鏁扮粍
+            if (!positionStr.includes(',')) return [];
+
+            // 灏嗗瓧绗︿覆鎸夐�楀彿鍒嗗壊骞惰浆鎹负閫夐」鏁扮粍
+            return positionStr.split(',').map(pos => ({
+                name: pos.trim() // 鍘婚櫎鍙兘鐨勭┖鏍�
+            }));
+        },
         getKbBarInfo() {
             var that = this;
             that.isLoading = true;
@@ -52,13 +66,31 @@
             }, false)
                 .then(function (res) {
                     var json = res;
+
                     if (json.status == 0) {
+                        console.log(json.data.tbBillList.kbBarInfo[0].agvPostion);
                         that.KbBarInfo = json.data.tbBillList.kbBarInfo[0];
                         that.DAA001 = that.KbBarInfo.daA001;
                         that.KbBarMxInfo = json.data.tbBillList.kbBarMxInfo;
                         that.$refs.XBar.focus();
                         that.XbarInfo = [];
                         that.XBar = "";
+
+                        // 妫�鏌ユ槸鍚﹀瓨鍦ㄩ�楀彿
+                        //const agvPosition = json.data.tbBillList.kbBarInfo[0].agvPostion;
+                        //that.AgvDw = agvPosition.includes(',') ? agvPosition.split(',')[0] : '';
+                        const agvPostion = json.data && json.data.tbBillList && json.data.tbBillList.kbBarInfo &&
+                            json.data.tbBillList.kbBarInfo[0] && json.data.tbBillList.kbBarInfo[0].agvPostion;
+
+                        if (agvPostion != null) {
+                            const agvPostionStr = String(agvPostion);
+                            that.AgvDw = agvPostionStr.split(',')[0];
+                            that.actionsAgvDw = that.handleAgvPositions(agvPostionStr);
+                        } else {
+                            that.AgvDw = null;
+                            that.actionsAgvDw = null;
+                        }
+
                     }
                     else {
                         that.$playSound('error');
@@ -144,12 +176,14 @@
                     }
                     else {
                         that.$playSound('error');
+                        that.XBar = "";
                         that.$toast.fail(json.message);
                     }
                     that.isLoading = false;
                 })
                 .catch(function (error) {
                     that.isLoading = false;
+                    that.XBar = "";
                     that.$playSound('error');
                     that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
                 });
@@ -369,6 +403,16 @@
             this.xtName = action.name;  // 缁戝畾name鍒皒tName瀛楁
             this.show = false;
         },
+
+        onSelectAgvDw(action) {
+            this.AgvDw = action.name;
+            this.showAgvDw = false;
+        },
+
+        selectDW() {
+            this.showAgvDw = true;
+        },
+
         //鑾峰彇鍙懠鍙獳GV鐨勭嚎浣�
         selectXt() {
             this.show = true;
@@ -412,17 +456,31 @@
         //AGV閫佹
         handleAGVInspection() {
 
-            this.$toast.fail("鍔熻兘寮�鍙戞祴璇曚腑锛�");
-            return;
+            //this.$toast.fail("鍔熻兘寮�鍙戞祴璇曚腑锛�");
+            //return;
 
             if (this.isLoading) {
                 return;
             }
 
+
             var that = this;
+            if (that.agvChecked === false)
+            {
+                that.$playSound('error');
+                that.$toast.fail("AGV閫佹璇峰厛鍕鹃�� AGV");
+                return;
+            }
+
             if (!that.KbBar) {
                 that.$playSound('error');
                 that.$toast.fail("璇峰厛鎵弿鍗℃澘鏉$爜");
+                return;
+            }
+
+            if (!that.AgvDw) {
+                that.$playSound('error');
+                that.$toast.fail("璇峰厛閫夋嫨AGV鐐逛綅");
                 return;
             }
     
@@ -439,6 +497,47 @@
             that.isLoading = true;
             that.AxiosHttp("post", 'Womdaa/handleAGVInspection', {
                 KbBar: that.KbBar,
+                userAccount: that.userInfo.loginAccount,
+                AgvDw: that.AgvDw
+            }, false)
+                .then(function (res) {
+                    var json = res;
+                    if (json.status == 0) {
+                        that.$playSound('success');
+                        that.$notify({ type: 'success', message: json.message });
+                    } else {
+                        that.$playSound('error');
+                        that.$toast.fail(json.message);
+                    }
+                    that.isLoading = false;
+                })
+                .catch(function (error) {
+                    that.isLoading = false;
+                    that.$playSound('error');
+                    that.$toast.fail("AGV閫佹澶辫触锛岃閲嶈瘯锛�");
+                    that.$refs.KbBar.focus();
+                });
+        },
+
+        //AGV鍛煎彨
+        handleAGVCall() {
+            //this.$toast.fail("鍔熻兘寮�鍙戞祴璇曚腑锛�");
+            //return;
+
+            if (this.isLoading) {
+                return;
+            }
+
+            var that = this;
+            if (!that.xtNum) {
+                that.$playSound('error');
+                that.$toast.fail("璇峰厛閫夋嫨绾夸綋");
+                return;
+            }
+
+            that.isLoading = true;
+            that.AxiosHttp("post", 'Womdaa/handleAGVCall', {
+                XtNum: that.xtNum,
                 userAccount: that.userInfo.loginAccount
             }, false)
                 .then(function (res) {
@@ -455,26 +554,9 @@
                 .catch(function (error) {
                     that.isLoading = false;
                     that.$playSound('error');
-                    that.$toast.fail("閫佹澶辫触锛岃閲嶈瘯锛�");
+                    that.$toast.fail("AGV鍛煎彨澶辫触锛岃閲嶈瘯锛�");
                     that.$refs.KbBar.focus();
                 });
-        },
-
-        //AGV鍛煎彨
-        handleAGVCall() {
-            this.$toast.fail("鍔熻兘寮�鍙戞祴璇曚腑锛�");
-            return;
-
-            if (this.isLoading) {
-                return;
-            }
-
-            var that = this;
-            if (!that.xtNum) {
-                that.$playSound('error');
-                that.$toast.fail("璇峰厛閫夋嫨绾夸綋");
-                return;
-            }
         }
 
 

--
Gitblit v1.9.3