From 47e24a17f8aefc795d97fa3678281f2f9940056d Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期日, 07 十二月 2025 10:40:11 +0800
Subject: [PATCH] 小卫组托调整

---
 WebTM/views/Baseset/基础资料/saomazutuo_xiaowei.html |  131 ++++++++++++++++++++++++-------------------
 1 files changed, 73 insertions(+), 58 deletions(-)

diff --git "a/WebTM/views/Baseset/\345\237\272\347\241\200\350\265\204\346\226\231/saomazutuo_xiaowei.html" "b/WebTM/views/Baseset/\345\237\272\347\241\200\350\265\204\346\226\231/saomazutuo_xiaowei.html"
index e3394f9..eb3a918 100644
--- "a/WebTM/views/Baseset/\345\237\272\347\241\200\350\265\204\346\226\231/saomazutuo_xiaowei.html"
+++ "b/WebTM/views/Baseset/\345\237\272\347\241\200\350\265\204\346\226\231/saomazutuo_xiaowei.html"
@@ -470,69 +470,84 @@
                     layer.msg('鏉$爜涓嶈兘涓虹┖锛岃鎵弿鏉$爜锛�', { icon: 2 });
                     return;
                 }
-
-                $.ajax({
-                    url: GetWEBURL() + '/WEBSController/get_BarCode_PackUnionBill_New_Json_xiaowei',
-                    type: 'GET',
-                    data: {
-                        "HInterID": hform.HInterID,
-                        "HBarCode": sBarCode,
-                        "HBillType": HBillType,
-                        "HBillSubType": HBillSubType,
-                        "HBarCode_Pack": '',
-                        "HBillNo": hform.HBillNo,
-                        "HMaterNumber_Pack": HMaterNumber_Pack,
-                        "HMaker": hform.HMaker,
-                        "HStockOrgID": hform.HStockOrgID
-                    },
-                    success: function (res) {
-                        FindMaterial();
-                        if (res.count == 1) {
-                            layer.msg('鏉$爜澶勭悊鎴愬姛', { icon: 1 });
-                            listData.push({
-                                鏉$爜缂栧彿: sBarCode,
-                                鏁伴噺: 1,
-                                鐗╂枡浠g爜: hform.HMaterID,
-                                鐗╂枡鍚嶇О: hform.HMaterName,
-                                鏉$爜涓暟: 1,
-                                HInterID: hform.HInterID
-                            });
-
-                            table.reload('mainTable', {
-                                data: listData
-                            });
-
-                            $('#HBarCode').val('');
-                        } else {
-                            layer.msg(res.Message || '鏉$爜澶勭悊澶辫触', { icon: 2 });
-                        }
-                    },
-                    error: function () {
-                        layer.msg('鏉$爜澶勭悊澶辫触锛岃妫�鏌ョ綉缁滆繛鎺�', { icon: 2 });
+                FindMaterial(sBarCode).then(function (materialInfo) {
+                    if (!materialInfo) {
+                        layer.msg('鏈壘鍒扮墿鏂欎俊鎭�', { icon: 2 });
+                        return;
                     }
+                    hform.HMaterID = materialInfo.HMaterID;
+                    hform.HMaterName = materialInfo.HMaterName;
+                    hform.HMaterModel = materialInfo.HMaterModel;
+                    $.ajax({
+                        url: GetWEBURL() + '/WEBSController/get_BarCode_PackUnionBill_New_Json_xiaowei',
+                        type: 'GET',
+                        data: {
+                            "HInterID": hform.HInterID,
+                            "HBarCode": sBarCode,
+                            "HBillType": HBillType,
+                            "HBillSubType": HBillSubType,
+                            "HBarCode_Pack": '',
+                            "HBillNo": hform.HBillNo,
+                            "HMaterNumber_Pack": HMaterNumber_Pack,
+                            "HMaker": hform.HMaker,
+                            "HStockOrgID": hform.HStockOrgID
+                        },
+                        success: function (res) {
+                            if (res.count == 1) {
+                                layer.msg('鏉$爜澶勭悊鎴愬姛', { icon: 1 });
+                                listData.push({
+                                    鏉$爜缂栧彿: sBarCode,
+                                    鏁伴噺: 1,
+                                    鐗╂枡浠g爜: hform.HMaterID,
+                                    鐗╂枡鍚嶇О: hform.HMaterName,
+                                    鏉$爜涓暟: 1,
+                                    HInterID: hform.HInterID
+                                });
+
+                                table.reload('mainTable', {
+                                    data: listData
+                                });
+
+                                $('#HBarCode').val('');
+                            } else {
+                                layer.msg(res.Message || '鏉$爜澶勭悊澶辫触', { icon: 2 });
+                            }
+                        },
+                        error: function () {
+                            layer.msg('鏉$爜澶勭悊澶辫触锛岃妫�鏌ョ綉缁滆繛鎺�', { icon: 2 });
+                        }
+                    });
+                }).catch(function (error) {
+                    layer.msg('鏌ユ壘鐗╂枡澶辫触: ' + error, { icon: 2 });
                 });
             }
 
-            function FindMaterial() {
-                var sBarCode = $('#HBarCode').val();
-                $.ajax({
-                    url: GetWEBURL() + '/Gy_Material/findMaterialByNumber',
-                    type: 'GET',
-                    data: {
-                        "HbarCode": sBarCode,
-                        "HSTOCKORGID": hform.HStockOrgID
-                    },
-                    success: function (res) {
-                        let data = res.data;
-                        if (res.count == 1) {
-                            hform.HMaterID = data[0].HMaterID
-                            hform.HMaterName = data[0].HMaterName
-                            hform.HMaterModel = data[0].HMaterModel
+
+            function FindMaterial(sBarCode) {
+                return new Promise(function (resolve, reject) {
+                    $.ajax({
+                        url: GetWEBURL() + '/Gy_Material/findMaterialByNumber',
+                        type: 'GET',
+                        data: {
+                            "HbarCode": sBarCode,
+                            "HSTOCKORGID": hform.HStockOrgID
+                        },
+                        success: function (res) {
+                            let data = res.data;
+                            if (res.count == 1) {
+                                resolve({
+                                    HMaterID: data[0].HMaterID,
+                                    HMaterName: data[0].HMaterName,
+                                    HMaterModel: data[0].HMaterModel
+                                });
+                            } else {
+                                resolve(null); 
+                            }
+                        },
+                        error: function () {
+                            reject('鏌ユ壘鐗╂枡澶辫触锛岃妫�鏌ョ綉缁滆繛鎺�');
                         }
-                    },
-                    error: function () {
-                        layer.msg('鏉$爜澶勭悊澶辫触锛岃妫�鏌ョ綉缁滆繛鎺�', { icon: 2 });
-                    }
+                    });
                 });
             }
 

--
Gitblit v1.9.1