华恒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.

609 lines
28 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. using ICSSoft.Frame.Helper;
  11. namespace ICSSoft.Frame.DataConnect.Action
  12. {
  13. /// <summary>
  14. /// ���������ɼ�
  15. /// ���⣺��վͬʱͶ��ͬһ����ʱ���ᷢ����ͻ
  16. /// </summary>
  17. public class ActionGoToMO : IActionWithStatus
  18. {
  19. private FramDataContext _domainDataProvider = null;
  20. public ActionGoToMO(FramDataContext domainDataProvider)
  21. {
  22. this._domainDataProvider = domainDataProvider;
  23. }
  24. public FramDataContext DataProvider
  25. {
  26. get
  27. {
  28. return _domainDataProvider;
  29. }
  30. }
  31. public Messages CheckIn(ActionEventArgs actionEventArgs)
  32. {
  33. ((GoToMOActionEventArgs)actionEventArgs).PassCheck = true;
  34. Messages messages = new Messages();
  35. try
  36. {
  37. DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
  38. //����Ĭ��Ϊ��ʼ��FOR �ع����к��ظ�
  39. actionEventArgs.ProductInfo.NowSimulation.RCARDSEQ = ActionOnLineHelper.StartSeq;
  40. if (((GoToMOActionEventArgs)actionEventArgs).MOCode == null || ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == string.Empty)
  41. {
  42. throw new Exception("$CS_Sys_GoToMO_Lost_MOParam");
  43. }
  44. #region ����;��
  45. //����ActionCheckStatus��û�м�����;�̣�������;�̣�����CheckedOP��ΪTrue
  46. ICSMO mo = null;
  47. if (mo == null || mo.ISCONINPUT == "1")
  48. {
  49. if (actionEventArgs.CurrentMO != null)
  50. {
  51. mo = actionEventArgs.CurrentMO;
  52. }
  53. else
  54. {
  55. mo = (ICSMO)this.DataProvider.ICSMO.SingleOrDefault<ICSMO>(a => a.MOCODE == ((GoToMOActionEventArgs)actionEventArgs).MOCode && a.WorkPoint == AppConfig.WorkPointCode);
  56. actionEventArgs.CurrentMO = mo;
  57. }
  58. if (mo == null)
  59. {
  60. throw new Exception("$CS_MO_Not_Exit");
  61. }
  62. }
  63. ICSMO2ROUTE route = null;
  64. if (route == null)
  65. {
  66. route = (ICSMO2ROUTE)dataCollectFacade.GetMONormalRouteByMOCode(mo.MOCODE);
  67. if (route == null)
  68. {
  69. throw new Exception("$CS_MOnotNormalRoute");
  70. }
  71. }
  72. ICSITEMROUTE2OP op =null;
  73. if (op == null)
  74. {
  75. op = dataCollectFacade.GetMORouteFirstOperation(mo.MOCODE, route.ROUTECODE);
  76. }
  77. ICSBaseModel baseMode = new ICSBaseModel(this.DataProvider);
  78. if (baseMode.GetOperation2Resource(op.OPCODE, actionEventArgs.ResourceCode) == null)
  79. {
  80. throw new Exception("$CS_Route_Failed_FirstOP $Domain_MO =" + mo.MOCODE);
  81. }
  82. #endregion
  83. #region �����Ƿ����Զ�����lot��OPά��
  84. string itemCode = mo.ITEMCODE;
  85. object item = this.DataProvider.ICSINVENTORY.SingleOrDefault(a => a.INVCODE == itemCode && a.WorkPoint == AppConfig.WorkPointCode);
  86. if (item == null)
  87. {
  88. throw new Exception("$Error_ItemCode_NotExist $Domain_ItemCode=" + itemCode);
  89. }
  90. #endregion
  91. #region ���SIMULATION
  92. actionEventArgs.ProductInfo.NowSimulation.ROUTECODE = route.ROUTECODE;
  93. actionEventArgs.ProductInfo.NowSimulation.OPCODE = op.OPCODE;
  94. actionEventArgs.ProductInfo.NowSimulation.LACTION = ActionType.DataCollectAction_GoMO;
  95. actionEventArgs.ProductInfo.NowSimulation.ACTIONLIST = ";" + ActionType.DataCollectAction_GoMO + ";";
  96. actionEventArgs.ProductInfo.NowSimulation.RCARD = actionEventArgs.RunningCard;
  97. //������ǰ���Ѿ�����
  98. actionEventArgs.ProductInfo.NowSimulation.TCARD = actionEventArgs.RunningCard;
  99. actionEventArgs.ProductInfo.NowSimulation.TCARDSEQ = ActionOnLineHelper.StartSeq;
  100. actionEventArgs.ProductInfo.NowSimulation.SCARD = actionEventArgs.RunningCard;
  101. actionEventArgs.ProductInfo.NowSimulation.SCARDSEQ = ActionOnLineHelper.StartSeq;
  102. actionEventArgs.ProductInfo.NowSimulation.MOCODE = mo.MOCODE;
  103. actionEventArgs.ProductInfo.NowSimulation.ITEMCODE = mo.ITEMCODE;
  104. //
  105. ICSMODEL model=null;
  106. if (model == null)
  107. {
  108. model = this.DataProvider.ICSMODEL.SingleOrDefault(a => a.MODELCODE == ((ICSINVENTORY)item).INVMODELCODE && a.WorkPoint == AppConfig.WorkPointCode);
  109. if (model == null)
  110. {
  111. throw new Exception("$CS_Model_Lost $CS_Param_ItemCode=" + mo.ITEMCODE);
  112. }
  113. }
  114. // Changed end
  115. actionEventArgs.ProductInfo.NowSimulation.MODELCODE = model.MODELCODE;
  116. actionEventArgs.ProductInfo.NowSimulation.IDMERGERULE = mo.IDMERGERULE;
  117. actionEventArgs.ProductInfo.NowSimulation.ISCOM = ProductComplete.NoComplete;
  118. actionEventArgs.ProductInfo.NowSimulation.RESCODE = actionEventArgs.ResourceCode;
  119. actionEventArgs.ProductInfo.NowSimulation.PRODUCTSTATUS = ProductStatus.GOOD;
  120. actionEventArgs.ProductInfo.NowSimulation.FROMOP = ActionOnLineHelper.StringNull;
  121. actionEventArgs.ProductInfo.NowSimulation.FROMROUTE = ActionOnLineHelper.StringNull;
  122. actionEventArgs.ProductInfo.NowSimulation.CARTONCODE = ActionOnLineHelper.StringNull;
  123. actionEventArgs.ProductInfo.NowSimulation.LOTNO = ActionOnLineHelper.StringNull;
  124. actionEventArgs.ProductInfo.NowSimulation.PALLETCODE = ActionOnLineHelper.StringNull;
  125. actionEventArgs.ProductInfo.NowSimulation.NGTIMES = ActionOnLineHelper.StartNGTimes;
  126. actionEventArgs.ProductInfo.NowSimulation.ISHOLD = "0";
  127. actionEventArgs.ProductInfo.NowSimulation.MOSEQ = Int32.Parse(mo.MOSEQ);
  128. actionEventArgs.ProductInfo.NowSimulation.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  129. actionEventArgs.ProductInfo.NowSimulation.MUSER = AppConfig.UserCode;
  130. actionEventArgs.ProductInfo.NowSimulation.MUSERName = AppConfig.UserName;
  131. actionEventArgs.ProductInfo.NowSimulation.WorkPoint = AppConfig.WorkPointCode;
  132. #endregion
  133. #region ���鹤������
  134. //��������ʱ��������Ʒ�����ڲ����趨�еģ������Ӳ�Ʒ�׼�����
  135. object obj_SysEn = this.DataProvider.Sys_EnumValues.SingleOrDefault(a => a.WorkPointCode == AppConfig.WorkPointCode && a.EnumKey == "CHECKGOMOGROUP" && a.EnumValue == ((ICSINVENTORY)item).INVMODELCODE);
  136. if (obj_SysEn != null)
  137. {
  138. object firstCheck = dataCollectFacade.GetFirstCheckByMO(mo.MOCODE, DateTime.Now.ToString("yyyy-MM-dd"));
  139. if (firstCheck == null)
  140. {
  141. throw new Exception("$CS_MOCode_No_FirstCheck");
  142. }
  143. else if (((ICSFIRSTCHECKBYMO)firstCheck).CHECKRESULT == "UnQualified")
  144. {
  145. throw new Exception("$CS_MOCode_FirstCheck_NotPass");
  146. }
  147. }
  148. #endregion
  149. }
  150. catch (Exception e)
  151. {
  152. messages.Add(new Message(e));
  153. }
  154. return messages;
  155. }
  156. public Messages CheckIn(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
  157. {
  158. ((GoToMOActionEventArgs)actionEventArgs).PassCheck = true;
  159. Messages messages = new Messages();
  160. try
  161. {
  162. DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
  163. //����Ĭ��Ϊ��ʼ��FOR �ع����к��ظ�
  164. actionEventArgs.ProductInfo.NowSimulation.RCARDSEQ = ActionOnLineHelper.StartSeq;
  165. if (((GoToMOActionEventArgs)actionEventArgs).MOCode == null || ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == string.Empty)
  166. {
  167. throw new Exception("$CS_Sys_GoToMO_Lost_MOParam");
  168. }
  169. #region ����;��
  170. //����ActionCheckStatus��û�м�����;�̣�������;�̣�����CheckedOP��ΪTrue
  171. ICSMO mo = actionCheckStatus.MO;
  172. if (mo == null || mo.ISCONINPUT == "1")
  173. {
  174. if (actionEventArgs.CurrentMO != null)
  175. {
  176. mo = actionEventArgs.CurrentMO;
  177. }
  178. else
  179. {
  180. mo = (ICSMO)this.DataProvider.ICSMO.SingleOrDefault<ICSMO>(a => a.MOCODE == ((GoToMOActionEventArgs)actionEventArgs).MOCode && a.WorkPoint == AppConfig.WorkPointCode);
  181. actionEventArgs.CurrentMO = mo;
  182. }
  183. if (mo == null)
  184. {
  185. throw new Exception("$CS_MO_Not_Exit");
  186. }
  187. actionCheckStatus.MO = mo;
  188. }
  189. ICSMO2ROUTE route = actionCheckStatus.Route;
  190. if (route == null)
  191. {
  192. route = (ICSMO2ROUTE)dataCollectFacade.GetMONormalRouteByMOCode(mo.MOCODE);
  193. if (route == null)
  194. {
  195. throw new Exception("$CS_MOnotNormalRoute");
  196. }
  197. actionCheckStatus.Route = route;
  198. }
  199. ICSITEMROUTE2OP op = actionCheckStatus.OP;
  200. if (op == null)
  201. {
  202. op = dataCollectFacade.GetMORouteFirstOperation(mo.MOCODE, route.ROUTECODE);
  203. actionCheckStatus.OP = op;
  204. }
  205. if (actionCheckStatus.CheckedOP == false)
  206. {
  207. ICSBaseModel baseMode = new ICSBaseModel(this.DataProvider);
  208. if (baseMode.GetOperation2Resource(op.OPCODE, actionEventArgs.ResourceCode) == null)
  209. {
  210. throw new Exception("$CS_Route_Failed_FirstOP $Domain_MO =" + mo.MOCODE);
  211. }
  212. actionCheckStatus.CheckedOP = true;
  213. }
  214. #endregion
  215. #region ���鹤��
  216. //����״̬����
  217. //����ActionCheckStatus��û�м���������״̬�������飬����CheckedMO��ΪTrue
  218. if (actionCheckStatus.CheckedMO == false)
  219. {
  220. if (!dataCollectFacade.CheckMO(mo))
  221. {
  222. throw new Exception("$CS_MO_Status_Error $CS_Param_MOStatus=$" + mo.MOSTATUS);
  223. }
  224. actionCheckStatus.CheckedMO = true;
  225. }
  226. /*1.Simulation ûм¼
  227. * a. MO Running Card ûظ OK
  228. * b. MO Running Card ظ Exception
  229. *
  230. * 2. Simulation м¼
  231. * a. Simulation ǰ һ OK
  232. * b. Simulation ǰ һ
  233. * b1. ǰ ع
  234. * b11. MO Running Card ûظ OK
  235. * b12. MO Running Card ظ Exception
  236. * b2. ǰع Exception
  237. *
  238. */
  239. //����ActionCheckStatus��û�м���������״̬�������飬����CheckedMO��ΪTrue
  240. string strMOTypeParamValue = actionCheckStatus.MOTypeParamValue;
  241. if (strMOTypeParamValue == string.Empty)
  242. {
  243. actionCheckStatus.MOTypeParamValue = mo.MOTYPE;
  244. }
  245. //���� �������������������IJ�Ʒ���кŲ������ɼ�
  246. if (actionEventArgs.ProductInfo.LastSimulation != null)
  247. {
  248. //���������͹���������ͬҲ������
  249. if ((mo.MOCODE == actionEventArgs.ProductInfo.LastSimulation.MOCODE))
  250. {
  251. ((GoToMOActionEventArgs)actionEventArgs).PassCheck = false;
  252. return messages;
  253. }
  254. //���鷵�����������ɼ�ʱ�����ж�������Ҳ����˵ֻ��û�����Ƽ�¼�Ļ����Ѿ������IJ�Ʒ���кŲ��ܹ�����������
  255. if (actionEventArgs.ProductInfo.LastSimulation.ISCOM == "0")
  256. {
  257. throw new Exception("$CS_PRODUCT_STILL_INLINE_NOT_BELONG_MO ,$CS_Param_ID " + actionEventArgs.RunningCard);
  258. }
  259. }
  260. // Ͷ��������
  261. if (mo.ISCONINPUT == "1") // �ͻ��ڹ����й�ѡ�ˡ�����Ͷ�����������鹤����Ͷ���������򲻼���
  262. {
  263. if (mo.MOPLANQTY - mo.MOINPUTQTY + mo.MOSCRAPQTY + mo.OFFMOQTY - mo.IDMERGERULE < 0)
  264. {
  265. throw new Exception("$CS_MOInputOut");
  266. }
  267. }
  268. #endregion
  269. #region �����Ƿ����Զ�����lot��OPά��
  270. string itemCode = mo.ITEMCODE;
  271. object item = this.DataProvider.ICSINVENTORY.SingleOrDefault(a => a.INVCODE == itemCode && a.WorkPoint == AppConfig.WorkPointCode );
  272. if (item == null)
  273. {
  274. throw new Exception("$Error_ItemCode_NotExist $Domain_ItemCode=" + itemCode);
  275. }
  276. #endregion
  277. #region ���SIMULATION
  278. actionEventArgs.ProductInfo.NowSimulation.ID = AppConfig.GetGuid();
  279. actionEventArgs.ProductInfo.NowSimulation.ROUTECODE = route.ROUTECODE;
  280. actionEventArgs.ProductInfo.NowSimulation.OPCODE = op.OPCODE;
  281. actionEventArgs.ProductInfo.NowSimulation.LACTION = ActionType.DataCollectAction_GoMO;
  282. actionEventArgs.ProductInfo.NowSimulation.ACTIONLIST = ";" + ActionType.DataCollectAction_GoMO + ";";
  283. actionEventArgs.ProductInfo.NowSimulation.RCARD = actionEventArgs.RunningCard;
  284. //������ǰ���Ѿ�����
  285. //actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence = ActionOnLineHelper.StartSeq;
  286. //END
  287. actionEventArgs.ProductInfo.NowSimulation.TCARD = actionEventArgs.RunningCard;
  288. actionEventArgs.ProductInfo.NowSimulation.TCARDSEQ = ActionOnLineHelper.StartSeq;
  289. actionEventArgs.ProductInfo.NowSimulation.SCARD = actionEventArgs.RunningCard;
  290. actionEventArgs.ProductInfo.NowSimulation.SCARDSEQ = ActionOnLineHelper.StartSeq;
  291. actionEventArgs.ProductInfo.NowSimulation.MOCODE = mo.MOCODE;
  292. actionEventArgs.ProductInfo.NowSimulation.ITEMCODE = mo.ITEMCODE;
  293. //
  294. ICSMODEL model = actionCheckStatus.Model;
  295. if (model == null)
  296. {
  297. model = this.DataProvider.ICSMODEL.SingleOrDefault(a => a.MODELCODE == ((ICSINVENTORY)item).INVCLASS && a.WorkPoint == AppConfig.WorkPointCode);
  298. actionCheckStatus.Model = model;
  299. if (model == null)
  300. {
  301. throw new Exception("$CS_Model_Lost $CS_Param_ItemCode=" + mo.ITEMCODE);
  302. }
  303. }
  304. // Changed end
  305. actionEventArgs.ProductInfo.NowSimulation.MODELCODE = model.MODELCODE;
  306. actionEventArgs.ProductInfo.NowSimulation.IDMERGERULE = mo.IDMERGERULE;
  307. actionEventArgs.ProductInfo.NowSimulation.ISCOM = ProductComplete.NoComplete;
  308. actionEventArgs.ProductInfo.NowSimulation.RESCODE = actionEventArgs.ResourceCode;
  309. actionEventArgs.ProductInfo.NowSimulation.PRODUCTSTATUS = ProductStatus.GOOD;
  310. actionEventArgs.ProductInfo.NowSimulation.FROMOP = ActionOnLineHelper.StringNull;
  311. actionEventArgs.ProductInfo.NowSimulation.FROMROUTE = ActionOnLineHelper.StringNull;
  312. actionEventArgs.ProductInfo.NowSimulation.CARTONCODE = ActionOnLineHelper.StringNull;
  313. actionEventArgs.ProductInfo.NowSimulation.LOTNO = ActionOnLineHelper.StringNull;
  314. actionEventArgs.ProductInfo.NowSimulation.PALLETCODE = ActionOnLineHelper.StringNull;
  315. actionEventArgs.ProductInfo.NowSimulation.NGTIMES = ActionOnLineHelper.StartNGTimes;
  316. actionEventArgs.ProductInfo.NowSimulation.ISHOLD = "0";
  317. actionEventArgs.ProductInfo.NowSimulation.MOSEQ = Int32.Parse(mo.MOSEQ);
  318. actionEventArgs.ProductInfo.NowSimulation.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  319. actionEventArgs.ProductInfo.NowSimulation.MUSER = AppConfig.UserCode;
  320. actionEventArgs.ProductInfo.NowSimulation.MUSERName = AppConfig.UserName;
  321. actionEventArgs.ProductInfo.NowSimulation.WorkPoint = AppConfig.WorkPointCode;
  322. #endregion
  323. #region ���鹤������
  324. //��������ʱ��������Ʒ�����ڲ����趨�еģ������Ӳ�Ʒ�׼�����
  325. object obj_SysEn = this.DataProvider.Sys_EnumValues.SingleOrDefault( a => a.WorkPointCode == AppConfig.WorkPointCode && a.EnumKey == "CHECKGOMOGROUP" &&a.EnumValue==((ICSINVENTORY)item).INVMODELCODE);
  326. if (obj_SysEn != null)
  327. {
  328. object firstCheck = dataCollectFacade.GetFirstCheckByMO(mo.MOCODE, DateTime.Now.ToString("yyyy-MM-dd"));
  329. if (firstCheck == null)
  330. {
  331. throw new Exception("$CS_MOCode_No_FirstCheck");
  332. }
  333. else if (((ICSFIRSTCHECKBYMO)firstCheck).CHECKRESULT == "UnQualified")
  334. {
  335. throw new Exception("$CS_MOCode_FirstCheck_NotPass");
  336. }
  337. }
  338. #endregion
  339. }
  340. catch (Exception e)
  341. {
  342. messages.Add(new Message(e));
  343. }
  344. return messages;
  345. }
  346. public Messages Execute(ActionEventArgs actionEventArgs)
  347. {
  348. ((GoToMOActionEventArgs)actionEventArgs).MOCode = ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim().ToUpper();
  349. actionEventArgs.RunningCard = actionEventArgs.RunningCard.Trim().ToUpper();
  350. Messages messages = new Messages();
  351. if (((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == String.Empty)
  352. {
  353. messages.Add(new Message(MessageType.Error, "$CS_Please_Input_MOCode"));
  354. }
  355. if (((GoToMOActionEventArgs)actionEventArgs).RunningCard.Trim() == String.Empty)
  356. {
  357. messages.Add(new Message(MessageType.Error, "$CS_Please_Input_RunningCard"));
  358. }
  359. DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
  360. try
  361. {
  362. actionEventArgs.ProductInfo.NowSimulation.EATTRIBUTE1 = (actionEventArgs as GoToMOActionEventArgs).Memo;
  363. messages.AddMessages(this.CheckIn(actionEventArgs));
  364. if (!((GoToMOActionEventArgs)actionEventArgs).PassCheck)
  365. {
  366. throw new Exception("$���кţ�"
  367. + actionEventArgs.RunningCard + "�ѹ���������" + ((GoToMOActionEventArgs)actionEventArgs).MOCode + ",ǰ����һվ�ɼ�!");
  368. }
  369. if (messages.IsSuccess())
  370. {
  371. ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
  372. // �����Ͳ�Pallet
  373. DataCollectFacade dcf = new DataCollectFacade(this.DataProvider);
  374. messages.AddMessages(dataCollect.Execute(actionEventArgs));
  375. if (messages.IsSuccess())
  376. {
  377. ReportHelper reportCollect = new ReportHelper(this.DataProvider);
  378. //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));
  379. }
  380. }
  381. }
  382. catch (Exception e)
  383. {
  384. messages.Add(new Message(e));
  385. }
  386. return messages;
  387. }
  388. //��չһ����ActionCheckStatus�����ķ���
  389. public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
  390. {
  391. ((GoToMOActionEventArgs)actionEventArgs).MOCode = ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim().ToUpper();
  392. actionEventArgs.ProductInfo.NowSimulation.EATTRIBUTE1 = (actionEventArgs as GoToMOActionEventArgs).Memo;
  393. actionEventArgs.RunningCard = actionEventArgs.RunningCard.Trim().ToUpper();
  394. Messages messages = new Messages();
  395. if (((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == String.Empty)
  396. {
  397. messages.Add(new Message(MessageType.Error, "$CS_Please_Input_MOCode"));
  398. }
  399. if (((GoToMOActionEventArgs)actionEventArgs).RunningCard.Trim() == String.Empty)
  400. {
  401. messages.Add(new Message(MessageType.Error, "$CS_Please_Input_RunningCard"));
  402. }
  403. DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
  404. try
  405. {
  406. //���ú���ActionCheckStatus������CheckIn����
  407. messages.AddMessages(this.CheckIn(actionEventArgs, actionCheckStatus));
  408. // add support RMA
  409. if (actionEventArgs.CurrentMO != null)
  410. {
  411. actionEventArgs.ProductInfo.NowSimulation.RMABILLCODE = actionEventArgs.CurrentMO.RMABILLCODE;
  412. }
  413. if (!((GoToMOActionEventArgs)actionEventArgs).PassCheck)
  414. {
  415. throw new Exception("$���кţ�"
  416. + actionEventArgs.RunningCard + "�ѹ���������" + ((GoToMOActionEventArgs)actionEventArgs).MOCode + ",ǰ����һվ�ɼ�!");
  417. }
  418. if (messages.IsSuccess())
  419. {
  420. actionEventArgs.ProductInfo.NowSimulation.EATTRIBUTE1 = (actionEventArgs as GoToMOActionEventArgs).Memo;
  421. if (actionCheckStatus.NeedUpdateSimulation)
  422. {
  423. ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
  424. messages.AddMessages(dataCollect.Execute(actionEventArgs));
  425. }
  426. else
  427. {
  428. ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
  429. messages.AddMessages(dataCollect.Execute(actionEventArgs, actionCheckStatus));
  430. }
  431. if (messages.IsSuccess())
  432. {
  433. if (actionCheckStatus.NeedFillReport)
  434. {
  435. ReportHelper reportCollect = new ReportHelper(this.DataProvider);
  436. //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo, actionCheckStatus));
  437. }
  438. //��Action�����б�
  439. actionCheckStatus.ActionList.Add(actionEventArgs);
  440. }
  441. }
  442. }
  443. catch (Exception e)
  444. {
  445. messages.Add(new Message(e));
  446. }
  447. return messages;
  448. }
  449. private void updateItem2Route(string itemCode, string routeCode, string userCode)
  450. {
  451. DateTime mtime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString());
  452. //string sql = @"UPDATE ICSITEM2ROUTE set ISREF='1',MTIME='" + mtime + "' where ITEMCODE='" + itemCode + "' and ROUTECODE='" + routeCode + "' and ISREF!='1'";
  453. string sql = @"UPDATE ICSITEM2ROUTE set ISREF='��',MTIME='" + mtime + "' where ITEMCODE='" + itemCode + "' and ROUTECODE='" + routeCode + "' and ISREF!='��'";
  454. sql = string.Format(sql);
  455. this._domainDataProvider.ExecuteCommand(sql);
  456. this._domainDataProvider.SubmitChanges();
  457. }
  458. public Messages AutoGoMO(ActionEventArgs actionEventArgs)
  459. {
  460. return AutoGoMO(actionEventArgs, null);
  461. }
  462. public Messages AutoGoMO(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
  463. {
  464. Messages msg = new Messages();
  465. // ������ǰ���к�������Ʒ���򲻻�����������
  466. if (actionEventArgs.ProductInfo != null &&
  467. actionEventArgs.ProductInfo.LastSimulation != null &&
  468. actionEventArgs.ProductInfo.LastSimulation.ISCOM != "1")
  469. {
  470. return msg;
  471. }
  472. DateTime dbDateTime;
  473. dbDateTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString());
  474. string strResCode = actionEventArgs.ResourceCode;
  475. string strRCard = actionEventArgs.RunningCard;
  476. // ��������
  477. string strMOCode = "";
  478. // ִ�й��������IJ���
  479. GoToMOActionEventArgs gomoArg = new GoToMOActionEventArgs(ActionType.DataCollectAction_GoMO,
  480. actionEventArgs.RunningCard,
  481. actionEventArgs.UserCode,
  482. actionEventArgs.ResourceCode,
  483. actionEventArgs.ProductInfo,
  484. strMOCode);
  485. IAction gomoAction = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_GoMO);
  486. try
  487. {
  488. if (actionCheckStatus != null)
  489. {
  490. msg.AddMessages(((IActionWithStatus)gomoAction).Execute(gomoArg, actionCheckStatus));
  491. }
  492. else
  493. {
  494. msg.AddMessages(gomoAction.Execute(gomoArg));
  495. }
  496. }
  497. catch (Exception e)
  498. {
  499. msg.Add(new Message(e));
  500. }
  501. if (msg.IsSuccess() == true)
  502. {
  503. if (actionCheckStatus == null || actionCheckStatus.NeedUpdateSimulation == true)
  504. {
  505. ActionOnLineHelper onLine = new ActionOnLineHelper(this.DataProvider);
  506. Messages msgProduct = onLine.GetIDInfo(actionEventArgs.RunningCard);
  507. actionEventArgs.ProductInfo = (ProductInfo)msgProduct.GetData().Values[0];
  508. }
  509. else
  510. {
  511. actionEventArgs.ProductInfo.LastSimulation = new ExtendSimulation(gomoArg.ProductInfo.NowSimulation);
  512. actionCheckStatus.ProductInfo.LastSimulation = actionEventArgs.ProductInfo.LastSimulation;
  513. }
  514. }
  515. return msg;
  516. }
  517. public void ShowMessage()
  518. {
  519. }
  520. }
  521. }