public static decimal CalculateMonthlyRentExpiredWaitPayAmount(DateTime start, string grantId) { ParkGrant grant = ParkGrantServices.QueryByGrantId(grantId); if (grant == null) { throw new MyException("获取授权失败"); } if (grant.BeginDate == DateTime.MinValue || grant.EndDate == DateTime.MinValue || (grant.EndDate != DateTime.MinValue && grant.EndDate.Date >= DateTime.Now.Date)) { return(0); } ParkCarType carType = ParkCarTypeServices.QueryParkCarTypeByRecordId(grant.CarTypeID); if (carType == null) { throw new MyException("获取车类失败"); } if (carType.BaseTypeID != BaseCarType.MonthlyRent) { return(0); } DateTime startDate = grant.EndDate.AddDays(1).Date; DateTime endDate = start.Date; List <string> plateNos = new List <string>(); EmployeePlate plate = EmployeePlateServices.Query(grant.PlateID); if (plate == null) { throw new MyException("获取车牌号失败"); } plateNos.Add(plate.PlateNo); if (!string.IsNullOrWhiteSpace(grant.PKLot)) { List <ParkGrant> sameGrants = ParkGrantServices.QueryByParkingAndLotAndCarType(grant.PKID, grant.PKLot, BaseCarType.MonthlyRent, grant.GID); foreach (var item in sameGrants) { int lot1 = grant.PKLot.Split(',').Length; int lot2 = item.PKLot.Split(',').Length; if (lot1 != lot2) { continue; } EmployeePlate plate1 = EmployeePlateServices.Query(item.PlateID); if (plate1 == null) { throw new MyException("获取车牌号失败"); } plateNos.Add(plate1.PlateNo); } } IParkOrder factory = ParkOrderFactory.GetFactory(); return(factory.QueryMonthExpiredNotPayAmount(startDate, endDate, grant.PKID, plateNos)); }