|
@@ -1,4 +1,5 @@
|
|
|
using AutoMapper;
|
|
|
+using NPOI.HPSF;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using OASystem.Domain;
|
|
|
using OASystem.Domain.AesEncryption;
|
|
@@ -293,6 +294,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
else if (dto.Status == 2)
|
|
|
{
|
|
|
+
|
|
|
+ var grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable == 98 && a.CId == grp_Decrease.Id && a.IsDel == 0);
|
|
|
+
|
|
|
+ if (grp_CreditCardPayment == null) return new JsonView() { Code = 400, Msg = MsgTips.Fail };
|
|
|
+
|
|
|
+ var isAuditGM = grp_CreditCardPayment.IsAuditGM;
|
|
|
+ if (isAuditGM == 1 || isAuditGM == 3) return new JsonView() { Code = 400, Msg = $"该费用已通过审核,不可编辑" };
|
|
|
+
|
|
|
+ if (grp_CreditCardPayment.IsPay == 1) return new JsonView() { Code = 400, Msg = $"该费用已付款,不可编辑!" };
|
|
|
+
|
|
|
bool res = await UpdateAsync(a => a.Id == grp_Decrease.Id, a => new Grp_DecreasePayments
|
|
|
{
|
|
|
DiId = grp_Decrease.DiId,
|
|
@@ -315,66 +326,62 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
});
|
|
|
if (res)
|
|
|
{
|
|
|
- var grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable == 98 && a.CId == grp_Decrease.Id && a.IsDel == 0);
|
|
|
- if (grp_CreditCardPayment != null)
|
|
|
- {
|
|
|
-
|
|
|
- var teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
|
|
|
+
|
|
|
+ var teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
|
|
|
|
|
|
- if (teamRate != null)
|
|
|
+ if (teamRate != null)
|
|
|
+ {
|
|
|
+ if (teamRate.CurrencyCode.Equals("CNY"))
|
|
|
{
|
|
|
- if (teamRate.CurrencyCode.Equals("CNY"))
|
|
|
- {
|
|
|
- grp_CreditCardPayment.DayRate = 1.0000M;
|
|
|
- grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- grp_CreditCardPayment.DayRate = teamRate.Rate;
|
|
|
- grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney * grp_CreditCardPayment.DayRate;
|
|
|
- }
|
|
|
+ grp_CreditCardPayment.DayRate = 1.0000M;
|
|
|
+ grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- RollbackTran();
|
|
|
- return new JsonView() { Code = 400, Msg = "修改失败!" };
|
|
|
+ grp_CreditCardPayment.DayRate = teamRate.Rate;
|
|
|
+ grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney * grp_CreditCardPayment.DayRate;
|
|
|
}
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ return new JsonView() { Code = 400, Msg = "修改失败!" };
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ int isPay = 0;
|
|
|
+ if (dto.PayDId == 72) isPay = 1;
|
|
|
|
|
|
-
|
|
|
- int isPay = 0;
|
|
|
- if (dto.PayDId == 72) isPay = 1;
|
|
|
-
|
|
|
- int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
- .Where(a => a.Id == grp_CreditCardPayment.Id)
|
|
|
- .SetColumns(a => new Grp_CreditCardPayment
|
|
|
- {
|
|
|
- OtherSideName = dto.OtherSideName,
|
|
|
- OtherSideNo = dto.OtherSideNo,
|
|
|
- OtherBankName = dto.OtherBankName,
|
|
|
- PayDId = dto.PayDId,
|
|
|
- IsPay = isPay,
|
|
|
- PayMoney = grp_Decrease.FeeTotal,
|
|
|
- PaymentCurrency = grp_Decrease.Currency,
|
|
|
- Payee = dto.SupplierName,
|
|
|
- OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
|
|
|
- DayRate = grp_CreditCardPayment.DayRate,
|
|
|
- RMBPrice = grp_CreditCardPayment.RMBPrice,
|
|
|
-
|
|
|
- })
|
|
|
- .ExecuteCommandAsync();
|
|
|
- if (CTable > 0)
|
|
|
+ int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .Where(a => a.Id == grp_CreditCardPayment.Id)
|
|
|
+ .SetColumns(a => new Grp_CreditCardPayment
|
|
|
{
|
|
|
- CommitTran();
|
|
|
+ OtherSideName = dto.OtherSideName,
|
|
|
+ OtherSideNo = dto.OtherSideNo,
|
|
|
+ OtherBankName = dto.OtherBankName,
|
|
|
+ PayDId = dto.PayDId,
|
|
|
+ IsPay = isPay,
|
|
|
+ PayMoney = grp_Decrease.FeeTotal,
|
|
|
+ PaymentCurrency = grp_Decrease.Currency,
|
|
|
+ Payee = dto.SupplierName,
|
|
|
+ OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
|
|
|
+ DayRate = grp_CreditCardPayment.DayRate,
|
|
|
+ RMBPrice = grp_CreditCardPayment.RMBPrice,
|
|
|
+
|
|
|
+ })
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ if (CTable > 0)
|
|
|
+ {
|
|
|
+ CommitTran();
|
|
|
|
|
|
- var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2,dataId = grp_Decrease.Id };
|
|
|
+ var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2, dataId = grp_Decrease.Id };
|
|
|
|
|
|
- return new JsonView() { Code = 200, Msg = "修改成功!", Data = data };
|
|
|
- }
|
|
|
+ return new JsonView() { Code = 200, Msg = "修改成功!", Data = data };
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
RollbackTran();
|
|
|
- return new JsonView() { Code = 400, Msg = MsgTips.Fail }; ;
|
|
|
+ return new JsonView() { Code = 400, Msg = MsgTips.Fail };
|
|
|
}
|
|
|
|
|
|
public async Task<Result> PostGroupNameAndEasy(DecreasePaymentsDto dto)
|
|
@@ -498,6 +505,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
Result result = new Result() { Code = -2, Msg = "删除失败!" };
|
|
|
|
|
|
+ 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, "删除失败!");
|
|
|
+ if (ccpInfo.IsAuditGM > 0) return new Result(-2, "该费用已审核,不可删除!");
|
|
|
+ if (ccpInfo.IsPay == 1) return new Result(-2, "该费用已付款,不可删除!");
|
|
|
+
|
|
|
_sqlSugar.BeginTran();
|
|
|
|
|
|
var del = await _sqlSugar.Updateable<Grp_DecreasePayments>()
|