// 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); }
private Messages DropLoadedParts(string rcard) { Messages msg = new Messages(); ActionOnLineHelper onLine = new ActionOnLineHelper(DataProvider); MaterialFacade materialFacade = new MaterialFacade(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); TSFacade tsFacade = new TSFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(rcard.Trim().ToUpper(), string.Empty); ProductInfo product = GetProduct(sourceRCard); if (product == null || product.LastSimulation == null) { msg.Add(new UserControl.Message(MessageType.Error, "$NoSimulation")); return(msg); } // Marked By HI1/Venus.Feng on 20081013 for Hisense Version : GOOD can do drop /* * if (product.LastSimulation.ProductStatus != ProductStatus.NG) * { * msg.Add(new UserControl.Message(MessageType.Error, "$DropMaterial_Need_NG")); * return msg; * } */ // End Marked msg.Add(new UserControl.Message(rcard)); //获取所有需要拆解或者替换的Parts ArrayList partsToUnload = new ArrayList(); for (int i = 0; i < this.ultraGridLoadedPart.Rows.Count; i++) { if (ultraGridLoadedPart.Rows[i].Cells[0].Text.ToLower() == "true") { InnoObject innoObject = new InnoObject(); innoObject.LineIndex = i; innoObject.MCard = ultraGridLoadedPart.Rows[i].Cells["PackedNo"].Text; innoObject.MCardType = ultraGridLoadedPart.Rows[i].Cells["MCardType"].Text; innoObject.ItemIndex = partsToUnload.Count + 1; innoObject.MItemCode = ultraGridLoadedPart.Rows[i].Cells["ItemCode"].Text; innoObject.MOCode = ultraGridLoadedPart.Rows[i].Cells["MOCode"].Text; innoObject.Qty = 1; innoObject.NewBarcode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(ultraGridLoadedPart.Rows[i].Cells["NewBarcode"].Text.Trim())); partsToUnload.Add(innoObject); } } //对于需要替换的Parts,需要做类似上料中的解析和检查 for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (innoObject.NewBarcode.Trim().Length > 0) { //抓取物料的设定 Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(innoObject.MItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (material == null) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_NotFound")); return(msg); } string barcode = innoObject.NewBarcode.Trim(); //模拟一个OPBOMDetail OPBOMDetail detailTemp = new OPBOMDetail(); detailTemp.OPBOMItemControlType = material.MaterialControlType; detailTemp.OPBOMParseType = material.MaterialParseType; detailTemp.OPBOMCheckType = material.MaterialCheckType; detailTemp.CheckStatus = material.CheckStatus; detailTemp.SerialNoLength = material.SerialNoLength; detailTemp.NeedVendor = material.NeedVendor; detailTemp.OPBOMSourceItemCode = innoObject.MItemCode; detailTemp.OPBOMItemCode = innoObject.MItemCode; detailTemp.OPBOMItemQty = 1; MINNO newMINNO = new MINNO(); newMINNO.MOCode = innoObject.MOCode.Trim(); newMINNO.MItemCode = material.MaterialCode.Trim(); Messages collectMessage = dataCollectFacade.GetMINNOByBarcode(detailTemp, barcode, newMINNO.MOCode, null, false, false, out newMINNO); if (collectMessage.IsSuccess()) { innoObject.NewLotNo = newMINNO.LotNO; innoObject.NewPCBA = newMINNO.PCBA; innoObject.NewBIOS = newMINNO.BIOS; innoObject.NewVersion = newMINNO.Version; innoObject.NewVendorItemCode = newMINNO.VendorItemCode; innoObject.NewVendorCode = newMINNO.VendorCode; innoObject.NewDateCode = newMINNO.DateCode; } else { msg.AddMessages(collectMessage); return(msg); } } } try { this.DataProvider.BeginTransaction(); //更新试流单 //下料中处理tbltry,tbltry2rcard for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; TryEventArgs tryEventArgs = new TryEventArgs( ActionType.DataCollectAction_TryNew, ApplicationService.Current().UserCode, product.LastSimulation.OPCode, ApplicationService.Current().ResourceCode, product.LastSimulation.ItemCode, sourceRCard, innoObject.MItemCode, innoObject.MCard, string.Empty, false, false); msg.AddMessages(onLine.ActionWithTransaction(tryEventArgs)); if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } } //更新试流单 //上料中处理tbltry,tbltry2rcard for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (innoObject.NewBarcode.Trim().Length > 0) { TryEventArgs tryEventArgs = new TryEventArgs( ActionType.DataCollectAction_TryNew, ApplicationService.Current().UserCode, product.LastSimulation.OPCode, ApplicationService.Current().ResourceCode, product.LastSimulation.ItemCode, sourceRCard, innoObject.MItemCode, innoObject.NewBarcode, string.Empty, true, true); msg.AddMessages(onLine.ActionWithTransaction(tryEventArgs)); if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } } } //检查新上料是否在TS中而不可用 for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (innoObject.NewBarcode.Trim().Length > 0) { if (!tsFacade.RunningCardCanBeClollected(innoObject.NewBarcode.Trim(), CardType.CardType_Part)) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTSOrScrapped $SERIAL_NO=" + innoObject.NewBarcode.Trim())); DataProvider.RollbackTransaction(); return(msg); } } } //拆解或者替换处理tblonwipitem,tblsimulationreport DropMaterialEventArgs dropMaterialEventArgs = new DropMaterialEventArgs(ActionType.DataCollectAction_DropMaterial, product.LastSimulation.RunningCard, ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, product); dropMaterialEventArgs.OnwipItems = partsToUnload.ToArray(); msg.AddMessages(onLine.ActionWithTransaction(dropMaterialEventArgs)); if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } //针对拆解下的物料,做TS相关的动作 for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (_TSList[innoObject.LineIndex] != null) { if (_TSErrorCodeList[innoObject.LineIndex] == null) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Select_ErrorCode")); DataProvider.RollbackTransaction(); return(msg); } Domain.TS.TS oldTS = (Domain.TS.TS)tsFacade.QueryLastTSByRunningCard(innoObject.MCard); if (oldTS != null) { if (oldTS.TSStatus == TSStatus.TSStatus_New || oldTS.TSStatus == TSStatus.TSStatus_Confirm || oldTS.TSStatus == TSStatus.TSStatus_TS) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTS")); DataProvider.RollbackTransaction(); return(msg); } else if (oldTS.TSStatus != TSStatus.TSStatus_Reflow && oldTS.TSStatus != TSStatus.TSStatus_Split && oldTS.TSStatus != TSStatus.TSStatus_Complete && oldTS.TSStatus != TSStatus.TSStatus_Scrap) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_WrongTSStatus")); DataProvider.RollbackTransaction(); return(msg); } } Domain.TS.TS newTS = (Domain.TS.TS)_TSList[innoObject.LineIndex]; tsFacade.AddTS(newTS); foreach (TSErrorCode tsErrorCode in (TSErrorCode[])_TSErrorCodeList[innoObject.LineIndex]) { tsErrorCode.RunningCard = newTS.RunningCard; tsErrorCode.RunningCardSequence = newTS.RunningCardSequence; tsErrorCode.ItemCode = newTS.ItemCode; tsErrorCode.ModelCode = newTS.ModelCode; tsErrorCode.MOCode = newTS.MOCode; tsErrorCode.MOSeq = newTS.MOSeq; tsErrorCode.MaintainUser = newTS.MaintainUser; tsErrorCode.MaintainDate = newTS.MaintainDate; tsErrorCode.MaintainTime = newTS.MaintainTime; tsFacade.AddTSErrorCode(tsErrorCode); } } } if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } if (msg.IsSuccess()) { DataProvider.CommitTransaction(); } else { DataProvider.RollbackTransaction(); } } catch (Exception e) { this.DataProvider.RollbackTransaction(); msg.Add(new UserControl.Message(e)); } return(msg); }