二楼出库工位处理系统.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using ServiceCenter.SqlSugars;
  2. using System.ComponentModel;
  3. using WCS.Core;
  4. using WCS.Entity;
  5. using WCS.WorkEngineering.Extensions;
  6. using WCS.WorkEngineering.WebApi.Controllers;
  7. using DeviceFlags = WCS.WorkEngineering.Extensions.DeviceFlags;
  8. namespace WCS.WorkEngineering.Systems
  9. {
  10. /// <summary>
  11. /// 出库站台交互
  12. /// </summary>
  13. //[BelongTo(typeof(MainWorld))]
  14. [Description("二楼出库工位处理系统")]
  15. public class 二楼出库工位处理系统 : DeviceSystem<Station>
  16. {
  17. protected override bool ParallelDo => true;
  18. protected override bool SaveLogsToFile => true;
  19. public override void Do(Station obj)
  20. {
  21. var IsThereATask = false; //无任务
  22. #region 判断站点是否有任务
  23. //光电有货或有任务有货
  24. if (obj.Data3.Status.HasFlag(Entity.Protocol.Station.StatusEunm.PH_Status) || obj.Data3.Status.HasFlag(Entity.Protocol.Station.StatusEunm.OT_Status))
  25. {
  26. if (!obj.Data3.Status.HasFlag(Entity.Protocol.Station.StatusEunm.PH_Status))
  27. IsThereATask = true;
  28. }
  29. #endregion 判断站点是否有任务
  30. if (IsThereATask)
  31. {
  32. }
  33. else
  34. {
  35. if (obj.Entity.HasFlag(DeviceFlags.一楼出库口))
  36. {
  37. var any = false;
  38. SqlSugarHelper.Do(db =>
  39. {
  40. any = db.Default.Queryable<WCS_TaskInfo>().Any(v => v.AddrTo == obj.Entity.Code && v.Status <= Entity.TaskStatus.AGVExecution);
  41. });
  42. if (!any) WmsApi.ApplyStockOutTask(obj.Entity.Code);
  43. }
  44. }
  45. }
  46. public override bool Select(Device dev)
  47. {
  48. //return dev.Code == "1016";
  49. return dev.HasFlag(DeviceFlags.巷道口) && dev.HasFlag(DeviceFlags.出库);
  50. }
  51. }
  52. }