From af9a73e6de3c076e55858704fe2a85167ecacdbc Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 16 一月 2024 10:06:20 +0800
Subject: [PATCH] 采购入库单收料通知单,进行选单号,可以多选,保存前反写关联数量的存储过程

---
 WebTM/views/验收入库/外购入库/Kf_POStockInBackBillList.html       |    2 
 WebTM/views/验收入库/外购入库/Kf_POStockInBillList.html           |   10 +
 WebTM/views/采购管理/收料通知单/Add_Edit_Cg_POInStockBillList.html |  128 +++++++++++++++++++++++-
 WebTM/views/采购管理/收料通知单/Cg_POInStockBillList.html          |   11 +
 WebTM/views/验收入库/外购入库/Add_Edit_Kf_POStockInBillList.html  |  138 +++++++++++++++++++++++++--
 5 files changed, 263 insertions(+), 26 deletions(-)

diff --git "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\346\224\266\346\226\231\351\200\232\347\237\245\345\215\225/Add_Edit_Cg_POInStockBillList.html" "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\346\224\266\346\226\231\351\200\232\347\237\245\345\215\225/Add_Edit_Cg_POInStockBillList.html"
index 90d3928..f23f286 100644
--- "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\346\224\266\346\226\231\351\200\232\347\237\245\345\215\225/Add_Edit_Cg_POInStockBillList.html"
+++ "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\346\224\266\346\226\231\351\200\232\347\237\245\345\215\225/Add_Edit_Cg_POInStockBillList.html"
@@ -157,8 +157,16 @@
                                         <div class="layui-col-xs4 layui-inline">
                                             <label class="layui-form-label">閫夊崟鍙�</label>
                                             <div class="layui-input-inline">
-                                                <input class="layui-input" name="Box2" id="Box2" autocomplete="off">
+                                                <input type="text" name="" id="" class="layui-input" value="" style="float:left;width:150px;">
+                                                
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="XDHList" id="XDHList" style="width:40px;">
+                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                </button>
                                             </div>
+                                            <!--<label class="layui-form-label">閫夊崟鍙�</label>
+                                            <div class="layui-input-inline">
+                                                <input class="layui-input" name="Box2" id="Box2" autocomplete="off">
+                                            </div>-->
                                         </div>
 
                                     </div>
@@ -356,7 +364,8 @@
             var rowdata = [{
                 "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HWHID": 0, "鏀舵枡浠撳簱": "",
                 "HSPID": 0, "鏀舵枡浠撲綅": "", "HSecUnitID": 0, "杈呭姪鍗曚綅": "", "HQty": "0", "HRemark": ""
-                , "HPrice": "0", "HTaxPrice": "0", "HMoney": "0", "HDiscountRate": "0", "HTaxRate": "0", "HTaxMoney": "0"
+                , "HPrice": "0", "HTaxPrice": "0", "HMoney": "0", "HDiscountRate": "0", "HTaxRate": "0", "HTaxMoney": "0",
+                "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0
             }];
 
             // 鍒濆鍖栫晫
@@ -369,8 +378,9 @@
                 //鏂板琛岃〃鏍兼暟鎹�
                 var NewRow = {
                     "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HWHID": 0, "鏀舵枡浠撳簱": "",
-                    "HSPID": 0, "鏀舵枡浠撲綅": "", "HSecUnitID": data.HSecUnitID, "杈呭姪鍗曚綅":data.杈呭姪鍗曚綅, "HQty": "0", "HRemark": ""
-                    , "HPrice": "0", "HTaxPrice": "0", "HMoney": "0", "HDiscountRate": "0", "HTaxRate": "0", "HTaxMoney": "0"
+                    "HSPID": 0, "鏀舵枡浠撲綅": "", "HSecUnitID": data.HSecUnitID, "杈呭姪鍗曚綅": data.杈呭姪鍗曚綅, "HQty": "0", "HRemark": ""
+                    , "HPrice": "0", "HTaxPrice": "0", "HMoney": "0", "HDiscountRate": "0", "HTaxRate": "0", "HTaxMoney": "0",
+                    "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
                 };
                 switch (obj.event) {
                     case 'btn-AddLine':
@@ -495,7 +505,7 @@
                             , HPrice: HPrice
                             , HMoney: HMoney
                         });
-                       /* table.render(option);*/
+                        /* table.render(option);*/
                         break;
                     case "HPrice":                                         //鍗曚环
                         //鏁版嵁鏍煎紡鏍¢獙
@@ -505,7 +515,7 @@
                             obj.update({
                                 HPrice: oldText
                             });
-                           /* table.render(option);*/
+                            /* table.render(option);*/
 
                             layer.msg("鍗曚环璇疯緭鍏ュぇ浜�0鐨勬暟瀛�!");
                             return;
@@ -514,7 +524,7 @@
 
                         //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
                         var HQty = obj.data.HQty * 1;                   //鏁伴噺
-                        var HPrice = value * 1;               
+                        var HPrice = value * 1;
                         var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
 
 
@@ -584,6 +594,10 @@
                     , cols: [[ //瀛愯〃
                         { type: 'checkbox', totalRowText: '鍚堣琛�' }
                         , { type: 'numbers', title: '搴忓彿', width: 100, totalRow: true }
+                        , { type: 'HSourceBillNo', title: '婧愬崟鍙�', width: 100, hide: true }//婧愬崟鍙�
+                        , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', width: 100, hide: true }//婧愬崟绫诲瀷
+                        , { type: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 100, hide: true }//婧愬崟涓诲唴鐮�
+                        , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 100, hide: true }//婧愬崟瀛愬唴鐮�
                         , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true }
                         , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 150, edit: 'text', event: "HMaterID" }//f7
                         , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 150, }
@@ -608,7 +622,7 @@
                     ]]
                 }
 
-                option.data = rowdata;
+                option.data = [];
                 table.render(option);
             }
 
@@ -666,7 +680,11 @@
                                     {
                                         "HMaterID": data.HMaterID, "鐗╂枡浠g爜": data.鐗╂枡浠g爜, "鐗╂枡鍚嶇О": data.鐗╂枡鍚嶇О, "瑙勬牸鍨嬪彿": data.瑙勬牸鍨嬪彿, "HUnitID": data.HUnitID, "璁¢噺鍗曚綅": data.璁¢噺鍗曚綅, "HWHID": data.HWHID, "鏀舵枡浠撳簱": data.鏀舵枡浠撳簱,
                                         "HSPID": data.HSPID, "鏀舵枡浠撲綅": data.浠撲綅鍚嶇О, "HSecUnitID": data.HSecUnitID, "杈呭姪鍗曚綅": data.杈呭姪鍗曚綅, "HQty": data.鏁伴噺, "HRemark": data.琛ㄤ綋澶囨敞
-                                        , "HPrice": data.鍗曚环, "HTaxPrice": data.鍚◣鍗曚环, "HMoney": data.閲戦, "HDiscountRate": data.鎶樻墸鐜�, "HTaxRate": data.绋庣巼, "HTaxMoney": data.绋庨
+                                        , "HPrice": data.鍗曚环, "HTaxPrice": data.鍚◣鍗曚环, "HMoney": data.閲戦, "HDiscountRate": data.鎶樻墸鐜�, "HTaxRate": data.绋庣巼, "HTaxMoney": data.绋庨,
+                                        "HSourceBillNo": data.婧愬崟鍗曞彿,    //婧愬崟鍙�
+                                        "HSourceBillType": data.婧愬崟绫诲瀷,   //婧愬崟绫诲瀷
+                                        "HSourceInterID": data.婧愬崟涓诲唴鐮�,   //婧愬崟涓诲唴鐮�
+                                        "HSourceEntryID": data.婧愬崟瀛愬唴鐮�     //婧愬崟瀛愬唴鐮�
                                     }
                                 )
                             }
@@ -746,6 +764,24 @@
                         table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
                         num.push(table.cache["mainTable"][i])
                     }
+                }
+
+                checkDuplicateData(num);
+                const duplicateRows = checkDuplicateData(num);
+                if (duplicateRows.length > 0) {
+                    let message = '琛ㄦ牸涓瓨鍦ㄩ噸澶嶆暟鎹紝閲嶅琛屾暟涓猴細';
+
+                    for (let i = 0; i < duplicateRows.length; i++) {
+                        const { row1, row2 } = duplicateRows[i];
+                        message += `绗�${row1}琛屼笌绗�${row2}琛岀浉鍚宍;
+
+                        if (i !== duplicateRows.length - 1) {
+                            message += '锛�';
+                        }
+                    }
+
+                    message += '锛岃鍒犻櫎鍏朵腑涓�琛�';
+                    layer.alert(message);
                 }
 
                 var sMainStr = JSON.stringify(data.field);
@@ -1112,6 +1148,80 @@
                 })
             }
 
+            //琛ㄥご淇℃伅閫夋嫨鍗曟嵁寮圭獥
+            form.on('submit(XDHList)', function () {
+
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2
+                    , skin: "layui-layer-rim" //鍔犱笂杈规
+                    , title: "閲囪喘鍏ュ簱鍗曞垪琛�"  //鏍囬
+                    , closeBtn: 1  //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                    , shift: 2 //寮瑰嚭鍔ㄧ敾
+                    , area: ["90%", "90%"] //绐椾綋澶у皬
+                    , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                    , content: ["../../閲囪喘绠$悊/閲囪喘璁㈠崟/Cg_POOrderBillList.html", "yes"]
+                    , btn: ["纭畾", "鍙栨秷"]
+                    , btn1: function (index, laero) {
+                        //鎸夐挳涓�  鐨勫洖璋�
+                        var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
+                        var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
+
+                        if (checkStatus.data.length == 0) {
+                            return layer.msg("璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�!");
+                        }
+                        layer.alert("浣犲凡閫夋嫨" + checkStatus.data.length + "鏉℃暟鎹�");
+                        //鑾峰彇鏀舵枡閫氱煡鍗曚唬鐮�
+                        var ProcessNumber = [];
+                        for (var i = 0; i < checkStatus.data.length; i++) {
+                            ProcessNumber.push(checkStatus.data[i]);
+                        }
+
+                        //鑾峰彇褰撳墠浣嶇疆鎵�鍦ㄨ鏁�
+                        var NowNum = 0;
+                        NowNum = option.data.length;
+
+                        var j = 0;
+                        for (var i = 0; i < ProcessNumber.length; i++) {
+                            option.data.push({
+                                "HMaterID": checkStatus.data[j].HMaterID, "鐗╂枡浠g爜": checkStatus.data[j].鐗╂枡浠g爜, "鐗╂枡鍚嶇О": checkStatus.data[j].鐗╂枡鍚嶇О, "瑙勬牸鍨嬪彿": checkStatus.data[j].瑙勬牸鍨嬪彿,
+                                "HUnitID": checkStatus.data[j].HUnitID, "璁¢噺鍗曚綅": checkStatus.data[j].璁¢噺鍗曚綅, 
+                                "HQty": checkStatus.data[j].鏁伴噺, "HPrice": checkStatus.data[j].鍗曚环,
+                                "HMoney": checkStatus.data[j].閲戦, "HTaxPrice": checkStatus.data[j].鍚◣鍗曚环,  "HTaxRate": checkStatus.data[j].绋庣巼, "HTaxMoney": checkStatus.data[j].绋庨,
+                                "HSourceBillNo": checkStatus.data[j].鍗曟嵁鍙�, "HSourceBillType": checkStatus.data[j].HBillType, "HSourceInterID": checkStatus.data[j].hmainid, "HSourceEntryID": checkStatus.data[j].hsubid,
+                            })
+                            j++;
+                        }
+                        table.render(option);
+                        layer.close(index);//鍏抽棴寮圭獥
+                    }
+
+                });
+            });
+
+             //鍒ゆ柇鎵�閫夌潃涓庤〃鏍兼槸鍚︽湁閲嶅鏁版嵁
+            function checkDuplicateData(data) {
+                const duplicates = [];
+
+                for (let i = 0; i < data.length; i++) {
+                    const currentItem = data[i];
+                    let isDuplicate = false;
+
+                    for (let j = i + 1; j < data.length; j++) {
+                        const compareItem = data[j];
+                        //涓诲瓙id
+                        if (currentItem.HSourceInterID === compareItem.HSourceInterID && currentItem.HSourceEntryID === compareItem.HSourceEntryID) {
+                            isDuplicate = true;
+                            duplicates.push({ row1: i + 1, row2: j + 1 }); // 璁板綍閲嶅鏁版嵁鎵�鍦ㄨ鏁�
+                        }
+                    }
+                    if (isDuplicate && !duplicates.some(item => item.row1 === i + 1)) {
+                        duplicates.push({ row1: i + 1, row2: -1 }); // 璁板綍閲嶅鏁版嵁鎵�鍦ㄨ鏁帮紝-1 琛ㄧず鏈壘鍒颁笌褰撳墠琛岄噸澶嶇殑琛�
+                    }
+                }
+                return duplicates;
+            }
+
 
             //#region 鏍规嵁鐗╂枡ID鑾峰彇鐗╂枡璇︾粏淇℃伅
             function getMaterialByMaterID(HMaterID) {
diff --git "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\346\224\266\346\226\231\351\200\232\347\237\245\345\215\225/Cg_POInStockBillList.html" "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\346\224\266\346\226\231\351\200\232\347\237\245\345\215\225/Cg_POInStockBillList.html"
index 4da27d6..a08351e 100644
--- "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\346\224\266\346\226\231\351\200\232\347\237\245\345\215\225/Cg_POInStockBillList.html"
+++ "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\346\224\266\346\226\231\351\200\232\347\237\245\345\215\225/Cg_POInStockBillList.html"
@@ -213,7 +213,7 @@
                 //鐩存帴鎵ц鍒楄〃绛涢�� 鍔犺浇鏁版嵁鍒扮綉鏍�
                 get_FastQuery(1)
                 //鏌ヨ
-                get_Display(sWhere);
+               //get_Display(sWhere);
                 //闅愯棌鍕鹃�夊瓧娈�
                 DisPlay_HideColumn();
 
@@ -385,13 +385,17 @@
                         var checkStatus = table.checkStatus('mainTable')
                             , data = checkStatus.data;
                         if (checkStatus.data.length === 1) {
-                            var InterID = data[0].hmainid.toString();
+                            var HInterID = data[0].hmainid.toString();
+                            var HsupId = data[0].hsubid;
+                            var HQty = data[0].鏁伴噺;
+                            var HSourceInterID = data[0].婧愬崟涓诲唴鐮�;
+                            var HSourceEntryID = data[0].婧愬崟瀛愬唴鐮�;
                             //閫昏緫鍒犻櫎鏂规硶
                             layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗涓嶈兘鎭㈠", { title: "鍒犻櫎纭" }, function (index) {
                                 $.ajax({
                                     type: "GET",
                                     url: GetWEBURL() + "Cg_POInStockBill/DeltetPOInStockBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                                    data: { "HInterID": InterID, "user": sessionStorage["HUserName"] },
+                                    data: { "HInterID": HInterID, "HsupId": HsupId, "HQty": HQty, "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID, "user": sessionStorage["HUserName"] },
                                     success: function (result) {
                                         if (result.count == 1) {
                                             layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
@@ -654,6 +658,7 @@
                 if (HMangerID) {
                     sWhere += " and 涓荤 like '%" + HMangerID + "%'";
                 }
+                sWhere += " and 鍏抽棴浜� =''";
                 get_Display(sWhere);
                 sWhere = "";//璋冪敤鎺ュ彛鍚庢竻绌簊Where缂撳瓨
             }
diff --git "a/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Add_Edit_Kf_POStockInBillList.html" "b/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Add_Edit_Kf_POStockInBillList.html"
index f0f7efe..98fe529 100644
--- "a/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Add_Edit_Kf_POStockInBillList.html"
+++ "b/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Add_Edit_Kf_POStockInBillList.html"
@@ -162,8 +162,16 @@
                                         <div class="layui-col-xs4 layui-inline">
                                             <label class="layui-form-label">閫夊崟鍙�</label>
                                             <div class="layui-input-inline">
-                                                <input class="layui-input" name="Box2" id="Box2" autocomplete="off">
+                                                <input type="text" name="" id="" class="layui-input" value="" style="float:left;width:150px;">
+                                                
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="XDHList" id="XDHList" style="width:40px;">
+                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                </button>
                                             </div>
+                                            <!--<label class="layui-form-label">閫夊崟鍙�</label>
+                                            <div class="layui-input-inline">
+                                                <input class="layui-input" name="Box2" id="Box2" autocomplete="off">
+                                            </div>-->
                                         </div>
                                         <div class="layui-col-xs4 layui-inline">
                                             <label class="layui-form-label">璐熻矗浜�</label>
@@ -249,7 +257,7 @@
                                                 <input type="text" class="layui-input" name="HCheckDate" id="HCheckDate" style="background-color:#efefef4d;" readonly>
                                             </div>
                                         </div>
-                                        <div class="layui-inline">
+                                        <div class="layui-inline" >
                                             <label class="layui-form-label" style="width: 85px;">鍏抽棴鏃ユ湡</label>
                                             <div class="layui-input-block" style="margin-left: 120px;">
                                                 <input type="text" class="layui-input" name="HCloseDate" id="HCloseDate" style="background-color:#efefef4d;" readonly>
@@ -394,7 +402,8 @@
                 "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HAuxPropID": 0, "鐗╂枡杈呭姪灞炴��": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HQtyMust": "", "HQty": "", "HRemark": "",
                 "HPrice": "0", "HMoney": "0", "HOrderPrice": "0", "HWHID": 0, "鏀舵枡浠撳簱": "",
                 "HSPID": 0, "浠撲綅鍚嶇О": "", "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
-                "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": ""
+                "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
+                "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0, 
             }];
             // 鍒濆鍖栫晫
             set_InitGrid();
@@ -408,7 +417,8 @@
                     "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HAuxPropID": 0, "鐗╂枡杈呭姪灞炴��": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HQtyMust": "", "HQty": "", "HRemark": "",
                     "HPrice": "0", "HMoney": "0", "HOrderPrice": "0", "HWHID": 0, "鏀舵枡浠撳簱": "",
                     "HSPID": 0, "浠撲綅鍚嶇О": "", "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
-                    "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": ""
+                    "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
+                    "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
                 };
                 switch (obj.event) {
                     case 'btn-AddLine':
@@ -670,7 +680,7 @@
             }
 
 
-
+            //瀛愯〃
 
             function set_InitGrid() {
                 option = {
@@ -682,6 +692,10 @@
                     , cols: [[ //瀛愯〃
                         { type: 'checkbox', totalRowText: '鍚堣琛�' }
                         , { type: 'numbers', title: '搴忓彿', width: 100, totalRow: true }
+                        , { type: 'HSourceBillNo', title: '婧愬崟鍙�', width: 100, hide: true }//婧愬崟鍙�
+                        , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', width: 100, hide: true }//婧愬崟绫诲瀷
+                        , { type: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 100, hide: true }//婧愬崟涓诲唴鐮�
+                        , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 100, hide: true }//婧愬崟瀛愬唴鐮�
                         , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true }
                         , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 150, edit: 'text', event: "HMaterID" }//f7
                         , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 150, }
@@ -705,7 +719,7 @@
                     ]]
                 }
 
-                option.data = rowdata;
+                option.data = [];
                 table.render(option);
             }
 
@@ -743,7 +757,7 @@
                                 , "HManagerID": data.HManagerID
                                 , "HManagerName": data.璐熻矗浜�
                                 , "HExRate": data.姹囩巼
-                                , "Box2": ""
+                                //, "Box2": ""
                                 , "HRemark": data.琛ㄥご澶囨敞
                                 , "HMaker": data.鍒跺崟浜�
                                 , "HChecker": data.瀹℃牳浜�
@@ -763,7 +777,11 @@
                                     {
                                         "HMaterID": subdata[i].HMaterID, "鐗╂枡浠g爜": subdata[i].鐗╂枡浠g爜, "鐗╂枡鍚嶇О": subdata[i].鐗╂枡鍚嶇О, "瑙勬牸鍨嬪彿": subdata[i].瑙勬牸鍨嬪彿, "HAuxPropID": subdata[i].HAuxPropID, "鐗╂枡杈呭姪灞炴��": subdata[i].鐗╂枡杈呭姪灞炴��, "HUnitID": subdata[i].HUnitID, "璁¢噺鍗曚綅": subdata[i].璁¢噺鍗曚綅,
                                         "HQtyMust": subdata[i].搴旀敹鏁伴噺, "HQty": subdata[i].瀹炴敹鏁伴噺, "HRemark": subdata[i].琛ㄤ綋澶囨敞, "HPrice": subdata[i].鍗曚环, "HMoney": subdata[i].閲戦, "HOrderPrice": subdata[i].閲囪喘閲戦, "HWHID": subdata[i].HWHID, "鏀舵枡浠撳簱": subdata[i].鏀舵枡浠撳簱, "HSPID": subdata[i].HSPID, "浠撲綅鍚嶇О": subdata[i].浠撲綅鍚嶇О,
-                                        "HBatchNo": subdata[i].鎵规
+                                        "HBatchNo": subdata[i].鎵规,
+                                        "HSourceBillNo": subdata[i].婧愬崟鍗曞彿,    //婧愬崟鍙�
+                                        "HSourceBillType": subdata[i].婧愬崟绫诲瀷,   //婧愬崟绫诲瀷
+                                        "HSourceInterID": subdata[i].婧愬崟涓诲唴鐮�,   //婧愬崟涓诲唴鐮�
+                                        "HSourceEntryID": subdata[i].婧愬崟瀛愬唴鐮�     //婧愬崟瀛愬唴鐮�
                                     }
                                 )
                             }
@@ -826,6 +844,7 @@
                     return;
                 }
 
+
                 var num = [];
                 for (var i = 0; i < table.cache["mainTable"].length; i++) {
                     if (table.cache["mainTable"][i] != "") {
@@ -833,6 +852,25 @@
                         num.push(table.cache["mainTable"][i])
                     }
                 }
+
+                checkDuplicateData(num);
+                const duplicateRows = checkDuplicateData(num);
+                if (duplicateRows.length > 0) {
+                    let message = '琛ㄦ牸涓瓨鍦ㄩ噸澶嶆暟鎹紝閲嶅琛屾暟涓猴細';
+
+                    for (let i = 0; i < duplicateRows.length; i++) {
+                        const { row1, row2 } = duplicateRows[i];
+                        message += `绗�${row1}琛屼笌绗�${row2}琛岀浉鍚宍;
+
+                        if (i !== duplicateRows.length - 1) {
+                            message += '锛�';
+                        }
+                    }
+
+                    message += '锛岃鍒犻櫎鍏朵腑涓�琛�';
+                    layer.alert(message);
+                } 
+                
 
                 var sMainStr = JSON.stringify(data.field);
                 var sSubStr = JSON.stringify(num);
@@ -1059,7 +1097,8 @@
                                                 "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HAuxPropID": 0, "鐗╂枡杈呭姪灞炴��": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HQtyMust": "", "HQty": "", "HRemark": "",
                                                 "HPrice": "0", "HMoney": "0", "HOrderPrice": "0", "HWHID": 0, "鏀舵枡浠撳簱": "",
                                                 "HSPID": 0, "浠撲綅鍚嶇О": "", "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
-                                                "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": ""
+                                                "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
+                                                "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
                                             };
 
                                             table.cache["mainTable"].push(NewRow);
@@ -1191,8 +1230,87 @@
                     }
                 })
             }
-                 
 
+            //琛屽唴浜嬩欢
+            table.on('tool(mainTable)', function (obj) {
+                set_GridDelete(obj);   //琛屽唴鍒犻櫎
+                set_GridCellCheck(obj); //琛屽唴蹇嵎閿瓫閫�
+
+            });
+            //琛ㄥご淇℃伅閫夋嫨鍗曟嵁寮圭獥
+            form.on('submit(XDHList)', function () {
+
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2
+                    , skin: "layui-layer-rim" //鍔犱笂杈规
+                    , title: "鏀舵枡閫氱煡鍗曞垪琛�"  //鏍囬
+                    , closeBtn: 1  //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                    , shift: 2 //寮瑰嚭鍔ㄧ敾
+                    , area: ["90%", "90%"] //绐椾綋澶у皬
+                    , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                    , content: ["../../閲囪喘绠$悊/鏀舵枡閫氱煡鍗�/Cg_POInStockBillList.html", "yes"]
+                    , btn: ["纭畾", "鍙栨秷"]
+                    , btn1: function (index, laero) {
+                        //鎸夐挳涓�  鐨勫洖璋�
+                        var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
+                        var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
+
+                        if (checkStatus.data.length == 0) {
+                            return layer.msg("璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�!");
+                        }
+                        layer.alert("浣犲凡閫夋嫨" + checkStatus.data.length + "鏉℃暟鎹�");
+                        //鑾峰彇鏀舵枡閫氱煡鍗曚唬鐮�
+                        var ProcessNumber = [];
+                        for (var i = 0; i < checkStatus.data.length; i++) {
+                            ProcessNumber.push(checkStatus.data[i]);
+                        }
+
+                        //鑾峰彇褰撳墠浣嶇疆鎵�鍦ㄨ鏁�
+                        var NowNum = 0;
+                        NowNum = option.data.length;
+
+                        
+                        var j = 0;
+                        for (var i = 0; i < ProcessNumber.length; i++) {
+                            option.data.push({
+                                "HMaterID": checkStatus.data[j].HMaterID, "鐗╂枡浠g爜": checkStatus.data[j].鐗╂枡浠g爜, "鐗╂枡鍚嶇О": checkStatus.data[j].鐗╂枡鍚嶇О, "瑙勬牸鍨嬪彿": checkStatus.data[j].瑙勬牸鍨嬪彿,
+                                "HAuxPropID": 0, "鐗╂枡杈呭姪灞炴��": "", "HUnitID": checkStatus.data[j].HUnitID, "璁¢噺鍗曚綅": checkStatus.data[j].璁¢噺鍗曚綅, "HQtyMust": "", "HQty": checkStatus.data[j].鏁伴噺, "HRemark": "",
+                                "HPrice": checkStatus.data[j].鍗曚环, "HMoney": checkStatus.data[j].閲戦, "HOrderPrice": "0", "HWHID": checkStatus.data[j].HWHID, "鏀舵枡浠撳簱": checkStatus.data[j].鏀舵枡浠撳簱,
+                                "HSPID": checkStatus.data[j].HSPID, "浠撲綅鍚嶇О": checkStatus.data[j].浠撲綅鍚嶇О, "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
+                                "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
+                                "HSourceBillNo": checkStatus.data[j].鍗曟嵁鍙�, "HSourceBillType": checkStatus.data[j].HBillType, "HSourceInterID": checkStatus.data[j].hmainid, "HSourceEntryID": checkStatus.data[j].hsubid,
+                            })
+                            j++;
+                        }
+                        table.render(option);
+                        layer.close(index);//鍏抽棴寮圭獥
+                    }
+                       
+                });
+            });
+            //鍒ゆ柇鎵�閫夌潃涓庤〃鏍兼槸鍚︽湁閲嶅鏁版嵁
+            function checkDuplicateData(data) {
+                const duplicates = [];
+
+                for (let i = 0; i < data.length; i++) {
+                    const currentItem = data[i];
+                    let isDuplicate = false;
+
+                    for (let j = i + 1; j < data.length; j++) {
+                        const compareItem = data[j];
+
+                        if (currentItem.HSourceInterID === compareItem.HSourceInterID && currentItem.HSourceEntryID === compareItem.HSourceEntryID) {
+                            isDuplicate = true;
+                            duplicates.push({ row1: i + 1, row2: j + 1 }); // 璁板綍閲嶅鏁版嵁鎵�鍦ㄨ鏁�
+                        }
+                    }
+                    if (isDuplicate && !duplicates.some(item => item.row1 === i + 1)) {
+                        duplicates.push({ row1: i + 1, row2: -1 }); // 璁板綍閲嶅鏁版嵁鎵�鍦ㄨ鏁帮紝-1 琛ㄧず鏈壘鍒颁笌褰撳墠琛岄噸澶嶇殑琛�
+                    }
+                }
+                return duplicates;
+            }
             //琛屽唴鍒犻櫎
             function set_GridDelete(obj) {
                 var data = obj.data;
diff --git "a/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBackBillList.html" "b/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBackBillList.html"
index 767e1f1..cfa290e 100644
--- "a/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBackBillList.html"
+++ "b/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBackBillList.html"
@@ -559,7 +559,7 @@
                     layer.msg('璇烽�夋嫨涓�琛屾暟鎹鏍革紒');
                 }
             }
-            //#endregion
+            //#endregionz
 
             //#region 鏉$爜鏄庣粏
             function get_BarCodeDetail() {
diff --git "a/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBillList.html" "b/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBillList.html"
index 05b1f9e..29c3897 100644
--- "a/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBillList.html"
+++ "b/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBillList.html"
@@ -490,6 +490,7 @@
                 //if (HOrgID) {
                 //    sWhere += " and HUSEORGID = '" + HOrgID + "'";
                 //}
+                sWhere += " and 鍏抽棴浜� =''";
                 get_Display(sWhere);
                 sWhere = "";//璋冪敤鎺ュ彛鍚庢竻绌簊Where缂撳瓨
             }
@@ -518,20 +519,23 @@
                 get_Display(sWhere);
             }
             //#endregion
-
             //鍒犻櫎
             function set_DeleteBill() {
                 var checkStatus = table.checkStatus('mainTable')
                     , data = checkStatus.data;
                 if (checkStatus.data.length === 1) {
-                    var InterID = data[0].hmainid.toString();
+                    var Hmainid = data[0].hmainid.toString();
+                    var HsupId = data[0].hsubid;
+                    var HQty = data[0].瀹炴敹鏁伴噺;
+                    var HSourceInterID = data[0].婧愬崟涓诲唴鐮�;
+                    var HSourceEntryID = data[0].婧愬崟瀛愬唴鐮�;
                     //閫昏緫鍒犻櫎鏂规硶
                     layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗涓嶈兘鎭㈠", { title: "鍒犻櫎纭" }, function (index) {
                         var wait = layer.load();
                         $.ajax({
                             type: "GET",
                             url: GetWEBURL() + "/Kf_POStockInBill/DeltetKf_POStockInBill", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                            data: { "HInterID": InterID },
+                            data: { "Hmainid": Hmainid, "HsupId": HsupId, "HQty": HQty, "HSourceInterID": HSourceInterID, "HSourceEntryID": HSourceEntryID, "user": sessionStorage["HUserName"] },
                             success: function (result) {
                                 if (result.count == 1) {
                                     layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {

--
Gitblit v1.9.1