From fc2b395e10c968f4bcf540613538265655b7a15e Mon Sep 17 00:00:00 2001
From: chengsc <11752@DESKTOP-DS49RCP>
Date: 星期四, 08 五月 2025 16:47:07 +0800
Subject: [PATCH] 修改问题

---
 Wms/WMS.BLL/HttpServer.cs                       |  424 +++++++++++++++++++++++
 Wms/WMS.IBLL/IHttpServer.cs                     |   20 +
 Pda/View/AsnSetting/requestRuku.html            |   88 +---
 Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs        |    9 
 Pda/View/AsnSetting/LocationOptimize.html       |  225 ++++++++++++
 Wms/Wms/Controllers/PdaAsnController.cs         |   29 +
 Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs |    7 
 Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs        |  167 +++++++++
 Wms/WMS.Entity/BllAsnEntity/BllPalletUpShelf.cs |    2 
 Wms/Wms/Controllers/DownApiController.cs        |    6 
 Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs    |  103 -----
 11 files changed, 906 insertions(+), 174 deletions(-)

diff --git a/Pda/View/AsnSetting/LocationOptimize.html b/Pda/View/AsnSetting/LocationOptimize.html
new file mode 100644
index 0000000..76423b8
--- /dev/null
+++ b/Pda/View/AsnSetting/LocationOptimize.html
@@ -0,0 +1,225 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta name="viewport" content="user-scalable=0,width=device-width,initial-scale=1.0" />
+    <meta charset="UTF-8" />
+    <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665, minimum-scale=0.5, maximum-scale=1, user-scalable=no" /> -->
+    <!-- <meta name="viewport" content="width=device-width, initial-scale=0.665" /> -->
+    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
+    <title>Boxline PDA</title>
+
+    <link rel="stylesheet" href="/layui/css/layui.css" />
+    <link rel="stylesheet" href="/css/style.css" />
+    <script src="/js/adaptive.js"></script>
+    <link rel="stylesheet" href="/css/my.css" />
+    <style type="text/css">
+        td {
+            word-break: break-all;
+            word-wrap: break-word;
+        }
+
+        .layui-form-switch {
+            margin-top: 0;
+        }
+
+        /* 鏍囩鏍峰紡 */
+        .tableyang-this a {
+            margin: 10px 10px 0px 0px;
+            line-height: 30px;
+            width: 100px;
+            color: #999;
+            text-align: center;
+            float: left;
+            background: #f7f7f7;
+            user-select: none;
+            position: relative;
+            z-index: 1;
+            cursor: pointer;
+            border-radius: 5px;
+            border: 1px solid #ccc;
+            transition: all 0.3s ease;
+        }
+
+        .tableyang-this a.hover {
+            color: #5298ff;
+            background-color: #eff2ff;
+            border: 1px solid #5298ff;
+        }
+
+        /* 鍐呭灞呬腑 */
+        .tableyang-tab {
+            display: flex;
+            /* justify-content: center; */
+            /* align-items: center; */
+            flex-direction: column;
+            height: 90vh;
+        }
+
+        /* 蹇呯敤鏍峰紡 */
+        .tableyang-2,
+        .tableyang-3 {
+            display: none;
+        }
+
+        ul {
+            list-style-type: none;
+            padding: 0;
+        }
+
+        li {
+            cursor: pointer;
+            background-color: lightgray;
+            padding: 10px;
+            margin-bottom: 5px;
+        }
+    </style>
+    <link rel="stylesheet" href="/css/adapter.css" />
+    <script src="../../js/jquery.js"></script>
+    <script src="../../js/jquery-3.5.1.min.js"></script>
+</head>
+
+<body>
+    <div id="" class="main-content">
+
+        <div id="" class="layout-title">
+            <table border="" cellspacing="" cellpadding="">
+                <tr>
+                    <td class="img-back"><a href="../index.html"><img src="/assets/back.jpg"></a></td>
+                    <td class="title-text" lang>搴撲綅宸烽亾</td>
+                    <td class="title-menu-icon"><img id="menuImg" src="/assets/menu.jpg"></td>
+                </tr>
+            </table>
+        </div>
+
+        <div id="" class="layout-sub-content">
+            <div id="menuList" class="menu">
+                <ul class="" style="text-align: center;">
+                    <li><a href="../index.html" lang>涓婚〉</a></li>
+                    <!-- <li><a href="productEnterConfirm.html">鍏ュ簱淇℃伅纭</a></li> -->
+                    <li><a href="../login.html" lang>閲嶆柊鐧诲綍</a></li>
+                </ul>
+            </div>
+
+            <!-- 鏃犵爜 -->
+            <div id="content2">
+                <div id="zongDiv" class="layout-bill-info" style="height: 150px;">
+                    <form class="layui-form" id="form2" action="">
+                        <div id="" class="layui-form-item layout-input">
+                            <label class="layui-form-label">鎵樼洏鐮�</label>
+                            <div class="layui-input-block">
+                                <input id="pln" type="text" placeholder=""
+                                    autocomplete="off" class="layui-input" >
+                            </div>
+                        </div>
+                        <div id="" class="layui-form-item layout-input">
+                            <label class="layui-form-label">鍌ㄤ綅鐮�</label>
+                            <div class="layui-input-block">
+                                <input id="locateNo" type="text" placeholder=""
+                                    autocomplete="off" class="layui-input" >
+                            </div>
+                        </div>             
+
+                        <table class="layout-tbl-submit" border="" cellspacing="" cellpadding="">
+                            <tr>
+                                <td style="width: 30%;"></td>
+                                <td style="width: 40%;">
+                                    <button class="layout-btn layout-btn-blue" lang type="button" lay-submit
+                                        lay-filter="formCall1">鎸囧畾</button>
+                                </td>
+                                <td style="width: 30%;"></td>
+
+                            </tr>
+                        </table>
+
+                    </form>
+                </div>
+
+                <br>
+
+
+            </div>
+
+        </div>
+    </div>
+    <script src="/js/jquery-3.5.1.min.js"></script>
+    <script src="/layui/layui.js"></script>
+    <script src="/js/public.js"></script>
+    <script src="/js/language.js"></script>
+    <script src="/js/jquery.cookie.js"></script>
+    <script>
+        layui.use(['form', 'jquery'], function () {
+            var form = layui.form
+
+            /*鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��*/
+            $("#TaskNo").val(""); 
+            $("#TaskId").val("");
+            initLanguage()
+            setLanguage()
+
+            form.on('submit(formCall1)', function (data) {
+                if ($("#pln").val() == "") {
+                    layer.msg('鎵樼洏鐮佷笉鑳戒负绌�', {
+                        icon: 2,
+                        time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                    });
+                    return;
+                }
+                if ($("#locateNo").val() == "") {
+                    layer.msg('鍌ㄤ綅涓嶈兘涓虹┖', {
+                        icon: 2,
+                        time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                    });
+                    return;
+                }
+                var param = {
+                    PalletNo: $("#pln").val(),
+					LocatNo:$("#locateNo").val()
+                }
+                //鍛煎彨灏忚溅
+                sendData(IP + "/PdaAsn/SaveAppointLocate", param, 'post', function (res) {
+                    if (res.Success == "0") { //鎴愬姛 
+                        layer.msg(res.Message, {
+                            icon: 1,
+                            time: 1000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                        }, function () {
+                            $("#pln").val(""),
+                            $("#locateNo").val("")
+                        });
+                    } else { //涓嶆垚鍔�
+                        layer.msg(res.Message, {
+                            icon: 2,
+                            time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                        }, function () {
+                            $("#pln").val(""),
+                            $("#locateNo").val("")
+                        });
+                    }
+                });
+                 
+
+                return false; //闃绘琛ㄥ崟璺宠浆銆傚鏋滈渶瑕佽〃鍗曡烦杞紝鍘绘帀杩欐鍗冲彲銆�
+            });
+            
+            /*鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��*/
+
+
+            $("#menuImg").click(function (e) {
+                //console.log("menuImg")
+                e.stopPropagation()
+
+                if ($("#menuList").is(":hidden")) {
+                    $("#menuList").show()
+                } else {
+                    $("#menuList").hide()
+                }
+            })
+            $('body').click(function () {
+                // //console.log("body")
+                $("#menuList").hide()
+            })
+        })
+    </script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/Pda/View/AsnSetting/requestRuku.html b/Pda/View/AsnSetting/requestRuku.html
index 309c5ab..3c66790 100644
--- a/Pda/View/AsnSetting/requestRuku.html
+++ b/Pda/View/AsnSetting/requestRuku.html
@@ -209,56 +209,6 @@
 				});
 			}
 
-			//鐢宠宸烽亾
-			form.on('submit(requestRoadway)', function (data) {
-				if (!$("#PalletNo").val()) {
-					layer.msg('璇锋壂鎻忔墭鐩樻潯鐮�', {
-						icon: 2,
-						time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-					});
-					return;
-				}
-				var param = {
-					PalletNo: $("#PalletNo").val(),
-					HouseNo:"W01"
-				}
-				sendData(IP + "/PdaAsn/RequestRoadWay", param, 'post', function (res) {
-					if (res.code == 0) { //鎴愬姛 
-						layer.msg(res.msg, {
-							icon: 1,
-							time: 2500 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-						}, function () {
-							var statusVal='';
-							if(res.data.Status=="0"){
-								statusVal='绛夊緟涓婃灦';
-							}else if(res.data.Status=="1"){
-								statusVal='姝e湪涓婃灦';
-							}else if(res.data.Status=="2"){
-								statusVal='涓婃灦瀹屾垚';
-							}else if(res.data.Status=="3"){
-								statusVal='宸插彇娑�';
-							}else{
-								statusVal='鏈笂鏋�';
-							}
-							$("#Status").val(statusVal);
-							$("#SkuNo").val(res.data.SkuNo+"-"+res.data.SkuName);
-							$("#LotNo").val(res.data.LotNo);
-							$("#RoadwayNo").val(res.data.RoadwayNo);
-							$("#LocatNo").val(res.data.LocatNo);
-						});
-					} else { //涓嶆垚鍔�
-						layer.msg(res.msg, {
-							icon: 2,
-							time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-						}, function () {
-							//鍥炶皟
-							clearTable();
-						});
-					}
-				});
-				return false; //闃绘琛ㄥ崟璺宠浆銆傚鏋滈渶瑕佽〃鍗曡烦杞紝鍘绘帀杩欐鍗冲彲銆�
-			});
-
 			//鐢宠鍌ㄤ綅
 			form.on('submit(requestLocat)', function (data) {
 				if (!$("#PalletNo").val()) {
@@ -273,28 +223,28 @@
 					HouseNo:"W02"
 				}
 				sendData(IP + "/DownApi/RequestLocation", param, 'post', function (res) {
-					if (res.Success == 0) { //鎴愬姛 
-						layer.msg(res.msg, {
+					if (res.Success == "0") { //鎴愬姛 
+						layer.msg(res.Message, {
 							icon: 1,
 							time: 2500 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
 						}, function () {
-							var statusVal='';
-							if(res.data.Status=="0"){
-								statusVal='绛夊緟涓婃灦';
-							}else if(res.data.Status=="1"){
-								statusVal='姝e湪涓婃灦';
-							}else if(res.data.Status=="2"){
-								statusVal='涓婃灦瀹屾垚';
-							}else if(res.data.Status=="3"){
-								statusVal='宸插彇娑�';
-							}else{
-								statusVal='鏈笂鏋�';
-							}
-							$("#Status").val(statusVal);
-							$("#SkuNo").val(res.data.SkuNo+"-"+res.data.SkuName);
-							$("#LotNo").val(res.data.LotNo);
-							$("#RoadwayNo").val(res.data.RoadwayNo);
-							$("#LocatNo").val(res.data.LocatNo);
+							// var statusVal='';
+							// if(res.data.Status=="0"){
+							// 	statusVal='绛夊緟涓婃灦';
+							// }else if(res.data.Status=="1"){
+							// 	statusVal='姝e湪涓婃灦';
+							// }else if(res.data.Status=="2"){
+							// 	statusVal='涓婃灦瀹屾垚';
+							// }else if(res.data.Status=="3"){
+							// 	statusVal='宸插彇娑�';
+							// }else{
+							// 	statusVal='鏈笂鏋�';
+							// }
+							// $("#Status").val(statusVal);
+							// $("#SkuNo").val(res.data.SkuNo+"-"+res.data.SkuName);
+							// $("#LotNo").val(res.data.LotNo);
+							// $("#RoadwayNo").val(res.data.RoadwayNo);
+							// $("#LocatNo").val(res.data.LocatNo);
 						});
 					} else { //涓嶆垚鍔�
 						layer.msg(res.Message, {
diff --git a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
index f5c6885..d088c20 100644
--- a/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
+++ b/Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -2589,21 +2589,21 @@
                 try
                 {
                     var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss")
-                    response = HttpHelper.DoPost(url, jsonData, "涓嬪彂缁橶CS鍏ュ簱鍛戒护", "WCS");
+                    //response = HttpHelper.DoPost(url, jsonData, "涓嬪彂缁橶CS鍏ュ簱鍛戒护", "WCS");
                     var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss")
                     var list = new List<string>() { model.TaskNo };
-                    //瑙f瀽杩斿洖鏁版嵁 
-                    var wcsModel = JsonConvert.DeserializeObject<WcsModel2>(response);
-                    if (wcsModel.code == 200)
-                    {
+                    ////瑙f瀽杩斿洖鏁版嵁 
+                    //var wcsModel = JsonConvert.DeserializeObject<WcsModel2>(response);
+                    //if (wcsModel.code == 200)
+                    //{
                         //鏇存敼浠诲姟鐨勫彂閫佽繑鍥炴椂闂�//
                         new TaskServer().EditTaskIssueOk(list, time1, time2);
 
-                    }else
-                    {
-                        new TaskServer().EditTaskIssueNo(list, time1, time2, wcsModel.message);
-                        throw new Exception("WCS鍙嶉锛�"+wcsModel.message);
-                    }
+                    //}else
+                    //{
+                    //    new TaskServer().EditTaskIssueNo(list, time1, time2, wcsModel.message);
+                    //    throw new Exception("WCS鍙嶉锛�"+wcsModel.message);
+                    //}
                 }
                 catch (Exception ex)
                 {
@@ -2616,85 +2616,7 @@
             }
         }
 
-        /// <summary>
-        /// 鍏ュ簱浠诲姟瀹屾垚JC34
-        /// </summary>
-        /// <param name="taskNo"></param>
-        /// <param name="userId"></param>
-        /// <exception cref="Exception"></exception>
-        public void ArrivalSuccess2(string taskNo, int userId)
-        {
-            try
-            {
-                //姝e父鍏ュ簱 
-                var task = Db.Queryable<LogTask>().First(m => m.IsDel == "0" && m.TaskNo == taskNo);
-                if (task == null)
-                {
-                    throw new Exception("鏈煡璇㈠埌浠诲姟淇℃伅");
-                }
-                if (task.Status == "2")
-                {
-                    throw new Exception("褰撳墠浠诲姟宸插畬鎴�");
-                }
-
-                var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.PalletNo == task.PalletNo).ToList();
-                var upShelf = Db.Queryable<BllPalletUpShelf>().First(m => m.TaskNo == taskNo);
-                if (upShelf == null)
-                {
-                    throw new Exception("娌℃湁鎵惧埌鎵樼洏涓婃灦淇℃伅");
-                }
-                //褰撳墠浠诲姟涓殑鍌ㄤ綅淇℃伅
-                var locate = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == task.EndLocat);
-                if (locate == null)
-                {
-                    throw new Exception($"鏈煡璇㈠埌浠诲姟涓殑鍌ㄤ綅淇℃伅");
-                }
-                Db.BeginTran();
-
-                task.Status = "2";//浠诲姟鐘舵��
-                task.IsSend = 0;
-                task.IsCancel = 0;
-                task.IsFinish = 0;
-                task.FinishDate = DateTime.Now;//瀹屾垚鏃堕棿
-                Db.Updateable(task).ExecuteCommand();
-                if (userId != 0)
-                {
-                    //娣诲姞鎿嶄綔鏃ュ織璁板綍
-                    var k = new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鍏ュ簱鏃ュ織", taskNo, "瀹屾垚", $"鐐瑰嚮瀹屾垚鎸夐挳銆佸畬鎴愪换鍔″彿涓猴細{taskNo}鐨勪换鍔�", userId);
-                }
-
-                //鍒ゆ柇鏄惁鏄洖娴佸叆搴撳畬鎴�
-                if (stockDetail.Any())
-                {
-                    throw new Exception("娌℃湁鏌ヨ鍒板簱瀛樹俊鎭�");
-                }
-
-                foreach (var item in stockDetail)
-                {
-                    item.WareHouseNo = locate.WareHouseNo;
-                    item.RoadwayNo = locate.RoadwayNo;
-                    item.AreaNo = locate.AreaNo;
-                    item.LocatNo = locate.LocatNo;
-                    item.UpdateTime = DateTime.Now;
-                    if (userId != 0)
-                    {
-                        item.UpdateUser = userId;
-                    }
-                }
-                upShelf.Status = "2";
-                Db.Updateable(upShelf).ExecuteCommand();
-
-                locate.Status = "1";
-                Db.Updateable(locate).ExecuteCommand();
-                Db.Updateable(stockDetail).ExecuteCommand();
-                Db.CommitTran();
-
-            }
-            catch (Exception e)
-            {
-                throw new Exception(e.Message);
-            }
-        }
+        
 
         #endregion
 
@@ -4330,7 +4252,8 @@
                 var upShelfList = Db.Queryable<BllPalletUpShelf>().Where(m => m.IsDel == "0" && m.TaskNo == taskNo && m.PalletNo == task.PalletNo).ToList();
                 foreach (var upShelf in upShelfList)
                 {
-                    upShelf.IsDel = "1";
+                    //upShelf.IsDel = "1";
+                    upShelf.Status = "4";
                     Db.Updateable(upShelf).ExecuteCommand();
                 } 
 
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
index 57367dd..c5960a5 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaAsnServer.cs
@@ -21,6 +21,7 @@
 using Model.ModelDto.DataDto;
 using System.Xml.Schema;
 using ZXing.OneD;
+using System.Threading.Tasks;
 
 namespace WMS.BLL.BllPdaServer
 {
@@ -1897,6 +1898,172 @@
             }
         }
 
+        /// <summary>
+        /// 淇濆瓨鎸囧畾鐨勫偍浣�
+        /// </summary>
+        /// <param name="palletNo"></param>
+        /// <param name="locateNo"></param>
+        /// <param name="userId"></param>
+        /// <exception cref="Exception"></exception>
+        public void SaveAppointLocate(string palletNo, string locateNo, int userId)
+        {
+            try
+            {
+                //鎵樼洏搴撳瓨淇℃伅
+                var stockDetailList = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.PalletNo == palletNo).ToList();
+                if (stockDetailList.Count(m=> string.IsNullOrWhiteSpace(m.LocatNo)) > 0)
+                {
+                    throw new Exception("鎵樼洏娌℃湁鍦ㄥ钩搴撳偍浣嶄笂");
+                }
+                //鍒ゆ柇鎵樼洏鐨勫偍浣嶆槸鍚︽槸骞冲簱
+                var stockDetail = stockDetailList.First();
+                var oldLocate = stockDetail.LocatNo;
+                var pingAreaStr = Db.Queryable<SysStorageArea>().Where(m => m.IsDel == "0" && m.WareHouseNo == "W04" && m.AreaNo != "B06" && m.AreaNo != "B07").Select(m => m.AreaNo).ToList();
+                var pingLocateInfo = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == oldLocate && pingAreaStr.Contains(m.AreaNo) && m.IsDel == "0");
+                if (pingLocateInfo == null)
+                {
+                    throw new Exception("褰撳墠鎵樼洏鎵�鍦ㄧ殑鍌ㄤ綅娌℃湁鍦ㄧ郴缁熶腑鎵惧埌淇℃伅");
+                }
+
+                var skuList = Db.Queryable<SysMaterials>().Where(m => m.IsDel == "0").ToList();
+                //楠岃瘉鐗╂枡鏄惁鏈夋垚鍝�
+                foreach (var item in stockDetailList)
+                {
+                    var skuItem = skuList.First(m => m.SkuNo == item.SkuNo);
+                    if (skuItem.Type == "2")
+                    {
+                        throw new Exception("鎴愬搧鐗╂枡璇峰叆鎴愬搧搴�");
+                    }
+                }
+                //鍌ㄤ綅
+                var locate = Db.Queryable<SysStorageLocat>().First(m => m.IsDel == "0" && m.LocatNo == locateNo);
+                if (locate == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌鍌ㄤ綅鐨勪俊鎭�");
+                }
+                if (locate.WareHouseNo != "W02")
+                {
+                    throw new Exception("鍙兘鎸囧畾绔嬪簱鐨勫偍浣�");
+                }
+                if (locate.Status != "0" || locate.Flag != "0")
+                {
+                    throw new Exception("璇ュ偍浣嶇姸鎬佷笉鏄┖鍌ㄤ綅鎴栨爣蹇椾笉鏄甯哥殑");
+                }
+
+
+                Db.BeginTran();
+                try
+                {
+                    var time = DateTime.Now;
+                    //鍒ゆ柇褰撳墠鎵樼洏鏄惁瀛樺湪缁戝畾淇℃伅
+                    var task = Db.Queryable<LogTask>().First(m=> m.IsDel == "0" && m.PalletNo == palletNo && (m.Status == "0" || m.Status == "1") && m.OrderType == "0" && m.Type == "0");
+                    
+                    var upShelf = Db.Queryable<BllPalletUpShelf>().First(m => m.IsDel == "0" && m.PalletNo == palletNo && (m.Status == "0" || m.Status == "1"));
+                    if (task != null)
+                    {
+                        if (task.Status == "1")
+                        {
+                            throw new Exception("鎵樼洏姝e湪鎵ц浠诲姟锛屼笉鍙寚瀹氬偍浣�");
+                        }
+                        if (task.Status == "0")
+                        {
+                            if (upShelf != null)
+                            {
+                                if (upShelf.Status == "1")
+                                {
+                                    throw new Exception("鎵樼洏姝e湪鎵ц涓婃灦浠诲姟锛屼笉鍙寚瀹氬偍浣�");
+                                }
+                                if (upShelf.Status == "0")
+                                {
+                                    if (locate.LocatNo == task.EndLocat)
+                                    {
+                                        throw new Exception("宸叉寚瀹氬偍浣嶏紝鏃犻渶閲嶅鎸囧畾");
+                                    }
+                                    //閲嶆柊鎸囧畾鍌ㄤ綅
+                                    task.EndLocat = locate.LocatNo;
+                                    task.EndRoadway = locate.RoadwayNo;
+                                    upShelf.LocatNo = locate.LocatNo;
+                                    upShelf.RoadwayNo = locate.RoadwayNo;
+                                    Db.Updateable(task).ExecuteCommand();
+                                    Db.Updateable(upShelf).ExecuteCommand();
+                                    new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鎸囧畾鍌ㄤ綅", palletNo, "缂栬緫", $"鎸囧畾浜嗗偍浣嶏細{locate.LocatNo}銆佹墭鐩樼爜锛歿palletNo}鐨勪俊鎭�", userId);
+                                    Db.CommitTran();
+                                    return;
+                                }
+                            }
+                            else
+                            {
+                                throw new Exception("鏌ヨ鍑轰换鍔′絾娌℃湁涓婃灦璁板綍锛屼俊鎭敊璇�");
+                            }
+                        }
+                    }
+
+                    // 娣诲姞鍏ュ簱鏃ュ織璁板綍
+                    var taskNo = new Common().GetMaxNo("TK");
+                    var addTask = new LogTask    //鍏ュ簱浠诲姟
+                    {
+                        TaskNo = taskNo,
+                        Sender = "WMS",
+                        Receiver = "WCS",
+                        IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+                        SendDate = DateTime.Now,  //鍙戦�佹椂闂�
+                        //BackDate = DateTime.Now,  //杩斿洖鏃堕棿
+                        StartRoadway = "",            // 璧峰宸烽亾
+                        StartLocat = oldLocate,//璧峰浣嶇疆
+                        EndLocat = locate.LocatNo,//鐩爣浣嶇疆
+                        EndRoadway = locate.RoadwayNo,  // 鐩爣宸烽亾
+                        PalletNo = palletNo,//鎵樼洏鐮�
+                        IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+                        IsCancel = 1,//鏄惁鍙彇娑�
+                        IsFinish = 1,//鏄惁鍙畬鎴�
+                        Type = "0",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟  2 绉诲簱浠诲姟
+                        Status = "0",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+                        OrderType = "0",//0 鍏ュ簱鍗� 1 鍑哄簱鍗�  2 鐩樼偣鍗�  3 绉诲簱鍗�
+                        Msg = $"{oldLocate}鍒�=>>{locate.LocatNo}鐨勫叆搴撲换鍔�", //鍏抽敭淇℃伅
+
+                    };
+                    Db.Insertable(addTask).ExecuteCommand();
+
+                    //娣诲姞鎵樼洏涓婃灦璁板綍
+                    var upShelfAdd = new BllPalletUpShelf()
+                    {
+                        TaskNo = addTask.TaskNo,
+                        TraceNo = "",
+                        PalletNo = palletNo,
+                        SkuNo = stockDetail.SkuNo,
+                        SkuName = stockDetail.SkuName,
+                        LotNo = stockDetail.LotNo,
+                        Status = "0",
+
+                        WareHouseNo = locate.WareHouseNo,
+                        RoadwayNo = locate.RoadwayNo,
+                        AreaNo = locate.AreaNo,
+                        LocatNo = locate.LocatNo,
+
+                        CreateUser = 0,
+                    };
+                    Db.Insertable(upShelfAdd).ExecuteCommand();
+
+                    locate.Status = "2";
+
+                    Db.Updateable(locate).ExecuteCommand();
+
+                    new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鎸囧畾鍌ㄤ綅", palletNo, "缂栬緫", $"鎸囧畾浜嗗偍浣嶏細{locate.LocatNo}銆佹墭鐩樼爜锛歿palletNo}鐨勪俊鎭�", userId);
+                    Db.CommitTran();
+                }
+                catch (Exception e)
+                {
+                    Db.RollbackTran();
+                    throw new Exception(e.Message);
+                }
+
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+            }
+        }
+
         #endregion
 
 
diff --git a/Wms/WMS.BLL/HttpServer.cs b/Wms/WMS.BLL/HttpServer.cs
index 210df4f..1fee251 100644
--- a/Wms/WMS.BLL/HttpServer.cs
+++ b/Wms/WMS.BLL/HttpServer.cs
@@ -1,8 +1,14 @@
-锘縰sing SqlSugar;
+锘縰sing Model.InterFaceModel;
+using SqlSugar;
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Text;
+using WMS.BLL.Logic;
 using WMS.BLL.LogServer;
+using WMS.DAL;
+using WMS.Entity.BllAsnEntity;
+using WMS.Entity.BllSoEntity;
 using WMS.Entity.Context;
 using WMS.Entity.DataEntity;
 using WMS.Entity.LogEntity;
@@ -16,6 +22,338 @@
         private static readonly SqlSugarScope Db = DataContext.Db;
         public HttpServer() { }
 
+        /// <summary>
+        /// 鐢宠鍌ㄤ綅  锛堢珛浣撳簱锛�
+        /// </summary>
+        /// <param name="palletNo"></param>
+        /// <param name="houseNo"></param>
+        /// <param name="roadwayNo"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public OutCommandDto RequestLocation(string palletNo, string houseNo)
+        {
+            try
+            {
+                //楠岃瘉鎵樼洏鏉$爜鏄惁涓虹┖
+                if (string.IsNullOrEmpty(palletNo))
+                {
+                    throw new Exception("璇疯緭鍏ヨ鐢宠鐨勬墭鐩樻潯鐮�");
+                }
+                //楠岃瘉鎵�灞炰粨搴撴槸鍚︿负绌�
+                if (string.IsNullOrEmpty(houseNo))
+                {
+                    throw new Exception("璇烽�夋嫨鎵�灞炰粨搴�");
+                }
+                //楠岃瘉鏄惁涓哄钩搴撳叆搴�
+                var houseType = Db.Queryable<SysWareHouse>().First(a => a.WareHouseNo == houseNo);//鑾峰彇浠撳簱绫诲瀷
+                //楠岃瘉鏄惁涓虹珛浣撳簱鍏ュ簱
+                if (houseType.Type != "1")
+                {
+                    throw new Exception("浠撳簱绫诲瀷閿欒锛岃閫夋嫨绔嬩綋搴撲粨搴�");
+                }
+
+                OutCommandDto comDto;//杩斿洖wcs鐨勫叆搴撳懡浠�
+
+                var stock = Db.Queryable<SysPallets>().First(a => a.PalletNo == palletNo);//鎵樼洏淇℃伅
+
+                //鍒ゆ柇鎵樼洏鏉$爜鏄惁鏈夋晥
+                if (stock == null)
+                    throw new Exception("鎵樼洏鏉$爜涓嶅彈WMS绠$悊锛屼笉鍙叆搴擄紒");
+
+                #region 
+                var upShelfOld = Db.Queryable<BllPalletUpShelf>().First(m => m.IsDel == "0" && m.PalletNo == palletNo && (m.Status == "0" || m.Status == "1"));
+                
+                var skuList = Db.Queryable<SysMaterials>().Where(m => m.IsDel == "0").ToList();
+                //鐗╂枡绫诲埆淇℃伅
+                var skuCategoryList = Db.Queryable<SysMaterialCategory>().Where(m => m.IsDel == "0").ToList();
+
+                var skuNo = ""; //鍏ュ簱鐗╂枡 
+                var starLocate = ""; // 璧峰鍌ㄤ綅
+                var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.PalletNo == palletNo).ToList();
+                //楠岃瘉鐗╂枡鏄惁鏈夋垚鍝�
+                foreach (var item in stockDetail)
+                {
+                    var skuItem = skuList.First(m => m.SkuNo == item.SkuNo);
+                    if (skuItem.Type == "2")
+                    {
+                        throw new Exception("鎴愬搧鐗╂枡璇峰叆鎴愬搧搴�");
+                    }
+                }
+                if (upShelfOld != null) //鏌ヨ鍒板叆搴撲俊鎭�
+                {
+                    var beingTask = Db.Queryable<LogTask>().First(m => m.IsDel == "0" && m.TaskNo == upShelfOld.TaskNo);
+                    if (beingTask == null)
+                    {
+                        throw new Exception("璇ユ墭鐩樻鍦ㄥ叆搴擄紝浣嗘湭鏌ヨ鍒颁换鍔′俊鎭�");
+                    }
+                    if (!string.IsNullOrWhiteSpace(beingTask.EndLocat))
+                    {
+                        comDto = new OutCommandDto()
+                        {
+                            PalletNo = palletNo,//鎵樼洏鍙�
+                            StartRoadway = beingTask.StartRoadway, // 璧峰宸烽亾
+                            StartLocate = beingTask.StartLocat, // 璧峰浣嶇疆
+                            EndLocate = beingTask.EndLocat, // 鐩爣浣嶇疆
+                            EndRoadway = beingTask.EndRoadway,                           //  鐩爣宸烽亾
+                            TaskNo = beingTask.TaskNo, // 浠诲姟鍙�
+                            TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
+                            OutMode = "",  //鐩爣鍦板潃
+                            Order = 1
+                        };
+                        if (beingTask.IsSuccess == 0)
+                        {
+                            beingTask.IsSuccess = 1;
+                        }
+                        beingTask.Status = "1";
+                        Db.Updateable(beingTask).ExecuteCommand();
+                        if (upShelfOld.Status == "0")
+                        {
+                            upShelfOld.Status = "1";
+                            Db.Updateable(upShelfOld).ExecuteCommand();
+                        }
+                        return comDto;
+                    }
+                    else
+                    {
+                        throw new Exception("鏌ヨ鍒颁换鍔′絾鐩殑鍌ㄤ綅涓虹┖");
+                    }
+                }
+                else //鐢宠鍏ュ簱
+                {
+                    if (stockDetail.Count == 0)
+                    {
+                        throw new Exception($"{palletNo}鎵樼洏鏉$爜涓嶅叿鏈夌鐮佷俊鎭紝涓嶅彲鍏ュ簱锛�");
+                    }
+                    if (stockDetail.Count(m => !string.IsNullOrWhiteSpace(m.LocatNo)) == 0)
+                    {
+                        throw new Exception("褰撳墠鎵樼洏娌℃湁鍦ㄥ钩搴撳偍浣嶄笂锛岃鏍稿疄");
+                    }
+                    starLocate = stockDetail.First().LocatNo;
+
+                    var pingAreaStr = Db.Queryable<SysStorageArea>().Where(m => m.IsDel == "0" && m.WareHouseNo == "W04" && m.AreaNo != "B06" && m.AreaNo != "B07").Select(m => m.AreaNo).ToList();
+                    var pingLocateInfo = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == starLocate && pingAreaStr.Contains(m.AreaNo) && m.IsDel == "0");
+                    if (pingLocateInfo == null)
+                    {
+                        throw new Exception("褰撳墠鎵樼洏鎵�鍦ㄧ殑鍌ㄤ綅娌℃湁鍦ㄧ郴缁熶腑鎵惧埌淇℃伅");
+                    }
+                    if (pingLocateInfo.Status != "1")
+                    {
+                        throw new Exception("褰撳墠鎵樼洏鎵�鍦ㄧ殑鍌ㄤ綅鐘舵�侀敊璇紝涓嶆槸绌哄偍浣�");
+                    }
+                    skuNo = stockDetail.First().SkuNo;
+
+                    var beingTask = Db.Queryable<LogTask>().First(m => m.IsDel == "0"
+                    && (m.Status == "0" || m.Status == "1") && m.PalletNo == palletNo && m.Type == "0");
+                    if (beingTask != null)
+                    {
+                        if (!string.IsNullOrWhiteSpace(beingTask.EndLocat))
+                        {
+                            comDto = new OutCommandDto()
+                            {
+                                PalletNo = palletNo,//鎵樼洏鍙�
+                                StartRoadway = beingTask.StartRoadway, // 璧峰宸烽亾
+                                StartLocate = beingTask.StartLocat, // 璧峰浣嶇疆
+                                EndLocate = beingTask.EndLocat, // 鐩爣浣嶇疆
+                                EndRoadway = beingTask.EndRoadway,                           //  鐩爣宸烽亾
+                                TaskNo = beingTask.TaskNo, // 浠诲姟鍙�
+                                TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
+                                OutMode = "",  //鐩爣鍦板潃
+                                Order = 1,
+                                Type = PLCTypeEnum.AGV
+                            };
+                            if (beingTask.IsSuccess == 0)
+                            {
+                                beingTask.IsSuccess = 1;
+                               
+                            }
+                            beingTask.Status = "1";
+                            Db.Updateable(beingTask).ExecuteCommand();
+                            return comDto;
+                        }
+                        else
+                        {
+                            throw new Exception("鏌ヨ鍒颁换鍔′絾鐩殑鍌ㄤ綅涓虹┖");
+                        }
+                    }
+
+                    //鑾峰彇瀵瑰簲鍥炲簱瑙勫垯
+                    var function = Db.Queryable<SysFunSetting>().First(a => a.IsDel == "0" && a.FunSetName == "鎵樼洏鍥炲簱楠岃瘉" && a.IsEnable == "NO");
+                    #region 鎵樼洏鍥炲簱瑙勫垯
+
+                    if (function != null)
+                    {
+                        //鎷h揣瀹屾垚鍚庡厑璁告墭鐩樺洖搴�
+                        if (function.SetValue == "CompletePick")
+                        {
+                            var allot = Db.Queryable<BllExportAllot>().First(a => a.IsDel == "0" && a.LotNo == stockDetail[0].LotNo && a.PalletNo == palletNo && a.SkuNo == stockDetail[0].SkuNo);
+
+                            //楠岃瘉鎷h揣鏄庣粏鏄惁瀛樺湪
+                            if (allot != null)
+                            {
+                                //楠岃瘉褰撳墠鎵樼洏鎷h揣淇℃伅鏄惁宸插畬鎴�
+                                if (allot.Status != "5")
+                                {
+                                    throw new Exception("褰撳墠鎵樼洏鎷h揣淇℃伅鏈畬鎴愶紝璇峰畬鎴愬悗鍥炲簱锛�");
+                                }
+                            }
+                        }
+                    }
+                    #endregion
+                }
+
+                var allotLocate = new AllotLocation();
+
+                #region 鐢宠鍌ㄤ綅
+
+                SysStorageLocat locate;
+                                var sku = skuList.FirstOrDefault(m => m.SkuNo == skuNo);
+                if (sku == null)
+                {
+                    throw new Exception("鐗╂枡淇℃伅涓湭鏌ヨ鍒板叆搴撳崟鏄庣粏鍖呭惈鐨勭墿鏂欎俊鎭紝涓嶅彲鍏ュ簱");
+                }
+                //鍒ゆ柇鐗╂枡鏄惁鍚湁绫诲埆淇℃伅
+                if (string.IsNullOrWhiteSpace(sku.CategoryNo))
+                {
+                    throw new Exception($"鐗╂枡锛歿sku.SkuNo}鏈煡璇㈠埌绫诲埆淇℃伅");
+                }
+
+                var skuCategory = skuCategoryList.FirstOrDefault(m => m.CategoryNo == sku.CategoryNo);
+                if (skuCategory == null)
+                {
+                    throw new Exception($"鏈湪绫诲埆淇℃伅涓煡璇㈠埌鐗╂枡锛歿sku.SkuNo}鍖呭惈鐨勭被鍒�");
+                }
+
+                var areaStr = skuCategory.AreaNo.Split(",");
+                var areaList = new List<string>();
+                foreach (var item in areaStr)
+                {
+                    areaList.Add(item);
+                }
+
+                locate = allotLocate.GetSuiTableLocate(houseNo, areaList, "");
+                
+
+                #endregion
+
+                Db.BeginTran();
+                try
+                {
+
+                    
+                    //娣诲姞宸烽亾浣跨敤璁板綍
+                    var log = new SysRoadwayUseLog
+                    {
+                        RoadwayNo = locate.RoadwayNo,
+                        WareHouseNo = houseNo,
+                        Row = 0,
+                        Column = 0,
+                        Layer = 0,
+                    };
+                    Db.Insertable(log).ExecuteCommand();
+                    var taskNo = new Common().GetMaxNo("TK");
+                    var exTask = new LogTask    //鍏ュ簱浠诲姟
+                    {
+                        TaskNo = taskNo,
+                        Sender = "WMS",
+                        Receiver = "WCS",
+                        IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛
+                        SendDate = DateTime.Now,  //鍙戦�佹椂闂�
+                        BackDate = DateTime.Now,  //杩斿洖鏃堕棿
+                        StartRoadway = "",            // 璧峰宸烽亾
+                        StartLocat = starLocate,//璧峰浣嶇疆
+                        EndLocat = locate.LocatNo,//鐩爣浣嶇疆
+                        EndRoadway = locate.RoadwayNo,  // 鐩爣宸烽亾
+                        PalletNo = palletNo,//鎵樼洏鐮�
+                        IsSend = 1,//鏄惁鍙啀娆′笅鍙�
+                        IsCancel = 1,//鏄惁鍙彇娑�
+                        IsFinish = 1,//鏄惁鍙畬鎴�
+                        Type = "0",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟  2 绉诲簱浠诲姟
+                        Status = "1",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
+                        OrderType = "0",//0 鍏ュ簱鍗� 1 鍑哄簱鍗�  2 鐩樼偣鍗�  3 绉诲簱鍗�
+                        Msg = "鍏ュ簱鍙e埌=>>" + locate.LocatNo + "鐨勫叆搴撲换鍔�", //鍏抽敭淇℃伅
+
+                    };
+                    Db.Insertable(exTask).ExecuteCommand();
+                    var asnNo = "";
+                    // 娣诲姞鎵樼洏缁戝畾琛ㄦ墭鐩樺叆搴撲换鍔″彿 liudl
+                    foreach (DataStockDetail stockModel in stockDetail)
+                    {
+                        var bindModel = Db.Queryable<BllPalletBind>().First(m => m.IsDel == "0" && m.Status == "2"
+                        && m.PalletNo == stockModel.PalletNo && m.ASNNo == stockModel.ASNNo && m.ASNDetailNo == stockModel.ASNDetailNo);
+                        if (bindModel != null && string.IsNullOrWhiteSpace(bindModel.TaskNo))
+                        {
+                            bindModel.TaskNo = taskNo;
+                            bindModel.WareHouseNo = locate.WareHouseNo;
+                            bindModel.RoadwayNo = locate.RoadwayNo;
+                            bindModel.LocatNo = locate.LocatNo;
+                            Db.Updateable(bindModel).ExecuteCommand();
+                            asnNo = stockModel.ASNNo;
+                        }
+                    }
+                    foreach (DataStockDetail stockModel in stockDetail)
+                    {
+                        //娣诲姞鎵樼洏涓婃灦璁板綍
+                        var upShelf = new BllPalletUpShelf()
+                        {
+                            TaskNo = exTask.TaskNo,
+                            TraceNo = asnNo,
+                            PalletNo = palletNo,
+                            SkuNo = stockModel.SkuNo,
+                            SkuName = stockModel.SkuName,
+                            LotNo = stockModel.LotNo,
+                            Status = "1",
+
+                            WareHouseNo = houseNo,
+                            RoadwayNo = locate.RoadwayNo,
+                            AreaNo = locate.AreaNo,
+                            LocatNo = locate.LocatNo,
+
+                            CreateUser = 0,
+                        };
+                        Db.Insertable(upShelf).ExecuteCommand();
+                    }
+                     
+                    
+                    locate.Status = "2";
+                    Db.Updateable(locate).ExecuteCommand();
+                     
+                    Db.CommitTran();
+                    comDto = new OutCommandDto()
+                    {
+                        PalletNo = palletNo,//鎵樼洏鍙�
+                        StartRoadway = "",
+                        StartLocate = starLocate, // 璧峰浣嶇疆
+                        EndLocate = locate.LocatNo, // 鐩爣浣嶇疆 
+                        EndRoadway = locate.RoadwayNo,   // 鐩爣宸烽亾
+                        TaskNo = taskNo, // 浠诲姟鍙�
+                        TaskType = "0",// 浠诲姟绫诲瀷 (鍑哄簱)
+                        OutMode = "",  //鐩爣鍦板潃
+                        Order = 1,
+                        Type = PLCTypeEnum.AGV
+                    };
+
+                }
+                catch (Exception ex)
+                {
+                    Db.RollbackTran();
+                    throw new Exception(ex.Message);
+                }
+                #endregion
+
+
+                return comDto;
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+            }
+        }
+
+        /// <summary>
+        /// agv璧板嚭鍌ㄤ綅淇敼鍌ㄤ綅淇℃伅锛屼粎闄愬钩搴撳偍浣�
+        /// </summary>
+        /// <param name="taskNo"></param>
+        /// <param name="userId"></param>
         public void UpLocateByAgvOut(string taskNo, int userId)
         {
             try
@@ -55,5 +393,89 @@
                 throw new Exception(e.Message);
             }
         }
+
+        /// <summary>
+        /// 鍏ュ簱浠诲姟瀹屾垚JC34
+        /// </summary>
+        /// <param name="taskNo"></param>
+        /// <param name="userId"></param>
+        /// <exception cref="Exception"></exception>
+        public void ArrivalSuccess2(string taskNo, int userId)
+        {
+            try
+            {
+                //姝e父鍏ュ簱 
+                var task = Db.Queryable<LogTask>().First(m => m.IsDel == "0" && m.TaskNo == taskNo);
+                if (task == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌浠诲姟淇℃伅");
+                }
+                if (task.Status == "2")
+                {
+                    throw new Exception("褰撳墠浠诲姟宸插畬鎴�");
+                }
+
+                var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.PalletNo == task.PalletNo).ToList();
+                var upShelf = Db.Queryable<BllPalletUpShelf>().First(m => m.TaskNo == taskNo);
+                if (upShelf == null)
+                {
+                    throw new Exception("娌℃湁鎵惧埌鎵樼洏涓婃灦淇℃伅");
+                }
+                //褰撳墠浠诲姟涓殑鍌ㄤ綅淇℃伅
+                var locate = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == task.EndLocat);
+                if (locate == null)
+                {
+                    throw new Exception($"鏈煡璇㈠埌浠诲姟涓殑鍌ㄤ綅淇℃伅");
+                }
+                Db.BeginTran();
+
+                task.Status = "2";//浠诲姟鐘舵��
+                task.IsSend = 0;
+                task.IsCancel = 0;
+                task.IsFinish = 0;
+                task.FinishDate = DateTime.Now;//瀹屾垚鏃堕棿
+                Db.Updateable(task).ExecuteCommand();
+                if (userId != 0)
+                {
+                    //娣诲姞鎿嶄綔鏃ュ織璁板綍
+                    var k = new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鍏ュ簱鏃ュ織", taskNo, "瀹屾垚", $"鐐瑰嚮瀹屾垚鎸夐挳銆佸畬鎴愪换鍔″彿涓猴細{taskNo}鐨勪换鍔�", userId);
+                }
+
+                //鍒ゆ柇鏄惁鏄洖娴佸叆搴撳畬鎴�
+                if (stockDetail.Any())
+                {
+                    throw new Exception("娌℃湁鏌ヨ鍒板簱瀛樹俊鎭�");
+                }
+
+                foreach (var item in stockDetail)
+                {
+                    item.WareHouseNo = locate.WareHouseNo;
+                    item.RoadwayNo = locate.RoadwayNo;
+                    item.AreaNo = locate.AreaNo;
+                    item.LocatNo = locate.LocatNo;
+                    item.UpdateTime = DateTime.Now;
+                    if (userId != 0)
+                    {
+                        item.UpdateUser = userId;
+                    }
+                }
+                upShelf.Status = "2";
+                Db.Updateable(upShelf).ExecuteCommand();
+
+                locate.Status = "1";
+                Db.Updateable(locate).ExecuteCommand();
+                Db.Updateable(stockDetail).ExecuteCommand();
+                Db.CommitTran();
+
+            }
+            catch (Exception e)
+            {
+                throw new Exception(e.Message);
+            }
+        }
+
+
+
+
     }
 }
diff --git a/Wms/WMS.Entity/BllAsnEntity/BllPalletUpShelf.cs b/Wms/WMS.Entity/BllAsnEntity/BllPalletUpShelf.cs
index bb7459c..a2df3d4 100644
--- a/Wms/WMS.Entity/BllAsnEntity/BllPalletUpShelf.cs
+++ b/Wms/WMS.Entity/BllAsnEntity/BllPalletUpShelf.cs
@@ -38,7 +38,7 @@
         /// </summary>
         public string LotNo { get; set; }
         /// <summary>
-        /// 鐘舵��
+        /// 鐘舵�� 0绛夊緟鎵ц 1姝e湪鎵ц 2鎵ц瀹屾垚 4宸插彇娑�
         /// </summary>
         public string Status { get; set; }
 
diff --git a/Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs b/Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs
index f5ebebe..3e63783 100644
--- a/Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs
+++ b/Wms/WMS.IBLL/IBllAsnServer/IPalletBindServer.cs
@@ -111,12 +111,7 @@
         OutCommandDto RequestMiJiLocation(string palletNo, string houseNo, string roadwayNo);
 
 
-        /// <summary>
-        /// 鍏ュ簱瀹屾垚JC34
-        /// </summary>
-        /// <param name="taskNo">浠诲姟鍙�</param>
-        /// <param name="userId">鎿嶄綔浜�(涓嬫父绯荤粺鏃朵负绌�)</param> 
-        void ArrivalSuccess2(string taskNo, int userId);
+        
         /// <summary>
         /// 鍏ュ簱瀹屾垚
         /// </summary>
diff --git a/Wms/WMS.IBLL/IHttpServer.cs b/Wms/WMS.IBLL/IHttpServer.cs
index 75e2da5..f36233f 100644
--- a/Wms/WMS.IBLL/IHttpServer.cs
+++ b/Wms/WMS.IBLL/IHttpServer.cs
@@ -1,4 +1,5 @@
-锘縰sing System;
+锘縰sing Model.InterFaceModel;
+using System;
 using System.Collections.Generic;
 using System.Text;
 
@@ -6,11 +7,28 @@
 {
     public interface IHttpServer
     {
+
+        /// <summary>
+        /// 鐢宠鍌ㄤ綅  锛堢珛浣撳簱锛�
+        /// </summary>
+        /// <param name="palletNo"></param>
+        /// <param name="houseNo"></param>
+        /// <returns></returns>
+        OutCommandDto RequestLocation(string palletNo, string houseNo);
+
         /// <summary>
         /// agv璧板嚭鍌ㄤ綅淇敼鍌ㄤ綅淇℃伅锛屼粎闄愬钩搴撳偍浣�
         /// </summary>
         /// <param name="taskNo"></param>
         /// <param name="userId"></param>
         void UpLocateByAgvOut(string taskNo,int userId);
+
+        /// <summary>
+        /// 鍏ュ簱瀹屾垚JC34
+        /// </summary>
+        /// <param name="taskNo">浠诲姟鍙�</param>
+        /// <param name="userId">鎿嶄綔浜�(涓嬫父绯荤粺鏃朵负绌�)</param> 
+        void ArrivalSuccess2(string taskNo, int userId);
+
     }
 }
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
index 7c5b974..6ffd44f 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaAsnServer.cs
@@ -20,6 +20,15 @@
         List<string> GetNoPasteAsnNoStrList();
         //鏍规嵁鍗曟嵁鑾峰彇鏍囩鏁伴噺
         BoxListInfoDto GetBoxCountByAsn(string asnNo, int? asnDetailId);
+
+        /// <summary>
+        /// 淇濆瓨鎸囧畾鐨勫偍浣�
+        /// </summary>
+        /// <param name="palletNo"></param>
+        /// <param name="locateNo"></param>
+        /// <param name="userId"></param>
+        void SaveAppointLocate(string palletNo, string locateNo, int userId);
+
         #endregion
 
 
diff --git a/Wms/Wms/Controllers/DownApiController.cs b/Wms/Wms/Controllers/DownApiController.cs
index 7e9adf6..fe33f06 100644
--- a/Wms/Wms/Controllers/DownApiController.cs
+++ b/Wms/Wms/Controllers/DownApiController.cs
@@ -300,7 +300,7 @@
 
             try
             {
-                var list = _asnPalletBindSvc.RequestLocation(model.PalletNo, model.HouseNo);
+                var list = _http.RequestLocation(model.PalletNo, model.HouseNo);
                 _asnPalletBindSvc.IssueAsnTask(list, _config.WcsHost+ _config.IssueComApiUrl2);//WCS璺緞
                 
                 new OperationASNServer().AddLogOperationAsn("PDA妯″潡", "鐢宠鍏ュ簱", model.PalletNo, "娣诲姞", $"鐢宠鍌ㄤ綅鎵樼洏鍙凤細{model.PalletNo}鐨勬垚鍔熶俊鎭�", int.Parse(userId));
@@ -429,7 +429,7 @@
                     case "0"://鍏ュ簱瀹屾垚浠诲姟
                         if (model.TaskType == "0")//0锛氬叆搴� 1锛氬嚭搴� 2锛氱Щ搴�
                         {
-                            _asnPalletBindSvc.ArrivalSuccess2(model.TaskNo, 0);
+                            _http.ArrivalSuccess2(model.TaskNo, 0);
                             return Ok(new WcsModel { StatusCode = 0, Msg = "鍏ュ簱瀹屾垚" });
                         }
                         break;
@@ -453,7 +453,7 @@
                         }
                         else if (model.TaskType == "0")// 鐩樼偣鍑哄簱鎵樼洏鍥炲簱瀹屾垚
                         {
-                            _asnPalletBindSvc.ArrivalSuccess2(model.TaskNo, 0);
+                            _http.ArrivalSuccess2(model.TaskNo, 0);
                             return Ok(new WcsModel { StatusCode = 0, Msg = "鍏ュ簱瀹屾垚" });
                         }
                         break;
diff --git a/Wms/Wms/Controllers/PdaAsnController.cs b/Wms/Wms/Controllers/PdaAsnController.cs
index ced30b5..1522b14 100644
--- a/Wms/Wms/Controllers/PdaAsnController.cs
+++ b/Wms/Wms/Controllers/PdaAsnController.cs
@@ -1,4 +1,5 @@
 锘縰sing Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Identity;
 using Microsoft.AspNetCore.Mvc;
 using Model.InterFaceModel;
 using Model.ModelDto.BllAsnDto;
@@ -24,10 +25,12 @@
     public class PdaAsnController : ControllerBase
     {
         private readonly IPdaAsnServer _PdaAsnSvc;
+        private readonly UserManager _userManager;
 
-        public PdaAsnController(IPdaAsnServer pdaAsnSvc)
+        public PdaAsnController(IPdaAsnServer pdaAsnSvc,UserManager userManager)
         {
-            _PdaAsnSvc = pdaAsnSvc;
+            _PdaAsnSvc = pdaAsnSvc; 
+            _userManager = userManager;
         }
         
 
@@ -234,11 +237,31 @@
                 return Ok(new { code = 1, msg = e.Message });
             }
         }
-        
+
 
         //---------------------------------------------鐢宠鍏ュ簱椤甸潰----------------------------------------------------------------------
 
 
+        /// <summary>
+        /// 淇濆瓨鎸囧畾鐨勫偍浣�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult SaveAppointLocate(PalletBindVm model)
+        {
+            try
+            {
+                _PdaAsnSvc.SaveAppointLocate(model.PalletNo, model.LocatNo, _userManager.UserId);
+
+                return Ok(new HttpReturnModel{ Success = "0", Message = "鏍规嵁鍗曟嵁鑾峰彇鏍囩鏁伴噺" });
+
+            }
+            catch (Exception e)
+            {
+                return Ok(new HttpReturnModel { Success = "1", Message = e.Message });
+            }
+        }
 
 
         #endregion

--
Gitblit v1.8.0