diff --git a/Src/Dlhis.Canteen/Order/Request/BalanceHainingImportRequest.cs b/Src/Dlhis.Canteen/Order/Request/BalanceHainingImportRequest.cs index 1b23a7f4..391a765d 100644 --- a/Src/Dlhis.Canteen/Order/Request/BalanceHainingImportRequest.cs +++ b/Src/Dlhis.Canteen/Order/Request/BalanceHainingImportRequest.cs @@ -101,6 +101,11 @@ public class BalanceHainingImportRequest : IValidatableObject { yield return new ValidationResult("仅支持设备消费", new[] { nameof(ApplicationType) }); } + + if (BusinessPlaceCode.IsEmpty()) + { + yield return new ValidationResult("营业掉不可为空", new[] { nameof(BusinessPlaceCode) }); + } } else { diff --git a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs index 4a32d04f..5da5d96a 100644 --- a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs +++ b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs @@ -500,6 +500,22 @@ public class BalanceService : IBalanceService var gainfo = await _dbContext.Queryable().Where(x => x.Code == request.UserCode).SingleAsync(); gainfo.ThrowIfNull($"工号{request.UserCode}不存在"); var gainfoMeal = await _dbContext.Queryable().Where(x => x.UserCode == request.UserCode).SingleAsync(); + if (gainfoMeal == null) + { + gainfoMeal = new GainfoMealEntity + { + CreatedBy = 1, + ModifiedBy = 1, + UserNo = gainfo.No, + UserCode = gainfo.Code, + Balance = 0, + BalanceOfRecharge = 0, + BalanceOfSubsidies = 0, + Version = 0 + }; + + await _dbContext.InsertAsync(gainfoMeal); + } var businessPlace = await _dbContext.Queryable() .LeftJoin((a, b) => a.Code == b.PlaceCode)