CarTouristGuideGroundRepository.cs 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600
  1. using Aspose.Words.Tables;
  2. using AutoMapper;
  3. using NPOI.SS.Formula.Functions;
  4. using NPOI.SS.UserModel;
  5. using NPOI.Util;
  6. using OASystem.Domain;
  7. using OASystem.Domain.AesEncryption;
  8. using OASystem.Domain.Dtos.Financial;
  9. using OASystem.Domain.Dtos.Groups;
  10. using OASystem.Domain.Dtos.QiYeWeChat;
  11. using OASystem.Domain.Entities.Financial;
  12. using OASystem.Domain.Entities.Groups;
  13. using OASystem.Domain.Entities.Resource;
  14. using OASystem.Domain.ViewModels.Groups;
  15. using OASystem.Infrastructure.Repositories.Financial;
  16. using OASystem.Infrastructure.Repositories.System;
  17. using OASystem.Infrastructure.Tools;
  18. using SqlSugar.Extensions;
  19. using System.Collections.Generic;
  20. using System.Linq;
  21. using System.Reflection;
  22. using static NPOI.HSSF.Util.HSSFColor;
  23. namespace OASystem.Infrastructure.Repositories.Groups
  24. {
  25. public class CarTouristGuideGroundRepository : BaseRepository<Grp_CarTouristGuideGroundReservations, Grp_CarTouristGuideGroundReservationsContent>
  26. {
  27. private readonly IMapper _mapper;
  28. private readonly CheckBoxsRepository _checkRep;
  29. private readonly SetDataRepository _setDataRep;
  30. private readonly DailyFeePaymentRepository _daiRep; //日付申请仓库
  31. private readonly GroupCostParameterRepository _groupCostParameterRepository;
  32. private readonly ForeignReceivablesRepository _foreignReceivablesRepository;
  33. public CarTouristGuideGroundRepository(SqlSugarClient sqlSugar, IMapper mapper, CheckBoxsRepository checkRep, SetDataRepository setDataRep,
  34. DailyFeePaymentRepository daiRep, GroupCostParameterRepository groupCostParameterRepository, ForeignReceivablesRepository foreignReceivablesRepository)
  35. : base(sqlSugar)
  36. {
  37. _mapper = mapper;
  38. _checkRep = checkRep;
  39. _setDataRep = setDataRep;
  40. _daiRep = daiRep;
  41. _groupCostParameterRepository = groupCostParameterRepository;
  42. _foreignReceivablesRepository = foreignReceivablesRepository;
  43. }
  44. public async Task<Result> OpCarTouristGuideGround(OpCarTouristGuideGroundDto dto)
  45. {
  46. Result result = new Result() { Code = -2, Msg = "未知错误" };
  47. BeginTran();
  48. try
  49. {
  50. int id = 0;
  51. var grp_CarTouristGuide = _mapper.Map<Grp_CarTouristGuideGroundReservations>(dto);
  52. if (dto.Status == 1)//添加
  53. {
  54. var grp_CarTouristGuideGround = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>()
  55. .First(a => a.IsDel == 0 &&
  56. a.Area == dto.Area &&
  57. a.BusName == dto.BusName &&
  58. a.ServiceGuide == dto.ServiceGuide &&
  59. a.DiId == dto.DiId &&
  60. a.BusTel == dto.BusTel &&
  61. a.ServiceTel == dto.ServiceTel &&
  62. a.PriceName == dto.PriceName
  63. );
  64. grp_CarTouristGuideGround = null;
  65. if (grp_CarTouristGuideGround != null)
  66. {
  67. return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
  68. }
  69. else
  70. {
  71. id = await AddAsyncReturnId(grp_CarTouristGuide);
  72. if (id == 0)
  73. {
  74. RollbackTran();
  75. result = new Result() { Code = -1, Msg = "添加失败,请稍后重试!" };
  76. }
  77. else
  78. {
  79. result = new Result() { Code = 0, Msg = "添加成功!" };
  80. }
  81. }
  82. }
  83. else if (dto.Status == 2)//修改
  84. {
  85. bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_CarTouristGuideGroundReservations
  86. {
  87. Area = grp_CarTouristGuide.Area,
  88. ServiceCompany = grp_CarTouristGuide.ServiceCompany,
  89. ServiceGuide = grp_CarTouristGuide.ServiceGuide,
  90. ServiceTel = grp_CarTouristGuide.ServiceTel,
  91. BusName = grp_CarTouristGuide.BusName,
  92. BusDescription = grp_CarTouristGuide.BusDescription,
  93. BusTel = grp_CarTouristGuide.BusTel,
  94. ServiceStartTime = grp_CarTouristGuide.ServiceStartTime,
  95. ServiceEndTime = grp_CarTouristGuide.ServiceEndTime,
  96. ServiceDescription = grp_CarTouristGuide.ServiceDescription,
  97. QuotedPriceExplanation = grp_CarTouristGuide.QuotedPriceExplanation,
  98. OrbitalPrivateTransfer = grp_CarTouristGuide.OrbitalPrivateTransfer,
  99. Remark = grp_CarTouristGuide.Remark,
  100. PriceType = grp_CarTouristGuide.PriceType,
  101. PriceName = grp_CarTouristGuide.PriceName,
  102. });
  103. if (res)
  104. {
  105. id = dto.Id;
  106. result = new Result() { Code = 0, Msg = "修改成功!" };
  107. }
  108. else
  109. {
  110. RollbackTran();
  111. result = new Result() { Code = -1, Msg = "修改失败,请稍后重试!" };
  112. }
  113. }
  114. #region add导游地接数据屏蔽
  115. //if (id != 0)
  116. //{
  117. // var _LocalGuideDataCar = _sqlSugar.Queryable<Res_LocalGuideData>()
  118. // .First(a =>
  119. // a.UnitName == AesEncryptionHelper.Encrypt(dto.BusName) &&
  120. // a.ContactTel == AesEncryptionHelper.Encrypt(dto.BusTel) &&
  121. // a.IsDel == 0
  122. // );
  123. // if (_LocalGuideDataCar == null)
  124. // {
  125. // var res_LocalGuideCar = new Res_LocalGuideData();
  126. // res_LocalGuideCar.UnitName = dto.BusName;
  127. // res_LocalGuideCar.ContactTel = dto.BusTel;
  128. // res_LocalGuideCar.CreateUserId = dto.CreateUserId;
  129. // EncryptionProcessor.EncryptProperties(res_LocalGuideCar);
  130. // int cId = await _sqlSugar.Insertable(res_LocalGuideCar).ExecuteReturnIdentityAsync();
  131. // }
  132. // var _LocalGuideDataService = _sqlSugar.Queryable<Res_LocalGuideData>()
  133. // .First(a =>
  134. // a.UnitName == AesEncryptionHelper.Encrypt(dto.ServiceCompany) &&
  135. // a.ContactTel == AesEncryptionHelper.Encrypt(dto.ServiceTel) &&
  136. // a.IsDel == 0
  137. // );
  138. // if (_LocalGuideDataService == null)
  139. // {
  140. // Res_LocalGuideData res_LocalGuideService = new Res_LocalGuideData();
  141. // res_LocalGuideService.UnitName = dto.ServiceCompany;
  142. // res_LocalGuideService.ContactTel = dto.ServiceTel;
  143. // res_LocalGuideService.Contact = dto.ServiceTel;
  144. // res_LocalGuideService.CreateUserId = dto.CreateUserId;
  145. // EncryptionProcessor.EncryptProperties(res_LocalGuideService);
  146. // int cId = await _sqlSugar.Insertable(res_LocalGuideService).ExecuteReturnIdentityAsync();
  147. // }
  148. //}
  149. #endregion
  150. CommitTran();
  151. }
  152. catch (Exception ex)
  153. {
  154. result = new Result() { Code = -2, Msg = "未知错误" + ex.Message };
  155. }
  156. return result;
  157. }
  158. public Result CarTouristGuideGroundContent(CarTouristGuideGroundContentDto dto)
  159. {
  160. Result result = new Result() { Code = -2, Msg = "未知错误" };
  161. try
  162. {
  163. Grp_CarTouristGuideGroundReservations grpCarOp = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(x => x.Id == dto.Id);
  164. if (!DateTime.TryParse(grpCarOp?.ServiceStartTime, out DateTime start))
  165. {
  166. result.Msg = "服务开始时间不存在!";
  167. result.Code = -1;
  168. return result;
  169. }
  170. if (!DateTime.TryParse(grpCarOp?.ServiceEndTime, out DateTime end))
  171. {
  172. result.Msg = "服务结束时间不存在!";
  173. result.Code = -1;
  174. return result;
  175. }
  176. if (DateTime.Compare(end, start) < 0)
  177. {
  178. result.Msg = "服务时间区间有误!结束时间不应该小于开始时间!";
  179. result.Code = -1;
  180. return result;
  181. }
  182. TimeSpan ts = end - start; //计算时间差
  183. int day = ts.Days;
  184. var diid = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == 79)
  185. .Select(x => x.DIId)
  186. .Distinct()
  187. .ToList();
  188. //团组下拉框
  189. List<Grp_DelegationInfo> _Delegations = diid.Any()
  190. ? _sqlSugar.Queryable<Grp_DelegationInfo>()
  191. .Where(x => x.IsDel == 0 && diid.Contains(x.Id)).ToList()
  192. : new List<Grp_DelegationInfo>();
  193. List<ShareGroupInfoIIView> grp_Delegations = _mapper.Map<List<ShareGroupInfoIIView>>(_Delegations);
  194. //支付方式
  195. List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
  196. List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
  197. //列表初始化
  198. List<Sys_SetData> TableInitialization = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 17 && a.IsDel == 0).ToList();
  199. List<SetDataInfoView> _TableInitialization = _mapper.Map<List<SetDataInfoView>>(TableInitialization);
  200. _TableInitialization = _TableInitialization.OrderBy(x => x.RemarkSort).ToList();
  201. List<Sys_SetData> ssd = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.STid == 78).ToList();
  202. List<SetDataInfoView> ssdv = _mapper.Map<List<Sys_SetData>, List<SetDataInfoView>>(ssd);
  203. var carTouristGuides = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>()
  204. .LeftJoin<Sys_SetData>((a, b) => b.IsDel == 0 && a.SId == b.Id)
  205. .Where(a => a.IsDel == 0 && a.CTGGRId == dto.Id)
  206. .Select((a, b) => new CarTouristGuideGroundReservationsContentView
  207. {
  208. SId = a.SId,
  209. Id = a.Id,
  210. Count = a.Count,
  211. DatePrice = a.DatePrice,
  212. Price = a.Price,
  213. PriceContent = a.PriceContent,
  214. Units = a.Units,
  215. SidName = b.Name
  216. })
  217. .ToList();
  218. var weikuanSign = new int[] { 1070, 1071, 1452 };
  219. TableInitialization.RemoveAll(x => weikuanSign.Contains(x.Id));
  220. var weiKuanArr = _TableInitialization.Where(x => weikuanSign.Contains(x.Id)).ToList();
  221. var weiKuanResultArr = carTouristGuides.Where(x => weikuanSign.Contains(x.SId)).ToList();
  222. carTouristGuides.RemoveAll(x => weikuanSign.Contains(x.SId));
  223. var existingSIdArr = new HashSet<int>(carTouristGuides.Select(x => x.SId));
  224. foreach (var itemSt in TableInitialization)
  225. {
  226. if (!existingSIdArr.Contains(itemSt.Id))
  227. {
  228. carTouristGuides.Add(new CarTouristGuideGroundReservationsContentView
  229. {
  230. SId = itemSt.Id,
  231. Count = 1,
  232. SidName = itemSt.Name,
  233. });
  234. existingSIdArr.Add(itemSt.Id);
  235. }
  236. }
  237. var groupResult = carTouristGuides.GroupBy(x => x.SId).ToDictionary(x => x.Key, x => x.ToList());
  238. foreach (var item in groupResult.Keys)
  239. {
  240. var startForTime = start;
  241. var dayResult = new List<CarTouristGuideGroundReservationsContentView>();
  242. for (var i = 0; i <= day; i++)
  243. {
  244. dayResult.Add(new CarTouristGuideGroundReservationsContentView
  245. {
  246. Count = 1,
  247. DatePrice = startForTime,
  248. SId = item,
  249. SidName = groupResult[item][0].SidName
  250. });
  251. startForTime = startForTime.AddDays(1);
  252. }
  253. if (groupResult[item].Count != day)
  254. {
  255. for (var m = 0; m < groupResult[item].Count; m++)
  256. {
  257. for (var m1 = 0; m1 < dayResult.Count; m1++)
  258. {
  259. if (groupResult[item][m].DatePrice == dayResult[m1].DatePrice)
  260. {
  261. dayResult[m1] = groupResult[item][m];
  262. }
  263. }
  264. }
  265. }
  266. else
  267. {
  268. groupResult[item] = groupResult[item].OrderBy(x => x.DatePrice).ToList();
  269. if (groupResult[item][0].DatePrice == dayResult[0].DatePrice && groupResult[item][day - 1].DatePrice == dayResult[day - 1].DatePrice)
  270. {
  271. dayResult = groupResult[item];
  272. }
  273. else
  274. {
  275. for (var m = 0; m < groupResult[item].Count; m++)
  276. {
  277. for (var m1 = 0; m1 < dayResult.Count; m1++)
  278. {
  279. if (groupResult[item][m].DatePrice == dayResult[m1].DatePrice)
  280. {
  281. dayResult[m1] = groupResult[item][m];
  282. }
  283. }
  284. }
  285. }
  286. }
  287. groupResult[item] = dayResult;
  288. }
  289. carTouristGuides = groupResult.Values.SelectMany(sublist => sublist).OrderBy(x => x.SId).ThenBy(x => x.DatePrice).ToList();
  290. var _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment, Sys_SetData, Sys_SetData>(
  291. (g, s1, s2) => new JoinQueryInfos(
  292. JoinType.Left, g.PayDId == s1.Id,
  293. JoinType.Left, g.PaymentCurrency == s2.Id
  294. ))
  295. .Where((g, s1, s2) => g.CId == dto.Id && g.IsDel == 0 && g.CTable == 79)
  296. .Select((g, s1, s2) => new CarTouristCreditCardPaymentView
  297. {
  298. IsAuditGM = g.IsAuditGM,
  299. PayDId = g.PayDId,
  300. PaymentCurrency = g.PaymentCurrency,
  301. Payee = g.Payee,
  302. PayMoney = g.PayMoney,
  303. PayPercentage = g.PayPercentage,
  304. PayName = s1.Name,
  305. PaymentCurrencyName = s2.Name,
  306. OrbitalPrivateTransfer = g.OrbitalPrivateTransfer,
  307. OrbitalPrivateTransferStr = g.OrbitalPrivateTransfer == 0 ? "公转" : "私转",
  308. BankNo = g.BankNo,
  309. CardholderName = g.CardholderName,
  310. CompanyBankNo = g.CompanyBankNo,
  311. ConsumptionDate = g.ConsumptionDate,
  312. ConsumptionPatterns = g.ConsumptionPatterns,
  313. Ctdid = g.CTDId,
  314. OtherBankName = g.OtherBankName,
  315. OtherSideName = g.OtherSideName,
  316. OtherSideNo = g.OtherSideNo,
  317. })
  318. .First();
  319. Dictionary<string, string> soureDic = new Dictionary<string, string>()
  320. {
  321. {"车费", "VF"},
  322. {"导游费", "T/G S"},
  323. {"客户午餐费用" , "L"},
  324. {"导游景点费" , "T/G EF"},
  325. {"导游小费" , "T/G T"},
  326. // --
  327. {"司机小费", "DRV T"},
  328. {"司机餐补", "C/F M"},
  329. {"车超时费", "C/F OF"},
  330. {"导游餐补", "T/G M"},
  331. {"导游房补", "T/G A"},
  332. {"导游交通", "T/G TF"},
  333. {"客户早餐费用", "B"},
  334. {"客户晚餐费用", "D"},
  335. {"景点门票费", "EF"},
  336. {"饮料/零食/水果", "B/R/F"},
  337. {"翻译费", "I/F"},
  338. };
  339. var checkedItem = new List<string>();
  340. var checkedItemId = new List<int>();
  341. var isSaveCheck = false;
  342. if (string.IsNullOrWhiteSpace(grpCarOp.SelectCheck))
  343. {
  344. //获取成本选中
  345. var checkTopArr = _checkRep.GetCheckBoxsByDiid(grpCarOp.DiId);
  346. if (true)
  347. {
  348. var FindTop = checkTopArr.Find(x => x.CbType == "Top");
  349. if (FindTop != null)
  350. {
  351. var selectName = FindTop.CbValues.Split(',').ToList<string>();
  352. foreach (var soureKey in soureDic.Keys)
  353. {
  354. var find = selectName.Find(x => x == soureDic[soureKey]);
  355. if (find == null)
  356. {
  357. var Lindex = carTouristGuides.FindIndex(x => x.SidName == soureKey);
  358. //carTouristGuides.RemoveRange(Lindex, day + 1);
  359. }
  360. else
  361. {
  362. checkedItem.Add(soureKey);
  363. checkedItemId.Add(_TableInitialization.Find(x => x.Name == soureKey)!.Id);
  364. }
  365. }
  366. }
  367. else
  368. {
  369. checkedItem = _TableInitialization.Select(x => x.Name).ToList();
  370. checkedItemId.AddRange(_TableInitialization.Select(x => x.Id).ToList());
  371. }
  372. }
  373. }
  374. else
  375. {
  376. isSaveCheck = true;
  377. var checkedItemThis = grpCarOp.SelectCheck.Split(",").ToList<string>();
  378. int number = 0;
  379. foreach (var item in checkedItemThis)
  380. {
  381. if (!int.TryParse(item, out number))
  382. {
  383. checkedItemId.Add(_TableInitialization.Find(x => x.Name == item)!.Id);
  384. checkedItem.Add(item);
  385. }
  386. else
  387. {
  388. checkedItemId.Add(number);
  389. checkedItem.Add(_TableInitialization.Find(x => x.Id == int.Parse(item))!.Name);
  390. }
  391. }
  392. }
  393. if (grpCarOp.PriceType == 1062) //尾款id
  394. {
  395. if (isSaveCheck)
  396. {
  397. checkedItemId.AddRange(weiKuanArr.Select(x => x.Id).ToList());
  398. checkedItem.AddRange(weiKuanArr.Select(x => x.Name).ToList());
  399. checkedItemId = checkedItemId.Distinct().ToList();
  400. checkedItem = checkedItem.Distinct().ToList();
  401. }
  402. else
  403. {
  404. checkedItemId = weiKuanArr.Select(x => x.Id).ToList();
  405. checkedItem = weiKuanArr.Select(x => x.Name).ToList();
  406. }
  407. var weiPrice = weiKuanResultArr.Find(x => x.SId == 1070);
  408. if (weiPrice != null)
  409. {
  410. weiPrice.SidName = "尾款金额";
  411. }
  412. var weiOther = weiKuanResultArr.Find(x => x.SId == 1071);
  413. if (weiOther != null)
  414. {
  415. weiOther.SidName = "其他额外费用";
  416. }
  417. var cityPrice = weiKuanResultArr.Find(x => x.SId == 1452);
  418. if (cityPrice != null)
  419. {
  420. cityPrice.SidName = "城市税";
  421. }
  422. carTouristGuides.Add(weiPrice ??= new CarTouristGuideGroundReservationsContentView
  423. {
  424. Count = 1,
  425. DatePrice = DateTime.Now,
  426. Price = 0,
  427. PriceContent = "",
  428. SId = 1070,
  429. SidName = "尾款金额",
  430. Units = 0,
  431. });
  432. carTouristGuides.Add(weiOther ??= new CarTouristGuideGroundReservationsContentView
  433. {
  434. Count = 1,
  435. DatePrice = DateTime.Now,
  436. Price = 0,
  437. PriceContent = "",
  438. SId = 1071,
  439. SidName = "其他额外费用",
  440. Units = 0,
  441. });
  442. carTouristGuides.Add(cityPrice ??= new CarTouristGuideGroundReservationsContentView
  443. {
  444. Count = 1,
  445. DatePrice = DateTime.Now,
  446. Price = 0,
  447. PriceContent = "",
  448. SId = 1452,
  449. SidName = "城市税",
  450. Units = 0,
  451. });
  452. }
  453. else
  454. {
  455. _TableInitialization.RemoveAll(x => weikuanSign.Contains(x.Id));
  456. checkedItem.RemoveAll(x => x == "尾款金额" || x == "其他额外费用");
  457. checkedItemId.RemoveAll(x => weikuanSign.Contains(x));
  458. }
  459. //三公费用金额以及币种
  460. var boolParse = int.TryParse(grpCarOp.Area, out int natiId);
  461. var NationalTravelFee = _sqlSugar.Queryable<Grp_NationalTravelFee>()
  462. .LeftJoin<Sys_SetData>((a, b) => a.Currency == b.Id)
  463. .Where((a, b) => a.IsDel == 0 && b.IsDel == 0)
  464. .Select((a, b) => new
  465. {
  466. a.Id,
  467. a.Currency,
  468. CurrencyStr = b.Name,
  469. a.FoodCost,
  470. a.RoomCost,
  471. a.PublicCost,
  472. })
  473. .First((a) => boolParse == true && a.Id == natiId);
  474. var rate = new
  475. {
  476. grpCarOp.Rate,
  477. grpCarOp.toCurr
  478. };
  479. var bankCard = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 15)
  480. .Select(x => new
  481. {
  482. x.Id,
  483. x.Name
  484. })
  485. .OrderByDescending(x => x.Id)
  486. .ToList();
  487. if (dto.PortType == 1)
  488. {
  489. var data = new
  490. {
  491. Payment = _Payment,
  492. Delegations = grp_Delegations,
  493. carTouristGuides = carTouristGuides,
  494. CreditCardPayment = _CreditCardPayment,
  495. start,
  496. end,
  497. ssdv,
  498. checkedItem,
  499. existItem = _TableInitialization.Select(x => x.Name).ToList(),
  500. NationalTravelFee,
  501. rate,
  502. bankCard
  503. };
  504. return result = new Result() { Code = 0, Msg = "查询成功", Data = data };
  505. }
  506. else if (dto.PortType == 2)
  507. {
  508. var data = new
  509. {
  510. Payment = _Payment,
  511. TableInitialization = _TableInitialization,
  512. carTouristGuides = carTouristGuides,
  513. CreditCardPayment = _CreditCardPayment ??= new CarTouristCreditCardPaymentView(),
  514. ssdv,
  515. checkedItemId,
  516. NationalTravelFee,
  517. rate,
  518. bankCard
  519. };
  520. return result = new Result() { Code = 0, Msg = "查询成功", Data = data };
  521. }
  522. return result = new Result() { Code = -1, Msg = "请传入有效portType" };
  523. }
  524. catch (Exception ex)
  525. {
  526. return result = new Result() { Code = -2, Msg = "未知错误" };
  527. }
  528. }
  529. /// <summary>
  530. /// web弃用
  531. /// </summary>
  532. /// <param name="dto"></param>
  533. /// <returns></returns>
  534. public Result OpCarTouristGuideGroundContentById(CarTouristGuideGroundIdDto dto)
  535. {
  536. Result result = new Result() { Code = -2, Msg = "未知错误" };
  537. try
  538. {
  539. List<Grp_CarTouristGuideGroundReservationsContent> grp_CarTouristsContent = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>().Where(a => a.IsDel == 0 && a.CTGGRId == dto.Id).ToList();
  540. List<CarTouristGuideGroundReservationsContentView> carTouristGuides = _mapper.Map<List<CarTouristGuideGroundReservationsContentView>>(grp_CarTouristsContent);
  541. foreach (var item in carTouristGuides)
  542. {
  543. item.SidName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == item.SId).Name;
  544. }
  545. Grp_CreditCardPayment CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 79);
  546. CarTouristCreditCardPaymentView _CreditCardPayment = _mapper.Map<CarTouristCreditCardPaymentView>(CreditCardPayment);
  547. if (_CreditCardPayment != null)
  548. {
  549. _CreditCardPayment.PayName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == _CreditCardPayment.PayDId).Name;
  550. _CreditCardPayment.PaymentCurrencyName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == _CreditCardPayment.PaymentCurrency).Name;
  551. if (_CreditCardPayment.OrbitalPrivateTransfer == 0) _CreditCardPayment.OrbitalPrivateTransferStr = "公转";
  552. else _CreditCardPayment.OrbitalPrivateTransferStr = "私转";
  553. }
  554. var data = new
  555. {
  556. CarTouristsContent = carTouristGuides,
  557. CreditCardPayment = _CreditCardPayment,
  558. };
  559. return result = new Result() { Code = 0, Msg = "查询成功", Data = data };
  560. }
  561. catch (Exception ex)
  562. {
  563. return result = new Result() { Code = -2, Msg = "未知错误(" + ex.Message + ")" };
  564. }
  565. }
  566. /// <summary>
  567. /// 根据diid查询op费用列表
  568. /// </summary>
  569. /// <param name="dto"></param>
  570. /// <returns></returns>
  571. public async Task<Result> QueryCarTouristGuideGroundByDiId(CarTouristGuideGroundDto dto)
  572. {
  573. Result result = new Result() { Code = -2, Msg = "未知错误" };
  574. if (dto.PortType == 0 || string.IsNullOrWhiteSpace(dto.PortType.ToString()))
  575. {
  576. return result = new Result() { Code = -1, Msg = "请传入PortType参数,请求端口分类 1 Web 2 Android 3 IOS" };
  577. }
  578. try
  579. {
  580. #region SQL条件拼接
  581. string sqlWhere = string.Empty;
  582. sqlWhere += string.Format(@"And t.DIId={0} and t.isdel={1}", dto.DiId, 0);
  583. string UserId = "";
  584. List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 79).ToList();
  585. foreach (Grp_GroupsTaskAssignment gta in gtaUIdList)
  586. UserId += gta.UId + ",";
  587. if (!string.IsNullOrWhiteSpace(UserId))
  588. {
  589. UserId = UserId.Substring(0, UserId.Length - 1);
  590. }
  591. else
  592. {
  593. UserId = "0";
  594. }
  595. sqlWhere += string.Format(@" And t.CreateUserId in ({0})", UserId);
  596. if (dto.IsPaySign != -1)
  597. {
  598. sqlWhere += string.Format(@" And c.IsPay = {0} ", dto.IsPaySign);
  599. }
  600. if (!string.IsNullOrEmpty(sqlWhere.Trim()))
  601. {
  602. Regex r = new Regex("And");
  603. sqlWhere = r.Replace(sqlWhere, "Where", 1);
  604. }
  605. #endregion
  606. int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
  607. int endIndex = startIndex + dto.PageSize - 1;
  608. Regex regex = new Regex("^[\u4e00-\u9fa5]*$");
  609. //城市列表
  610. var data = _sqlSugar.Queryable<Grp_NationalTravelFee>()
  611. .Where(x => x.IsDel == 0)
  612. .Select(x => new
  613. {
  614. x.Id,
  615. x.Country,
  616. x.City,
  617. })
  618. .ToList();
  619. if (dto.PortType == 1)
  620. {
  621. string sql = string.Format(@"select t.*,(select Name from Sys_SetData where isdel = 0 and id = t.priceType) as 'priceTypeStr',s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage,c.PayMoney,c.PayDid,c.IsPay from
  622. Grp_CarTouristGuideGroundReservations t
  623. left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id and c.isdel=0
  624. left Join Sys_SetData s on s.Id=c.PaymentCurrency {0}
  625. order by c.IsAuditGM,c.PayPercentage desc", sqlWhere);
  626. List<Grp_CarTouristGuideGroundView> infoViews = _sqlSugar.SqlQueryable<Grp_CarTouristGuideGroundView>(sql).ToList();
  627. foreach (var item in infoViews)
  628. {
  629. if (!regex.IsMatch(item.Area))
  630. {
  631. for (int i = 0; i < data.Count; i++)
  632. {
  633. if (item.Area.Equals(data[i].Id.ToString()))
  634. {
  635. item.Area = string.Format("{0} {1}", data[i].Country, data[i].City);
  636. }
  637. }
  638. }
  639. if (string.IsNullOrWhiteSpace(item.priceTypeStr))
  640. {
  641. item.priceTypeStr = "未选择!";
  642. }
  643. if (item.OrbitalPrivateTransfer == 0) item.OrbitalPrivateTransferStr = "公转";
  644. else if (item.OrbitalPrivateTransfer == 1) item.OrbitalPrivateTransferStr = "私转";
  645. item.ServiceStartTime = Convert.ToDateTime(item.ServiceStartTime).ToString("yyyy-MM-dd");
  646. item.ServiceEndTime = Convert.ToDateTime(item.ServiceEndTime).ToString("yyyy-MM-dd");
  647. item.ServiceQuotedPrice = item.PayMoney;
  648. item.PayThenMoney = Math.Round(item.PayPercentage / 100 * item.ServiceQuotedPrice, 2);
  649. item.RemainingBalance = Math.Round(item.ServiceQuotedPrice - item.PayPercentage / 100 * item.ServiceQuotedPrice, 2);
  650. if (item.IsAuditGM == 0) item.IsAuditGMStr = "未审核";
  651. else if (item.IsAuditGM == 1) item.IsAuditGMStr = "已通过";
  652. else if (item.IsAuditGM == 2) item.IsAuditGMStr = "未通过";
  653. else if (item.IsAuditGM == 3) item.IsAuditGMStr = "自动审核";
  654. Sys_SetData s = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == item.PayDid);
  655. if (s != null)
  656. {
  657. item.PayStrd = s.Name;
  658. }
  659. else item.PayStrd = "未选择";
  660. }
  661. return result = new Result() { Code = 0, Msg = "查询成功!", Data = infoViews };
  662. }
  663. else if (dto.PortType == 2 || dto.PortType == 3)
  664. {
  665. string sql = string.Format(@"Select * From (
  666. Select row_number() over (order by c.IsAuditGM,c.PayPercentage desc) as RowNumber,t.*,(select Name from Sys_SetData where isdel = 0 and id = t.priceType) as 'priceTypeStr',s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage,c.PayDid,c.PayMoney
  667. from
  668. Grp_CarTouristGuideGroundReservations t
  669. left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id and c.isdel=0
  670. left Join Sys_SetData s on s.Id=c.PaymentCurrency {0}
  671. ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
  672. List<Grp_CarTouristGuideGroundView> grp_CarTourists = _sqlSugar.SqlQueryable<Grp_CarTouristGuideGroundView>(sql).ToList();
  673. foreach (var item in grp_CarTourists)
  674. {
  675. if (!regex.IsMatch(item.Area))
  676. {
  677. for (int i = 0; i < data.Count; i++)
  678. {
  679. if (item.Area.Equals(data[i].Id.ToString()))
  680. {
  681. item.Area = string.Format("{0} {1}", data[i].Country, data[i].City);
  682. }
  683. }
  684. }
  685. if (string.IsNullOrWhiteSpace(item.priceTypeStr))
  686. {
  687. item.priceTypeStr = "未选择!";
  688. }
  689. if (item.OrbitalPrivateTransfer == 0) item.OrbitalPrivateTransferStr = "公转";
  690. else if (item.OrbitalPrivateTransfer == 1) item.OrbitalPrivateTransferStr = "私转";
  691. item.ServiceStartTime = Convert.ToDateTime(item.ServiceStartTime).ToString("yyyy-MM-dd");
  692. item.ServiceEndTime = Convert.ToDateTime(item.ServiceEndTime).ToString("yyyy-MM-dd");
  693. if (item.IsAuditGM == 0) item.IsAuditGMStr = "未审核";
  694. else if (item.IsAuditGM == 1) item.IsAuditGMStr = "已通过";
  695. else if (item.IsAuditGM == 2) item.IsAuditGMStr = "未通过";
  696. else if (item.IsAuditGM == 3) item.IsAuditGMStr = "自动审核";
  697. item.ServiceQuotedPrice = item.PayMoney;
  698. item.PayThenMoney = Math.Round(item.PayPercentage / 100 * item.ServiceQuotedPrice, 2);
  699. item.RemainingBalance = Math.Round(item.ServiceQuotedPrice - item.PayPercentage / 100 * item.ServiceQuotedPrice, 2);
  700. Sys_SetData s = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == item.PayDid);
  701. if (s != null)
  702. {
  703. item.PayStrd = s.Name;
  704. }
  705. else item.PayStrd = "未选择";
  706. }
  707. string CountSql = string.Format(@"Select COUNT(1) as Count From (
  708. select t.*,s.Name as CurrencyStr,c.IsAuditGM,c.PayPercentage from
  709. Grp_CarTouristGuideGroundReservations t
  710. left Join Grp_CreditCardPayment c on CTable=79 and c.CId=t.Id and c.isdel=0
  711. left Join Sys_SetData s on s.Id=t.CId {0}
  712. ) temp ", sqlWhere);
  713. DataCount dataCount = _sqlSugar.SqlQueryable<DataCount>(CountSql).First();
  714. if (dataCount != null)
  715. {
  716. int count = dataCount.Count;
  717. float totalPage = (float)count / dto.PageSize;//总页数
  718. if (totalPage == 0) totalPage = 1;
  719. else totalPage = (int)Math.Ceiling((double)totalPage);
  720. ListViewBase<Grp_CarTouristGuideGroundView> rst = new ListViewBase<Grp_CarTouristGuideGroundView>();
  721. rst.DataList = grp_CarTourists;
  722. rst.DataCount = count;
  723. rst.CurrPageIndex = dto.PageIndex;
  724. rst.CurrPageSize = dto.PageSize;
  725. return result = new Result() { Code = 0, Msg = "查询成功!", Data = rst };
  726. }
  727. }
  728. }
  729. catch (Exception)
  730. {
  731. return result = new Result() { Code = -2, Msg = "未知错误" };
  732. }
  733. return result;
  734. }
  735. /// <summary>
  736. /// OP费用录入填写详情
  737. /// </summary>
  738. /// <param name="dto"></param>
  739. /// <returns></returns>
  740. public async Task<Result> OpCarTouristGuideGroundContent(OpCarTouristGuideGroundContentDto dto)
  741. {
  742. Result result = new Result() { Code = -2, Msg = "未知错误" };
  743. var di = _sqlSugar.Queryable<Grp_DelegationInfo>().First(x => x.Id == dto.DiId && x.IsDel == 0);
  744. if (di == null)
  745. {
  746. result.Code = -1;
  747. result.Msg = "无该团组信息!";
  748. return result;
  749. }
  750. try
  751. {
  752. BeginTran();
  753. List<Grp_CarTouristGuideGroundReservationsContent> carTouristList = dto.OPContentList.Select(item => new Grp_CarTouristGuideGroundReservationsContent
  754. {
  755. Id = item.Id,
  756. DiId = dto.DiId,
  757. CTGGRId = dto.CTGGRId,
  758. SId = item.SId,
  759. Price = item.Price,
  760. PriceContent = item.priceContent,
  761. Currency = dto.Currency,
  762. CreateUserId = dto.CreateUserId,
  763. Units = item.Units,
  764. DatePrice = item.DatePrice,
  765. Count = item.Count,
  766. }).ToList();
  767. #region 旧数据处理
  768. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm ss");
  769. var ids = carTouristList.Select(x1 => x1.Id);
  770. _ = _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservationsContent>().Where(x => x.DiId == dto.DiId && x.CTGGRId == dto.CTGGRId && !ids.Contains(x.Id) && x.IsDel == 0).SetColumns(x => new Grp_CarTouristGuideGroundReservationsContent
  771. {
  772. IsDel = 1,
  773. DeleteTime = time,
  774. DeleteUserId = dto.CreateUserId,
  775. }).ExecuteCommand();
  776. #endregion
  777. if (carTouristList.Count > 0)
  778. {
  779. #region 超支处理
  780. Dictionary<int, int> mealsDic = new Dictionary<int, int>()
  781. {
  782. {988,1074},
  783. {93,1075},
  784. {989,1076},
  785. };
  786. //限制只能选择地区
  787. var opSingle = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(x => x.Id == dto.CTGGRId && x.IsDel == 0);
  788. var opSingleCityId = 0;
  789. Grp_NationalTravelFee cityPrice = null;
  790. string priceCity = string.Empty;
  791. //三公费用
  792. if (int.TryParse(opSingle.Area, out opSingleCityId))
  793. {
  794. cityPrice = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(x =>
  795. x.Id == opSingleCityId
  796. ).First();
  797. priceCity = cityPrice == null ? string.Empty : cityPrice.Country + cityPrice?.City;
  798. }
  799. else
  800. {
  801. cityPrice = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(x =>
  802. !string.IsNullOrEmpty(x.City) && x.City.Contains(opSingle.Area)
  803. ).First();
  804. priceCity = opSingle.Area;
  805. }
  806. cityPrice ??= new Grp_NationalTravelFee
  807. {
  808. FoodCost = 0.00M,
  809. Id = 0,
  810. };
  811. List<Tuple<int, string, int, decimal>> arr = new List<Tuple<int, string, int, decimal>>();
  812. arr.Add(new Tuple<int, string, int, decimal>(1074, "早餐超支费用", 1077, 1M)); // sid name setdataid 系数
  813. arr.Add(new Tuple<int, string, int, decimal>(1075, "午餐超支费用", 1078, 1M));
  814. arr.Add(new Tuple<int, string, int, decimal>(1076, "晚餐超支费用", 1079, 1M));
  815. arr.Add(new Tuple<int, string, int, decimal>(982, "车超时费用", 1050, 2.4M));
  816. arr.Add(new Tuple<int, string, int, decimal>(1059, "导游超时费用", 1072, 1M));
  817. arr.Add(new Tuple<int, string, int, decimal>(1085, "景点门票超支费用", 1086, 1.2M));
  818. arr.Add(new Tuple<int, string, int, decimal>(1073, "翻译超时费用", 1087, 1.5M));
  819. //超支费用表(数据添加) Fin_GroupExtraCost
  820. List<Fin_GroupExtraCost> groupExtraCostsArr = new List<Fin_GroupExtraCost>();
  821. List<List<Fin_GroupExtraCost>> enterOverspendArr = new List<List<Fin_GroupExtraCost>>();
  822. var aMeal = cityPrice.FoodCost.ObjToDecimal() / 2; //一顿三公费用
  823. var findSetDataCurr = _sqlSugar.Queryable<Sys_SetData>().First(q => q.Id == dto.toCurr && q.IsDel == 0);
  824. var carCurr = _sqlSugar.Queryable<Sys_SetData>().First(q => q.Id == carTouristList.First().Currency && q.IsDel == 0);
  825. foreach (var item in arr)
  826. {
  827. var a = carTouristList.Where(x => x.SId == item.Item1 && x.Price != 0).Select(x => new Fin_GroupExtraCost
  828. {
  829. Coefficient = item.Item4,
  830. CreateTime = DateTime.Now,
  831. CreateUserId = dto.CreateUserId,
  832. DiId = dto.DiId,
  833. FilePath = string.Empty,
  834. IsDel = 0,
  835. PriceCount = x.Count,
  836. Price = x.Price,
  837. PriceDt = x.DatePrice.ObjToDate(),
  838. PriceCurrency = x.Currency,
  839. PriceSum = x.Count * x.Price,
  840. PriceName = di.TeamName + "-" + priceCity + "-" + $"{item.Item2}(地接导入)",
  841. PriceType = 1028,
  842. PriceDetailType = item.Item3,
  843. Remark = x.PriceContent,
  844. Area = opSingleCityId
  845. }).ToList();
  846. if (a.Count > 0)
  847. {
  848. enterOverspendArr.Add(a);
  849. }
  850. }
  851. //数组中的费用
  852. if (enterOverspendArr.Count > 0)
  853. {
  854. groupExtraCostsArr.AddRange(enterOverspendArr.SelectMany(x => x).ToList());
  855. }
  856. var start = opSingle.ServiceStartTime.ObjToDate();
  857. var end = opSingle.ServiceEndTime.ObjToDate();
  858. string remake = string.Empty;
  859. var exitMealCount = 0;
  860. var price = 0M;
  861. //var day = 0;
  862. var consumerMealStr = string.Empty;
  863. var consumerMealNumber = 0;
  864. var consumerMealAllPrice = 0.00M;
  865. while (start <= end)
  866. {
  867. //查看每日每顿是否存在超支
  868. //不存在则加入退费 (三公一顿 - 消费金额)
  869. //93 , 989
  870. bool isExistsWu = carTouristList.Where(x => x.SId == mealsDic[93] && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0 && x.Price > 0).Count() == 0;
  871. bool isExistsWan = carTouristList.Where(x => x.SId == mealsDic[989] && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0 && x.Price > 0).Count() == 0;
  872. var mealPriceWu = carTouristList.Where(x => x.SId == 93 && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0).Sum(x => x.Price * x.Count);
  873. var mealPriceWan = carTouristList.Where(x => x.SId == 989 && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0).Sum(x => x.Price * x.Count);
  874. var mealPriceWuChao = carTouristList.Where(x => x.SId == mealsDic[93] && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0).Sum(x => x.Price * x.Count);
  875. var mealPriceWanChao = carTouristList.Where(x => x.SId == mealsDic[989] && x.IsDel == 0 && DateTime.Compare(start, x.DatePrice.ObjToDate()) == 0).Sum(x => x.Price * x.Count);
  876. if (mealPriceWu > 0)
  877. {
  878. consumerMealStr += $"{start.ToString("M/d")}午餐消费{mealPriceWu + mealPriceWuChao}{carCurr?.Name},";
  879. consumerMealNumber++;
  880. consumerMealAllPrice += mealPriceWu + mealPriceWuChao;
  881. }
  882. if (mealPriceWan > 0)
  883. {
  884. consumerMealStr += $"{start.ToString("M/d")}晚餐消费{mealPriceWan + mealPriceWanChao}{carCurr?.Name},";
  885. consumerMealNumber++;
  886. consumerMealAllPrice += mealPriceWan + mealPriceWanChao;
  887. }
  888. if (isExistsWu && isExistsWan)
  889. {
  890. remake += $"{start.ToString("M/d")}午餐和晚餐,";
  891. exitMealCount += 2;
  892. price += (aMeal * 2 * di.VisitPNumber) - (mealPriceWu * dto.Rate) - (mealPriceWan * dto.Rate);
  893. }
  894. else if (isExistsWu)
  895. {
  896. remake += $"{start.ToString("M/d")}午餐,";
  897. exitMealCount += 1;
  898. price += (aMeal * di.VisitPNumber) - (mealPriceWu * dto.Rate);
  899. }
  900. else if (isExistsWan)
  901. {
  902. remake += $"{start.ToString("M/d")}晚餐,";
  903. exitMealCount += 1;
  904. price += (aMeal * di.VisitPNumber) - (mealPriceWan * dto.Rate);
  905. }
  906. start = start.AddDays(1);
  907. //day++;
  908. }
  909. var priceTypeArr = new int[] { 1061, 1069 };
  910. if (exitMealCount > 0 && priceTypeArr.Contains(opSingle.PriceType))
  911. {
  912. string searchKey = "宴请";
  913. remake = remake.TrimEnd(',');
  914. remake += $"财政 {findSetDataCurr?.Name} {aMeal} * {di.VisitPNumber} * {exitMealCount}餐";
  915. remake += $",[TuT]{consumerMealStr} 共{consumerMealNumber}顿 {consumerMealAllPrice} {carCurr?.Name}";
  916. decimal priceInt = price / di.VisitPNumber / exitMealCount;
  917. groupExtraCostsArr.Add(new Fin_GroupExtraCost
  918. {
  919. Coefficient = 1,
  920. CreateTime = DateTime.Now,
  921. CreateUserId = dto.CreateUserId,
  922. DiId = dto.DiId,
  923. FilePath = string.Empty,
  924. IsDel = 0,
  925. PriceCount = di.VisitPNumber * exitMealCount * -1,
  926. Price = priceInt,
  927. PriceDt = opSingle.ServiceStartTime.ObjToDate(),
  928. PriceCurrency = findSetDataCurr == null ? dto.toCurr : findSetDataCurr.Id,
  929. PriceSum = (di.VisitPNumber * exitMealCount * -1) * priceInt,
  930. PriceName = di.TeamName + "-" + priceCity + "-" + $"退餐费(地接导入)",
  931. PriceType = 1028,
  932. PriceDetailType = 1088,
  933. Remark = remake,
  934. Area = opSingleCityId,
  935. SYsupervisorConfirm = dto.OPContentList.Where(x => x.priceContent.Contains(searchKey)).Count() > 0 ? 1 : 0,
  936. });
  937. }
  938. var needToConfirm = new int[] { 1088, 1050 };
  939. if (groupExtraCostsArr.Count > 0)
  940. {
  941. foreach (var item in groupExtraCostsArr)
  942. {
  943. var ManagerConfirm = needToConfirm.Contains(item.PriceDetailType) ? 0 : 1;
  944. var SupervisorConfirm = needToConfirm.Contains(item.PriceDetailType) ? 0 : 1;
  945. var SYsupervisorConfirm = needToConfirm.Contains(item.PriceDetailType) ? 0 : 1;
  946. if (item.SYsupervisorConfirm > 0)
  947. {
  948. SYsupervisorConfirm = 1;
  949. }
  950. var QuerySgin = _sqlSugar.Queryable<Fin_GroupExtraCost>()
  951. .Where(x => x.PriceName == item.PriceName && x.DiId == item.DiId && x.IsDel == 0 && x.PriceDt.ToString("yyyy-MM-dd") == item.PriceDt.ToString("yyyy-MM-dd"))
  952. .First();
  953. if (QuerySgin == null)
  954. {
  955. var resultId = await PostGroupExtraCost_Operator(new Fin_GroupExtraCostDto_OP
  956. {
  957. coefficient = item.Coefficient,
  958. createUser = dto.CreateUserId,
  959. currency = item.PriceCurrency,
  960. diId = item.DiId,
  961. editType = 1,
  962. filePath = string.Empty,
  963. payee = dto.Payee,
  964. PortType = 1,
  965. PriceCount = item.PriceCount,
  966. priceName = item.PriceName,
  967. remark = item.Remark,
  968. price = item.Price,
  969. priceDetailType = item.PriceDetailType,
  970. priceType = item.PriceType,
  971. PriceDt = item.PriceDt.ToString("yyyy-MM-dd"),
  972. payType = dto.PayDId,
  973. costSign = dto.OrbitalPrivateTransfer,
  974. Area = item.Area,
  975. ManagerConfirm = ManagerConfirm,
  976. SupervisorConfirm = SupervisorConfirm,
  977. SYsupervisorConfirm = SYsupervisorConfirm
  978. });
  979. _sqlSugar.Insertable<Fin_LocalGuideRelevancyOverspend>(new Fin_LocalGuideRelevancyOverspend
  980. {
  981. CreateTime = DateTime.Now,
  982. CreateUserId = dto.CreateUserId,
  983. IsDel = 0,
  984. LocalGuideId = opSingle.Id,
  985. OverspendId = resultId.Data,
  986. }).ExecuteCommand();
  987. }
  988. else
  989. {
  990. item.Id = QuerySgin.Id;
  991. _ = await PostGroupExtraCost_Operator(new Fin_GroupExtraCostDto_OP
  992. {
  993. coefficient = item.Coefficient,
  994. createUser = dto.CreateUserId,
  995. currency = item.PriceCurrency,
  996. diId = item.DiId,
  997. editType = 2,
  998. filePath = string.Empty,
  999. payee = dto.Payee,
  1000. PortType = 1,
  1001. PriceCount = item.PriceCount,
  1002. priceName = item.PriceName,
  1003. remark = item.Remark,
  1004. price = item.Price,
  1005. priceDetailType = item.PriceDetailType,
  1006. priceType = item.PriceType,
  1007. PriceDt = item.PriceDt.ToString("yyyy-MM-dd"),
  1008. payType = dto.PayDId,
  1009. costSign = dto.OrbitalPrivateTransfer,
  1010. Id = item.Id,
  1011. Area = item.Area,
  1012. });
  1013. }
  1014. }
  1015. _foreignReceivablesRepository.OverSpSeteceivables(new OverSpSeteceivablesDto
  1016. {
  1017. CreateUserId = dto.CreateUserId,
  1018. DiId = dto.DiId,
  1019. });
  1020. }
  1021. #endregion
  1022. var existingRecords = await _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>()
  1023. .Where(a => carTouristList.Select(item => item.Id).Contains(a.Id) &&
  1024. a.CTGGRId == dto.CTGGRId &&
  1025. a.IsDel == 0
  1026. )
  1027. .ToListAsync();
  1028. var existingRecordsDict = existingRecords.ToDictionary(a => (a.Id));
  1029. var insertList = new List<Grp_CarTouristGuideGroundReservationsContent>();
  1030. var updateList = new List<Grp_CarTouristGuideGroundReservationsContent>();
  1031. foreach (var item in carTouristList)
  1032. {
  1033. if (!existingRecordsDict.TryGetValue((item.Id), out var existingRecord))
  1034. {
  1035. insertList.Add(item);
  1036. }
  1037. else
  1038. {
  1039. existingRecord.Price = item.Price;
  1040. existingRecord.PriceContent = item.PriceContent;
  1041. existingRecord.Currency = dto.Currency;
  1042. existingRecord.Remark = item.Remark;
  1043. existingRecord.DatePrice = item.DatePrice;
  1044. existingRecord.Count = item.Count;
  1045. existingRecord.Units = item.Units;
  1046. updateList.Add(existingRecord);
  1047. }
  1048. }
  1049. // 执行批量插入
  1050. if (insertList.Any())
  1051. {
  1052. var insertIds = await _sqlSugar.Insertable(insertList).ExecuteReturnIdentityAsync();
  1053. if (insertIds == 0)
  1054. {
  1055. throw new Exception("添加失败,请稍后重试!");
  1056. }
  1057. }
  1058. // 执行批量更新
  1059. if (updateList.Any())
  1060. {
  1061. var updateCount = await _sqlSugar.Updateable(updateList).ExecuteCommandAsync();
  1062. if (updateCount == 0)
  1063. {
  1064. throw new Exception("修改失败,请稍后重试!");
  1065. }
  1066. }
  1067. }
  1068. Regex regex = new Regex("^[\u4e00-\u9fa5]{0,}$");
  1069. //城市税排除计算
  1070. var excludeList = new List<int>(); // { 1452 }
  1071. #region 修改C表数据
  1072. Grp_CreditCardPayment c = new Grp_CreditCardPayment();
  1073. c.PaymentCurrency = dto.Currency;
  1074. for (int i = 0; i < dto.SelectCheck.Count; i++)
  1075. {
  1076. if (!regex.IsMatch(dto.SelectCheck[i]))
  1077. {
  1078. for (int j = 0; j < carTouristList.Count; j++)
  1079. {
  1080. if (int.Parse(dto.SelectCheck[i]) == carTouristList[j].SId)
  1081. {
  1082. if (excludeList.Contains(carTouristList[j].SId))
  1083. {
  1084. continue;
  1085. }
  1086. c.PayMoney += carTouristList[j].Price * carTouristList[j].Count;
  1087. }
  1088. }
  1089. }
  1090. else
  1091. {
  1092. c.PayMoney = carTouristList.Sum(x =>
  1093. {
  1094. if (excludeList.Contains(x.SId))
  1095. {
  1096. return 0;
  1097. }
  1098. return x.Price * x.Count;
  1099. });
  1100. break;
  1101. }
  1102. }
  1103. c.PayPercentage = dto.PayPercentage;
  1104. c.ConsumptionDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1105. c.CTable = 79;
  1106. c.CId = dto.CTGGRId;
  1107. c.IsAuditGM = 0;
  1108. c.PayDId = dto.PayDId;
  1109. c.DIId = dto.DiId;
  1110. c.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
  1111. c.Payee = dto.Payee;
  1112. c.CreateUserId = dto.CreateUserId;
  1113. //--------------------添加C表字段---------------
  1114. c.ConsumptionPatterns = dto.ConsumptionPatterns;
  1115. c.CTDId = dto.Ctdid;
  1116. c.BankNo = dto.BankNo;
  1117. c.CardholderName = dto.CardholderName;
  1118. c.ConsumptionDate = dto.ConsumptionDate;
  1119. c.CompanyBankNo = dto.CompanyBankNo;
  1120. c.OtherBankName = dto.OtherBankName;
  1121. c.OtherSideNo = dto.OtherSideNo;
  1122. c.OtherSideName = dto.OtherSideName;
  1123. //2025-04-07 第四次更改 PayDId == 72(刷卡) IsPay == 1
  1124. if (c.PayDId == 72) c.IsPay = 1;
  1125. else c.IsPay = 0;
  1126. c.RMBPrice = c.PayMoney;
  1127. c.DayRate = 1;
  1128. #region 老汇率获取
  1129. //Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 79);
  1130. //List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
  1131. //if (_TeamRate != null)
  1132. //{
  1133. // Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
  1134. // if (_SetData != null)
  1135. // {
  1136. // currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
  1137. // CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
  1138. // if (CurrencyRate != null)
  1139. // {
  1140. // c.RMBPrice = c.PayMoney * Convert.ToDecimal(CurrencyRate.Rate);
  1141. // c.DayRate = CurrencyRate.Rate;
  1142. // }
  1143. // }
  1144. //}
  1145. #endregion
  1146. var rate = await _setDataRep.PostCurrencyByDiid(dto.DiId, 79, dto.Currency);
  1147. if (rate.Code == 0)
  1148. {
  1149. var rateData = rate.Data as CurrencyInfo;
  1150. if (rateData != null)
  1151. {
  1152. c.RMBPrice = c.PayMoney * rateData.Rate;
  1153. c.DayRate = rateData.Rate;
  1154. }
  1155. }
  1156. int noticeSign = 1; //企业微信通知标识
  1157. int noticeCcpId = 0;
  1158. Grp_CreditCardPayment grp_CreditCard = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.CTGGRId && a.IsDel == 0 && a.CTable == 79 && a.DIId == dto.DiId);
  1159. if (grp_CreditCard != null)//修改
  1160. {
  1161. int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == dto.CTGGRId && a.CTable == 79 && a.DIId == dto.DiId).SetColumns(a => new Grp_CreditCardPayment
  1162. {
  1163. PaymentCurrency = c.PaymentCurrency,
  1164. PayMoney = c.PayMoney,
  1165. PayPercentage = c.PayPercentage,
  1166. CTable = c.CTable,
  1167. PayDId = c.PayDId,
  1168. OrbitalPrivateTransfer = c.OrbitalPrivateTransfer,
  1169. Payee = c.Payee,
  1170. IsPay = c.IsPay,
  1171. RMBPrice = c.RMBPrice,
  1172. DayRate = c.DayRate,
  1173. //添加属性
  1174. ConsumptionPatterns = c.ConsumptionPatterns,
  1175. CTDId = c.CTDId,
  1176. BankNo = c.BankNo,
  1177. CardholderName = c.CardholderName,
  1178. ConsumptionDate = c.ConsumptionDate,
  1179. CompanyBankNo = c.CompanyBankNo,
  1180. OtherBankName = c.OtherBankName,
  1181. OtherSideNo = c.OtherSideNo,
  1182. OtherSideName = c.OtherSideName
  1183. }).ExecuteCommandAsync();
  1184. noticeSign = 2;
  1185. noticeCcpId = grp_CreditCard.Id;
  1186. if (CTable == 0)
  1187. {
  1188. RollbackTran();
  1189. return result = new Result() { Code = -2, Msg = "修改失败" };
  1190. }
  1191. }
  1192. else//添加
  1193. {
  1194. int id = await _sqlSugar.Insertable(c).ExecuteReturnIdentityAsync();
  1195. noticeCcpId = id;
  1196. if (id == 0)
  1197. {
  1198. RollbackTran();
  1199. return result = new Result() { Code = -2, Msg = "添加失败" };
  1200. }
  1201. }
  1202. #endregion
  1203. _ = await _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservations>()
  1204. .Where(a => a.Id == dto.CTGGRId && a.DiId == dto.DiId && a.IsDel == 0)
  1205. .SetColumns(a => new Grp_CarTouristGuideGroundReservations
  1206. {
  1207. CId = dto.Currency,
  1208. ServiceQuotedPrice = c.PayMoney,
  1209. OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
  1210. SelectCheck = string.Join(',', dto.SelectCheck),
  1211. Rate = dto.Rate,
  1212. toCurr = dto.toCurr
  1213. })
  1214. .ExecuteCommandAsync();
  1215. var data = new { ccpId = noticeCcpId, sign = noticeSign };
  1216. result = new Result() { Code = 0, Msg = "保存成功", Data = data };
  1217. CommitTran();
  1218. }
  1219. catch (Exception ex)
  1220. {
  1221. RollbackTran();
  1222. result = new Result() { Code = -2, Msg = $"接口异常!({ex.Message})" };
  1223. }
  1224. return result;
  1225. }
  1226. /// <summary>
  1227. /// 超支费用
  1228. /// 1增、2改、3删
  1229. /// </summary>
  1230. /// <param name="dto"></param>
  1231. /// <returns></returns>
  1232. private async Task<Result> PostGroupExtraCost_Operator(Fin_GroupExtraCostDto_OP dto)
  1233. {
  1234. Result rt = new Result();
  1235. #region 验证
  1236. #endregion
  1237. Fin_GroupExtraCost _entity = new Fin_GroupExtraCost();
  1238. _entity.DiId = dto.diId;
  1239. _entity.PriceName = dto.priceName;
  1240. _entity.Price = dto.price;
  1241. _entity.PriceCurrency = dto.currency;
  1242. _entity.PriceType = dto.priceType;
  1243. _entity.Coefficient = dto.coefficient;
  1244. _entity.PriceDetailType = dto.priceDetailType;
  1245. _entity.FilePath = dto.filePath;
  1246. _entity.Remark = dto.remark;
  1247. _entity.PriceCount = dto.PriceCount;
  1248. _entity.PriceDt = DateTime.Parse(dto.PriceDt);
  1249. _entity.PriceSum = dto.price * dto.PriceCount;
  1250. _entity.Area = dto.Area;
  1251. _entity.SupervisorConfirm = dto.SupervisorConfirm;
  1252. _entity.ManagerConfirm = dto.ManagerConfirm;
  1253. _entity.SYsupervisorConfirm = dto.SYsupervisorConfirm;
  1254. _daiRep.BeginTran();
  1255. if (dto.editType == 1)
  1256. {
  1257. _entity.CreateUserId = dto.createUser;
  1258. _entity.CreateTime = DateTime.Now;
  1259. _entity.IsDel = 0;
  1260. int returnId = await _daiRep.AddAsyncReturnId<Fin_GroupExtraCost>(_entity);
  1261. if (returnId > 0)
  1262. {
  1263. dto.Id = returnId;
  1264. }
  1265. }
  1266. else if (dto.editType == 2)
  1267. {
  1268. bool res = await _daiRep.UpdateAsync<Fin_GroupExtraCost>(s => s.Id == dto.Id, s => new Fin_GroupExtraCost
  1269. {
  1270. PriceName = dto.priceName,
  1271. Price = dto.price,
  1272. PriceCurrency = dto.currency,
  1273. PriceType = dto.priceType,
  1274. PriceDetailType = dto.priceDetailType,
  1275. Coefficient = dto.coefficient,
  1276. FilePath = dto.filePath,
  1277. Remark = dto.remark,
  1278. PriceCount = dto.PriceCount,
  1279. PriceDt = _entity.PriceDt,
  1280. PriceSum = _entity.PriceSum,
  1281. Area = _entity.Area,
  1282. });
  1283. if (!res)
  1284. {
  1285. _daiRep.RollbackTran();
  1286. //Ok(JsonView(false, "2操作失败!"))
  1287. rt.Msg = "2操作失败!";
  1288. return rt;
  1289. }
  1290. }
  1291. else if (dto.editType == 3)
  1292. {
  1293. string delTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
  1294. bool res = await _daiRep.UpdateAsync<Fin_GroupExtraCost>(s => s.Id == dto.Id, s => new Fin_GroupExtraCost
  1295. {
  1296. IsDel = 1,
  1297. DeleteTime = delTime,
  1298. DeleteUserId = dto.createUser
  1299. });
  1300. if (!res)
  1301. {
  1302. _daiRep.RollbackTran();
  1303. rt.Msg = "3操作失败!";
  1304. return rt;
  1305. }
  1306. }
  1307. else
  1308. {
  1309. _daiRep.RollbackTran();
  1310. rt.Msg = "未知的editType";
  1311. return rt;
  1312. }
  1313. if (!(await extraCost_editCreditCardPayment(dto)))
  1314. {
  1315. rt.Msg = "ccp操作失败";
  1316. return rt;
  1317. }
  1318. _daiRep.CommitTran();
  1319. rt.Code = 0;
  1320. rt.Msg = "操作成功";
  1321. rt.Data = dto.Id;
  1322. return rt;
  1323. }
  1324. private async Task<bool> extraCost_editCreditCardPayment(Fin_GroupExtraCostDto_OP costDto)
  1325. {
  1326. //设置团组汇率
  1327. decimal dcm_dayrate = 1M;
  1328. decimal dcm_rmbPrice = costDto.price;
  1329. int ispay = costDto.payType == 72 ? 1 : 0;
  1330. if (costDto.costSign != 3)
  1331. {
  1332. //获取新汇率 int diId,int CId, int currencyId
  1333. Result rate = await _setDataRep.PostCurrencyByDiid(costDto.diId, 1015, costDto.currency);
  1334. if (rate.Code == 0)
  1335. {
  1336. var rateInfo = (rate.Data as CurrencyInfo);
  1337. if (rateInfo is not null)
  1338. {
  1339. dcm_dayrate = rateInfo.Rate;
  1340. dcm_rmbPrice = rateInfo.Rate * dcm_rmbPrice;
  1341. }
  1342. else
  1343. {
  1344. dcm_dayrate = 1;
  1345. }
  1346. }
  1347. }
  1348. Grp_CreditCardPayment ccp = _daiRep.Query<Grp_CreditCardPayment>(s => s.CId == costDto.Id && s.CTable == 1015).First();
  1349. if (ccp == null)
  1350. {
  1351. ccp = new Grp_CreditCardPayment();
  1352. ccp.PayDId = costDto.payType;// dto
  1353. ccp.ConsumptionPatterns = "";
  1354. ccp.ConsumptionDate = "";
  1355. ccp.CTDId = costDto.payCardId;// dto
  1356. ccp.BankNo = "";
  1357. ccp.CardholderName = "";
  1358. ccp.PayMoney = costDto.price;// dto
  1359. ccp.PaymentCurrency = costDto.currency;// dto
  1360. ccp.CompanyBankNo = "";
  1361. ccp.OtherBankName = "";
  1362. ccp.OtherSideNo = "";
  1363. ccp.OtherSideName = "";
  1364. ccp.Remark = "";
  1365. ccp.CreateUserId = costDto.createUser;
  1366. ccp.CreateTime = DateTime.Now;
  1367. ccp.MFOperator = 0;
  1368. ccp.MFOperatorDate = "";
  1369. ccp.IsAuditDM = 0;
  1370. ccp.AuditDMOperate = 0;
  1371. ccp.AuditDMDate = "";
  1372. ccp.IsAuditMF = 0;
  1373. ccp.AuditMFOperate = 0;
  1374. ccp.AuditMFDate = "";
  1375. ccp.IsAuditGM = 0;
  1376. ccp.AuditGMOperate = 0;
  1377. ccp.AuditGMDate = "";
  1378. ccp.IsPay = ispay; // upd
  1379. ccp.DIId = costDto.diId;// dto
  1380. ccp.CId = costDto.Id;// dto
  1381. ccp.CTable = 1015; //超支费用指向id
  1382. ccp.IsDel = 0;
  1383. ccp.PayPercentage = 100M;
  1384. ccp.PayThenMoney = 0M;
  1385. ccp.PayPercentageOld = 100M;
  1386. ccp.PayThenMoneyOld = 0M;
  1387. ccp.UpdateDate = "";
  1388. ccp.Payee = costDto.payee;// dto
  1389. ccp.OrbitalPrivateTransfer = costDto.costSign;// dto
  1390. ccp.ExceedBudget = 0;
  1391. ccp.DayRate = dcm_dayrate; //upd
  1392. ccp.RMBPrice = dcm_rmbPrice; //upd
  1393. int ccpInsertId = _daiRep.AddReturnId<Grp_CreditCardPayment>(ccp);
  1394. if (ccpInsertId > 0)
  1395. {
  1396. return true;
  1397. }
  1398. }
  1399. else
  1400. {
  1401. if (costDto.editType == 2)
  1402. {
  1403. bool res = _daiRep.Update<Grp_CreditCardPayment>(s => s.Id == ccp.Id, s => new Grp_CreditCardPayment
  1404. {
  1405. PayDId = costDto.payType,
  1406. CTDId = costDto.payCardId,
  1407. PayMoney = costDto.price,
  1408. PaymentCurrency = costDto.currency,
  1409. IsPay = ispay,
  1410. Payee = costDto.payee,
  1411. OrbitalPrivateTransfer = costDto.costSign,
  1412. DayRate = dcm_dayrate,
  1413. RMBPrice = dcm_rmbPrice
  1414. });
  1415. return res;
  1416. }
  1417. else if (costDto.editType == 3)
  1418. {
  1419. string delTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
  1420. bool res2 = _daiRep.Update<Grp_CreditCardPayment>(s => s.Id == ccp.Id, s => new Grp_CreditCardPayment
  1421. {
  1422. IsDel = 1,
  1423. DeleteTime = delTime,
  1424. DeleteUserId = costDto.createUser
  1425. });
  1426. return res2;
  1427. }
  1428. }
  1429. return false;
  1430. }
  1431. public async Task<Result> GroupExtraCost_OperatorList(List<Fin_GroupExtraCostDto_OP> dto)
  1432. {
  1433. Result rt = new Result();
  1434. foreach (var item in dto)
  1435. {
  1436. await _daiRep.UpdateAsync<Fin_GroupExtraCost>(s => s.PriceName == item.priceName && s.DiId == item.diId,
  1437. s => new Fin_GroupExtraCost
  1438. {
  1439. IsDel = 1,
  1440. DeleteTime = DateTime.Now.ToString("yyyy-MM-dd"),
  1441. DeleteUserId = item.createUser
  1442. });
  1443. rt = await PostGroupExtraCost_Operator(item);
  1444. }
  1445. return rt;
  1446. }
  1447. }
  1448. }