From fef4a39d606932ebb2f7ae7d58c8ddcdd3e3b9db Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期六, 20 九月 2025 14:43:07 +0800
Subject: [PATCH] PDA-AGV转运功能增加指定目标储位功能

---
 Pda/View/HouseDataSetting/agvTransport.html |   49 ++++++++++++++++
 Wms/Wms/Controllers/PdaCrController.cs      |   22 +++++++
 Wms/Model/ModelVm/PdaVm/PdaCrVm.cs          |    4 +
 Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs     |    4 
 Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs     |   36 +++++++++++-
 Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs     |    9 ++
 6 files changed, 117 insertions(+), 7 deletions(-)

diff --git a/Pda/View/HouseDataSetting/agvTransport.html b/Pda/View/HouseDataSetting/agvTransport.html
index 09a4011..0d7e32e 100644
--- a/Pda/View/HouseDataSetting/agvTransport.html
+++ b/Pda/View/HouseDataSetting/agvTransport.html
@@ -138,6 +138,15 @@
                                 <img src="/assets/down_arraw.png">
                             </div>
                         </div>
+                         <div id="" class="layui-form-item layout-dropdownlist">
+                            <label class="layui-form-label" lang>鐩爣鍌ㄤ綅锛�</label>
+                            <div class="layui-input-block" id="selectLocatNoEnd">
+                                <select id="LocatNoEnd" lay-filter="getLocatNoEnd" lay-search>
+                                    <option value=""></option>
+                                </select>
+                                <img src="/assets/down_arraw.png">
+                            </div>
+                        </div>
                         <div id="" class="layui-form-item layout-dropdownlist">
                             <label class="layui-form-label" lang>鍏ュ簱鍙o細</label>
                             <div class="layui-input-block" id="selectRuku">
@@ -447,6 +456,45 @@
                     }
                 });
             }
+             //閫変腑鍑哄簱鍗曚簨浠�
+             form.on('select(getQuyu)', function (data) {
+                  //鍏堟洿鏂颁竴涓嬬洰鏍囧尯鍩�
+                updateLocatNoEndList()
+            });
+            //鐐瑰嚮鐩爣鍌ㄤ綅涓嬫媺妗嗕簨浠�
+            $("#selectLocatNoEnd").click(function () {
+                if ($("#Quyu").val() == "") {
+                    layer.msg('璇峰厛閫夋嫨鐩爣鍖哄煙', {
+                        icon: 2,
+                        time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                    });
+                    return
+                }
+             
+            })
+            /* 缁戝畾鐩爣鍌ㄤ綅淇℃伅 */
+            function updateLocatNoEndList() {
+                $("#LocatNoEnd").empty()
+                $("#LocatNoEnd").append('<option value =>' + '</option>');
+                form.render('select');
+
+                var param = {
+                    "AreaNo": $("#Quyu").val()
+                };
+                sendData(IP + "/PdaCr/GetLocatByArea", param, 'get', function (res) {
+                    if (res.code == 0) { //鎴愬姛
+                        for (var i = 0; i < res.data.length; i++) {
+                            $("#LocatNoEnd").append('<option value =' + res.data[i] + '>' + res.data[i]+ '</option>');
+                        }
+                        form.render('select');
+                    } else { //涓嶆垚鍔�
+                        layer.msg(res.msg, {
+                        	icon: 2,
+                        	time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+                        }, function() {});
+                    }
+                });
+            }
 
             //鐐瑰嚮鍑哄簱鍗曟嵁涓嬫媺妗嗕簨浠�
             $("#selectOutNo").click(function () {
@@ -652,6 +700,7 @@
                     var param = {
                         PalletNo: $("#STOCKCODE").val(),
                         AreaNo: $("#Quyu").val(),
+                        LocatNoEnd: $("#LocatNoEnd").val(),
                         Ruku: $("#Ruku").val()
                     }
                     //鍛煎彨灏忚溅
diff --git a/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs b/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs
index 13e05ca..454a45e 100644
--- a/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs
+++ b/Wms/Model/ModelVm/PdaVm/PdaCrVm.cs
@@ -65,6 +65,10 @@
         /// </summary>
         public string AreaNo { get; set; }
         /// <summary>
+        /// 鐩爣鍌ㄤ綅
+        /// </summary>
+        public string LocatNoEnd { get; set; }
+        /// <summary>
         /// 鍏ュ簱鍙�
         /// </summary>
         public string Ruku { get; set; }
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
index 5ce43ae..95d16c8 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -802,6 +802,29 @@
             return storageArea;
         }
         /// <summary>
+        /// 鏍规嵁鍖哄煙鍙疯幏鍙栧偍浣嶅湴鍧�闆嗗悎
+        /// </summary>
+        /// <param name="areaNo"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        public List<string> GetLocatByArea(string areaNo)
+        {
+            try
+            {
+                if (string.IsNullOrEmpty(areaNo))
+                {
+                    throw new Exception("璇烽�夋嫨鍖哄煙");
+                }
+                var _list = Db.Queryable<SysStorageLocat>().Where(w => w.IsDel == "0" && w.AreaNo == areaNo && w.WareHouseNo == "W04").Select(s => s.LocatNo).ToList();
+
+                return _list;
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+        /// <summary>
         /// 鑾峰彇宸插垎閰嶇殑鍑哄簱鍗曟嵁
         /// </summary>
         /// <returns></returns>
@@ -1011,7 +1034,7 @@
             }
         }*/
 
-        public async Task AgvTransport(string palletNo, string areaNo, string ruku, string url, int userId)
+        public async Task AgvTransport(string palletNo, string areaNo,string locatNoEnd, string ruku, string url, int userId)
         {
             try
             {
@@ -1046,7 +1069,14 @@
                     {
                         throw Oops.Bah("鎵�閫夊尯鍩熶俊鎭笉瀛樺湪,璇锋鏌�!");
                     }
-                    EndLocat = await GetLocat(areaNo);
+                    if (!string.IsNullOrEmpty(locatNoEnd))
+                    {
+                        EndLocat = locatNoEnd;//鎸囧畾鍌ㄤ綅鍦板潃
+                    }
+                    else
+                    {
+                        EndLocat = await GetLocat(areaNo);//绯荤粺鍒嗛厤鍌ㄤ綅鍦板潃
+                    }                    
                 }
                 else
                 {
@@ -1075,7 +1105,7 @@
                 //鐩爣鍌ㄤ綅淇℃伅
                 //var storageLocatEnd = new SysStorageLocat();
 
-                var storageLocatEnd = await Db.Queryable<SysStorageLocat>().FirstAsync(w => w.IsDel == "0" && w.LocatNo == EndLocat && w.Flag == "0");
+                var storageLocatEnd = await Db.Queryable<SysStorageLocat>().FirstAsync(w => w.IsDel == "0" && w.LocatNo == EndLocat && w.Flag == "0" && w.WareHouseNo == "W04" && w.AreaNo == areaNo);
                 if (storageLocatEnd == null)
                 {
                     throw Oops.Bah("鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�,璇锋鏌�!");
diff --git a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
index c5e12c6..79fec1e 100644
--- a/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
+++ b/Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -3718,7 +3718,7 @@
             {
                 throw Oops.Bah("鏈幏鍙栧埌瀵瑰簲鍌ㄤ綅淇℃伅锛岃妫�鏌�!");
             }
-            if (locat.Status != "3")
+            if (locat.Status != "1")
             {
                 throw Oops.Bah("褰撳墠鍌ㄤ綅涓嶆槸鏈夌墿鍝侊紝璇锋鏌�!");
             }
@@ -3801,7 +3801,7 @@
                 #region 娣诲姞鍑哄簱鎿嶄綔鏃ュ織璁板綍淇℃伅
 
                 //娣诲姞鎿嶄綔鏃ュ織璁板綍
-                var k = new OperationSOServer().AddLogOperationSo("鍑哄簱浣滀笟", "鎷h揣鏄庣粏", soNo, "瀹屾垚", $"鐢≒DA瀹屾垚浜嗗崟鎹彿涓簕soNo}鐨勫钩搴撳嚭搴�", userId);
+                var k = new OperationSOServer().AddLogOperationSo("鍑哄簱浣滀笟", "鎷h揣鏄庣粏", palletNo, "瀹屾垚", $"鐢≒DA瀹屾垚浜嗘墭鐩樺彿涓簕palletNo}鐨勫钩搴撳嚭搴�", userId);
 
                 #endregion
 
diff --git a/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs b/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
index c4a75c5..ceaee97 100644
--- a/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
+++ b/Wms/WMS.IBLL/IPdaServer/IPdaCrServer.cs
@@ -110,6 +110,13 @@
         /// <returns></returns>
         Task<List<SysStorageArea>> GetStorageArea(string palletNo);
         /// <summary>
+        /// 鏍规嵁鍖哄煙鍙疯幏鍙栧偍浣嶅湴鍧�闆嗗悎
+        /// </summary>
+        /// <param name="areaNo"></param>
+        /// <returns></returns>
+        /// <exception cref="Exception"></exception>
+        List<string> GetLocatByArea(string areaNo);
+        /// <summary>
         /// 鑾峰彇宸插垎閰嶇殑鍑哄簱鍗曟嵁
         /// </summary>
         /// <returns></returns>
@@ -133,7 +140,7 @@
         /// <param name="areaNo"></param>
         /// <param name="ruku"></param>
         /// <param name="url"></param>
-        Task AgvTransport(string palletNo, string areaNo, string ruku, string url, int userId);
+        Task AgvTransport(string palletNo, string areaNo, string locatNoEnd, string ruku, string url, int userId);
         /// <summary>
         /// 鍛煎彨agv杞繍绌烘墭鐩�
         /// </summary>
diff --git a/Wms/Wms/Controllers/PdaCrController.cs b/Wms/Wms/Controllers/PdaCrController.cs
index ce952b6..130abd6 100644
--- a/Wms/Wms/Controllers/PdaCrController.cs
+++ b/Wms/Wms/Controllers/PdaCrController.cs
@@ -19,6 +19,7 @@
 using Microsoft.Extensions.Options;
 using Model.ModelDto.DataDto;
 using Model.ModelDto;
+using Model.ModelVm.BllSoVm;
 
 namespace Wms.Controllers
 {
@@ -237,7 +238,26 @@
         [UnitOfWork]
         public async Task AgvTransport(PdaAgvTransportVm model)
         {
-            await _pdaCrSvc.AgvTransport(model.PalletNo, model.AreaNo, model.Ruku, _config.WcsHost+ _config.IssueComApiUrl, _userManager.UserId);
+            await _pdaCrSvc.AgvTransport(model.PalletNo, model.AreaNo, model.LocatNoEnd, model.Ruku, _config.WcsHost + _config.IssueComApiUrl, _userManager.UserId);
+        }
+        /// <summary>
+        /// 鏍规嵁鍖哄煙鍙疯幏鍙栧偍浣嶅湴鍧�闆嗗悎
+        /// </summary>
+        /// <param name="areaNo"></param>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetLocatByArea(string areaNo)
+        {
+            try
+            {
+                var _list = _pdaCrSvc.GetLocatByArea(areaNo);
+
+                return Ok(new { code = 0, count = 0, msg = "鑾峰彇鎴愬姛", data = _list });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { code = 1, msg = e.Message });
+            }
         }
         /// <summary>
         /// 鍛煎彨agv杞繍绌烘墭鐩�

--
Gitblit v1.8.0