From 29cd467ba62b2bdf49c6546e78ae3ec809c4a723 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 19 六月 2025 17:50:28 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_AGV.cs |   66 +++++++++++++++++++++++++--------
 1 files changed, 50 insertions(+), 16 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_AGV.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_AGV.cs"
index 2debb9b..03a0580 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_AGV.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_AGV.cs"
@@ -25,7 +25,7 @@
             Dt_RoadwayInfo dt_RoadwayInfo = _basicService.RoadwayInfoService.Repository.QueryFirst(x => x.OutSCStationCode == outTask.TargetAddress);
             if (dt_RoadwayInfo == null || dt_RoadwayInfo.AreaId == 11) return WebResponseContent.Instance.OK();
             Dt_CachePoint startcachePoint = new Dt_CachePoint();
-            Dt_CachePoint cachePoint = GetCachePointByStartPoint(dt_RoadwayInfo.OutStationCode, ref startcachePoint);
+            Dt_CachePoint cachePoint = GetCachePointByStartPoint(dt_RoadwayInfo.OutStationCode, "", ref startcachePoint);
             if (startcachePoint.EnableStatus == EnableStatusEnum.Disable.ObjToInt()) return WebResponseContent.Instance.OK();
             //if (dt_RoadwayInfo.AreaId == 11)//杈呮枡涓嶇敤AGV鎼繍
             //{
@@ -73,12 +73,23 @@
                 if (Repository.QueryFirst(x => x.SourceAddress == point &&
                 x.TaskStatus < AGVTaskStatusEnum.DoneFetch.ObjToInt() ||
                 x.TargetAddress == point) != null)
-                    throw new Exception($"绔欑偣銆恵point}銆戝瓨鍦ㄤ换鍔★紒");
+                    throw new Exception($"缂撳瓨鐐广�恵point}銆戝瓨鍦ˋGV浠诲姟锛�");
                 Dt_CachePoint? cachePoint = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == point);
                 if (cachePoint == null) throw new Exception("鏈壘鍒扮紦瀛樼偣!");
-                if (cachePoint.AreaId != 4) throw new Exception("褰撳墠缂撳瓨鐐瑰尯鍩熸棤缁戝畾鏉冮檺!");
+                if (cachePoint.Depth == 1)
+                {
+                    Dt_CachePoint? cachePoint1 = _basicService.CachePointService.Repository.QueryFirst(x => x.AreaId == cachePoint.AreaId && x.Column == cachePoint.Column && cachePoint.Row - x.Row == 1);
+                    if (cachePoint1 != null)
+                    {
+                        if (Repository.QueryFirst(x => x.SourceAddress == cachePoint1.PointCode &&
+                x.TaskStatus < AGVTaskStatusEnum.DoneFetch.ObjToInt() ||
+                x.TargetAddress == cachePoint1.PointCode) != null)
+                            throw new Exception($"鍐呯疆缂撳瓨鐐广�恵cachePoint1.PointCode}銆戝瓨鍦ˋGV浠诲姟锛�");
+                    }
+                }
+                //if (cachePoint.AreaId != 4) throw new Exception("褰撳墠缂撳瓨鐐瑰尯鍩熸棤缁戝畾鏉冮檺!");
                 cachePoint.PointStatus = LocationStatusEnum.InStock.ObjToInt();
-                cachePoint.Remark = qty;
+                if (cachePoint.AreaId == 4) cachePoint.Remark = qty;
                 cachePoint.Modifier = App.User.UserName;
                 _basicService.CachePointService.Repository.UpdateData(cachePoint);
                 return WebResponseContent.Instance.OK();
@@ -100,12 +111,13 @@
                 if (Repository.QueryFirst(x => x.SourceAddress == point &&
                 x.TaskStatus < AGVTaskStatusEnum.DoneFetch.ObjToInt() ||
                 x.TargetAddress == point) != null)
-                    throw new Exception($"绔欑偣銆恵point}銆戝瓨鍦ㄤ换鍔★紒");
+                    throw new Exception($"缂撳瓨鐐广�恵point}銆戝瓨鍦ˋGV浠诲姟锛�");
                 Dt_CachePoint? cachePoint = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == point);
                 if (cachePoint == null) throw new Exception("鏈壘鍒扮紦瀛樼偣!");
-                if (cachePoint.AreaId != 2 && cachePoint.AreaId != 5 && cachePoint.AreaId != 8)
-                    throw new Exception("褰撳墠缂撳瓨鐐瑰尯鍩熸棤閲婃斁鏉冮檺!");
+                //if (cachePoint.AreaId != 2 && cachePoint.AreaId != 5 && cachePoint.AreaId != 8)
+                //    throw new Exception("褰撳墠缂撳瓨鐐瑰尯鍩熸棤閲婃斁鏉冮檺!");
                 cachePoint.PointStatus = LocationStatusEnum.Free.ObjToInt();
+                cachePoint.Modifier = App.User.UserName;
                 _basicService.CachePointService.Repository.UpdateData(cachePoint);
                 return WebResponseContent.Instance.OK();
             }
@@ -120,7 +132,7 @@
         /// </summary>
         /// <param name="endPoint"></param>
         /// <returns></returns>
-        public WebResponseContent CallMateriel(string endPoint)
+        public WebResponseContent CallMateriel(string endPoint, string startPoint)
         {
             try
             {
@@ -129,7 +141,7 @@
                 x.TargetAddress == endPoint) != null)
                     throw new Exception($"绔欑偣銆恵endPoint}銆戝瓨鍦ㄤ换鍔★紒");
 
-                Dt_CachePoint cachePoint = GetCachePointByEndPoint(endPoint);
+                Dt_CachePoint cachePoint = GetCachePointByEndPoint(endPoint, startPoint);
 
                 Dt_Task task = new Dt_Task()
                 {
@@ -173,7 +185,7 @@
         /// </summary>
         /// <param name="startPoint"></param>
         /// <returns></returns>
-        public WebResponseContent MaterielCarry(string startPoint)
+        public WebResponseContent MaterielCarry(string startPoint, string endPoint)
         {
             try
             {
@@ -182,7 +194,7 @@
                 x.TargetAddress == startPoint) != null)
                     throw new Exception($"绔欑偣銆恵startPoint}銆戝瓨鍦ㄤ换鍔★紒");
                 Dt_CachePoint startcachePoint = new Dt_CachePoint();
-                Dt_CachePoint cachePoint = GetCachePointByStartPoint(startPoint, ref startcachePoint);
+                Dt_CachePoint cachePoint = GetCachePointByStartPoint(startPoint, endPoint, ref startcachePoint);
 
                 Dt_Task task = new()
                 {
@@ -225,12 +237,23 @@
         /// <param name="startPoint"></param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
-        private Dt_CachePoint GetCachePointByStartPoint(string startPoint, ref Dt_CachePoint startcachePoint)
+        private Dt_CachePoint GetCachePointByStartPoint(string startPoint, string endPoint, ref Dt_CachePoint startcachePoint)
         {
             #region MyRegion
             Dt_CachePoint? StartcachePoint = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == startPoint);
-            if (StartcachePoint == null) throw new Exception("鏈壘鍒扮紦瀛樼偣!");
+            if (StartcachePoint == null) throw new Exception($"鏈壘鍒扮紦瀛樼偣{startPoint}!");
             startcachePoint = StartcachePoint;
+            endPoint = "";
+            if (!string.IsNullOrEmpty(endPoint))
+            {
+                Dt_CachePoint? cachePoint1 = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == endPoint);
+                if (cachePoint1 == null) throw new Exception($"鏈壘鍒扮紦瀛樼偣{endPoint}!");
+                if (Repository.QueryFirst(x => x.SourceAddress == endPoint &&
+                x.TaskStatus < AGVTaskStatusEnum.DoneFetch.ObjToInt() ||
+                x.TargetAddress == endPoint) != null)
+                    throw new Exception($"缂撳瓨鐐广�恵endPoint}銆戝瓨鍦ㄤ换鍔★紒");
+                return cachePoint1;
+            }
             Dt_AreaRouter areaRouter = _basicService.AreaRouterService.Repository.QueryFirst(x => x.StartArea == StartcachePoint.AreaId.ToString());
             if (areaRouter == null) throw new Exception("鏈壘鍒拌矾鐢变俊鎭�!");
 
@@ -249,11 +272,22 @@
         /// <param name="endPoint"></param>
         /// <returns></returns>
         /// <exception cref="Exception"></exception>
-        private Dt_CachePoint GetCachePointByEndPoint(string endPoint)
+        private Dt_CachePoint GetCachePointByEndPoint(string endPoint, string startPoint)
         {
             #region MyRegion
             Dt_CachePoint? StartcachePoint = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == endPoint);
-            if (StartcachePoint == null) throw new Exception("鏈壘鍒扮紦瀛樼偣!");
+            if (StartcachePoint == null) throw new Exception($"鏈壘鍒扮紦瀛樼偣{endPoint}!");
+
+            if (!string.IsNullOrEmpty(endPoint))
+            {
+                Dt_CachePoint? cachePoint1 = _basicService.CachePointService.Repository.QueryFirst(x => x.PointCode == startPoint);
+                if (cachePoint1 == null) throw new Exception($"鏈壘鍒扮紦瀛樼偣{startPoint}!");
+                if (Repository.QueryFirst(x => x.SourceAddress == startPoint &&
+                x.TaskStatus < AGVTaskStatusEnum.DoneFetch.ObjToInt() ||
+                x.TargetAddress == startPoint) != null)
+                    throw new Exception($"缂撳瓨鐐广�恵startPoint}銆戝瓨鍦ㄤ换鍔★紒");
+                return cachePoint1;
+            }
 
             Dt_AreaRouter areaRouter = _basicService.AreaRouterService.Repository.QueryFirst(x => x.NextArea == StartcachePoint.AreaId.ToString());
             if (areaRouter == null) throw new Exception("鏈壘鍒拌矾鐢变俊鎭�!");
@@ -289,7 +323,7 @@
             }
             catch (Exception ex)
             {
-                return WebResponseContent.Instance.Error(ex.Message);
+                return WebResponseContent.Instance.Error("AGV浠诲姟涓嬪彂澶辫触:" + ex.Message);
             }
         }
 

--
Gitblit v1.9.3