TaskBookBehavior_63006.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using DbCommon.BusinessCore.BaseCore;
  2. using DbCommon.Enties.DbModels;
  3. using Pms.DataLibrary.Order;
  4. using ProjectManagementSystem.Common.Core;
  5. using ProjectManagementSystem.Common.Extenions;
  6. using ProjectManagementSystem.Common.Logger;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace ProjectManagementSystem.TaskBookEvent
  13. {
  14. public class TaskBookBehavior_63006 : BaseTaskBookBehaviorV2
  15. {
  16. LocationPropertyManager locationManager = new LocationPropertyManager();
  17. public TaskBookBehavior_63006() : base(63006, "等待放行盒放行")
  18. {
  19. }
  20. public override bool TaskBookOperator(TaskData taskDetailInfo, StepData stepInfo)
  21. {
  22. try
  23. {
  24. int[] marks = stepInfo.WareHouseID.GetLocationMember("放行叫料路线").ToValueArray<int>();
  25. if (marks == null || marks.Length == 0)
  26. {
  27. Log(taskDetailInfo, stepInfo, "未配置放行叫料路线,步骤完成");
  28. return true;
  29. }
  30. int count = DeviceControl.Instance.Communication.InfoBoxDictionary.Values
  31. .Count(d => d.DataValid && marks.Contains(d.Route) && d.BoxCalled);
  32. if (count < marks.Length)
  33. {
  34. Log(taskDetailInfo, stepInfo, "等待放行");
  35. return false;
  36. }
  37. for (int j = 0; j < 3; j++)
  38. {
  39. for (int i = 0; i < marks.Length; i++)
  40. {
  41. DeviceControl.Instance.CallBoxLightOff(marks[i]);
  42. System.Threading.Thread.Sleep(100);
  43. }
  44. }
  45. Log(taskDetailInfo, stepInfo, $"已放行,灭灯");
  46. return true;
  47. }
  48. catch (Exception ex)
  49. {
  50. LogException(ex);
  51. }
  52. return false;
  53. }
  54. }
  55. }