|
@@ -27,6 +27,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
/// <param name="feeType">
|
|
|
/// 1.酒店 76
|
|
|
/// 2.op 79
|
|
|
+ /// 3.其他费用-出行物资 98
|
|
|
/// </param>
|
|
|
/// <param name="diId">团组Id</param>
|
|
|
/// <param name="dataId">数据Id(模块类型主表Id)</param>
|
|
@@ -37,7 +38,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
if (diId < 1) { _view.Msg = MsgTips.DiId; return _view; }
|
|
|
if (dataId < 1) { _view.Msg = MsgTips.Id; return _view; }
|
|
|
|
|
|
- List<int> stids = new List<int>() { 17, 66 };
|
|
|
+ var stids = new List<int>() { 17, 66, 91 };
|
|
|
var setData = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && stids.Contains(x.STid)).ToList();
|
|
|
string _teamCurrency = string.Empty;
|
|
|
|
|
@@ -48,7 +49,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
//币种验证 统一为currencycode三字码
|
|
|
if (int.TryParse(_teamCurrency,out int currency)) _teamCurrency = setData.Find(x => x.Id == currency)?.Name ?? "";
|
|
|
|
|
|
-
|
|
|
string costContentSql = $"Select * From Grp_GroupCost";
|
|
|
var costContents = _sqlSugar.SqlQueryable<GroupCostAuditView>(costContentSql).Where(x => x.IsDel == 0 && x.Diid == diId).ToList();
|
|
|
if (costContents.Count < 1) { _view.Msg = $"团组成本信息未填写!"; return _view; }
|
|
@@ -114,11 +114,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
DateTime checkIn = Convert.ToDateTime(hotelCostInfo.CheckInDate),
|
|
|
checkOut = Convert.ToDateTime(hotelCostInfo.CheckOutDate);
|
|
|
if (checkOut > checkIn) checkOut = checkOut.AddDays(-1); //房费计算,结束日期为前一天
|
|
|
- var hotelCostInfos = costContents.Where(x => x.CurrTime >= checkIn && x.CurrTime <= checkOut).ToList();
|
|
|
+ var hotelCostInfos = costContents.Where(x => x.CurrTime >= checkIn && x.CurrTime <= checkOut).ToList();
|
|
|
if (hotelCostInfos.Count < 1) isAutoAudit = false;
|
|
|
|
|
|
decimal otherFee = hotelCostDetails.Where(x => x.PriceType != 1).Sum(x => x.Price * (x.Rate == 0.0000M ? 1.0000M : x.Rate));
|
|
|
- if (otherFee > 0) { otherFee /= (checkOut-checkIn).Days; }
|
|
|
+ if (otherFee > 0) { otherFee /= (checkOut - checkIn).Days; }
|
|
|
var hotelCostInfosGroup = hotelCostInfos.GroupBy(x => x.Date);
|
|
|
foreach (var item in hotelCostInfosGroup)
|
|
|
{
|
|
@@ -160,10 +160,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
return _view;
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
//撤销该条数据的自动审核 --> 该条数据的审核状态是自动审核 3 --> 0
|
|
|
-
|
|
|
- var quashStatus = QuashAudit(76,diId,dataId);
|
|
|
+ var quashStatus = QuashAudit(76, diId, dataId);
|
|
|
|
|
|
if (quashStatus)
|
|
|
{
|
|
@@ -171,7 +171,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
_view.Msg = "费用超团组成本,自动审核撤销成功!";
|
|
|
return _view;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
else if (feeType == 2)
|
|
@@ -199,7 +198,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
//1.参数验证
|
|
|
var opCheckPriceTyeps = opinfos.SelectCheck.Split(',');
|
|
|
- var opCheckPriceTyepIds = setData.Where(x => opinfos.SelectCheck.Split(',').Contains(x.Name)).Select(x=>x.Id).ToList();
|
|
|
+ var opCheckPriceTyepIds = setData.Where(x => opinfos.SelectCheck.Split(',').Contains(x.Name)).Select(x => x.Id).ToList();
|
|
|
var opContents = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>()
|
|
|
.Where(x => x.IsDel == 0 && x.DiId == diId && x.CTGGRId == dataId && opCheckPriceTyepIds.Contains(x.SId))
|
|
|
.OrderBy(x => x.DatePrice, OrderByType.Asc)
|
|
@@ -228,7 +227,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
_teamRate = payInfo.DayRate;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
var opBasicDatas = setData.Where(x => x.STid == 17).ToList(); //费用类型基础数据
|
|
|
bool isAutoAudit = true;
|
|
|
if (!DateTime.TryParse(opinfos.ServiceStartTime, out DateTime startDt1) || !DateTime.TryParse(opinfos.ServiceEndTime, out DateTime endDt1))
|
|
@@ -357,13 +356,104 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
else
|
|
|
{
|
|
|
//撤销该条数据的自动审核 --> 该条数据的审核状态是自动审核 3 --> 0
|
|
|
- if (QuashAudit(79,diId,dataId))
|
|
|
+ if (QuashAudit(79, diId, dataId))
|
|
|
+ {
|
|
|
+ _view.Code = 200;
|
|
|
+ _view.Msg = "费用超团组成本,自动审核撤销成功!";
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (feeType == 3)
|
|
|
+ {
|
|
|
+ #region 出行物资的功能及相关费用自动审核
|
|
|
+
|
|
|
+ var isAutoAudit = false;
|
|
|
+ var currModule = 98; //其他款项
|
|
|
+ int groupSize = 0; // 团组人数
|
|
|
+ var groupDetails = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(x => x.IsDel == 0 && x.Id == diId).FirstAsync();
|
|
|
+ if (groupInfo != null) groupSize = groupDetails.VisitPNumber;
|
|
|
+
|
|
|
+ decimal groupCostCNYTotal = costContents.Sum(x => x.TeFee) * _teamRate * groupSize; //团组成本出行物资总金额
|
|
|
+ if (groupCostCNYTotal <= 0.00M)
|
|
|
+ {
|
|
|
+ _view.Msg = $"团组成本出行物资费用数据未填写";
|
|
|
+ QuashAudit(currModule, diId, dataId);
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
+
|
|
|
+ var teNames = setData.Where(x => x.STid == 91).Select(x => x.Name).ToList();
|
|
|
+ var otherFeeDatas = _sqlSugar.Queryable<Grp_DecreasePayments>()
|
|
|
+ .InnerJoin<Grp_CreditCardPayment>((dp,ccp) => dp.Id == ccp.CId && ccp.CTable == 98 && ccp.IsDel == 0)
|
|
|
+ .Where((dp, ccp) => dp.IsDel == 0 && dp.DiId == diId)
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+ var ids = new List<int>();
|
|
|
+ foreach (var item in otherFeeDatas)
|
|
|
+ {
|
|
|
+ if (item.PriceName.Contains("、"))
|
|
|
+ {
|
|
|
+ var priceNames = item.PriceName.Split('、');
|
|
|
+ foreach (var priceName in priceNames)
|
|
|
+ {
|
|
|
+ if (teNames.Contains(priceName))
|
|
|
+ {
|
|
|
+ ids.Add(item.Id);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(teNames.Contains(item.PriceName))
|
|
|
+ {
|
|
|
+ ids.Add(item.Id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ids = ids.Distinct().ToList();
|
|
|
+ decimal otherFeeCNYTotal = otherFeeDatas.Where(x => ids.Contains(x.Id)).Sum(x => x.FeeTotal); //其他费用出行物资总金额
|
|
|
+ if (otherFeeCNYTotal <= 0.00M)
|
|
|
+ {
|
|
|
+ _view.Msg = $"其他款项出行物资费用数据未填写";
|
|
|
+ QuashAudit(currModule, diId, dataId);
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (otherFeeCNYTotal > groupCostCNYTotal)
|
|
|
+ {
|
|
|
+ _view.Msg = $"其他款项出行物资费用超出团组成本物资费用";
|
|
|
+ QuashAudit(currModule, diId, dataId);
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
+ isAutoAudit = true;
|
|
|
+ //2.判断是否自动审核
|
|
|
+ if (isAutoAudit)
|
|
|
+ {
|
|
|
+ var ccpUpdate = _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .SetColumns(it => it.IsAuditGM == 3)
|
|
|
+ .SetColumns(it => it.AuditGMOperate == 4)
|
|
|
+ .SetColumns(it => it.AuditGMDate == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+ .Where(s => s.DIId == diId && s.CTable == currModule && s.CId == dataId)
|
|
|
+ .ExecuteCommand();
|
|
|
+ if (ccpUpdate > 0)
|
|
|
+ {
|
|
|
+ _view.Code = 200;
|
|
|
+ _view.Msg = "自动审核执行成功";
|
|
|
+ return _view;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //撤销该条数据的自动审核 --> 该条数据的审核状态是自动审核 3 --> 0
|
|
|
+ var quashStatus = QuashAudit(currModule, diId, dataId);
|
|
|
+
|
|
|
+ if (quashStatus)
|
|
|
{
|
|
|
_view.Code = 200;
|
|
|
_view.Msg = "费用超团组成本,自动审核撤销成功!";
|
|
|
return _view;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
else _view.Msg = $"请传入有效的feeType参数";
|
|
|
|