Exemplo n.º 1
0
        /// <summary>
        /// 添加车辆
        /// </summary>
        public ActionResult AddVehicle(string tenantCode, string licenceNumber,string deviceNo, string SIM, EnumVehicleType vehicleType)
        {
            try
            {
                ModelFacade.Merchant.CustomerVehicle.AddVehicleOperateTran(tenantCode, licenceNumber, deviceNo, SIM, vehicleType, this.Passport.UserName);
                return Json(new AjaxResult(), JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return this.ErrorResult(ex);
            }
            ////EMVehicle entity = new EMVehicle();
            ////entity.DeviceNo = gpsCode;
            ////entity.ExpireTime = expireTime.ToDateTimeNull();
            ////entity.GPSTypeID = gpsType.ToULong();
            ////entity.GroupID = ulong.MaxValue;
            ////entity.IconType = (EnumVehicleType)(vehicleType.ToInt());

            //////entity.UserName = SessionUserInfo.UserName;
            ////entity.TenantCode = tenantCode;
            ////entity.SIMNo = SIM;
            ////entity.VehicleCode = Guid.NewGuid();
            ////entity.LicenceNumber = licenceNumber;
            ////entity.IsStop = false;
            ////entity.CreateTime = DateTime.Now;
            ////entity.InstallTime = DateTime.Now;

            //////DBProcessResult bl = _SysSettingService.AddVehicle(view);
            ////DBProcessResult<int> res = new VehicleManagerWCFService().AddVehicleOperateTran(entity, SessionUserInfo.UserName);
            ////return Json(new { IsSuccess = res.IsSuccess, Message = res.Message, addCount = res.ReturnValue }, null, Encoding.UTF8, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 添加车辆
 /// </summary>
 public ActionResult AddVehicle(string tenantCode, string licenceNumber, string deviceNo, string SIM, EnumVehicleType vehicleType, ulong groupID)
 {
     try
     {
         ModelFacade.VehicleManage.vehicleManageOperateModel.AddVehicleOperateTran(tenantCode, licenceNumber, deviceNo, SIM, vehicleType, this.Passport.UserName, groupID);
         return Json(new AjaxResult(), JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return this.ErrorResult(ex);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 保存车辆
 /// </summary>     
 public ActionResult SetVehicle(string VehicleCode, string LicenceNumber, string SIMNo, EnumVehicleType IconType, ulong groupID)
 {
     try
     {
         ModelFacade.VehicleManage.vehicleManageOperateModel.SetVehicle(VehicleCode, LicenceNumber, SIMNo, IconType,groupID);
         return Json(new AjaxResult(), JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return this.ErrorResult(ex);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 设置修改车辆
        /// </summary>
        public void SetVehicle(string vehicleCode, string licenceNumber, string simNo, EnumVehicleType iconType, ulong groupID)
        {

            var rep = DMRepository.Get<EVehicle>();
            var device = rep.Get(p => p.VehicleCode.ToString() == vehicleCode);

            if (device == null) throw new BusinessException("关联车辆不存在!");

            if (device.LicenceNumber != licenceNumber && DACFacade.Movo.VehicleDAC.IsExist(device.TenantCode, licenceNumber))
                throw new BusinessException("已经有相同车牌号的车辆!");

            device.LicenceNumber = licenceNumber;
            device.SIMNo = simNo;
            device.IconType = iconType;
            device.GroupID = groupID;
            rep.Save(device, p => p.VehicleCode.ToString() == vehicleCode, p => new Columns(p.LicenceNumber, p.SIMNo, p.IconType, p.GroupID));
        }
Exemplo n.º 5
0
        public void AddVehicleOperateTran(string tenantCode, string licenceNumber, string deviceNo, string SIMNo, EnumVehicleType vehicleType, string passportUserName, ulong groupID)
        {
            if (DACFacade.Movo.VehicleDAC.IsExist(tenantCode, licenceNumber)) throw new BusinessException("已经有相同车牌号的车辆!");


            var rep = DMRepository.Get<EVehicle>();

            var device = rep.Get(p => p.DeviceNo == deviceNo);

            if (device == null) throw new NullReferenceException("要关联的设备不存在!设备号:" + deviceNo + "");


            device.SIMNo = SIMNo;
            device.LicenceNumber = licenceNumber;
            device.GroupID = groupID;
            device.TenantCode = tenantCode;
            device.InstallTime = DateTime.Now;

            using (var dmTrans = DMContext.GetTransaction())
            {
                try
                {
                    var trans = dmTrans.BeginTransaction();
                    rep.Save(device, p => p.VehicleCode == device.VehicleCode, trans);

                    if (DACFacade.Gps.HistoryDataStoreConfigDAC.Select(device.VehicleCode) == null)
                    {
                        //新增车辆历史数据配置
                        var gpsTypeEntity = DACFacade.Gps.GpsTypeDAC.Select(device.GPSTypeID);
                        if (gpsTypeEntity == null) throw new BusinessException("设备类型不存在,请重新填写!");

                        string tableName = GetGPSCodeHelper.GetTableNameByCondition(gpsTypeEntity.PrefixCode);
                        var table = DACFacade.Gps.HistoryDataStoreConfigDAC.SelectHisotryDataStoreTableByTbName(tableName);
                        if (table == null) throw new BusinessException(string.Format("找不到对应的历史数据表[{0}],请联系DBA!", tableName));
                        var configEntity = new EHistoryDataStoreConfig();
                        configEntity.RecordID = Guid.NewGuid();
                        configEntity.CreateDate = DateTime.Now;
                        configEntity.Enable = true;
                        configEntity.StoreTable = table;
                        configEntity.VehicleCode = device.VehicleCode;

                        DACFacade.Gps.HistoryDataStoreConfigDAC.Insert(trans, configEntity);
                    }

                    if (rep.Get<EVehicleLog>(p => p.VehicleCode == device.VehicleCode) == null)
                    {
                        //新增车辆Log
                        var vehicleLog = new EVehicleLog()
                        {
                            BeginDate = DateTime.Now,
                            LogID = DACFacade.Movo.IdentityNoDAC.GetVehicleLogID(),
                            DeviceNo = device.DeviceNo,
                            EndDate = null,
                            GPSCode = device.GPSCode,
                            GPSTypeID = device.GPSTypeID,
                            InitMileage = device.InitMileage,
                            LicenceNumber = device.LicenceNumber,
                            Operator = passportUserName,
                            SIMNo = device.SIMNo,
                            TenantCode = device.TenantCode,
                            VehicleCode = device.VehicleCode,
                            GroupID = device.GroupID
                        };

                        rep.Add(vehicleLog, trans);
                    }

                    dmTrans.Commit();
                }
                catch (Exception ex)
                {
                    dmTrans.Rollback();
                    throw ex;
                }
            }
        }
Exemplo n.º 6
0
 //类型转换
 private string GetIconTypeName(EnumVehicleType type)
 {
     switch (type)
     {
         case EnumVehicleType.Car:
             return "轿车";
         case EnumVehicleType.Motorcycle:
             return "摩托车";
         case EnumVehicleType.Truck:
             return "货车";
         case EnumVehicleType.ElectricBike:
             return "电动车";
         case EnumVehicleType.Person:
             return "人";
         case EnumVehicleType.Marker:
             return "标注点";
     }
     return string.Empty;
 }
Exemplo n.º 7
0
        /// <summary>
        /// 设置车辆
        /// </summary>
        public ActionResult SetVehicle(string VehicleCode, string LicenceNumber, string SIMNo, EnumVehicleType IconType, DateTime? expireTime)
        {
            try
            {
                ModelFacade.Merchant.CustomerVehicle.SetVehicle(VehicleCode, LicenceNumber, SIMNo, IconType, expireTime);
                return Json(new AjaxResult(), JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return this.ErrorResult(ex);
            }
            ////Guid code = new Guid(VehicleCode);
            ////EMVehicle vehicle = this._WebManagerWCFService.GetVehicle(code);
            ////if (vehicle == null)
            ////{
            ////    return Json(new
            ////    {
            ////        result = 0,
            ////        data = "关联车辆不存在!"
            ////    });
            ////}
            ////VehicleViewModel model = new VehicleViewModel();
            ////model.VehicleCode = vehicle.VehicleCode;
            ////model.LicenceNumber = LicenceNumber;
            ////model.GroupID = vehicle.GroupID;
            ////model.GPSTypeID = vehicle.GPSTypeID;
            ////model.GPSTypeName = vehicle.GPSTypeName;
            ////model.DeviceNo = vehicle.DeviceNo;
            ////model.GPSCode = vehicle.GPSCode;
            ////model.TenantCode = vehicle.TenantCode;
            ////model.InitMileage = vehicle.InitMileage;
            ////model.InstallTime = vehicle.InstallTime;
            ////model.CreateTime = vehicle.CreateTime;
            ////model.IsStop = vehicle.IsStop;

            ////model.ExpireTime = ExpireTime;
            ////model.SIMNo = SIMNo;
            ////model.IconType = (EnumVehicleType)IconType;

            ////DBProcessResult dbResult = this._OperationsService.ModifyVehicle(model);
            ////return Json(new
            ////{
            ////    result = dbResult.IsSuccess ? 1 : 0,
            ////    data = dbResult.Message
            ////});
        }
Exemplo n.º 8
0
 public NavalVehicle(int id, List <Driver> drivers, EnumVehicleType type) : base(id, drivers)
 {
     this.type = type;
 }
Exemplo n.º 9
0
 public Ship(int id, List <Driver> drivers, EnumVehicleType type) : base(id, drivers, type)
 {
 }