From 8a8f4b04dd45a8e0cca558039b2e77dab82bd93c Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期四, 09 十一月 2023 14:16:49 +0800
Subject: [PATCH] 信用额度申请单:根据客户带出相关信息、隐藏原黄线天数/新黄线天数/原红线天线/新红线天数

---
 WebTM/views/仓存管理/仓库调拨/Kf_MoveStockBill_Fast.html | 1712 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 1,266 insertions(+), 446 deletions(-)

diff --git "a/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\344\273\223\345\272\223\350\260\203\346\213\250/Kf_MoveStockBill_Fast.html" "b/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\344\273\223\345\272\223\350\260\203\346\213\250/Kf_MoveStockBill_Fast.html"
index 3db65a7..7c4b846 100644
--- "a/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\344\273\223\345\272\223\350\260\203\346\213\250/Kf_MoveStockBill_Fast.html"
+++ "b/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\344\273\223\345\272\223\350\260\203\346\213\250/Kf_MoveStockBill_Fast.html"
@@ -1,22 +1,27 @@
 锘�<!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <title>璋冩嫧鍗�</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>鐩存帴璋冩嫧鍗�</title>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
     <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
     <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
+    <style>
+        .layui-col-xs8 {
+            width: 55.666667%;
+        }
+    </style>
 </head>
 
 <body>
     <div class="layui-fluid" style="padding:0">
         <div class="layui-card">
-            <div class="layui-card-body" style="padding: 5px; height:800px;">
+            <div class="layui-card-body" style="padding: 0px; height:800px;">
                 <form class="layui-form" action="" lay-filter="component-form-group">
                     <div style="background-color:#0085E8;">
-                        <span style="color: white;"><i class="layui-icon layui-icon-form"></i>璋冩嫧鍗�</span>
+                        <span style="color: white;"><i class="layui-icon layui-icon-form"></i>鐩存帴璋冩嫧鍗�</span>
                     </div>
                     <div class="layui-form-item" style="padding:15px;margin:0px">
                         <div class="layui-row">
@@ -24,7 +29,20 @@
                                 <label class="layui-form-label" style="width:40px;padding-left:0px;">鏉$爜</label>
                             </div>
                             <div class="layui-col-xs8">
-                                <input type="text" name="HBarCode" id="HBarCode" lay-verify="HBarCode" autocomplete="off" class="layui-input">
+                                <input type="text" name="HBarCode" id="HBarCode" lay-verify="HBarCode" onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;" autocomplete="off" class="layui-input" onfocus="this.select();">
+                            </div>
+                            <div class="layui-col-xs2">
+                                <button type="button" lay-submit="" class="layui-btn" lay-filter="QueDin">纭畾</button>
+                            </div>
+                        </div>
+                        <div class="layui-form-item" style="padding:0px;margin:0px">
+                            <div class="layui-row">
+                                <div class="layui-col-xs3">
+                                    <label class="layui-form-label" style="width:40px;padding-left:0px;">鏁伴噺</label>
+                                </div>
+                                <div class="layui-col-xs8">
+                                    <input type="text" name="HQty" id="HQty" lay-verify="HQty" onkeyup="if(!this.value.match(/^[\+\-]?\d*?\.?\d*?$/)){if(!this.t_value>0){this.value=''}else{this.value=this.t_value;}}else this.t_value=this.value;if(this.value.match(/^(?:[\+\-]?\d+(?:\.\d+)?)?$/))this.o_value=this.value" autocomplete="off" class="layui-input" onfocus="this.select();">
+                                </div>
                             </div>
                         </div>
                     </div>
@@ -33,8 +51,9 @@
                             <li lay-id="1" style="padding:1px;" class="layui-this">閫夋嫨婧愬崟</li>
                             <li lay-id="2" style="padding:1px;">琛ㄥご淇℃伅</li>
                             <li lay-id="3" style="padding:1px;">鏄庣粏淇℃伅</li>
-                            <li lay-id="4" style="padding:1px;">搴撳瓨淇℃伅</li>
-                            <li lay-id="5" style="padding:1px;min-width: 35px;" ">姹囨��</li>
+                            <li lay-id="4" style="padding:1px;">涓嬫灦淇℃伅</li>
+                            <!--<li lay-id="5" style="padding:1px;">搴撳瓨淇℃伅</li>
+                            <li lay-id="6" style="padding:1px;min-width: 35px;">姹囨��</li>-->
                         </ul>
                         <div class="layui-tab-content">
                             <!--閫夋嫨婧愬崟-->
@@ -42,17 +61,17 @@
                                 <div class="layui-form-item">
                                     <div class="layui-row">
                                         <div class="layui-col-xs3">
-                                            <label class="layui-form-label" style="width:60px;padding-left:0px;">鍗曟嵁绫诲瀷</label>
+                                            <label class="layui-form-label" style="width:60px;padding-left:0px;">婧愬崟绫诲瀷</label>
                                         </div>
                                         <div class="layui-col-xs8">
-                                            <select name=" HBillType" id="HBillType">
-                                                <option value="-1">鎵嬪伐褰曞叆</option>
-                                                <option value="3720">鐢熶骇浠诲姟鍗�-鎶曟枡</option>
+                                            <select name="HBillType" id="HBillType">
+                                                <option value="1402">鍙戣揣閫氱煡鍗�</option>
                                                 <option value="1243">璋冩嫧鐢宠鍗�</option>
-                                                <!--<option value="1201">濮斿璁㈠崟-鎶曟枡</option>
-                                <option value="1402">鍙戣揣閫氱煡鍗�</option>
-                                <option value="1234">涓嬫灦閫氱煡鍗�</option>
-                                <option value="1243">璋冩嫧鐢宠鍗�</option>-->
+                                                <option value="3720">鐢熶骇鐢ㄦ枡娓呭崟</option>
+                                                <option value="1604">濮斿鐢ㄦ枡娓呭崟</option>
+                                                <option value="1242">鍑哄簱鐢宠鍗�</option>
+                                                <option value="1214">鐢熶骇鍙戞枡閫氱煡鍗�</option>
+                                                <option value="-1" selected>鎵嬪伐褰曞叆</option>
                                             </select>
                                             <!--<input type="text" name="cmbSourceType" id="cmbSourceType" lay-verify="cmbSourceType" autocomplete="off" class="layui-input">-->
                                         </div>
@@ -64,20 +83,24 @@
                                             <label class="layui-form-label" style="width:60px;padding-left:0px;">婧愬崟鍙�</label>
                                         </div>
                                         <div class="layui-col-xs8">
-                                            <input type="text" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
+                                        </div>
+                                        <div class="layui-col-xs2">
+                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="QueDin2">纭畾</button>
                                         </div>
                                     </div>
                                 </div>
-                                <div class="layui-form-item">
+                                <div class="layui-form-item" style="padding:0px;margin:0px;">
                                     <div class="layui-row">
                                         <div class="layui-col-xs3">
-                                            <label class="layui-form-label" style="width:60px;padding-left:0px;">鍗曟嵁鍙�</label>
+                                            <label class="layui-form-label" style="width:60px;padding-left:0px;">鍏堣繘鍏堝嚭浠撳簱</label><!--鍏堣繘鍏堝嚭浠撳簱-->
                                         </div>
-                                        <div class="layui-col-xs5">
-                                            <input type="text" name="HBillNo" id="HBillNo" lay-verify="HBillNo" disabled="disabled" autocomplete="off" class="layui-input mobile">
+                                        <div class="layui-col-xs8">
+                                            <input type="text" name="HFIFOWHNAME" id="HFIFOWHNAME" lay-verify="HFIFOWHNAME" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
+                                            <input type="hidden" name="HFIFOWHID" id="HFIFOWHID" lay-verify="HFIFOWHID" value="0" autocomplete="off" class="layui-input">
                                         </div>
-                                        <div class="layui-col-xs3">
-                                            <input type="text" name="HInterID" id="HInterID" lay-verify="HInterID" disabled="disabled" autocomplete="off" class="layui-input mobile">
+                                        <div class="layui-col-xs2">
+                                            <button type="button" id="HFIFOWHID-BT" lay-submit="" class="layui-btn" lay-filter="HFIFOWHID-BT">...</button>
                                         </div>
                                     </div>
                                 </div>
@@ -90,6 +113,18 @@
                                             <select name=" HStockStyle" id="HStockStyle">
                                                 <option value="1">缁勭粐鍐呰皟鎷�</option>
                                                 <option value="2">璺ㄧ粍缁囪皟鎷�</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs3">
+                                            <label class="layui-form-label" style="width:60px;padding-left:0px;">鍗曟嵁绫诲瀷</label>
+                                        </div>
+                                        <div class="layui-col-xs8">
+                                            <select name="HBillSubType" id="HBillSubType">
+                                                <!--鍔ㄦ�佹覆鏌撶粍缁�-->
                                             </select>
                                         </div>
                                     </div>
@@ -122,6 +157,19 @@
                                         </div>
                                     </div>
                                 </div>
+                                <div class="layui-form-item">
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs3">
+                                            <label class="layui-form-label" style="width:60px;padding-left:0px;">鍗曟嵁鍙�</label>
+                                        </div>
+                                        <div class="layui-col-xs5">
+                                            <input type="text" name="HBillNo" id="HBillNo" lay-verify="HBillNo" disabled="disabled" autocomplete="off" class="layui-input mobile">
+                                        </div>
+                                        <div class="layui-col-xs3">
+                                            <input type="text" name="HInterID" id="HInterID" lay-verify="HInterID" disabled="disabled" autocomplete="off" class="layui-input mobile">
+                                        </div>
+                                    </div>
+                                </div>
                             </div>
                             <!--琛ㄥご淇℃伅-->
                             <div class="layui-tab-item">
@@ -131,7 +179,7 @@
                                             <label class="layui-form-label" style="width:60px;padding-left:0px;">璋冨叆浠撳簱</label>
                                         </div>
                                         <div class="layui-col-xs6">
-                                            <input type="text" name="HWHNAME" id="HWHNAME" lay-verify="HWHNAME" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HWHNAME" id="HWHNAME" lay-verify="HWHNAME" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
                                             <input type="hidden" name="HWHID" id="HWHID" lay-verify="HWHID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
@@ -145,11 +193,11 @@
                                             <label class="layui-form-label" style="width:60px;padding-left:0px;">璋冨叆浠撲綅</label>
                                         </div>
                                         <div class="layui-col-xs6">
-                                            <input type="text" name="HStockPlaceName" id="HStockPlaceName" lay-verify="HStockPlaceName" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HStockPlaceName" id="HStockPlaceName" lay-verify="HStockPlaceName" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
                                             <input type="hidden" name="HStockPlaceID" id="HStockPlaceID" lay-verify="HStockPlaceID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
-                                            <button type="button" id="HSpID-BT" lay-submit="" class="layui-btn" lay-filter="HSpID-BT" style="display:none">...</button>
+                                            <button type="button" id="HSpID-BT" lay-submit="" class="layui-btn" lay-filter="HSpID-BT">...</button>
                                         </div>
                                     </div>
                                 </div>
@@ -159,7 +207,7 @@
                                             <label class="layui-form-label" style="width:60px;padding-left:0px;">璋冨嚭浠撳簱</label>
                                         </div>
                                         <div class="layui-col-xs6">
-                                            <input type="text" name="HSCWHNAME" id="HSCWHNAME" lay-verify="HSCWHNAME" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HSCWHNAME" id="HSCWHNAME" lay-verify="HSCWHNAME" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
                                             <input type="hidden" name="HSCWHID" id="HSCWHID" lay-verify="HSCWHID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
@@ -173,11 +221,11 @@
                                             <label class="layui-form-label" style="width:60px;padding-left:0px;">璋冨嚭浠撲綅</label>
                                         </div>
                                         <div class="layui-col-xs6">
-                                            <input type="text" name="HOutStockPlaceName" id="HOutStockPlaceName" lay-verify="HOutStockPlaceName" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HOutStockPlaceName" id="HOutStockPlaceName" lay-verify="HOutStockPlaceName" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
                                             <input type="hidden" name="HOutStockPlaceID" id="HOutStockPlaceID" lay-verify="HOutStockPlaceID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
-                                            <button type="button" id="HOSpID-BT" lay-submit="" class="layui-btn" lay-filter="HOSpID-BT" style="display:none">...</button>
+                                            <button type="button" id="HOSpID-BT" lay-submit="" class="layui-btn" lay-filter="HOSpID-BT">...</button>
                                         </div>
                                     </div>
                                 </div>
@@ -187,7 +235,7 @@
                                             <label class="layui-form-label" style="width:30px;padding-left:0px;">鐝粍</label>
                                         </div>
                                         <div class="layui-col-xs6">
-                                            <input type="text" name="HGroupName" id="HGroupName" lay-verify="HGroupName" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HGroupName" id="HGroupName" lay-verify="HGroupName" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
                                             <input type="hidden" name="HGroupID" id="HGroupID" lay-verify="HGroupID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
@@ -201,7 +249,7 @@
                                             <label class="layui-form-label" style="width:30px;padding-left:0px;">淇濈</label>
                                         </div>
                                         <div class="layui-col-xs6">
-                                            <input type="text" name="HKeeper" id="HKeeper" lay-verify="HKeeper" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HKeeper" id="HKeeper" lay-verify="HKeeper" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
                                             <input type="hidden" name="HKeeperID" id="HKeeperID" lay-verify="HKeeperID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
@@ -215,7 +263,7 @@
                                             <label class="layui-form-label" style="width:30px;padding-left:0px;">楠屾敹</label>
                                         </div>
                                         <div class="layui-col-xs6">
-                                            <input type="text" name="HSecManager" id="HSecManager" lay-verify="HSecManager" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HSecManager" id="HSecManager" lay-verify="HSecManager" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
                                             <input type="hidden" name="HSecManagerID" id="HSecManagerID" lay-verify="HSecManagerID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
@@ -229,7 +277,7 @@
                                             <label class="layui-form-label" style="width:30px;padding-left:0px;">閮ㄩ棬</label>
                                         </div>
                                         <div class="layui-col-xs6">
-                                            <input type="text" name="HDeptName" id="HDeptName" lay-verify="HDeptName" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HDeptName" id="HDeptName" lay-verify="HDeptName" onkeyup="value=value.replace(/\s+/g,'')" autocomplete="off" class="layui-input" onfocus="this.select();">
                                             <input type="hidden" name="HDeptID" id="HDeptID" lay-verify="HDeptID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
@@ -243,7 +291,7 @@
                                             <label class="layui-form-label" style="width:30px;padding-left:0px;">璋冨嚭缁勭粐</label>
                                         </div>
                                         <div class="layui-col-xs6">
-                                            <input type="text" name="HStockOutOrgName" id="HStockOutOrgName" lay-verify="HStockOutOrgName" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HStockOutOrgName" id="HStockOutOrgName" lay-verify="HStockOutOrgName" autocomplete="off" class="layui-input" onfocus="this.select();">
                                             <input type="hidden" name="HStockOutOrgID" id="HStockOutOrgID" lay-verify="HStockOutOrgID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
@@ -257,7 +305,7 @@
                                             <label class="layui-form-label" style="width:30px;padding-left:0px;">璋冨叆缁勭粐</label>
                                         </div>
                                         <div class="layui-col-xs6">
-                                            <input type="text" name="HStockInOrgName" id="HStockInOrgName" lay-verify="HStockInOrgName" autocomplete="off" class="layui-input">
+                                            <input type="text" name="HStockInOrgName" id="HStockInOrgName" lay-verify="HStockInOrgName" autocomplete="off" class="layui-input" onfocus="this.select();">
                                             <input type="hidden" name="HStockInOrgID" id="HStockInOrgID" lay-verify="HStockInOrgID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
@@ -279,38 +327,32 @@
                                     </div>
                                 </div>
                                 <!--<div class="layui-form-item" >
-                    <label class="layui-form-label" style="width:60px;padding-left:0px;">璋冩嫧绫诲瀷</label>
-                    <div class="layui-input-inline">
-                        <select name=" HBillType" id="HBillType">
-                            <option value="">浠撳簱璋冩嫧</option>
-                            <option value="">棰嗘枡璋冩嫧</option>
-                        </select>
-                        <input type="text" name="cmbSourceType" id="cmbSourceType" lay-verify="cmbSourceType" autocomplete="off" class="layui-input">
-                    </div>
-                </div>-->
+                                <label class="layui-form-label" style="width:60px;padding-left:0px;">璋冩嫧绫诲瀷</label>
+                                <div class="layui-input-inline">
+                                    <select name=" HBillType" id="HBillType">
+                                        <option value="">浠撳簱璋冩嫧</option>
+                                        <option value="">棰嗘枡璋冩嫧</option>
+                                    </select>
+                                    <input type="text" name="cmbSourceType" id="cmbSourceType" lay-verify="cmbSourceType" autocomplete="off" class="layui-input">
+                                </div>
+                            </div>-->
                             </div>
                             <!--鏄庣粏淇℃伅-->
                             <div class="layui-tab-item">
-                                <div class="layui-form-item" style="padding:0px;margin:0px">
-                                    <div class="layui-row">
-                                        <div class="layui-col-xs3">
-                                            <label class="layui-form-label" style="width:40px;padding-left:0px;">鏁伴噺</label>
-                                        </div>
-                                        <div class="layui-col-xs8">
-                                            <input type="text" name="HQty" id="HQty" lay-verify="HQty" autocomplete="off" class="layui-input">
-                                        </div>
-                                    </div>
-                                </div>
                                 <table class="layui-hide" id="wl-table" lay-filter="wl-table"></table>
                             </div>
+                            <!--涓嬫灦淇℃伅-->
+                            <div class="layui-tab-item">
+                                <table class="layui-hide" id="FIFOlist-table" lay-filter="FIFOlist-table"></table>
+                            </div>
                             <!--搴撳瓨淇℃伅-->
-                            <div class="layui-tab-item">
+                            <!--<div class="layui-tab-item">
                                 <table class="layui-hide" id="mx-table" lay-filter="mx-table"></table>
-                            </div>
+                            </div>-->
                             <!--姹囨��-->
-                            <div class="layui-tab-item">
+                            <!--<div class="layui-tab-item">
                                 <table class="layui-hide" id="fj-table-qd" lay-filter="fj-table-qd"></table>
-                            </div>
+                            </div>-->
                         </div>
                         <!--<div class="layui-form-item" style="margin-bottom: 20px;">
             <div class="layui-row">
@@ -368,13 +410,95 @@
                 , table = layui.table
                 , form = layui.form
                 , element = layui.element;
-            $("#HBarCode").focus();
+            var HInterID = $('#HInterID').val()
+            var HBillNo = $('#HBillNo').val()
+            var HBillType = '1207'
+            var HMaker = sessionStorage["HUserName"]
+            var HSourceFlag = sessionStorage["SourceFlag"];
+            var OperationType = 0;//鎿嶄綔绫诲瀷
+            var option = [];
+            $("#HSourceBillNo").focus();
+
+            var listOption = {
+                elem: '#wl-table'
+                , toolbar: '#toolbarDemo'
+                , cellMinWidth: 90
+                , limit: 3000
+                , totalRow: true
+                , cols: [[
+                    { type: 'radio' }
+                    , { field: 'HQty', title: '鏁伴噺', width: 150, totalRow: true }
+                    , { field: 'HQtyMust', title: '搴旀敹鏁伴噺', width: 150, totalRow: true }
+                    , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 150 }
+                    , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 150 }
+                    , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 150 }
+                    , { field: 'HAuxPropName', title: '杈呭姪灞炴��', width: 150 }
+                    , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 150 }
+                    //, { field: 'HBatchNo', title: '鎵规', width: 150, hide: true }
+                    , { field: 'HPieceQty', title: '鏉$爜鏁伴噺', width: 150, totalRow: true }
+                    , { field: 'HMaterID', title: 'HMaterID', width: 150, hide: true }
+                    , { field: 'HAuxPropID', title: 'HAuxPropID', width: 150, hide: true }
+                    , { field: 'HSourceInterID', title: 'HSourceInterID', width: 150, hide: true }
+                    , { field: 'HSourceEntryID', title: 'HSourceEntryID', width: 150, hide: true }
+                    , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 70 }
+                ]]
+                , height: 500
+                , done: function () {
+                    layer.closeAll("loading");
+                }
+            }
+            var FIFOlistOption = {
+                elem: '#FIFOlist-table'
+                , toolbar: '#toolbarDemo'
+                , cellMinWidth: 90
+                , limit: 3000
+                , totalRow: true
+                , cols: [[
+                    { field: 'HQty', title: '鏁伴噺', width: 150, totalRow: true }
+                    , { field: 'HQtyMust', title: '涓嬫灦鏁伴噺', width: 150, totalRow: true }
+                    , { field: 'HWhName', title: '浠撳簱', width: 150 }
+                    , { field: 'HSPName', title: '浠撲綅', width: 150 }
+                    , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 150 }
+                    , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 150 }
+                    , { field: 'HBatchNo', title: '鎵规', width: 150 }
+                    , { field: 'HAuxPropName', title: '杈呭姪灞炴��', width: 150 }
+                ]]
+                , height: 500
+                , done: function () {
+                    layer.closeAll("loading");
+                }
+            }
+            var listOption1 = {
+                elem: '#mx-table'
+                , toolbar: '#toolbarDemo'
+                , cellMinWidth: 90
+                , cols: [[
+                    { type: 'radio' }
+                    , { field: 'HQty', title: '鏁伴噺', width: 150, totalRow: true }
+                    , { field: 'HQtyMust', title: '搴旀敹鏁伴噺', width: 150, totalRow: true }
+                    , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 150 }
+                    , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 150 }
+                    , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 150 }
+                    , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150 }
+                    , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150 }
+                    , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 150 }
+                    , { field: 'HBatchNo', title: '鎵规', width: 150 }
+                    , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 70 }
+                ]]
+                , height: 500
+                , done: function () {
+                    layer.closeAll("loading");
+                }
+            }
 
             //琛ㄥご鍒濆鍖栬祴鍊硷紙鏍规嵁鐧诲綍鐢ㄦ埛鑾峰彇 榛樿浠撳簱銆侀儴闂ㄣ�侀獙鏀躲�佷繚绠°�侀噾铦剁敤鎴凤級 new
-            $("#HSCWHID").val(sessionStorage["HWHID"]);
-            $("#HSCWHNAME").val(sessionStorage["HWHName"]);
-            $("#HOutStockPlaceID").val(sessionStorage["HSPID"]);
-            $("#HOutStockPlaceName").val(sessionStorage["HSPName"]);
+            //$("#HSCWHID").val(sessionStorage["HWHID"]);
+           
+
+
+           // $("#HSCWHNAME").val(sessionStorage["HWHName"]);
+            //$("#HOutStockPlaceID").val(sessionStorage["HSPID"]);
+            //$("#HOutStockPlaceName").val(sessionStorage["HSPName"]);
             $("#HDeptID").val(sessionStorage["HDeptID"]);
             $("#HDeptName").val(sessionStorage["HDept"]);
             $("#HSecManagerID").val(sessionStorage["HSecManagerID"]);
@@ -392,7 +516,8 @@
             $("#HStockOutOrgName").val(sessionStorage["Organization"]);
             $("#HStockInOrgID").val(sessionStorage["OrganizationID"]);
             $("#HStockInOrgName").val(sessionStorage["Organization"]);
-            var HSourceFlag = sessionStorage["SourceFlag"];
+            $("#HBillSubType").val(sessionStorage["HBillSubType"]);
+
 
             //鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
             if (sessionStorage.login != "login") {
@@ -412,23 +537,156 @@
                 }
                 return vars;
             }
+            //var params = getUrlVars();
+            //var HInterID_Temp = params[params[0]]; //浠庡弬鏁颁腑鑾峰彇 鍗曟嵁鍐呯爜
+            //var lSourceBillType = params[params[2]];  //浠庡崟鎹幏鍙� 婧愬崟绫诲瀷    
             var params = getUrlVars();
-            var linterid = params[params[0]]; //浠庡弬鏁颁腑鑾峰彇 鍗曟嵁鍐呯爜
-            var lSourceBillType = params[params[2]];  //浠庡崟鎹幏鍙� 婧愬崟绫诲瀷
+            var OperationType = params[params[0]];  //浠庣紦瀛樺垪琛ㄤ腑杩斿洖鏁版嵁绫诲瀷  1鏂板  2浠庣紦瀛樺垪琛ㄤ腑杩斿洖
+            var HInterID_Temp = params[params[1]];  //浠庣紦瀛樺垪琛ㄤ腑杩斿洖鍗曟嵁ID
+            var HSourceBillType = params[params[2]]; //鐢ㄤ簬鍒ゆ柇婧愬崟绫诲瀷
 
-            function RoadBillMain(linterid)//鍔犺浇琛ㄥご
+
+            //鍒ゆ柇鏄惁鏂板
+            if (HInterID != 0) {
+                HSourceFlag = true;
+            }
+            //浠庣紦瀛樺垪琛ㄧ紪杈戝姛鑳借烦杞嚦鍗曟嵁妯″潡
+            else if (OperationType == 2) {
+                RoadBillMain(HInterID_Temp);
+                $("#HBarCode").select();
+                $("#HBarCode").focus();     //鑾峰彇鍏夋爣
+                //$('#QueDin2').addClass("layui-btn-disabled").attr("disabled", true);//鎸夐挳绂佺敤
+                //document.getElementById("QueDin2").disabled = true;   //鎸夐挳鍙樹负涓嶅彲缂栬緫鐘舵��
+                //鏄剧ず琛ㄤ綋鏄庣粏
+                DisBillEntryList();
+                HSourceFlag = true;
+            }
+            else {
+                OperationType = 1;
+                //鑾峰彇鏈�澶у崟鎹甀D銆佸崟鎹彿
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/WEBSController/GetMaxBillNoAndID_Json",
+                    async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                    data: { "HBillType": HBillType },
+                    success: function (d) {
+                        if (d.count == 1) {
+                            $("#HInterID").val(d.data[0].HInterID);
+                            $("#HBillNo").val(d.data[0].HBillNo);
+                            HInterID = $('#HInterID').val()
+                            HBillNo = $('#HBillNo').val()
+                        }
+                        else {
+                            layer.msg(d.Message, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+                        }
+                    }
+                });
+
+                //鑾峰彇鍗曟嵁瀛愮被鍨�
+                var HBillSubType = '';
+                var HStockOutOrgID = $("#HStockOutOrgID").val()//璋冨嚭缁勭粐
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/WEBSController/GetBillSubType_Json",
+                    async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                    data: { "HBillType": '1207', "HStockOrgID": HStockOutOrgID },
+                    success: function (result) {
+                        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            var data = result.data;
+                            for (var i = 0; i < data.length; i++) {
+                                HBillSubType += '<option value="' + data[i].HNumber + '">' + data[i].HName + '</option>';
+                            }
+                            $("#HBillSubType").append(HBillSubType);
+                            if (HSourceBillType == 1402) { //鍙戣揣閫氱煡鍗�
+                                $("#HBillSubType").val("ZJDB02_SYS"); //鍗曟嵁绫诲瀷榛樿涓哄瘎鍞�
+                            }
+                            form.render('select');
+                        }
+                        layer.closeAll("loading");
+                    }
+                })
+
+                HSourceFlag = false;
+            }
+
+            function RoadBillMain(HInterID_Temp)//鍔犺浇琛ㄥご
             {
                 $.ajax({
-                    url: GetWEBURL() + "/Web/GetPonderationBill",
                     type: "GET",
-                    data: { "HInterID": linterid },
+                    url: GetWEBURL() + "/Web/GetPonderationBill",
+                    async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                    data: { "HInterID": HInterID_Temp },
                     success: function (d) {
                         // console.log(d.data);
                         $("#HInterID").val(d.data[0].HInterID);
                         $("#HBillNo").val(d.data[0].HBillNo);
-                        $("#HBillType").val(d.data[0].HSourceBillType);
+                        $("#HBillType").val(d.data[0].HSourceBillType == null ? "1402" : d.data[0].HSourceBillType);
+                        //鑾峰彇婧愬崟绫诲瀷銆佹簮鍗曞崟鍙�
+                        if (d.data[0].HSourceBillType == "1402") {
+                            $("#HBillType").empty();
+                            $("#HBillType").val("1402");
+                            var optionHtml = '';
+                            optionHtml += "<option value = '" + d.data[0].HSourceBillType + "' >" + '鍙戣揣閫氱煡鍗�' + "</option>";
+                            $("#HBillType").append(optionHtml);
+                            layui.form.render('select');
+                            $("#HBillType").attr("readonly", "readonly");
+                        }
+                        else if (d.data[0].HSourceBillType == "1243") {
+                            $("#HBillType").empty();
+                            $("#HBillType").val("1243");
+                            var optionHtml = '';
+                            optionHtml += "<option value = '" + d.data[0].HSourceBillType + "' >" + '璋冩嫧鐢宠鍗�' + "</option>";
+                            $("#HBillType").append(optionHtml);
+                            layui.form.render('select');
+                            $("#HBillType").attr("readonly", "readonly");
+                        }
+                        else if (d.data[0].HSourceBillType == "3720") {
+                            $("#HBillType").empty();
+                            $("#HBillType").val("3720");
+                            var optionHtml = '';
+                            optionHtml += "<option value = '" + d.data[0].HSourceBillType + "' >" + '鐢熶骇鐢ㄦ枡娓呭崟' + "</option>";
+                            $("#HBillType").append(optionHtml);
+                            layui.form.render('select');
+                            $("#HBillType").attr("readonly", "readonly");
+                        }
+                        else if (d.data[0].HSourceBillType == "1604") {
+                            $("#HBillType").empty();
+                            $("#HBillType").val("1604");
+                            var optionHtml = '';
+                            optionHtml += "<option value = '" + d.data[0].HSourceBillType + "' >" + '濮斿鐢ㄦ枡娓呭崟' + "</option>";
+                            $("#HBillType").append(optionHtml);
+                            layui.form.render('select');
+                            $("#HBillType").attr("readonly", "readonly");
+                        }
+                        else if (d.data[0].HSourceBillType == "1242") {
+                            $("#HBillType").empty();
+                            $("#HBillType").val("1242");
+                            var optionHtml = '';
+                            optionHtml += "<option value = '" + d.data[0].HSourceBillType + "' >" + '鍑哄簱鐢宠鍗�' + "</option>";
+                            $("#HBillType").append(optionHtml);
+                            layui.form.render('select');
+                            $("#HBillType").attr("readonly", "readonly");
+                        }
+                        else if (d.data[0].HSourceBillType == "1214") {
+                            $("#HBillType").empty();
+                            $("#HBillType").val("1214");
+                            var optionHtml = '';
+                            optionHtml += "<option value = '" + d.data[0].HSourceBillType + "' >" + '鐢熶骇鍙戞枡閫氱煡鍗�' + "</option>";
+                            $("#HBillType").append(optionHtml);
+                            layui.form.render('select');
+                            $("#HBillType").attr("readonly", "readonly");
+                        }
+                        else {
+                            $("#HBillType").empty();
+                            $("#HBillType").val("-1");
+                            var optionHtml = '';
+                            optionHtml += "<option value = '" + d.data[0].HSourceBillType + "' >" + '鎵嬪伐褰曞叆' + "</option>";
+                            $("#HBillType").append(optionHtml);
+                            layui.form.render('select');
+                            $("#HBillType").attr("readonly", "readonly");
+                        }
                         $("#HSourceBillNo").val(d.data[0].HSourceBillNo);
-                        $("#HSourceBillNo").attr("disabled","true");
+                        $("#HSourceBillNo").attr("disabled", "true");
                         //$("#HSourceBillNo").append.readonly = true;
                         HSourceFlag = true;
                         //$("#HWHID").val(d.data[0].HWhID);
@@ -439,17 +697,113 @@
                         //$("#HQty").val(d.data[0].HQty);
                     }
                 })
+                //鑾峰彇鍗曟嵁瀛愮被鍨�
+                var HBillSubType = '';
+                var HStockOutOrgID = $("#HStockOutOrgID").val()//璋冨嚭缁勭粐
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/WEBSController/GetBillSubType_Json",
+                    async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                    data: { "HBillType": '1207', "HStockOrgID": HStockOutOrgID },
+                    success: function (result) {
+                        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            var data = result.data;
+                            for (var i = 0; i < data.length; i++) {
+                                HBillSubType += '<option value="' + data[i].HNumber + '">' + data[i].HName + '</option>';
+                            }
+                            $("#HBillSubType").append(HBillSubType);
+                            form.render('select');
+                        }
+                        layer.closeAll("loading");
+                    }
+                })
             }
 
 
-            function RoadBillSub(linterid)//鍔犺浇琛ㄤ綋
+
+            ////鍒ゆ柇鏄惁鏂板
+            //if (HInterID_Temp == null || HInterID_Temp == 0) {
+            //    //鑾峰彇鏈�澶у崟鎹彿 new
+            //    $("#HInterID").val("");
+            //    $("#HBillNo").val("");
+            //    $.ajax({
+            //        url: GetWEBURL() + "/Web/GetMAXNumPDA",
+            //        type: "GET",
+            //        data: { "HBillType": '1207' },
+            //        success: function (d) {
+            //            //console.log(d.data);
+            //            $("#HInterID").val(d.data[0].HInterID);
+            //            $("#HBillNo").val(d.data[0].HBillNo);
+            //        }
+            //    });
+            //    //鑾峰彇鍗曟嵁瀛愮被鍨�
+            //    var HBillSubType = '';
+            //    var HStockOutOrgID = $("#HStockOutOrgID").val()//璋冨嚭缁勭粐
+            //    $.ajax({
+            //        url: GetWEBURL() + "/WEBSController/GetBillSubType_Json",
+            //        type: "GET",
+            //        data: { "HBillType": '1207', "HStockOrgID": HStockOutOrgID },
+            //        success: function (result) {
+            //            if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+            //                var data = result.data;
+            //                for (var i = 0; i < data.length; i++) {
+            //                    HBillSubType += '<option value="' + data[i].HNumber + '">' + data[i].HName + '</option>';
+            //                }
+            //                $("#HBillSubType").append(HBillSubType);
+            //                if (HSourceBillType == 1402) { //鍙戣揣閫氱煡鍗�
+            //                    $("#HBillSubType").val("ZJDB02_SYS"); //鍗曟嵁绫诲瀷榛樿涓哄瘎鍞�
+            //                }
+            //                form.render('select');
+            //            }
+            //            layer.closeAll("loading");
+            //        }
+            //    })
+            //}
+            //else {//濡傛灉淇敼鍒欒蛋涓嬮潰 new
+            //    RoadBillMain(HInterID_Temp);
+            //    RoadBillSub(HInterID_Temp);
+            //}
+
+            if (HSourceBillType == 1402) { //鍙戣揣閫氱煡鍗�
+                $("#HBillType").val(1402);
+               
+            } else if (HSourceBillType == 1243) { //璋冩嫧鐢宠鍗�
+                $("#HBillType").val(1243);
+
+            } else if (HSourceBillType == 1214) { //鐢熶骇鍙戞枡閫氱煡鍗�
+                $("#HBillType").val(1214);
+
+            } else if (HSourceBillType == 3720) { //鐢熶骇鐢ㄦ枡娓呭崟
+                $("#HBillType").val(3720);
+
+            } else if (HSourceBillType == 1604) { //濮斿鐢ㄦ枡娓呭崟
+                $("#HBillType").val(1604);
+
+            } else if (HSourceBillType == 1242) { //鍑哄簱鐢宠鍗�
+                $("#HBillType").val(1242);
+            } else {
+                $("#HBillType").val(-1);
+            }
+          
+             //鐩存帴璋冩嫧  鎵皟鍑轰粨搴�--璋冨叆浠撳簱--鏉$爜
+            if ($("#HBillType").val() == -1) {
+                element.tabChange('tab-MoveStockBill', '2');
+
+                $("#HSCWHNAME").focus();//璋冨嚭浠撳簱
+            }
+
+
+
+            function RoadBillSub(HInterID_Temp)//鍔犺浇琛ㄤ綋
             {
                 table.render({
                     elem: '#wl-table'
                     , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
-                    , toolbar: '#toolbarDemo'
+                    //, toolbar: '#toolbarDemo'
+                    , page: true
+                    , limit: 100
                     , defaultToolbar: []
-                    , where: { HBillID: linterid, HBillType: '1207', sWhere: '' }
+                    , where: { HBillID: HInterID_Temp, HBillType: '1207', sWhere: '' }
                     , cols: [[
                           { type: 'radio' }
                         , { field: 'HQty', title: '鏁伴噺', width: 150 }
@@ -460,7 +814,7 @@
                         , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150 }
                         , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150 }
                         , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 150 }
-                        , { field: 'HBatchNo', title: '鎵规', width: 150 }
+                        //, { field: 'HBatchNo', title: '鎵规', width: 150 }
                         , { field: 'HMaterID', title: '鐗╂枡鍐呯爜', width: 150, hide: true }
                         , { field: 'HAuxPropID', title: '', width: 150, hide: true }
                         , { field: 'HMTONo', title: '璁″垝璺熻釜鍙�', width: 150, hide: true }
@@ -471,29 +825,25 @@
                         layer.closeAll("loading");
                     }
                 });
-            }
+            }            
 
-            //鍒ゆ柇鏄惁鏂板
-            if (linterid == null || linterid == 0) {
-                //鑾峰彇鏈�澶у崟鎹彿 new
-                $("#HInterID").val("");
-                $("#HBillNo").val("");
-                $.ajax({
-                    url: GetWEBURL() + "/Web/GetMAXNum",
-                    type: "GET",
-                    data: { "HBillType": '1207' },
-                    success: function (d) {
-                        //console.log(d.data);
-                        $("#HInterID").val(d.data[0].HInterID);
-                        $("#HBillNo").val(d.data[0].HBillNo);
+            //閫夋嫨鍏堣繘鍏堝嚭浠撳簱
+            form.on('submit(HFIFOWHID-BT)', function () {//閫夋嫨璋冨嚭浠撳簱
+                var HStockOutOrgID = $("#HStockOutOrgID").val();
+                layer.open({
+                    type: 2
+                    , area: ['100%', '100%']
+                    , title: '浠撳簱鍒楄〃'
+                    , shade: 0.6 //閬僵閫忔槑搴�
+                    , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
+                    , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+                    , content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_WarehouseListNew.html?Type=HFIFOWHID&HOrgID=' + HStockOutOrgID + '', 'yes']
+                    , resize: false
+                    , cancel: function () {
+                        //$(".layui-btn").removeClass("layui-btn-disabled");
                     }
-                });
-            }
-            else {//濡傛灉淇敼鍒欒蛋涓嬮潰 new
-                RoadBillMain(linterid);
-                RoadBillSub(linterid);
-            }
-
+                })
+            });
 
             //閫夋嫨璋冨叆浠撳簱
             form.on('submit(HWHID-BT)', function () {//閫夋嫨璋冨叆浠撳簱
@@ -548,7 +898,7 @@
 
             //閫夋嫨璋冨叆浠撲綅
             form.on('submit(HSpID-BT)', function () {//閫夋嫨璋冨叆浠撲綅
-
+                var HStockInOrgID = $("#HStockInOrgID").val();
                 layer.open({
                     type: 2
                     , area: ['100%', '100%']
@@ -556,12 +906,28 @@
                     , shade: 0.6 //閬僵閫忔槑搴�
                     , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
                     , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
-                    , content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_StockPlaceListNew.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HSpID&HOrgID=HStockInOrgID', 'yes']
+                    , content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_StockPlaceListNew.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HSpID&HOrgID=' + HStockInOrgID + '', 'yes']
                     , resize: false
                     , cancel: function () {
                     }
                 })
             });
+
+            //form.on('submit(HSpID-BT)', function () {//閫夋嫨浠撲綅
+            //    layer.open({
+            //        type: 2
+            //        , area: ['100%', '100%']
+            //        , title: '浠撲綅鍒楄〃'
+            //        , shade: 0.6 //閬僵閫忔槑搴�
+            //        , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
+            //        , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+            //        , content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_StockPlaceList.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HSpID', 'yes']
+            //        , resize: false
+            //        , cancel: function () {
+            //            //$(".layui-btn").removeClass("layui-btn-disabled");
+            //        }
+            //    })
+            //});
 
             //閫夋嫨璋冨嚭浠撳簱
             form.on('submit(HSCWHID-BT)', function () {//閫夋嫨璋冨嚭浠撳簱
@@ -583,6 +949,7 @@
 
             //閫夋嫨璋冨嚭浠撲綅
             form.on('submit(HOSpID-BT)', function () {//閫夋嫨璋冨嚭浠撲綅
+                var HStockOutOrgID = $("#HStockOutOrgID").val();
                 layer.open({
                     type: 2
                     , area: ['100%', '100%']
@@ -590,13 +957,29 @@
                     , shade: 0.6 //閬僵閫忔槑搴�
                     , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
                     , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
-                    , content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_StockPlaceListNew.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HOSpID&HOrgID=HStockOutOrgID', 'yes']
+                    , content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_StockPlaceListNew.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HOSpID&HOrgID=' + HStockOutOrgID + '', 'yes']
                     , resize: false
                     , cancel: function () {
                         //$(".layui-btn").removeClass("layui-btn-disabled");
                     }
                 })
             });
+
+            //form.on('submit(HOSpID-BT)', function () {//閫夋嫨浠撲綅
+            //    layer.open({
+            //        type: 2
+            //        , area: ['100%', '100%']
+            //        , title: '浠撲綅鍒楄〃'
+            //        , shade: 0.6 //閬僵閫忔槑搴�
+            //        , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
+            //        , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+            //        , content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_StockPlaceList.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HOSpID', 'yes']
+            //        , resize: false
+            //        , cancel: function () {
+            //            //$(".layui-btn").removeClass("layui-btn-disabled");
+            //        }
+            //    })
+            //});
 
 
 
@@ -721,21 +1104,46 @@
 
             //缂栬緫
             form.on('submit(cmdModify)', function () {//缂栬緫
-                var sSubStr = table.cache['wl-table'];
-                //if (AllowLoadData(sSubStr) != false) {//闈炵┖楠岃瘉
-                layer.open({
-                    type: 2
-                    , area: ['100%', '100%']
-                    , title: '鏄庣粏鍒楄〃'
-                    , shade: 0.6 //閬僵閫忔槑搴�
-                    , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
-                    , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
-                    , content: ['../../../views/鍏叡椤甸潰/Kf_BarCodeEditDlg.html?table=' + JSON.stringify(sSubStr), 'yes']
-                    , resize: false
-                    , cancel: function () {
-                        //$(".layui-btn").removeClass("layui-btn-disabled");
-                    }
-                })
+                var checkStatus = table.checkStatus('wl-table')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1) {
+                    layer.open({
+                        type: 2
+                        , area: ['100%', '100%']
+                        , title: '鏄庣粏鍒楄〃'
+                        , shade: 0.6 //閬僵閫忔槑搴�
+                        , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
+                        , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+                        , content: ['../../../views/鍏叡椤甸潰/Kf_BarCodeEditDlg.html?HInterID=' + data[0].HInterID + '&HMaterID =' + data[0].HMaterID + '&HBillType =' + data[0].HBillType, 'yes']
+                        , resize: false
+                        , cancel: function () {
+                            //$(".layui-btn").removeClass("layui-btn-disabled");
+                        }
+                        , end: function () {
+                            //鏄剧ず琛ㄤ綋鏄庣粏
+                            DisBillEntryList();
+                        }
+                    })
+                }
+                else {
+                    layer.msg('璇峰厛閫夋嫨涓�琛岃褰曪紝杩涜缂栬緫锛�');
+                }
+
+                //var sSubStr = table.cache['wl-table'];
+                ////if (AllowLoadData(sSubStr) != false) {//闈炵┖楠岃瘉
+                //layer.open({
+                //    type: 2
+                //    , area: ['100%', '100%']
+                //    , title: '鏄庣粏鍒楄〃'
+                //    , shade: 0.6 //閬僵閫忔槑搴�
+                //    , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
+                //    , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
+                //    , content: ['../../../views/鍏叡椤甸潰/Kf_BarCodeEditDlg.html?table=' + JSON.stringify(sSubStr), 'yes']
+                //    , resize: false
+                //    , cancel: function () {
+                //        //$(".layui-btn").removeClass("layui-btn-disabled");
+                //    }
+                //})
                 // }
             });
 
@@ -764,7 +1172,9 @@
                                     elem: '#wl-table'
                                     , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
                                     , cellMinWidth: 80
-                                    , toolbar: '#toolbarDemo'
+                                    //, toolbar: '#toolbarDemo'
+                                    , page: true
+                                    , limit: 100
                                     , defaultToolbar: []
                                     , where: { HBillID: sInterID, HBillType: '1207', sWhere: '' }
                                     , cols: [[
@@ -777,7 +1187,7 @@
                                         , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 100 }
                                         , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 100 }
                                         , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 100 }
-                                        , { field: 'HBatchNo', title: '鎵规', width: 100 }
+                                        //, { field: 'HBatchNo', title: '鎵规', width: 100 }
                                         , { field: 'HAuxPropID', title: '杈呭姪灞炴��', width: 100 }
                                         , { field: 'HMTONo', title: '璁″垝璺熻釜鍙�', width: 100 }
                                         , { field: 'HMaterID', title: '鐗╂枡ID', width: 100 }
@@ -797,8 +1207,33 @@
 
             //閫�鍑烘寜閽�
             form.on('submit(Cancel)', function () {
-                parent.location.href = "../../../views/index.html"
-                //window.close();//鍏抽棴褰撳墠椤�
+                var sInterID = $("#HInterID").val()
+                var HBillType = '1207'
+                $.ajax(
+                    {
+                        type: "Get",
+                        url: GetWEBURL() + "/WEBSController/set_DelPonderationBillMain_Temp_FIFO_Json",
+                        async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                        data: { "HInterID": sInterID, "HBillType": HBillType },
+                        dataType: "json",
+                        success: function (data) {
+                            if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜�
+                            }
+                            else {
+                                layer.msg(data.Message, { icon: 2 });
+                            }
+                        },
+                        error: function (err) {
+                            layer.msg('閿欒' + err, {
+                                icon: 5,
+                                time: 20000
+                            }, function () {
+                            });
+                        }
+                    });
+                layer.confirm('鎮ㄧ‘瀹氳閫�鍑哄悧锛�', { icon: 3, title: '鎻愮ず' }, function (index) {
+                    parent.location.href = "../../../views/index_Mobile.html";
+                });
             })
 
             //鎻愪氦
@@ -814,19 +1249,23 @@
                         {
                             type: "POST",
                             url: GetWEBURL() + "/MoveStockBill/set_SaveMoveStockBill_Json", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                            async: true,
+                            async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
                             data: { "oMain": sMainStr },
                             dataType: "json",
                             success: function (data) {
                                 if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜�
-                                    layer.confirm("鐢熸垚璋冩嫧鍗�" + data.Message + $("#HBillNo").val(), {
+                                    layer.confirm(data.Message, {
+                                    //layer.confirm("鐢熸垚璋冩嫧鍗�" + data.Message + $("#HBillNo").val(), {
                                         icon: 1, skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず", closeBtn: 0, btn: ['鏂板'],
                                         btn2: function () {
                                             //parent.layui.admin.events.closeThisTabs();鍏抽棴椤电
                                             //window.close();//鍏抽棴椤甸潰锛屾祻瑙堝櫒鏈夋晥锛孭DA鏃犳晥
                                             parent.location.href = "../../../views/index.html"
                                         }//鍏抽棴
-                                    }, function () { window.location.reload(); });//鏂板
+                                    }, function () {
+                                        //window.location.reload();
+                                        location.replace('Kf_MoveStockBill_Fast.html?OperationType=1&HInterID=0');
+                                    });//鏂板
                                 }
                                 else {
                                     layer.close(index);
@@ -852,286 +1291,485 @@
                 }
             });
 
+            //#region 鎵弿婧愬崟鏉$爜
+
+            //鎵簮鍗�
+            $('#HSourceBillNo').on('keydown', function (event) {      //鎵簮鍗�
+                if (event.keyCode == 13) {
+                    GetMeesageBySourceBillNo();
+                }
+            });
+
+            //纭畾
+            form.on('submit(QueDin2)', function (data) {
+                GetMeesageBySourceBillNo();
+            });
+
+            //鎵弿婧愬崟鏉$爜
+            function GetMeesageBySourceBillNo(obj) {
+                var sInterID = $("#HInterID").val()
+                var sBillNo = $("#HBillNo").val()
+                var HBillType = '1207'
+                var HSourceBillNo = $('#HSourceBillNo').val()
+                var HSourceBillType = $("#HBillType").val()
+                var HMaker = sessionStorage["HUserName"]
+                var HFIFOWhID = $("#HFIFOWHID").val()
+                var HStockOutOrgID = $("#HStockOutOrgID").val()//璋冨嚭缁勭粐
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + "/WEBSController/get_SourceBarCode_MoveStock_Json",
+                    async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                    data: { "HInterID": sInterID, "HBillNo": sBillNo, "HBillType": HBillType, "HSourceBillNo": HSourceBillNo, "HSourceBillType": HSourceBillType, "HMaker": HMaker, "HFIFOWhID": HFIFOWhID, "HOWNERID": HStockOutOrgID },
+                    success: function (result) {
+                        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            playSound1();
+                            HSourceFlag = true;
+                            if (result.data.hDeptIDField != 0) {
+                                $("#HDeptID").val(result.data.hDeptIDField);
+                                $("#HDeptName").val(result.data.hDeptNameField);
+                            }
+                            if (result.data.hWhIDField != 0) {
+                                $("#HWHID").val(result.data.hWhIDField);
+                                $("#HWHNAME").val(result.data.hWhNameField);
+                            }
+                            if (result.data.hSCWhIDField != 0) {
+                                $("#HSCWHID").val(result.data.hSCWhIDField);
+                                $("#HSCWHNAME").val(result.data.hSCWhNameField);
+                            }
+
+                            $("#HStockStyle").find("option:contains('" + result.data.hStockStyleField +"')").attr("selected", true);
+                            $("#HStockInOrgID").val(result.data.hStockInOrgIDField);
+                            $("#HStockInOrgName").val(result.data.hStockInOrgNameField);
+                            $("#HStockOutOrgID").val(result.data.hStockOutOrgIDField);
+                            $("#HStockOutOrgName").val(result.data.hStockOutOrgNameField);
+                            $("#HSourceBillNo").val(result.data.hSourceBillNoField);
+
+                            $("#HStockStyle").attr("disabled", "disabled");
+                            $("#HStockInOrgName").attr("readonly", "readonly");
+                            $("#HStockOutOrgName").attr("readonly", "readonly");
+                            $("#HBillType").attr("disabled", "disabled");
+                            form.render('select');
+                            if (result.data.hMulSourceFlagField == 0) {
+                                $("#HSourceBillNo").attr("readonly", "readonly");
+                            }
+                            layer.load(3);
+
+                            if (HSourceBillType == 1402 || HSourceBillType == 1214 || HSourceBillType == 1242) { //鍙戣揣閫氱煡鍗晐|鐢熶骇鍙戞枡閫氱煡鍗�
+                                element.tabChange('tab-MoveStockBill', '2');
+                                //鎵簮鍗曟垚鍔熷悗锛屽厜鏍囨樉绀哄埌璋冨嚭浠撳簱涓�
+                                $("#HSCWHNAME").focus();
+                            } 
+
+                            //鏄剧ず琛ㄤ綋鏄庣粏
+                            DisBillEntryList();
+
+                            //$.ajax({
+                            //    url: GetWEBURL() + '/WEBSController/GetBillEntryTmpList_Json',
+                            //    type: "GET",
+                            //    data: { "HInterID": sInterID, "HBillNo": sBillNo, "HBillType": HBillType, "HStockOrgID": HStockOutOrgID },
+                            //    success: function (result) {
+                            //        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            //            listOption.data = result.data.Materlist;
+                            //            table.render(listOption);
+                            //            FIFOlistOption.data = result.data.FIFOlist;
+                            //            table.render(FIFOlistOption);
+
+                            //            //console.log(result.data.list2);
+                            //            var count = 0;
+                            //            var count1 = 0;
+                            //            for (var i = 0; i < result.data.Materlist.length; i++) {
+                            //                count += result.data.Materlist[i].HQty;
+                            //                count1 += result.data.Materlist[i].HPieceQty;
+                            //            }
+                            //            $("#HSumQtys").val(count);
+                            //            $("#HBarCodeQtys").val(count1);
+                            //            //return;
+                            //        }
+                            //        else {
+                            //            layer.msg(result.Message);
+                            //        }
+                            //        layer.closeAll("loading");
+                            //    }
+                            //});
+                        }
+                        else {
+                            playSound();
+                            layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        }
+                        layer.closeAll("loading");
+                    }
+                });
+            }
+
+            //#endregion
+
+
+            //#region 鎵弿鐗╂枡鏉$爜
 
             //鎵潯鐮�
-            $('#HBarCode').on('keydown', function (event) {  //鎵潯鐮�
+            $('#HBarCode').on('keydown', function (event) {
+                var sQty = $("#HQty").val();
+                if (event.keyCode == 13) {
+                    GetMeesageByBarCode();
+                }
+            });
+
+            //纭畾
+            form.on('submit(QueDin)', function (data) {
+                GetMeesageByBarCode();
+            });
+
+            //鎵潯鐮�
+            function GetMeesageByBarCode(obj) {  //杩斿洖宸ヤ綔涓績
                 var sOldBarCode = $('#HBarCode').val()
                 var HDeleteFlag = sOldBarCode.substring(0, 1);
                 var sBarCode = sOldBarCode.slice(1);
 
-                var sSubStr = table.cache['wl-table'];
-                //var sBarCode = $('#HBarCode').val()
                 var sInterID = $("#HInterID").val()
+                var HBillType = '1207';
                 var sBillNo = $("#HBillNo").val()
+                var sMaker = $("#HMaker").val();//鍒跺崟浜�
+                var WhID = $("#HWHID").val()//璋冨叆浠撳簱
+                var SPID = $("#HStockPlaceID").val()//璋冨叆浠撲綅
+                var HSCWhID = $("#HSCWHID").val()//璋冨嚭浠撳簱
+                var HSCSPID = $("#HOutStockPlaceID").val()//璋冨嚭浠撲綅
                 var sQty = $("#HQty").val()
-                var sHBillType = $("#HBillType").val()
-                var SCWhID = $("#HSCWHID").val()//璋冨嚭浠撳簱
-                var HSPID = $("#HStockPlaceID").val()//璋冨叆浠撲綅
-                var HWHID = $("#HWHID").val()//璋冨叆浠撳簱
-                var SCSPID = $("#HOutStockPlaceID").val()//璋冨嚭浠撲綅
-                var HMaker = $("#HMaker").val();//鍒跺崟浜�
-                var HOrgID = $("#HOrgID").val();//缁勭粐
-                var sBillType = '1207';
-                var sSourceBillNo = $("#HSourceBillNo").val();//婧愬崟鍙�
-
-                if (sSourceBillNo == null)
-                {
-                    sSourceBillNo = "";
-                }
-
                 if (sQty == "") {
                     sQty = 0;
                 }
-                if (event.keyCode == 13) {
-                    if (HDeleteFlag == "*") {
-                        if (sBarCode != "") {
-                            $('#HBarCode').val("");
-                        }
-                        $.ajax(
-                            {
-                                type: "Get",
-                                url: GetWEBURL() + "/ProductIn/Delete_Json",
-                                async: true,
-                                data: { "HInterID": sInterID, "HBillNo": sBillNo, "HBillType": sBillType, "HBarCode": sBarCode },
-                                dataType: "json",
-                                success: function (data) {
-                                    if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜�
-                                        table.render({
-                                            elem: '#wl-table'
-                                            , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
-                                            , toolbar: '#toolbarDemo'
-                                            , defaultToolbar: []
-                                            , where: { HBillID: sInterID, HBillType: '1207', sWhere: '' }
-                                            , cols: [[
-                                                { type: 'radio' }
-                                                , { field: 'HQty', title: '鏁伴噺', width: 150 }
-                                                , { field: 'HQtyMust', title: '搴旀敹鏁伴噺', width: 150 }
-                                                , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 150 }
-                                                , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 150 }
-                                                , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 150 }
-                                                , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150 }
-                                                , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150 }
-                                                , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 150 }
-                                                , { field: 'HBatchNo', title: '鎵规', width: 150 }
-                                                , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 70 }
-                                            ]]
-                                            // , data: [linterid]
-                                            // , page: true
-                                            , height: 500
-                                            , done: function () {
-                                                layer.closeAll("loading");
-                                            }
-                                        })
-                                    }
-                                    else {
-                                        layer.msg(data.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                                    }
-                                },
-                                error: function (err) {
-                                    layer.msg('閿欒' + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                                }
-                            });
+                var sSourceBillNo = $("#HSourceBillNo").val();//婧愬崟鍙�
+                if (sSourceBillNo == null) {
+                    sSourceBillNo = "";
+                }
+                var sHBillType = $("#HBillType").val()
+                var HStockInOrgID = $("#HStockInOrgID").val()//璋冨叆缁勭粐
+                var HStockOutOrgID = $("#HStockOutOrgID").val()//璋冨嚭缁勭粐
+                var HScanStyle = "";
+
+                //鍒ゆ柇鏉$爜鏄惁涓虹┖  new
+                if (sBarCode == '') {
+                    playSound();
+                    layer.msg("鏉$爜涓虹┖锛屼笉鑳芥壂鎻忥紒", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    return false;
+                }
+
+                if (HDeleteFlag == "*") {
+                    if (sBarCode != "") {
+                        $('#HBarCode').val("");
                     }
-                    else {
-                        var sBarCode = $('#HBarCode').val()
-                        if (sBarCode != "") {
-                            $('#HBarCode').val("");
-                        }
-                        if (sQty != "") {
-                            $('#HQty').val("");
-                        }
-                        if ($("#HWHNAME").val() == '') {
-                            playSound();
-                            layer.msg("璋冨叆浠撳簱娌℃湁閫夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                            return false;
-                        }
-                        //if ($("#HWHID").val() == $("#HSCWHID").val() && $("#HStockPlaceID").val() == $("#HOutStockPlaceID").val()) {
-                        //    layer.msg("璋冨叆浠撳簱銆佷粨浣嶄笉鑳藉拰璋冨嚭浠撳簱銆佷粨浣嶉兘鐩稿悓!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                        //    return false;
-                        //}
-                        //if ($("#HSCWHNAME").val() == '') {
-                        //    layer.msg("璋冨嚭浠撳簱娌℃湁閫夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                        //    return false;
-                        //}
-                        if ($("#HBillNo").val() == '') {
-                            playSound();
-                            layer.msg("閿欒鐨勫崟鎹彿!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                            return false;
-                        }
-                        if ($("#HInterID").val() == '') {
-                            playSound();
-                            layer.msg("閿欒鐨勫唴鐮�!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                            return false;
-                        }
-                        $.ajax({
-                            url: GetWEBURL() + "/MoveStockBill/get_InfoByBarCode_Source_Json",
+                    $.ajax(
+                        {
                             type: "GET",
-                            data: { "sCode": sBarCode, "sInterID": sInterID, "sBillNo": sBillNo, "sQty": sQty, "HWHID": HWHID, "HSPID": HSPID, "SCWhID": SCWhID, "SCSPID": SCSPID, "HMaker": HMaker, "HOrgID": HOrgID, "HSourceBillNo": sSourceBillNo, "HSourceBillType":  sHBillType },
-                            success: function (result) {
-                                if (result.count == 1) {
-                                    element.tabChange('tab-MoveStockBill', '3');
-                                    //$("#HWHNAME").attr("readOnly", "true");//璋冨叆浠撳簱涓嶅彲鍙�
-                                    //$("#HWHID-BT").attr("disabled", "true");
-                                    //$("#HStockPlaceName").attr("readOnly", "true");//璋冨叆浠撲綅涓嶅彲鍙�
-                                    //$("#HSpID-BT").attr("disabled", "true");
-                                    //$("#HSCWHNAME").attr("readOnly", "true");//璋冨嚭浠撳簱涓嶅彲鍙�
-                                    //$("#HSCWHID-BT").attr("disabled", "true");
-                                    //$("#HOutStockPlaceName").attr("readOnly", "true");//璋冨叆浠撲綅涓嶅彲鍙�
-                                    //$("#HOSpID-BT").attr("disabled", "true");
-                                    layer.load(3)
-                                    table.render({
-                                        elem: '#wl-table'
-                                        , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
-                                        , toolbar: '#toolbarDemo'
-                                        , defaultToolbar: []
-                                        , totalRow: true
-                                        , where: { HBillID: sInterID, HBillType: '1207', sWhere: '' }
-                                        , cols: [[
-                                            { type: 'radio', totalRowText: '鍚堣' }
-                                            , { field: 'HQty', title: '鏁伴噺', width: 150, totalRow: true }
-                                            , { field: '浠舵暟', title: '浠舵暟', width: 150, totalRow: true }
-                                            , { field: 'HQtyMust', title: '搴旀敹鏁伴噺', width: 150 }
-                                            , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 150 }
-                                            , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 150 }
-                                            , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 150 }
-                                            , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150 }
-                                            , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150 }
-                                            , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 150 }
-                                            , { field: 'HBatchNo', title: '鎵规', width: 150 }
-                                            , { field: 'HMaterID', title: '鐗╂枡鍐呯爜', width: 150, hide: true }
-                                            , { field: 'HAuxPropID', title: '', width: 150, hide: true }
-                                            , { field: 'HMTONo', title: '璁″垝璺熻釜鍙�', width: 150, hide: true }
-                                            , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 70 }
-                                        ]]
-                                        // , data: [linterid]
-                                        // , page: true
-                                        //, height: 500
-                                        , done: function () {
-                                            layer.closeAll("loading");
-                                        }
-                                    });
+                            url: GetWEBURL() + "/ProductIn/Delete_Json",
+                            async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                            data: { "HInterID": sInterID, "HBillNo": sBillNo, "HBillType": '1207', "HBarCode": sBarCode },
+                            dataType: "json",
+                            success: function (data) {
+                                if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜�
+                                    //鏄剧ず琛ㄤ綋鏄庣粏
+                                    DisBillEntryList();
+
+                                    //$.ajax({
+                                    //    url: GetWEBURL() + '/WEBSController/GetBillEntryTmpList_Json',
+                                    //    type: "GET",
+                                    //    data: { "HInterID": sInterID, "HBillNo": sBillNo, "HBillType": HBillType, "HStockOrgID": HStockOutOrgID },
+                                    //    success: function (result) {
+                                    //        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                    //            listOption.data = result.data.Materlist;
+                                    //            table.render(listOption);
+                                    //            FIFOlistOption.data = result.data.FIFOlist;
+                                    //            table.render(FIFOlistOption);
+
+                                    //            //console.log(result.data.list2);
+                                    //            var count = 0;
+                                    //            var count1 = 0;
+                                    //            for (var i = 0; i < result.data.Materlist.length; i++) {
+                                    //                count += result.data.Materlist[i].HQty;
+                                    //                count1 += result.data.Materlist[i].HPieceQty;
+                                    //            }
+                                    //            $("#HSumQtys").val(count);
+                                    //            $("#HBarCodeQtys").val(count1);
+                                    //            //return;
+                                    //        }
+                                    //        else {
+                                    //            layer.msg(result.Message);
+                                    //        }
+                                    //        layer.closeAll("loading");
+                                    //    }
+                                    //});
                                     playSound1();
-                                    var sSubStr = table.cache['wl-table'];
+                                    //娓呯┖鏁伴噺
+                                    $("#HQty").val("");
                                 }
                                 else {
                                     playSound();
-                                    layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                                    layer.msg(data.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                                 }
-                                layer.closeAll("loading");
+                            },
+                            error: function (err) {
+                                playSound();
+                                layer.msg('閿欒' + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                             }
-                            //,
-                            //error: function (XMLHttpRequest, textStatus, errorThrown) {
-                            //    alert("璇锋眰瀵硅薄XMLHttpRequest: " + XMLHttpRequest);
-                            //    alert("閿欒绫诲瀷textStatus: " + textStatus);
-                            //    alert("寮傚父瀵硅薄errorThrown: " + errorThrown);
-                            //}
                         });
+                }
+                else {
+                    if ($("#HBillNo").val() == '') {
+                        playSound();
+                        layer.msg("閿欒鐨勫崟鎹彿!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        return false;
                     }
-                }
-            });
-
-
-            function playSound() {
-                console.log("playSound");
-                //var audio = document.getElementById("cs");
-                //$("appendAut").html("");
-                //if (audio == null)
-                //$("appendAut").append('<audio id="cs" hidden controls> <source src = "../../video/jingbao.wav" type = "audio/ogg"> </audio >');
-                //$("appendAut").attr("src","../../video/jingbao.wav")
-                var audio = document.getElementById("cs");
-                audio.play();
-            }
-
-            function playSound1() {
-                console.log("playSound1");
-                //var audio = document.getElementById("cs");
-                //$("appendAut").html("");
-                //if (audio == null)
-                //$("appendAut").append('<audio id="cs" hidden controls> <source src = "../../video/success.wav" type = "audio/ogg"> </audio >');
-                //$("appendAut").attr("src", "../../video/success.wav")
-                var audio = document.getElementById("cs2");
-                audio.play();
-            }
-
-            //鎵簮鍗�
-            $('#HSourceBillNo').on('keydown', function (event) {      //鎵簮鍗�
-                var HSourceBillNo = $('#HSourceBillNo').val()
-                var sInterID = $("#HInterID").val()
-                var sBillNo = $("#HBillNo").val()
-                var HSourceBillType = $("#HBillType").val()
-                if (HSourceBillType == '1243')
-                {
-                    
-                }
-                if (event.keyCode == 13) {
+                    if ($("#HInterID").val() == '') {
+                        playSound();
+                        layer.msg("閿欒鐨勫唴鐮�!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                        return false;
+                    }
+                    var sBarCode = $('#HBarCode').val()
+                    if (sBarCode != "") {
+                        $('#HBarCode').val("");
+                    }
+                    if (sQty != "") {
+                        $('#HQty').val("");
+                    }
                     $.ajax({
-                        url: GetWEBURL() + "/MoveStockBill/set_SavePonderationBillMain_Temp_Source_Fast_Json",
                         type: "GET",
-                        data: { "HSourceBillType": HSourceBillType, "HSourceBillNo": HSourceBillNo, "sInterID": sInterID, "sBillNo": sBillNo },
+                        url: GetWEBURL() + "/WEBSController/get_BarCode_MoveStock_Json",
+                        async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                        data: { "sBarCode": sBarCode, "HInterID": sInterID, "HBillType": HBillType, "HBillNo": sBillNo, "HMaker": sMaker, "HWhID": WhID, "HSPID": SPID, "HSCWHID": HSCWhID, "HSCSPID": HSCSPID, "HQty": sQty, "SourceFlag": HSourceFlag, "HSourceBillNo": sSourceBillNo, "HSourceBillType": sHBillType, "HStockInOrgID": HStockInOrgID, "HStockOutOrgID": HStockOutOrgID, "HScanStyle": HScanStyle },
                         success: function (result) {
-                            if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            if (result.count == 1) {
+                                if (result.data.hBarTypeField == '浠撳簱鏉$爜') {
+                                    $("#HSCWHNAME").val(result.data.hWhNameField);
+                                    $("#HSCWHID").val(result.data.hWhIDField);
+                                    $("#HOutStockPlaceName").val("");
+                                    $("#HNote").val(";涓�閿壂鐮佷粨搴撴潯鐮�");
+                                    element.tabChange('tab-MoveStockBill', '2');  //璺宠浆椤电
+                                    return;
+                                }
+                                else if (result.data.hBarTypeField == '浠撲綅鏉$爜') {
+                                    $("#HOutStockPlaceName").val(result.data.hSPNameField);
+                                    $("#HOutStockPlaceID").val(result.data.hSPIDField);
+                                    $("#HSCWHNAME").val(result.data.hWhNameField);
+                                    $("#HSCWHID").val(result.data.hWhIDField);
+                                    $("#HNote").val(";涓�閿壂鐮佷粨浣嶆潯鐮�");
+                                    element.tabChange('tab-MoveStockBill', '2');//璺宠浆椤电
+                                    return;
+                                }
+                                else if (result.data.hBarTypeField == '閮ㄩ棬鏉$爜') {
+                                    $("#HDeptName").val(result.data.hDeptNameField);
+                                    $("#HDeptID").val(result.data.hDeptIDField);
+                                    $("#HNote").val(";涓�閿壂鐮侀儴闂ㄦ潯鐮�");
+                                    element.tabChange('tab-MoveStockBill', '2');//璺宠浆椤电
+                                    return;
+                                }
+                                else if (result.data.hBarTypeField == '婧愬崟鏉$爜') {
+                                    if (result.data.hDeptIDField != 0) {
+                                        $("#HDeptID").val(result.data.hDeptIDField);
+                                        $("#HDeptName").val(result.data.hDeptNameField);
+                                    }
+                                    if (result.data.hWhIDField != 0) {
+                                        $("#HWHID").val(result.data.hWhIDField);
+                                        $("#HWHNAME").val(result.data.hWhNameField);
+                                    }
+                                    if (result.data.hSCWhIDField != 0) {
+                                        $("#HSCWHID").val(result.data.hSCWhIDField);
+                                        $("#HSCWHNAME").val(result.data.hSCWhNameField);
+                                    }
 
-                                if (result.data[0].HSourceBillType == '1243')
-                                {
-                                    $("#HStockStyle").val(result.data[0].HStockStyle);
-                                    $("#HStockInOrgID").val(result.data[0].HSTOCKINORGID);
-                                    $("#HStockInOrgName").val(result.data[0].HSTOCKINORGName);
-                                    $("#HStockOutOrgID").val(result.data[0].HSTOCKOUTORGID);
-                                    $("#HStockOutOrgName").val(result.data[0].HSTOCKOUTORGName);
+                                    $("#HStockStyle").find("option:contains('" + result.data.hStockStyleField + "')").attr("selected", true);
+                                    $("#HStockInOrgID").val(result.data.hStockInOrgIDField);
+                                    $("#HStockInOrgName").val(result.data.hStockInOrgNameField);
+                                    $("#HStockOutOrgID").val(result.data.hStockOutOrgIDField);
+                                    $("#HStockOutOrgName").val(result.data.hStockOutOrgNameField);
+                                    $("#HSourceBillNo").val(result.data.hSourceBillNoField);
+                                    HSourceFlag = true;
+                                    //鑾峰彇婧愬崟绫诲瀷銆佹簮鍗曞崟鍙�
+                                    $("#HBillType").val(result.data.hSourceBillTypeField == null ? "1402" : result.data.hSourceBillTypeField);
+                                    if (result.data.hSourceBillTypeField == "1402") {
+                                        $("#HBillType").empty();
+                                        $("#HBillType").val("1402");
+                                        var optionHtml = '';
+                                        optionHtml += "<option value = '" + result.data.hSourceBillTypeField + "' >" + '鍙戣揣閫氱煡鍗�' + "</option>";
+                                        $("#HBillType").append(optionHtml);
+                                        layui.form.render('select');
+                                        $("#HBillType").attr("readonly", "readonly");
+                                    }
+                                    else if (result.data.hSourceBillTypeField == "1243") {
+                                        $("#HBillType").empty();
+                                        $("#HBillType").val("1243");
+                                        var optionHtml = '';
+                                        optionHtml += "<option value = '" + result.data.hSourceBillTypeField + "' >" + '璋冩嫧鐢宠鍗�' + "</option>";
+                                        $("#HBillType").append(optionHtml);
+                                        layui.form.render('select');
+                                        $("#HBillType").attr("readonly", "readonly");
+                                    }
+                                    else if (result.data.hSourceBillTypeField == "3720") {
+                                        $("#HBillType").empty();
+                                        $("#HBillType").val("3720");
+                                        var optionHtml = '';
+                                        optionHtml += "<option value = '" + result.data.hSourceBillTypeField + "' >" + '鐢熶骇鐢ㄦ枡娓呭崟' + "</option>";
+                                        $("#HBillType").append(optionHtml);
+                                        layui.form.render('select');
+                                        $("#HBillType").attr("readonly", "readonly");
+                                    }
+                                    else if (result.data.hSourceBillTypeField == "1604") {
+                                        $("#HBillType").empty();
+                                        $("#HBillType").val("1604");
+                                        var optionHtml = '';
+                                        optionHtml += "<option value = '" + result.data.hSourceBillTypeField + "' >" + '濮斿鐢ㄦ枡娓呭崟' + "</option>";
+                                        $("#HBillType").append(optionHtml);
+                                        layui.form.render('select');
+                                        $("#HBillType").attr("readonly", "readonly");
+                                    }
+                                    else if (result.data.hSourceBillTypeField == "1242") {
+                                        $("#HBillType").empty();
+                                        $("#HBillType").val("1242");
+                                        var optionHtml = '';
+                                        optionHtml += "<option value = '" + result.data.hSourceBillTypeField + "' >" + '鍑哄簱鐢宠鍗�' + "</option>";
+                                        $("#HBillType").append(optionHtml);
+                                        layui.form.render('select');
+                                        $("#HBillType").attr("readonly", "readonly");
+                                    }
+                                    else if (result.data.hSourceBillTypeField == "1214") {
+                                        $("#HBillType").empty();
+                                        $("#HBillType").val("1214");
+                                        var optionHtml = '';
+                                        optionHtml += "<option value = '" + result.data.hSourceBillTypeField + "' >" + '鐢熶骇鍙戞枡閫氱煡鍗�' + "</option>";
+                                        $("#HBillType").append(optionHtml);
+                                        layui.form.render('select');
+                                        $("#HBillType").attr("readonly", "readonly");
+                                    }
+                                    else {
+                                        //$("#HBillType").empty();
+                                        $("#HBillType").val("-1");
+                                        var optionHtml = '';
+                                        optionHtml += "<option value = '" + result.data.hSourceBillTypeField + "' >" + '鎵嬪伐褰曞叆' + "</option>";
+                                        $("#HBillType").append(optionHtml);
+                                        layui.form.render('select');
+                                        $("#HBillType").attr("readonly", "readonly");
+                                    }
+
+                                    $("#HStockStyle").attr("disabled", "disabled");
+                                    $("#HStockInOrgName").attr("readonly", "readonly");
+                                    $("#HStockOutOrgName").attr("readonly", "readonly");
+                                    $("#HBillType").attr("disabled", "disabled");
+                                    form.render('select');
+                                    if (result.data.hMulSourceFlagField == 0) {
+                                        $("#HSourceBillNo").attr("readonly", "readonly");
+                                    }
+                                    $("#HNote").val(";涓�閿壂鐮佹簮鍗曟潯鐮�");
+                                    element.tabChange('tab-MoveStockBill', '3');
+                                }
+                                else {
+                                    if (HSourceFlag == "false") {
+                                        $("#HBillType").find("option:contains('鎵嬪伐褰曞叆')").attr("selected", true);
+                                        $("#HSourceBillNo").val("");
+
+                                        $("#HStockStyle").attr("disabled", "disabled");
+                                        $("#HStockInOrgName").attr("readonly", "readonly");
+                                        $("#HStockOutOrgName").attr("readonly", "readonly");
+                                        $("#HBillType").attr("disabled", "disabled");
+                                        $("#HSourceBillNo").attr("readonly", "readonly");
+                                        form.render('select');
+                                    }
+                                    HSourceFlag = true;
+                                    element.tabChange('tab-MoveStockBill', '3');
                                 }
 
-                                $("#HDeptID").val(result.data[0].HDeptID);
-                                $("#HDeptName").val(result.data[0].HDeptName);
-                                
+                                layer.load(3)
 
-                                $("#HWHID").val(result.data[0].HWhID);
-                                $("#HWHNAME").val(result.data[0].HWhName);
+                                //鏄剧ず琛ㄤ綋鏄庣粏
+                                DisBillEntryList();
 
-                                //if (!DBUtility.ClsPub.ObjToBool(DS.Tables[0].Rows[0]["HIsStockMgr"])) {
-                                //    $("#HStockPlaceName").Enabled = false;
-                                //    $("#HStockPlaceID").Enabled = false;
-                                //}
-                                //else {
-                                //    $("#HStockPlaceName").Enabled = true;
-                                //    $("#HStockPlaceID").Enabled = true;
-                                //}
-                                layer.load(3);
-                                element.tabChange('tab-MoveStockBill', '2');
-                                table.render({
-                                    elem: '#wl-table'
-                                    , url: GetWEBURL() + '/MoveStockBill/DisBillEntryList_Webs_Json'
-                                    , toolbar: '#toolbarDemo'
-                                    , defaultToolbar: []
-                                    , where: { HBillID: sInterID, HBillType: '1207', sWhere: '' }
-                                    , cols: [[
-                                        { type: 'radio' }
-                                        , { field: 'HQty', title: '鏁伴噺', width: 150 }
-                                        , { field: 'HQtyMust', title: '搴旀敹鏁伴噺', width: 150 }
-                                        , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 150 }
-                                        , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 150 }
-                                        , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 150 }
-                                        , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150 }
-                                        , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150 }
-                                        , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 150 }
-                                        , { field: 'HBatchNo', title: '鎵规', width: 150 }
-                                        , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 70 }
-                                    ]]
-                                    // , data: [linterid]
-                                    // , page: true
-                                    , height: 500
-                                    , done: function () {
-                                        layer.closeAll("loading");
-                                    }
-                                });
+                                //$.ajax({
+                                //    url: GetWEBURL() + '/WEBSController/GetBillEntryTmpList_Json',
+                                //    type: "GET",
+                                //    data: { "HInterID": sInterID, "HBillNo": sBillNo, "HBillType": HBillType, "HStockOrgID": HStockOutOrgID },
+                                //    success: function (result) {
+                                //        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                //            listOption.data = result.data.Materlist;
+                                //            table.render(listOption);
+                                //            FIFOlistOption.data = result.data.FIFOlist;
+                                //            table.render(FIFOlistOption);
+
+                                //            //console.log(result.data.list2);
+                                //            var count = 0;
+                                //            var count1 = 0;
+                                //            for (var i = 0; i < result.data.Materlist.length; i++) {
+                                //                count += result.data.Materlist[i].HQty;
+                                //                count1 += result.data.Materlist[i].HPieceQty;
+                                //            }
+                                //            $("#HSumQtys").val(count);
+                                //            $("#HBarCodeQtys").val(count1);
+                                //            //return;
+                                //        }
+                                //        else {
+                                //            layer.msg(result.Message);
+                                //        }
+                                //        layer.closeAll("loading");
+                                //    }
+                                //});
+                                playSound1();
+                                //娓呯┖鏁伴噺
+                                $("#HQty").val("");
                             }
                             else {
+                                playSound();
                                 layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                             }
                             layer.closeAll("loading");
                         }
                     });
                 }
-            });
+            }
+
+            //#endregion
+
+
+            //#region 鏄剧ず鐗╂枡鍒楄〃淇℃伅
+
+            function DisBillEntryList() {
+                var sInterID = $("#HInterID").val()
+                var sBillNo = $("#HBillNo").val()
+                var HBillType = '1207'
+                var HStockOutOrgID = $("#HStockOutOrgID").val()//璋冨嚭缁勭粐
+
+                //鍒锋柊鍒楄〃淇℃伅
+                $.ajax({
+                    type: "GET",
+                    url: GetWEBURL() + '/WEBSController/GetBillEntryTmpList_Json',
+                    async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                    data: { "HInterID": sInterID, "HBillNo": sBillNo, "HBillType": HBillType, "HStockOrgID": HStockOutOrgID },
+                    success: function (result) {
+                        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                            listOption.data = result.data.Materlist;
+                            table.render(listOption);
+                            FIFOlistOption.data = result.data.FIFOlist;
+                            table.render(FIFOlistOption);
+
+                            //console.log(result.data.list2);
+                            var count = 0;
+                            var count1 = 0;
+                            for (var i = 0; i < result.data.Materlist.length; i++) {
+                                count += result.data.Materlist[i].HQty;
+                                count1 += result.data.Materlist[i].HPieceQty;
+                            }
+                            $("#HSumQtys").val(count);
+                            $("#HBarcodeQtys").val(count1);
+                            //return;
+                        }
+                        else {
+                            layer.msg(result.Message);
+                        }
+                        layer.closeAll("loading");
+                    }
+                });
+            }
+
+            //#endregion
+
+
+            
+
 
             $('#HStockPlaceName').on('keydown', function (event) {      //鎵粨浣�
                 var HBarCode = $('#HStockPlaceName').val()
@@ -1183,15 +1821,201 @@
                 }
             });
 
+            //鎵皟鍏ヤ粨搴�
+            $('#HWHNAME').on('keydown', function (event) {
+                var HBarCode = $('#HWHNAME').val()
+                if (event.keyCode == 13) {
+                    if (!HBarCode) {
+                        layer.msg('鏃犱粨搴撴潯鐮佷俊鎭紒');
+                        return;
+                    }
+                    //鍒ゆ柇鏂囨湰妗嗘槸鍚︽湁鏁版嵁    new
+                    $.ajax({
+                        url: GetWEBURL() + "/LookingFor/getWHName_Json",
+                        type: "GET",
+                        data: { "HBarCode": HBarCode },
+                        success: function (result) {
+                            if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                //$("#HStockPlaceName").val(result.data[0].HName);
+                                //$("#HStockPlaceID").val(result.data[0].HItemID);
+                                $("#HWHID").val(result.data[0].HItemID);
+                                $("#HWHNAME").val(result.data[0].HName);
+                                //element.tabChange('tab-POStockInBill', '2');
+                                //鎵皟鍏ヤ粨搴撴垚鍔熷悗锛屽厜鏍囨樉绀哄埌鏉$爜涓�
+                                $("#HBarCode").focus();
+                                if (HSourceBillType == 1402 || HSourceBillType == 1214) { //鍙戣揣閫氱煡鍗晐|鐢熶骇鍙戞枡閫氱煡鍗�
+                                    element.tabChange('tab-MoveStockBill', '2');
+                                    //鎵皟鍏ヤ粨搴撴垚鍔熷悗锛屽厜鏍囨樉绀哄埌鏉$爜涓�
+                                    $("#HBarCode").focus();
+                                } 
+                            }
+                            else {
+                                // $("#verifycode").click();
+                                //layer.msg(result.Message, { icon: 5 });
+                                layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                            }
+                            layer.closeAll("loading");
+                        }
+                    });
+                    // layer.msg($('#HSourceBillNo').val(), { icon: 1 });
+                }
+            });            
+
+            //鎵皟鍑轰粨搴�
+            $('#HSCWHNAME').on('keydown', function (event) {
+                var HBarCode = $('#HSCWHNAME').val()
+                if (event.keyCode == 13) {
+                    if (!HBarCode) {
+                        layer.msg('鏃犱粨搴撴潯鐮佷俊鎭紒');
+                        return;
+                    }
+                    //鍒ゆ柇鏂囨湰妗嗘槸鍚︽湁鏁版嵁    new
+                    $.ajax({
+                        url: GetWEBURL() + "/LookingFor/getWHName_Json",
+                        type: "GET",
+                        data: { "HBarCode": HBarCode },
+                        success: function (result) {
+                            if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                //$("#HStockPlaceName").val(result.data[0].HName);
+                                //$("#HStockPlaceID").val(result.data[0].HItemID);
+                                $("#HSCWHID").val(result.data[0].HItemID);
+                                $("#HSCWHNAME").val(result.data[0].HName);
+                                //element.tabChange('tab-POStockInBill', '2');
+                                //鎵皟鍑轰粨搴撴垚鍔熷悗锛屽厜鏍囨樉绀哄埌璋冨叆浠撳簱涓�
+                                $("#HWHNAME").focus();
+                                if (HSourceBillType == 1402 || HSourceBillType == 1214) { //鍙戣揣閫氱煡鍗晐|鐢熶骇鍙戞枡閫氱煡鍗�
+                                    element.tabChange('tab-MoveStockBill', '2');
+                                    //鎵皟鍑轰粨搴撴垚鍔熷悗锛屽厜鏍囨樉绀哄埌璋冨叆浠撳簱涓�
+                                    $("#HWHNAME").focus();
+                                }                                
+                            }
+                            else {
+                                // $("#verifycode").click();
+                                //layer.msg(result.Message, { icon: 5 });
+                                layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                            }
+                            layer.closeAll("loading");
+                        }
+                    });
+                    // layer.msg($('#HSourceBillNo').val(), { icon: 1 });
+                }
+            });
+
+            //鎵弿鍏堣繘鍏堝嚭浠撳簱
+            $('#HFIFOWHNAME').on('keydown', function (event) {
+                var HBarCode = $('#HFIFOWHNAME').val()
+                if (event.keyCode == 13) {
+                    //鍒ゆ柇鏂囨湰妗嗘槸鍚︽湁鏁版嵁    new
+                    $.ajax({
+                        type: "GET",
+                        url: GetWEBURL() + "/LookingFor/getWHName_Json",
+                        async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                        data: { "HBarCode": HBarCode },
+                        success: function (result) {
+                            if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                $("#HFIFOWHID").val(result.data[0].HItemID);
+                                $("#HFIFOWHNAME").val(result.data[0].HName);
+                                element.tabChange('tab-MateOutBill', '1');
+                                //鍏夋爣鏄剧ず鍒版潯鐮佷笂
+                                $("#HBarCode").focus();
+                            }
+                            else {
+                                layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                            }
+                            layer.closeAll("loading");
+                        }
+                    });
+                }
+            });
+
+            //#region 鍒犻櫎鍔熻兘鎺т欢
+            form.on('submit(cmdDelete)', function () {//鍒犻櫎
+                var checkStatus = table.checkStatus('wl-table')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1) {
+                    layer.confirm("纭瑕佸垹闄ゅ悧锛屽垹闄ゅ悗灏嗕笉鍙仮澶嶏紒", { title: "鍒犻櫎纭" }, function (index) {
+                        var sInterID = $("#HInterID").val()
+                        var sBillNo = $("#HBillNo").val()
+                        var sMaterID = data[0].HMaterID
+                        var sAuxPropID = data[0].HAuxPropID
+                        var sMTONo = ''
+                        var sSourceInterID = data[0].HSourceInterID
+                        var sSourceEntryID = data[0].HSourceEntryID
+                        var HBillType = '1207';
+                        var HStockOutOrgID = $("#HStockOutOrgID").val()//璋冨嚭缁勭粐
+                        $.ajax(
+                            {
+                                type: "Get",
+                                url: GetWEBURL() + "/WEBSController/set_DelPonderationBillMain_Temp_InterIDAndSource_Json",
+                                async: false,    //async鐢ㄤ簬鎺у埗锛坒alse锛夊悓姝ュ拰锛坱rue锛夊紓姝ワ紝榛樿鐨勬槸true锛屽嵆璇锋眰榛樿鐨勬槸寮傛璇锋眰
+                                data: { "HInterID": sInterID, "HMaterID": sMaterID, "HAuxPropID": sAuxPropID, "HMTONo": sMTONo, "HSourceInterID": sSourceInterID, "HSourceEntryID": sSourceEntryID, "HBillType": HBillType },
+                                dataType: "json",
+                                success: function (data) {
+                                    if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                        //鏄剧ず琛ㄤ綋鏄庣粏
+                                        DisBillEntryList();
+
+                                        ////鏄剧ず琛ㄤ綋鏄庣粏
+                                        //$.ajax({
+                                        //    url: GetWEBURL() + '/WEBSController/GetBillEntryTmpList_Json',
+                                        //    type: "GET",
+                                        //    data: { "HInterID": sInterID, "HBillNo": sBillNo, "HBillType": HBillType, "HStockOrgID": HStockOutOrgID },
+                                        //    success: function (result) {
+                                        //        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                        //            listOption.data = result.data.Materlist;
+                                        //            table.render(listOption);
+                                        //            FIFOlistOption.data = result.data.FIFOlist;
+                                        //            table.render(FIFOlistOption);
+
+                                        //            //console.log(result.data.list2);
+                                        //            var count = 0;
+                                        //            var count1 = 0;
+                                        //            for (var i = 0; i < result.data.Materlist.length; i++) {
+                                        //                count += result.data.Materlist[i].HQty;
+                                        //                count1 += result.data.Materlist[i].HPieceQty;
+                                        //            }
+                                        //            $("#HSumQtys").val(count);
+                                        //            $("#HBarCodeQtys").val(count1);
+                                        //            //return;
+                                        //        }
+                                        //        else {
+                                        //            layer.msg(result.Message);
+                                        //        }
+                                        //        layer.closeAll("loading");
+                                        //    }
+                                        //});
+                                    }
+                                    else {
+                                        layer.msg(data.Message, { icon: 2 });
+                                    }
+                                },
+                                error: function (err) {
+                                    layer.msg('閿欒' + err, {
+                                        icon: 5,
+                                        time: 20000
+                                    }, function () {
+                                    });
+                                }
+                            });
+                        layer.close(index)
+                    })
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛岃褰曪紝杩涜鍒犻櫎锛�');
+                }
+            });
+            //#endregion
+
             table.render({
                 elem: '#mx-table'
                 // , url: GetWEBURL() + '/MoveStockBill/GetHBarCodeShowBillSub'
                 //, toolbar: '#toolbarDemo'
-                // , where: { sMsg: linterid, sMsg2: lentryid }
+                // , where: { sMsg: HInterID_Temp, sMsg2: lentryid }
                 , cols: [[
                     , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
                 ]]
                 , page: true
+                , limit: 100
                 , height: 500
                 , done: function () {
                 }
@@ -1216,39 +2040,44 @@
                 }
             });
 
-
-            //浠ヤ笂涓簂ayui妯″潡
+            function playSound() {
+                console.log("playSound");
+                //var audio = document.getElementById("cs");
+                //$("appendAut").html("");
+                //if (audio == null)
+                //$("appendAut").append('<audio id="cs" hidden controls> <source src = "../../video/jingbao.wav" type = "audio/ogg"> </audio >');
+                //$("appendAut").attr("src","../../video/jingbao.wav")
+                var audio = document.getElementById("cs");
+                audio.play();
+            }
+            function playSound1() {
+                console.log("playSound1");
+                //var audio = document.getElementById("cs");
+                //$("appendAut").html("");
+                //if (audio == null)
+                //$("appendAut").append('<audio id="cs" hidden controls> <source src = "../../video/success.wav" type = "audio/ogg"> </audio >');
+                //$("appendAut").attr("src", "../../video/success.wav")
+                var audio = document.getElementById("cs2");
+                audio.play();
+            }
+            
         });
-        //娓呯┖琛ㄥご
-        //function f_ClearTitle() {
 
-        //    $("#HBarCode").val("");
-        //    $("#HSpName").val("");
-        //    $("#HSpID").val("0");
-        //    $("#HQty").val("0");
-        //    $("#HSourceBillNo").val("");
-        //    $("#HWHNAME").val("");
-        //    $("#HWHID").val("0");
-        //    $("#HSCWHNAME").val("");
-        //    $("#HSCWHID").val("0");
-        //    $("#HSupName").val("");
-        //    $("#HSupID").val("0");
-        //    $("#HKeeper").val("");
-        //    $("#HKeeperID").val("0");
-        //    $("#HSecManager").val("0");
-        //    $("#HSecManagerID").val("");
-        //    $("#HDeptName").val("");
-        //    $("#HDeptID").val("0");
-        //    $("#HBillNo").val("");
-        //    $("#HInterID").val("0");
-        //}
+
+
+        //浠ヤ笂涓簂ayui妯″潡
+        
+        function GetHFIFOWHNAMEValue(obj)  //杩斿洖鍏堣繘鍏堝嚭浠撳簱
+        {
+            $("#HFIFOWHNAME").val(obj[0].HName);
+            $("#HFIFOWHID").val(obj[0].HItemID);
+        }
         function GetHWHValue(obj)  //杩斿洖璋冨叆浠撳簱
         {
             $("#HWHNAME").val(obj[0].HName);
             //sessionStorage["HWHID"] = obj[0].HItemID;
             $("#HWHID").val(obj[0].HItemID);
         }
-
         function GetHOrgNameValue(obj)  //杩斿洖璋冨叆缁勭粐
         {
             $("#HStockInOrgName").val(obj[0].HName);
@@ -1261,10 +2090,11 @@
             $("#HStockOutOrgID").val(obj[0].HItemID);
 
         }
-
         function GetHSpValue(obj) {  //杩斿洖璋冨叆浠撲綅
             $("#HStockPlaceName").val(obj[0].HName);
             $("#HStockPlaceID").val(obj[0].HItemID);
+            $("#HWHNAME").val(obj[0].HWhName);
+            $("#HWHID").val(obj[0].HWHID);
         }
         function GetHSCWHNAMEValue(obj)  //杩斿洖璋冨嚭浠撳簱
         {
@@ -1274,6 +2104,8 @@
         function GetHOutStockPlaceIDValue(obj) {  //杩斿洖璋冨嚭浠撲綅
             $("#HOutStockPlaceName").val(obj[0].HName);
             $("#HOutStockPlaceID").val(obj[0].HItemID);
+            $("#HSCWHNAME").val(obj[0].HWhName);
+            $("#HSCWHID").val(obj[0].HWHID);
         }
         function GetHSupValue(obj) {  //杩斿洖渚涘簲鍟�
             $("#HSupName").val(obj[0].HName);
@@ -1291,8 +2123,6 @@
             $("#HDeptName").val(obj[0].HName);
             $("#HDeptID").val(obj[0].HItemID);
         }
-
-        //杩斿洖鐝粍
         function GetProductionTeamValue(obj) {   //杩斿洖鐝粍
             if (obj.length == 0) {
                 layer.msg("璇峰厛閫夋嫨鐝粍", { index: 0 });
@@ -1302,49 +2132,38 @@
                 layer.closeAll();
             }
         }
-        //function Get_CheckWhAndSP(sInterID, sHBillType, sBarCode, sHWHID, sHSPID) {   //杩斿洖閮ㄩ棬
-        //    $.ajax({
-        //        type: "GET",
-        //        data: { "sHInterID": sInterID, "sHBillType": sHBillType, "sBarCode": sBarCode, "sHWHID": sHWHID, "sHSPID": sHSPID },
-        //        success: function (result) {
-        //            if(result.count==1)
-        //            {
-        //               // layer.msg(result.Message, { icon: 1 });
-        //                return true;
-        //            }
-        //            else
-        //            {
-        //                layer.msg(result.Message, { icon: 5 });
-        //                return false;
-        //            }
-        //        }
-        //    })
-        //}
+
         function AllowLoadData(sSubStr, bnt) {  //闈炵┖楠岃瘉
+            //鏁板瓧姝e垯(鍖呭惈灏忔暟)
+            var reg = /^\d+(\.\d+)?$/;
+            //if (reg.test($("#HQty").val()) == false || $("#HQty").val() == '') {
+            //    layer.msg("鏁伴噺蹇呴』涓烘暟閲忔垨灏忔暟", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+            //    return false;
+            //}
             //if ($("#HSourceBillNo").val() == '') {
             //    layer.msg("璇峰厛鎵簮鍗�!", { icon: 5 });
             //    return false;
             //}
-            if ($("#HDeptName").val() == '') {
-                layer.msg("閮ㄩ棬娌℃湁閫夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                return false;
-            }
-            if ($("#HSecManager").val() == '') {
-                layer.msg("楠屾敹浜烘病鏈夐�夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                return false;
-            }
-            if ($("#HKeeper").val() == '') {
-                layer.msg("淇濈浜烘病鏈夐�夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                return false;
-            }
+            //if ($("#HDeptName").val() == '') {
+            //    layer.msg("閮ㄩ棬娌℃湁閫夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+            //    return false;
+            //}
+            //if ($("#HSecManager").val() == '') {
+            //    layer.msg("楠屾敹浜烘病鏈夐�夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+            //    return false;
+            //}
+            //if ($("#HKeeper").val() == '') {
+            //    layer.msg("淇濈浜烘病鏈夐�夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+            //    return false;
+            //}
             //if ($("#HSupName").val() == '') {
             //    layer.msg("渚涘簲鍟嗘病鏈夐�夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
             //    return false;
             //}
-            if ($("#HWHNAME").val() == '') {
-                layer.msg("璋冨叆浠撳簱娌℃湁閫夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                return false;
-            }
+            //if ($("#HWHNAME").val() == '') {
+            //    layer.msg("璋冨叆浠撳簱娌℃湁閫夋嫨!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+            //    return false;
+            //}
             //if ($("#HWHID").val() == $("#HSCWHID").val() && $("#HStockPlaceID").val() == $("#HOutStockPlaceID").val()) {
             //    layer.msg("璋冨叆浠撳簱銆佷粨浣嶄笉鑳藉拰璋冨嚭浠撳簱銆佷粨浣嶉兘鐩稿悓!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
             //    return false;
@@ -1361,28 +2180,29 @@
                 layer.msg("娌℃湁鐗╂枡鏄庣粏璁板綍!", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                 return false;
             }
-            if (bnt == 'Saver') {
-                if (!typeof (sSubStr) == "undefined") {
-                    for (var i = 0; i <= sSubStr.length - 1; i++) {  //鍒ゆ柇鎵爜鏁伴噺涓嶈兘澶т簬搴旀敹鏁伴噺
-                        if (parseFloat(sSubStr[i].HQtyMust) > 0) {
-                            if (parseFloat(sSubStr[i].HQty) > parseFloat(sSubStr[i].HQtyMust)) {
-                                layer.msg("鏁伴噺涓嶈兘澶т簬搴旀敹鏁伴噺锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                                return false;
-                            }
-                        }
-                    }
-                    //for (var i = 0; i <= sSubStr.length - 1; i++) {   //鍒ゆ柇鎵爜鏁伴噺涓嶈兘涓�0
-                    //    if (parseFloat(sSubStr[i].HQty) == 0) {
-                    //        layer.msg("澶栬喘鍏ュ簱璁板綍鏈壂鐮侊紒", { icon: 5 });
-                    //        return false;
-                    //    }
-                    //}
-                }
-            }
-            else {
-                return true;
-            }
+            //if (bnt == 'Saver') {
+            //    if (!typeof (sSubStr) == "undefined") {
+            //        for (var i = 0; i <= sSubStr.length - 1; i++) {  //鍒ゆ柇鎵爜鏁伴噺涓嶈兘澶т簬搴旀敹鏁伴噺
+            //            if (parseFloat(sSubStr[i].HQtyMust) > 0) {
+            //                if (parseFloat(sSubStr[i].HQty) > parseFloat(sSubStr[i].HQtyMust)) {
+            //                    layer.msg("鏁伴噺涓嶈兘澶т簬搴旀敹鏁伴噺锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+            //                    return false;
+            //                }
+            //            }
+            //        }
+            //        //for (var i = 0; i <= sSubStr.length - 1; i++) {   //鍒ゆ柇鎵爜鏁伴噺涓嶈兘涓�0
+            //        //    if (parseFloat(sSubStr[i].HQty) == 0) {
+            //        //        layer.msg("澶栬喘鍏ュ簱璁板綍鏈壂鐮侊紒", { icon: 5 });
+            //        //        return false;
+            //        //    }
+            //        //}
+            //    }
+            //}
+            //else {
+            //    return true;
+            //}
         }
+        
     </script>
 
 </body>

--
Gitblit v1.9.1