/// <summary> /// 打印 /// <param name="tabletitle">表头</param> /// <param name="table">打印内容</param> /// <param name="tf">设置打印横向还是纵向</param> /// <param name="title">打印文件的标题</param> /// <param name="add">附加打印内容1</param> /// <param name="add1">附加打印内容2</param> /// <param name="add2">附加打印内容3</param> /// </summary> public static void Print(List <string> tabletitle, List <List <string> > table, bool tf, string title, string add, string add1, string add2) { try { System.Windows.Forms.PrintDialog pd = new System.Windows.Forms.PrintDialog(); pd.AllowSomePages = true; var doc = CreatePrintDocument(tabletitle, table, tf, title, add, add1, add2); if (doc == null) { var information = WlstMessageBox.Show ("打印提示", "打印超过10张,请重新筛选数据后打印!", WlstMessageBoxType.Ok); return; } pd.Document = doc; if (pd.ShowDialog() == DialogResult.OK) { doc.Print(); //CreatePrintDocument(tabletitle, table, tf, title, add, add1, add2).Print(); } } catch (Exception ex) { MessageBox.Show("打印错误,请检查打印设置!"); } }
private void Button_Click(object sender, RoutedEventArgs e) { var tmp = this.DataContext as FrmSelectTimeTableViewModel; if (tmp == null) { return; } if (OnFormBtnOkClick != null) { if (Wlst.Cr.CoreMims.Services.UserInfo.UserLoginInfo.AreaW.Contains(AreaId) || Wlst.Cr.CoreMims.Services.UserInfo.UserLoginInfo.D) { OnFormBtnOkClick(this, new EventArgsFrmSelectTimeTable(tmp)); this.Close(); } else { var infoss = WlstMessageBox.Show("警告", "您没有权限修改该分组或终端时间表!是否退出?", WlstMessageBoxType.YesNo); if (infoss != WlstMessageBoxResults.Yes) { OnFormBtnOkClick(this, new EventArgsFrmSelectTimeTable(null)); this.Close(); } } } }
private void Button_Click_2(object sender, RoutedEventArgs e) { List <int> SumYears = new List <int>(); int Sum = 0; int SumDay = 0; for (DateTime day = new DateTime(DateTime.Now.Year, 1, 1); day <= new DateTime(DateTime.Now.Year, 12, 31); day = day.AddDays(1)) { var info = Wlst.Sr.TimeTableSystem.Services.SunRiseSetInfoServices.GetSunRiseItemInfo(day.Month, day.Day); if (info != null) { Sum = Sum + info.time_sunrise + (1440 - info.time_sunset); SumDay = SumDay + 1; } } int Sum366 = 0; var day229 = Wlst.Sr.TimeTableSystem.Services.SunRiseSetInfoServices.GetSunRiseItemInfo(2, 29); int Sum365 = 0; string year366 = ""; string year365 = ""; if (SumDay == 365) { Sum366 = Sum + (day229.time_sunrise + (1440 - day229.time_sunset)); Sum365 = Sum; year366 = "如果"; year365 = "今年"; } else if (SumDay == 366) { Sum365 = Sum - (day229.time_sunrise + (1440 - day229.time_sunset)); Sum366 = Sum; year365 = "如果"; year366 = "今年"; } string strSum366 = (Sum366 / 60).ToString("D2") + "小时" + (Sum366 % 60).ToString("D2") + "分钟"; string strSum365 = (Sum365 / 60).ToString("D2") + "小时" + (Sum365 % 60).ToString("D2") + "分钟"; int Sum366to1 = Sum366 / 366; int Sum365to1 = Sum365 / 365; string strSum366to1 = (Sum366to1 / 60).ToString("D2") + "小时" + (Sum366to1 % 60).ToString("D2") + "分钟"; string strSum365to1 = (Sum365to1 / 60).ToString("D2") + "小时" + (Sum365to1 % 60).ToString("D2") + "分钟"; string strline = "开灯时长:日落时刻 至 日出时刻的时长" + "。 \n"; string str = strline + year366 + "有366天" + " \n" + "则总全夜时长为:" + Sum366 + "分钟,即" + strSum366 + "; \n" + "平均每天全夜时长为:" + Sum366to1 + "分钟,即" + strSum366to1 + "。 \n" + year365 + "有365天" + " \n" + "则总全夜时长为:" + Sum365 + "分钟,即" + strSum365 + "; \n" + "平均每天全夜时长为:" + Sum365to1 + "分钟,即" + strSum365to1 + "。"; if (year365 == "今年") { str = strline + year365 + "有365天" + " \n" + "则总全夜时长为:" + Sum365 + "分钟,即" + strSum365 + "; \n" + "平均每天全夜时长为:" + Sum365to1 + "分钟,即" + strSum365to1 + "。 \n" + year366 + "有366天" + " \n" + "则总全夜时长为:" + Sum366 + "分钟,即" + strSum366 + "; \n" + "平均每天全夜时长为:" + Sum366to1 + "分钟,即" + strSum366to1 + "。"; } WlstMessageBox.Show("统计开灯时长", str, WlstMessageBoxType.Ok); }
private void ExBtnSaveAndSnd() { _dtSaveAndSnd = DateTime.Now; var ins = BackViewModelToTerminalInformation(); if (ins == null) { return; } foreach ( var tt in Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems ) { if (tt.Value.RtuModel == EnumRtuModel.Wj9001 && tt.Value.RtuFid == ins.RtuFid && tt.Value.RtuFid != 0 && tt.Value.RtuId != ins.RtuId) { if (tt.Value.RtuPhyId == ins.RtuPhyId) { WlstMessageBox.Show("无法保存", "该设备物理地址重复!", WlstMessageBoxType.Ok); break; } } } Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.UpdateEquipmentInfo(ins); Remind = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " --" + "保存命令已发送..."; }
/// <summary> /// 显示集中器列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { if (Model != null) { if (Model.HaveSlu() == false) { WlstMessageBox.Show("方案设置有遗漏,请完善该方案", "该区域没有可用的集中器与控制器...", WlstMessageBoxType.Ok); return; } } var fawi = father.ActualWidth; var TwoWidth = Two.ActualWidth > 980 ? Two.ActualWidth : 980; // TwoWidth = Two.DesiredSize.Width > TwoWidth ? Two.DesiredSize.Width : TwoWidth; var OneWidth = One.ActualWidth > 910 ? One.ActualWidth : 910; // OneWidth = One.DesiredSize.Width > OneWidth ? One.DesiredSize.Width : OneWidth; if (fawi > OneWidth + TwoWidth + 20) { One.Visibility = Visibility.Visible; Two.Visibility = Visibility.Visible; Two.Margin = new Thickness(OneWidth + 20, 0, 0, 0); Three.Visibility = Visibility.Collapsed; } else { One.Visibility = Visibility.Collapsed; Two.Visibility = Visibility.Visible; Two.Margin = new Thickness(10, 0, 0, 0); Three.Visibility = Visibility.Collapsed; } }
private void Label_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { var info = WlstMessageBox.Show("确认", "是否解除屏蔽报警!", WlstMessageBoxType.YesNo); if (info == WlstMessageBoxResults.Yes) { SndDeleteAlarmTime(); } }
private void treeListView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var listView = sender as Telerik.Windows.Controls.RadGridView; if (listView == null) { return; } var ggg = listView.CurrentCellInfo; var mvvm = ggg.Item as OneGrpOrRtuLoopsSet; if (mvvm == null) { return; } var cellIndex = ggg.Column.DisplayIndex; var nodeId = mvvm.RtuOrGrpId; if (nodeId == 0) { return; // special terminal } if (mvvm.Items.Count + 1 < cellIndex) { return; } int typeloop = 6; if (mvvm.Has3006 || (mvvm.Has3005 == false && mvvm.Has3006 == false)) { typeloop = 8; } if (cellIndex < 2) //2 is K1; { func(mvvm); } else if (cellIndex < typeloop + 2) { int timetable = mvvm.Items[cellIndex - 2].TimeTalbe; FrmGroupSelectTimeTableView frmGroupSelect = new FrmGroupSelectTimeTableView(); frmGroupSelect.Background = this.Background; frmGroupSelect.OnFormBtnOkClick += new EventHandler <EventArgsFrmSelectTimeTable>(frmGroupSelect_OnFormBtnOkClick); frmGroupSelect.SetDataContext(mvvm.RtuOrGrpId, mvvm.RtuOrGrpName, cellIndex - 1, timetable, mvvm.PhyId, Model.Items, mvvm.Has3005, mvvm.Has3006, mvvm.AreaId); frmGroupSelect.ShowDialog(); } else { WlstMessageBox.Show("警告", "该终端或分组不支持此回路设置!", WlstMessageBoxType.Ok); } }
public void FundEventHandlers(PublishEventArgs args) { try { if (args.EventType == PublishEventType.Core) { var recguid = args.GetParams()[1]; var rec = args.GetParams()[0] as List <Tuple <int, int> >; if (rec == null || rec.Count == 0) { return; } if (_sndguid == long.Parse(recguid.ToString())) { if ( WlstMessageBox.Show("上海五零盛同信息科技有限公司", "主设备增加成功,是否直接导航到配置界面进行设备参数设置", WlstMessageBoxType.YesNo) == WlstMessageBoxResults.Yes) { if (rec[0].Item1 > 1000000 && rec[0].Item1 < (1000000 + 99999)) { object[] parsObjects = new object[] { rec[0].Item1, "newAdd3005" }; RegionManage.ShowViewByIdAttachRegionWithArgu( CurrentSelectEquipmentMoudle.ModuleInfoSetViewId, parsObjects); } else { RegionManage.ShowViewByIdAttachRegionWithArgu( CurrentSelectEquipmentMoudle.ModuleInfoSetViewId, rec[0].Item1); } } } } if (args.EventType == "onuseraddslusgleequipment") { if (args.GetParams().Count < 1) { return; } long recguid = 0; if (Int64.TryParse(args.GetParams()[0].ToString(), out recguid)) { if (_sndguid == recguid) { WlstMessageBox.Show("上海五零盛同信息科技有限公司", "单灯设备增加成功!", WlstMessageBoxType.Ok); } } } } catch (Exception xe) { WriteLog.WriteLogError("AddEquitment error in FundEventHandlers:ex:" + xe); } }
private void Luxequipment2_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dt.CurrentSelectLux2.Id > 0) { var luxareaid = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuBelongArea(dt.CurrentSelectLux2.Id); //var luxareaid = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[value.Id].AreaId; if (flag == false && luxareaid != areaid) { string masg = ""; if (Wlst.Cr.CoreMims.Services.UserInfo.UserLoginInfo.D) { masg = "当前区域"; } else { foreach (var t in Wlst.Cr.CoreMims.Services.UserInfo.UserLoginInfo.AreaW) { if (luxareaid != t) { masg = "您所管理的区域"; } else { masg = "当前区域"; break; } } } var infoss = WlstMessageBox.Show("警告: " + dt.TimeId + "-" + dt.TimeName, "备用光控: " + dt.CurrentSelectLux2.Name + " 不属于" + masg + ", 是 继续,否 取消当前选择.", WlstMessageBoxType.YesNo); if (infoss == WlstMessageBoxResults.Yes) { return; } else { if (dt.LuxCollection2.Count > 0) { dt.CurrentSelectLux2 = dt.LuxCollection2[0]; } } dt.ShowCurrentSelectLux2 = 22; } } else { dt.ShowCurrentSelectLux2 = 0; } }
private void Button_Click(object sender, RoutedEventArgs e) { if (gridview5.Visibility == Visibility.Visible) { Wlst.Cr.CoreMims.ReportExcel.ExcelExport.ExcelExportWriteByRadGridView(gridview5); } else { WlstMessageBox.Show("警告", "导出失败!", WlstMessageBoxType.Ok); } }
//private void ellipse_MouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) //{ // AreaSet.AreaSeta info = new AreaSeta(); // // info.Show(); //} protected override void OnClosing(CancelEventArgs e) { var info = WlstMessageBox.Show("是否确定退出该应用程序?", WlstMessageBoxType.YesNo); if (info == WlstMessageBoxResults.No) { e.Cancel = true; return; } base.OnClosing(e); }
private void SndZcOrSndToSvr(int x) //todo { if (x < 1 || x > 14) { return; } // Msg = "snd x=" + x; if (x == 1) { var info = WlstMessageBox.Show("操作提示", "只能接一个硬件设备时才能设置地址", WlstMessageBoxType.YesNo); if (info != WlstMessageBoxResults.Yes) { return; } Remind = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " --" + "设置地址命令已发送..."; } if (x == 2)//todo { Remind = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " --" + "设置参数命令已发送..."; } if (x == 5) { Remind = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " --" + "设置时钟命令已发送..."; } if (x == 6) { Remind = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " --" + "复位命令已发送..."; } if (x == 12) { Remind = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " --" + "召测时钟命令已发送..."; } if (x == 13) { Remind = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " --" + "召测命令已发送..."; } var nt = Wlst.Sr.ProtocolPhone.LxLeak.wst_leak_order_zcOrSet; var order = new LeakOrders.LeakOrderItem(); order.Op = x; order.RtuId = RtuId; nt.WstLeakOrderZcOrSet.Item.Add(order); SndOrderServer.OrderSnd(nt); }
/// <summary> /// 完成集中器设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click_1(object sender, RoutedEventArgs e) { if (Model != null) { Model.OnUserSetOverSelectedSefDef(); var nts = Model.OnUserSetOverSlus(); if (nts == false) { WlstMessageBox.Show("方案设置有遗漏,请完善该方案", "未设置任何使用该方案的集中器与控制器...", WlstMessageBoxType.Ok); return; } } One.Visibility = Visibility.Visible; One.Margin = new Thickness(10, 0, 0, 0); Two.Visibility = Visibility.Collapsed; Three.Visibility = Visibility.Collapsed; }
private void Ex() { _datetime[1] = DateTime.Now; var infoss = WlstMessageBox.Show("确认保存", "即将保存信息,是 继续,否 退出.", WlstMessageBoxType.YesNo); if (infoss != WlstMessageBoxResults.Yes) { return; } _lstTmlbandingTimeTable.Clear(); foreach (var t in ChildTreeItems) { GetTmlbandingTimeTable(t); if (t.IsListTreeNodeGroup) { GetGrpbandingTimeTable(t); } } DeleteTmlBandingTimeTableSameData(); //todo update time if (_lstTmlbandingTimeTable.Count == 0) { return; } var lst = new List <TmlWeekTimeTaleBelongInfomation>(); foreach (var t in _lstTmlbandingTimeTable) { lst.Add(new TmlWeekTimeTaleBelongInfomation() { rtu_id = t.Item1, rtuLoopId = t.Item2, timeTableId = t.Item3 }); } dtSnd = DateTime.Now; Sr.TimeTableSystem.Services.TmlLoopBngTimeTableInfoService.UpdateTmlLoopBngTt(lst); Msg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 正在保存 ..."; }
private void gtx_Click(object sender, System.Windows.RoutedEventArgs e) { gtx.Visibility = Visibility.Collapsed; count = 0; try { int x = Convert.ToInt32(tbphy.Text); //lvf nb单灯删除 2018年5月28日13:57:37 if (x > 1700000 && x < 1800000) { Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.DeleteEquipment(x); return; } if (x > 0 && Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey( x)) { if (WlstMessageBox.Show("确认不可恢复删除", "删除设备,逻辑地址为:" + x + ",删除将不可恢复,请确认...", WlstMessageBoxType.YesNo) == WlstMessageBoxResults.Yes) { Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.DeleteEquipment(x); } } else { WlstMessageBox.Show("设备不存在", "您想删除的设备" + x + "不存在,请确认..."); } } catch (Exception ex) { } }
private void ExCmdDelete() { if (IsCheckedRules) { ExCmdDeleterule(); return; } var infoss = WlstMessageBox.Show("确认删除", "是否删除该自定义报警,是 继续删除,否 退出.", WlstMessageBoxType.YesNo); if (infoss != WlstMessageBoxResults.Yes) { return; } _dtDelete = DateTime.Now; if (CurrentSelectItem != null && this.Records.Contains(CurrentSelectItem)) { this.Records.Remove(CurrentSelectItem); } }
/// <summary> /// 打印预览 /// <param name="tabletitle">表头</param> /// <param name="table">打印内容</param> /// <param name="tf">设置打印横向还是纵向</param> /// <param name="title">打印文件的标题</param> /// <param name="add">附加打印内容1</param> /// <param name="add1">附加打印内容2</param> /// <param name="add2">附加打印内容3</param> /// </summary> public static void PrintPriview(List <string> tabletitle, List <List <string> > table, bool tf, string title, string add, string add1, string add2) { try { PrintPreviewDialog PrintPriview = new PrintPreviewDialog(); var doc = CreatePrintDocument(tabletitle, table, tf, title, add, add1, add2); if (doc == null) { var information = WlstMessageBox.Show ("打印提示", "打印超过10张,请重新筛选数据后打印!", WlstMessageBoxType.Ok); return; } PrintPriview.Document = doc;// CreatePrintDocument(tabletitle, table, tf, title, add, add1, add2); PrintPriview.WindowState = FormWindowState.Maximized; PrintPriview.ShowDialog(); } catch (Exception ex) { MessageBox.Show("打印错误,请检查打印设置!"); } }
private void DelCmdEx() { for (int i = this.ChildTreeItems.Count - 1; i >= 0; i--) { if (this.ChildTreeItems[i].IsSelected == true && this.ChildTreeItems[i].IsGroup == true) { //if (this.ChildTreeItems[i].ChildTreeItems.Count != 0) //{ var infoss = WlstMessageBox.Show("确认删除", "是否删除该分组,是 继续删除,否 退出.", WlstMessageBoxType.YesNo); if (infoss != WlstMessageBoxResults.Yes) { return; } this.ChildTreeItems.RemoveAt(i); //} //else //{ // this.ChildTreeItems.RemoveAt(i); //} } } ReLoadTmlsRelfectGrps(); }
private void RequestSystemInfo(string session, Wlst.mobile.MsgWithMobile infos) { var data = infos.SysRepSh; if (data.Op == 1) { if (updateflg) { WlstMessageBox.Show("提示", "设置信息更新成功。", WlstMessageBoxType.Ok); } updateflg = false; Idf = data.Idf.ToString(); ProjectDeAddr = data.Info1.ProjectDeAddr; ProjectName = data.Info1.ProjectName; PhoneThatProjectCat = data.Info1.PhoneThatProjectCat; DtSystemInstal = (new DateTime(data.Idf)).ToString("yyyy年MM月dd日"); TvCnt1 = data.Info1.TvCnt1; TvSvr = data.Info1.TvSvr; VerProCom4 = "v" + data.Info1.VerProCom4; VerProCnt5 = data.Info1.VerProCnt5; MiddleTime = new DateTime(data.Info1.DtMiddleStart); } }
/// <summary> /// 点击确认按钮,将修改后的数据即时加载到前一界面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click_1(object sender, RoutedEventArgs e) { _dt.SubOperationCount = _dt.OperationItems.Count; close1 = true; if (close1) { if (_dt.OperationItems.Count == 0) { var infoss = WlstMessageBox.Show("警告", "当前方案中未添加操作", WlstMessageBoxType.Ok); return; } if (_dt.SchemeName.Trim() == string.Empty) { var infoss = WlstMessageBox.Show("警告", "方案名称不能为空", WlstMessageBoxType.Ok); return; } if (_dt.TunnelName.Trim() == string.Empty) { var infoss = WlstMessageBox.Show("警告", "隧道名称不能为空", WlstMessageBoxType.Ok); return; } if (_dt.CurrentSelectLux.Id <= 0 && _dt.CurrentSelectLux2.Id > 0) { var infoss = WlstMessageBox.Show("警告", "未设置主光控时设置了备用光控!", WlstMessageBoxType.Ok); return; } if (_dt.CurrentSelectLux.Id <= 0 && _dt.IsLuxOrTime == 1) { var infoss = WlstMessageBox.Show("警告", "未选择主光控!", WlstMessageBoxType.Ok); return; } if (_dt.ProtectTime < 100 || _dt.ProtectTime > 500) { var infoss = WlstMessageBox.Show("警告", "保护时间超出范围,应在[100,500]之间!", WlstMessageBoxType.Ok); return; } foreach (var t in _dt.OperationItems) { if (t.OperationName.Trim() == string.Empty) { var infoss = WlstMessageBox.Show("警告", "方案名称不能为空", WlstMessageBoxType.Ok); return; } if (t.MaxLux < 0 || t.MaxLux > 10000) { var infoss = WlstMessageBox.Show("警告", "最大光控值超出范围,应在[0,10000]之间!", WlstMessageBoxType.Ok); return; } } if (_dt.IsLuxOrTime == 1) { bool flag = true; //假设不重复 for (int i = 0; i < _dt.OperationItems.Count - 1; i++) { //循环开始元素 for (int j = i + 1; j < _dt.OperationItems.Count; j++) { //循环后续所有元素 //如果相等,则重复 if (_dt.OperationItems[i].MaxLux == _dt.OperationItems[j].MaxLux) { flag = false; //设置标志变量为重复 break; //结束循环 } } } if (flag == false) { var infoss = WlstMessageBox.Show("警告", "最大光控值出现重复!", WlstMessageBoxType.Ok); return; } } if (_dt.IsLuxOrTime == 2) { bool flag1 = true; //假设不重复 for (int i = 0; i < _dt.OperationItems.Count - 1; i++) { //循环开始元素 for (int j = i + 1; j < _dt.OperationItems.Count; j++) { //循环后续所有元素 //如果相等,则重复 if (_dt.OperationItems[i].LastTimeHour == _dt.OperationItems[j].LastTimeHour && _dt.OperationItems[i].LastTimeMinute == _dt.OperationItems[j].LastTimeMinute) { flag1 = false; //设置标志变量为重复 break; //结束循环 } } } if (flag1 == false) { var infoss = WlstMessageBox.Show("警告", "最大操作时间出现重复!", WlstMessageBoxType.Ok); return; } } close = true; } if (close) { if (OnFormBtnOkClick != null) { OnFormBtnOkClick(this, new EventArgsAddTunnel(_dt)); } this.Close(); } }
private void ExAddNew() { if (CurrentSelectEquipmentMoudle == null) { return; } _dtAddNew = DateTime.Now; var mouduleKey = CurrentSelectEquipmentMoudle.ModuleKey; if (mouduleKey < 1) { //WlstMessageBox.Show(I36N.Services.I36N.ConvertByCoding("11040005"), // I36N.Services.I36N.ConvertByCoding("11040006"),WlstMessageBoxType.Ok); //UMessageBox.Show(I36N.Services.I36N.ConvertByCoding("11040005"), // I36N.Services.I36N.ConvertByCoding("11040006"), UMessageBoxButton.Ok); WlstMessageBox.Show("请选择主设备类型,必须一项!", "请选择", WlstMessageBoxType.Ok); return; } if (PhyId < 1) { //WlstMessageBox.Show(I36N.Services.I36N.ConvertByCoding("11040007"), // I36N.Services.I36N.ConvertByCoding("11040008"),WlstMessageBoxType.Ok); //UMessageBox.Show(I36N.Services.I36N.ConvertByCoding("11040007"), // I36N.Services.I36N.ConvertByCoding("11040008"), UMessageBoxButton.Ok); WlstMessageBox.Show("主设备地址不合法,请重新输入!", "错误", WlstMessageBoxType.Ok); return; } WjParaBase cons = null; var bolfind = false; int idstart = 0; if (mouduleKey == 3090 || mouduleKey == 3005 || mouduleKey == 3006 || mouduleKey == 6005) { idstart = 1000000; } else if (mouduleKey == 1080) { idstart = 1400000; } else if (mouduleKey == 2090) { idstart = 1500000; } foreach ( var t in Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems) { if (t.Key > idstart && t.Key < (idstart + 99999)) { if (t.Value.RtuPhyId == PhyId) { bolfind = true; cons = t.Value; break; } } } if (bolfind) { try { // UMessageBox.Show( I36N.Services.I36N.ConvertByCoding("11040009"),I36N.Services.I36N.ConvertByCoding("11040010", cons.RtuId, cons.RtuName, PhyId), //逻辑地址:" + cons.RtuId + ",名称:" + cons.RtuName + "已经使用该(" + PhyId + ")地址,请重新输入... // UMessageBoxButton.Ok); WlstMessageBox.Show("地址已存在", "逻辑地址:" + cons.RtuId + ",名称:" + cons.RtuName + "已经使用该(" + PhyId + ")地址,请重新输入...", WlstMessageBoxType.Ok); return; } catch (Exception ex) { WriteLog.WriteLogError("Error:" + ex); return; } } int mode = 0; try { mode = mouduleKey; } catch (Exception ex) { WriteLog.WriteLogError("Error:" + ex); } if (mode == 0) { // UMessageBox.Show(I36N.Services.I36N.ConvertByCoding("11040011"), // I36N.Services.I36N.ConvertByCoding("11040012"), UMessageBoxButton.Ok); WlstMessageBox.Show("设备型号转换出错......,请重新添加", "未知错误", WlstMessageBoxType.Ok); //WlstMessageBox.Show(I36N.Services.I36N.ConvertByCoding("11040011"), // I36N.Services.I36N.ConvertByCoding("11040012"),WlstMessageBoxType.Ok); return; } var infoss = WlstMessageBox.Show("确认增加", "即将增加设备,是 继续增加,否 退出.", WlstMessageBoxType.YesNo); if (infoss != WlstMessageBoxResults.Yes) { return; } //此处应该加上 设置成功与否的一个标志 增加失败提示 _sndguid = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.AddMainEquipment(PhyId, mode, AreaId, GrpId); }
private void Button_Click(object sender, RoutedEventArgs e) { if (dt.CurrentSelectLux.Name == null) { var newlst = new List <int>(); foreach (var t in dt.LuxCollection) { newlst.Add(t.Id); } foreach (var t in dt.LuxCollection2) { if (newlst.Contains(t.Id)) { newlst.Remove(t.Id); } } if (newlst.Count > 0) { foreach (var t in dt.LuxCollection) { if (t.Id == newlst.First()) { dt.CurrentSelectLux = t; continue; } } } } bool close = false; bool close1 = true; List <string> msag = new List <string>(); foreach (var t in Wlst.Sr.TimeTableSystem.Services.RtuOrGprBandingTimeTableInfoService.GetBangdingToThisTimeTablesTmls(areaid, dt.TimeId)) { if (t.Item1 > 999999) { var tmp = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t.Item1]; if (tmp.RtuModel == EnumRtuModel.Wj3005 || tmp.RtuModel == EnumRtuModel.Wj3090) { msag.Add("终端 " + t.Item1 + " " + Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[t.Item1].RtuName); } } else { var tu = new Tuple <int, int>(areaid, t.Item1); if (Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups.ContainsKey(tu)) { var tmp = Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups[tu]; foreach (var tt in tmp.LstTml) { if (Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems.ContainsKey(tt) == false) { continue; } var info = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[tt]; if (info != null) { if (info.RtuModel == EnumRtuModel.Wj3005 || info.RtuModel == EnumRtuModel.Wj3090) { msag.Add("分组 " + t.Item1 + " " + Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups[tu].GroupName); break; } } } } } } if (dt.MainIsOverOne[0] && msag.Count > 0 && Sr.EquipmentInfoHolding.Services.Others.IsOldUseTwoOpenLightSection == false) { string msg = ""; if (msag.Count == 1) { msg = msag[0]; } else if (msag.Count == 2) { msg = msag[0] + "," + msag[1]; } else if (msag.Count > 2) { msg = msag[0] + "," + msag[1]; } var information = WlstMessageBox.Show("无法保存", "该时间表为多段开关灯时间表," + msg + " 不支持多段开关灯功能,请解除绑定后再修改该时间表!", WlstMessageBoxType.Ok); close1 = false; } if (close1) { var dic = new Dictionary <int, List <int> >(); int max1 = 1; //int LightOpenCloseProtect = 5; for (int i = 0; i < 3; i++) { if (dt.MainIsOverOne[i]) { max1 = max1 + 1; } } if (dt.RuleItems.Count == 7 * max1) { var lst = new List <int>(); //光控开,开,光控关,关 //var ruleitemslistorder = // (from t in dt.RuleItems orderby t.DayOfWeekUsed , t.TimeOn select t).ToList(); var ruleitemslistorder = (from t in dt.RuleItems orderby t.DayOfWeekUsed, t.TimetableSectionId select t).ToList(); var RuleItemsOnce = new ObservableCollection <TimeTableOneDayInfomationItem>(); foreach (var f in ruleitemslistorder) { RuleItemsOnce.Add(f); } foreach (var t in RuleItemsOnce) { lst = new List <int>(); if (t.IsUsedLuxOn) { lst.Add(t.TimeOn - dt.LuxEffective); } else { if (t.TimeOn == 1500) { lst.Add(1500); } else if (t.TimeOn > 1440) { lst.Add(t.TimeOn - 1440); } else if (t.TimeOn == 1440) { lst.Add(t.TimeOn - 1440 + 1); } else { lst.Add(t.TimeOn); } } if (t.TimeOn == 1500) { lst.Add(1500); } else if (t.TimeOn > 1440) { lst.Add(t.TimeOn - 1440); } else if (t.TimeOn == 1440) { lst.Add(t.TimeOn - 1440 + 1); } else { lst.Add(t.TimeOn); } if (t.IsUsedLuxOff) { lst.Add(t.TimeOff - dt.LuxEffective); } else { if (t.TimeOff == 1500) { lst.Add(1500); } else if (t.TimeOff > 1440) { lst.Add(t.TimeOff - 1440); } else if (t.TimeOff == 1440) { lst.Add(t.TimeOff - 1440 + 1); } else { lst.Add(t.TimeOff); } } if (t.TimeOff == 1500) { lst.Add(1500); } else if (t.TimeOff > 1440) { lst.Add(t.TimeOff - 1440); } else if (t.TimeOff == 1440) { lst.Add(t.TimeOff - 1440 + 1); } else { lst.Add(t.TimeOff); } if (dic.ContainsKey(t.DayOfWeekUsed)) { var lit = new List <int>(dic[t.DayOfWeekUsed]); for (int i = 0; i < lst.Count; i++) { lit.Add(lst[i]); } dic[t.DayOfWeekUsed] = new List <int>(lit); } else { dic.Add(t.DayOfWeekUsed, lst); } } var listall = new List <int>(); var listallint = 0; var first = 0; for (int i = 0; i < 7; i++) { var listnow = new List <int>(dic[i]); int weekafter = new int(); if (i == 0) { weekafter = 6; } else { weekafter = i - 1; } int weekbefore = new int(); if (i == 0) { weekbefore = 6; } else { weekbefore = i - 1; } var listbefore = new List <int>(dic[weekbefore]); var listafter = new List <int>(dic[weekafter]); var is1500 = 0; listall.Add(0); for (int j = 0; j < listnow.Count; j++) { listall[i] = listall[i] + listnow[j]; if (listnow[j] == 1500) { is1500 = is1500 + 1; } else { is1500 = 0; } } if (is1500 == 4 || is1500 == 8 || is1500 == 12 || is1500 == 16) { } else { is1500 = 0; } if (listall[i] / listnow.Count != 1500) { for (int j = 2; j < listnow.Count - 2; j = j + 2) { if (j > 2 && j + is1500 < listnow.Count - 2) { if (listnow[j - 1] < listnow[j + 1] && listnow[j - 2] < listnow[j + 1] && listnow[j - 1] < listnow[j] && listnow[j - 2] < listnow[j]) { } else { var information = WlstMessageBox.Show ("无法保存", "存在同一时间段内关灯时间大于开灯时间的情况,请重新修改!", WlstMessageBoxType.Ok); return; } } else { if (listnow[1] != 1500 && listnow[1] < listnow[3] && listnow[0] < listnow[3] && listnow[1] < listnow[2] && listnow[0] < listnow[2]) { } else if (listnow[1] == 1500 && listbefore[listbefore.Count - 1] < listnow[3] && listbefore[listbefore.Count - 2] < listnow[3] && listbefore[listbefore.Count - 2] < listnow[2] && listbefore[listbefore.Count - 1] < listnow[2]) { } else { var information = WlstMessageBox.Show ("无法保存", "存在同一时间段内关灯时间大于开灯时间的情况,请重新修改!", WlstMessageBoxType.Ok); return; } } if (j == listnow.Count - 4) { if ((listnow[j + 3] < listnow[j + 1] && listnow[j + 3] < listafter[1] && listnow[j + 3] < listafter[0] && listnow[j + 2] < listafter[1] && listnow[j + 2] < listafter[0] && listafter[1] != 1500) || (listnow[j + 3] > listnow[j + 1] && listnow[j + 3] > listnow[j] && listnow[j + 2] > listnow[j + 1] && listnow[j + 2] > listnow[j] && listnow[j + 3] != 1500) || (listnow[j + 3] == 1500 && listnow[j + 2] == 1500 && listnow[j + 1] == 1500 && listnow[j] == 1500)) { } else { var information = WlstMessageBox.Show ("无法保存", "最后时间段存在关灯时间大于开灯时间的情况,请重新修改!", WlstMessageBoxType.Ok); return; } } } for (int j = 2; j < listnow.Count - 4; j = j + 4) { if (listnow[j] > listnow[j + 2] && listnow[j] > listnow[j + 1] && listnow[j - 1] > listnow[j + 1] && listnow[j - 1] > listnow[j + 2]) { var information = WlstMessageBox.Show ("无法保存", "存在非最后段跨天的情况,请重新修改!", WlstMessageBoxType.Ok); return; } if (listnow[j + 2] > listnow[j + 4] && listnow[j + 2] > listnow[j + 3] && listnow[j + 1] > listnow[j + 4] && listnow[j + 1] > listnow[j + 3]) { var information = WlstMessageBox.Show ("无法保存", "存在同一时间段时间顺序设置错误的情况,请重新修改!", WlstMessageBoxType.Ok); return; } } } else { listallint = listallint + 1; } } if (listall.Count == 7 && listallint == 7) { var information = WlstMessageBox.Show ("无法保存", "没有设置时间,请重新修改!", WlstMessageBoxType.Ok); return; } } if (dt.CurrentSelectLux.Id > 0 && dt.LuxChanged == false) { var luxareaid = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuBelongArea(dt.CurrentSelectLux.Id); //var luxareaid = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[value.Id].AreaId; if (luxareaid != areaid) { string masg = ""; if (Wlst.Cr.CoreMims.Services.UserInfo.UserLoginInfo.D) { masg = "当前区域"; } else { foreach (var t in Wlst.Cr.CoreMims.Services.UserInfo.UserLoginInfo.AreaW) { if (luxareaid != t) { masg = "您所管理的区域"; } else { masg = "当前区域"; break; } } } var infoss = WlstMessageBox.Show("警告", "该光控 " + dt.CurrentSelectLux.Name + " 不属于" + masg + ",是否继续操作? 是 继续,否 退出.", WlstMessageBoxType.YesNo); if (infoss == WlstMessageBoxResults.No) { return; } } } if (dt.CurrentSelectLux.Id <= 0 && dt.CurrentSelectLux2.Id > 0) { var infoss = WlstMessageBox.Show("警告", "未设置主光控时设置了备用光控!", WlstMessageBoxType.YesNo); return; } if (dt.CurrentSelectLux.Id <= 0) { foreach (var t in dt.RuleItems) { if (t.IsUsedLuxOn == true || t.IsUsedLuxOff == true) { var infoss = WlstMessageBox.Show("警告", "设置了光控开关灯,但未选择主光控!", WlstMessageBoxType.YesNo); return; } } } close = true; } if (close) { dt.IsEdit = false; if (dt.LuxId2 == 0) { dt.ShowCurrentSelectLux2 = 0; } if (OnFormBtnOkClick != null) { OnFormBtnOkClick(this, new EventArgsAddTimeTable(dt)); } this.Close(); } }
private void Luxequipment_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dt.CurrentSelectLux.Id > 0 && dt.LuxChanged == false) { var luxareaid = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetRtuBelongArea(dt.CurrentSelectLux.Id); //var luxareaid = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.InfoItems[value.Id].AreaId; if (luxareaid != areaid) { string masg = ""; if (Wlst.Cr.CoreMims.Services.UserInfo.UserLoginInfo.D) { masg = "当前区域"; } else { foreach (var t in Wlst.Cr.CoreMims.Services.UserInfo.UserLoginInfo.AreaW) { if (luxareaid != t) { masg = "您所管理的区域"; } else { masg = "当前区域"; break; } } } var infoss = WlstMessageBox.Show("警告: " + dt.TimeId + "-" + dt.TimeName, "主光控: " + dt.CurrentSelectLux.Name + " 不属于" + masg + ", 是 继续,否 取消当前选择.", WlstMessageBoxType.YesNo); if (infoss != WlstMessageBoxResults.Yes) { dt.CurrentSelectLux = dt.LuxCollection[0]; } } var luxdelete = dt.CurrentSelectLux; if (dt.CurrentSelectLux.Id <= 0) { dt.CurrentSelectLux2 = dt.LuxCollection2[0]; dt.ShowCurrentSelectLux2 = 0; dt.LuxCollection2.Clear(); foreach (var t in dt.LuxCollection) { dt.LuxCollection2.Add(t); } dt.CurrentSelectLux2 = null; dt.LuxId2 = 0; dt.LuxName2 = ""; } else { dt.ShowCurrentSelectLux2 = 22; flag = true; dt.LuxCollection2.Clear(); foreach (var t in dt.LuxCollection) { dt.LuxCollection2.Add(t); } dt.LuxCollection2.Remove(luxdelete); dt.CurrentSelectLux2 = null; dt.LuxId2 = 0; dt.LuxName2 = ""; //foreach (var t in dt.LuxCollection2) //{ // if (t.Id == dt.LuxId2) // { // dt.CurrentSelectLux2 = t; // } //} flag = false; } } else if (dt.CurrentSelectLux.Id <= 0 && dt.LuxChanged == false) { dt.LuxCollection2.Clear(); foreach (var t in dt.LuxCollection) { dt.LuxCollection2.Add(t); } dt.CurrentSelectLux2 = null; dt.LuxId2 = 0; dt.LuxName2 = ""; flag = false; } }