From befd7c022b9156ae87404fdb9c3f644db08cecd0 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期三, 18 六月 2025 10:17:13 +0800
Subject: [PATCH] 排产取消分页,提料计划添加列设置,工程项目任务类销售出库单费用带保存待审核修改

---
 WebTM/views/验收入库/外购入库/Kf_POStockInBackBill_Add_Up.html | 1186 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 825 insertions(+), 361 deletions(-)

diff --git "a/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBackBill_Add_Up.html" "b/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBackBill_Add_Up.html"
index 7b83378..c24734b 100644
--- "a/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBackBill_Add_Up.html"
+++ "b/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBackBill_Add_Up.html"
@@ -66,7 +66,7 @@
                                 <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>
+                                            <label class="layui-form-label">鍗曟嵁鍙�<label style="color:red"> * </label></label>
                                             <div class="layui-input-inline">
                                                 <input type="text" class="layui-input" name="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
                                                 <input type="hidden" name="HInterID" id="HInterID" value="0">
@@ -74,43 +74,53 @@
                                             </div>
                                         </div>
                                         <div class="layui-col-xs4 layui-inline">
-                                            <label class="layui-form-label">鏃ユ湡</label>
+                                            <label class="layui-form-label">鏃ユ湡<label style="color:red"> * </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" style="background-color:#efefef4d;">
+                                                <input type="date" class="layui-input" name="HDate" id="HDate" autocomplete="off" model="datetime" dateFormat="yyyy-MM-dd" placeholder="yyyy-MM-dd" 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 class="layui-input" name="HInnerBillNo" id="HInnerBillNo" autocomplete="off">
+                                                <input class="layui-input" name="HInnerBillNo" id="HInnerBillNo" autocomplete=" off" 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" name="HSupName" id="HSupName" class="layui-input" value="" style="float:left;width:150px;">
-                                                <input type="hidden" name="HSupID" id="HSupID" class="layui-input" value=0 style="float:left;width:150px;">
-                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HSupList" 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>
+                                            <label class="layui-form-label">涓氬姟鍛�<label style="color:red"> * </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;">
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" style="width:40px;display:none;">
                                                     <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>
+                                            <label class="layui-form-label">閮ㄩ棬<label style="color:red"> * </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" style="width:40px;display:none;">
+                                                    <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 style="color:red"> * </label></label>
+                                            <div class="layui-input-inline">
+                                                <input type="text" name="HSupName" id="HSupName" class="layui-input" value="" style="float:left;width:150px;">
+                                                <input type="hidden" name="HSupID" id="HSupID" class="layui-input" value=0 style="float:left;width:150px;">
+                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HSupList" style="width:40px;display:none;">
+                                                    <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 style="color:red"> * </label></label>
                                             <div class="layui-input-inline">
                                                 <input type="text" name="HWHName" id="HWHName" class="layui-input" value="" style="float:left;width:150px;">
                                                 <input type="hidden" name="HWHID" id="HWHID" class="layui-input" value=0 style="float:left;width:150px;">
@@ -119,11 +129,8 @@
                                                 </button>
                                             </div>
                                         </div>
-
-                                    </div>
-                                    <div class="layui-row">
                                         <div class="layui-col-xs4 layui-inline">
-                                            <label class="layui-form-label">楠屾敹鍛�</label>
+                                            <label class="layui-form-label">閫�鏂欏憳<label style="color:red"> * </label></label>
                                             <div class="layui-input-inline">
                                                 <input type="text" name="HSecManagerName" id="HSecManagerName" class="layui-input" value="" style="float:left;width:150px;">
                                                 <input type="hidden" name="HSecManagerID" id="HSecManagerID" class="layui-input" value=0 style="float:left;width:150px;">
@@ -132,28 +139,30 @@
                                                 </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="HKeeperName" id="HKeeperName" class="layui-input" value="" style="float:left;width:150px;">
-                                                <input type="hidden" name="HKeeperID" id="HKeeperID" class="layui-input" value=0 style="float:left;width:150px;">
-                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HKeeperList" 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="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" 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" style="display:none;">
+                                    <div class="layui-col-xs4 layui-inline" style="display:none;">
+                                        <label class="layui-form-label">淇濈鍛�</label>
+                                        <div class="layui-input-inline">
+                                            <input type="text" name="HKeeperName" id="HKeeperName" class="layui-input" value="" style="float:left;width:150px;">
+                                            <input type="hidden" name="HKeeperID" id="HKeeperID" class="layui-input" value=0 style="float:left;width:150px;">
+                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HKeeperList" 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">
+                                    <div class="layui-col-xs4 layui-inline" style="display:none;">
+                                        <label class="layui-form-label">璐熻矗浜�</label>
+                                        <div class="layui-input-inline">
+                                            <input type="text" name="HManagerName" id="HManagerName" class="layui-input" value="" style="float:left;width:150px;">
+                                            <input type="hidden" name="HManagerID" id="HManagerID" class="layui-input" value=0 style="float:left;width:150px;">
+                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HManagerList" 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" style="display:none;">
                                         <label class="layui-form-label">婧愬崟绫诲瀷</label>
                                         <div class="layui-input-inline">
                                             <select name="HSourceBillType" id="HSourceBillType" lay-verify="HSourceBillType">
@@ -161,7 +170,7 @@
                                             </select>
                                         </div>
                                     </div>
-                                    <div class="layui-col-xs4 layui-inline">
+                                    <div class="layui-col-xs4 layui-inline" style="display:none;">
                                         <label class="layui-form-label">閫夊崟鍙�</label>
                                         <div class="layui-input-inline">
                                             <input type="text" name="" id="" class="layui-input" value="" style="float:left;width:150px;">
@@ -171,50 +180,32 @@
                                             </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="HManagerName" id="HManagerName" class="layui-input" value="" style="float:left;width:150px;">
-                                                <input type="hidden" name="HManagerID" id="HManagerID" class="layui-input" value=0 style="float:left;width:150px;">
-                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="HManagerList" 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-xs7 layui-inline">
-                                            <label class="layui-form-label">鎽樿</label>
-                                            <div class="layui-input-block">
-                                                <input class="layui-input" name="HExplanation" id="HExplanation" autocomplete="off">
-                                            </div>
+                                    <div class="layui-col-xs7 layui-inline">
+                                        <label class="layui-form-label">鎽樿</label>
+                                        <div class="layui-input-block">
+                                            <input class="layui-input" name="HExplanation" id="HExplanation" autocomplete="off">
                                         </div>
                                     </div>
-                                    <div class="layui-row">
-                                        <div class="layui-col-xs7 layui-inline">
-                                            <label class="layui-form-label">澶囨敞</label>
-                                            <div class="layui-input-block">
-                                                <input class="layui-input" name="HRemark" id="HRemark" autocomplete="off">
-                                            </div>
+                                </div>
+                                <div class="layui-row">
+                                    <div class="layui-col-xs7 layui-inline">
+                                        <label class="layui-form-label">澶囨敞</label>
+                                        <div class="layui-input-block">
+                                            <input class="layui-input" name="HRemark" id="HRemark" autocomplete="off">
                                         </div>
                                     </div>
-                                    <div class="layui-row">
-                                        <div class="layui-inline">
-                                            <label class="layui-form-label" style="width: 85px;">缁勭粐</label>
-                                            <div class="layui-input-block" style="margin-left: 120px; width: 185px;">
-                                                <select name="HOrgID" id="HOrgID" lay-verify="HOrgID">
-                                                    <!--鍔ㄦ�佹覆鏌撶粍缁�-->
-                                                </select>
-                                            </div>
+                                </div>
+                                <div class="layui-row">
+                                    <div class="layui-inline">
+                                        <label class="layui-form-label" style="width: 85px;">缁勭粐</label>
+                                        <div class="layui-input-block" style="margin-left: 120px; width: 185px;">
+                                            <select name="HOrgID" id="HOrgID" lay-verify="HOrgID">
+                                                <!--鍔ㄦ�佹覆鏌撶粍缁�-->
+                                            </select>
                                         </div>
                                     </div>
                                 </div>
                             </div>
-
-
                             <!--鍒跺崟淇℃伅-->
                             <div class="layui-tab-item">
                                 <div class="layui-form-item">
@@ -240,20 +231,6 @@
                                     </div>
                                     <div class="layui-row">
                                         <div class="layui-inline">
-                                            <label class="layui-form-label" style="width: 85px;">淇敼浜�</label>
-                                            <div class="layui-input-block" style="margin-left: 120px;">
-                                                <input type="text" class="layui-input" name="HUpDater" id="HUpDater" style="background-color:#efefef4d;" readonly>
-                                            </div>
-                                        </div>
-                                        <div class="layui-inline">
-                                            <label class="layui-form-label" style="width: 85px;">浣滃簾浜�</label>
-                                            <div class="layui-input-block" style="margin-left: 120px;">
-                                                <input type="text" class="layui-input" name="HDeleteMan " id="HDeleteMan " style="background-color:#efefef4d;" readonly>
-                                            </div>
-                                        </div>
-                                    </div>
-                                    <div class="layui-row">
-                                        <div class="layui-inline">
                                             <label class="layui-form-label" style="width: 85px;">鍒跺崟鏃ユ湡</label>
                                             <div class="layui-input-block" style="margin-left: 120px;">
                                                 <input type="text" class="layui-input" name="HMakeDate" id="HMakeDate" style="background-color:#efefef4d;" readonly>
@@ -271,32 +248,51 @@
                                                 <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-inline">
+                                            <label class="layui-form-label" style="width: 85px;">淇敼浜�</label>
+                                            <div class="layui-input-block" style="margin-left: 120px;">
+                                                <input type="text" class="layui-input" name="HUpDater" id="HUpDater" style="background-color:#efefef4d;" readonly>
+                                            </div>
+                                        </div>
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label" style="width: 85px;">浣滃簾浜�</label>
+                                            <div class="layui-input-block" style="margin-left: 120px;">
+                                                <input type="text" class="layui-input" name="HDeleteMan" id="HDeleteMan" style="background-color:#efefef4d;" readonly>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="layui-row">
                                         <div class="layui-inline">
                                             <label class="layui-form-label" style="width: 85px;">淇敼鏃ユ湡</label>
                                             <div class="layui-input-block" style="margin-left: 120px;">
                                                 <input type="text" class="layui-input" name="HUpDateDate" id="HUpDateDate" style="background-color:#efefef4d;" readonly>
                                             </div>
                                         </div>
-                                        <div class="layui-row">
-                                            <div class="layui-inline">
-                                                <label class="layui-form-label" style="width: 85px;">浣滃簾鏃ユ湡</label>
-                                                <div class="layui-input-block" style="margin-left: 120px;">
-                                                    <input type="text" class="layui-input" name="HDeleteDate" id="HDeleteDate" style="background-color:#efefef4d;" readonly>
-                                                </div>
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label" style="width: 85px;">浣滃簾鏃ユ湡</label>
+                                            <div class="layui-input-block" style="margin-left: 120px;">
+                                                <input type="text" class="layui-input" name="HDeleteDate" id="HDeleteDate" style="background-color:#efefef4d;" readonly>
                                             </div>
                                         </div>
                                     </div>
                                 </div>
                             </div>
                         </div>
+
+
+
                     </div>
 
                     <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>
+                            <!-- <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>-->
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>鍒楄缃�</button>
+                            <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Inventory" id="get_Inventory"><i class="layui-icon layui-icon-form"></i>搴撳瓨鏌ヨ</button>
+                            <!--  <button type="button" class="layui-btn layui-btn-sm" lay-event="get_InOutSum" id="get_InOutSum"><i class="layui-icon layui-icon-form"></i>鍑哄叆搴撹褰曟煡璇�</button>-->
                         </div>
                     </script>
                     <script type="text/html" id="xuhao">
@@ -334,14 +330,14 @@
 
             var allVal;
             //#endregion
-
+            var HModName = "Kf_POStockInBackBill_Add_Up"
 
             //#region 杩涘叆椤甸潰鍗冲姞杞�
 
             //鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
             get_LoginIs();
             //鑾峰彇缁勭粐
-            Organ() ;
+            Organ();
 
             //#region 銆愬姩鎬佽幏鍙栨ā鍧楀悕绉般��
             var HModuleType = "1239";
@@ -352,8 +348,8 @@
 
             //鑾峰彇婧愬崟绫诲瀷
             HSourceBillType();
-           
-         //鑾峰彇椤甸潰璺宠浆鍙傛暟
+
+            //鑾峰彇椤甸潰璺宠浆鍙傛暟
             var params = get_UrlVars();
             if (typeof (params[params[0]]) == "undefined") {
                 OperationType = 1;//鎿嶄綔绫诲瀷
@@ -363,17 +359,17 @@
                 var HSouceBillType = params[params[2]];//婧愬崟绫诲瀷
             }
 
-           // 鍒濆鍖栫晫
+            // 鍒濆鍖栫晫
             set_InitGrid();
 
-        //#region 鑾峰彇鏈�澶у崟鎹彿
+            //#region 鑾峰彇鏈�澶у崟鎹彿
             function get_MAXNum() {
                 $("#HInterID").val("0");
                 $("#HBillNo").val("");
                 $.ajax({
                     url: GetWEBURL() + "/WEBSController/GetMaxBillNoAndID_Json",
                     type: "GET",
-                    data: { "HBillType": '1103' },
+                    data: { "HBillType": '1239' },
                     success: function (d) {
                         $("#HBillNo").val(d.data[0].HBillNo);
                         $("#HInterID").val(d.data[0].HInterID);
@@ -382,9 +378,9 @@
             }
             //#endregion
 
-         //#region 鍒ゆ柇鎿嶄綔绫诲瀷骞跺垵濮嬪寲鐣岄潰
+            //#region 鍒ゆ柇鎿嶄綔绫诲瀷骞跺垵濮嬪寲鐣岄潰
             if (OperationType == 1) {                                                   //鏃犳簮鍗曟柊澧�
-               /* $("#HItemID").val(0);*/
+                /* $("#HItemID").val(0);*/
 
                 //鐢熸垚鍗曟嵁鍙峰拰鍐呯爜
                 get_MAXNum();
@@ -412,31 +408,31 @@
 
 
 
-            //鍒ゆ柇鏄惁鏂板
-            if (linterid == null || linterid == 0) {
-                //鑾峰彇鏈�澶у崟鎹彿 new
-                $("#HMaker").val(sessionStorage["HUserName"]);
-                $("#HInterID").val("0");
-                $("#HBillNo").val("");
-                $.ajax({
-                    url: GetWEBURL() + "/Web/GetMAXNum",
-                    type: "GET",
-                    data: { "HBillType": '1239' },
-                    success: function (d) {
-                        //console.log(d.data);
-                        $("#HBillNo").val(d.data[0].HBillNo);
-                        $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
-                        $("#HInterID").val(d.data[0].HInterID);
-                        $("#HSSDate").val(Format(new Date(), "yyyy-MM-dd")); //缁撶畻鏂瑰紡
-                    }
-                });
-            } else {//濡傛灉淇敼鍒欒蛋涓嬮潰 new
-                $("#HInterID").val(linterid);
-                RoadBillMain(linterid);
-            }
+            ////鍒ゆ柇鏄惁鏂板
+            //if (linterid == null || linterid == 0) {
+            //    //鑾峰彇鏈�澶у崟鎹彿 new
+            //    $("#HMaker").val(sessionStorage["HUserName"]);
+            //    $("#HInterID").val("0");
+            //    $("#HBillNo").val("");
+            //    $.ajax({
+            //        url: GetWEBURL() + "/Web/GetMAXNum",
+            //        type: "GET",
+            //        data: { "HBillType": '1239' },
+            //        success: function (d) {
+            //            //console.log(d.data);
+            //            $("#HBillNo").val(d.data[0].HBillNo);
+            //            $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
+            //            $("#HInterID").val(d.data[0].HInterID);
+            //            $("#HSSDate").val(Format(new Date(), "yyyy-MM-dd")); //缁撶畻鏂瑰紡
+            //        }
+            //    });
+            //} else {//濡傛灉淇敼鍒欒蛋涓嬮潰 new
+            //    $("#HInterID").val(linterid);
+            //    RoadBillMain(linterid);
+            //}
             //#endregion
             //#endregion
-          //鑾峰彇缁勭粐
+            //鑾峰彇缁勭粐
             function Organ() {
                 //鑾峰彇鐧诲綍椤电粍缁囧垪
                 $.ajax({
@@ -458,8 +454,8 @@
                 })
             }
             var rowdata = [{
-                "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "",  "HQty": "", "HRemark": "",
-                "HPrice": "0", "HMoney": "0", "HOrderPrice": "0", "HWHID": 0, "鏀舵枡浠撳簱": "",
+                "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HQty": "", "HRemark": "",
+                "HPrice": "0", "HMoney": "0", "HOrderPrice": "0", "HWHID": 0, "鍙戞枡浠撳簱": "",
                 "HSPID": 0, "浠撲綅鍚嶇О": "", "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
                 "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
                 "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
@@ -475,12 +471,18 @@
                 //鏂板琛岃〃鏍兼暟鎹�
                 var NewRow = {
                     "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HQty": "", "HRemark": "",
-                    "HPrice": "0", "HMoney": "0", "HOrderPrice": "0", "HWHID": 0, "鏀舵枡浠撳簱": "",
+                    "HPrice": "0", "HMoney": "0", "HOrderPrice": "0", "HWHID": 0, "鍙戞枡浠撳簱": "",
                     "HSPID": 0, "浠撲綅鍚嶇О": "", "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
                     "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
                     "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
                 };
                 switch (obj.event) {
+                    //搴撳瓨鏌ヨ
+                    case 'get_Inventory': get_Inventory();
+                        break;
+                    //鍑哄叆搴撹褰曟煡璇�
+                    case 'get_InOutSum': get_InOutSum();
+                        break;
                     case 'btn-AddLine':
                         table.cache["mainTable"].push(NewRow);
                         option.data = table.cache["mainTable"];
@@ -507,10 +509,10 @@
                             //checkRefresh();
                         }
                         break;
-                    ////鍒楄缃�
-                    //case 'set_HideColumn':
-                    //    get_HideColumn();
-                    //    break;
+                    //鍒楄缃�
+                    case 'set_HideColumn':
+                        get_HideColumn();
+                        break;
                 }
             });
 
@@ -590,7 +592,11 @@
                 //鏁板�兼牸寮忔牎楠屽伐鍏�
                 var ref = /^\d+(\.\d+)?$/;          //闈炶礋鏁版鍒欒〃杈惧紡
                 var temp = "";
-
+                console.log(obj)
+                var Dec = getDecByMaterID(obj.data.HMaterID) //鑾峰彇绮惧害
+                var HQtyDec = (Dec["HQtyDec"] == null || Dec["HQtyDec"] == 0) ? 4 : Dec["HQtyDec"];  //鏁伴噺绮惧害
+                var HPriceDec = (Dec["HPriceDec"] == null || Dec["HPriceDec"] == 0) ? 4 : Dec["HPriceDec"];  //鍗曚环绮惧害
+                var HMoneyDec = (Dec["HMoneyDec"] == null || Dec["HMoneyDec"] == 0) ? 2 : Dec["HMoneyDec"];  //閲戦绮惧害
                 // 鍗曞厓鏍肩紪杈戜箣鍓嶇殑鍊�
                 var oldText = $(this).prev().text();
                 var value = obj.value //寰楀埌淇敼鍚庣殑鍊�
@@ -610,6 +616,15 @@
 
                             layer.msg("鏁伴噺璇疯緭鍏ュぇ浜�0鐨勬暟瀛�!");
                             return;
+                        } else if (value * 1 > obj.data.HQtyMust * 1) {
+                            //鎭㈠鏁版嵁鍒扮紪杈戝墠
+                            obj.update({
+                                HQty: oldText
+                            });
+                            table.render(option);
+
+                            layer.msg("瀹為��鏁伴噺涓嶈兘澶т簬搴旈��鏁伴噺!");
+                            return;
                         }
 
 
@@ -617,7 +632,9 @@
                         var HQty = value * 1;                           //鏁伴噺
                         var HPrice = obj.data.HPrice * 1;               //鍗曚环
                         var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
-
+                        HQty = Number(HQty.toFixed(HQtyDec));
+                        HPrice = Number(HPrice.toFixed(HPriceDec));
+                        HMoney = Number(HMoney.toFixed(HMoneyDec));
 
 
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
@@ -626,7 +643,7 @@
                             , HPrice: HPrice
                             , HMoney: HMoney
                         });
-                        /* table.render(option);*/
+                        table.render(option);
                         break;
                     case "HPrice":                                         //鍗曚环
                         //鏁版嵁鏍煎紡鏍¢獙
@@ -646,7 +663,9 @@
                         var HQty = obj.data.HQty * 1;                   //鏁伴噺
                         var HPrice = value * 1;
                         var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
-
+                        HQty = Number(HQty.toFixed(HQtyDec));
+                        HPrice = Number(HPrice.toFixed(HPriceDec));
+                        HMoney = Number(HMoney.toFixed(HMoneyDec));
 
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({
@@ -654,6 +673,7 @@
                             , HPrice: HPrice
                             , HMoney: HMoney
                         });
+                        table.render(option)
                         break;
                     case "HMoney":                                         //閲戦
                         //鏁版嵁鏍煎紡鏍¢獙
@@ -663,7 +683,7 @@
                             obj.update({
                                 HMoney: oldText
                             });
-                            /* table.render(option);*/
+                            table.render(option);
 
                             layer.msg("閲戦璇疯緭鍏ュぇ浜�0鐨勬暟瀛�!");
                             return;
@@ -672,8 +692,10 @@
                         //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
                         var HQty = obj.data.HQty * 1;                   //鏁伴噺
                         var HMoney = value * 1;
-                        var HPrice = (HMoney / HQty).toFixed(2);       //鍗曚环=閲戦/鏁伴噺
-
+                        var HPrice = Number((HMoney / HQty).toFixed(2));       //鍗曚环=閲戦/鏁伴噺
+                        HQty = Number(HQty.toFixed(HQtyDec));
+                        HPrice = Number(HPrice.toFixed(HPriceDec));
+                        HMoney = Number(HMoney.toFixed(HMoneyDec));
 
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({
@@ -681,8 +703,9 @@
                             , HPrice: HPrice
                             , HMoney: HMoney
                         });
-                        break;
                         table.render(option);
+                        break;
+
                     default:
                 }
             });
@@ -692,7 +715,55 @@
 
 
             //#region 鏈〉闈㈡墍鏈夎璋冪敤鐨勬柟娉�
-
+            //#region 搴撳瓨鏌ヨ
+            function get_Inventory() {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1 && data[0].HMaterID != 0) {
+                    var HMaterID = data[0].HMaterID.toString();
+                    //寮圭獥鏂规硶
+                    layer.open({
+                        type: 2//寮圭獥绫诲瀷
+                        , skin: 'layui-layer-rim' //鍔犱笂杈规
+                        , area: ['90%', '90%']//澶у皬
+                        , title: '搴撳瓨鏌ヨ鍒楄〃'//鏍囬
+                        , shift: 2//寮瑰嚭鍔ㄧ敾
+                        , content: ['../../浠撳瓨绠$悊/鏉$爜鎶ヨ〃/Kf_ICinventoryQueryReport.html?Type=1&HMaterID=' + HMaterID, 'yes']
+                        , btn: ['鍙栨秷']
+                        , btn1: function (index, layero) {
+                            layer.close(index);
+                        }
+                    })
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛屾湁鐗╂枡鏁版嵁鏌ヨ锛�');
+                }
+            }
+            //#endregion
+            //#region 鍑哄叆搴撹褰曟煡璇�
+            function get_InOutSum() {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1 && data[0].HMaterID != 0) {
+                    var HMaterID = data[0].HMaterID.toString();
+                    layer.open({
+                        type: 2//寮圭獥绫诲瀷
+                        , skin: 'layui-layer-rim' //鍔犱笂杈规
+                        , area: ['90%', '90%']//澶у皬
+                        , title: '鍑哄叆搴撹褰曞垪琛�'//鏍囬
+                        , shift: 2//寮瑰嚭鍔ㄧ敾
+                        , content: ['../../浠撳瓨绠$悊/鏉$爜鎶ヨ〃/Kf_StockInOutSumQueryReport.html?Type=1&HMaterID=' + HMaterID, 'yes']
+                        , btn: ['鍙栨秷']
+                        , btn1: function (index, layero) {
+                            layer.close(index);
+                        }
+                    })
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛屾湁鐗╂枡鏁版嵁鏌ヨ锛�');
+                }
+            }
+            //#endregion
             //#region 鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
             function get_LoginIs() {
                 if (sessionStorage.login != "login") {
@@ -704,7 +775,7 @@
             //#endregion
 
 
-            
+
             //鏃ユ湡鏍煎紡鍖�
             function formatDate(date) {
                 var d = new Date(date),
@@ -731,24 +802,24 @@
                     , totalRow: true
                     , cols: [[ //瀛愯〃
                         { type: 'checkbox', totalRowText: '鍚堣琛�' }
-                        , { type: 'numbers', title: '搴忓彿', width: 100}
-                        , { type: 'HSourceBillNo', title: '婧愬崟鍙�', width: 100, hide: true }//婧愬崟鍙�
+                        , { type: 'numbers', field: '搴忓彿', title: '搴忓彿', width: 100 }
+                        , { field: 'HSourceBillNo', title: '婧愬崟鍙�', width: 100, hide: true }//婧愬崟鍙�
                         , { field: 'HSourceBillType', title: '婧愬崟绫诲瀷', width: 100, hide: true }//婧愬崟绫诲瀷
-                        , { type: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 100, hide: true }//婧愬崟涓诲唴鐮�
+                        , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 100, hide: true }//婧愬崟涓诲唴鐮�
                         , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 100, hide: true }//婧愬崟瀛愬唴鐮�
                         , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true }
-                        , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 150, edit: 'text', event: "HMaterID" }//f7
+                        , { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜', width: 150, event: "HMaterID" }//f7
                         , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 150, style: 'background-color:#efefef4d;' }
-                        , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 100, style: 'background-color:#efefef4d;'}
+                        , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 100, style: 'background-color:#efefef4d;' }
                         , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true }
-                        , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 100, edit: 'text', event: "HUnitID" }//f7
-                        , { field: 'HQty', title: '瀹炴敹鏁伴噺', width: 150, edit: 'text', totalRow: true}
-                        , { field: 'HQtyMust', title: '搴旀敹鏁伴噺', width: 150, edit: 'text', totalRow: true}
-                        , { field: 'HPrice', title: '鍗曚环', width: 100, edit: 'text' }
-                        , { field: 'HMoney', title: '閲戦', width: 100, edit: 'text', totalRow: true }
-                        , { field: 'HOrderPrice', title: '閲囪喘閲戦', width: 100, edit: 'text', totalRow: true}
+                        , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 100, event: "HUnitID" }//f7
+                        , { field: 'HQty', title: '瀹為��鏁伴噺', width: 150, edit: 'text', totalRow: true }
+                        , { field: 'HQtyMust', title: '搴旈��鏁伴噺', width: 150, totalRow: true }
+                        , { field: 'HPrice', title: '鍗曚环', width: 100 }
+                        , { field: 'HMoney', title: '閲戦', width: 100, totalRow: true }
+                        , { field: 'HOrderPrice', title: '閲囪喘閲戦', width: 100, totalRow: true }
                         , { field: 'HWHID ', title: 'HWHID ', width: 100, hide: true }
-                        , { field: '鏀舵枡浠撳簱', title: '鏀舵枡浠撳簱', width: 100, edit: 'text', event: "HWHID" }//f7
+                        , { field: '鍙戞枡浠撳簱', title: '鍙戞枡浠撳簱', width: 100, edit: 'text', event: "HWHID" }//f7
                         , { field: 'HSPID', title: 'HSPID', width: 100, hide: true }
                         , { field: '浠撲綅鍚嶇О', title: '浠撲綅鍚嶇О', width: 100, edit: 'text', event: "HSPID" }//f7
                         , { field: 'HBatchNo', title: '鎵规', width: 150, edit: 'text' }
@@ -759,6 +830,7 @@
 
                 option.data = [];
                 table.render(option);
+                DisPlay_HideColumn();
             }
 
             //#region 鍔犺浇琛ㄥご
@@ -801,11 +873,13 @@
                                 , "HMaker": data.鍒跺崟浜�
                                 , "HChecker": data.瀹℃牳浜�
                                 , "HCloseMan": data.鍏抽棴浜�
-                                , "HMakeDate": data.鍒跺崟鏃ユ湡
-                                , "HCheckDate": data.瀹℃牳鏃ユ湡
-                                , "HCloseDate": data.鍏抽棴鏃ユ湡
-                                , "HUpDateDate": data.淇敼鏃ユ湡
-                                , "HDeleteDate": data.浣滃簾鏃ユ湡
+                                , "HUpDater": data.淇敼浜�
+                                , "HDeleteDate": data.浣滃簾浜�
+                                , "HMakeDate": data.鍒跺崟鏃ユ湡 == null ? "" : Pub_Format(data.鍒跺崟鏃ユ湡, "yyyy-MM-dd hh:mm:ss")
+                                , "HCheckDate": data.瀹℃牳鏃ユ湡 == null ? "" : Pub_Format(data.瀹℃牳鏃ユ湡, "yyyy-MM-dd hh:mm:ss")
+                                , "HCloseDate": data.鍏抽棴鏃ユ湡 == null ? "" : Pub_Format(data.鍏抽棴鏃ユ湡, "yyyy-MM-dd hh:mm:ss")
+                                , "HUpDateDate": data.淇敼鏃ユ湡 == null ? "" : Pub_Format(data.淇敼鏃ユ湡, "yyyy-MM-dd hh:mm:ss")
+                                , "HDeleteDate": data.浣滃簾鏃ユ湡 == null ? "" : Pub_Format(data.浣滃簾鏃ユ湡, "yyyy-MM-dd hh:mm:ss")
 
                             });
                             //瀛愯〃  璧嬪��
@@ -815,7 +889,7 @@
                                 rowdata.push(
                                     {
                                         "HMaterID": subdata[i].HMaterID, "鐗╂枡浠g爜": subdata[i].鐗╂枡浠g爜, "鐗╂枡鍚嶇О": subdata[i].鐗╂枡鍚嶇О, "瑙勬牸鍨嬪彿": subdata[i].瑙勬牸鍨嬪彿, "HUnitID": subdata[i].HUnitID, "璁¢噺鍗曚綅": subdata[i].璁¢噺鍗曚綅,
-                                        "HQty": subdata[i].瀹炴敹鏁伴噺, "HQtyMust": subdata[i].搴旀敹鏁伴噺,"HRemark": subdata[i].琛ㄤ綋澶囨敞, "HPrice": subdata[i].鍗曚环, "HMoney": subdata[i].閲戦, "HOrderPrice": subdata[i].閲囪喘閲戦, "HWHID": subdata[i].HWHID, "鏀舵枡浠撳簱": subdata[i].鏀舵枡浠撳簱, "HSPID": subdata[i].HSPID, "浠撲綅鍚嶇О": subdata[i].浠撲綅鍚嶇О,
+                                        "HQty": subdata[i].瀹炴敹鏁伴噺, "HQtyMust": subdata[i].搴旀敹鏁伴噺, "HRemark": subdata[i].琛ㄤ綋澶囨敞, "HPrice": subdata[i].鍗曚环, "HMoney": subdata[i].閲戦, "HOrderPrice": subdata[i].閲囪喘閲戦, "HWHID": subdata[i].HWHID, "鍙戞枡浠撳簱": subdata[i].鏀舵枡浠撳簱, "HSPID": subdata[i].HSPID, "浠撲綅鍚嶇О": subdata[i].浠撲綅鍚嶇О,
                                         "HBatchNo": subdata[i].鎵规,
                                         "HSourceBillNo": subdata[i].婧愬崟鍗曞彿,    //婧愬崟鍙�
                                         "HSourceBillType": subdata[i].婧愬崟绫诲瀷,   //婧愬崟绫诲瀷
@@ -853,11 +927,11 @@
                 }
             });
 
-           //#region 淇濆瓨鎸夐挳
+            //#region 淇濆瓨鎸夐挳
             form.on('submit(Saver)', function (data) {
                 //#region 鍒ゆ柇婧愬崟鐘舵��
                 if (OperationType == 1 || OperationType == 4) {
-                    
+
                     if ($("#HSourceBillType").val() == "1105") {
                         for (var i = 0; i < option.data.length; i++) {
                             var HSourceBillData = "";
@@ -878,6 +952,27 @@
                                 return;
                             }
                         }
+                    } else if ($("#HSourceBillType").val() == "1201") {
+                        for (var i = 0; i < option.data.length; i++) {
+                            var HSourceBillData = "";
+                            var HSourceBillData = getPushSource_POStockInBillInit(option.data[i].HSourceInterID, option.data[i].HSourceEntryID);            //鑾峰彇婧愬崟鏁版嵁
+                            if (HSourceBillData != "none") {
+                                if (HSourceBillData == null) {
+                                    layer.alert("淇濆瓨澶辫触!绗�" + (i + 1) + "琛岋細鏈煡璇㈠埌婧愬崟鍗曟嵁!", { icon: 5 });
+                                    return;
+                                }
+                                //else if (HSourceBillData.鐘舵�� != "宸插鏍�") {
+                                //    var err = "淇濆瓨澶辫触!鍘熷洜锛氱" + (i + 1) + "琛�-婧愬崟鍗曟嵁鐘舵�佷负鈥�" + HSourceBillData.鐘舵�� + "鈥濓紝涓嶅厑璁镐繚瀛橈紒";
+                                //    layer.alert(err, { icon: 5 });
+                                //    return;
+                                //} else if (HSourceBillData.琛岀姸鎬� == "宸插叧闂�") {
+                                //    layer.alert("淇濆瓨澶辫触!绗�" + (i + 1) + "琛岋細璇ヨ璁板綍琛岀姸鎬佷负'宸插叧闂�'鐘舵��!", { icon: 5 });
+                                //    return;
+                                //}
+                            } else {
+                                return;
+                            }
+                        }
                     }
                     else {
                         return layer.msg('褰撳墠涓嶆敮鎸佽婧愬崟锛侊紒');
@@ -886,25 +981,25 @@
                 //#endregion
 
                 //if (AllowLoadData(data)) {
-                    set_SaveBill(data);
+                set_SaveBill(data);
                 //}
             });
             //#endregion
-       
-        //#region 鑾峰彇鍙傛暟_浼犻�掔殑JSON鏍煎紡鍙傛暟
+
+            //#region 鑾峰彇鍙傛暟_浼犻�掔殑JSON鏍煎紡鍙傛暟
             function getUrlVars_JSON() {
                 var datajson;
                 var str = window.location.search; //鑾峰彇閾炬帴涓紶閫掔殑鍙傛暟
-                var arr = str.substring(str.lastIndexOf("=")+1);
+                var arr = str.substring(str.lastIndexOf("=") + 1);
                 datajson = $.parseJSON(decodeURI(arr));
                 return datajson;
             }
             //#endregion
 
 
-          //#region 涓嬫帹椤甸潰鍒濆鍖�
+            //#region 涓嬫帹椤甸潰鍒濆鍖�
             function setInit_PushBill() {
-                 //鐢熸垚鍗曟嵁鍙峰拰鍐呯爜
+                //鐢熸垚鍗曟嵁鍙峰拰鍐呯爜
                 get_MAXNum();
 
                 //鍒濆鍖栨棩鏈熴�佸埗鍗曚汉銆佸埗鍗曟棩鏈�
@@ -919,95 +1014,13 @@
                 //绂佺敤缁勭粐閫夐」
                 $("#HOrgID").attr("disabled", true);
 
-               //鑾峰彇
-                 var data = getUrlVars_JSON().data;
-                    var dataArray = [];
-                    for (var i = 0; i < data.length; i++) {
-                        var temp = getPushSource_POInStockBackInit(data[i].hmainid, data[i].hsubid);
-                        if (temp != "none") {
-                            dataArray.push(temp);
-                        } else {
-                            return;
-                    }
+                if (HSouceBillType == "1105") {
+                    setInit_PushBill_ByPOInStockBackBill();
+                } else if (HSouceBillType == "1201") {
+                    setInit_PushBill_ByPOStockInBillInit();
                 }
+            }
 
-
-                    form.val("component-form-group", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
-                        "HMainSourceInterID": "0"
-                        , "HMainSourceEntryID": "0"
-                        , "HMainSourceBillNo": ""
-                        , "HMainSourceBillType": $("#BillType").val()
-
-                        , "HDeptID": dataArray[0].HDeptID
-                        , "HDeptName": dataArray[0].閮ㄩ棬
-                        , "HManagerID": dataArray[0].HManagerID
-                        , "HManagerName": dataArray[0].涓荤
-                        , "HWHID": dataArray[0].HWHID
-                        , "HWHName": dataArray[0].浠撳簱
-                        , "HEmpID": dataArray[0].HEmpID
-                        , "HEmpName": dataArray[0].涓氬姟鍛�
-                        , "HSupID": dataArray[0].HSupID
-                        , "HSupName": dataArray[0].渚涘簲鍟�
-                        , "HSecManagerID": dataArray[0].HSecManagerID
-                        , "HSecManagerName": dataArray[0].楠屾敹鍛�
-                        , "HKeeperID": dataArray[0].HKeeperID
-                        , "HKeeperName": dataArray[0].淇濈鍛�
-                        , "HCurID": dataArray[0].HCurID
-                        , "HCurName": dataArray[0].甯佸埆
-                        , "HExRate": dataArray[0].姹囩巼
-                        , "HAddress": data.浜よ揣鍦扮偣
-                        , "HRemark": data.琛ㄥご澶囨敞
-                        , "HInnerBillNo": data.鍐呴儴鍗曟嵁鍙�
-                    });
-
-                    //瀛愯〃  璧嬪��
-                    var rowdata = [];
-                    for (var i = 0; i < dataArray.length; i++) {
-                        rowdata.push(
-                            {
-                                "HMaterID": dataArray[i].HMaterID
-                                , "鐗╂枡浠g爜": dataArray[i].鐗╂枡浠g爜
-                                , "鐗╂枡鍚嶇О": dataArray[i].鐗╂枡鍚嶇О
-                                , "瑙勬牸鍨嬪彿": dataArray[i].瑙勬牸鍨嬪彿
-                                , "HUnitID": dataArray[i].HUnitID
-                                , "璁¢噺鍗曚綅": dataArray[i].璁¢噺鍗曚綅
-                                , "HWHID": dataArray[i].HWHID
-                                , "鏀舵枡浠撳簱": dataArray[i].鏀舵枡浠撳簱
-                                , "HSPID": dataArray[i].HSPID    
-                                , "浠撲綅鍚嶇О": dataArray[i].浠撲綅鍚嶇О
-                                , "HSecUnitID": dataArray[i].HSecUnitID
-                                , "杈呭姪鍗曚綅": dataArray[i].杈呭姪鍗曚綅
-                                , "HQty": dealDoubleToFixed(dataArray[i].鏁伴噺, 1)
-                                , "HPrice": dealDoubleToFixed(dataArray[i].鍗曚环, 3)
-                                , 'HDiscountRate': dataArray[i].鎶樻墸鐜�                                                    //
-                                , 'HRelTaxPrice': "0"
-                                , "HTaxRate": dataArray[i].绋庣巼
-                                , 'HTaxMoney': dataArray[i].绋庨                                                     //
-                                , "HMoney": dealDoubleToFixed(dataArray[i].閲戦, 2)
-                                , "HRemark": dataArray[i].琛ㄤ綋澶囨敞
-
-                                , "HSourceInterID": dataArray[i].hmainid
-                                , "HSourceEntryID": dataArray[i].hsubid
-                                , "HSourceBillNo": dataArray[i].鍗曟嵁鍙�
-                                , "HSourceBillType": dataArray[i].HBillType
-                                , "HRelationQty": "0"
-                                , "HRelationMoney": "0"
-
-                                , 'HPOOrderInterID': "0"
-                                , 'HPOOrderEntryID': "0"
-                                , 'HPOOrderBillNo': ""
-
-                                , 'HSeOrderTaxPrice': dealDoubleToFixed(dataArray[i].鍚◣鍗曚环, 3)
-                                , "HSeOrderInterID": dataArray[i].hmainid
-                                , "HSeOrderEntryID": dataArray[i].hsubid
-                                , "HSeOrderBillNo": dataArray[i].鍗曟嵁鍙�
-                            }
-                        );
-                    }
-                    option.data = rowdata;
-                    table.render(option);
-                }
-        
             //#endregion
 
             //#region 淇濆瓨鏂规硶
@@ -1029,12 +1042,12 @@
                     layer.msg("璇烽�夋嫨浠撳簱锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return;
                 }
-                if ($("#HKeeperID").val() == 0) {
-                    layer.msg("璇烽�夋嫨淇濈鍛橈紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                    return;
-                }
+                //if ($("#HKeeperID").val() == 0) {
+                //    layer.msg("璇烽�夋嫨淇濈鍛橈紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                //    return;
+                //}
                 if ($("#HSecManagerID").val() == 0) {
-                    layer.msg("璇烽�夋嫨楠屾敹鍛橈紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    layer.msg("璇烽�夋嫨閫�鏂欏憳锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return;
                 }
 
@@ -1256,9 +1269,33 @@
                     , btn2: function (index, layero) { }
                 })
             }
+            //#region 鏍规嵁鐗╂枡ID鑾峰彇绮惧害
+            function getDecByMaterID(HMaterID) {
+                var resultData = {};
+                $.ajax({  // 寮傛璇锋眰
+                    url: GetWEBURL() + "Gy_Material/getDecByID",  //璇锋眰鍦板潃
+                    async: false,   //鏄惁寮�鍚紓姝�
+                    type: "GET",   //璇锋眰绫诲瀷
+                    data: {   //瀹氫箟鍙戦�佸埌鏈嶅姟鍣ㄧ殑鏁版嵁
+                        "HMaterID": HMaterID     //  灏唄materid浣滀负璇锋眰鍙傛暟鍙戦��
+                    },
+                    success: function (result) {   // 褰撹姹傛垚鍔熸椂锛屾墽琛岃繖涓嚱鏁�
+                        if (result.code == 1) { // 濡傛灉鏈嶅姟鍣ㄨ繑鍥炵殑鏁版嵁涓殑`code瀛楁绛変簬1锛岃繖鍙兘琛ㄧず瀹℃牳鎿嶄綔鎴愬姛鎵ц
+                            var data = result.data; //澹版槑data鍙橀噺锛屽苟灏嗗叾璧嬪�间负result瀵硅薄涓殑data灞炴��
+                            resultData = data[0];   //灏哾ata鏁扮粍锛堟垨绫绘暟缁勫璞★級鐨勭涓�涓厓绱犺祴鍊肩粰鍙橀噺resultData
+                        }
+                        //else {
+                        //    layer.alert(result.Message, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' }); //result.msg瀵硅薄锛屾彁绀哄脊绐� 绫诲瀷涓�5锛� 鎸夐挳锛屽拰鎸夐挳鐨勫悕绉颁负閫�鍑�  鏃堕棿 涓�100绉掞紝浠ュ強鍋忕Щ閲忥紙`offset: 't'
+                        //}
+                    }, error: function () {
+                        layer.alert("鍙戠敓閿欒!", { icon: 5 });  //鎻愮ず寮圭獥 鍙戠敓閿欒 锛岃绀烘爣蹇椾负5鐨�
+                    }
+                });
+                return resultData;
+            }
+            //#endregion
 
-
-         //#region 鍙嶅鏍�/瀹℃牳鏁版嵁
+            //#region 鍙嶅鏍�/瀹℃牳鏁版嵁
             function set_CheckBill(num) {
                 var InterID = $("#HInterID").val();
                 //閫昏緫瀹℃牳鏂规硶
@@ -1310,47 +1347,46 @@
                                     //if (checkStatus.data.length != 1) {
                                     //    return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
                                     //}
+                                    OptionData = checkStatus.data[0];  //鎶婇�変腑鏁版嵁鐨勭涓�鏉¤祴鍊肩粰OptionData鍙橀噺
+                                    if (checkStatus.data.length > 1) {
+                                        var rowIndex = $(obj.tr).attr("data-index") * 1;
+                                        for (var i = 0; i < checkStatus.data.length; i++) {
+                                            if (rowIndex + i >= option.data.length) {
+                                                var NewRow = {
+                                                    "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HQty": "", "HRemark": "",
+                                                    "HPrice": "0", "HMoney": "0", "HOrderPrice": "0", "HWHID": 0, "鍙戞枡浠撳簱": "",
+                                                    "HSPID": 0, "浠撲綅鍚嶇О": "", "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
+                                                    "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
+                                                    "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
+                                                };
 
+                                                table.cache["mainTable"].push(NewRow);
+                                                option.data = table.cache["mainTable"];
 
-                                    var rowIndex = $(obj.tr).attr("data-index") * 1;
-                                    for (var i = 0; i < checkStatus.data.length; i++) {
-                                        if (rowIndex + i >= option.data.length) {
-                                            var NewRow = {
-                                                "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HQty": "", "HRemark": "",
-                                                "HPrice": "0", "HMoney": "0", "HOrderPrice": "0", "HWHID": 0, "鏀舵枡浠撳簱": "",
-                                                "HSPID": 0, "浠撲綅鍚嶇О": "", "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
-                                                "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
-                                                "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
-                                            };
+                                                table.render(option);
+                                            }
 
-                                            table.cache["mainTable"].push(NewRow);
-                                            option.data = table.cache["mainTable"];
-
-                                            table.render(option);
+                                            var HMaterID = checkStatus.data[i].HItemID;
+                                            var resultData = getMaterialByMaterID(HMaterID);
+                                            option.data[rowIndex + i].HMaterID = resultData.HMaterID;
+                                            option.data[rowIndex + i].鐗╂枡浠g爜 = resultData.HMaterNumber;
+                                            option.data[rowIndex + i].鐗╂枡鍚嶇О = resultData.HMaterName;
+                                            option.data[rowIndex + i].瑙勬牸鍨嬪彿 = resultData.HMaterModel;
+                                            option.data[rowIndex + i].HUnitID = resultData.HUnitID;
+                                            option.data[rowIndex + i].璁¢噺鍗曚綅 = resultData.HUnitName;
+                                            ////鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                                            //obj.update({
+                                            //    "HMaterID": checkStatus.data[0].HItemID
+                                            //    , "鐗╂枡浠g爜": checkStatus.data[0].HNumber
+                                            //    , "鐗╂枡鍚嶇О": checkStatus.data[0].HName
+                                            //    , "瑙勬牸鍨嬪彿": checkStatus.data[0].HModel
+                                            //    , "HUnitID": checkStatus.data[0].HUnitID
+                                            //    , "璁¢噺鍗曚綅": checkStatus.data[0].HUnitName
+                                            //})
+                                            //layer.close(index);//鍏抽棴寮圭獥
                                         }
-
-
-
-                                        var HMaterID = checkStatus.data[i].HItemID;
-                                        var resultData = getMaterialByMaterID(HMaterID);
-                                        option.data[rowIndex + i].HMaterID = resultData.HMaterID;
-                                        option.data[rowIndex + i].鐗╂枡浠g爜 = resultData.HMaterNumber;
-                                        option.data[rowIndex + i].鐗╂枡鍚嶇О = resultData.HMaterName;
-                                        option.data[rowIndex + i].瑙勬牸鍨嬪彿 = resultData.HMaterModel;
-                                        option.data[rowIndex + i].HUnitID = resultData.HUnitID;
-                                        option.data[rowIndex + i].璁¢噺鍗曚綅 = resultData.HUnitName;
-                                        ////鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
-                                        //obj.update({
-                                        //    "HMaterID": checkStatus.data[0].HItemID
-                                        //    , "鐗╂枡浠g爜": checkStatus.data[0].HNumber
-                                        //    , "鐗╂枡鍚嶇О": checkStatus.data[0].HName
-                                        //    , "瑙勬牸鍨嬪彿": checkStatus.data[0].HModel
-                                        //    , "HUnitID": checkStatus.data[0].HUnitID
-                                        //    , "璁¢噺鍗曚綅": checkStatus.data[0].HUnitName
-                                        //})
-                                        //layer.close(index);//鍏抽棴寮圭獥
+                                        table.render(option);
                                     }
-                                    table.render(option);
                                     layer.closeAll();
                                     //layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
                                 }
@@ -1359,14 +1395,14 @@
                                     //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
                                 },
                                 end: function () {
-                                obj.update({
-                                     "HMaterID" :OptionData.HMaterID
-                                        ,"鐗╂枡浠g爜" : OptionData.鐗╂枡浠g爜
-                                       , "鐗╂枡鍚嶇О" :OptionData.鐗╂枡鍚嶇О
-                                        ,"瑙勬牸鍨嬪彿" : OptionData.瑙勬牸鍨嬪彿
-                                        ,"HUnitID" :OptionData.HUnitID
-                                        ,"璁¢噺鍗曚綅" : OptionData.璁¢噺鍗曚綅鍚嶇О
-                                })
+                                    obj.update({
+                                        "HMaterID": OptionData.HItemID
+                                        , "鐗╂枡浠g爜": OptionData.鐗╂枡浠g爜
+                                        , "鐗╂枡鍚嶇О": OptionData.鐗╂枡鍚嶇О
+                                        , "瑙勬牸鍨嬪彿": OptionData.瑙勬牸鍨嬪彿
+                                        , "HUnitID": OptionData.HUnitID
+                                        , "璁¢噺鍗曚綅": OptionData.璁¢噺鍗曚綅鍚嶇О
+                                    })
                                 }
                             });
                         }
@@ -1397,12 +1433,12 @@
                                     })
                                     layer.close(index);//鍏抽棴寮圭獥
                                 }
-                             , end: function () {
-                                obj.update({
-                                    "HUnitID": OptionData.HItemID
-                                    , "璁¢噺鍗曚綅": OptionData.璁¢噺鍗曚綅鍚嶇О
-                                })
-                            }
+                                , end: function () {
+                                    obj.update({
+                                        "HUnitID": OptionData.HItemID
+                                        , "璁¢噺鍗曚綅": OptionData.璁¢噺鍗曚綅鍚嶇О
+                                    })
+                                }
                             })
                         }
                         //鏀舵枡浠撳簱
@@ -1427,17 +1463,17 @@
                                     }
                                     //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
                                     obj.update({
-                                        "鏀舵枡浠撳簱": checkStatus.data[0].浠撳簱鍚嶇О
+                                        "鍙戞枡浠撳簱": checkStatus.data[0].浠撳簱鍚嶇О
                                         , "HWHID": checkStatus.data[0].HItemID
                                     })
                                     layer.close(index);//鍏抽棴寮圭獥
                                 }
-                              , end: function () {
-                                obj.update({
-                                    "HWHID": OptionData.HItemID
-                                    , "鏀舵枡浠撳簱": OptionData.浠撳簱鍚嶇О
-                                })
-                            }
+                                , end: function () {
+                                    obj.update({
+                                        "HWHID": OptionData.HItemID
+                                        , "鍙戞枡浠撳簱": OptionData.浠撳簱鍚嶇О
+                                    })
+                                }
                             })
                         }
                         //浠撲綅
@@ -1467,16 +1503,99 @@
                                     })
                                     layer.close(index);//鍏抽棴寮圭獥
                                 }
-                             , end: function () {
-                                obj.update({
-                                    "HSPID": OptionData.HMainID
-                                    , "浠撲綅鍚嶇О": OptionData.浠撲綅鍚嶇О
-                                })
-                            }
+                                , end: function () {
+                                    obj.update({
+                                        "HSPID": OptionData.HMainID
+                                        , "浠撲綅鍚嶇О": OptionData.浠撲綅鍚嶇О
+                                    })
+                                }
                             })
                         }
+                        obj.event = "";
+                        return false;
                     }
                 })
+
+                //鍙屽嚮
+                $('.layui-table-box tbody td[data-field="鐗╂枡浠g爜"]').off('dblclick').on('dblclick', function () {
+                    var HOrgID = $("#HOrgID").val();
+                    layer.open({
+                        type: 2
+                        , skin: "layui-layer-rim" //鍔犱笂杈规
+                        , title: "鐗╂枡鍒楄〃"  //鏍囬
+                        , closeBtn: 1  //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                        , shift: 2 //寮瑰嚭鍔ㄧ敾
+                        , area: ["90%", "90%"] //绐椾綋澶у皬
+                        , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                        , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html?openType=2&HOrgID=' + HOrgID, '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("璇烽�夋嫨涓�鏉℃暟鎹�");
+                            //}
+                            OptionData = checkStatus.data[0];  //鎶婇�変腑鏁版嵁鐨勭涓�鏉¤祴鍊肩粰OptionData鍙橀噺
+                            if (checkStatus.data.length > 1) {
+                                var rowIndex = $(obj.tr).attr("data-index") * 1;
+                                for (var i = 0; i < checkStatus.data.length; i++) {
+                                    if (rowIndex + i >= option.data.length) {
+                                        var NewRow = {
+                                            "HMaterID": 0, "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": 0, "璁¢噺鍗曚綅": "", "HQty": "", "HRemark": "",
+                                            "HPrice": "0", "HMoney": "0", "HOrderPrice": "0", "HWHID": 0, "鍙戞枡浠撳簱": "",
+                                            "HSPID": 0, "浠撲綅鍚嶇О": "", "HBatchNo": "", "HPOOrderInterID": 0, "HPOOrderEntryID": 0,
+                                            "HPOOrderBillNo": "", "HSeOrderInterID": 0, "HSeOrderEntryID": 0, "HSeOrderBillNo": "",
+                                            "HSourceBillNo": 0, "HSourceBillType": 0, "HSourceInterID": 0, "HSourceEntryID": 0,
+                                        };
+
+                                        table.cache["mainTable"].push(NewRow);
+                                        option.data = table.cache["mainTable"];
+
+                                        table.render(option);
+                                    }
+
+                                    var HMaterID = checkStatus.data[i].HItemID;
+                                    var resultData = getMaterialByMaterID(HMaterID);
+                                    option.data[rowIndex + i].HMaterID = resultData.HMaterID;
+                                    option.data[rowIndex + i].鐗╂枡浠g爜 = resultData.HMaterNumber;
+                                    option.data[rowIndex + i].鐗╂枡鍚嶇О = resultData.HMaterName;
+                                    option.data[rowIndex + i].瑙勬牸鍨嬪彿 = resultData.HMaterModel;
+                                    option.data[rowIndex + i].HUnitID = resultData.HUnitID;
+                                    option.data[rowIndex + i].璁¢噺鍗曚綅 = resultData.HUnitName;
+                                    ////鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                                    //obj.update({
+                                    //    "HMaterID": checkStatus.data[0].HItemID
+                                    //    , "鐗╂枡浠g爜": checkStatus.data[0].HNumber
+                                    //    , "鐗╂枡鍚嶇О": checkStatus.data[0].HName
+                                    //    , "瑙勬牸鍨嬪彿": checkStatus.data[0].HModel
+                                    //    , "HUnitID": checkStatus.data[0].HUnitID
+                                    //    , "璁¢噺鍗曚綅": checkStatus.data[0].HUnitName
+                                    //})
+                                    //layer.close(index);//鍏抽棴寮圭獥
+                                }
+                                table.render(option);
+                            }
+                            layer.closeAll();
+                            //layer.close(layer.index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+                        }
+                        , btn2: function (index, layero) {
+                            //鎸夐挳銆愭寜閽簩銆戠殑鍥炶皟
+                            //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+                        },
+                        end: function () {
+                            obj.update({
+                                "HMaterID": OptionData.HItemID
+                                , "鐗╂枡浠g爜": OptionData.鐗╂枡浠g爜
+                                , "鐗╂枡鍚嶇О": OptionData.鐗╂枡鍚嶇О
+                                , "瑙勬牸鍨嬪彿": OptionData.瑙勬牸鍨嬪彿
+                                , "HUnitID": OptionData.HUnitID
+                                , "璁¢噺鍗曚綅": OptionData.璁¢噺鍗曚綅鍚嶇О
+                            })
+                        }
+                    });
+                });
             }
 
             //琛屽唴浜嬩欢
@@ -1502,7 +1621,7 @@
                 })
                 switch (type) {
                     case '1105':
-                        return { url: "../../閲囪喘绠$悊/鏀舵枡閫氱煡鍗�/Cg_POInStockBackBillList.html", name: data[0]["HName"] };
+                        return { url: "../../閲囪喘绠$悊/閫�鏂欓�氱煡鍗�/Cg_POInStockBackBillList.html", name: data[0]["HName"] };
                         break;
                 }
 
@@ -1513,7 +1632,7 @@
                 var HOrgID = $("#HOrgID").val();
                 var url = "";
                 if ($("#HSourceBillType").val() == "1105") {
-                    url = "../../閲囪喘绠$悊/鏀舵枡閫氱煡鍗�/Cg_POInStockBackBillList.html?openType=2&HOrgID=" + HOrgID;
+                    url = "../../閲囪喘绠$悊/閫�鏂欓�氱煡鍗�/Cg_POInStockBackBillList.html?openType=2&HOrgID=" + HOrgID;
                 } else {
                     return layer.msg('褰撳墠涓嶆敮鎸佽婧愬崟閫夋嫨锛侊紒');
                 }
@@ -1536,6 +1655,35 @@
                         if (checkStatus.data.length == 0) {
                             return layer.msg("璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�!");
                         }
+
+                        form.val("component-form-group", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
+                            "HMainSourceInterID": "0"
+                            , "HMainSourceEntryID": "0"
+                            , "HMainSourceBillNo": ""
+                            , "HMainSourceBillType": $("#BillType").val()
+
+                            , "HDeptID": checkStatus.data[0].HDeptID
+                            , "HDeptName": checkStatus.data[0].閮ㄩ棬
+                            , "HManagerID": checkStatus.data[0].HManagerID
+                            , "HManagerName": checkStatus.data[0].涓荤
+                            , "HWHID": checkStatus.data[0].涓昏〃浠撳簱ID == null ? 0 : checkStatus.data[0].涓昏〃浠撳簱ID
+                            , "HWHName": checkStatus.data[0].涓昏〃浠撳簱
+                            , "HEmpID": checkStatus.data[0].HEmpID
+                            , "HEmpName": checkStatus.data[0].涓氬姟鍛�
+                            , "HSupID": checkStatus.data[0].HSupID
+                            , "HSupName": checkStatus.data[0].渚涘簲鍟�
+                            //, "HSecManagerID": checkStatus.data[0].HSecManagerID
+                            //, "HSecManagerName": checkStatus.data[0].楠屾敹鍛�
+                            //, "HKeeperID": checkStatus.data[0].HKeeperID
+                            //, "HKeeperName": checkStatus.data[0].淇濈鍛�
+                            , "HCurID": checkStatus.data[0].HCurID
+                            , "HCurName": checkStatus.data[0].甯佸埆
+                            , "HExRate": checkStatus.data[0].姹囩巼
+                            /*, "HAddress": data.浜よ揣鍦扮偣*/
+                            , "HRemark": checkStatus.data[0].琛ㄥご澶囨敞
+                            , "HInnerBillNo": checkStatus.data[0].鍐呴儴鍗曟嵁鍙�
+                        });
+
                         //layer.alert("浣犲凡閫夋嫨" + checkStatus.data.length + "鏉℃暟鎹�");
                         //鑾峰彇鏀舵枡閫氱煡鍗曚唬鐮�
                         var ProcessNumber = [];
@@ -1552,10 +1700,10 @@
                             for (var i = 0; i < ProcessNumber.length; i++) {
                                 option.data.push({
                                     "HMaterID": checkStatus.data[j].HMaterID, "鐗╂枡浠g爜": checkStatus.data[j].鐗╂枡浠g爜, "鐗╂枡鍚嶇О": checkStatus.data[j].鐗╂枡鍚嶇О, "瑙勬牸鍨嬪彿": checkStatus.data[j].瑙勬牸鍨嬪彿,
-                                    "HUnitID": checkStatus.data[j].HUnitID, "璁¢噺鍗曚綅": checkStatus.data[j].璁¢噺鍗曚綅, 
-                                    "HQty": checkStatus.data[j].鏁伴噺-checkStatus.data[j].鍏宠仈鏁伴噺,"HQtyMust": checkStatus.data[j].搴旀敹鏁伴噺, "HPrice": checkStatus.data[j].鍗曚环,
-                                    "HMoney": checkStatus.data[j].閲戦,  "HTaxRate": checkStatus.data[j].绋庣巼, "HTaxMoney": checkStatus.data[j].绋庨,"HWHID": checkStatus.data[j].HWHID,
-                                    "鏀舵枡浠撳簱": checkStatus.data[j].鏀舵枡浠撳簱,"HSPID": checkStatus.data[j].HSPID,"浠撲綅鍚嶇О": checkStatus.data[j].浠撲綅鍚嶇О,"HSecUnitID": checkStatus.data[j].HSecUnitID,"杈呭姪鍗曚綅": checkStatus.data[j].杈呭姪鍗曚綅,
+                                    "HUnitID": checkStatus.data[j].HUnitID, "璁¢噺鍗曚綅": checkStatus.data[j].璁¢噺鍗曚綅,
+                                    "HQty": checkStatus.data[j].鏁伴噺 - checkStatus.data[j].鍏宠仈鏁伴噺, "HQtyMust": checkStatus.data[j].鏁伴噺 - checkStatus.data[j].鍏宠仈鏁伴噺, "HPrice": checkStatus.data[j].鍗曚环,
+                                    "HMoney": (checkStatus.data[j].鏁伴噺 - checkStatus.data[j].鍏宠仈鏁伴噺) * Number(checkStatus.data[j].鍗曚环), "HTaxRate": checkStatus.data[j].绋庣巼, "HTaxMoney": checkStatus.data[j].绋庨, "HWHID": checkStatus.data[j].HWHID,
+                                    "鍙戞枡浠撳簱": checkStatus.data[j].鏀舵枡浠撳簱, "HSPID": checkStatus.data[j].HSPID, "浠撲綅鍚嶇О": checkStatus.data[j].浠撲綅鍚嶇О, "HSecUnitID": checkStatus.data[j].HSecUnitID, "杈呭姪鍗曚綅": checkStatus.data[j].杈呭姪鍗曚綅,
                                     "HSourceBillNo": checkStatus.data[j].鍗曟嵁鍙�, "HSourceBillType": checkStatus.data[j].HBillType, "HSourceInterID": checkStatus.data[j].hmainid, "HSourceEntryID": checkStatus.data[j].hsubid
                                 })
                                 j++;
@@ -1568,7 +1716,7 @@
                 });
             });
 
-             //鍒ゆ柇鎵�閫夌潃涓庤〃鏍兼槸鍚︽湁閲嶅鏁版嵁
+            //鍒ゆ柇鎵�閫夌潃涓庤〃鏍兼槸鍚︽湁閲嶅鏁版嵁
             function checkDuplicateData(data) {
                 const duplicates = [];
 
@@ -1641,8 +1789,8 @@
             }
             //#endregion
 
-           
-          //#region 鑾峰彇婧愬崟绫诲瀷
+
+            //#region 鑾峰彇婧愬崟绫诲瀷
             function HSourceBillType() {
                 var HName = '閲囪喘閫�鏂欏崟';
                 //鑾峰彇鐧诲綍椤电粍缁囧垪
@@ -1666,7 +1814,100 @@
             }
             //#endregion
 
-         //#region 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栨簮鍗曢��鏂欓�氱煡鍗曟暟鎹�
+            //#region 涓嬫帹椤甸潰鍒濆鍖�-閫�鏂欓�氱煡鍗�
+            function setInit_PushBill_ByPOInStockBackBill() {
+                //鑾峰彇
+                var data = getUrlVars_JSON().data;
+                var dataArray = [];
+                for (var i = 0; i < data.length; i++) {
+                    var temp = getPushSource_POInStockBackInit(data[i].hmainid, data[i].hsubid);
+                    if (temp != "none") {
+                        dataArray.push(temp);
+                    } else {
+                        return;
+                    }
+                }
+
+
+                form.val("component-form-group", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
+                    "HMainSourceInterID": "0"
+                    , "HMainSourceEntryID": "0"
+                    , "HMainSourceBillNo": ""
+                    , "HMainSourceBillType": $("#BillType").val()
+
+                    , "HDeptID": dataArray[0].HDeptID
+                    , "HDeptName": dataArray[0].閮ㄩ棬
+                    , "HManagerID": dataArray[0].HManagerID
+                    , "HManagerName": dataArray[0].涓荤
+                    , "HWHID": dataArray[0].涓昏〃浠撳簱ID == null ? 0 : dataArray[0].涓昏〃浠撳簱ID
+                    , "HWHName": dataArray[0].涓昏〃浠撳簱
+                    , "HEmpID": dataArray[0].HEmpID
+                    , "HEmpName": dataArray[0].涓氬姟鍛�
+                    , "HSupID": dataArray[0].HSupID
+                    , "HSupName": dataArray[0].渚涘簲鍟�
+                    //, "HSecManagerID": dataArray[0].HSecManagerID
+                    //, "HSecManagerName": dataArray[0].楠屾敹鍛�
+                    //, "HKeeperID": dataArray[0].HKeeperID
+                    //, "HKeeperName": dataArray[0].淇濈鍛�
+                    , "HCurID": dataArray[0].HCurID
+                    , "HCurName": dataArray[0].甯佸埆
+                    , "HExRate": dataArray[0].姹囩巼
+                    , "HAddress": data.浜よ揣鍦扮偣
+                    , "HRemark": data.琛ㄥご澶囨敞
+                    , "HInnerBillNo": data.鍐呴儴鍗曟嵁鍙�
+                });
+
+                //瀛愯〃  璧嬪��
+                var rowdata = [];
+                for (var i = 0; i < dataArray.length; i++) {
+                    rowdata.push(
+                        {
+                            "HMaterID": dataArray[i].HMaterID
+                            , "鐗╂枡浠g爜": dataArray[i].鐗╂枡浠g爜
+                            , "鐗╂枡鍚嶇О": dataArray[i].鐗╂枡鍚嶇О
+                            , "瑙勬牸鍨嬪彿": dataArray[i].瑙勬牸鍨嬪彿
+                            , "HUnitID": dataArray[i].HUnitID
+                            , "璁¢噺鍗曚綅": dataArray[i].璁¢噺鍗曚綅
+                            , "HWHID": dataArray[i].HWHID
+                            , "鍙戞枡浠撳簱": dataArray[i].鏀舵枡浠撳簱
+                            , "HSPID": dataArray[i].HSPID
+                            , "浠撲綅鍚嶇О": dataArray[i].浠撲綅鍚嶇О
+                            , "HSecUnitID": dataArray[i].HSecUnitID
+                            , "杈呭姪鍗曚綅": dataArray[i].杈呭姪鍗曚綅
+                            , "HQty": dealDoubleToFixed(dataArray[i].鏁伴噺, 1)
+                            , "HQtyMust": dealDoubleToFixed(dataArray[i].鏁伴噺, 1)
+                            , "HPrice": dealDoubleToFixed(dataArray[i].鍗曚环, 3)
+                            , 'HDiscountRate': dataArray[i].鎶樻墸鐜�                                                    //
+                            , 'HRelTaxPrice': "0"
+                            , "HTaxRate": dataArray[i].绋庣巼
+                            , 'HTaxMoney': dataArray[i].绋庨                                                     //
+                            , "HMoney": dealDoubleToFixed(dataArray[i].閲戦, 2)
+                            , "HRemark": dataArray[i].琛ㄤ綋澶囨敞
+
+                            , "HSourceInterID": dataArray[i].hmainid
+                            , "HSourceEntryID": dataArray[i].hsubid
+                            , "HSourceBillNo": dataArray[i].鍗曟嵁鍙�
+                            , "HSourceBillType": dataArray[i].HBillType
+                            , "HRelationQty": "0"
+                            , "HRelationMoney": "0"
+
+                            , 'HPOOrderInterID': "0"
+                            , 'HPOOrderEntryID': "0"
+                            , 'HPOOrderBillNo': ""
+
+                            , 'HSeOrderTaxPrice': dealDoubleToFixed(dataArray[i].鍚◣鍗曚环, 3)
+                            , "HSeOrderInterID": dataArray[i].hmainid
+                            , "HSeOrderEntryID": dataArray[i].hsubid
+                            , "HSeOrderBillNo": dataArray[i].鍗曟嵁鍙�
+                        }
+                    );
+                }
+                option.data = rowdata;
+                table.render(option);
+            }
+            //#endregion
+
+            //#region 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栨簮鍗曢��鏂欓�氱煡鍗曟暟鎹�
             function getPushSource_POInStockBackInit(HSourceInterID, HSourceEntryID) {
                 var res = "none";
                 $.ajax({
@@ -1692,8 +1933,231 @@
                 return res;
             }
             //#endregion
+
+            //#region 涓嬫帹椤甸潰鍒濆鍖�-閲囪喘鍏ュ簱鍗�
+            function setInit_PushBill_ByPOStockInBillInit() {
+                //鑾峰彇
+                var data = getUrlVars_JSON().data;
+                var dataArray = [];
+                for (var i = 0; i < data.length; i++) {
+                    var temp = getPushSource_POStockInBillInit(data[i].hmainid, data[i].hsubid);
+                    if (temp != "none") {
+                        dataArray.push(temp);
+                    } else {
+                        return;
+                    }
+                }
+
+
+                form.val("component-form-group", { //formTest 鍗� class="layui-form" 鎵�鍦ㄥ厓绱犲睘鎬� lay-filter="" 瀵瑰簲鐨勫��
+                    "HInnerBillNo": dataArray[0].鍐呴儴鍗曟嵁鍙�
+                    , "HSupID": dataArray[0].HSupID
+                    , "HSupName": dataArray[0].渚涘簲鍟�
+                    , "HEmpID": dataArray[0].HEmpID
+                    , "HEmpName": dataArray[0].涓氬姟鍛�
+                    , "HWHID": dataArray[0].涓昏〃浠撳簱ID
+                    , "HWHName": dataArray[0].涓昏〃浠撳簱
+                    //, "HSecManagerID": data.HSecManagerID
+                    //, "HSecManagerName": data.楠屾敹鍛�
+                    , "HKeeperID": dataArray[0].HKeeperID
+                    , "HKeeperName": dataArray[0].淇濈鍛�
+                    , "HDeptName": dataArray[0].閮ㄩ棬
+                    , "HDeptID": dataArray[0].HDeptID
+                    //, "HSourceBillType": data.婧愬崟绫诲瀷
+                    , "HManagerID": dataArray[0].HManagerID
+                    , "HManagerName": dataArray[0].璐熻矗浜�
+                    , "HExRate": dataArray[0].姹囩巼
+                    //, "Box2": ""
+                    //, "HExplanation": data.鎽樿
+                    //, "HRemark": data.琛ㄥご澶囨敞
+
+                    , "HSourceBillType": HSouceBillType
+                });
+
+                //瀛愯〃  璧嬪��
+                var rowdata = [];
+                for (var i = 0; i < dataArray.length; i++) {
+                    rowdata.push(
+                        {
+                            "HMaterID": dataArray[i].HMaterID
+                            , "鐗╂枡浠g爜": dataArray[i].鐗╂枡浠g爜
+                            , "鐗╂枡鍚嶇О": dataArray[i].鐗╂枡鍚嶇О
+                            , "瑙勬牸鍨嬪彿": dataArray[i].瑙勬牸鍨嬪彿
+                            , "HUnitID": dataArray[i].HUnitID
+                            , "璁¢噺鍗曚綅": dataArray[i].璁¢噺鍗曚綅
+
+
+                            , "HWHID": dataArray[i].HWHID
+                            , "鍙戞枡浠撳簱": dataArray[i].鏀舵枡浠撳簱
+                            , "HSPID": dataArray[i].HSPID
+                            , "浠撲綅鍚嶇О": dataArray[i].浠撲綅鍚嶇О
+                            //, "HSecUnitID": dataArray[i].HSecUnitID
+                            //, "杈呭姪鍗曚綅": dataArray[i].杈呭姪鍗曚綅
+
+
+                            , "HQty": dealDoubleToFixed(dataArray[i].瀹炴敹鏁伴噺, 1) - dealDoubleToFixed(dataArray[i].鍏宠仈鏁伴噺, 1)
+                            , "HQtyMust": dealDoubleToFixed(dataArray[i].瀹炴敹鏁伴噺, 1) - dealDoubleToFixed(dataArray[i].鍏宠仈鏁伴噺, 1)
+
+
+                            , "HPrice": dealDoubleToFixed(dataArray[i].鍗曚环, 3)
+                            , "HMoney": dealDoubleToFixed(dataArray[i].閲戦, 2)
+                            , "HOrderPrice": dataArray[i].閲囪喘閲戦
+                            , "HRemark": dataArray[i].琛ㄤ綋澶囨敞
+                            , "HBatchNo": dataArray[i].鎵规
+
+                            , "HSourceInterID": dataArray[i].hmainid
+                            , "HSourceEntryID": dataArray[i].hsubid
+                            , "HSourceBillNo": dataArray[i].鍗曟嵁鍙�
+                            , "HSourceBillType": dataArray[i].HBillType
+                            , "HRelationQty": "0"
+                            , "HRelationMoney": "0"
+                        }
+                    );
+                }
+                option.data = rowdata;
+                table.render(option);
+            }
             //#endregion
 
+            //#region 鏍规嵁涓诲唴鐮佷笌瀛愬唴鐮佽幏鍙栨簮鍗曢噰璐叆搴撳崟鏁版嵁
+            function getPushSource_POStockInBillInit(HSourceInterID, HSourceEntryID) {
+                var res = "none";
+                $.ajax({
+                    url: GetWEBURL() + "/Kf_POStockInBill/loadKf_POStockInBillEdit_Push",
+                    async: false,
+                    type: "GET",
+                    data: {
+                        "HInterID": HSourceInterID
+                        , "HSubID": HSourceEntryID
+                    },
+                    success: function (result) {
+                        if (result.code == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            res = result.data[0];
+                        } else {
+                            res = result.data;
+                            //layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+                        }
+                    }, error: function () {
+                        res = "none";
+                        layer.alert("鍙戠敓閿欒!", { icon: 5 });
+                    }
+                });
+                return res;
+            }
+            //#endregion
+            //#endregion
+            //#region 鍒楄缃�
+            //闅愯棌鍒楄缃�
+            function get_HideColumn() {
+                var colName = "";
+                for (var i = 1; i < option.cols[0].length - 1; i++) {
+                    colName += option.cols[0][i]["field"] + ",";
+                }
+
+                var colTitleName = "";
+                for (var i = 1; i < option.cols[0].length - 1; i++) {
+                    colTitleName += option.cols[0][i]["title"] + ",";
+                }
+                colName = encodeURI(colName.substring(0, colName.length - 1));//瀵� URI 杩涜缂栫爜
+                layer.open({
+                    type: 2
+                    , skin: "layui-layer-rim" //鍔犱笂杈规
+                    , title: "闅愯棌鍒楄缃�"  //鏍囬
+                    , closeBtn: 1  //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                    , shift: 2 //寮瑰嚭鍔ㄧ敾
+                    , area: ["50%", "90%"] //绐椾綋澶у皬
+                    , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                    , content: ['../../鍩虹璧勬枡/闅愯棌鍒楄缃�/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName + '&colTitleName = ' + colTitleName, "yes"]
+                    , btn: ["纭畾", "鍙栨秷"]
+                    , btn1: function (index, laero) {
+                        //鍒锋柊琛ㄦ牸鏁版嵁
+                        DisPlay_HideColumn();
+                        //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                        layer.close(index);//鍏抽棴寮圭獥
+                    }
+                })
+            }
+
+            //鏄剧ず鍒楁暟鎹�
+            function DisPlay_HideColumn() {
+                $.ajax({
+                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
+                    type: "GET",
+                    async: false,
+                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
+                    success: function (data1) {
+                        if (data1.data.length != 0) {
+
+                            var dataCol = [];//鏁版嵁搴撴煡璇㈠嚭鐨勫垪鏁版嵁
+                            var titleData = [];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
+
+                            dataCol = data1.data[0].HGridString.split(',');
+
+                            for (var i = 0; i < option.cols[0].length - 2; i++) {
+                                var dataCols = dataCol[i].split('|');
+                                //闅愯棌鍒�
+                                if (dataCols[1] == 1) {
+                                    option.cols[0][i + 1]["hide"] = true;
+                                }
+                                //璁剧疆鍐呭瀛椾綋澶у皬
+                                if (data1.data[0].HFontSize != 0) {
+                                    option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
+                                } else {
+                                    option.cols[0][i + 1]["style"] = "font-size:100%";
+                                }
+                                //璁剧疆鍒楀
+                                if (dataCols[3] > 0) {
+                                    option.cols[0][i + 1]["width"] = dataCols[3];
+                                }
+                                //鏄剧ず鍒�
+                                if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
+                                    option.cols[0][i + 1]["hide"] = false;
+                                }
+                                //瀛椾綋鎵�鍦ㄤ綅缃�(宸� 灞呬腑 鍙�)
+                                switch (dataCols[2]) {
+                                    case "L":
+                                        option.cols[0][i + 1]["align"] = "left";
+                                        break;
+                                    case "M":
+                                        option.cols[0][i + 1]["align"] = "center";
+                                        break;
+                                    case "R":
+                                        option.cols[0][i + 1]["align"] = "right";
+                                        break;
+                                }
+                                //璁剧疆琛ㄦ牸title灞炴�ф樉绀哄埆鍚�
+                                if (dataCols[4] != null && dataCols[4] != "") {
+                                    option.cols[0][i + 1]["title"] = dataCols[4];
+                                }
+                            }
+                            //鍙栨秷鍐荤粨鍒�
+                            for (var i = 1; i < option.cols[0].length - 1; i++) {
+                                if (option.cols[0][i]["fixed"] != null) {
+                                    option.cols[0][i]["fixed"] = null;
+                                }
+                                else {
+                                    break;
+                                }
+                            }
+                            //鍐荤粨鍒�
+                            if (data1.data[0].HFixCols != 0) {
+                                for (var i = 0; i < data1.data[0].HFixCols; i++) {
+                                    if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
+                                        data1.data[0].HFixCols += 1;
+                                    }
+                                    option.cols[0][i + 1]["fixed"] = "left";
+                                }
+                            }
+                            table.render(option);
+                        } else {
+                            table.render(option);
+                        }
+                    }, error: function () {
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                })
+            }
+            //#endregion
 
             //浠ヤ笂鏄痩ayui妯″潡
         });
@@ -1741,27 +2205,27 @@
         }
 
 
-         //鍙屽嚮杩斿洖鐗╂枡
-         function GetGyMaterial(data) {
-             OptionData = data
-         }
-           //鍙屽嚮杩斿洖璁¢噺鍗曚綅
-         function GetGyUnit(data) {
-             OptionData = data
-         }
+        //鍙屽嚮杩斿洖鐗╂枡
+        function GetGyMaterial(data) {
+            OptionData = data
+        }
+        //鍙屽嚮杩斿洖璁¢噺鍗曚綅
+        function GetGyUnit(data) {
+            OptionData = data
+        }
 
-           //鍙屽嚮杩斿洖鏀舵枡浠撳簱
-         function GetGyWarehouse(data) {
-             OptionData = data
-         } 
+        //鍙屽嚮杩斿洖鏀舵枡浠撳簱
+        function GetGyWarehouse(data) {
+            OptionData = data
+        }
 
 
         //鍙屽嚮杩斿洖鏀舵枡浠撲綅
-         function GetGyStockPlace(data) {
-             OptionData = data
-         } 
+        function GetGyStockPlace(data) {
+            OptionData = data
+        }
 
-           //#region 澶勭悊灏忔暟鏄剧ず浣嶆暟锛坉ata锛氶渶瑕佸鐞嗙殑鏁版嵁锛沶um锛氭暟鎹殑绫诲瀷(濡�1:鏁伴噺锛�2:閲戦锛�3:鍗曚环)锛�
+        //#region 澶勭悊灏忔暟鏄剧ず浣嶆暟锛坉ata锛氶渶瑕佸鐞嗙殑鏁版嵁锛沶um锛氭暟鎹殑绫诲瀷(濡�1:鏁伴噺锛�2:閲戦锛�3:鍗曚环)锛�
         function dealDoubleToFixed(data, num) {
             //鐢ㄤ簬璁剧疆灏忔暟浣嶆暟
             var dotLength = 0;
@@ -1795,7 +2259,7 @@
                 }
             }
         }
-            //#endregion
+                //#endregion
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1