TaskBookBehavior_63022.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using DbCommon.BusinessCore.BaseCore;
  2. using DbCommon.Enties.DbModels;
  3. using Pms.DataLibrary.Models;
  4. using Pms.DataLibrary.Order;
  5. using Pms.Models;
  6. using ProjectManagementSystem.Common.Config;
  7. using ProjectManagementSystem.Common.Extenions;
  8. using ProjectManagementSystem.Common.Logger;
  9. using ProjectManagementSystem.Common.WebApi;
  10. using ProjectManagementSystem.Common.Models;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Threading.Tasks;
  16. using ProjectManagementSystem.Common.Service;
  17. using ProjectManagementSystem.Common.Core;
  18. namespace ProjectManagementSystem.TaskBookEvent
  19. {
  20. public class TaskBookBehavior_63022 : BaseTaskBookBehaviorV2
  21. {
  22. public TaskBookBehavior_63022() : base(63022, "上报任务状态(任务开始)")
  23. {
  24. }
  25. public override bool TaskBookOperator(TaskData taskDetailInfo, StepData stepInfo)
  26. {
  27. try
  28. {
  29. var t = PmsTaskService.Instance.GetTaskState(taskDetailInfo.TaskID);
  30. if (t == null)
  31. {
  32. Log(taskDetailInfo, stepInfo, $"获取任务状态失败");
  33. return false;
  34. }
  35. t.currentPositionCode = taskDetailInfo.StepList.OrderBy(d => d.StepID).FirstOrDefault(d => !string.IsNullOrEmpty(d.WareHouseID)).WareHouseID;
  36. t.method = "start";
  37. bool result = CustomerApi.AgvCallback(t, out string content);
  38. Log(taskDetailInfo, stepInfo, $"{Remark}{result.ToChineseString()} {content}");
  39. return true;
  40. }
  41. catch (Exception ex)
  42. {
  43. LogException(ex);
  44. }
  45. return false;
  46. }
  47. }
  48. }