|
@@ -4,11 +4,13 @@ using NPOI.SS.Formula.Functions;
|
|
|
using NPOI.SS.UserModel;
|
|
|
using NPOI.Util;
|
|
|
using OASystem.Domain;
|
|
|
+using OASystem.Domain.Dtos.Financial;
|
|
|
using OASystem.Domain.Dtos.Groups;
|
|
|
using OASystem.Domain.Entities.Financial;
|
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
using OASystem.Domain.Entities.Resource;
|
|
|
using OASystem.Domain.ViewModels.Groups;
|
|
|
+using OASystem.Infrastructure.Repositories.Financial;
|
|
|
using OASystem.Infrastructure.Repositories.System;
|
|
|
using OASystem.Infrastructure.Tools;
|
|
|
using SqlSugar.Extensions;
|
|
@@ -22,13 +24,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly CheckBoxsRepository _checkRep;
|
|
|
private readonly SetDataRepository _setDataRep;
|
|
|
+ private readonly DailyFeePaymentRepository _daiRep; //日付申请仓库
|
|
|
|
|
|
- public CarTouristGuideGroundRepository(SqlSugarClient sqlSugar, IMapper mapper , CheckBoxsRepository checkRep, SetDataRepository setDataRep)
|
|
|
+ public CarTouristGuideGroundRepository(SqlSugarClient sqlSugar, IMapper mapper , CheckBoxsRepository checkRep, SetDataRepository setDataRep, DailyFeePaymentRepository daiRep)
|
|
|
: base(sqlSugar)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
|
_checkRep = checkRep;
|
|
|
_setDataRep = setDataRep;
|
|
|
+ _daiRep = daiRep;
|
|
|
}
|
|
|
|
|
|
public async Task<Result> OpCarTouristGuideGround(OpCarTouristGuideGroundDto dto)
|
|
@@ -669,11 +673,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
DiId = dto.DiId,
|
|
|
PriceCurrency = item.Currency,
|
|
|
PriceName = di.TeamName + "车超时费(地接导入)",
|
|
|
- PriceType = 1050,
|
|
|
+ PriceType = 1028,
|
|
|
PriceDt = item.DatePrice.ObjToDate(),
|
|
|
PriceSum = item.Price * item.Count,
|
|
|
PriceCount = item.Count,
|
|
|
FilePath = string.Empty,
|
|
|
+ PriceDetailType = 1050,
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -719,11 +724,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
DiId = dto.DiId,
|
|
|
PriceCurrency = cityPrice.Currency,
|
|
|
PriceName = di.TeamName + "餐费(地接导入)",
|
|
|
- PriceType = 1049,
|
|
|
+ PriceType = 1028,
|
|
|
PriceDt = Convert.ToDateTime(item["日期"]),
|
|
|
PriceSum = price - foodCost,
|
|
|
PriceCount = 1,
|
|
|
FilePath = string.Empty,
|
|
|
+ PriceDetailType = 1049,
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -736,19 +742,56 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
foreach (var item in groupExtraCostsArr)
|
|
|
{
|
|
|
- var QuerySgin = _sqlSugar.Queryable<Fin_GroupExtraCost>().Where(x => x.PriceName == item.PriceName && x.DiId == item.DiId && x.IsDel == 0).First();
|
|
|
+ var QuerySgin = _sqlSugar.Queryable<Fin_GroupExtraCost>().Where(x => x.PriceName == item.PriceName && x.DiId == item.DiId && x.IsDel == 0 && item.PriceDt.ToString("yyyy-MM-dd") == item.PriceDt.ToString("yyyy-MM-dd")).First();
|
|
|
if (QuerySgin == null)
|
|
|
{
|
|
|
- isTrue = _sqlSugar.Insertable<Fin_GroupExtraCost>(item).ExecuteCommand() > 0;
|
|
|
+ var resultThis = await PostGroupExtraCost_Operator(new Fin_GroupExtraCostDto_OP
|
|
|
+ {
|
|
|
+ coefficient = 1,
|
|
|
+ createUser = dto.CreateUserId,
|
|
|
+ currency = item.PriceCurrency,
|
|
|
+ diId = item.DiId,
|
|
|
+ editType = 1,
|
|
|
+ filePath = string.Empty,
|
|
|
+ payee = dto.Payee,
|
|
|
+ PortType = 1,
|
|
|
+ PriceCount = item.PriceCount,
|
|
|
+ priceName = item.PriceName,
|
|
|
+ remark = item.Remark,
|
|
|
+ price = item.Price,
|
|
|
+ priceDetailType = item.PriceDetailType,
|
|
|
+ priceType = item.PriceType,
|
|
|
+ PriceDt = item.PriceDt.ToString("yyyy-MM-dd"),
|
|
|
+ payType = dto.PayDId,
|
|
|
+ costSign = dto.OrbitalPrivateTransfer
|
|
|
+ });
|
|
|
+ isTrue = resultThis.Code == 0 ? true : false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
item.Id = QuerySgin.Id;
|
|
|
- isTrue = _sqlSugar.Updateable<Fin_GroupExtraCost>(QuerySgin).IgnoreColumns(x => new
|
|
|
+ var resultThis = await PostGroupExtraCost_Operator(new Fin_GroupExtraCostDto_OP
|
|
|
{
|
|
|
- x.CreateTime,
|
|
|
- x.CreateUserId,
|
|
|
- }).ExecuteCommand() > 0;
|
|
|
+ coefficient = 1,
|
|
|
+ createUser = dto.CreateUserId,
|
|
|
+ currency = item.PriceCurrency,
|
|
|
+ diId = item.DiId,
|
|
|
+ editType = 2,
|
|
|
+ filePath = string.Empty,
|
|
|
+ payee = dto.Payee,
|
|
|
+ PortType = 1,
|
|
|
+ PriceCount = item.PriceCount,
|
|
|
+ priceName = item.PriceName,
|
|
|
+ remark = item.Remark,
|
|
|
+ price = item.Price,
|
|
|
+ priceDetailType = item.PriceDetailType,
|
|
|
+ priceType = item.PriceType,
|
|
|
+ PriceDt = item.PriceDt.ToString("yyyy-MM-dd"),
|
|
|
+ payType = dto.PayDId,
|
|
|
+ costSign = dto.OrbitalPrivateTransfer,
|
|
|
+ Id = item.Id,
|
|
|
+ });
|
|
|
+ isTrue = resultThis.Code == 0 ? true : false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -899,6 +942,231 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 超支费用
|
|
|
+ /// 1增、2改、3删
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task<Result> PostGroupExtraCost_Operator(Fin_GroupExtraCostDto_OP dto)
|
|
|
+ {
|
|
|
+ Result rt = new Result();
|
|
|
+
|
|
|
+ #region 验证
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ Fin_GroupExtraCost _entity = new Fin_GroupExtraCost();
|
|
|
+ _entity.DiId = dto.diId;
|
|
|
+ _entity.PriceName = dto.priceName;
|
|
|
+ _entity.Price = dto.price;
|
|
|
+ _entity.PriceCurrency = dto.currency;
|
|
|
+ _entity.PriceType = dto.priceType;
|
|
|
+ _entity.Coefficient = dto.coefficient;
|
|
|
+ _entity.PriceDetailType = dto.priceDetailType;
|
|
|
+ _entity.FilePath = dto.filePath;
|
|
|
+ _entity.Remark = dto.remark;
|
|
|
+ _entity.PriceCount = dto.PriceCount;
|
|
|
+ _entity.PriceDt = DateTime.Parse(dto.PriceDt);
|
|
|
+ _entity.PriceSum = dto.price * dto.PriceCount;
|
|
|
+
|
|
|
+ _daiRep.BeginTran();
|
|
|
+ if (dto.editType == 1)
|
|
|
+ {
|
|
|
+ _entity.CreateUserId = dto.createUser;
|
|
|
+ _entity.CreateTime = DateTime.Now;
|
|
|
+ _entity.IsDel = 0;
|
|
|
+
|
|
|
+ int returnId = await _daiRep.AddAsyncReturnId<Fin_GroupExtraCost>(_entity);
|
|
|
+ if (returnId > 0)
|
|
|
+ {
|
|
|
+ dto.Id = returnId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (dto.editType == 2)
|
|
|
+ {
|
|
|
+ bool res = await _daiRep.UpdateAsync<Fin_GroupExtraCost>(s => s.Id == dto.Id, s => new Fin_GroupExtraCost
|
|
|
+ {
|
|
|
+ PriceName = dto.priceName,
|
|
|
+ Price = dto.price,
|
|
|
+ PriceCurrency = dto.currency,
|
|
|
+ PriceType = dto.priceType,
|
|
|
+ PriceDetailType = dto.priceDetailType,
|
|
|
+ Coefficient = dto.coefficient,
|
|
|
+ FilePath = dto.filePath,
|
|
|
+ Remark = dto.remark,
|
|
|
+ PriceCount = dto.PriceCount,
|
|
|
+ PriceDt = _entity.PriceDt,
|
|
|
+ PriceSum = _entity.PriceSum
|
|
|
+ });
|
|
|
+ if (!res)
|
|
|
+ {
|
|
|
+ _daiRep.RollbackTran();
|
|
|
+ //Ok(JsonView(false, "2操作失败!"))
|
|
|
+ rt.Msg = "2操作失败!";
|
|
|
+ return rt;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (dto.editType == 3)
|
|
|
+ {
|
|
|
+ string delTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
|
|
|
+ bool res = await _daiRep.UpdateAsync<Fin_GroupExtraCost>(s => s.Id == dto.Id, s => new Fin_GroupExtraCost
|
|
|
+ {
|
|
|
+ IsDel = 1,
|
|
|
+ DeleteTime = delTime,
|
|
|
+ DeleteUserId = dto.createUser
|
|
|
+ });
|
|
|
+ if (!res)
|
|
|
+ {
|
|
|
+ _daiRep.RollbackTran();
|
|
|
+ rt.Msg = "3操作失败!";
|
|
|
+ return rt;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _daiRep.RollbackTran();
|
|
|
+ rt.Msg = "未知的editType";
|
|
|
+ return rt;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!extraCost_editCreditCardPayment(dto))
|
|
|
+ {
|
|
|
+ rt.Msg = "ccp操作失败";
|
|
|
+ return rt;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ _daiRep.CommitTran();
|
|
|
+ rt.Code = 0;
|
|
|
+ rt.Msg = "操作成功";
|
|
|
+ return rt;
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool extraCost_editCreditCardPayment(Fin_GroupExtraCostDto_OP costDto)
|
|
|
+ {
|
|
|
+ //设置团组汇率
|
|
|
+ decimal dcm_dayrate = 1M;
|
|
|
+ decimal dcm_rmbPrice = costDto.price;
|
|
|
+ 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();
|
|
|
+
|
|
|
+ if (tr != null)
|
|
|
+ {
|
|
|
+ if (costDto.currency == 49)
|
|
|
+ {
|
|
|
+ dcm_dayrate = tr.RateU;
|
|
|
+ dcm_rmbPrice = dcm_rmbPrice * tr.RateU;
|
|
|
+ }
|
|
|
+ else if (costDto.currency == 51)
|
|
|
+ {
|
|
|
+ dcm_dayrate = tr.RateE;
|
|
|
+ dcm_rmbPrice = dcm_rmbPrice * tr.RateE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Grp_CreditCardPayment ccp = _daiRep.Query<Grp_CreditCardPayment>(s => s.CId == costDto.Id && s.CTable == 1015).First();
|
|
|
+ if (ccp == null)
|
|
|
+ {
|
|
|
+ ccp = new Grp_CreditCardPayment();
|
|
|
+
|
|
|
+ ccp.PayDId = costDto.payType;// dto
|
|
|
+ ccp.ConsumptionPatterns = "";
|
|
|
+ ccp.ConsumptionDate = "";
|
|
|
+ ccp.CTDId = costDto.payCardId;// dto
|
|
|
+ ccp.BankNo = "";
|
|
|
+
|
|
|
+ ccp.CardholderName = "";
|
|
|
+ ccp.PayMoney = costDto.price;// dto
|
|
|
+ ccp.PaymentCurrency = costDto.currency;// dto
|
|
|
+ ccp.CompanyBankNo = "";
|
|
|
+ ccp.OtherBankName = "";
|
|
|
+
|
|
|
+ ccp.OtherSideNo = "";
|
|
|
+ ccp.OtherSideName = "";
|
|
|
+ ccp.Remark = "";
|
|
|
+ ccp.CreateUserId = costDto.createUser;
|
|
|
+ ccp.CreateTime = DateTime.Now;
|
|
|
+
|
|
|
+ ccp.MFOperator = 0;
|
|
|
+ ccp.MFOperatorDate = "";
|
|
|
+ ccp.IsAuditDM = 0;
|
|
|
+ ccp.AuditDMOperate = 0;
|
|
|
+ ccp.AuditDMDate = "";
|
|
|
+
|
|
|
+ ccp.IsAuditMF = 0;
|
|
|
+ ccp.AuditMFOperate = 0;
|
|
|
+ ccp.AuditMFDate = "";
|
|
|
+ ccp.IsAuditGM = 0;
|
|
|
+ ccp.AuditGMOperate = 0;
|
|
|
+
|
|
|
+ ccp.AuditGMDate = "";
|
|
|
+ ccp.IsPay = ispay; // upd
|
|
|
+ ccp.DIId = costDto.diId;// dto
|
|
|
+ ccp.CId = costDto.Id;// dto
|
|
|
+ ccp.CTable = 1015; //超支费用指向id
|
|
|
+
|
|
|
+ ccp.IsDel = 0;
|
|
|
+ ccp.PayPercentage = 100M;
|
|
|
+ ccp.PayThenMoney = 0M;
|
|
|
+ ccp.PayPercentageOld = 100M;
|
|
|
+ ccp.PayThenMoneyOld = 0M;
|
|
|
+
|
|
|
+ ccp.UpdateDate = "";
|
|
|
+ ccp.Payee = costDto.payee;// dto
|
|
|
+ ccp.OrbitalPrivateTransfer = costDto.costSign;// dto
|
|
|
+ ccp.ExceedBudget = 0;
|
|
|
+ ccp.DayRate = dcm_dayrate; //upd
|
|
|
+
|
|
|
+ ccp.RMBPrice = dcm_rmbPrice; //upd
|
|
|
+
|
|
|
+ int ccpInsertId = _daiRep.AddReturnId<Grp_CreditCardPayment>(ccp);
|
|
|
+ if (ccpInsertId > 0)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (costDto.editType == 2)
|
|
|
+ {
|
|
|
+ bool res = _daiRep.Update<Grp_CreditCardPayment>(s => s.Id == ccp.Id, s => new Grp_CreditCardPayment
|
|
|
+ {
|
|
|
+ PayDId = costDto.payType,
|
|
|
+ CTDId = costDto.payCardId,
|
|
|
+ PayMoney = costDto.price,
|
|
|
+ PaymentCurrency = costDto.currency,
|
|
|
+ IsPay = ispay,
|
|
|
+
|
|
|
+ Payee = costDto.payee,
|
|
|
+ OrbitalPrivateTransfer = costDto.costSign,
|
|
|
+ DayRate = dcm_dayrate,
|
|
|
+ RMBPrice = dcm_rmbPrice
|
|
|
+ });
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ else if (costDto.editType == 3)
|
|
|
+ {
|
|
|
+ string delTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
|
|
|
+ bool res2 = _daiRep.Update<Grp_CreditCardPayment>(s => s.Id == ccp.Id, s => new Grp_CreditCardPayment
|
|
|
+ {
|
|
|
+ IsDel = 1,
|
|
|
+ DeleteTime = delTime,
|
|
|
+ DeleteUserId = costDto.createUser
|
|
|
+ });
|
|
|
+ return res2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|