瀏覽代碼

成本Api添加报批数据

yuanrf 11 月之前
父節點
當前提交
d500e6d224

+ 2 - 1
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -5217,7 +5217,8 @@ namespace OASystem.API.Controllers
                     x.VisaCountry,
                     x.VisaPrice,
                     x.Id,
-                }).ToList()
+                }).ToList(),
+                baoPi = _GroupCostParameterRepository.GetBaoPi(diid)
             }));
         }
 

+ 208 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/GroupCostParameterRepository.cs

@@ -56,5 +56,213 @@ namespace OASystem.Infrastructure.Repositories.Groups
             }
             return isTrue;
         }
+
+        public object GetBaoPi(int diid)
+        {
+            List<dynamic> dynamics = new List<dynamic>();
+            try
+            {
+                Grp_EnterExitCost eec = _sqlSugar.Queryable<Grp_EnterExitCost>().First(x => x.DiId == diid);
+                if (eec != null)
+                {
+                    var AirJJ = new
+                    {
+                        Type = "JJC",
+                        Price = eec.AirJJ
+                    };
+                    dynamics.Add(AirJJ);
+
+                    var AirGW = new
+                    {
+                        Type = "GWC",
+                        Price = eec.AirGW
+                    };
+                    dynamics.Add(AirGW);
+
+                    List<Grp_DayAndCost> dac1 = _sqlSugar.Queryable<Grp_DayAndCost>().Where(x => x.DiId == diid && x.Type == 1).ToList();  //酒店费用
+                    List<Grp_DayAndCost> dac2 = _sqlSugar.Queryable<Grp_DayAndCost>().Where(x => x.DiId == diid && x.Type == 2).ToList(); //餐费用
+                    List<Grp_DayAndCost> dac3 = (from item in _sqlSugar.Queryable<Grp_DayAndCost>() //公杂费用
+                                                 where item.DiId == diid && item.Type == 3
+                                                 select item).ToList();
+
+                    decimal SumHotel = 0;
+                    decimal SumMeals = 0;
+                    decimal SumGongZa = 0;
+
+                    List<dynamic> hotelList = new List<dynamic>();
+                    List<string> checkString = new List<string>();
+
+                    if (dac1.Count != 0)//酒店费用
+                    {
+                        for (int i = 0; i < dac1.Count; i++)
+                        {
+                            if (!string.IsNullOrWhiteSpace(dac1[i].Place))
+                            {
+                                if (!checkString.Contains(dac1[i].Place))
+                                {
+                                    var hotelData = new
+                                    {
+                                        CountryOrCity = dac1[i].Place,
+                                        Price = dac1[i].SubTotal
+                                    };
+                                    hotelList.Add(hotelData);
+                                    checkString.Add(dac1[i].Place);
+                                }
+                            }
+                            SumHotel += dac1[i].SubTotal;
+                        }
+                    }
+                    hotelList = hotelList.Distinct().ToList();
+                    List<dynamic> MealsList = new List<dynamic>();
+
+                    if (dac2.Count != 0) //餐费用
+                    {
+                        for (int i = 0; i < dac2.Count; i++)
+                        {
+                            if (checkString.Contains(dac2[i].Place))
+                            {
+                                var mealsData = new
+                                {
+                                    CountryOrCity = dac2[i].Place,
+                                    Price = dac2[i].SubTotal
+                                };
+
+                                MealsList.Add(mealsData);
+                            }
+                            SumMeals += dac2[i].SubTotal;
+                        }
+                    }
+                    MealsList = MealsList.Distinct().ToList();
+                    List<dynamic> GongZaList = new List<dynamic>();
+
+                    if (dac3.Count != 0) //公杂费用
+                    {
+                        for (int i = 0; i < dac3.Count; i++)
+                        {
+                            if (checkString.Contains(dac3[i].Place))
+                            {
+                                var gongZaData = new
+                                {
+                                    CountryOrCity = dac3[i].Place,
+                                    Price = dac3[i].SubTotal
+                                };
+
+                                GongZaList.Add(gongZaData);
+                            }
+                            SumGongZa += dac3[i].SubTotal;
+                        }
+                    }
+                    GongZaList = GongZaList.Distinct().ToList();
+
+                    //签证
+                    var Visa = new
+                    {
+                        Type = "Visa",
+                        Price = eec.Visa,
+                        Desc = eec.VisaRemark
+                    };
+                    dynamics.Add(Visa);
+
+                    //核酸检测费
+                    var HeSuan = new
+                    {
+                        Type = "HeSuan",
+                        Price = eec.HeSuan  //元/人
+                    };
+                    dynamics.Add(HeSuan);
+
+                    //保险费
+                    var Insurance = new
+                    {
+                        Type = "Insurance",
+                        Price = eec.Safe  //元/人
+                    };
+                    dynamics.Add(Insurance);
+
+                    // 伙食费
+                    var Meals = new
+                    {
+                        Type = "Meals",
+                        Content = MealsList
+                    };
+                    dynamics.Add(Meals);
+
+                    // 酒店费用
+                    var Hotel = new
+                    {
+                        Type = "Hotel",
+                        Content = hotelList
+                    };
+                    dynamics.Add(Hotel);
+
+                    // 公杂费用
+                    var GongZa = new
+                    {
+                        Type = "GongZa",
+                        Content = GongZaList
+                    };
+                    dynamics.Add(GongZa);
+
+                    decimal AirJJCTotal = 0;
+                    decimal AirGWCTotal = 0;
+
+                    //境内费用(其他费用)选择框
+                    if (eec.ChoiceOne == 1)
+                    {
+                        AirJJCTotal += Math.Round((eec.InsidePay), 2);
+                        AirGWCTotal += Math.Round((eec.InsidePay), 2);
+                    }
+                    //国际旅费合计选择框
+                    if (eec.ChoiceTwo == 1)
+                    {
+                        if (eec.AirJJC_Checked == 1) AirJJCTotal += Math.Round((eec.OutsideJJPay), 2);
+                        if (eec.AirGWC_Checked == 1) AirGWCTotal += Math.Round((eec.OutsaideGWPay), 2);
+                    }
+                    //住宿费合计选择框
+                    if (eec.ChoiceThree == 1)
+                    {
+                        AirJJCTotal += Math.Round(SumHotel, 2);
+                        AirGWCTotal += Math.Round(SumHotel, 2);
+                    }
+
+                    //伙食费合计选择框
+                    if (eec.ChoiceFour == 1)
+                    {
+                        AirJJCTotal += Math.Round(SumMeals, 2);
+                        AirGWCTotal += Math.Round(SumMeals, 2);
+                    }
+
+                    //公杂费合计选择框
+                    if (eec.ChoiceFour == 1)
+                    {
+                        AirJJCTotal += Math.Round(SumGongZa, 2);
+                        AirGWCTotal += Math.Round(SumGongZa, 2);
+                    }
+
+                    // 报批总报价 - 经济舱
+                    var SumAirJJC = new
+                    {
+                        Type = "SumAirJJC",
+                        Price = AirJJCTotal
+                    };
+                    dynamics.Add(SumAirJJC);
+
+                    //报批总报价 - 公务舱
+                    var SumAirGWC = new
+                    {
+                        Type = "SumAirGWC",
+                        Price = AirGWCTotal
+                    };
+                    dynamics.Add(SumAirGWC);
+
+                }
+            }
+            catch (Exception)
+            {
+                dynamics = new List<dynamic>();
+            }
+
+            return dynamics;
+        }
     }
 }