Procházet zdrojové kódy

新增团组成本报价功能支持

在 FinancialController 中新增字段 `_groupCheckBox` 并注入依赖,支持团组成本选中项操作。
新增 SQL 查询逻辑,从 `Grp_GroupCostParameter` 表中获取团组成本报价数据。
新增处理团组成本报价的逻辑,包括 `groupCost` 和 `groupCostItem` 属性的赋值。
新增 `GroupCostCalculate` 类,支持单人报价和总报价的计算逻辑。
新增 `ChildFeeInfo` 类,用于表示费用项的详细信息,并支持截断小数计算。
更新视图模型 `Fin_ForeignReceivablesView`,新增 `groupCost` 和 `groupCostItem` 字段。
优化代码格式,新增命名空间引用,完善仓库逻辑以支持团组成本参数的操作。
Lyyyi před 7 hodinami
rodič
revize
7b4470e7d9

+ 19 - 3
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -55,6 +55,7 @@ namespace OASystem.API.Controllers
         private readonly PaymentRefundAndOtherMoneyRepository _paymentRefundAndOtherMoneyRep; //收款退还与其他款项 仓库
         private readonly DelegationInfoRepository _delegationInfoRep;             //团组信息 仓库
         private readonly ForeignReceivablesRepository _foreignReceivablesRepository;
+        private readonly CheckBoxsRepository _groupCheckBox; //团组成本选中项 仓库
 
         /// <summary>
         /// 初始化
@@ -73,7 +74,9 @@ namespace OASystem.API.Controllers
             HttpClient httpClient,
             DelegationInfoRepository delegationInfoRep,
             SetDataRepository setDataRep,
-            ForeignReceivablesRepository foreignReceivablesRepository)
+            ForeignReceivablesRepository foreignReceivablesRepository,
+            CheckBoxsRepository groupCheckBox
+            )
         {
             _mapper = mapper;
             _config = configuration;
@@ -89,6 +92,7 @@ namespace OASystem.API.Controllers
             _delegationInfoRep = delegationInfoRep;
             _setDataRep = setDataRep;
             _foreignReceivablesRepository = foreignReceivablesRepository;
+            _groupCheckBox = groupCheckBox;
         }
 
         #region 日付申请
@@ -2380,7 +2384,6 @@ namespace OASystem.API.Controllers
             if (list_rst.Any())
             {
                 //查询团组各模块费用信息
-
                 string sql = @"
                     Select
                       Id,
@@ -2571,6 +2574,13 @@ namespace OASystem.API.Controllers
                     .AddParameters(new { GroupIds = groupIds })
                     .ToList();
 
+                #region 2025-12-01 新增团组成本报价
+                string groupCostSql = @"select * from  Grp_GroupCostParameter where IsDel = 0 and CostType = 'A' And diid IN (@GroupIds)";
+                var groupCostDatas = _sqlSugar.SqlQueryable<GroupCostCalculate>(groupCostSql)
+                    .AddParameters(new { GroupIds = groupIds })
+                    .ToList();
+                #endregion
+
                 int rowNumber = 1;
                 foreach (var item_rst in list_rst)
                 {
@@ -2732,6 +2742,13 @@ namespace OASystem.API.Controllers
 
                     item_rst.feeItem = feeDatas;
                     #endregion
+
+                    #region 团组成本报价信息 2025-12-01 13:56:55
+
+                    var groupCostInfo = groupCostDatas.FirstOrDefault(f => f.DiId == diId);
+                    item_rst.groupCost = groupCostInfo?.GroupTotalPrice ?? 0.00m;
+                    item_rst.groupCostItem = groupCostInfo?.ChildFeeInfos ?? new List<ChildFeeInfo>();
+                    #endregion
                 }
 
                 result.total_fr = sumAll_fr.ToString("#0.00");
@@ -2752,7 +2769,6 @@ namespace OASystem.API.Controllers
                         Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/应收款项模板 - 副本.xls")
                     };
 
-
                     int excNo = 1;
                     foreach (var item in list_rst)
                     {

+ 208 - 34
OASystem/OASystem.Domain/Entities/Groups/Grp_GroupCostParameter.cs

@@ -1,45 +1,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OASystem.Domain.Entities.Groups
+namespace OASystem.Domain.Entities.Groups
 {
     /// <summary>
     /// 团组成本预算表
     /// </summary>
     [SugarTable("Grp_GroupCostParameter")]
-    public class Grp_GroupCostParameter:EntityBase
+    public class Grp_GroupCostParameter : EntityBase
     {
         /// <summary>
         /// 团组ID
         /// </summary>
-        [SugarColumn(IsNullable =true,ColumnDataType ="int")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int DiId { get; set; }
         /// <summary>
         /// 币种
@@ -322,8 +292,212 @@ namespace OASystem.Domain.Entities.Groups
         public int TDCRS { get; set; }
     }
 
-    public class Grp_GroupCostParameterView: Grp_GroupCostParameter
+    public class Grp_GroupCostParameterView : Grp_GroupCostParameter
+    {
+
+    }
+
+    /// <summary>
+    /// 费用计算
+    /// </summary>
+    public class GroupCostCalculate : Grp_GroupCostParameter
+    {
+        #region 各项费用计算 单人报价、总报价
+        /// <summary>
+        /// 签证单人报价
+        /// </summary>
+        public decimal VisaSinglePrice { get { return VisaCB * VisaXS; } }
+        /// <summary>
+        /// 保险单人报价
+        /// </summary>
+        public decimal PolicySinglePrice { get { return BXCB * BXXS; } }
+
+        /// <summary>
+        /// 火车票单人报价
+        /// </summary>
+        public decimal TicketSinglePrice { get { return HCPCB * HCPXS; } }
+
+        /// <summary>
+        /// 机票经济舱单人报价
+        /// </summary>
+        public decimal EconomySinglePrice { get { return JJCCB * JJCXS; } }
+
+        /// <summary>
+        /// 机票公务舱单人报价
+        /// </summary>
+        public decimal BusinessSinglePrice { get { return GWCCB * GWCXS; } }
+
+        /// <summary>
+        /// 机票头等舱单人报价
+        /// </summary>
+        public decimal FirstClassSinglePrice { get { return TDCCB * TDCXS; } }
+
+        /// <summary>
+        /// 船票单人报价
+        /// </summary>
+        public decimal FerryTicketSinglePrice { get { return CPCB * CPXS; } }
+
+        /// <summary>
+        /// 核酸检测单人报价
+        /// </summary>
+        public decimal NucleicAcidTesSinglePrice { get { return HSCB * HSXS; } }
+
+        /// <summary>
+        /// 酒店TBR 单人报价
+        /// </summary>
+        public decimal HotelTBRSinglePrice { get { return TBRCB * TBRXS; } }
+
+        /// <summary>
+        /// 酒店SGR 单人报价
+        /// </summary>
+        public decimal HotelSGRSinglePrice { get { return SGRCB * SGRXS; } }
+
+        /// <summary>
+        /// 酒店JSES 单人报价
+        /// </summary>
+        public decimal HotelJSESSinglePrice { get { return JSESCB * JSESXS; } }
+
+        /// <summary>
+        /// 酒店Suite 单人报价
+        /// </summary>
+        public decimal HotelSuiteSinglePrice { get { return SUITECB * SUITEXS; } }
+
+        /// <summary>
+        /// 地接 单人报价
+        /// </summary>
+        public decimal GroundSinglePrice { get { return DJCB * DJXS; } }
+
+        /// <summary>
+        /// 公务 单人报价
+        /// </summary>
+        public decimal BusinessActivitySinglePrice { get { return GWCB * GWXS; } }
+
+        /// <summary>
+        /// 零用金 单人报价
+        /// </summary>
+        public decimal PettyCashSinglePrice { get { return LYJCB * LYJXS; } }
+        #endregion
+
+        #region 费用组合计算 单人报价、总报价
+        /// <summary>
+        /// 费用集合
+        /// </summary>
+        public List<ChildFeeInfo> ChildFeeInfos
+        {
+            get
+            {
+                var list = new List<ChildFeeInfo>();
+                var otherSinglePrice = VisaSinglePrice + PolicySinglePrice + TicketSinglePrice + FerryTicketSinglePrice + NucleicAcidTesSinglePrice + GroundSinglePrice + BusinessActivitySinglePrice + PettyCashSinglePrice;
+                //经济舱 TBR、经济舱 SGR、经济舱 JS/ES、经济舱 SUITE、公务舱 TBR、公务舱 SGR、公务舱 JS/ES、公务舱 SUITE、头等舱 JS/ES、头等舱 SUITE
+                if (JJCRS > 0)
+                {
+                    if (TBRNumber > 0)
+                    {
+                        list.Add(new ChildFeeInfo("经济舱 TBR", EconomySinglePrice + HotelTBRSinglePrice + otherSinglePrice, JJCRS));
+                    }
+                    else if (SGRNumber > 0)
+                    {
+                        list.Add(new ChildFeeInfo("经济舱 SGR", EconomySinglePrice + HotelSGRSinglePrice + otherSinglePrice, JJCRS));
+                    }
+                    else if(SGRNumber > 0)
+                    {
+                        list.Add(new ChildFeeInfo("经济舱 JS/ES", EconomySinglePrice + HotelJSESSinglePrice + otherSinglePrice, JJCRS));
+                    }
+                    else if(SGRNumber > 0)
+                    {
+                        list.Add(new ChildFeeInfo("经济舱 SUITE", EconomySinglePrice + HotelSuiteSinglePrice + otherSinglePrice, JJCRS));
+                    }
+                }
+
+                if (GWCRS > 0)
+                {
+                    if (TBRNumber > 0)
+                    {
+                        list.Add(new ChildFeeInfo("公务舱 TBR", BusinessSinglePrice + HotelTBRSinglePrice + otherSinglePrice, GWCRS));
+                    }
+                    else if(SGRNumber > 0)
+                    {
+                        list.Add(new ChildFeeInfo("公务舱 SGR", BusinessSinglePrice + HotelSGRSinglePrice + otherSinglePrice, GWCRS));
+                    }
+                    else if(SGRNumber > 0)
+                    {
+                        list.Add(new ChildFeeInfo("公务舱 JS/ES", BusinessSinglePrice + HotelJSESSinglePrice + otherSinglePrice, GWCRS));
+                    }
+                    else if(SGRNumber > 0)
+                    {
+                        list.Add(new ChildFeeInfo("公务舱 SUITE", BusinessSinglePrice + HotelSuiteSinglePrice + otherSinglePrice, GWCRS));
+                    }
+                }
+
+                if (TDCRS > 0)
+                {
+                    if (SGRNumber > 0)
+                    {
+                        list.Add(new ChildFeeInfo("头等舱 JS/ES", FirstClassSinglePrice + HotelJSESSinglePrice + otherSinglePrice, TDCRS));
+                    }
+                    else if(SGRNumber > 0)
+                    {
+                        list.Add(new ChildFeeInfo("头等舱 SUITE", FirstClassSinglePrice + HotelSuiteSinglePrice + otherSinglePrice, TDCRS));
+                    }
+                }
+
+                return list;
+            }
+        }
+
+        #endregion
+
+        public decimal GroupTotalPrice { get { return ChildFeeInfos.Sum(x => x.TotalPrice); } }
+
+    }
+
+    public class ChildFeeInfo
     {
+        /// <summary>
+        /// 费用类型名称
+        /// </summary>
+        public string TypeName { get; set; }
+
+        /// <summary>
+        /// 单人报价
+        /// </summary>
+        public decimal SinglePrice { get; set; }
 
+        /// <summary>
+        /// 总人数
+        /// </summary>
+        public int TotalPeople { get; set; }
+
+        /// <summary>
+        /// 总报价
+        /// </summary>
+        public decimal TotalPrice { get; set; }
+
+        public ChildFeeInfo() { }
+
+        /// <summary>
+        /// 重构
+        /// </summary>
+        /// <param name="typeName">类型名称</param>
+        /// <param name="singlePrice">单人报价</param>
+        /// <param name="totalPeople">人数</param>
+        public ChildFeeInfo(string typeName, decimal singlePrice, int totalPeople)
+        {
+            TypeName = typeName;
+            SinglePrice = TruncateTo(singlePrice, 2);
+            TotalPeople = totalPeople;
+            TotalPrice = TruncateTo(SinglePrice * totalPeople, 2);
+        }
+
+        /// <summary>
+        /// 截断保留指定位数小数(不四舍五入)
+        /// </summary>
+        public decimal TruncateTo(decimal value, int decimals)
+        {
+            decimal factor = (decimal)Math.Pow(10, decimals);
+            return Math.Truncate(value * factor) / factor;
+        }
     }
+
+    
 }

+ 11 - 0
OASystem/OASystem.Domain/ViewModels/Financial/Fin_ForeignReceivablesView.cs

@@ -1,4 +1,5 @@
 using OASystem.Domain.Entities.Financial;
+using OASystem.Domain.Entities.Groups;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -421,6 +422,16 @@ namespace OASystem.Domain.ViewModels.Financial
         /// 子项明细
         /// </summary>
         public List<ClientFeeInfoView>? feeItem { get; set; }
+
+        /// <summary>
+        /// 团组成本 - 报价
+        /// </summary>
+        public decimal groupCost { get; set; }
+
+        /// <summary>
+        /// 团组成本 - 报价 明细
+        /// </summary>
+        public List<ChildFeeInfo> groupCostItem { get; set; }
     }
 
 

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

@@ -426,5 +426,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             return dynamics;
         }
+    
+        
     }
 }