From 601cdc345ba6181aa8455a4964fe433e71c875de Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@DESKTOP-5BIMHQ3>
Date: 星期四, 20 六月 2024 16:56:43 +0800
Subject: [PATCH] Merge branch 'wxw'

---
 Wms/WMS.BLL/BllTransServer/NoticeServer.cs    |  661 +++++++++++++++++---------------
 Wms/WMS.Entity/DataEntity/DataStockDetail.cs  |    6 
 Wms/Model/InterFaceModel/SoModel.cs           |    4 
 Wms/WMS.Entity/LogEntity/LogTask.cs           |    4 
 Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs |   20 +
 HTML/views/StatisticalReport/BoxInfor.html    |  464 +---------------------
 6 files changed, 415 insertions(+), 744 deletions(-)

diff --git a/HTML/views/StatisticalReport/BoxInfor.html b/HTML/views/StatisticalReport/BoxInfor.html
index 35b4739..c836bcb 100644
--- a/HTML/views/StatisticalReport/BoxInfor.html
+++ b/HTML/views/StatisticalReport/BoxInfor.html
@@ -50,7 +50,7 @@
 								<input type="text" id="PalletNo"  name="PalletNo" placeholder="鎵樼洏鍙�" autocomplete="off" class="layui-input">
 							</div>
 						</div>
-						<div class="layui-inline mingxi">
+						<!-- <div class="layui-inline mingxi">
 							<label class="layui-form-label" style="width: 60px;">璐т富缂栫爜</label>
 							<div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
 								<input type="text" id="OwnerNo" name="OwnerNo" placeholder="璐т富缂栫爜" autocomplete="off"
@@ -63,7 +63,7 @@
 								<input type="text" id="OwnerName" name="OwnerName" placeholder="璐т富鍚嶇О" autocomplete="off"
 									class="layui-input">
 							</div>
-						</div>
+						</div> -->
 						<div class="layui-inline mingxi">
 							<label class="layui-form-label" style="width: 60px;">鎵规鍙�</label>
 							<div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
@@ -73,12 +73,12 @@
 
 						<!-- 绠辩爜 绠辨敮鐘舵�� 妫�楠屾爣璁� 闆剁鏍囪 璐ㄩ噺鐘舵�� -->
 
-						<div class="layui-inline zongdan" >
+						<!-- <div class="layui-inline zongdan" >
 							<label class="layui-form-label" style="width: 60px;">绠辩爜</label>
 							<div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
 								<input type="text" id="BoxNo"  name="BoxNo" placeholder="绠辩爜" autocomplete="off" class="layui-input">
 							</div>
-						</div>
+						</div> -->
 						<!-- <div class="layui-inline zhijian">
 							<label class="layui-form-label" style="width: 60px;">绠辨敮鐘舵��</label>
 							<div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
@@ -91,7 +91,7 @@
 								</select>
 							</div>
 						</div> -->
-						<div class="layui-inline zhijian">
+						<!-- <div class="layui-inline zhijian">
 							<label class="layui-form-label" style="width: 60px;">鎶芥鏍囪</label>
 							<div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
 								<select name="InspectMark" id="InspectMark" lay-filter="InspectMark"
@@ -123,7 +123,7 @@
 									<option value="1">鏄�</option>
 								</select>
 							</div>
-						</div>
+						</div> -->
 						<div class="layui-inline zhijian">
 							<label class="layui-form-label" style="width: 60px;">璐ㄦ鐘舵��</label>
 							<div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
@@ -138,7 +138,7 @@
 							</div>
 						</div>
 
-						<div class="layui-inline zhijian">
+						<!-- <div class="layui-inline zhijian">
 							<label class="layui-form-label" style="width: 60px;">寮�濮嬫椂闂�</label>
 							<div class="layui-input-inline" style="width: 170px; margin-right: 0px;">
 								<input type="text" autocomplete="off" id="StartTime" class="layui-input"
@@ -151,7 +151,7 @@
 								<input type="text" autocomplete="off" id="EndTime" class="layui-input"
 									placeholder="缁撴潫鏃堕棿">
 							</div>
-						</div>
+						</div> -->
 
 						<div class="layui-inline sousuo">
 							<button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
@@ -164,82 +164,19 @@
 						</div>
 					</div>
 				</div>
-
+				<div id="center"></div>
 				<div class="layui-card-body">
-					<div style="position: relative;">
-						<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
-							<ul class="layui-tab-title" id="tab">
-								<li  class="layui-this">鎵樼洏鏄庣粏</li>
-								<li >绠辩爜鏄庣粏</li>
-							</ul>
-
-							<div id="center">	
-							</div>
-
-							<div class="layui-tab-content">
-								<div class="layui-tab-item layui-show">
-									<div class="position-relative"><!-- class="position-relative" --><!-- 鑷畾涔夎〃澶村姞涓� -->
-										<table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
-										<!-- #region 鑷畾涔夎〃澶� -->
-										<div class="headerSetIcon">
-											<button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols">
-												<i class="layui-icon">&#xe610;</i>
-											</button>
-										</div>
-										<!-- #endregion -->
-									</div>
-								</div>
-								<div class="layui-tab-item">
-									<div class="position-relative"><!-- class="position-relative" --><!-- 鑷畾涔夎〃澶村姞涓� -->
-										<table id="LAY-app-content-list2" lay-filter="LAY-app-content-list2"></table>
-										<!-- #region 鑷畾涔夎〃澶� -->
-										<div class="headerSetIcon">
-											<button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols2">
-												<i class="layui-icon">&#xe610;</i>
-											</button>
-										</div>
-										<!-- #endregion -->
-
-										<!-- #region 鑷畾涔夎〃澶� -->									
-										<script type="text/html" id="templetProductionTime">
-											{{# function GetBtn(d){
-													return formatDate(d.ProductionTime);
-												}	
-											}}
-											{{ GetBtn(d) }}
-										</script>
-
-										<script type="text/html" id="templetInspectTime">
-											{{# function GetBtn1(d){
-													return formatDate(d.InspectTime);
-												}	
-											}}
-											{{ GetBtn1(d) }}
-										</script>
-										<!-- #endregion -->
-									</div>
-								</div>
-							</div>
+					<div class="position-relative"><!-- class="position-relative" --><!-- 鑷畾涔夎〃澶村姞涓� -->
+						<table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
+						<!-- #region 鑷畾涔夎〃澶� -->
+						<div class="headerSetIcon">
+							<button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols">
+								<i class="layui-icon">&#xe610;</i>
+							</button>
 						</div>
-						
+						<!-- #endregion -->
 					</div>
 					
-                    <script type="text/html" id="BoxStatus">
-                        {{#  if(d.Status=='0'){ }}
-                            <p>鏈粍鎵�</p>
-                        {{#  } else if(d.Status == '1') { }}
-                            <p>宸茬粍鎵�</p>
-                        {{#  } else if(d.Status == '2') { }}
-                            <p>宸插叆搴�</p>
-                        {{#  } else if(d.Status == '3') { }}
-                            <p>宸插嚭搴�</p>
-                        {{#  } else if(d.Status == '4') { }}
-							<p>宸插垎閰�</p>
-						{{#  } else if(d.Status == '5') { }}
-							<p>宸叉嫞璐�</p>
-						{{#  } }}
-						
-                    </script>
                     <script type="text/html" id="InspectMarkStatus">
                         {{#  if(d.InspectMark=='0'){ }}
                             <p>鍚�</p>
@@ -253,30 +190,6 @@
                         {{#  } else if(d.BitPalletMark == '1') { }}
                             <p>鏄�</p>
                         {{# } }}
-                    </script>
-
-                    <script type="text/html" id="InspectStatus1">
-                        {{#  if(d.InspectStatus == '0') { }}
-                            <p>寰呮楠�</p>
-                        {{#  } else if(d.InspectStatus == '1'){ }}
-                            <p>妫�楠屽悎鏍�</p>
-                        {{#  } else if(d.InspectStatus == '2'){ }}
-                            <p>涓嶅悎鏍�</p>
-                        {{#  } else if(d.InspectStatus == '4') { }}
-                            <p>鏀剧疆鏈�</p>
-                        {{#  } }}
-                    </script>
-                    <script type="text/html" id="BitPalletMarkStatus1">
-                        {{#  if(d.BitBoxMark=='0'){ }}
-                            <p>鍚�</p>
-                        {{#  } else if(d.BitBoxMark == '1') { }}
-                            <p>鏄�</p>
-                        {{# } }}
-                    </script>
-                    <script type="text/html" id="table-content-list">
-                        <button class="layui-btn layui-btn-normal layui-btn-xs approvalBtnupt" id="approvalBtnupt" lay-event="edit">
-                            <i class="layui-icon layui-icon-edit"></i>璇︽儏
-                        </button>
                     </script>
 				</div>
 			</div>
@@ -300,9 +213,7 @@
 					element = layui.element;
 					laydate = layui.laydate;
 
-				var h1 = GetTableTabHeight();
-				// var h1 =  GetTkableTopHeight();
-				// console.log(h1)
+				var h1 = GetTableHeight();
 
 				laydate.render({
 					elem: '#StartTime',
@@ -415,18 +326,18 @@
                     {field: 'PalletNo', title: '鎵樼洏鍙�', align: 'center'},
                     {field: 'SkuNo', title: '鐗╂枡缂栫爜', align: 'center'},
                     {field: 'SkuName', title: '鐗╂枡鍚嶇О', align: 'center'},
-					{field: 'OwnerNo',title: '璐т富缂栫爜',align: 'center'},
-					{field: 'OwnerName',title: '璐т富鍚嶇О',align: 'center'}, 
-					{field: 'SupplierNo',title: '渚涘簲鍟嗙紪鐮�',align: 'center'},
-					{field: 'SupplierName',title: '渚涘簲鍟嗗悕绉�',align: 'center'}, 
+					//{field: 'OwnerNo',title: '璐т富缂栫爜',align: 'center'},
+					//{field: 'OwnerName',title: '璐т富鍚嶇О',align: 'center'}, 
+					//{field: 'SupplierNo',title: '渚涘簲鍟嗙紪鐮�',align: 'center'},
+					//{field: 'SupplierName',title: '渚涘簲鍟嗗悕绉�',align: 'center'}, 
                     {field: 'LotNo', title: '鎵规鍙�', align: 'center'},
                     {field: 'LotText', title: '鎵规鎻忚堪', align: 'center'},
-                    {field: 'SupplierLot', title: '渚涜揣鎵规', align: 'center'},
+                    //{field: 'SupplierLot', title: '渚涜揣鎵规', align: 'center'},
                     {field: 'Qty', title: '鏁伴噺', align: 'center'},
                     {field: 'LockQty', title: '閿佸畾鏁伴噺', align: 'center',},
                     {field: 'FrozenQty', title: '鍐荤粨鏁伴噺', align: 'center'},
-                    {field: 'InspectMark', title: '鎶芥鏍囪', align: 'center', templet: '#InspectMarkStatus'},
-                    {field: 'BitPalletMark', title: '闆舵墭鏍囪', align: 'center', templet: '#BitPalletMarkStatus'},
+                    //{field: 'InspectMark', title: '鎶芥鏍囪', align: 'center', templet: '#InspectMarkStatus'},
+                    //{field: 'BitPalletMark', title: '闆舵墭鏍囪', align: 'center', templet: '#BitPalletMarkStatus'},
 				]];
 				var TotalColsSysArr=encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//灏嗚〃澶存暟鎹繘琛寀rl缂栫爜
 				//#endregion
@@ -502,176 +413,6 @@
 					//#endregion                    
                 }                
 
-				// 琛ㄥ崟闇�瑕佺殑鍙橀噺
-				var infoOptions2;
-				//#region 鍘熷闈炶嚜瀹氫箟鍒�
-				// infoOptions2 = {
-				// 	elem: '#LAY-app-content-list2',
-				// 	height: 'full-206',
-				// 	id: 'LAY-app-content-list2',
-				// 	page: true,
-				// 	limit: pageCnt,
-				// 	limits: pageLimits,
-				// 	even: true,
-				// 	cellMinWidth: 80, //鍏ㄥ眬瀹氫箟甯歌鍗曞厓鏍肩殑鏈�灏忓搴︼紝layui 2.2.1 鏂板
-				// 	cols: 
-				// 	[[
-                //         {
-                //             title: '搴忓彿',  type: 'numbers',  fixed: 'left'
-                //         },
-                //         {
-                //             field: 'SkuNo', title: '鐗╂枡缂栫爜', align: 'center',
-                //         },
-                //         {
-                //             field: 'SkuName', title: '鐗╂枡鍚嶇О', align: 'center',
-                //         },
-                //         {
-                //             field: 'PalletNo', title: '鎵樼洏鍙�', align: 'center', width: 110,
-                //         },
-                //         {
-                //             field: 'BoxNo', title: '绠辩爜', align: 'center', width: 100,
-                //         }, 
-                //         {
-                //             field: 'Status', title: '绠辨敮鐘舵��', align: 'center', templet: '#BoxStatus',
-                //         },
-                //         {
-                //             field: 'LotNo', title: '鎵规鍙�', align: 'center',
-                //         },
-                //         {
-                //             field: 'LotText', title: '鎵规鎻忚堪', align: 'center',
-                //         },
-                //         {
-                //             field: 'Qty', title: '鏁伴噺', width: 90, align: 'center',
-                //         },
-                //         {
-                //             field: 'FullQty', title: '鏁寸鏁伴噺', width: 100, align: 'center',
-                //         },
-                //         {
-                //             field: 'ProductionTime', title: '鐢熶骇鏃ユ湡', align: 'center',
-                //             templet: function(d) {
-                //                 return formatDate(d.ProductionTime);
-                //             },
-                //         },
-                //         {
-                //             field: 'InspectMark', title: '鎶芥鏍囪', align: 'center', templet: '#InspectMarkStatus',
-                //         }, 
-                //         {
-                //             field: 'BitBoxMark', templet: '#BitPalletMarkStatus1', title: '闆剁鏍囪', align: 'center',
-                //         },
-                //         {
-                //             field: 'InspectStatus', templet: '#InspectStatus1', title: '璐ㄦ鐘舵��', align: 'center',
-                //         }, 
-                //         {
-                //             field: 'InspectTime', title: '澶嶆鏃堕棿', align: 'center',
-                //             templet: function(d) {
-                //                 return formatDate(d.InspectTime);
-                //             },
-                //         },
-                //         {
-				// 			title: '鎿嶄綔', fixed: 'right', align: 'center', toolbar: '#table-content-list'
-				// 		}
-				// 	]]
-				// };
-                //#endregion
-				
-				//鑾峰彇鏄庣粏淇℃伅
-				//#region 鑷畾涔夎〃澶�
-				var DetailColsArr = [[
-					{field: '',title: '搴忓彿',type:'numbers',fixed: 'left', "disabled": true},   
-                    {field: 'SkuNo', title: '鐗╂枡缂栫爜', align: 'center'},
-                    {field: 'SkuName', title: '鐗╂枡鍚嶇О', align: 'center'},
-                    {field: 'PalletNo', title: '鎵樼洏鍙�', align: 'center', width: 110},
-                    {field: 'BoxNo', title: '绠辩爜', align: 'center', width: 100}, 
-                    {field: 'Status', title: '绠辨敮鐘舵��', align: 'center', templet: '#BoxStatus'},
-                    {field: 'LotNo', title: '鎵规鍙�', align: 'center'},
-                    {field: 'LotText', title: '鎵规鎻忚堪', align: 'center'},
-                    {field: 'Qty', title: '鏁伴噺', width: 90, align: 'center'},
-                    {field: 'FullQty', title: '鏁寸鏁伴噺', width: 100, align: 'center'},
-                    {field: 'ProductionTime', title: '鐢熶骇鏃ユ湡', align: 'center',templet: '#templetProductionTime'},
-                    {field: 'InspectMark', title: '鎶芥鏍囪', align: 'center', templet: '#InspectMarkStatus'}, 
-                    {field: 'BitBoxMark', templet: '#BitPalletMarkStatus1', title: '闆剁鏍囪', align: 'center'},
-                    {field: 'InspectStatus', templet: '#InspectStatus1', title: '璐ㄦ鐘舵��', align: 'center'}, 
-                    {field: 'InspectTime', title: '澶嶆鏃堕棿', align: 'center',templet: '#templetInspectTime'},
-                    {field: 'caozuo',title: '鎿嶄綔', fixed: 'right', align: 'center', toolbar: '#table-content-list', "disabled": true}
-				]];
-				var DetailColsSysArr=encodeURIComponent(encodeURIComponent(JSON.stringify(DetailColsArr)))//灏嗚〃澶存暟鎹繘琛寀rl缂栫爜
-				//#endregion				
-				function refreshTable2(Id,SkuNo,SkuName,LotNo,PalletNo,BoxNo,Status,InspectMark,BitBoxMark,InspectStatus,StartTime,EndTime) {
-					//#region 鑷畾涔夎〃澶�
-					var colsJson2
-					var param1={
-						Href:'Statistical/GetBoxInfo'
-					};
-					sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function(res) {
-						if (res.code == 0){							
-							if(res.data=='' || res.data==undefined || res.data==null){
-								colsJson2=DetailColsArr
-							}else{
-								colsJson2= eval(res.data);
-							}
-						}else{
-								colsJson2=DetailColsArr
-						}
-						infoOptions2 = {
-							elem: '#LAY-app-content-list2',
-							height: h1,
-							id: 'LAY-app-content-list2',
-							page: true,
-							limit: pageCnt,
-							limits: pageLimits,
-							even: true,
-							cellMinWidth: 80, //鍏ㄥ眬瀹氫箟甯歌鍗曞厓鏍肩殑鏈�灏忓搴︼紝layui 2.2.1 鏂板
-							done: function(){
-								//鑷畾涔夊垪瀹�
-								SetTableColW('LAY-app-content-list2','Statistical/GetBoxInfo',DetailColsSysArr);
-							}, 
-							cols:colsJson2
-						};
-						
-						var param = {
-							Id:Id,
-							SkuNo:SkuNo,
-							SkuName:SkuName,
-							LotNo:LotNo,
-							PalletNo:PalletNo,
-							BoxNo:BoxNo,
-							Status:Status,
-							InspectMark:InspectMark,
-							BitBoxMark:BitBoxMark,
-							InspectStatu:InspectStatus,
-							StartTime:StartTime,
-							EndTime:EndTime,
-						} 
-						sendData(IP + "/Statistical/GetBoxInfo", param, 'get', function(res) {
-							if (res.code == 0) //鎴愬姛
-							{
-								var list = res.data;
-								$.extend(infoOptions2, {
-									data: list
-								});
-								infoOptions2.page = {
-									curr: 1
-								}
-								tableIns2 = table.render(infoOptions2);
-							}
-							else //涓嶆垚鍔�
-							{
-								layer.msg('鑾峰彇鏄庣粏鍒楄〃淇℃伅澶辫触锛�', {
-									icon: 2,
-									time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-								}, function() {});
-							}
-						})
-					});
-					//#endregion					
-				}
-                
-				//var url = IP + "/Statistical/GetInventoryList1";
-				
-               
-				
-				//鎺ュ彈鍏ㄥ眬鍙橀噺
-				let quanid = '';
 				//鐩戝惉鎼滅储
 				form.on('submit(LAY-app-contlist-search)', function(data) {
 					var SkuNo = $("#SkuNo").val();
@@ -692,27 +433,10 @@
 					var StartTime = $("#StartTime").val();
 					var EndTime = $("#EndTime").val();
 
-					if(yemianid == 0){
-						console.log("鎬诲崟");
-						refreshTable(SkuNo,SkuName,PalletNo,LotNo,BoxNo,Status,InspectMark,BitPalletMark,BitBoxMark,InspectStatus,OwnerNo,OwnerName,StartTime,EndTime);
-					}else if(yemianid == 1){
-						quanid = '';
-						console.log("鏄庣粏");
-						refreshTable2(quanid,SkuNo,SkuName,LotNo,PalletNo,BoxNo,Status,InspectMark,BitBoxMark,InspectStatus,StartTime,EndTime);
-					}
+					refreshTable(SkuNo,SkuName,PalletNo,LotNo,BoxNo,Status,InspectMark,BitPalletMark,BitBoxMark,InspectStatus,OwnerNo,OwnerName,StartTime,EndTime);
 					
 				});
-				//瑙﹀彂琛屽弻鍑讳簨浠�
-				table.on('rowDouble(LAY-app-content-list)', function(obj) {
-					$(".layui-tab-title>li").attr("class", "");
-					$('.layui-tab-title>li').eq(1).attr('class', 'layui-this');
-					$('.layui-tab-content .layui-tab-item').attr('class', 'layui-tab-item')
-					$('.layui-tab-content .layui-tab-item').eq(1).attr('class', 'layui-tab-item layui-show')
-					console.log(obj.data.Id);
-					quanid = obj.data.Id;
-					refreshTable2(obj.data.Id);
-					yemianid=1;
-				});
+
 				
 				//鐩戝惉Tab鍒囨崲锛屼互鏀瑰彉鍦板潃hash鍊�
 				element.on('tab(docDemoTabBrief)', function(data){
@@ -734,130 +458,9 @@
 					var StartTime = $("#StartTime").val();
 					var EndTime = $("#EndTime").val();
 
-					console.log(data.index);
-					yemianid = data.index
-					if(yemianid == 0){
-						console.log("鎬诲崟");
-						refreshTable(SkuNo,SkuName,PalletNo,LotNo,BoxNo,Status,InspectMark,BitPalletMark,BitBoxMark,InspectStatus,OwnerNo,OwnerName,StartTime,EndTime);
-					}else if(yemianid == 1){
-						console.log("鏄庣粏");
-						refreshTable2(quanid,SkuNo,SkuName,LotNo,PalletNo,BoxNo,Status,InspectMark,BitBoxMark,InspectStatus,StartTime,EndTime);
-					}
+					refreshTable(SkuNo,SkuName,PalletNo,LotNo,BoxNo,Status,InspectMark,BitPalletMark,BitBoxMark,InspectStatus,OwnerNo,OwnerName,StartTime,EndTime);
 				});
 				var doing = true;
-				// ------------------------------------璇︽儏---------------------------------------------------
-				table.on('tool(LAY-app-content-list2)', function(obj) {
-					console.log(obj)
-					var data = obj.data;
-					//璇︽儏
-					if (obj.event === 'edit') {
-						BoxNo = data.BoxNo;
-						console.log(data)
-						layer.open({
-							type: 2,
-							title: '绠辨敮璇︽儏淇℃伅',
-							content: 'BoxSupportInfor.html?BoxNo=' + BoxNo,
-							maxmin: true,
-							area: ['80%', '85%'],
-							btn: ['鍏抽棴'],
-							yes: function(index, layero) {
-								var iframeWindow = window['layui-layer-iframe' + index],
-									submitID = 'layuiadmin-app-form-edit',
-									submit = layero.find('iframe').contents().find('#' + submitID);
-									if(doing)
-									{
-										doing = false;
-										
-										layer.close(index); //鍏抽棴寮瑰眰
-										refreshTable();
-										doing = true;
-												
-											
-									}
-							}
-						});
-					} 
-				});
-
-				form.on('submit(daochu)', function () {
-					layer.confirm('纭畾瀵煎嚭褰撳墠鏁版嵁鍚楋紵', function(index) {
-						if(yemianid == 0){
-							console.log("鎵樼洏鏄庣粏"); 
-							var param = {
-								SkuNo : $("#SkuNo").val(),
-								SkuName : $("#SkuName").val(),
-								LotNo : $("#LotNo").val(),
-								PalletNo : $("#PalletNo").val(),
-
-								BoxNo : $("#BoxNo").val(),
-								Status : $("#Status").val(),
-								InspectMark : $("#InspectMark").val(),
-								BitPalletMark : $("#BitPalletMark").val(),
-								BitBoxMark : $("#BitBoxMark").val(),
-								InspectStatus : $("#InspectStatus").val(),
-
-								StartTime: $("#StartTime").val(),
-								EndTime: $("#EndTime").val(),
-							};
-
-							sendData(IP + "/Statistical/GetBindListDaoChu", param, 'get', function (res) {
-								console.log(res);
-								if (res.code == 0) { //鎴愬姛
-									var list = res.data;
-									table.exportFile(tableIns.config.id, list,'xls',"鎵樼洏鏄庣粏淇℃伅"+getNowTime(),); //data 涓鸿瀹炰緥涓殑浠绘剰鏁伴噺鐨勬暟鎹�
-									layer.msg('瀵煎嚭鎴愬姛锛�', {
-										icon: 1,
-										time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-									}, function () {
-										
-									});
-									
-								} else { //涓嶆垚鍔�
-									layer.msg('鑾峰彇淇℃伅澶辫触锛�', {
-										icon: 2,
-										time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-									}, function () { });
-								}
-							});
-						}else if(yemianid == 1){
-							console.log("绠辩爜鏄庣粏");
-							var param = {
-								Id:quanid,
-								SkuNo: $("#SkuNo").val(),
-								SkuName: $("#SkuName").val(),
-								LotNo:$("#LotNo").val(),
-								LocatNo:$("#LocatNo").val(),
-								PalletNo:$("#PalletNo").val(),
-								Status:$("#Status").val(),
-								InspectStatus:$("#InspectStatus").val(),
-								IsSamolingTray:$("#IsSamolingTray").val(),
-								StartTime: $("#StartTime").val(),
-								EndTime: $("#EndTime").val(),
-							};
-							sendData(IP + "/Statistical/GetBoxInfoDaoChu", param, 'get', function (res) {
-								console.log(res);
-								if (res.code == 0) { //鎴愬姛
-									var list = res.data;
-									table.exportFile(tableIns2.config.id, list,'xls',"绠辩爜鏄庣粏淇℃伅"+getNowTime(),); //data 涓鸿瀹炰緥涓殑浠绘剰鏁伴噺鐨勬暟鎹�
-									layer.msg('瀵煎嚭鎴愬姛锛�', {
-										icon: 1,
-										time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-									}, function () {
-										
-									});
-									
-								} else { //涓嶆垚鍔�
-									layer.msg('鑾峰彇淇℃伅澶辫触锛�', {
-										icon: 2,
-										time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-									}, function () { });
-								}
-							});
-						}
-					});
-					
-					
-				});
 
 				//#region 鑷畾涔夎〃澶�
 				//鑷畾涔夎〃澶�			
@@ -872,17 +475,6 @@
 							area: ['970px', '650px']
 						});
 					},
-					customCols2: function(){
-						layer.open({
-							type: 2,
-							title: '鑷畾涔夊垪',
-							content: '../SystemSettings/HeaderSetting.html?Href=Statistical/GetBoxInfo&ColsSysArr='+DetailColsSysArr,
-							maxmin: false,
-							resize: false,
-							area: ['970px', '650px']
-						});
-					}
-
 				};
 				$('.layui-btn').on('click', function() {
 					var type = $(this).data('type');
diff --git a/Wms/Model/InterFaceModel/SoModel.cs b/Wms/Model/InterFaceModel/SoModel.cs
index c48ca16..bad3c50 100644
--- a/Wms/Model/InterFaceModel/SoModel.cs
+++ b/Wms/Model/InterFaceModel/SoModel.cs
@@ -49,6 +49,10 @@
         /// </summary>
         public string SkuNo { get; set; }
         /// <summary>
+        /// 鐗╂枡鍚嶇О
+        /// </summary>
+        public string SkuName { get; set; }
+        /// <summary>
         /// 鎵规鍙�
         /// </summary>
         public string LotNo { get; set; }
diff --git a/Wms/WMS.BLL/BllTransServer/NoticeServer.cs b/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
index fee3032..c029acf 100644
--- a/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
+++ b/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
@@ -1,10 +1,15 @@
 锘縰sing Model.InterFaceModel;
+using Newtonsoft.Json;
 using SqlSugar;
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Text;
+using WMS.BLL.LogServer;
 using WMS.DAL;
 using WMS.Entity.BllAsnEntity;
+using WMS.Entity.BllQualityEntity;
+using WMS.Entity.BllSoEntity;
 using WMS.Entity.Context;
 using WMS.Entity.DataEntity;
 using WMS.Entity.LogEntity;
@@ -115,6 +120,7 @@
                 throw ex;
             }
         }
+
         /// <summary>
         /// 浠诲姟瀹屾垚
         /// </summary>
@@ -161,10 +167,10 @@
                 }
                 switch (taskInfo.OrderType)
                 {
-                    //鍏ュ簱瀹屾垚
+                    #region 鍏ュ簱瀹屾垚
                     case "0":
                         //鍏ュ簱鍗曟槑缁嗕俊鎭�
-                        var noticeDetail = Db.Queryable<BllArrivalNoticeDetail>().First(w => w.Id == taskInfo.ASNDetailNo);
+                        var noticeDetail = Db.Queryable<BllArrivalNoticeDetail>().First(w => w.Id == taskInfo.NoticeDetailNo);
                         if (noticeDetail == null)
                         {
                             resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曟槑缁嗕笉瀛樺湪!";
@@ -190,45 +196,70 @@
                             return resultModel;
                         }
                         //搴撳瓨鏄庣粏
-                        var sd1 = new DataStockDetail()
+                        var sd1 = Db.Queryable<DataStockDetail>().First(w => w.PalletNo == taskInfo.PalletNo);
+                        if (sd1 == null)
                         {
-                            LotNo = noticeDetail.LotNo,
-                            LotText = noticeDetail.LotText,
-                            SupplierLot = noticeDetail.SupplierLot,
-                            SkuNo = noticeDetail.SkuNo,
-                            SkuName = noticeDetail.SkuName,
-                            Standard = noticeDetail.Standard,
-                            Qty = 1,
-                            LockQty = 0,
-                            FrozenQty = 0,
-                            InspectQty = 0,
-                            ASNNo = noticeDetail.ASNNo,
-                            ASNDetailNo = noticeDetail.Id,
-                            WareHouseNo = locatInfo.WareHouseNo,//鎵�灞炰粨搴�
-                            RoadwayNo = locatInfo.RoadwayNo,//鎵�灞炲贩閬�
-                            AreaNo = locatInfo.AreaNo,//鎵�灞炲尯鍩�
-                            LocatNo = locatInfo.LocatNo,//鍌ㄤ綅鍦板潃
-                            PalletNo = taskInfo.PalletNo,
-                            PalletNo2 = "",
-                            PalletNo3 = "",
-                            PalletTags = "0",
-                            CompleteTime = comTime,
-                            ProductionTime = null,
-                            ExpirationTime = null,
-                            Status = "0",
-                            InspectMark = "0",
-                            InspectStatus = "0",//寰呮楠�
-                            BitPalletMark = "0",
-                            PackagNo = "",
-                            IsBale = "0",
-                            IsBelt = "0",
+                            sd1 = new DataStockDetail()
+                            {
+                                LotNo = noticeDetail.LotNo,
+                                LotText = noticeDetail.LotText,
+                                SupplierLot = noticeDetail.SupplierLot,
+                                SkuNo = noticeDetail.SkuNo,
+                                SkuName = noticeDetail.SkuName,
+                                Standard = noticeDetail.Standard,
+                                Qty = 1,
+                                LockQty = 0,
+                                FrozenQty = 0,
+                                InspectQty = 0,
+                                ASNNo = noticeDetail.ASNNo,
+                                ASNDetailNo = noticeDetail.Id,
+                                WareHouseNo = locatInfo.WareHouseNo,//鎵�灞炰粨搴�
+                                RoadwayNo = locatInfo.RoadwayNo,//鎵�灞炲贩閬�
+                                AreaNo = locatInfo.AreaNo,//鎵�灞炲尯鍩�
+                                LocatNo = locatInfo.LocatNo,//鍌ㄤ綅鍦板潃
+                                PalletNo = taskInfo.PalletNo,
+                                PalletNo2 = "",
+                                PalletNo3 = "",
+                                PalletTags = "0",
+                                CompleteTime = comTime,
+                                ProductionTime = null,
+                                ExpirationTime = null,
+                                Status = "0",
+                                InspectMark = "0",
+                                InspectStatus = "0",//寰呮楠�
+                                BitPalletMark = "0",
+                                PackagNo = "",
+                                IsBale = "0",
+                                IsBelt = "0",
 
-                            IsDel = "0",
-                            CreateUser = 0,
-                            CreateTime = comTime
-                        };
-                        //鎻掑叆搴撳瓨鏄庣粏
-                        Db.Insertable(sd1).ExecuteCommand();
+                                PalletStatus = "1",
+
+                                IsDel = "0",
+                                CreateUser = 0,
+                                CreateTime = comTime
+                            };
+                            //鎻掑叆搴撳瓨鏄庣粏
+                            Db.Insertable(sd1).ExecuteCommand();
+                        }
+                        else
+                        {
+                            sd1.Qty = 1;
+                            sd1.LockQty = 0;
+                            sd1.FrozenQty = 0;
+                            sd1.InspectQty = 0;
+                            sd1.ASNNo = noticeDetail.ASNNo;
+                            sd1.ASNDetailNo = noticeDetail.Id;
+                            sd1.WareHouseNo = locatInfo.WareHouseNo;//鎵�灞炰粨搴�
+                            sd1.RoadwayNo = locatInfo.RoadwayNo;//鎵�灞炲贩閬�
+                            sd1.AreaNo = locatInfo.AreaNo;//鎵�灞炲尯鍩�
+                            sd1.LocatNo = locatInfo.LocatNo;//鍌ㄤ綅鍦板潃
+                            sd1.CompleteTime = comTime;
+                            sd1.InspectStatus = "0";//寰呮楠�
+                            sd1.PalletStatus = "1";//棰勬贩
+
+                            //淇敼搴撳瓨鏄庣粏
+                            Db.Updateable(sd1).ExecuteCommand();
+                        }
 
                         noticeDetail.CompleteQty += 1;//瀹屾垚鏁伴噺
                         noticeDetail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴�
@@ -260,7 +291,185 @@
                         locatInfo.Status = "1";//鏈夌墿鍝�
                         //鏇存柊鍌ㄤ綅鐘舵��
                         Db.Updateable(locatInfo).ExecuteCommand();
+
+                        #region 璐ㄦ璇烽獙
+                        var qualityRequest = Db.Queryable<BllQualityInspectionRequest>().First(m => m.IsDel == "0" && m.SkuNo == noticeDetail.SkuNo && m.LotNo == noticeDetail.LotNo && m.SupplierLot == noticeDetail.SupplierLot);
+                        if (qualityRequest == null)
+                        {
+                            //璐ㄦ璇烽獙鍗曚俊鎭�
+                            string qcNo = new Common().GetMaxNo("QC");
+                            qualityRequest = new BllQualityInspectionRequest();
+                            qualityRequest.QcNo = qcNo;
+                            qualityRequest.Status = "0";
+                            qualityRequest.SkuNo = noticeDetail.SkuNo;
+                            qualityRequest.SkuName = noticeDetail.SkuName;
+                            qualityRequest.LotNo = noticeDetail.LotNo;
+                            qualityRequest.SupplierLot = noticeDetail.SupplierLot;
+                            qualityRequest.Qty = noticeDetail.Qty;
+                            qualityRequest.SamplingQty = 0;
+                            qualityRequest.ASNNo = noticeDetail.ASNNo;
+                            qualityRequest.CreateUser = 0;
+                            qualityRequest.CreateTime = comTime;
+
+                            // 璁板綍浠诲姟鏃ュ織
+                            var taskNo = new Common().GetMaxNo("TK");
+                            var exTask = new LogTask()
+                            {
+                                TaskNo = taskNo,
+                                Sender = "WMS",
+                                Receiver = "Limes",
+                                IsSuccess = 0,//鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+                                StartLocat = "",//璧峰浣嶇疆
+                                PalletNo = "",//鎵樼洏鐮�
+                                IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+                                IsCancel = 1,//鏄惁鍙彇娑�
+                                IsFinish = 1,//鏄惁鍙畬鎴�    
+                                Status = "0",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+                                OrderType = "5",//0 鍏ュ簱鍗� 1 鍑哄簱鍗�  2 鐩樼偣鍗�  3 绉诲簱鍗� 4 鍙栨牱鍑哄簱鍗� 5 鍏朵粬
+                                EndLocat = "",//鐩爣浣嶇疆
+                                Type = "3",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟  2 绉诲簱浠诲姟
+                                Msg = "璇烽獙浠诲姟"
+                            };
+                            // 鎻掑叆浠诲姟鏃ュ織
+                            Db.Insertable(exTask).ExecuteCommand();
+
+                            // 璋冪敤Limes鎺ュ彛鍙戣捣璇烽獙
+                            var sendModel = new SendLimesModel()
+                            {
+                                QcNo = qualityRequest.QcNo,
+                                SkuNo = qualityRequest.SkuNo,
+                                Qty = qualityRequest.Qty.ToString(),
+                                LotNo = qualityRequest.LotNo,
+                                SupplierLot = qualityRequest.SupplierLot,
+                                RequestUser = "",                       // 璇烽獙浜�
+                            };
+                            var jsonData = JsonConvert.SerializeObject(sendModel);
+                            string response = "";
+                            try
+                            {
+                                var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
+                                //response = HttpHelper.DoPost(url, jsonData, "涓婁紶Limes绯荤粺鍙戣捣璇烽獙", "Limes");
+                                var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
+
+                                ////瑙f瀽杩斿洖鏁版嵁 
+                                //var limesModel = JsonConvert.DeserializeObject<LimesModel>(response);
+                                List<string> list1 = new List<string>();
+                                list1.Add(taskNo);
+                                //if (limesModel.Success == 0)
+                                //{
+                                //鏇存敼浠诲姟鐨勫彂閫佽繑鍥炴椂闂�//
+                                new TaskServer().EditTaskIssueOk(list1, time1, time2);
+
+                                // 鏇存柊璇烽獙鍗曚俊鎭�
+                                qualityRequest.Status = "1";
+                                qualityRequest.SamplingQty = 10;//decimal.Parse(limesModel.SamplingQty);
+                                qualityRequest.RequestUser = 0;
+                                qualityRequest.RequestTime = DateTime.Now;
+                                qualityRequest.UpdateTime = DateTime.Now;
+                                qualityRequest.UpdateUser = 0;
+                                //娣诲姞璐ㄦ璇烽獙鍗�
+                                Db.Insertable(qualityRequest).ExecuteCommand();
+                                //}
+                                //if (limesModel.Success == -1)
+                                //{
+                                //    new TaskServer().EditTaskIssueNo(list1, time1, time2,limesModel.Message);
+                                //    throw new Exception(limesModel.Message);
+                                //}
+                            }
+                            catch (Exception ex)
+                            {
+                                throw new Exception(ex.Message);
+                            }
+                        }
+                        #endregion
+
                         break;
+                    #endregion
+
+                    #region 鍑哄簱瀹屾垚
+                    case "1":
+                        //鍑哄簱鍗曟槑缁嗕俊鎭�
+                        var exNoticeDetail = Db.Queryable<BllExportNoticeDetail>().First(w => w.Id == taskInfo.NoticeDetailNo);
+                        if (exNoticeDetail == null)
+                        {
+                            resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曟槑缁嗕笉瀛樺湪!";
+                            return resultModel;
+                        }
+                        //鍑哄簱鍗曚俊鎭�
+                        var exNotice = Db.Queryable<BllExportNotice>().First(w => w.SONo == exNoticeDetail.SONo);
+                        if (exNotice == null)
+                        {
+                            resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曚笉瀛樺湪!";
+                            return resultModel;
+                        }
+                        if (exNotice.Status == "4" || exNotice.Status == "5")
+                        {
+                            resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曞凡鎵ц瀹屾垚!";
+                            return resultModel;
+                        }
+                        //璧峰鍌ㄤ綅淇℃伅
+                        var startLocatInfo = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.StartLocat && w.IsDel == "0");
+                        if (startLocatInfo == null)
+                        {
+                            resultModel.Message = "璧峰鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
+                            return resultModel;
+                        }
+                        //鐩爣鍌ㄤ綅淇℃伅
+                        var endLocatInfo = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0");
+                        if (endLocatInfo == null)
+                        {
+                            resultModel.Message = "鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
+                            return resultModel;
+                        }
+                        //搴撳瓨鏄庣粏
+                        var sd2 = Db.Queryable<DataStockDetail>().First(w => w.PalletNo == taskInfo.PalletNo);
+                        if (sd2 == null)
+                        {
+                            resultModel.Message = "搴撳瓨淇℃伅涓嶅瓨鍦�!";
+                            return resultModel;
+                        }
+                        //淇敼鍑哄簱鍗曟槑缁嗘嫞璐ф暟閲�
+                        exNoticeDetail.CompleteQty += sd2.Qty;
+                        Db.Updateable(exNoticeDetail).ExecuteCommand();
+
+                        exNotice.UpdateUser = 0;
+                        exNotice.UpdateTime = comTime;
+                        if (exNotice.Status == "0" || exNotice.Status == "1" || exNotice.Status == "2")
+                        {
+                            exNotice.Status = "3";//鏇存敼涓烘鍦ㄦ墽琛�
+                        }
+                        var num = Db.Queryable<BllExportNoticeDetail>().Count(m => m.IsDel == "0" && m.SONo == exNoticeDetail.SONo && m.CompleteQty < m.Qty);
+                        if (num <= 0)
+                        {
+                            exNotice.Status = "4"; //鏇存敼涓烘墽琛屽畬鎴�                            
+                        }
+                        //淇敼鍑哄簱鍗曚俊鎭�
+                        Db.Updateable(exNotice).ExecuteCommand();
+
+                        sd2.Qty = 0;
+                        sd2.LockQty = 0;
+                        sd2.FrozenQty = 0;
+                        sd2.InspectQty = 0;
+                        sd2.ASNNo = "";
+                        sd2.ASNDetailNo = null;
+                        sd2.WareHouseNo = endLocatInfo.WareHouseNo;//鎵�灞炰粨搴�
+                        sd2.RoadwayNo = endLocatInfo.RoadwayNo;//鎵�灞炲贩閬�
+                        sd2.AreaNo = endLocatInfo.AreaNo;//鎵�灞炲尯鍩�
+                        sd2.LocatNo = endLocatInfo.LocatNo;//鍌ㄤ綅鍦板潃
+                        sd2.CompleteTime = comTime;
+                        //淇敼搴撳瓨鏄庣粏
+                        Db.Updateable(sd2).ExecuteCommand();
+
+                        startLocatInfo.Status = "0";//绌哄偍浣�
+                        //淇敼璧峰鍌ㄤ綅鐘舵��
+                        Db.Updateable(startLocatInfo).ExecuteCommand();
+
+                        endLocatInfo.Status = "1";//绌哄偍浣�
+                        //淇敼鐩爣鍌ㄤ綅鐘舵��
+                        Db.Updateable(endLocatInfo).ExecuteCommand();
+
+                        break;
+                    #endregion
                 }
                 taskInfo.Status = "2";//鎵ц瀹屾垚
                 //淇敼浠诲姟鐘舵��
@@ -280,17 +489,19 @@
                 throw ex;
             }
         }
-        /*public SoResInfo ErpAddExportNotice(SoInfo model)
+
+        /// <summary>
+        /// 涓嬪彂鍑哄簱鍗�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public SoResInfo ErpAddExportNotice(SoInfo model)
         {
             try
             {
-                if (string.IsNullOrEmpty(model.SoType))
-                {
-                    throw new Exception("鍗曟嵁绫诲瀷涓嶅彲涓虹┖!");
-                }
                 if (string.IsNullOrEmpty(model.OrderCode))
                 {
-                    throw new Exception("绯荤粺鍗曞彿涓嶅彲涓虹┖!");
+                    throw new Exception("涓婃父绯荤粺鍗曞彿涓嶅彲涓虹┖!");
                 }
                 if (model.SoDetails.Count <= 0)
                 {
@@ -299,29 +510,9 @@
                 //杩斿洖淇℃伅
                 SoResInfo result = new SoResInfo();
 
+                var skuNos = model.SoDetails.Select(a => a.SkuNo).Distinct().ToList();
                 //鑾峰彇搴撳瓨鏄庣粏
                 var stockDetailList = Db.Queryable<DataStockDetail>().Where(s => skuNos.Contains(s.SkuNo) && (s.Qty - s.FrozenQty - s.LockQty) > 0 && s.InspectStatus == "1").ToList();
-                //鑾峰彇搴撳瓨
-                var stockList = Db.Queryable<DataStock>().Where(s => skuNos.Contains(s.SkuNo) && (s.Qty - s.FrozenQty - s.LockQty) > 0).ToList();
-
-                string CustomerName = string.Empty;
-                if (!string.IsNullOrEmpty(model.Customer))
-                {
-                    //瀹㈡埛淇℃伅
-                    var customer = Db.Queryable<SysCustomer>().First(m => m.IsDel == "0" && m.CustomerNo == model.Customer);
-                    if (customer == null)
-                    {
-                        throw new Exception("瀹㈡埛淇℃伅涓嶅瓨鍦�!");
-                    }
-                    CustomerName = customer.CustomerName;
-                }
-                //鎵胯繍鍟嗕俊鎭�
-                var logistics = Db.Queryable<SysLogisticsInfo>().First(m => m.IsDel == "0" && m.CarrierName == model.LogisticsNo);
-                int? logisticsId = null;
-                if (logistics != null)
-                {
-                    logisticsId = logistics.Id;
-                }
                 var billNo = "";
                 var bl = true;
                 do
@@ -335,268 +526,126 @@
                 List<SoDetailInfo> soDetailList = new List<SoDetailInfo>();
                 //寮�鍚簨鍔�
                 Db.BeginTran();
-                try
+
+                var list = new List<BllExportNoticeDetail>();
+                //娣诲姞鍑哄簱鍗�
+                foreach (var d in model.SoDetails)
                 {
-                    var list = new List<BllExportNoticeDetail>();
-                    //娣诲姞鍑哄簱鍗�
-                    foreach (var d in model.SoDetails)
+                    if (d.Qty < 1)
                     {
-                        if (d.Qty < 1)
-                        {
-                            throw new Exception("鍑哄簱鏁伴噺蹇呴』澶т簬0");
-                        }
-                        var sku = skuList.FirstOrDefault(a => a.SkuNo == d.SkuNo);
-                        if (sku == null)
-                        {
-                            throw new Exception($"鐗╂枡淇℃伅涓湭鏌ヨ鍒板嚭搴撶墿鏂欎俊鎭�:{d.SkuNo}");
-                        }
-                        //0:鎴愬搧鍑哄簱銆�1:棰嗘枡鍑哄簱銆�3锛氱墿鏂欏彇鏍峰嚭搴撱��4:涓嶅悎鏍煎搧鍑哄簱銆�6:浠e偍鍑哄簱銆�7:鍏朵粬鍑哄簱銆� ///2:鎶芥鍑哄簱銆�5:涓棿鍝佸嚭搴撱��8:瀵勫瓨鍑哄簱
-                        if (model.SoType == "0" || model.SoType == "3" || model.SoType == "4" || model.SoType == "7")
-                        {
-                            if (string.IsNullOrWhiteSpace(d.LotNo))
-                            {
-                                throw new Exception("鎵规涓嶅彲涓虹┖!");
-                            }
-                        }
-                        //搴撳瓨鏄庣粏
-                        List<DataStockDetail> stockDetails;
-                        //鎸囧畾鎵规
-                        if (!string.IsNullOrWhiteSpace(d.LotNo))
-                        {
-                            stockDetails = stockDetailList.Where(s => s.SkuNo == d.SkuNo && s.LotNo == d.LotNo).ToList();
-                            if (stockDetails.Count < 1)
-                            {
-                                throw new Exception($"搴撳瓨涓湭鏌ヨ鍒板嚭搴撶墿鏂欎俊鎭�:{d.SkuNo}");
-                            }
-                            //鍒ゆ柇鏁伴噺
-                            var qty = stockDetails.Sum(s => s.Qty - s.FrozenQty - s.LockQty);
-                            if (d.Qty > qty)
-                            {
-                                throw new Exception($"鎬诲簱瀛樹腑鍑哄簱鐗╂枡淇℃伅:{d.SkuNo}銆亄d.LotNo} 搴撳瓨鏁伴噺涓嶈冻");
-                            }
-                            //搴撳瓨淇℃伅
-                            var stockInfo = stockList.First(w => w.SkuNo == d.SkuNo && w.LotNo == d.LotNo);
-                            if (stockInfo == null)
-                            {
-                                throw new Exception($"鎬诲簱瀛樹腑鏈煡璇㈠埌鍑哄簱鐗╂枡淇℃伅:{d.SkuNo}");
-                            }
-                            //鍒ゆ柇鎬诲簱瀛樻暟閲�
-                            if (d.Qty > stockInfo.Qty - stockInfo.FrozenQty - stockInfo.LockQty)
-                            {
-                                throw new Exception($"鎬诲簱瀛樹腑鍑哄簱鐗╂枡淇℃伅:{d.SkuNo}銆亄d.LotNo} 搴撳瓨鏁伴噺涓嶈冻");
-                            }
-                            //娣诲姞鍑哄簱鍗曟槑缁�
-                            var noticeDetail = new BllExportNoticeDetail()
-                            {
-                                SONo = billNo,
-                                SkuNo = sku.SkuNo,
-                                SkuName = sku.SkuName,
-                                Standard = sku.Standard,
-                                LotNo = d.LotNo,
-                                LotText = stockInfo.LotText,
-                                Qty = d.Qty,
-                                AllotQty = 0,
-                                FactQty = 0,
-                                CompleteQty = 0,
-                                PackagNo = sku.PackagNo,
-                                Price = sku.Price,
-                                Money = string.IsNullOrWhiteSpace(sku.Price.ToString()) ? null : sku.Price * d.Qty,
-                                IsBale = "",
-                                IsBelt = "",
-                                SupplierLot = stockInfo.SupplierLot,
-                                IsWave = "0",
-                                WaveNo = "",
-                                IsIssueLotNo = string.IsNullOrWhiteSpace(d.LotNo) ? "0" : "1",
-
-                                OrderDetailCode = d.OrderDetailCode,
-
-                                CreateUser = 0,
-                            };
-                            list.Add(noticeDetail);
-                            //鏇存柊搴撳瓨閿佸畾鏁伴噺
-                            stockInfo.LockQty += d.Qty;
-                            var i = Db.Updateable(stockInfo).UpdateColumns(it => new { it.LockQty }).ExecuteCommand();
-
-                            SoDetailInfo soDetail = new SoDetailInfo();
-                            soDetail.OrderDetailCode = d.OrderDetailCode;
-                            soDetail.LockQty = d.Qty;
-                            soDetail.LotNo = d.LotNo;
-
-                            soDetailList.Add(soDetail);
-                        }
-                        else//鏈寚瀹氭壒娆�
-                        {
-                            Dictionary<int, decimal> dic = new Dictionary<int, decimal>();
-                            decimal q1 = 0;
-                            //棣栧厛鏌ヨ褰撳墠杩欑鐗╂枡鎵规鍙蜂负绌虹殑
-                            stockDetails = stockDetailList.Where(s => s.SkuNo == d.SkuNo && string.IsNullOrWhiteSpace(s.LotNo)).ToList();
-                            if (stockDetails.Count > 0)
-                            {
-                                q1 = (decimal)stockDetails.Sum(s => s.Qty - s.FrozenQty - s.LockQty);
-                                //搴撳瓨淇℃伅
-                                var stockInfo = stockList.FirstOrDefault(w => w.SkuNo == d.SkuNo && string.IsNullOrWhiteSpace(w.LotNo));
-                                if (stockInfo != null)
-                                {
-                                    var q2 = stockInfo.Qty - stockInfo.FrozenQty - stockInfo.LockQty;
-                                    if (q2 < q1)
-                                    {
-                                        q1 = q2;
-                                    }
-                                    if (d.Qty > q1)
-                                    {
-                                        dic.Add(stockInfo.Id, q1);
-                                    }
-                                    else
-                                    {
-                                        dic.Add(stockInfo.Id, d.Qty);
-                                    }
-                                }
-                            }
-                            //濡傛灉鎵规鍙蜂负绌虹殑鏁伴噺涓嶅锛屾牴鎹壒娆″厛杩涘厛鍑哄師鍒欐煡鎵惧叾瀹冩壒娆$殑
-                            if (d.Qty > q1)
-                            {
-                                stockDetails = stockDetailList.Where(m => m.SkuNo == d.SkuNo && !string.IsNullOrWhiteSpace(m.LotNo)).OrderBy(s => s.LotNo).ToList();
-                                foreach (var demo in stockDetails)
-                                {
-                                    if (q1 >= d.Qty)
-                                    {
-                                        break;
-                                    }
-                                    var q2 = demo.Qty - demo.FrozenQty - demo.LockQty;
-                                    //搴撳瓨淇℃伅
-                                    var stockInfo = stockList.FirstOrDefault(w => w.SkuNo == d.SkuNo && w.LotNo == demo.LotNo);
-                                    if (stockInfo == null)
-                                    {
-                                        continue;
-                                    }
-                                    decimal q4 = 0;
-                                    if (dic.ContainsKey(stockInfo.Id))
-                                    {
-                                        q4 = dic[stockInfo.Id];
-                                    }
-                                    var q3 = stockInfo.Qty - stockInfo.FrozenQty - stockInfo.LockQty - q4;
-                                    if (q3 < q2)
-                                    {
-                                        q2 = q3;
-                                    }
-                                    if (q2 > d.Qty - q1)
-                                    {
-                                        if (!dic.ContainsKey(stockInfo.Id))
-                                        {
-                                            dic.Add(stockInfo.Id, d.Qty - q1);
-                                        }
-                                        else
-                                        {
-                                            //鏇存柊鍊�
-                                            dic[stockInfo.Id] += d.Qty - q1;
-                                        }
-                                        q1 += d.Qty - q1;
-                                    }
-                                    else
-                                    {
-                                        if (!dic.ContainsKey(stockInfo.Id))
-                                        {
-                                            dic.Add(stockInfo.Id, (decimal)q2);
-                                        }
-                                        else
-                                        {
-                                            //鏇存柊鍊�
-                                            dic[stockInfo.Id] = dic[stockInfo.Id] + (decimal)q2;
-                                        }
-                                        q1 += (decimal)q2;
-                                    }
-                                }
-                            }
-                            if (d.Qty > q1)
-                            {
-                                throw new Exception($"鎬诲簱瀛樹腑鍑哄簱鐗╂枡淇℃伅:{d.SkuNo} 搴撳瓨鏁伴噺涓嶈冻");
-                            }
-                            foreach (var s in dic)
-                            {
-                                var st = stockList.First(a => a.Id == s.Key);
-                                var item = new BllExportNoticeDetail()
-                                {
-                                    SONo = billNo,
-                                    OrderDetailCode = d.OrderDetailCode,
-                                    SkuNo = sku.SkuNo,
-                                    SkuName = sku.SkuName,
-                                    Standard = sku.Standard,
-                                    LotNo = st.LotNo,
-                                    LotText = st.LotText,
-                                    Qty = s.Value,
-                                    AllotQty = 0,
-                                    FactQty = 0,
-                                    CompleteQty = 0,
-                                    PackagNo = sku.PackagNo,
-                                    Price = sku.Price,
-                                    Money = string.IsNullOrWhiteSpace(sku.Price.ToString()) ? null : sku.Price * d.Qty,
-                                    IsBale = "",
-                                    IsBelt = "",
-                                    SupplierLot = st.SupplierLot,
-                                    IsWave = "0",
-                                    WaveNo = "",
-                                    IsIssueLotNo = string.IsNullOrWhiteSpace(d.LotNo) ? "0" : "1",
-
-                                    CreateUser = 0,
-                                };
-                                list.Add(item);
-
-                                st.LockQty += s.Value;//閿佸畾鏁伴噺
-                                var i = Db.Updateable(st).UpdateColumns(it => new { it.LockQty }).ExecuteCommand();
-
-                                SoDetailInfo soDetail = new SoDetailInfo();
-                                soDetail.OrderDetailCode = d.OrderDetailCode;
-                                soDetail.LockQty = s.Value;
-                                soDetail.LotNo = st.LotNo;
-
-                                soDetailList.Add(soDetail);
-                            }
-                        }
+                        throw new Exception("鍑哄簱鏁伴噺蹇呴』澶т簬0");
                     }
-                    var notice = new BllExportNotice()
+                    if (string.IsNullOrWhiteSpace(d.LotNo))
+                    {
+                        throw new Exception("鎵规涓嶅彲涓虹┖!");
+                    }
+                    //搴撳瓨鏄庣粏
+                    List<DataStockDetail> stockDetails = stockDetailList.Where(s => s.SkuNo == d.SkuNo && s.LotNo == d.LotNo).OrderByDescending(o => o.CompleteTime).ToList();
+                    if (stockDetails.Count < 1)
+                    {
+                        throw new Exception($"搴撳瓨涓湭鏌ヨ鍒板嚭搴撶墿鏂欎俊鎭�:{d.SkuNo}");
+                    }
+                    //鍒ゆ柇鏁伴噺
+                    var qty = stockDetails.Sum(s => s.Qty - s.FrozenQty - s.LockQty);
+                    if (d.Qty > qty)
+                    {
+                        throw new Exception($"搴撳瓨涓嚭搴撶墿鏂欎俊鎭�:{d.SkuNo}銆亄d.LotNo} 搴撳瓨鏁伴噺涓嶈冻");
+                    }
+                    //娣诲姞鍑哄簱鍗曟槑缁�
+                    var noticeDetail = new BllExportNoticeDetail()
                     {
                         SONo = billNo,
-                        OrderCode = model.OrderCode,
-                        Type = model.SoType,
-                        Status = "0",
-                        Origin = "WMS",
-                        CustomerNo = model.Customer,
-                        CustomerName = CustomerName,
-                        LogisticsId = logisticsId,
+                        SkuNo = d.SkuNo,
+                        SkuName = d.SkuName,
+                        Standard = "",
+                        LotNo = d.LotNo,
+                        LotText = "",
+                        Qty = d.Qty,
+                        AllotQty = 0,
+                        FactQty = 0,
+                        CompleteQty = 0,
+                        PackagNo = "",
+                        Price = 0,
+                        Money = 0,
+                        IsBale = "",
+                        IsBelt = "",
+                        SupplierLot = "",
                         IsWave = "0",
                         WaveNo = "",
-                        IsDespatch = "0",
+                        IsIssueLotNo = "1",
+
+                        OrderDetailCode = d.OrderDetailCode,
 
                         CreateUser = 0,
                     };
-
-                    var n = Db.Insertable<BllExportNotice>(notice).ExecuteCommand();
-                    var m = Db.Insertable<BllExportNoticeDetail>(list).ExecuteCommand();
-
-                    if (n <= 0 || m <= 0)
+                    list.Add(noticeDetail);
+                    //閿佸畾搴撳瓨鏁伴噺
+                    decimal lockQty = 0;
+                    foreach (var item in stockDetails)
                     {
-                        Db.RollbackTran();
-                        throw new Exception("鎿嶄綔澶辫触");
+                        if (lockQty >= d.Qty)
+                        {
+                            break;
+                        }
+                        if (item.Qty - item.LockQty - item.FrozenQty <= d.Qty - lockQty)
+                        {
+                            item.LockQty += item.Qty - item.LockQty - item.FrozenQty;
+                            lockQty += (decimal)(item.Qty - item.LockQty - item.FrozenQty);
+                        }
+                        else
+                        {
+                            item.LockQty += d.Qty - lockQty;
+                            lockQty += d.Qty - lockQty;
+                        }
+                        Db.Updateable(item).UpdateColumns(it => new { it.LockQty }).ExecuteCommand();
                     }
-                    Db.CommitTran();
-                    //鍥炰紶涓婃父绯荤粺閿佸畾鏁伴噺淇℃伅
-                    result.Success = "0";
-                    result.Message = "鎿嶄綔鎴愬姛";
-                    result.SoDetails = soDetailList;
-                    return result;
 
+                    SoDetailInfo soDetail = new SoDetailInfo();
+                    soDetail.OrderDetailCode = d.OrderDetailCode;
+                    soDetail.LockQty = d.Qty;
+                    soDetail.LotNo = d.LotNo;
+
+                    soDetailList.Add(soDetail);
                 }
-                catch (Exception ex)
+                //鍑哄簱鍗曚俊鎭�
+                var notice = new BllExportNotice()
+                {
+                    SONo = billNo,
+                    OrderCode = model.OrderCode,
+                    Type = model.SoType,
+                    Status = "0",
+                    Origin = "WMS",
+                    CustomerNo = model.Customer,
+                    CustomerName = "",
+                    LogisticsId = null,
+                    IsWave = "0",
+                    WaveNo = "",
+                    IsDespatch = "0",
+
+                    CreateUser = 0,
+                };
+
+                var n = Db.Insertable<BllExportNotice>(notice).ExecuteCommand();
+                var m = Db.Insertable<BllExportNoticeDetail>(list).ExecuteCommand();
+
+                if (n <= 0 || m <= 0)
                 {
                     Db.RollbackTran();
-                    throw new Exception(ex.Message);
+                    throw new Exception("鎿嶄綔澶辫触");
                 }
+                //鎻愪氦浜嬪姟
+                Db.CommitTran();
+                //鍥炰紶涓婃父绯荤粺閿佸畾鏁伴噺淇℃伅
+                result.Success = "0";
+                result.Message = "鎿嶄綔鎴愬姛";
+                result.SoDetails = soDetailList;
+                return result;
             }
             catch (Exception ex)
             {
                 Db.RollbackTran();
                 throw new Exception(ex.Message);
             }
-        }*/
+        }
     }
 }
diff --git a/Wms/WMS.Entity/DataEntity/DataStockDetail.cs b/Wms/WMS.Entity/DataEntity/DataStockDetail.cs
index 49e77d1..e742d8e 100644
--- a/Wms/WMS.Entity/DataEntity/DataStockDetail.cs
+++ b/Wms/WMS.Entity/DataEntity/DataStockDetail.cs
@@ -208,6 +208,12 @@
         public DateTime? ExpirationTime {get;set;}
 
         /// <summary>
+        /// 鎵樼洏鐘舵��
+        /// Default:0锛氬噣妗� 1锛氶娣� 2锛氬崐鎴愬搧 3锛氳剰妗�
+        /// </summary>
+        public string PalletStatus { get; set; }
+
+        /// <summary>
         /// Desc:鐘舵��
         /// Default:0锛氬緟鍒嗛厤 1锛氶儴鍒嗗垎閰�  2锛氬凡鍒嗛厤 3锛氱洏鐐归攣瀹� 4锛氱Щ搴撻攣瀹�
         /// Nullable:True
diff --git a/Wms/WMS.Entity/LogEntity/LogTask.cs b/Wms/WMS.Entity/LogEntity/LogTask.cs
index d3a679b..3ca8f92 100644
--- a/Wms/WMS.Entity/LogEntity/LogTask.cs
+++ b/Wms/WMS.Entity/LogEntity/LogTask.cs
@@ -20,9 +20,9 @@
         public string TaskNo {get;set;}
 
         /// <summary>
-        /// 鍏ュ簱鏄庣粏鍙�
+        /// 鍏ュ簱\鍑哄簱鍗曟槑缁嗗彿
         /// </summary>
-        public int ASNDetailNo { get; set; }
+        public int NoticeDetailNo { get; set; }
 
         /// <summary>
         /// Desc:鍙戦�佹柟
diff --git a/Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs b/Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs
index 48c013b..5354775 100644
--- a/Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs
+++ b/Wms/WMS.IBLL/IBllTransServer/INoticeServer.cs
@@ -7,6 +7,26 @@
 {
     public interface INoticeServer
     {
+        /// <summary>
+        /// 涓嬪彂鍏ュ簱鍗�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
         public ErpModel CreateAsn(AsnInfo model);
+
+        /// <summary>
+        /// 浠诲姟瀹屾垚
+        /// </summary>
+        /// <param name="TaskNo"></param>
+        /// <param name="Status"></param>
+        /// <returns></returns>
+        public ErpModel FinishTask(string TaskNo, string Status);
+
+        /// <summary>
+        /// 涓嬪彂鍑哄簱鍗�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public SoResInfo ErpAddExportNotice(SoInfo model);
     }
 }

--
Gitblit v1.8.0