//public CRLConveryControl(string ip) //{ // _ip = ip; // mPLC = new RWLOPCServerl(_ip); //} //public bool InitOPCData(DataSet ds) //{ // if (ds != null) // { // DataTable dt = ds.Tables[0]; // for (int i = 0; i < dt.Rows.Count; i++) // { // if (dt.Rows[i]["userid"].ToString() == _ip) // { // if (dt.Rows[i]["groupname"].ToString() == "Convery") // { // CRLStationInfo si = new CRLStationInfo(); // si.stationno = int.Parse(dt.Rows[i]["stationno"].ToString()); // si.stationtype = int.Parse(dt.Rows[i]["stationtype"].ToString()); // si.LocationX = int.Parse(dt.Rows[i]["field1"].ToString()); // si.LocationY = int.Parse(dt.Rows[i]["field2"].ToString()); // si.Width = SplitWidth(dt.Rows[i]["remark"].ToString())[0]; // si.Height = SplitWidth(dt.Rows[i]["remark"].ToString())[1]; // si.value = int.Parse(dt.Rows[i]["value"].ToString()); // si.config = dt.Rows[i]["field3"].ToString(); // StationInfo.Add(si); // CRLOPCItem findco = ItemInfo.Find( // delegate(CRLOPCItem ii) // { // return ii.groupname == "Convery"; // } // ); // if (findco == null) // { // CRLOPCItem coi = new CRLOPCItem(); // coi.groupname = dt.Rows[i]["groupname"].ToString(); // coi.ipaddress = dt.Rows[i]["userid"].ToString(); // coi.DBAddress = int.Parse(dt.Rows[i]["objects"].ToString()); // coi.start = int.Parse(dt.Rows[i]["value"].ToString()); // coi.length = int.Parse(dt.Rows[i]["signaltype"].ToString()); // ItemInfo.Add(coi); // } // else // findco.length += 20;//leo 30 to 20 // } // else // { // CRLOPCItem co = new CRLOPCItem(); // co.groupname = dt.Rows[i]["groupname"].ToString(); // co.ipaddress = dt.Rows[i]["userid"].ToString(); // co.DBAddress = int.Parse(dt.Rows[i]["objects"].ToString()); // co.start = int.Parse(dt.Rows[i]["value"].ToString()); // co.length = int.Parse(dt.Rows[i]["stationno"].ToString()); // ItemInfo.Add(co); // } // } // } // return true; // } // return false; //} public bool InitOPCData(DataSet ds) { if (ds != null) { DataTable dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { _ip = dt.Rows[i]["userid"].ToString(); if (!PLCList.ContainsKey(_ip)) { PLCList.Add(_ip, new RWLOPCServerl(_ip)); PLCFlag.Add(_ip, false); PLCList[_ip].Connect(); } switch (dt.Rows[i]["groupname"].ToString()) { case "Convery": ConveryInit(dt.Rows[i]); break; //case "OutPick": OutPickInit(dt.Rows[i]); break; //case "InPick": InPickInit(dt.Rows[i]); break; default: OtherInit(dt.Rows[i]); break; } //if (dt.Rows[i]["groupname"].ToString() == "Convery") //{ // CRLOPCItem findco = ItemInfo.Find( // delegate(CRLOPCItem ii) // { // return ii.groupname == "Convery"; // } // ); // if (findco == null) // { // CRLOPCItem coi = new CRLOPCItem(); // coi.groupname = dt.Rows[i]["groupname"].ToString(); // coi.ipaddress = dt.Rows[i]["userid"].ToString(); // coi.DBAddress = int.Parse(dt.Rows[i]["objects"].ToString()); // coi.start = int.Parse(dt.Rows[i]["value"].ToString()); // coi.length = int.Parse(dt.Rows[i]["signaltype"].ToString()); // ItemInfo.Add(coi); // } // else // findco.length += 20;//leo 30 to 20 //} //else //{ // CRLOPCItem co = new CRLOPCItem(); // co.groupname = dt.Rows[i]["groupname"].ToString(); // co.ipaddress = dt.Rows[i]["userid"].ToString(); // co.DBAddress = int.Parse(dt.Rows[i]["objects"].ToString()); // co.start = int.Parse(dt.Rows[i]["value"].ToString()); // co.length = int.Parse(dt.Rows[i]["stationno"].ToString()); // ItemInfo.Add(co); //} } return(true); } return(false); }
/// <summary> /// 初始化输送机对应参数 /// </summary> /// <returns></returns> public bool TransDeviceInit() { DataSet ds = DataTrans.D_GetDeviceSSJ(); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //获取设备编号第一个字母,用于与绑定IP地址 _SSJDhead = ds.Tables[0].Rows[i]["VAR1"].ToString().Substring(0, 1); string _ip = ConfigurationManager.AppSettings[_SSJDhead].ToString(); //需要改进,将端口,DB块,端口等也进行构造函数初始化l if (!PLCList.ContainsKey(_SSJDhead)) { PLCList.Add(_SSJDhead, new RWLOPCServerl(_ip)); PLCFlag.Add(_SSJDhead, false); PLCList[_SSJDhead].Connect(); } if (!HsPLCList.ContainsKey(_SSJDhead)) { HsPLCList.Add(_SSJDhead, new HsControlServer(_ip)); bool flag = HsPLCList[_SSJDhead].HsServerConnect(); string res = flag ? "成功" : "失败"; NotifyEvent?.Invoke($"PLC{_ip}连接{res}"); } TransportStr tp = new TransportStr(); tp.SSJID = ds.Tables[0].Rows[i]["SSJID"].ToString(); tp.BTID = ds.Tables[0].Rows[i]["BTID"].ToString(); tp.DTYPE = ds.Tables[0].Rows[i]["DTYPE"].ToString(); tp.ZXRWH = ds.Tables[0].Rows[i]["ZXRWH"].ToString(); tp.DWXH = ds.Tables[0].Rows[i]["DWXH"].ToString(); tp.KXBZ = ds.Tables[0].Rows[i]["KXBZ"].ToString(); tp.TRAYCODE = ds.Tables[0].Rows[i]["TRAYCODE"].ToString(); tp.JYM = ds.Tables[0].Rows[i]["JYM"].ToString(); tp.BFLAG = ds.Tables[0].Rows[i]["BFLAG"].ToString(); tp.ALLEYID = ds.Tables[0].Rows[i]["ALLEYID"].ToString(); //tp.ALLEYID = ""; tp.VAR1 = ds.Tables[0].Rows[i]["VAR1"].ToString(); tp.VAR2 = ds.Tables[0].Rows[i]["VAR2"].ToString(); tp.VAR3 = ds.Tables[0].Rows[i]["VAR3"].ToString(); tp.VAR4 = ds.Tables[0].Rows[i]["VAR4"].ToString(); tp.VAR5 = ds.Tables[0].Rows[i]["VAR5"].ToString(); tp.SSRWLX = ds.Tables[0].Rows[i]["SSRWLX"].ToString(); tp.SSJIDhead = _SSJDhead; lsTransport.Add(tp); } return(true); } return(false); }
private void AddRegion(HyperCatalog.Business.Region region, PLCList plcDates, int offSet) { Trace.Write("Enter Add Region [" + region.Code + "]"); //Fix for eZilla #70617 ( GEMSTONE: WW & NA PLC dates are not visible in UI) - Prabhu PLC p = new PLC(); p.CountryCode = region.Code; #region identify if region is in Item PLC list if (plcDates != null) { foreach (PLC plc in plcDates) { if (plc.CountryCode == region.Code2) { p = plc; break; } } } #endregion //UltraGridRow newRow = new UltraGridRow(new object[] { "", region.Code + " - " + region.Name, "", null, null, null, null, null, "R", region.Code, region.ParentCode, offSet }); UltraGridRow newRow = new UltraGridRow(new object[] { "", region.Code + " - " + region.Name, "", p.BlindDate, p.FullDate, p.ObsoleteDate, p.AnnouncementDate, p.RemovalDate, "R", region.Code, region.ParentCode, offSet, "", p.BlindLocked, p.FullLocked, p.ObsoleteLocked, p.AnnouncementLocked, p.RemovalLocked, p.EndOfSupportLocked, p.DiscontinueLocked, p.EndOfLifeLocked, p.BlindDateType, p.FullDateType, p.ObsoleteDateType, p.AnnouncementDateType, p.RemovalDateType, p.EndOfSupportDateType, p.DiscontinueDateType, p.EndOfLifeDateType, p.Excluded, p.ExcludeModifierId, p.EndOfSupportDate, p.DiscontinueDate, p.EndOfLifeDate }); //Fix for eZilla #70617 ( GEMSTONE: WW & NA PLC dates are not visible in UI) - Prabhu dg.Rows.Add(newRow); rowCount++; newRow.Cells.FromKey("Region").Style.Padding.Left = Unit.Parse((offSet * 5).ToString() + "px"); newRow.Cells.FromKey("Region").Style.CssClass = "hc_region"; newRow.DataKey = region.Code; #region Add extra button at the end of the row newRow.Cells.FromKey("ApplyChilds").Text = "<IMG title='Clear all sub countries' src='/hc_v4/img/recursive.gif' onclick='CSC(\"" + dg.ClientID + "\", " + newRow.Index.ToString() + ");' BORDER=0 VALIGN=MIDDLE BORDER=0 STYLE='cursor:hand'></IMG>"; #endregion AddCountrieRows(region.Countries, plcDates, offSet + 1); foreach (HyperCatalog.Business.Region subRegion in region.SubRegions) { //Fix for eZilla #70617 ( GEMSTONE: WW & NA PLC dates are not visible in UI) - Prabhu if (subRegion.SubRegions.Count > 0 || subRegion.Countries.Count > 0 || Item.NodeOID > 0) { AddRegion(subRegion, plcDates, offSet + 1); } } Trace.Write("Exit Add Region [" + region.Code + "]"); }
private void AddCountrieRows(HyperCatalog.Business.CountryList countries, PLCList plcDates, int offSet) { if (countries == null) { return; } foreach (Country country in countries) { Trace.Write(" CountryCode = " + country.Code); UltraGridRow newRow; /*DateTime? blind=null, full=null, obsolete=null, announce=null, remove=null; * bool blindLocked = false, fullLocked = false, obsoleteLocked = false, announceLocked = false, removeLocked = false; * */ PLC p = new PLC(); p.CountryCode = country.Code; #region identify if country is in Item PLC list if (plcDates != null) { foreach (PLC plc in plcDates) { if (plc.CountryCode == country.Code) { p = plc; break; } } } #endregion newRow = new UltraGridRow(new object[] { "", country.Code + " - " + country.Name, "", p.BlindDate, p.FullDate, p.ObsoleteDate, p.AnnouncementDate, p.RemovalDate, "C", country.Code, country.RegionCode, offSet, "", p.BlindLocked, p.FullLocked, p.ObsoleteLocked, p.AnnouncementLocked, p.RemovalLocked, p.EndOfSupportLocked, p.DiscontinueLocked, p.EndOfLifeLocked, p.BlindDateType, p.FullDateType, p.ObsoleteDateType, p.AnnouncementDateType, p.RemovalDateType, p.EndOfSupportDateType, p.DiscontinueDateType, p.EndOfLifeDateType, p.Excluded, p.ExcludeModifierId, p.EndOfSupportDate, p.DiscontinueDate, p.EndOfLifeDate }); dg.Rows.Add(newRow); #region formatting dg.Rows[dg.Rows.Count - 1].Cells.FromKey("Blind").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("PID").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("POD").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("Announcement").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("Removal").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("EndOfSupport").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("Discontinue").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("EndOfLife").Column.Format = SessionState.User.FormatDate; #endregion rowCount++; newRow.Cells.FromKey("Region").Text = "<img src='/hc_v4/img/flags/" + country.Code + ".gif' border=0 valign='middle'/> " + newRow.Cells.FromKey("Region").Text; newRow.Cells.FromKey("Region").Style.Padding.Left = Unit.Parse((offSet * 5).ToString() + "px"); newRow.Cells.FromKey("Region").Style.CustomRules = "class='hc_country'"; newRow.Cells.FromKey("ApplyChilds").Text = "<IMG title='Clear this line' src='/hc_v4/img/clear.gif' onclick='CC(\"" + dg.ClientID + "\", " + newRow.Index.ToString() + ");' BORDER=0 VALIGN=MIDDLE BORDER=0 STYLE='cursor:hand'></IMG>"; // Consider Locks coming from country level //Trace.Write(country.Code + " - " + country.Name, "FULL Locked = " + p.FullLocked.ToString()); //newRow.Cells.FromKey("Blind").AllowEditing = (p.BlindLocked || p.IsMinimized || p.IsFrozen) ? AllowEditing.No : AllowEditing.Yes; //newRow.Cells.FromKey("Blind").Style.CssClass = (p.BlindLocked || p.IsMinimized || p.IsFrozen) ? "ro" : ""; //newRow.Cells.FromKey("PID").AllowEditing = (p.FullLocked || p.IsMinimized || p.IsFrozen) ? AllowEditing.No : AllowEditing.Yes; //newRow.Cells.FromKey("PID").Style.CssClass = (p.FullLocked || p.IsMinimized || p.IsFrozen) ? "ro" : ""; //newRow.Cells.FromKey("POD").AllowEditing = (p.ObsoleteLocked || p.IsMinimized) ? AllowEditing.No : AllowEditing.Yes; //newRow.Cells.FromKey("POD").Style.CssClass = (p.ObsoleteLocked || p.IsMinimized) ? "ro" : ""; //newRow.Cells.FromKey("Announcement").AllowEditing = (p.AnnouncementLocked || p.IsMinimized || p.IsFrozen) ? AllowEditing.No : AllowEditing.Yes; //newRow.Cells.FromKey("Announcement").Style.CssClass = (p.AnnouncementLocked || p.IsMinimized || p.IsFrozen) ? "ro" : ""; //newRow.Cells.FromKey("Removal").AllowEditing = (p.RemovalLocked || p.IsMinimized) ? AllowEditing.No : AllowEditing.Yes; //newRow.Cells.FromKey("Removal").Style.CssClass = (p.RemovalLocked || p.IsMinimized) ? "ro" : ""; // Changes for CR 4516 - Prabhu Trace.Write(country.Code + " - " + country.Name, "FULL Locked = " + p.FullLocked.ToString()); newRow.Cells.FromKey("Blind").AllowEditing = (p.BlindLocked) ? AllowEditing.No : AllowEditing.Yes; newRow.Cells.FromKey("Blind").Style.CssClass = (p.BlindLocked) ? "ro" : ""; newRow.Cells.FromKey("PID").AllowEditing = (p.FullLocked) ? AllowEditing.No : AllowEditing.Yes; newRow.Cells.FromKey("PID").Style.CssClass = (p.FullLocked) ? "ro" : ""; newRow.Cells.FromKey("POD").AllowEditing = (p.ObsoleteLocked) ? AllowEditing.No : AllowEditing.Yes; newRow.Cells.FromKey("POD").Style.CssClass = (p.ObsoleteLocked) ? "ro" : ""; newRow.Cells.FromKey("Announcement").AllowEditing = (p.AnnouncementLocked) ? AllowEditing.No : AllowEditing.Yes; newRow.Cells.FromKey("Announcement").Style.CssClass = (p.AnnouncementLocked) ? "ro" : ""; newRow.Cells.FromKey("Removal").AllowEditing = (p.RemovalLocked) ? AllowEditing.No : AllowEditing.Yes; newRow.Cells.FromKey("Removal").Style.CssClass = (p.RemovalLocked) ? "ro" : ""; newRow.DataKey = country.Code; } }
public void LoadPLCGrid() { Trace.Write("Enter LoadPLCGrid"); dg.Rows.Clear(); rowCount = 0; using (PLCList plc = Item != null ? Item.PLCDates : null) { if (SessionState.Culture.Type == CultureType.Locale) { // Country using (CountryList countries = new CountryList()) { countries.Add(SessionState.Culture.Country); AddCountrieRows(countries, plc, 0); } } else { // Region or master region using (HyperCatalog.Business.Region rootRegion = HyperCatalog.Business.Region.GetByShortCode(SessionState.Culture.CountryCode)) { AddRegion(rootRegion, plc, 0); } } Utils.InitGridSort(ref dg, false); if (rowCount > 0) { if (rowCount == 1) { // Add empty row UltraGridRow newRow = new UltraGridRow(new object[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }); dg.Rows.Add(newRow); newRow.Cells.FromKey("Region").AllowEditing = AllowEditing.No; newRow.Cells.FromKey("Region").Style.CssClass = "ro"; newRow.Cells.FromKey("Blind").AllowEditing = AllowEditing.No; newRow.Cells.FromKey("Blind").Style.CssClass = "ro"; newRow.Cells.FromKey("PID").AllowEditing = AllowEditing.No; newRow.Cells.FromKey("PID").Style.CssClass = "ro"; newRow.Cells.FromKey("POD").AllowEditing = AllowEditing.No; newRow.Cells.FromKey("POD").Style.CssClass = "ro"; newRow.Cells.FromKey("Announcement").AllowEditing = AllowEditing.No; newRow.Cells.FromKey("Announcement").Style.CssClass = "ro"; newRow.Cells.FromKey("Removal").AllowEditing = AllowEditing.No; newRow.Cells.FromKey("Removal").Style.CssClass = "ro"; rowCount++; } int height = (rowCount + 1) * 20; // (nb rows + header) if (height < 300) { dg.Height = Unit.Pixel(height); } } dg.DisplayLayout.CellClickActionDefault = CellClickAction.Edit; dg.DisplayLayout.AllowSortingDefault = AllowSorting.No; dg.DisplayLayout.UseFixedHeaders = true; dg.Columns.FromKey("ApplyChilds").Header.Fixed = true; dg.Columns.FromKey("Region").Header.Fixed = true; //Commented for fix QC 7304: Crystal UAT - In the Product Life Cycle section Delete functionality still available //dg.Columns.FromKey("ApplyChilds").Hidden = !SessionState.User.HasCapability(CapabilitiesEnum.MANAGE_PLC); dg.Columns.FromKey("ApplyChilds").Hidden = true; Trace.Write("Exit LoadPLCGrid"); } }