From 3425237a2b54ca28fc3e3c5f7c35a7fbef4e15fa Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 29 十二月 2025 09:19:29 +0800
Subject: [PATCH] 1

---
 WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_KeyElement.html |  519 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 400 insertions(+), 119 deletions(-)

diff --git "a/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\345\215\225\345\223\201\350\277\207\347\253\231_\345\260\217\345\215\253/Cj_ProcessItemStationPlatform_KeyElement.html" "b/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\345\215\225\345\223\201\350\277\207\347\253\231_\345\260\217\345\215\253/Cj_ProcessItemStationPlatform_KeyElement.html"
index b305a4d..0f2108a 100644
--- "a/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\345\215\225\345\223\201\350\277\207\347\253\231_\345\260\217\345\215\253/Cj_ProcessItemStationPlatform_KeyElement.html"
+++ "b/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\345\215\225\345\223\201\350\277\207\347\253\231_\345\260\217\345\215\253/Cj_ProcessItemStationPlatform_KeyElement.html"
@@ -33,11 +33,11 @@
                                 <label class="layui-form-label" style="padding-left:0px" id="">闀洉鐮�:</label>
                                 <input type="text" class="layui-input" name="HBarCode_SN" lay-verify="HBarCode_SN" autocomplete="off" placeholder="璇烽敭鍏ュ悗鍥炶溅" id="HBarCode_SN" style="width: 500px;">
                             </div>
-
+                            <button class="layui-btn layui-btn-normal" style="float:left;" type="button" lay-submit="" lay-filter="btnNextProc" id="btnNextProc">鎹骇鍝�</button>
 
                             <button class="layui-btn layui-btn-normal" style="float:right" type="button" lay-submit="" lay-filter="btnExit" id="btnExit">閫�鍑�</button>
-                            
-                            
+
+
 
                         </div>
 
@@ -79,12 +79,19 @@
                                                 <input type="text" class="layui-input" name="HSNNo" lay-verify="HSNNo" id="HSNNo" style="background-color:#efefef4d;" readonly>
                                             </div>
                                         </div>
+                                        <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="HBillNo" lay-verify="HBillNo" id="HBillNo" style="background-color:#EDEDED;" readonly>
+                                                <input type="hidden" name="HInterID" id="HInterID" lay-verify="HInterID">
+                                            </div>
+                                        </div>
                                     </div>
                                     <div class="layui-row">
                                         <div class="layui-inline">
                                             <label class="layui-form-label" style="width: 85px;" id="BT_HProcExchBillNo">宸ュ簭娴佽浆鍗�</label>
                                             <div class="layui-input-block" style="margin-left: 120px;">
-                                                <input type="text" class="layui-input" name="HProcExchBillNo" lay-verify="HProcExchBillNo" id="HProcExchBillNo" value="" style="background-color:#efefef4d;">
+                                                <input type="text" class="layui-input" name="HProcExchBillNo" lay-verify="HProcExchBillNo" id="HProcExchBillNo" value="" style="background-color:#efefef4d;" autocomplete="off">
                                                 <input type="hidden" class="layui-input" name="HProcExchInterID" lay-verify="HProcExchInterID" id="HProcExchInterID" value="0">
                                                 <input type="hidden" class="layui-input" name="HProcExchEntryID" lay-verify="HProcExchEntryID" id="HProcExchEntryID" value="0">
                                             </div>
@@ -237,15 +244,16 @@
                             </div>
                         </div>
                     </div>
-                    <script type="text/html" id="toolbarDemo">
+                    <!--<script type="text/html" id="toolbarDemo">
                         <div class="layui-btn-container">
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete"><i class="layui-icon layui-icon-form"></i>瑙g粦</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn" id="HideColumn"><i class="layui-icon layui-icon-form"></i>鍒楄缃�</button>
                         </div>
-                    </script>
+                    </script>-->
                     <script type="text/html" id="toolbarDemo2">
                         <div class="layui-btn-container">
-                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete2"><i class="layui-icon layui-icon-form"></i>鍒犻櫎</button>
+                            <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete2"><i class="layui-icon layui-icon-form"></i>鍒犻櫎</button>-->
+                            <button type="button" class="layui-btn layui-btn-sm" lay-event="refresh" id="refresh"><i class="layui-icon layui-icon-form"></i>鍒锋柊</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn2" id="HideColumn"><i class="layui-icon layui-icon-form"></i>鍒楄缃�</button>
                         </div>
                     </script>
@@ -255,6 +263,9 @@
     </div>
 </body>
 </html>
+<script type="text/html" id="barDemo">
+    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
+</script>
 <script>
 
     layui.config({
@@ -274,8 +285,8 @@
 
         //瀹氫箟鍏ㄥ眬鍙橀噺
 
-        var HModName = "Cj_ProcessItemStationPlatform_batch";
-        var HModName2 = "Cj_ProcessItemStationPlatform_batch2";
+        var HModName = "Cj_ProcessItemStationPlatform_KeyElement";
+        var HModName2 = "Cj_ProcessItemStationPlatform_KeyElement2";
         var option = [];
         var option2 = [];
         //#endregion
@@ -289,6 +300,11 @@
         //#endregion
 
         //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
+
+        table.on('tool(mainTable)', function (obj) {
+            set_GridDelete(obj);   //琛屽唴鍒犻櫎
+        });
+
         //澶村伐鍏锋爮浜嬩欢
         table.on('toolbar(mainTable)', function (obj) {
             switch (obj.event) {
@@ -303,68 +319,37 @@
         table.on('toolbar(mainTable2)', function (obj) {
             switch (obj.event) {
                 //鍒犻櫎鎸夐挳
-                case 'btn-Delete2': set_DeleteBill2();
+                case 'btn-Delete2': btn_Delete();
                     break;
                 //鍒楄缃�
                 case 'set_HideColumn2': get_HideColumnNoPage(HModName2, sessionStorage["HUserName"], option2, get_Display);
                     break;
+                //鍒锋柊
+                case 'refresh': get_Display();
+                    break;
             };
         });
-        //鎵规鐮佸洖杞︽柟娉�
-        $('#HBarCode_Batch').on('keydown', function (event) {
-            var HBarCode = $('#HBarCodeSN').val();
-            var HBardCodeProcExchBillNo = $('#HBardCodeProcExchBillNo').val();
-            if (event.keyCode == 13) {
-                if (!HBardCodeProcExchBillNo) {
-                    layer.msg(get_MessageError("[0000-2-034]璇峰厛鎵祦杞崱锛�", sessionStorage["HTranSlate"]))
-                    return;
-                } else {
-                    HBarCode = HBarCode.toUpperCase();
-                    if (!HBarCode) {
-                        layer.msg(get_MessageError("[0000-2-019]鏉″舰鐮佷笉鑳戒负绌猴紒", sessionStorage["HTranSlate"]))
-                        return;
-                    } else {
-                        if (HBarCode.length != 29 && HBarCode.length != 50) {
-                            layer.alert(get_MessageError("[3791-2-012]瀛愪欢鏉$爜闀垮害涓嶄负29浣嶆垨50浣�!", sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-035]閫�鍑�', sessionStorage["HTranSlate"])], time: 100000, offset: 't' });
-                            return;
-                        }
-
-                        if (HBarCode.match(/[^\x00-\xff]/g) != null) {
-                            layer.alert(get_MessageError("[3791-2-013]蹇呴』鏄崐瑙掑瓧绗�!", sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-035]閫�鍑�', sessionStorage["HTranSlate"])], time: 100000, offset: 't' });
-                            return;
-                        }
-                    }
-                }
-                for (var i = 0; i < option.data.length; i++) {
-                    if (option.data[i]["HBatchNo"] == "") {
-                        layer.msg(get_MessageError("[3791-2-014]褰撳墠宸ュ簭鎵规涓嶈兘涓虹┖锛�", sessionStorage["HTranSlate"]))
-                        return;
-                    }
-                }
-                txtHBarCode_KeyDown(HBarCode);
-            }
-        });
-      
         //闀洉鐮佸洖杞︽柟娉�
         $('#HBarCode_SN').on('keydown', function (event) {
-            var HBarCode = $('#HBardCodeProcExchBillNo').val();
+            var HBarCode_SN = $('#HBarCode_SN').val();
             if (event.keyCode == 13) {
-                if (!HBarCode) {
-                    layer.msg(get_MessageError("[0000-1-057]娴佽浆鍗′笉鑳戒负绌猴紒", sessionStorage["HTranSlate"]))
-                    return;
+                
+                if (HBarCode_SN) {
+                    createBillNo();
+                    txtHBarCodeSN_KeyDown(HBarCode_SN);
                 }
-                setIntervalIndex = setInterval(setIntervalList, 30000);
-                get_BomList(HBarCode);
-                //if (option.data != 0) {
-                //    //淇濆瓨鍒颁复鏃惰〃
-                //    get_AddBomTempList();
-                //}
-                //鏌ヨ涓嶈壇璁板綍
-                get_BadRecords();
-                //鏌ヨ鍚堟牸璁板綍
-                get_HGRecords();
 
-               
+            }
+        });
+        //鍏抽敭浠跺洖杞︽柟娉�
+        $('#HBarCode_Key').on('keydown', function (event) {
+            var HBarCode_Key = $('#HBarCode_Key').val();
+            if (event.keyCode == 13) {
+                
+                if (HBarCode_Key) {
+                    txtHBarCodeKey_KeyDown(HBarCode_Key);
+                }
+
             }
         });
 
@@ -393,7 +378,23 @@
         form.on('submit(btnHProc)', function () {
             btnHProc();
         });
+        //鎹骇鍝�
+        form.on('submit(btnNextProc)', function (data) {
+            //for (var i = 0; i < option.data.length; i++) {
+            //    if (option.data[i].HBindingQty < 1 || option.data[i].HBarCode == "") {
+            //        layer.alert("绗�<span style='color: red;'>" + (i + 1) + "</span>琛岋紝閰嶄欢 <span style='color: blue;'>" + option.data[i].HMaterName + "</span> 鏈粦瀹氶綈鏁达紒")
+            //        return;
+            //    }
+            //}
 
+            //淇濆瓨鍏抽敭浠�
+            if (AllowLoadData(data)) {
+                set_SaveBill(data);
+            }
+
+            //鍘嗗彶缁戝畾璁板綍鏌ヨ
+            //get_Display();
+        });
 
         //閫�鍑�
         form.on('submit(btnExit)', function (data) {
@@ -412,7 +413,7 @@
         //鍒濆鍖栫晫闈�
         function set_ClearBill() {
             //杩涘叆椤甸潰榛樿鍏夋爣鍦ㄦ祦杞崱涓�
-            $("#HBardCodeProcExchBillNo").focus();
+            $("#HBarCode_SN").focus();
             //鍒跺崟浜�
             $("#HMaker").val(sessionStorage["HUserName"]);
             $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
@@ -421,7 +422,7 @@
             //鍒濆鍖栬〃鏍�
             set_InitGrid();
             //
-            //get_Display();
+            get_Display();
         }
 
         //#region 閫氳繃鐧诲綍鐢ㄦ埛鑾峰彇榛樿鍊�
@@ -462,29 +463,33 @@
         function set_InitGrid() {
             option= {
                 elem: '#mainTable'
-                , toolbar: '#toolbarDemo'
+                //, toolbar: '#toolbarDemo'
                 , page: false
                 , totalRow: true
                 , cellMinWidth: 120
                 , data: []
                 , height: 285
                 , limit: 10
-                , cols: [[
-                    { type: 'numbers', title: '搴忓彿' }
-                    , { field: '鏃ユ湡', title: '鏃ユ湡' }
-                    , { field: '閰嶄欢浠g爜', title: '閰嶄欢浠g爜' }
-                    , { field: '閰嶄欢鍚嶇О', title: '閰嶄欢鍚嶇О' }
-                    , { field: '閰嶄欢瑙勬牸', title: '閰嶄欢瑙勬牸' }
-                    , { field: '閰嶄欢鏁伴噺', title: '閰嶄欢鏁伴噺', totalRow: true}
-                    , { field: 'HBatchNo', title: '褰撳墠鎵规' }
-                    , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true }
-                    , { field: 'HICMOEntryID', title: 'HICMOEntryID', hide: true }
-                    , { field: 'HICMOBillNo', title: 'HICMOBillNo', hide: true }
-                    , { field: 'HProcExchInterID', title: 'HProcExchInterID', hide: true }
-                    , { field: 'HProcExchEntryID', title: 'HProcExchEntryID', hide: true }
-                    , { field: 'HProcExchBillNo', title: 'HProcExchBillNo', hide: true }
+                , cols: [[ //缁戝畾淇℃伅琛�
+                    { type: 'numbers', title: '搴忓彿', width: 50 }
+                    , { field: 'HBarCode_P', title: '浜у搧鐮�', width: 265 }
+                    , { field: 'HBarCode', title: '閰嶄欢鐮�', width: 265 }
+                    , { field: 'HPartsQty', title: '閰嶄欢鏁�', width: 72 }
+                    , { field: 'HBindingQty', title: '宸茬粦鏁�', width: 72 }
                     , { field: 'HMaterID', title: 'HMaterID', hide: true }
-                    , { field: 'HBarCode', title: 'HBarCode', hide: true }
+                    , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 160 }
+                    , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 160 }
+                    , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 160, hide: true }
+                    , { field: 'HBatchNo', title: '鎵规', width: 160, hide: true }
+                    , { field: 'HSourceID', title: 'HSourceID', width: 160, hide: true }
+                    , { field: 'HEquipID', title: 'HEquipID', width: 160, hide: true }
+                    , { field: 'HGroupID', title: 'HGroupID', width: 160, hide: true }
+                    , { field: 'HWorkerID', title: 'HWorkerID', width: 160, hide: true }
+                    , { field: 'HScanDate', title: 'HScanDate', width: 160, hide: true }
+                    , { field: 'HSourceInterID', title: 'HSourceInterID', width: 160, hide: true }
+                    , { field: 'HSourceEntryID', title: 'HSourceEntryID', width: 160, hide: true }
+                    , { field: 'HSourceBillNo', title: 'HSourceBillNo', width: 160, hide: true }
+                    , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 66 }
                 ]]
             }
             option2 = {
@@ -518,77 +523,164 @@
             table.render(option2);
         }
         
-        //鏉$爜鍥炶溅鏌ヨ
-        function txtHBarCode_KeyDown(HBarCode) {
-
-            var HProcExchBillNo = $("#HProcExchBillNo").val();
+        //浜у搧SN闀洉鐮佺爜鍥炶溅鏌ヨ
+        function txtHBarCodeSN_KeyDown(HBarCode) {
+            //涓昏〃淇℃伅鏌ヨ
             var indexs = layer.load();
+            //閰嶄欢淇℃伅鏌ヨ
+            var HBillNo = $("#HBillNo").val();
             $.ajax({
                 type: "GET",
-                url: GetWEBURL() + "/Cj_SingleStation/SNHBardCodeList",
+                url: GetWEBURL() + "/Cj_SingleStation/HBardCodeBomList_XW",
                 async: false,
-                data: { "HBarCode": HBarCode, "HProcExchBillNo": HProcExchBillNo, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
+                data: { "HBillNo": HBillNo, "HBarCode": HBarCode, "HProcID": $("#HProcID").val(), "HOrgID": sessionStorage["OrganizationID"], "user": sessionStorage["HUserName"] },
                 dataType: "json",
                 success: function (data1) {
                     if (data1.count == 1) {
-                        layer.close(indexs);
-                        var index = layer.load();
+                        var data = data1.data
+                        var rowarr = [];
 
+                        for (var i = 0; i < data.length; i++) {
+                            rowarr.push({
+                                "HBarCode_P": data[i].浜у搧鐮�, "HPartsBarCode": "", "HPartsQty": data[i].鍒嗗瓙瀛愰」鐢ㄩ噺, "HBindingQty": 0
+                                , "HMaterID": data[i].瀛愰」鐗╂枡ID, "HMaterNumber": data[i].瀛愰」鐗╂枡浠g爜, "HMaterName": data[i].瀛愰」鐗╂枡鍚嶇О, "HMaterModel": data[i].瀛愰」瑙勬牸鍨嬪彿, "HBatchNo": ""
+                                , "HSourceID": $("#HSourceID").val(), "HEquipID": 0, "HGroupID": $("#HGroupID").val(), "HWorkerID": $("#HEmpID").val()
+                                , "HScanDate": new Date(), "HSourceInterID": $("#HICMOInterID").val()
+                                , "HSourceEntryID": $("#HICMOEntryID").val(), "HSourceBillNo": $("#HICMOBillNo").val()
+                            });
+                        }
+
+                        option.data = rowarr;
+
+                        table.render(option);
+
+
+
+                        //绂佺敤杈撳叆妗�,鑳屾櫙鑹插彉鐏�
+                        $("#HBarCode_SN").prop("readonly", true);
+                        $("#HBarCode_SN").css('background', '#EDEDED')//鑳屾櫙鑹插彉鐏�
+                        //鍏夋爣璺宠浆鍒伴厤浠剁爜鏂囨湰妗嗕笂
+                        $("#HBarCode_Key").focus();
+                        //鑾峰彇瀵瑰簲涓昏〃淇℃伅
                         $.ajax({
                             type: "GET",
-                            url: GetWEBURL() + "/Cj_SingleStation/HBardCodeSNList",
+                            url: GetWEBURL() + "/Cj_SingleStation/checkHBarCode_Batch",
                             async: false,
-                            data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"] },
+                            data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
                             dataType: "json",
                             success: function (data1) {
                                 if (data1.count == 1) {
-                                    layer.close(index);
-                                    $("#HBarCode_P").val(HBarCode);
-                                    if (AllowLoadData()) {
-                                        //淇濆瓨鏁版嵁
-                                        set_AddAssemblyBill();
-                                    }
+                                    layer.close(indexs);
+                                    $("#HSNNo").val(HBarCode);
+                                    $("#HMaterNumber").val(data1.data[0]["HMaterNumber"])
+                                    $("#HMaterName").val(data1.data[0]["HMaterName"])
+                                    $("#HMaterModel").val(data1.data[0]["HMaterModel"])
+                                    $("#HICMOBillNo").val(data1.data[0]["HSourceBillNo"])
                                 }
                                 else {
-                                    layer.close(index);
-                                    layer.msg(get_MessageError(data1.Message, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]纭', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]娓╅Θ鎻愮ず", sessionStorage["HTranSlate"]) });
+                                    layer.close(indexs);
+                                    layer.confirm(data1.Message);
                                 }
-                                $("#HBarCodeSN").val("");
+
                             },
                             error: function (err) {
-                                layer.close(index);
+                                layer.close(indexs);
                                 layer.msg(get_MessageError("閿欒:" + err, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]纭', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]娓╅Θ鎻愮ず", sessionStorage["HTranSlate"]) });
+                                return;
                             }
                         });
                     }
                     else {
                         layer.close(indexs);
-                        layer.msg(get_MessageError(data1.Message, sessionStorage["HTranSlate"]));
+                        $("#HBarCode_SN").val("");
+                        $("#HBarCode_SN").focus();
+                        layer.confirm(data1.Message);
                     }
-                    //鍏夋爣璺宠浆鍒癝N鏉$爜鏂囨湰妗嗕笂
-                    //$("#HBarCodeSN").focus();
-                    $("#HBarCodeSN").val("");
                 },
                 error: function (err) {
                     layer.close(indexs);
-                    layer.msg(get_MessageError("閿欒:" + err, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]纭', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]娓╅Θ鎻愮ず", sessionStorage["HTranSlate"]) });
+                    layer.msg("閿欒:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    $("#HBarCode_SN").val("");
+                    $("#HBarCode_SN").focus();
+                    layer.confirm(data1.Message);
+                }
+            });
+
+        }
+
+        //閰嶄欢鐮佸洖杞︽煡璇�
+        function txtHBarCodeKey_KeyDown(HBarCode) {
+            var indexs = layer.load();
+            var HBillNo = $("#HBillNo").val();
+            $.ajax({
+                type: "GET",
+                url: GetWEBURL() + "/Cj_SingleStation/BarCodeBillBomBind_XW",
+                async: false,
+                data: { "HBillNo": HBillNo, "HBarCode": HBarCode, "HBarCode_P": $('#HBarCode_SN').val(), "HProcID": $('#HProcID').val(), "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
+                dataType: "json",
+                success: function (data1) {
+                    if (data1.count == 1) {
+                        var data = data1.data
+
+                        for (var i = 0; i < option.data.length; i++) {
+                            if (data[0].HMaterID == option.data[i].HMaterID && option.data[i].HBindingQty < option.data[i].HPartsQty) {
+                                option.data[i].HMaterID = data[0].HMaterID
+                                option.data[i].HMaterNumber = data[0].鐗╂枡浠g爜
+                                option.data[i].HMaterName = data[0].鐗╂枡鍚嶇О
+                                option.data[i].HMaterModel = data[0].瑙勬牸鍨嬪彿
+                                option.data[i].HBarCode = data[0].閰嶄欢鐮�
+                                option.data[i].HBindingQty = option.data[i].HBindingQty + 1
+                                $("#HReturnMessage").text("鎴愬姛鎵爜涓�涓厤浠�:" + data[0].鐗╂枡鍚嶇О);
+                                break;
+                            } else if (data[0].HMaterID == option.data[i].HMaterID && i == option.data.length - 1) {
+                                layer.msg("绗�" + (i + 1) + "琛屽凡鍏ㄩ儴缁戝畾锛岃鍕胯秴閲忕粦瀹�");
+                            } else if (data[0].HMaterID != option.data[i].HMaterID && i == option.data.length - 1) {
+                                layer.msg("鎵�鎵厤浠剁爜锛�" + HBarCode + " ,瀵瑰簲鐗╂枡涓嶅湪鐢熶骇鐢ㄦ枡娓呭崟涓紒");
+                            }
+                        }
+
+                        //option.data = rowarr;
+
+                        table.render(option);
+                        //鍏夋爣璺宠浆鍒伴厤浠剁爜鏂囨湰妗嗕笂
+                        $("#HBarCode_Key").focus();
+                        $("#HBarCode_Key").val("");
+                        //濡傛灉閰嶄欢閰嶅畬鑷甫鎻愪氦
+                        if (areQuantitiesEqual(option.data)) {
+                            //淇濆瓨鍏抽敭浠�
+                            if (AllowLoadData(data)) {
+                                set_SaveBill(data);
+                            }
+                        }
+                        layer.close(indexs);
+                    }
+                    else {
+                        layer.close(indexs);
+                        layer.confirm(data1.Message);
+                    }
+                },
+                error: function (err) {
+                    layer.close(indexs);
+                    layer.msg("閿欒:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                 }
             });
         }
-
-        //鍔犺浇缃戞牸
-        function get_Display() {
+        //鍔犺浇鍘嗗彶杩囩珯娓呭崟淇℃伅
+        function get_Display(sWhere = '') {
             var ajaxLoad = layer.load();
+            var HProcID = $("#HProcID").val();
+            var HSourceID = $("#HSourceID").val();
+            sWhere += ` and HProcID = ${HProcID} and HSourceID = ${HSourceID}`
             $.ajax({
-                url: GetWEBURL() + '/Cg_POOrderBill/list',
+                url: GetWEBURL() + '/Cj_SingleStation/SingleStationOutBillList',
                 async: false,
                 type: "GET",
-                data: { "sWhere": '', "user": sessionStorage["HUserName"] },
+                data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                 success: function (data1) {
                     if (data1.count == 1) {
                         var data = [];//鍒楀瓧娈垫暟鎹�
                         var col = [];
-                        var titleData=[]
+                        var titleData = []
                         var totalArray = ["鏁伴噺", "鍏宠仈鏁伴噺", "鏈叧鑱旀暟閲�", "鎵撳嵃鏉$爜鏁伴噺", "鏈墦鍗版潯鐮佹暟閲�", "瀹炴敹鏁伴噺", "閲戦"];
                         //缁欑┖鐨勬暟缁勮祴鍊�
                         for (var key in data1.list) {
@@ -626,15 +718,15 @@
                                 }
                             }
                         }
-                        option.cols = [col]
-                        option.data = data1.data;
+                        option2.cols = [col]
+                        option2.data = data1.data;
 
-                        
+
 
                         //鍒锋柊琛ㄦ牸鏁版嵁
-                        DisPlay_HideColumn(HModName, sessionStorage["HUserName"], option, []);
+                        DisPlay_HideColumn(HModName2, sessionStorage["HUserName"], option2, []);
 
-                        table.render(option);
+                        table.render(option2);
                         layer.close(ajaxLoad);
                         //layer.alert("鏌ヨ鎴愬姛", { icon: 1 });
                     } else {
@@ -646,6 +738,170 @@
                     layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
                 }
             });
+        }
+
+        //#region 淇濆瓨鏂规硶
+        function set_SaveBill() {
+            var data = {
+                "field": {
+                    "HProcID": $("#HProcID").val(), "HBatchNo": "",
+                    "HGroupID": $("#HGroupID").val(), "HSourceID": $("#HSourceID").val(),
+                    "HPRDOrgID": sessionStorage["OrganizationID"],
+                    "HEmpID": $("#HEmpID").val(), "HDeptID": $("#HDeptID").val()
+                }
+            };
+            var sMainStr = JSON.stringify(data.field);
+            var HBarCode = $("#HBarCode_SN").val();
+            var sSubStr = JSON.stringify(option.data);
+            var sMainSub = sMainStr + ';' + HBarCode + ';' + sSubStr + ';' + sessionStorage["HUserName"];
+            var indexs = layer.load();
+            $.ajax({
+                type: "POST",
+                url: GetWEBURL() + "/Cj_SingleStation/AddStationOutBillAndAssemblyBill",
+                async: false,
+                data: { "sMainSub": sMainSub },
+                dataType: "json",
+                success: function (data1) {
+                    if (data1.count == 1) {
+                        layer.close(indexs);
+
+
+                        $("#HReturnMessage").text("鎴愬姛杩囩珯鎵爜涓�涓骇鍝�:" + HBarCode);
+                        //鍒囨崲浜у搧
+                        set_changeHBarCodeSN();
+                        get_Display();
+                    }
+                    else {
+
+                        layer.close(indexs);
+                        layer.msg(data1.Message, { icon: 5, btn: ["纭"], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "鍑虹幇閿欒" });
+                    }
+
+                },
+                error: function (err) {
+
+                    layer.close(indexs);
+                    layer.msg(get_MessageError("閿欒:" + err, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]纭', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]娓╅Θ鎻愮ず", sessionStorage["HTranSlate"]) });
+                }
+            });
+        }
+        //#endregion
+
+        //鍒犻櫎鍗曟嵁
+        function btn_Delete() {
+            var checkStatus = table.checkStatus('mainTable2')
+                , data = checkStatus.data;
+            if (checkStatus.data.length === 1) {
+                layer.confirm(get_MessageError('[0000-1-003]纭畾鍒犻櫎' + data[0].鍗曟嵁鍙� + '鍚楋紵', sessionStorage["HTranSlate"]), function (index) {
+                    var ajaxLoad = layer.load();
+                    //閫昏緫鍒犻櫎鏂规硶
+                    $.ajax({
+                        url: GetWEBURL() + '/Cj_StationOutBill/del_StationOutBillandAssemblyBill',
+                        type: "GET",
+                        data: { "HInterID": data[0].hmainid, "HBarCode_P": data[0].闀洉SN鐮�, "HDeleteMan": sessionStorage["HUserName"], "HBillSubType": "3791" },
+                        success: function (result) {
+                            if (result.count == 1) {
+                                get_Display();
+                                layer.close(ajaxLoad);
+                            } else {
+                                layer.close(ajaxLoad);
+                                layer.alert(get_MessageError(result.Message, sessionStorage["HTranSlate"]) + result.Message, { icon: 5 });
+                            }
+                        }, error: function () {
+                            layer.close(ajaxLoad);
+                            layer.alert(get_MessageError("[0000-1-002]鎺ュ彛璇锋眰澶辫触!", sessionStorage["HTranSlate"]), { icon: 5 });
+                        }
+                    });
+                    layer.close(index);
+                });
+            } else {
+                layer.msg(get_MessageError('[0000-1-001]璇烽�夋嫨涓�琛屾暟鎹紪杈戯紒', sessionStorage["HTranSlate"]));
+            }
+        }
+
+        //鍒囨崲浜у搧鏂规硶
+        function set_changeHBarCodeSN() {
+            $("#HSNNo").val("");
+            $("#HMaterNumber").val("")
+            $("#HMaterName").val("")
+            $("#HMaterModel").val("")
+            $("#HICMOBillNo").val("")
+
+
+            //鍚敤杈撳叆妗�,鑳屾櫙鑹叉仮澶�
+            $("#HBarCode_SN").prop("readonly", false);
+            $("#HBarCode_SN").css('background', '#FFFFFF')//浜у搧鐮佹枃鏈鑳屾櫙鑹叉仮澶�
+            //娓呯┖鏂囨湰妗嗗唴瀹�
+            $("#HBarCode_SN").val("");//浜у搧鐮佹枃鏈鍐呭娓呯┖
+            //鍏夋爣璺宠浆鍒颁骇鍝佺爜鏂囨湰妗嗕笂
+            $("#HBarCode_SN").focus();
+
+            //娓呴櫎缁戝畾淇℃伅缃戞牸鎵爜璁板綍
+            option.data = [];
+            table.render(option);
+        }
+
+        // 鐢熸垚鍗曟嵁鍙�
+        function createBillNo() {
+            //閲嶆柊鑾峰彇鍗曟嵁鍙�
+            $.ajax({
+                url: GetWEBURL() + "/Web/GetMAXNumPDA",
+                type: "GET",
+                async: false,
+                data: { "HBillType": '3727' },
+                success: function (d) {
+                    //$("#HInterID").val(d.data[0].HInterID);
+                    $("#HBillNo").val(d.data[0].HBillNo);
+                    //$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));  //榛樿涓哄綋鍓嶆棩鏈�
+                    //閲嶆柊鍚敤淇濆瓨鎸夐挳
+                    //$("#btnSave").removeClass("layui-btn-disabled").attr("disabled", false);
+                }
+            });
+        }
+
+        //琛ㄦ牸琛屽唴浜嬩欢鍒犻櫎
+        function set_GridDelete(obj) {
+            var data = obj.data;
+            var rowIndex = $(obj.tr).attr("data-index");
+            if (obj.event === 'del') {
+                layer.confirm('鐪熺殑鍒犻櫎琛屽悧锛�', function (index) {
+
+                    var wait = layer.load();
+                    //鍒犻櫎涓存椂琛ㄦ暟鎹�
+                    $.ajax({
+                        url: GetWEBURL() + 'Deltet_Sc_AssemblyBill_BindBarCodeTemp',
+                        type: "GET",
+                        data: { "HBillNo": $("#HBillNo").val(), "HBarCode": option.data[rowIndex].HBarCode, "user": sessionStorage["HUserName"] },
+                        success: function (result) {
+                            if (result.count == 1) {
+                                layer.msg(result.Message, { icon: 1, time: 500 }, function () {
+                                    //鍏抽棴褰撳墠frame
+                                    layer.close(wait);
+                                });
+                            } else {
+                                layer.alert(result.code + result.Message, { icon: 5 });
+                                layer.close(wait);
+                            }
+                        }, error: function () {
+                            layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                            layer.close(wait);
+                        }
+                    });
+
+
+                    //鍒锋柊琛ㄦ牸鏁版嵁
+                    option.data[rowIndex].HBarCode = "";
+                    option.data[rowIndex].HBindingQty = 0;
+                    //option.data[rowIndex].HMaterID = 0;
+                    option.data[rowIndex].HMaterNumber = "";
+                    option.data[rowIndex].HMaterName = "";
+                    option.data[rowIndex].HMaterModel = "";
+                    option.data[rowIndex].HBarCode = "";
+
+                    table.render(option);
+                    layer.close(index);
+                });
+            }
         }
 
         //鍛樺伐閫夋嫨椤甸潰
@@ -783,17 +1039,26 @@
         //闈炵┖楠岃瘉
         function AllowLoadData() {
 
-            var HBarCode = $("#HBarCode_P").val();
+            var HBarCode = $("#HBarCode_SN").val();
             if (HBarCode == "") {
                 layer.msg(get_MessageError("[0000-2-019]浜у搧SN涓嶈兘涓虹┖!", sessionStorage["HTranSlate"]))
                 return false;
             }
+            var sSubStr = JSON.stringify(table.cache['mainTable']);
 
-            var HEmpID2 = $("#HEmpID2").val();
-            if (HEmpID2 == 0) {
-                layer.msg(get_MessageError("[0000-2-030]鎿嶄綔鍛樹笉鑳戒负绌�!", sessionStorage["HTranSlate"]))
-                return false;
+            if (typeof (sSubStr) != "undefined" && typeof (sSubStr) != "") {
+                sSubStr = JSON.parse(sSubStr);
+                for (var i = 0; i < sSubStr.length; i++) {
+                    if (sSubStr[i].HBarCode == "" || sSubStr[i].HBarCode == undefined || sSubStr[i].HBarCode == null) {
+                        layer.msg("缁戝畾淇℃伅绗�" + (i + 1) + "琛�,閰嶄欢鐮佹湭缁戝畾!", { icon: 5, btn: ['纭'], time: 4000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        return Result = false;
+                    }
+                }
+            } else {
+                layer.msg("閰嶄欢缁戝畾淇℃伅涓嶅厑璁镐负绌�!", { icon: 5, btn: ['纭'], time: 4000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                return Result = false;
             }
+
 
             //var HBadReasonID = $("#HBadReasonID").val();
             //if (HBadReasonID == 0) {
@@ -802,7 +1067,23 @@
             //}
             return true;
         }
+        //鍒ゆ柇鏄惁缁戝畾瀹�
+        function areQuantitiesEqual(arr) {
+            if (arr.length === 0) {
+                return false; // 绌烘暟缁勯粯璁よ涓烘弧瓒虫潯浠�
+            }
 
+            const firstHPartsQty = arr[0].HPartsQty;
+            const firstHBindingQty = arr[0].HBindingQty;
+
+            for (let i = 1; i < arr.length; i++) {
+                if (arr[i].HPartsQty !== firstHPartsQty || arr[i].HBindingQty !== firstHBindingQty) {
+                    return false;
+                }
+            }
+
+            return true;
+        }
         //#endregion
 
     });

--
Gitblit v1.9.1