|
@@ -53,6 +53,7 @@ using OASystem.API.OAMethodLib.Hub.HubClients;
|
|
|
using OASystem.API.OAMethodLib.Hub.Hubs;
|
|
|
using System.Collections.Generic;
|
|
|
using OASystem.API.OAMethodLib.JuHeAPI;
|
|
|
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -5631,6 +5632,169 @@ namespace OASystem.API.Controllers
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> PostGroupCostModulePrompt(GroupCostModulePromptDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ #region 参数验证
|
|
|
+ if (dto.DiId < 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入有效的DiId参数!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<int> cTableIds = new List<int>() {
|
|
|
+ 76 ,//酒店预订
|
|
|
+ 77 ,//行程
|
|
|
+ 79 ,//车 / 导游地接
|
|
|
+ 80 ,//签证
|
|
|
+ 81 ,//邀请 / 公务活
|
|
|
+ 82 ,//团组客户保险
|
|
|
+ 85 ,//机票预订
|
|
|
+ 98 ,//其他款项
|
|
|
+ 285 ,//收款退还
|
|
|
+ 751 ,//酒店早餐
|
|
|
+ 1015 // 超支费用
|
|
|
+ };
|
|
|
+
|
|
|
+ if (dto.CTable < 0 && !cTableIds.Contains(dto.CTable))
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入有效的CTable参数!"));
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ //Grp_GroupCostParameter 预算表 Grp_GroupCost 详细费用列表
|
|
|
+ var _GroupCostParameters = _usersRep._sqlSugar.Queryable<Grp_GroupCostParameter>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).ToList();
|
|
|
+
|
|
|
+ if (_GroupCostParameters.Count <= 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(true, "暂无该团组成本信息!", new List<dynamic>()));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_GroupCostParameters[0].IsShare == 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(true, "该团组成本未完成!", new List<dynamic>()));
|
|
|
+ }
|
|
|
+ var _GroupCosts = _usersRep._sqlSugar.Queryable<Grp_GroupCost>().Where(it => it.IsDel == 0 && it.Diid == dto.DiId).ToList();
|
|
|
+
|
|
|
+ //处理date为空问题
|
|
|
+ if (_GroupCosts.Count > 0)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < _GroupCosts.Count; i++)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(_GroupCosts[i].Date))
|
|
|
+ {
|
|
|
+ if (i > 0)
|
|
|
+ {
|
|
|
+ _GroupCosts[i].Date = _GroupCosts[i - 1].Date;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ GroupCostModulePromptView _view = new GroupCostModulePromptView()
|
|
|
+ {
|
|
|
+ CurrencyCode = _GroupCostParameters[0].Currency,
|
|
|
+ Rate = _GroupCostParameters[0].Rate
|
|
|
+ };
|
|
|
+
|
|
|
+ List<GroupCostModulePromptInfo> _ModulePromptInfos = new List<GroupCostModulePromptInfo>();
|
|
|
+ foreach (var item in _GroupCostParameters)
|
|
|
+ {
|
|
|
+ GroupCostModulePromptInfo modulePromptInfo = new GroupCostModulePromptInfo()
|
|
|
+ {
|
|
|
+ CostType = item.CostType,
|
|
|
+ CostTypeStartTime = Convert.ToDateTime(item.CostTypeStartTime).ToString("yyyy-MM-dd"),
|
|
|
+ CostTypeEndTime = Convert.ToDateTime(item.CostTypeendTime).ToString("yyyy-MM-dd"),
|
|
|
+ CostTypeNumber = item.CostTypenumber
|
|
|
+ };
|
|
|
+
|
|
|
+ List<string> costTypes = new List<string>() { "A","B" };
|
|
|
+
|
|
|
+ List<Grp_GroupCost> _GroupCostsTypeData = new List<Grp_GroupCost>();
|
|
|
+ var _GroupCostsDuplicates = _GroupCostParameters.GroupBy(x => x.CostType).Select(y => y.FirstOrDefault());
|
|
|
+ if (_GroupCostsDuplicates.Count() == 1)
|
|
|
+ {
|
|
|
+ _GroupCostsTypeData = _GroupCosts;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _GroupCostsTypeData = _GroupCosts.Where(it => Convert.ToDateTime(it.Date) >= Convert.ToDateTime(item.CostTypeStartTime) &&
|
|
|
+ Convert.ToDateTime(it.Date) <= Convert.ToDateTime(item.CostTypeendTime)).ToList();
|
|
|
+ }
|
|
|
+
|
|
|
+ //var _GroupCostsTypeData = _GroupCosts.Where(it => it.Date)
|
|
|
+ List<dynamic> datas = new List<dynamic>();
|
|
|
+ /*
|
|
|
+ * 76 酒店预订
|
|
|
+ * 77 行程
|
|
|
+ * 79 车/导游地接
|
|
|
+ * 80 签证
|
|
|
+ * 81 邀请/公务活动
|
|
|
+ * 82 团组客户保险
|
|
|
+ * 85 机票预订
|
|
|
+ * 98 其他款项
|
|
|
+ * 285 收款退还
|
|
|
+ * 751 酒店早餐
|
|
|
+ * 1015 超支费用
|
|
|
+ */
|
|
|
+ switch (dto.CTable)
|
|
|
+ {
|
|
|
+ case 76: // 酒店预订
|
|
|
+ datas.AddRange(
|
|
|
+ _GroupCostsTypeData.Select(it => new
|
|
|
+ {
|
|
|
+ it.DAY,
|
|
|
+ it.Date,
|
|
|
+ it.ACCON,
|
|
|
+ it.ITIN,
|
|
|
+ it.SGR,
|
|
|
+ it.TBR,
|
|
|
+ it.JS_ES,
|
|
|
+ it.Suite
|
|
|
+ })
|
|
|
+ );
|
|
|
+ break;
|
|
|
+ case 79: // 车/导游地接
|
|
|
+ datas.AddRange(
|
|
|
+ _GroupCostsTypeData.Select(it => new
|
|
|
+ {
|
|
|
+ it.Date,
|
|
|
+ it.CarCost,
|
|
|
+ it.TGS,
|
|
|
+ it.SGR,
|
|
|
+ it.TBR,
|
|
|
+ it.JS_ES,
|
|
|
+ it.Suite
|
|
|
+ })
|
|
|
+ );
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ modulePromptInfo.Data = datas;
|
|
|
+ _ModulePromptInfos.Add(modulePromptInfo);
|
|
|
+
|
|
|
+ }
|
|
|
+ _view.ModulePromptInfos = _ModulePromptInfos;
|
|
|
+
|
|
|
+ return Ok(JsonView(true,"操作成功!", _view));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, ex.Message));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 酒店预定 保留
|