public void PostionShow(string command, decimal Id) { try { var mp1 = dc.Moveplan.First(p => p.Id == Id); if (mp1.Movestate != "已走动") { Ext.Msg.Alert("提示", "尚未走动,不能查看").Show(); return; } if (mp1.Movestarttime == null) { Ext.Msg.Alert("提示", "手动闭合计划,不能查看").Show(); return; } string historysql = string.Format("SELECT short_name, stateflag,person_name, entertime_mine, outtime_mine, trackblock, station_mark FROM v_jykj_history where remark2='{0}' and entertime_mine>='{1}' and entertime_mine<='{2}' order by entertime_mine desc;", mp1.Personid.Trim().PadLeft(7, '0'), mp1.Movestarttime.Value.ToString("yyyy-MM-dd") + " 00:00:00", mp1.Movestarttime.Value.ToString("yyyy-MM-dd") + " 23:59:59"); PostGreSQLHelper pgh = new PostGreSQLHelper(); string msg = "<B><font color=\"orange\">" + mp1.Movestarttime.Value.ToString("yyyy年MM月dd日") + "下井信息</font></B><HR>"; DataTable dthistory = pgh.ExecuteQuery(historysql).Tables[0]; if (dthistory.Rows.Count > 0) { msg += "历史状态:已出井<p>"; msg += "入井时间:" + dthistory.Rows[0]["entertime_mine"].ToString() + "<p>"; msg += "出井时间:" + dthistory.Rows[0]["outtime_mine"].ToString() + "<p>"; msg += "轨迹信息:<p>"; if (dthistory.Rows[0]["station_mark"].ToString().Trim() == "") { msg += "无<p>"; } else { string[] group = dthistory.Rows[0]["trackblock"].ToString().Trim().Split(','); foreach (var r in group) { string[] row = r.Split('&'); msg += row[1] + "到达" + pgh.GetPointNameNote(row[0]) + "<p>"; } //msg += dthistory.Rows[0]["station_mark"].ToString().Trim().Replace(",", "<p>").Replace("*", "到达时间:"); } } else { msg += "无"; } SearchBLWindow.Html = msg; //SearchBLStore.DataSource = pgh.ExecuteQuery(historysql).Tables[0]; //SearchBLStore.DataBind(); SearchBLWindow.Show(); } catch { Ext.Msg.Alert("出错提醒", "查询超时或没有信息!").Show(); } }
public static decimal GetKQrecord(string personnumber, DateTime pcdate, string pcbanci, string inputperson) { DBSCMDataContext dc = new DBSCMDataContext(); var krs = dc.KqRecord.Where(p => p.Kqpnumber == personnumber && p.Kqtime == pcdate && p.Kqbenci == pcbanci); if (krs.Count() == 0) { string historysql = string.Format("SELECT short_name, stateflag,person_name, entertime_mine, outtime_mine, trackblock, station_mark FROM v_jykj_history where remark2='{0}' and outtime_mine>='{1}' order by outtime_mine desc;", personnumber.PadLeft(7, '0'), System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); PostGreSQLHelper pgh = new PostGreSQLHelper(); DataTable dthistory = pgh.ExecuteQuery(historysql).Tables[0]; if (dthistory.Rows.Count > 0) { KqRecord kr = new KqRecord { Kqtime = pcdate, Kqbenci = pcbanci, Inputperson = inputperson, Downtime = DateTime.Parse(dthistory.Rows[0]["entertime_mine"].ToString()), Uptime = DateTime.Parse(dthistory.Rows[0]["outtime_mine"].ToString()), Kqpnumber = personnumber, Zdgj = dthistory.Rows[0]["trackblock"].ToString().Trim() }; dc.KqRecord.InsertOnSubmit(kr); dc.SubmitChanges(); return(dc.KqRecord.First(p => p.Kqpnumber == personnumber && p.Downtime == kr.Downtime).Rjid); } else { return(-1); } } else { if (krs.First().Uptime >= System.DateTime.Now.AddHours(-1)) { return(krs.First().Rjid); } else { return(-1); } } }
public void LoadData() { if (cbbPerson.SelectedIndex == -1) { Ext.Msg.Alert("提示", "请选择人员!").Show(); return; } //cbbPerson.SelectedItem.Value = "110932"; string realsql = string.Format("SELECT short_name, stateflag,person_name, entertime_mine, outtime_mine, trackblock FROM v_jykj_real where remark2='{0}' order by entertime_mine desc limit 1;", cbbPerson.SelectedItem.Value.Trim().PadLeft(7, '0')); string historysql = string.Format("SELECT short_name, stateflag,person_name, entertime_mine, outtime_mine, trackblock, station_mark FROM v_jykj_history where remark2='{0}' order by entertime_mine desc limit 1;", cbbPerson.SelectedItem.Value.Trim().PadLeft(7, '0')); string msg = ""; PostGreSQLHelper pgh = new PostGreSQLHelper(); msg += "<B><font color=\"orange\">当前下井信息</font></B><HR>"; DataTable dtreal = pgh.ExecuteQuery(realsql).Tables[0]; if (dtreal.Rows.Count > 0) { msg += "当前状态:" + (dtreal.Rows[0]["stateflag"].ToString().Trim() == "1" ? "已入井" : "已出井"); msg += "<p>"; msg += "入井时间:" + dtreal.Rows[0]["entertime_mine"].ToString() + "<p>"; if (dtreal.Rows[0]["outtime_mine"].ToString() == "1902/1/1 0:00:00") { msg += "出井时间:xxxx/x/x x:xx:xx<p>"; } else { msg += "出井时间:" + dtreal.Rows[0]["outtime_mine"].ToString() + "<p>"; } msg += "轨迹信息:<p>"; if (dtreal.Rows[0]["trackblock"].ToString().Trim() == "") { msg += "无<p>"; } else { string[] group = dtreal.Rows[0]["trackblock"].ToString().Trim().Split(','); foreach (var r in group) { string[] row = r.Split('&'); msg += row[1] + "到达" + pgh.GetPointNameNote(row[0]) + "<p>"; } } } else { msg += "无<p>"; } msg += "<B><font color=\"orange\">最近一次下井信息</font></B><HR>"; DataTable dthistory = pgh.ExecuteQuery(historysql).Tables[0]; if (dthistory.Rows.Count > 0) { msg += "历史状态:已出井<p>"; msg += "入井时间:" + dthistory.Rows[0]["entertime_mine"].ToString() + "<p>"; msg += "出井时间:" + dthistory.Rows[0]["outtime_mine"].ToString() + "<p>"; msg += "轨迹信息:<p>"; if (dthistory.Rows[0]["station_mark"].ToString().Trim() == "") { msg += "无<p>"; } else { string[] group = dthistory.Rows[0]["trackblock"].ToString().Trim().Split(','); foreach (var r in group) { string[] row = r.Split('&'); msg += row[1] + "到达" + pgh.GetPointNameNote(row[0]) + "<p>"; } //msg += dthistory.Rows[0]["station_mark"].ToString().Trim().Replace(",", "<p>").Replace("*", "到达时间:"); } } else { msg += "无"; } panel1.Html = msg; //DetailStore.DataSource = pgh.ExecuteQuery("SELECT short_name, stateflag, substring(card_id from 10) as card_id, person_name, entertime_mine, outtime_mine, trackblock, station_mark FROM v_jykj_history limit 5;"); //DetailStore.DataBind(); }