private void exportClick(object sender, RoutedEventArgs e)//导出 { try { if (string.IsNullOrWhiteSpace(filePathText.Text)) { MessageBoxX.Show("导出提示", "未设置文件路径"); return; } long startTime = dataTime()[0]; //开始时间 long endTime = dataTime()[1]; //结束时间 int allPage = 0; int cnt = 0; string filePath = ""; if (listType == _listType.ais) { //List<dataAnadll.FUS_ICD_MySql.AISMsg_SS> list = MainWindow.data.AIS(startTime, endTime, MainWindow.mycon, 1, 10); dataAnadll.AISDataProvider dataprovider = new dataAnadll.AISDataProvider((uint)startTime, (uint)endTime); dataprovider.GetPageNum(out allPage); List <dataAnadll.FUS_ICD_MySql.AISMsg_SS> list; for (int i = 0; i < allPage; i++) { dataprovider.GetPage(i + 1, out list); //alldata.Add(); cnt += dataAnadll.SaveToExcel.Save_AISdata(filePathText.Text + "\\ais.xls", list, AIStitle, 14); } filePath = "AIS.xls"; } else if (listType == _listType.radar) { dataAnadll.RadarDataProvider radarp = new dataAnadll.RadarDataProvider((uint)startTime, (uint)endTime); radarp.GetPageNum(out allPage); List <dataAnadll.FUS_ICD_MySql.RdDetectMsg_SS> list; for (int i = 0; i < allPage; i++) { radarp.GetPage(i + 1, out list); cnt += dataAnadll.SaveToExcel.Save_Radardata(filePathText.Text + "\\radar.xls", list, radartitle, 6); } filePath = "radar.xls"; } else if (listType == _listType.fus) { dataAnadll.FUSDataProvider radarp = new dataAnadll.FUSDataProvider((uint)startTime, (uint)endTime); radarp.GetPageNum(out allPage); List <dataAnadll.FUS_ICD_MySql.FusTarget_SS> list; for (int i = 0; i < allPage; i++) { radarp.GetPage(i + 1, out list); //SaveToExcel.Save_Fusedata(filePathText.Text + "/radar.xls", list, radartitle, 6); cnt += dataAnadll.SaveToExcel.Save_Fusedata(filePathText.Text + "\\fuse.xls", list, fusetitle, 15); } //List<dataAnadll.FUS_ICD_MySql.FusTarget_SS> list = MainWindow.data.Fuse(startTime, endTime, MainWindow.mycon); filePath = "fuse.xls"; } else if (listType == _listType.ope1) { dataAnadll.OperationLogProvider radarp = new dataAnadll.OperationLogProvider(); radarp.SearchLog(1, DataQuery.getTimeStamp(startTime), DataQuery.getTimeStamp(endTime), out allPage); List <dataAnadll.OperationLog> list; List <string[]> loginList = new List <string[]>(); for (int i = 0; i < allPage; i++) { radarp.GetPage(i + 1, out list); for (int j = 0; j < list.Count; j++) { string[] str = new string[8]; // str[0] = "#############"; str[0] = list[j].UserName.ToString(); str[1] = list[j].OptionName.ToString(); str[2] = list[j].OptionTime.ToString(); str[3] = list[j].Result.ToString(); str[4] = list[j].Note.ToString(); str[5] = list[j].IP.ToString(); str[6] = logNumber[list[j].LogType].ToString(); loginList.Add(str); } } cnt += dataAnadll.SaveToExcel.Save_Optionlog(filePathText.Text + "\\login.xls", loginList, logintitle, 7); filePath = "login.xls"; } else if (listType == _listType.ope2) { dataAnadll.OperationLogProvider radarp = new dataAnadll.OperationLogProvider(); radarp.SearchLog(2, DataQuery.getTimeStamp(startTime), DataQuery.getTimeStamp(endTime), out allPage); List <dataAnadll.OperationLog> list; List <string[]> opeList = new List <string[]>(); for (int i = 0; i < allPage; i++) { radarp.GetPage(i + 1, out list); for (int j = 0; j < list.Count; j++) { string[] str = new string[7]; //str[0] = "#############"; str[0] = list[j].UserName.ToString(); str[1] = list[j].OptionName.ToString(); str[2] = list[j].OptionTime.ToString(); str[3] = list[j].Result.ToString(); str[4] = list[j].Note.ToString(); str[5] = list[j].IP.ToString(); str[6] = logNumber[list[j].LogType].ToString(); opeList.Add(str); } } cnt += dataAnadll.SaveToExcel.Save_Optionlog(filePathText.Text + "\\operate.xls", opeList, opearatetitle, 7); filePath = "operate.xls"; } else if (listType == _listType.alarm) { dataAnadll.AlarmLogProvider radarp = new dataAnadll.AlarmLogProvider(DataQuery.getTimeStamp(startTime), DataQuery.getTimeStamp(endTime)); radarp.GetPageNum(out allPage); List <dataAnadll.AlarmLog> list; List <string[]> loginList = new List <string[]>(); for (int i = 0; i < allPage; i++) { radarp.GetPage(i + 1, out list); for (int j = 0; j < list.Count; j++) { string[] str = new string[8]; //str[0] = "###############"; alarmData alarmTarget = new alarmData(); string a = ""; if (list[j].alarm_area_num == 201) { a = alarmType[0]; } else if (list[j].alarm_area_num == 202) { a = alarmType[1]; } else if (list[j].alarm_area_num == 203) { a = alarmType[2]; } else if (list[j].alarm_area_num >= 210 && list[j].alarm_area_num <= 215) { a = alarmType[3]; } else if (list[j].alarm_area_num >= 220 && list[j].alarm_area_num <= 225) { a = alarmType[4]; } else if (list[j].alarm_area_num == 255) { a = alarmType[5]; } alarmTarget.alarmNumber = a; alarmTarget.time = list[j].time.ToString(); alarmTarget.radarNumber = list[j].radar_batch_id.ToString(); alarmTarget.radarNumber2 = list[i].radar_batch_id2.ToString();//告警日志添加雷达2 批号 alarmTarget.IMO = list[j].ais_batch_id.ToString(); switch (list[j].alarm_type) { case 1: alarmTarget.alarmString = "驶入"; break; case 2: alarmTarget.alarmString = "驶出"; break; default: alarmTarget.alarmString = "未知报警"; break; } switch (list[j].country) { case 412: case 413: alarmTarget.country = "中国"; break; case 574: case 576: alarmTarget.country = "越南"; break; case 533: alarmTarget.country = "马拉西亚"; break; default: alarmTarget.country = "其他"; break; } alarmTarget.Atrrib = state[list[j].iff_attrib]; str[0] = alarmTarget.time; str[1] = alarmTarget.radarNumber; // list[j].radar_batch_id.ToString(); str[2] = alarmTarget.radarNumber2; str[3] = alarmTarget.IMO; // list[j].ais_batch_id.ToString(); str[4] = alarmTarget.alarmNumber; // list[j].alarm_area_num.ToString(); str[5] = alarmTarget.alarmString; // list[j].alarm_type.ToString(); str[6] = alarmTarget.country; // list[j].country.ToString(); str[7] = alarmTarget.Atrrib; // list[j].iff_attrib.ToString(); loginList.Add(str); } } cnt += dataAnadll.SaveToExcel.Save_AlarmLog(filePathText.Text + "\\alarm.xls", loginList, alarmtitle, 8); filePath = "alarm.xls"; } else if (listType == _listType.dev) { dataAnadll.SystemLogProvider sysp = new dataAnadll.SystemLogProvider(DataQuery.getTimeStamp(startTime), DataQuery.getTimeStamp(endTime)); sysp.GetPageNum(out allPage); List <dataAnadll.SystemLog> list; List <string[]> sysList = new List <string[]>(); for (int i = 0; i < allPage; i++) { sysp.GetPage(i + 1, out list); for (int j = 0; j < list.Count; j++) { string[] str = new string[6]; //str[0] = "###########"; str[0] = list[j].machine_IP.ToString(); str[1] = list[j].machine_Name.ToString(); str[2] = type[list[j].machine_Network]; str[3] = type[list[j].machine_Workstate]; str[4] = list[j].machine_time.ToString(); str[5] = list[j].reason.ToString(); sysList.Add(str); } } cnt += dataAnadll.SaveToExcel.Save_SystemLog(filePathText.Text + "\\device.xls", sysList, devicetitle, 6); filePath = "device.xls"; } if (cnt > 0) { MessageBoxX.Show("导出提示", string.Format("导出至{0}!", filePath)); } else { MessageBoxX.Show("导出提示", string.Format("数据为空,导出失败")); } } catch (Exception ee) { } }
private void fuseClick(object sender, RoutedEventArgs e)//融合 { try { listType = _listType.fus; AIS.IsChecked = false; radar.IsChecked = false; fuse.IsChecked = false; login.IsChecked = false; operation.IsChecked = false; alarm.IsChecked = false; device.IsChecked = false; fuse.IsChecked = true; long startTime = dataTime()[0]; //开始时间 long endTime = dataTime()[1]; //结束时间 AISList.Visibility = Visibility.Collapsed; radarList.Visibility = Visibility.Collapsed; fuseList.Visibility = Visibility.Visible; userLoginList.Visibility = Visibility.Collapsed; operateList.Visibility = Visibility.Collapsed; alarmList.Visibility = Visibility.Collapsed; deviceList.Visibility = Visibility.Collapsed; fusp = new dataAnadll.FUSDataProvider((uint)startTime, (uint)endTime); List <dataAnadll.FUS_ICD_MySql.FusTarget_SS> list; fusp.GetPageNum(out PageIndex.Total); PageIndex.Current = 1; fuseDataList.Clear(); for (int j = 0; j < PageIndex.Total; j++) { fusp.GetPage(j + 1, out list); for (int i = 0; i < list.Count; i++) { fuseData fuseTarget = new fuseData(); fuseTarget.number = list[i].lFusBatchID; fuseTarget.time = (GetTime((list[i].lTime).ToString())).ToString(); string a = ""; if (list[i].FusDataType == "2") { a = mix[0]; } else if (list[i].FusDataType == "3") { a = mix[1]; } else if (list[i].FusDataType == "100") { a = mix[2]; } fuseTarget.type = a; fuseTarget.dataNumber = list[i].SrcNum; fuseTarget.longitude = list[i].dLongti; fuseTarget.latitude = list[i].dLati; fuseTarget.angle = list[i].dNorthCourse; fuseTarget.name = list[i].cName; fuseTarget.call = list[i].cCall_ID; fuseTarget.country = list[i].country; fuseTarget.Atrrbi = state[Convert.ToInt32(list[i].ucIFFAttrib)]; fuseTarget.high = list[i].fMaxDeep; fuseTarget.people = list[i].ulCount; fuseTarget.IMO = list[i].ulAISBatchID; fuseTarget.radar_batch_id = list[i].ulRdbatchID; fuseTarget.radar_batch_id2 = list[i].ulOpticalID; fuseDataList.Add(fuseTarget); } } fuseList.DataContext = fuseDataList; } catch (Exception ee) { } }