|
@@ -26,7 +26,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly TeamRateRepository _teamRateRep;
|
|
|
private readonly SetDataRepository _setDataRepository;
|
|
|
- public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper, TeamRateRepository teamRateRep, SetDataRepository setDataRepository )
|
|
|
+ public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper, TeamRateRepository teamRateRep, SetDataRepository setDataRepository)
|
|
|
: base(sqlSugar)
|
|
|
{
|
|
|
this._mapper = mapper;
|
|
@@ -54,13 +54,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
Left Join Sys_Users as su On gdp.CreateUserId = su.Id
|
|
|
Where gdp.DiId = {0} And ccp.CTable = 98 {2} And ccp.IsDel = 0 And gdp.IsDel = 0 And gdp.CreateUserId in ({1}) ", dto.DiId, dto.UserId, sqlWhere);
|
|
|
List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
|
|
|
-
|
|
|
+
|
|
|
return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = _DecreasePayments };
|
|
|
}
|
|
|
|
|
|
public async Task<JsonView> DecreasePaymentsSelect(DecreasePaymentsDto dto)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
#region 团组下拉框
|
|
|
|
|
|
List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == dto.CTId).ToList();
|
|
@@ -148,7 +148,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
supplier = _supplier,
|
|
|
supplierArea = _supplierArea
|
|
|
};
|
|
|
- return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = data };
|
|
|
+ return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = data };
|
|
|
|
|
|
}
|
|
|
|
|
@@ -175,122 +175,122 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
//}
|
|
|
//else//不存在,可添加
|
|
|
//{
|
|
|
- id = await AddAsyncReturnId(grp_Decrease);
|
|
|
- if (id < 1)
|
|
|
- {
|
|
|
- RollbackTran();
|
|
|
- return new JsonView() { Code = 400, Msg = "添加失败!" };
|
|
|
- }
|
|
|
-
|
|
|
- //进行C表添加
|
|
|
- Grp_CreditCardPayment C = new Grp_CreditCardPayment();
|
|
|
- C.PayDId = dto.PayDId;
|
|
|
- C.ConsumptionPatterns = "";
|
|
|
- C.ConsumptionDate = "";
|
|
|
- C.CTDId = 0;
|
|
|
- C.BankNo = "";
|
|
|
- C.CardholderName = "";
|
|
|
- C.PayMoney = grp_Decrease.FeeTotal;
|
|
|
- C.PaymentCurrency = grp_Decrease.Currency;
|
|
|
- //当天汇率
|
|
|
- //if (!string.IsNullOrEmpty(hfRate.Value))
|
|
|
- // C.DayRate = hfRate.Value;
|
|
|
- //else
|
|
|
- //C.DayRate = "";
|
|
|
- C.CompanyBankNo = "";
|
|
|
- C.OtherBankName = dto.OtherBankName;
|
|
|
- C.OtherSideNo = dto.OtherSideNo;
|
|
|
- C.OtherSideName = dto.OtherSideName;
|
|
|
- C.Remark = "";
|
|
|
- C.CreateUserId = grp_Decrease.CreateUserId;
|
|
|
- C.MFOperator = 0;
|
|
|
- C.MFOperatorDate = "";
|
|
|
- C.IsAuditDM = 0;
|
|
|
- C.AuditDMOperate = 0;
|
|
|
- C.AuditDMDate = "";
|
|
|
- C.IsAuditMF = 0;
|
|
|
- C.AuditMFOperate = 0;
|
|
|
- C.AuditMFDate = "";
|
|
|
- C.IsAuditGM = 0;
|
|
|
- C.AuditGMOperate = 21;
|
|
|
- C.AuditGMDate = "";
|
|
|
-
|
|
|
- //2025-04-07 第四次更改 PayDId == 72(刷卡) IsPay == 1
|
|
|
- if (C.PayDId == 72) C.IsPay = 1;
|
|
|
-
|
|
|
- C.DIId = grp_Decrease.DiId;
|
|
|
- C.CId = id;
|
|
|
- C.CTable = 98;
|
|
|
- C.PayPercentage = 100;
|
|
|
- C.PayThenMoney = 0;
|
|
|
- C.PayPercentageOld = 0;
|
|
|
- C.PayThenMoneyOld = 0;
|
|
|
- C.UpdateDate = "";
|
|
|
- C.Payee = dto.SupplierName;
|
|
|
- C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
|
|
|
- C.ExceedBudget = 0;
|
|
|
- //C.RMBPrice = 0.00f;
|
|
|
+ id = await AddAsyncReturnId(grp_Decrease);
|
|
|
+ if (id < 1)
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 400, Msg = "添加失败!" };
|
|
|
+ }
|
|
|
|
|
|
- //设置该团组的汇率
|
|
|
- var teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
|
|
|
- //Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Decrease.DiId && a.IsDel == 0 && a.CTable == 98);
|
|
|
- if (teamRate != null)
|
|
|
+ //进行C表添加
|
|
|
+ Grp_CreditCardPayment C = new Grp_CreditCardPayment();
|
|
|
+ C.PayDId = dto.PayDId;
|
|
|
+ C.ConsumptionPatterns = "";
|
|
|
+ C.ConsumptionDate = "";
|
|
|
+ C.CTDId = 0;
|
|
|
+ C.BankNo = "";
|
|
|
+ C.CardholderName = "";
|
|
|
+ C.PayMoney = grp_Decrease.FeeTotal;
|
|
|
+ C.PaymentCurrency = grp_Decrease.Currency;
|
|
|
+ //当天汇率
|
|
|
+ //if (!string.IsNullOrEmpty(hfRate.Value))
|
|
|
+ // C.DayRate = hfRate.Value;
|
|
|
+ //else
|
|
|
+ //C.DayRate = "";
|
|
|
+ C.CompanyBankNo = "";
|
|
|
+ C.OtherBankName = dto.OtherBankName;
|
|
|
+ C.OtherSideNo = dto.OtherSideNo;
|
|
|
+ C.OtherSideName = dto.OtherSideName;
|
|
|
+ C.Remark = "";
|
|
|
+ C.CreateUserId = grp_Decrease.CreateUserId;
|
|
|
+ C.MFOperator = 0;
|
|
|
+ C.MFOperatorDate = "";
|
|
|
+ C.IsAuditDM = 0;
|
|
|
+ C.AuditDMOperate = 0;
|
|
|
+ C.AuditDMDate = "";
|
|
|
+ C.IsAuditMF = 0;
|
|
|
+ C.AuditMFOperate = 0;
|
|
|
+ C.AuditMFDate = "";
|
|
|
+ C.IsAuditGM = 0;
|
|
|
+ C.AuditGMOperate = 21;
|
|
|
+ C.AuditGMDate = "";
|
|
|
+
|
|
|
+ //2025-04-07 第四次更改 PayDId == 72(刷卡) IsPay == 1
|
|
|
+ if (C.PayDId == 72) C.IsPay = 1;
|
|
|
+
|
|
|
+ C.DIId = grp_Decrease.DiId;
|
|
|
+ C.CId = id;
|
|
|
+ C.CTable = 98;
|
|
|
+ C.PayPercentage = 100;
|
|
|
+ C.PayThenMoney = 0;
|
|
|
+ C.PayPercentageOld = 0;
|
|
|
+ C.PayThenMoneyOld = 0;
|
|
|
+ C.UpdateDate = "";
|
|
|
+ C.Payee = dto.SupplierName;
|
|
|
+ C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
|
|
|
+ C.ExceedBudget = 0;
|
|
|
+ //C.RMBPrice = 0.00f;
|
|
|
+
|
|
|
+ //设置该团组的汇率
|
|
|
+ var teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
|
|
|
+ //Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Decrease.DiId && a.IsDel == 0 && a.CTable == 98);
|
|
|
+ if (teamRate != null)
|
|
|
+ {
|
|
|
+ if (teamRate.CurrencyCode.Equals("CNY"))
|
|
|
{
|
|
|
- if (teamRate.CurrencyCode.Equals("CNY"))
|
|
|
- {
|
|
|
- C.DayRate = 1.0000M;
|
|
|
- C.RMBPrice = C.PayMoney;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- C.DayRate = teamRate.Rate;
|
|
|
- C.RMBPrice = C.PayMoney * C.DayRate;
|
|
|
- }
|
|
|
+ C.DayRate = 1.0000M;
|
|
|
+ C.RMBPrice = C.PayMoney;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- RollbackTran();
|
|
|
- return new JsonView() { Code = 400, Msg = $"添加失败!团组汇率未设置{_sqlSugar.Queryable<Sys_SetData>().First(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)?.Name ?? ""}该币种汇率!" };
|
|
|
+ C.DayRate = teamRate.Rate;
|
|
|
+ C.RMBPrice = C.PayMoney * C.DayRate;
|
|
|
}
|
|
|
- int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
|
|
|
- if (cId > 1)
|
|
|
- {
|
|
|
-
|
|
|
- #region 策划部内容同步添加至资料库
|
|
|
- //var userInfo = _sqlSugar.Queryable<Sys_Users>()
|
|
|
- // .LeftJoin<Sys_Department>((u,d)=> d.IsDel == 0 && u.DepId == d.Id )
|
|
|
- // .Where((u, d) => u.Id == dto.CreateUserId && d.DepName == "策划部" && u.IsDel == 0)
|
|
|
- // .First();
|
|
|
-
|
|
|
- //if (userInfo != null)
|
|
|
- //{
|
|
|
- // Res_MediaSuppliers mediaSuppliersData = new Res_MediaSuppliers
|
|
|
- // {
|
|
|
- // CreateTime = DateTime.Now,
|
|
|
- // CreateUserId = dto.CreateUserId,
|
|
|
- // UnitName = dto.SupplierName,
|
|
|
- // TypeId = dto.SupplierTypeId,
|
|
|
- // UnitAddress = dto.SupplierAddress,
|
|
|
- // Contact = dto.SupplierContact,
|
|
|
- // Tel = dto.SupplierContactNumber,
|
|
|
- // Email = dto.SupplierEmail,
|
|
|
- // Privince = dto.SupplierArea == 1 ? "国内" :"国外",
|
|
|
- // };
|
|
|
-
|
|
|
- // EncryptionProcessor.EncryptProperties(mediaSuppliersData);
|
|
|
- // _sqlSugar.Insertable(mediaSuppliersData).ExecuteCommand();
|
|
|
- //}
|
|
|
-
|
|
|
- #endregion
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 400, Msg = $"添加失败!团组汇率未设置{_sqlSugar.Queryable<Sys_SetData>().First(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)?.Name ?? ""}该币种汇率!" };
|
|
|
+ }
|
|
|
+ int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
|
|
|
+ if (cId > 1)
|
|
|
+ {
|
|
|
|
|
|
- CommitTran();
|
|
|
- var data = new { ccpId = cId, sign = 1,dataId = id };
|
|
|
- return new JsonView() { Code = 200, Msg = "添加成功!", Data = data };
|
|
|
- }
|
|
|
+ #region 策划部内容同步添加至资料库
|
|
|
+ //var userInfo = _sqlSugar.Queryable<Sys_Users>()
|
|
|
+ // .LeftJoin<Sys_Department>((u,d)=> d.IsDel == 0 && u.DepId == d.Id )
|
|
|
+ // .Where((u, d) => u.Id == dto.CreateUserId && d.DepName == "策划部" && u.IsDel == 0)
|
|
|
+ // .First();
|
|
|
+
|
|
|
+ //if (userInfo != null)
|
|
|
+ //{
|
|
|
+ // Res_MediaSuppliers mediaSuppliersData = new Res_MediaSuppliers
|
|
|
+ // {
|
|
|
+ // CreateTime = DateTime.Now,
|
|
|
+ // CreateUserId = dto.CreateUserId,
|
|
|
+ // UnitName = dto.SupplierName,
|
|
|
+ // TypeId = dto.SupplierTypeId,
|
|
|
+ // UnitAddress = dto.SupplierAddress,
|
|
|
+ // Contact = dto.SupplierContact,
|
|
|
+ // Tel = dto.SupplierContactNumber,
|
|
|
+ // Email = dto.SupplierEmail,
|
|
|
+ // Privince = dto.SupplierArea == 1 ? "国内" :"国外",
|
|
|
+ // };
|
|
|
+
|
|
|
+ // EncryptionProcessor.EncryptProperties(mediaSuppliersData);
|
|
|
+ // _sqlSugar.Insertable(mediaSuppliersData).ExecuteCommand();
|
|
|
+ //}
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ CommitTran();
|
|
|
+ var data = new { ccpId = cId, sign = 1, dataId = id };
|
|
|
+ return new JsonView() { Code = 200, Msg = "添加成功!", Data = data };
|
|
|
+ }
|
|
|
|
|
|
- RollbackTran();
|
|
|
- return new JsonView() { Code = 400, Msg = "添加失败!" };
|
|
|
- // }
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 400, Msg = "添加失败!" };
|
|
|
+ // }
|
|
|
}
|
|
|
else if (dto.Status == 2)
|
|
|
{
|
|
@@ -381,7 +381,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
}
|
|
|
RollbackTran();
|
|
|
- return new JsonView() { Code = 400, Msg = MsgTips.Fail };
|
|
|
+ return new JsonView() { Code = 400, Msg = MsgTips.Fail };
|
|
|
}
|
|
|
|
|
|
public async Task<Result> PostGroupNameAndEasy(DecreasePaymentsDto dto)
|
|
@@ -501,11 +501,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
- public async Task<Result> _Del(int id, int userId)
|
|
|
+ public async Task<Result> _Del(int id, int userId)
|
|
|
{
|
|
|
Result result = new Result() { Code = -2, Msg = "删除失败!" };
|
|
|
|
|
|
- var ccpInfo =await _sqlSugar.Queryable<Grp_CreditCardPayment>()
|
|
|
+ var ccpInfo = await _sqlSugar.Queryable<Grp_CreditCardPayment>()
|
|
|
.FirstAsync(x => x.CId == id && x.CTable == 98 && x.IsDel == 0);
|
|
|
if (ccpInfo == null) return new Result(-2, "数据不存在,不可删除!");
|
|
|
|
|
@@ -520,24 +520,24 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
_sqlSugar.BeginTran();
|
|
|
|
|
|
var del = await _sqlSugar.Updateable<Grp_DecreasePayments>()
|
|
|
- .SetColumns(it => new Grp_DecreasePayments()
|
|
|
- {
|
|
|
- IsDel = 1,
|
|
|
- DeleteUserId = userId,
|
|
|
- DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
- }).Where(it => it.Id == id)
|
|
|
- .ExecuteCommandAsync();
|
|
|
+ .SetColumns(it => new Grp_DecreasePayments()
|
|
|
+ {
|
|
|
+ IsDel = 1,
|
|
|
+ DeleteUserId = userId,
|
|
|
+ DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
+ }).Where(it => it.Id == id)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
if (del > 0)
|
|
|
{
|
|
|
var del1 = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
- .SetColumns(a => new Grp_CreditCardPayment()
|
|
|
- {
|
|
|
- IsDel = 1,
|
|
|
- DeleteUserId = userId,
|
|
|
- DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
- })
|
|
|
- .Where(a => a.CId == id && a.CTable == 98)
|
|
|
- .ExecuteCommandAsync();
|
|
|
+ .SetColumns(a => new Grp_CreditCardPayment()
|
|
|
+ {
|
|
|
+ IsDel = 1,
|
|
|
+ DeleteUserId = userId,
|
|
|
+ DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
+ })
|
|
|
+ .Where(a => a.CId == id && a.CTable == 98)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
if (del1 > 0)
|
|
|
{
|
|
|
_sqlSugar.CommitTran();
|