|
|
@@ -1990,6 +1990,23 @@ public class AirTicketResRepository : BaseRepository<Grp_AirTicketReservations,
|
|
|
// -------------------- 分支 B:编辑覆盖 --------------------
|
|
|
else
|
|
|
{
|
|
|
+ //创建ResId对应的待删除附加服务费集合(指已进入数据库的附加服务费,并且存在某航段某旅客修改票号等导致匹配不上已存在的(未审核)附加服务费数据,导致C表数据存在冗余错误)
|
|
|
+ List<Grp_AirAdditionServices> sourceAddList = await _sqlSugar.Queryable<Grp_AirAdditionServices>()
|
|
|
+ .Where(x => x.ResId == dbAir.Id && x.IsDel == 0)
|
|
|
+ .ToListAsync(); //当前ResId的所有未删除附加服务费
|
|
|
+
|
|
|
+ List<Grp_AirAdditionServices> waitDelList = new List<Grp_AirAdditionServices>();
|
|
|
+ //待删除附加服务费集合,后续会从中移除已更新或新增的附加服务费,剩余的就是需要删除的附加服务费
|
|
|
+
|
|
|
+ foreach (var sourceAdd in sourceAddList) {
|
|
|
+
|
|
|
+ var checkcard = await _sqlSugar.Queryable<Grp_CreditCardPayment>()
|
|
|
+ .Where(x => x.CId == sourceAdd.Id && x.CTable == sourceAdd.SysTypeId && x.IsDel == 0 && x.IsAuditGM % 2 == 0)
|
|
|
+ .FirstAsync();
|
|
|
+ if (checkcard != null) {
|
|
|
+ waitDelList.Add(sourceAdd);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//添加附加服务费用表数据,以及C表对应费用审核数据
|
|
|
//需要预检查数据库中是否存在附加服务数据,如果存在则更新,不存在则新增
|
|
|
@@ -1998,6 +2015,7 @@ public class AirTicketResRepository : BaseRepository<Grp_AirTicketReservations,
|
|
|
foreach (var custItem in custList)
|
|
|
{
|
|
|
List<AdditionalService> addList = custItem.AdditionalServices;
|
|
|
+
|
|
|
//检查数据库中对应的附加服务数据集合
|
|
|
List<Grp_AirAdditionServices> dbAddList = await _sqlSugar.Queryable<Grp_AirAdditionServices>()
|
|
|
.Where(x => x.ResId == dbAir.Id && x.ClientId == custItem.ClientId && x.TicketCode == custItem.TicketCode && x.IsDel == 0)
|
|
|
@@ -2006,6 +2024,12 @@ public class AirTicketResRepository : BaseRepository<Grp_AirTicketReservations,
|
|
|
//添加、修改附加服务数据,并统计执行操作的附加服务数据集合与dbAddList比较,检查是否有多余的附加服务数据需要删除
|
|
|
foreach (var addItem in addList)
|
|
|
{
|
|
|
+ var checkDel = waitDelList.FirstOrDefault(x => x.SysTypeId == addItem.ServiceTypeId && x.ClientId == custItem.ClientId && x.TicketCode == custItem.TicketCode);
|
|
|
+ if (checkDel != null)
|
|
|
+ {
|
|
|
+ waitDelList.Remove(checkDel);//从待删除集合中移除,表示该附加服务数据仍存在于此次提交,不需要删除
|
|
|
+ }
|
|
|
+
|
|
|
// 先检查数据库中是否存在该附加服务数据
|
|
|
var existingAddService = await _sqlSugar.Queryable<Grp_AirAdditionServices>()
|
|
|
.Where(x => x.ResId == dbAir.Id && x.SysTypeId == addItem.ServiceTypeId && x.ClientId == custItem.ClientId && x.TicketCode == custItem.TicketCode && x.IsDel == 0)
|
|
|
@@ -2140,6 +2164,20 @@ public class AirTicketResRepository : BaseRepository<Grp_AirTicketReservations,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //待删除附加服务费
|
|
|
+ foreach (var waitDelItem in waitDelList)
|
|
|
+ {
|
|
|
+ await _sqlSugar.Updateable<Grp_AirAdditionServices>()
|
|
|
+ .SetColumns(x => new Grp_AirAdditionServices { IsDel = 1, DeleteUserId = currUserId, DeleteTime = DateTime.Now.ToString() })
|
|
|
+ .Where(x => x.Id == waitDelItem.Id)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ //删除对应的信用卡付款表数据
|
|
|
+ await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .SetColumns(x => new Grp_CreditCardPayment { IsDel = 1, DeleteUserId = currUserId, DeleteTime = DateTime.Now.ToString() })
|
|
|
+ .Where(x => x.CId == waitDelItem.Id && x.CTable == waitDelItem.SysTypeId)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
var dbCard = dbCardList.FirstOrDefault(x => x.CId == dbAir.Id);
|
|
|
|