From 8a36bbee40f5e1069b15a98b1e64ac9719ee8a46 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期二, 23 四月 2024 17:17:13 +0800
Subject: [PATCH] 1.销售出库单 增加 反写源单 销售订单和发货通知单   超出 关联数量  关闭源单 2.应收单 增加  反写源单 销售出库单 和 销售订单  超出关联数量  关闭源单 3.动态获取源单增加参数 Num 0蓝单   1红单  2全部 4.销售流程的测试并完善功能; 销售订单-》发货通知单-》销售出库单-》应收单 (注意: 源单类型的下拉框 需要 根据数据库 表动态加载, 关联数量 要准确 , 审核 且 未关闭 未行关闭的行 才能下推 ,关联数量超额后,要 反写 关闭 源单 )

---
 WebTM/views/生产管理/生产汇报单/Sc_Add_ICMOReportBillList.html |  990 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 755 insertions(+), 235 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html"
index aae1074..07bc876 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\261\207\346\212\245\345\215\225/Sc_Add_ICMOReportBillList.html"
@@ -13,8 +13,8 @@
     <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/PageTitle.js"></script>
     <style type="text/css">
-
         /*begin 姝ゆ牱寮忕敤浜庢秷闄よ鍏冪礌涓竷灞�瀹藉害涓嶅鐨勯棶棰�*/
         .layui-form-item .layui-inline {
             margin-top: 5px;
@@ -29,7 +29,7 @@
     <div class="layui-fluid" style="padding: 0;">
         <div class="layui-card" style="padding: 15px;">
             <div class="layui-card-body" style="padding: 1px;">
-                <form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
+                <form class="layui-form" action="" lay-filter="component-form-group" style="background-color:white;">
                     <div class="layui-card-header">
                         <div class="layui-btn-group">
                             <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_AddNew" id="set_AddNew">鏂板</button>
@@ -42,85 +42,208 @@
                             <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">閫�鍑�</button>
                         </div>
                     </div>
-                    <div class="layui-form-item" style="padding-top: 10px;">
-                        <div class="layui-row">
-                            <div class="layui-col-xs4 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" />
+                    <h1 style="text-align:center;"><b>鐢熶骇姹囨姤鍗�</b></h1>
+                    <div class="layui-tab" lay-filter="tab-POStockInBill">
+                        <ul class="layui-tab-title" lay-filter="tab-all">
+                            <li lay-id="1" style="padding:1px;" class="layui-this">鍩烘湰淇℃伅</li>
+                            <li lay-id="2" style="padding:1px;">鍒跺崟淇℃伅</li>
+                            <li lay-id="3" style="padding:1px;">闄勪欢淇℃伅</li>
+                        </ul>
+                        <div class="layui-tab-content">
+                            <!--鍩烘湰淇℃伅-->
+                            <div class="layui-tab-item layui-show">
+                                <div class="layui-form-item" style="padding-top: 10px;">
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs4 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" />
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 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-col-xs4 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" value="0">
+                                                <input type="hidden" name="HDeptNumber" id="HDeptNumber">
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HShopList" 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-row">
+                                        <div class="layui-col-xs4 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" style="width:40px;">
+                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                </button>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 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" style="width:40px;">
+                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                </button>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">婧愬崟绫诲瀷</label>
+                                            <div class="layui-input-inline">
+                                                <select name="HMainSourceBillType" lay-filter="HMainSourceBillType" id="HMainSourceBillType">
+                                                    <option value="2">鐢熶骇浠诲姟鍗�</option>
+                                                    <option value="1" selected="selected">鎵嬪伐褰曞叆</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs4 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="HMainSourceEntryID" id="HMainSourceEntryID" class="layui-input" value="0" style="float:left;width:150px;">
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="XDHList" id="XDHList" style="width:40px;">
+                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
+                                                </button>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs8 layui-inline">
+                                            <label class="layui-form-label" style="width: 6.5%;">澶囨敞</label>
+                                            <div class="layui-input-block">
+                                                <input class="layui-input" name="HRemark" id="HRemark" autocomplete="off" style=" width: 75%;">
+                                            </div>
+                                        </div>
+                                    </div>
                                 </div>
                             </div>
-                            <div class="layui-col-xs4 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 class="layui-tab-item">
+                                <div class="layui-form-item">
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs4 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;" readonly>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 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;" readonly>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 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;" readonly>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">鍒跺崟鏃ユ湡</label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" class="layui-input" name="HMakeDate" id="HMakeDate" style="background-color:#efefef4d;" readonly>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">瀹℃牳鏃ユ湡</label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" class="layui-input" name="HCheckDate" id="HCheckDate" style="background-color:#efefef4d;" readonly>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">鍏抽棴鏃ユ湡</label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" class="layui-input" name="HCloseDate" id="HCloseDate" style="background-color:#efefef4d;" readonly>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs4 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;" readonly>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 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;" readonly>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">淇敼鏃ユ湡</label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" class="layui-input" name="HUpDateDate" id="HUpDateDate" style="background-color:#efefef4d;" readonly>
+                                            </div>
+                                        </div>
+                                        <div class="layui-col-xs4 layui-inline">
+                                            <label class="layui-form-label">浣滃簾鏃ユ湡</label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" class="layui-input" name="HDeleteDate" id="HDeleteDate" style="background-color:#efefef4d;" readonly>
+                                            </div>
+                                        </div>
+                                    </div>
                                 </div>
                             </div>
-                            <div class="layui-col-xs4 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="" style="float:left;width:150px;">
-                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="HShopList" 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-row">
-                            <div class="layui-col-xs4 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="" style="float:left;width:150px;">
-                                    <button type="button" lay-submit="" class="layui-btn" 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-col-xs4 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="" style="float:left;width:150px;">
-                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" style="width:40px;">
-                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
-                                    </button>
-                                </div>
-                            </div>
-                            <div class="layui-col-xs4 layui-inline">
-                                <label class="layui-form-label">婧愬崟绫诲瀷</label>
-                                <div class="layui-input-inline">
-                                    <select name="HMainSourceBillType" lay-filter="HMainSourceBillType" id="HMainSourceBillType">
-                                        <option value="2">鐢熶骇浠诲姟鍗�</option>
-                                        <option value="1" selected="selected">鎵嬪伐褰曞叆</option>
-                                    </select>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="layui-row">
-                            <div class="layui-col-xs4 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="" style="float:left;width:150px;">
-                                    <input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" class="layui-input" value="" style="float:left;width:150px;">
-                                    <button type="button" lay-submit="" class="layui-btn" lay-filter="XDHList" id="XDHList" style="width:40px;">
-                                        <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
-                                    </button>
-                                </div>
-                            </div>
-                            <div class="layui-col-xs4 layui-inline">
-                                <label class="layui-form-label">澶囨敞</label>
-                                <div class="layui-input-inline">
-                                    <textarea placeholder="璇疯緭鍏ョ淮澶囨敞" class="layui-textarea" name="HRemark" id="HRemark"></textarea>
+                            <!--闄勪欢淇℃伅-->
+                            <div class="layui-tab-item">
+                                <div class="layui-form-item">
+                                    <div class="layui-upload">
+                                        <button type="button" class="layui-btn" id="testList">閫夋嫨鏂囦欢</button><input class="layui-upload-file" type="file" accept="" name="file" multiple="">
+                                        <div class="layui-upload-list">
+                                            <table class="layui-table">
+                                                <thead>
+                                                    <tr>
+                                                        <th>鏂囦欢鍚�</th>
+                                                        <th>澶у皬</th>
+                                                        <th>鐘舵��</th>
+                                                        <th>鎿嶄綔</th>
+                                                    </tr>
+                                                </thead>
+                                                <tbody id="ProImgByList">
+                                                </tbody>
+                                            </table>
+                                        </div>
+                                    </div>
                                 </div>
                             </div>
                         </div>
                     </div>
-                    <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
+                    <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">
+                            <div class="layui-tab-item layui-show">
+                                <!--鐢熶骇姹囨姤鍗曟槑缁�-->
+                                <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
+                            </div>
+                            <div class="layui-tab-item">
+                                <!--浜ч噺姹囨姤鍗�-->
+                                <table class="layui-hide" id="mainTable_prodReport" lay-filter="mainTable_prodReport"></table>
+                            </div>
+                        </div>
+                    </div>
                     <script type="text/html" id="toolbarDemo">
                         <div class="layui-btn-container">
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine" id="btn-AddLine"><i class="layui-icon layui-icon-form"></i>澧炲姞涓�琛�</button>
@@ -130,6 +253,8 @@
                     <script type="text/html" id="xuhao">
                         {{d.LAY_TABLE_INDEX+1}}
                     </script>
+                    <!--闅愯棌瀛楁-->
+                    <input type="hidden" name="HInnerBillNo" id="HInnerBillNo" value="">
                 </form>
             </div>
         </div>
@@ -138,34 +263,44 @@
         <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
     </script>
     <script>
+        var OptionData = [];
         //#region 鎶樺彔娉ㄩ噴
         //#endregion
         layui.config({
             base: '../../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
         }).extend({
             index: 'lib/index' //涓诲叆鍙fā鍧�
-        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
+        }).use(['index', 'form', 'laydate', 'table', 'element', 'upload'], function () {
+
+            //#region 鍏敤鍙橀噺
             var $ = layui.$
                 , admin = layui.admin
                 , layer = layui.layer
                 , table = layui.table
                 , form = layui.form
+                , upload = layui.upload
                 , laydate = layui.laydate
                 , element = layui.element;
-
-        //#region 鍏敤鍙橀噺
             var option;
+            var option_prodReport;
             var sBillType = "3711";
-            var TabRow = {
-                "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
-                "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HRemark": ""
-            };
+            //var TabRow = {
+            //    "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
+            //    "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0,"HBadQty":0, "HRemark": ""
+            //};
             var Sctag = "0";
             var columns = "";
-        //#endregion
+            //#endregion
 
 
-        //#region 杩涘叆椤甸潰鍗冲姞杞�
+            //#region 杩涘叆椤甸潰鍗冲姞杞�
+
+            //#region 銆愬姩鎬佽幏鍙栨ā鍧楀悕绉般��
+            var HModuleType = "3711";
+            //閫氳繃鍗曟嵁绫诲瀷锛屼粠鏁版嵁搴撳姩鎬佽幏鍙栧崟鎹ā鍧楀懡鍚�,寮曠敤js鏂囦欢 PageTitle.js
+            var HPageTitle = get_PageTitle(HModuleType) == "" ? $("h1").html() : get_PageTitle(HModuleType);
+            $("h1").html('<b>' + HPageTitle + '</b>');
+            //#endregion
 
             //鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
             get_LoginIs();
@@ -190,23 +325,36 @@
             }
             //鍒ゆ柇鎿嶄綔绫诲瀷
             if (OperationType == 1) {//鏃犳簮鍗曟柊澧�
+                $("#HDeptID").val(sessionStorage["HDeptID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭閮ㄩ棬ID
+                $("#HDeptName").val(sessionStorage["HDept"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭閮ㄩ棬
+                $("#HGroupID").val(sessionStorage["HGroupID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍ID
+                $("#HGroupName").val(sessionStorage["HGroup"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍
+                $("#HEmpID").val(sessionStorage["HEmpID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛業D
+                $("#HEmpName").val(sessionStorage["HEmpName"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛�
                 set_AddFNew();
             }
             else if (OperationType == 2) {//鏈夋簮鍗曟柊澧�
+                $("#HDeptID").val(sessionStorage["HDeptID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭閮ㄩ棬ID
+                $("#HDeptName").val(sessionStorage["HDept"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭閮ㄩ棬
+                $("#HGroupID").val(sessionStorage["HGroupID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍ID
+                $("#HGroupName").val(sessionStorage["HGroup"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鐝粍
+                $("#HEmpID").val(sessionStorage["HEmpID"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛業D
+                $("#HEmpName").val(sessionStorage["HEmpName"]); //鏍规嵁鐧诲綍鐢ㄦ埛甯﹀嚭鎿嶄綔鍛�
                 set_AddNew();
             }
             else if (OperationType == 3) {//缂栬緫
                 set_EditFromGrid();
+                //get_file();
             }
             else {
                 layer.alert("鏈煡鎿嶄綔绫诲瀷锛�", { icon: 5 });
             }
 
 
-        //#endregion
+            //#endregion
 
 
-        //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
+            //#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
 
             //#region 澶村伐鍏锋爮浜嬩欢
             table.on('toolbar(mainTable)', function (obj) {
@@ -214,7 +362,13 @@
                 var checkStatus = table.checkStatus('mainTable')
                     , data = checkStatus.data;;
                 var AddRow = table.cache['mainTable'];
-                var NewRow = TabRow;
+                var NewRow = {
+                    "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
+                    "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0,
+                    "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
+                    "HSourceBillType": 0
+                };
+
                 switch (obj.event) {
                     //鏂板涓�琛�
                     case 'btn-AddLine': btnAddLine(NewRow);
@@ -233,39 +387,9 @@
             });
             //#endregion
 
-            //#region 琛ㄥご淇℃伅杞﹂棿寮圭獥
+            //#region 閫夋嫨鐢熶骇杞﹂棿鎸夐挳
             form.on('submit(HShopList)', function () {
-                //椤甸潰灞�-鑷畾涔�
-                layer.open({
-                    type: 2,
-                    skin: 'layui-layer-rim', //鍔犱笂杈规
-                    title: '杞﹂棿鍒楄〃',
-                    closeBtn: 1,
-                    shift: 2,
-                    area: ['80%', '80%'],
-                    maxmin: true,
-                    content: ['../../PublicPage/DeptInformation.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('璇烽�夋嫨鏁版嵁');
-                        }
-                        $("#HDeptName").val(checkStatus.data[0].HName);
-                        $("#HDeptID").val(checkStatus.data[0].HItemID);
-                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
-                    }
-                    , btn2: function (index, layero) {
-                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
-                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
-                    },
-                    end: function () {
-                    },
-                    success: function (layero, index) {
-                    }
-                });
+                get_checkDept();
             });
             //#endregion
 
@@ -280,7 +404,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) {
 
@@ -290,7 +414,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鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                     }
@@ -308,42 +432,9 @@
             });
             //#endregion
 
-            //#region 琛ㄥご淇℃伅璋冩暣浜哄脊绐�
+            //#region 閫夋嫨缁熻鍛樻寜閽�
             form.on('submit(HEmpList)', function () {
-                //椤甸潰灞�-鑷畾涔�
-                layer.open({
-                    type: 2,
-                    skin: 'layui-layer-rim', //鍔犱笂杈规
-                    title: '浜哄憳鍒楄〃',
-                    closeBtn: 1,
-                    shift: 2,
-                    area: ['80%', '80%'],
-                    maxmin: true,
-                    content: ['../../PublicPage/UserInformation.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('璇烽�夋嫨鏁版嵁');
-                        }
-                        $("#HEmpName").val(checkStatus.data[0].HName);
-                        $("#HEmpID").val(checkStatus.data[0].HItemID);
-                        layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
-                    }
-                    , btn2: function (index, layero) {
-                        //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
-                        //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
-                    },
-                    end: function () {
-
-                    },
-                    success: function (layero, index) {
-
-                    }
-                });
+                get_checkEmp();
             });
             //#endregion
 
@@ -359,7 +450,12 @@
                     content: ['../../PublicPage/ProductionOrder.html', 'yes'],
                     btn: ['纭畾', '鍙栨秷']
                     , btn1: function (index, layero) {
-                        option.data = [TabRow];
+                        option.data = [{
+                            "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
+                            "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0,
+                            "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
+                            "HSourceBillType": 0, "HICMOTempID": 0
+                        }];
                         table.render(option);
                         //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
                         var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
@@ -381,25 +477,31 @@
                         }
                         if (isAllEqual(list))  //鐩稿悓鍗曞彿
                         {
-                            console.log(checkStatus.data);
+                            //console.log(checkStatus.data);
                             if (checkStatus.data.length > 1) {
                                 for (var i = 0; i < checkStatus.data.length - 1; i++) //琛ヨ
                                 {
                                     //var NewRow = { "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "", "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HRemark": "" };
-                                    table.cache["mainTable"].push(TabRow);
+                                    table.cache["mainTable"].push({
+                                        "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
+                                        "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0, "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
+                                        "HSourceBillType": 0, "HICMOTempID": 0
+                                    });
                                     option.data = table.cache["mainTable"];
                                     table.render(option);
                                 }
                             }
-                            for (var i = 0; i < checkStatus.data.length; i++) {
-                                $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterID"] .layui-table-cell').text(checkStatus.data[i].HMaterID);
-                                $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterCode"] .layui-table-cell').text(checkStatus.data[i].HMaterCode);
-                                $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterName"] .layui-table-cell').text(checkStatus.data[i].HMaterName);
-                                $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterSpec"] .layui-table-cell').text(checkStatus.data[i].HMaterSpec);
-                                $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HUnitID"] .layui-table-cell').text(checkStatus.data[i].HUnitID);
-                                $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HUnitCode"] .layui-table-cell').text(checkStatus.data[i].HUnitCode);
-                                $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HUnitName"] .layui-table-cell').text(checkStatus.data[i].HUnitName);
-                            }
+                            option.data = checkStatus.data;
+                            table.render(option);
+                            //for (var i = 0; i < checkStatus.data.length; i++) {
+                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterID"] .layui-table-cell').text(checkStatus.data[i].HMaterID);
+                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterCode"] .layui-table-cell').text(checkStatus.data[i].HMaterCode);
+                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterName"] .layui-table-cell').text(checkStatus.data[i].HMaterName);
+                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HMaterSpec"] .layui-table-cell').text(checkStatus.data[i].HMaterSpec);
+                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HUnitID"] .layui-table-cell').text(checkStatus.data[i].HUnitID);
+                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HUnitCode"] .layui-table-cell').text(checkStatus.data[i].HUnitCode);
+                            //    $('.layui-table-view[lay-id="mainTable"]').children('.layui-table-box').children('.layui-table-body').find('table tbody tr[data-index="' + i + '"]').find('td[data-field="HUnitName"] .layui-table-cell').text(checkStatus.data[i].HUnitName);
+                            //}
                             layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                         }
                         else {
@@ -431,16 +533,23 @@
             //#region 鎻愪氦淇濆瓨
             form.on('submit(Saver)', function (data) {//淇濆瓨
                 var refSav = "";
-                if (linterid == "" || linterid == null) {
+                if (OperationType == 1 || OperationType == 2) {
                     refSav = "Add";
                 }
-                if (linterid != "" && linterid != null) {
+                if (OperationType == 3) {
                     refSav = "Update";
                 }
                 data.field.HMaker = sessionStorage["HUserName"];//鍒跺崟浜�
+                //绛涢�夊垹闄や箣鍚庝笉涓虹┖鐨勬暟鎹粍
+                var row = [];
+                for (var i = 0; i < table.cache['mainTable'].length; i++) {
+                    if (table.cache['mainTable'][i] != "") {
+                        row.push(table.cache['mainTable'][i])
+                    }
+                }
                 var sMainStr = JSON.stringify(data.field);
-                var sSubStr = JSON.stringify(table.cache['mainTable']);
-                var sMainSub = sMainStr + ';' + sSubStr + ';' + refSav;
+                var sSubStr = JSON.stringify(row);
+                var sMainSub = sMainStr + ';' + sSubStr + ';' + refSav + ";" + sessionStorage["HUserName"];
                 if (!AllowLoadData(sSubStr))//鏁版嵁楠岃瘉
                 {
                     return false;
@@ -454,9 +563,10 @@
                     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); //鍐嶆墽琛屽叧闂� 聽 聽 聽 聽 聽聽 聽聽聽 聽
+                                $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);//淇濆瓨鎸夐挳绂佺敤
+                                $('#set_CheckBill').removeClass("layui-btn-disabled").attr("disabled", false);//瀹℃牳鎸夐挳鍚敤
+                                //var index = parent.layer.getFrameIndex(window.name); //鍏堝緱鍒板綋鍓峣frame灞傜殑绱㈠紩
+                                //parent.layer.close(index); //鍐嶆墽琛屽叧闂� 聽 聽 聽 聽 聽聽 聽聽聽 聽
                             });
                         }
                         else {
@@ -484,7 +594,7 @@
 
             //#region 瀹℃牳
             form.on('submit(set_CheckBill)', function (data) {
-
+                set_CheckBill()
             });
             //#endregion
 
@@ -500,10 +610,10 @@
             });
             //#endregion
 
-        //#endregion
+            //#endregion
 
 
-        //#region 鏈〉闈㈡墍鏈夎璋冪敤鐨勬柟娉�
+            //#region 鏈〉闈㈡墍鏈夎璋冪敤鐨勬柟娉�
 
             //#region 鍒濆鍖栬〃鍗�
             function set_InitFrom() {
@@ -515,9 +625,15 @@
 
             //#region 琛ㄦ牸澧炲姞琛屼簨浠�
             function btnAddLine(NewRow) {
-                table.cache["mainTable"].push(NewRow);
-                option.data = table.cache["mainTable"];
-                table.render(option);
+                var tableBak = table.cache["mainTable"]; //鑾峰彇涔嬪墠缂栬緫杩囩殑琛ㄦ牸鏁版嵁
+                buttonArr = [];//娓呯┖鏁扮粍
+                for (var i = 0; i < tableBak.length; i++) {
+                    buttonArr.push(tableBak[i]);  //灏嗕箣鍓嶇殑鏁版嵁瀛樺偍
+                }
+                buttonArr.push(NewRow);  //鍦ㄥ熬閮ㄥ姞涓�琛�
+                table.reload("mainTable", {
+                    data: buttonArr    //灏嗘暟鎹噸鏂拌浇鍏ヨ〃鏍�
+                })
             }
             //#endregion
 
@@ -559,6 +675,35 @@
             }
             //#endregion
 
+            //#region 瀹℃牳
+            function set_CheckBill() {
+                var InterID = $("#HInterID").val();
+                //閫昏緫瀹℃牳鏂规硶
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/Sc_ICMOReportBill/AuditProcessReportList", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    data: { "HInterID": InterID, "IsAudit": 0, "CurUserName": sessionStorage["HUserName"] },
+                    success: function (result) {
+                        if (result.count == 1) {
+                            layer.msg(result.Message, { time: 1 * 10000, icon: 1 }, function () {
+                                // 寰楀埌frame绱㈠紩
+                                var index = layer.getFrameIndex(window.name);
+                                //鍏抽棴褰撳墠frame
+                                layer.close(index);
+                                //淇敼涓哄姛鍚庡埛鏂扮晫闈�
+                                $("#btnSearch").trigger('click');
+                            });
+
+                        } else {
+                            layer.alert(result.code + result.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+            //#endregion
+
             //#region 琛ㄦ牸琛屽唴浜嬩欢蹇嵎閿瓫閫�
             function set_GridCellCheck(obj) {
                 $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
@@ -574,7 +719,7 @@
                                 shift: 2,
                                 area: ['90%', '90%'],
                                 maxmin: true,
-                                content: ['../../PublicPage/PartInformation.html', 'yes'],
+                                content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html', 'yes'],
                                 btn: ['纭畾', '鍙栨秷']
                                 , btn1: function (index, layero) {
                                     //鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
@@ -586,17 +731,26 @@
                                     //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                     obj.update({
                                         HMaterID: checkStatus.data[0].HItemID,
-                                        HMaterCode: checkStatus.data[0].HNumber,
-                                        HMaterName: checkStatus.data[0].HName,
-                                        HMaterSpec: checkStatus.data[0].HModel,
+                                        HMaterCode: checkStatus.data[0].鐗╂枡浠g爜,
+                                        HMaterName: checkStatus.data[0].鐗╂枡鍚嶇О,
+                                        HMaterSpec: checkStatus.data[0].瑙勬牸鍨嬪彿,
                                     });
                                     layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                                 }
                                 , btn2: function (index, layero) {
                                     //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
                                     //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
-                                },
-                                end: function () {
+                                }, end: function () {
+                                    if (OptionData.length > 0) {
+                                        //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                                        obj.update({
+                                            HMaterID: OptionData[0].HItemID,
+                                            HMaterCode: OptionData[0].鐗╂枡浠g爜,
+                                            HMaterName: OptionData[0].鐗╂枡鍚嶇О,
+                                            HMaterSpec: OptionData[0].瑙勬牸鍨嬪彿,
+                                        });
+                                        OptionData = [];
+                                    }
                                 }
                             });
                         }
@@ -612,7 +766,7 @@
                                 shift: 2,
                                 area: ['90%', '90%'],
                                 maxmin: true,
-                                content: ['../../PublicPage/UnitInformation.html', 'yes'],
+                                content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Unit.html', 'yes'],
                                 btn: ['纭畾', '鍙栨秷']
                                 , btn1: function (index, layero) {
 
@@ -626,8 +780,8 @@
                                     //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                     obj.update({
                                         HUnitID: checkStatus.data[0].HItemID,
-                                        HUnitCode: checkStatus.data[0].HNumber,
-                                        HUnitName: checkStatus.data[0].HName
+                                        HUnitCode: checkStatus.data[0].璁¢噺鍗曚綅浠g爜,
+                                        HUnitName: checkStatus.data[0].璁¢噺鍗曚綅鍚嶇О
                                     });
 
                                     layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
@@ -635,9 +789,16 @@
                                 , btn2: function (index, layero) {
                                     //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
                                     //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
-                                },
-                                end: function () {
-
+                                }, end: function () {
+                                    if (OptionData.length > 0) {
+                                        //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                                        obj.update({
+                                            HUnitID: OptionData[0].HItemID,
+                                            HUnitCode: OptionData[0].璁¢噺鍗曚綅浠g爜,
+                                            HUnitName: OptionData[0].璁¢噺鍗曚綅鍚嶇О
+                                        });
+                                        OptionData = [];
+                                    }
                                 }
                             });
                         }
@@ -653,7 +814,7 @@
                                 shift: 2,
                                 area: ['90%', '90%'],
                                 maxmin: true,
-                                content: ['../../PublicPage/SourceInformation.html', 'yes'],
+                                content: ['../../鍩虹璧勬枡/鐢熶骇鍩虹璧勬枡/Gy_Source.html', 'yes'],
                                 btn: ['纭畾', '鍙栨秷']
                                 , btn1: function (index, layero) {
 
@@ -667,8 +828,8 @@
                                     //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                     obj.update({
                                         HSourceID: checkStatus.data[0].HItemID,
-                                        HSourceCode: checkStatus.data[0].HNumber,
-                                        HSourceName: checkStatus.data[0].HName
+                                        HSourceCode: checkStatus.data[0].鐢熶骇璧勬簮浠g爜,
+                                        HSourceName: checkStatus.data[0].鐢熶骇璧勬簮鍚嶇О
                                     });
 
                                     layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
@@ -676,9 +837,16 @@
                                 , btn2: function (index, layero) {
                                     //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
                                     //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
-                                },
-                                end: function () {
-
+                                }, end: function () {
+                                    if (OptionData.length > 0) {
+                                        //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                                        obj.update({
+                                            HSourceID: OptionData[0].HItemID,
+                                            HSourceCode: OptionData[0].鐢熶骇璧勬簮浠g爜,
+                                            HSourceName: OptionData[0].鐢熶骇璧勬簮鍚嶇О
+                                        });
+                                        OptionData = [];
+                                    }
                                 }
                             });
                         }
@@ -694,7 +862,7 @@
                                 shift: 2,
                                 area: ['90%', '90%'],
                                 maxmin: true,
-                                content: ['../../PublicPage/UserInformation.html', 'yes'],
+                                content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_EmployeeList.html?type=HManager', 'yes'],
                                 btn: ['纭畾', '鍙栨秷']
                                 , btn1: function (index, layero) {
 
@@ -708,8 +876,8 @@
                                     //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                     obj.update({
                                         HWorkerid: checkStatus.data[0].HItemID,
-                                        HWorkerCode: checkStatus.data[0].HNumber,
-                                        HWorkerName: checkStatus.data[0].HName
+                                        HWorkerCode: checkStatus.data[0].鑱屽憳浠g爜,
+                                        HWorkerName: checkStatus.data[0].鑱屽憳鍚嶇О
                                     });
 
                                     layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
@@ -717,9 +885,16 @@
                                 , btn2: function (index, layero) {
                                     //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
                                     //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
-                                },
-                                end: function () {
-
+                                }, end: function () {
+                                    if (OptionData.length > 0) {
+                                        //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                                        obj.update({
+                                            HWorkerid: OptionData[0].HItemID,
+                                            HWorkerCode: OptionData[0].鑱屽憳浠g爜,
+                                            HWorkerName: OptionData[0].鑱屽憳鍚嶇О
+                                        });
+                                        OptionData = [];
+                                    }
                                 }
                             });
                         }
@@ -749,7 +924,18 @@
                     , { field: 'HWorkerid', title: 'HWorkerid', edit: 'text', width: 100, hide: true }
                     , { field: 'HWorkerCode', title: '鎿嶄綔鍛樹唬鐮�', edit: 'text', event: 'HWorkerCode', width: 100 }
                     , { field: 'HWorkerName', title: '鎿嶄綔鍛樺悕绉�', edit: 'text', width: 100 }
-                    , { field: 'HQty', title: '鐢熶骇鏁伴噺', edit: 'text', width: 100 }
+                    , { field: 'HQty', title: '鐢熶骇鏁伴噺', edit: 'text', width: 100, totalRow: true }
+                    , { field: 'HBadQty', title: '涓嶈壇鏁伴噺', edit: 'text', width: 100, totalRow: true }
+                    , { field: 'HICMOBillNo', title: '鐢熶骇璁㈠崟', edit: 'text', width: 100 }
+                    , { field: 'HICMOInterID', title: '鐢熶骇璁㈠崟鍐呯爜', edit: 'text', width: 100, hide: true }
+                    , { field: 'HICMOEntryID', title: '鐢熶骇璁㈠崟瀛愬唴鐮�', edit: 'text', width: 100, hide: true }
+
+                    , { field: 'HSourceInterID', title: '婧愬崟鍐呯爜', edit: 'text', width: 100, hide: true }
+                    , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', edit: 'text', width: 100, hide: true }
+                    , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', edit: 'text', width: 100, hide: true }
+                    , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', edit: 'text', width: 100, hide: true }
+                    , { field: 'HICMOTempID', title: 'HICMOTempID', edit: 'text', width: 100, hide: true }
+
                     , { field: 'HRemark', title: '琛ㄤ綋澶囨敞', edit: 'text', width: 100 }
                     , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 150 }
                 ];
@@ -759,8 +945,43 @@
                     , toolbar: '#toolbarDemo'
                     , page: false
                     , cellMinWidth: 120
+                    , totalRow: true
                     , height: 500
                     , cols: [columns]
+                    , done: function (res, curr, count) {
+
+                    }
+                };
+
+                columns_prodReport = [
+                    { type: 'checkbox', fixed: 'left' }
+                    , { templet: '#xuhao', title: '搴忓彿', sort: true, fixed: 'left', event: "qwe", width: 100 }
+                    , { field: 'HMaterID', title: 'HMaterID', edit: 'text', width: 100, hide: true }
+                    , { field: 'HMaterCode', title: '鐗╂枡浠g爜', edit: 'text', event: 'HMaterCode', width: 100 }
+                    , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', edit: 'text', width: 100 }
+                    , { field: 'HMaterSpec', title: '瑙勬牸鍨嬪彿', edit: 'text', width: 100 }
+                    , { field: 'HSourceID', title: 'HSourceID', edit: 'text', width: 100, hide: true }
+                    , { field: 'HSourceCode', title: '璧勬簮浠g爜', edit: 'text', event: 'HSourceCode', width: 100 }
+                    , { field: 'HSourceName', title: '璧勬簮鍚嶇О', edit: 'text', width: 100 }
+                    , { field: 'HWorkerid', title: 'HWorkerid', edit: 'text', width: 100, hide: true }
+                    , { field: 'HWorkerCode', title: '鎿嶄綔鍛樹唬鐮�', edit: 'text', event: 'HWorkerCode', width: 100 }
+                    , { field: 'HWorkerName', title: '鎿嶄綔鍛樺悕绉�', edit: 'text', width: 100 }
+                    , { field: 'HQty', title: '鐢熶骇鏁伴噺', edit: 'text', width: 100, totalRow: true }
+                    , { field: 'HBadQty', title: '涓嶈壇鏁伴噺', edit: 'text', width: 100, totalRow: true }
+                    , { field: 'HICMOBillNo', title: '鐢熶骇璁㈠崟', edit: 'text', width: 100 }
+                    , { field: 'HRemark', title: '琛ㄤ綋澶囨敞', edit: 'text', width: 100 }
+                    , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 150 }
+                ];
+                option_prodReport = {
+                    id: 'mainTable_prodReport'
+                    , elem: '#mainTable_prodReport'
+                    , page: true
+                    , totalRow: true
+                    , limit: 1000
+                    , limits: [500, 1000, 1500, 2000, 3000]
+                    , cellMinWidth: 120
+                    , height: 500
+                    , cols: [columns_prodReport]
                     , done: function (res, curr, count) {
 
                     }
@@ -769,12 +990,11 @@
             //#endregion
 
             //#region 鑾峰彇鏈�澶у崟鎹彿
-            function set_MAXNum() {
+            function get_MAXNum() {
                 var date = new Date();
                 var day = date.getDate();
                 var month = date.getMonth() + 1;
                 var year = date.getFullYear();
-                var shijian = year + "-" + month + "-" + day;
                 //鑾峰彇鏈�澶у崟鎹彿 new
                 $("#HInterID").val("0");
                 $("#HBillNo").val("");
@@ -785,8 +1005,11 @@
                     success: function (d) {
                         //console.log(d.data);
                         $("#HBillNo").val(d.data[0].HBillNo);
-                        $("#HDate").val(shijian);
-                        $("#HInterID").val(0);
+                        $("#HInterID").val(d.data[0].HInterID);
+                        $("#HDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
+                        $("#HMakeDate").val(Pub_Format(new Date(), "yyyy-MM-dd"));
+                        $("#HMaker").val(sessionStorage["HUserName"]);
+                        PicUpload();
                     }
                 });
             }
@@ -795,14 +1018,19 @@
             //#region 鏃犳簮鍗曟柊澧�
             function set_AddFNew() {
                 //鑾峰彇鏈�澶у崟鎹彿
-                set_MAXNum();
+                get_MAXNum();
                 $('#HMainSourceBillNo').attr("disabled", false);
                 $('#XDHList').addClass("layui-btn-disabled").attr("disabled", true);
                 $('#set_CheckBill').addClass("layui-btn-disabled").attr("disabled", true);
                 $('#set_AbandonCheck').addClass("layui-btn-disabled").attr("disabled", true);
                 $('#set_DeleteBill').addClass("layui-btn-disabled").attr("disabled", true);
                 $('#get_PrintReport').addClass("layui-btn-disabled").attr("disabled", true);
-                option.data = [TabRow];
+                option.data = [{
+                    "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
+                    "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0,
+                    "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
+                    "HSourceBillType": 0, "HICMOTempID": 0
+                }];
                 table.render(option);
             }
             //#endregion
@@ -810,9 +1038,67 @@
             //#region 鏈夋簮鍗曟柊澧�
             function set_AddNew() {
                 //鑾峰彇鏈�澶у崟鎹彿
-                set_MAXNum();
-                option.data = [TabRow];
-                table.render(option);
+                get_MAXNum();
+                if (linterid.length > 0 && HSouceBillType == 3724) {
+                    var arr = [];
+                    var arr_detail = [];
+                    $.ajax({
+                        url: GetWEBURL() + "Sc_ICMOReportBill/GetProdReportBillList",
+                        type: "GET",
+                        data: {
+                            "HInterID": linterid,
+                            "user": sessionStorage["HUserName"]
+                        },
+                        async: false,
+                        success: function (result) {
+                            if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                var data = result.data.h_p_Sc_ICMOBillWorkQtyStatus_TmpList1; //姹囨�讳俊鎭�
+                                var data_detail = result.data.h_p_Sc_ICMOBillWorkQtyStatus_TmpList; //鏄庣粏淇℃伅
+
+                                for (let i = 0; i < data.length; i++) {
+                                    arr.push({
+                                        "HMaterID": data[i].鐗╂枡ID, "HMaterCode": data[i].鐗╂枡浠g爜, "HMaterName": data[i].鐗╂枡鍚嶇О, "HMaterSpec": data[i].瑙勬牸鍨嬪彿,
+                                        "HUnitID": data[i].鍗曚綅ID, "HUnitCode": data[i].璁¢噺鍗曚綅浠g爜, "HUnitName": data[i].璁¢噺鍗曚綅, "HSourceID": data[i].鐢熶骇璧勬簮ID, "HSourceCode": data[i].鐢熶骇璧勬簮浠g爜,
+                                        "HSourceName": data[i].鐢熶骇璧勬簮鍚嶇О, "HWorkerid": data[i].鎿嶄綔鍛業D, "HWorkerCode": data[i].鎿嶄綔鍛樹唬鐮�,
+                                        "HWorkerName": data[i].鎿嶄綔鍛樺悕绉�, "HQty": data[i].浜ч噺, "HBadQty": data[i].涓嶈壇鏁伴噺 == '' ? 0 : data[i].涓嶈壇鏁伴噺, "HICMOBillNo": data[i].鐢熶骇璁㈠崟鍙�,
+                                        "HICMOInterID": data[i].HICMOInterID, "HICMOEntryID": data[i].HICMOEntryID, "HRemark": "", "HSourceInterID": data[i].HICMOInterID, "HSourceEntryID": data[i].HICMOEntryID, "HSourceBillNo": data[i].鐢熶骇璁㈠崟鍙�,
+                                        "HSourceBillType": 3710, "HICMOTempID": data[i].HICMOTempID
+                                    });
+                                }
+
+                                for (let j = 0; j < data_detail.length; j++) {
+                                    arr_detail.push({
+                                        "HMaterID": data_detail[j].鐗╂枡ID, "HMaterCode": data_detail[j].鐗╂枡浠g爜, "HMaterName": data_detail[j].鐗╂枡鍚嶇О,
+                                        "HMaterSpec": data_detail[j].瑙勬牸鍨嬪彿, "HUnitID": 0, "HUnitCode": "", "HUnitName": "", "HSourceID": data_detail[j].鐢熶骇璧勬簮ID,
+                                        "HSourceCode": data_detail[j].鐢熶骇璧勬簮浠g爜, "HSourceName": data_detail[j].鐢熶骇璧勬簮鍚嶇О, "HWorkerid": data_detail[j].鎿嶄綔鍛業D,
+                                        "HWorkerCode": data_detail[j].鎿嶄綔鍛樹唬鐮�, "HWorkerName": data_detail[j].鎿嶄綔鍛樺悕绉�, "HQty": data_detail[j].浜ч噺,
+                                        "HBadQty": data_detail[j].涓嶈壇鏁伴噺, "HICMOBillNo": data_detail[j].鐢熶骇璁㈠崟鍙�, "HRemark": ""
+                                    })
+                                }
+                            } else {
+                                layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+                            }
+                        }, error: function () {
+                            layer.alert("鍙戠敓閿欒!", { icon: 5 });
+                        }
+                    });
+
+                    option.data = arr;
+                    console.log(option.data);
+                    table.render(option);
+
+                    option_prodReport.data = arr_detail;
+                    table.render(option_prodReport);
+                } else {
+                    option.data = [{
+                        "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
+                        "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0,
+                        "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
+                        "HSourceBillType": 0, "HICMOTempID": 0
+                    }];
+                    table.render(option);
+                }
+
             }
             //#endregion
 
@@ -820,7 +1106,12 @@
             function set_EditFromGrid() {
                 set_EditForm(linterid);  //缂栬緫鑾峰彇琛ㄥご
                 set_EditGrid(linterid);  //缂栬緫鑾峰彇琛ㄤ綋
-                option.data = [TabRow];
+                option.data = [{
+                    "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "",
+                    "HSourceID": 0, "HSourceCode": "", "HSourceName": "", "HWorkerid": 0, "HWorkerCode": "", "HWorkerName": "", "HQty": 0, "HBadQty": 0,
+                    "HICMOBillNo": "", "HICMOInterID": "0", "HICMOEntryID": "0", "HRemark": "", "HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "",
+                    "HSourceBillType": 0, "HICMOTempID": 0
+                }];
                 table.render(option);
             }
             //#endregion
@@ -837,23 +1128,24 @@
                     success: function (result) {
                         if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
                             var data = result.data.h_v_IF_ICMOReportBillList_Edit[0];
-                            console.info(data);
-                            form.val("component-form-group", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
-                                "HBillNo": data.鍗曟嵁鍙�
-                                , "HDate": formatDate(data.鏃ユ湡)
-                                , "HInnerBillNo": data.鍐呴儴鍗曟嵁鍙�
-                                , "HDeptID": data.HDeptID                //鐢熶骇杞﹂棿ID
-                                , "HDeptName": data.閮ㄩ棬                 //鐢熶骇杞﹂棿鍚嶇О
-                                , "HGroupID": data.HGroupID              //鐝粍ID
-                                , "HGroupName": data.鐝粍                //鐝粍鍚嶇О
-                                , "HEmpID": data.HEmpID                  //缁熻鍛業D
-                                , "HEmpName": data.缁熻鍛�                //缁熻鍛樺悕绉�
-                                , "HMainSourceBillNo": data.HMainSourceBillNo
-                                , "HMainSourceInterID": data.HMainSourceInterID
-                                , "HMainSourceEntryID": data.HMainSourceEntryID
-                                , "HExplanation": ""                      //鎽樿
-                                , "HRemark": data.琛ㄥご澶囨敞                //澶囨敞
-                            });
+                            //console.info(data);
+                            $("#HBillNo").val(data.鍗曟嵁鍙�);
+                            $("#HDate").val(formatDate(data.鏃ユ湡));
+                            $("#HInnerBillNo").val(data.鍐呴儴鍗曟嵁鍙�);
+                            $("#HDeptID").val(data.HDeptID);
+                            $("#HDeptName").val(data.閮ㄩ棬);
+                            $("#HDeptNumber").val(data.閮ㄩ棬浠g爜);
+                            $("#HGroupID").val(data.HGroupID);
+                            $("#HGroupName").val(data.鐝粍);
+                            $("#HEmpID").val(data.HEmpID);
+                            $("#HEmpName").val(data.缁熻鍛�);
+                            $("#HMainSourceBillNo").val(data.HMainSourceBillNo);
+                            $("#HMainSourceInterID").val(data.HMainSourceInterID);
+                            $("#HMainSourceEntryID").val(data.HMainSourceEntryID);
+                            $("#HExplanation").val("");
+                            $("#HRemark").val(data.琛ㄥご澶囨敞);
+                            PicUpload();
+                            get_file();
                         } else {
                             layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
                         }
@@ -876,7 +1168,6 @@
                         if (result.count == 1) {
                             option.data = result.data;
                             table.render(option);
-
                         } else {
                             layer.alert(result.code + result.Message, { icon: 5 });
                         }
@@ -945,15 +1236,15 @@
             //#region 闈炵┖楠岃瘉
             function AllowLoadData(sSubStr) {  //闈炵┖楠岃瘉
                 var Result = true;
-                if ($("#HDeptID").val() == '' || $("#HDeptID").val() == null) {
+                if ($("#HDeptID").val() == '' || $("#HDeptID").val() == null || $("#HDeptID").val() == "undefined" || $("#HDeptID").val() == 0) {
                     layer.msg("杞﹂棿涓嶈兘涓虹┖!", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return Result = false;
                 }
-                if ($("#HGroupID").val() == '' || $("#HGroupID").val() == null) {
+                if ($("#HGroupID").val() == '' || $("#HGroupID").val() == null || $("#HGroupID").val() == "undefined" | $("#HGroupID").val() == 0) {
                     layer.msg("鐝粍涓嶈兘涓虹┖锛�", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return Result = false;
                 }
-                if ($("#HEmpID").val() == '' || $("#HEmpID").val() == null) {
+                if ($("#HEmpID").val() == '' || $("#HEmpID").val() == null || $("#HGroupID").val() == "undefined" || $("#HEmpID").val() == 0) {
                     layer.msg("缁熻鍛樹笉鑳戒负绌猴紒", { icon: 5, btn: ['纭'], time: 2000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return Result = false;
                 }
@@ -1004,12 +1295,241 @@
             }
             //#endregion
 
+            //#region 閫夋嫨缁熻鍛樻柟娉�
+            function get_checkEmp() {
+                layer.open({
+                    type: 2//寮圭獥绫诲瀷
+                    , skin: 'layui-layer-rim' //鍔犱笂杈规
+                    , area: ['90%', '90%']//澶у皬
+                    , title: '鑱屽憳鍒楄〃'//鏍囬
+                    , shift: 2//寮瑰嚭鍔ㄧ敾
+                    , 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(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) { }
+                })
+            }
             //#endregion
+
+            //#region 閫夋嫨閮ㄩ棬鏂规硶
+            function get_checkDept() {
+                layer.open({
+                    type: 2//寮圭獥绫诲瀷
+                    , skin: 'layui-layer-rim' //鍔犱笂杈规
+                    , area: ['90%', '90%']//澶у皬
+                    , title: '閮ㄩ棬鍒楄〃'//鏍囬
+                    , shift: 2//寮瑰嚭鍔ㄧ敾
+                    , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_DepartmentList.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('璇烽�夋嫨鏁版嵁');
+                        }
+                        $("#HDeptName").val(checkStatus.data[0].閮ㄩ棬鍚嶇О);
+                        $("#HDeptID").val(checkStatus.data[0].HItemID);
+                        $("#HDeptNumber").val(checkStatus.data[0].閮ㄩ棬浠g爜);
+                        layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                    }
+                    , btn2: function (index, layero) { }
+                })
+            }
+            //#endregion
+
+            //#region 鏂囦欢涓婁紶
+            function PicUpload() {
+                //澶氬浘鐗囦笂浼�
+                //澶氭枃浠跺垪琛ㄧず渚�
+                var ProImgByList = $('#ProImgByList')
+                    , uploadListIns = upload.render({
+                        elem: '#testList'
+                        , url: GetWEBURL() + "/Cj_StationOutBill/UploadFile1"
+                        , accept: 'file'
+                        , multiple: true
+                        , auto: false
+                        //, bindAction: '#testListAction' //鎸夋壄缁戝畾
+                        , data: { "HBillNo": $("#HBillNo").val(), "HRemark": $("#HRemark").val(), "HUserName": sessionStorage["HUserName"] }
+                        , choose: function (obj) {
+                            var files = this.files = obj.pushFile(); //灏嗘瘡娆¢�夋嫨鐨勬枃浠惰拷鍔犲埌鏂囦欢闃熷垪
+                            //璇诲彇鏈湴鏂囦欢
+                            obj.preview(function (index, file, result) {
+                                var tr = $(['<tr id="upload-' + index + '">'
+                                    , '<td>' + file.name + '</td>'
+                                    , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
+                                    , '<td>绛夊緟涓婁紶</td>'
+                                    , '<td>'
+                                    , '<button class="layui-btn layui-btn-xs demo-reload ">涓婁紶</button>'
+                                    , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">鍒犻櫎</button>'
+                                    , '</td>'
+                                    , '</tr>'].join(''));
+
+                                //鍗曚釜閲嶄紶
+                                tr.find('.demo-reload').on('click', function () {
+                                    obj.upload(index, file);
+                                    return false;
+                                });
+
+                                //鍒犻櫎
+                                tr.find('.demo-delete').on('click', function () {
+                                    delete files[index]; //鍒犻櫎瀵瑰簲鐨勬枃浠�
+                                    tr.remove();
+                                    uploadListIns.config.elem.next()[0].value = ''; //娓呯┖ input file 鍊硷紝浠ュ厤鍒犻櫎鍚庡嚭鐜板悓鍚嶆枃浠朵笉鍙��
+                                });
+
+                                ProImgByList.append(tr);
+                            });
+                        }
+                        , done: function (res, index, upload) {
+                            if (res.code == 1) { //涓婁紶鎴愬姛
+                                var tr = ProImgByList.find('tr#upload-' + index)
+                                    , tds = tr.children();
+                                tds.eq(2).html('<span style="color: #5FB878;">涓婁紶鎴愬姛</span>');
+                                tds.eq(3).html(''); //娓呯┖鎿嶄綔
+                                //tds.eq(3).find('.demo-reload').addClass('layui-hide'); //闅愯棌涓婁紶
+                                return delete this.files[index]; //鍒犻櫎鏂囦欢闃熷垪宸茬粡涓婁紶鎴愬姛鐨勬枃浠�
+                            }
+                            this.error(index, upload);
+                        }
+                        , error: function (index, upload) {
+                            var tr = ProImgByList.find('tr#upload-' + index)
+                                , tds = tr.children();
+                            tds.eq(2).html('<span style="color: #FF5722;">涓婁紶澶辫触[妫�鏌ユ枃浠跺悕鍙婃枃浠舵牸寮廬</span>');
+                            tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //鏄剧ず涓婁紶
+                        }
+                    });
+            }
+            //#endregion
+
+
+            //鑾峰彇缂栬緫鏃�,宸蹭笂浼犵殑鏂囦欢鍒楄〃
+            function get_file() {
+                var HBillNo = $("#HBillNo").val()
+                if (HBillNo != null || HBillNo != undefined) {
+                    var ProImgByList = $('#ProImgByList')
+                    $.ajax({
+                        url: GetWEBURL() + '/Cj_StationOutBill/Filelist',
+                        type: "GET",
+                        data: { "HBillNo": HBillNo },
+                        success: function (data1) {
+                            if (data1.count == 1) {
+                                var index = 0;
+                                for (var i = 0; i < data1.data.length; i++) {
+                                    var tr = $(['<tr id="upload-' + i + '">'
+                                        , '<td style="display:none">' + data1.data[i].HItemID + '</td>'
+                                        , '<td style="display:none">' + data1.data[i].HSourceBillNo + '</td>'
+                                        , '<td>' + data1.data[i].HFileName + '</td>'
+                                        , '<td>' + (data1.data[i].HFileSize / 1014).toFixed(1) + 'kb</td>'
+                                        , '<td style="color: #5FB878;">涓婁紶鎴愬姛</td>'
+                                        , '<td style="display:none">' + data1.data[i].url + '</td>'
+                                        , '<td>'
+                                        , '<button class="layui-btn layui-btn-xs  demo-dowload" type="button" id="deltefile" onclick="javascript:dowload(this)"><i class="layui-icon layui-icon-download-circle layuiadmin-button-btn"></i>涓嬭浇</button>'
+                                        , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete" type="button" id="deltefile" onclick="javascript:toManager(this)"><i class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>鍒犻櫎</button>'
+                                        , '</td>'
+                                        , '</tr>'].join(''));
+                                    $('#ProImgByList').append(tr);
+                                }
+                            } else {
+                                layer.alert(data1.code + data1.Message, { icon: 5 });
+                            }
+                        }, error: function () {
+                            layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                        }
+                    });
+                }
+            }
+
+
+
+            //#endregion
+
 
 
         });
 
 
+        //鍒犻櫎鏂囦欢
+        function toManager(r) {
+            //寰楀埌褰撳墠鎵�鍦ㄨ
+            var rows = r.parentNode.parentNode.rowIndex;
+            //寰楀埌鎵�鍦ㄨ鐨勭涓�鍒楃殑鍐呭:涓婚敭ID
+            var HItemID = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(0)").html();
+            //寰楀埌鎵�鍦ㄨ鐨勭浜屽垪鐨勫唴瀹�:鍗曟嵁鍙�
+            var HSourceBillNo = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(1)").html();
+            //寰楀埌鎵�鍦ㄨ鐨勭涓夊垪鐨勫唴瀹�:鏂囦欢鍚嶇О
+            var HFileName = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(2)").html();
+            layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗涓嶈兘鎭㈠", { title: "鍒犻櫎纭" }, function (index) {
+
+                //鍒犻櫎宸蹭笂浼犳枃浠�
+                $.ajax({
+                    url: GetWEBURL() + '/Cj_StationOutBill/DeleteFilelist',
+                    type: "GET",
+                    data: { "HItemID": HItemID, "HSourceBillNo": HSourceBillNo, "HFileName": HFileName },
+                    success: function (data1) {
+                        if (data1.count == 1) {
+                            layer.alert(data1.Message, { icon: 1 });
+                            $("#ProImgByList tr").eq((rows - 1)).remove();
+                        }
+                        else {
+                            layer.alert(data1.code + data1.Message, { icon: 5 });
+                        }
+                    }, error: function () {
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            })
+        }
+
+        //涓嬭浇鏂囦欢
+        function dowload(r) {
+            //寰楀埌褰撳墠鎵�鍦ㄨ
+            var rows = r.parentNode.parentNode.rowIndex;
+            //寰楀埌鎵�鍦ㄨ鐨勭浜斿垪鐨勫唴瀹�:鏂囦欢鍦板潃
+            var url = $("#ProImgByList tr:eq(" + (rows - 1) + ") td:eq(5)").html();
+            /*window.location.href = url;*/
+            window.open(url)
+        }
+        //鐢熶骇杞﹂棿
+        function GetHDeptNameValue(obj) {
+            $("#HDeptName").val(obj[0].閮ㄩ棬鍚嶇О);
+            $("#HDeptID").val(obj[0].HItemID);
+            $("#HDeptNumber").val(obj[0].閮ㄩ棬浠g爜);
+        }
+        //鐢熶骇鐝粍
+        function GetHGroupValue(obj) {
+            $("#HGroupName").val(obj[0].鐝粍鍚嶇О);
+            $("#HGroupID").val(obj[0].HItemID);
+        }
+        //缁熻鍛�
+        function GetHEmpValue(obj) {
+            $("#HEmpName").val(obj[0].鑱屽憳鍚嶇О);
+            $("#HEmpID").val(obj[0].HItemID);
+        }
+        //鐗╂枡
+        function GetMaterValue(obj) {
+            OptionData = obj;
+        }
+        //鍗曚綅
+        function GetUnitValue(obj) {
+            OptionData = obj;
+        }
+        //鐢熶骇璧勬簮
+        function GetGySource(obj) {
+            OptionData[0] = obj;
+        }
+        //鎿嶄綔鍛�
+        function GetHManagerValue(obj) {
+            OptionData = obj;
+        }
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1