ProcessPlcClear.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Pms.DataLibrary.Order;
  2. using ProjectManagementSystem.Common.Config;
  3. using ProjectManagementSystem.Common.Core;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace ProjectManagementSystem.TaskEvent
  10. {
  11. public class ProcessPlcClear : ICustomProcess
  12. {
  13. private List<string> m_currentPosList = new List<string>();
  14. public void CustomProcess(List<TaskData> dataList)
  15. {
  16. m_currentPosList.Clear();
  17. for (int i = 0; i < dataList.Count; i++)
  18. {
  19. var data = dataList[i];
  20. string[] posArray = data.StepList?
  21. .OrderBy(d => d.StepID)?
  22. .Select(d => d.WareHouseID)?
  23. .Distinct()?
  24. .ToArray();
  25. if (posArray != null)
  26. {
  27. for (int idx = 0; idx < posArray.Length; idx++)
  28. {
  29. m_currentPosList.Add(posArray[idx]);
  30. }
  31. }
  32. }
  33. var RouteConfigList = ExcelConfig.Instance.RouteConfigList;
  34. for (int i = 0; i < RouteConfigList.Count; i++)
  35. {
  36. var routeConfig = ExcelConfig.Instance.RouteConfigList[i];
  37. //工位没有任务了,需要清零信号
  38. routeConfig.PlcIsNeedClear = (!string.IsNullOrEmpty(routeConfig.PlcIpAddr) || routeConfig.IOTransID > 0)&& !m_currentPosList.Contains(routeConfig.LocationCode);
  39. }
  40. }
  41. }
  42. }