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

3231 lines
140 KiB

5 months ago
  1. using System;
  2. using System.Collections;
  3. using System.Reflection;
  4. using System.Runtime.Remoting;
  5. using System.Text.RegularExpressions;
  6. using System.Linq;
  7. using System.Data.Linq;
  8. using System.Xml;
  9. using System.IO;
  10. using ICSSoft.Base.Config.AppConfig;
  11. using System.Collections.Specialized;
  12. using ICSSoft.Frame.Data.Entity;
  13. using ICSSoft.Frame.DataConnect.Action;
  14. using System.Data;
  15. using ICSSoft.Frame.DataCollect;
  16. using ICSSoft.Frame.Data.BLL;
  17. using ICSSoft.Frame.Helper;
  18. using System.Collections.Generic;
  19. namespace ICSSoft.Frame.DataConnect
  20. {
  21. /// <summary>
  22. /// DataCollectFacade ��ժҪ˵����
  23. /// ���: DataCollectFacade.cs
  24. /// �� ��:
  25. /// �� ��:
  26. /// </summary>
  27. public class DataCollectFacade
  28. {
  29. public const string ISMAINROUTE_TRUE = "1";
  30. private FramDataContext _domainDataProvider = null;
  31. public DataCollectFacade()
  32. {
  33. }
  34. public const string PID = "PID";
  35. public const string HID = "HID";
  36. public const string POWER = "POWER";
  37. public DataCollectFacade(FramDataContext domainDataProvider)
  38. {
  39. this._domainDataProvider = domainDataProvider;
  40. }
  41. public FramDataContext DataProvider
  42. {
  43. get
  44. {
  45. return _domainDataProvider;
  46. }
  47. }
  48. #region ����
  49. /// <summary>
  50. /// ֻ֧�����ϵIJɼ���TS��REWORK������վӦ���Լ����顢��д
  51. /// </summary>
  52. /// <param name="iD"></param>
  53. /// <param name="actionType"></param>
  54. /// <param name="resourceCode"></param>
  55. /// <param name="userCode"></param>
  56. /// <param name="product"></param>
  57. /// <returns></returns>
  58. public Messages CheckID(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
  59. {
  60. return CheckID(iD, actionType, resourceCode, userCode, product, null);
  61. }
  62. //
  63. // ��չһ����ActionCheckStatus�����ķ���
  64. public Messages CheckID(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, ActionCheckStatus actionCheckStatus)
  65. {
  66. // ����actionCheckStatus�е�MOCode�Ƿ���product�е�һ��
  67. if (actionCheckStatus != null)
  68. {
  69. if (actionCheckStatus.ProductInfo != null)
  70. {
  71. //���� �ж�LastSimulationΪNull������
  72. if (actionCheckStatus.ProductInfo.LastSimulation != null)
  73. {
  74. if (actionCheckStatus.ProductInfo.LastSimulation.MOCODE != product.LastSimulation.MOCODE)
  75. {
  76. actionCheckStatus = new ActionCheckStatus();
  77. }
  78. }
  79. }
  80. }
  81. // Added end
  82. Messages messages = new Messages();
  83. try
  84. {
  85. DoCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  86. }
  87. catch (Exception e)
  88. {
  89. messages.Add(new Message(e));
  90. }
  91. return messages;
  92. }
  93. //,���� ����
  94. private void DoCheck(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
  95. {
  96. if (product.CurrentMO == null)
  97. {
  98. this.CheckMO(product.LastSimulation.MOCODE, product);
  99. }
  100. else
  101. {
  102. this.CheckMO(product.CurrentMO);
  103. }
  104. this.GetRouteOPOnline(iD, actionType, resourceCode, userCode, product);
  105. this.CheckCardStatus(product);
  106. this.CheckRepeatCollect(actionType, product);
  107. //if first op,break off carton information
  108. if (GetMORouteFirstOperation(product.NowSimulation.MOCODE, product.NowSimulation.ROUTECODE).OPCODE
  109. == product.CurrentItemRoute2OP.OPCODE)
  110. {
  111. if (product.NowSimulation.CARTONCODE != String.Empty)
  112. {
  113. //Package.PackageFacade pf = new Package.PackageFacade(DataProvider);
  114. //pf.SubtractCollected(((ExtendSimulation)product.LastSimulation).CARTONCODE);
  115. }
  116. ((ExtendSimulation)product.LastSimulation).CARTONCODE = String.Empty;
  117. product.NowSimulation.CARTONCODE = String.Empty;
  118. }
  119. }
  120. private void DoCheck(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, ActionCheckStatus actionCheckStatus)
  121. {
  122. if (actionCheckStatus == null || actionCheckStatus.CheckedID == false)
  123. {
  124. if (actionCheckStatus == null || actionCheckStatus.CheckedMO == false)
  125. {
  126. this.CheckMO(product.LastSimulation.MOCODE, product);
  127. if (actionCheckStatus != null)
  128. {
  129. actionCheckStatus.CheckedMO = true;
  130. }
  131. }
  132. this.GetRouteOPOnline(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  133. if (actionCheckStatus != null)
  134. {
  135. actionCheckStatus.CheckedID = true;
  136. }
  137. }
  138. else
  139. {
  140. this.GetRouteOPOnline(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  141. }
  142. // �Ƿ��ظ��ɼ�
  143. this.CheckCardStatus(product);
  144. this.CheckRepeatCollect(actionType, product);
  145. }
  146. //����ǰһ��Simulation ����, Ԥ���� �µ� Simulation ��¼
  147. public Messages WriteSimulation(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
  148. {
  149. Messages messages = new Messages();
  150. try
  151. {
  152. product.NowSimulation.ID = AppConfig.GetGuid();
  153. product.NowSimulation.MOCODE = product.LastSimulation.MOCODE;
  154. product.NowSimulation.ITEMCODE = product.LastSimulation.ITEMCODE;
  155. product.NowSimulation.MODELCODE = product.LastSimulation.MODELCODE;
  156. product.NowSimulation.IDMERGERULE = product.LastSimulation.IDMERGERULE;
  157. product.NowSimulation.RCARD = iD;
  158. product.NowSimulation.RCARDSEQ = product.LastSimulation.RCARDSEQ + 1;
  159. product.NowSimulation.TCARD = product.LastSimulation.TCARD;
  160. product.NowSimulation.TCARDSEQ = product.LastSimulation.TCARDSEQ;
  161. product.NowSimulation.SCARD = product.LastSimulation.SCARD;
  162. product.NowSimulation.SCARDSEQ = product.LastSimulation.SCARDSEQ;
  163. product.NowSimulation.FROMROUTE = ActionOnLineHelper.StringNull;
  164. product.NowSimulation.FROMOP = ActionOnLineHelper.StringNull;
  165. product.NowSimulation.ROUTECODE = product.LastSimulation.ROUTECODE;
  166. product.NowSimulation.OPCODE = product.LastSimulation.OPCODE;
  167. product.NowSimulation.RESCODE = resourceCode;
  168. product.NowSimulation.PRODUCTSTATUS = ProductStatus.GOOD;
  169. product.NowSimulation.LACTION = actionType;
  170. product.NowSimulation.ACTIONLIST = string.Format("{0}{1};", product.LastSimulation.ACTIONLIST, actionType);
  171. //�����Ƿ��깤 TODO
  172. product.NowSimulation.ISCOM = ProductComplete.NoComplete;
  173. product.NowSimulation.CARTONCODE = product.LastSimulation.CARTONCODE;
  174. product.NowSimulation.LOTNO = product.LastSimulation.LOTNO;
  175. product.NowSimulation.PALLETCODE = product.LastSimulation.PALLETCODE;
  176. product.NowSimulation.NGTIMES = product.LastSimulation.NGTIMES;
  177. //
  178. product.NowSimulation.RMABILLCODE = product.LastSimulation.RMABILLCODE;
  179. product.NowSimulation.MOSEQ = product.LastSimulation.MOSEQ;
  180. DateTime dbDateTime = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
  181. product.NowSimulation.MTIME = dbDateTime;
  182. product.NowSimulation.MUSER = AppConfig.UserCode;
  183. product.NowSimulation.MUSERName = AppConfig.UserName;
  184. product.NowSimulation.WorkPoint = AppConfig.WorkPointCode;
  185. }
  186. catch (Exception e)
  187. {
  188. messages.Add(new Message(e));
  189. }
  190. return messages;
  191. }
  192. public ICSSimulation CloneSimulation(ICSSimulation simulation)
  193. {
  194. ICSSimulation returnValue = CreateNewSimulation();
  195. Type simulationType = typeof(ICSSimulation);
  196. FieldInfo[] fieldInfoList = simulationType.GetFields();
  197. if (fieldInfoList != null)
  198. {
  199. foreach (FieldInfo fieldInfo in fieldInfoList)
  200. {
  201. fieldInfo.SetValue(returnValue, fieldInfo.GetValue(simulation));
  202. }
  203. }
  204. return returnValue;
  205. }
  206. /// <summary>
  207. /// ����ID��һ���������Ƿ��Ѿ���ʹ��
  208. ///
  209. /// �Ĵ���SQL
  210. /// </summary>
  211. /// <param name="iD"></param>
  212. /// <param name="mOCode"></param>
  213. /// <returns></returns>
  214. public ICSONWIP CheckIDIsUsed(string id, string moCode)
  215. {
  216. string sql = @"select * from ICSONWIP
  217. where RCARD='" + id + "'and MOCODE='" + moCode + "'";
  218. var objs = this._domainDataProvider.ExecuteQuery<ICSONWIP>(sql).ToList();
  219. if (objs == null || objs.Count < 1)
  220. return null;
  221. else
  222. return (ICSONWIP)objs[0];
  223. }
  224. #region ����
  225. //ID״̬����
  226. public bool CheckCardStatus(ProductInfo productInfo)
  227. {
  228. if (productInfo.LastSimulation.PRODUCTSTATUS != ProductStatus.GOOD)
  229. {
  230. if (((ExtendSimulation)productInfo.LastSimulation).AdjustProductStatus != ProductStatus.GOOD)
  231. /* �������빤��*/
  232. {
  233. throw new Exception("$CS_ProductStatusError $CS_Param_ProductStatus=" + productInfo.LastSimulation.PRODUCTSTATUS
  234. + " $CS_Param_ID=" + productInfo.LastSimulation.RCARD);
  235. }
  236. }
  237. return true;
  238. }
  239. //����״̬����
  240. public bool CheckMO(string moCode)
  241. {
  242. ICSMO mo = (ICSMO)this.DataProvider.ICSMO.SingleOrDefault(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode);
  243. //����״̬����
  244. bool moStatus = this.CheckMO(mo);
  245. if (!moStatus)
  246. {
  247. throw new Exception("$CS_MOStatus_Error $CS_Param_MOStatus=$" + mo.MOSTATUS);
  248. }
  249. return moStatus;
  250. }
  251. public bool CheckMO(string moCode, ProductInfo product)
  252. {
  253. ICSMO mo = null;
  254. if (product.CurrentMO == null)
  255. {
  256. mo = (ICSMO)this.DataProvider.ICSMO.SingleOrDefault(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode);
  257. }
  258. else
  259. {
  260. mo = product.CurrentMO;
  261. }
  262. //����״̬����
  263. bool moStatus = this.CheckMO(mo);
  264. if (!moStatus)
  265. {
  266. throw new Exception("$CS_MOStatus_Error $CS_Param_MOStatus=$" + mo.MOSTATUS);
  267. }
  268. product.CurrentMO = mo;
  269. return moStatus;
  270. }
  271. //����״̬����
  272. public bool CheckMO(ICSMO mo)
  273. {
  274. if ((mo.MOSTATUS == MOManufactureStatus.MOSTATUS_RELEASE) ||
  275. (mo.MOSTATUS == MOManufactureStatus.MOSTATUS_OPEN))
  276. return true;
  277. else
  278. return false;
  279. }
  280. private const char isSelected = '1';
  281. //���ݹ����趨���鶯���ɷ��ڸù�����
  282. public bool CheckAction(ProductInfo productInfo, object op, string actionType)
  283. {
  284. string opCode = string.Empty;
  285. string opControl = "0000000000000000000000";
  286. if (op is ICSOP)
  287. {
  288. opCode = ((ICSOP)op).OPCODE;
  289. opControl = ((ICSOP)op).OPCONTROL;
  290. }
  291. if (op is ICSITEMROUTE2OP)
  292. {
  293. opCode = ((ICSITEMROUTE2OP)op).OPCODE;
  294. opControl = ((ICSITEMROUTE2OP)op).OPCONTROL;
  295. }
  296. return true;// this.CheckActionOnlineAndOutline(actionType, opCode, opControl);
  297. }
  298. public void CheckRepeatCollect(string actionType, ProductInfo product)
  299. {
  300. switch (product.LastSimulation.LACTION)
  301. {
  302. case ActionType.DataCollectAction_OutLineGood:
  303. case ActionType.DataCollectAction_OutLineNG:
  304. case ActionType.DataCollectAction_OutLineReject:
  305. switch (actionType)
  306. {
  307. case ActionType.DataCollectAction_OutLineGood:
  308. case ActionType.DataCollectAction_OutLineNG:
  309. //���⹤���������βɼ�NG
  310. //if (product.l != null && product.LastTS.RunningCardSequence != product.LastSimulation.RunningCardSequence)
  311. //{
  312. // this.CheckRepeatCollect(product.LastSimulation.RunningCard, product.LastSimulation.ActionList, actionType);
  313. //}
  314. product.NowSimulation.ACTIONLIST = string.Format("{0}{1};", product.LastSimulation.ACTIONLIST, actionType);
  315. break;
  316. default:
  317. product.NowSimulation.ACTIONLIST = string.Format(";{0};", actionType);
  318. break;
  319. }
  320. break;
  321. case ActionType.DataCollectAction_NG:
  322. case ActionType.DataCollectAction_SMTNG:
  323. case ActionType.DataCollectAction_OQCNG:
  324. case ActionType.DataCollectAction_Reject:
  325. product.NowSimulation.ACTIONLIST = string.Format(";{0};", actionType);
  326. break;
  327. default:
  328. switch (actionType)
  329. {
  330. case ActionType.DataCollectAction_OutLineGood:
  331. case ActionType.DataCollectAction_OutLineNG:
  332. product.NowSimulation.ACTIONLIST = string.Format(";{0};", actionType);
  333. break;
  334. default:
  335. if (product.LastSimulation.OPCODE == product.NowSimulation.OPCODE)
  336. {
  337. this.CheckRepeatCollect(product.LastSimulation.RCARD, product.LastSimulation.ACTIONLIST, actionType);
  338. product.NowSimulation.ACTIONLIST = string.Format("{0}{1};", product.LastSimulation.ACTIONLIST, actionType);
  339. }
  340. else
  341. {
  342. product.NowSimulation.ACTIONLIST = string.Format(";{0};", actionType);
  343. }
  344. break;
  345. }
  346. break;
  347. }
  348. }
  349. public void CheckRepeatCollect(string rcard, string actionList, string action)
  350. {
  351. actionList = ";" + actionList + ";";
  352. switch (action)
  353. {
  354. case ActionType.DataCollectAction_GoMO:
  355. if (actionList.IndexOf(";" + ActionType.DataCollectAction_GoMO + ";") >= 0)
  356. {
  357. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  358. }
  359. break;
  360. /*�������빤��*/
  361. case ActionType.DataCollectAction_OffMo:
  362. {
  363. if (actionList.IndexOf(";" + ActionType.DataCollectAction_OffMo + ";") >= 0)
  364. {
  365. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  366. }
  367. break;
  368. }
  369. case ActionType.DataCollectAction_DropMaterial:
  370. {
  371. if (actionList.IndexOf(";" + ActionType.DataCollectAction_DropMaterial + ";") >= 0)
  372. {
  373. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  374. }
  375. break;
  376. }
  377. case ActionType.DataCollectAction_SMTGOOD:
  378. case ActionType.DataCollectAction_GOOD:
  379. case ActionType.DataCollectAction_OutLineGood:
  380. case ActionType.DataCollectAction_OQCGood:
  381. string[] actions = actionList.Split(new char[] { ';' });
  382. //if (actions.Length > 2) //��Ϊ������actionList��ǰ�󶼼��˷ֺ�
  383. if (actions.Length > 3)
  384. {
  385. //string lastAction = actions[actions.Length - 2]; //��Ϊ������actionList��ǰ�󶼼��˷ֺ�
  386. string lastAction = actions[actions.Length - 3];
  387. if (lastAction == ActionType.DataCollectAction_GOOD
  388. || lastAction == ActionType.DataCollectAction_GOOD
  389. || lastAction == ActionType.DataCollectAction_SMTGOOD
  390. || lastAction == ActionType.DataCollectAction_OutLineGood
  391. || lastAction == ActionType.DataCollectAction_OQCGood)
  392. {
  393. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  394. }
  395. }
  396. break;
  397. case ActionType.DataCollectAction_OutLineNG:
  398. case ActionType.DataCollectAction_SMTNG:
  399. case ActionType.DataCollectAction_NG:
  400. case ActionType.DataCollectAction_OQCNG:
  401. case ActionType.DataCollectAction_OutLineReject:
  402. if (actionList.IndexOf(";" + ActionType.DataCollectAction_NG + ";") >= 0)
  403. {
  404. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  405. }
  406. if (actionList.IndexOf(";" + ActionType.DataCollectAction_SMTNG + ";") >= 0)
  407. {
  408. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  409. }
  410. if (actionList.IndexOf(";" + ActionType.DataCollectAction_OutLineNG + ";") >= 0)
  411. {
  412. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  413. }
  414. if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCReject + ";") >= 0)
  415. {
  416. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  417. }
  418. if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCNG + ";") >= 0)
  419. {
  420. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  421. }
  422. break;
  423. case ActionType.DataCollectAction_CollectINNO:
  424. if (actionList.IndexOf(";" + ActionType.DataCollectAction_CollectINNO + ";") >= 0)
  425. {
  426. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  427. }
  428. break;
  429. case ActionType.DataCollectAction_CollectKeyParts:
  430. if (actionList.IndexOf(";" + ActionType.DataCollectAction_CollectKeyParts + ";") >= 0)
  431. {
  432. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  433. }
  434. break;
  435. case ActionType.DataCollectAction_ECN:
  436. if (actionList.IndexOf(";" + ActionType.DataCollectAction_ECN + ";") >= 0)
  437. {
  438. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  439. }
  440. break;
  441. case ActionType.DataCollectAction_OQCLotAddID:
  442. if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCLotAddID + ";") >= 0)
  443. {
  444. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  445. }
  446. break;
  447. case ActionType.DataCollectAction_OQCLotRemoveID:
  448. if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCLotRemoveID + ";") >= 0)
  449. {
  450. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  451. }
  452. break;
  453. case ActionType.DataCollectAction_TRY:
  454. if (actionList.IndexOf(";" + ActionType.DataCollectAction_TRY + ";") >= 0)
  455. {
  456. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  457. }
  458. break;
  459. case ActionType.DataCollectAction_SoftINFO:
  460. if (actionList.IndexOf(";" + ActionType.DataCollectAction_SoftINFO + ";") >= 0)
  461. {
  462. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  463. }
  464. break;
  465. case ActionType.DataCollectAction_Split:
  466. if (actionList.IndexOf(";" + ActionType.DataCollectAction_Split + ";") >= 0)
  467. {
  468. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  469. }
  470. break;
  471. case ActionType.DataCollectAction_Reject:
  472. case ActionType.DataCollectAction_OQCReject:
  473. if (actionList.IndexOf(";" + ActionType.DataCollectAction_Reject + ";") >= 0)
  474. {
  475. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  476. }
  477. if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCReject + ";") >= 0)
  478. {
  479. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  480. }
  481. break;
  482. case ActionType.DataCollectAction_OQCPass:
  483. if (actionList.IndexOf(";" + ActionType.DataCollectAction_OQCPass + ";") >= 0)
  484. {
  485. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  486. }
  487. break;
  488. case ActionType.DataCollectAction_BurnIn:
  489. if (actionList.IndexOf(";" + ActionType.DataCollectAction_BurnIn + ";") >= 0)
  490. {
  491. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  492. }
  493. break;
  494. case ActionType.DataCollectAction_BurnOut:
  495. if (actionList.IndexOf(";" + ActionType.DataCollectAction_BurnOut + ";") >= 0)
  496. {
  497. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  498. }
  499. break;
  500. case ActionType.DataCollectAction_Carton:
  501. if (actionList.IndexOf(";" + ActionType.DataCollectAction_Carton + ";") >= 0)
  502. {
  503. throw new Exception("$CS_RepeatCollect_OnOneOP $CS_Param_ID :" + rcard);
  504. }
  505. break;
  506. default:
  507. throw new Exception("$CS_Sys_Error_CheckRepeatCollect_Failed $CS_Param_Action=" + action + " $CS_Param_ID :" + rcard);
  508. }
  509. }
  510. //ά�޴���
  511. public object GetCardLastTSRecordInNewStatus(string rcard)
  512. {
  513. string sql = "SELECT * FROM icsts WHERE rcard='" + rcard + "' and workpoint = '"+AppConfig.WorkPointCode+"' order by tstimes desc";
  514. var objs = this._domainDataProvider.ExecuteQuery<ICSTS>(sql).ToList();
  515. if (objs == null || objs.Count < 1)
  516. return null;
  517. else
  518. return (ICSTS)objs[0];
  519. }
  520. /// <summary>
  521. /// ** ��������: �ɲ�Ʒ���кŻ������µ�һ��ά�޼�¼
  522. /// ** �� ��:
  523. /// ** �� ��:
  524. /// </summary>
  525. /// <param name="rcard"></param>
  526. /// <returns></returns>
  527. public ICSTS GetCardLastTSRecord(string runningCard)
  528. {
  529. return GetCardLastTSRecord(runningCard, string.Empty);
  530. }
  531. public ICSTS GetCardLastTSRecord(string runningCard, string moCode)
  532. {
  533. string sql = string.Empty;
  534. sql += " SELECT * ";
  535. sql += " FROM icsts ";
  536. sql += string.Format(" WHERE rcard = '{0}' ", runningCard.Trim());
  537. if (moCode.Trim().Length > 0)
  538. {
  539. sql += string.Format(" AND mocode = '{0}' ", moCode.Trim());
  540. }
  541. sql += " And workpoint='"+AppConfig.WorkPointCode+"'";
  542. sql += " ORDER BY mtime desc";
  543. var objs = this._domainDataProvider.ExecuteQuery<ICSTS>(sql).ToList();
  544. if (objs == null || objs.Count < 1)
  545. return null;
  546. else
  547. return (ICSTS)objs[0];
  548. }
  549. //Online ����;��OP�Ƿ�����
  550. public void GetRouteOPOnline(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
  551. {
  552. GetRouteOPOnline(iD, actionType, resourceCode, userCode, product, null);
  553. }
  554. public void GetRouteOPOnline(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, Action.ActionCheckStatus actionCheckStatus)
  555. {
  556. switch (product.LastSimulation.LACTION)
  557. {
  558. case ActionType.DataCollectAction_OutLineGood:
  559. case ActionType.DataCollectAction_OutLineNG:
  560. case ActionType.DataCollectAction_OutLineReject:
  561. switch (actionType)
  562. {
  563. case ActionType.DataCollectAction_OutLineGood:
  564. case ActionType.DataCollectAction_OutLineNG:
  565. case ActionType.DataCollectAction_OutLineReject:
  566. throw new Exception("$CS_Route_Failed_Need_Call_CheckRouteOPOutline");
  567. default:
  568. this.AdjustRouteOPOnline(iD, actionType, resourceCode, userCode, product);
  569. this.CheckOnlineOP(iD, actionType, resourceCode, userCode, product);
  570. break;
  571. }
  572. break;
  573. case ActionType.DataCollectAction_NG:
  574. case ActionType.DataCollectAction_SMTNG:
  575. case ActionType.DataCollectAction_Reject:
  576. case ActionType.DataCollectAction_OQCReject:
  577. case ActionType.DataCollectAction_OQCNG:
  578. switch (actionType)
  579. {
  580. case ActionType.DataCollectAction_OutLineGood:
  581. case ActionType.DataCollectAction_OutLineNG:
  582. case ActionType.DataCollectAction_OutLineReject:
  583. throw new Exception("$CS_Route_Failed_Need_Call_CheckRouteOPOutline");
  584. case ActionType.DataCollectAction_OQCReject:
  585. {
  586. this.AdjustRouteOPOnline(iD, actionType, resourceCode, userCode, product);
  587. this.CheckOnlineOPSingle(iD, actionType, resourceCode, userCode, product);
  588. break;
  589. }
  590. default:
  591. this.AdjustRouteOPOnline(iD, actionType, resourceCode, userCode, product);
  592. this.CheckOnlineOPSingle(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  593. break;
  594. }
  595. break;
  596. default:
  597. switch (actionType)
  598. {
  599. case ActionType.DataCollectAction_OutLineGood:
  600. case ActionType.DataCollectAction_OutLineNG:
  601. throw new Exception("$CS_Route_Failed_Need_Call_CheckRouteOPOutline");
  602. default:
  603. this.AdjustRouteOPOnline(iD, actionType, resourceCode, userCode, product);
  604. this.CheckOnlineOP(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  605. break;
  606. }
  607. break;
  608. }
  609. }
  610. public void AdjustRouteOPOnline(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
  611. {
  612. ICSTS ts = GetCardLastTSRecord(iD, product.LastSimulation.MOCODE);
  613. if (ts != null)
  614. {
  615. #region ���ϵ����� ���ϺͲ��ⲻ�ܹ��ٴν�������
  616. if (ts != null && ts.FRMINPUTTYPE == "tssource_onwip" && ts.TSSTATUS == TSStatus.TSStatus_Scrap)
  617. {
  618. if (ts.FRMROUTECODE == product.LastSimulation.ROUTECODE &&
  619. ts.FRMOPCODE == product.LastSimulation.OPCODE &&
  620. ts.MOCODE == product.LastSimulation.MOCODE &&
  621. ts.RCARD == product.LastSimulation.RCARD)
  622. {
  623. throw new Exception("$CS_Error_Product_Already_Scrap");
  624. }
  625. }
  626. #endregion
  627. #region ��������������
  628. if (ts != null && ts.TSSTATUS == TSStatus.TSStatus_Reflow)
  629. {
  630. if (ts.RCARDSEQ == product.LastSimulation.RCARDSEQ)
  631. {
  632. ((ExtendSimulation)product.LastSimulation).AdjustProductStatus = ProductStatus.GOOD;
  633. ((ExtendSimulation)product.LastSimulation).NextRouteCode = ts.REFROUTECODE;
  634. ((ExtendSimulation)product.LastSimulation).NextOPCode = ts.REFOPCODE;
  635. if (ts.REFOPCODE.Length == 0)
  636. {
  637. ICSITEMROUTE2OP itemOP = GetMORouteFirstOperation(product.LastSimulation.MOCODE, ts.REFROUTECODE);
  638. if (itemOP != null)
  639. {
  640. if (((ExtendSimulation)product.LastSimulation).NextOPCode == null
  641. || ((ExtendSimulation)product.LastSimulation).NextOPCode.Trim().Length <= 0)
  642. {
  643. ((ExtendSimulation)product.LastSimulation).NextOPCode = itemOP.OPCODE;
  644. ((ExtendSimulation)product.LastSimulation).AdjustProductStatus = ProductStatus.GOOD;
  645. }
  646. }
  647. else
  648. {
  649. throw new Exception("$CS_Route_Lost_First_OP_Of_Route" + " : " + ts.REFROUTECODE);
  650. }
  651. }
  652. }
  653. }
  654. #endregion
  655. }
  656. if (((ExtendSimulation)product.LastSimulation).NextRouteCode == null
  657. || ((ExtendSimulation)product.LastSimulation).NextRouteCode.Trim().Length <= 0)
  658. {
  659. ((ExtendSimulation)product.LastSimulation).NextRouteCode = product.LastSimulation.ROUTECODE;
  660. }
  661. if (((ExtendSimulation)product.LastSimulation).NextOPCode == null
  662. || ((ExtendSimulation)product.LastSimulation).NextOPCode.Trim().Length <= 0)
  663. {
  664. ((ExtendSimulation)product.LastSimulation).NextOPCode = product.LastSimulation.OPCODE;
  665. }
  666. }
  667. private void CheckMaterialAndTest(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
  668. {
  669. CheckMaterialAndTest(iD, actionType, resourceCode, userCode, product, null);
  670. }
  671. private void CheckMaterialAndTest(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, Action.ActionCheckStatus actionCheckStatus)
  672. {
  673. //#region �������Ժ�������ͬһ������
  674. ////Ĭ�ϻ��ڵ�ǰվ����һ������{hight}
  675. ////L���Ժ�����Action �ڽ�����һվǰ������������
  676. ////FQC��GOOD����Pass�������ų�����
  677. ///*�����߼�������һ�������Ƿ������û������������˼�������Action��KeyParts����Action�ļ��飻
  678. // * �����ϲ����пͻ���ҵ���ϱ�֤��
  679. // * �������߼������������ݲɼ�ģ����Spec�У���RD�������Ϸ�ʽ��
  680. // * Ŀǰû����Rework�ļ���
  681. // */
  682. //if (
  683. // ActionType.DataCollectAction_SMTGOOD == actionType
  684. // || ActionType.DataCollectAction_SMTNG == actionType
  685. // || ActionType.DataCollectAction_GOOD == actionType
  686. // || ActionType.DataCollectAction_NG == actionType
  687. // || ActionType.DataCollectAction_OQCGood == actionType
  688. // || ActionType.DataCollectAction_OQCNG == actionType
  689. // || ActionType.DataCollectAction_OQCPass == actionType)
  690. //{
  691. // object currentOP = null;
  692. // if (product.CurrentItemRoute2OP != null)
  693. // {
  694. // currentOP = product.CurrentItemRoute2OP;
  695. // }
  696. // else
  697. // {
  698. // currentOP = (new ItemFacade(this._domainDataProvider)).GetItemRoute2Operation(product.NowSimulation.ITEMCODE, product.NowSimulation.ROUTECODE, product.NowSimulation.OPCODE);
  699. // product.CurrentItemRoute2OP = currentOP as ICSITEMROUTE2OP;
  700. // }
  701. // if (currentOP == null)
  702. // {
  703. // if (product.LastSimulation != null && product.LastSimulation.ISCOM == "1")
  704. // {
  705. // throw new Exception("$CS_PRODUCT_ALREADY_COMPLETE $CS_Param_OPCode =" + product.LastSimulation.OPCODE);
  706. // }
  707. // else
  708. // {
  709. // throw new Exception("$CS_Route_Failed_GetNotNextOP");
  710. // }
  711. // }
  712. // string opControls = ((ICSITEMROUTE2OP)currentOP).OPCONTROL;
  713. // if (opControls != null && opControls.Length > 2)
  714. // {
  715. // if (opControls.Substring(0, 2).Trim() == "11"
  716. // || (FormatHelper.StringToBoolean(opControls, (int)OperationList.Testing)
  717. // && FormatHelper.StringToBoolean(opControls, (int)OperationList.ComponentDown)))
  718. // {
  719. // BenQGuru.eMES.Rework.ReworkFacade reworkFacade = new BenQGuru.eMES.Rework.ReworkFacade(this.DataProvider);
  720. // BenQGuru.eMES.Domain.Rework.ReworkSheet rSheet = (BenQGuru.eMES.Domain.Rework.ReworkSheet)reworkFacade.GetReworkSheetByReject(product.LastSimulation.RCARD, product.LastSimulation.RCARDSEQ);
  721. // //ͳ��KeyParts�ĸ���
  722. // int keypartTimes = 0;
  723. // //ͳ��Inno�ĸ���
  724. // int innoTimes = 0;
  725. // object[] objs = null;
  726. // ArrayList listTmp = new ArrayList();
  727. // if (actionCheckStatus != null)
  728. // {
  729. // for (int iaction = 0; iaction < actionCheckStatus.ActionList.Count; iaction++)
  730. // {
  731. // ActionEventArgs actionEventArgs = (ActionEventArgs)actionCheckStatus.ActionList[iaction];
  732. // if (actionEventArgs is CINNOActionEventArgs || actionEventArgs is CKeypartsActionEventArgs)
  733. // {
  734. // for (int iwip = 0; iwip < actionEventArgs.OnWIP.Count; iwip++)
  735. // {
  736. // if (actionEventArgs.OnWIP[iwip] is ICSONWIPITEM)
  737. // {
  738. // ICSONWIPITEM wipItem = (ICSONWIPITEM)actionEventArgs.OnWIP[iwip];
  739. // ONWIPItemObject wipObj = new ONWIPItemObject();
  740. // wipObj.MCARD = wipItem.MCARD;
  741. // wipObj.MCardType = wipItem.MCARDTYPE;
  742. // wipObj.OPCODE = wipItem.OPCODE;
  743. // wipObj.RunningCard = wipItem.RCARD;
  744. // wipObj.RunningCardSequence = wipItem.RCARDSEQ.ToString();
  745. // listTmp.Add(wipObj);
  746. // }
  747. // }
  748. // }
  749. // }
  750. // }
  751. // if (listTmp.Count > 0)
  752. // {
  753. // objs = new object[listTmp.Count];
  754. // listTmp.CopyTo(objs);
  755. // }
  756. // if (objs == null || objs.Length == 0)
  757. // {
  758. // objs = this.ExtraQuery(product.NowSimulation.RCARD
  759. // , product.NowSimulation.OPCODE
  760. // , product.NowSimulation.MOCODE
  761. // , product.LastSimulation.LACTION, product);
  762. // }
  763. // string opBOMType = actionCheckStatus == null ? String.Empty : actionCheckStatus.opBOMType;
  764. // if (opBOMType == string.Empty)
  765. // {
  766. // //��ȡOPBOM��ά��������Ϣ
  767. // OPBOMFacade opFac = new OPBOMFacade(this._domainDataProvider);
  768. // if (FormatHelper.StringToBoolean(opControls, (int)OperationList.ComponentDown))
  769. // {
  770. // opBOMType = opFac.GetOPDropBOMDetailType(
  771. // product.NowSimulation.MOCODE
  772. // , product.NowSimulation.ROUTECODE
  773. // , ((ICSITEMROUTE2OP)currentOP).OPCODE
  774. // , out keypartTimes
  775. // , out innoTimes);
  776. // //���Ƿְ�����
  777. // keypartTimes = Convert.ToInt32(keypartTimes * product.LastSimulation.IDMERGERULE);
  778. // }
  779. // else
  780. // {
  781. // opBOMType = opFac.GetOPBOMDetailType(
  782. // product.NowSimulation.MOCODE
  783. // , product.NowSimulation.ROUTECODE
  784. // , ((ICSITEMROUTE2OP)currentOP).OPCODE
  785. // , out keypartTimes
  786. // , out innoTimes);
  787. // //���Ƿְ�����
  788. // keypartTimes = Convert.ToInt32(keypartTimes * product.LastSimulation.IDMERGERULE);
  789. // }
  790. // if (actionCheckStatus != null)
  791. // {
  792. // actionCheckStatus.opBOMType = opBOMType;
  793. // actionCheckStatus.keypartTimes = keypartTimes;
  794. // actionCheckStatus.innoTimes = innoTimes;
  795. // }
  796. // }
  797. // else
  798. // {
  799. // if (actionCheckStatus != null)
  800. // {
  801. // keypartTimes = actionCheckStatus.keypartTimes;
  802. // innoTimes = actionCheckStatus.innoTimes;
  803. // }
  804. // }
  805. // //������ǰ��Rework�����Ļ�,ͳ�ƴ���
  806. // int iCount = 1;
  807. // if (rSheet != null && rSheet.ReworkType == Web.Helper.ReworkType.REWORKTYPE_ONLINE)
  808. // {
  809. // object[] objReworks = reworkFacade.QueryReworkSheet(rSheet.ReworkCode);
  810. // if (objReworks != null && objReworks.Length > 0)
  811. // {
  812. // for (int i = 0; i < objReworks.Length; i++)
  813. // {
  814. // BenQGuru.eMES.Domain.Rework.ReworkSheet rs = (BenQGuru.eMES.Domain.Rework.ReworkSheet)objReworks[i];
  815. // if (rs.ReworkType == Web.Helper.ReworkType.REWORKTYPE_ONLINE)
  816. // {
  817. // object[] objOPS = (new MOModel.ItemFacade(this._domainDataProvider)).QueryItem2Operation(rs.ItemCode, rs.NewRouteCode);
  818. // for (int j = 0; j < objOPS.Length; j++)
  819. // {
  820. // ICSITEMROUTE2OP i2op = (ICSITEMROUTE2OP)objOPS[j];
  821. // if (i2op.OPCODE == product.LastSimulation.OPCODE)
  822. // {
  823. // iCount += 1;
  824. // }
  825. // }
  826. // }
  827. // }
  828. // }
  829. // //product.LastSimulation.FromRoute
  830. // }
  831. // keypartTimes = keypartTimes * iCount;
  832. // innoTimes = innoTimes * iCount;
  833. // if (objs == null || (objs != null && objs.Length < 1))
  834. // {
  835. // if (BenQGuru.eMES.Web.Helper.FormatHelper.StringToBoolean(product.CurrentItemRoute2OP.OPCONTROL, (int)OperationList.ComponentLoading))
  836. // {
  837. // throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  838. // }
  839. // if (BenQGuru.eMES.Web.Helper.FormatHelper.StringToBoolean(product.CurrentItemRoute2OP.OPCONTROL, (int)OperationList.ComponentDown))
  840. // {
  841. // throw new Exception("$CS_PLEASE_COMPLETE_DROPMATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  842. // }
  843. // if (product.LastSimulation.LACTION == ActionType.DataCollectAction_DropMaterial)
  844. // {
  845. // throw new Exception("$CS_PLEASE_COMPLETE_DROPMATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  846. // }
  847. // else
  848. // {
  849. // throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  850. // }
  851. // }
  852. // string actionList = String.Empty;
  853. // //ʵ������KeyParts����
  854. // int actualKeyParts = 0;
  855. // //ʵ������Inno����
  856. // int actualInnos = 0;
  857. // string keyPartsString = ActionType.DataCollectAction_CollectKeyParts;
  858. // string INNOString = ActionType.DataCollectAction_CollectINNO;
  859. // string bomKeyPartsString = BOMItemControlType.ITEM_CONTROL_KEYPARTS;
  860. // string bomINNOString = BOMItemControlType.ITEM_CONTROL_LOT;
  861. // if (objs != null)
  862. // {
  863. // foreach (ONWIPItemObject wip in objs)
  864. // {
  865. // if (wip.MCardType == MCardType.MCardType_Keyparts)
  866. // {
  867. // actionList = actionList + keyPartsString + ";";
  868. // actualKeyParts += 1;
  869. // }
  870. // if (wip.MCardType == MCardType.MCardType_INNO)
  871. // {
  872. // actionList = actionList + INNOString + ";";
  873. // //�޸� ֻ����һ�μ�������
  874. // actualInnos = 1;
  875. // }
  876. // }
  877. // }
  878. // if (actionList.IndexOf(INNOString) < 0
  879. // && actionList.IndexOf(keyPartsString) < 0)
  880. // {
  881. // if (product.LastSimulation.LACTION == ActionType.DataCollectAction_DropMaterial)
  882. // {
  883. // throw new Exception("$CS_PLEASE_DROP_INNO_KEYPARTS $CS_Param_ID =" + product.LastSimulation.RCARD);
  884. // }
  885. // else
  886. // {
  887. // throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  888. // }
  889. // return;
  890. // }
  891. // //����KeyParts���ϵ�����
  892. // if (opBOMType.IndexOf(bomKeyPartsString) >= 0
  893. // && opBOMType.IndexOf(bomINNOString) < 0)
  894. // {
  895. // if (actionList.IndexOf(keyPartsString) < 0
  896. // || actualKeyParts < keypartTimes)
  897. // {
  898. // if (product.LastSimulation.LACTION == ActionType.DataCollectAction_DropMaterial)
  899. // {
  900. // throw new Exception("$CS_PLEASE_DROP_INNO_KEYPARTS $CS_Param_ID =" + product.LastSimulation.RCARD);
  901. // }
  902. // else
  903. // {
  904. // throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  905. // }
  906. // }
  907. // if (actionList.IndexOf(keyPartsString) >= 0 && actualKeyParts > keypartTimes && actualKeyParts != 0)
  908. // {
  909. // if (product.LastSimulation.LACTION == ActionType.DataCollectAction_CollectKeyParts)
  910. // {
  911. // throw new Exception("$CS_ALREADY_COLLECTMATIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  912. // }
  913. // }
  914. // }
  915. // //���鼯�����ϵ�����
  916. // if (opBOMType.IndexOf(bomKeyPartsString) < 0
  917. // && opBOMType.IndexOf(bomINNOString) >= 0)
  918. // {
  919. // if (actionList.IndexOf(INNOString) < 0
  920. // || actualInnos < innoTimes)
  921. // {
  922. // if (product.LastSimulation.LACTION == ActionType.DataCollectAction_DropMaterial)
  923. // {
  924. // throw new Exception("$CS_PLEASE_DROP_INNO_KEYPARTS $CS_Param_ID =" + product.LastSimulation.RCARD);
  925. // }
  926. // else
  927. // {
  928. // throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  929. // }
  930. // }
  931. // if (actionList.IndexOf(INNOString) >= 0 && actualInnos > innoTimes && actualInnos != 0)
  932. // {
  933. // if (product.LastSimulation.LACTION == ActionType.DataCollectAction_CollectINNO)
  934. // {
  935. // throw new Exception("$CS_ALREADY_COLLECTMATIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  936. // }
  937. // }
  938. // }
  939. // //���߶����ڵ�״��
  940. // if (opBOMType.IndexOf(bomKeyPartsString) >= 0
  941. // && opBOMType.IndexOf(bomINNOString) >= 0)
  942. // {
  943. // if (actionList.IndexOf(INNOString) < 0
  944. // || actionList.IndexOf(keyPartsString) < 0
  945. // || actualInnos < innoTimes
  946. // || actualKeyParts < keypartTimes)
  947. // {
  948. // if (product.LastSimulation.LACTION == ActionType.DataCollectAction_DropMaterial)
  949. // {
  950. // throw new Exception("$CS_PLEASE_DROP_INNO_KEYPARTS $CS_Param_ID =" + product.LastSimulation.RCARD);
  951. // }
  952. // else
  953. // {
  954. // throw new Exception("$CS_PLEASE_COMPLETE_MATERIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  955. // }
  956. // }
  957. // if ((actionList.IndexOf(INNOString) >= 0 && actualInnos > innoTimes && actualInnos != 0)
  958. // || (actionList.IndexOf(keyPartsString) >= 0 && actualKeyParts > keypartTimes && actualKeyParts != 0))
  959. // {
  960. // if (product.LastSimulation.LACTION == ActionType.DataCollectAction_CollectKeyParts
  961. // || product.LastSimulation.LACTION == ActionType.DataCollectAction_CollectINNO)
  962. // {
  963. // throw new Exception("$CS_ALREADY_COLLECTMATIAL $CS_Param_ID =" + product.LastSimulation.RCARD);
  964. // }
  965. // }
  966. // }
  967. // }
  968. // }
  969. //}
  970. //#endregion
  971. }
  972. //OUT_Line -> OQC OUT_Line -> Normal �����߱任��ָ�� Route + OP
  973. public ICSITEMROUTE2OP CheckOnlineOPSingle(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
  974. {
  975. return CheckOnlineOPSingle(iD, actionType, resourceCode, userCode, product, null);
  976. }
  977. // ��չActionCheckStatus
  978. public ICSITEMROUTE2OP CheckOnlineOPSingle(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, Action.ActionCheckStatus actionCheckStatus)
  979. {
  980. if (actionCheckStatus != null)
  981. {
  982. if (actionCheckStatus.CheckedNextOP == true && actionCheckStatus.OP != null)
  983. {
  984. bool bPass = false;
  985. //��ǰվ
  986. if (product.LastSimulation.NextOPCode == actionCheckStatus.OP.OPCODE &&
  987. product.LastSimulation.NextRouteCode == actionCheckStatus.OP.ROUTECODE)
  988. {
  989. bPass = true;
  990. }
  991. if (bPass == true)
  992. {
  993. this.WriteSimulationCheckOnlineOP(iD, actionType, resourceCode, userCode, product);
  994. OtherCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  995. return actionCheckStatus.OP;
  996. }
  997. }
  998. }
  999. ICSBaseModel dataModel = new ICSBaseModel(this.DataProvider);
  1000. //��һվ�����ɼ�
  1001. if (dataModel.GetOperation2Resource(((ExtendSimulation)product.LastSimulation).NextOPCode, resourceCode) != null)
  1002. {
  1003. ICSITEMROUTE2OP op = this.GetMORouteOP(product.LastSimulation.ITEMCODE, product.LastSimulation.MOCODE, ((ExtendSimulation)product.LastSimulation).NextRouteCode, ((ExtendSimulation)product.LastSimulation).NextOPCode, product);
  1004. if (op == null)
  1005. {
  1006. /*Burn In ©ɨʱFTʾòƷѾ߱ʾҪ޸ģԱUSER֪ˣʾҪӵһվͶ
  1007. ʾʱ򣬼ָòƷѾȲҪֱӱںټһ򣬲ϾǺܷܶĹǿų
  1008. * */
  1009. if (product.LastSimulation != null && product.LastSimulation.ISCOM == "1")
  1010. {
  1011. throw new Exception("$CS_PRODUCT_ALREADY_COMPLETE $CS_Param_OPCode =" + product.LastSimulation.OPCODE);
  1012. }
  1013. else
  1014. {
  1015. throw new Exception("$CS_Route_Failed_GetNotNextOP");
  1016. }
  1017. }
  1018. this.WriteSimulationCheckOnlineOP(iD, actionType, resourceCode, userCode, product);
  1019. OtherCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  1020. if (actionCheckStatus != null)
  1021. {
  1022. actionCheckStatus.OP = op;
  1023. actionCheckStatus.CheckedNextOP = true;
  1024. actionCheckStatus.CheckedNextOPCode = product.LastSimulation.OPCODE;
  1025. actionCheckStatus.CheckedNextRouteCode = product.LastSimulation.NextRouteCode;
  1026. }
  1027. return op;
  1028. }
  1029. else
  1030. {
  1031. throw new Exception("$CS_Route_Failed_GetNextOP_Online_Line $CS_Param_ID =" + product.LastSimulation.RCARD);
  1032. }
  1033. }
  1034. public void OtherCheck(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
  1035. {
  1036. OtherCheck(iD, actionType, resourceCode, userCode, product, null);
  1037. }
  1038. public void OtherCheck(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, Action.ActionCheckStatus actionCheckStatus)
  1039. {
  1040. //���ϺͲ���ͬʱ��������
  1041. switch (product.LastSimulation.LACTION)
  1042. {
  1043. case ActionType.DataCollectAction_OutLineGood:
  1044. //��������Action�Ͳ���Action�Ƿ���ͬһ������
  1045. string route = product.LastSimulation.ROUTECODE;
  1046. string opcode = product.LastSimulation.OPCODE;
  1047. //��ʱ��ֵ
  1048. product.LastSimulation.ROUTECODE = product.LastSimulation.FROMROUTE;
  1049. product.LastSimulation.OPCODE = product.LastSimulation.FROMOP;
  1050. CheckMaterialAndTest(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  1051. //�ָ�����ֵ
  1052. product.LastSimulation.ROUTECODE = route;
  1053. product.LastSimulation.OPCODE = opcode;
  1054. break;
  1055. case ActionType.DataCollectAction_OutLineNG:
  1056. case ActionType.DataCollectAction_NG:
  1057. case ActionType.DataCollectAction_SMTNG:
  1058. case ActionType.DataCollectAction_OQCNG:
  1059. //��������Action�Ͳ���Action�Ƿ���ͬһ������
  1060. CheckMaterialAndTest(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  1061. break;
  1062. case ActionType.DataCollectAction_Reject:
  1063. break;
  1064. default:
  1065. //��������Action�Ͳ���Action�Ƿ���ͬһ������
  1066. CheckMaterialAndTest(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  1067. break;
  1068. }
  1069. }
  1070. public ICSITEMROUTE2OP CheckOnlineOP(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
  1071. {
  1072. return CheckOnlineOP(iD, actionType, resourceCode, userCode, product, null);
  1073. }
  1074. public ICSITEMROUTE2OP CheckOnlineOP(string iD, string actionType, string resourceCode, string userCode, ProductInfo product, Action.ActionCheckStatus actionCheckStatus)
  1075. {
  1076. if (actionCheckStatus != null)
  1077. {
  1078. if (actionCheckStatus.CheckedNextOP == true && actionCheckStatus.OP != null)
  1079. {
  1080. bool bPass = false;
  1081. //��ǰվ
  1082. if (product.LastSimulation.NextOPCode == actionCheckStatus.OP.OPCODE &&
  1083. product.LastSimulation.NextRouteCode == actionCheckStatus.OP.ROUTECODE)
  1084. {
  1085. bPass = true;
  1086. }
  1087. else if (product.LastSimulation.NextOPCode == actionCheckStatus.CheckedNextOPCode &&
  1088. product.LastSimulation.NextRouteCode == actionCheckStatus.CheckedNextRouteCode)
  1089. {
  1090. //��һվ
  1091. bPass = true;
  1092. ((ExtendSimulation)product.LastSimulation).NextOPCode = actionCheckStatus.OP.OPCODE;
  1093. }
  1094. if (bPass == true)
  1095. {
  1096. this.WriteSimulationCheckOnlineOP(iD, actionType, resourceCode, userCode, product);
  1097. OtherCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  1098. return actionCheckStatus.OP;
  1099. }
  1100. }
  1101. }
  1102. //BaseModelFacade dataModel = new BaseModelFacade(this.DataProvider);
  1103. ICSITEMROUTE2OP op;
  1104. //��һվ,��ǰվ������
  1105. ICSBaseModel dataModel = new ICSBaseModel(this.DataProvider);
  1106. if (dataModel.GetOperation2Resource(((ExtendSimulation)product.LastSimulation).NextOPCode, resourceCode) != null)
  1107. {
  1108. op = this.GetMORouteOP(product.LastSimulation.ITEMCODE, product.LastSimulation.MOCODE, ((ExtendSimulation)product.LastSimulation).NextRouteCode, ((ExtendSimulation)product.LastSimulation).NextOPCode, product);
  1109. if (op == null)
  1110. {
  1111. /*Burn In ©ɨʱFTʾòƷѾ߱ʾҪ޸ģԱUSER֪ˣʾҪӵһվͶ
  1112. ʾʱ򣬼ָòƷѾȲҪֱӱںټһ򣬲ϾǺܷܶĹǿų
  1113. * */
  1114. if (product.LastSimulation != null && product.LastSimulation.ISCOM == "1")
  1115. {
  1116. throw new Exception("$CS_PRODUCT_ALREADY_COMPLETE $CS_Param_OPCode =" + product.LastSimulation.OPCODE);
  1117. }
  1118. else
  1119. {
  1120. throw new Exception("$CS_Route_Failed_GetNotNextOP");
  1121. }
  1122. }
  1123. this.WriteSimulationCheckOnlineOP(iD, actionType, resourceCode, userCode, product);
  1124. OtherCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  1125. if (actionCheckStatus != null)
  1126. {
  1127. actionCheckStatus.OP = op;
  1128. actionCheckStatus.CheckedNextOP = true;
  1129. actionCheckStatus.CheckedNextOPCode = product.LastSimulation.OPCODE;
  1130. actionCheckStatus.CheckedNextRouteCode = product.LastSimulation.NextRouteCode;
  1131. }
  1132. return op;
  1133. }
  1134. else
  1135. {
  1136. op = this.GetMORouteNextOperation(product.LastSimulation.MOCODE, ((ExtendSimulation)product.LastSimulation).NextRouteCode, ((ExtendSimulation)product.LastSimulation).NextOPCode);
  1137. if (op == null)
  1138. {
  1139. /*Burn In ©ɨʱFTʾòƷѾ߱ʾҪ޸ģԱUSER֪ˣʾҪӵһվͶ
  1140. ʾʱ򣬼ָòƷѾȲҪֱӱںټһ򣬲ϾǺܷܶĹǿų
  1141. * */
  1142. if (product.LastSimulation != null && product.LastSimulation.ISCOM == "1")
  1143. {
  1144. throw new Exception("��Ʒ�Ѿ��깤, ���� =" + product.LastSimulation.OPCODE);
  1145. }
  1146. else
  1147. {
  1148. throw new Exception("$CS_Route_Failed_GetNotNextOP");
  1149. }
  1150. }
  1151. //ֱ������������������������һվ�ɼ�
  1152. if (product.LastSimulation.LACTION == ActionType.DataCollectAction_GoMO
  1153. && product.LastSimulation.OPCODE != op.OPCODE)
  1154. {
  1155. throw new Exception("$CS_Route_Failed_GetNotNextOP $CS_Param_OPCode =" + product.LastSimulation.OPCODE);
  1156. }
  1157. //�жϵ�ǰ��½��Դ�͹����Ƿ�ƥ��
  1158. ICSOP2RES op2Res = dataModel.GetOperationByResource(resourceCode);
  1159. if (op2Res.OPCODE != op.OPCODE)
  1160. {
  1161. throw new Exception("��Ʒ�ɼ�����Ϊ��" + op.OPCODE + ",��ǰ����Ϊ: " + op2Res.OPCODE);
  1162. }
  1163. // End Added
  1164. if (actionCheckStatus != null)
  1165. {
  1166. actionCheckStatus.OP = op;
  1167. actionCheckStatus.CheckedNextOP = true;
  1168. actionCheckStatus.CheckedNextOPCode = product.LastSimulation.OPCODE;
  1169. actionCheckStatus.CheckedNextRouteCode = product.LastSimulation.NextRouteCode;
  1170. }
  1171. ((ExtendSimulation)product.LastSimulation).NextOPCode = op.OPCODE;
  1172. this.WriteSimulationCheckOnlineOP(iD, actionType, resourceCode, userCode, product);
  1173. OtherCheck(iD, actionType, resourceCode, userCode, product, actionCheckStatus);
  1174. return op;
  1175. }
  1176. }
  1177. public void WriteSimulationCheckOnlineOP(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
  1178. {
  1179. this.WriteSimulation(iD, actionType, resourceCode, userCode, product);
  1180. product.NowSimulation.ROUTECODE = ((ExtendSimulation)product.LastSimulation).NextRouteCode;
  1181. product.NowSimulation.OPCODE = ((ExtendSimulation)product.LastSimulation).NextOPCode;
  1182. }
  1183. #endregion ����
  1184. /// <summary>
  1185. ///
  1186. /// </summary>
  1187. /// <param name="moCode"></param>
  1188. /// <param name="outPutQty">ֻ��Ҫ��д������</param>
  1189. public void UpdateMOOutPut(string moCode, int outPutQty)
  1190. {
  1191. string sql = @"UPDATE ICSMO
  1192. SET MOACTQTY=MOACTQTY+'" + outPutQty + "' where MOCODE='" + moCode + "'";
  1193. sql = string.Format(sql);
  1194. this._domainDataProvider.ExecuteCommand(sql);
  1195. this._domainDataProvider.SubmitChanges();
  1196. }
  1197. #region ����;����Ϣ
  1198. //�����Ƿ�Ϊ;������һ������
  1199. public bool OPIsMORouteLastOP(string moCode, string routeCode, string opCode)
  1200. {
  1201. ICSBaseModel baseModel = new ICSBaseModel(this.DataProvider);
  1202. return baseModel.OperationIsRouteLastOperation(moCode, routeCode, opCode);
  1203. }
  1204. //����;�̹�����Ϣ
  1205. public ICSITEMROUTE2OP GetMORouteOP(string itemCode, string moCode, string routeCode, string curOp, ProductInfo e)
  1206. {
  1207. if (e.CurrentItemRoute2OP == null)
  1208. {
  1209. e.CurrentItemRoute2OP = GetItemRoute2Operation(itemCode, routeCode, curOp);
  1210. }//���ǵ�;�̺͹����任��case
  1211. else if (e.CurrentItemRoute2OP != null
  1212. && (e.CurrentItemRoute2OP.OPCODE != curOp
  1213. || e.CurrentItemRoute2OP.ROUTECODE != routeCode))
  1214. {
  1215. e.CurrentItemRoute2OP = GetItemRoute2Operation(itemCode, routeCode, curOp);
  1216. }
  1217. return e.CurrentItemRoute2OP;
  1218. }
  1219. #region �������������Ų�ѯ����;��
  1220. public ICSMO2ROUTE GetMONormalRouteByMOCode(string moCode)
  1221. {
  1222. var obj = QueryMORoutes(moCode, string.Empty, ISMAINROUTE_TRUE);
  1223. if (obj != null)
  1224. {
  1225. return (ICSMO2ROUTE)obj;
  1226. }
  1227. return null;
  1228. }
  1229. #endregion
  1230. public ICSMO2ROUTE QueryMORoutes(string moCode, string routeCode)
  1231. {
  1232. return QueryMORoutes(moCode, routeCode, string.Empty, string.Empty);
  1233. }
  1234. public ICSMO2ROUTE QueryMORoutes(string moCode, string routeCode, string isMainRoute)
  1235. {
  1236. return QueryMORoutes(moCode, routeCode, isMainRoute, string.Empty);
  1237. }
  1238. public ICSMO2ROUTE QueryMORoutes(string moCode, string routeCode, string isMainRoute, string opBOMVersion)
  1239. {
  1240. string sql = @"select * from ICSMO2ROUTE where ";
  1241. string tmpString = " 1=1 ";
  1242. if ((moCode != string.Empty) && (moCode.Trim() != string.Empty))
  1243. {
  1244. tmpString += " and MOCODE = '" + moCode.Trim() + "'";
  1245. }
  1246. if ((routeCode != string.Empty) && (routeCode.Trim() != string.Empty))
  1247. {
  1248. tmpString += " and ROUTECODE ='" + routeCode.Trim() + "'";
  1249. }
  1250. //if ((isMainRoute != string.Empty) && (isMainRoute.Trim() != string.Empty))
  1251. //{
  1252. // tmpString += " and ISMROUTE ='" + isMainRoute.Trim() + "'";
  1253. //}
  1254. if ((opBOMVersion != string.Empty) && (opBOMVersion.Trim() != string.Empty))
  1255. {
  1256. tmpString += " and OPBOMVER ='" + opBOMVersion.Trim() + "'";
  1257. }
  1258. var objs = this._domainDataProvider.ExecuteQuery<ICSMO2ROUTE>(sql + tmpString).ToList();
  1259. if (objs == null || objs.Count < 1)
  1260. return null;
  1261. else
  1262. return (ICSMO2ROUTE)objs[0];
  1263. }
  1264. #region ����;�̵�һ������
  1265. public ICSITEMROUTE2OP GetMORouteFirstOperation(string moCode)
  1266. {
  1267. var mo = this._domainDataProvider.ICSMO.SingleOrDefault<ICSMO>(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode);
  1268. if (mo == null)
  1269. {
  1270. throw new Exception("$Error_MONotExisted");
  1271. }
  1272. var mo2route = GetMONormalRouteByMOCode(moCode);
  1273. string sql = @" select * from ICSITEMROUTE2OP
  1274. where ITEMCODE='" + mo.ITEMCODE + "' and ROUTECode='" + ((ICSMO2ROUTE)mo2route).ROUTECODE + "' and OPSEQ = (select min(OPSEQ) from ICSITEMROUTE2OP where itemcode = '" + mo.ITEMCODE + "' and routecode = '" + mo2route.ROUTECODE + "' and workpoint = '" + AppConfig.WorkPointCode + "' ) and workpoint = '" + AppConfig.WorkPointCode + "'";
  1275. var objs = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList();
  1276. if (objs == null)
  1277. {
  1278. throw new Exception("$Error_ItemRoute_NotExist" + String.Format("[$Itemcode='{0}',$routecode='{1}']", mo.ITEMCODE, ((ICSMO2ROUTE)mo2route).ROUTECODE));
  1279. }
  1280. return (ICSITEMROUTE2OP)objs[0];
  1281. }
  1282. public ICSITEMROUTE2OP GetMORouteFirstOperation(string moCode, string routeCode)
  1283. {
  1284. var mo = this._domainDataProvider.ICSMO.SingleOrDefault<ICSMO>(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode);
  1285. if (mo == null)
  1286. {
  1287. throw new Exception("$Error_MONotExisted");
  1288. }
  1289. string sql = @" select * from ICSITEMROUTE2OP
  1290. where ITEMCODE='" + mo.ITEMCODE + "' and ROUTECode='" + routeCode + "' and OPSEQ = (select min(OPSEQ) from ICSITEMROUTE2OP where itemcode = '" + mo.ITEMCODE + "' and routecode = '" + routeCode + "' and workpoint = '" + AppConfig.WorkPointCode + "' ) and workpoint = '" + AppConfig.WorkPointCode + "'";
  1291. var objs = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList();
  1292. if (objs == null)
  1293. {
  1294. throw new Exception("$Error_ItemRoute_NotExist" + String.Format("[$Itemcode='{0}',$routecode='{1}']", mo.ITEMCODE, routeCode));
  1295. }
  1296. return (ICSITEMROUTE2OP)objs[0];
  1297. }
  1298. #endregion
  1299. # region �鿴��һ������
  1300. public ICSITEMROUTE2OP GetMORouteNextOperation(string moCode, string routeCode, string opCode)
  1301. {
  1302. var mo = this._domainDataProvider.ICSMO.SingleOrDefault<ICSMO>(a => a.MOCODE == moCode && a.WorkPoint == AppConfig.WorkPointCode);
  1303. if (mo == null)
  1304. {
  1305. throw new Exception("$Error_MONotExisted");
  1306. }
  1307. string sql = @" select * from ICSITEMROUTE2OP
  1308. where ITEMCODE= '" + mo.ITEMCODE + "' and ROUTECODE='" + routeCode + "' and OPSEQ > (select OPSEQ from ICSITEMROUTE2OP where itemcode = '" + mo.ITEMCODE + "' and routecode = '" + routeCode + "' and opcode='" + opCode + "' and workpoint = '" + AppConfig.WorkPointCode + "') and workpoint = '" + AppConfig.WorkPointCode + "' order by opseq";
  1309. var objs = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList();
  1310. if (objs == null || objs.Count < 1)
  1311. return null;
  1312. else
  1313. return (ICSITEMROUTE2OP)objs[0];
  1314. }
  1315. #endregion
  1316. #region ��ѯij�������������кŸ���
  1317. public int GetMO2RCardLinkCount(string moCode)
  1318. {
  1319. string sql = "SELECT COUNT(*) FROM ICSMO2RCARD WHERE MOCODE='" + moCode + "'";
  1320. var objs = this._domainDataProvider.ExecuteQuery<ICSMO2RCARD>(sql).ToList();
  1321. if (objs == null || objs.Count < 1)
  1322. return 0;
  1323. else
  1324. return (objs.Count);
  1325. }
  1326. #endregion
  1327. #region ��ѯ�����׼���¼����
  1328. public int QueryFirstCheckByMOCount(string moCode, int checkDate)
  1329. {
  1330. string sql = @"select count(*)
  1331. from ICSFIRSTCHECKBYMO A left join ICSMO B on A.MOCODE = B.MOCODE
  1332. left join ICSINVENTORY C on B.ITEMCODE = C.INVCODE
  1333. where 1=1";
  1334. if (!String.IsNullOrEmpty(moCode))
  1335. {
  1336. sql += " and A.MOCODE = '" + moCode + "'";
  1337. }
  1338. if (checkDate > 0)
  1339. {
  1340. sql += " and A.CHECKDATE = '" + checkDate + "'";
  1341. }
  1342. var objs = this._domainDataProvider.ExecuteQuery<ICSFIRSTCHECKBYMO>(sql).ToList();
  1343. if (objs == null || objs.Count < 1)
  1344. return 0;
  1345. else
  1346. return (objs.Count);
  1347. }
  1348. #endregion
  1349. #region �������������Ų�ѯ�����׼���¼
  1350. public ICSFIRSTCHECKBYMO GetFirstCheckByMO(string moCode, string checkDate)
  1351. {
  1352. string sql = @"select * from ICSFIRSTCHECKBYMO where MOCODE='" + moCode + "' and CHECKDATE='" + checkDate + "'";
  1353. var obj = this._domainDataProvider.ExecuteQuery<ICSFIRSTCHECKBYMO>(sql).ToList();
  1354. if (obj != null && obj.Count > 0)
  1355. {
  1356. return (ICSFIRSTCHECKBYMO)obj[0];
  1357. }
  1358. return null;
  1359. }
  1360. #endregion
  1361. public ICSITEMROUTE2OP GetItemRoute2Operation(string itemCode, string routeCode, string opCode)
  1362. {
  1363. string sql = @"select * from ICSITEMROUTE2OP
  1364. where ITEMCODE='" + itemCode + "' and ROUTECODE='" + routeCode + "' and OPCODE ='" + opCode + "'";
  1365. var obj = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList();
  1366. if (obj == null || obj.Count < 1)
  1367. {
  1368. throw new Exception("$Error_ItemRoute_NotExisted");
  1369. }
  1370. return (ICSITEMROUTE2OP)obj[0];
  1371. }
  1372. #region �жϹ����Ƿ����ڲ�Ʒ;�̹���
  1373. public bool IsOPInItemOP(string itemCode, int orgID, string OPCode)
  1374. {
  1375. string sql = @"SELECT COUNT (*) FROM ICSITEMROUTE2OP
  1376. WHERE ITEMCODE = '" + itemCode + "' AND OPCODE = '" + OPCode + "' ";
  1377. var obj = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList();
  1378. if (obj == null || obj.Count < 1)
  1379. {
  1380. return false;
  1381. }
  1382. else
  1383. {
  1384. return true;
  1385. }
  1386. }
  1387. #endregion
  1388. public ICSITEMROUTE2OP QueryItemRoute2Op(string routeCode, string itemCode)
  1389. {
  1390. string sql = @"SELECT COUNT (*) FROM ICSITEMROUTE2OP
  1391. WHERE ITEMCODE = '" + itemCode + "' AND ROUTECODE = '" + routeCode + "' ";
  1392. var obj = this._domainDataProvider.ExecuteQuery<ICSITEMROUTE2OP>(sql).ToList();
  1393. if (obj == null || obj.Count < 1)
  1394. {
  1395. throw new Exception("$Error_ItemRoute_NotExisted");
  1396. }
  1397. return (ICSITEMROUTE2OP)obj[0];
  1398. }
  1399. #endregion ����;����Ϣ
  1400. #endregion
  1401. #region ���к�ת���ɼ�
  1402. //ID��ת��ǰ���кţ�����
  1403. //Resrouce����ǰ��̨��Դ���ƣ�����
  1404. //UserCode�������û�������
  1405. // Language�����Կ��أ�0 Ӣ�ģ�1 ���ģ�Ŀǰֻ�ṩ����
  1406. //����ֵ����OK�� ��ʾ����ͨ��������Ϊ������Ϣ
  1407. public string CheckIDRoute(string ID, string Resrouce, string UserCode, int Language)//�˷������ıߵ��ã�������������
  1408. {
  1409. ID = ID.Trim().ToUpper();
  1410. Resrouce = Resrouce.Trim().ToUpper();
  1411. UserCode = UserCode.Trim().ToUpper();
  1412. if (ID == string.Empty)
  1413. return "$CS_IDisNull";
  1414. if (Resrouce == string.Empty)
  1415. return "$CS_ResrouceisNull";
  1416. if (UserCode == string.Empty)
  1417. return "$CS_UserCodeisNull";
  1418. ActionOnLineHelper onLine = new ActionOnLineHelper(this.DataProvider);
  1419. Messages messages1 = onLine.GetIDInfo(ID);
  1420. if (messages1.IsSuccess())
  1421. {
  1422. //((Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();
  1423. //try
  1424. //{
  1425. // ProductInfo product = (ProductInfo)messages1.GetData().Values[0];
  1426. // messages1.AddMessages(onLine.CheckID(new ActionEventArgs(ActionType.DataCollectAction_IDTran, ID,
  1427. // UserCode, Resrouce,
  1428. // product
  1429. // )));
  1430. // if (!messages1.IsSuccess())
  1431. // return GetErrorMessage(messages1);
  1432. // return "OK";
  1433. //}
  1434. //catch
  1435. //{
  1436. //}
  1437. //finally
  1438. //{
  1439. // ((Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
  1440. //}
  1441. return "";
  1442. }
  1443. else
  1444. {
  1445. return GetErrorMessage(messages1);
  1446. }
  1447. }
  1448. public string GetErrorMessage(Messages messages)
  1449. {
  1450. for (int i = 0; i < messages.Count(); i++)
  1451. {
  1452. Message message = messages.Objects(i);
  1453. if (message.Type == MessageType.Error)
  1454. {
  1455. if (message.Body == string.Empty)
  1456. return message.Exception.Message;
  1457. else
  1458. return (message.Body);
  1459. }
  1460. }
  1461. // return messages.Debug();
  1462. return "$CS_System_unKnowError";
  1463. }
  1464. public string GetRuningCard(string sCard, string moCode)
  1465. {
  1466. string sql = "";
  1467. if (string.IsNullOrEmpty(moCode.Trim()))
  1468. {
  1469. sql = @"SELECT top 1 * FROM icssimulation
  1470. WHERE scard = '" + sCard + "' AND mocode = '" + moCode + "'" +
  1471. " ORDER BY mdate DESC, mtime DESC";
  1472. }
  1473. else
  1474. {
  1475. sql = @"SELECT top 1 * FROM icssimulation
  1476. WHERE scard = '" + sCard + "'" +
  1477. " ORDER BY mdate DESC, mtime DESC";
  1478. }
  1479. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1480. if (objs == null || objs.Count < 1)
  1481. return "";
  1482. else
  1483. return ((ICSSimulation)objs[0]).RCARD;
  1484. }
  1485. #endregion
  1486. #region Simulation
  1487. /// <summary>
  1488. ///
  1489. /// </summary>
  1490. public ICSSimulation CreateNewSimulation()
  1491. {
  1492. return new ICSSimulation();
  1493. }
  1494. public void AddSimulation(ICSSimulation simulation)
  1495. {
  1496. this._domainDataProvider.ICSSimulation.InsertOnSubmit(simulation);
  1497. this._domainDataProvider.SubmitChanges();
  1498. }
  1499. public void UpdateSimulation(ICSSimulation simulation)
  1500. {
  1501. var line = this._domainDataProvider.ICSSimulation.SingleOrDefault(a => a.RCARD == simulation.RCARD && a.WorkPoint == AppConfig.WorkPointCode);
  1502. if (line != null)
  1503. {
  1504. this._domainDataProvider.ICSSimulation.DeleteOnSubmit(line);
  1505. }
  1506. this._domainDataProvider.ICSSimulation.InsertOnSubmit(simulation);
  1507. }
  1508. public void UpdateSimulationReport(ICSSimulationReport simulationReport)
  1509. {
  1510. var line = this._domainDataProvider.ICSSimulationReport.SingleOrDefault(a => a.RCARD == simulationReport.RCARD && a.WorkPoint == AppConfig.WorkPointCode);
  1511. if (line != null)
  1512. {
  1513. this._domainDataProvider.ICSSimulationReport.DeleteOnSubmit(line);
  1514. }
  1515. this._domainDataProvider.ICSSimulationReport.InsertOnSubmit(simulationReport);
  1516. }
  1517. public void DeleteSimulation(ICSSimulation simulation)
  1518. {
  1519. var line = this._domainDataProvider.ICSSimulation.Where(a => a.RCARD == simulation.RCARD && a.WorkPoint == simulation.WorkPoint);
  1520. this._domainDataProvider.ICSSimulation.DeleteAllOnSubmit(line);
  1521. }
  1522. public void UpdateSimulationForLot(string rCard, string moCode, string lotNo)
  1523. {
  1524. string sql = "UPDATE ICSSimulation SET LOTNO='" + lotNo + "' WHERE RCARD='" + rCard + "' AND MOCODE='" + moCode + "'";
  1525. sql = string.Format(sql);
  1526. this._domainDataProvider.ExecuteCommand(sql);
  1527. this._domainDataProvider.SubmitChanges();
  1528. }
  1529. // End Added
  1530. /// <summary>
  1531. ///
  1532. /// �Ĵ���SQL
  1533. /// </summary>
  1534. /// <param name="runningCard"></param>
  1535. /// <returns></returns>
  1536. // public object GetSimulation(string runningCard)
  1537. // {
  1538. // object[] simulations = this.DataProvider.CustomQuery(typeof(Simulation),
  1539. // //new SQLParamCondition(string.Format("select {0} from TBLSIMULATION where RCARD = $RCARD order by MDATE desc,MTIME desc",
  1540. // new SQLParamCondition(string.Format(
  1541. // @"select {0} from
  1542. // (select A.*
  1543. // from TBLSIMULATION A
  1544. // where RCARD = $RCARD
  1545. // order by A.MDATE desc, A.MTIME desc)
  1546. // where rownum = 1",
  1547. // DomainObjectUtility.GetDomainObjectFieldsString(typeof(Simulation))),
  1548. // new SQLParameter[] { new SQLParameter("RCARD", typeof(string), runningCard.ToUpper()) }));
  1549. // if (simulations == null)
  1550. // return null;
  1551. // if (simulations.Length > 0)
  1552. // return simulations[0];
  1553. // else
  1554. // return null;
  1555. // }
  1556. public ICSSimulation GetSimulation(string runningCard)
  1557. {
  1558. string sql = "SELECT * FROM ICSSimulation WHERE RCARD = '" + runningCard + "' ORDER BY MTIME DESC ";
  1559. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1560. if (objs == null || objs.Count < 1)
  1561. return null;
  1562. else
  1563. return (ICSSimulation)objs[0];
  1564. }
  1565. public ICSSimulation GetSimulationByRCardOrTCard(string runningCard)
  1566. {
  1567. string sql = @"select * from ICSSimulation
  1568. where RCARD = '" + runningCard + "' or TCARD='" + runningCard + "'order by MTIME desc";
  1569. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1570. if (objs == null || objs.Count < 1)
  1571. return null;
  1572. else
  1573. return (ICSSimulation)objs[0];
  1574. }
  1575. // public object GetSimulationByRCardOrTCard(string runningCard)
  1576. // {
  1577. // object[] simulations = this.DataProvider.CustomQuery(typeof(Simulation),
  1578. // //new SQLParamCondition(string.Format("select {0} from TBLSIMULATION where RCARD = $RCARD order by MDATE desc,MTIME desc",
  1579. // new SQLParamCondition(string.Format(
  1580. // @"select {0} from tblsimulation where
  1581. // (rcard,mocode) in (
  1582. // select rcard, mocode
  1583. // from (select rcard, mocode
  1584. // from TBLSIMULATION
  1585. // where RCARD = $RCARD
  1586. // OR TCARD=$RCARD
  1587. // order by MDATE desc, MTIME desc)
  1588. // where rownum = 1)",
  1589. // DomainObjectUtility.GetDomainObjectFieldsString(typeof(Simulation))),
  1590. // new SQLParameter[] { new SQLParameter("RCARD", typeof(string), runningCard.ToUpper()), new SQLParameter("RCARD", typeof(string), runningCard.ToUpper()) }));
  1591. // if (simulations == null)
  1592. // return null;
  1593. // if (simulations.Length > 0)
  1594. // return simulations[0];
  1595. // else
  1596. // return null;
  1597. // }
  1598. public ICSSimulation GetSimulationByTCard(string runningCard)
  1599. {
  1600. string sql= @"select * from ICSSimulation
  1601. where TCARD='"+runningCard+"' order by MTIME desc ";
  1602. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1603. if (objs == null || objs.Count < 1)
  1604. return null;
  1605. else
  1606. return (ICSSimulation)objs[0];
  1607. }
  1608. public ICSSimulation QuerySimulation(string runningCard)
  1609. {
  1610. string sql = @"select * from ICSSimulation
  1611. where RCARD = '" + runningCard + "' order by MTIME desc";
  1612. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1613. if (objs == null || objs.Count < 1)
  1614. return null;
  1615. else
  1616. return (ICSSimulation)objs[0];
  1617. }
  1618. public ICSSimulationReport QuerySimulationReport(string runningCard)
  1619. {
  1620. string sql = @"select * from ICSSimulationReport
  1621. where RCARD = '" + runningCard + "' order by MTIME desc";
  1622. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList();
  1623. if (objs == null || objs.Count < 1)
  1624. return null;
  1625. else
  1626. return (ICSSimulationReport)objs[0];
  1627. }
  1628. /// <summary>
  1629. /// �Ĵ���SQL
  1630. /// </summary>
  1631. /// <param name="runningCard"></param>
  1632. /// <returns></returns>
  1633. public ICSSimulation GetOnlineSimulationByMoCode(string moCode)
  1634. {
  1635. string sql = @"select * from ICSSimulation
  1636. where MODE = '" + moCode + "' and ISCOM = 0 order by MTIME desc";
  1637. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1638. if (objs == null || objs.Count < 1)
  1639. return null;
  1640. else
  1641. return (ICSSimulation)objs[0];
  1642. }
  1643. /// <summary>
  1644. /// �Ĵ���SQL
  1645. /// </summary>
  1646. /// <param name="runningCard"></param>
  1647. /// <returns></returns>
  1648. public ICSSimulation GetSimulationFromCarton(string cartonno)
  1649. {
  1650. string sql = @"select * from ICSSimulation
  1651. CARTONCODE = '" + cartonno + "' order by MTIME desc";
  1652. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1653. if (objs == null || objs.Count < 1)
  1654. return null;
  1655. else
  1656. return (ICSSimulation)objs[0];
  1657. }
  1658. public ICSSimulationReport GetRCardByCartonCode(string cartonCode)
  1659. {
  1660. string sql = @"select * from ICSSimulation
  1661. CARTONCODE = '" + cartonCode + "' order by MTIME desc";
  1662. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList();
  1663. if (objs == null || objs.Count < 1)
  1664. return null;
  1665. else
  1666. return (ICSSimulationReport)objs[0];
  1667. }
  1668. // End Added
  1669. /// <summary>
  1670. ///
  1671. /// �Ĵ���SQL
  1672. /// </summary>
  1673. /// <param name="runningCard"></param>
  1674. /// <returns></returns>
  1675. public ICSSimulation GetSimulation(string moCode, string runningCard)
  1676. {
  1677. string sql = @"select * from ICSSimulation
  1678. WHERE RCARD='" + runningCard + "' and MOCODE='" + moCode + "'";
  1679. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1680. if (objs == null || objs.Count < 1)
  1681. return null;
  1682. else
  1683. return (ICSSimulation)objs[0];
  1684. }
  1685. public ICSSimulation GetSimulationByMoCodeAndRcardORTCard(string moCode, string runningCard)
  1686. {
  1687. string sql = @"select * from ICSSimulation
  1688. where (RCARD = '" + runningCard + "' or TCARD='" + runningCard + "') and MOCODE = '" + moCode + "'";
  1689. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1690. if (objs == null || objs.Count < 1)
  1691. return null;
  1692. else
  1693. return (ICSSimulation)objs[0];
  1694. }
  1695. public ICSSimulation GetSimulationByTCARDAndMoCode(string moCode, string translateCard)
  1696. {
  1697. string sql = @"select * from ICSSimulation
  1698. where TCARD = '" + translateCard + "' and MOCODE = '" + moCode + "'";
  1699. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1700. if (objs == null || objs.Count < 1)
  1701. return null;
  1702. else
  1703. return (ICSSimulation)objs[0];
  1704. }
  1705. //
  1706. /// <summary>
  1707. /// ����translateCard��ѯת�������к�
  1708. /// </summary>
  1709. public ICSSimulation GetSimulationFromTCard(string translateCard)
  1710. {
  1711. string sql = @"select * from ICSSimulation
  1712. where TCARD = '" + translateCard + "'";
  1713. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1714. if (objs == null || objs.Count < 1)
  1715. return null;
  1716. else
  1717. return (ICSSimulation)objs[0];
  1718. }
  1719. public ICSSimulation GetLastSimulation(string rcard)
  1720. {
  1721. string sql = @"select * from ICSSimulation
  1722. where RCARD='" + rcard + "'and MOCODE in(select MOCODE from ICSMO where MOSTATUS='') ORDER BY MTIME DESC";
  1723. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1724. if (objs == null || objs.Count < 1)
  1725. return null;
  1726. else
  1727. return (ICSSimulation)objs[0];
  1728. }
  1729. public ICSSimulation GetLastSimulation(string rcard, string moCode)
  1730. {
  1731. string sql = @"select * from ICSSimulation
  1732. where RCARD='" + rcard + "'and MOCODE = '" + moCode + "'and MOCODE in(select MOCODE from ICSMO where MOSTATUS='') ORDER BY MTIME DESC";
  1733. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1734. if (objs == null || objs.Count < 1)
  1735. return null;
  1736. else
  1737. return (ICSSimulation)objs[0];
  1738. }
  1739. public ICSSimulation GetSimulationNotInCurretMoCode(string rcard, string moCode)
  1740. {
  1741. string sql = @"select * from ICSSimulation
  1742. where RCARD='" + rcard + "'and MOCODE in(select MOCODE from ICSMO where MOSTATUS='') and MOCODE!='" + moCode + "' ";
  1743. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1744. if (objs == null || objs.Count < 1)
  1745. return null;
  1746. else
  1747. return (ICSSimulation)objs[0];
  1748. }
  1749. public ICSSimulation GetLastSimulationOrderByDateAndTime(string rcard)
  1750. {
  1751. string sql = @"select * from ICSSimulation
  1752. where RCARD='" + rcard + "'and MOCODE in(select MOCODE from ICSMO where MOSTATUS='') and PRODUCTSTATUS in ('GOOD','OFFLINE','OFFMO','OUTLINE') ORDER BY MTIME DESC";
  1753. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulation>(sql).ToList();
  1754. if (objs == null || objs.Count < 1)
  1755. return null;
  1756. else
  1757. return (ICSSimulation)objs[0];
  1758. }
  1759. #endregion
  1760. #region OnWIP
  1761. /// <summary>
  1762. ///
  1763. /// </summary>
  1764. public ICSONWIP CreateNewOnWIP()
  1765. {
  1766. return new ICSONWIP();
  1767. }
  1768. public void AddOnWIP(ICSONWIP onWIP)
  1769. {
  1770. this._domainDataProvider.ICSONWIP.InsertOnSubmit(onWIP);
  1771. }
  1772. public void UpdateOnWIP(ICSONWIP onWIP)
  1773. {
  1774. //this.DataProvider.Update(onWIP);
  1775. var line = this._domainDataProvider.ICSONWIP.Where(a => a.ID == onWIP.ID);
  1776. this._domainDataProvider.ICSONWIP.DeleteAllOnSubmit(line);
  1777. this._domainDataProvider.ICSONWIP.InsertOnSubmit(onWIP);
  1778. }
  1779. public void DeleteOnWIP(ICSONWIP onWIP)
  1780. {
  1781. var line = this._domainDataProvider.ICSONWIP.Where(a => a.ID == onWIP.ID);
  1782. this._domainDataProvider.ICSONWIP.DeleteAllOnSubmit(line);
  1783. }
  1784. public ICSONWIP QueryOnWIP(string mCard, string moCode, string opCode, string action)
  1785. {
  1786. string sql = @"select * from ICSONWIP
  1787. where RCARD='" + mCard + "' and ACTION='" + action + "' and MOCODE='" + moCode + "'and OPCODE='" + opCode + "'";
  1788. var objs = this._domainDataProvider.ExecuteQuery<ICSONWIP>(sql).ToList();
  1789. if (objs == null || objs.Count < 1)
  1790. return null;
  1791. else
  1792. return (ICSONWIP)objs[0];
  1793. }
  1794. #endregion
  1795. #region SimulationReport
  1796. /// <summary>
  1797. ///
  1798. /// </summary>
  1799. public ICSSimulationReport CreateNewSimulationReport()
  1800. {
  1801. return new ICSSimulationReport();
  1802. }
  1803. public void AddSimulationReport(ICSSimulationReport simulationReport)
  1804. {
  1805. this.DataProvider.ICSSimulationReport.InsertOnSubmit(simulationReport);
  1806. this._domainDataProvider.SubmitChanges();
  1807. }
  1808. //��������Ʒ��ʷ��¼����LOTNO
  1809. public void UpdateSimulationReportForLot(string rCard, string moCode, string lotNo)
  1810. {
  1811. string sql = @"UPDATE ICSSimulationReport
  1812. SET LOTNO='" + lotNo + "' WHERE RCARD='" + rCard + "' AND MOCODE='" + moCode + "'";
  1813. sql = string.Format(sql);
  1814. this._domainDataProvider.ExecuteCommand(sql);
  1815. this._domainDataProvider.SubmitChanges();
  1816. }
  1817. //����Carton��
  1818. public void UpdateSimulationReportCartonNo(string rcard, string mocode, string ctnno)
  1819. {
  1820. string sql = @"UPDATE ICSSimulationReport
  1821. SET CARTONCODE='" + ctnno + "'where RCARD='" + rcard + "' and MOCODE='" + mocode + "'";
  1822. sql = string.Format(sql);
  1823. this._domainDataProvider.ExecuteCommand(sql);
  1824. this._domainDataProvider.SubmitChanges();
  1825. }
  1826. //����RCODE��MOCODEɾ������Ʒ��ʷ��¼��
  1827. public void DeleteSimulationReport(ICSSimulation simulation)
  1828. {
  1829. string sql = @"delete from ICSSimulationReport
  1830. where RRCARD='" + simulation.RCARD + "' and MOCODE='" + simulation.MOCODE + "'";
  1831. sql = string.Format(sql);
  1832. this._domainDataProvider.ExecuteCommand(sql);
  1833. this._domainDataProvider.SubmitChanges();
  1834. }
  1835. public void DeleteSimulationReport(ICSSimulationReport simulationReport)
  1836. {
  1837. var line = this._domainDataProvider.ICSSimulationReport.Where(a => a.ID == simulationReport.ID);
  1838. this._domainDataProvider.ICSSimulationReport.DeleteOnSubmit(simulationReport);
  1839. //this.DataProvider.Delete(simulationReport);
  1840. }
  1841. /// <summary>
  1842. /// ���ݲ�Ʒ��ǰ���кŻ�ȡ����һ��SimulationReport
  1843. /// </summary>
  1844. /// <param name="rcard"></param>
  1845. /// <returns></returns>
  1846. public ICSSimulationReport GetLastSimulationReport(string rcard)
  1847. {
  1848. string sql = @"select * from ICSSimulationReport
  1849. where RCARD='" + rcard + "'";
  1850. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList();
  1851. if (objs == null || objs.Count < 1)
  1852. return null;
  1853. else
  1854. return (ICSSimulationReport)objs[0];
  1855. }
  1856. /// <summary>
  1857. ///���ݲ�Ʒ��ǰ���кš��깤״̬��ȡ����һ��SimulationReport
  1858. /// </summary>
  1859. /// <param name="rcard"></param>
  1860. /// <param name="isComp"></param>
  1861. /// <returns></returns>
  1862. public ICSSimulationReport GetLastSimulationReport(string rcard, bool isComp)
  1863. {
  1864. string sql = @"SELECT * FROM ICSSimulationReport
  1865. WHERE RCARD='" + rcard + "' and ISCOM='" + isComp + "'ORDER BY MTIME DESC";
  1866. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList();
  1867. if (objs == null || objs.Count < 1)
  1868. return null;
  1869. else
  1870. return (ICSSimulationReport)objs[0];
  1871. }
  1872. /// <summary>
  1873. /// ���ݰ�װ���Ż�ȡ����һ��SimulationReport
  1874. /// </summary>
  1875. /// <param name="cartonCode"></param>
  1876. /// <returns></returns>
  1877. public ICSSimulationReport GetLastSimulationReportByCarton(string cartonCode)
  1878. {
  1879. string sql = @"SELECT * FROM ICSSimulationReport
  1880. WHERE CARTONCODE='" + cartonCode + "' ORDER BY MTIME DESC";
  1881. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList();
  1882. if (objs == null || objs.Count < 1)
  1883. return null;
  1884. else
  1885. return (ICSSimulationReport)objs[0];
  1886. }
  1887. //���ݰ�װ���Ų�������Ʒ��Ϣ
  1888. public ICSSimulationReport QuerySimulationReportByCarton(string cartonno)
  1889. {
  1890. string sql = @"select * from ICSSimulationReport
  1891. where CARTONCODE = '" + cartonno + "'";
  1892. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList();
  1893. if (objs == null || objs.Count < 1)
  1894. return null;
  1895. else
  1896. return (ICSSimulationReport)objs[0];
  1897. }
  1898. //���ݹ����š���Ʒ��ǰ���кŻ�ȡ����Ʒ��Ϣ
  1899. public ICSSimulationReport GetSimulationReport(string moCode, string runningCard)
  1900. {
  1901. string sql = @"select * from ICSSimulationReport
  1902. where RCARD = '" + runningCard + "' and MOCODE = '" + moCode + "' order by MTIME desc";
  1903. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList();
  1904. if (objs == null || objs.Count < 1)
  1905. return null;
  1906. else
  1907. return (ICSSimulationReport)objs[0];
  1908. }
  1909. //���ݹ����š���Ʒ��ǰ���кŻ�ȡ״̬���ڡ�OFFMO��������Ʒ��Ϣ
  1910. public ICSSimulationReport GetSimulationReportNotInCurretMoCode(string rcard, string moCode)
  1911. {
  1912. string sql = "SELECT * FROM ICSSimulationReport WHERE RCARD='" + rcard + "' and MOCODE!='" + moCode + "' and PRODUCTSTATUS != 'OFFMO' ORDER BY MTIME DESC";
  1913. var objs = this._domainDataProvider.ExecuteQuery<ICSSimulationReport>(sql).ToList();
  1914. if (objs == null || objs.Count < 1)
  1915. return null;
  1916. else
  1917. return (ICSSimulationReport)objs[0];
  1918. }
  1919. #endregion
  1920. #region OnWIPItem
  1921. /// <summary>
  1922. ///
  1923. /// </summary>
  1924. public ICSONWIPITEM CreateNewOnWIPItem()
  1925. {
  1926. return new ICSONWIPITEM();
  1927. }
  1928. public void AddOnWIPItem(ICSONWIPITEM onWIPItem)
  1929. {
  1930. this.DataProvider.ICSONWIPITEM.InsertOnSubmit(onWIPItem);
  1931. }
  1932. public void UpdateOnWIPItem(ICSONWIPITEM onWIPItem)
  1933. {
  1934. var line = this._domainDataProvider.ICSONWIPITEM.Where(a => a.ID == onWIPItem.ID);
  1935. this._domainDataProvider.ICSONWIPITEM.DeleteAllOnSubmit(line);
  1936. this._domainDataProvider.ICSONWIPITEM.InsertOnSubmit(onWIPItem);
  1937. //this.DataProvider.Update(onWIPItem);
  1938. }
  1939. public void DeleteOnWIPItem(ICSONWIPITEM onWIPItem)
  1940. {
  1941. var line = this._domainDataProvider.ICSONWIPITEM.Where(a => a.ID == onWIPItem.ID);
  1942. this._domainDataProvider.ICSONWIPITEM.DeleteAllOnSubmit(line);
  1943. //this.DataProvider.Delete(onWIPItem);
  1944. }
  1945. //���ݲ�Ʒ���кš���Ʒ���к���ˮ�š����������š�MCARD��ˮ�Ż�ȡ������ʷ��¼
  1946. public object GetOnWIPItem(string runningCard, decimal runningCardSequence, string mocode, decimal mSequence)
  1947. {
  1948. //return this.DataProvider.CustomSearch(typeof(OnWIPItem), new object[] { runningCard, runningCardSequence, mOCode, mSequence });
  1949. var line = this._domainDataProvider.ICSONWIPITEM.SingleOrDefault(a => a.RCARD == runningCard && a.RCARDSEQ == runningCardSequence && a.MOCODE == mocode && a.MSEQ == mSequence);
  1950. return (ICSONWIPITEM)line;
  1951. }
  1952. //���ݲ�Ʒ���кš����������Ż�ȡ����һ��������ʷ��¼
  1953. public ICSONWIPITEM GetLastOnWIPItem(string runningCard, string moCode)
  1954. {
  1955. string sql = @" select * from ICSONWIPITEM
  1956. where RCARD='" + runningCard + "' and MOCODE = '" + moCode + "' order by MTIME desc,MOSEQ desc";
  1957. var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList();
  1958. if (objs == null || objs.Count < 1)
  1959. return null;
  1960. else
  1961. return (ICSONWIPITEM)objs[0];
  1962. }
  1963. //���ݲ�Ʒ���кš���Ʒ���к���ˮ�š����������Ż�ȡ���ϴ���
  1964. public ICSONWIPITEM ExtraQuery(string runningCard, decimal runningCardSequence, string moCode)
  1965. {
  1966. string sql = @"select distinct MITEMCODE from ICSONWIPITEM
  1967. where MCARDTYPE='" + MCardType.MCardType_Keyparts + "' and RCARD = '" + runningCard + "' and RCARDSEQ = '" + runningCardSequence + "' and MOCODE = '" + moCode + "'"
  1968. +" union (select MITEMCODE from ICSONWIPITEM where MCARDTYPE=" + MCardType.MCardType_INNO + " and RCARD = '" + runningCard + "' and RCARDSEQ = '" + runningCardSequence + "' and MOCODE = '" + moCode + "'";
  1969. var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList();
  1970. if (objs == null || objs.Count < 1)
  1971. return null;
  1972. else
  1973. return (ICSONWIPITEM)objs[0];
  1974. }
  1975. public static ICSONWIPITEM ExtraQuery(string runningCard)
  1976. {
  1977. ArrayList arRcard = new ArrayList();
  1978. //BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider);
  1979. //castHelper.GetAllRCard(ref arRcard, runningCard);
  1980. arRcard.Add(runningCard);
  1981. string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')";
  1982. FramDataContext db = new FramDataContext(AppConfig.AppConnectString);
  1983. db.Connection.Open();
  1984. db.Transaction = db.Connection.BeginTransaction();
  1985. ICSONWIPITEM entity = new ICSONWIPITEM();
  1986. try
  1987. {
  1988. var line = db.ICSONWIPITEM.Where(a => a.RCARD == runningCard && a.ACTIONTYPE ==MaterialType.CollectMaterial.ToString());
  1989. return (ICSONWIPITEM)line;
  1990. }
  1991. catch (Exception ex)
  1992. {
  1993. throw new Exception(ex.Message);
  1994. }
  1995. }
  1996. public ICSONWIPITEM ExtraQuery(string runningCard, string opCODE, string moCode, string actionType, ProductInfo product)
  1997. {
  1998. string sql = "";
  1999. string selectSQL = String.Empty;
  2000. // ��ѯ���ϼ�¼�����ϼ�¼
  2001. if (actionType == ActionType.DataCollectAction_DropMaterial)
  2002. {
  2003. string runningCards = runningCard;
  2004. if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
  2005. {
  2006. ArrayList arRcard = new ArrayList();
  2007. //BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider);
  2008. //castHelper.GetAllRCard(ref arRcard, runningCard);
  2009. arRcard.Add(runningCard);
  2010. runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')";
  2011. sql = @" select * from ICSONWIPITEM
  2012. where RCARD='" + runningCard + "' and DROPOP='" + opCODE + "' and ACTIONTYPE='" + (int)MaterialType.DropMaterial + "'";
  2013. }
  2014. else
  2015. {
  2016. sql = " select * from ICSONWIPITEM where RCARD = RCARD='" + runningCard + "' and DROPOP='" + opCODE + "' and ACTIONTYPE='" + (int)MaterialType.DropMaterial + "'";
  2017. }
  2018. var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList();
  2019. if (objs == null || objs.Count < 1)
  2020. return null;
  2021. else
  2022. return (ICSONWIPITEM)objs[0];
  2023. }
  2024. else
  2025. {
  2026. sql = @" select * from ICSONWIPITEM
  2027. where RCARD = RCARD='" + runningCard + "' and DROPOP='" + opCODE + "' and MOCODE = '" + moCode + "' and ACTIONTYPE='" + (int)MaterialType.DropMaterial + "'";
  2028. var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList();
  2029. if (objs == null || objs.Count < 1)
  2030. return null;
  2031. else
  2032. return (ICSONWIPITEM)objs[0];
  2033. }
  2034. }
  2035. //������С��װ�Ż�����Ʒ�IJ�Ʒ���кŲ���������ʷ��¼
  2036. public ICSONWIPITEM QueryOnWIPItem(string mCard)
  2037. {
  2038. string sql = @" select * from ICSONWIPITEM
  2039. where where 1=1 and MCARD = '" + mCard + "'";
  2040. var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList();
  2041. if (objs == null || objs.Count < 1)
  2042. return null;
  2043. else
  2044. return (ICSONWIPITEM)objs[0];
  2045. }
  2046. //������С��װ�Ż�����Ʒ�IJ�Ʒ���кź����ϴ�����ѯ������ʷ��¼��Ϣ
  2047. public ICSONWIPITEM QueryOnWIPItem(string mCard, string MItemCode)
  2048. {
  2049. string sql = @" select * from ICSONWIPITEM
  2050. where where 1=1 and MCARD = '" + mCard + "'and MITEMCODE='" + MItemCode + "'";
  2051. var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList();
  2052. if (objs == null || objs.Count < 1)
  2053. return null;
  2054. else
  2055. return (ICSONWIPITEM)objs[0];
  2056. }
  2057. //������С��װ�Ż�����Ʒ�IJ�Ʒ���кš����ϴ��롢���������Ų�ѯ������ʷ��¼��Ϣ
  2058. public ICSONWIPITEM QueryOnWIPItemWithmoCode(string mCard, string MItemCode, string moCode)
  2059. {
  2060. string sql = @" select * from ICSONWIPITEM
  2061. where where 1=1 and MCARD = '" + mCard + "'and MITEMCODE='" + MItemCode + "'and MOCODE='" + moCode + "'";
  2062. var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList();
  2063. if (objs == null || objs.Count < 1)
  2064. return null;
  2065. else
  2066. return (ICSONWIPITEM)objs[0];
  2067. }
  2068. //������С��װ�Ż�����Ʒ�IJ�Ʒ���кš���Ʒ���кš��¼����Ͳ���������ʷ��¼��Ϣ
  2069. public ICSONWIPITEM QueryOnWIPItem(string mCard, string rCardList, string actionType)
  2070. {
  2071. string sql = @"SELECT * FROM ICSONWIPITEM";
  2072. sql += "WHERE 1 = 1 ";
  2073. if (mCard.Trim().Length > 0)
  2074. {
  2075. sql += "AND MCARD = '" + mCard.Trim().ToUpper() + "' ";
  2076. }
  2077. if (actionType.Trim().Length > 0)
  2078. {
  2079. sql += "AND ACTIONTYPE = '" + actionType.Trim().ToUpper() + "' ";
  2080. }
  2081. if (rCardList.Trim().Length > 0)
  2082. {
  2083. sql += "AND RCARD IN " + rCardList.Trim().ToUpper() + " ";
  2084. }
  2085. sql += "ORDER BY MTIME desc";
  2086. var objs = this._domainDataProvider.ExecuteQuery<ICSONWIPITEM>(sql).ToList();
  2087. if (objs == null || objs.Count < 1)
  2088. return null;
  2089. else
  2090. return (ICSONWIPITEM)objs[0];
  2091. }
  2092. #endregion
  2093. #region ������ʽ�������������ط���
  2094. public Messages ParseFromBarcode(ref ICSMINNO newMINNO, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength)
  2095. {
  2096. return ParseFromBarcode(ref newMINNO, barcode, opBOMDetailForItemCode, opBOMDetailSNLength, true);
  2097. }
  2098. public Messages ParseFromBarcode(ref ICSMINNO newMINNO, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength, bool dealSecondSource)
  2099. {
  2100. Messages returnValue = new Messages();
  2101. string splitter = "-";
  2102. string itemCode = string.Empty;
  2103. string vendorCode = string.Empty;
  2104. string lotNo = string.Empty;
  2105. string productDate = string.Empty;
  2106. string pattern = @"^.+-.+-.+-.+[Rr]?$";
  2107. Regex reg = new Regex(pattern, RegexOptions.IgnoreCase);
  2108. Match match = reg.Match(barcode);
  2109. if (!match.Success)
  2110. {
  2111. //returnValue.Add(new Message(MessageType.Error, "$parse_barcode: $CS_Error_Format" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
  2112. return returnValue;
  2113. }
  2114. lotNo = barcode;
  2115. int pos = 0;
  2116. //Vendor Code
  2117. pos = barcode.IndexOf(splitter);
  2118. vendorCode = barcode.Substring(0, pos);
  2119. barcode = barcode.Substring(pos + 1);
  2120. //Item code
  2121. pos = barcode.IndexOf(splitter);
  2122. itemCode = barcode.Substring(0, pos);
  2123. barcode = barcode.Substring(pos + 1);
  2124. //Product date
  2125. pos = barcode.IndexOf(splitter);
  2126. productDate = barcode.Substring(0, pos);
  2127. barcode = barcode.Substring(pos + 1);
  2128. //Return
  2129. if (itemCode == string.Empty
  2130. || vendorCode == string.Empty
  2131. || lotNo == string.Empty
  2132. || productDate == string.Empty)
  2133. {
  2134. //returnValue.Add(new Message(MessageType.Error, "$parse_barcode: $CS_Error_LackOfInfo" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
  2135. return returnValue;
  2136. }
  2137. if (returnValue.IsSuccess())
  2138. {
  2139. //newMINNO.MItemCode = itemCode;
  2140. //newMINNO.VendorCode = vendorCode;
  2141. //newMINNO.LotNO = lotNo;
  2142. //newMINNO.DateCode = productDate;
  2143. returnValue.ClearMessages();
  2144. returnValue.Add(new Message(MessageType.Success, "$parse_barcode$CS_Error_ParseSuccess"));
  2145. }
  2146. return returnValue;
  2147. }
  2148. public Messages ParseFromPrepare(ref ICSMINNO newMINNO, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength)
  2149. {
  2150. return ParseFromPrepare(ref newMINNO, barcode, opBOMDetailForItemCode, opBOMDetailSNLength, true);
  2151. }
  2152. public Messages ParseFromPrepare(ref ICSMINNO newMINNO, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength, bool dealSecondSource)
  2153. {
  2154. Messages returnValue = new Messages();
  2155. /*
  2156. string sql = "select " + DomainObjectUtility.GetDomainObjectFieldsStringWithTableName(typeof(MKeyPart)) + " ";
  2157. sql += "from tblmkeypart, tblmkeypartdetail ";
  2158. sql += "where tblmkeypart.mitemcode = tblmkeypartdetail.mitemcode ";
  2159. sql += "and tblmkeypart.seq = tblmkeypartdetail.seq ";
  2160. sql += "and serialno = '" + barcode.Trim().ToUpper() + "' ";
  2161. object[] mKeyParts = this.DataProvider.CustomQuery(typeof(MKeyPart), new SQLCondition(sql));
  2162. if (mKeyParts == null)
  2163. {
  2164. returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_prepare: $CS_Error_NoPrepareInfo" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
  2165. return returnValue;
  2166. }
  2167. for (int i = 0; i < mKeyParts.Length; i++)
  2168. {
  2169. returnValue = new Messages();
  2170. string prepareMOCode = ((MKeyPart)mKeyParts[i]).MoCode == null ? "" : ((MKeyPart)mKeyParts[i]).MoCode.Trim().ToUpper();
  2171. string keyPartMOCode = newMINNO.MOCode == null ? "" : newMINNO.MOCode.Trim().ToUpper();
  2172. if (prepareMOCode.Length > 0 && prepareMOCode != keyPartMOCode)
  2173. {
  2174. if (i == mKeyParts.Length - 1)
  2175. {
  2176. returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_prepare: $CS_Error_MOLimited " + ((MKeyPart)mKeyParts[i]).MoCode.Trim().ToUpper() + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
  2177. return returnValue;
  2178. }
  2179. else
  2180. {
  2181. continue;
  2182. }
  2183. }
  2184. //�ȶ��Ϻź����кų���
  2185. returnValue.AddMessages(this.CheckAfterParse(((MKeyPart)mKeyParts[i]).MItemCode, opBOMDetailForItemCode, barcode, opBOMDetailSNLength, "$parse_prepare:", dealSecondSource));
  2186. if (!returnValue.IsSuccess())
  2187. {
  2188. if (i == mKeyParts.Length - 1)
  2189. {
  2190. return returnValue;
  2191. }
  2192. else
  2193. {
  2194. continue;
  2195. }
  2196. }
  2197. if (returnValue.IsSuccess())
  2198. {
  2199. newMINNO.MItemCode = ((MKeyPart)mKeyParts[i]).MItemCode;
  2200. newMINNO.VendorCode = ((MKeyPart)mKeyParts[i]).VendorCode;
  2201. newMINNO.LotNO = ((MKeyPart)mKeyParts[i]).LotNO;
  2202. newMINNO.DateCode = ((MKeyPart)mKeyParts[i]).DateCode;
  2203. newMINNO.VendorItemCode = ((MKeyPart)mKeyParts[i]).VendorItemCode;
  2204. newMINNO.Version = ((MKeyPart)mKeyParts[i]).Version;
  2205. newMINNO.PCBA = ((MKeyPart)mKeyParts[i]).PCBA;
  2206. newMINNO.BIOS = ((MKeyPart)mKeyParts[i]).BIOS;
  2207. returnValue.ClearMessages();
  2208. returnValue.Add(new UserControl.Message(MessageType.Success, "$parse_prepare$CS_Error_ParseSuccess"));
  2209. break;
  2210. }
  2211. }
  2212. * */
  2213. return returnValue;
  2214. }
  2215. public Messages ParseFromProduct(ref ICSMINNO newMINNO, bool checkComplete, string moCode, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength)
  2216. {
  2217. return ParseFromProduct(ref newMINNO, checkComplete, moCode, barcode, opBOMDetailForItemCode, opBOMDetailSNLength, true, false);
  2218. }
  2219. public Messages ParseFromProduct(ref ICSMINNO newMINNO, bool checkComplete, string moCode, string barcode, ICSOPBOMDETAIL opBOMDetailForItemCode, int opBOMDetailSNLength, bool dealSecondSource, bool isSKDCartonCheck)
  2220. {
  2221. Messages returnValue = new Messages();
  2222. /*
  2223. SimulationReport simRpt = GetSimulationReportNotInCurretMoCode(barcode, moCode);
  2224. if (simRpt == null)
  2225. {
  2226. returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_product: $CS_Error_NoSimulationReport" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
  2227. return returnValue;
  2228. }
  2229. if (!isSKDCartonCheck && simRpt.IsLoadedPart.Trim().Length > 0 && simRpt.IsLoadedPart.Trim() == FormatHelper.TRUE_STRING)
  2230. {
  2231. returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_product: $CS_Error_AlreadyLoaded" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
  2232. return returnValue;
  2233. }
  2234. if (checkComplete && simRpt.IsComplete == FormatHelper.FALSE_STRING)
  2235. {
  2236. returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_product: $CS_Error_NotComplete" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
  2237. return returnValue;
  2238. }
  2239. if (simRpt.Status != ProductStatus.GOOD
  2240. && simRpt.Status != ProductStatus.OffLine
  2241. && simRpt.Status != ProductStatus.OffMo
  2242. && simRpt.Status != ProductStatus.OutLine)
  2243. {
  2244. returnValue.Add(new UserControl.Message(MessageType.Error, "$parse_product: $CS_ProductStatusError" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
  2245. return returnValue;
  2246. }
  2247. //�ȶ��Ϻź����кų���
  2248. returnValue.AddMessages(this.CheckAfterParse(simRpt.ItemCode, opBOMDetailForItemCode, barcode, opBOMDetailSNLength, "$parse_product:", dealSecondSource));
  2249. if (!returnValue.IsSuccess())
  2250. {
  2251. return returnValue;
  2252. }
  2253. if (returnValue.IsSuccess())
  2254. {
  2255. newMINNO.MItemCode = simRpt.ItemCode;
  2256. //newMINNO.LotNO = simRpt.LOTNO;
  2257. returnValue.ClearMessages();
  2258. returnValue.Add(new UserControl.Message(MessageType.Success, "$parse_product$CS_Error_ParseSuccess"));
  2259. }
  2260. */
  2261. return returnValue;
  2262. }
  2263. private Messages CheckAfterParse(string inputItemCode, ICSOPBOMDETAIL opBOMDetail, string input, int opBOMDetailSNLength, string msgPrefix, bool dealSecondSource)
  2264. {
  2265. Messages returnValue = new Messages();
  2266. /*
  2267. //�Ϻűȶ�
  2268. if (opBOMDetail != null)
  2269. {
  2270. if (dealSecondSource)
  2271. {
  2272. string itemCode = opBOMDetail.ItemCode;
  2273. string opID = opBOMDetail.OPID;
  2274. string opBOMCode = opBOMDetail.OPBOMCode;
  2275. string opBOMVersion = opBOMDetail.OPBOMVersion;
  2276. string opBOMSourceItemcode = opBOMDetail.OPBOMSourceItemCode;
  2277. int orgID = GlobalVariables.CurrentOrganizations.First().OrganizationID;
  2278. OPBOMFacade opbomfacade = new OPBOMFacade(this.DataProvider);
  2279. object[] objs = opbomfacade.QueryOPBOMDetail(opID, itemCode, opBOMCode, opBOMVersion, orgID, inputItemCode);
  2280. if (objs != null)
  2281. {
  2282. if (((OPBOMDetail)objs[0]).OPBOMSourceItemCode.Trim().ToUpper() != opBOMSourceItemcode.Trim().ToUpper())
  2283. {
  2284. returnValue.Add(new UserControl.Message(MessageType.Error, msgPrefix + " $CS_LotControlMaterial_CompareItemFailed"));
  2285. return returnValue;
  2286. }
  2287. }
  2288. else
  2289. {
  2290. returnValue.Add(new UserControl.Message(MessageType.Error, msgPrefix + " $CS_LotControlMaterial_CompareItemFailed"));
  2291. return returnValue;
  2292. }
  2293. }
  2294. else
  2295. {
  2296. if (string.Compare(inputItemCode, opBOMDetail.OPBOMItemCode, true) != 0)
  2297. {
  2298. returnValue.Add(new UserControl.Message(MessageType.Error, msgPrefix + "$CS_LotControlMaterial_CompareItemFailed"));
  2299. return returnValue;
  2300. }
  2301. }
  2302. }
  2303. //�������кų���
  2304. if (opBOMDetailSNLength > 0)
  2305. {
  2306. if (input.Length != opBOMDetailSNLength)
  2307. {
  2308. returnValue.Add(new UserControl.Message(MessageType.Error, msgPrefix + " $Error_SNLength_Wrong"));
  2309. return returnValue;
  2310. }
  2311. }
  2312. *
  2313. * */
  2314. return returnValue;
  2315. }
  2316. //�������鹩Ӧ��
  2317. public Messages CheckNeedVebdor(ICSMINNO newMINNO)
  2318. {
  2319. Messages returnValue = new Messages();
  2320. //if (string.IsNullOrEmpty(newMINNO.VendorCode))
  2321. //{
  2322. // returnValue.Add(new UserControl.Message(MessageType.Error, "$CS_Material_Have_No_Vendor" + "[$CS_MItemCode:" + newMINNO.MItemCode.Trim() + "]"));
  2323. // return returnValue;
  2324. //}
  2325. return returnValue;
  2326. }
  2327. public bool KeyPartUsed(string keyPartRCard, string mItemCode, bool checkCache, ArrayList inputPartList)
  2328. {
  2329. if (checkCache)
  2330. {
  2331. //�����Ƿ�����ҳ���ϵģ����ǻ�û�б��浽���ݿ���
  2332. if (inputPartList != null)
  2333. {
  2334. foreach (ICSMINNO minno in inputPartList)
  2335. {
  2336. //if (minno.EATTRIBUTE1 == MCardType.MCardType_Keyparts
  2337. // && minno.MItemPackedNo.Trim().ToUpper() == keyPartRCard.Trim().ToUpper())
  2338. //{
  2339. // return true;
  2340. //}
  2341. }
  2342. }
  2343. }
  2344. //Check DB
  2345. //object[] onWIPItemList = QueryOnWIPItem(keyPartRCard, mItemCode);
  2346. //if (onWIPItemList != null)
  2347. //{
  2348. // foreach (ICSONWIPITEM onWIPItem in onWIPItemList)
  2349. // {
  2350. // if (onWIPItem.MCardType == MCardType.MCardType_Keyparts
  2351. // && onWIPItem.ActionType == (int)MaterialType.CollectMaterial)
  2352. // {
  2353. // return true;
  2354. // }
  2355. // }
  2356. //}
  2357. return false;
  2358. }
  2359. public Messages GetMINNOByBarcode(ICSOPBOMDETAIL opBOMDetail, string barcode, string moCode, ArrayList inputPartList, bool dealSecondSource, bool isSKDCartonCheck, string actionType, out ICSMINNO minno)
  2360. {
  2361. Messages returnValue = new Messages();
  2362. minno = null;
  2363. /*
  2364. //������ʽ
  2365. bool checkStatus = opBOMDetail.CheckStatus == BenQGuru.eMES.Web.Helper.FormatHelper.TRUE_STRING;
  2366. //��������
  2367. string checkTypeSetting = "," + opBOMDetail.OPBOMCheckType + ",";
  2368. int inputLength = opBOMDetail.SerialNoLength;
  2369. string checkNeedVendor = !string.IsNullOrEmpty(opBOMDetail.NeedVendor) ? checkNeedVendor = opBOMDetail.NeedVendor : string.Empty;
  2370. string mItemCode = opBOMDetail.OPBOMItemCode;
  2371. MaterialFacade materialFacade = new MaterialFacade(this.DataProvider);
  2372. ICSMINNO newMINNO = materialFacade.CreateNewMINNO();
  2373. newMINNO.MITEMCODE = mItemCode;
  2374. newMINNO.LOTNO = string.Empty;
  2375. DateTime dbDateTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString());
  2376. object obj = GetSimulationNotInCurretMoCode(barcode, moCode);
  2377. if (obj != null && ((ICSSimulation)obj).IsComplete != "1")
  2378. {
  2379. returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("{0} $CS_ERROR_MATERIAL_NOT_COMPLETE", barcode)));
  2380. return returnValue;
  2381. }
  2382. Material.InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider);
  2383. ItemFacade itemfacade = new ItemFacade(this.DataProvider);
  2384. object objItemLot = inventoryFacade.QueryLastItemLotByLotNo(barcode);
  2385. if (objItemLot == null)
  2386. {
  2387. objItemLot = inventoryFacade.QueryItemLotByBarCode(barcode);
  2388. if (objItemLot != null)
  2389. {
  2390. newMINNO.MITEMCODE = ((ICSITEMLot)objItemLot).MCODE.ToString();
  2391. newMINNO.LOTNO = ((ICSITEMLot)objItemLot).LotNO.ToString();
  2392. newMINNO.DATECODE = ((ICSITEMLot)objItemLot).PRODUCTDATE.ToString();
  2393. newMINNO.VENDORCODE = ((ICSITEMLot)objItemLot).VENDORCODE;
  2394. newMINNO.VENDORITEMCODE = ((ICSITEMLot)objItemLot).VENDORITEMCODE;
  2395. }
  2396. }
  2397. else
  2398. {
  2399. newMINNO.MITEMCODE = ((ICSITEMLot)objItemLot).MCODE.ToString();
  2400. newMINNO.LOTNO = ((ICSITEMLot)objItemLot).LotNO.ToString();
  2401. newMINNO.DATECODE = ((ICSITEMLot)objItemLot).PRODUCTDATE.ToString();
  2402. newMINNO.VENDORCODE = ((ICSITEMLot)objItemLot).VENDORCODE;
  2403. newMINNO.VENDORITEMCODE = ((ICSITEMLot)objItemLot).VENDORITEMCODE;
  2404. }
  2405. //�Ϻűȶ�
  2406. if (checkTypeSetting.IndexOf(OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower()) >= 0)
  2407. {
  2408. Messages messsages = ParseFromProduct(ref newMINNO, true, moCode, barcode, opBOMDetail, inputLength, dealSecondSource, false);
  2409. if (!messsages.IsSuccess())
  2410. {
  2411. if (objItemLot == null)
  2412. {
  2413. returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("$CS_Error_ItemLot_Dif")));
  2414. return returnValue;
  2415. }
  2416. else
  2417. {
  2418. //for��λ����֧��������
  2419. if (string.Compare(((ICSITEMLot)objItemLot).Mcode, ICSOPBOMDETAIL.OPBOMItemCode, true) != 0 && actionType != "LotPart0")
  2420. {
  2421. returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("$CS_Error_Mcode_DIF")));
  2422. return returnValue;
  2423. }
  2424. }
  2425. }
  2426. //for��λ����֧��������
  2427. if (actionType == "LotPart" || actionType == "LotPart0")
  2428. {
  2429. returnValue.AddMessages(MDSManager(newMINNO.LotNO, opBOMDetail.MaintainUser));
  2430. if (!returnValue.IsSuccess())
  2431. {
  2432. return returnValue;
  2433. }
  2434. }
  2435. }
  2436. newMINNO.MITEMCODE = moCode;
  2437. newMINNO.OPBOMCODE = opBOMDetail.OBCODE;
  2438. newMINNO.OPBOMVER = opBOMDetail.OPBOMVER;
  2439. newMINNO.OPCODE = opBOMDetail.OPCODE;
  2440. newMINNO.MaintainTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString());
  2441. if (obj != null)
  2442. {
  2443. newMINNO.ITEMCODE = ((ICSSimulation)obj).ITEMCODE;
  2444. newMINNO.ROUTECODE = ((ICSSimulation)obj).ROUTECODE;
  2445. newMINNO.RESCODE = ((ICSSimulation)obj).RESCODE;
  2446. }
  2447. //����VendorCodeΪ�գ���tblmaterial�л�ȡ
  2448. if (newMINNO.VENDORCODE == null || newMINNO.VENDORCODE.Trim().Length <= 0)
  2449. {
  2450. object objMaterial = itemfacade.GetMaterial(newMINNO.MITEMCODE.Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID);
  2451. if (objMaterial != null)
  2452. {
  2453. newMINNO.VENDORCODE = ((Domain.MOModel.Material)objMaterial).VendorCode;
  2454. }
  2455. }
  2456. //Check if key part was used
  2457. if (!isSKDCartonCheck && opBOMDetail.OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_KEYPARTS
  2458. && KeyPartUsed(barcode, newMINNO.MItemCode, true, inputPartList))
  2459. {
  2460. returnValue.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ParseFailed $CS_Error_KeyPartUsed:" + barcode));
  2461. return returnValue;
  2462. }
  2463. //���кų��ȱȶ�
  2464. if (opBOMDetail.OBPARSETYPE.Trim().Length <= 0)
  2465. {
  2466. if (inputLength > 0 && barcode.Trim().Length != inputLength)
  2467. {
  2468. returnValue.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ParseFailed $Error_SNLength_Wrong"));
  2469. return returnValue;
  2470. }
  2471. }
  2472. //check NeedVendor
  2473. if (!isSKDCartonCheck && checkNeedVendor == NeedVendor.NeedVendor_Y)
  2474. {
  2475. Messages checkNeedVendorMsg = new Messages();
  2476. checkNeedVendorMsg = CheckNeedVebdor(newMINNO);
  2477. if (!checkNeedVendorMsg.IsSuccess())
  2478. {
  2479. returnValue.AddMessages(checkNeedVendorMsg);
  2480. return returnValue;
  2481. }
  2482. }
  2483. if (string.IsNullOrEmpty(newMINNO.MITEMCODE))
  2484. {
  2485. newMINNO.MItemCode = mItemCode;
  2486. }
  2487. newMINNO.MItemPackedNo = barcode;
  2488. if (opBOMDetail.OBITEMCONTYPE == BOMItemControlType.ITEM_CONTROL_KEYPARTS)
  2489. {
  2490. newMINNO.EAttribute1 = MCardType.MCardType_Keyparts;
  2491. }
  2492. else if (opBOMDetail.OBITEMCONTYPE == BOMItemControlType.ITEM_CONTROL_LOT)
  2493. {
  2494. newMINNO.EATTRIBUTE1 = MCardType.MCardType_INNO;
  2495. newMINNO.QTY = opBOMDetail.OBITEMQTY;
  2496. }
  2497. minno = newMINNO;
  2498. */
  2499. return returnValue;
  2500. }
  2501. public Messages GetMINNOByBarcode(ICSOPBOMDETAIL opBOMDetail, ICSMINNO oldminno, string moCode, ArrayList inputPartList, bool dealSecondSource, bool isSKDCartonCheck, string actionType, out ICSMINNO minno)
  2502. {
  2503. Messages returnValue = new Messages();
  2504. minno = null;
  2505. /*
  2506. //������ʽ
  2507. bool checkStatus = opBOMDetail.CHECKSTATUS == BenQGuru.eMES.Web.Helper.FormatHelper.TRUE_STRING;
  2508. //��������
  2509. string checkTypeSetting = "," + opBOMDetail.OPBOMCheckType + ",";
  2510. int inputLength = opBOMDetail.SerialNoLength;
  2511. string checkNeedVendor = !string.IsNullOrEmpty(opBOMDetail.NeedVendor) ? checkNeedVendor = opBOMDetail.NeedVendor : string.Empty;
  2512. string mItemCode = opBOMDetail.OPBOMItemCode;
  2513. MaterialFacade materialFacade = new MaterialFacade(this.DataProvider);
  2514. ICSMINNO newMINNO = materialFacade.CreateNewMINNO();
  2515. newMINNO.MITEMCODE = mItemCode;
  2516. newMINNO.LOTNO = string.Empty;
  2517. DateTime dbDateTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString());
  2518. object obj = GetSimulationNotInCurretMoCode(oldminno.MItemPackedNo, moCode);
  2519. if (obj != null && ((ICSSimulation)obj).IsComplete != "1")
  2520. {
  2521. returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("{0} $CS_ERROR_MATERIAL_NOT_COMPLETE", oldminno.MItemPackedNo)));
  2522. return returnValue;
  2523. }
  2524. Material.InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider);
  2525. ItemFacade itemfacade = new ItemFacade(this.DataProvider);
  2526. object objItemLot = inventoryFacade.QueryLastItemLotByLotNo(oldminno.MItemPackedNo);
  2527. if (objItemLot == null)
  2528. {
  2529. objItemLot = inventoryFacade.QueryItemLotByBarCode(oldminno.MItemPackedNo);
  2530. if (objItemLot != null)
  2531. {
  2532. newMINNO.LOTNO = ((ICSITEMLot)objItemLot).LotNO.ToString();
  2533. newMINNO.DATECODE = ((ICSITEMLot)objItemLot).PRODUCTDATE.ToString();
  2534. newMINNO.VENDORCODE = ((ICSITEMLot)objItemLot).VENDORCODE;
  2535. newMINNO.VENDORITEMCODE = ((ICSITEMLot)objItemLot).VENDORITEMCODE;
  2536. }
  2537. }
  2538. else
  2539. {
  2540. newMINNO.LOTNO = ((ICSITEMLot)objItemLot).LotNO.ToString();
  2541. newMINNO.DATECODE = ((ICSITEMLot)objItemLot).PRODUCTDATE.ToString();
  2542. newMINNO.VENDORCODE = ((ICSITEMLot)objItemLot).VENDORCODE;
  2543. newMINNO.VENDORITEMCODE = ((ICSITEMLot)objItemLot).VENDORITEMCODE;
  2544. }
  2545. //�Ϻűȶ�
  2546. if (checkTypeSetting.IndexOf(OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower()) >= 0)
  2547. {
  2548. Messages messsages = ParseFromProduct(ref newMINNO, true, moCode, oldminno.MItemPackedNo, opBOMDetail, inputLength, dealSecondSource, false);
  2549. if (!messsages.IsSuccess())
  2550. {
  2551. if (objItemLot == null)
  2552. {
  2553. returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("$CS_Error_ItemLot_Dif")));
  2554. return returnValue;
  2555. }
  2556. else
  2557. {
  2558. //for��λ����֧��������
  2559. if (string.Compare(((ICSITEMLot)objItemLot).Mcode, opBOMDetail.OPBOMItemCode, true) != 0 && actionType != "LotPart0")
  2560. {
  2561. returnValue.Add(new UserControl.Message(MessageType.Error, string.Format("$CS_Error_Mcode_DIF")));
  2562. return returnValue;
  2563. }
  2564. }
  2565. }
  2566. //��λ����֧��������
  2567. if (actionType == "LotPart" || actionType == "LotPart0")
  2568. {
  2569. if (oldminno.Nextlotno != null && oldminno.Nextlotno.Trim() != "")
  2570. {
  2571. returnValue.AddMessages(MDSManager(oldminno.Nextlotno, opBOMDetail.MaintainUser));
  2572. }
  2573. else
  2574. {
  2575. returnValue.AddMessages(MDSManager(oldminno.LotNO, opBOMDetail.MaintainUser));
  2576. }
  2577. if (!returnValue.IsSuccess())
  2578. {
  2579. return returnValue;
  2580. }
  2581. }
  2582. }
  2583. newMINNO.MOCODE = moCode;
  2584. newMINNO.OPBOMCODE = opBOMDetail.OBCODE;
  2585. newMINNO.OPBOMVER = opBOMDetail.OPBOMVER;
  2586. newMINNO.OPCODE = opBOMDetail.OPCODE;
  2587. newMINNO.MaintainTime = Convert.ToDateTime(AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString());
  2588. if (obj != null)
  2589. {
  2590. newMINNO.ITEMCODE = ((ICSSimulation)obj).ITEMCODE;
  2591. newMINNO.ROUTECODE = ((ICSSimulation)obj).ROUTECODE;
  2592. newMINNO.RESCODE = ((ICSSimulation)obj).RESCODE;
  2593. }
  2594. //����VendorCodeΪ�գ���tblmaterial�л�ȡ
  2595. if (newMINNO.VENDORCODE == null || newMINNO.VENDORCODE.Trim().Length <= 0)
  2596. {
  2597. object objMaterial = itemfacade.GetMaterial(newMINNO.MItemCode.Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID);
  2598. if (objMaterial != null)
  2599. {
  2600. newMINNO.VENDORCODE = ((Domain.MOModel.Material)objMaterial).VendorCode;
  2601. }
  2602. }
  2603. //Check if key part was used
  2604. if (!isSKDCartonCheck && opBOMDetail.OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_KEYPARTS
  2605. && KeyPartUsed(oldminno.LotNO, newMINNO.MItemCode, true, inputPartList))
  2606. {
  2607. returnValue.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ParseFailed $CS_Error_KeyPartUsed:" + oldminno.LotNO));
  2608. return returnValue;
  2609. }
  2610. //���кų��ȱȶ�
  2611. if (opBOMDetail.OPBOMParseType.Trim().Length <= 0)
  2612. {
  2613. if (inputLength > 0 && oldminno.LotNO.Trim().Length != inputLength)
  2614. {
  2615. returnValue.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ParseFailed $Error_SNLength_Wrong"));
  2616. return returnValue;
  2617. }
  2618. }
  2619. //check NeedVendor
  2620. if (!isSKDCartonCheck && checkNeedVendor == NeedVendor.NeedVendor_Y)
  2621. {
  2622. Messages checkNeedVendorMsg = new Messages();
  2623. checkNeedVendorMsg = CheckNeedVebdor(newMINNO);
  2624. if (!checkNeedVendorMsg.IsSuccess())
  2625. {
  2626. returnValue.AddMessages(checkNeedVendorMsg);
  2627. return returnValue;
  2628. }
  2629. }
  2630. if (string.IsNullOrEmpty(newMINNO.MItemCode))
  2631. {
  2632. newMINNO.MITEMCODE = mItemCode;
  2633. }
  2634. newMINNO.MITEMPACKEDNO = oldminno.LOTNO;
  2635. if (opBOMDetail.OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_KEYPARTS)
  2636. {
  2637. newMINNO.EATTRIBUTE1 = MCardType.MCardType_Keyparts;
  2638. }
  2639. else if (opBOMDetail.OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_LOT)
  2640. {
  2641. newMINNO.EATTRIBUTE1 = MCardType.MCardType_INNO;
  2642. newMINNO.QTY = opBOMDetail.OBITEMQTY;
  2643. }
  2644. minno = newMINNO;
  2645. */
  2646. return returnValue;
  2647. }
  2648. #endregion
  2649. #region MESEntityList
  2650. public ICSMESEntityList CreateNewMESEntityList()
  2651. {
  2652. return new ICSMESEntityList();
  2653. }
  2654. public void AddMESEntityList(ICSMESEntityList mesEntityList)
  2655. {
  2656. this.DataProvider.ICSMESEntityList.InsertOnSubmit(mesEntityList);
  2657. }
  2658. public void DeleteMESEntityList(ICSMESEntityList mesEntityList)
  2659. {
  2660. this.DataProvider.ICSMESEntityList.DeleteOnSubmit(mesEntityList);
  2661. }
  2662. public object GetMESEntityList(int serial)
  2663. {
  2664. return this.DataProvider.ICSMESEntityList.SingleOrDefault( a => a.serial== serial );
  2665. }
  2666. private int GetMESEntityListSerial(ICSMESEntityList mesEntityList)
  2667. {
  2668. if (mesEntityList == null)
  2669. {
  2670. return -1;
  2671. }
  2672. string sql = "SELECT * FROM ICSMESEntityList WHERE 1 = 1 ";
  2673. sql += string.Format(" AND workpoint = '{0}' ", mesEntityList.WorkPoint);
  2674. sql += string.Format(" AND faccode = '{0}' ", mesEntityList.FACCODE);
  2675. sql += string.Format(" AND segcode = '{0}' ", mesEntityList.SEGCODE);
  2676. sql += string.Format(" AND sscode = '{0}' ", mesEntityList.SSCODE);
  2677. sql += string.Format(" AND rescode = '{0}' ", mesEntityList.RESCODE);
  2678. sql += string.Format(" AND opcode = '{0}' ", mesEntityList.OPCODE);
  2679. sql += string.Format(" AND modelcode = '{0}' ", mesEntityList.MODELCODE);
  2680. sql += string.Format(" AND shifttypecode = '{0}' ", mesEntityList.SHIFTTYPECODE);
  2681. sql += string.Format(" AND shiftcode = '{0}' ", mesEntityList.SHIFTCODE);
  2682. sql += string.Format(" AND tpcode = '{0}' ", mesEntityList.TPCODE);
  2683. var objs = this._domainDataProvider.ExecuteQuery<ICSMESEntityList>(sql).ToList();
  2684. if (objs == null || objs.Count < 1)
  2685. return -1;
  2686. else
  2687. return ((ICSMESEntityList)objs[0]).serial;
  2688. }
  2689. public int GetMESEntityListSerial(ICSSimulationReport simulationReport)
  2690. {
  2691. if (simulationReport == null)
  2692. {
  2693. return -1;
  2694. }
  2695. ICSBaseModel baseModelFacade = new ICSBaseModel(this.DataProvider);
  2696. ICSMESEntityList mesEntityList = new ICSMESEntityList();
  2697. ICSSS stepSequence = (ICSSS)baseModelFacade.GetStepSequence(simulationReport.SSCODE);
  2698. ICSSEG segment = (ICSSEG)baseModelFacade.GetSegment(simulationReport.SEGCODE);
  2699. if (segment != null)
  2700. {
  2701. ICSFACTORY factory = this.DataProvider.ICSFACTORY.SingleOrDefault(a => a.ID == segment.FACID);
  2702. mesEntityList.FACCODE = factory.FACCODE;
  2703. }
  2704. mesEntityList.BIGSSCODE = "";
  2705. mesEntityList.SEGCODE = simulationReport.SEGCODE;
  2706. mesEntityList.SSCODE = simulationReport.SSCODE;
  2707. mesEntityList.RESCODE = simulationReport.RESCODE;
  2708. mesEntityList.OPCODE = simulationReport.OPCODE;
  2709. mesEntityList.MODELCODE = simulationReport.MODELCODE;
  2710. mesEntityList.SHIFTTYPECODE = simulationReport.SHIFTTYPECODE;
  2711. mesEntityList.SHIFTCODE = simulationReport.SHIFTCODE;
  2712. mesEntityList.TPCODE = simulationReport.TPCODE;
  2713. mesEntityList.WorkPoint = simulationReport.WorkPoint;
  2714. //�ֲ�ѯ���Ƿ����ڣ������ڵĻ�������һ��
  2715. int returnValue = GetMESEntityListSerial(mesEntityList);
  2716. if (returnValue <= 0)
  2717. {
  2718. AddMESEntityList(mesEntityList);
  2719. returnValue = GetMESEntityListSerial(mesEntityList);
  2720. }
  2721. return returnValue;
  2722. }
  2723. #endregion
  2724. private bool CheckIsComAndNotInStorage(string rcard, string moCode)
  2725. {
  2726. ICSSimulation sim = this.GetLastSimulation(rcard, moCode) as ICSSimulation;
  2727. if (sim != null)
  2728. {
  2729. if (sim.ISCOM == "1" && sim.PRODUCTSTATUS == "GOOD")
  2730. {
  2731. //�ж�δ������
  2732. object[] objOnWip = null;// this.QueryOnWIP(sim.RCARD, sim.MOCODE, sim.OPCODE, "GOOD");
  2733. if (objOnWip == null || objOnWip.Length <= 1)
  2734. {
  2735. return true;
  2736. }
  2737. }
  2738. }
  2739. return false;
  2740. }
  2741. public Messages CheckReworkRcardIsScarp(string rcard, string resCode)
  2742. {
  2743. Messages msg = new Messages();
  2744. ICSBaseModel baseModelFacade = new ICSBaseModel(this.DataProvider);
  2745. ICSRES resource = (ICSRES)baseModelFacade.GetResource(resCode);
  2746. ICSSimulationReport simulationReport = (ICSSimulationReport)this.GetLastSimulationReport(rcard);
  2747. if (resource != null && simulationReport != null
  2748. && simulationReport.PRODUCTSTATUS == ProductStatus.Scrap)
  2749. {
  2750. msg.Add(new Message(MessageType.Error, "$CS_Rcard_IS_Scrap_Can_Not_Rework"));
  2751. }
  2752. return msg;
  2753. }
  2754. }
  2755. [Serializable]
  2756. //����״̬
  2757. public class MOManufactureStatus
  2758. {
  2759. private ArrayList _list = new ArrayList();
  2760. public MOManufactureStatus()
  2761. {
  2762. this._list.Add(MOManufactureStatus.MOSTATUS_INITIAL);
  2763. this._list.Add(MOManufactureStatus.MOSTATUS_RELEASE);
  2764. this._list.Add(MOManufactureStatus.MOSTATUS_OPEN);
  2765. this._list.Add(MOManufactureStatus.MOSTATUS_CLOSE);
  2766. this._list.Add(MOManufactureStatus.MOSTATUS_PENDING);
  2767. }
  2768. public const string MOSTATUS_INITIAL = "mostatus_initial"; //��ʼ
  2769. public const string MOSTATUS_RELEASE = "�·�";//"mostatus_release"; //�·�
  2770. public const string MOSTATUS_OPEN = "������";//"mostatus_open"; //������
  2771. public const string MOSTATUS_CLOSE = "mostatus_close"; //�ص�
  2772. public const string MOSTATUS_PENDING = "mostatus_pending"; //��ͣ
  2773. #region IInternalSystemVariable ��Ա
  2774. public string Group
  2775. {
  2776. get
  2777. {
  2778. return "MOManufactureStatus";
  2779. }
  2780. }
  2781. public ArrayList Items
  2782. {
  2783. get
  2784. {
  2785. return this._list;
  2786. }
  2787. }
  2788. #endregion
  2789. }
  2790. [Serializable]
  2791. public class ONWIPItemQueryObject
  2792. {
  2793. public string MItemCode;
  2794. }
  2795. [Serializable]
  2796. public class ONWIPItemObject
  2797. {
  2798. public string RunningCard;
  2799. public string RunningCardSequence;
  2800. public string MCARD;
  2801. public string MCardType;
  2802. public string OPCODE;
  2803. }
  2804. }