DecreasePaymentsRepository.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. using AutoMapper;
  2. using NPOI.SS.Formula.Functions;
  3. using OASystem.Domain;
  4. using OASystem.Domain.Dtos.Groups;
  5. using OASystem.Domain.Entities.Financial;
  6. using OASystem.Domain.Entities.Groups;
  7. using OASystem.Domain.Entities.Resource;
  8. using OASystem.Domain.ViewModels.Financial;
  9. using OASystem.Domain.ViewModels.Groups;
  10. using OASystem.Domain.ViewModels.QiYeWeChat;
  11. using OASystem.Domain.ViewModels.Resource;
  12. using OASystem.Infrastructure.Repositories.System;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.Linq;
  16. using System.Runtime.Intrinsics.Arm;
  17. using System.Text;
  18. using System.Threading.Tasks;
  19. namespace OASystem.Infrastructure.Repositories.Groups
  20. {
  21. public class DecreasePaymentsRepository : BaseRepository<Grp_DecreasePayments, Grp_DecreasePayments>
  22. {
  23. private readonly IMapper _mapper;
  24. private readonly TeamRateRepository _teamRateRep;
  25. private readonly SetDataRepository _setDataRepository;
  26. public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper, TeamRateRepository teamRateRep, SetDataRepository setDataRepository )
  27. : base(sqlSugar)
  28. {
  29. this._mapper = mapper;
  30. _teamRateRep = teamRateRep;
  31. this._setDataRepository = setDataRepository;
  32. }
  33. /// <summary>
  34. /// 根据团组Id查询数据
  35. /// </summary>
  36. /// <param name="dto"></param>
  37. /// <returns></returns>
  38. public async Task<JsonView> DecreasePaymentsList(DecreasePaymentsListDto dto)
  39. {
  40. string sqlWhere = "";
  41. if (dto.IsPaySign != -1)
  42. {
  43. sqlWhere += string.Format(@" And ccp.IsPay = {0} ", dto.IsPaySign);
  44. }
  45. //雷怡 2024-5-8 15:14 新增View字段 CreateTime
  46. string sql = string.Format(@" Select gdp.Id,gdp.DiId,gdp.PriceName,gdp.FeeTotal,sd1.[Name] as Currency,gdp.FilePath,su.CnName as CreateUserName,
  47. ccp.IsAuditGM as isAudit,ccp.IsPay,gdp.CreateTime
  48. From Grp_DecreasePayments as gdp With(Nolock) Left Join Grp_CreditCardPayment as ccp With(Nolock) On gdp.Id = ccp.CId
  49. Left Join Sys_SetData as sd1 On gdp.Currency = sd1.Id
  50. Left Join Sys_Users as su On gdp.CreateUserId = su.Id
  51. 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);
  52. List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
  53. return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = _DecreasePayments };
  54. }
  55. public async Task<JsonView> DecreasePaymentsSelect(DecreasePaymentsDto dto)
  56. {
  57. #region 团组下拉框
  58. List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == dto.CTId).ToList();
  59. string DiId = "";
  60. List<DecreasePaymentGroupView> _Delegations = new List<DecreasePaymentGroupView>();
  61. if (grp_GroupsTaskAssignment.Count > 0)
  62. {
  63. foreach (var item in grp_GroupsTaskAssignment)
  64. {
  65. DiId += item.DIId + ",";
  66. }
  67. if (DiId != "0")
  68. {
  69. DiId = DiId.Substring(0, DiId.Length - 1);
  70. }
  71. string sql = string.Format($@"Select
  72. (select ssd.name from Sys_SetData ssd WHERE ssd.id = di.TeamLevSId) as TeamLevSId,
  73. di.Id,
  74. di.TeamName,
  75. di.ClientUnit,
  76. di.ClientName,
  77. di.TourCode,
  78. di.TeamDid,
  79. sd.[Name] As TeamTypeName,
  80. di.VisitCountry,
  81. di.VisitStartDate,
  82. di.VisitEndDate,
  83. di.VisitDays,
  84. di.VisitPNumber,
  85. di.CreateTime
  86. From Grp_DelegationInfo di With(NoLock)
  87. Left Join Sys_SetData sd On di.TeamDid = sd.Id
  88. Where di.Id in({DiId}) and di.IsDel=0
  89. Order By di.CreateTime Desc");
  90. //DecreasePaymentGroupView
  91. _Delegations = _sqlSugar.SqlQueryable<DecreasePaymentGroupView>(sql).ToList();
  92. }
  93. #endregion
  94. #region 其他下拉框查询
  95. //支付方式
  96. List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
  97. List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
  98. //供应商 supplier
  99. List<Sys_SetData> supplier = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 21 && a.IsDel == 0).ToList();
  100. List<SetDataInfoView> _supplier = _mapper.Map<List<SetDataInfoView>>(supplier);
  101. if (_supplier.Count > 0)
  102. {
  103. var d1 = _supplier.Find(it => it.Name.Equals("策划 公司"));
  104. if (d1 != null) _supplier.Remove(d1);
  105. var d2 = _supplier.Find(it => it.Name.Equals("礼仪"));
  106. if (d2 != null) _supplier.Remove(d2);
  107. var d3 = _supplier.Find(it => it.Name.Equals("日常办公用品"));
  108. if (d3 != null) _supplier.Remove(d3);
  109. var d4 = _supplier.Find(it => it.Name.Equals("其他"));
  110. if (d4 != null)
  111. {
  112. _supplier.Remove(d4);
  113. _supplier.Add(d4);
  114. }
  115. }
  116. List<dynamic> _supplierArea = new List<dynamic>() {
  117. new { id=1,name = "国内" },
  118. new { id=2,name = "国外" },
  119. };
  120. #endregion
  121. var data = new
  122. {
  123. payment = _Payment,
  124. groupName = _Delegations,
  125. supplier = _supplier,
  126. supplierArea = _supplierArea
  127. };
  128. return new JsonView() { Code = 200, Msg = MsgTips.Status, Data = data };
  129. }
  130. public async Task<JsonView> OpDecreasePayments(DecreasePaymentsOpDto dto)
  131. {
  132. BeginTran();
  133. int id = 0;
  134. Grp_DecreasePayments grp_Decrease = _mapper.Map<Grp_DecreasePayments>(dto);
  135. //处理费用总计
  136. if (grp_Decrease.FeeTotal == 0.00M)
  137. {
  138. grp_Decrease.FeeTotal = grp_Decrease.Price * grp_Decrease.Price;
  139. }
  140. //根据成本判断自动审核
  141. #region 根据成本判断自动审核
  142. var auto = false;
  143. if (dto.IsSelect == 1)
  144. {
  145. var costInfo = _sqlSugar.Queryable<Grp_GroupCostParameter>()
  146. .LeftJoin<Grp_DelegationInfo>((a, b) => b.IsDel == 0 && b.Id == a.DiId)
  147. .Where((a, b) => a.DiId == dto.DiId && a.IsDel == 0 && a.CostType == "A")
  148. .Select((a,b) => new
  149. {
  150. a.Currency,
  151. a.CostType,
  152. a.Rate,
  153. b.VisitPNumber,
  154. })
  155. .First();
  156. if (costInfo != null)
  157. {
  158. //获取团组成本
  159. var groupCostPrice_Decimal = _sqlSugar.Queryable<Grp_GroupCost>()
  160. .Where(x => x.Diid == dto.DiId && x.IsDel == 0 && x.TE != 0)
  161. .Sum(x => x.TE);
  162. groupCostPrice_Decimal *= costInfo.VisitPNumber;
  163. var costPrice_Decimal = groupCostPrice_Decimal;
  164. var dtoPrice_Decimal = dto.FeeTotal;
  165. var costInfoCurr_Bool = int.TryParse(costInfo.Currency, out int costInfoCurr_Int);
  166. if(costInfoCurr_Int != dto.Currency)
  167. {
  168. if (costInfoCurr_Bool)
  169. {
  170. costPrice_Decimal *= costInfo.Rate;
  171. //获取其他款项汇率
  172. var rate_Object = await _setDataRepository.PostCurrencyByDiid(dto.DiId, 98, dto.Currency);
  173. if (rate_Object != null && rate_Object.Code == 0) {
  174. var currInfo = (rate_Object.Data as CurrencyInfo);
  175. if (currInfo != null)
  176. {
  177. dtoPrice_Decimal *= currInfo.Rate;
  178. if (costPrice_Decimal > dtoPrice_Decimal)
  179. {
  180. auto = true;
  181. }
  182. }
  183. }
  184. }
  185. }
  186. else
  187. {
  188. if (costPrice_Decimal > dtoPrice_Decimal)
  189. {
  190. auto = true;
  191. }
  192. }
  193. }
  194. }
  195. #endregion
  196. List<TeamRateDescAddCurrencyIdView> teamRates = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, dto.DiId, 98);
  197. if (dto.Status == 1)//添加
  198. {
  199. string selectSql = string.Format(@"select * from Grp_DecreasePayments where PriceName='{0}' and IsDel={1} and DiId={2}"
  200. , dto.PriceName, 0, dto.DiId);
  201. var DecreasePayments = await _sqlSugar.SqlQueryable<Grp_DecreasePayments>(selectSql).FirstAsync();//查询是否存在
  202. if (DecreasePayments != null)
  203. {
  204. return new JsonView() { Code = 400, Msg = "该数据已存在,请勿重复添加!" };
  205. }
  206. else//不存在,可添加
  207. {
  208. id = await AddAsyncReturnId(grp_Decrease);
  209. if (id < 1)
  210. {
  211. RollbackTran();
  212. return new JsonView() { Code = 400, Msg = "添加失败!" };
  213. }
  214. //进行C表添加
  215. Grp_CreditCardPayment C = new Grp_CreditCardPayment();
  216. C.PayDId = dto.PayDId;
  217. C.ConsumptionPatterns = "";
  218. C.ConsumptionDate = "";
  219. C.CTDId = 0;
  220. C.BankNo = "";
  221. C.CardholderName = "";
  222. C.PayMoney = grp_Decrease.FeeTotal;
  223. C.PaymentCurrency = grp_Decrease.Currency;
  224. //当天汇率
  225. //if (!string.IsNullOrEmpty(hfRate.Value))
  226. // C.DayRate = hfRate.Value;
  227. //else
  228. //C.DayRate = "";
  229. C.CompanyBankNo = "";
  230. C.OtherBankName = dto.OtherBankName;
  231. C.OtherSideNo = dto.OtherSideNo;
  232. C.OtherSideName = dto.OtherSideName;
  233. C.Remark = "";
  234. C.CreateUserId = grp_Decrease.CreateUserId;
  235. C.MFOperator = 0;
  236. C.MFOperatorDate = "";
  237. C.IsAuditDM = 0;
  238. C.AuditDMOperate = 0;
  239. C.AuditDMDate = "";
  240. C.IsAuditMF = 0;
  241. C.AuditMFOperate = 0;
  242. C.AuditMFDate = "";
  243. C.IsAuditGM = auto ? 3 : 0;
  244. C.AuditGMOperate = 21;
  245. C.AuditGMDate = "";
  246. //注释 刷卡 = 已支付状态
  247. if (C.PayDId == 72) C.IsPay = 1;
  248. else C.IsPay = 0;
  249. C.DIId = grp_Decrease.DiId;
  250. C.CId = id;
  251. C.CTable = 98;
  252. C.PayPercentage = 100;
  253. C.PayThenMoney = 0;
  254. C.PayPercentageOld = 0;
  255. C.PayThenMoneyOld = 0;
  256. C.UpdateDate = "";
  257. C.Payee = dto.SupplierName;
  258. C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
  259. C.ExceedBudget = 0;
  260. //C.RMBPrice = 0.00f;
  261. //设置该团组的汇率
  262. TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
  263. //Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Decrease.DiId && a.IsDel == 0 && a.CTable == 98);
  264. if (teamRate != null)
  265. {
  266. if (teamRate.CurrencyCode.Equals("CNY"))
  267. {
  268. C.DayRate = 1.0000M;
  269. C.RMBPrice = C.PayMoney;
  270. }
  271. else
  272. {
  273. C.DayRate = teamRate.Rate;
  274. C.RMBPrice = C.PayMoney * C.DayRate;
  275. }
  276. }
  277. else
  278. {
  279. RollbackTran();
  280. return new JsonView() { Code = 400, Msg = $"添加失败!团组汇率未设置{_sqlSugar.Queryable<Sys_SetData>().First(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)?.Name ?? ""}该币种汇率!" };
  281. }
  282. int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
  283. if (cId != 0)
  284. {
  285. CommitTran();
  286. var data = new { ccpId = cId, sign = 1 };
  287. return new JsonView() { Code = 200, Msg = "添加成功!", Data = data };
  288. }
  289. else
  290. {
  291. RollbackTran();
  292. return new JsonView() { Code = 400, Msg = "添加失败!" };
  293. }
  294. }
  295. }
  296. else if (dto.Status == 2)
  297. {
  298. bool res = await UpdateAsync(a => a.Id == grp_Decrease.Id, a => new Grp_DecreasePayments
  299. {
  300. DiId = grp_Decrease.DiId,
  301. SupplierArea = grp_Decrease.SupplierArea,
  302. SupplierTypeId = grp_Decrease.SupplierTypeId,
  303. SupplierName = grp_Decrease.SupplierName,
  304. SupplierContact = grp_Decrease.SupplierContact,
  305. SupplierContactNumber = grp_Decrease.SupplierContactNumber,
  306. SupplierSocialAccount = grp_Decrease.SupplierSocialAccount,
  307. SupplierEmail = grp_Decrease.SupplierEmail,
  308. SupplierAddress = grp_Decrease.SupplierAddress,
  309. PriceName = grp_Decrease.PriceName,
  310. Price = grp_Decrease.Price,
  311. Quantity = grp_Decrease.Quantity,
  312. FeeTotal = grp_Decrease.FeeTotal,
  313. Currency = grp_Decrease.Currency,
  314. FilePath = grp_Decrease.FilePath,
  315. OTAOrderNo = grp_Decrease.OTAOrderNo,
  316. Remark = grp_Decrease.Remark,
  317. });
  318. if (res)
  319. {
  320. Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable == 98 && a.CId == grp_Decrease.Id && a.IsDel == 0);
  321. if (grp_CreditCardPayment != null)
  322. {
  323. //设置该团组的汇率
  324. TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
  325. if (teamRate != null)
  326. {
  327. if (teamRate.CurrencyCode.Equals("CNY"))
  328. {
  329. grp_CreditCardPayment.DayRate = 1.0000M;
  330. grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
  331. }
  332. else
  333. {
  334. grp_CreditCardPayment.DayRate = teamRate.Rate;
  335. grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney * grp_CreditCardPayment.DayRate;
  336. }
  337. }
  338. else
  339. {
  340. RollbackTran();
  341. return new JsonView() { Code = 400, Msg = "修改失败!" };
  342. }
  343. int ispay = 0;
  344. if (dto.PayDId == 72) ispay = 1;
  345. int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
  346. .Where(a => a.Id == grp_CreditCardPayment.Id)
  347. .SetColumns(a => new Grp_CreditCardPayment
  348. {
  349. OtherSideName = dto.OtherSideName,
  350. OtherSideNo = dto.OtherSideNo,
  351. OtherBankName = dto.OtherBankName,
  352. PayDId = dto.PayDId,
  353. IsPay = ispay,
  354. PayMoney = grp_Decrease.FeeTotal,
  355. PaymentCurrency = grp_Decrease.Currency,
  356. Payee = dto.SupplierName,
  357. OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
  358. DayRate = grp_CreditCardPayment.DayRate,
  359. RMBPrice = grp_CreditCardPayment.RMBPrice,
  360. IsAuditGM = auto ? 3 : grp_CreditCardPayment.IsAuditGM
  361. })
  362. .ExecuteCommandAsync();
  363. if (CTable > 0)
  364. {
  365. CommitTran();
  366. var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2 };
  367. return new JsonView() { Code = 200, Msg = "修改成功!", Data = data };
  368. }
  369. }
  370. }
  371. RollbackTran();
  372. return new JsonView() { Code = 400, Msg = "修改失败!" };
  373. }
  374. RollbackTran();
  375. return new JsonView() { Code = 400, Msg = MsgTips.Fail }; ;
  376. }
  377. public async Task<Result> PostGroupNameAndEasy(DecreasePaymentsDto dto)
  378. {
  379. Result result = new Result() { Code = -2, Msg = "未知错误" };
  380. try
  381. {
  382. #region 团组下拉框
  383. List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == dto.CTId).ToList();
  384. string DiId = "";
  385. foreach (var item in grp_GroupsTaskAssignment)
  386. {
  387. DiId += item.DIId + ",";
  388. }
  389. if (!string.IsNullOrWhiteSpace(DiId))
  390. {
  391. DiId = DiId.Substring(0, DiId.Length - 1);
  392. }
  393. else
  394. {
  395. DiId = "0";
  396. }
  397. string sql = string.Format(@"select Id,TourCode,TeamName,ClientName,VisitStartDate,VisitEndDate,VisitCountry,VisitDays,VisitPNumber from Grp_DelegationInfo where Id in({0}) and IsDel={1}", DiId, 0);
  398. List<DelegationEasyView> grp_Delegations = _sqlSugar.SqlQueryable<DelegationEasyView>(sql).ToList();
  399. if (grp_Delegations.Count != 0)
  400. {
  401. int count = grp_Delegations.Count;
  402. float totalPage = (float)count / dto.PageSize;//总页数
  403. if (totalPage == 0) totalPage = 1;
  404. else totalPage = (int)Math.Ceiling((double)totalPage);
  405. List<DelegationEasyView> delegationEasyViews = new List<DelegationEasyView>();
  406. for (int i = 0; i < dto.PageSize; i++)
  407. {
  408. var RowIndex = i + (dto.PageIndex - 1) * dto.PageSize;
  409. if (RowIndex < grp_Delegations.Count)
  410. {
  411. delegationEasyViews.Add(grp_Delegations[RowIndex]);
  412. }
  413. else
  414. {
  415. break;
  416. }
  417. }
  418. ListViewBase<DelegationEasyView> rst = new ListViewBase<DelegationEasyView>();
  419. rst.DataList = delegationEasyViews;
  420. rst.DataCount = count;
  421. rst.CurrPageIndex = dto.PageIndex;
  422. rst.CurrPageSize = dto.PageSize;
  423. return result = new Result() { Code = 0, Msg = "查询成功!", Data = rst };
  424. }
  425. else
  426. {
  427. ListViewBase<DelegationEasyView> rst = new ListViewBase<DelegationEasyView>();
  428. rst.DataList = new List<DelegationEasyView>();
  429. return result = new Result() { Code = 0, Msg = "暂无数据!", Data = rst };
  430. }
  431. #endregion
  432. }
  433. catch (Exception ex)
  434. {
  435. return result = new Result() { Code = -2, Msg = "程序错误" };
  436. throw;
  437. }
  438. }
  439. /// <summary>
  440. /// 根据团组增减款项表Id查询数据
  441. /// </summary>
  442. /// <param name="dto"></param>
  443. /// <returns></returns>
  444. /// <exception cref="NotImplementedException"></exception>
  445. public async Task<JsonView> QueryDecreasePaymentsById(DecreasePaymentsByIdDto dto)
  446. {
  447. string sql = string.Format($@"Select
  448. dp.Id,
  449. dp.DiId,
  450. dp.SupplierArea,
  451. dp.SupplierTypeId,
  452. dp.SupplierName,
  453. dp.SupplierContact,
  454. dp.SupplierContactNumber,
  455. dp.SupplierSocialAccount,
  456. dp.SupplierEmail,
  457. dp.SupplierAddress,
  458. dp.PriceName,
  459. dp.Price,
  460. dp.Quantity,
  461. dp.FeeTotal,
  462. dp.Currency,
  463. dp.FilePath,
  464. dp.OTAOrderNo,
  465. dp.Remark,
  466. ccp.PayDId,
  467. ccp.OrbitalPrivateTransfer,
  468. ccp.OtherBankName,
  469. ccp.OtherSideName,
  470. ccp.OtherSideNo,
  471. ccp.IsAuditGM
  472. From Grp_DecreasePayments dp With(NoLock)
  473. Left Join Grp_CreditCardPayment ccp With(NoLock) On dp.Id = ccp.CId And dp.DiId = ccp.DIId And ccp.CTable = 98
  474. Where dp.IsDel = 0 And dp.Id = {dto.Id}");
  475. var info = await _sqlSugar.SqlQueryable<DecreasePaymentsInfoView>(sql).FirstAsync();
  476. return new JsonView() { Code = 200, Msg = MsgTips.Succeed, Data = info };
  477. }
  478. /// <summary>
  479. /// Del
  480. /// </summary>
  481. /// <param name="dto"></param>
  482. /// <returns></returns>
  483. /// <exception cref="NotImplementedException"></exception>
  484. public async Task<Result> _Del(int id, int userId)
  485. {
  486. Result result = new Result() { Code = -2, Msg = "删除失败!" };
  487. _sqlSugar.BeginTran();
  488. var del = await _sqlSugar.Updateable<Grp_DecreasePayments>()
  489. .SetColumns(it => new Grp_DecreasePayments()
  490. {
  491. IsDel = 1,
  492. DeleteUserId = userId,
  493. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  494. }).Where(it => it.Id == id)
  495. .ExecuteCommandAsync();
  496. if (del > 0)
  497. {
  498. var del1 = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
  499. .SetColumns(a => new Grp_CreditCardPayment()
  500. {
  501. IsDel = 1,
  502. DeleteUserId = userId,
  503. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  504. })
  505. .Where(a => a.CId == id && a.CTable == 98)
  506. .ExecuteCommandAsync();
  507. if (del1 > 0)
  508. {
  509. _sqlSugar.CommitTran();
  510. result.Code = 0;
  511. result.Msg = "删除成功!";
  512. return result;
  513. }
  514. }
  515. _sqlSugar.RollbackTran();
  516. return result;
  517. }
  518. }
  519. }