protected override void UpdateDomainObject(object domainObject) { if (_facade == null) { _facade = new TSModelFacadeFactory(base.DataProvider).CreateTSModelFacade(); } if (((ErrorCodeItem2Route)domainObject).RouteCode.ToUpper() != "TS" && ((ErrorCodeItem2Route)domainObject).RouteCode.Trim().Length > 0) { //检查途程是不是和产品挂起来了 BenQGuru.eMES.MOModel.ItemFacade itemFacade = new BenQGuru.eMES.MOModel.ItemFacade(this.DataProvider); object ir = itemFacade.GetItem2Route(((ErrorCodeItem2Route)domainObject).ItemCode, ((ErrorCodeItem2Route)domainObject).RouteCode, ((ErrorCodeItem2Route)domainObject).OrganizationID.ToString()); if (ir == null) { throw new Exception("$Error_ItemRoute_NotExist"); } } if (((ErrorCodeItem2Route)domainObject).RouteCode.Trim().Length > 0) { BenQGuru.eMES.BaseSetting.BaseModelFacade baseModelFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider); object route2op = baseModelFacade.GetRoute2Operation(((ErrorCodeItem2Route)domainObject).RouteCode.ToUpper(), ((ErrorCodeItem2Route)domainObject).OPCode.ToUpper()); if (route2op == null) { throw new Exception("$Error_RouteHasNoOperations"); } } this._facade.UpdateErrorCodeItem2Route((ErrorCodeItem2Route)domainObject); }
protected override int GetRowCount() { if (_facade == null) { _facade = new FacadeFactory(base.DataProvider).CreateItemFacade(); } return(this._facade.QueryItemCount( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)), FormatHelper.CleanString(this.txtItemNameQuery.Text), "", "", "")); }
private void LoadData() { BenQGuru.eMES.MOModel.ItemFacade facade = new BenQGuru.eMES.MOModel.ItemFacade(this.DataProvider); object[] dimList = facade.QueryItem2Dimention(this.txtItemCodeQuery.Text); if (dimList != null) { foreach (BenQGuru.eMES.Domain.MOModel.Item2Dimention dim in dimList) { TextBox tb = this.Page.FindControl("txt" + dim.ParamName) as TextBox; if (tb != null) { tb.Text = dim.ParamValue.ToString(); } } } }
private void SetRaflowPanel(object obj) { ClearReflowPanel(); this.ucLabEditMOCode.Value = ((BenQGuru.eMES.Domain.TS.TS)obj).MOCode; this.ucLabEditItemCode.Value = ((BenQGuru.eMES.Domain.TS.TS)obj).ItemCode; if (((BenQGuru.eMES.Domain.TS.TS)obj).FromRouteCode != string.Empty) { this.ucLabEditRoute.Value = ((BenQGuru.eMES.Domain.TS.TS)obj).FromRouteCode; } else { TSFacade tsFacade = new TSFacade(this.DataProvider); BenQGuru.eMES.Domain.DataCollect.Simulation simulation = tsFacade.GetSimulation(((BenQGuru.eMES.Domain.TS.TS)obj).RunningCard, ((BenQGuru.eMES.Domain.TS.TS)obj).MOCode); if (simulation == null) { Messages message = new Messages(); message.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_HasNot_RouteCode")); ApplicationRun.GetInfoForm().Add(message); ClearReflowPanel(); this.ultraCheckEditor1.Checked = false; return; } else { this.ucLabEditRoute.Value = simulation.FromRoute; } } BenQGuru.eMES.MOModel.ItemFacade itemFacade = new BenQGuru.eMES.MOModel.ItemFacade(this.DataProvider); object[] item2Op = itemFacade.QueryItem2Operation(this.ucLabEditItemCode.Value, this.ucLabEditRoute.Value); if (item2Op == null) { return; } else { for (int i = 0; i < item2Op.Length; i++) { this.ucLabComboxOPCode.AddItem(((BenQGuru.eMES.Domain.MOModel.ItemRoute2OP)item2Op[i]).OPCode, ((BenQGuru.eMES.Domain.MOModel.ItemRoute2OP)item2Op[i]).OPCode); } } }
protected void Page_Load(object sender, System.EventArgs e) { _facade = new BenQGuru.eMES.MOModel.ItemFacade(this.DataProvider); if (!this.IsPostBack) { // 初始化页面语言 this.InitPageLanguage(this.languageComponent1, false); if (this.GetRequestParam("ItemCode") == string.Empty) { ExceptionManager.Raise(this.GetType(), "$Error_RequestUrlParameter_Lost"); } this.txtItemCodeQuery.Text = this.GetRequestParam("ItemCode"); this.TextboxOrgID.Text = this.GetRequestParam("OrgID"); Organization org = (Organization)(new BenQGuru.eMES.BaseSetting.BaseModelFacade()).GetOrg(int.Parse(this.GetRequestParam("OrgID").ToString())); this.TextboxOrg.Text = org.OrganizationDescription; this.LoadData(); } }
private void CheckImportResult(ArrayList items) { BenQGuru.eMES.MOModel.ItemFacade itemFacade = new BenQGuru.eMES.MOModel.ItemFacade(base.DataProvider); BenQGuru.eMES.BaseSetting.BaseModelFacade modelFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider); if (_facade == null) { _facade = new SMTFacade(base.DataProvider); } ArrayList checkedSpec = new ArrayList(); ArrayList checkedProduct = new ArrayList(); ArrayList checkedSSCode = new ArrayList(); for (int i = 0; i < items.Count; i++) { SMTFeederMaterial item = (SMTFeederMaterial)items[i]; item.EAttribute1 = true.ToString(); if (item.ProductCode == string.Empty || item.StepSequenceCode == string.Empty || item.MachineCode == string.Empty || item.MachineStationCode == string.Empty || item.MaterialCode == string.Empty) { item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$Error_Input_Empty"); continue; } if (checkedProduct.Contains(item.ProductCode) == false) { object obj = itemFacade.GetItem(item.ProductCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (obj == null) { item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$Error_ItemCode_NotExist"); continue; } else { checkedProduct.Add(item.ProductCode); } } if (checkedSSCode.Contains(item.StepSequenceCode) == false) { object obj = modelFacade.GetStepSequence(item.StepSequenceCode); if (obj == null) { item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$Error_SSCode_NotExist"); continue; } else { checkedSSCode.Add(item.StepSequenceCode); } } if (item.FeederSpecCode == string.Empty || item.Qty == 0) { if (item.SourceMaterialCode == string.Empty || i == 0) { item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$MaterialCode_Not_Exist"); continue; } for (int n = 0; n < items.Count; n++) { SMTFeederMaterial item1 = (SMTFeederMaterial)items[n]; if (item1.MaterialCode == item.SourceMaterialCode) { if (item.FeederSpecCode == string.Empty) { item.FeederSpecCode = item1.FeederSpecCode; } if (item.Qty == 0) { item.Qty = item1.Qty; } break; } } if (item.FeederSpecCode == string.Empty) { item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$FeederSpec_Not_Exist"); continue; } } if (checkedSpec.Contains(item.FeederSpecCode) == false) { object obj = _facade.GetFeederSpec(item.FeederSpecCode); if (obj == null) { item.EAttribute1 = false.ToString() + ":" + languageComponent1.GetString("$FeederSpec_Not_Exist"); continue; } else { checkedSpec.Add(item.FeederSpecCode); } } } }
private string autoCreateASNFromCheckoutInfo(string invNo, Pick pick) { try { InvoicesDetail invD = (InvoicesDetail)_InventoryFacade.GetInvoicesDetail(invNo); CARTONINVOICES[] cartos = _warehouseFacade.GetGrossAndWeight(pick.PickNo); string stno = CreateStNO(); Asn asn = new Asn(); asn.Stno = stno; asn.StType = "UB"; asn.CDate = FormatHelper.TODateInt(DateTime.Now); asn.CTime = FormatHelper.TOTimeInt(DateTime.Now); asn.CUser = GetUserCode(); asn.Status = "Release"; asn.Invno = invNo; asn.FacCode = pick.FacCode; if (cartos.Length > 0) { asn.Gross_weight = (decimal)cartos[0].GROSS_WEIGHT; asn.Volume = cartos[0].VOLUME; } asn.StorageCode = invD.StorageCode ?? " "; asn.MaintainUser = GetUserCode(); asn.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); asn.MaintainDate = FormatHelper.TODateInt(DateTime.Now); CartonInvDetailMaterial[] cartonMs = _warehouseFacade.GetCartonInvDetailMaterial(pick.PickNo); MOModel.ItemFacade _itemfacade = new BenQGuru.eMES.MOModel.ItemFacade(this.DataProvider); int i = 1; this.DataProvider.BeginTransaction(); foreach (CartonInvDetailMaterial m in cartonMs) { object materobj = _itemfacade.GetMaterial(m.MCODE); Domain.MOModel.Material mater = materobj as Domain.MOModel.Material; if (materobj == null) { this.DataProvider.RollbackTransaction(); throw new Exception("物料表没有物料:" + m.MCODE); } string custMCode = _warehouseFacade.GetCustMCodeForUB(pick.PickNo, m.DQMCODE); if (mater.MCONTROLTYPE == SAP_CONTROLTYPE.SAP_ITEM_CONTROL_KEYPARTS) { ASNDetail asnd = new ASNDetail(); asnd.ActQty = 0; //asnd.CartonNo = " "; asnd.DQMCode = m.DQMCODE; asnd.Qty = (int)m.QTY; asnd.StLine = i.ToString(); asnd.CustMCode = custMCode; asnd.MCode = m.MCODE; asnd.Status = "Release"; asnd.StNo = stno; asnd.MDesc = mater.MchshortDesc; asnd.Unit = m.UNIT; asnd.CDate = FormatHelper.TODateInt(DateTime.Now); asnd.CTime = FormatHelper.TOTimeInt(DateTime.Now); asnd.CUser = GetUserCode(); asnd.MaintainDate = FormatHelper.TODateInt(DateTime.Now); asnd.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); asnd.MaintainUser = GetUserCode(); asnd.LotNo = " "; CARTONINVDETAILSN[] sns = _warehouseFacade.GetCartonInvDetailSn(m.CARTONNO, pick.PickNo); List <string> snList = new List <string>(); if (sns.Length > 0) { foreach (CARTONINVDETAILSN sn in sns) { snList.Add(sn.SN); } Asndetail detail = _warehouseFacade.GetFirstCheckInAsnDetail(snList); if (detail != null) { asnd.ProductionDate = detail.Production_Date; asnd.SupplierLotNo = detail.Supplier_lotno; asnd.LotNo = detail.Lotno; asnd.StorageAgeDate = detail.StorageageDate; } } DBDateTime dbTime = FormatHelper.GetNowDBDateTime(this.DataProvider); Asndetailitem detailitem = _warehouseFacade.CreateNewAsndetailitem(); detailitem.CDate = dbTime.DBDate; detailitem.CTime = dbTime.DBTime; detailitem.CUser = this.GetUserCode(); detailitem.MaintainDate = dbTime.DBDate; detailitem.MaintainTime = dbTime.DBTime; detailitem.MaintainUser = this.GetUserCode(); detailitem.Stline = i.ToString(); detailitem.Stno = asn.Stno; detailitem.MCode = asnd.MCode; detailitem.DqmCode = asnd.DQMCode; //查找对应的SAP单 object[] qtyobjs = _warehouseFacade.GetSAPNOandLinebyMCODE(asn.Invno, asnd.MCode, asnd.DQMCode); if (qtyobjs == null) { this.DataProvider.RollbackTransaction(); throw new Exception("入库需求" + asn.Invno + " 没有相关物料" + asnd.MCode + "," + asnd.DQMCode + "或者此行已被取消!"); } decimal sub = asnd.Qty; for (int k = 0; k < qtyobjs.Length; k++) { InvoicesDetail invdetail = qtyobjs[k] as InvoicesDetail; decimal subNeed = 0; object findNeedQTY_old = _warehouseFacade.GetNeedImportQtyOLD(invdetail.InvNo, invdetail.InvLine, asnd.StNo); //找这个invoice行已经导入了多少,和判退多少 Asndetailitem subItemOld = findNeedQTY_old as Asndetailitem; object findNeedQTY_now = _warehouseFacade.GetNeedImportQtyNow(invdetail.InvNo, invdetail.InvLine, asnd.StNo); //找这个invoice行已经导入了多少,和判退多少 Asndetailitem subItemNow = findNeedQTY_now as Asndetailitem; subNeed = invdetail.PlanQty - subItemOld.Qty + (subItemOld.Qty - subItemOld.ReceiveQty) + (subItemOld.ReceiveQty - subItemOld.QcpassQty); subNeed = subNeed - subItemNow.Qty; if (subNeed == 0) { continue; } //如果箱数量大于需求数量差---进行拆分 if (sub > subNeed) { sub = sub - subNeed; // sub是剩余的 detailitem.Qty = subNeed; detailitem.Invline = invdetail.InvLine.ToString(); detailitem.Invno = invdetail.InvNo; detailitem.ActQty = detailitem.Qty; detailitem.QcpassQty = detailitem.Qty; detailitem.ReceiveQty = detailitem.Qty; _warehouseFacade.AddAsndetailitem(detailitem); } //如果箱单数量小于等于需求数量差--直接填入 else { detailitem.Qty = sub; detailitem.Invline = invdetail.InvLine.ToString(); detailitem.Invno = invdetail.InvNo; detailitem.ActQty = detailitem.Qty; detailitem.QcpassQty = detailitem.Qty; detailitem.ReceiveQty = detailitem.Qty; _warehouseFacade.AddAsndetailitem(detailitem); sub = 0; } if (sub == 0) { break; } } //如果sub>0,说明导入数量过多,报错 if (sub > 0) { this.DataProvider.RollbackTransaction(); throw new Exception("箱单导入数量与需求数量不符!"); } foreach (CARTONINVDETAILSN sn in sns) { Asndetailsn asnSN = new Asndetailsn(); asnSN.CDate = FormatHelper.TODateInt(DateTime.Now); asnSN.CTime = FormatHelper.TOTimeInt(DateTime.Now); asnSN.CUser = GetUserCode(); asnSN.MaintainDate = FormatHelper.TODateInt(DateTime.Now); asnSN.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); asnSN.MaintainUser = GetUserCode(); asnSN.Sn = sn.SN; asnSN.Stline = i.ToString(); asnSN.Stno = stno; _warehouseFacade.AddAsndetailsn(asnSN); } _InventoryFacade.AddASNDetail(asnd); } else if (mater.MCONTROLTYPE == SAP_CONTROLTYPE.SAP_ITEM_CONTROL_LOT || mater.MCONTROLTYPE == SAP_CONTROLTYPE.SAP_ITEM_CONTROL_NOCONTROL) { ASNDetail asnd = new ASNDetail(); asnd.ActQty = 0; asnd.CustMCode = custMCode; asnd.DQMCode = m.DQMCODE; asnd.Qty = (int)m.QTY; asnd.StLine = i.ToString(); asnd.MCode = m.MCODE; asnd.StNo = stno; asnd.Status = "Release"; asnd.MDesc = mater.MchshortDesc; asnd.Unit = m.UNIT; asnd.CDate = FormatHelper.TODateInt(DateTime.Now); asnd.CTime = FormatHelper.TOTimeInt(DateTime.Now); asnd.CUser = GetUserCode(); asnd.MaintainDate = FormatHelper.TODateInt(DateTime.Now); asnd.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); asnd.MaintainUser = GetUserCode(); asnd.LotNo = " "; Pickdetailmaterial pickMaterial = (Pickdetailmaterial)_warehouseFacade.GetLotNOInformationFromDQMCODE(m.DQMCODE, pick.PickNo); if (pickMaterial != null) { asnd.ProductionDate = pickMaterial.Production_Date; asnd.SupplierLotNo = pickMaterial.Supplier_lotno; asnd.LotNo = pickMaterial.Lotno; asnd.StorageAgeDate = pickMaterial.StorageageDate; } else { throw new Exception(pick.PickNo + "没有找到检料信息!"); } _InventoryFacade.AddASNDetail(asnd); DBDateTime dbTime = FormatHelper.GetNowDBDateTime(this.DataProvider); Asndetailitem detailitem = _warehouseFacade.CreateNewAsndetailitem(); detailitem.CDate = dbTime.DBDate; detailitem.CTime = dbTime.DBTime; detailitem.CUser = this.GetUserCode(); detailitem.MaintainDate = dbTime.DBDate; detailitem.MaintainTime = dbTime.DBTime; detailitem.MaintainUser = this.GetUserCode(); detailitem.Stline = i.ToString(); detailitem.Stno = asn.Stno; detailitem.MCode = asnd.MCode; detailitem.DqmCode = asnd.DQMCode; //查找对应的SAP单 object[] qtyobjs = _warehouseFacade.GetSAPNOandLinebyMCODE(asn.Invno, asnd.MCode, asnd.DQMCode); if (qtyobjs == null) { this.DataProvider.RollbackTransaction(); throw new Exception("箱单导入数量与需求数量不符!"); } decimal sub = asnd.Qty; for (int k = 0; k < qtyobjs.Length; k++) { InvoicesDetail invdetail = qtyobjs[k] as InvoicesDetail; decimal subNeed = 0; object findNeedQTY_old = _warehouseFacade.GetNeedImportQtyOLD(invdetail.InvNo, invdetail.InvLine, asnd.StNo); //找这个invoice行已经导入了多少,和判退多少 Asndetailitem subItemOld = findNeedQTY_old as Asndetailitem; object findNeedQTY_now = _warehouseFacade.GetNeedImportQtyNow(invdetail.InvNo, invdetail.InvLine, asnd.StNo); //找这个invoice行已经导入了多少,和判退多少 Asndetailitem subItemNow = findNeedQTY_now as Asndetailitem; subNeed = invdetail.PlanQty - subItemOld.Qty + (subItemOld.Qty - subItemOld.ReceiveQty) + (subItemOld.ReceiveQty - subItemOld.QcpassQty); subNeed = subNeed - subItemNow.Qty; if (subNeed == 0) { continue; } //如果箱数量大于需求数量差---进行拆分 if (sub > subNeed) { sub = sub - subNeed; // sub是剩余的 detailitem.Qty = subNeed; detailitem.Invline = invdetail.InvLine.ToString(); detailitem.Invno = invdetail.InvNo; detailitem.ActQty = detailitem.Qty; detailitem.QcpassQty = detailitem.Qty; detailitem.ReceiveQty = detailitem.Qty; _warehouseFacade.AddAsndetailitem(detailitem); } //如果箱单数量小于等于需求数量差--直接填入 else { detailitem.Qty = sub; detailitem.Invline = invdetail.InvLine.ToString(); detailitem.Invno = invdetail.InvNo; detailitem.ActQty = detailitem.Qty; detailitem.QcpassQty = detailitem.Qty; detailitem.ReceiveQty = detailitem.Qty; _warehouseFacade.AddAsndetailitem(detailitem); sub = 0; } if (sub == 0) { break; } } //如果sub>0,说明导入数量过多,报错 if (sub > 0) { this.DataProvider.RollbackTransaction(); throw new Exception("箱单导入数量与需求数量不符!"); } } i++; } _warehouseFacade.AddAsn(asn); WarehouseFacade facade = new WarehouseFacade(base.DataProvider); #region 在invinouttrans表中增加一条数据 //ASN asn = (ASN)domainObject; DBDateTime dbTime1 = FormatHelper.GetNowDBDateTime(this.DataProvider); InvInOutTrans trans = facade.CreateNewInvInOutTrans(); trans.CartonNO = string.Empty; trans.DqMCode = string.Empty; trans.FacCode = asn.FacCode; trans.FromFacCode = asn.FromfacCode; trans.FromStorageCode = asn.FromstorageCode; trans.InvNO = asn.Invno; trans.InvType = asn.StType; trans.LotNo = string.Empty; trans.MaintainDate = dbTime1.DBDate; trans.MaintainTime = dbTime1.DBTime; trans.MaintainUser = this.GetUserCode(); trans.MCode = string.Empty; trans.ProductionDate = 0; trans.Qty = 0; trans.Serial = 0; trans.StorageAgeDate = 0; trans.StorageCode = asn.StorageCode; trans.SupplierLotNo = string.Empty; trans.TransNO = asn.Stno; trans.TransType = "IN"; trans.Unit = string.Empty; trans.ProcessType = "UBCreateASN"; facade.AddInvInOutTrans(trans); #endregion this.DataProvider.CommitTransaction(); return(stno); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); throw ex; } }
//Laws Lu,2006/01/20,比对配置信息 private Messages CheckConfig(SoftwareActionEventArgs e, ProductInfo product) { Messages msg = new Messages(); if (chkConfig.Checked == false) { return(msg); } if (e.CurrentMO == null) { e.CurrentMO = (new MOModel.MOFacade(DataProvider)).GetMO(product.LastSimulation.MOCode) as Domain.MOModel.MO; } // if(e.CurrentMO.MOBIOSVersion != strVer) // { // msg.Add(new UserControl.Message(MessageType.Error,"$CS_VERSION_COMPARE_NOT_PASS $CS_MO_VERSION=" // + e.CurrentMO.MOBIOSVersion + " $CS_CURRENT_VERSION=" + strVer)); DataCollectFacade dcf = new DataCollectFacade(DataProvider); MOModel.ItemFacade icf = new BenQGuru.eMES.MOModel.ItemFacade(DataProvider); object[] configInfos = dcf.GetConfigInfo(e.RunningCard); object[] itemChecks = icf.GetItem2Config(e.CurrentMO.ItemCode); //DataProvider.BeginTransaction(); try { if (configInfos == null || itemChecks == null) { throw new Exception("$CS_CONFIG_NOT_EXIST"); } int iPass = 0; foreach (Domain.DataCollect.ConfigInfo ci in configInfos) { dcf.DeleteConfigInfo(ci); foreach (Domain.MOModel.Item2Config ic in itemChecks) { if (ic.NeedCheck == "1" && ic.ConfigCode == ci.CheckItemCode && ic.ParentCode == ci.CatergoryCode) { if (ic.ConfigValue != ci.CheckItemVlaue) { Domain.DataCollect.OnWipConfigCollect onwipConfigCollect = new BenQGuru.eMES.Domain.DataCollect.OnWipConfigCollect(); onwipConfigCollect.PKID = System.Guid.NewGuid().ToString(); onwipConfigCollect.RunningCard = e.ProductInfo.NowSimulation.RunningCard; onwipConfigCollect.RunningCardSequence = e.ProductInfo.NowSimulation.RunningCardSequence; onwipConfigCollect.ItemCode = e.CurrentMO.ItemCode; onwipConfigCollect.MoCode = e.CurrentMO.MOCode; onwipConfigCollect.ModelCode = e.ProductInfo.NowSimulation.ModelCode; onwipConfigCollect.SegmnetCode = e.ProductInfo.NowSimulationReport.SegmentCode; onwipConfigCollect.RouteCode = e.ProductInfo.NowSimulation.RouteCode; onwipConfigCollect.StepSequenceCode = e.ProductInfo.NowSimulationReport.StepSequenceCode; onwipConfigCollect.OPCode = e.ProductInfo.NowSimulation.OPCode; onwipConfigCollect.ResourceCode = e.ProductInfo.NowSimulation.ResourceCode; onwipConfigCollect.ShiftTypeCode = e.ProductInfo.NowSimulationReport.ShiftTypeCode; onwipConfigCollect.ShiftCode = e.ProductInfo.NowSimulationReport.ShiftCode; onwipConfigCollect.TimePeriodCode = e.ProductInfo.NowSimulationReport.TimePeriodCode; onwipConfigCollect.MaintainUser = e.ProductInfo.NowSimulation.MaintainUser; onwipConfigCollect.MaintainDate = e.ProductInfo.NowSimulation.MaintainDate; onwipConfigCollect.MaintainTime = e.ProductInfo.NowSimulation.MaintainTime; onwipConfigCollect.EAttribute1 = e.ProductInfo.NowSimulation.EAttribute1; onwipConfigCollect.ActValue = ci.CheckItemVlaue; onwipConfigCollect.CheckItemVlaue = ic.ConfigValue; onwipConfigCollect.ItemConfig = ic.ItemConfigration; onwipConfigCollect.CatergoryCode = ci.CatergoryCode; onwipConfigCollect.ParentCode = ic.ParentCode; onwipConfigCollect.CheckItemCode = ci.CheckItemCode; dcf.AddOnWipConfigCollect(onwipConfigCollect); msg.Add(new UserControl.Message(MessageType.Error, "$CS_CONFIG_CHECK_FAILURE " + ic.ConfigName + "=" + ic.ConfigValue + " $CS_Param_Action=" + ci.CheckItemVlaue)); } else { iPass++; } } } } //DataProvider.CommitTransaction(); if (msg.IsSuccess() && iPass != 0) { msg.Add(new UserControl.Message(MessageType.Success, "$CS_CONFIG_CHECK_SUCCESS $CS_CONFIG_CHECK_COUNT =" + iPass.ToString())); } } catch (Exception E) { msg.Add(new UserControl.Message(E)); //DataProvider.RollbackTransaction(); } // finally // { // ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); // } //Domain.MOModel.Item2Config[] configInfos = mfc.getitem(e.RunningCard); //Domain.MOModel.Item2Config[] itemConfigs = dcf.ge // ve.PKID = System.Guid.NewGuid().ToString(); // ve.MoVersionInfo = e.CurrentMO.MOBIOSVersion; // ve.Mocode = e.CurrentMO.MOCode; // ve.Rcard = e.RunningCard; // ve.VersionInfo = strVer; // ve.MDate = FormatHelper.TODateInt(DateTime.Now); // ve.MTime = FormatHelper.TOTimeInt(DateTime.Now); // ve.MUser = e.UserCode; // // DataProvider.BeginTransaction(); // try // { // dcf.AddVersionError(ve); // dcf.DeleteVersionCollect(vc as Domain.DataCollect.VersionCollect); // // DataProvider.CommitTransaction(); // } // catch(Exception E) // { // msg.Add(new UserControl.Message(E)); // DataProvider.RollbackTransaction(); // } // finally // { // ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); // } // } return(msg); }
protected override void ImportData(Excel.Worksheet sheet, string[] strHeader) { DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(ApplicationService.DataProvider); ImportDataEngine impEng = new ImportDataEngine(ApplicationService.DataProvider, this.configObjList, this.configMatchType, ApplicationService.LoginUserCode, dbDateTime); impEng.ImportDataMapping = Properties.Settings.Default.DataMappingType; impEng.UpdateRepeatData = Properties.Settings.Default.DataRepeat; ApplicationService.DataProvider.BeginTransaction(); try { int iRow = 2; int iImportedCount = 0; while (true) { string[] strRow = ReadExcelRow(sheet, iRow, strHeader.Length); if (strRow == null) { break; } // 导入产品 try { // 产品途程主资料 BenQGuru.eMES.MOModel.MOFacade moFacade = new BenQGuru.eMES.MOModel.MOFacade(ApplicationService.DataProvider); BenQGuru.eMES.MOModel.ItemFacade itemFacade = new BenQGuru.eMES.MOModel.ItemFacade(ApplicationService.DataProvider); BenQGuru.eMES.Domain.MOModel.Item2Route itemRoute = new BenQGuru.eMES.Domain.MOModel.Item2Route(); itemRoute.ItemCode = strRow[0].Trim().ToUpper(); itemRoute.RouteCode = strRow[1].Trim().ToUpper(); itemRoute.OrganizationID = int.Parse(strRow[2].Trim().ToUpper()); itemRoute.IsReference = "0"; itemRoute.MaintainUser = ApplicationService.LoginUserCode; itemRoute.MaintainDate = dbDateTime.DBDate; itemRoute.MaintainTime = dbDateTime.DBTime; object ir = itemFacade.GetItem2Route(itemRoute.ItemCode, itemRoute.RouteCode, itemRoute.OrganizationID.ToString()); if (ir == null) { ApplicationService.DataProvider.Insert(itemRoute); } else { ApplicationService.DataProvider.Update(itemRoute); } // 产品默认途程 BenQGuru.eMES.Domain.MOModel.DefaultItem2Route defRoute = null; BenQGuru.eMES.Domain.MOModel.DefaultItem2Route dr = moFacade.GetDefaultItem2Route(itemRoute.ItemCode) as BenQGuru.eMES.Domain.MOModel.DefaultItem2Route; if (dr != null) { defRoute = dr; } else { defRoute = new BenQGuru.eMES.Domain.MOModel.DefaultItem2Route(); } defRoute.ItemCode = itemRoute.ItemCode; if (strRow[3].Trim().ToUpper() == "YES") { defRoute.RouteCode = itemRoute.RouteCode; } if (defRoute.RouteCode != null && defRoute.RouteCode != "") { defRoute.MDate = dbDateTime.DBDate; defRoute.MTime = dbDateTime.DBTime; if (dr == null) { ApplicationService.DataProvider.Insert(defRoute); } else { ApplicationService.DataProvider.Update(defRoute); } } // 产品途程工序列表 //将原来的删除 string strSql = string.Format("delete tblitemroute2op where itemcode = '{0}' and routecode='{1}' and orgid = {2}", itemRoute.ItemCode, itemRoute.RouteCode, itemRoute.OrganizationID.ToString()); ApplicationService.DataProvider.CustomExecute(new SQLCondition(strSql)); strSql = "insert into tblitemroute2op (opid,routecode,opcode,opseq,opcontrol,idmergetype,idmergerule,muser,mdate,mtime,itemcode,orgid) "; strSql += "select routecode||opcode||'{0}',routecode,opcode,opseq,opcontrol,'idmergetype_idmerge',1,muser,mdate,mtime,'{0}',{2} "; strSql += "from tblroute2op where routecode='{1}' "; strSql = string.Format(strSql, itemRoute.ItemCode, itemRoute.RouteCode, itemRoute.OrganizationID.ToString()); ApplicationService.DataProvider.CustomExecute(new SQLCondition(strSql)); iImportedCount++; } catch (Exception ex) { string strResult = ex.Message; if (strResult == "$DATA_REPEAT_CANCEL") // 如果是重复数据,并设置终止 { throw new Exception(strResult); } else if (strResult != "$Import_Unique_Data_Exist") // $Import_Unique_Data_Exist表示重复数据,设置忽略 { if (Properties.Settings.Default.DataError == ImportDataEngine.OnErrorDeal.Cancel) { throw new Exception(strResult); } } } iRow++; } ApplicationService.DataProvider.CommitTransaction(); MessageBox.Show(UserControl.MutiLanguages.ParserMessage("$CycleImport_Success [" + iImportedCount.ToString() + "]"), this.MainForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { ApplicationService.DataProvider.RollbackTransaction(); MessageBox.Show(UserControl.MutiLanguages.ParserMessage(ex.Message), this.MainForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop); } }