public ResponseResult sendImageDownOrder(Dictionary <string, string> inparams) { ResponseResult Result = null; try { string token = inparams["token"]; string sysflag = inparams["sysflag"]; string ch = inparams["ch"]; string tno = inparams["tno"]; string carno = inparams["carno"]; string cid = inparams["cid"]; string souflag = System.Configuration.ConfigurationManager.AppSettings["MonitorDataSource"]; WebGIS.RealtimeDataServer.CarRealData res = new WebGIS.RealtimeDataServer.CarRealData(); RDSConfigModel rc = RDSConfig.GetRDS(sysflag); WebGIS.RealtimeDataServer.WCFServiceClient wc = new WebGIS.RealtimeDataServer.WCFServiceClient(); //调用WebGIS实时数据服务接口查询车辆轨迹数据 if (souflag == "RDS" && rc != null && rc.RunFlag) { wc.Endpoint.Address = new System.ServiceModel.EndpointAddress(rc.WCFUrl); res = wc.GetCarData(sysflag, long.Parse(cid)); if (res != null) { if (res.OnlineStatus == 1)//在线,下发指令 { SendResult sr = new SendResult(); sr.CID = cid; sr.TNO = tno; sr.CarNo = carno; sr.Res = false; sr.Desc = "拍照"; sr.Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); bool result = SendOrderHander.Send_CTS_ImageRequestDown(sysflag, token, long.Parse(sr.CID), long.Parse(sr.TNO), uint.Parse(ch)); sr.Res = result; Result = new ResponseResult(ResState.Success, "", sr); } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发拍照指令!", null); } } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发拍照指令!", null); } } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发拍照指令!", null); } } catch (Exception ex) { Result = new ResponseResult(ResState.OperationFailed, ex.Message, null); } //SendOrderHander.Send_CTS_SetTermParamDown(sysflag, token, cid, tno, paramlist); return(Result); }
public ResponseResult sendDriveRecordCMDDownOrder(Dictionary <string, string> inparams) { ResponseResult Result = null; try { string token = inparams["token"]; string sysflag = inparams["sysflag"]; string tno = inparams["tno"]; string carno = inparams["carno"]; string cid = inparams["cid"]; string cmd = inparams["cmd"]; string platenum = inparams["platenum"]; string platetype = inparams["platetype"]; string vin = inparams["vin"]; string quotient = inparams["quotient"]; string souflag = System.Configuration.ConfigurationManager.AppSettings["MonitorDataSource"]; WebGIS.RealtimeDataServer.CarRealData res = new WebGIS.RealtimeDataServer.CarRealData(); RDSConfigModel rc = RDSConfig.GetRDS(sysflag); WebGIS.RealtimeDataServer.WCFServiceClient wc = new WebGIS.RealtimeDataServer.WCFServiceClient(); //调用WebGIS实时数据服务接口查询车辆轨迹数据 if (souflag == "RDS" && rc != null && rc.RunFlag) { wc.Endpoint.Address = new System.ServiceModel.EndpointAddress(rc.WCFUrl); res = wc.GetCarData(sysflag, long.Parse(cid)); if (res != null) { if (res.OnlineStatus == 1)//在线,下发指令 { SendResult sr = new SendResult(); sr.CID = cid; sr.TNO = tno; sr.CarNo = carno; sr.Res = false; bool result = false; switch (cmd) { case "0x82": sr.Desc = "行驶记录仪-设置车辆信息"; sr.Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); result = SendOrderHander.Send_DriveRecordDownCMDDown_VIN_NUM_TYPE(sysflag, token, long.Parse(sr.CID), long.Parse(sr.TNO), vin, platenum, platetype); sr.Res = result; break; case "0xC3": sr.Desc = "行驶记录仪-设置脉冲系数"; sr.Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); result = SendOrderHander.Send_DriveRecordDownCMDDown_CharacterQuotient(sysflag, token, long.Parse(sr.CID), long.Parse(sr.TNO), uint.Parse(quotient)); sr.Res = result; break; default: sr.Desc = ""; sr.Res = result; break; } Result = new ResponseResult(ResState.Success, "", sr); } else //不在线,无法下发指令 { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发指令!", null); } } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发指令!", null); } } //不在线,无法下发指令 else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发指令!", null); } } catch (Exception ex) { Result = new ResponseResult(ResState.OperationFailed, ex.Message, null); } //SendOrderHander.Send_CTS_SetTermParamDown(sysflag, token, cid, tno, paramlist); return(Result); }
public ResponseResult sendXiaoDaiParamOrder(Dictionary<string, string> inparams) { ResponseResult Result = null; try { string token = inparams["token"]; string sysflag = inparams["sysflag"]; string tno = inparams["tno"]; string carno = inparams["carno"]; string cid = inparams["cid"]; string datevalue = inparams["datevalue"]; string dayvalue = inparams["dayvalue"]; string minutevalue = inparams["minutevalue"]; string TransmissionDataStr = "0005"; byte[] datas = new byte[9]; datas[0] = 0x0; datas[1] = 0x5; if (!string.IsNullOrEmpty(datevalue)) { DateTime dt = DateTime.Parse(datevalue); datas[2] = Convert.ToByte(toBCD(dt.Year % 100)); datas[3] = Convert.ToByte(toBCD(dt.Month)); datas[4] = Convert.ToByte(toBCD(dt.Day)); TransmissionDataStr += Convert.ToByte(toBCD(dt.Year % 100)).ToString() + Convert.ToByte(toBCD(dt.Month)).ToString() + Convert.ToByte(toBCD(dt.Day)).ToString(); } else { datas[2] = Convert.ToByte(toBCD(0)); datas[3] = Convert.ToByte(toBCD(0)); datas[4] = Convert.ToByte(toBCD(0)); TransmissionDataStr += Convert.ToByte(toBCD(0)).ToString() + Convert.ToByte(toBCD(0)).ToString() + Convert.ToByte(toBCD(0)).ToString(); ; } if (!string.IsNullOrEmpty(dayvalue)) { datas[6] = (byte)(uint.Parse(dayvalue)); datas[5] = (byte)(uint.Parse(dayvalue) >> 8); TransmissionDataStr += uint.Parse(dayvalue).ToString("X2"); } else { datas[6] = (byte)(0); datas[5] = (byte)(0 >> 8); TransmissionDataStr += 0.ToString("X2"); } if (!string.IsNullOrEmpty(minutevalue)) { datas[8] = (byte)(uint.Parse(minutevalue)); datas[7] = (byte)(uint.Parse(minutevalue) >> 8); TransmissionDataStr += uint.Parse(minutevalue).ToString("X2"); } else { datas[8] = (byte)(0); datas[7] = (byte)(0 >> 8); TransmissionDataStr += 0.ToString("X2"); } string souflag = System.Configuration.ConfigurationManager.AppSettings["MonitorDataSource"]; WebGIS.RealtimeDataServer.CarRealData res = new WebGIS.RealtimeDataServer.CarRealData(); RDSConfigModel rc = RDSConfig.GetRDS(sysflag); WebGIS.RealtimeDataServer.WCFServiceClient wc = new WebGIS.RealtimeDataServer.WCFServiceClient(); //调用WebGIS实时数据服务接口查询车辆轨迹数据 if (souflag == "RDS" && rc != null && rc.RunFlag) { wc.Endpoint.Address = new System.ServiceModel.EndpointAddress(rc.WCFUrl); res = wc.GetCarData(sysflag, long.Parse(cid)); if (res != null) { if (res.OnlineStatus == 1)//在线,下发指令 { SendResult sr = new SendResult(); sr.CID = cid; sr.TNO = tno; sr.CarNo = carno; sr.Res = false; sr.Desc = "销贷-设置还款日期及提醒时间"; sr.Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); bool result = SendOrderHander.Send_CTS_TransmissionProtocol(sysflag, token, long.Parse(sr.CID), long.Parse(sr.TNO), 0x8F02, datas); sr.Res = result; if (result) { //如果下发返回True,则写入数据库记录 UpdateJFQZExtend_Transmission(sysflag, long.Parse(cid), datevalue, string.IsNullOrEmpty(dayvalue) ? -1 : Int32.Parse(dayvalue), string.IsNullOrEmpty(minutevalue) ? -1 : Int32.Parse(minutevalue), -1, string.Empty, string.Empty); } Result = new ResponseResult(ResState.Success, "", sr); } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发销贷参数设置指令!", null); } } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发销贷参数设置指令!", null); } } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发销贷参数设置指令!", null); } } catch (Exception ex) { Result = new ResponseResult(ResState.OperationFailed, ex.Message, null); } //SendOrderHander.Send_CTS_SetTermParamDown(sysflag, token, cid, tno, paramlist); return Result; }
public ResponseResult sendXiaoDaiLockOrder(Dictionary<string, string> inparams) { ResponseResult Result = null; try { string token = inparams["token"]; string sysflag = inparams["sysflag"]; string tno = inparams["tno"]; string LDataType = inparams["LDataType"]; string carno = inparams["carno"]; string cid = inparams["cid"]; string paramvalue = inparams["paramvalue"]; string rev = inparams["rev"]; string nj = inparams["nj"]; string lockreason = inparams["lockreason"]; string unlockreason = inparams["unlockreason"]; string orderDesc = ""; string TransmissionDataStr = ""; byte[] datas = new byte[6]; datas[0] = 0x0; datas[1] = 0x7; switch (paramvalue) { case "0xA8": orderDesc = "立即锁车"; if (LDataType == "1" && rev != "") { nj = "0"; datas[2] = 0x1; } if (LDataType == "2" && nj != "") { rev = "0"; datas[2] = 0x3; } datas[4] = (byte)(uint.Parse(rev)); datas[3] = (byte)(uint.Parse(rev) >> 8); datas[5] = (byte)(uint.Parse(nj)); break; case "0x8A": orderDesc = "立即解锁"; datas[2] = 0x6; datas[4] = (byte)(uint.Parse(rev)); datas[3] = (byte)(uint.Parse(rev) >> 8); datas[5] = (byte)(100); //TransmissionDataStr = "0007" + "06" + uint.Parse(rev).ToString("X2"); break; } string souflag = System.Configuration.ConfigurationManager.AppSettings["MonitorDataSource"]; WebGIS.RealtimeDataServer.CarRealData res = new WebGIS.RealtimeDataServer.CarRealData(); RDSConfigModel rc = RDSConfig.GetRDS(sysflag); WebGIS.RealtimeDataServer.WCFServiceClient wc = new WebGIS.RealtimeDataServer.WCFServiceClient(); //调用WebGIS实时数据服务接口查询车辆轨迹数据 if (souflag == "RDS" && rc != null && rc.RunFlag) { wc.Endpoint.Address = new System.ServiceModel.EndpointAddress(rc.WCFUrl); res = wc.GetCarData(sysflag, long.Parse(cid)); if (res != null) { if (res.OnlineStatus == 1)//在线,下发指令 { SendResult sr = new SendResult(); sr.CID = cid; sr.TNO = tno; sr.CarNo = carno; sr.Res = false; sr.Desc = orderDesc; sr.Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //bool result = SendOrderHander.Send_CTS_TransmissionProtocol(sysflag, token, long.Parse(sr.CID), long.Parse(sr.TNO), 0x8F02, strToToHexByte(TransmissionDataStr)); bool result = SendOrderHander.Send_CTS_TransmissionProtocol(sysflag, token, long.Parse(sr.CID), long.Parse(sr.TNO), 0x8F02, datas); sr.Res = result; if (result) { //如果下发返回True,则写入数据库记录 UpdateJFQZExtend_Transmission(sysflag, long.Parse(cid), string.Empty, -1, -1, Convert.ToInt32(rev), lockreason, unlockreason); } Result = new ResponseResult(ResState.Success, "", sr); } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发车辆锁定设置指令!", null); } } else { Result = new ResponseResult(ResState.OtherError, "后台服务异常,无法下发车辆锁定设置指令!", null); } } else { Result = new ResponseResult(ResState.OtherError, "后台服务停止运行,无法下发车辆锁定设置指令!", null); } } catch (Exception ex) { Result = new ResponseResult(ResState.OperationFailed, ex.Message, null); } //SendOrderHander.Send_CTS_SetTermParamDown(sysflag, token, cid, tno, paramlist); return Result; }
public ResponseResult sendXiaoDaiActivateOrder(Dictionary<string, string> inparams) { ResponseResult Result = null; try { string token = inparams["token"]; string sysflag = inparams["sysflag"]; string tno = inparams["tno"]; string carno = inparams["carno"]; string cid = inparams["cid"]; string vin = inparams["vin"]; string vintype = inparams["vintype"]; string energytype = inparams["energytype"]; string orderDesc = ""; string TransmissionDataStr = ""; byte FDJType = Convert.ToByte(energytype == "" ? "0" : energytype); //发动机类型(日后从数据库中由车辆信息取出) byte[] datas = new byte[4]; datas[0] = 0x0; datas[1] = 0x6; if (vintype == "0xAA") { orderDesc = "车辆销贷功能激活"; datas[2] = 0x1; datas[3] = FDJType; TransmissionDataStr = "0006" + "01" + FDJType.ToString(); } else if (vintype == "0x55") { orderDesc = "车辆销贷功能关闭"; datas[2] = 0x2; datas[3] = FDJType; TransmissionDataStr = "0006" + "02" + FDJType; } string souflag = System.Configuration.ConfigurationManager.AppSettings["MonitorDataSource"]; WebGIS.RealtimeDataServer.CarRealData res = new WebGIS.RealtimeDataServer.CarRealData(); RDSConfigModel rc = RDSConfig.GetRDS(sysflag); WebGIS.RealtimeDataServer.WCFServiceClient wc = new WebGIS.RealtimeDataServer.WCFServiceClient(); //调用WebGIS实时数据服务接口查询车辆轨迹数据 if (souflag == "RDS" && rc != null && rc.RunFlag) { wc.Endpoint.Address = new System.ServiceModel.EndpointAddress(rc.WCFUrl); res = wc.GetCarData(sysflag, long.Parse(cid)); if (res != null) { if (res.OnlineStatus == 1)//在线,下发指令 { SendResult sr = new SendResult(); sr.CID = cid; sr.TNO = tno; sr.CarNo = carno; sr.Res = false; sr.Desc = orderDesc; sr.Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); bool result = SendOrderHander.Send_CTS_TransmissionProtocol(sysflag, token, long.Parse(sr.CID), long.Parse(sr.TNO), 0x8F02, datas); sr.Res = result; Result = new ResponseResult(ResState.Success, "", sr); } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发" + orderDesc + "指令!", null); } } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发" + orderDesc + "指令!", null); } } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发" + orderDesc + "指令!", null); } } catch (Exception ex) { Result = new ResponseResult(ResState.OperationFailed, ex.Message, null); } //SendOrderHander.Send_CTS_SetTermParamDown(sysflag, token, cid, tno, paramlist); return Result; }
public ResponseResult sendDriveRecordCollectOrder(Dictionary <string, string> inparams) { ResponseResult Result = null; try { string token = inparams["token"]; string sysflag = inparams["sysflag"]; string tno = inparams["tno"]; string carno = inparams["carno"]; string cid = inparams["cid"]; string cmd = inparams["cmd"]; string start = inparams["start"]; string end = inparams["end"]; long startsecond = 0; long endsecond = 0; string souflag = System.Configuration.ConfigurationManager.AppSettings["MonitorDataSource"]; WebGIS.RealtimeDataServer.CarRealData res = new WebGIS.RealtimeDataServer.CarRealData(); RDSConfigModel rc = RDSConfig.GetRDS(sysflag); WebGIS.RealtimeDataServer.WCFServiceClient wc = new WebGIS.RealtimeDataServer.WCFServiceClient(); //调用WebGIS实时数据服务接口查询车辆轨迹数据 if (souflag == "RDS" && rc != null && rc.RunFlag) { wc.Endpoint.Address = new System.ServiceModel.EndpointAddress(rc.WCFUrl); res = wc.GetCarData(sysflag, long.Parse(cid)); if (res != null) { if (res.OnlineStatus == 1)//在线,下发指令 { SendResult sr = new SendResult(); sr.CID = cid; sr.TNO = tno; sr.CarNo = carno; sr.Res = false; switch (cmd) { case "0x00": sr.Desc = "采集记录仪执行标准版本"; startsecond = 0; endsecond = 0; break; case "0x01": sr.Desc = "采集当前驾驶人信息"; startsecond = 0; endsecond = 0; break; case "0x02": sr.Desc = "采集记录仪的实时时钟"; startsecond = 0; endsecond = 0; break; case "0x03": sr.Desc = "采集累计行程里程"; startsecond = 0; endsecond = 0; break; case "0x04": sr.Desc = "采集记录仪脉冲系数"; startsecond = 0; endsecond = 0; break; case "0x05": sr.Desc = "采集车辆信息"; startsecond = 0; endsecond = 0; break; case "0x06": sr.Desc = "采集记录仪状态信号配置信息"; startsecond = 0; endsecond = 0; break; case "0x07": sr.Desc = "采集记录仪唯一性编号"; startsecond = 0; endsecond = 0; break; case "0x08": sr.Desc = "采集指定的行驶速度记录"; startsecond = Convert.ToInt64((DateTime.Parse(start) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); endsecond = Convert.ToInt64((DateTime.Parse(end) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); break; case "0x09": sr.Desc = "采集指定的位置信息记录"; startsecond = Convert.ToInt64((DateTime.Parse(start) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); endsecond = Convert.ToInt64((DateTime.Parse(end) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); break; case "0x10": sr.Desc = "采集指定的事故疑点记录"; startsecond = Convert.ToInt64((DateTime.Parse(start) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); endsecond = Convert.ToInt64((DateTime.Parse(end) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); break; case "0x11": sr.Desc = "采集指定的超时驾驶记录"; startsecond = Convert.ToInt64((DateTime.Parse(start) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); endsecond = Convert.ToInt64((DateTime.Parse(end) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); break; case "0x12": sr.Desc = "采集指定的驾驶人身份记录"; startsecond = Convert.ToInt64((DateTime.Parse(start) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); endsecond = Convert.ToInt64((DateTime.Parse(end) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); break; case "0x13": sr.Desc = "采集指定的外部供电记录"; startsecond = Convert.ToInt64((DateTime.Parse(start) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); endsecond = Convert.ToInt64((DateTime.Parse(end) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); break; case "0x14": sr.Desc = "采集指定的参数修改记录"; startsecond = Convert.ToInt64((DateTime.Parse(start) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); endsecond = Convert.ToInt64((DateTime.Parse(end) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); break; case "0x15": sr.Desc = "采集指定的速度状态日志"; startsecond = Convert.ToInt64((DateTime.Parse(start) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); endsecond = Convert.ToInt64((DateTime.Parse(end) - DateTime.Parse("1970-01-01 00:00:00").ToLocalTime()).TotalSeconds); break; default: sr.Desc = ""; startsecond = 0; endsecond = 0; break; } sr.Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); bool result = SendOrderHander.Send_CTS_DriveRecordDataCollectionRequest(sysflag, token, long.Parse(sr.CID), long.Parse(sr.TNO), Convert.ToUInt32(cmd, 16), 0, startsecond, endsecond); sr.Res = result; Result = new ResponseResult(ResState.Success, "", sr); } else //不在线,无法下发指令 { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发采集指令!", null); } } else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发采集指令!", null); } } //不在线,无法下发指令 else { Result = new ResponseResult(ResState.OtherError, "车辆不在线,无法下发采集指令!", null); } } catch (Exception ex) { Result = new ResponseResult(ResState.OperationFailed, ex.Message, null); } //SendOrderHander.Send_CTS_SetTermParamDown(sysflag, token, cid, tno, paramlist); return(Result); }