林豪 左 2 anni fa
parent
commit
bb0a9fb449
1 ha cambiato i file con 21 aggiunte e 5 eliminazioni
  1. 21 5
      Projects/永冠OPP/WCS.Service/Works/SRM/SRMWork.cs

+ 21 - 5
Projects/永冠OPP/WCS.Service/Works/SRM/SRMWork.cs

@@ -439,12 +439,28 @@ namespace WCS.Service.Works.SRM
                                    .ToList();
 
                     if (!arrIn.Any()) return; //当前堆垛机无入库任务
-
+                    var lastIn = srmDevice.Entity.Get<int>("LastIn");
+                    StationDevice station = null;
                     //入库口设备信息 找一个有任务有光电且不在运行状态位的取货点 如果找不到代表任务还在输送途中
-                    var station = arrIn.OrderBy(v => v.Data2.Tasknum > 0 && v.Data2.Status.HasFlag(IstationStatus.光电状态) && !v.Data3.Status.HasFlag(StationStatus.运行状态位) ? 0 : 1)
-                                       .ThenBy(v => v.Entity.Is(DF.SRM涂布取货) ? 0 : 1)
-                                       .ThenBy(v => v.Entity.Is(DF.SRMBOPP取货) ? 0 : 1)
-                                       .FirstOrDefault() ?? throw new WarnException($"[{deviceCode}]等待入库任务输送到位");
+                    if (lastIn is 0 or 1)
+                    {
+                        // 涂布优先为2
+                        srmDevice.Entity.Set("LastIn", 2);
+                        station = arrIn.OrderBy(v => v.Data2.Tasknum > 0 && v.Data2.Status.HasFlag(IstationStatus.光电状态) && !v.Data3.Status.HasFlag(StationStatus.运行状态位) ? 0 : 1)
+                                          .ThenBy(v => v.Entity.Is(DF.SRM涂布取货) ? 0 : 1)
+                                          .ThenBy(v => v.Entity.Is(DF.SRMBOPP取货) ? 0 : 1)
+                                          .FirstOrDefault() ?? throw new WarnException($"[{deviceCode}]等待入库任务输送到位");
+                    }
+                    else if (lastIn == 2)
+                    {
+                        // BOPP优先为1
+                        srmDevice.Entity.Set("LastIn", 1);
+                        station = arrIn.OrderBy(v => v.Data2.Tasknum > 0 && v.Data2.Status.HasFlag(IstationStatus.光电状态) && !v.Data3.Status.HasFlag(StationStatus.运行状态位) ? 0 : 1)
+                                          .ThenBy(v => v.Entity.Is(DF.SRMBOPP取货) ? 0 : 1)
+                                          .ThenBy(v => v.Entity.Is(DF.SRM涂布取货) ? 0 : 1)
+                                          .FirstOrDefault() ?? throw new WarnException($"[{deviceCode}]等待入库任务输送到位");
+                    }
+
 
                     //根据上述筛选条件筛选出来的入库任务 找到对应的设备组
                     var item = Device.Where(v => v.DEVICEGROUP.Any(p => p.MEMBER.CODE == station.Entity.CODE)).Single();