public ActionResult Refuse(string keyvalue, int type) { if (type == 0) {//拜访车辆(有车) VisitcarEntity car = visitcarbll.GetEntity(keyvalue); car.State = 99; visitcarbll.SaveForm(keyvalue, car); } else if (type == 3) {//拜访人员 CarUserEntity car = CarUserbll.GetEntity(keyvalue); car.State = 99; CarUserbll.SaveForm(keyvalue, car, null); } else if (type == 1) {//物料车 OperticketmanagerBLL obll = new OperticketmanagerBLL(); OperticketmanagerEntity op = obll.GetEntity(keyvalue); op.ExamineStatus = 99; obll.SaveForm(keyvalue, op); } else {//2危化品车 HazardouscarBLL hbll = new HazardouscarBLL(); HazardouscarEntity ha = hbll.GetEntity(keyvalue); ha.State = 99; hbll.Update(keyvalue, ha); } return(Success("操作成功。")); }
public ActionResult GetEntity(string keyValue, int type) { if (type == 0) { var data = visitcarbll.GetEntity(keyValue); return(ToJsonResult(data)); } else if (type == 1) { OperticketmanagerBLL operbll = new OperticketmanagerBLL(); var data = operbll.GetEntity(keyValue); return(ToJsonResult(data)); } else if (type == 3) {//拜访人员 CarUserBLL CarUserbll = new CarUserBLL(); var data = CarUserbll.GetEntity(keyValue); return(ToJsonResult(data)); } else { HazardouscarBLL haza = new HazardouscarBLL(); var data = haza.GetEntity(keyValue); return(ToJsonResult(data)); } }
public ActionResult CarOut(string keyValue, string Note, int type, List <PersongpsEntity> pergps) { //根据危化品类型添加二级节点 var data = dataItemDetailBLL.GetDataItemListByItemCode("'SocketUrl'"); string IP = ""; int Port = 0; foreach (var item in data) { if (item.ItemName == "IP") { IP = item.ItemValue; } else if (item.ItemName == "Port") { Port = Convert.ToInt32(item.ItemValue); } } visitcarbll.CarOut(keyValue, Note, type, pergps); CarAlgorithmEntity Car = new CarAlgorithmEntity(); Car.ID = keyValue; Car.State = 1; SocketHelper.SendMsg(Car.ToJson(), IP, Port); DataItemDetailBLL pdata = new DataItemDetailBLL(); string key = string.Empty; // "21049470"; string sign = string.Empty; // "4gZkNoh3W92X6C66Rb6X"; var pitem = pdata.GetItemValue("Hikappkey"); //海康服务器密钥 var url = pdata.GetItemValue("HikBaseUrl"); //海康服务器地址 if (!string.IsNullOrEmpty(pitem)) { key = pitem.Split('|')[0]; sign = pitem.Split('|')[1]; } if (type == 0) { VisitcarEntity car = visitcarbll.GetEntity(keyValue); HikOut(url, key, sign, car.CarNo); } else if (type == 1) { OperticketmanagerBLL obll = new OperticketmanagerBLL(); OperticketmanagerEntity op = obll.GetEntity(keyValue); HikOut(url, key, sign, op.Platenumber); } else if (type == 2) { HazardouscarBLL hbll = new HazardouscarBLL(); HazardouscarEntity ha = hbll.GetEntity(keyValue); HikOut(url, key, sign, ha.CarNo); } return(Success("操作成功。")); }
public ActionResult GetFormJson(string keyValue) { var data = operticketmanagerbll.GetEntity(keyValue); return(ToJsonResult(data)); }
public string GetCarPoint(string id, string type) { string sn = ""; string startTime = ""; string endTime = ""; string Url = new DataItemDetailBLL().GetItemValue("IOTUrl"); switch (type) { case "0": break; case "1": break; case "2": break; case "3": var visitcar = visitbll.GetEntity(id); sn = visitcar.GPSID; if (visitcar.InTime != null) { startTime = Convert.ToDateTime(visitcar.InTime).ToString("yyyy-MM-ddTHH:mm:ss"); } else { startTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"); } if (visitcar.OutTime != null) { endTime = Convert.ToDateTime(visitcar.InTime).ToString("yyyy-MM-ddTHH:mm:ss"); } else { endTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"); } break; case "4": var opercar = operbll.GetEntity(id); sn = opercar.GpsId; if (opercar.Getdata != null) { startTime = Convert.ToDateTime(opercar.Getdata).ToString("yyyy-MM-ddTHH:mm:ss"); } else { startTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"); } if (opercar.OutDate != null) { endTime = Convert.ToDateTime(opercar.OutDate).ToString("yyyy-MM-ddTHH:mm:ss"); } else { endTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"); } break; case "5": var hazardouscar = hazarbll.GetEntity(id); sn = hazardouscar.GPSID; if (hazardouscar.InTime != null) { startTime = Convert.ToDateTime(hazardouscar.InTime).ToString("yyyy-MM-ddTHH:mm:ss"); } else { startTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"); } if (hazardouscar.OutTime != null) { endTime = Convert.ToDateTime(hazardouscar.InTime).ToString("yyyy-MM-ddTHH:mm:ss"); } else { endTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"); } break; } string json = "{\"sn\": \"" + sn + "\",\"startTime\": \"" + startTime + "\",\"endTime\": \"" + endTime + "\"}"; string msg = HttpCommon.HttpPostJson(Url + "/services/app/GpsCar/GetDeviceGpsData", json); IotCar car = JsonConvert.DeserializeObject <IotCar>(msg); GpsList gps = new GpsList(); List <GpsPoint> PointList = new List <GpsPoint>(); foreach (var carGpsData in car.result) { GpsPoint point = new GpsPoint(); point.X = Convert.ToDouble(carGpsData.Latitude); point.Y = Convert.ToDouble(carGpsData.Longitude); point.Z = 200; PointList.Add(point); } gps.ID = id; gps.data = PointList; return(gps.ToJson()); }
public ActionResult ChangeState(string keyvalue, int type, int state) { //根据危化品类型添加二级节点 #region 获取编码管理配置信息 var data = dataItemDetailBLL.GetDataItemListByItemCode("'SocketUrl'"); string IP = ""; int Port = 0; foreach (var item in data) { if (item.ItemName == "IP") { IP = item.ItemValue; } else if (item.ItemName == "Port") { Port = Convert.ToInt32(item.ItemValue); } } DataItemDetailBLL pdata = new DataItemDetailBLL(); string key = string.Empty; // "21049470"; string sign = string.Empty; // "4gZkNoh3W92X6C66Rb6X"; var pitem = pdata.GetItemValue("Hikappkey"); //海康服务器密钥 var baseurl = pdata.GetItemValue("HikBaseUrl"); //海康服务器地址 if (!string.IsNullOrEmpty(pitem)) { key = pitem.Split('|')[0]; sign = pitem.Split('|')[1]; } #endregion state++; if (type == 0) {//拜访车辆 VisitcarEntity car = visitcarbll.GetEntity(keyvalue); car.State = state; car.InTime = DateTime.Now; visitcarbll.SaveForm(keyvalue, car); CarAlgorithmEntity Car = new CarAlgorithmEntity(); Car.CarNo = car.CarNo; Car.GPSID = car.GPSID; Car.GPSName = car.GPSNAME; Car.ID = car.ID; Car.Type = 3; Car.State = 0; Car.LineName = car.LineName; Car.GoodsName = ""; SocketHelper.SendMsg(Car.ToJson(), IP, Port); //车辆放行 (疫情期间此功能暂时屏蔽) //AddCarpermission(baseurl, key, sign, car.CarNo, car.Phone, car.Dirver); var baselist = CarUserbll.addUserJurisdiction(keyvalue, state, baseurl, key, sign); return(Content(baselist.ToJson())); } else if (type == 3) {//拜访人员 CarUserEntity car = CarUserbll.GetEntity(keyvalue); car.State = type; car.InTime = DateTime.Now; CarUserbll.SaveForm(keyvalue, car, null); //人员添加出入权限 var baselist = CarUserbll.addUserJurisdiction(keyvalue, state, baseurl, key, sign); return(Content(baselist.ToJson())); } else if (type == 1) {//物料车辆 string parkNames = "1号岗,二号地磅"; OperticketmanagerBLL obll = new OperticketmanagerBLL(); OperticketmanagerEntity op = obll.GetEntity(keyvalue); op.ExamineStatus = state; if (state == 3) { op.Getdata = DateTime.Now; } obll.SaveForm(keyvalue, op); CarAlgorithmEntity Car = new CarAlgorithmEntity(); Car.CarNo = op.Platenumber; Car.GPSID = op.GpsId; Car.GPSName = op.GpsName; Car.ID = op.ID; Car.State = 0; Car.Type = 4; string Dress = op.Dress; Car.GoodsName = Dress; int ISwharf = op.ISwharf; string Transporttype = op.Transporttype; if (Transporttype == "提货") { Car.LineName = op.Dress + Transporttype; if (ISwharf == 1) { Car.LineName += "(码头)"; parkNames += ",码头岗"; } } else { if (ISwharf == 1) { Car.LineName = "物料转运(码头)"; parkNames += ",码头岗"; } else { Car.LineName = "转运(纯称重)"; } } SocketHelper.SendMsg(Car.ToJson(), IP, Port); //车辆放行 AddCarpermission(baseurl, key, sign, op.Platenumber, op.DriverName, op.DriverTel, parkNames); return(Success("操作成功。")); } else {//危化品车辆 HazardouscarBLL hbll = new HazardouscarBLL(); HazardouscarEntity ha = hbll.GetEntity(keyvalue); ha.State = state; ha.InTime = DateTime.Now; hbll.Update(keyvalue, ha); CarAlgorithmEntity Car = new CarAlgorithmEntity(); Car.CarNo = ha.CarNo; Car.GPSID = ha.GPSID; Car.GPSName = ha.GPSNAME; Car.ID = ha.ID; Car.Type = 5; Car.State = 0; Car.LineName = ha.HazardousName; Car.GoodsName = ha.HazardousName; SocketHelper.SendMsg(Car.ToJson(), IP, Port); //车辆放行 CarIn(baseurl, key, sign, ha.CarNo, ha.Phone, ha.Dirver); //人员添加出入权限 var baselist = CarUserbll.addUserJurisdiction(keyvalue, state, baseurl, key, sign); return(Content(baselist.ToJson())); } }