|
@@ -6,6 +6,7 @@ using NPOI.Util;
|
|
|
using OASystem.Domain;
|
|
|
using OASystem.Domain.Dtos.Financial;
|
|
|
using OASystem.Domain.Dtos.Groups;
|
|
|
+using OASystem.Domain.Dtos.QiYeWeChat;
|
|
|
using OASystem.Domain.Entities.Financial;
|
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
using OASystem.Domain.Entities.Resource;
|
|
@@ -15,7 +16,9 @@ using OASystem.Infrastructure.Repositories.System;
|
|
|
using OASystem.Infrastructure.Tools;
|
|
|
using SqlSugar.Extensions;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
using System.Reflection;
|
|
|
+using static NPOI.HSSF.Util.HSSFColor;
|
|
|
|
|
|
namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
@@ -713,9 +716,19 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
public async Task<Result> OpCarTouristGuideGroundContent(OpCarTouristGuideGroundContentDto dto)
|
|
|
{
|
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
+
|
|
|
+ var di = _sqlSugar.Queryable<Grp_DelegationInfo>().First(x => x.Id == dto.DiId && x.IsDel == 0);
|
|
|
+ if (di == null)
|
|
|
+ {
|
|
|
+ result.Code = -1;
|
|
|
+ result.Msg = "无该团组信息!";
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
try
|
|
|
{
|
|
|
BeginTran();
|
|
|
+
|
|
|
List<Grp_CarTouristGuideGroundReservationsContent> carTouristList = dto.OPContentList.Select(item => new Grp_CarTouristGuideGroundReservationsContent
|
|
|
{
|
|
|
Id = item.Id,
|
|
@@ -730,9 +743,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
DatePrice = item.DatePrice,
|
|
|
Count = item.Count,
|
|
|
}).ToList();
|
|
|
+
|
|
|
string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm ss");
|
|
|
|
|
|
var ids = carTouristList.Select(x1 => x1.Id);
|
|
|
+
|
|
|
_ = _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservationsContent>().Where(x => x.DiId == dto.DiId && x.CTGGRId == dto.CTGGRId).SetColumns(x => new Grp_CarTouristGuideGroundReservationsContent
|
|
|
{
|
|
|
IsDel = 1,
|
|
@@ -749,71 +764,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
|
|
|
if (carTouristList.Count > 0)
|
|
|
{
|
|
|
- #region load
|
|
|
-
|
|
|
- //车超时费
|
|
|
- //餐费和三公经费那个表做完匹配后也放进超支表里
|
|
|
- //添加导游超时费用
|
|
|
-
|
|
|
- DataTable tb = new DataTable();
|
|
|
- tb.Columns.Add("日期", typeof(DateTime));
|
|
|
- tb.Columns.Add("费用", typeof(decimal));
|
|
|
- tb.Columns.Add("币种", typeof(string));
|
|
|
- var carExtraList = carTouristList.Where(x => x.SId == 982 && x.Price != 0).ToList();
|
|
|
- var mealPriceList = carTouristList.Where(x => (x.SId == 93 || x.SId == 988 || x.SId == 989) && x.Price != 0).GroupBy(x => x.DatePrice).ToList();
|
|
|
- var tgOvertime = carTouristList.Where(x => x.SId == 1059 && x.Price != 0).ToList();
|
|
|
-
|
|
|
- List<Tuple<int, string, int, decimal>> arr = new List<Tuple<int, string, int, decimal>>();
|
|
|
- arr.Add(new Tuple<int, string, int,decimal>(1074, "早餐超支费用", 1077, 1M)); // sid name setdataid 系数
|
|
|
- arr.Add(new Tuple<int, string, int,decimal>(1075, "午餐超支费用", 1078, 1M));
|
|
|
- arr.Add(new Tuple<int, string, int,decimal>(1076, "晚餐超支费用", 1079, 1M));
|
|
|
-
|
|
|
- //成本数据
|
|
|
- List<Grp_GroupCost> _GroupCosts = new List<Grp_GroupCost>();
|
|
|
-
|
|
|
- var _GroupCostParameters = _groupCostParameterRepository.GetGroupCostParameterMainByDiid(dto.DiId);
|
|
|
-
|
|
|
- if (_GroupCostParameters != null && _GroupCostParameters.IsShare == 1)
|
|
|
- {
|
|
|
- _GroupCosts = _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;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var CostSoure = _GroupCosts.GroupBy(x => x.Date).ToList();
|
|
|
-
|
|
|
- _GroupCosts.Clear();
|
|
|
-
|
|
|
- foreach (var costSoure in CostSoure)
|
|
|
- {
|
|
|
- var cost = costSoure.ToList();
|
|
|
- cost[0].D = cost.Sum(x => x.D);
|
|
|
- cost[0].B = cost.Sum(x => x.B);
|
|
|
- cost[0].L = cost.Sum(x => x.L);
|
|
|
- _GroupCosts.Add(cost[0]);
|
|
|
- }
|
|
|
- }
|
|
|
+ #region 超支处理
|
|
|
|
|
|
- mealPriceList.ForEach(x =>
|
|
|
+ Dictionary<int, int> mealsDic = new Dictionary<int, int>()
|
|
|
{
|
|
|
- var row = tb.NewRow();
|
|
|
- row["日期"] = x.Key;
|
|
|
- row["费用"] = x.Sum(x => x.Price * x.Count);
|
|
|
- row["币种"] = x.FirstOrDefault()?.Currency;
|
|
|
- tb.Rows.Add(row);
|
|
|
- });
|
|
|
+ {988,1074},
|
|
|
+ {93,1075},
|
|
|
+ {989,1076},
|
|
|
+ };
|
|
|
|
|
|
//限制只能选择地区
|
|
|
var opSingle = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(x => x.Id == dto.CTGGRId && x.IsDel == 0);
|
|
@@ -837,87 +795,83 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
priceCity = opSingle.Area;
|
|
|
}
|
|
|
|
|
|
+ cityPrice ??= new Grp_NationalTravelFee
|
|
|
+ {
|
|
|
+ FoodCost = "0",
|
|
|
+ Id = 0,
|
|
|
+ };
|
|
|
+
|
|
|
+ List<Tuple<int, string, int, decimal>> arr = new List<Tuple<int, string, int, decimal>>();
|
|
|
+ arr.Add(new Tuple<int, string, int,decimal>(1074, "早餐超支费用", 1077, 1M)); // sid name setdataid 系数
|
|
|
+ arr.Add(new Tuple<int, string, int,decimal>(1075, "午餐超支费用", 1078, 1M));
|
|
|
+ arr.Add(new Tuple<int, string, int,decimal>(1076, "晚餐超支费用", 1079, 1M));
|
|
|
+ arr.Add(new Tuple<int, string, int, decimal>(982, "车超时费用", 1050, 2.4M));
|
|
|
+ arr.Add(new Tuple<int, string, int, decimal>(1059, "导游超时费用", 1072, 1M));
|
|
|
+ arr.Add(new Tuple<int, string, int, decimal>(1085, "景点门票超支费用", 1086, 1.2M));
|
|
|
+ arr.Add(new Tuple<int, string, int, decimal>(1073, "翻译超时费用", 1087, 1.5M));
|
|
|
+
|
|
|
//超支费用表(数据添加) Fin_GroupExtraCost
|
|
|
List<Fin_GroupExtraCost> groupExtraCostsArr = new List<Fin_GroupExtraCost>();
|
|
|
+ List<List<Fin_GroupExtraCost>> enterOverspendArr = new List<List<Fin_GroupExtraCost>>();
|
|
|
|
|
|
- var di = _sqlSugar.Queryable<Grp_DelegationInfo>().First(x => x.Id == dto.DiId && x.IsDel == 0);
|
|
|
- if (di == null)
|
|
|
- {
|
|
|
- result.Code = -1;
|
|
|
- result.Msg = "无该团组信息!";
|
|
|
- return result;
|
|
|
- }
|
|
|
+ var setDataArr = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 17).ToList();
|
|
|
+ var setDataCurrArr = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 66).ToList();
|
|
|
+ var number = 0; //人数
|
|
|
+ var aMeal = cityPrice.FoodCost.ObjToDecimal() / 2; //一顿三公费用
|
|
|
+ var findSsetDataCurr = setDataCurrArr.Find(q => q.Id == carTouristList[0].Currency);
|
|
|
|
|
|
- //车超时费
|
|
|
- if (carExtraList.Count > 0)
|
|
|
+ foreach (var item in arr)
|
|
|
{
|
|
|
- foreach (var item in carExtraList)
|
|
|
- {
|
|
|
- groupExtraCostsArr.Add(new Fin_GroupExtraCost
|
|
|
+ var a = carTouristList.Where(x => x.SId == item.Item1 && x.Price != 0).Select(x => {
|
|
|
+
|
|
|
+ string remake = x.Remark;
|
|
|
+
|
|
|
+ //餐费超支备注额外处理
|
|
|
+ if (mealsDic.Values.Contains(item.Item1))
|
|
|
{
|
|
|
- Price = item.Price,
|
|
|
- CreateTime = DateTime.Now,
|
|
|
- CreateUserId = dto.CreateUserId,
|
|
|
- Coefficient = 2M,
|
|
|
- DiId = dto.DiId,
|
|
|
- PriceCurrency = item.Currency,
|
|
|
- PriceName = di.TeamName + "-" + priceCity + "-" + "车超时费(地接导入)",
|
|
|
- PriceType = 1028,
|
|
|
- PriceDt = item.DatePrice.ObjToDate(),
|
|
|
- PriceSum = item.Price * item.Count,
|
|
|
- PriceCount = item.Count,
|
|
|
- FilePath = string.Empty,
|
|
|
- PriceDetailType = 1050,
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ var keyId = mealsDic.FirstOrDefault(q => q.Value == item.Item1).Key;
|
|
|
|
|
|
- //导游超时费用
|
|
|
- if (tgOvertime.Count > 0)
|
|
|
- {
|
|
|
- foreach (var item in tgOvertime)
|
|
|
- {
|
|
|
- groupExtraCostsArr.Add(new Fin_GroupExtraCost
|
|
|
+ //今日一顿餐食费用 (今日一顿餐费 + 今日一顿超支费用)
|
|
|
+ var dayMealPrice = carTouristList.Where(q => q.SId == keyId && q.Price != 0 &&
|
|
|
+ DateTime.Compare(x.DatePrice.ObjToDate(),q.DatePrice.ObjToDate()) == 0).Sum( q => q.Price) + x.Price;
|
|
|
+
|
|
|
+ var findSetData = setDataArr.Find(q => q.Id == keyId);
|
|
|
+
|
|
|
+
|
|
|
+ if (di.VisitPNumber > 1 && x.Count == 1)
|
|
|
+ {
|
|
|
+ number = di.VisitPNumber;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ number = x.Count;
|
|
|
+ }
|
|
|
+
|
|
|
+ dayMealPrice = dayMealPrice / number;
|
|
|
+
|
|
|
+ remake = $"{x.DatePrice?.ToString("M/d")} {findSetData?.Name}{findSsetDataCurr?.Name} {dayMealPrice * number} - 财政{aMeal} * {number} = {findSsetDataCurr?.Name}{(dayMealPrice * number) - (aMeal * number)}";
|
|
|
+ }
|
|
|
+
|
|
|
+ return new Fin_GroupExtraCost
|
|
|
{
|
|
|
- Price = item.Price,
|
|
|
+ Coefficient = item.Item4,
|
|
|
CreateTime = DateTime.Now,
|
|
|
CreateUserId = dto.CreateUserId,
|
|
|
- Coefficient = 2M,
|
|
|
DiId = dto.DiId,
|
|
|
- PriceCurrency = item.Currency,
|
|
|
- PriceName = di.TeamName + "-" + priceCity + "-" + "导游超时费(地接导入)",
|
|
|
- PriceType = 1028,
|
|
|
- PriceDt = item.DatePrice.ObjToDate(),
|
|
|
- PriceSum = item.Price * item.Count,
|
|
|
- PriceCount = item.Count,
|
|
|
FilePath = string.Empty,
|
|
|
- PriceDetailType = 1072,
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- List<List<Fin_GroupExtraCost>> enterOverspendArr = new List<List<Fin_GroupExtraCost>>();
|
|
|
-
|
|
|
- foreach (var item in arr)
|
|
|
- {
|
|
|
-
|
|
|
- var a = carTouristList.Where(x => x.SId == item.Item1 && x.Price != 0).Select(x => new Fin_GroupExtraCost
|
|
|
- {
|
|
|
- Coefficient = item.Item4,
|
|
|
- CreateTime = DateTime.Now,
|
|
|
- CreateUserId = dto.CreateUserId,
|
|
|
- DiId = dto.DiId,
|
|
|
- FilePath = string.Empty,
|
|
|
- IsDel = 0,
|
|
|
- PriceCount = x.Count,
|
|
|
- Price = x.Price,
|
|
|
- PriceDt = x.DatePrice.ObjToDate(),
|
|
|
- PriceCurrency = x.Currency,
|
|
|
- PriceSum = x.Count * x.Price,
|
|
|
- PriceName = di.TeamName + "-" + priceCity + "-" + $"{item.Item2}(地接导入)",
|
|
|
- PriceType = 1028,
|
|
|
- PriceDetailType = item.Item3,
|
|
|
+ IsDel = 0,
|
|
|
+ PriceCount = x.Count,
|
|
|
+ Price = x.Price,
|
|
|
+ PriceDt = x.DatePrice.ObjToDate(),
|
|
|
+ PriceCurrency = x.Currency,
|
|
|
+ PriceSum = x.Count * x.Price,
|
|
|
+ PriceName = di.TeamName + "-" + priceCity + "-" + $"{item.Item2}(地接导入)",
|
|
|
+ PriceType = 1028,
|
|
|
+ PriceDetailType = item.Item3,
|
|
|
+ Remark = remake,
|
|
|
+ };
|
|
|
}).ToList();
|
|
|
+
|
|
|
if (a.Count > 0)
|
|
|
{
|
|
|
enterOverspendArr.Add(a);
|
|
@@ -930,83 +884,71 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
groupExtraCostsArr.AddRange(enterOverspendArr.SelectMany(x => x).ToList());
|
|
|
}
|
|
|
|
|
|
- if (_GroupCostParameters != null)
|
|
|
+ var start = opSingle.ServiceStartTime.ObjToDate();
|
|
|
+ var end = opSingle.ServiceEndTime.ObjToDate();
|
|
|
+ string remake = string.Empty;
|
|
|
+ var exitMealCount = 0;
|
|
|
+ var price = 0M;
|
|
|
+ var day = 0;
|
|
|
+ while (start <= end)
|
|
|
{
|
|
|
- //币种
|
|
|
- var currOpResult = await _setDataRep.PostCurrencyByDiid(dto.DiId, 79, carTouristList[0].Currency);
|
|
|
- var currOp = currOpResult.Code == 0 ? (currOpResult.Data as CurrencyInfo) == null ? 1 : (currOpResult.Data as CurrencyInfo)!.Rate : 1;
|
|
|
-
|
|
|
- //三公费用汇率 (修改为对比成本)
|
|
|
- //var cityCurrResult = await _setDataRep.PostCurrencyByDiid(dto.DiId, 79, cityPrice.Currency);
|
|
|
- //var cityCurr = cityCurrResult.Code == 0 ? (cityCurrResult.Data as CurrencyInfo) == null ? 1 : (cityCurrResult.Data as CurrencyInfo)!.Rate : 1;
|
|
|
-
|
|
|
- //成本汇率
|
|
|
- var costCurr = _GroupCostParameters.Rate;
|
|
|
-
|
|
|
- if (tb.Rows.Count > 0)
|
|
|
+ //查看每日每顿是否存在超支
|
|
|
+ //不存在则加入退费 (三公一顿 - 消费金额)
|
|
|
+ //93 , 989
|
|
|
+ bool isExistsWu = carTouristList.Where(x => x.SId == mealsDic[93] && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0 && x.Price > 0).Count() == 0;
|
|
|
+ bool isExistsWan = carTouristList.Where(x => x.SId == mealsDic[989] && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0 && x.Price > 0).Count() == 0;
|
|
|
+ var mealPriceWu = carTouristList.Where(x => x.SId == 93 && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0).Sum(x => x.Price);
|
|
|
+ var mealPriceWan = carTouristList.Where(x => x.SId == 989 && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0).Sum(x => x.Price);
|
|
|
+
|
|
|
+ if (isExistsWu && isExistsWan)
|
|
|
{
|
|
|
- foreach (DataRow item in tb.Rows)
|
|
|
- {
|
|
|
- var listTime = Convert.ToDateTime(item["日期"]);
|
|
|
- var costFliterArr = _GroupCosts.Where(x => DateTime.TryParse(x.Date, out DateTime costData)
|
|
|
- && costData.ToString("yyyy-MM-dd") == listTime.ToString("yyyy-MM-dd")).ToList();
|
|
|
+ remake += $"{start.ToString("M/d")}午餐和晚餐,";
|
|
|
+ exitMealCount += 2;
|
|
|
+ price += (aMeal * 2 * di.VisitPNumber) - (mealPriceWu) - (mealPriceWan);
|
|
|
|
|
|
- //成本日期费用
|
|
|
- decimal foodCost = (costFliterArr.Sum(x => x.D) + costFliterArr.Sum(x => x.L) + costFliterArr.Sum(x => x.B)) * di.VisitPNumber;
|
|
|
-
|
|
|
- var price = Convert.ToDecimal(item["费用"]);
|
|
|
- if (item["币种"].ToString() != _GroupCostParameters.Currency.ToString().Trim()) //币种不相同
|
|
|
- {
|
|
|
- var a = item["币种"].ToString();
|
|
|
- var b = _GroupCostParameters.Currency.ToString().Trim();
|
|
|
-
|
|
|
- //币种str匹配不上在匹配Name
|
|
|
- if (int.TryParse(a, out int a1))
|
|
|
- {
|
|
|
- a = _sqlSugar.Queryable<Sys_SetData>().First(x => x.IsDel == 0 && x.Id == a1).Name;
|
|
|
- }
|
|
|
-
|
|
|
- if (int.TryParse(b, out int b1))
|
|
|
- {
|
|
|
- b = _sqlSugar.Queryable<Sys_SetData>().First(x => x.IsDel == 0 && x.Id == b1).Name;
|
|
|
- }
|
|
|
-
|
|
|
- if (a != b)
|
|
|
- {
|
|
|
- //全部转换为rmb;
|
|
|
- item["费用"] = price * currOp;
|
|
|
- foodCost = (foodCost * costCurr);
|
|
|
+ }
|
|
|
+ else if (isExistsWu)
|
|
|
+ {
|
|
|
+ remake += $"{start.ToString("M/d")}午餐,";
|
|
|
+ exitMealCount += 1;
|
|
|
+ price += (aMeal * di.VisitPNumber) - (mealPriceWu);
|
|
|
+ }
|
|
|
+ else if (isExistsWan)
|
|
|
+ {
|
|
|
+ remake += $"{start.ToString("M/d")}晚餐,";
|
|
|
+ exitMealCount += 1;
|
|
|
+ price += (aMeal * di.VisitPNumber) - (mealPriceWan);
|
|
|
+ }
|
|
|
|
|
|
- item["币种"] = "836";
|
|
|
- //cityPrice.Currency = 836;
|
|
|
- }
|
|
|
- }
|
|
|
+ start = start.AddDays(1);
|
|
|
+ day++;
|
|
|
+ }
|
|
|
|
|
|
- if (price > foodCost)
|
|
|
- {
|
|
|
- //每天费用大于三公费用
|
|
|
- groupExtraCostsArr.Add(new Fin_GroupExtraCost
|
|
|
- {
|
|
|
- Price = price - foodCost,
|
|
|
- CreateTime = DateTime.Now,
|
|
|
- CreateUserId = dto.CreateUserId,
|
|
|
- Coefficient = 1,
|
|
|
- DiId = dto.DiId,
|
|
|
- PriceCurrency = Convert.ToInt32(item["币种"]),
|
|
|
- PriceName = di.TeamName + "-" + priceCity + "-" + "餐费(地接导入)",
|
|
|
- PriceType = 1028,
|
|
|
- PriceDt = Convert.ToDateTime(item["日期"]),
|
|
|
- PriceSum = price - foodCost,
|
|
|
- PriceCount = 1,
|
|
|
- FilePath = string.Empty,
|
|
|
- PriceDetailType = 1049,
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ if (exitMealCount > 0)
|
|
|
+ {
|
|
|
+ remake = remake.TrimEnd(',');
|
|
|
+ remake += $"财政 {findSsetDataCurr?.Name} {aMeal} * {di.VisitPNumber} * {exitMealCount}餐";
|
|
|
+ price = price / di.VisitPNumber / exitMealCount;
|
|
|
+ groupExtraCostsArr.Add(new Fin_GroupExtraCost
|
|
|
+ {
|
|
|
+ Coefficient = 1,
|
|
|
+ CreateTime = DateTime.Now,
|
|
|
+ CreateUserId = dto.CreateUserId,
|
|
|
+ DiId = dto.DiId,
|
|
|
+ FilePath = string.Empty,
|
|
|
+ IsDel = 0,
|
|
|
+ PriceCount = di.VisitPNumber * exitMealCount * -1 ,
|
|
|
+ Price = price,
|
|
|
+ PriceDt = opSingle.ServiceStartTime.ObjToDate(),
|
|
|
+ PriceCurrency = findSsetDataCurr == null ? carTouristList[0].Currency: findSsetDataCurr.Id ,
|
|
|
+ PriceSum = (di.VisitPNumber * exitMealCount * -1) * price,
|
|
|
+ PriceName = di.TeamName + "-" + priceCity + "-" + $"退餐费(地接导入)",
|
|
|
+ PriceType = 1028,
|
|
|
+ PriceDetailType = 1088,
|
|
|
+ Remark = remake,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- var isTrue = false;
|
|
|
if (groupExtraCostsArr.Count > 0)
|
|
|
{
|
|
|
foreach (var item in groupExtraCostsArr)
|
|
@@ -1014,7 +956,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
var QuerySgin = _sqlSugar.Queryable<Fin_GroupExtraCost>().Where(x => x.PriceName == item.PriceName && x.DiId == item.DiId && x.IsDel == 0 && x.PriceDt.ToString("yyyy-MM-dd") == item.PriceDt.ToString("yyyy-MM-dd")).First();
|
|
|
if (QuerySgin == null)
|
|
|
{
|
|
|
- var resultThis = await PostGroupExtraCost_Operator(new Fin_GroupExtraCostDto_OP
|
|
|
+ _ = await PostGroupExtraCost_Operator(new Fin_GroupExtraCostDto_OP
|
|
|
{
|
|
|
coefficient = 1,
|
|
|
createUser = dto.CreateUserId,
|
|
@@ -1032,14 +974,14 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
priceType = item.PriceType,
|
|
|
PriceDt = item.PriceDt.ToString("yyyy-MM-dd"),
|
|
|
payType = dto.PayDId,
|
|
|
- costSign = dto.OrbitalPrivateTransfer
|
|
|
+ costSign = dto.OrbitalPrivateTransfer,
|
|
|
+ Area = opSingle.Area.ObjToInt(),
|
|
|
});
|
|
|
- isTrue = resultThis.Code == 0 ? true : false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
item.Id = QuerySgin.Id;
|
|
|
- var resultThis = await PostGroupExtraCost_Operator(new Fin_GroupExtraCostDto_OP
|
|
|
+ _ = await PostGroupExtraCost_Operator(new Fin_GroupExtraCostDto_OP
|
|
|
{
|
|
|
coefficient = 1,
|
|
|
createUser = dto.CreateUserId,
|
|
@@ -1060,7 +1002,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
costSign = dto.OrbitalPrivateTransfer,
|
|
|
Id = item.Id,
|
|
|
});
|
|
|
- isTrue = resultThis.Code == 0 ? true : false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1214,7 +1155,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- int CarTouristGuideCTable = await _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservations>().Where(a => a.Id == dto.CTGGRId && a.DiId == dto.DiId && a.IsDel == 0).SetColumns(a => new Grp_CarTouristGuideGroundReservations
|
|
|
+ _ = await _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservations>().Where(a => a.Id == dto.CTGGRId && a.DiId == dto.DiId && a.IsDel == 0).SetColumns(a => new Grp_CarTouristGuideGroundReservations
|
|
|
{
|
|
|
CId = dto.Currency,
|
|
|
ServiceQuotedPrice = c.PayMoney,
|
|
@@ -1222,12 +1163,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
SelectCheck = string.Join(',', dto.SelectCheck)
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
- if (CarTouristGuideCTable == 0)
|
|
|
- {
|
|
|
- RollbackTran();
|
|
|
- return result = new Result() { Code = -2, Msg = "修改失败" };
|
|
|
- }
|
|
|
-
|
|
|
var data = new { ccpId = noticeCcpId, sign = noticeSign };
|
|
|
result = new Result() { Code = 0, Msg = "保存成功", Data = data };
|
|
|
CommitTran();
|
|
@@ -1235,7 +1170,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
RollbackTran();
|
|
|
- return result = new Result() { Code = -2, Msg = $"接口异常!({ex.Message})"};
|
|
|
+ result = new Result() { Code = -2, Msg = $"接口异常!({ex.Message})"};
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@@ -1268,6 +1203,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
_entity.PriceCount = dto.PriceCount;
|
|
|
_entity.PriceDt = DateTime.Parse(dto.PriceDt);
|
|
|
_entity.PriceSum = dto.price * dto.PriceCount;
|
|
|
+ _entity.Area = dto.Area;
|
|
|
|
|
|
_daiRep.BeginTran();
|
|
|
if (dto.editType == 1)
|
|
@@ -1296,7 +1232,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
Remark = dto.remark,
|
|
|
PriceCount = dto.PriceCount,
|
|
|
PriceDt = _entity.PriceDt,
|
|
|
- PriceSum = _entity.PriceSum
|
|
|
+ PriceSum = _entity.PriceSum,
|
|
|
+ Area = _entity.Area,
|
|
|
});
|
|
|
if (!res)
|
|
|
{
|
|
@@ -1329,7 +1266,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
return rt;
|
|
|
}
|
|
|
|
|
|
- if (!extraCost_editCreditCardPayment(dto))
|
|
|
+ if (!(await extraCost_editCreditCardPayment(dto)))
|
|
|
{
|
|
|
rt.Msg = "ccp操作失败";
|
|
|
return rt;
|
|
@@ -1342,29 +1279,30 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
return rt;
|
|
|
}
|
|
|
|
|
|
- private bool extraCost_editCreditCardPayment(Fin_GroupExtraCostDto_OP costDto)
|
|
|
+ private async Task<bool> extraCost_editCreditCardPayment(Fin_GroupExtraCostDto_OP costDto)
|
|
|
{
|
|
|
//设置团组汇率
|
|
|
decimal dcm_dayrate = 1M;
|
|
|
decimal dcm_rmbPrice = costDto.price;
|
|
|
- //int ispay = costDto.payType == 72 ? 1 : 0;
|
|
|
- int ispay = 0;
|
|
|
+ int ispay = costDto.payType == 72 ? 1 : 0;
|
|
|
|
|
|
if (costDto.costSign != 3)
|
|
|
{
|
|
|
- Grp_TeamRate tr = _daiRep.Query<Grp_TeamRate>(s => s.DiId == costDto.diId && s.CTable == 1015).First();
|
|
|
+ //获取新汇率 int diId,int CId, int currencyId
|
|
|
+ Result rate = await _setDataRep.PostCurrencyByDiid(costDto.diId, 1015, costDto.currency);
|
|
|
|
|
|
- if (tr != null)
|
|
|
+ if (rate.Code == 0)
|
|
|
{
|
|
|
- if (costDto.currency == 49)
|
|
|
+ var rateInfo = (rate.Data as CurrencyInfo);
|
|
|
+ if (rateInfo is not null)
|
|
|
{
|
|
|
- dcm_dayrate = tr.RateU;
|
|
|
- dcm_rmbPrice = dcm_rmbPrice * tr.RateU;
|
|
|
+
|
|
|
+ dcm_dayrate = rateInfo.Rate;
|
|
|
+ dcm_rmbPrice = rateInfo.Rate * dcm_rmbPrice;
|
|
|
}
|
|
|
- else if (costDto.currency == 51)
|
|
|
+ else
|
|
|
{
|
|
|
- dcm_dayrate = tr.RateE;
|
|
|
- dcm_rmbPrice = dcm_rmbPrice * tr.RateE;
|
|
|
+ dcm_dayrate = 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1462,7 +1400,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
return false;
|
|
|
}
|
|
|
|