From e192600a773d5b4afe4c5ad3d4a13773c0f61d29 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 26 五月 2025 09:18:31 +0800
Subject: [PATCH] 报表更新

---
 WebTM/views/生产管理/生产开工单/Sc_Add_MESBeginWorkBillList.html | 1568 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 1,253 insertions(+), 315 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_Add_MESBeginWorkBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_Add_MESBeginWorkBillList.html"
index 660eb42..76bca7b 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_Add_MESBeginWorkBillList.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\345\274\200\345\267\245\345\215\225/Sc_Add_MESBeginWorkBillList.html"
@@ -2,15 +2,78 @@
 <html>
 <head>
     <meta charset="utf-8" />
-    <title>鏂板/缂栬緫寮�宸ュ崟</title>
+    <title>鐢熶骇寮�宸ュ崟</title>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <!--寮曠敤layui鏍峰紡鏂囦欢-->
     <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
     <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
+    <!--寮曠敤layui js鏂囦欢-->
+    <script src="../../../layuiadmin/layui/layui.js"></script>
+    <script src="../../../layuiadmin/Scripts/json2.js"></script>
+    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
+    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
+    <script src="../../../layuiadmin/PubCustom.js"></script>
+    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
     <style type="text/css">
         .layui-form-label {
             width: 85px;
+        }
+
+        .maintitle {
+            background-color: #1492ff;
+            color: #fff;
+            padding: 5px 10px;
+            border: none;
+            border-radius: 4px;
+        }
+
+        .title {
+            border-left: 4px solid #1492ff;
+            padding-left: 6px;
+            margin: 20px 10px 4px;
+            font-size: 16px;
+            color: #333;
+        }
+
+        .buttom_box_little {
+            width: 60px;
+            height: 36px;
+            color: #fff;
+            background-color: #1492ff;
+            border-radius: 4px;
+            border: none;
+            margin: 10px;
+        }
+
+        .layui-input {
+            width: 93%;
+        }
+
+        .layui-inline, img {
+            display: block;
+            vertical-align: middle
+        }
+
+        .layui-input, .layui-textarea {
+            display: inline-block;
+            width: 100%;
+            padding-left: 10px;
+        }
+
+        .laydate-time-list ol {
+            overflow-x: hidden !important;
+            overflow-y: auto !important;
+        }
+
+        .layui-form-label {
+            padding: 9px 5px;
+        }
+
+        .layui-input-block {
+            margin-left: 85px;
+            min-height: 36px;
         }
     </style>
 </head>
@@ -23,83 +86,255 @@
                     <form id="form0" class="layui-form" lay-filter="component-form-group" action="">
                         <div class="layui-card-header">
                             <div class="layui-btn-group">
-
-                                <button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">淇濆瓨</button>
+                                <button type="button" id="Saver" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">淇濆瓨</button>
+                                <button type="button" id="VerIfySaver" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="VerIfySaver">瀹℃牳</button>
                                 <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">閫�鍑�</button>
-
-
                             </div>
 
                         </div>
                         <div class="layui-card-body">
                             <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
-                                <!--<ul class="layui-tab-title">
-                                <li class="layui-this">鍩烘湰淇℃伅</li>-->
-                                <!--<li>鍏朵粬淇℃伅</li>-->
-                                <!--</ul>-->
                                 <h1 style="text-align:center;"><b>鐢熶骇寮�宸ュ崟</b></h1>
                                 <div class="layui-tab-content">
-                                    <div class="layui-tab-item layui-show">
-                                        <div class="layui-form-item">
-                                            <div class="layui-inline">
-                                                <label class="layui-form-label">鍗曟嵁鍙�</label>
-                                                <div class="layui-input-inline">
-                                                    <input class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" readonly="readonly" autocomplete="off">
-                                                    <input id="HInterID" name="HInterID" type="hidden" />
-                                                    <input id="HMaker" name="HMaker" type="hidden" /><!--鍒跺崟浜�-->
-                                                </div>
-                                            </div>
-                                            <div class="layui-inline">
-                                                <label class="layui-form-label">鏃ユ湡</label>
-                                                <div class="layui-input-inline">
-                                                    <input class="layui-input" name="HDate" id="HDate" autocomplete="off" model="datetime" dateFormat="yyyy-MM-dd" placeholder="yyyy-MM-dd">
-                                                </div>
-                                            </div>
-                                            <div class="layui-inline">
-                                                <label class="layui-form-label">閮ㄩ棬</label>
-                                                <div class="layui-input-inline">
-                                                    <input type="text" name="HDeptName" id="HDeptName" class="layui-input" value="0" style="float:left;width:150px;">
-                                                    <input type="hidden" name="HDeptID" id="HDeptID" class="layui-input" value="0" style="float:left;width:150px;">
-                                                    <button type="button" lay-submit="" class="layui-btn layui-btn-primary" lay-filter="Department" style="width:40px;">
-                                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
-                                                    </button>
-                                                </div>
-                                            </div>
-                                            <div class="layui-inline">
-                                                <label class="layui-form-label">鐝粍</label>
-                                                <div class="layui-input-inline">
-                                                    <input type="text" name="HGroupName" id="HGroupName" class="layui-input" value="0" style="float:left;width:150px;">
-                                                    <input type="hidden" name="HGroupID" id="HGroupID" class="layui-input" value="0" style="float:left;width:150px;">
-                                                    <button type="button" lay-submit="" class="layui-btn layui-btn-primary" lay-filter="HGroupList" style="width:40px;">
-                                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
-                                                    </button>
-                                                </div>
-                                            </div>
+                                    <div class="layui-tab layui-tab-card">
+                                        <ul class="layui-tab-title">
+                                            <li class="layui-this">鍩烘湰淇℃伅</li>
+                                            <li>鍒跺崟淇℃伅</li>
+                                        </ul>
+                                        <div class="layui-tab-content" style="height: 400px;">
+                                            <div class="layui-tab-item layui-show">
+                                                <div class="layui-form-item">
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鍗曟嵁鍙�:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" disabled autocomplete="off">
+                                                            <input id="HInterID" name="HInterID" type="hidden" />
 
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鍗曟嵁鏃ユ湡:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input class="layui-input" name="HDate" id="HDate" disabled autocomplete="off" model="datetime" dateFormat="yyyy-MM-dd" placeholder="yyyy-MM-dd">
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">褰撳墠宸ュ簭:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input class="layui-input" name="HProcName" lay-verify="HProcName" id="HProcName" disabled autocomplete="off">
+                                                            <input id="HProcID" name="HProcID" value="0"  type="hidden" />
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <div class="layui-form-item">
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">浜у搧浠g爜</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" name="HMaterCode" id="HMaterCode" class="layui-input" value="" style="float:left;width:150px;">
+                                                            <input type="hidden" name="HMaterID" id="HMaterID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HMaterList" id="HMaterList" style="width:40px;">
+                                                                <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                            </button>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">浜у搧鍚嶇О:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input class="layui-input" name="HMaterName" lay-verify="HMaterName" id="HMaterName" autocomplete="off">
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">瑙勬牸鍨嬪彿:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input class="layui-input" name="HMaterSpec" lay-verify="HMaterSpec" id="HMaterSpec" autocomplete="off">
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <div class="layui-form-item">
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">寮�宸ユ椂闂�:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input class="layui-input" name="HBeginWorkTime" id="HBeginWorkTime" autocomplete="off" model="datetime" dateFormat="yyyy-MM-dd" placeholder="yyyy-MM-dd">
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鐢熶骇璧勬簮</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" name="HSourceName" id="HSourceName" class="layui-input" value="" style="float:left;width:150px;">
+                                                            <input type="hidden" name="HSourceID" id="HSourceID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HSourceList" id="HSourceList" style="width:40px;">
+                                                                <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                            </button>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鎿嶄綔鍛�:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" name="HEmpName" id="HEmpName" class="layui-input" value="" style="float:left;width:150px;">
+                                                            <input type="hidden" name="HEmpID" id="HEmpID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" id="HEmpList" style="width:40px;">
+                                                                <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                            </button>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <div class="layui-form-item">
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">婧愬崟绫诲瀷</label>
+                                                        <div class="layui-input-inline">
+                                                            <select name="SourceType" lay-filter="SourceType" id="SourceType">
+                                                                <option value="2">鐢熶骇浠诲姟鍗�</option>
+                                                                <option value="1" selected="selected">鎵嬪伐褰曞叆</option>
+                                                            </select>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">婧愬崟鍗曞彿</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" name="HMainSourceBillNo" id="HMainSourceBillNo" class="layui-input" value="" style="float:left;width:150px;">
+                                                            <input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                            <input type="hidden" name="HMainSourceBillType" id="HMainSourceBillType" class="layui-input" value="0">
+                                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="XDHList" id="XDHList" style="width:40px;">
+                                                                <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                            </button>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline" style="display:none">
+                                                        <label class="layui-form-label">婧愬崟琛屽彿:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input class="layui-input" name="HMainSourceEntryID" lay-verify="HMainSourceEntryID" id="HMainSourceEntryID" value="0"  autocomplete="off" disabled>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鐢熶骇璁㈠崟:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input class="layui-input" name="HICMOBillNo" lay-verify="HICMOBillNo" id="HICMOBillNo" autocomplete="off">
+                                                            <input id="HICMOInterID" name="HICMOInterID" type="hidden" value="0"  />
+                                                            <input id="HICMOEntryID" name="HICMOEntryID" type="hidden" value="0"  />
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <div class="layui-form-item">
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鐢熶骇鐝粍:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" name="HGroupName" id="HGroupName" class="layui-input" value="" style="float:left;width:150px;">
+                                                            <input type="hidden" name="HGroupID" id="HGroupID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HGroupList" id="HGroupList" style="width:40px;">
+                                                                <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                            </button>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">杞﹂棿:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" name="HDeptName" id="HDeptName" class="layui-input" value="" style="float:left;width:150px;">
+                                                            <input type="hidden" name="HDeptID" id="HDeptID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HDeptList" id="HDeptList" style="width:40px;">
+                                                                <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                            </button>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鐢熶骇鐝:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" name="HWorkShiftName" id="HWorkShiftName" class="layui-input" value="" style="float:left;width:150px;">
+                                                            <input type="hidden" name="HWorkShiftID" id="HWorkShiftID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HWorkShiftList" id="HWorkShiftLists" style="width:40px;">
+                                                                <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                            </button>
+                                                        </div>
+                                                    </div>
+
+                                                </div>
+                                            </div>
+                                            <div class="layui-tab-item">
+                                                <div class="layui-form-item">
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鍒跺崟浜�:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" class="layui-input" name="HMaker" id="HMaker" style="background-color:#efefef4d;" disabled>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">淇敼浜�:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" class="layui-input" name="HUpDater" id="HUpDater" style="background-color:#efefef4d;" disabled>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">瀹℃牳浜�:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" class="layui-input" name="HChecker" id="HChecker" style="background-color:#efefef4d;" disabled>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <div class="layui-form-item">
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鍒跺崟鏃ユ湡:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="datetime" class="layui-input" name="HMakeDate" id="HMakeDate" style="background-color:#efefef4d;" dateFormat="yyyy-MM-dd" placeholder="yyyy-MM-dd" disabled>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">淇敼鏃ユ湡:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="datetime" class="layui-input" name="HUpDateDate" id="HUpDateDate" style="background-color:#efefef4d;" dateFormat="yyyy-MM-dd" placeholder="yyyy-MM-dd" disabled>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">瀹℃牳鏃ユ湡:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="datetime" class="layui-input" name="HCheckDate" id="HCheckDate" style="background-color:#efefef4d;" dateFormat="yyyy-MM-dd" placeholder="yyyy-MM-dd" disabled>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <div class="layui-form-item">
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鍏抽棴浜�:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" class="layui-input" name="HCloseMan" id="HCloseMan" style="background-color:#efefef4d;" disabled>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">浣滃簾浜�:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="text" class="layui-input" name="HDeleteMan" id="HDeleteMan" style="background-color:#efefef4d;" disabled>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <div class="layui-form-item">
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">鍏抽棴鏃ユ湡:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="datetime" class="layui-input" name="HCloseDate" id="HCloseDate" style="background-color:#efefef4d;" dateFormat="yyyy-MM-dd" placeholder="yyyy-MM-dd" disabled>
+                                                        </div>
+                                                    </div>
+                                                    <div class="layui-inline">
+                                                        <label class="layui-form-label">浣滃簾鏃ユ湡:</label>
+                                                        <div class="layui-input-inline">
+                                                            <input type="datetime" class="layui-input" name="HDeleteDate" id="HDeleteDate" style="background-color:#efefef4d;" dateFormat="yyyy-MM-dd" placeholder="yyyy-MM-dd" disabled>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                            </div>
                                         </div>
-                                        <div class="layui-form-item">
-                                            <div class="layui-inline">
-                                                <label class="layui-form-label">璧勬簮</label>
-                                                <div class="layui-input-inline">
-                                                    <input type="text" name="HSourceName" id="HSourceName" class="layui-input" value="0" style="float:left;width:150px;">
-                                                    <input type="hidden" name="HSourceID" id="HSourceID" class="layui-input" value="0" style="float:left;width:150px;">
-                                                    <button type="button" lay-submit="" class="layui-btn layui-btn-primary" lay-filter="HSourceList" style="width:40px;">
-                                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
-                                                    </button>
+                                    </div>
+                                </div>
+                                <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>
+                                    </ul>
+                                    <div class="layui-tab-content">
+                                        <!--瀛愯〃-->
+                                        <div class="layui-tab-item layui-show">
+                                            <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
+                                            <script type="text/html" id="toolbarDemo">
+                                                <div class="layui-btn-container">
+                                                    <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine"><i class="layui-icon layui-icon-form"></i>澧炲姞涓�琛�</button>
+                                                    <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>澶嶅埗涓�琛�</button>
                                                 </div>
-                                            </div>
-                                            <div class="layui-inline">
-                                                <label class="layui-form-label">寮�宸ユ棩鏈�</label>
-                                                <div class="layui-input-inline">
-                                                    <input class="layui-input" name="HBeginWorkTime" id="HBeginWorkTime" autocomplete="off" model="datetime" dateFormat="yyyy-MM-dd" placeholder="yyyy-MM-dd">
-                                                </div>
-                                            </div>
-                                            <div class="layui-inline">
-                                                <label class="layui-form-label">澶囨敞</label>
-                                                <div class="layui-input-inline">
-                                                    <textarea placeholder="璇疯緭鍏ョ淮澶囨敞" class="layui-textarea" name="HRemark" id="HRemark"></textarea>
-                                                </div>
-                                            </div>
+                                            </script>
                                         </div>
                                     </div>
                                 </div>
@@ -110,31 +345,33 @@
             </div>
         </div>
     </div>
-    <script type="text/html" id="barDemo">
-        <!--<a class="layui-btn layui-btn-xs" lay-event="edit">缂栬緫</a>-->
-        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
-    </script>
-    <script src="../../../layuiadmin/layui/layui.js"></script>
-    <script src="../../../layuiadmin/Scripts/json2.js"></script>
-    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
-    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
     <script>
-//鑾峰彇鍙傛暟
-        function getUrlVars() {
-            var vars = [], hash;
-            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
-            for (var i = 0; i < hashes.length; i++) {
-                hash = hashes[i].split('=');
-                vars.push(hash[0]);
-                vars[hash[0]] = hash[1];
-            }
-            return vars;
+        //鑾峰彇鍙傛暟
+        var OptionData = [];
+        var HBillType = "";  //鍗曟嵁绫诲瀷
+        var HSourceInterID = ""; //婧愬崟涓诲唴鐮�
+        var HSourceEntryID = "";  //婧愬崟瀛愬唴鐮�
+        var HSourceBillNo = "";   //婧愬崟鍗曞彿
+        var HSourceBillType = "";  //婧愬崟绫诲瀷
+        var refSav = "";   //鎻愪氦绫诲瀷
+        //鑾峰彇椤甸潰璺宠浆鍙傛暟  //鍗曟嵁缂栬緫鐘舵�侊細 1.鏃犳簮鍗曟柊澧灺� 聽2.鏈夋簮鍗曟柊澧灺� 聽3.缂栬緫聽 4.娴忚聽 5.鍙樻洿
+        var params = get_UrlVars();
+        if (typeof (params[params[0]]) == "undefined") {
+            var OperationType = 1;//鎿嶄綔绫诲瀷
+        } else {
+            var OperationType = params[params[0]];//鎿嶄綔绫诲瀷
+            var linterid = params[params[1]];//婧愬崟id
+            var HSBillType = params[params[2]];//婧愬崟绫诲瀷
         }
 
+        var edit = function (data) {
+            HBillType = data[0].HBillType;
+            HSourceInterID = data[0].HSourceInterID;
+            HSourceEntryID = data[0].HSourceEntryID;
+            HSourceBillNo = data[0].HSourceBillNo;
+            HSourceBillType = data[0].HSourceBillType;
 
-
-        var params = getUrlVars();
-        var hID = params[params[0]];//缂栬緫鏌ョ湅
+        }
 
 
         layui.config({
@@ -142,6 +379,7 @@
         }).extend({
             index: 'lib/index' //涓诲叆鍙fā鍧�
         }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
+            //#region 鍏敤鍙橀噺
             var $ = layui.$
                 , admin = layui.admin
                 , layer = layui.layer
@@ -149,49 +387,247 @@
                 , form = layui.form
                 , laydate = layui.laydate
                 , element = layui.element;
+            //#endregion
 
-            //甯歌鐢ㄦ硶
-            laydate.render({
-                elem: '#HDate',
-            });
-            laydate.render({
-                elem: '#HBeginWorkTime'
-            });
-            //鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
-            //if (sessionStorage.login != "login") {
-            //    layer.confirm("鐧诲綍澶辨晥锛岃閲嶆柊鐧诲綍锛�", {
-            //        icon: 4, skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず", closeBtn: 0, btn: ['閲嶆柊鐧诲綍']
-            //    }, function () { window.location.href = "../../user/login.html"; });
-            //}
+            //瀹氫箟鍙橀噺 鐢ㄤ簬鑾峰彇褰撳墠鐝
+            var HCenterID = "";
+
+            //鍒濆鍖栬〃鍗曟彃浠�
+            set_InitFrom();
+
+            //鍒ゆ柇鎿嶄綔绫诲瀷
+            if (OperationType == 1) {//鏃犳簮鍗�
+                $("#HEmpID").val(sessionStorage["HEmpID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛業D
+                $("#HEmpName").val(sessionStorage["HEmpName"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛�
+                $("#HGroupID").val(sessionStorage["HGroupID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍ID
+                $("#HGroupName").val(sessionStorage["HGroup"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍
+                HCenterID = sessionStorage["HWorkCenterID"]; //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭宸ヤ綔涓績ID
+                //鍒濆鍖栬鍒掕〃
+                get_InitGrid();
+                set_AddFNew();
+                //鑾峰彇褰撳墠鐝
+                get_HWorkShift();
+            }
+            else if (OperationType == 2) {//鏈夋簮鍗�
+                $("#HEmpID").val(sessionStorage["HEmpID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛業D
+                $("#HEmpName").val(sessionStorage["HEmpName"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛�
+                $("#HGroupID").val(sessionStorage["HGroupID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍ID
+                $("#HGroupName").val(sessionStorage["HGroup"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍
+                HCenterID = sessionStorage["HWorkCenterID"]; //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭宸ヤ綔涓績ID
+                //鍒濆鍖栬鍒掕〃
+                get_InitGrid();
+                set_AddNew();
+                //鑾峰彇褰撳墠鐝
+                get_HWorkShift();
+            }
+            else if (OperationType == 3) {//缂栬緫
+                //鍒濆鍖栬鍒掕〃
+                get_InitGrid();
+                set_EditFromGrid();
+            }
+            else {
+                layer.alert("鏈煡鎿嶄綔绫诲瀷锛�", { icon: 5 });
+            }
+           
+            //鍒濆鍖栨彃浠�
+            function set_InitFrom() {
+                //鏃ユ湡鏃堕棿閫夋嫨鍣�
+                laydate.render({
+                    elem: '#HBeginWorkTime'
+                    , type: 'datetime'
+                });
+                laydate.render({
+                    elem: '#HEndDate'
+                    , type: 'datetime'
+                });
+                laydate.render({
+                    elem: '#HDate'
+                    , type: 'datetime'
+                });
+                laydate.render({
+                    elem: '#HMakeDate'
+                    , type: 'datetime'
+                });
+                laydate.render({
+                    elem: '#HUpDateDate'
+                    , type: 'datetime'
+                });
+                laydate.render({
+                    elem: '#HCheckDate'
+                    , type: 'datetime'
+                });
+                laydate.render({
+                    elem: '#HCloseDate'
+                    , type: 'datetime'
+                });
+                laydate.render({
+                    elem: '#HDeleteDate'
+                    , type: 'datetime'
+                });
+            }
+
+            //鏃犳簮鍗曟柊澧�
+            function set_AddFNew() {
+                //鍔犳簮鍗曠被鍨嬪尯鍒�(鍙互鍐欎笉鍚岀殑鏂规硶)
+
+            }
 
 
 
-            function RoadBillMain(hID)//鍔犺浇琛ㄥご
-            {
-                //alert(hID);
-                //鏌ヨ妫�楠屾柟妗堝崟鏄惁瀛樺湪
+            //鏈夋簮鍗曟柊澧�
+            function set_AddNew() {
+                refSav = "Add";
+                //鍒濆鍩烘湰淇℃伅璧嬪��
+                $("#HDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));      //鍗曟嵁鏃ユ湡
+                $("#HBeginWorkTime").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"))  //寮�宸ユ棩鏈�
+                $("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));  //鍒跺崟鏃ユ湡
+                $("#HMaker").val(sessionStorage["HUserName"]);     //鍒跺崟浜�
+
+                //鍔犳簮鍗曠被鍨嬪尯鍒�(鍙互鍐欎笉鍚岀殑鏂规硶)
+
+                $('#HMaterCode').attr("disabled", true);
+                $('#HMaterList').addClass("layui-btn-disabled").attr("disabled", true);
+                $('#HMaterName').attr("disabled", true);
+                $('#HMaterSpec').attr("disabled", true);
+                $('#HBeginWorkTime').attr("disabled", true);
+                $('#HSourceName').attr("disabled", true);
+                $('#HSourceList').addClass("layui-btn-disabled").attr("disabled", true);
+                $('#HMainSourceBillNo').attr("disabled", true);
+                $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
+                $('#HDeptName').attr("disabled", true);
+                $('#HDeptList').addClass("layui-btn-disabled").attr("disabled", true);
+                $('#SourceType').attr("disabled", true);
+                form.render('select');
+                $('#HICMOBillNo').attr("disabled", true);
+
+                $.ajax(
+                    {
+                        type: "GET",
+                        url: GetWEBURL() + "/Sc_MESBeginWorkBill/GetMESBeginWorkFrom", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        async: false,
+                        data: {
+                            "HSourceInterID": HSourceInterID,
+                            "HSourceEntryID": HSourceEntryID,
+                            "HSourceBillNo": HSourceBillNo,
+                            "HSourceBillType": HBillType
+                        },
+                        dataType: "json",
+                        success: function (data) {
+                            if (data.count == 1)// 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            {
+                                var LoadData = data.data.h_p_JIT_GetInfoByICMOStatusInterID;
+                                $("#HProcID").val(LoadData[0].HProcID); //褰撳墠宸ュ簭ID
+                                $("#HProcName").val(LoadData[0].HProcName); //褰撳墠宸ュ簭
+                                $("#HMaterID").val(LoadData[0].HMaterID); //浜у搧ID
+                                $("#HMaterCode").val(LoadData[0].HMaterNumber); //浜у搧浠g爜
+                                $("#HMaterName").val(LoadData[0].HMaterName); //浜у搧鍚嶇О
+                                $("#HMaterSpec").val(LoadData[0].HModel); //浜у搧瑙勬牸
+                                $("#HSourceID").val(LoadData[0].HSourceID); //鐢熶骇璧勬簮ID
+                                $("#HSourceName").val(LoadData[0].HSourceName); //鐢熶骇璧勬簮
+                                $("#HMainSourceBillNo").val(LoadData[0].HSourceBillNo); //婧愬崟鍗曞彿
+                                $("#HMainSourceInterID").val(LoadData[0].HSourceInterID); //婧愬崟涓诲唴鐮�(鍙栧�糎InterID)
+                                $("#HMainSourceEntryID").val(LoadData[0].HSourceEntryID); //婧愬崟瀛愬唴鐮�(婧愬崟琛屽彿)
+                                $("#HMainSourceBillType").val(HSourceBillType); //婧愬崟绫诲瀷
+                                $("#HDeptID").val(LoadData[0].HDeptID); //杞﹂棿ID
+                                $("#HDeptName").val(LoadData[0].HDeptName); //杞﹂棿
+                                $("#HICMOInterID").val(LoadData[0].HICMOInterID); //鐢熶骇璁㈠崟ID
+                                $("#HICMOEntryID").val(LoadData[0].HICMOEntryID); //鐢熶骇璁㈠崟瀛怚D
+                                $("#HICMOBillNo").val(LoadData[0].HICMOBillNo); //鐢熶骇璁㈠崟
+                                HCenterID = LoadData[0].HCenterID == null ? sessionStorage["HWorkCenterID"] : LoadData[0].HCenterID;//宸ヤ綔涓績id
+                            }
+                            else {
+                                layer.alert(data.Message, { icon: 5 });
+
+                            }
+                        },
+                        error: function (err) {
+                            layer.alert(err, { icon: 5 });
+                        }
+                    });
+            }
+
+            //缂栬緫
+            function set_EditFromGrid() {
+                refSav = "Update";
+                $('#HMaterCode').attr("disabled", true);
+                $('#HMaterList').addClass("layui-btn-disabled").attr("disabled", true);
+                $('#HMaterName').attr("disabled", true);
+                $('#HMaterSpec').attr("disabled", true);
+                $('#HBeginWorkTime').attr("disabled", true);
+                $('#HSourceName').attr("disabled", true);
+                $('#HSourceList').addClass("layui-btn-disabled").attr("disabled", true);
+                $('#HMainSourceBillNo').attr("disabled", true);
+                $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
+                $('#HDeptName').attr("disabled", true);
+                $('#HDeptList').addClass("layui-btn-disabled").attr("disabled", true);
+                $('#SourceType').attr("disabled", true);
+                form.render('select');
+                $('#HICMOBillNo').attr("disabled", true);
+
                 $.ajax({
                     url: GetWEBURL() + "Sc_MESBeginWorkBill/Sc_MESBeginWorkBillListCheckDetai",
                     type: "GET",
                     data: {
-                        "HID": hID
+                        "HID": linterid
                     },
                     success: function (result) {
 
                         if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                            var data = result.data.h_v_Sc_MESBeginWorkBillList_NEW[0];
+                            var data = result.data.h_v_Sc_MESBeginWorkBillList_Edit[0];
+                            var tableSub = result.data.h_v_Sc_MESBeginWorkBillList_Edit;
                             form.val("component-form-group", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
-                                "HBillNo": data.鍗曟嵁鍙�
-                                , "HDate": formatDate(data.鏃ユ湡)
-                                , "HDeptID": data.HDeptID                  //閮ㄩ棬ID
-                                , "HDeptName": data.閮ㄩ棬鍚嶇О               //閮ㄩ棬鍚嶇О
-                                , "HGroupID": data.HGroupID                //鐝粍ID
-                                , "HGroupName": data.鐝粍鍚嶇О              //鐝粍鍚嶇О
+                                "HInterID": data.hmainid
+                                , "HBillNo": data.鍗曟嵁鍙�
+                                , "HDate": Format(data.鏃ユ湡)
+                                , "HProcID": data.HProcID
+                                , "HProcName": data.宸ュ簭鍚嶇О
+                                , "HMaterID": data.HMaterID
+                                , "HMaterCode": data.浜у搧浠g爜
+                                , "HMaterName": data.浜у搧鍚嶇О
+                                , "HMaterSpec": data.瑙勬牸鍨嬪彿
+                                , "HBeginWorkTime": Format(data.寮�宸ユ椂闂�)
                                 , "HSourceID": data.HSourceID              //璧勬簮ID
                                 , "HSourceName": data.璧勬簮鍚嶇О             //璧勬簮鍚嶇О
-                                , "HBeginWorkTime": formatDate(data.寮�宸ユ椂闂�)//寮�宸ユ棩鏈�
+                                , "HEmpID": data.HEmpID                   //鎿嶄綔鍛業D
+                                , "HEmpName": data.鐢宠寮�宸ヤ汉鍛�           //鎿嶄綔鍛�
+                                , "HMainSourceInterID": data.HMainSourceInterID                 //婧愬崟ID
+                                , "HMainSourceEntryID": data.HMainSourceEntryID                 //婧愬崟瀛怚D
+                                , "HMainSourceBillNo": data.HMainSourceBillNo                 //婧愬崟鍗曞彿
+                                , "HMainSourceBillType": data.HMainSourceBillType               //婧愬崟绫诲瀷
+                                , "HGroupID": data.HGroupID                //鐝粍ID
+                                , "HGroupName": data.鐝粍鍚嶇О              //鐝粍鍚嶇О
+                                , "HDeptID": data.HDeptID                  //閮ㄩ棬ID
+                                , "HDeptName": data.閮ㄩ棬鍚嶇О               //閮ㄩ棬鍚嶇О
+                                , "HICMOInterID": data.HICMOInterID                       //鐢熶骇璁㈠崟涓籌D
+                                , "HICMOEntryID": data.HICMOEntryID                        //鐢熶骇璁㈠崟瀛怚D
+                                , "HICMOBillNo": data.HICMOBillNo                        //鐢熶骇璁㈠崟
                                 , "HRemark": data.澶囨敞                    //澶囨敞
+                                , "HMaker": data.鍒跺崟浜�                            //鍒跺崟浜�
+                                , "HMakeDate": data.鍒跺崟鏃ユ湡                          //鍒跺崟鏃ユ湡
+                                , "HUpDater": sessionStorage["HUserName"]             //淇敼浜�
+                                , "HUpDateDate": Format(new Date(), "yyyy-MM-dd hh:mm:ss")//淇敼鏃ユ湡
+                                , "HChecker": data.瀹℃牳浜�             //瀹℃牳浜�
+                                , "HCheckDate": data.瀹℃牳鏃ユ湡   //瀹℃牳鏃ユ湡
+                                , "HCloseMan": data.鍏抽棴浜�                //鍏抽棴浜�
+                                , "HCloseDate": data.鍏抽棴鏃ユ湡             //鍏抽棴鏃ユ湡
+                                , "HDeleteMan": data.浣滃簾浜�               //浣滃簾浜�
+                                , "HDeleteDate": data.浣滃簾鏃ユ湡       //浣滃簾鏃ユ湡
+
                             });
+                            //瀛愯〃  璧嬪��
+                            var rowdata = [];
+                            for (var i = 0; i < tableSub.length; i++) {
+                                rowdata.push(
+                                    {
+                                        "HRelationBillInterID": tableSub[i].HRelationBillInterID, "HRelationBillEntryID": tableSub[i].HRelationBillEntryID, "HRelationBillNo": tableSub[i].HRelationBillNo, "HRelationBillType": tableSub[i].HRelationBillType,
+                                        "HICMOInterID": tableSub[i].鐢熶骇璁㈠崟鍐呯爜, "HICMOEntryID": tableSub[i].鐢熶骇璁㈠崟瀛愬唴鐮�, "HICMOBillNo": tableSub[i].鐢熶骇璁㈠崟, "HRemark": tableSub[i].澶囨敞,
+                                        "HProcExchInterID": tableSub[i].HProcExchInterID, "HProcExchEntryID": tableSub[i].HProcExchEntryID, "HProcExchBillNo": tableSub[i].HProcExchBillNo,
+                                        "HMaterID": tableSub[i].HMaterID, "HMaterName": tableSub[i].浜у搧鍚嶇О, "HProcID": tableSub[i].HProcID, "HProcName": tableSub[i].宸ュ簭鍚嶇О,
+                                    }
+                                )
+                            }
+                            option.data = rowdata;
+                            table.render(option);
 
                         } else {
                             layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
@@ -200,17 +636,10 @@
                         layer.alert("鍙戠敓閿欒!", { icon: 5 });
                     }
                 });
-            }
-
-
-            var date = new Date();
-            var day = date.getDate();
-            var month = date.getMonth() + 1;
-            var year = date.getFullYear();
-            var shijian = year + "-" + month + "-" + day;
+            }            
 
             //鍒ゆ柇鏄惁鏂板
-            if (hID == null || hID == 0) {
+            if (linterid == null || linterid == 0) {
                 //鑾峰彇鏈�澶у崟鎹彿 new
                 $("#HInterID").val("0");
                 $("#HBillNo").val("");
@@ -219,33 +648,101 @@
                     type: "GET",
                     data: { "HBillType": '3787' },
                     success: function (d) {
-                        console.log(d);
-                        //console.log(d.data);
                         $("#HBillNo").val(d.data[0].HBillNo);
-                        $("#HDate").val(shijian);
-                        $("#HBeginWorkTime").val(shijian);
                         $("#HInterID").val(0);
                     }
                 });
             }
             else {//濡傛灉淇敼鍒欒蛋涓嬮潰 new
-                $("#HInterID").val(hID);//淇敼鏃朵富琛↖D
-                RoadBillMain(hID);
-                /* RoadBillSub(linterid);*/
+                $("#HInterID").val(linterid);//淇敼鏃朵富琛↖D
             }
 
-            //琛ㄥご淇℃伅閮ㄩ棬寮圭獥
-            form.on('submit(Department)', function () {
+            //鑾峰彇涓嬫媺閫変腑鍊�
+            form.on('select(SourceType)', function (data) {
+                Sctag = data.value;
+                form.render('select');
+                if (Sctag != "2")  //鏃犳簮鍗�
+                {
+                    $("#HMainSourceInterID").val("");
+                    $("#HMainSourceEntryID").val("");
+                    $("#HMainSourceBillNo").val("");
+                    $("#HMainSourceBillType").val("");
+                    $('#HMainSourceBillNo').attr("disabled", false);
+                    $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
+                    OperationType = 1;
+                }
+                else {
+                    $('#HMainSourceBillNo').attr("disabled", true);
+                    $('#XDHList').removeClass("layui-btn-disabled").attr("disabled", false);
+                    OperationType = 2;
+                }
+            });
+
+            //淇濆瓨鎻愪氦
+            form.on('submit(Saver)', function (data) {
+                //绂佺敤淇濆瓨鎸夐挳
+                $('#Saver').addClass("layui-btn-disabled").attr("disabled", true);
+                //鍒ゆ柇绯荤粺鍙傛暟鏄惁鍕鹃��
+                Xt_AllowLoadData(data);
+
+            });
+
+            //瀹℃牳鎸夐挳鎻愪氦
+            form.on('submit(VerIfySaver)', function (data) {
+                SaveVerify();
+            });
+
+            //瀹℃牳鎻愪氦
+            function SaveVerify(HName) {
+                var InterID = $("#HInterID").val();
+                if (!AllowLoadData())//鏁版嵁楠岃瘉
+                {
+                    return false;
+                }
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/Sc_MESBeginWorkBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    async: true,
+                    data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": HName },
+                    dataType: "json",
+                    success: function (data) {
+                        if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            layer.msg(data.Message, { time: 1 * 2000, icon: 1 }, function (index) {
+                                //layer.close(layer.index);
+                                //window.parent.location.reload();
+                                $('#VerIfySaver').addClass("layui-btn-disabled").attr("disabled", true);//瀹℃牳鎸夐挳绂佺敤
+                            });
+                        }
+                        else {
+                            layer.alert(data.Message, { icon: 5 })
+                        }
+                    },
+                    error: function (err) {
+                        layer.alert(err, { icon: 5 })
+                    }
+                })
+            }
+
+
+            //閫�鍑�
+            form.on('submit(Exit)', function (data) {
+                Pub_Close(1);
+                parent.location.reload();
+            });
+
+
+            //琛ㄥご淇℃伅浜у搧寮圭獥
+            form.on('submit(HMaterList)', function () {
                 //椤甸潰灞�-鑷畾涔�
                 layer.open({
                     type: 2,
                     skin: 'layui-layer-rim', //鍔犱笂杈规
-                    title: '閮ㄩ棬鍒楄〃',
+                    title: '浜у搧鍒楄〃',
                     closeBtn: 1,
                     shift: 2,
                     area: ['80%', '80%'],
                     maxmin: true,
-                    content: ['../../PublicPage/DeptInformation.html', 'yes'],
+                    content: ['../../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html', 'yes'],
                     btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {
 
@@ -255,8 +752,10 @@
                         if (checkStatus.data.length === 0) {
                             return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
-                        $("#HDeptName").val(checkStatus.data[0].HName);
-                        $("#HDeptID").val(checkStatus.data[0].HItemID);
+                        $("#HMaterName").val(checkStatus.data[0].鐗╂枡鍚嶇О);
+                        $("#HMaterNumber").val(checkStatus.data[0].鐗╂枡浠g爜);
+                        $("#HMaterID").val(checkStatus.data[0].HItemID);
+                        $("#HMaterSpec").val(checkStatus.data[0].瑙勬牸鍨嬪彿);
                         layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) {
@@ -272,6 +771,83 @@
                 });
             });
 
+            //鐢熶骇璧勬簮
+            form.on('submit(HSourceList)', function () {
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2,
+                    skin: 'layui-layer-rim', //鍔犱笂杈规
+                    title: '璧勬簮鍒楄〃',
+                    closeBtn: 1,
+                    shift: 2,
+                    area: ['80%', '80%'],
+                    maxmin: true,
+                    content: ['../../../鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_Source.html', '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('璇烽�夋嫨鏁版嵁');
+                        }
+                        $("#HSourceName").val(checkStatus.data[0].鐢熶骇璧勬簮鍚嶇О);
+                        $("#HSourceID").val(checkStatus.data[0].HItemID);
+                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) {
+                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                    },
+                    end: function () {
+
+                    },
+                    success: function (layero, index) {
+
+                    }
+                });
+            });
+
+            //鎿嶄綔鍛�
+            form.on('submit(HEmpList)', function () {
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2,
+                    skin: 'layui-layer-rim', //鍔犱笂杈规
+                    title: '浜哄憳鍒楄〃',
+                    closeBtn: 1,
+                    shift: 2,
+                    area: ['80%', '80%'],
+                    maxmin: true,
+                    content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_EmployeeList.html?type=HEmp', '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('璇烽�夋嫨鏁版嵁');
+                        }
+                        $("#HEmpName").val(checkStatus.data[0].鑱屽憳鍚嶇О);
+                        $("#HEmpID").val(checkStatus.data[0].HItemID);
+                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) {
+                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                    },
+                    end: function () {
+
+                    },
+                    success: function (layero, index) {
+
+                    }
+                });
+            });
+
+            //婧愬崟鍗曞彿 XDHList
 
             //琛ㄥご淇℃伅鐝粍寮圭獥
             form.on('submit(HGroupList)', function () {
@@ -284,7 +860,7 @@
                     shift: 2,
                     area: ['80%', '80%'],
                     maxmin: true,
-                    content: ['../../PublicPage/GroupInformation.html', 'yes'],
+                    content: ['../../鍩虹璧勬枡/宸ヨ祫鍩虹璧勬枡/Gy_Group.html?type=HGroup', 'yes'],
                     btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {
 
@@ -294,7 +870,7 @@
                         if (checkStatus.data.length === 0) {
                             return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
-                        $("#HGroupName").val(checkStatus.data[0].HName);
+                        $("#HGroupName").val(checkStatus.data[0].鐝粍鍚嶇О);
                         $("#HGroupID").val(checkStatus.data[0].HItemID);
                         layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
@@ -311,8 +887,8 @@
                 });
             });
 
-            //琛ㄥご淇℃伅璧勬簮寮圭獥
-            form.on('submit(HSourceList)', function () {
+            //琛ㄥご淇℃伅杞﹂棿寮圭獥
+            form.on('submit(HDeptList)', function () {
                 //椤甸潰灞�-鑷畾涔�
                 layer.open({
                     type: 2,
@@ -322,7 +898,7 @@
                     shift: 2,
                     area: ['80%', '80%'],
                     maxmin: true,
-                    content: ['../../PublicPage/SourceInformation.html', 'yes'],
+                    content: ['../../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_DepartmentList.html', 'yes'],
                     btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {
 
@@ -332,8 +908,8 @@
                         if (checkStatus.data.length === 0) {
                             return layer.msg('璇烽�夋嫨鏁版嵁');
                         }
-                        $("#HSourceName").val(checkStatus.data[0].HName);
-                        $("#HSourceID").val(checkStatus.data[0].HItemID);
+                        $("#HDeptName").val(checkStatus.data[0].閮ㄩ棬鍚嶇О);
+                        $("#HDeptID").val(checkStatus.data[0].HItemID);
                         layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
                     , btn2: function (index, layero) {
@@ -348,203 +924,565 @@
                     }
                 });
             });
-           
 
-           
+            //琛ㄥご淇℃伅鐝寮圭獥
+            form.on('submit(HWorkShiftList)', function () {
+                //椤甸潰灞�-鑷畾涔�
+                layer.open({
+                    type: 2,
+                    skin: 'layui-layer-rim', //鍔犱笂杈规
+                    title: '鐝鍒楄〃',
+                    closeBtn: 1,
+                    shift: 2,
+                    area: ['80%', '80%'],
+                    maxmin: true,
+                    content: ['../../鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_WorkShiftList.html?type=HWorkShifts&OperationType=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('璇烽�夋嫨鏁版嵁');
+                        }
+                        $("#HWorkShiftName").val(checkStatus.data[0].鐝鍚嶇О);
+                        $("#HWorkShiftID").val(checkStatus.data[0].HInterID);
+                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) {
+                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                    },
+                    end: function () {
 
+                    },
+                    success: function (layero, index) {
 
-            form.on('submit(Exit)', function () {//
-                var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
-                parent.layer.close(index); //鍐嶆墽琛屽叧闂�
+                    }
+                });
             });
 
 
+            //#region 瀛愯〃锛氬ご宸ュ叿鏍忎簨浠�
+            table.on('toolbar(mainTable)', function (obj) {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+
+                //鏂板琛岃〃鏍兼暟鎹�
+                var NewRow =
+                {
+                    "HMaterID": "0"
+                    , "HMaterName": ""
+                    , "HProcID": "0"
+                    , "HProcName": ""
+                    , "HRelationBillInterID": "0"
+                    , "HRelationBillEntryID": "0"
+                    , "HRelationBillType": ""
+                    , "HRelationBillNo": ""
+                    , "HICMOInterID": "0"
+                    , "HICMOEntryID": "0"
+                    , "HICMOBillNo": ""
+                    , "HProcExchInterID": "0"
+                    , "HProcExchEntryID": "0"
+                    , "HProcExchBillNo": ""
+                    , "HRemark": ""
+                    , "HSourceInterID": "0"
+                    , "HSourceEntryID": "0"
+                    , "HSourceBillNo": ""
+                    , "HSourceBillType": ""
+                };
+                switch (obj.event) {
+                    case 'btn-AddLine':
+                        table.cache["mainTable"].push(NewRow);
+                        option.data = table.cache["mainTable"];
+                        table.render(option);
+
+                        break;
+                    case 'btn-CopyLine':
+                        var copydata = JSON.stringify(data);
+                        if (data.length <= 0) {
+                            layer.msg("璇烽�夋嫨闇�瑕佸鍒剁殑涓�琛岋紒");
+                        }
+                        else if (data.length > 1) {
+                            layer.msg("鍙兘閫夋嫨澶嶅埗涓�琛岋紒");
+                        }
+                        else {
+                            var copydata2 = copydata.substring(1, copydata.length);//鍘婚櫎棣栬瀛楃'['
+                            var copyrow = copydata2.substring(0, copydata2.length - 1);//鍘婚櫎鏈熬瀛楃']'
+                            table.cache["mainTable"].push(JSON.parse(copyrow));//灏嗗鍒剁殑琛屽己杞垚json杩藉姞鍒拌〃鏍间笂
+                            option.data = table.cache["mainTable"];//灏嗘暟鎹粦瀹氬埌data涓�
+                            table.render(option);//灏嗘暟鎹覆鏌撳埌琛ㄦ牸涓�
+                        }
+                        break;
+                    //涓婁竴琛�
+                    case 'btn_up':
+                        btn_up(data);
+                        break;
+                    //涓嬩竴琛�
+                    case 'btn_under':
+                        btn_under(data);
+                        break;
+                }
+            });
+            //#endregion
+
+            //#region 瀛愯〃锛氳鍐呬簨浠�
+            table.on('tool(mainTable)', function (obj) {
+                set_GridDelete(obj);   //琛屽唴鍒犻櫎
+                set_GridCellCheck(obj); //琛屽唴蹇嵎閿瓫閫�
+
+            });
+            //#endregion
+
+            //#region 璁″垝琛ㄥ垵濮嬪寲
+            function get_InitGrid() {
+                option = {
+                    elem: '#mainTable'
+                    , toolbar: '#toolbarDemo'
+                    , limit: 100
+                    , totalRow: true
+                    , cellMinWidth: 120
+                    , height: 400
+                    , cols: [[
+                        { type: 'checkbox', totalRowText: '鍚堣琛�' }
+                        , { type: 'numbers', title: '搴忓彿', style: 'background-color: #f9f9f9;' }
+                        , { field: 'HRelationBillInterID', title: '鍏宠仈鍓骇璁″垝鍗曞唴鐮�', hide: true }
+                        , { field: 'HRelationBillEntryID', title: '鍏宠仈鍓骇璁″垝鍗曞瓙鍐呯爜', hide: true }
+                        , { field: 'HRelationBillType', title: '鍏宠仈鍓骇璁″垝鍗曠被鍨�', hide: true }
+                        , { field: 'HRelationBillNo', title: '鍏宠仈鍓骇璁″垝鍗�', edit: 'text', event: "HRelationBillNo" }
+                        , { field: 'HMaterID', title: 'HMaterID', event: "HMaterID", hide: true }
+                        , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', style: 'background-color: #f9f9f9;' }
+                        , { field: 'HProcID', title: 'HProcID', edit: 'text', hide: true }
+                        , { field: 'HProcName', title: '宸ュ簭鍚嶇О', edit: 'text', event: "HProcID" }
+                        , { field: 'HICMOInterID', title: '鐢熶骇璁㈠崟鍐呯爜', hide: true }
+                        , { field: 'HICMOEntryID', title: '鐢熶骇璁㈠崟瀛愬唴鐮�', hide: true }
+                        , { field: 'HICMOBillNo', title: '鐢熶骇璁㈠崟鍙�', style: 'background-color: #f9f9f9;' }
+                        , { field: 'HProcExchInterID', title: '宸ュ簭娴佽浆鍗″唴鐮�', hide: true }
+                        , { field: 'HProcExchEntryID', title: '宸ュ簭娴佽浆鍗″瓙鍐呯爜', hide: true }
+                        , { field: 'HProcExchBillNo', title: '宸ュ簭娴佽浆鍗″彿', templet: "#HProcExchInterID" }
+                        , { field: 'HRemark', title: '澶囨敞', edit: 'text' }
+                        , { field: 'HSourceInterID', title: '婧愬崟鍐呯爜', hide: true }
+                        , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', hide: true }
+                        , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', hide: true }
+                        , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', hide: true }
+                        , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo' }
+                    ]]
+                }
+
+                var rowdata = [
+                    {
+                        "HMaterID": "0"
+                        , "HMaterName": ""
+                        , "HProcID": "0"
+                        , "HProcName": ""
+                        , "HRelationBillInterID": "0"
+                        , "HRelationBillEntryID": "0"
+                        , "HRelationBillType": ""
+                        , "HRelationBillNo": ""
+                        , "HICMOInterID": "0"
+                        , "HICMOEntryID": "0"
+                        , "HICMOBillNo": ""
+                        , "HProcExchInterID": "0"
+                        , "HProcExchEntryID": "0"
+                        , "HProcExchBillNo": ""
+                        , "HRemark": ""
+                        , "HSourceInterID": "0"
+                        , "HSourceEntryID": "0"
+                        , "HSourceBillNo": ""
+                        , "HSourceBillType": ""
+                    }
+                ];
+                option.data = rowdata;
+                table.render(option);
+                form.render('select');
+            }
+            //#endregion
 
 
-            form.on('submit(Cancel)', function () {
-                //sessionStorage["SourceFlag"] = false;
-                parent.location.href = "../../../views/index.html"
-                //window.close();//鍏抽棴褰撳墠椤�
-            })
+            //#region 瀛愯〃锛氬垹闄ゆ寚瀹氳
+            function set_GridDelete(obj) {
+                var data = obj.data;
+                var rowIndex = $(obj.tr).attr("data-index");
+                if (obj.event === 'del') {
+                    layer.confirm('鐪熺殑鍒犻櫎琛屽悧锛�', function (index) {
+                        console.log("绱㈠紩涓�:" + rowIndex);
+                        if (rowIndex === '0') {
+                            layer.msg('棣栬鏃犳硶鍒犻櫎锛侊紒锛�');
+                        } else {
+                            var oldData = table.cache["mainTable"];
+                            oldData.splice(obj.tr.data('index'), 1)
+                            option.data = oldData;//灏嗘暟鎹粦瀹氬埌data涓�
+                            table.render(option);
+                            for (var i = 0; i < oldData.length; i++) {
+                                $('#HICMOBillNo' + (i + 1)).find("option[value='" + oldData[i].HICMOBillNo + "']").attr("selected", true);
+                            }
+                            form.render('select');
+                            layer.close(index);
+                        }
+                    });
+                }
+            }
+            //#endregion
 
-            function formatDate(date) {
-                var d = new Date(date),
-                    month = '' + (d.getMonth() + 1),
-                    day = '' + d.getDate(),
-                    year = d.getFullYear();
+            //#region 瀛愯〃锛氬揩鎹烽敭(F7)鎵撳紑寮圭獥
+            function set_GridCellCheck(obj) {
+                $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
+                    if (event.key == "F7") {
+                        if (obj.event == "HRelationBillNo") {
+                            var HProcID = $("#HProcID").val();
+                            var HSourceID = $("#HSourceID").val();
+                            layer.open({
+                                type: 2
+                                , skin: "layui-layer-rim"                           //鍔犱笂杈规
+                                , title: "鍓骇璁″垝鍗�"                             //鏍囬
+                                , closeBtn: 1                                       //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                                , shift: 2                                          //寮瑰嚭鍔ㄧ敾
+                                , area: ["90%", "90%"]                              //绐椾綋澶у皬
+                                , maxmin: true                                      //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                                , content: ['../../../views/Baseset/鍩虹璧勬枡/Sc_ProcessExchangeBillListView.html?HProcID=' + HProcID + '&HSourceID=' + HSourceID+'', 'yes']
+                                , btn: ["纭畾", "鍙栨秷"]
+                                , btn1: function (index, laero) {
+                                    //鎸夐挳涓�  鐨勫洖璋�
+                                    var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
+                                    var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
 
-                if (month.length < 2) month = '0' + month;
-                if (day.length < 2) day = '0' + day;
+                                    if (checkStatus.data.length != 1) {
+                                        return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
+                                    }
+                                    if ($("#HSourceName").val() == checkStatus.data[0].鐢熶骇璧勬簮 && $("#HProcName").val() == checkStatus.data[0].宸ュ簭) {
+                                        obj.update({
+                                            "HProcExchInterID": checkStatus.data[0].hmainid
+                                            , "HProcExchEntryID": checkStatus.data[0].hsubid
+                                            , "HProcExchBillNo": checkStatus.data[0].鍗曟嵁鍙�
+                                            , "HRelationBillInterID": checkStatus.data[0].hmainid
+                                            , "HRelationBillEntryID": checkStatus.data[0].hsubid
+                                            , "HRelationBillNo": checkStatus.data[0].鍗曟嵁鍙�
+                                            , "HICMOInterID": checkStatus.data[0].hicmointerid
+                                            , "HICMOEntryID": checkStatus.data[0].HICMOEntryID
+                                            , "HICMOBillNo": checkStatus.data[0].鐢熶骇璁㈠崟鍙�
+                                            , "HMaterID": checkStatus.data[0].HMaterID
+                                            , "HMaterName": checkStatus.data[0].浜у搧
+                                            , "HProcID": checkStatus.data[0].HProcID
+                                            , "HProcName": checkStatus.data[0].宸ュ簭
+                                            , "HSourceInterID": checkStatus.data[0].hmainid
+                                            , "HSourceEntryID": checkStatus.data[0].hsubid
+                                            , "HSourceBillNo": checkStatus.data[0].鍗曟嵁鍙�
+                                            , "HSourceBillType": 3772
 
-                return [year, month, day].join('-');
+                                        })
+                                    }
+                                    else {
+                                        return layer.msg("閫夋嫨鍓骇璁″垝鍗曠殑鐢熶骇璧勬簮涓庡伐搴�,璺熷綋鍓嶇敓浜ц祫婧愪笌宸ュ簭涓嶅尮閰�");
+                                    }
+
+                                    layer.close(index);//鍏抽棴寮圭獥
+                                }
+                                , btn2: function (index, layero) { }
+                                , end: function () {
+                                    if ($("#HSourceName").val() == OptionData[0].鐢熶骇璧勬簮  && $("#HProcName").val() == OptionData[0].宸ュ簭) {
+                                        obj.update({
+                                            "HProcExchInterID": OptionData[0].hmainid
+                                            , "HProcExchEntryID": OptionData[0].hsubid
+                                            , "HProcExchBillNo": OptionData[0].鍗曟嵁鍙�
+                                            , "HRelationBillInterID": OptionData[0].hmainid
+                                            , "HRelationBillEntryID": OptionData[0].hsubid
+                                            , "HRelationBillNo": OptionData[0].鍗曟嵁鍙�
+                                            , "HICMOInterID": OptionData[0].hicmointerid
+                                            , "HICMOEntryID": OptionData[0].HICMOEntryID
+                                            , "HICMOBillNo": OptionData[0].鐢熶骇璁㈠崟鍙�
+                                            , "HMaterID": OptionData[0].HMaterID
+                                            , "HMaterName": OptionData[0].浜у搧
+                                            , "HProcID": OptionData[0].HProcID
+                                            , "HProcName": OptionData[0].宸ュ簭
+                                            , "HSourceInterID": OptionData[0].hmainid
+                                            , "HSourceEntryID": OptionData[0].hsubid
+                                            , "HSourceBillNo": OptionData[0].鍗曟嵁鍙�
+                                            , "HSourceBillType": 3772
+
+                                        })
+                                    } else {
+                                        return layer.msg("閫夋嫨鍓骇璁″垝鍗曠殑鐢熶骇璧勬簮涓庡伐搴�,璺熷綋鍓嶇敓浜ц祫婧愪笌宸ュ簭涓嶅尮閰�");
+                                    }
+
+                                    OptionData = [];
+                                }
+                            })
+                        }
+                        if (obj.event == "HProcID") {
+                            layer.open({
+                                type: 2
+                                , skin: "layui-layer-rim"                           //鍔犱笂杈规
+                                , title: "鍓骇璁″垝鍗�"                             //鏍囬
+                                , closeBtn: 1                                       //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                                , shift: 2                                          //寮瑰嚭鍔ㄧ敾
+                                , area: ["90%", "90%"]                              //绐椾綋澶у皬
+                                , maxmin: true                                      //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                                , content: ['../../../views/鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_Process.html', 'yes']
+                                , btn: ["纭畾", "鍙栨秷"]
+                                , btn1: function (index, laero) {
+                                    //鎸夐挳涓�  鐨勫洖璋�
+                                    var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
+                                    var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
+
+                                    if (checkStatus.data.length != 1) {
+                                        return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
+                                    }
+                                    if ($("#HProcName").val() == checkStatus.data[0].宸ュ簭鍚嶇О) {
+                                        obj.update({
+                                            "HProcID": checkStatus.data[0].HItemID
+                                            , "HProcName": checkStatus.data[0].宸ュ簭鍚嶇О
+
+                                        })
+                                    } else {
+                                        return layer.msg("閫夋嫨鐨勫伐搴�,璺熷綋鍓嶅伐鍗曠殑宸ュ簭涓嶅尮閰�");
+                                    }
+
+                                    layer.close(index);//鍏抽棴寮圭獥
+                                }
+                                , btn2: function (index, layero) { }
+                                , end: function () {
+
+                                }
+                            })
+                        }
+                        obj.event = "";
+                        return false;
+                    }
+                })
+            }
+            //#endregion
+
+
+
+            function AllowLoadData() {  //闈炵┖楠岃瘉
+                var Result = true;
+                if ($("#HBillNo").val() == '' || $("#HBillNo").val() == null) {
+                    layer.msg("鍗曟嵁鍙蜂笉鑳戒负绌�!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return Result = false;
+                }
+                if ($("#HDate").val() == '' || $("#HDate").val() == null) {
+                    layer.msg("鍗曟嵁鏃ユ湡涓嶈兘涓虹┖!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return Result = false;
+                }
+                if ($("#HMaterID").val() == '' || $("#HMaterID").val() == null) {
+                    layer.msg("浜у搧缂栫爜涓嶈兘涓虹┖锛�", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return Result = false;
+                }
+                if ($("#HBeginWorkTime").val() == '' || $("#HBeginWorkTime").val() == null) {
+                    layer.msg("寮�宸ユ椂闂翠笉鑳戒负绌猴紒", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return Result = false;
+                }
+                if ($("#HSourceID").val() == '' || $("#HSourceID").val() == null) {
+                    layer.msg("鐢熶骇璧勬簮涓嶈兘涓虹┖锛�", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return Result = false;
+                }
+                if ($("#HEmpID").val() == '' || $("#HEmpID").val() == null) {
+                    layer.msg("鎿嶄綔鍛樹笉鑳戒负绌猴紒", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return Result = false;
+                }
+                if ($("#HGroupID").val() == '' || $("#HGroupID").val() == null) {
+                    layer.msg("鐝粍涓嶈兘涓虹┖锛�", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return Result = false;
+                }
+                if ($("#HDeptID").val() == '' || $("#HDeptID").val() == null) {
+                    layer.msg("杞﹂棿涓嶈兘涓虹┖锛�", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return Result = false;
+                }
+                if (OperationType == "2") {
+                    if ($("#HICMOInterID").val() == '' || $("#HICMOInterID").val() == null) {
+                        layer.msg("鐢熶骇璁㈠崟涓嶈兘涓虹┖锛�", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        return Result = false;
+                    }
+                }
+                return Result;
             }
 
-            form.on('submit(Saver)', function (data) {//淇濆瓨
-                //debugger;
-                data.field.HMaker = sessionStorage["HUserName"];//鍒跺崟浜�
-                var sMainStr = JSON.stringify(data.field);
-                var sMainSub = sMainStr;
-
-
-                $.ajax(
-                    {
-                        type: "POST",
-                        url: GetWEBURL() + "/Sc_MESBeginWorkBill/SaveGetMESBeginWorkBillList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                        async: true,
-                        data: { "msg": sMainSub },
-                        dataType: "json",
-                        success: function (data) {
-                            if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                                layer.msg(data.Message, { time: 1 * 1000, icon: 1 }, function () {
-                                    $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
-                                    var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
-                                    parent.layer.close(index); //鍐嶆墽琛屽叧闂� 聽 聽 聽 聽 聽聽 聽聽聽 聽
+            //鍒ゆ柇绯荤粺鍙傛暟鏄惁閫変腑
+            function Xt_AllowLoadData(data2) {
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/Sc_MESBeginWorkBill/Xt_AllowLoadData", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    async: false,
+                    data: { "HKey": "Sc_MESBeginWorkBill_SwipeCardStart" },
+                    success: function (data) {
+                        if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            if (data.Verify == "Y") //鍒峰崱楠岃瘉
+                            {
+                                layer.msg("闇�瑕佽繘琛屽埛鍗¢獙璇�!", { time: 1 * 1000, icon: 1 }, function (index) {
+                                    layer.open({
+                                        type: 2,
+                                        skin: 'layui-layer-rim', //鍔犱笂杈规
+                                        title: 'IC鍒峰崱',
+                                        closeBtn: 1,
+                                        shift: 2,
+                                        area: ['50%', '80%'],
+                                        maxmin: true,
+                                        content: '../../鐢熶骇绠$悊/鎶ュ伐鍙板伐搴�/寮�宸�/Sc_SwipeCardStart.html?HSourceInterID=' + HSourceInterID + '&HBillType=KG&HBillNo=' + $("#HBillNo").val(),
+                                        end: function () {
+                                            if (OptionData.length > 0) {
+                                                if (OptionData[0]["data"] == "1") {
+                                                    data2.field["HMaker"] = OptionData[0]["HName"];
+                                                    save(data2);
+                                                } else if (OptionData[0]["data"] == "0") {
+                                                    layer.msg("鍥犱负鎶�鑳戒笉鍖归厤,鏃犳硶淇濆瓨!")
+                                                }
+                                                OptionData = [];
+                                            } else {
+                                                $('#Saver').removeClass("layui-btn-disabled").attr("disabled", false);
+                                            }
+                                        }
+                                    });
                                 });
                             }
                             else {
-
-                                f_alert(data.Message);
-                                console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable));
+                                save(data2);
                             }
-                            layer.closeAll("loading");
-                        },
-                        error: function (err) {
-
-                            f_alert("閿欒:" + err);
-                            console.log("Reason" + sMainStr);
                         }
-                    });
-            });
-            function f_alert(sMsg) {
-                layer.alert(sMsg, { icon: 5 });
-
-            }
-
-            //鐩戝惉鎻愪氦
-            form.verify({
-                numberOrEmpty: function (value, item) {
-                    // if (value != '') {
-                    if (!/^\d+$/.test(value)) {
-                        return '涓嶈兘涓虹┖鎴栨暟瀛楁垨鑰�0';
+                        else {
+                            layer.alert(data.Message, { icon: 5 })
+                        }
+                    },
+                    error: function (err) {
+                        layer.alert(err, { icon: 5 })
                     }
-                    //}
-                }
-            });
+                })
+            }
 
-
-        });
-        //瀹氫箟鍏ㄥ眬鍙橀噺
-        var HReasonName, ReasonID, EmpName, SQProcName,
-            ProcID, ZRProcName, QRName
-            ;
-        function GetHReasonValue(obj)  //杩斿洖涓嶈壇鍘熷洜
-        {
-            HReasonName = obj[0].HName;
-            ReasonID = obj[0].HItemID;
-        }
-        //杩斿洖鐗╂枡
-        function GetHMaterNameValue(obj) {  //杩斿洖鐗╂枡
-            $("#HMater").val(obj[0].HName);
-            $("#HMaterID").val(obj[0].HItemID);
-            $("#HMaterNumber").val(obj[0].HNumber);
-        }
-        //杩斿洖宸ュ簭
-        function GetHProcValue(obj) {  //杩斿洖宸ュ簭
-            $("#HProcName").val(obj[0].宸ュ簭);
-            $("#HProcID").val(obj[0].HItemID);
-            $("#HProcNumber").val(obj[0].宸ュ簭浠g爜);
-        }
-        function GetHDeptNameValue(obj) {  //杩斿洖閮ㄩ棬
-            $("#HDepName").val(obj[0].HName);
-            $("#HDeptID").val(obj[0].HItemID);
-            $("#HDeptNumber").val(obj[0].HNumber);
-        }
-        //杩斿洖鍗曚綅
-        function GetHUnitNameValue(obj) {
-            $("#HUName").val(obj[0].HName);
-            $("#HUnitID").val(obj[0].HItemID);
-            $("#HUnitNumber").val(obj[0].HNumber);
-        }
-
-        function GetHKeeperValue(obj) {  //杩斿洖璐d换浜�
-            EmpName = obj[0].HName;
-            // $("#HEmpName").val(obj[0].HName);
-            //$("#HItemID").val(obj[0].HItemID);
-        }
-        //function GetHProcValue(obj) {  //杩斿洖鐢宠宸ュ簭
-        //    SQProcName = obj[0].宸ュ簭;
-        //    ProcID = obj[0].HItemID;
-        //    //$("#HSQProcName").val(obj[0].宸ュ簭);
-        //    //$("#HProcID").val(obj[0].HItemID);
-        //}
-        function GetHZRValue(obj) {   //杩斿洖璐d换宸ュ簭
-            ZRProcName = obj[0].宸ュ簭;
-            //$("#HZRProcName").val(obj[0].宸ュ簭);
-            //$("#HItemID").val(obj[0].HItemID);
-        }
-        //HWorker
-        function GetHWorkerValue(obj) {  //杩斿洖涓嶈壇纭浜�
-            QRName = obj[0].HName;
-            //$("#HQRName").val(obj[0].HName);
-            //$("#HItemID").val(obj[0].HItemID);
-        }
-        function AllowLoadData(sSubStr) {  //闈炵┖楠岃瘉
-            //if ($("#HSourceBillNo").val() == '') {
-            //    layer.msg("璇峰厛鎵簮鍗�!", { icon: 5 });
-            //    return false;
-            //}
-            if ($("#HDeptName").val() == '') {
-                layer.msg("閮ㄩ棬娌℃湁閫夋嫨", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                return false;
-            }
-            if ($("#HSecManager").val() == '') {
-                layer.msg("楠屾敹浜烘病鏈夐�夋嫨", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                return false;
-            }
-            if ($("#HKeeper").val() == '') {
-                layer.msg("淇濈浜烘病鏈夐�夋嫨", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                return false;
-            }
-            //if ($("#HWHNAME").val() == '') {
-            //    layer.msg("浠撳簱娌℃湁閫夋嫨!", { icon: 5 });
-            //    return false;
-            //}
-            if ($("#HBillNo").val() == '') {
-                layer.msg("閿欒鐨勫崟鎹彿", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                return false;
-            }
-            if ($("#HInterID").val() == '') {
-                layer.msg("閿欒鐨勫唴鐮�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                return false;
-            }
-            if (typeof (sSubStr) == "undefined") {
-                layer.msg("娌℃湁鐗╂枡鏄庣粏璁板綍", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                return false;
-            }
-            if (!typeof (sSubStr) == "undefined") {
-                //for (var i = 0; i <= sSubStr.length - 1; i++) {  //鍒ゆ柇鎵爜鏁伴噺涓嶈兘澶т簬搴旀敹鏁伴噺
-                //    if (parseFloat(sSubStr[i].HQtyMust) > 0) {
-                //        if (parseFloat(sSubStr[i].HQty) > parseFloat(sSubStr[i].HQtyMust))
-                //        {
-                //            layer.msg("鏁伴噺涓嶈兘澶т簬搴旀敹鏁伴噺", { icon: 5, btn: ['纭畾'], time: 100000, offset: 't' });
-                //            return false;
-                //        }
-                //    }
-                //}
-                for (var i = 0; i <= sSubStr.length - 1; i++) {   //鍒ゆ柇鎵爜鏁伴噺涓嶈兘涓�0
-                    if (parseFloat(sSubStr[i].HQty) > 0) {
-                        s = 1;
+            //淇濆瓨
+            function save(data) {
+                var index = layer.load();
+                //鑾峰彇瀛愯〃鏁版嵁
+                var num = [];
+                for (var i = 0; i < table.cache["mainTable"].length; i++) {
+                    if (table.cache["mainTable"][i] != "") {
+                        table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
+                        num.push(table.cache["mainTable"][i])
                     }
                 }
-                if (s == 0) {
-                    layer.msg("浜у搧鍏ュ簱璁板綍鏈壂鐮�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                //鏇存柊瀹℃牳浜轰负鍒峰崱浜�
+                var HName = data.field["HMaker"];
+                //瀛愯〃鏁版嵁搴忓垪鍖�
+                var sSubStr = JSON.stringify(num);
+                var sMainStr = JSON.stringify(data.field);
+                var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"] + ';' + refSav;
+                if (!AllowLoadData())//鏁版嵁楠岃瘉
+                {
                     return false;
                 }
+                $.ajax({
+                    type: "POST",
+                    url: GetWEBURL() + "/Sc_MESBeginWorkBill/SaveGetMESBeginWorkFrom", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    async: false,
+                    data: { "msg": sMainSub },
+                    dataType: "json",
+                    success: function (data) {
+                        if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            $("#HInterID").val(data.HInterID);//鑾峰彇鎻愪氦鎴愬姛杩斿洖鐨勫崟鎹富ID
+                            layer.msg(data.Message, { time: 1 * 2000, icon: 1 }, function (index) {
+                                //layer.close(layer.index);
+                                //window.parent.location.reload();
+                                if (data.Verify == "Y") //鑷姩瀹℃牳
+                                {
+                                    layer.close(index);
+                                    SaveVerify(HName); //瀹℃牳
+                                }
+                                else {
+                                    layer.close(index);
+                                }
+                            });
+                            layer.close(index);
+
+                            //layer.confirm(data.Message, {
+                            //    btn: ['纭']
+                            //}, function (index) {
+                            //        if (data.Verify == "Y") //鑷姩瀹℃牳
+                            //        {
+                            //            layer.close(index);
+                            //            SaveVerify(); //瀹℃牳
+                            //        }
+                            //        else {
+                            //            layer.close(index);
+                            //        }
+                            //});
+                        }
+                        else {
+                            layer.alert(data.Message, { icon: 5 })
+                            layer.close(index);
+                        }
+                    },
+                    error: function (err) {
+                        layer.alert(err, { icon: 5 })
+                        layer.close(index);
+                    }
+                })
             }
-            else {
-                return true;
+
+            //鑾峰彇鐝
+            function get_HWorkShift() {
+                var HDeptID = $("#HDeptID").val();
+                $.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;
+                                $("#HWorkShiftID").val(LoadData[0].HInterID); //褰撳墠宸ュ簭ID
+                                $("#HWorkShiftName").val(LoadData[0].鐝); //褰撳墠宸ュ簭
+                            }
+                            else {
+                                layer.alert(data.Message, { icon: 5 });
+                            }
+                        },
+                        error: function (err) {
+                            layer.alert(err, { icon: 5 });
+                        }
+                    });
             }
-        }</script>
+
+            //浠ヤ笂涓簂ayui妯″潡
+        });
+        function formatDate(date) {
+            var d = new Date(date),
+                month = '' + (d.getMonth() + 1),
+                day = '' + d.getDate(),
+                year = d.getFullYear();
+
+            if (month.length < 2) month = '0' + month;
+            if (day.length < 2) day = '0' + day;
+
+            return [year, month, day].join('-');
+        }
+
+        //鎿嶄綔鍛�
+        function GetHEmpValue(obj) {
+            $("#HEmpName").val(obj[0].鑱屽憳鍚嶇О);
+            $("#HEmpID").val(obj[0].HItemID);
+        }
+        //鐢熶骇鐝粍
+        function GetHGroupValue(obj) {
+            $("#HGroupName").val(obj[0].鐝粍鍚嶇О);
+            $("#HGroupID").val(obj[0].HItemID);
+        }
+
+        //鐢熶骇鐝
+        function GetHWorkShiftsValue(obj) {
+            $("#HWorkShiftID").val(obj[0].HInterID); //褰撳墠宸ュ簭ID
+            $("#HWorkShiftName").val(obj[0].鐝鍚嶇О); //褰撳墠宸ュ簭
+        }
+
+        function GetSwipeCardStart(obj) {
+            OptionData[0] = obj;
+        }
+        //娴佽浆鍗�
+        function GetProcExValue(obj) {
+            OptionData = obj;
+        }
+    </script>
 </body>
-</html>
\ No newline at end of file
+</html>

--
Gitblit v1.9.1