소스 검색

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

LEIYI 5 달 전
부모
커밋
51a06aca18

+ 8 - 1
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -4100,6 +4100,7 @@ Group by PriceType ", dto.diId);
                 .Where(x=> {
                     var count = 0;
                     var stringArr = new string[] { "SYsupervisorConfirm", "SupervisorConfirm", "ManagerConfirm" };
+                    var max = 1;
                     foreach (var item in stringArr)
                     {
                         var number = x.GetType()?.GetProperty(item)?.GetValue(x).ObjToInt();
@@ -4108,7 +4109,13 @@ Group by PriceType ", dto.diId);
                             count++;
                         }
                     }
-                    return count > 1;
+
+                    if (x.PriceDetailType == 1044)
+                    {
+                        max = 0;
+                    }
+
+                    return count > max;
                 })
                 .Select(x =>
                 {

+ 62 - 0
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -11820,6 +11820,68 @@ ORDER by  gctggrc.id DESC
                 return Ok(_view);
             }
 
+            #region 成本无酒店价格数据进入超支
+            _sqlSugar.BeginTran();
+            var start_Bool = DateTime.TryParse(_dto.CheckInDate, out DateTime start_Time);
+            var end_Bool = DateTime.TryParse(_dto.CheckOutDate, out DateTime end_Time);
+            var groupCost = _sqlSugar.Queryable<Grp_GroupCost>().Where(x => x.Diid == _dto.DiId && x.IsDel == 0).ToList();
+            for (int i = 0; i < groupCost.Count; i++)
+            {
+                if (groupCost[i].Date.IsNullOrWhiteSpace() && i != 0)
+                {
+                    groupCost[i].Date = groupCost[i - 1].Date;
+                }
+            }
+            var groupCost_Grp = groupCost.GroupBy(x => x.Date).ToList();
+            List<Fin_GroupExtraCostDto_OP> extraCostList = new
+                 List<Fin_GroupExtraCostDto_OP>();
+
+            if (start_Bool && end_Bool)
+            {
+                while (start_Time < end_Time)
+                {
+                    foreach (var item in groupCost_Grp)
+                    {
+                        if (DateTime.TryParse(item.Key, out DateTime cost_Time))
+                        {
+                            if (DateTime.Compare(start_Time, cost_Time) == 0 && item.Sum(x => x.SGR + x.Suite + x.TBR + x.JS_ES) == 0)
+                            {
+                                extraCostList.Add(new
+                                     Fin_GroupExtraCostDto_OP
+                                {
+                                    Area = _dto.AreaId,
+                                    coefficient = 1.5M,
+                                    createUser = _dto.UserId,
+                                    currency = _dto.CardPriceCurrency,
+                                    diId = _dto.DiId,
+                                    ManagerConfirm = 0,
+                                    SupervisorConfirm = 0,
+                                    SYsupervisorConfirm = 0,
+                                    editType = 1,
+                                    PortType = 1,
+                                    price = _dto.CardPrice,
+                                    PriceCount = 1,
+                                    priceType = 1027,
+                                    priceDetailType = 1044,
+                                    PriceDt = start_Time.ToString("yyyy-MM-dd"),
+                                    priceName = $"酒店超支费用-酒店导入-({start_Time.ToString("yyyy/MM/dd")})",
+                                });
+                            }
+                        }
+                    }
+
+                    start_Time = start_Time.AddDays(1);
+                }
+            }
+
+            if (extraCostList.Any())
+            {
+                 await _carTouristGuideGroundRep.GroupExtraCost_OperatorList(extraCostList);
+            }
+            _sqlSugar.CommitTran();
+
+            #endregion
+
             #region 应用推送
 
             try

+ 17 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -1519,5 +1519,22 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return false;
         }
 
+        public async Task<Result> GroupExtraCost_OperatorList(List<Fin_GroupExtraCostDto_OP> dto)
+        {
+            Result rt = new Result();
+            foreach (var item in dto)
+            {
+                await  _daiRep.UpdateAsync<Fin_GroupExtraCost>(s => s.PriceName == item.priceName && s.DiId == item.diId, 
+                    s => new Fin_GroupExtraCost
+                    {
+                        IsDel = 1,
+                        DeleteTime = DateTime.Now.ToString("yyyy-MM-dd"),
+                        DeleteUserId = item.createUser
+                    });
+                rt = await PostGroupExtraCost_Operator(item);
+            }
+            return rt;
+        }
+
     }
 }