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

---
 H5/Js/PurchaseReturn.js |  275 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 201 insertions(+), 74 deletions(-)

diff --git a/H5/Js/PurchaseReturn.js b/H5/Js/PurchaseReturn.js
index 409bdfa..6c39c84 100644
--- a/H5/Js/PurchaseReturn.js
+++ b/H5/Js/PurchaseReturn.js
@@ -14,7 +14,7 @@
                 quantity:0
             },
             formData: {},
-            tableData: [],
+            ItemDetail: [],
             codeTableData: [],
             itemOutNoList: [],
             itemOutNoStr: [],
@@ -26,7 +26,21 @@
             messageCenter: {},
             messageId: 0,
 
-            show: false,
+            scanInfo: { barcodeNum: "", splitNum: "", barcode: "" },
+            ip: "",
+            port: "",
+            oldBarInfo: [],
+            cfBarInfo: [],
+
+            selectKey: "",//鏌ヨ鍏抽敭瀛�
+            actions: [],//鍒楄〃鐨勫��
+            show: false,//鍒楄〃灞曠ず
+            // 褰撳墠閫変腑琛岀殑绱㈠紩
+            currentIndex: -1,
+            // 瀛樺偍閫変腑琛屾暟鎹璞�
+            selItem: {},
+            ItemBarKw: [],//褰撳ぉ琛岀浉鍏虫潯鐮佸簱浣嶄俊鎭�
+            DaaInfo: {},
         }
     },
     mounted() {
@@ -35,9 +49,98 @@
             loginGuid: this.GetLoginInfor().loginGuid,
             loginAccount: this.GetLoginInfor().loginAccount,
         };
+        that.beginload();
+        //that.show = false;
     },
     methods: {
+        /**
+        * 澶勭悊琛岀偣鍑讳簨浠讹紙鍗曢�夐�昏緫锛�
+        * @param {Object} item 褰撳墠琛屾暟鎹�
+        * @param {Number} index 褰撳墠琛岀储寮�
+        */
+        handleRowClick(item, index) {
+            if (this.isLoading) {
+                return;
+            }
+
+            // 閲嶇疆鎵�鏈夎鐨勯�変腑鐘舵��
+            this.currentIndex = -1;
+
+            // 璁剧疆褰撳墠閫変腑琛�
+            this.currentIndex = index;
+            this.selItem = {
+                itemid: item.itemId,//椹煎嘲鍛藉悕娉曪紒锛侊紒
+                index: index
+            };
+
+            console.log('褰撳墠閫変腑椤�:', this.selItem); // 璋冭瘯鐢�
+
+            this.GetBarKwByItem();
+        },
+        //鑾峰彇搴撲綅淇℃伅
+        GetBarKwByItem() {
+            //Womdaa
+            //WwGd
+            var that = this;
+            that.isLoading = true;
+            that.AxiosHttp("post", 'Womdaa/GetBarKwByItemCK', {
+                itemId: that.selItem.itemid,
+                userName: that.userInfo.loginAccount,
+                type: 'CGCK',
+                billNo:that.scanFormData.itemOutNo
+            }, false)
+                .then(function (res) {
+                    var json = res;
+                    if (json.status == 0) {
+                        that.ItemBarKw = json.data.tbBillList;
+                    }
+                    else {
+                        that.$toast.fail(json.message);
+                        that.$playSound('error');
+                        that.ItemBarKw = [];
+                    }
+                    that.isLoading = false;
+                })
+                .catch(function (error) {
+                    that.isLoading = false;
+                    that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                    that.$playSound('error');
+                    console.log(error);
+                    that.ItemBarKw = [];
+                });
+        },
         getItemOutNo() {
+            var that = this;
+            that.isLoading = true;
+            that.AxiosHttp("post", 'MesCgthSq/GetMesCgthSq', {}, false)
+                .then(function (res) {
+                    var json = res;
+                    if (json.status == 0) {
+                        that.itemOutNoList = json.data.tbBillList;
+                        if (!Array.isArray(that.itemOutNoList) || that.itemOutNoList.length === 0) {
+                            that.$toast.fail("娌℃湁鍙敤鐨勬暟鎹�");
+                            that.show = false;
+                        }
+                        else {
+                            that.itemOutNoStr = that.itemOutNoList.map(s => ({ name: s }));
+                            that.show = true;
+                        }
+                    }
+                    else {
+                        that.$playSound('error');
+                        that.$toast.fail(json.message);
+                    }
+                    that.isLoading = false;
+                })
+                .catch(function (error) {
+                    that.isLoading = false;
+                    that.$playSound('error');
+                    that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                    console.log(error);
+                });
+
+        },
+        beginload() {
             var that = this;
 
             that.isLoading = true;
@@ -47,116 +150,60 @@
                     var json = res;
                     if (json.status == 0) {
                         that.itemOutNoList = json.data.tbBillList;
-                        that.itemOutNoStr = that.itemOutNoList.map(s => {
-                            return { name: s.billNo }
-                        });
-                        that.show = true;
                     }
                     else {
+                        that.$playSound('error');
                         that.$toast.fail(json.message);
                     }
                     that.isLoading = false;
                 })
                 .catch(function (error) {
                     that.isLoading = false;
+                    that.$playSound('error');
                     that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
                     console.log(error);
                 });
 
         },
         onSelect(item) {
-            // 榛樿鎯呭喌涓嬬偣鍑婚�夐」鏃朵笉浼氳嚜鍔ㄦ敹璧�
-            // 鍙互閫氳繃 close-on-click-action 灞炴�у紑鍚嚜鍔ㄦ敹璧�
             this.show = false;
-
-            //let staf = this.stafList.filter(it => it.staffName === item.name);
-
             this.scanFormData.itemOutNo = item.name;
-
-            let itemOut = this.itemOutNoList.filter(it => it.billNo == item.name);
-
-            this.invItemOutId = itemOut[0].id;
-
+            this.invItemOutId = item.name;
+            this.ItemBarKw = []; // 閫夋嫨鐢宠鍗曞彿鍚庢竻绌哄簱浣嶅垪琛�
             this.getItem();
-
-            //var that = this;
-
-            //that.isLoading = true;
-            //that.AxiosHttp("post", 'MesInvItemOuts/GetPage', {
-            //    billNo: this.scanFormData.itemOutNo,
-            //    pageIndex: 1,
-            //    limit: 1,
-            //}, false)
-            //    .then(function (res) {
-            //        var json = res;
-            //        if (json.status == 0) {
-            //            that.formData = json.data.tbBillList[0];
-            //            that.formData.billTypeName = "鍑哄簱鍗�";
-
-            //            that.getScanBarcode();
-            //        }
-            //        else {
-            //            that.$toast.fail(json.message);
-            //        }
-            //        that.isLoading = false;
-            //    })
-            //    .catch(function (error) {
-            //        that.isLoading = false;
-            //        that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
-            //        console.log(error);
-            //    });
-
         },
         getItem() {
             var that = this;
             that.isLoading = true;
             that.AxiosHttp("post", 'MesCgthSq/GetSumItem', {
-                id: that.invItemOutId,
                 billNo: that.scanFormData.itemOutNo,
                 barcode: that.scanFormData.barcode,
             }, false)
                 .then(function (res) {
                     var json = res;
                     if (json.status == 0) {
-                        that.tableData = json.data.tbBillList.sumItem;
-                        that.scanFormData.itemNo = json.data.tbBillList.itemNo
-                        //that.scanFormData.quantity = json.data.tbBillList.quantity
-                        console.log(json);
+                        that.ItemDetail = {
+                            items: json.data.tbBillList.items,
+                            ysitems: json.data.tbBillList.ysitems,
+                            allList: json.data.tbBillList.allList
+                        };
+                        that.$refs.barcode.focus();
                     }
                     else {
+                        that.$playSound('error');
                         that.$toast.fail(json.message);
+                        that.ItemDetail = [];
                     }
                     that.isLoading = false;
                 })
                 .catch(function (error) {
                     that.isLoading = false;
+                    that.$playSound('error');
                     that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
-                    console.log(error);
+                    that.ItemDetail = [];
                 });
         },
-        //getScanBarcode() {
 
-        //    var that = this;
-        //    that.isLoading = true;
-        //    that.AxiosHttp("post", 'MesInvItemOuts/GetScanBarcode', {
-        //        id: that.formData.guid
-        //    }, false)
-        //        .then(function (res) {
-        //            var json = res;
-        //            if (json.status == 0) {
-        //                that.codeTableData = res.data.tbBillList;
-        //            }
-        //            else {
-        //                that.$toast.fail(json.message);
-        //            }
-        //            that.isLoading = false;
-        //        })
-        //        .catch(function (error) {
-        //            that.isLoading = false;
-        //            that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
-        //            console.log(error);
-        //        });
-        //},
         SaveBarCodes() {
 
             //if (!this.scanFormData.barcode) {
@@ -180,20 +227,100 @@
                         //}
                         that.scanFormData.quantity = json.data.tbBillList.barcodeNum
                         that.getItem();
+                        that.$refs.barcode.focus();
+                        that.scanFormData.barcode = null;
+                        that.$playSound('success');
+                        that.$notify({ type: 'success', message: json.message });
+                    }
+                    else if (json.status == 2) {
+                        that.$refs.splitNum.focus();
+                        that.scanInfo.splitNum = json.data.tbBillList.splitNum;
+                        that.scanFormData.quantity = json.data.tbBillList.barcodeNum;
                     }
                     else {
+                        that.$playSound('error');
                         that.$toast.fail(json.message);
                         that.$refs.barcode.focus();
+                        that.scanFormData.barcode = null;
                     }
-                    that.$notify({ type: 'success', message: json.message });
                     that.isLoading = false;
                 })
                 .catch(function (error) {
                     that.isLoading = false;
+                    that.$playSound('error');
                     that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
                     console.log(error);
                     that.$refs.barcode.focus();
                 });
-        }
+        },
+        getChaiFen() {
+            //this.isPrinterPopupVisible = true; // 鏄剧ず寮圭獥
+
+            if (this.isLoading) {
+                return;
+            }
+
+            var that = this;
+            if (that.scanFormData.itemOutNo.length <= 0) {
+                that.$playSound('error');
+                that.$toast.fail("鐢宠鍗曞彿涓嶈兘涓虹┖锛�");
+                return;
+            }
+            if (that.scanInfo.splitNum * 1 <= 0) {
+                that.$playSound('error');
+                that.$toast.fail("鎷嗗垎鏁伴噺涓嶈兘涓虹┖锛�");
+                return;
+            }
+            if (that.scanFormData.barcode.length * 1 <= 0) {
+                that.$playSound('error');
+                that.$toast.fail("鐗╂枡鏉$爜涓嶈兘涓虹┖锛�");
+                return;
+            }
+            //that.ip = "";
+            //that.prot = "";
+            //that.getPrintInfo();
+
+            //if (that.ip.length <= 0 || that.prot.length <= 0) {
+            //    alert(that.ip);
+            //    alert(that.prot);
+            //    return;
+            //}
+
+            that.isLoading = true;
+            that.AxiosHttp("post", 'MesCgthSq/ScanCodeCF', {
+                billNo: that.scanFormData.itemOutNo,
+                userName: that.userInfo.loginAccount,
+                barcode: that.scanFormData.barcode,
+                Num: that.scanInfo.splitNum,
+            }, false)
+                .then(function (res) {
+                    var json = res;
+                    if (json.status == 0) {
+                        //  that.modeInfo = json.data.tbBillList;
+                        that.scanInfo.splitNum = null;
+                        that.scanFormData.quantity = null;
+                        that.scanFormData.barcode = null;
+                        that.$notify({ type: 'success', message: json.message });
+                        that.$playSound('success');
+                        that.getItem();
+                        //that.sendMessage(json.data.tbBillList);
+                        that.sendPrintMessage(json.data.tbBillList);
+
+                        that.$refs.barcode.focus();
+                        
+                    }
+                    else {
+                        that.$playSound('error');
+                        that.$toast.fail(json.message);
+                    }
+                    that.isLoading = false;
+                })
+                .catch(function (error) {
+                    that.isLoading = false;
+
+                    that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+                    that.$playSound('error');
+                });
+        },
     }
 })
\ No newline at end of file

--
Gitblit v1.9.3