TaskBookBehavior_63008.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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_63008 : BaseTaskBookBehaviorV2
  21. {
  22. LocationPropertyManager locationManager = new LocationPropertyManager();
  23. public TaskBookBehavior_63008() : base(63008, "续接任务")
  24. {
  25. }
  26. public override bool TaskBookOperator(TaskData taskDetailInfo, StepData stepInfo)
  27. {
  28. try
  29. {
  30. string location1 = stepInfo.WareHouseID.GetLocationMember("续接任务取货点");
  31. if (string.IsNullOrEmpty(location1))
  32. {
  33. Log(taskDetailInfo, stepInfo, $"未配置续接任务取货点");
  34. return true;
  35. }
  36. string location2 = stepInfo.WareHouseID.GetLocationMember("续接任务放货点");
  37. if (string.IsNullOrEmpty(location2))
  38. {
  39. Log(taskDetailInfo, stepInfo, $"未配置续接任务放货点");
  40. return true;
  41. }
  42. locationManager.UpdateStatus(location2, LocationStatus.Empty);
  43. PmsTaskInfoDto data = new PmsTaskInfoDto();
  44. data.LocationCode = location1;
  45. data.TargetLocationCode = location2;
  46. data.ParentTaskId = taskDetailInfo.TaskID;
  47. data.Carrier = taskDetailInfo.Carrier;
  48. var result = PmsTaskService.Instance.TaskAdd(data);
  49. if (result.code != 20000)
  50. {
  51. Log(taskDetailInfo, stepInfo, $"续接任务失败 {result.message}");
  52. return false;
  53. }
  54. //Log(taskDetailInfo, stepInfo, $"续接任务成功 {result.message}");
  55. System.Threading.Thread.Sleep(1000);
  56. return true;
  57. }
  58. catch (Exception ex)
  59. {
  60. LogException(ex);
  61. }
  62. return false;
  63. }
  64. }
  65. }