/// <summary> /// RCard Burn Out /// </summary> /// <returns></returns> private Messages RunBurnOut(string rcard, string shelfpk) { if (Resource == null) { BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider); Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode); } Messages messages = new Messages(); try { messages = GetProduct(rcard); if (messages.IsSuccess()) { product = (ProductInfo)messages.GetData().Values[0]; actionCheckStatus = new ActionCheckStatus(); actionCheckStatus.ProductInfo = product; if (actionCheckStatus.ProductInfo != null) { actionCheckStatus.ProductInfo.Resource = Resource; } IAction dataCollectModule = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_BurnOutGood); ActionEventArgs actionEventArgs = new ActionEventArgs( ActionType.DataCollectAction_BurnOutGood, rcard, ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, shelfpk, product); messages.AddMessages(((IActionWithStatus)dataCollectModule).Execute( actionEventArgs, actionCheckStatus)); } if (messages.IsSuccess()) { messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_BurnOutSUCCESS,$CS_Param_ID:{0}", rcard))); } return(messages); } catch (Exception e) { messages.Add(new UserControl.Message(e)); return(messages); } }
/// <summary> /// GOOD指令采集 /// </summary> /// <returns></returns> private Messages RunGood(ActionCheckStatus actionCheckStatus, string actionType) { Messages messages = new Messages(); //Add By Bernard @ 2010-11-03 DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(this.txtRunningCard.Value.Trim().ToUpper(), string.Empty); //end IAction dataCollectModule = new ActionFactory(this.DataProvider).CreateAction(actionType); messages.AddMessages(((IActionWithStatus)dataCollectModule).Execute(new ActionEventArgs(actionType, sourceRCard.Trim(), userCode, ApplicationService.Current().ResourceCode, product), actionCheckStatus)); if (messages.IsSuccess()) { messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS,$CS_Param_ID: {0}", txtRunningCard.Value.Trim()))); } return(messages); }
/// <summary> /// NG指令采集 /// </summary> /// <returns></returns> private Messages RunNG(ActionCheckStatus actionCheckStatus, string actionType) { Messages messages = new Messages(); //Add By Bernard @ 2010-11-03 DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(this.txtRunningCard.Value.Trim().ToUpper(), string.Empty); //end object[] ErrorCodes = GetSelectedErrorCodes();//取不良代码组+不良代码 if (ErrorCodes == null || ErrorCodes.Length == 0) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Burn_ErrorCode_Not_Maintain")); } IAction dataCollectModule = new ActionFactory(this.DataProvider).CreateAction(actionType); if (messages.IsSuccess()) { messages.AddMessages(((IActionWithStatus)dataCollectModule).Execute( new TSActionEventArgs(actionType, sourceRCard.Trim(), userCode, ApplicationService.Current().ResourceCode, product, ErrorCodes, null, txtMem.Value), actionCheckStatus)); } if (messages.IsSuccess()) { iNG = iNG + 1; messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_NGSUCCESS,$CS_Param_ID: {0}", txtRunningCard.Value.Trim()))); } return(messages); }
// Added end public override Messages Action(object act) { Messages msg = new Messages(); ActionOnLineHelper _helper = null; BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null; if (act == null) { return(msg); } DataCollect.Action.ActionEventArgs args; if (ObjectState == null) { args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs(); args.RunningCard = act.ToString().ToUpper().Trim(); } else { args = ObjectState as DataCollect.Action.ActionEventArgs; } string data = act.ToString().ToUpper().Trim(); //Laws Lu,2006/06/03 添加 获取已有连接 if ((act as IDCTClient).DBConnection != null) { domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider; } else { domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider() as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider; (act as IDCTClient).DBConnection = domainProvider; } DataCollectFacade dataCollect = new DataCollect.DataCollectFacade(domainProvider); TSFacade tsFacade = new TSFacade(domainProvider); if (msg.IsSuccess()) { MO moWillGo = (MO)keypartsHT["MOWillGo"]; ProductInfo product = (ProductInfo)keypartsHT["ProdcutInfo"]; if (opBomDetailCount > opBomDetailCollectNum) { try { object[] opBomDetailCompare = new object[opBomDetailList.Count]; opBomDetailList.CopyTo(opBomDetailCompare); string ItemCode = string.Empty; string parseTypeSetting = "," + ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).OPBOMParseType + ","; string checkTypeSetting = "," + ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).OPBOMCheckType + ","; bool checkStatus = ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).CheckStatus == BenQGuru.eMES.Web.Helper.FormatHelper.TRUE_STRING; string CheckNeedVendor = string.Empty; if (!string.IsNullOrEmpty(((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).NeedVendor)) { CheckNeedVendor = ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).NeedVendor; } string MItemCode = ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).OPBOMItemCode; string OBSItemCode = ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).OPBOMSourceItemCode; int inputLength = ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).SerialNoLength; MaterialFacade facade = new MaterialFacade(domainProvider); MINNO newMINNO = facade.CreateNewMINNO(); newMINNO.MItemCode = MItemCode; Messages parseSuccess = new Messages(); Messages oldParseSuccess = new Messages(); parseSuccess.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ParseFailed:")); int num = 0; //勾选了料号比对,必须选择解析方式 if (checkTypeSetting.IndexOf("," + OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower() + ",") >= 0) { if (parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_BARCODE.ToLower() + ",") < 0 && parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_PREPARE.ToLower() + ",") < 0 && parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_PRODUCT.ToLower() + ",") < 0) { msg.Add(new UserControl.Message(MessageType.Error, " $CS_Error_ParseFailed:$CheckCompareItem_Must_CheckOneParse")); goto Label2; } } //Parse from barcode if (!parseSuccess.IsSuccess() && parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_BARCODE.ToLower() + ",") >= 0) { OPBOMDetail opBOMDetailForItemCode = null; if (checkTypeSetting.IndexOf("," + OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower() + ",") >= 0) { opBOMDetailForItemCode = (OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]; } oldParseSuccess.AddMessages(parseSuccess); parseSuccess = dataCollect.ParseFromBarcode(ref newMINNO, data, opBOMDetailForItemCode, inputLength); num += 1; } //Parse from prepare if (!parseSuccess.IsSuccess() && parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_PREPARE.ToLower() + ",") >= 0) { Simulation sim = (Simulation)dataCollect.GetSimulation(ID); newMINNO.MOCode = sim.MOCode; OPBOMDetail opBOMDetailForItemCode = null; if (checkTypeSetting.IndexOf("," + OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower() + ",") >= 0) { opBOMDetailForItemCode = (OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]; } oldParseSuccess.AddMessages(parseSuccess); parseSuccess = dataCollect.ParseFromPrepare(ref newMINNO, data, opBOMDetailForItemCode, inputLength); num += 1; } //Parse from product if (!parseSuccess.IsSuccess() && parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_PRODUCT.ToLower() + ",") >= 0) { OPBOMDetail opBOMDetailForItemCode = null; if (checkTypeSetting.IndexOf("," + OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower() + ",") >= 0) { opBOMDetailForItemCode = (OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]; } oldParseSuccess.AddMessages(parseSuccess); parseSuccess = dataCollect.ParseFromProduct(ref newMINNO, checkStatus, data, opBOMDetailForItemCode, inputLength); num += 1; } if (!parseSuccess.IsSuccess()) { if (num > 0) { oldParseSuccess.AddMessages(parseSuccess); msg.AddMessages(oldParseSuccess); goto Label2; } if (num == 0) { if (inputLength > 0 && data.Trim().Length != inputLength) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_SNLength_Wrong")); goto Label2; } } } //检查新上料是否在TS中而不可用 if (!tsFacade.RunningCardCanBeClollected(data, CardType.CardType_Part)) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTSOrScrapped $SERIAL_NO=" + data)); goto Label2; } #region Check if key part was used if (((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_KEYPARTS && KeyPartUsed(domainProvider, data, newMINNO.MItemCode, true)) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_Error_KeyPartUsed")); goto Label2; } #endregion #region check NeedVendor //如果VendorCode为空,到tblmaterial中获取 if (newMINNO.VendorCode == null || newMINNO.VendorCode.Trim().Length <= 0) { ItemFacade itemfacade = new ItemFacade(domainProvider); object objMaterial = itemfacade.GetMaterial(newMINNO.MItemCode.Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID); if (objMaterial != null) { newMINNO.VendorCode = ((BenQGuru.eMES.Domain.MOModel.Material)objMaterial).VendorCode; } } if (CheckNeedVendor == NeedVendor.NeedVendor_Y) { Messages checkNeedVendor = new Messages(); checkNeedVendor = dataCollect.CheckNeedVebdor(newMINNO); if (!checkNeedVendor.IsSuccess()) { msg.AddMessages(checkNeedVendor); goto Label2; } } #endregion if (checkTypeSetting.IndexOf("," + OPBOMDetailCheckType.CHECK_LINKBARCODE.ToLower() + ",") >= 0) { //Link barcode if (string.IsNullOrEmpty(newMINNO.MItemCode)) { newMINNO.MItemCode = MItemCode; } newMINNO.MItemPackedNo = data; if (((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_KEYPARTS) { newMINNO.EAttribute1 = MCardType.MCardType_Keyparts; } else if (((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_LOT) { newMINNO.EAttribute1 = MCardType.MCardType_INNO; newMINNO.Qty = ((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMItemQty; } opBomdetailRealCollectList.Add((object)newMINNO); } ++opBomDetailCollectNum; Label2: if (opBomDetailCount > opBomDetailCollectNum) { if (((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMItemControlType != null && ((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_LOT) { msg.Add(new UserControl.Message(MessageType.Normal, ">>$DCT_PLEASE_INPUT_Lot:" + ((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMSourceItemCode)); ProcessBeforeReturn(this.Status, msg); return(msg); } else { msg.Add(new UserControl.Message(MessageType.Normal, ">>$CS_PleaseInputKeypart:" + ((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMSourceItemCode)); ProcessBeforeReturn(this.Status, msg); return(msg); } } } catch (Exception ex) { msg.Add(new UserControl.Message(MessageType.Error, ex.Message)); } } domainProvider.BeginTransaction(); try { BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider); Resource resource = (Resource)dataModel.GetResource(args.ResourceCode); _helper = new ActionOnLineHelper(domainProvider); ActionCheckStatus actionCheckStatus = new ActionCheckStatus(); actionCheckStatus.ProductInfo = product; actionCheckStatus.ProductInfo.Resource = resource; ExtendSimulation lastSimulation = actionCheckStatus.ProductInfo.LastSimulation; BenQGuru.eMES.Material.WarehouseFacade wfacade = null; if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { wfacade = new WarehouseFacade(domainProvider); } IDCTClient client = act as IDCTClient; //检查新上料是否在TS中而不可用 if (opBomdetailRealCollectList != null) { foreach (MINNO minno in opBomdetailRealCollectList) { if (!tsFacade.RunningCardCanBeClollected(minno.MItemPackedNo, CardType.CardType_Part)) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTSOrScrapped $SERIAL_NO=" + minno.MItemPackedNo)); break; } } } #region Check if key part was used if (opBomdetailRealCollectList != null) { foreach (MINNO minno in opBomdetailRealCollectList) { if (minno.EAttribute1 == MCardType.MCardType_Keyparts) { if (KeyPartUsed(domainProvider, minno.MItemPackedNo, minno.MItemCode, false)) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_Error_KeyPartUsed")); break; } } } } #endregion if (msg.IsSuccess()) { object[] objOpBomdetailRealCollect = new object[opBomdetailRealCollectList.Count]; opBomdetailRealCollectList.CopyTo(objOpBomdetailRealCollect); string strRCard = product.NowSimulation.RunningCard; msg.AddMessages(_helper.ActionWithTransaction( new CINNOActionEventArgs( ActionType.DataCollectAction_CollectINNO, strRCard, client.LoginedUser, client.ResourceCode, product, string.Empty, wfacade), actionCheckStatus, objOpBomdetailRealCollect)); } #region 物料过账 if (msg.IsSuccess()) { BaseModelFacade bMfacade = new BaseModelFacade(domainProvider); object objOP = bMfacade.GetOperationByResource(client.ResourceCode); string strRCard = product.NowSimulation.RunningCard; object[] objOpBomdetailRealCollect = new object[opBomdetailRealCollectList.Count]; opBomdetailRealCollectList.CopyTo(objOpBomdetailRealCollect); if (opBomdetailRealCollectList != null && opBomdetailRealCollectList.Count > 0) { Messages messagesNew = new Messages(); string ItemCode = string.Empty; DataCollectFacade dataCollectFacade = new DataCollectFacade(domainProvider); object objectSimulation = dataCollectFacade.GetSimulation(strRCard); if (objectSimulation != null) { ItemCode = ((Simulation)objectSimulation).ItemCode; } foreach (MINNO minno in opBomdetailRealCollectList) { messagesNew.AddMessages(_helper.ActionWithTransaction(new TryEventArgs( ActionType.DataCollectAction_TryNew, client.LoginedUser, ((Operation2Resource)objOP).OPCode, client.ResourceCode, ItemCode, strRCard, minno.MItemCode, minno.MItemPackedNo, string.Empty, true, true))); } msg.AddMessages(messagesNew); } } #endregion if (msg.IsSuccess()) { if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { if (wfacade != null) { wfacade.ExecCacheSQL(); } } #region 增加良品采集 { Resource Resource = (Resource)dataModel.GetResource(client.ResourceCode); Messages messages1 = new Messages(); if (actionCheckStatus.ProductInfo == null) { messages1 = _helper.GetIDInfo(ID); actionCheckStatus.ProductInfo = (ProductInfo)messages1.GetData().Values[0]; actionCheckStatus.ProductInfo.Resource = Resource; lastSimulation = actionCheckStatus.ProductInfo.LastSimulation; msg.AddMessages(messages1); } else //将上一个Action的NowSimulation设置为本Action的LastSimulation { if (actionCheckStatus.ActionList.Count > 0) { actionCheckStatus.ProductInfo = new ProductInfo(); actionCheckStatus.ProductInfo.NowSimulation = new Simulation(); actionCheckStatus.ProductInfo.Resource = Resource; //actionCheckStatus.ProductInfo.LastSimulation = // new ExtendSimulation(((ActionEventArgs)actionCheckStatus.ActionList[actionCheckStatus.ActionList.Count - 1]).ProductInfo.NowSimulation); actionCheckStatus.ProductInfo.LastSimulation = new ExtendSimulation((Simulation)(new DataCollectFacade(domainProvider)).GetLastSimulationOrderByDateAndTime(ID)); } } product = actionCheckStatus.ProductInfo; // Changed end if (msg.IsSuccess()) { messages1.AddMessages(_helper.ActionWithTransaction(new ActionEventArgs(ActionType.DataCollectAction_GOOD, ID, client.LoginedUser, client.ResourceCode, product), actionCheckStatus)); } } #endregion } if (msg.IsSuccess()) { domainProvider.CommitTransaction(); msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_CollectSuccess"))); } else { domainProvider.RollbackTransaction(); } } catch (Exception ex) { domainProvider.RollbackTransaction(); msg.Add(new UserControl.Message(ex)); } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection(); } } if (msg.IsSuccess()) { base.Action(act); this.ObjectState = null; this.keypartsHT = null; this.opBomDetailList.Clear(); this.opBomDetailCount = 0; this.opBomDetailCollectNum = 0; this.opBomdetailRealCollectList.Clear(); ID = string.Empty; } ProcessBeforeReturn(this.Status, msg); return(msg); }
// Added end public override Messages Action(object act) { Messages msg = new Messages(); ActionOnLineHelper _helper = null; BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null; if (act == null) { return(msg); } DataCollect.Action.ActionEventArgs args; if (ObjectState == null) { args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs(); args.RunningCard = act.ToString().ToUpper().Trim(); } else { args = ObjectState as DataCollect.Action.ActionEventArgs; } string data = act.ToString().ToUpper().Trim(); //Keyparts //Laws Lu,2006/06/03 添加 获取已有连接 if ((act as IDCTClient).DBConnection != null) { domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider; } else { domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider() as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider; (act as IDCTClient).DBConnection = domainProvider; } msg = CheckData(data, domainProvider); if (keypartsHT == null) { // 按照逻辑,走到这个分支应该是错误的 string strFile = @"C:\DCT_EmptyMessage.txt"; string strLine = DateTime.Now.ToString("yyyy-MM-dd HH:mi:ss") + "\t" + "ActionCollectKeyParts" + "\t" + "Missing Product In Action, RunningCard:" + args.RunningCard + ",Input:" + data; System.IO.StreamWriter writer = new System.IO.StreamWriter(strFile, true); writer.WriteLine(strLine); writer.Close(); // if (msg.IsSuccess() && (keypartsHT == null || keypartsHT.ContainsKey("ProdcutInfo") == false)) { //检查序列号 _helper = new ActionOnLineHelper(domainProvider); msg = _helper.GetIDInfo(args.RunningCard); // Added by Icyer 2006/12/14 // 检查序列号 ProductInfo product = (ProductInfo)msg.GetData().Values[0]; if (product == null || product.LastSimulation == null) { msg.ClearMessages(); msg.Add(new Message(MessageType.Error, "$NoSimulation")); } // base.Action (act); // ActionCollectKeyparts actionCollectKeyparts = this; // this.NextAction = actionCollectKeyparts; // this.Status = ActionStatus.PrepareData; // return msg; // Added end } if (msg.IsSuccess() && (keypartsHT == null || keypartsHT.ContainsKey("KeypartsInfo") == false)) { try { keypartsHT = new Hashtable(); keypartsHT.Add("ProdcutInfo", msg); ProductInfo product = (ProductInfo)msg.GetData().Values[0]; /* Removed by Icyer 2006/12/14 * 如果序列号已在本上料工序,则GetMORouteNextOperation会取下一个工序,导致找不到OPBOM * 改变推导OPBOM的逻辑 * ItemFacade itemFacade = new ItemFacade(domainProvider); * object op = itemFacade.GetMORouteNextOperation( * product.LastSimulation.MOCode, * product.LastSimulation.RouteCode, * product.LastSimulation.OPCode); * * OPBOMFacade opBOMFacade=new OPBOMFacade( domainProvider); * object[] objBomDetail = opBOMFacade.GetOPBOMDetails( * product.LastSimulation.MOCode, * product.LastSimulation.RouteCode, * (op as ItemRoute2OP).OPCode); */ // Added by Icyer 2006/12/14 IDCTClient client = act as IDCTClient; OPBOMFacade opBOMFacade = new OPBOMFacade(domainProvider); object[] objBomDetail = null; DataCollect.ActionOnLineHelper onLine = new ActionOnLineHelper(domainProvider); Messages messages1 = onLine.CheckID( new CKeypartsActionEventArgs( ActionType.DataCollectAction_CollectKeyParts, product.LastSimulation.RunningCard, client.LoginedUser, client.ResourceCode, product, null, null)); if (messages1.IsSuccess() == true) { objBomDetail = opBOMFacade.GetOPBOMDetails( product.NowSimulation.MOCode, product.NowSimulation.RouteCode, product.NowSimulation.OPCode); } else { throw new Exception(messages1.OutPut()); } // Added end MOFacade moFacade = new MOFacade(domainProvider); object mo = moFacade.GetMO(product.LastSimulation.MOCode); OPBomKeyparts opBomKeyparts = new OPBomKeyparts(objBomDetail, Convert.ToInt32(((MO)mo).IDMergeRule), domainProvider); if (opBomKeyparts.Count == 0) { /* Removed by Icyer 2006/12/27 @ YHI * msg.Add(new Message(MessageType.Error, "$CS_NOOPBomInfo $CS_Param_MOCode="+product.LastSimulation.MOCode +" $CS_Param_RouteCode="+product.LastSimulation.RouteCode +" $CS_Param_OPCode ="+product.LastSimulation.OPCode)); * throw new Exception(msg.OutPut()); */ throw new Exception("$CS_NOOPBomInfo"); } else { //opBomKeyparts.AddKeyparts(data, product.LastSimulation.MOCode); // Removed by Icyer 2006/12/14 keypartsHT.Add("KeypartsInfo", opBomKeyparts); } } catch (Exception ex) { /* Removed by Icyer 2006/12/27 @ YHI * keypartsHT = null; * this.NeedCancel = true; * throw ex; */ // Added by Icyer 2006/12/27 @ YHI base.Action(act); ActionCollectKeyparts actionCollectKeyparts = this; this.NextAction = actionCollectKeyparts; this.Status = ActionStatus.PrepareData; msg.ClearMessages(); msg.Add(new UserControl.Message(MessageType.Error, ex.Message)); msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts")); return(msg); // Added end } } } if (msg.IsSuccess()) { OPBomKeyparts opBomKeyparts = (OPBomKeyparts)keypartsHT["KeypartsInfo"]; msg = keypartsHT["ProdcutInfo"] as Messages; MO moWillGo = (MO)keypartsHT["MOWillGo"]; ProductInfo product = (ProductInfo)msg.GetData().Values[0]; Messages msgResult = new Messages(); if (opBomKeyparts.Count > opBomKeyparts.GetbomKeypartCount()) { try { //opBomKeyparts.AddKeyparts(data, product.LastSimulation.MOCode); if (moWillGo == null) { msgResult.AddMessages(opBomKeyparts.AddKeyparts(data, product.LastSimulation.MOCode)); } else { msgResult.AddMessages(opBomKeyparts.AddKeyparts(data, moWillGo.MOCode)); } } catch (Exception ex) { msgResult.Add(new UserControl.Message(MessageType.Error, ex.Message)); } keypartsHT["KeypartsInfo"] = opBomKeyparts; } if (msgResult.IsSuccess() == false || opBomKeyparts.Count > opBomKeyparts.GetbomKeypartCount()) { base.Action(act); ActionCollectKeyparts actionCollectKeyparts = this; this.NextAction = actionCollectKeyparts; this.Status = ActionStatus.PrepareData; this.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts " + (opBomKeyparts.GetbomKeypartCount() + 1).ToString() + "/" + opBomKeyparts.Count.ToString()); if (msgResult.IsSuccess() == false) { //msgResult.Add(new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts")); return(msgResult); } else { return(msg); } } //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection(); domainProvider.BeginTransaction(); try { BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider); Resource resource = (Resource)dataModel.GetResource(args.ResourceCode); _helper = new ActionOnLineHelper(domainProvider); DataCollectFacade dataCollect = new DataCollect.DataCollectFacade(domainProvider); ActionCheckStatus actionCheckStatus = new ActionCheckStatus(); actionCheckStatus.ProductInfo = product; actionCheckStatus.ProductInfo.Resource = resource; ExtendSimulation lastSimulation = actionCheckStatus.ProductInfo.LastSimulation; BenQGuru.eMES.Material.WarehouseFacade wfacade = null; if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { wfacade = new WarehouseFacade(domainProvider); } IDCTClient client = act as IDCTClient; msg.AddMessages(_helper.ActionWithTransaction( new CKeypartsActionEventArgs( ActionType.DataCollectAction_CollectKeyParts, product.NowSimulation.RunningCard, client.LoginedUser, client.ResourceCode, product, opBomKeyparts, wfacade), actionCheckStatus)); // Added by Icyer 2006/12/28 @ YHI 采集集成上料 bool bLoadedINNO = false; if (this.NeedCollectINNO == true && msg.IsSuccess() == true) { string strRCard = product.NowSimulation.RunningCard; UserControl.Messages msgProduct = _helper.GetIDInfo(strRCard); product = (ProductInfo)msgProduct.GetData().Values[0]; CINNOActionEventArgs argsInno = new CINNOActionEventArgs( ActionType.DataCollectAction_CollectINNO, strRCard, client.LoginedUser, client.ResourceCode, product, INNOCode, wfacade ); IAction action = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_CollectINNO); msg.AddMessages(action.Execute(argsInno)); if (msg.IsSuccess() == true) { bLoadedINNO = true; msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_INNO_CollectSuccess[" + this.INNOCode + "] $CS_Keyparts_CollectSuccess"))); } } // Added end if (msg.IsSuccess()) { if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { if (wfacade != null) { wfacade.ExecCacheSQL(); } } domainProvider.CommitTransaction(); if (bLoadedINNO == false) { msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_Keyparts_CollectSuccess"))); } } else { domainProvider.RollbackTransaction(); } } catch (Exception ex) { domainProvider.RollbackTransaction(); msg.Add(new UserControl.Message(ex)); } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection(); } base.Action(act); ActionRCard actRcard1 = new ActionRCard(); actRcard1.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"); this.NextAction = actRcard1; this.ObjectState = null; this.keypartsHT = null; this.Status = ActionStatus.PrepareData; return(msg); } base.Action(act); //Web.Helper.ActionType acttype = new Web.Helper.ActionType(); // if(acttype.Items.Contains(args.RunningCard)) // { // (act as IDCTClient).CachedAction = null; // } ActionRCard actRcard = new ActionRCard(); actRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"); this.NextAction = actRcard; // Added by Icyer 2006/12/14 this.ObjectState = null; this.keypartsHT = null; this.Status = ActionStatus.PrepareData; // Added end return(msg); }
/// <summary> /// 工单归属采集 /// </summary> /// <returns></returns> private Messages RunGOMO(ActionCheckStatus actionCheckStatus) { Messages messages = new Messages(); //Add By Bernard @ 2010-11-03 DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(txtRunningCard.Value.Trim().ToUpper(), string.Empty); //end //Laws Lu,新建数据采集Action ActionOnLineHelper onLine = new ActionOnLineHelper(this.DataProvider); //IAction dataCollectModule = (new ActionFactory(this.DataProvider)).CreateAction(ActionType.DataCollectAction_GoMO); //Laws Lu,2005/09/14,新增 工单不能为空 if (txtGOMO.Checked == true && txtGOMO.Value.Trim() != String.Empty) { actionCheckStatus.ProductInfo = product; //产品序列号长度检查 if (bRCardLenULE.Checked && bRCardLenULE.Value.Trim() != string.Empty) { int len = 0; try { len = int.Parse(bRCardLenULE.Value.Trim()); if (txtRunningCard.Value.Trim().Length != len) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Length_FLetter_NotCompare $CS_Param_ID:" + txtRunningCard.Value.Trim())); } } catch { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Length_FLetter_NotCompare $CS_Param_ID:" + txtRunningCard.Value.Trim())); } } //产品序列号首字符串检查 if (bRCardLetterULE.Checked && bRCardLetterULE.Value.Trim() != string.Empty) { int index = -1; if (bRCardLetterULE.Value.Trim().Length <= txtRunningCard.Value.Trim().Length) { index = txtRunningCard.Value.IndexOf(bRCardLetterULE.Value.Trim()); } if (index == -1) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_FLetter_NotCompare $CS_Param_ID:" + txtRunningCard.Value.Trim())); } } //add by hiro 08/11/05 检查序列号内容为字母,数字和空格 string pattern = @"^([A-Za-z0-9]+[ ]*)*[A-Za-z0-9]+$"; string rcard = this.txtRunningCard.Value.Trim().ToString(); Regex rex = new Regex(pattern, RegexOptions.IgnoreCase); Match match = rex.Match(rcard); ItemFacade itemfacade = new ItemFacade(this.DataProvider); object obj = itemfacade.GetItem2SNCheck(this.txtItem.Value.Trim().ToString(), ItemCheckType.ItemCheckType_SERIAL); if (obj != null) { if (((Item2SNCheck)obj).SNContentCheck == SNContentCheckStatus.SNContentCheckStatus_Need) { if (!match.Success) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_SNContent_CheckWrong $CS_Param_RunSeq:" + this.txtRunningCard.Value.Trim().ToString())); } } } //end by hiro //Laws Lu,参数定义 GoToMOActionEventArgs args = new GoToMOActionEventArgs(ActionType.DataCollectAction_GoMO, sourceRCard.Trim(), ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, product, txtGOMO.Value); //actionCheckStatus.NeedUpdateSimulation = false; //Laws Lu,执行工单采集并收集返回信息 if (messages.IsSuccess()) { messages.AddMessages(onLine.Action(args, actionCheckStatus)); } } if (messages.IsSuccess()) { messages.Add(new UserControl.Message(MessageType.Success, "$CS_GOMOSUCCESS $CS_Param_ID:" + this.txtRunningCard.Value.Trim().ToString())); txtRunningCard.TextFocus(false, true); } return(messages); }
private void CheckAndRunOnWip() { if (txtRunningCard.Value.Trim() == string.Empty) { if (!this.txtGOMO.Checked) { txtMO.Value = String.Empty; txtItem.Value = String.Empty; labelItemDescription.Text = ""; } ApplicationRun.GetInfoForm().AddEx("$CS_Please_Input_RunningCard"); //将焦点移到产品序列号输入框 txtRunningCard.TextFocus(false, true); return; } else { DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); BurnFacade burnFacade = new BurnFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceCard = dataCollectFacade.GetSourceCard(this.txtRunningCard.Value.Trim().ToUpper(), string.Empty); if (this.txtGOMO.Checked && this.txtGOMO.Value.Trim().Length == 0) { ApplicationRun.GetInfoForm().AddEx("$CS_CMPleaseInputMO"); this.txtGOMO.Checked = true; this.txtGOMO.TextFocus(false, true); return; } if (this.txtGOMO.Checked && this.txtGOMO.InnerTextBox.Enabled) { ApplicationRun.GetInfoForm().AddEx("$CS_PleasePressEnterOnGOMO"); this.txtGOMO.Checked = true; this.txtGOMO.TextFocus(false, true); return; } // End Added //Add by sandy on 20140528 if (rdoBurnIn.Checked && rdoNG.Checked) { UserControl.Message message = new UserControl.Message(MessageType.Error, "$CS_BurnIn_Can_Not_NG"); ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ": " + this.txtRunningCard.Value, message, true); txtRunningCard.TextFocus(false, true); return; } //end if (txtRunningCard.Value.Trim().ToUpper() == ng_collect) { rdoNG.Checked = true; rdoBurnOut.Checked = true; txtRunningCard.TextFocus(false, true); return; } //Jarvis 20130125 支持GOOD指令 if (txtRunningCard.Value.Trim().ToUpper() == good_collect) { rdoGood.Checked = true; txtRunningCard.TextFocus(false, true); return; } //Add by sandy on 20140528 if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnIn) { rdoGood.Checked = true; rdoBurnIn.Checked = true; txtRunningCard.TextFocus(false, true); return; } if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnOutGood) { rdoGood.Checked = true; rdoBurnOut.Checked = true; txtRunningCard.TextFocus(false, true); return; } if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnOutNG) { rdoNG.Checked = true; rdoBurnOut.Checked = true; txtRunningCard.TextFocus(false, true); return; } //End //add by hiro.chen 08/11/18 TocheckIsDown Messages msg = new Messages(); msg.AddMessages(dataCollectFacade.CheckISDown(sourceCard.Trim().ToUpper())); if (!msg.IsSuccess()) { ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ":" + this.txtRunningCard.Value, msg, true); txtRunningCard.TextFocus(false, true); return; } //end //报废不能返工 msg.AddMessages(dataCollectFacade.CheckReworkRcardIsScarp(sourceCard.Trim().ToUpper(), ApplicationService.Current().ResourceCode)); if (!msg.IsSuccess()) { ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ":" + this.txtRunningCard.Value, msg, true); txtRunningCard.TextFocus(false, true); return; } //end //Laws Lu,2005/10/19,新增 缓解性能问题 //Laws Lu,2006/12/25 修改 减少Open/Close的次数 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false; ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection(); //Laws Lu,2005/08/16,修改 把msg换成globeMSG globeMSG = CheckProduct(); // Added by Icyer 2005/10/28 if (Resource == null) { BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider); Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode); } actionCheckStatus = new ActionCheckStatus(); actionCheckStatus.ProductInfo = product; if (actionCheckStatus.ProductInfo != null) { actionCheckStatus.ProductInfo.Resource = Resource; } string strMoCode = String.Empty; if (product != null && product.LastSimulation != null) { strMoCode = product.LastSimulation.MOCode; } if (strMoCode != String.Empty) { if (listActionCheckStatus.ContainsKey(strMoCode)) { actionCheckStatus = (ActionCheckStatus)listActionCheckStatus[strMoCode]; actionCheckStatus.ProductInfo = product; actionCheckStatus.ActionList = new ArrayList(); } else { listActionCheckStatus.Add(strMoCode, actionCheckStatus); } } //Amoi,Laws Lu,2005/08/02,修改 if (txtGOMO.Checked == true) { globeMSG.AddMessages(RunGOMO(actionCheckStatus)); if (!globeMSG.IsSuccess()) { listActionCheckStatus.Clear(); } } else { if (product != null && product.LastSimulation != null) { this.txtMO.Value = product.LastSimulation.MOCode; this.txtItem.Value = product.LastSimulation.ItemCode; this.labelItemDescription.Text = this.GetItemDescription(product.LastSimulation.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); } else { this.txtMO.Value = ""; this.txtItem.Value = ""; this.labelItemDescription.Text = ""; } } //EndAmoi //老化进和老化出工序不能同时勾选 BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); object objOP = baseModelFacade.GetOperationByResource(ApplicationService.Current().ResourceCode); if (product != null && product.LastSimulation != null && objOP != null) { object objOp = itemFacade.GetItemRoute2Operation(this.txtItem.Value, product.LastSimulation.RouteCode, ((Operation2Resource)objOP).OPCode); if (objOp != null) { opControl = ((ItemRoute2OP)objOp).OPControl; if (opControl[(int)OperationList.BurnIn] == isSelected && opControl[(int)OperationList.BurnOut] == isSelected) { globeMSG.Add(new UserControl.Message(MessageType.Error, "$CS_BurnInOut_Can_Not_Choose_Together")); } } } //老化未达到预计时间且不是强制老化时不可做老化出良品采集 if (!isForce && globeMSG.IsSuccess() && rdoBurnOut.Checked && rdoGood.Checked && product.LastSimulation != null) { object objBurnWip = burnFacade.GetBurnWip(sourceCard.Trim().ToUpper(), product.LastSimulation.MOCode); BurnWip burnWip = objBurnWip as BurnWip; if (objBurnWip != null && burnWip.Status == BurnType.BurnIn) { DateTime dtForecast = FormatHelper.ToDateTime(burnWip.ForecastOutDate, burnWip.ForecastOutTime); if (dbDateTime.DateTime < dtForecast) { globeMSG.Add(new UserControl.Message(MessageType.Error, "$CS_Burn_Time_Not_Enough")); } } } if (globeMSG.IsSuccess()) { this.RunOnWip(); } } //刷新grid this.BindGrid(); //Laws Lu,2005/10/19,新增 缓解性能问题 //Laws Lu,2006/12/25 修改 减少Open/Close的次数 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true; //将焦点移到产品序列号输入框 ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ": " + this.txtRunningCard.Value, globeMSG, true); //Application.DoEvents(); txtRunningCard.TextFocus(false, true); globeMSG.ClearMessages(); }
private void ucBtnOK_Click(object sender, System.EventArgs e) { if (this.ucLEMOCode.Value.Trim() == string.Empty) { this.ucMessage.Add(">>$CS_Please_Input_MOCode"); ucLEMOCode.TextFocus(false, true); return; } if (this.ucLERunningCard.Value.Trim() == string.Empty) { this.ucMessage.Add(">>$CS_Please_Input_RunningCard"); return; } if (this._moCode == string.Empty) { if (!this.displayMOInfo()) { return; } } string runningCard = this.ucLERunningCard.Value.Trim().ToUpper(); this.ucMessage.Add("<< " + runningCard); Messages messages = this._helper.GetIDInfo(runningCard); if (messages.IsSuccess()) { ProductInfo product = (ProductInfo)messages.GetData().Values[0]; // Added by Icyer 2005/10/28 if (Resource == null) { BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider); Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode); } // Added end ActionCheckStatus actionCheckStatus = new ActionCheckStatus(); if (listActionCheckStatus.ContainsKey(_moCode)) { actionCheckStatus = (ActionCheckStatus)listActionCheckStatus[_moCode]; actionCheckStatus.ProductInfo = null; actionCheckStatus.ActionList = new ArrayList(); } else { listActionCheckStatus.Add(_moCode, actionCheckStatus); } GoToMOActionEventArgs args = new GoToMOActionEventArgs( ActionType.DataCollectAction_GoMO, runningCard, ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, product, this._moCode); IAction action = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_GoMO); //Laws Lu,2005/10/19,新增 缓解性能问题 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection(); DataProvider.BeginTransaction(); try { messages.AddMessages(((IActionWithStatus)action).Execute(args, actionCheckStatus)); if (messages.IsSuccess()) { this.DataProvider.CommitTransaction(); messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOMO_CollectSuccess $MOCode={0}", this._moCode))); actionCheckStatus.MO.MOInputQty += actionCheckStatus.MO.IDMergeRule; this.displayMOInfo(); } else { this.DataProvider.RollbackTransaction(); } } catch (Exception ex) { this.DataProvider.RollbackTransaction(); messages.Add(new UserControl.Message(ex)); } finally { //Laws Lu,2005/10/19,新增 缓解性能问题 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); } } this.ucMessage.Add(messages); this.ucMessage.Add(">>$CS_Please_Input_RunningCard"); this.ucLERunningCard.Value = ""; this.ucLERunningCard.TextFocus(false, true); }
public override Messages Action(object act) { Messages msg = new Messages(); BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null; if (act == null) { return(msg); } IDCTClient client = act as IDCTClient; if (currentProductInfo == null) { return(msg); } DataCollect.Action.ActionEventArgs args; if (ObjectState == null) { args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs(); } else { args = ObjectState as DataCollect.Action.ActionEventArgs; } string data = act.ToString().ToUpper().Trim(); //Errorcode //Laws Lu,2006/06/03 添加 获取已有连接 if ((act as IDCTClient).DBConnection != null) { domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider; } else { domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider() as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider; (act as IDCTClient).DBConnection = domainProvider; } if (string.Compare(data, BaseDCTDriver.FINERROR, true) != 0) //结束的标志 { msg = CheckData(data, domainProvider); if (msg.IsSuccess()) { if (_currInputStep.StepType == InputStepType.ErrorCode) //一次完整的ErrorCode 与 Error Location的输入完成 { if (errorCodesHT == null) { errorCodesHT = new Hashtable(); } string key = _currInputStep.ErrorCode + "&" + _currInputStep.ErrorLoc; bool bExist = false; if (!errorCodesHT.ContainsKey(key)) { errorCodesHT.Add(key, key); } else { bExist = true; } if (bExist == false) { //msg.Add(new UserControl.Message(MessageType.Succes,data)); // Removed by Icyer 2007/01/09 避免重复输出 } else { msg.Add(new UserControl.Message(MessageType.Success, "$ErrorCodeCollected")); } this.Status = ActionStatus.PrepareData; return(msg); } else { this.Status = ActionStatus.PrepareData; return(msg); } } else { this.Status = ActionStatus.PrepareData; return(msg); } } if (msg.IsSuccess()) { //检查序列号 ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider); msg = _helper.GetIDInfo(args.RunningCard); if (msg.IsSuccess()) { ProductInfo product = (ProductInfo)msg.GetData().Values[0]; TSModelFacade tsmodelFacade = new TSModelFacade(domainProvider); if (errorCodesHT == null) { msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$ErrorCode_Not_Exist")); } if (msg.IsSuccess()) { #region 得到用户输入的 Error Code和Error Location BenQGuru.eMES.Domain.TS.TSErrorCode2Location[] errorInfo = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location[errorCodesHT.Count]; TSModel.TSModelFacade tsFacade = new TSModelFacade(domainProvider); int i = 0; foreach (DictionaryEntry dic in errorCodesHT) { string[] keys = dic.Key.ToString().Split('&'); if (keys.Length > 1) { //没有Location if (keys[1].Contains(NoLoc)) { object[] objs = tsFacade.GetErrorCodeGroupByErrorCodeCode(keys[0]); errorInfo[i] = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location(); if (objs != null && objs.Length > 0) { ErrorCodeGroupA errorgroup = (ErrorCodeGroupA)objs[0]; errorInfo[i].ErrorCode = keys[0]; errorInfo[i].ErrorCodeGroup = errorgroup.ErrorCodeGroup; errorInfo[i].ErrorLocation = string.Empty; errorInfo[i].AB = ItemLocationSide.ItemLocationSide_AB; } } else //有location { object[] objs = tsFacade.GetErrorCodeGroupByErrorCodeCode(keys[0]); errorInfo[i] = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location(); if (objs != null && objs.Length > 0) { ErrorCodeGroupA errorgroup = (ErrorCodeGroupA)objs[0]; errorInfo[i].ErrorCode = keys[0]; errorInfo[i].ErrorCodeGroup = errorgroup.ErrorCodeGroup; errorInfo[i].ErrorLocation = keys[1]; errorInfo[i].AB = ItemLocationSide.ItemLocationSide_AB; } } } else //没有Location { object[] objs = tsFacade.GetErrorCodeGroupByErrorCodeCode(keys[0]); errorInfo[i] = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location(); if (objs != null && objs.Length > 0) { ErrorCodeGroupA errorgroup = (ErrorCodeGroupA)objs[0]; errorInfo[i].ErrorCode = keys[0]; errorInfo[i].ErrorCodeGroup = errorgroup.ErrorCodeGroup; errorInfo[i].ErrorLocation = string.Empty; errorInfo[i].AB = ItemLocationSide.ItemLocationSide_AB; } } i++; } #endregion /* * string[] errorcs = new string[errorCodesHT.Count]; * int i=0; * foreach( DictionaryEntry dic in errorCodesHT ) * { * errorcs[i] = dic.Key.ToString(); * i++; * } * */ /* Removed by Icyer 2007/03/15 允许自动归属工单 * //Laws Lu,2006/06/22 modify fix the bug that system alert object not set an instance when the product.LastSimulation is null * if(product.LastSimulation == null) * { * msg.Add(new UserControl.Message(UserControl.MessageType.Error,"$NoSimulation")); * } */ /* * object[] errorcodes = null; * if(msg.IsSuccess()) * { * //errorcodes = tsmodelFacade.QueryECG2ECByECAndModelCode(errorcs, product.LastSimulation.ModelCode); * string strModelCode = this.GetModelCodeFromProduct(product, this.moWillGo, domainProvider); * if (strModelCode != "") * { * errorcodes = tsmodelFacade.QueryECG2ECByECAndModelCode(errorcs, strModelCode); * } * * if( errorcodes==null || errorcodes.Length==0 ) * { * msg.Add(new UserControl.Message(UserControl.MessageType.Error,"$ErrorCode_Not_BelongTo_ModelCode")); * base.Action (act); * ActionCollectSMTNG actionCollectNG = this; * actionCollectNG.IsTopAction = false; * this.NextAction = actionCollectNG; * this.Status = ActionStatus.PrepareData; * return msg; * } * } */ if (msg.IsSuccess()) { IAction dataCollectModule = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_NG); //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection(); domainProvider.BeginTransaction(); try { //IDCTClient client = act as IDCTClient; ActionCheckStatus actionCheckStatus = new ActionCheckStatus(); msg.AddMessages(((IActionWithStatus)dataCollectModule).Execute( new TSActionEventArgs(ActionType.DataCollectAction_SMTNG, args.RunningCard, client.LoginedUser, client.ResourceCode, product, errorInfo, ""), actionCheckStatus)); if (msg.IsSuccess()) { domainProvider.CommitTransaction(); msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_NGSUCCESS"))); } else { domainProvider.RollbackTransaction(); } } catch (Exception ex) { domainProvider.RollbackTransaction(); msg.Add(new UserControl.Message(ex)); } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection(); } } } } } //if((act as IDCTClient).CachedAction is ActionCollectSMTNG) //{ // if(this.Status == BenQGuru.eMES.Common.DCT.Core.ActionStatus.Working) // { // this.ObjectState = null; // if(this.errorCodesHT != null) // { // this.errorCodesHT.Clear(); // } // } // this.Status = BenQGuru.eMES.Common.DCT.Core.ActionStatus.PrepareData; // (act as IDCTClient).CachedAction = this; //} if (this.errorCodesHT == null) { msg.ClearMessages(); } if (msg.IsSuccess() || this.errorCodesHT == null) { base.Action(act); } else { msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN")); this.Status = ActionStatus.PrepareData; this.FlowDirect = FlowDirect.WaitingInput; } currentProductInfo = null; moWillGo = null; this.ObjectState = null; if (this.errorCodesHT != null) { this.errorCodesHT.Clear(); } return(msg); }