|
@@ -126,104 +126,97 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
var DecreasePayments = await _sqlSugar.SqlQueryable<Grp_DecreasePayments>(selectSql).FirstAsync();//查询是否存在
|
|
|
if (DecreasePayments != null)
|
|
|
{
|
|
|
- return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
|
|
|
+ return new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
|
|
|
}
|
|
|
else//不存在,可添加
|
|
|
{
|
|
|
|
|
|
id = await AddAsyncReturnId(grp_Decrease);
|
|
|
- if (id > 0)
|
|
|
+ if (id < 1)
|
|
|
{
|
|
|
- result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- result = new Result() { Code = 0, Msg = "添加失败!" };
|
|
|
+ RollbackTran();
|
|
|
+ return new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
}
|
|
|
- if (result.Code == 0)
|
|
|
- {
|
|
|
- //进行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.Price;
|
|
|
- C.PaymentCurrency = grp_Decrease.Currency;
|
|
|
- //当天汇率
|
|
|
- //if (!string.IsNullOrEmpty(hfRate.Value))
|
|
|
- // C.DayRate = hfRate.Value;
|
|
|
- //else
|
|
|
- //C.DayRate = "";
|
|
|
- C.CompanyBankNo = "";
|
|
|
- C.OtherBankName = "";
|
|
|
- C.OtherSideNo = "";
|
|
|
- C.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 = "";
|
|
|
- C.IsPay = 0;
|
|
|
- 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.Payee;
|
|
|
- C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
|
|
|
- C.ExceedBudget = 0;
|
|
|
- //C.RMBPrice = 0.00f;
|
|
|
+
|
|
|
+ //进行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.Price;
|
|
|
+ C.PaymentCurrency = grp_Decrease.Currency;
|
|
|
+ //当天汇率
|
|
|
+ //if (!string.IsNullOrEmpty(hfRate.Value))
|
|
|
+ // C.DayRate = hfRate.Value;
|
|
|
+ //else
|
|
|
+ //C.DayRate = "";
|
|
|
+ C.CompanyBankNo = "";
|
|
|
+ C.OtherBankName = "";
|
|
|
+ C.OtherSideNo = "";
|
|
|
+ C.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 = "";
|
|
|
+ C.IsPay = 0;
|
|
|
+ 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.Payee;
|
|
|
+ C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
|
|
|
+ C.ExceedBudget = 0;
|
|
|
+ //C.RMBPrice = 0.00f;
|
|
|
|
|
|
- //设置该团组的汇率
|
|
|
- TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyCode == grp_Decrease.Currency.ToString()).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"))
|
|
|
- {
|
|
|
- C.DayRate = 1.0000M;
|
|
|
- C.RMBPrice = C.PayMoney;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- C.DayRate = teamRate.Rate;
|
|
|
- C.RMBPrice = C.PayMoney * C.DayRate;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ //设置该团组的汇率
|
|
|
+ TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyCode == grp_Decrease.Currency.ToString()).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"))
|
|
|
{
|
|
|
C.DayRate = 1.0000M;
|
|
|
C.RMBPrice = C.PayMoney;
|
|
|
}
|
|
|
- int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
|
|
|
- if (cId != 0)
|
|
|
- {
|
|
|
- result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
|
- }
|
|
|
else
|
|
|
{
|
|
|
- RollbackTran();
|
|
|
- result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
+ C.DayRate = teamRate.Rate;
|
|
|
+ C.RMBPrice = C.PayMoney * C.DayRate;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
+ C.DayRate = 1.0000M;
|
|
|
+ C.RMBPrice = C.PayMoney;
|
|
|
+ }
|
|
|
+ int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
|
|
|
+ if (cId != 0)
|
|
|
+ {
|
|
|
+ CommitTran();
|
|
|
+ return new Result() { Code = 0, Msg = "添加成功!" };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -265,44 +258,48 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
grp_CreditCardPayment.DayRate = 1M;
|
|
|
grp_CreditCardPayment.RMBPrice = grp_Decrease.Price;
|
|
|
}
|
|
|
- int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.Id == grp_CreditCardPayment.Id).SetColumns(a => new Grp_CreditCardPayment
|
|
|
- {
|
|
|
- PayDId = dto.PayDId,
|
|
|
- PayMoney = grp_Decrease.Price,
|
|
|
- PaymentCurrency = grp_Decrease.Currency,
|
|
|
- Payee = dto.Payee,
|
|
|
- OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
|
|
|
- DayRate = grp_CreditCardPayment.DayRate,
|
|
|
- RMBPrice = grp_CreditCardPayment.RMBPrice,
|
|
|
+ int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .Where(a => a.Id == grp_CreditCardPayment.Id)
|
|
|
+ .SetColumns(a => new Grp_CreditCardPayment
|
|
|
+ {
|
|
|
+ PayDId = dto.PayDId,
|
|
|
+ PayMoney = grp_Decrease.Price,
|
|
|
+ PaymentCurrency = grp_Decrease.Currency,
|
|
|
+ Payee = dto.Payee,
|
|
|
+ OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
|
|
|
+ DayRate = grp_CreditCardPayment.DayRate,
|
|
|
+ RMBPrice = grp_CreditCardPayment.RMBPrice,
|
|
|
|
|
|
- }).ExecuteCommandAsync();
|
|
|
- if (CTable != 0)
|
|
|
+ }).ExecuteCommandAsync();
|
|
|
+ if (CTable > 0)
|
|
|
{
|
|
|
- result = new Result() { Code = 0, Msg = "修改成功!" };
|
|
|
+ CommitTran();
|
|
|
+ return new Result() { Code = 0, Msg = "修改成功!" };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- result = new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
RollbackTran();
|
|
|
+ return new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
RollbackTran();
|
|
|
- result = new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
+ return new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- result = new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
+ RollbackTran();
|
|
|
+ return new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
}
|
|
|
}
|
|
|
- CommitTran();
|
|
|
+
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
RollbackTran();
|
|
|
- result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
+ return new Result() { Code = -2, Msg = ex.Message };
|
|
|
}
|
|
|
return result;
|
|
|
}
|