Quellcode durchsuchen

团组流程个费用录入增加 STID = 72 ispay==1(机票、签证、保险、OP、增减款项、商邀、超支)

LEIYI vor 6 Monaten
Ursprung
Commit
e1532ce524

+ 0 - 1
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -3386,7 +3386,6 @@ namespace OASystem.API.Controllers
             {
                 return new Result() { Code = -1, Msg = "查询异常!", Data = CurrencyRate };
             }
-
         }
 
         private bool extraCost_editCreditCardPayment(Fin_GroupExtraCostDto_OP costDto)

+ 98 - 170
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -2470,20 +2470,12 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> AirTicketResById(AirTicketResByIdDto dto)
         {
-            try
-            {
-                Result groupData = await _airTicketResRep.AirTicketResById(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
-            }
-            catch (Exception ex)
+            Result groupData = await _airTicketResRep.AirTicketResById(dto);
+            if (groupData.Code != 0)
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
+                return Ok(JsonView(false, groupData.Msg));
             }
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
         /// <summary>
         /// 机票费用录入操作(Status:1.新增,2.修改)
@@ -3638,20 +3630,12 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> InvitationOfficialActivitiesList(InvitationOfficialActivitiesListDto dto)
         {
-            try
-            {
-                Result groupData = await _InvitationOfficialActivitiesRep.InvitationOfficialActivitiesList(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
-            }
-            catch (Exception ex)
+            Result groupData = await _InvitationOfficialActivitiesRep.InvitationOfficialActivitiesList(dto);
+            if (groupData.Code != 0)
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
+                return Ok(JsonView(false, groupData.Msg));
             }
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
 
         //
@@ -3714,34 +3698,26 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> OpInvitationOfficialActivities(OpInvitationOfficialActivitiesDto dto)
         {
-            try
+            Result groupData = await _InvitationOfficialActivitiesRep.OpInvitationOfficialActivities(dto, _setDataRep.PostCurrencyByDiid);
+            if (groupData.Code != 0)
             {
-                Result groupData = await _InvitationOfficialActivitiesRep.OpInvitationOfficialActivities(dto, _setDataRep.PostCurrencyByDiid);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-
-                #region 应用推送
-                try
-                {
-                    int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
-                    int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
+                return Ok(JsonView(false, groupData.Msg));
+            }
 
-                    await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
-                }
-                catch (Exception ex)
-                {
-                }
-                #endregion
+            #region 应用推送
+            try
+            {
+                int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
+                int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
 
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
+                await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
             }
             catch (Exception ex)
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
             }
+            #endregion
+
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
         /// <summary>
         /// 商邀删除
@@ -6138,12 +6114,7 @@ namespace OASystem.API.Controllers
             {
                 return Ok(JsonView(false, data.Msg));
             }
-
-            
-
-
             return Ok(JsonView(true, data.Msg, data.Data));
-
         }
 
         /// <summary>
@@ -6495,7 +6466,8 @@ namespace OASystem.API.Controllers
                                       IsDel = 1,
                                       DeleteUserId = dto.DeleteUserId,
                                       DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
-                                  }).ExecuteCommand();
+                                  })
+                                  .ExecuteCommand();
             if (resSub < 1)
             {
                 _sqlSugar.RollbackTran();
@@ -6513,38 +6485,30 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> VisaPriceAddSelect()
         {
-            try
-            {
-                //支付方式
-                List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
-                List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
+            //支付方式
+            List<Sys_SetData> Payment = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 14 && a.IsDel == 0).ToList();
+            List<SetDataInfoView> _Payment = _mapper.Map<List<SetDataInfoView>>(Payment);
 
-                //币种
-                List<Sys_SetData> CurrencyList = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 66 && a.IsDel == 0).ToList();
-                List<SetDataInfoView> _CurrencyList = _mapper.Map<List<SetDataInfoView>>(CurrencyList);
+            //币种
+            List<Sys_SetData> CurrencyList = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 66 && a.IsDel == 0).ToList();
+            List<SetDataInfoView> _CurrencyList = _mapper.Map<List<SetDataInfoView>>(CurrencyList);
 
-                //乘客类型
-                List<Sys_SetData> PassengerType = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 69 && a.IsDel == 0).ToList();
-                List<SetDataInfoView> _PassengerType = _mapper.Map<List<SetDataInfoView>>(PassengerType);
+            //乘客类型
+            List<Sys_SetData> PassengerType = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 69 && a.IsDel == 0).ToList();
+            List<SetDataInfoView> _PassengerType = _mapper.Map<List<SetDataInfoView>>(PassengerType);
 
-                //卡类型
-                List<Sys_SetData> BankCard = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 15 && a.IsDel == 0).ToList();
-                List<SetDataInfoView> _BankCard = _mapper.Map<List<SetDataInfoView>>(BankCard);
+            //卡类型
+            List<Sys_SetData> BankCard = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 15 && a.IsDel == 0).ToList();
+            List<SetDataInfoView> _BankCard = _mapper.Map<List<SetDataInfoView>>(BankCard);
 
-                var data = new
-                {
-                    Payment = _Payment,
-                    CurrencyList = _CurrencyList,
-                    PassengerType = _PassengerType,
-                    BankCard = _BankCard
-                };
-                return Ok(JsonView(true, "查询成功!", data));
-            }
-            catch (Exception ex)
+            var data = new
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
-            }
+                Payment = _Payment,
+                CurrencyList = _CurrencyList,
+                PassengerType = _PassengerType,
+                BankCard = _BankCard
+            };
+            return Ok(JsonView(true, "查询成功!", data));
         }
 
         /// <summary>
@@ -6556,33 +6520,26 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> OpVisaPrice(OpVisaPriceDto dto)
         {
-            try
+            Result groupData = await _visaPriceRep.OpVisaPrice(dto);
+            if (groupData.Code != 0)
             {
-                Result groupData = await _visaPriceRep.OpVisaPrice(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-
-                #region 应用推送
-                try
-                {
-                    int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
-                    int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
+                return Ok(JsonView(false, groupData.Msg));
+            }
 
-                    await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
-                }
-                catch (Exception ex)
-                {
-                }
-                #endregion
+            #region 应用推送
+            try
+            {
+                int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
+                int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
 
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
+                await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
             }
             catch (Exception ex)
             {
-                return Ok(JsonView(false, ex.Message));
             }
+            #endregion
+
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
         #endregion
 
@@ -6737,19 +6694,13 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryCarTouristGuideGroundByDiId(CarTouristGuideGroundDto dto)
         {
-            try
-            {
-                Result groupData = await _carTouristGuideGroundRep.QueryCarTouristGuideGroundByDiId(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
-            }
-            catch (Exception ex)
+            Result groupData = await _carTouristGuideGroundRep.QueryCarTouristGuideGroundByDiId(dto);
+            if (groupData.Code != 0)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, groupData.Msg));
             }
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
+           
         }
         /// <summary>
         /// 根据op费用Id查询单条数据及c表数据
@@ -6855,20 +6806,13 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> OpCarTouristGuideGround(OpCarTouristGuideGroundDto dto)
         {
-            try
-            {
-                Result groupData = await _carTouristGuideGroundRep.OpCarTouristGuideGround(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
-            }
-            catch (Exception ex)
+            Result groupData = await _carTouristGuideGroundRep.OpCarTouristGuideGround(dto);
+            if (groupData.Code != 0)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, groupData.Msg));
             }
+
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
         /// <summary>
         /// 填写费用详细页面初始化绑定
@@ -6893,6 +6837,7 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, ex.Message));
             }
         }
+        
         /// <summary>
         /// 根据op费用Id查询详细数据
         /// </summary>
@@ -6916,6 +6861,7 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, ex.Message));
             }
         }
+       
         /// <summary>
         /// OP费用录入填写详情
         /// </summary>
@@ -10362,41 +10308,32 @@ ORDER by  gctggrc.id DESC
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostHotelReservationsCreateCheckVolumeNo(HotelReservationBasicsDataInitDto _dto)
         {
-            try
-            {
-                #region  参数验证
-                if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
-                if (_dto.PageId < 1) _dto.PageId = 28; //酒店预定Id
-                if (_dto.DiId < 1) return Ok(JsonView(false, "团组Id为空"));
-
-                PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
-
-                #region 页面操作权限验证
-                pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
+            #region  参数验证
+            if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
+            if (_dto.PageId < 1) _dto.PageId = 28; //酒店预定Id
+            if (_dto.DiId < 1) return Ok(JsonView(false, "团组Id为空"));
 
-                if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限!"));
-                #endregion
+            PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
 
-                #region 团组操作权限验证 76 酒店预定模块
-                var groupAuthView = await GeneralMethod.PostGroupOperationAuth(_dto.DiId, _dto.UserId, 76);
-                if (groupAuthView.Code != 0) return Ok(JsonView(false, groupAuthView.Msg));
-                #endregion
+            #region 页面操作权限验证
+            pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
 
-                #endregion
+            if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限!"));
+            #endregion
 
-                Result data = await _hotelPriceRep._CreateCheckVolumeNo(_dto.DiId);
-                if (data.Code != 0)
-                {
-                    return Ok(JsonView(false, data.Msg));
-                }
-                return Ok(JsonView(true, data.Msg, data.Data));
+            #region 团组操作权限验证 76 酒店预定模块
+            var groupAuthView = await GeneralMethod.PostGroupOperationAuth(_dto.DiId, _dto.UserId, 76);
+            if (groupAuthView.Code != 0) return Ok(JsonView(false, groupAuthView.Msg));
+            #endregion
 
+            #endregion
 
-            }
-            catch (Exception ex)
+            Result data = await _hotelPriceRep._CreateCheckVolumeNo(_dto.DiId);
+            if (data.Code != 0)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, data.Msg));
             }
+            return Ok(JsonView(true, data.Msg, data.Data));
         }
 
         /// <summary>
@@ -10540,7 +10477,6 @@ ORDER by  gctggrc.id DESC
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostHotelReservationsDel(HotelReservationsDelDto _dto)
         {
-
             #region  参数验证
             if (_dto.UserId < 1) return Ok(JsonView(false, "员工Id为空"));
             if (_dto.PageId < 1) _dto.PageId = 28; //酒店预定Id
@@ -10564,7 +10500,6 @@ ORDER by  gctggrc.id DESC
             #endregion
 
             return Ok(await _hotelPriceRep._Del(_dto.Id, _dto.UserId));
-
         }
 
         /// <summary>
@@ -12265,33 +12200,26 @@ ORDER by  gctggrc.id DESC
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> OpCustomers(OpCustomersDto dto)
         {
-            try
+            Result groupData = await _customersRep.OpCustomers(dto);
+            if (groupData.Code != 0)
             {
-                Result groupData = await _customersRep.OpCustomers(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-
-                #region 应用推送
-                try
-                {
-                    int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
-                    int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
+                return Ok(JsonView(false, groupData.Msg));
+            }
 
-                    await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
-                }
-                catch (Exception ex)
-                {
-                }
-                #endregion
+            #region 应用推送
+            try
+            {
+                int ccpId = groupData.Data.GetType().GetProperty("ccpId").GetValue(groupData.Data, null);
+                int sign = groupData.Data.GetType().GetProperty("sign").GetValue(groupData.Data, null);
 
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
+                await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
             }
             catch (Exception ex)
             {
-                return Ok(JsonView(false, ex.Message));
             }
+            #endregion
+
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
         /// <summary>
         ///  保险文件上传

+ 6 - 11
OASystem/OASystem.Infrastructure/Repositories/Groups/AirTicketResRepository.cs

@@ -423,7 +423,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
             {
                 BeginTran();
                 int id = 0;
-                Grp_AirTicketReservations grp_AirTicket = _mapper.Map<Grp_AirTicketReservations>(dto.AirTicketResOpData);
+                var grp_AirTicket = _mapper.Map<Grp_AirTicketReservations>(dto.AirTicketResOpData);
+
                 if (dto.Status == 1)
                 {
                     //string selectSql = string.Format(@"select * from Grp_AirTicketReservations where CONVERT(nvarchar,ClientName)= '{0}' and IsDel={1} and FlightsCode='{2}'"
@@ -459,13 +460,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         Grp_CreditCardPayment grp_CreditCard = _mapper.Map<Grp_CreditCardPayment>(dto.CardPaymentOpData);
 
                         //PayDId == 刷卡 IsPay == 1
-                        //if (dto.CardPaymentOpData.PayDId == 72)
-                        //{
-                        //    grp_CreditCard.IsPay = 1;
-                        //}
-                        //else grp_CreditCard.IsPay = 0;
-
-                        grp_CreditCard.IsPay = 0;
+                        if (dto.CardPaymentOpData.PayDId == 72) grp_CreditCard.IsPay = 1;
+                        else grp_CreditCard.IsPay = 0;
 
                         //获取新汇率  int diId,int CId, int currencyId
                         var rate = await fn(dto.AirTicketResOpData.DiId,85,dto.AirTicketResOpData.Currency);
@@ -678,9 +674,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         Grp_CreditCardPayment grp_CreditCard = _mapper.Map<Grp_CreditCardPayment>(dto.CardPaymentOpData);
 
                         //PayDId == 刷卡 IsPay == 1
-                        //if (grp_CreditCard.PayDId == 72) grp_CreditCard.IsPay = 1;
-                        //else grp_CreditCard.IsPay = 0;
-                        grp_CreditCard.IsPay = 0;
+                        if (grp_CreditCard.PayDId == 72) grp_CreditCard.IsPay = 1;
+                        else grp_CreditCard.IsPay = 0;
 
                         //获取新汇率  int diId,int CId, int currencyId
                         var rate = await fn(dto.AirTicketResOpData.DiId, 85, dto.AirTicketResOpData.Currency);

+ 41 - 30
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -47,10 +47,19 @@ namespace OASystem.Infrastructure.Repositories.Groups
             try
             {
                 int id = 0;
-                Grp_CarTouristGuideGroundReservations grp_CarTouristGuide = _mapper.Map<Grp_CarTouristGuideGroundReservations>(dto);
+                var grp_CarTouristGuide = _mapper.Map<Grp_CarTouristGuideGroundReservations>(dto);
                 if (dto.Status == 1)//添加
                 {
-                    Grp_CarTouristGuideGroundReservations grp_CarTouristGuideGround = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().First(a => a.IsDel == 0 && a.Area == dto.Area && a.BusName == dto.BusName && a.ServiceGuide == dto.ServiceGuide && a.DiId == dto.DiId && a.BusTel == dto.BusTel && a.ServiceTel == dto.ServiceTel && a.PriceName == dto.PriceName);
+                    var grp_CarTouristGuideGround = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>()
+                                                             .First(a => a.IsDel == 0 && 
+                                                                         a.Area == dto.Area && 
+                                                                         a.BusName == dto.BusName && 
+                                                                         a.ServiceGuide == dto.ServiceGuide && 
+                                                                         a.DiId == dto.DiId && 
+                                                                         a.BusTel == dto.BusTel && 
+                                                                         a.ServiceTel == dto.ServiceTel && 
+                                                                         a.PriceName == dto.PriceName
+                                                             );
                     if (grp_CarTouristGuideGround != null)
                     {
                         return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
@@ -65,8 +74,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
                         else
                         {
-
-
                             result = new Result() { Code = 0, Msg = "添加成功!" };
                         }
 
@@ -75,7 +82,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 }
                 else if (dto.Status == 2)//修改
                 {
-
                     bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_CarTouristGuideGroundReservations
                     {
                         Area = grp_CarTouristGuide.Area,
@@ -604,12 +610,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 Regex regex = new Regex("^[\u4e00-\u9fa5]*$");
 
                 //城市列表
-                var data = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(x => x.IsDel == 0).Select(x => new
-                {
-                    x.Id,
-                    x.Country,
-                    x.City,
-                }).ToList();
+                var data = _sqlSugar.Queryable<Grp_NationalTravelFee>()
+                                    .Where(x => x.IsDel == 0)
+                                    .Select(x => new
+                                    {
+                                        x.Id,
+                                        x.Country,
+                                        x.City,
+                                    })
+                                    .ToList();
 
                 if (dto.PortType == 1)
                 {
@@ -620,8 +629,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                                 order by c.IsAuditGM,c.PayPercentage desc", sqlWhere);
                     List<Grp_CarTouristGuideGroundView> infoViews = _sqlSugar.SqlQueryable<Grp_CarTouristGuideGroundView>(sql).ToList();
 
-
-
                     foreach (var item in infoViews)
                     {
                         if (!regex.IsMatch(item.Area))
@@ -722,7 +729,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         if (totalPage == 0) totalPage = 1;
                         else totalPage = (int)Math.Ceiling((double)totalPage);
 
-
                         ListViewBase<Grp_CarTouristGuideGroundView> rst = new ListViewBase<Grp_CarTouristGuideGroundView>();
                         rst.DataList = grp_CarTourists;
                         rst.DataCount = count;
@@ -1012,10 +1018,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     #endregion
 
                     var existingRecords = await _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>()
-                                          .Where(a => carTouristList.Select(item => item.Id).Contains(a.Id) &&
-                                                      a.CTGGRId == dto.CTGGRId &&
-                                                      a.IsDel == 0)
-                                          .ToListAsync();
+                                                         .Where(a => carTouristList.Select(item => item.Id).Contains(a.Id) &&
+                                                                     a.CTGGRId == dto.CTGGRId &&
+                                                                     a.IsDel == 0
+                                                                     )
+                                                         .ToListAsync();
 
                     var existingRecordsDict = existingRecords.ToDictionary(a => (a.Id));
 
@@ -1096,9 +1103,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 c.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
                 c.Payee = dto.Payee;
                 c.CreateUserId = dto.CreateUserId;
-                //if (c.PayDId == 72) c.IsPay = 1;
-                //else c.IsPay = 0;
-                c.IsPay = 0;
+
+                if (c.PayDId == 72) c.IsPay = 1;
+                else c.IsPay = 0;
+
                 c.RMBPrice = c.PayMoney;
                 c.DayRate = 1;
 
@@ -1172,15 +1180,18 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                 #endregion
 
-                _ = await _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservations>().Where(a => a.Id == dto.CTGGRId && a.DiId == dto.DiId && a.IsDel == 0).SetColumns(a => new Grp_CarTouristGuideGroundReservations
-                {
-                    CId = dto.Currency,
-                    ServiceQuotedPrice = c.PayMoney,
-                    OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
-                    SelectCheck = string.Join(',', dto.SelectCheck),
-                    Rate = dto.Rate,
-                    toCurr = dto.toCurr
-                }).ExecuteCommandAsync();
+                _ = await _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservations>()
+                                   .Where(a => a.Id == dto.CTGGRId && a.DiId == dto.DiId && a.IsDel == 0)
+                                   .SetColumns(a => new Grp_CarTouristGuideGroundReservations
+                                   {
+                                       CId = dto.Currency,
+                                       ServiceQuotedPrice = c.PayMoney,
+                                       OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
+                                       SelectCheck = string.Join(',', dto.SelectCheck),
+                                       Rate = dto.Rate,
+                                       toCurr = dto.toCurr
+                                   })
+                                   .ExecuteCommandAsync();
 
                 var data = new { ccpId = noticeCcpId, sign = noticeSign };
                 result = new Result() { Code = 0, Msg = "保存成功", Data = data };

+ 108 - 110
OASystem/OASystem.Infrastructure/Repositories/Groups/CustomersRepository.cs

@@ -361,140 +361,138 @@ namespace OASystem.Infrastructure.Repositories.Groups
         public async Task<Result> OpCustomers(OpCustomersDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
+
+            BeginTran();
+            int id = dto.Id;
+            Grp_Customers cus = _mapper.Map<Grp_Customers>(dto);
+
+            Grp_CreditCardPayment c = _mapper.Map<Grp_CreditCardPayment>(dto);
+            c.Remark = dto.CRemark;
+            c.PayPercentage = 100;
+            c.CTable = 82;
+            c.CId = id;
+            c.IsAuditGM = 0;
+            c.PayMoney = cus.InsuranceCosts;
+            c.PaymentCurrency = cus.Currency;
+
+            if (c.PayDId == 72) c.IsPay = 1;
+            else c.IsPay = 0;
+
+            c.RMBPrice = cus.InsuranceCosts;
+            c.DayRate = 1;
+            Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 82);
+            List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
+            if (_TeamRate != null)
             {
-                BeginTran();
-                int id = dto.Id;
-                Grp_Customers cus = _mapper.Map<Grp_Customers>(dto);
-
-                Grp_CreditCardPayment c = _mapper.Map<Grp_CreditCardPayment>(dto);
-                c.Remark = dto.CRemark;
-                c.PayPercentage = 100;
-                c.CTable = 82;
-                c.CId = id;
-                c.IsAuditGM = 0;
-                c.PayMoney = cus.InsuranceCosts;
-                c.PaymentCurrency = cus.Currency;
-                //if (c.PayDId == 72) c.IsPay = 1;
-                //else c.IsPay = 0;
-                c.IsPay = 0;
-                c.RMBPrice = cus.InsuranceCosts;
-                c.DayRate = 1;
-                Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 82);
-                List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
-                if (_TeamRate != null)
+                Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == cus.Currency);
+                if (_SetData != null)
                 {
-                    Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == cus.Currency);
-                    if (_SetData != null)
+                    currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
+                    CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
+                    if (CurrencyRate != null)
                     {
-                        currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
-                        CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
-                        if (CurrencyRate != null)
-                        {
-                            c.RMBPrice = c.PayMoney * Convert.ToDecimal(CurrencyRate.Rate);
-                            c.DayRate = CurrencyRate.Rate;
-                        }
+                        c.RMBPrice = c.PayMoney * Convert.ToDecimal(CurrencyRate.Rate);
+                        c.DayRate = CurrencyRate.Rate;
                     }
                 }
+            }
 
-                if (dto.Status == 1)//添加
+            if (dto.Status == 1)//添加
+            {
+                Grp_Customers customers = _sqlSugar.Queryable<Grp_Customers>()
+                                                   .First(a => a.DiId == dto.DiId &&
+                                                               a.IsDel == 0 &&
+                                                               a.ClientName == dto.ClientName &&
+                                                               a.InsuranceCosts == dto.InsuranceCosts &&
+                                                               a.Currency == dto.Currency
+                                                    );
+                if (customers != null)
                 {
-                    Grp_Customers customers = _sqlSugar.Queryable<Grp_Customers>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.ClientName == dto.ClientName && a.InsuranceCosts == dto.InsuranceCosts && a.Currency == dto.Currency);
-                    if (customers != null)
-                    {
-                        return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
-                    }
-                    else
-                    {
-                        id = await AddAsyncReturnId(cus);
-                        if (id != 0)
-                        {
-                            c.CId = id;
-                            int cId = await _sqlSugar.Insertable(c).ExecuteReturnIdentityAsync();
-                            if (cId != 0)
-                            {
-                                var data = new { ccpId = cId, sign = 1 };
-                                result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
-
-                            }
-                            else
-                            {
-                                RollbackTran();
-                                result = new Result() { Code = -1, Msg = "添加失败!" };
-                            }
-                        }
-                        else
-                        {
-                            RollbackTran();
-                            result = new Result() { Code = -1, Msg = "添加失败,请稍后重试!" };
-                        }
-                    }
-
+                    return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
                 }
-                else if (dto.Status == 2)//修改
+                else
                 {
-
-
-                    bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_Customers
-                    {
-                        Iid = cus.Iid,
-                        ClientName = cus.ClientName,
-                        InsuranceCosts = cus.InsuranceCosts,
-                        Currency = cus.Currency,
-                        Attachment = cus.Attachment,
-                        Remark = cus.Remark
-                    });
-                    if (res)
+                    id = await AddAsyncReturnId(cus);
+                    if (id != 0)
                     {
-                        int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == cus.Id && a.CTable == 82).SetColumns(a => new Grp_CreditCardPayment
+                        c.CId = id;
+                        int cId = await _sqlSugar.Insertable(c).ExecuteReturnIdentityAsync();
+                        if (cId != 0)
                         {
-                            PayDId = dto.PayDId,
-                            PayMoney = c.PayMoney,
-                            PaymentCurrency = c.PaymentCurrency,
-                            Payee = c.Payee,
-                            OrbitalPrivateTransfer = c.OrbitalPrivateTransfer,
-                            DayRate = c.DayRate,
-                            RMBPrice = c.RMBPrice,
-                            ConsumptionPatterns = c.ConsumptionPatterns,
-                            ConsumptionDate = c.ConsumptionDate,
-                            CTDId = c.CTDId,
-                            CompanyBankNo = c.CompanyBankNo,
-                            OtherBankName = c.OtherBankName,
-                            OtherSideNo = c.OtherSideNo,
-                            OtherSideName = c.OtherSideName,
-                            BankNo = c.BankNo,
-                            CardholderName = c.CardholderName,
-                            Remark = c.Remark,
-
-                        }).ExecuteCommandAsync();
-                        if (CTable == 0)
-                        {
-                            result = new Result() { Code = -1, Msg = "修改失败!" };
-                            RollbackTran();
+                            var data = new { ccpId = cId, sign = 1 };
+                            result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
                         }
                         else
                         {
-                            Grp_CreditCardPayment ccp = Query<Grp_CreditCardPayment>(a => a.CId == cus.Id && a.CTable == 82).First();
-
-                            var data = new { ccpId = ccp.Id, sign = 2 };
-
-                            result = new Result() { Code = 0, Msg = "修改成功!", Data = data };
+                            RollbackTran();
+                            result = new Result() { Code = -1, Msg = "添加失败!" };
                         }
-
                     }
                     else
                     {
                         RollbackTran();
-                        result = new Result() { Code = -1, Msg = "修改失败,请稍后重试!" };
+                        result = new Result() { Code = -1, Msg = "添加失败,请稍后重试!" };
                     }
                 }
-                CommitTran();
+
             }
-            catch (Exception ex)
+            else if (dto.Status == 2)//修改
             {
-                return result = new Result() { Code = -2, Msg = "未知错误" };
-                throw;
+                bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_Customers
+                {
+                    Iid = cus.Iid,
+                    ClientName = cus.ClientName,
+                    InsuranceCosts = cus.InsuranceCosts,
+                    Currency = cus.Currency,
+                    Attachment = cus.Attachment,
+                    Remark = cus.Remark
+                });
+                if (res)
+                {
+                    int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
+                                                .Where(a => a.CId == cus.Id && a.CTable == 82)
+                                                .SetColumns(a => new Grp_CreditCardPayment
+                                                {
+                                                    PayDId = dto.PayDId,
+                                                    PayMoney = c.PayMoney,
+                                                    PaymentCurrency = c.PaymentCurrency,
+                                                    Payee = c.Payee,
+                                                    OrbitalPrivateTransfer = c.OrbitalPrivateTransfer,
+                                                    DayRate = c.DayRate,
+                                                    RMBPrice = c.RMBPrice,
+                                                    ConsumptionPatterns = c.ConsumptionPatterns,
+                                                    ConsumptionDate = c.ConsumptionDate,
+                                                    CTDId = c.CTDId,
+                                                    CompanyBankNo = c.CompanyBankNo,
+                                                    OtherBankName = c.OtherBankName,
+                                                    OtherSideNo = c.OtherSideNo,
+                                                    OtherSideName = c.OtherSideName,
+                                                    BankNo = c.BankNo,
+                                                    CardholderName = c.CardholderName,
+                                                    Remark = c.Remark,
+
+                                                })
+                                                .ExecuteCommandAsync();
+                    if (CTable == 0)
+                    {
+                        result = new Result() { Code = -1, Msg = "修改失败!" };
+                        RollbackTran();
+                    }
+                    else
+                    {
+                        Grp_CreditCardPayment ccp = Query<Grp_CreditCardPayment>(a => a.CId == cus.Id && a.CTable == 82).First();
+                        var data = new { ccpId = ccp.Id, sign = 2 };
+                        result = new Result() { Code = 0, Msg = "修改成功!", Data = data };
+                    }
+                }
+                else
+                {
+                    RollbackTran();
+                    result = new Result() { Code = -1, Msg = "修改失败,请稍后重试!" };
+                }
             }
+            CommitTran();
+
             return result;
         }
     }

+ 7 - 9
OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

@@ -211,11 +211,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     C.AuditGMOperate = 21;
                     C.AuditGMDate = "";
 
-                    //注释 刷卡=已支付状态
-                    //if (C.PayDId == 72) C.IsPay = 1;
-                    //else C.IsPay = 0;
-                    C.IsPay = 0;
-
+                    //注释 刷卡 = 已支付状态
+                    if (C.PayDId == 72) C.IsPay = 1;
+                    else C.IsPay = 0;
+                   
                     C.DIId = grp_Decrease.DiId;
                     C.CId = id;
                     C.CTable = 98;
@@ -254,7 +253,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     if (cId != 0)
                     {
                         CommitTran();
-
                         var data = new { ccpId = cId, sign = 1 };
                         return new JsonView() { Code = 200, Msg = "添加成功!", Data = data };
                     }
@@ -315,8 +313,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
 
                         int ispay = 0;
-                        //if (dto.PayDId == 72) ispay = 1;
-
+                        if (dto.PayDId == 72) ispay = 1;
 
                         int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
                                                     .Where(a => a.Id == grp_CreditCardPayment.Id)
@@ -334,7 +331,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                                         DayRate = grp_CreditCardPayment.DayRate,
                                                         RMBPrice = grp_CreditCardPayment.RMBPrice,
 
-                                                    }).ExecuteCommandAsync();
+                                                    })
+                                                    .ExecuteCommandAsync();
                         if (CTable > 0)
                         {
                             CommitTran();

+ 16 - 13
OASystem/OASystem.Infrastructure/Repositories/Groups/HotelPriceRepository.cs

@@ -317,7 +317,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
                     }
 
-
                     //var currCode = currData.Find(x => x.Id == it.Currency)?.Name;
                     //decimal? currRate = teamRateDescViews.Find(x => x.CurrencyCode == currCode)?.Rate;
                     //it.Rate = currRate ?? 0.00M;
@@ -477,16 +476,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     if (updateHotelSubData.Count > 0)
                     {
                         int hotelSubUpdate = await _sqlSugar.Updateable<Grp_HotelReservationsContent>(updateHotelSubData)
-                                                         .IgnoreColumns(it => new {
-                                                             it.DiId,
-                                                             it.HrId,
-                                                             it.CreateUserId,
-                                                             it.CreateTime,
-                                                             it.DeleteUserId,
-                                                             it.DeleteTime
-                                                         })
-                                                         .WhereColumns(it => it.Id)
-                                                         .ExecuteCommandAsync();
+                                                            .IgnoreColumns(it => new {
+                                                                it.DiId,
+                                                                it.HrId,
+                                                                it.CreateUserId,
+                                                                it.CreateTime,
+                                                                it.DeleteUserId,
+                                                                it.DeleteTime
+                                                            })
+                                                            .WhereColumns(it => it.Id)
+                                                            .ExecuteCommandAsync();
                         if (hotelSubUpdate > 0) hotelSubStatus = true;
                     }
                     
@@ -498,7 +497,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     }
 
                     var hotelInfo = await _sqlSugar.Queryable<Grp_CreditCardPayment>()
-                                                   .Where(it => it.DIId == _dto.DiId && it.CId == _dto.Id && it.CTable == 76 && it.IsDel == 0)
+                                                   .Where(it => it.DIId == _dto.DiId && 
+                                                                it.CId == _dto.Id && 
+                                                                it.CTable == 76 && 
+                                                                it.IsDel == 0
+                                                    )
                                                    .FirstAsync();
                     if (hotelInfo == null) //ccp表 Add
                     {
@@ -508,7 +511,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     {
                         _CreditCardPayment.Id = hotelInfo.Id;
 
-                        int creditCardStatus = await _sqlSugar.Updateable<Grp_CreditCardPayment>(_CreditCardPayment)
+                        int creditCardStatus = await _sqlSugar.Updateable(_CreditCardPayment)
                                                     .UpdateColumns(it => new
                                                     {
                                                         it.CTDId,

+ 213 - 220
OASystem/OASystem.Infrastructure/Repositories/Groups/InvitationOfficialActivitiesRepository.cs

@@ -282,258 +282,250 @@ Order By i.id  Desc ", sqlWhere);
         {
             Result result = new Result() { Code = -2, Msg = "程序错误!" };
             BeginTran();
-            try
+
+            int id = 0;
+            Grp_InvitationOfficialActivities grp_Invitation = _mapper.Map<Grp_InvitationOfficialActivities>(dto);
+            if (dto.Status == 1)//添加
             {
-                int id = 0;
-                Grp_InvitationOfficialActivities grp_Invitation = _mapper.Map<Grp_InvitationOfficialActivities>(dto);
-                if (dto.Status == 1)//添加
-                {
-                    //string selectSql = string.Format(@"select * from Grp_InvitationOfficialActivities where InviterArea='{0}' and Inviter='{1}' and DiId={2} and IsDel={3}"
-                    //                                , dto.InviterArea, dto.Inviter, dto.DiId, 0);
-                    //var _InvitationOfficialActivities = await _sqlSugar.SqlQueryable<Grp_InvitationOfficialActivities>(selectSql).FirstAsync();//查询是否存在
-                    //if (_InvitationOfficialActivities != null)
-                    //{
-                    //    return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
-                    //}
+                //string selectSql = string.Format(@"select * from Grp_InvitationOfficialActivities where InviterArea='{0}' and Inviter='{1}' and DiId={2} and IsDel={3}"
+                //                                , dto.InviterArea, dto.Inviter, dto.DiId, 0);
+                //var _InvitationOfficialActivities = await _sqlSugar.SqlQueryable<Grp_InvitationOfficialActivities>(selectSql).FirstAsync();//查询是否存在
+                //if (_InvitationOfficialActivities != null)
+                //{
+                //    return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
+                //}
 
-                    id = await AddAsyncReturnId(grp_Invitation);
-                    if (id != 0)//修改或添加商邀资料
+                id = await AddAsyncReturnId(grp_Invitation);
+                if (id != 0)//修改或添加商邀资料
+                {
+                    Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
+                    res_InvitationData.Country = dto.InviterArea;
+                    res_InvitationData.UnitName = dto.Inviter;
+                    res_InvitationData.Delegation = dto.DiId.ToString();
+                    Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
+                        (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName && a.IsDel == 0);
+                    if (ifNullUp == null)///添加或修改商邀资料
                     {
-                        Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
-                        res_InvitationData.Country = dto.InviterArea;
-                        res_InvitationData.UnitName = dto.Inviter;
-                        res_InvitationData.Delegation = dto.DiId.ToString();
-                        Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
-                            (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName && a.IsDel == 0);
-                        if (ifNullUp == null)///添加或修改商邀资料
+                        res_InvitationData.Remark = dto.OtherInformation;
+                        int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
+                        if (DataID != 0)
                         {
-                            res_InvitationData.Remark = dto.OtherInformation;
-                            int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
-                            if (DataID != 0)
-                            {
-                                result = new Result() { Code = 0, Msg = "添加成功!" };
-                            }
-                            else
-                            {
-                                RollbackTran();
-                                result = new Result() { Code = -1, Msg = "添加失败!" };
-                            }
-
+                            result = new Result() { Code = 0, Msg = "添加成功!" };
                         }
                         else
                         {
-                            int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>().Where(a => a.Id == ifNullUp.Id).SetColumns(a => new Res_InvitationOfficialActivityData
-                            {
-                                Contact = dto.Contact,
-                                Tel = dto.Tel,
-                                Email = dto.Email,
-                                Fax = dto.Fax,
-                                Address = dto.Address,
-                                Remark = dto.OtherInformation,
-                            }).ExecuteCommandAsync();
+                            RollbackTran();
+                            result = new Result() { Code = -1, Msg = "添加失败!" };
                         }
 
-                        Grp_CreditCardPayment C = new Grp_CreditCardPayment();
-                        C.PayDId = dto.PayDId;
-                        //if (C.PayDId == 72) C.IsPay = 1;
-                        //else C.IsPay = 0;
-
-                        C.ConsumptionPatterns = dto.ConsumptionPatterns;
-                        C.ConsumptionDate = dto.ConsumptionDate;
-                        C.CTDId = dto.CTDId;
-                        C.BankNo = dto.BankNo;
-                        C.CardholderName = dto.CardholderName;
-                        C.PayMoney = dto.PayMoney;
-                        C.PaymentCurrency = dto.PaymentCurrency;
-                        C.CompanyBankNo = dto.CompanyBankNo;
-                        C.OtherBankName = dto.OtherBankName;
-                        C.OtherSideNo = dto.OtherSideNo;
-                        C.OtherSideName = dto.OtherSideName;
-                        C.Remark = "";
-                        C.CreateUserId = dto.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 = 0;
-                        C.AuditGMDate = "";
-                        C.IsPay = 0;
-                        C.DIId = dto.DiId;
-                        C.CId = id;
-                        C.CTable = 81;
-                        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;
+                    }
+                    else
+                    {
+                        int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>()
+                                                    .Where(a => a.Id == ifNullUp.Id)
+                                                    .SetColumns(a => new Res_InvitationOfficialActivityData
+                                                    {
+                                                        Contact = dto.Contact,
+                                                        Tel = dto.Tel,
+                                                        Email = dto.Email,
+                                                        Fax = dto.Fax,
+                                                        Address = dto.Address,
+                                                        Remark = dto.OtherInformation,
+                                                    })
+                                                    .ExecuteCommandAsync();
+                    }
 
-                        //获取新汇率  int diId,int CId, int currencyId
-                        var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
+                    Grp_CreditCardPayment C = new Grp_CreditCardPayment();
+                    C.PayDId = dto.PayDId;
+                    if (C.PayDId == 72) C.IsPay = 1;
+                    else C.IsPay = 0;
 
-                        if (rate.Code == 0)
-                        {
-                            var rateInfo = (rate.Data as CurrencyInfo);
-                            if (rateInfo is not null)
-                            {
+                    C.ConsumptionPatterns = dto.ConsumptionPatterns;
+                    C.ConsumptionDate = dto.ConsumptionDate;
+                    C.CTDId = dto.CTDId;
+                    C.BankNo = dto.BankNo;
+                    C.CardholderName = dto.CardholderName;
+                    C.PayMoney = dto.PayMoney;
+                    C.PaymentCurrency = dto.PaymentCurrency;
+                    C.CompanyBankNo = dto.CompanyBankNo;
+                    C.OtherBankName = dto.OtherBankName;
+                    C.OtherSideNo = dto.OtherSideNo;
+                    C.OtherSideName = dto.OtherSideName;
+                    C.Remark = "";
+                    C.CreateUserId = dto.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 = 0;
+                    C.AuditGMDate = "";
+                    C.DIId = dto.DiId;
+                    C.CId = id;
+                    C.CTable = 81;
+                    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.DayRate = rateInfo.Rate;
-                                C.RMBPrice = rateInfo.Rate * C.PayMoney;
-                            }
-                            else
-                            {
-                                C.DayRate = 1;
-                                C.RMBPrice = C.PayMoney;
-                            }
-                        }
+                    //获取新汇率  int diId,int CId, int currencyId
+                    var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
 
-                        int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
-                        var data = new { ccpId = cId, sign = 1 };
-                        if (cId != 0)
+                    if (rate.Code == 0)
+                    {
+                        var rateInfo = (rate.Data as CurrencyInfo);
+                        if (rateInfo is not null)
                         {
-                            result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
+
+                            C.DayRate = rateInfo.Rate;
+                            C.RMBPrice = rateInfo.Rate * C.PayMoney;
                         }
                         else
                         {
-                            RollbackTran();
-                            result = new Result() { Code = -1, Msg = "添加失败!" };
+                            C.DayRate = 1;
+                            C.RMBPrice = C.PayMoney;
                         }
                     }
-                    
+
+                    int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
+                    var data = new { ccpId = cId, sign = 1 };
+                    if (cId != 0)
+                    {
+                        result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
+                    }
+                    else
+                    {
+                        RollbackTran();
+                        result = new Result() { Code = -1, Msg = "添加失败!" };
+                    }
                 }
-                else//修改
+            }
+            else//修改
+            {
+                var thisTime = new DateTime();
+                DateTime.TryParse(dto.InviteTime, out thisTime);
+                bool res = await UpdateAsync(a => a.Id == grp_Invitation.Id, a => new Grp_InvitationOfficialActivities
                 {
-                    var thisTime = new DateTime();
-                    DateTime.TryParse(dto.InviteTime, out thisTime);
-                    bool res = await UpdateAsync(a => a.Id == grp_Invitation.Id, a => new Grp_InvitationOfficialActivities
-                    {
-                        DiId = dto.DiId,
-                        InviterArea = dto.InviterArea,
-                        Inviter = dto.Inviter,
-                        InviteTime = thisTime,
-                        Attachment = dto.Attachment,
-                        InviteCost = dto.InviteCost,
-                        InviteCurrency = dto.InviteCurrency,
-                        SendCost = dto.SendCost,
-                        SendCurrency = dto.SendCurrency,
-                        EventsCost = dto.EventsCost,
-                        EventsCurrency = dto.EventsCurrency,
-                        TranslateCost = dto.TranslateCost,
-                        TranslateCurrency = dto.TranslateCurrency,
-                        IsGoOfficaiaBussiness = dto.IsGoOfficaiaBussiness,
-                        Remark = dto.Remark,
-                    });
-                    if (res)
+                    DiId = dto.DiId,
+                    InviterArea = dto.InviterArea,
+                    Inviter = dto.Inviter,
+                    InviteTime = thisTime,
+                    Attachment = dto.Attachment,
+                    InviteCost = dto.InviteCost,
+                    InviteCurrency = dto.InviteCurrency,
+                    SendCost = dto.SendCost,
+                    SendCurrency = dto.SendCurrency,
+                    EventsCost = dto.EventsCost,
+                    EventsCurrency = dto.EventsCurrency,
+                    TranslateCost = dto.TranslateCost,
+                    TranslateCurrency = dto.TranslateCurrency,
+                    IsGoOfficaiaBussiness = dto.IsGoOfficaiaBussiness,
+                    Remark = dto.Remark,
+                });
+                if (res)
+                {
+                    Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
+                    res_InvitationData.Country = dto.InviterArea;
+                    res_InvitationData.UnitName = dto.Inviter;
+                    Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
+                        (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName && a.IsDel == 0);
+                    if (ifNullUp == null)///添加或修改商邀资料
                     {
-                        Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
-                        res_InvitationData.Country = dto.InviterArea;
-                        res_InvitationData.UnitName = dto.Inviter;
-                        Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
-                            (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName && a.IsDel == 0);
-                        if (ifNullUp == null)///添加或修改商邀资料
-                        {
-                            res_InvitationData.Remark = dto.OtherInformation;
-                            res_InvitationData.Delegation = dto.DiId.ToString();
+                        res_InvitationData.Remark = dto.OtherInformation;
+                        res_InvitationData.Delegation = dto.DiId.ToString();
 
-                            int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
-                            if (DataID != 0)
-                            {
-                                result = new Result() { Code = 0, Msg = "添加成功!" };
-                            }
-                            else
-                            {
-                                RollbackTran();
-                                result = new Result() { Code = -1, Msg = "添加失败!" };
-                            }
+                        int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
+                        if (DataID != 0)
+                        {
+                            result = new Result() { Code = 0, Msg = "添加成功!" };
                         }
                         else
                         {
-                            int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>()
-                                .Where(a => a.Id == ifNullUp.Id)
-                                .SetColumns(a => new Res_InvitationOfficialActivityData
-                                {
-                                    Contact = dto.Contact,
-                                    Tel = dto.Tel,
-                                    Email = dto.Email,
-                                    Fax = dto.Fax,
-                                    Address = dto.Address,
-                                    Remark = dto.OtherInformation,
-                                }).ExecuteCommandAsync();
+                            RollbackTran();
+                            result = new Result() { Code = -1, Msg = "添加失败!" };
                         }
+                    }
+                    else
+                    {
+                        int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>()
+                                                    .Where(a => a.Id == ifNullUp.Id)
+                                                    .SetColumns(a => new Res_InvitationOfficialActivityData
+                                                    {
+                                                        Contact = dto.Contact,
+                                                        Tel = dto.Tel,
+                                                        Email = dto.Email,
+                                                        Fax = dto.Fax,
+                                                        Address = dto.Address,
+                                                        Remark = dto.OtherInformation,
+                                                    })
+                                                    .ExecuteCommandAsync();
+                    }
 
-                        Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Invitation.Id && a.CTable == 81 && a.IsDel == 0);
-                        if (grp_CreditCardPayment != null)
-                        {
-                            //if (dto.PayDId == 72) grp_CreditCardPayment.IsPay = 1;
-                            //else grp_CreditCardPayment.IsPay = 0;
-                            grp_CreditCardPayment.IsPay = 0;
-
-                            grp_CreditCardPayment.PayMoney = dto.PayMoney;
-                            grp_CreditCardPayment.PaymentCurrency = dto.PaymentCurrency;
-                            grp_CreditCardPayment.Payee = dto.Payee;
-                            grp_CreditCardPayment.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
+                    Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Invitation.Id && a.CTable == 81 && a.IsDel == 0);
+                    if (grp_CreditCardPayment != null)
+                    {
+                        if (dto.PayDId == 72) grp_CreditCardPayment.IsPay = 1;
+                        else grp_CreditCardPayment.IsPay = 0;
 
+                        grp_CreditCardPayment.PayMoney = dto.PayMoney;
+                        grp_CreditCardPayment.PaymentCurrency = dto.PaymentCurrency;
+                        grp_CreditCardPayment.Payee = dto.Payee;
+                        grp_CreditCardPayment.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
 
-                            //获取新汇率  int diId,int CId, int currencyId
-                            var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
+                        //获取新汇率  int diId,int CId, int currencyId
+                        var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
 
-                            grp_CreditCardPayment.DayRate = 1;
-                            grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
-                            if (rate.Code == 0)
+                        grp_CreditCardPayment.DayRate = 1;
+                        grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
+                        if (rate.Code == 0)
+                        {
+                            var rateInfo = (rate.Data as CurrencyInfo);
+                            if (rateInfo is not null)
                             {
-                                var rateInfo = (rate.Data as CurrencyInfo);
-                                if (rateInfo is not null)
-                                {
-
-                                    grp_CreditCardPayment.DayRate = rateInfo.Rate;
-                                    grp_CreditCardPayment.RMBPrice = rateInfo.Rate * grp_CreditCardPayment.PayMoney;
-                                }
+                                grp_CreditCardPayment.DayRate = rateInfo.Rate;
+                                grp_CreditCardPayment.RMBPrice = rateInfo.Rate * grp_CreditCardPayment.PayMoney;
                             }
+                        }
 
-                            int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
-                                                        .Where(a => a.Id == grp_CreditCardPayment.Id)
-                                                        .SetColumns(a => new Grp_CreditCardPayment
-                                                        {
-                                                            ConsumptionPatterns = dto.ConsumptionPatterns,
-                                                            ConsumptionDate = dto.ConsumptionDate,
-                                                            PayDId = dto.PayDId,
-                                                            IsPay = grp_CreditCardPayment.IsPay,
-                                                            CTDId = dto.CTDId,
-                                                            BankNo = dto.BankNo,
-                                                            CardholderName = dto.CardholderName,
-                                                            CompanyBankNo = dto.CompanyBankNo,
-                                                            OtherBankName = dto.OtherBankName,
-                                                            OtherSideNo = dto.OtherSideNo,
-                                                            OtherSideName = dto.OtherSideName,
-                                                            PayMoney = grp_CreditCardPayment.PayMoney,
-                                                            PaymentCurrency = grp_CreditCardPayment.PaymentCurrency,
-                                                            Payee = grp_CreditCardPayment.Payee,
-                                                            OrbitalPrivateTransfer = grp_CreditCardPayment.OrbitalPrivateTransfer,
-                                                            DayRate = grp_CreditCardPayment.DayRate,
-                                                            RMBPrice = grp_CreditCardPayment.RMBPrice,
-                                                        }).ExecuteCommandAsync();
-                            if (CTable != 0)
-                            {
-                                var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2 };
-                                result = new Result() { Code = 0, Msg = "修改成功!", Data = data };
-                            }
-                            else
-                            {
-                                result = new Result() { Code = -1, Msg = "修改失败!" };
-                                RollbackTran();
-                            }
+                        int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
+                                                    .Where(a => a.Id == grp_CreditCardPayment.Id)
+                                                    .SetColumns(a => new Grp_CreditCardPayment
+                                                    {
+                                                        ConsumptionPatterns = dto.ConsumptionPatterns,
+                                                        ConsumptionDate = dto.ConsumptionDate,
+                                                        PayDId = dto.PayDId,
+                                                        IsPay = grp_CreditCardPayment.IsPay,
+                                                        CTDId = dto.CTDId,
+                                                        BankNo = dto.BankNo,
+                                                        CardholderName = dto.CardholderName,
+                                                        CompanyBankNo = dto.CompanyBankNo,
+                                                        OtherBankName = dto.OtherBankName,
+                                                        OtherSideNo = dto.OtherSideNo,
+                                                        OtherSideName = dto.OtherSideName,
+                                                        PayMoney = grp_CreditCardPayment.PayMoney,
+                                                        PaymentCurrency = grp_CreditCardPayment.PaymentCurrency,
+                                                        Payee = grp_CreditCardPayment.Payee,
+                                                        OrbitalPrivateTransfer = grp_CreditCardPayment.OrbitalPrivateTransfer,
+                                                        DayRate = grp_CreditCardPayment.DayRate,
+                                                        RMBPrice = grp_CreditCardPayment.RMBPrice,
+                                                    }).ExecuteCommandAsync();
+                        if (CTable != 0)
+                        {
+                            var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2 };
+                            result = new Result() { Code = 0, Msg = "修改成功!", Data = data };
                         }
                         else
                         {
-                            RollbackTran();
                             result = new Result() { Code = -1, Msg = "修改失败!" };
+                            RollbackTran();
                         }
                     }
                     else
@@ -542,13 +534,14 @@ Order By i.id  Desc ", sqlWhere);
                         result = new Result() { Code = -1, Msg = "修改失败!" };
                     }
                 }
-                CommitTran();
-            }
-            catch (Exception ex)
-            {
-                result = new Result() { Code = -2, Msg = "程序错误!" };
-                throw;
+                else
+                {
+                    RollbackTran();
+                    result = new Result() { Code = -1, Msg = "修改失败!" };
+                }
             }
+            CommitTran();
+
             return result;
         }
     }

+ 103 - 106
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaPriceRepository.cs

@@ -321,136 +321,133 @@ From Grp_VisaInfo as v With(Nolock) left Join Grp_CreditCardPayment as c With(No
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
             BeginTran();
-            try
+            int id = 0;
+            Grp_VisaInfo grp_Visa1 = _mapper.Map<Grp_VisaInfo>(dto);
+            Grp_CreditCardPayment c = _mapper.Map<Grp_CreditCardPayment>(dto);
+            c.PayMoney = dto.VisaPrice;
+            c.PaymentCurrency = dto.VisaCurrency;
+            c.Remark = dto.CRemark;
+            c.PayPercentage = 100;
+            c.CTable = 80;
+            c.CId = dto.Id;
+            c.IsAuditGM = 0;
+
+            if (c.PayDId == 72) c.IsPay = 1;
+            else c.IsPay = 0;
+
+            c.RMBPrice = c.PayMoney;
+            c.DayRate = 1.0000M;
+            Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
+            List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
+            if (_TeamRate != null)
             {
-                int id = 0;
-                Grp_VisaInfo grp_Visa1 = _mapper.Map<Grp_VisaInfo>(dto);
-                Grp_CreditCardPayment c = _mapper.Map<Grp_CreditCardPayment>(dto);
-                c.PayMoney = dto.VisaPrice;
-                c.PaymentCurrency = dto.VisaCurrency;
-                c.Remark = dto.CRemark;
-                c.PayPercentage = 100;
-                c.CTable = 80;
-                c.CId = dto.Id;
-                c.IsAuditGM = 0;
-                //if (c.PayDId == 72) c.IsPay = 1; 
-                //else c.IsPay = 0;
-                c.IsPay = 0;
-                c.RMBPrice = c.PayMoney;
-                c.DayRate = 1;
-                Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
-                List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
-                if (_TeamRate != null)
+                Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
+                if (_SetData != null)
                 {
-                    Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
-                    if (_SetData != null)
+                    currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
+                    CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
+                    if (CurrencyRate != null)
                     {
-                        currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
-                        CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
-                        if (CurrencyRate != null)
-                        {
-                            c.RMBPrice = c.PayMoney * Convert.ToDecimal(CurrencyRate.Rate);
-                            c.DayRate = CurrencyRate.Rate;
-                        }
+                        c.RMBPrice = c.PayMoney * Convert.ToDecimal(CurrencyRate.Rate);
+                        c.DayRate = CurrencyRate.Rate;
                     }
                 }
+            }
 
-                if (dto.Status == 1)//添加
+            if (dto.Status == 1)//添加
+            {
+                Grp_VisaInfo grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>()
+                                                 .First(a => a.IsDel == 0 &&
+                                                             a.VisaDescription.Equals(dto.VisaDescription) &&
+                                                             a.VisaCurrency == dto.VisaCurrency &&
+                                                             a.VisaPrice == dto.VisaPrice &&
+                                                             a.VisaClient == dto.VisaClient
+                                                  );
+                if (grp_Visa != null)
                 {
-                    Grp_VisaInfo grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.IsDel == 0 &&   
-                                                                                           a.VisaDescription.Equals(dto.VisaDescription) && 
-                                                                                           a.VisaCurrency == dto.VisaCurrency && 
-                                                                                           a.VisaPrice == dto.VisaPrice && 
-                                                                                           a.VisaClient == dto.VisaClient
-                                                                                     );
-                    if (grp_Visa != null)
-                    {
-                        return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
-                    }
-                    else
+                    return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
+                }
+                else
+                {
+                    id = await AddAsyncReturnId(grp_Visa1);
+                    if (id != 0)
                     {
-                        id = await AddAsyncReturnId(grp_Visa1);
-                        if (id != 0)
+                        c.CId = id;
+                        int cId = await _sqlSugar.Insertable(c).ExecuteReturnIdentityAsync();
+                        if (cId != 0)
                         {
-                            c.CId = id;
-                            int cId = await _sqlSugar.Insertable(c).ExecuteReturnIdentityAsync();
-                            if (cId != 0)
-                            {
-                                var data = new { ccpId = cId, sign = 1 };
-                                result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
+                            var data = new { ccpId = cId, sign = 1 };
+                            result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
 
-                            }
-                            else
-                            {
-                                RollbackTran();
-                                result = new Result() { Code = -1, Msg = "添加失败!" };
-                            }
                         }
                         else
                         {
                             RollbackTran();
-                            result = new Result() { Code = -1, Msg = "添加失败,请稍后重试!" };
+                            result = new Result() { Code = -1, Msg = "添加失败!" };
                         }
                     }
-
-                }
-                else if (dto.Status == 2)//修改
-                {
-
-                    bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_VisaInfo
-                    {
-                        VisaClient = grp_Visa1.VisaClient,
-                        VisaPrice = grp_Visa1.VisaPrice,
-                        VisaCurrency = grp_Visa1.VisaCurrency,
-                        IsThird = grp_Visa1.IsThird,
-                        PassengerType = grp_Visa1.PassengerType,
-                        VisaNumber = grp_Visa1.VisaNumber,
-                        VisaFreeNumber = grp_Visa1.VisaFreeNumber,
-                        Remark = dto.Remark,
-                        VisaDescription = dto.VisaDescription
-                    });
-                    if (res)
-                    {
-                        int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == grp_Visa1.Id && a.CTable == 80).SetColumns(a => new Grp_CreditCardPayment
-                        {
-                            PayDId = dto.PayDId,
-                            IsPay = c.IsPay,
-                            PayMoney = c.PayMoney,
-                            PaymentCurrency = c.PaymentCurrency,
-                            Payee = c.Payee,
-                            OrbitalPrivateTransfer = c.OrbitalPrivateTransfer,
-                            DayRate = c.DayRate,
-                            RMBPrice = c.RMBPrice,
-                            ConsumptionPatterns = c.ConsumptionPatterns,
-                            ConsumptionDate = c.ConsumptionDate,
-                            CTDId = c.CTDId,
-                            CompanyBankNo = c.CompanyBankNo,
-                            OtherBankName = c.OtherBankName,
-                            OtherSideNo = c.OtherSideNo,
-                            OtherSideName = c.OtherSideName,
-                            BankNo = c.BankNo,
-                            CardholderName = c.CardholderName,
-                            Remark = c.Remark,
-
-                        }).ExecuteCommandAsync();
-
-                        Grp_CreditCardPayment ccp = Query<Grp_CreditCardPayment>(a => a.CId == grp_Visa1.Id && a.CTable == 80).First();
-
-                        var data = new { ccpId = ccp.Id, sign = 2 };
-                        result = new Result() { Code = 0, Msg = "修改成功!", Data = data };
-                    }
                     else
                     {
                         RollbackTran();
-                        result = new Result() { Code = -1, Msg = "修改失败,请稍后重试!" };
+                        result = new Result() { Code = -1, Msg = "添加失败,请稍后重试!" };
                     }
                 }
-                CommitTran();
             }
-            catch (Exception ex)
+            else if (dto.Status == 2)//修改
             {
-                result = new Result() { Code = -2, Msg = ex.Message };
+                bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_VisaInfo
+                {
+                    VisaClient = grp_Visa1.VisaClient,
+                    VisaPrice = grp_Visa1.VisaPrice,
+                    VisaCurrency = grp_Visa1.VisaCurrency,
+                    IsThird = grp_Visa1.IsThird,
+                    PassengerType = grp_Visa1.PassengerType,
+                    VisaNumber = grp_Visa1.VisaNumber,
+                    VisaFreeNumber = grp_Visa1.VisaFreeNumber,
+                    Remark = dto.Remark,
+                    VisaDescription = dto.VisaDescription
+                });
+                if (res)
+                {
+                    int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
+                                                .Where(a => a.CId == grp_Visa1.Id && a.CTable == 80)
+                                                .SetColumns(a => new Grp_CreditCardPayment
+                                                {
+                                                    PayDId = dto.PayDId,
+                                                    IsPay = c.IsPay,
+                                                    PayMoney = c.PayMoney,
+                                                    PaymentCurrency = c.PaymentCurrency,
+                                                    Payee = c.Payee,
+                                                    OrbitalPrivateTransfer = c.OrbitalPrivateTransfer,
+                                                    DayRate = c.DayRate,
+                                                    RMBPrice = c.RMBPrice,
+                                                    ConsumptionPatterns = c.ConsumptionPatterns,
+                                                    ConsumptionDate = c.ConsumptionDate,
+                                                    CTDId = c.CTDId,
+                                                    CompanyBankNo = c.CompanyBankNo,
+                                                    OtherBankName = c.OtherBankName,
+                                                    OtherSideNo = c.OtherSideNo,
+                                                    OtherSideName = c.OtherSideName,
+                                                    BankNo = c.BankNo,
+                                                    CardholderName = c.CardholderName,
+                                                    Remark = c.Remark,
+
+                                                })
+                                                .ExecuteCommandAsync();
+
+                    var ccp = Query<Grp_CreditCardPayment>(a => a.CId == grp_Visa1.Id && a.CTable == 80).First();
+
+                    var data = new { ccpId = ccp.Id, sign = 2 };
+                    result = new Result() { Code = 0, Msg = "修改成功!", Data = data };
+                }
+                else
+                {
+                    RollbackTran();
+                    result = new Result() { Code = -1, Msg = "修改失败,请稍后重试!" };
+                }
             }
+            CommitTran();
+
             return result;
         }
     }