From 1552dce281ef5a80fbc1d911ea8a32eb7d0795f6 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期三, 05 十一月 2025 16:51:22 +0800
Subject: [PATCH] 单品过站开发

---
 WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_batchKeyElement.html  |  613 ++++++++++++++++++----
 WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_generateCaseCode.html |  467 ++++++++++++-----
 WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_KeyElement.html       |  494 +++++++++++++----
 3 files changed, 1,192 insertions(+), 382 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..c2da2ff 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>
 
@@ -77,6 +77,13 @@
                                             <label class="layui-form-label" style="width: 85px;" id="">褰撳墠闀洉鐮�:</label>
                                             <div class="layui-input-block" style="margin-left: 120px;">
                                                 <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>
@@ -237,12 +244,12 @@
                             </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>
@@ -255,6 +262,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 +284,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 +299,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 +318,39 @@
         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;
             };
         });
-        //鎵规鐮佸洖杞︽柟娉�
-        $('#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_SN").val() == "" || $("#HBarCode_SN").val() == null) {
+                    layer.msg("鏈壂SN鐮佽鍏堟壂鐮�");
+                    $("#HBarCode_SN").focus();
+                    return
+                }
+                if (HBarCode_Key) {
+                    txtHBarCodeKey_KeyDown(HBarCode_Key);
+                }
+
             }
         });
 
@@ -393,7 +379,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 +414,7 @@
         //鍒濆鍖栫晫闈�
         function set_ClearBill() {
             //杩涘叆椤甸潰榛樿鍏夋爣鍦ㄦ祦杞崱涓�
-            $("#HBardCodeProcExchBillNo").focus();
+            $("#HBarCode_SN").focus();
             //鍒跺崟浜�
             $("#HMaker").val(sessionStorage["HUserName"]);
             $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
@@ -421,7 +423,7 @@
             //鍒濆鍖栬〃鏍�
             set_InitGrid();
             //
-            //get_Display();
+            get_Display();
         }
 
         //#region 閫氳繃鐧诲綍鐢ㄦ埛鑾峰彇榛樿鍊�
@@ -462,29 +464,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 +524,158 @@
             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/BarCodeBillBomMatch_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("");
+
+                        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 +713,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 +733,170 @@
                     layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
                 }
             });
+        }
+
+        //#region 淇濆瓨鏂规硶
+        function set_SaveBill() {
+            var data = {
+                "field": {
+                    "HProcID": $("#HProcID").val(), "HBatchNo": "",
+                    "HGroupID": $("#HGroupID").val(), "HSourceID": $("#HSourceID").val(),
+                    "HProdOrgID": 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,18 +1034,27 @@
         //闈炵┖楠岃瘉
         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) {
             //    layer.msg("涓嶈壇鍘熷洜涓嶈兘涓虹┖!")
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_batchKeyElement.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_batchKeyElement.html"
index 8f054d9..f64b0bc 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_batchKeyElement.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_batchKeyElement.html"
@@ -33,7 +33,8 @@
                                 <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:left;" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">淇濆瓨</button>-->
 
                             <button class="layui-btn layui-btn-normal" style="float:right" type="button" lay-submit="" lay-filter="btnExit" id="btnExit">閫�鍑�</button>
                             <button class="layui-btn layui-btn-normal" style="float: right" type="button" lay-submit="" lay-filter="btnChange" id="btnChange">鍙樻洿</button>
@@ -46,7 +47,7 @@
 
 
                     </div>
-                    <div class="layui-tab layui-tab-card" style="width: 49%; float: left; background-color: white;height:400px">
+                    <div class="layui-tab layui-tab-card" style="width: 40%; float: left; background-color: white;height:400px">
                         <ul class="layui-tab-title" lay-filter="tab-all">
                             <li lay-id="1" style="padding:1px;" class="layui-this">浜у搧淇℃伅</li>
                             <li lay-id="2" style="padding:1px;">鍏朵粬淇℃伅</li>
@@ -64,11 +65,18 @@
                                             </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 class="layui-inline">
                                             <label class="layui-form-label" style="width: 85px;" id="">褰撳墠鎵规:</label>
                                             <div class="layui-input-block" style="margin-left: 120px;">
                                                 <input type="text" class="layui-input" name="HBatchNo" lay-verify="HBatchNo" id="HBatchNo" style="background-color:#efefef4d;" readonly>
                                             </div>
-                                        </div>
+                                        </div>-->
                                         <div class="layui-inline">
                                             <label class="layui-form-label" style="width: 85px;" id="">渚涘簲鍟�:</label>
                                             <div class="layui-input-block" style="margin-left: 120px;">
@@ -213,7 +221,7 @@
                         </div>
                     </div>
 
-                    <div class="layui-tab layui-tab-card" style="width: 50.5%; float: right;">
+                    <div class="layui-tab layui-tab-card" style="width: 59.5%; float: right;">
                         <ul class="layui-tab-title">
                             <li class="layui-this">鍏抽敭浠舵竻鍗�</li>
                         </ul>
@@ -240,12 +248,7 @@
                             </div>
                         </div>
                     </div>
-                    <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 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>
@@ -258,6 +261,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({
@@ -277,8 +283,8 @@
 
         //瀹氫箟鍏ㄥ眬鍙橀噺
 
-        var HModName = "Cj_ProcessItemStationPlatform_batch";
-        var HModName2 = "Cj_ProcessItemStationPlatform_batch2";
+        var HModName = "Cj_ProcessItemStationPlatform_batchKeyElement";
+        var HModName2 = "Cj_ProcessItemStationPlatform_batchKeyElement2";
         var option = [];
         var option2 = [];
         //#endregion
@@ -293,11 +299,17 @@
 
         //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
         //澶村伐鍏锋爮浜嬩欢
+        
+        //缁戝畾淇℃伅琛屽唴浜嬩欢
+        table.on('tool(mainTable)', function (obj) {
+            set_GridDelete(obj);   //琛屽唴鍒犻櫎
+        });
+
         table.on('toolbar(mainTable)', function (obj) {
             switch (obj.event) {
                 //鍒犻櫎鎸夐挳
-                case 'btn-Delete': set_DeleteBill();
-                    break;
+                //case 'btn-Delete': btn_Delete();
+                //    break;
                 //鍒楄缃�
                 case 'set_HideColumn': get_HideColumnNoPage(HModName, sessionStorage["HUserName"], option, get_Display);
                     break;
@@ -306,70 +318,118 @@
         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;
             };
         });
+
+        //鍙樻洿
+        form.on('submit(btnChange)', function (data) {
+            $("#HBarCode_Batch").val("");
+            $("#HBarCode_Batch").prop("readonly", false);
+            $("#HBarCode_BatchSec").val("");
+            $("#HBatchNo").val("");
+            $("#HMaterNumber").val("");
+            $("#HMaterName").val("");
+            $("#HMaterModel").val("");
+            $("#HSupID").val(0)
+            $("#HSupName").val(0)
+            //杩涘叆椤甸潰榛樿鍏夋爣鍦ㄦ壒娆′笂
+            $("#HBarCode_Batch").focus();
+        });
+
         //鎵规鐮佸洖杞︽柟娉�
         $('#HBarCode_Batch').on('keydown', function (event) {
-            var HBarCode = $('#HBarCodeSN').val();
-            var HBardCodeProcExchBillNo = $('#HBardCodeProcExchBillNo').val();
+            var HBarCode = $('#HBarCode_Batch').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) {
+                    txtHBarCode_KeyDown(HBarCode);
+                }
 
-                        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_Batch").val() == "" || $("#HBarCode_Batch").val() == null) {
+                    layer.msg("鏈壂鎵规鐮佽鍏堟壂鐮�");
+                    $("#HBarCode_Batch").focus();
+                    return
                 }
-                setIntervalIndex = setInterval(setIntervalList, 30000);
-                get_BomList(HBarCode);
-                //if (option.data != 0) {
-                //    //淇濆瓨鍒颁复鏃惰〃
-                //    get_AddBomTempList();
-                //}
-                //鏌ヨ涓嶈壇璁板綍
-                get_BadRecords();
-                //鏌ヨ鍚堟牸璁板綍
-                get_HGRecords();
+                if (HBarCode_SN) {
+                    createBillNo();
+                    txtHBarCodeSN_KeyDown(HBarCode_SN);
+                }
 
-               
             }
         });
+        //鍏抽敭浠跺洖杞︽柟娉�
+        $('#HBarCode_Key').on('keydown', function (event) {
+            var HBarCode_Key = $('#HBarCode_Key').val();
+            if (event.keyCode == 13) {
+                if ($("#HBarCode_Batch").val() == "" || $("#HBarCode_Batch").val() == null) {
+                    layer.msg("鏈壂鎵规鐮佽鍏堟壂鐮�");
+                    $("#HBarCode_Batch").focus();
+                    return
+                }
+                if ($("#HBarCode_SN").val() == "" || $("#HBarCode_SN").val() == null) {
+                    layer.msg("鏈壂SN鐮佽鍏堟壂鐮�");
+                    $("#HBarCode_SN").focus();
+                    return
+                }
+                if (HBarCode_Key) {
+                    txtHBarCodeKey_KeyDown(HBarCode_Key);
+                }
+
+            }
+        });
+
+        //淇濆瓨
+        form.on('submit(btnSave)', function (data) {
+            if (AllowLoadData(data)) {
+                set_SaveBill(data);
+            }
+        });
+        //鎹骇鍝�
+        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);
+            }
+
+            
+
+            //閲嶆柊鑾峰彇鍗曟嵁鍙�
+            //$.ajax({
+            //    url: GetWEBURL() + "/Web/GetMAXNumPDA",
+            //    type: "GET",
+            //    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);
+            //    }
+            //});
+
+            //鍘嗗彶缁戝畾璁板綍鏌ヨ
+            //get_Display();
+        });
+
 
         //閫夋嫨鎿嶄綔鍛�
         form.on('submit(btnHEmp)', function () {
@@ -415,16 +475,17 @@
         //鍒濆鍖栫晫闈�
         function set_ClearBill() {
             //杩涘叆椤甸潰榛樿鍏夋爣鍦ㄦ祦杞崱涓�
-            $("#HBardCodeProcExchBillNo").focus();
+            $("#HBarCode_Batch").focus();
             //鍒跺崟浜�
             $("#HMaker").val(sessionStorage["HUserName"]);
             $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
+            
             //閫氳繃鐧诲綍鐢ㄦ埛鑾峰彇榛樿鍊�
             GetDefValByUser();
             //鍒濆鍖栬〃鏍�
             set_InitGrid();
             //
-            //get_Display();
+            get_Display();
         }
 
         //#region 閫氳繃鐧诲綍鐢ㄦ埛鑾峰彇榛樿鍊�
@@ -461,33 +522,55 @@
         }
             //#endregion
 
+        // 鐢熸垚鍗曟嵁鍙�
+        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_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 }
+                , limit: 50
+                , 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 = {
@@ -524,53 +607,35 @@
         //鏉$爜鍥炶溅鏌ヨ
         function txtHBarCode_KeyDown(HBarCode) {
 
-            var HProcExchBillNo = $("#HProcExchBillNo").val();
             var indexs = layer.load();
             $.ajax({
                 type: "GET",
-                url: GetWEBURL() + "/Cj_SingleStation/SNHBardCodeList",
+                url: GetWEBURL() + "/Cj_SingleStation/checkHBarCode_Batch",
                 async: false,
-                data: { "HBarCode": HBarCode, "HProcExchBillNo": HProcExchBillNo, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
+                data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
                 dataType: "json",
                 success: function (data1) {
                     if (data1.count == 1) {
                         layer.close(indexs);
-                        var index = layer.load();
+                        $("#HBarCode_BatchSec").val(HBarCode);
+                        const parts = HBarCode.split('@');
+                        $("#HBatchNo").val(parts[2]);
 
-                        $.ajax({
-                            type: "GET",
-                            url: GetWEBURL() + "/Cj_SingleStation/HBardCodeSNList",
-                            async: false,
-                            data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"] },
-                            dataType: "json",
-                            success: function (data1) {
-                                if (data1.count == 1) {
-                                    layer.close(index);
-                                    $("#HBarCode_P").val(HBarCode);
-                                    if (AllowLoadData()) {
-                                        //淇濆瓨鏁版嵁
-                                        set_AddAssemblyBill();
-                                    }
-                                }
-                                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"]) });
-                                }
-                                $("#HBarCodeSN").val("");
-                            },
-                            error: function (err) {
-                                layer.close(index);
-                                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"]) });
-                            }
-                        });
+                        $("#HMaterNumber").val(data1.data[0]["HMaterNumber"])
+                        $("#HMaterName").val(data1.data[0]["HMaterName"])
+                        $("#HMaterModel").val(data1.data[0]["HMaterModel"])
+                        $("#HSupID").val(data1.data[0]["HSupID"])
+                        $("#HSupName").val(data1.data[0]["HSupName"])
+                        $("#HBarCode_Batch").prop("readonly", true);
+
+                        //鍏夋爣鍦ㄩ暛闆曠爜涓�
+                        $("#HBarCode_SN").focus();
                     }
                     else {
                         layer.close(indexs);
-                        layer.msg(get_MessageError(data1.Message, sessionStorage["HTranSlate"]));
+                        layer.msg(data1.Message);
                     }
-                    //鍏夋爣璺宠浆鍒癝N鏉$爜鏂囨湰妗嗕笂
-                    //$("#HBarCodeSN").focus();
-                    $("#HBarCodeSN").val("");
+
                 },
                 error: function (err) {
                     layer.close(indexs);
@@ -579,19 +644,228 @@
             });
         }
 
-        //鍔犺浇缃戞牸
-        function get_Display() {
-            var ajaxLoad = layer.load();
+        //浜у搧SN闀洉鐮佺爜鍥炶溅鏌ヨ
+        function txtHBarCodeSN_KeyDown(HBarCode) {
+            //涓昏〃淇℃伅鏌ヨ
+            var indexs = layer.load();
+            //閰嶄欢淇℃伅鏌ヨ
+            var HBillNo = $("#HBillNo").val();
             $.ajax({
-                url: GetWEBURL() + '/Cg_POOrderBill/list',
+                type: "GET",
+                url: GetWEBURL() + "/Cj_SingleStation/HBardCodeBomList_XW",
+                async: false,
+                data: { "HBillNo": HBillNo,"HBarCode": HBarCode, "HProcID": $("#HProcID").val(), "HOrgID": sessionStorage["OrganizationID"], "user": sessionStorage["HUserName"] },
+                dataType: "json",
+                success: function (data1) {
+                    if (data1.count == 1) {
+                        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/checkHBarCode_Batch",
+                            async: false,
+                            data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
+                            dataType: "json",
+                            success: function (data1) {
+                                if (data1.count == 1) {
+                                    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(indexs);
+                                    layer.confirm(data1.Message);
+                                }
+
+                            },
+                            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"]) });
+                                return;
+                            }
+                        });
+                    }
+                    else {
+                        layer.close(indexs);
+                        $("#HBarCode_SN").val("");
+                        $("#HBarCode_SN").focus();
+                        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: "娓╅Θ鎻愮ず" });
+                    $("#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/BarCodeBillBomMatch_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("");
+
+                        layer.close(indexs);
+                    }
+                    else {
+                        layer.close(indexs);
+                        layer.msg(data1.Message);
+                    }
+                },
+                error: function (err) {
+                    layer.close(indexs);
+                    layer.msg("閿欒:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                }
+            });
+        }
+
+        //鍒囨崲浜у搧鏂规硶
+        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);
+        }
+
+        //#region 淇濆瓨鏂规硶
+        function set_SaveBill() {
+            var data = {
+                "field": {
+                    "HProcID": $("#HProcID").val(), "HBatchNo": $("#HBarCode_Batch").val(),
+                    "HGroupID": $("#HGroupID").val(), "HSourceID": $("#HSourceID").val(),
+                    "HProdOrgID": 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 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() + '/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) {
@@ -629,15 +903,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 {
@@ -782,21 +1056,74 @@
             })
         }
 
+        //琛ㄦ牸琛屽唴浜嬩欢鍒犻櫎
+        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);
+                });
+            }
+        }
 
         //闈炵┖楠岃瘉
         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) {
@@ -806,6 +1133,38 @@
             return true;
         }
 
+        //鍒犻櫎鍗曟嵁
+        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"]));
+            }
+        }
+
         //#endregion
 
     });
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_generateCaseCode.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_generateCaseCode.html"
index 5f8552f..b1362e1 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_generateCaseCode.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_generateCaseCode.html"
@@ -49,8 +49,8 @@
                             <div class="layui-tab-content" style="">
                                 <div class="layui-tab-item  layui-show">
                                     <div class="layui-input-block" style="display: inline-block; margin-left:0px;">
-                                        <label class="layui-form-label" style="padding-left:0px" id="">闇�姹傛暟閲�:</label>
-                                        <input type="text" class="layui-input" name="HNeedQty" lay-verify="HNeedQty" autocomplete="off" id="HNeedQty" value="100" style="width: 100px;float:left">
+                                        <label class="layui-form-label" style="padding-left:0px" id="">鏈�澶х鏁�:</label>
+                                        <input type="text" class="layui-input" name="HNeedQty" lay-verify="HNeedQty" autocomplete="off" id="HNeedQty" value="2" style="width: 100px;float:left" readonly>
 
                                     </div>
                                     <div class="layui-input-block" style="display: inline-block; margin-left:0px;">
@@ -58,14 +58,74 @@
                                         <input type="text" class="layui-input" name="HWeight" lay-verify="HWeight" autocomplete="off" id="HWeight" value="100" style="width: 100px;float:left">
 
                                     </div>
+                                    <div class="layui-input-block" style="display: inline-block; margin-left:0px;">
+                                        <label class="layui-form-label" style="padding-left:0px" id="">鏈�灏忛噸閲�:</label>
+                                        <input type="text" class="layui-input" name="HWeight" lay-verify="HMinWeight" autocomplete="off" id="HMinWeight" value="0" style="width: 100px;float:left">
 
+                                    </div>
+                                    <div class="layui-input-block" style="display: inline-block; margin-left:0px;">
+                                        <label class="layui-form-label" style="padding-left:0px" id="">鏈�澶ч噸閲�:</label>
+                                        <input type="text" class="layui-input" name="HWeight" lay-verify="HMaxWeight" autocomplete="off" id="HMaxWeight" value="101" style="width: 100px;float:left">
+
+                                    </div>
                                     <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
 
                                 </div>
                                 <!--鍏朵粬淇℃伅-->
                                 <div class="layui-tab-item">
                                     <div class="layui-form-item" style="padding-top: 10px;">
+
                                         <div class="layui-row">
+                                            <div class="layui-inline">
+                                                <label class="layui-form-label" style="width: 85px;padding: 9px 18px;" id="BT_HProcName">宸ュ簭</label>
+                                                <div class="layui-input-block" style="margin-left: 77px;">
+                                                    <input type="text" class="layui-input" name="HProcName" lay-verify="HProcName" id="HProcName" style="background-color: #efefef4d; width: 60%; display: inline-block;" readonly>
+                                                    <input type="hidden" name="HProcID" id="HProcID" lay-verify="HProcID" value="0">
+                                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHProc" id="btnHProc" style="padding: 0 10px;float: right;margin-right: 3px;">
+                                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
+                                                    </button>
+                                                </div>
+                                            </div>
+                                            <div class="layui-inline">
+                                                <label class="layui-form-label" style="width: 85px; padding: 9px 18px;" id="BT_HDeptName">褰撳墠杞﹂棿</label>
+                                                <div class="layui-input-block" style="margin-left: 77px;">
+                                                    <input type="text" class="layui-input" lay-verify="HDeptName" name="HDeptName" id="HDeptName" style="background-color: #efefef4d; width: 60%; display: inline-block;" readonly>
+                                                    <input type="hidden" class="layui-input" lay-verify="HDeptID" name="HDeptID" id="HDeptID">
+                                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHDept" id="btnHDept" style="padding: 0 10px;float: right;margin-right: 3px;">
+                                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
+                                                    </button>
+                                                </div>
+                                            </div>
+                                            <div class="layui-inline">
+                                                <label class="layui-form-label" style="width: 85px;padding: 9px 18px;" id="BT_HEmpName">鎿嶄綔鍛�</label>
+                                                <div class="layui-input-block" style="margin-left: 77px;">
+                                                    <input type="text" class="layui-input" lay-verify="HEmpName" name="HEmpName" id="HEmpName" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+                                                    <input type="hidden" class="layui-input" lay-verify="HEmpID" name="HEmpID" id="HEmpID" value="0">
+                                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHEmp" id="btnHEmp" style="padding: 0 10px;float: right;margin-right: 3px;">
+                                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
+                                                    </button>
+                                                </div>
+                                            </div>
+                                            <div class="layui-inline">
+                                                <label class="layui-form-label" style="width: 85px; padding: 9px 18px;" id="BT_HGroupName">鐢熶骇鐝粍</label>
+                                                <div class="layui-input-block" style="margin-left: 77px;">
+                                                    <input type="text" class="layui-input" name="HGroupName" id="HGroupName" lay-verify="HGroupName" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+                                                    <input type="hidden" class="layui-input" name="HGroupID" lay-verify="HGroupID" id="HGroupID" value="0">
+                                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHGroup" id="btnHGroup" style="padding: 0 10px;float: right;margin-right: 3px;">
+                                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
+                                                    </button>
+                                                </div>
+                                            </div>
+                                            <div class="layui-inline">
+                                                <label class="layui-form-label" style="width: 85px; padding: 9px 18px;" id="BT_HSourceName">鐢熶骇璧勬簮</label>
+                                                <div class="layui-input-block" style="margin-left: 77px;">
+                                                    <input type="text" class="layui-input" name="HSourceName" id="HSourceName" lay-verify="HSourceName" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+                                                    <input type="hidden" class="layui-input" name="HSourceID" lay-verify="HSourceID" id="HSourceID" value="0">
+                                                    <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHSource" id="btnHSource" style="padding: 0 10px;float: right;margin-right: 3px;">
+                                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
+                                                    </button>
+                                                </div>
+                                            </div>
                                             <div class="layui-inline">
                                                 <label class="layui-form-label" style="width: 85px;">鍒跺崟浜�</label>
                                                 <div class="layui-input-block" style="margin-left: 120px;">
@@ -101,12 +161,12 @@
                     <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>
+                            <!--<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 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="set_HideColumn2" id="HideColumn"><i class="layui-icon layui-icon-form"></i>鍒楄缃�</button>
                         </div>
                     </script>
@@ -116,6 +176,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({
@@ -135,10 +198,11 @@
 
         //瀹氫箟鍏ㄥ眬鍙橀噺
 
-        var HModName = "Cj_ProcessItemStationPlatform_batch";
-        var HModName2 = "Cj_ProcessItemStationPlatform_batch2";
+        var HModName = "Cj_ProcessItemStationPlatform_CaseCode";
+        var HModName2 = "Cj_ProcessItemStationPlatform_CaseCode2";
         var option = [];
         var option2 = [];
+        var barCodeData = [];//璁板綍SN鏉$爜淇℃伅
         //#endregion
 
         //#region 杩涘叆椤甸潰鍗冲姞杞�
@@ -150,11 +214,16 @@
         //#endregion
 
         //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
+
+        table.on('tool(mainTable)', function (obj) {
+            set_GridDelete(obj);   //琛屽唴鍒犻櫎
+        });
+
         //澶村伐鍏锋爮浜嬩欢
         table.on('toolbar(mainTable)', function (obj) {
             switch (obj.event) {
                 //鍒犻櫎鎸夐挳
-                case 'btn-Delete': set_DeleteBill();
+                case 'btn-Delete': btn_Delete();
                     break;
                 //鍒楄缃�
                 case 'set_HideColumn': get_HideColumnNoPage(HModName, sessionStorage["HUserName"], option, get_Display);
@@ -171,60 +240,14 @@
                     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;
-                }
-                setIntervalIndex = setInterval(setIntervalList, 30000);
-                get_BomList(HBarCode);
-                //if (option.data != 0) {
-                //    //淇濆瓨鍒颁复鏃惰〃
-                //    get_AddBomTempList();
-                //}
-                //鏌ヨ涓嶈壇璁板綍
-                get_BadRecords();
-                //鏌ヨ鍚堟牸璁板綍
-                get_HGRecords();
-
+                
+                txtHBarCode_KeyDown(HBarCode_SN);
                
             }
         });
@@ -264,7 +287,10 @@
                 Pub_Close(2);
             }
         });
-
+        //鍙樻洿
+        form.on('submit(btnSave)', function (data) {
+            set_getCaseCode();
+        });
 
         //#endregion
 
@@ -273,7 +299,7 @@
         //鍒濆鍖栫晫闈�
         function set_ClearBill() {
             //杩涘叆椤甸潰榛樿鍏夋爣鍦ㄦ祦杞崱涓�
-            $("#HBardCodeProcExchBillNo").focus();
+            $("#HBarCode_SN").focus();
             //鍒跺崟浜�
             $("#HMaker").val(sessionStorage["HUserName"]);
             $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
@@ -282,7 +308,13 @@
             //鍒濆鍖栬〃鏍�
             set_InitGrid();
             //
-            //get_Display();
+            get_Display();
+            var data = localStorage.getItem("CaseCodeDataCache");
+            if (data != null) {
+
+                option.data = JSON.parse(data);
+                table.render(option);
+            }
         }
 
         //#region 閫氳繃鐧诲綍鐢ㄦ埛鑾峰彇榛樿鍊�
@@ -317,13 +349,13 @@
                 }
             })
         }
-            //#endregion
+        //#endregion
 
-        //鍏抽敭浠舵竻鍗�
+        //褰╃洅娓呭崟
         function set_InitGrid() {
             option= {
                 elem: '#mainTable'
-                , toolbar: '#toolbarDemo'
+                //, toolbar: '#toolbarDemo'
                 , page: false
                 , totalRow: true
                 , cellMinWidth: 120
@@ -331,21 +363,21 @@
                 , 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: '褰撳墠鎵规' }
+                    { type: 'checkbox', fixed: 'left', totalRowText: '鍚堣' }
+                    , { type: 'numbers', title: '搴忓彿' }
+                    , { field: 'HItemID', title: 'HItemID', hide: true }
+                    , { field: 'HBarCode', title: '浜у搧SN鐮�' }
+                    , { field: 'HMaterID', title: 'HMaterID', hide: true  }
+                    , { field: 'HMaterNumber', title: '鐗╂枡浠g爜' }
+                    , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', totalRow: true}
+                    , { field: 'HMaterModel', 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 }
-                    , { field: 'HMaterID', title: 'HMaterID', hide: true }
-                    , { field: 'HBarCode', title: 'HBarCode', hide: true }
+                    , { field: 'HICMOBillNo', title: '鐢熶骇璁㈠崟鍙�', hide: true }
+                    , { field: 'HInterID', title: 'HInterID', hide: true }
+                    , { field: 'HWeight', title: '閲嶉噺' }
+                    , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 66 }
+                    
                 ]]
             }
             option2 = {
@@ -381,75 +413,154 @@
         
         //鏉$爜鍥炶溅鏌ヨ
         function txtHBarCode_KeyDown(HBarCode) {
+            getHBarCodeData(HBarCode);
+            //娓呯┖SN闀洉鐮佸唴瀹�
+            $("#HBarCode_SN").val("");
+            $("#HBarCode_SN").focus();
+        }
 
-            var HProcExchBillNo = $("#HProcExchBillNo").val();
-            var indexs = layer.load();
+        function getHBarCodeData(HBarCode) {
+            indexs = layer.load();
+            //鑾峰彇瀵瑰簲涓昏〃淇℃伅
             $.ajax({
                 type: "GET",
-                url: GetWEBURL() + "/Cj_SingleStation/SNHBardCodeList",
+                url: GetWEBURL() + "/Cj_SingleStation/checkHBarCode_Batch",
                 async: false,
-                data: { "HBarCode": HBarCode, "HProcExchBillNo": HProcExchBillNo, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
+                data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
                 dataType: "json",
                 success: function (data1) {
                     if (data1.count == 1) {
                         layer.close(indexs);
-                        var index = layer.load();
-
-                        $.ajax({
-                            type: "GET",
-                            url: GetWEBURL() + "/Cj_SingleStation/HBardCodeSNList",
-                            async: false,
-                            data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"] },
-                            dataType: "json",
-                            success: function (data1) {
-                                if (data1.count == 1) {
-                                    layer.close(index);
-                                    $("#HBarCode_P").val(HBarCode);
-                                    if (AllowLoadData()) {
-                                        //淇濆瓨鏁版嵁
-                                        set_AddAssemblyBill();
-                                    }
-                                }
-                                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"]) });
-                                }
-                                $("#HBarCodeSN").val("");
-                            },
-                            error: function (err) {
-                                layer.close(index);
-                                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"]) });
-                            }
-                        });
+                        barCodeData = data1.data[0];
+                        //$("#HMinWeight").val();鑾峰彇鏈�澶ф暟閲忔渶灏忛噸閲忔渶澶х鏁�
+                        //$("#HMaxWeight").val();
+                        //$("#HNeedQty").val();
+                        if (AllowLoadData()) {
+                            set_SaveBill(HBarCode);
+                        }
                     }
                     else {
                         layer.close(indexs);
-                        layer.msg(get_MessageError(data1.Message, sessionStorage["HTranSlate"]));
+                        
+                        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"]) });
                 }
             });
         }
 
-        //鍔犺浇缃戞牸
-        function get_Display() {
-            var ajaxLoad = layer.load();
+
+        //#region 杩囩珯淇濆瓨鏂规硶
+        function set_SaveBill(HBarCode) {
+            var data = {
+                "field": {
+                    "HProcID": $("#HProcID").val(), "HBatchNo": "", "HWeight": $("#HWeight").val(),
+                    "HGroupID": $("#HGroupID").val(), "HSourceID": $("#HSourceID").val(),
+                    "HProdOrgID": sessionStorage["OrganizationID"],
+                    "HEmpID": $("#HEmpID").val(), "HDeptID": $("#HDeptID").val()
+                }
+            };
+            var sMainStr = JSON.stringify(data.field);
+            var sSubStr = HBarCode;
+            var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
+            var indexs = layer.load();
             $.ajax({
-                url: GetWEBURL() + '/Cg_POOrderBill/list',
+                type: "POST",
+                url: GetWEBURL() + "/Cj_SingleStation/AddStationOutBillList",
+                async: false,
+                data: { "sMainSub": sMainSub },
+                dataType: "json",
+                success: function (data1) {
+                    if (data1.count == 1) {
+                        layer.close(indexs);
+                        //娓呭崟鍐呭瀛樺叆
+                        barCodeData.HInterID = data1.data//鑾峰彇瀵瑰簲鍑烘垬姹囨姤浣嗗唴鐮�
+                        barCodeData.HWeight = $("#HWeight").val()//閲嶉噺
+                        option.data.push(barCodeData);
+                        table.render(option)
+                        //鏈湴瀛樺偍
+                        localStorage.setItem("CaseCodeDataCache", JSON.stringify(option.data));
+
+                        $("#HReturnMessage").text("鎴愬姛鎵爜涓�涓�:" + HBarCode);
+                        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
+
+        //#region 涓鐮佺敓鎴�
+        function set_getCaseCode() {
+            const hitmidString = option.data.map(item => item.HItemID).join(",");
+            var sMainSub = hitmidString + ';' + sessionStorage["HUserName"];
+            var indexs = layer.load();
+            $.ajax({
+                type: "POST",
+                url: GetWEBURL() + "/Cj_SingleStation/AddCaseCode",
+                async: false,
+                data: { "sMainSub": sMainSub },
+                dataType: "json",
+                success: function (data1) {
+                    if (data1.count == 1) {
+                        layer.close(indexs);
+                        //娓呭崟鍐呭瀛樺叆
+                        option.data = [];
+                        table.render(option)
+                        //鏈湴瀛樺偍
+                        localStorage.setItem("CaseCodeDataCache", JSON.stringify(option.data));
+
+                        $("#HReturnMessage").text("鎴愬姛鐢熸垚涓�涓�:" + data1.data);
+                        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 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() + '/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) {
@@ -487,15 +598,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 {
@@ -508,6 +619,80 @@
                 }
             });
         }
+
+        //鍒犻櫎鍗曟嵁
+        function btn_Delete() {
+            var checkStatus = table.checkStatus('mainTable')
+                , data = checkStatus.data;
+            if (checkStatus.data.length === 1) {
+                layer.confirm(get_MessageError('[0000-1-003]纭畾鍒犻櫎' + data[0].HBarCode + '鍚楋紵', sessionStorage["HTranSlate"]), function (index) {
+                    var ajaxLoad = layer.load();
+                    //閫昏緫鍒犻櫎鏂规硶
+                    $.ajax({
+                        url: GetWEBURL() + '/Cj_StationOutBill/del_StationOutBill',
+                        type: "GET",
+                        data: { "HInterID": data[0].HInterID, "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_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() + '/Cj_StationOutBill/del_StationOutBill',
+                        type: "GET",
+                        data: { "HInterID": data.HInterID, "HDeleteMan": sessionStorage["HUserName"], "HBillSubType": "3791" },
+                        success: function (result) {
+                            if (result.count == 1) {
+                                // 鍒犻櫎 id=2 鐨勫璞★紙Bob锛�
+                                debugger
+                                const index = option.data.findIndex(item => item.HInterID === data.HInterID);
+                                if (index !== -1) {
+                                    option.data.splice(index, 1); // 浠� index 寮�濮嬪垹闄� 1 涓厓绱�
+                                }
+                                //鏈湴瀛樺偍
+                                localStorage.setItem("CaseCodeDataCache", JSON.stringify(option.data));
+                                
+                                get_Display();
+                                table.render(option);
+                                layer.close(wait);
+                            } else {
+                                layer.close(wait);
+                                layer.alert(get_MessageError(result.Message, sessionStorage["HTranSlate"]) + result.Message, { icon: 5 });
+                            }
+                        }, error: function () {
+                            layer.close(wait);
+                            layer.alert(get_MessageError("[0000-1-002]鎺ュ彛璇锋眰澶辫触!", sessionStorage["HTranSlate"]), { icon: 5 });
+                        }
+                    });
+
+                });
+            }
+        }
+
 
         //鍛樺伐閫夋嫨椤甸潰
         function btnHEmp() {
@@ -644,23 +829,29 @@
         //闈炵┖楠岃瘉
         function AllowLoadData() {
 
-            var HBarCode = $("#HBarCode_P").val();
-            if (HBarCode == "") {
-                layer.msg(get_MessageError("[0000-2-019]浜у搧SN涓嶈兘涓虹┖!", sessionStorage["HTranSlate"]))
+            let HMinWeight = +$("#HMinWeight").val();
+            let HMaxWeight = +$("#HMaxWeight").val();
+            let HWeight = +$("#HWeight").val();
+            //绗竴娆℃壂闀洉鐮�
+            if (option.data.length === 0) {
+                if (HWeight < HMinWeight || HWeight > HMaxWeight) {
+                    layer.confirm("閲嶉噺鏍¢獙澶辫触")
+                    return false;
+                }
+            } else {
+                if (HWeight < HMinWeight || HWeight > HMaxWeight) {
+                    layer.confirm("閲嶉噺鏍¢獙澶辫触")
+                    return false;
+                }
+                if (option.data[0].HMaterID != barCodeData.HMaterID) {
+                    return false;
+                }
+            }
+            if (option.data.length >= $("#HNeedQty").val()) {
+                layer.confirm("绠辨暟宸叉弧璇锋彁浜�")
                 return false;
             }
-
-            var HEmpID2 = $("#HEmpID2").val();
-            if (HEmpID2 == 0) {
-                layer.msg(get_MessageError("[0000-2-030]鎿嶄綔鍛樹笉鑳戒负绌�!", sessionStorage["HTranSlate"]))
-                return false;
-            }
-
-            //var HBadReasonID = $("#HBadReasonID").val();
-            //if (HBadReasonID == 0) {
-            //    layer.msg("涓嶈壇鍘熷洜涓嶈兘涓虹┖!")
-            //    return false;
-            //}
+           
             return true;
         }
 

--
Gitblit v1.9.1