From e50265de5ae4e5e4c8b8852e777216adab7c4ce4 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期三, 21 五月 2025 09:13:06 +0800
Subject: [PATCH] 合并分支

---
 WebTM/views/质量管理/首件检验单/QC_Add_Edit_FirstPieceCheckBill.html |  811 +++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 630 insertions(+), 181 deletions(-)

diff --git "a/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_Add_Edit_FirstPieceCheckBill.html" "b/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_Add_Edit_FirstPieceCheckBill.html"
index 5fd86d8..2510e28 100644
--- "a/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_Add_Edit_FirstPieceCheckBill.html"
+++ "b/WebTM/views/\350\264\250\351\207\217\347\256\241\347\220\206/\351\246\226\344\273\266\346\243\200\351\252\214\345\215\225/QC_Add_Edit_FirstPieceCheckBill.html"
@@ -47,19 +47,18 @@
         <div class="layui-card" style="padding: 2px;background-color: #efefef;">
             <div class="layui-card-body" style="padding: 1px;">
                 <form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
-                    <div style="padding: 10px;">
-                        <!--<button class="layui-btn layuiadmin-btn-order main-btn" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
-                            <i class="layui-icon layui-icon-print layuiadmin-button-btn"><span class="btn-title">棰勮</span></i>
-                        </button>-->
-                        <!--<button class="layui-btn layuiadmin-btn-order main-btn" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
-                            <i class="layui-icon layui-icon-edit layuiadmin-button-btn"><span class="btn-title">淇敼</span></i>
-                        </button>-->
-                        <button type="button" class="layui-btn layui-btn-normal" style="margin-left: 0px" lay-submit="" lay-filter="btn-AddNew" id="btn-AddNew">鏂板</button>
-                        <button type="button" class="layui-btn layui-btn-normal" style="margin-left: 0px" lay-submit="" lay-filter="btnSave" id="btnSave">淇濆瓨</button>
-                        <button type="button" class="layui-btn layui-btn-normal" style="margin-left: 0px" lay-submit="" lay-filter="btn-Exit" id="btn-Exit">閫�鍑�</button>
+                    <div style="position: relative; display: flex; align-items: center; padding: 10px;">
+                        <!-- 鎸夐挳缁� -->
+                        <div style="z-index: 1;">
+                            <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="btn-AddNew" id="btn-AddNew">鏂板</button>
+                            <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="btnSave" id="btnSave">淇濆瓨</button>
+                            <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="btn-Exit" id="btn-Exit">閫�鍑�</button>
+                            <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="btn-SIP" id="btn-SIP">SIP鏌ョ湅</button>
+                        </div>
+                        <!-- 鏍囬锛屼娇鐢ㄧ粷瀵瑰畾浣嶄娇鍏跺湪鐖跺鍣ㄥ唴灞呬腑 -->
+                        <h1 style="position: absolute; left: 50%; transform: translateX(-50%); z-index: 0; text-align: center; width: fit-content; margin: 0; padding: 0 10px;"><b>棣栦欢妫�楠屽崟</b></h1>
                     </div>
-                    <div class="layui-tab" lay-filter="tab-POStockInBill">
-                        <h1 style="text-align: center; padding: 10px 0;"><b>棣栦欢妫�楠屽崟</b></h1>
+                    <div class="layui-tab" lay-filter="tab-POStockInBill">                       
                         <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>
@@ -79,17 +78,27 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label" style="width: 85px;">鏃ユ湡</label>
                                             <div class="layui-input-block" style="margin-left: 120px;">
-                                                <input type="date" class="layui-input" name="HDate" id="HDate" style="padding-left: 32px; width: 110%;">
+                                                <input type="date" class="layui-input" name="HDate" id="HDate" style="padding-left: 68px;">
                                             </div>
                                         </div>
                                         <div class="layui-inline">
-                                            <label class="layui-form-label" style="width: 100px;padding: 9px 18px;">鐢熶骇璧勬簮</label>
-                                            <div class="layui-input-block" style="margin-left: 92px;">
+                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">鐢熶骇璧勬簮</label>
+                                            <div class="layui-input-block" style="margin-left: 77px;">
                                                 <input type="text" class="layui-input" name="HSourceName" id="HSourceName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
                                                 <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchSource" id="btnSearchSource" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                 </button>
                                                 <input type="hidden" name="HSourceID" id="HSourceID" value="0">
+                                            </div>
+                                        </div>
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">鐢熶骇鐝</label>
+                                            <div class="layui-input-block" style="margin-left: 77px;">
+                                                <input type="text" class="layui-input" name="HShiftsName" id="HShiftsName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+                                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHShifts" id="btnHShifts" style="padding: 0 10px;float: right;margin-right: 3px;">
+                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
+                                                </button>
+                                                <input type="hidden" name="HShiftsID" id="HShiftsID" value="0">
                                             </div>
                                         </div>
                                     </div>
@@ -98,6 +107,8 @@
                                             <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">浠诲姟鍗曞彿</label>
                                             <div class="layui-input-block" style="margin-left: 77px;">
                                                 <input type="text" class="layui-input" name="HICMOBillNo" id="HICMOBillNo" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+                                                <input type="hidden" class="layui-input" name="HICMOInterID" id="HICMOInterID" value="0" style="background-color:#efefef4d;" readonly>
+                                                <input type="hidden" name="HICMOEntryID" id="HICMOEntryID" value="0">
                                                 <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchICMOBill" id="btnSearchICMOBill" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                 </button>
@@ -106,58 +117,33 @@
                                         <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="HICMOQty" id="HICMOQty" style="background-color:#efefef4d;" readonly>
-                                            </div>
-                                        </div>
-                                        <div class="layui-inline" style="display: none">
-                                            <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="HICMOInterID" id="HICMOInterID" value="0" style="background-color:#efefef4d;" readonly>
-                                                <input type="hidden" name="HICMOEntryID" id="HICMOEntryID" value="0">
-                                            </div>
-                                        </div>
-                                    </div>
-                                    <div class="layui-row">
-                                        <div class="layui-inline" id="hidediv1">
-                                            <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="HProcExchQty" id="HProcExchQty" style="background-color:#efefef4d;" readonly value="1">
+                                                <input type="text" class="layui-input" name="HICMOQty" id="HICMOQty" style="background-color:#efefef4d;" readonly value="0">
                                             </div>
                                         </div>
                                         <div class="layui-inline" id="hidediv2">
                                             <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">娴佽浆鍗″彿</label>
                                             <div class="layui-input-block" style="margin-left: 77px;">
                                                 <input type="text" class="layui-input" name="HProcExchBillNo" id="HProcExchBillNo" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+                                                <input type="hidden" class="layui-input" name="HProcExchInterID" id="HProcExchInterID" value="0" style="background-color:#efefef4d;" readonly>
+                                                <input type="hidden" class="layui-input" name="HProcExchEntryID" id="HProcExchEntryID" value="0" style="background-color:#efefef4d;" readonly>
                                                 <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchProcExch" id="btnSearchProcExch" 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" id="hidediv1">
-                                            <label class="layui-form-label" style="width: 85px;">宸ュ簭</label>
+                                            <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="HProcName" id="HProcName" style="background-color:#efefef4d;" readonly value="1">
+                                                <input type="text" class="layui-input" name="HProcExchQty" id="HProcExchQty" style="background-color:#efefef4d;" readonly value="0">
                                             </div>
                                         </div>
                                     </div>
                                     <div class="layui-row">
-                                        <div class="layui-inline" style="display: none">
-                                            <label class="layui-form-label" style="width: 85px;">娴佽浆鍗D</label>
-                                            <div class="layui-input-block" style="margin-left: 120px;">
-                                                <input type="text" class="layui-input" name="HProcExchInterID" id="HProcExchInterID" value="0" style="background-color:#efefef4d;" readonly>
-                                            </div>
-                                        </div>
-                                        <div class="layui-inline" style="display: none">
-                                            <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="HProcExchEntryID" id="HProcExchEntryID" value="0" style="background-color:#efefef4d;" readonly>
-                                            </div>
-                                        </div>
                                         <div class="layui-inline">
                                             <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">浜у搧鍚嶇О</label>
                                             <div class="layui-input-block" style="margin-left: 77px;">
                                                 <input type="text" class="layui-input" name="HMaterName" id="HMaterName" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
-                                                <input type="text" class="layui-input" name="HMaterID" id="HMaterID" value="0" style="background-color:#efefef4d;width: 60%;display: none;" readonly>
+                                                <input type="hidden" class="layui-input" name="HMaterID" id="HMaterID" value="0" style="background-color:#efefef4d;width: 60%;display: none;" readonly>
                                                 <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchMater" id="btnSearchMater" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                 </button>
@@ -167,42 +153,70 @@
                                             <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">妫�楠屽憳</label>
                                             <div class="layui-input-block" style="margin-left: 77px;">
                                                 <input type="text" class="layui-input" name="HFirstCheckEmpName" id="HFirstCheckEmpName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+                                                <input type="hidden" name="HFirstCheckEmp" id="HFirstCheckEmp" value="0">
                                                 <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchHFirstCheckEmp" id="btnSearchHFirstCheckEmp" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                 </button>
-                                                <input type="hidden" name="HFirstCheckEmp" id="HFirstCheckEmp" value="0">
                                             </div>
                                         </div>
                                         <div class="layui-inline">
                                             <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">妫�楠屾柟妗�</label>
                                             <div class="layui-input-block" style="margin-left: 77px;">
                                                 <input type="text" class="layui-input" name="HQCSchemeName" id="HQCSchemeName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+                                                <input type="hidden" name="HQCSchemeID" id="HQCSchemeID" value="0">
                                                 <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchQCScheme" id="btnSearchQCScheme" style="padding: 0 10px;float: right;margin-right: 3px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                 </button>
-                                                <input type="hidden" name="HQCSchemeID" id="HQCSchemeID" value="0">
+
+                                            </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="HBatchNo" id="HBatchNo" style="">
+                                            </div>
+                                        </div>
+                                    </div>        
+                                    <div class="layui-row">
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label">鍒ゆ柇缁撹</label>
+                                            <div class="layui-input-block">
+                                                <input type="radio" name="HLastResult" value="true" title="鍚堟牸">
+                                                <input type="radio" name="HLastResult" value="false" title="涓嶅悎鏍�" checked>
+                                            </div>
+                                        </div>
+                                        <div class="layui-inline" id="hidediv1" style="margin-left:20px;">
+                                            <label class="layui-form-label" style="width: 85px;padding: 9px 18px;">宸ュ簭</label>
+                                            <div class="layui-input-block" style="margin-left: 77px;">
+                                                <input type="text" class="layui-input" name="HProcName" id="HProcName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
+                                                <input type="hidden" name="HProcID" id="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;">鍙栨牱鍗�</label>
+                                            <div class="layui-input-block" style="margin-left: 120px;">
+                                                <input type="text" class="layui-input" name="HTakeSampleCheckBillNo" id="HTakeSampleCheckBillNo" style="background-color:#efefef4d;" readonly>
+                                                <input type="hidden" name="HTakeSampleCheckBillID" id="HTakeSampleCheckBillID" value="0">
                                             </div>
                                         </div>
                                     </div>
                                     <div class="layui-row">
-                                    </div>
-                                    <div class="layui-row">
-                                        <div class="layui-inline" style="width: 50%;">
+                                        <div class="layui-inline" style="width: 45%;">
                                             <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="HRemark" id="HRemark" placeholder="璇疯緭鍏ュ唴瀹�" onmouseover="this.title=this.value">
                                             </div>
                                         </div>
-                                    </div>
-                                    <div class="layui-row">
-                                        <div class="layui-inline">
-                                            <label class="layui-form-label">鍒ゆ柇缁撹</label>
-                                            <div class="layui-input-block">
-                                                <input type="radio" name="HLastResult" id="HLastResult" value="true" title="鍚堟牸" checked>
-                                                <input type="radio" name="HLastResult" id="HLastResult" value="false" title="涓嶅悎鏍�">
+                                        <div class="layui-inline" style="width: 45%">
+                                            <label class="layui-form-label" style="width: 85px;">寮傚父涓存椂<br />澶勭悊鏂规</label>
+                                            <div class="layui-input-block" style="margin-left: 120px;">
+                                                <input type="text" class="layui-input" name="HErrTreatment" id="HErrTreatment" placeholder="璇疯緭鍏ュ唴瀹�" onmouseover="this.title=this.value" style="margin-top:10px;">
                                             </div>
                                         </div>
-                                    </div>
+                                    </div>                                    
                                 </div>
                             </div>
                             <!--鍒跺崟淇℃伅-->
@@ -344,13 +358,13 @@
                                     <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="HSampleQty" id="HSampleQty" style="background-color:#efefef4d;" readonly>
+                                            <input type="text" class="layui-input" name="HSampleQty" id="HSampleQty" value="0" 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="HSampleDamageQty" id="HSampleDamageQty" style="">
+                                            <input type="text" class="layui-input" name="HSampleDamageQty" id="HSampleDamageQty" value="0" style="">
                                         </div>
                                     </div>
                                 </div>
@@ -452,7 +466,7 @@
                                                 </button>
                                                 <input type="hidden" name="HQCCheckItemID" id="HQCCheckItemID" value="0">
                                             </div>
-                                        </div>                                        
+                                        </div>
                                     </div>
                                     <div class="layui-row" style="margin-top:5px;">
                                         <div class="layui-inline">
@@ -675,9 +689,11 @@
                 , laydate = layui.laydate
                 , element = layui.element;
             //鍏敤鍙橀噺
-            debugger;
+            //debugger;
             var rowdata = [];
             var option = [];
+            var HDeptID = "";//閮ㄩ棬id 鑾峰彇鐝
+            var HCenterID = "";//宸ヤ綔涓績id 鑾峰彇鐝
 
             var rowdata_Value = [];
             var option_Value = [];
@@ -692,13 +708,6 @@
             var UnRightQty_isFied = 0; //鐢ㄤ簬鍒ゆ柇鏄惁鍚堟牸//妫�楠屽�艰〃鏍间笉鍚堟牸鏁伴噺姹囨��
             var editIndex = 0;//缂栬緫涓嬫爣
             var SampleNum = [];//鏍锋湰鏁伴噺
-
-            //鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
-            //if (sessionStorage.login != "login") {
-            //    layer.confirm("鐧诲綍澶辨晥锛岃閲嶆柊鐧诲綍锛�", {
-            //        icon: 4, skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず", closeBtn: 0, btn: ['閲嶆柊鐧诲綍']
-            //    }, function () { window.location.href = "../../user/login.html"; });
-            //}
 
             //#region 銆愬姩鎬佽幏鍙栨ā鍧楀悕绉般��
             var HModuleType = "7505";
@@ -715,6 +724,7 @@
                 var linterid = params[params[1]];//婧愬崟id
                 var HSouceBillType = params[params[2]];//婧愬崟绫诲瀷
                 var HICMOEntryID = params[params[3]];//婧愬崟瀛恑d
+                var HEntryID = params[params[4]];//婧愬崟瀛恑d
             }
             /*鍥哄畾浠g爜锛屾瘡寮犲崟鎹兘瑕乥egin*/
             //////娴嬭瘯鐢ㄦ暟鎹�
@@ -722,13 +732,19 @@
             //var linterid = 11880;
             //var HSouceBillType = 3722;
             //var HICMOEntryID = 100027;
-            //鍒ゆ柇鏄惁鏂板
+
+            //鍒濆鍖栬〃鏍�
+            set_InitGrid();
+
+            //#region 鍒ゆ柇鏄惁鏂板
             if (OperationType == 1) {
                 $("#HInterID").val("");
                 $("#HBillNo").val("");
 
-                $("#HFirstCheckEmp").val(sessionStorage["HEmpID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭妫�楠屽憳ID
-                $("#HFirstCheckEmpName").val(sessionStorage["HEmpName"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭妫�楠屽憳
+                $("#HFirstCheckEmp").val(sessionStorage["HCheckEmpID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭妫�楠屽憳ID
+                $("#HFirstCheckEmpName").val(sessionStorage["HCheckEmpName"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭妫�楠屽憳
+                HDeptID = sessionStorage["HDeptID"]; //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭閮ㄩ棬ID
+                HCenterID = sessionStorage["HWorkCenterID"]; //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭宸ヤ綔涓績ID
 
                 //$('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);//鏈夋簮鍗曟椂淇濆瓨鎸夐挳绂佺敤
                 //鑾峰彇鏈�澶у崟鎹彿
@@ -744,6 +760,8 @@
                         $("#HMaker").val(sessionStorage["HUserName"]);
                     }
                 });
+                //鑾峰彇鐝
+                get_HWorkShift();
             }
             else if (OperationType == 2) {
                 $("#HInterID").val("");
@@ -756,6 +774,8 @@
 
                 $("#HFirstCheckEmp").val(sessionStorage["HEmpID"]);
                 $("#HFirstCheckEmpName").val(sessionStorage["HEmpName"]);
+                HDeptID = sessionStorage["HDeptID"]; //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭閮ㄩ棬ID
+                HCenterID = sessionStorage["HWorkCenterID"]; //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭宸ヤ綔涓績ID
                 //鑾峰彇鏈�澶у崟鎹彿
                 $.ajax({
                     url: GetWEBURL() + "/Web/GetMAXNum",
@@ -773,42 +793,60 @@
                 if (HSouceBillType == 3722 || HSouceBillType == 4610) {
                     //鏍规嵁婧愬崟id鑾峰彇婧愬崟淇℃伅
                     LoadingInformation2();
+                    //鑷姩甯﹀嚭妫�楠屾柟妗�
+                    GetCheckItemID();
                 }
                 //宸ュ簭杩涚珯鎺ユ敹鍗曞垪琛ㄩ妫�
                 else if (HSouceBillType == 3790) {
                     //鏍规嵁婧愬崟id鑾峰彇婧愬崟淇℃伅
                     LoadingInformation_StationInBill();
+                    //鑷姩甯﹀嚭妫�楠屾柟妗�
+                    GetCheckItemID();
                 }
                 //宸ュ簭濮斿鎺ユ敹鍗曞垪琛ㄩ妫�
                 else if (HSouceBillType == 3793) {
                     //鏍规嵁婧愬崟id鑾峰彇婧愬崟淇℃伅
                     LoadingInformation3();
+                    //鑷姩甯﹀嚭妫�楠屾柟妗�
+                    GetCheckItemID();
                 }
                 //鐢熶骇璁㈠崟鍒楄〃棣栨
                 else if (HSouceBillType == 3710) {
                     //鏍规嵁婧愬崟id鑾峰彇婧愬崟淇℃伅
                     LoadingInformation_ICMO();
+                    //鑷姩甯﹀嚭妫�楠屾柟妗�
+                    GetCheckItemID();
+                }
+                //宸ュ簭娴佽浆鍗″垪琛ㄩ妫�
+                else if (HSouceBillType == 3772) {
+                    //鏍规嵁婧愬崟id鑾峰彇婧愬崟淇℃伅
+                    LoadingInformation_ProcExchange();
+                    //鑷姩甯﹀嚭妫�楠屾柟妗�
+                    GetCheckItemID();
                 }
                 else {
                     layer.alert("婧愬崟绫诲瀷鏃犳晥锛�", { icon: 5 });
                 }
+                //鑾峰彇鐝
+                get_HWorkShift();
             }
             else if (OperationType == 3) {
                 RoadBillMain(linterid);
                 //RoadBillSub(linterid);
             }
+            //#endregion
 
             $("[name='btnSearchCheckItemID']").addClass("layui-btn-disabled").attr("disabled", true);//绂佺敤妫�楠岄」鐩斁澶ч暅
 
-            //鍒濆鍖栬〃鏍�
-            set_InitGrid();
 
-            //鏍规嵁婧愬崟id鑾峰彇婧愬崟淇℃伅
+            //#region 鏍规嵁婧愬崟鑾峰彇淇℃伅
+            //鏍规嵁婧愬崟id鑾峰彇婧愬崟淇℃伅(杩涚珯鎺ユ敹鍗�)
             function LoadingInformation_StationInBill() {
                 var wait = layer.load();
                 $.ajax({
                     url: GetWEBURL() + '/QC_FirstPieceCheckBill/get_StationInBill',
                     type: "GET",
+                    async: false,
                     data: { "HInterID": linterid, "user": sessionStorage["HUserName"] },
                     success: function (result) {
                         var data = result.data[0];
@@ -844,6 +882,54 @@
                 });
             }
 
+            //鏍规嵁婧愬崟id鑾峰彇婧愬崟淇℃伅(宸ュ簭娴佽浆鍗�)
+            function LoadingInformation_ProcExchange() {
+                $('#btnSearchSource').removeClass("layui-btn-disabled").attr("disabled", false);//鐢熶骇璧勬簮鎸夐挳鍚敤
+
+                var wait = layer.load();
+                $.ajax({
+                    url: GetWEBURL() + '/CheckBill/get_ProcessExchangeBill',
+                    type: "GET",
+                    async: false,
+                    data: { "HInterID": linterid, "HEntryID": HEntryID, "user": sessionStorage["HUserName"] },
+                    success: function (result) {
+                        var data = result.data[0];
+                        if (result.count == 1) {
+                            $("#HProcExchBillNo").val(data.鍗曟嵁鍙�);
+                            $("#HProcExchInterID").val(data.HInterID);
+                            $("#HProcExchEntryID").val(data.HProcExchEntryID == null ? 0 : data.HProcExchEntryID);//
+                            $("#HProcExchQty").val(data.娴佽浆鍗℃暟閲�);
+                            $("#HICMOBillNo").val(data.浠诲姟鍗�);
+                            $("#HICMOInterID").val(data.HICMOInterID);
+                            $("#HICMOQty").val(data.HICMOQty == null ? 0 : data.HICMOQty);//
+                            $("#HSourceName").val(data.鐢熶骇璧勬簮);//
+                            $("#HSourceID").val(data.HSourceID == null ? 0 : data.HSourceID);//
+                            $("#HMaterID").val(data.HMaterID);
+                            $("#HMaterName").val(data.浜у搧鍚嶇О);
+                            $("#HMainSourceBillNo").val(data.鍗曟嵁鍙�);
+                            $("#HMainSourceBillType").val(data.HBillType);
+                            $("#HMainSourceInterID").val(data.HInterID);
+                            $("#HICMOEntryID").val(data.HICMOEntryID == null ? 0 : data.HICMOEntryID);//
+                            $("#HQCSchemeName").val(data.妫�楠屾柟妗堝悕绉�);
+                            $("#HQCSchemeID").val(data.妫�楠屾柟妗圛D);
+                            $("#HProcID").val(data.HProcID);//
+                            $("#HProcName").val(data.褰撳墠宸ュ簭);//
+                            $("#HBatchNo").val(data.鎵瑰彿);
+                            HDeptID = data.HWorkShopID == null ? sessionStorage["HDeptID"] : data.HWorkShopID;//宸ヤ綔涓績id
+                            HCenterID = data.HCenterID == null ? sessionStorage["HWorkCenterID"] : data.HCenterID;//宸ヤ綔涓績id
+                            //鑾峰彇琛ㄤ綋妫�楠岄」鐩俊鎭�
+                            get_CheckItem();
+                        } else {
+                            layer.alert(result.Message, { icon: 5 });
+                        }
+                        layer.close(wait);
+                    }, error: function () {
+                        layer.close(wait);
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+
             //鏍规嵁婧愬崟id鑾峰彇婧愬崟淇℃伅--鐢熶骇璁㈠崟
             function LoadingInformation_ICMO() {
                 $("#hidediv1").attr({ "style": "display:none" });
@@ -853,6 +939,7 @@
                 $.ajax({
                     url: GetWEBURL() + '/LEMS/MES_IF_ICMOBillList_Json',
                     type: "GET",
+                    async: false,
                     data: { "sWhere": "and hmainid = " + linterid, "user": sessionStorage["HUserName"] },
                     success: function (result) {
                         var data = result.data[0];
@@ -889,6 +976,7 @@
                 $.ajax({
                     url: GetWEBURL() + "/QC_FirstPieceCheckBill/get_ICMOBillStatus_Tmp",
                     type: "GET",
+                    async: false,
                     data: { "HInterID": linterid, "HEntryID": HICMOEntryID, "HBillType": HSouceBillType },
                     success: function (result) {
                         var data = result.data[0];
@@ -910,7 +998,6 @@
                             $("#HICMOEntryID").val(data.HICMOEntryID);
                             $("#HQCSchemeName").val(data.妫�楠屾柟妗堝悕绉�);
                             $("#HQCSchemeID").val(data.妫�楠屾柟妗圛D);
-
                             //鑾峰彇琛ㄤ綋妫�楠岄」鐩俊鎭�
                             get_CheckItem();
                         } else {
@@ -930,6 +1017,7 @@
                 $.ajax({
                     url: GetWEBURL() + '/Cj_StationEntrustOutBill/list',
                     type: "GET",
+                    async: false,
                     data: { "sWhere": "and HInterID = " + linterid },
                     success: function (result) {
                         var data = result.data[0];
@@ -959,17 +1047,18 @@
                     }
                 });
             }
+            //#endregion
 
-            //澶村伐鍏锋爮浜嬩欢
+            //#region 澶村伐鍏锋爮浜嬩欢
             table.on('toolbar(mainTable)', function (obj) {
                 var checkStatus = table.checkStatus('mainTable')
                     , data = checkStatus.data;
                 //鏂板琛岃〃鏍兼暟鎹�
                 var NewRow = {
-                    "HQCCheckItemID": "", "妫�楠岄」鐩�": "", "HInspectInstruMentID": "0", "妫�楠屼华鍣�": "", "HQCStd": "", "HUnit": "", "HQCNote": "", "HAnalysisMethod": "", "HResult": "",
+                    "HQCCheckItemID": "", "妫�楠岄」鐩�": "", "HInspectInstruMentID": "0", "妫�楠屼华鍣ㄤ唬鐮�": "", "妫�楠屼华鍣�": "", "HQCStd": "", "HUnit": "", "HQCNote": "", "HAnalysisMethod": "", "HResult": "",
                     "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": false, "HStatus": 0, "HSampleSchemeID": 0, "HUnitID": 0,
-                    "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": '',
-                    "HSampleSchemeName": "", "HSampleQty": "", "HSampleDamageQty": "", "HAcceptQty": "0", "HInspectionLevel": "", "HRejectQty": "",
+                    "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": '0',
+                    "HSampleSchemeName": "", "HSampleQty": "0", "HSampleDamageQty": "0", "HAcceptQty": "0", "HInspectionLevel": "", "HRejectQty": "",
                     "HStrictness": "", "HSampleUnRightQty": "", "HAQL": "", "HSamplingType": ""
                 };
 
@@ -1007,6 +1096,7 @@
                         break;
                 }
             });
+            //#endregion
 
             //閫�鍑烘寜閽�
             form.on('submit(btn-Exit)', function (data) {
@@ -1144,6 +1234,27 @@
                     });
                 }
 
+                var data = obj.data;
+                if (obj.event == '妫�楠屼华鍣ㄤ唬鐮�') {
+                    var HNumber = data.妫�楠屼华鍣ㄤ唬鐮�;
+                    var linterid = data.HInspectInstruMentID;
+                    layer.open({
+                        type: 2
+                        , area: ['100%', '100%']
+                        , title: '鏌ョ湅妫�楠屼华鍣�'
+                        , closeBtn: 1
+                        , shade: 0.6 //閬僵閫忔槑搴�
+                        , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
+                        , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+                        , content: '../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Add_Edit_Gy_InspectInstruMent.html?OperationType=3&linterid=' + linterid + ''
+                        , resize: false,
+                        end: function () {
+                        }
+                        , cancel: function () {
+                        }
+                    })
+                }
+
                 $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
                     var rowIndex = Number($(obj.tr).attr("data-index")) + Number(1);
                     if (event.key == "F7") {
@@ -1157,7 +1268,7 @@
                                 shift: 2,
                                 area: ['90%', '90%'],
                                 maxmin: true,
-                               content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_CheckItem.html', 'yes'],
+                                content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_CheckItem.html?openType=2', 'yes'],
                                 btn: ['纭畾', '鍙栨秷']
                                 , btn1: function (index, layero) {
 
@@ -1174,7 +1285,7 @@
                                         , HQCCheckItemID: checkStatus.data[0].HItemID
                                         , HResult: HResult
                                     });
-                                    $('#HResult' + rowIndex + '').find("option[value='" + HResult + "']").attr("selected", true);                                    
+                                    $('#HResult' + rowIndex + '').find("option[value='" + HResult + "']").attr("selected", true);
                                     form.render('select');
                                     layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                                 }
@@ -1197,7 +1308,7 @@
                                 shift: 2,
                                 area: ['90%', '90%'],
                                 maxmin: true,
-                                content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_InspectInstruMentList.html', 'yes'],
+                                content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_InspectInstruMent.html?openType=2', 'yes'],
                                 btn: ['纭畾', '鍙栨秷']
                                 , btn1: function (index, layero) {
 
@@ -1210,7 +1321,8 @@
 
                                     //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                     obj.update({
-                                        妫�楠屼华鍣�: checkStatus.data[0].妫�楠屼华鍣ㄥ悕绉�
+                                        妫�楠屼华鍣ㄤ唬鐮�: checkStatus.data[0].妫�楠屼华鍣ㄤ唬鐮�
+                                        , 妫�楠屼华鍣�: checkStatus.data[0].妫�楠屼华鍣ㄥ悕绉�
                                         , HInspectInstruMentID: checkStatus.data[0].HItemID
                                     });
                                     layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
@@ -1247,7 +1359,7 @@
                                 shift: 2,
                                 area: ['90%', '90%'],
                                 maxmin: true,
-                                content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_InspectValue.html', 'yes'],
+                                content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_InspectValue.html?openType=2', 'yes'],
                                 btn: ['纭畾', '鍙栨秷']
                                 , btn1: function (index, layero) {
 
@@ -1342,7 +1454,7 @@
             //淇濆瓨
             function set_SaveBill(data) {
                 //璧嬪�兼渶鍚庝竴涓�変腑琛岀殑鏁版嵁缁檕ption.data
-                Assignment(LastIndex, LastIndex);
+                //Assignment(LastIndex, LastIndex);
                 //淇濆瓨鏈�鍚庝竴娆$偣鍑昏鐨勬楠屽��
                 set_SaveValue($("#HEntryID").val());
 
@@ -1430,7 +1542,7 @@
                 var ajaxLoad = layer.load();
                 var sWhere = " and hmainid=" + linterid;
                 $.ajax({
-                    url: GetWEBURL() + "/QC_FirstPieceCheckBill/QC_FirstPieceCheckBillList",
+                    url: GetWEBURL() + "/QC_FirstPieceCheckBill/QC_FirstPieceCheckBill_Edit",
                     type: "GET",
                     data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                     success: function (result) {
@@ -1450,6 +1562,8 @@
                                 , "HICMOEntryID": data.HICMOEntryID
                                 , "HMaterID": data.HMaterID
                                 , "HMaterName": data.鐗╂枡鍚嶇О
+                                , "HProcID": data.HProcID
+                                , "HProcName": data.HProcName
                                 , "HProcExchQty": data.HProcExchQty
                                 , "HProcExchBillNo": data.HProcExchBillNo
                                 , "HProcExchInterID": data.HProcExchInterID
@@ -1497,6 +1611,13 @@
                                 , "HEntryID": data.hsubid
                                 , "HQCCheckItemName": data.妫�楠岄」鐩悕绉�
                                 , "HQCCheckItemID": data.HQCCheckItemID
+                                , "HShiftsID": data.HShiftsID
+                                , "HShiftsName": data.鐝鍚嶇О
+                                , "HErrTreatment": data.寮傚父涓存椂澶勭悊鏂规
+                                , "HBatchNo": data.鎵瑰彿
+                                , "HLastResult": data.鍒ゅ畾缁撹 == "鍚堟牸" ? "true" : "false"
+                                , "HTakeSampleCheckBillID": data.HTakeSampleCheckBillID
+                                , "HTakeSampleCheckBillNo": data.HTakeSampleCheckBillNo
                             });
                             data = result.data;
                             //data = result.data.h_v_QC_Edit_FirstPieceCheckBillList;
@@ -1505,7 +1626,7 @@
                             for (var i = 0; i < data.length; i++) {
                                 rowdata.push(
                                     {
-                                        "HQCCheckItemID": data[i].HQCCheckItemID, "妫�楠岄」鐩�": data[i].妫�楠岄」鐩悕绉�, "HInspectInstruMentID": data[i].HInspectInstruMentID, "妫�楠屼华鍣�": data[i].妫�楠屼华鍣�, "HQCStd": data[i].妫�楠屾爣鍑�,
+                                        "HQCCheckItemID": data[i].HQCCheckItemID, "妫�楠岄」鐩唬鐮�": data[i].妫�楠岄」鐩唬鐮�, "妫�楠岄」鐩�": data[i].妫�楠岄」鐩悕绉�, "HInspectInstruMentID": data[i].HInspectInstruMentID, "妫�楠屼华鍣ㄤ唬鐮�": data[i].妫�楠屼华鍣ㄤ唬鐮�, "妫�楠屼华鍣�": data[i].妫�楠屼华鍣ㄥ悕绉�, "HQCStd": data[i].妫�楠屾爣鍑�,
                                         "HUnit": data[i].鍗曚綅鍚嶇О, "HQCNote": data[i].妫�楠岃褰�, "HResult": data[i].缁撹 == "鍚堟牸" ? 1 : 2,
                                         "HMax": data[i].鏈�澶у��, "HMin": data[i].鏈�灏忓��, "HAvg": data[i].骞冲潎鍊�, "HRemark": data[i].琛ㄤ綋澶囨敞,
                                         "HAnalysisMethod": data[i].鍒嗘瀽鏂规硶 == "瀹氭�у垎鏋�" ? 1 : (data[i].鍒嗘瀽鏂规硶 == "瀹氶噺鍒嗘瀽" ? 2 : 3), "HKeyInspect": data[i].閲嶇偣妫�鏌� == "鍚�" ? false : true,
@@ -1565,6 +1686,8 @@
 
             //琛ㄥご淇℃伅妫�楠屾柟妗堝脊绐�
             form.on('submit(btnSearchQCScheme)', function () {
+                var HName = $("#HMaterName").val();
+                var HProcName = $("#HProcName").val();
                 //椤甸潰灞�-鑷畾涔�
                 layer.open({
                     type: 2,
@@ -1574,7 +1697,7 @@
                     shift: 2,
                     area: ['90%', '90%'],
                     maxmin: true,
-                    content: ['../../璐ㄩ噺绠$悊/妫�楠屾柟妗堝崟/QC_CheckProjectList.html', 'yes'],
+                    content: ['../../璐ㄩ噺绠$悊/妫�楠屾柟妗堝崟/QC_CheckProjectList.html?OperationType=1&HName=' + HName + '&HProcName=' + HProcName + '', 'yes'],
                     btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {
 
@@ -1600,6 +1723,33 @@
 
                     }
                 });
+            });
+
+            //SIP鏌ョ湅鎸夐挳
+            form.on('submit(btn-SIP)', function () {
+                var HProcID = $("#HProcID").val();
+                var HMaterID = $("#HMaterID").val();
+                if (HProcID == 0 && HMaterID == 0) {
+                    layer.alert("鐗╂枡鍚嶇О涓庡伐搴忎笉鑳戒负绌�", { icon: 5 });
+                }
+                else {
+                    layer.open({
+                        type: 2
+                        , area: ['100%', '100%']
+                        , title: '鏌ョ湅浣滀笟鎸囧涔�'
+                        , closeBtn: 1
+                        , shade: 0.6 //閬僵閫忔槑搴�
+                        , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
+                        , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+                        , content: '../../鐢熶骇绠$悊/浣滀笟鎸囧涔�/Gy_SOPBill_Video.html?OperationType=5&HMaterID=' + HMaterID + '&HSourceNo=&HSourceEntryID=&HProcID=' + HProcID +'&HType=SIP'
+                        , resize: false,
+                        end: function () {
+                        }
+                        , cancel: function () {
+                        }
+                    })
+                }
+                
             });
 
             //#region銆愯〃浣撴斁澶ч暅銆�
@@ -1810,18 +1960,20 @@
                         $("#HUpLimit").val(checkStatus.data[0].涓婇檺鍊�);
                         $("#HDownLimit").val(checkStatus.data[0].涓嬮檺鍊�);
 
-                        option.data[$("#HEntryID").val() - 1].HSampleSchemeID = checkStatus.data[0].hmainid;
-                        option.data[$("#HEntryID").val() - 1].HSampleSchemeName = checkStatus.data[0].鎶芥牱鏂规鍚嶇О;
-                        option.data[$("#HEntryID").val() - 1].HSamplingType = checkStatus.data[0].鎶芥牱绫诲瀷;
-                        option.data[$("#HEntryID").val() - 1].HInspectionLevel = checkStatus.data[0].妫�楠屾按骞�;
-                        option.data[$("#HEntryID").val() - 1].HStrictness = checkStatus.data[0].涓ユ牸搴�;
-                        option.data[$("#HEntryID").val() - 1].HAQL = checkStatus.data[0].AQL;
-                        option.data[$("#HEntryID").val() - 1].HSampleQty = checkStatus.data[0].鏍锋湰閲�;
-                        option.data[$("#HEntryID").val() - 1].HSampleQty2 = checkStatus.data[0].鏍锋湰閲�;
-                        option.data[$("#HEntryID").val() - 1].HAcceptQty = checkStatus.data[0].鍏佽鏁�;
-                        option.data[$("#HEntryID").val() - 1].HRejectQty = checkStatus.data[0].鎷掔粷鏁�;
-                        option.data[$("#HEntryID").val() - 1].HUpLimit = checkStatus.data[0].涓婇檺鍊�;
-                        option.data[$("#HEntryID").val() - 1].HDownLimit = checkStatus.data[0].涓嬮檺鍊�;
+                        if ($("#HEntryID").val() - 1 >= 0) {
+                            option.data[$("#HEntryID").val() - 1].HSampleSchemeID = checkStatus.data[0].hmainid;
+                            option.data[$("#HEntryID").val() - 1].HSampleSchemeName = checkStatus.data[0].鎶芥牱鏂规鍚嶇О;
+                            option.data[$("#HEntryID").val() - 1].HSamplingType = checkStatus.data[0].鎶芥牱绫诲瀷;
+                            option.data[$("#HEntryID").val() - 1].HInspectionLevel = checkStatus.data[0].妫�楠屾按骞�;
+                            option.data[$("#HEntryID").val() - 1].HStrictness = checkStatus.data[0].涓ユ牸搴�;
+                            option.data[$("#HEntryID").val() - 1].HAQL = checkStatus.data[0].AQL;
+                            option.data[$("#HEntryID").val() - 1].HSampleQty = checkStatus.data[0].鏍锋湰閲�;
+                            option.data[$("#HEntryID").val() - 1].HSampleQty2 = checkStatus.data[0].鏍锋湰閲�;
+                            option.data[$("#HEntryID").val() - 1].HAcceptQty = checkStatus.data[0].鍏佽鏁�;
+                            option.data[$("#HEntryID").val() - 1].HRejectQty = checkStatus.data[0].鎷掔粷鏁�;
+                            option.data[$("#HEntryID").val() - 1].HUpLimit = checkStatus.data[0].涓婇檺鍊�;
+                            option.data[$("#HEntryID").val() - 1].HDownLimit = checkStatus.data[0].涓嬮檺鍊�;
+                        }
 
                         rowdata_Value = [];
                         for (let i = 1; i <= checkStatus.data[0].鏍锋湰閲�; i++) {
@@ -1849,11 +2001,12 @@
             //#endregion
 
             //#region銆愰�夋楠屾柟妗堣幏鍙栬〃浣撴楠岄」鐩俊鎭��
-            window.get_CheckItem = function() {
+            function get_CheckItem() {
                 var HBatchQty = $("#HProcExchQty").val();
                 $.ajax({
                     url: GetWEBURL() + "/Web/GetCheckItemByCheckProjectID",
                     type: "GET",
+                    async: false,
                     data: { "CheckProjectID": $("#HQCSchemeID").val() == '' ? 0 : $("#HQCSchemeID").val(), "HBatchQty": HBatchQty },
                     success: function (result) {
                         if (result.code == 1) {
@@ -1864,9 +2017,9 @@
                                 //瀛愯〃  璧嬪��
                                 rowdata.push(
                                     {
-                                        "HQCCheckItemID": data[i]["HQCCheckItemID"], "妫�楠岄」鐩�": data[i]["妫�楠岄」鐩�"], "HInspectInstruMentID": data[i]["HInspectInstruMentID"], "妫�楠屼华鍣�": data[i]["妫�楠屼华鍣�"], "HQCStd": data[i]["HQCStd"], "HUnit": data[i]["鍗曚綅鍚嶇О"], "HQCNote": "", "HAnalysisMethod": data[i]["鍒嗘瀽鏂规硶"], "HResult": data[i]["榛樿缁撹"],
+                                        "HQCCheckItemID": data[i]["HQCCheckItemID"], "妫�楠岄」鐩唬鐮�": data[i].妫�楠岄」鐩唬鐮�, "妫�楠岄」鐩�": data[i]["妫�楠岄」鐩�"], "HInspectInstruMentID": data[i]["HInspectInstruMentID"], "妫�楠屼华鍣ㄤ唬鐮�": data[i]["妫�楠屼华鍣ㄤ唬鐮�"], "妫�楠屼华鍣�": data[i]["妫�楠屼华鍣�"], "HQCStd": data[i]["HQCStd"], "HUnit": data[i]["鍗曚綅鍚嶇О"], "HQCNote": "", "HAnalysisMethod": data[i]["鍒嗘瀽鏂规硶"], "HResult": data[i]["榛樿缁撹"],
                                         "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": data[i]["閲嶇偣妫�鏌�"] == 1 ? true : false, "HStatus": 0, "HSampleSchemeID": data[i]["HSampleSchemeID"], "HUnitID": data[i]["HUnitID"],
-                                        "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": "",
+                                        "HInspectVal": '', "HTargetVal": '', "HUpLimit": + data[i].涓婇檺鍊�, "HDownLimit": + data[i].涓嬮檺鍊�, "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": "0",
                                         "HSampleSchemeName": data[i].鎶芥牱鏂规鍚嶇О, "HSampleQty": data[i].鏍锋湰閲�, "HAcceptQty": data[i].鍏佽鏁�, "HInspectionLevel": data[i].妫�楠屾按骞�, "HRejectQty": data[i].鎷掔粷鏁�,
                                         "HStrictness": data[i].涓ユ牸搴�, "HSampleUnRightQty": "", "HAQL": data[i].AQL, "HSamplingType": data[i].鎶芥牱绫诲瀷
                                     }
@@ -1910,9 +2063,74 @@
                     }
                 })
             }
+
+            //鐢ㄤ簬鍙屽嚮妫�楠屾柟妗堜娇鐢�
+            window.get_CheckItem1 = function () {
+                var HBatchQty = $("#HProcExchQty").val();
+                $.ajax({
+                    url: GetWEBURL() + "/Web/GetCheckItemByCheckProjectID",
+                    type: "GET",
+                    async: false,
+                    data: { "CheckProjectID": $("#HQCSchemeID").val() == '' ? 0 : $("#HQCSchemeID").val(), "HBatchQty": HBatchQty },
+                    success: function (result) {
+                        if (result.code == 1) {
+                            var rowdata = [];
+                            var data = result.data;
+                            rowdata_Value = [];
+                            for (var i = 0; i < result.data.length; i++) {
+                                //瀛愯〃  璧嬪��
+                                rowdata.push(
+                                    {
+                                        "HQCCheckItemID": data[i]["HQCCheckItemID"], "妫�楠岄」鐩唬鐮�": data[i].妫�楠岄」鐩唬鐮�, "妫�楠岄」鐩�": data[i]["妫�楠岄」鐩�"], "HInspectInstruMentID": data[i]["HInspectInstruMentID"], "妫�楠屼华鍣ㄤ唬鐮�": data[i]["妫�楠屼华鍣ㄤ唬鐮�"], "妫�楠屼华鍣�": data[i]["妫�楠屼华鍣�"], "HQCStd": data[i]["HQCStd"], "HUnit": data[i]["鍗曚綅鍚嶇О"], "HQCNote": "", "HAnalysisMethod": data[i]["鍒嗘瀽鏂规硶"], "HResult": data[i]["榛樿缁撹"],
+                                        "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": data[i]["閲嶇偣妫�鏌�"] == 1 ? true : false, "HStatus": 0, "HSampleSchemeID": data[i]["HSampleSchemeID"], "HUnitID": data[i]["HUnitID"],
+                                        "HInspectVal": '', "HTargetVal": '', "HUpLimit": + data[i].涓婇檺鍊�, "HDownLimit": + data[i].涓嬮檺鍊�, "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": "0",
+                                        "HSampleSchemeName": data[i].鎶芥牱鏂规鍚嶇О, "HSampleQty": data[i].鏍锋湰閲�, "HAcceptQty": data[i].鍏佽鏁�, "HInspectionLevel": data[i].妫�楠屾按骞�, "HRejectQty": data[i].鎷掔粷鏁�,
+                                        "HStrictness": data[i].涓ユ牸搴�, "HSampleUnRightQty": "", "HAQL": data[i].AQL, "HSamplingType": data[i].鎶芥牱绫诲瀷
+                                    }
+                                );
+                                SampleNum.push(5);
+                            }
+
+                            //妫�楠岄」鐩�
+                            for (let j = 1; j <= 5; j++) {
+                                rowdata_Value.push({
+                                    "HSEQ": j, "HInSpectResult": "", "HInSpectValueB": "", "HInSpectValueT": "", "HInSpectValue": "", "rowNum": $("#HEntryID").val()
+                                });
+                            }
+                            //妫�楠岄」鐩�
+                            option.data = rowdata;
+                            table.render(option);
+                            //妫�楠屽��
+                            option_Value.data = rowdata_Value;
+                            //console.log(JSON.stringify(option_Value.data));
+                            table.render(option_Value);
+                            //================================================
+                            for (var i = 1; i <= result.data.length; i++) {
+                                $('#HAnalysisMethod' + i + '').find("option[value='" + option.data[i - 1].HAnalysisMethod + "']").attr("selected", true);
+                                $('#HResult' + i + '').find("option[value='" + option.data[i - 1].HResult + "']").attr("selected", true);
+                            }
+                            form.render('select');
+
+                            option_Check = result.data;
+
+                            $("[name='HEntryID']").attr("value", result.data.length);
+                            $("[name='HQCCheckItemID']").attr("value", result.data[result.data.length - 1].HQCCheckItemID);
+                            $("[name='HQCCheckItemName']").attr("value", result.data[result.data.length - 1].妫�楠岄」鐩�);
+                            //榛樿閫変腑鏈�鍚庝竴琛�
+                            $("tr[data-index = " + (result.data.length - 1) + "] .layui-form-checkbox").dblclick();
+                            //$("tr[data-index = " + (result.data.length - 1) + "] .layui-form-checkbox").addClass('layui-form-checked');
+                            $("tr[data-index = " + (result.data.length - 1) + "] ").attr({ "style": "background:#ceedfa;color:black" });
+
+                            trindex = result.data.length - 1;
+                            $("#HEntryID").val() - 1
+                        }
+                    }
+                })
+            }
+
             //#endregion
 
-            //#region銆愯〃澶存斁澶ч暅銆�
+            //#region 銆愯〃澶存斁澶ч暅銆�
             //琛ㄥご淇℃伅宸ュ簭娴佽浆鍗″脊绐�
             form.on('submit(btnSearchProcExch)', function () {
                 //椤甸潰灞�-鑷畾涔�
@@ -1924,7 +2142,7 @@
                     shift: 2,
                     area: ['90%', '90%'],
                     maxmin: true,
-                    content: ['../../../views/Baseset/鍩虹璧勬枡/Sc_ProcessExchangeBillListView.html', 'yes'],
+                    content: ['../../杞﹂棿绠$悊/宸ュ簭娴佽浆鍗�/Sc_ProcessExchangeBillList.html?openType=2', 'yes'],
                     btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {
 
@@ -1963,7 +2181,7 @@
                     shift: 2,
                     area: ['90%', '90%'],
                     maxmin: true,
-                    content: ['../../鐢熶骇绠$悊/鐢熶骇浠诲姟鍗�/Sc_ICMOBillList.html', 'yes'],
+                    content: ['../../鐢熶骇绠$悊/鐢熶骇浠诲姟鍗�/Sc_ICMOBillList.html?openType=2', 'yes'],
                     btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {
 
@@ -2041,7 +2259,7 @@
                     shift: 2,
                     area: ['90%', '90%'],
                     maxmin: true,
-                    content: ['../../鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_Source.html', 'yes'],
+                    content: ['../../鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_Source.html?Htype=&openType=2', 'yes'],
                     btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {
 
@@ -2053,6 +2271,89 @@
                         }
                         $("#HSourceName").val(checkStatus.data[0].鐢熶骇璧勬簮鍚嶇О);
                         $("#HSourceID").val(checkStatus.data[0].HItemID);
+                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                        get_ICMOBillStatusList();
+                        get_QC_TakeSampleCheckBillList();
+                        GetCheckItemID();
+                    }
+                    , btn2: function (index, layero) {
+                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                    },
+                    end: function () {
+
+                    },
+                    success: function (layero, index) {
+
+                    }
+                });
+            });
+
+            //琛ㄥご淇℃伅宸ュ簭
+            form.on('submit(btnHProc)', function () {
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2,
+                    skin: 'layui-layer-rim', //鍔犱笂杈规
+                    title: '宸ュ簭鍒楄〃',
+                    closeBtn: 1,
+                    shift: 2,
+                    area: ['90%', '90%'],
+                    maxmin: true,
+                    content: ['../../鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_Process.html?openType=2', 'yes'],
+                    btn: ['纭畾', '鍙栨秷']
+                    , btn1: function (index, layero) {
+
+                        //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                        if (checkStatus.data.length === 0) {
+                            return layer.msg('璇烽�夋嫨鏁版嵁');
+                        }
+                        $("#HProcName").val(checkStatus.data[0].宸ュ簭鍚嶇О);
+                        $("#HProcID").val(checkStatus.data[0].HItemID);
+                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                        get_ICMOBillStatusList();
+                        get_QC_TakeSampleCheckBillList();
+                        GetCheckItemID();
+                    }
+                    , btn2: function (index, layero) {
+                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                    },
+                    end: function () {
+
+                    },
+                    success: function (layero, index) {
+
+                    }
+                });
+            });
+
+
+            //琛ㄥご淇℃伅鐢熶骇鐝寮圭獥
+            form.on('submit(btnHShifts)', function () {
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2,
+                    skin: 'layui-layer-rim', //鍔犱笂杈规
+                    title: '鐢熶骇鐝鍒楄〃',
+                    closeBtn: 1,
+                    shift: 2,
+                    area: ['90%', '90%'],
+                    maxmin: true,
+                    content: ['../../鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_WorkShiftList.html?type=HWorkShifts', 'yes'],
+                    btn: ['纭畾', '鍙栨秷']
+                    , btn1: function (index, layero) {
+
+                        //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+                        var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+                        if (checkStatus.data.length === 0) {
+                            return layer.msg('璇烽�夋嫨鏁版嵁');
+                        }
+                        $("#HShiftsName").val(checkStatus.data[0].鐝鍚嶇О);
+                        $("#HShiftsID").val(checkStatus.data[0].HInterID);
                         layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) {
@@ -2079,7 +2380,7 @@
                     shift: 2,
                     area: ['90%', '90%'],
                     maxmin: true,
-                    content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html', 'yes'],
+                    content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html?openType=2', 'yes'],
                     btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {
 
@@ -2093,6 +2394,7 @@
                         $("#HMaterNumber").val(checkStatus.data[0].鐗╂枡浠g爜);
                         $("#HMaterName").val(checkStatus.data[0].鐗╂枡鍚嶇О);
                         $("#HMaterID").val(checkStatus.data[0].HItemID);
+                        GetCheckItemID();
                         layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) {
@@ -2122,10 +2424,10 @@
                 $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
                 //鍒濆琛ㄦ牸鏁版嵁
                 rowdata = [{
-                    "HQCCheckItemID": "", "妫�楠岄」鐩�": "", "HInspectInstruMentID": "0", "妫�楠屼华鍣�": "", "HQCStd": "", "HUnit": "", "HQCNote": "", "HAnalysisMethod": "", "HResult": "",
+                    "HQCCheckItemID": "", "妫�楠岄」鐩�": "", "HInspectInstruMentID": "0", "妫�楠屼华鍣ㄤ唬鐮�": "", "妫�楠屼华鍣�": "", "HQCStd": "", "HUnit": "", "HQCNote": "", "HAnalysisMethod": "", "HResult": "",
                     "HMax": "", "HMin": "", "HAvg": "", "HRemark": "", "HKeyInspect": false, "HStatus": 0, "HSampleSchemeID": 0, "HUnitID": 0,
-                    "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": '',
-                    "HSampleSchemeName": "", "HSampleQty": "", "HSampleDamageQty": "", "HAcceptQty": "0", "HInspectionLevel": "", "HRejectQty": "",
+                    "HInspectVal": '', "HTargetVal": '', "HUpLimit": '', "HDownLimit": '', "HUpOffSet": '', "HDownOffSet": '', "HSampleDamageQty": '0',
+                    "HSampleSchemeName": "", "HSampleQty": "0", "HSampleDamageQty": "0", "HAcceptQty": "0", "HInspectionLevel": "", "HRejectQty": "",
                     "HStrictness": "", "HSampleUnRightQty": "", "HAQL": "", "HSamplingType": ""
                 }];
                 option = {
@@ -2139,19 +2441,27 @@
                         { type: 'checkbox', totalRowText: '鍚堣琛�' }
                         , { type: 'numbers', title: '搴忓彿', totalRow: true }
                         , { field: 'HQCCheckItemID', title: 'HQCCheckItemID', hide: true }
+                        , { field: '妫�楠岄」鐩唬鐮�', title: '妫�楠岄」鐩唬鐮�' }
                         , { field: '妫�楠岄」鐩�', title: '妫�楠岄」鐩�', edit: 'text', event: 'HQCCheckItemID' }
                         , { field: 'HInspectInstruMentID', title: 'HInspectInstruMentID', hide: true }
+                        , {
+                            field: '妫�楠屼华鍣ㄤ唬鐮�', title: '妫�楠屼华鍣ㄤ唬鐮�', totalRow: true, templet: function (d) {
+                                return '<span style="color: blue;" lay-event="妫�楠屼华鍣ㄤ唬鐮�">' + d.妫�楠屼华鍣ㄤ唬鐮� + '</span>';
+                            }, style: 'cursor: pointer;'
+                        }
                         , { field: '妫�楠屼华鍣�', title: '妫�楠屼华鍣�', edit: 'text', event: 'HInspectInstruMentID' }
                         , { field: 'HResult', title: '缁撹', templet: '#HResult', event: 'HResult' }
                         , { field: 'HAnalysisMethod', title: '鍒嗘瀽鏂规硶', templet: '#HAnalysisMethod', event: 'HAnalysisMethod' }
                         , { field: 'HKeyInspect', title: '閲嶇偣妫�鏌�', templet: '#HKeyInspect', unresize: false }
                         , { field: 'HQCStd', title: '妫�楠屾爣鍑�', edit: 'text' }
                         , { field: 'HUnit', title: '鍗曚綅', edit: 'text' }
+                        , { field: 'HInspectVal', title: '妫�楠屽��', edit: 'text' }
                         , { field: 'HQCNote', title: '妫�楠岃褰�', edit: 'text' }
+                        , { field: 'HUpLimit', title: '涓婇檺鍊�' }
+                        , { field: 'HDownLimit', title: '涓嬮檺鍊�' }
                         , { field: 'HMax', title: '鏈�澶у��', edit: 'text', totalRow: true }
                         , { field: 'HMin', title: '鏈�灏忓��', edit: 'text', totalRow: true }
                         , { field: 'HAvg', title: '骞冲潎鍊�', edit: 'text', totalRow: true }
-
                         , { field: 'HSampleSchemeID', title: '鎶芥牱鏂规ID', edit: 'text', hide: true }
                         , { field: 'HSampleSchemeName', title: '鎶芥牱鏂规', edit: 'text', hide: true }
                         , { field: 'HSampleQty', title: '鏍锋湰閲�', edit: 'text', hide: true }
@@ -2167,10 +2477,7 @@
                         , { field: 'xxx', title: '姣旇緝绗�', edit: 'text', hide: true }
                         , { field: 'HUnitID', title: '鍗曚綅ID', edit: 'text', hide: true }
                         , { field: 'HUnit', title: '鍗曚綅', edit: 'text', hide: true }
-                        , { field: 'HInspectVal', title: '妫�楠屽��', edit: 'text', hide: true }
                         , { field: 'HTargetVal', title: '鐩爣鍊�', edit: 'text', hide: true }
-                        , { field: 'HUpLimit', title: '涓婇檺鍊�', edit: 'text', hide: true }
-                        , { field: 'HDownLimit', title: '涓嬮檺鍊�', edit: 'text', hide: true }
                         , { field: 'HUpOffSet', title: '涓婂亸宸�', edit: 'text', hide: true }
                         , { field: 'HDownOffSet', title: '涓嬪亸宸�', edit: 'text', hide: true }
                         , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 85 }
@@ -2243,6 +2550,7 @@
                 table.render(option_Value);
             }
 
+
             //琛岄�夋嫨澶勭悊锛堢粨璁猴級
             form.on('select(HResult)', function (data) {
                 //鑾峰彇涓嬫媺妗嗛�変腑鐨勫��
@@ -2256,7 +2564,7 @@
 
                 //閫夋嫨鐨剆elect瀵硅薄鍊硷紱
                 var selectValue = data.value;
-                if (selectValue == 1) {
+                if (selectValue == "1") {
                     selectValue = "鍚堟牸"
                     $("#HInspectResultToSee").css("background-color", "#CEE3F2");//鏀瑰彉妫�楠岀粨鏋滆緭鍏ユ鑳屾櫙棰滆壊
                     $("#HInspectResultToSee2").css("background-color", "#CEE3F2");//鏀瑰彉妫�楠岀粨鏋滆緭鍏ユ鑳屾櫙棰滆壊
@@ -2287,12 +2595,12 @@
                 }
                 if (HQty > 0) {
                     document.querySelectorAll("[name='HLastResult']")[0].removeAttribute('checked'); //鍒犻櫎閫夋嫨灞炴��
-                    $("input:radio[name=HLastResult][value=" + false + "]").attr("checked", "true"); //娣诲姞閫夋嫨灞炴��
+                    $("input:radio[name=HLastResult][value='false']").prop("checked", "true"); //娣诲姞閫夋嫨灞炴��
                 } else {
                     document.querySelectorAll("[name='HLastResult']")[1].removeAttribute('checked'); //鍒犻櫎閫夋嫨灞炴��
-                    $("input:radio[name=HLastResult][value=" + true + "]").attr("checked", "true"); //娣诲姞閫夋嫨灞炴��
+                    $("input:radio[name=HLastResult][value='true']").prop("checked", "true"); //娣诲姞閫夋嫨灞炴��
                 }
-                form.render('radio');
+                form.render("radio");
             }
 
             ////琛岄�夋嫨澶勭悊锛堟楠岀粨鏋滐級-- 澶囦唤
@@ -2472,7 +2780,9 @@
                     set_SaveValue(dataindex + 1);
                 }
                 //璧嬪�间笌鍥炴樉
-                Assignment(nowindex, dataindex);
+                if ($("#HSampleSchemeID").val() != "0") {
+                    Assignment(nowindex, dataindex);
+                }
                 if (isHavingCount == false && OperationType != 3) {
                     var row_value = [];
                     for (let i = 0; i < SampleNum[nowindex]; i++) {
@@ -2499,7 +2809,7 @@
             //#endregion
 
 
-            //#region銆愭枃鏈鐩戝惉锛屽厜鏍囩Щ寮�鏃惰Е鍙戙��
+            //#region 銆愭枃鏈鐩戝惉锛屽厜鏍囩Щ寮�鏃惰Е鍙戙��
 
             //[ 鍒ゅ畾妫�楠屾槸鍚﹀悎鏍� ]鐩戝惉鏂囨湰妗嗙紪杈�--妫�楠屽��
             $("#HInspectVal").blur(function () {
@@ -2624,7 +2934,7 @@
 
             //#endregion
 
-            //#region銆愬垽鏂槸鍚﹀悎鏍兼柟娉曘��
+            //#region 銆愬垽鏂槸鍚﹀悎鏍兼柟娉曘��
             function Qualified(HComparator, HEntryID, HAnalysisMethod) {
                 var HInspectVal = $("#HInspectVal").val(); //妫�楠屽��
                 var HTargetVal = $("#HTargetVal").val(); //鐩爣鍊�
@@ -2635,7 +2945,7 @@
                 var HStatus = $("#HStatus").val() //鐘舵��
                 var HAcceptQty = $("#HAcceptQty").val();//鍏佽鏁�
 
-                //#region銆愬畾鎬у垎鏋愭柟娉曘��
+                //#region 銆愬畾鎬у垎鏋愭柟娉曘��
                 if (HAnalysisMethod == 1) {
                     //鐘舵�佷负鍚堟牸
                     if (HStatus == 1) {
@@ -2670,7 +2980,7 @@
                     }
                 }
                 //#endregion
-                //#region銆愬畾閲忓垎鏋愭柟娉曘��
+                //#region 銆愬畾閲忓垎鏋愭柟娉曘��
                 else if (HAnalysisMethod == 2) {
                     //鐘舵�佷负鍚堟牸
                     if (HStatus == 1) {
@@ -2829,7 +3139,7 @@
                     }
                 }
                 //#endregion
-                //#region銆愬叾浠栧垎鏋愭柟娉曘��
+                //#region 銆愬叾浠栧垎鏋愭柟娉曘��
                 else if (HAnalysisMethod == 3) {
                     //鐘舵�佷负鍚堟牸
                     if (HStatus == 1) {
@@ -2865,6 +3175,7 @@
                 }
                 //#endregion
 
+
                 form.render('select');
                 //鑾峰彇琛ㄤ綋缁撹鏁版嵁璧嬪�肩粰妫�楠岀粨鏋�
                 var HEntryID = $('#HEntryID').val();
@@ -2884,7 +3195,7 @@
             };
             //#endregion
 
-            //#region銆愯祴鍊间笌鍥炴樉銆�
+            //#region 銆愯祴鍊间笌鍥炴樉銆�
             function Assignment(nowindex, dataindex) {
                 if (SummaryIndex.indexOf(nowindex) == -1 && option.data[0].HSampleSchemeID == 0) {
                     var dataobj = {
@@ -2979,8 +3290,8 @@
                     $("#HDownLimit").val(0);
                     $("#HUpOffSet").val(0);
                     $("#HDownOffSet").val(0);
-                    $("#HSampleDamageQty").val("")
-                    $("#HSampleQty").val("")
+                    $("#HSampleDamageQty").val("0")
+                    $("#HSampleQty").val("0")
                     $("#HSampleQty2").val("")
                     $("#HAcceptQty").val("0")
                     $("#HInspectionLevel").val("")
@@ -2990,7 +3301,7 @@
                     $("#HSampleUnRightQty2").val("")
                     $("#HAQL").val("")
                     $("#HSamplingType").val("")
-                    $("#HSampleQty").val("")
+                    $("#HSampleQty").val("0")
                     $("#HInspectResultToSee").val("")
                     $("#HInspectResultToSee2").val("")
                     $("#HSampleUnRightQty").val("")
@@ -3504,48 +3815,116 @@
 
             //妫�楠屽�间繚瀛�
             function set_SaveValue(dataindex) {
-                //if (OperationType == 3) {
-                //    EchoValue();
-                //}
-                //for (let i = 0; i < table.cache['ValueTable'].length; i++) {
-                //    if (table.cache['ValueTable'][i].HInSpectValueB == "" || table.cache['ValueTable'][i].HInSpectValueB == null) {
-                //        table.cache['ValueTable'][i].HInSpectValueB = 0
-                //    }
-                //    if (table.cache['ValueTable'][i].HInSpectValueT == "" || table.cache['ValueTable'][i].HInSpectValueT == null) {
-                //        table.cache['ValueTable'][i].HInSpectValueT = 0
-                //    }
-                //    if (table.cache['ValueTable'][i].HInSpectValue == "" || table.cache['ValueTable'][i].HInSpectValue == null) {
-                //        table.cache['ValueTable'][i].HInSpectValue = 0
-                //    }
-                //}
-                //var sValueTable = JSON.stringify(table.cache['ValueTable']);
-                //var HInterID = $("#HInterID").val();
-                //var HEntryID = dataindex;
-                //var msg = sValueTable + ";" + HInterID + ";" + HEntryID
+                if (OperationType == 3) {
+                    EchoValue();
+                }
+                for (let i = 0; i < table.cache['ValueTable'].length; i++) {
+                    if (table.cache['ValueTable'][i].HInSpectValueB == "" || table.cache['ValueTable'][i].HInSpectValueB == null) {
+                        table.cache['ValueTable'][i].HInSpectValueB = 0
+                    }
+                    if (table.cache['ValueTable'][i].HInSpectValueT == "" || table.cache['ValueTable'][i].HInSpectValueT == null) {
+                        table.cache['ValueTable'][i].HInSpectValueT = 0
+                    }
+                    if (table.cache['ValueTable'][i].HInSpectValue == "" || table.cache['ValueTable'][i].HInSpectValue == null) {
+                        table.cache['ValueTable'][i].HInSpectValue = 0
+                    }
+                }
+                var sValueTable = JSON.stringify(table.cache['ValueTable']);
+                var HInterID = $("#HInterID").val();
+                var HEntryID = dataindex;
+                var msg = sValueTable + ";" + HInterID + ";" + HEntryID
 
-                //var index = layer.load();
-                //$.ajax({
-                //    type: "POST",
-                //    url: GetWEBURL() + "/QC_FirstPieceCheckBill/set_SaveValue",
-                //    async: true,
-                //    data: { "msg": msg },
-                //    dataType: "json",
-                //    success: function (data) {
-                //        if (data.count == 1) {
-                //            layer.close(index);
-                //            //$('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);//淇濆瓨鎸夐挳
-                //        }
-                //        else {
-                //            layer.close(index);
-                //            layer.msg("妫�楠屽�间繚瀛橀敊璇紒" + data.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                //        }
-                //    },
-                //    error: function (err) {
-                //        layer.close(index);
-                //        layer.msg("妫�楠屽�间繚瀛橀敊璇�:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                //    }
-                //});
+                var index = layer.load();
+                $.ajax({
+                    type: "POST",
+                    url: GetWEBURL() + "/QC_FirstPieceCheckBill/set_SaveValue",
+                    async: true,
+                    data: { "msg": msg },
+                    dataType: "json",
+                    success: function (data) {
+                        if (data.count == 1) {
+                            layer.close(index);
+                            //$('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);//淇濆瓨鎸夐挳
+                        }
+                        else {
+                            layer.close(index);
+                            layer.msg("妫�楠屽�间繚瀛橀敊璇紒" + data.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        }
+                    },
+                    error: function (err) {
+                        layer.close(index);
+                        layer.msg("妫�楠屽�间繚瀛橀敊璇�:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    }
+                });
             }
+
+            //鏍规嵁鐢熶骇璧勬簮鎴栬�� 宸ュ簭 鏌ヨ鐢熶骇宸ュ崟淇℃伅
+            function get_ICMOBillStatusList() {
+                var sWhere = "";
+                var HProcID = $("#HProcID").val();
+                var HSourceID = $("#HSourceID").val();
+                var HProcExchInterID = $("#HProcExchInterID").val();
+
+                if (HProcID != "0") {
+                    sWhere += " and HProcID=" + HProcID;
+                }
+                if (HSourceID != "0") {
+                    sWhere += " and HSourceID=" + HSourceID
+                }
+
+                sWhere += " and HSourceInterID=" + HProcExchInterID;
+
+                $.ajax({
+                    url: GetWEBURL() + "/CheckBill/GetICMOBillStatusList",
+                    type: "GET",
+                    async: false,
+                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
+                    success: function (result) {
+                        if (result.count == 1) {
+                            $("#HProcID").val(result.data[0]["HProcID"]);
+                            $("#HProcName").val(result.data[0]["宸ュ簭"]);
+                            $("#HSourceID").val(result.data[0]["HSourceID"]);
+                            $("#HSourceName").val(result.data[0]["鐢熶骇璧勬簮"]);
+
+                        } else {
+                            layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        }
+                    },
+                    error: function (err) {
+                        layer.msg("鎺ュ彛璇锋眰澶辫触锛�" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    }
+                })
+            }
+
+            //鍙栨牱鍗曟煡璇�
+            function get_QC_TakeSampleCheckBillList() {
+                var HProcID = $("#HProcID").val();
+                var HProcExchInterID = $("#HProcExchInterID").val();
+                var sWhere = "";
+
+                if (HProcID == "0" || HProcID == "") {
+                    return layer.msg("璇烽�夋嫨宸ュ簭!");
+                }
+                sWhere = " and 宸ュ簭娴佽浆鍗′富鍐呯爜='" + HProcExchInterID + "' and HProcID=" + HProcID;
+                $.ajax({
+                    url: GetWEBURL() + "/QC_TakeSampleCheckBill/QC_TakeSampleCheckBillMainList",
+                    type: "GET",
+                    async: false,
+                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
+                    success: function (result) {
+                        if (result.count == 1) {
+                            if (result.data.length > 0) {
+                                $("#HTakeSampleCheckBillID").val(result.data[0]["hmainid"]);
+                                $("#HTakeSampleCheckBillNo").val(result.data[0]["鍗曟嵁鍙�"]);
+                            }
+                        }
+                    },
+                    error: function (err) {
+                        layer.msg("鎺ュ彛璇锋眰澶辫触锛�" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    }
+                })
+            }
+
 
             //#region銆愰殣钘忔娴嬪�煎瓧娈点��
             function IsHide(HAnalysisMethod_Value) {
@@ -3656,27 +4035,43 @@
             }
             //#endregion
 
-            //#region 銆愬簾寮冧唬鐮併��
+            //#region 銆愬簾寮冧唬鐮�(鏂帿灏斿凡鍚敤)銆�
             table.on('edit(mainTable)', function (obj) {
+                var cell = $(this);
+                var rowIndex = cell.closest('tr').data('index'); // 鑾峰彇褰撳墠琛屾暟鎹储寮�
                 // 鍗曞厓鏍肩紪杈戜箣鍓嶇殑鍊�
                 var oldText = $(this).prev().text();
                 var value = obj.value //寰楀埌淇敼鍚庣殑鍊�
                     , data = obj.data //寰楀埌鎵�鍦ㄨ鎵�鏈夐敭鍊�
                     , field = obj.field; //寰楀埌瀛楁
-                //layer.msg('[ID: ' + data.id + '] ' + field + ' 瀛楁鏇存敼涓猴細' + value);
-
                 var HInspectVal = $("#HInspectVal").val(); //妫�楠屽��
                 var HTargetVal = $("#HTargetVal").val(); //鐩爣鍊�
                 var HComparator = $("#HComparator").val(); //姣旇緝绗�
-                var HEntryID = $("#HEntryID").val() - 1;
+                var HEntryID = rowIndex;
                 var HAnalysisMethod = table.cache["mainTable"][HEntryID].HAnalysisMethod; //鍒嗘瀽鏂规硶
+                var HUpLimit = table.cache["mainTable"][HEntryID].HUpLimit; //涓婇檺鍊�
+                var HDownLimit = table.cache["mainTable"][HEntryID].HDownLimit; //涓嬮檺鍊�
                 switch (field) {
                     case "HInspectVal":  //妫�楠屽��
-                        value = isNaN(value) ? 0 : value;
-                        if (HInspectVal) {
+                        value = isNaN(value) ? 0 : parseFloat(value);
+                        if (HAnalysisMethod == "2") {
+                            if (value <= HUpLimit && value >= HDownLimit) {
+                                obj.update({
+                                    "HResult": "1"
+                                });
 
+                                $('#HResult' + (HEntryID + 1)).find("option[value='1']").attr("selected", true);
+
+                            } else {
+                                obj.update({
+                                    "HResult": "2"
+                                });
+
+                                $('#HResult' + (HEntryID + 1)).find("option[value='2']").attr("selected", true);
+                            }
+                            form.render('select');
+                            LastResult();
                         }
-
                         break;
                     case "HTargetVal":  //鐩爣鍊�
                         value = isNaN(value) ? 0 : value;
@@ -3716,6 +4111,55 @@
             }
             //#endregion
 
+            //鑷姩甯﹀嚭妫�楠屾柟妗�
+            function GetCheckItemID() {
+                var HName = $("#HMaterName").val();
+                var HProName = $("#HProcName").val();
+                var HSourceID = $("#HSourceID").val();
+                if (HName != '' && HName != undefined && HProName != '' && HProName != undefined) {
+                    $.ajax({
+                        url: GetWEBURL() + "/Web/GetCheckItemID",
+                        type: "GET",
+                        async: false,
+                        data: { "HName": HName, "HProName": HProName,"HSourceID": HSourceID },
+                        success: function (result) {
+                            if (result.code == 1) {
+                                $("#HQCSchemeID").val(result.data[0].hmainid);
+                                $("#HQCSchemeName").val(result.data[0].妫�楠屾柟妗堝悕绉�);
+                                get_CheckItem();
+                            } else {
+                                layer.msg(result.code + result.Message, { icon: 5 });
+                            }
+                        }
+                    })
+                }
+            }
+
+            //鑾峰彇鐝
+            function get_HWorkShift() {
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/Gy_ShiftsController/Get_HWorkShift", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    data: {
+                        "HDeptID": HDeptID,
+                        "HCenterID": HCenterID
+                    },
+                    success: function (data) {
+                        if (data.count == 1)// 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                        {
+                            var LoadData = data.data;
+                            $("#HShiftsID").val(LoadData[0].HInterID); //褰撳墠宸ュ簭ID
+                            $("#HShiftsName").val(LoadData[0].鐝); //褰撳墠宸ュ簭
+                        }
+                        else {
+                            layer.alert(data.Message, { icon: 5 });
+                        }
+                    },
+                    error: function (err) {
+                        layer.alert(err, { icon: 5 });
+                    }
+                });
+            }
             //浠ヤ笂涓簂ayui妯″潡
         });
 
@@ -3741,6 +4185,7 @@
             $("#HMaterNumber").val(obj[0].鐗╂枡浠g爜);
             $("#HMaterName").val(obj[0].鐗╂枡鍚嶇О);
             $("#HMaterID").val(obj[0].HItemID);
+            GetCheckItemID();
         }
 
         function GetHEmpValue(obj) {  //璐ㄦ鍛�
@@ -3751,9 +4196,13 @@
         function GetCheckProjectValue(obj) {  //璐ㄦ鏂规
             $("#HQCSchemeID").val(obj[0].hmainid);
             $("#HQCSchemeName").val(obj[0].妫�楠屾柟妗堝悕绉�);
-            get_CheckItem();
-        }        
-
+            get_CheckItem1();
+        }
+        //鐝
+        function GetHWorkShiftsValue(obj) {
+            $("#HShiftsName").val(obj[0].鐝鍚嶇О);
+            $("#HShiftsID").val(obj[0].HInterID);
+        }
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1