TaskBookBehavior_61010.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using MaxCommunication.DataBase.Document;
  2. using PmsSecondaryPackaging.Interface.Model.Carrier;
  3. using PmsSecondaryPackaging.Interface.Model.StepBook;
  4. using PmsSecondaryPackaging.Interface.Model.TaskBook;
  5. using PmsSecondaryPackaging.TaskManager.TaskBookBehavior;
  6. using ProjectManagementSystem.NHibernateDBHelper;
  7. using System.Collections.Generic;
  8. using System.Threading;
  9. using System.Linq;
  10. using System;
  11. namespace ProjectManagementSystem.TaskBookEvent
  12. {
  13. public class TaskBookBehavior_61010 : BaseTaskBookBehavior
  14. {
  15. public TaskBookBehavior_61010() : base(61010)
  16. {
  17. }
  18. public override bool TaskBookSetting(TaskDetailInfoModel taskDetailInfo, List<StepDetailInfoModel> taskStepInfoList, CarrierInfoModel carrierInfo)
  19. {
  20. //IsEnable = false; Asynchronous = true;
  21. return base.TaskBookSetting(taskDetailInfo, taskStepInfoList, carrierInfo);
  22. }
  23. public override bool TaskBookTermination(TaskDetailInfoModel taskDetailInfo, List<StepDetailInfoModel> taskStepInfoList, CarrierInfoModel carrierInfo)
  24. {
  25. return base.TaskBookTermination(taskDetailInfo, taskStepInfoList, carrierInfo);
  26. }
  27. public override bool TaskBookOperator(TaskDetailInfoModel taskDetailInfo, List<StepDetailInfoModel> taskStepInfoList, CarrierInfoModel carrierInfo)
  28. {
  29. bool successed = false;
  30. StepDetailInfoModel currentStep = taskStepInfoList.Find(p => p.StepId == taskDetailInfo.CurrentStepID);
  31. string strCurWareHouse = currentStep.WareHouseID;
  32. try
  33. {
  34. bool pass = false;
  35. string curWareHouse = "";
  36. using (var session = WMSDBModelHelper.Session)
  37. {
  38. var result = session.QueryOver<WareHouseLocation>().Where(p => p.WareHouseCode == "002" && p.Status == "2").List().OrderBy(p => p.Attribute2).ThenByDescending(p => p.Attribute3);//.;//
  39. List<WareHouseLocation> list = result.ToList();
  40. if (list.Count() > 0)
  41. {
  42. curWareHouse = list.First().LocationCode;
  43. pass = true;
  44. }
  45. }
  46. if (pass)
  47. {
  48. successed = true;
  49. TextDocument.WriteFile(@"PMS/Log", "选择1楼电梯满库位上料61010", string.Format("选择目标库位:{0}", curWareHouse));
  50. }
  51. bool resultTask = InterfaceService.GetTask(taskDetailInfo.TaskID, out TaskDetailInfoModel taskDetailInfo1, out string message);
  52. if (string.IsNullOrEmpty(message) && taskDetailInfo1 == null)
  53. {
  54. successed = true;
  55. }
  56. }
  57. catch (Exception ex)
  58. {
  59. TextDocument.WriteFile(@"PMS/Log", "选择1楼电梯满库位上料61010", string.Format("异常:{0}", ex.ToString()));
  60. }
  61. return successed;
  62. }
  63. }
  64. }