gkj 2 years ago
parent
commit
36d26ee3d4

+ 4 - 1
ServiceCenter/ServiceCenter.csproj

@@ -20,9 +20,12 @@
     <PackageReference Include="PlcSiemens" Version="1.0.1" />
     <PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.5.0" />
     <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
-    <PackageReference Include="WCS.Core" Version="1.0.1.10" />
     <PackageReference Include="WCS.Entity" Version="1.0.2" />
     <PackageReference Include="WCS.Entity.Protocol" Version="1.0.1" />
   </ItemGroup>
+  
+  <ItemGroup>
+    <ProjectReference Include="..\WCS.Core\WCS.Core.csproj" />
+  </ItemGroup>
 
 </Project>

+ 1 - 0
WCS.Core/DataBlock.cs

@@ -33,6 +33,7 @@ namespace WCS.Core
         {
             try
             {
+
                 Start = (ushort)ProxyList.Min(v => v.Info.Position);
                 var last = ProxyList.OrderBy(v => v.Info.Position).Last();
                 Length = (ushort)(last.Info.Position + last.BytesCount);

+ 1 - 1
WCS.WorkEngineering/Systems/AgvSystems.cs

@@ -169,7 +169,7 @@ namespace WCS.WorkEngineering.Systems
                                 srm = stations.Select(v => v.Entity.Sources).SelectMany(v => v).Where(v => v.IsTunnel()) //上一个地址是巷道的
                                               .Select(v => v.Sources).SelectMany(v => v).Where(v => v.HasProtocol(typeof(ISRM520))) //筛选出堆垛机
                                               .Select(v => new SRM(v, this.World)) //转换为SRM
-                                              .Where(v => !v.Data2.Status.HasFlag(SrmStatus.Alarm) && v.Data2.AutoStatus == SrmAutoStatus.Automatic) //筛选出可用堆垛机
+                                              .Where(v => v != null && !v.Data2.Status.HasFlag(SrmStatus.Alarm) && v.Data2.AutoStatus == SrmAutoStatus.Automatic) //筛选出可用堆垛机
                                               .Where(v => tunnelNo.Contains(v.Entity.Code)) //筛选出巷道优先级最高的堆垛机
                                               .MinBy(v => tunnelNo.IndexOf(v.Entity.Code));//按照巷道优先级排序
                                 this.ExRecord(obj.Entity.Code, $"AGV任务{agv.ID},可用堆垛机{srm.Entity.Code}");

+ 11 - 5
WCS.WorkEngineering/WebApi/Controllers/WcsController.cs

@@ -1,5 +1,6 @@
 using Microsoft.AspNetCore.Mvc;
 using Newtonsoft.Json;
+using PlcSiemens.Core.Extension;
 using ServiceCenter;
 using ServiceCenter.Attributes;
 using ServiceCenter.Extensions;
@@ -132,9 +133,11 @@ namespace WCS.WorkEngineering.WebApi.Controllers
                             var agv = db.Default.Queryable<WCS_AgvTaskInfo>().Where(v => v.ID == task.AgvTaskID).SplitTable(v => v.Take(2)).First();
                             if (agv != null)
                             {
-                                var cancelTaskUpdateRes = CancelAgvTask(response, item, agv.AgvID);
-                                if (cancelTaskUpdateRes == null) continue;
-
+                                if (!agv.AgvID.IsNullOrEmpty())
+                                {
+                                    var cancelTaskUpdateRes = CancelAgvTask(response, item, agv.AgvID);
+                                    if (cancelTaskUpdateRes == null) continue;
+                                }
                                 agv.Status = AGVTaskStatus.Cancel;
                                 agv.AgvStatus = AGVTaskStatus.Cancel;
                                 db.Default.Updateable(agv).SplitTable().ExecuteCommand();
@@ -198,8 +201,11 @@ namespace WCS.WorkEngineering.WebApi.Controllers
                                 var agv = db.Default.Queryable<WCS_AgvTaskInfo>().Where(v => v.ID == task.AgvTaskID).SplitTable(v => v.Take(2)).First();
                                 if (agv != null)
                                 {
-                                    var cancelTaskUpdateRes = CancelAgvTask(response, item, agv.AgvID);
-                                    if (cancelTaskUpdateRes == null) continue;
+                                    //if (!agv.AgvID.IsNullOrEmpty())
+                                    //{
+                                    //    var cancelTaskUpdateRes = CancelAgvTask(response, item, agv.AgvID);
+                                    //    if (cancelTaskUpdateRes == null) continue;
+                                    //}
                                     agv.Status = AGVTaskStatus.MissionCompleted;
                                     agv.AgvStatus = AGVTaskStatus.MissionCompleted;
                                     db.Default.Updateable(agv).SplitTable().ExecuteCommand();

+ 21 - 0
WCS.WorkEngineering/WebApi/Models/WMS/Request/CompleteTaskVerifyRequest.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WCS.WorkEngineering.WebApi.Models.WMS.Request
+{
+    public class CompleteTaskVerifyRequest
+    {
+        /// <summary>
+        ///  任务号集合
+        /// </summary>
+        public List<int> TaskNo { get; set; }
+
+        /// <summary>
+        ///  目标状态
+        /// </summary>
+        public int State { get; set; }
+    }
+}

+ 6 - 6
WCS.WorkEngineering/WorkStart.cs

@@ -93,7 +93,7 @@ namespace WCS.WorkEngineering
 
             #region 初始化堆垛机相关信息
 
-            for (int i = 1; i <= 3; i++)
+            for (int i = 2; i <= 3; i++)
             {
                 var srm = new Device($"SRM{i}");
                 srm.AddFlag(DeviceFlags.堆垛机);
@@ -114,17 +114,17 @@ namespace WCS.WorkEngineering
 
             List<RouteInfo> routeInfos = new List<RouteInfo>
             {
-                new RouteInfo("SRM1", new string[] { "TY1" }),
+                //new RouteInfo("SRM1", new string[] { "TY1" }),
                 new RouteInfo("SRM2", new string[] { "TY2" }),
                 new RouteInfo("SRM3", new string[] { "TY3" }),
-                new RouteInfo("TY1", new string[] { "SRM1" }),
+                //new RouteInfo("TY1", new string[] { "SRM1" }),
                 new RouteInfo("TY2", new string[] { "SRM2" }),
                 new RouteInfo("TY3", new string[] { "SRM3" }),
-                new RouteInfo("TY1", new string[] { "1011", "1021" }),
+                //new RouteInfo("TY1", new string[] { "1011", "1021" }),
                 new RouteInfo("TY2", new string[] { "1013", "1023" }),
                 new RouteInfo("TY3", new string[] { "1015", "1025" }),
-                new RouteInfo("1012", new string[] { "TY1" }),
-                new RouteInfo("1022", new string[] { "TY1" }),
+                //new RouteInfo("1012", new string[] { "TY1" }),
+                //new RouteInfo("1022", new string[] { "TY1" }),
                 new RouteInfo("1014", new string[] { "TY2" }),
                 new RouteInfo("1024", new string[] { "TY2" }),
                 new RouteInfo("1016", new string[] { "TY3" }),