public string Execute(Hashtable params_ht) { Hashtable res = params_ht; if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整")); } else { uid = res["UID"].ToString().Trim(); OrdersManager om = new OrdersManager(); VehicleManager vm = new VehicleManager(); Hashtable ht = om.GetUserCurrentOrderVehicleGPSNum(uid); if (ht == null) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "您没有车辆无法寻车")); } else { string vid = SiteHelper.GetHashTableValueByKey(ht, "VID"); string gpsnum = SiteHelper.GetHashTableValueByKey(ht, "VehicleGPSNum"); bool isSuccess = vm.FindVehicle(vid); if (!isSuccess) { return(SiteHelper.GetJsonFromHashTable(null, "faild", "指令发送失败")); } else { return(SiteHelper.GetJsonFromHashTable(null, "success", "指令发送成功")); } } } }
public string Execute(Hashtable params_ht) { Hashtable res = params_ht; if (res["UID"] == null || res["VID"] == null || res["UID"].ToString().Trim().Length <= 0 || res["VID"].ToString().Trim().Length <= 0) { Hashtable result = new Hashtable(); result["ErrCode"] = "00";//服务器异常 return(SiteHelper.GetJsonFromHashTable(result, "faild", "参数不完整")); } else { uid = res["UID"].ToString().Trim(); vid = res["VID"].ToString().Trim(); VehicleManager vm = new VehicleManager(); Hashtable ht = vm.GetVehicleInfoByID(vid); if (ht == null) { Hashtable result = new Hashtable(); result["ErrCode"] = "01";//车辆未找到 return(SiteHelper.GetJsonFromHashTable(result, "faild", "未找到相关车辆信息")); } else { //占用车辆禁止操作 /*if (ht["USESTATE"].ToString() != "1") * { * OrdersManager om = new OrdersManager(); * Hashtable user_ht = om.GetLatestUserByVehicleID(vid); * if (user_ht != null && user_ht.Keys.Count > 0) * { * string vehicle_uid = SiteHelper.GetHashTableValueByKey(user_ht, "UserID"); * if (uid.CompareTo(vehicle_uid) != 0) * { * Hashtable result = new Hashtable(); * result["ErrCode"] = "02";//车辆已被占用 * return SiteHelper.GetJsonFromHashTable(result, "faild", "指令发送失败,车辆已被占用"); * } * } * }*/ bool isSuccess = vm.FindVehicle(vid); if (!isSuccess) { Hashtable result = new Hashtable(); result["ErrCode"] = "04";//指令发送失败 return(SiteHelper.GetJsonFromHashTable(result, "faild", "指令发送失败")); } else { return(SiteHelper.GetJsonFromHashTable(null, "success", "指令发送成功")); } } } }
public ApiResp Execute(System.Collections.Hashtable params_ht) { ApiResp resp = new ApiResp(); resp.code = "-1"; string client_id = params_ht["client_id"].ToString(); long timestamp = long.Parse(params_ht["timestamp"].ToString()); string sign = params_ht["sign"].ToString(); string plate_no = params_ht["plate_no"].ToString(); string order_no = params_ht["order_no"].ToString(); int op_type = int.Parse(params_ht["op_type"].ToString()); bool result = false; OrdersManager om = new OrdersManager(); BaoJiaManager mgr = new BaoJiaManager(); Hashtable order_ht = mgr.GetOrderInfo(order_no); if (order_ht != null && order_ht.Keys.Count > 0) { string order_state = SiteHelper.GetHashTableValueByKey(order_ht, "OrderState"); string vid = SiteHelper.GetHashTableValueByKey(order_ht, "VehicleID"); VehicleManager vm = new VehicleManager(); if (order_state == "1") { switch (op_type) { case 1: result = vm.OpenVehicle(vid); //如果是首次开车订单StartTime设为当前时间 if (result && string.IsNullOrEmpty(order_ht["STARTTIME"].ToString())) { mgr.SetCurrentOrderStartTime(order_ht["ID"].ToString()); om.UpdateOrderGPS(order_ht["ID"].ToString(), true); } break; case 2: result = vm.CloseVehicle(vid); break; case 3: result = vm.FindVehicle(vid); break; default: break; } } } else { resp.code = "-1"; resp.msg = "未找到相关订单"; } if (result) { resp.code = "0"; resp.msg = "成功"; } else { resp.code = "-1"; resp.msg = "失败"; } return(resp); }