Esempio n. 1
0
        /// <summary>
        /// 月租车无在场记录 根据车牌出场
        /// </summary>
        /// <param name="carNumber"></param>
        /// <param name="users"></param>
        /// <param name="carOutModel"></param>
        /// <returns></returns>
        public CarOutRecord CarOut(string carNumber, CarUsers users, CarOutModel carOutModel)
        {
            var carport = _carPortrepository.GetAll().Where(x => x.CarUserId == users.Id).FirstOrDefault();
            var carOut  = new CarOutRecord()
            {
                InTime         = DateTime.Now,
                CarId          = users?.Id,
                OutTime        = carOutModel.OutTime,
                InType         = carOutModel.InOutType,
                Remark         = "无在场记录出场",
                CarPort        = carport,
                CarInCount     = 0,
                CarNumber      = carNumber,
                CarOutPhotoId  = carOutModel.ImageId,
                OutPhotoTime   = carOutModel.OutPhotoTime,
                OutType        = carOutModel.InOutType,
                Pay            = carOutModel.Pay,
                AdvancePayment = 0,
                ParkId         = carOutModel.ParkId
            };
            var id = _carOutRecordRepository.InsertAndGetId(carOut);



            var outRecord = _carOutRecordRepository.GetAllIncluding(x => x.CarPort, x => x.CarUser, x => x.Park).Where(x => x.Id == id).FirstOrDefault();

            _eventBus.Trigger(new CarOutRecordCreateedEventData()
            {
                CarOutRecord = outRecord
            });

            return(outRecord);
        }
Esempio n. 2
0
        public CarOutRecord CarOut(CarInRecord carIn, CarOutModel carOutModel)
        {
            var carOut = new CarOutRecord()
            {
                CarInCount           = carIn.CarInCount,
                ParkId               = carIn.ParkId,
                CarId                = carIn.CarId,
                CarNumber            = carIn.CarNumber,
                InTime               = carIn.InTime,
                Pay                  = carOutModel.Pay,
                Receivable           = carOutModel.Receivable,
                Remark               = carOutModel.Remark,
                CarPortId            = carIn.CarPortId,
                IsMonthTempIn        = carIn.IsMonthTempIn,
                TempConvertMonthTime = carIn.TempConvertMonthTime,
                PayType              = carOutModel.PayType,
                OfferTime            = carOutModel.OfferTime,
                OfferMoney           = carOutModel.OfferMoney,
                CarInPhotoId         = carIn.CarInPhotoId,
                CarOutPhotoId        = carOutModel.ImageId,
                InCloudId            = carIn.CloudId,
                IsMonthTimeOutInt    = carIn.IsMonthTimeOutInt,
                InType               = carIn.InType,
                IsErrorOut           = carOutModel.IsErrorOut,
                OutTime              = carOutModel.OutTime,
                OutPhotoTime         = carOutModel.OutPhotoTime
            };

            _carInRecordRepository.Delete(carIn.Id);

            var id = _carOutRecordRepository.InsertAndGetId(carOut);

            _unitOfWorkManager.Current.SaveChanges();


            var outRecord = _carOutRecordRepository.GetAllIncluding(x => x.CarPort, x => x.CarUser, x => x.Park).Where(x => x.Id == id).FirstOrDefault();


            _eventBus.Trigger(new CarOutRecordCreateedEventData()
            {
                CarOutRecord = outRecord
            });

            return(outRecord);
        }
Esempio n. 3
0
        public Task SetInfo(CarOutRecord carOutRecord)
        {
            var tempCarport = carOutRecord.CarUser?.CarPorts?.Where(z => z.StartTime <= DateTime.Now && z.EndTime >= DateTime.Now);

            synchronizationContext.Post(x =>
            {
                txt_CarNumber.Text     = carOutRecord.CarNumber;
                txt_CarInCount.Text    = carOutRecord.CarInCount.ToString();
                txt_CarportsCount.Text = carOutRecord == null ? "0" : tempCarport?.Count().ToString();
                txt_InTime.Text        = carOutRecord.InTime.ToString("yyyy-MM-dd hh:mm:ss");
                txt_RematingDays.Text  = tempCarport == null ? "0" : (tempCarport.Max(c => c.EndTime) - DateTime.Now).TotalDays.ToString();
                txt_CarType.Text       = tempCarport == null ? "临时车" : tempCarport.First().CarPortType.CustomName;
                txt_UserName.Text      = carOutRecord.CarUser?.Name;
                txt_OutTime.Text       = carOutRecord.OutTime.ToString("yyyy-MM-dd hh:mm:ss");

                txt_RematingDays.Text = tempCarport == null ? "0" : ((int)(tempCarport.Max(c => c.EndTime) - DateTime.Now).TotalDays).ToString();
            }, null);
            return(Task.CompletedTask);
        }
Esempio n. 4
0
 public Task SetInfo(long entranceId, CarOutRecord carOutRecord)
 {
     return(SetInfo(carOutRecord));
 }