华恒Mes鼎捷代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
6.6 KiB

5 months ago
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using ICSSoft.Frame.Data.Entity;
  5. using System.Linq;
  6. using System.Data.Linq;
  7. using System.Xml.Linq;
  8. using ICSSoft.Base.Config.AppConfig;
  9. using ICSSoft.Frame.DataCollect;
  10. namespace ICSSoft.Frame.DataConnect.Action
  11. {
  12. /// <summary>
  13. /// ���������ɼ�
  14. /// </summary>
  15. public class ActionGood : IActionWithStatus
  16. {
  17. private FramDataContext _domainDataProvider = null;
  18. // public ActionGood()
  19. // {
  20. // }
  21. public ActionGood(FramDataContext domainDataProvider)
  22. {
  23. this._domainDataProvider = domainDataProvider;
  24. }
  25. public FramDataContext DataProvider
  26. {
  27. get
  28. {
  29. return _domainDataProvider;
  30. }
  31. }
  32. public Messages Execute(ActionEventArgs actionEventArgs)
  33. {
  34. Messages messages = new Messages();
  35. Messages msgAutoGoMO = new Messages();
  36. try
  37. {
  38. // �����Զ���������
  39. //ActionGoToMO actionGoToMO = new ActionGoToMO(this.DataProvider);
  40. //msgAutoGoMO = actionGoToMO.AutoGoMO(actionEventArgs);
  41. // Added end
  42. ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
  43. //��дSIMULATION ���鹤����ID��;�̡�����
  44. messages.AddMessages(dataCollect.CheckID(actionEventArgs));
  45. if (messages.IsSuccess())
  46. {
  47. //���� �깤�߼���������Check��ͨ���������£����е�RunningCardӦ����GOOD״̬
  48. //��ʱ���������⹤��
  49. DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
  50. if (actionEventArgs.ProductInfo.NowSimulation.ROUTECODE != "" && dataCollectFacade.OPIsMORouteLastOP(
  51. actionEventArgs.ProductInfo.NowSimulation.MOCODE
  52. , actionEventArgs.ProductInfo.NowSimulation.ROUTECODE
  53. , actionEventArgs.ProductInfo.NowSimulation.OPCODE))
  54. {
  55. actionEventArgs.ProductInfo.NowSimulation.ISCOM = "1";
  56. actionEventArgs.ProductInfo.NowSimulation.EATTRIBUTE1 = "GOOD";
  57. // dataCollectFacade.DeductMaterialQty(actionEventArgs);
  58. }
  59. messages.AddMessages(dataCollect.Execute(actionEventArgs));
  60. if (messages.IsSuccess())
  61. {
  62. //��д���Ա��� TODO
  63. ReportHelper reportCollect = new ReportHelper(this.DataProvider);
  64. //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));
  65. //messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));
  66. }
  67. }
  68. }
  69. catch (Exception e)
  70. {
  71. messages.Add(new Message(e));
  72. }
  73. if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false))
  74. return messages;
  75. else
  76. {
  77. msgAutoGoMO.IgnoreError();
  78. msgAutoGoMO.AddMessages(messages);
  79. return msgAutoGoMO;
  80. }
  81. }
  82. public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
  83. {
  84. Messages messages = new Messages();
  85. Messages msgAutoGoMO = new Messages();
  86. try
  87. {
  88. // Added end
  89. ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
  90. //��дSIMULATION ���鹤����ID��;�̡�����
  91. messages.AddMessages(dataCollect.CheckID(actionEventArgs, actionCheckStatus));
  92. if (messages.IsSuccess())
  93. {
  94. //���� �깤�߼���������Check��ͨ���������£����е�RunningCardӦ����GOOD״̬
  95. //��ʱ���������⹤��
  96. DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
  97. if (actionEventArgs.ProductInfo.NowSimulation.ROUTECODE != "" && dataCollectFacade.OPIsMORouteLastOP(
  98. actionEventArgs.ProductInfo.NowSimulation.MOCODE
  99. , actionEventArgs.ProductInfo.NowSimulation.ROUTECODE
  100. , actionEventArgs.ProductInfo.NowSimulation.OPCODE))
  101. {
  102. actionEventArgs.ProductInfo.NowSimulation.ISCOM = "1";
  103. actionEventArgs.ProductInfo.NowSimulation.EATTRIBUTE1 = "GOOD";
  104. }
  105. if (actionCheckStatus.NeedUpdateSimulation == true)
  106. {
  107. messages.AddMessages(dataCollect.Execute(actionEventArgs));
  108. }
  109. else
  110. {
  111. messages.AddMessages(dataCollect.Execute(actionEventArgs, actionCheckStatus));
  112. }
  113. if (messages.IsSuccess())
  114. {
  115. // �Զ������ͼ���
  116. if (messages.IsSuccess())
  117. {
  118. //��д���Ա��� TODO
  119. if (actionCheckStatus.NeedFillReport == true)
  120. {
  121. ReportHelper reportCollect = new ReportHelper(this.DataProvider);
  122. messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo, actionCheckStatus));
  123. }
  124. //��Action�����б�
  125. actionCheckStatus.ActionList.Add(actionEventArgs);
  126. }
  127. }
  128. }
  129. else
  130. {
  131. throw new Exception(messages.ToString());
  132. }
  133. }
  134. catch (Exception e)
  135. {
  136. messages.Add(new Message(e));
  137. }
  138. if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false))
  139. return messages;
  140. else
  141. {
  142. msgAutoGoMO.IgnoreError();
  143. msgAutoGoMO.AddMessages(messages);
  144. return msgAutoGoMO;
  145. }
  146. }
  147. }
  148. }