/// <summary> /// 初始化当前车厢信息和图片 /// </summary> private void Init_Load_TrainDetailInfo() { try { if (CurTrainDetail == null && ProblemTrainDetails != null && ProblemTrainDetails.Count > 0) { CurTrainDetail = ProblemTrainDetails[0]; } string FolderName = new BLL_Line().GetLineFolderName(CurTrainDetail.LineID); string ServerIP = Config.DB_IP; PicPath_L = @"\\" + ServerIP + @"\GQPics\" + FolderName + @"\" + CurTrainDetail.TrainComeDate.ToString("yyyyMMddHHmmss") + @"\L" + CurTrainDetail.TrainDetail_OrderNo.ToString().PadLeft(3, '0') + "_" + CurTrainDetail.TrainDetail_OrderNo + ".jpg"; PicPath_R = @"\\" + ServerIP + @"\GQPics\" + FolderName + @"\" + CurTrainDetail.TrainComeDate.ToString("yyyyMMddHHmmss") + @"\R" + CurTrainDetail.TrainDetail_OrderNo.ToString().PadLeft(3, '0') + "_" + CurTrainDetail.TrainDetail_OrderNo + ".jpg"; PicPath_ZL = @"\\" + ServerIP + @"\ZXGQPics\" + FolderName + @"\" + CurTrainDetail.TrainComeDate.ToString("yyyyMMddHHmmss") + @"\ZL" + CurTrainDetail.TrainDetail_OrderNo.ToString().PadLeft(3, '0') + "_" + CurTrainDetail.TrainDetail_OrderNo + ".jpg"; PicPath_ZR = @"\\" + ServerIP + @"\ZXGQPics\" + FolderName + @"\" + CurTrainDetail.TrainComeDate.ToString("yyyyMMddHHmmss") + @"\ZR" + CurTrainDetail.TrainDetail_OrderNo.ToString().PadLeft(3, '0') + "_" + CurTrainDetail.TrainDetail_OrderNo + ".jpg"; barStaticItem_CurInfo.Caption = "线路:" + CurTrainDetail.LineID + " 过车时间:" + CurTrainDetail.TrainComeDate + " 车次:" + CurTrainDetail.TrainNo + " 车号:" + CurTrainDetail.TrainDetail_No + " 车型:" + CurTrainDetail.vehicletype + " 顺位:" + CurTrainDetail.TrainDetail_OrderNo + " "; //加载当前车厢所有报警,优先展示有报警一侧图片 BLL_AlarmDetail adbll = new BLL_AlarmDetail(); list_ad = adbll.GetAlarmByCarID(CurTrainDetail.TrainDetail_ID.ToString()); if (list_ad != null && list_ad.Count > 0 && list_ad[0].Side != "") { LoadPic(list_ad[0].Side); btn_Pic_L.Caption = "左图" + list_ad.FindAll(n => n.Side == "L").Count; btn_Pic_R.Caption = "右图" + list_ad.FindAll(n => n.Side == "R").Count; btn_ZXPic_L.Caption = "走行部左" + list_ad.FindAll(n => n.Side == "ZL").Count; btn_ZXPic_R.Caption = "走行部右" + list_ad.FindAll(n => n.Side == "ZR").Count; lbl_AlarmCount.Caption = "本节车共计报警:" + list_ad.Count; } else { LoadPic("L"); btn_Pic_L.Caption = "左图"; btn_Pic_R.Caption = "右图"; btn_ZXPic_L.Caption = "走行部左"; btn_ZXPic_R.Caption = "走行部右"; lbl_AlarmCount.Caption = "本列车共计报警:0"; } } catch (Exception ex) { XtraMessageBox.Show("初始化失败:" + ex.Message); } }
private void CopyImage() { try { List <string> alarmlist = new List <string>(); CheckEdit tmpctl = null; foreach (Control ctl in this.Controls) { if (ctl is CheckEdit) { tmpctl = (CheckEdit)ctl; if (tmpctl.Checked) { alarmlist.Add(tmpctl.Text); } } } BLL_AlarmDetail adbll = new BLL_AlarmDetail(); DataTable tmp = adbll.GetAlarmPicPath(st, ed, alarmlist); int CopyCount = 0; if (tmp != null && tmp.Rows.Count > 0) { for (int i = 0; i < tmp.Rows.Count; i++) { string Root = ""; string ServerIP = Config.DB_IP; switch (tmp.Rows[i][3].ToString()) { case "pic": Root = @"\\" + ServerIP + @"\GQPics\"; break; case "zpic": Root = @"\\" + ServerIP + @"\ZXGQPics\"; break; default: continue; } //原图不存在直接跳过 if (!File.Exists(Root + tmp.Rows[i][0].ToString())) { Log.logsys.Info("原图不存在:" + Root + tmp.Rows[i][0].ToString()); continue; } else { //分类路径 if (!Directory.Exists(SavePath + "\\" + tmp.Rows[i][2].ToString())) { Directory.CreateDirectory(SavePath + "\\" + tmp.Rows[i][2].ToString()); } string AimPath = SavePath + "\\" + tmp.Rows[i][2].ToString() + "\\" + tmp.Rows[i][1].ToString().Replace("*", "#"); if (!File.Exists(AimPath)) { CopyCount += 1; File.Copy(Root + tmp.Rows[i][0].ToString(), AimPath, true); } } } XtraMessageBox.Show("共拷贝 " + CopyCount + " 张报警图片", "友情提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { XtraMessageBox.Show("此时间段无结果", "窃喜", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }