public string INNOCode = string.Empty; // 继承上料号 public override Messages PreAction(object act) { // Added by Icyer 2006/12/14 // 输入产品序列号是检查 DataCollect.Action.ActionEventArgs args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs(); if (this.ObjectState != null) { args = (DataCollect.Action.ActionEventArgs) this.ObjectState; } else { args.RunningCard = act.ToString().ToUpper(); } if (this.keypartsHT == null) { Messages msgCheck = CheckProduct(act, args.RunningCard); if (msgCheck.IsSuccess() == false) { /* * msgCheck.Add(new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard")); * keypartsHT = null; * this.NeedCancel = true; * this.ObjectState = null; * base.PreAction (act); * * ActionCollectKeyparts actionCollectKeyparts = new ActionCollectKeyparts(); * actionCollectKeyparts.NeedCollectINNO = this.NeedCollectINNO; * actionCollectKeyparts.INNOCode = this.INNOCode; * this.NextAction = actionCollectKeyparts; * this.ObjectState = null; * this.keypartsHT = null; * this.Status = ActionStatus.PrepareData; */ 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(msgCheck); } } this.ObjectState = args; // Added end base.PreAction(act); Messages msg = new Messages(); msg.Add(this.OutMesssage); return(msg); }
public DSC19DCTDriver GetDriver(int clientId) { DSC19DCTDriver driver = (DSC19DCTDriver)listDriver[clientId]; if (driver == null) { driver = new DSC19DCTDriver(); driver.IsRootDriver = false; DSC19Client c1 = new DSC19Client(client.ClientAddress, client.ClientPort); c1.ClientID = clientId; c1.ClientStatus = DSC19ClientStatus.Connecting; driver.client = c1; driver.ClientID = clientId; ((DSC19Client)client).TerminalConnect(driver); listDriver.Add(clientId, driver); // Added by Icyer 2006/12/29 @ YHI 设置切换指令时的Action BenQGuru.eMES.Common.DCT.Action.ActionRCard arCard = new BenQGuru.eMES.Common.DCT.Action.ActionRCard(); arCard.Status = ActionStatus.Working; driver.defaultDCTAction = arCard; // Added end } return(driver); }
// 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); }
public override Messages Action(object act) { Messages msg = new Messages(); 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; } //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 (msg.IsSuccess()) { //检查序列号 ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider); msg = _helper.GetIDInfo(args.RunningCard); if (msg.IsSuccess()) { ProductInfo product = (ProductInfo)msg.GetData().Values[0]; if (product.LastSimulation == null) { msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$NoSimulation")); } object[] oplist = null; if (msg.IsSuccess()) { oplist = GetOutLineOP(domainProvider, (act as IDCTClient).ResourceCode); if (oplist == null || oplist.Length == 0) { msg.Add(new UserControl.Message(MessageType.Error, "$CSError_Res_Cannot_Collect_OUtlineGood")); } } string opcode = string.Empty; if (msg.IsSuccess()) { opcode = (oplist[0] as Operation).OPCode; if (CheckOutlineOPInRoute(domainProvider, product.LastSimulation.RouteCode, opcode)) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_OutLineOP_In_ThisRoute")); } } if (msg.IsSuccess()) { if (IsLastOP(domainProvider, product.LastSimulation.MOCode, product.LastSimulation.RouteCode, product.LastSimulation.OPCode)) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_Op_IsLast_OutLineOP_Cannot_Collect")); } } if (msg.IsSuccess()) { //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()).PersistBroker.OpenConnection(); domainProvider.BeginTransaction(); try { IDCTClient client = act as IDCTClient; IAction dataCollectModule = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_OutLineGood); msg.AddMessages((dataCollectModule).Execute(new OutLineActionEventArgs( ActionType.DataCollectAction_OutLineGood, args.RunningCard, client.LoginedUser, client.ResourceCode, product, opcode))); if (msg.IsSuccess()) { domainProvider.CommitTransaction(); msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS"))); } 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); // // Web.Helper.ActionType acttype = new Web.Helper.ActionType(); // if(acttype.Items.Contains(args.RunningCard)) // { // (act as IDCTClient).CachedAction = null; // } // ActionRCard actRcard = new ActionRCard(); this.NextAction = actRcard; return(msg); }
public override Messages Action(object act) { Messages msg = new Messages(); 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(); } 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; } msg = CheckData(data, domainProvider); if (msg.IsSuccess()) { //关键逻辑,将ActionEventArgs对象传递到下一个Action args.ResourceCode = data; //ActionPassword acPwd = new ActionPassword(); // acPwd.ObjectState = ObjectState; // this.NextAction = acPwd; object[] objUserGroup = args.UserGroup; bool bIsAdmin = false; if (objUserGroup != null) { foreach (object o in objUserGroup) { if (((UserGroup)o).UserGroupType == "ADMIN") { bIsAdmin = true; break; } } } if (!bIsAdmin) { if (!(new Security.SecurityFacade(domainProvider)) .CheckResourceRight(args.UserCode, args.ResourceCode)) { msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$Error_No_Resource_Right")); } } ObjectState = args; msg.Add(new Message(MessageType.Data, "", new object[] { args })); // Added By Scott Gu for Hisense Version : Add Org ID object obj = new BaseModelFacade(domainProvider).GetResource(args.ResourceCode); object org = (new BaseModelFacade(domainProvider)).GetOrg(((Resource)obj).OrganizationID); if (org != null) { GlobalVariables.CurrentOrganizations.Clear(); GlobalVariables.CurrentOrganizations.Add((Organization)org); } else { msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$Error_NoOrganizationOfTheResource")); } } if (msg.IsSuccess()) { base.Action(act); msg.Add(new UserControl.Message(UserControl.MessageType.Success, "$DCT_WELCOME")); if (act is IDCTClient) { IDCTClient client = act as IDCTClient; client.Authorized = true; client.LoginedUser = args.UserCode; client.LoginedPassword = args.Passwod; client.ResourceCode = args.ResourceCode; } ActionRCard actRcard = new ActionRCard(); actRcard.OutMesssage = new Message(MessageType.Normal, "$DCT_PLEASE_ACTION"); actRcard.NeedInputActionCommand = true; //actRcard.LastAction = this; this.NextAction = actRcard; } return(msg); }
public override Messages Action(object act) { base.Action(act); Messages msg = new Messages(); if (act == 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(); /* * msg = CheckData(data); * if(msg.IsSuccess()) * { #region Key logic,Push next action and fill it with data * ObjectState = args; * * ActionPassword acPwd = new ActionPassword(); * * acPwd.LastAction = this; * * acPwd.ObjectState = ObjectState; * this.NextAction = acPwd; #endregion * * args.UserCode = data; * * msg.Add(new Message(MessageType.Data,"",new object[]{args})); * } */ args.UserCode = (act as IDCTClient).LoginedUser; args.ResourceCode = (act as IDCTClient).ResourceCode; switch (data) { //归属工单 case ActionType.DataCollectAction_GoMO: ActionGotoMO actionGotoMO = new ActionGotoMO(); actionGotoMO.ObjectState = args; this.NextAction = actionGotoMO; (act as IDCTClient).CachedAction = actionGotoMO; //currentAction = actionGotoMO; break; //采集GOOD, added by jessie lee case ActionType.DataCollectAction_GOOD: ActionCollectGood actionCollectGood = new ActionCollectGood(); actionCollectGood.ObjectState = args; this.NextAction = actionCollectGood; (act as IDCTClient).CachedAction = actionCollectGood; break; //采集NG, added by jessie lee, 10/05/2006 case ActionType.DataCollectAction_NG: ActionCollectNG actionCollectNG = new ActionCollectNG(); actionCollectNG.ObjectState = args; this.NextAction = actionCollectNG; (act as IDCTClient).CachedAction = actionCollectNG; break; //采集SMTNG, added by jessie lee, 10/05/2006 case ActionType.DataCollectAction_SMTNG: ActionCollectSMTNG actionCollectSMTNG = new ActionCollectSMTNG(); actionCollectSMTNG.ObjectState = args; this.NextAction = actionCollectSMTNG; (act as IDCTClient).CachedAction = actionCollectSMTNG; break; //采集OUTLINEGOOD, added by jessie lee, 2006/8/18 case ActionType.DataCollectAction_OutLineGood: ActionCollectOutlineGood actionCollectOutlineGood = new ActionCollectOutlineGood(); actionCollectOutlineGood.ObjectState = args; this.NextAction = actionCollectOutlineGood; (act as IDCTClient).CachedAction = actionCollectOutlineGood; break; //采集OUTLINENG, added by jessie lee, 2006/8/18 case ActionType.DataCollectAction_OutLineNG: ActionCollectOutlineNG actionCollectOutlineNG = new ActionCollectOutlineNG(); actionCollectOutlineNG.ObjectState = args; this.NextAction = actionCollectOutlineNG; (act as IDCTClient).CachedAction = actionCollectOutlineNG; break; //Keyparts上料, added by jessie lee, 10/05/2006 case ActionType.DataCollectAction_CollectKeyParts: ActionCollectKeyparts actionCollectKeyparts = new ActionCollectKeyparts(); actionCollectKeyparts.ObjectState = args; this.NextAction = actionCollectKeyparts; (act as IDCTClient).CachedAction = actionCollectKeyparts; break; case BaseDCTDriver.NEXTOP: ActionNextOP actionNextOP = new ActionNextOP(); this.NextAction = actionNextOP; (act as IDCTClient).CachedAction = actionNextOP; break; case ActionType.DataCollectAction_CompareAppendix: ActionCompareApp actionCartonCompare = new ActionCompareApp(); this.NextAction = actionCartonCompare; (act as IDCTClient).CachedAction = actionCartonCompare; break; case ActionType.DataCollectAction_Mix: ActionCollectMix actionCollectMix = new ActionCollectMix(); this.NextAction = actionCollectMix; break; case ActionType.DataCollectAction_KBatch: ActionBatchWithKeypaerts actionBatchWithKeypaerts = new ActionBatchWithKeypaerts(); this.NextAction = actionBatchWithKeypaerts; break; case ActionType.DataCollectAction_CompareProductCode: ActionCompareProductCode actionCompareProductCode = new ActionCompareProductCode(); this.NextAction = actionCompareProductCode; (act as IDCTClient).CachedAction = actionCompareProductCode; break; case ActionType.DataCollectAction_CompareTwo: ActionCompareAppAndProductCode actionCompareAppAndProductCode = new ActionCompareAppAndProductCode(); this.NextAction = actionCompareAppAndProductCode; (act as IDCTClient).CachedAction = actionCompareAppAndProductCode; break; case ActionType.DataCollectAction_AutoNG: ActionAutoNG actionAutoNG = new ActionAutoNG(); this.NextAction = actionAutoNG; (act as IDCTClient).CachedAction = actionAutoNG; break; case ActionType.DataCollectAction_FGPacking: ActionFGPacking actionFGPacking = new ActionFGPacking(); this.NextAction = actionFGPacking; (act as IDCTClient).CachedAction = actionFGPacking; break; case ActionType.DataCollectAction_ONPost: ActionCollectONPost actionCollectONPost = new ActionCollectONPost(); this.NextAction = actionCollectONPost; (act as IDCTClient).CachedAction = actionCollectONPost; break; case ActionType.DataCollectAction_OffPost: ActionCollectOffPost actionCollectOffPost = new ActionCollectOffPost(); this.NextAction = actionCollectOffPost; (act as IDCTClient).CachedAction = actionCollectOffPost; break; default: ActionRCard actionRCard = new ActionRCard(); //actionRCard.ObjectState = args; this.NextAction = actionRCard; break; } return(msg); }
public override Messages Action(object act) { Messages msg = new Messages(); 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(); } 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 (errorCodesHT == null) { errorCodesHT = new Hashtable(); } if (!errorCodesHT.ContainsKey(data)) { errorCodesHT.Add(data, data); } base.Action(act); ActionCollectOutlineNG actionCollectOutlineNG = this; actionCollectOutlineNG.IsTopAction = false; this.NextAction = actionCollectOutlineNG; this.Status = ActionStatus.PrepareData; //Laws Lu,2006/07/11 write back error code msg.Add(new UserControl.Message(MessageType.Success, data)); 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()) { string[] errorcs = new string[errorCodesHT.Count]; int i = 0; foreach (DictionaryEntry dic in errorCodesHT) { errorcs[i] = dic.Key.ToString(); i++; } //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); if (errorcodes == null || errorcodes.Length == 0) { msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$ErrorCode_Not_BelongTo_ModelCode")); } } object[] oplist = null; if (msg.IsSuccess()) { oplist = GetOutLineOP(domainProvider, (act as IDCTClient).ResourceCode); if (oplist == null || oplist.Length == 0) { msg.Add(new UserControl.Message(MessageType.Error, "$CSError_Res_Cannot_Collect_OUtlineGood")); } } string opcode = string.Empty; if (msg.IsSuccess()) { opcode = (oplist[0] as Operation).OPCode; if (CheckOutlineOPInRoute(domainProvider, product.LastSimulation.RouteCode, opcode)) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_OutLineOP_In_ThisRoute")); } } if (msg.IsSuccess()) { if (IsLastOP(domainProvider, product.LastSimulation.MOCode, product.LastSimulation.RouteCode, product.LastSimulation.OPCode)) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_Op_IsLast_OutLineOP_Cannot_Collect")); } } if (msg.IsSuccess()) { IAction dataCollectModule = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_OutLineNG); domainProvider.BeginTransaction(); try { IDCTClient client = act as IDCTClient; msg.AddMessages((dataCollectModule).Execute(new OutLineActionEventArgs( ActionType.DataCollectAction_OutLineNG, args.RunningCard, client.LoginedUser, client.ResourceCode, product, opcode, errorcodes, ""))); if (msg.IsSuccess()) { domainProvider.CommitTransaction(); msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_NGSUCCESS"))); //msg.Add( new UserControl.Message(MessageType.Succes ,string.Format("$CS_NGSUCCESS,$CS_Param_ID: {0}", args.RunningCard))); } 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 ActionCollectOutlineNG) { 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; } base.Action(act); ActionRCard actRcard = new ActionRCard(); this.NextAction = actRcard; return(msg); }
public override Messages Action(object act) { base.Action(act); Messages msg = new Messages(); if (act == 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(); //msg = CheckData(data); if (msg.IsSuccess()) { #region Key logic,Push next action and fill it with data args.RunningCard = data; ObjectState = args; Web.Helper.ActionType acttype = new Web.Helper.ActionType(); acttype.Items.Add(BaseDCTDriver.NEXTOP); ActionRCard acRcard = new ActionRCard(); if ((act as IDCTClient).CachedAction != null && !acttype.Items.Contains(args.RunningCard))//如果存在缓存的Action则利用缓存的Action { BaseDCTAction action = (act as IDCTClient).CachedAction; if (!(action is ActionCollectNG) && !(action is ActionCollectSMTNG) && !(action is ActionCollectOutlineNG) && !(action is ActionCollectKeyparts) && !(action is ActionBatchWithKeypaerts) && !(action is ActionCollectMix)) { action.ObjectState = ObjectState; } this.NextAction = action; } else if ((act as IDCTClient).CachedAction == null && !acttype.Items.Contains(args.RunningCard)) { ActionFactory acFac = new ActionFactory(); acFac.ObjectState = ObjectState; this.NextAction = acFac; } else if (acttype.Items.Contains(args.RunningCard)) { //ActionRCard acRcard = new ActionRCard(); //acRcard.ObjectState = ObjectState; this.NextAction = acRcard; } bool bIsAction = true; if (acttype.Items.Contains(args.RunningCard)) { switch (args.RunningCard) { //归属工单 case ActionType.DataCollectAction_GoMO: ActionGotoMO actionGotoMO = new ActionGotoMO(); //actionGotoMO.ObjectState = acRcrd.ObjectState; acRcard.NextAction = actionGotoMO; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_MOCode"); (act as IDCTClient).CachedAction = actionGotoMO; break; //采集GOOD, added by jessie lee case ActionType.DataCollectAction_GOOD: ActionCollectGood actionCollectGood = new ActionCollectGood(); //actionCollectGood.ObjectState = ObjectState; acRcard.NextAction = actionCollectGood; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_GOOD_Please_Input_GOOD_SN"); // Added by Icyer 2007/08/22 // 做良品采集时做归属工单 //changed by hiro 2008/08/27 //if ((act as IDCTClient).CachedAction is Action.ActionGotoMO) //{ // if (((Action.ActionGotoMO)(act as IDCTClient).CachedAction).moCode != string.Empty) // { // actionCollectGood.NeedGoMO = true; // actionCollectGood.NeedGoMOCode = ((Action.ActionGotoMO)(act as IDCTClient).CachedAction).moCode; // } //} // Added end (act as IDCTClient).CachedAction = actionCollectGood; break; //采集NG, added by jessie lee, 10/05/2006 case ActionType.DataCollectAction_NG: ActionCollectNG actionCollectNG = new ActionCollectNG(); //actionCollectNG.ObjectState = acRcard.ObjectState; acRcard.NextAction = actionCollectNG; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"); (act as IDCTClient).CachedAction = actionCollectNG; break; //采集SMTNG, added by jessie lee, 10/05/2006 case ActionType.DataCollectAction_SMTNG: ActionCollectSMTNG actionCollectSMTNG = new ActionCollectSMTNG(); //actionCollectSMTNG.ObjectState = acRcard.ObjectState; acRcard.NextAction = actionCollectSMTNG; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"); (act as IDCTClient).CachedAction = actionCollectSMTNG; break; //采集OutlineGOOD, added by jessie lee, 2006/8/21 case ActionType.DataCollectAction_OutLineGood: ActionCollectOutlineGood actionCollectOutlineGood = new ActionCollectOutlineGood(); //actionCollectGood.ObjectState = ObjectState; acRcard.NextAction = actionCollectOutlineGood; (act as IDCTClient).CachedAction = actionCollectOutlineGood; break; //采集OutlineNG, added by jessie lee, 2006/8/21 case ActionType.DataCollectAction_OutLineNG: ActionCollectOutlineNG actionCollectOutlineNG = new ActionCollectOutlineNG(); //actionCollectNG.ObjectState = acRcard.ObjectState; acRcard.NextAction = actionCollectOutlineNG; (act as IDCTClient).CachedAction = actionCollectOutlineNG; break; //Keyparts上料, added by jessie lee, 10/05/2006 case ActionType.DataCollectAction_CollectKeyParts: ActionCollectKeyparts actionCollectKeyparts = new ActionCollectKeyparts(); //actionCollectKeyparts.ObjectState = acRcard.ObjectState; acRcard.NextAction = actionCollectKeyparts; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"); // 如果上个采集是集成上料,则做KeyPart时同时做集成上料 if ((act as IDCTClient).CachedAction is Action.ActionCollectINNO) { if (((Action.ActionCollectINNO)(act as IDCTClient).CachedAction).INNOCode != string.Empty) { actionCollectKeyparts.NeedCollectINNO = true; actionCollectKeyparts.INNOCode = ((Action.ActionCollectINNO)(act as IDCTClient).CachedAction).INNOCode; } } else if ((act as IDCTClient).CachedAction is Action.ActionCollectKeyparts) { actionCollectKeyparts.NeedCollectINNO = ((Action.ActionCollectKeyparts)(act as IDCTClient).CachedAction).NeedCollectINNO; actionCollectKeyparts.INNOCode = ((Action.ActionCollectKeyparts)(act as IDCTClient).CachedAction).INNOCode; } // Added end (act as IDCTClient).CachedAction = actionCollectKeyparts; break; case ActionType.DataCollectAction_Split: ActionCollectIDMerge actionCollectIDMerge = new ActionCollectIDMerge(); acRcard.NextAction = actionCollectIDMerge; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_SN_For_Merge"); (act as IDCTClient).CachedAction = actionCollectIDMerge; break; case ActionType.DataCollectAction_CollectINNO: ActionCollectINNO actionCollectINNO = new ActionCollectINNO(); acRcard.NextAction = actionCollectINNO; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_CMPleaseInputINNOinEdt"); (act as IDCTClient).CachedAction = actionCollectINNO; break; case BaseDCTDriver.NEXTOP: ActionNextOP actionNextOP = new ActionNextOP(); acRcard.NextAction = actionNextOP; (act as IDCTClient).CachedAction = actionNextOP; break; case ActionType.DataCollectAction_CompareAppendix: ActionCompareApp actionCartonCompare = new ActionCompareApp(); acRcard.NextAction = actionCartonCompare; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_CARTONNO"); (act as IDCTClient).CachedAction = actionCartonCompare; break; case ActionType.DataCollectAction_Mix: ActionCollectMix actionCollectMix = new ActionCollectMix(); acRcard.NextAction = actionCollectMix; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"); break; case ActionType.DataCollectAction_KBatch: ActionBatchWithKeypaerts actionBatchWithKeypaerts = new ActionBatchWithKeypaerts(); acRcard.NextAction = actionBatchWithKeypaerts; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"); break; case ActionType.DataCollectAction_CompareProductCode: ActionCompareProductCode actionCompareProductCode = new ActionCompareProductCode(); acRcard.NextAction = actionCompareProductCode; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_CARTONNO"); (act as IDCTClient).CachedAction = actionCompareProductCode; break; case ActionType.DataCollectAction_CompareTwo: ActionCompareAppAndProductCode actionCompareAppAndProductCode = new ActionCompareAppAndProductCode(); acRcard.NextAction = actionCompareAppAndProductCode; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_CARTONNO"); (act as IDCTClient).CachedAction = actionCompareAppAndProductCode; break; case ActionType.DataCollectAction_AutoNG: ActionAutoNG actionAutoNG = new ActionAutoNG(); acRcard.NextAction = actionAutoNG; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"); (act as IDCTClient).CachedAction = actionAutoNG; break; case ActionType.DataCollectAction_FGPacking: ActionFGPacking actionFGPacking = new ActionFGPacking(); acRcard.NextAction = actionFGPacking; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"); (act as IDCTClient).CachedAction = actionFGPacking; break; case ActionType.DataCollectAction_MACID: ActionCollectMACID actionCollectMACID = new ActionCollectMACID(); acRcard.NextAction = actionCollectMACID; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"); (act as IDCTClient).CachedAction = actionCollectMACID; break; case ActionType.DataCollectAction_MACALL: ActionCollectMACALL actionCollectMACALL = new ActionCollectMACALL(); acRcard.NextAction = actionCollectMACALL; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"); (act as IDCTClient).CachedAction = actionCollectMACALL; break; case ActionType.DataCollectAction_ONPost: ActionCollectONPost actionCollectONPost = new ActionCollectONPost(); acRcard.NextAction = actionCollectONPost; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_UserCode"); (act as IDCTClient).CachedAction = actionCollectONPost; break; case ActionType.DataCollectAction_OffPost: ActionCollectOffPost actionCollectOffPost = new ActionCollectOffPost(); acRcard.NextAction = actionCollectOffPost; acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_UserCode"); (act as IDCTClient).CachedAction = actionCollectOffPost; break; default: bIsAction = false; break; } } else { bIsAction = false; } if (NeedInputActionCommand == true) { if (bIsAction == false) { msg.Add(new Message(MessageType.Error, "$CS_SystemError_CheckIDNotSupportAction")); ActionRCard actRcard = new ActionRCard(); actRcard.OutMesssage = new Message(MessageType.Normal, "$DCT_PLEASE_ACTION"); actRcard.NeedInputActionCommand = true; this.NextAction = actRcard; } else { NeedInputActionCommand = false; } } #endregion msg.Add(new Message(MessageType.Data, "", new object[] { args })); } return(msg); }