Forráskód Böngészése

酒店生成、确认单、便捷接口编写

wangh 1 éve%!(EXTRA string=óta)
szülő
commit
dd30e6a1b5

+ 456 - 38
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -30,6 +30,10 @@ using NPOI.HPSF;
 using SqlSugar;
 using System.Collections;
 using Org.BouncyCastle.Ocsp;
+using System.Globalization;
+using static QRCoder.PayloadGenerator;
+using Bookmark = Aspose.Words.Bookmark;
+using Aspose.Words.Fields;
 
 namespace OASystem.API.Controllers
 {
@@ -68,7 +72,7 @@ namespace OASystem.API.Controllers
         public GroupsController(IMapper mapper, SqlSugarClient sqlSugar, GrpScheduleRepository grpScheduleRep, DelegationInfoRepository groupRepository,
             TaskAssignmentRepository taskAssignmentRep, AirTicketResRepository airTicketResRep, DecreasePaymentsRepository decreasePaymentsRep,
             InvitationOfficialActivitiesRepository InvitationOfficialActivitiesRep, DelegationEnDataRepository delegationEnDataRep, EnterExitCostRepository enterExitCostRep
-            , DelegationVisaRepository delegationVisaRep, MessageRepository message,VisaPriceRepository visaPriceRep,CarTouristGuideGroundRepository carTouristGuideGroundRep,CheckBoxsRepository checkBoxs, GroupCostRepository GroupCostRepository, CostTypeHotelNumberRepository CostTypeHotelNumberRepository,
+            , DelegationVisaRepository delegationVisaRep, MessageRepository message, VisaPriceRepository visaPriceRep, CarTouristGuideGroundRepository carTouristGuideGroundRep, CheckBoxsRepository checkBoxs, GroupCostRepository GroupCostRepository, CostTypeHotelNumberRepository CostTypeHotelNumberRepository,
             GroupCostParameterRepository GroupCostParameterRepository, HotelPriceRepository hotelPriceRep)
         {
             _mapper = mapper;
@@ -89,8 +93,8 @@ namespace OASystem.API.Controllers
             _enterExitCostRep = enterExitCostRep;
             _delegationVisaRep = delegationVisaRep;
             _message = message;
-            _visaPriceRep= visaPriceRep;
-            _carTouristGuideGroundRep= carTouristGuideGroundRep;
+            _visaPriceRep = visaPriceRep;
+            _carTouristGuideGroundRep = carTouristGuideGroundRep;
             _checkBoxs = checkBoxs;
             _GroupCostRepository = GroupCostRepository;
             _CostTypeHotelNumberRepository = CostTypeHotelNumberRepository;
@@ -98,7 +102,7 @@ namespace OASystem.API.Controllers
             _hotelPriceRep = hotelPriceRep;
         }
 
-        
+
         #region 流程管控
 
         /// <summary>
@@ -298,17 +302,17 @@ namespace OASystem.API.Controllers
                 RefAsync<int> total = 0;//REF和OUT不支持异步,想要真的异步这是最优解
                 var _DelegationList = await _sqlSugar.SqlQueryable<DelegationListView>(sql).ToPageListAsync(dto.PageIndex, dto.PageSize, total);//ToPageAsync
 
-                return Ok(JsonView(true,"查询成功!",_DelegationList, total));
+                return Ok(JsonView(true, "查询成功!", _DelegationList, total));
 
             }
             else
             {
                 return Ok(JsonView(false, "查询失败"));
             }
-               
-           
 
-            
+
+
+
         }
 
         /// <summary>
@@ -444,10 +448,10 @@ namespace OASystem.API.Controllers
 
             GroupStepForDelegation.CreateWorkStep(dto.GroupId); //创建管控流程
 
-            return Ok(JsonView(true,"操作成功!",groupData.Data));
+            return Ok(JsonView(true, "操作成功!", groupData.Data));
         }
 
-        
+
 
         /// <summary>
         /// 获取团组名称data  And 签证国别Data
@@ -702,10 +706,11 @@ namespace OASystem.API.Controllers
                         .SetColumns(it => it.WorkStatus == dto.visaStatus)
                         .Where(s => s.Id == dto.visaProgressCustomerId)
                         .ExecuteCommandAsync();
-                    if (updCount > 0 && dto.publishCode == 1) {
+                    if (updCount > 0 && dto.publishCode == 1)
+                    {
 
                         _delegationVisaRep.ChangeDataBase(DBEnum.OA2014DB); //切换到新OA后删除
-                        
+
                         string sqlDelegation = string.Format(@" Select * From DelegationInfo With(Nolock) Where Id = {0} ", dto.diId);
                         OA2021_DelegationInfo groupData = _sqlSugar.SqlQueryable<OA2021_DelegationInfo>(sqlDelegation).First();
                         //GroupInfoDto grpDto = new GroupInfoDto() { Id = dto.diId };
@@ -731,7 +736,8 @@ namespace OASystem.API.Controllers
                             }
                         });
 
-                        if (rst) {
+                        if (rst)
+                        {
                             return Ok(JsonView(true, "发送通知成功"));
                         }
                     }
@@ -2795,14 +2801,14 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> GetNationalTravelFeePageDataSource()
         {
-           
+
             string sql = string.Format(@"Select * From Grp_NationalTravelFee Where Isdel = 0  ");
 
             var nationalTravelFeeData = await _groupRepository._sqlSugar.SqlQueryable<Grp_NationalTravelFee>(sql).ToListAsync();
 
             List<string> countryData = new List<string>();
 
-            countryData.AddRange( nationalTravelFeeData.Select(it => it.Country ).ToList());
+            countryData.AddRange(nationalTravelFeeData.Select(it => it.Country).ToList());
             countryData = countryData.Distinct().ToList();
 
             List<dynamic> dataSource = new List<dynamic>();
@@ -2815,7 +2821,7 @@ namespace OASystem.API.Controllers
                     CountryName = item,
                     CityData = cityData1
                 };
-                
+
                 dataSource.Add(countryData2);
             }
 
@@ -2831,9 +2837,9 @@ namespace OASystem.API.Controllers
         public async Task<IActionResult> PostNationalTravelFeePage(NationalTravelFeePageDto dto)
         {
             int portId = dto.PortType;
-            if (portId != 1 && portId != 2 && portId != 3) return Ok(JsonView(false, "请输入正确的端口号!\r\n请求端口分类1 Web 2 Android 3 IOS")); 
+            if (portId != 1 && portId != 2 && portId != 3) return Ok(JsonView(false, "请输入正确的端口号!\r\n请求端口分类1 Web 2 Android 3 IOS"));
 
-            if (dto.PageIndex == 0)  return Ok(JsonView(false, "当前页码数不能为0!"));
+            if (dto.PageIndex == 0) return Ok(JsonView(false, "当前页码数不能为0!"));
             if (dto.PageSize == 0) return Ok(JsonView(false, "每页条数不能0!"));
 
             string whereSql = string.Empty;
@@ -2887,7 +2893,7 @@ namespace OASystem.API.Controllers
                 whereSql = string.Format(@"And City = '{0}' ", dto.City);
             }
 
-            
+
             string sql = string.Format(@"Select gntf.Country,gntf.City,gntf.Currency,ssd.Name as CurrencyCode, 
 	                                                ssd.Remark as CurrencyName,gntf.RoomCost,gntf.FoodCost,gntf.PublicCost,
 	                                                gntf.LastUpdateUserId,su.CnName as LastUpdateUserName,gntf.LastUpdateTime 
@@ -2939,7 +2945,8 @@ namespace OASystem.API.Controllers
         {
             try
             {
-                Grp_NationalTravelFee _nationalTravelFee = new Grp_NationalTravelFee() { 
+                Grp_NationalTravelFee _nationalTravelFee = new Grp_NationalTravelFee()
+                {
                     Id = dto.Id,
                     DeleteUserId = dto.DeleteUserId,
                     DeleteTime = DateTime.Now.ToString("yyyy-MM-dd"),
@@ -3077,7 +3084,7 @@ namespace OASystem.API.Controllers
                     PassengerType = _PassengerType,
                     BankCard = _BankCard
                 };
-                return Ok(JsonView(true, "查询成功!",data));
+                return Ok(JsonView(true, "查询成功!", data));
             }
             catch (Exception ex)
             {
@@ -3146,8 +3153,8 @@ namespace OASystem.API.Controllers
         {
             try
             {
-                Grp_CarTouristGuideGroundReservations _groupData = await _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().FirstAsync(a=>a.Id==dto.Id && a.IsDel==0);
-                Grp_CreditCardPayment _creditCardPayment = await _sqlSugar.Queryable<Grp_CreditCardPayment>().FirstAsync(a => a.CId == dto.Id && a.CTable==79 && a.IsDel == 0);
+                Grp_CarTouristGuideGroundReservations _groupData = await _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>().FirstAsync(a => a.Id == dto.Id && a.IsDel == 0);
+                Grp_CreditCardPayment _creditCardPayment = await _sqlSugar.Queryable<Grp_CreditCardPayment>().FirstAsync(a => a.CId == dto.Id && a.CTable == 79 && a.IsDel == 0);
                 var data = new
                 {
                     CarTouristGuideGround = _groupData,
@@ -3308,9 +3315,9 @@ namespace OASystem.API.Controllers
                 ELSE 'False' END as isTrue  from Grp_GroupCost where Isdel = 0 and date != '' group by Diid) b on a.Id = b.Diid
                  Where TeamName != '' And IsDel = 0  Order By a.Id Desc
             ").ToList(); //团组列表
-            int diid = dto.Diid == - 1 ? groupList.First().Id : dto.Diid;
-            var groupInfo = await _groupRepository.PostShareGroupInfo(new ShareGroupInfoDto { PortType =  1 , Id = diid }); //团组信息
-            var groupChecks =   _checkBoxs.GetCheckBoxsByDiid(diid);  //团组选中信息  可枚举
+            int diid = dto.Diid == -1 ? groupList.First().Id : dto.Diid;
+            var groupInfo = await _groupRepository.PostShareGroupInfo(new ShareGroupInfoDto { PortType = 1, Id = diid }); //团组信息
+            var groupChecks = _checkBoxs.GetCheckBoxsByDiid(diid);  //团组选中信息  可枚举
             var groupCost = _GroupCostRepository.GetAllByDiid(diid);  //团组列表信息  
             var groupCostMap = _mapper.Map<List<Grp_GroupCostDto>>(groupCost);
             var hotelNumber = _CostTypeHotelNumberRepository.GetCostTypeHotelNumberByDiid(diid); //酒店数量 可枚举
@@ -3320,7 +3327,8 @@ namespace OASystem.API.Controllers
             //     Grp_GroupCostParameter());
             var GroupCostParameterMap = _mapper.Map<List<Grp_GroupCostParameterDto>>(GroupCostParameter);
 
-            return Ok(JsonView(new {
+            return Ok(JsonView(new
+            {
                 groupList,
                 groupInfo,
                 groupChecks,
@@ -3341,7 +3349,7 @@ namespace OASystem.API.Controllers
             JsonView jw = null;
             bool isTrue = false;
             var Grp_groups = _mapper.Map<List<Grp_GroupCost>>(dto.GroupCosts);
-            Grp_groups.ForEach(x => { x.CreateUserId = dto.Userid; x.CreateTime = DateTime.Now;}); //.ToString("yyyy-MM-dd HH:mm:ss")
+            Grp_groups.ForEach(x => { x.CreateUserId = dto.Userid; x.CreateTime = DateTime.Now; }); //.ToString("yyyy-MM-dd HH:mm:ss")
             var Grp_CheckBoxs = _mapper.Map<List<Grp_CheckBoxs>>(dto.CheckBoxs);
             Grp_CheckBoxs.ForEach(x => { x.CreateUserId = dto.Userid; x.CreateTime = DateTime.Now; });
             var Grp_HotelNumber = _mapper.Map<List<Grp_CostTypeHotelNumber>>(dto.CostTypeHotelNumbers);
@@ -3350,13 +3358,13 @@ namespace OASystem.API.Controllers
             try
             {
                 _sqlSugar.BeginTran();
-                isTrue = await _GroupCostRepository.SaveGroupCostList(Grp_groups,dto.Diid); //列表
-                isTrue = await _checkBoxs.SaveCheckBoxs(Grp_CheckBoxs,dto.Diid); //选中项
-                isTrue = await _CostTypeHotelNumberRepository.SaveHotelNumber(Grp_HotelNumber,dto.Diid); //酒店房间数量
+                isTrue = await _GroupCostRepository.SaveGroupCostList(Grp_groups, dto.Diid); //列表
+                isTrue = await _checkBoxs.SaveCheckBoxs(Grp_CheckBoxs, dto.Diid); //选中项
+                isTrue = await _CostTypeHotelNumberRepository.SaveHotelNumber(Grp_HotelNumber, dto.Diid); //酒店房间数量
                 isTrue = await _GroupCostParameterRepository.SaveAsync(Grp_CostParameters, dto.Diid); //系数
 
                 _sqlSugar.CommitTran();
-                jw = JsonView(true,"保存成功!",isTrue);
+                jw = JsonView(true, "保存成功!", isTrue);
             }
             catch (Exception)
             {
@@ -3503,17 +3511,17 @@ namespace OASystem.API.Controllers
             }
         }
         /// <summary>
-        /// 根基酒店费用操作(Status:1.新增,2.修改)
+        /// 计算酒店付款总金额
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> OpHotelReservations(OpHotelReservationsData dto)
+        public async Task<IActionResult> HotelConversionAmounts(HotelReservationsCNYDto dto)
         {
             try
             {
-                Result groupData = await _hotelPriceRep.OpHotelReservations(dto);
+                Result groupData = await _hotelPriceRep.HotelConversionAmounts(dto);
                 if (groupData.Code != 0)
                 {
                     return Ok(JsonView(false, groupData.Msg));
@@ -3525,18 +3533,19 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, ex.Message));
             }
         }
+
         /// <summary>
-        /// 计算酒店付款总金额
+        /// 根基酒店费用操作(Status:1.新增,2.修改)
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> HotelConversionAmounts(HotelReservationsCNYDto dto)
+        public async Task<IActionResult> OpHotelReservations(OpHotelReservationsData dto)
         {
             try
             {
-                Result groupData = await _hotelPriceRep.HotelConversionAmounts(dto);
+                Result groupData = await _hotelPriceRep.OpHotelReservations(dto);
                 if (groupData.Code != 0)
                 {
                     return Ok(JsonView(false, groupData.Msg));
@@ -3548,9 +3557,418 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, ex.Message));
             }
         }
+
+        /// <summary>
+        /// region 文件上传  可以带参数
+        /// </summary>
+        /// <param name="file"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> UploadHotel(IFormFile file)
+        {
+            try
+            {
+                if (file != null)
+                {
+                    var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
+                    //文件名称
+                    string projectFileName = file.FileName;
+
+                    //上传的文件的路径
+                    string filePath = "";
+
+
+                    if (!Directory.Exists(fileDir))
+                    {
+                        Directory.CreateDirectory(fileDir);
+                    }
+
+                    //上传的文件的路径
+                    filePath = fileDir + $@"\酒店费用录入相关文件\{projectFileName}";
+
+
+                    using (FileStream fs = System.IO.File.Create(filePath))
+                    {
+                        file.CopyTo(fs);
+                        fs.Flush();
+                    }
+                    return Ok(JsonView(true, "上传成功!", projectFileName));
+                }
+                else
+                {
+                    return Ok(JsonView(false, "上传失败!"));
+                }
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+
+        }
+        /// <summary>
+        /// 删除指定文件
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> DelFileHotel(DelFileDto dto)
+        {
+            try
+            {
+                string filePath = "";
+                var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
+                // 返回与指定虚拟路径相对应的物理路径即绝对路径
+                int id = 0;
+                filePath = fileDir + "/酒店费用录入相关文件/" + dto.fileName;
+                // 删除该文件
+                System.IO.File.Delete(filePath);
+                id = await _sqlSugar.Updateable<Grp_HotelReservations>().Where(a => a.Id == dto.Id).SetColumns(a => new Grp_HotelReservations { Attachment = "" }).ExecuteCommandAsync();
+
+                if (id != 0)
+                {
+                    return Ok(JsonView(true, "成功!"));
+                }
+                else
+                {
+                    return Ok(JsonView(false, "失败!"));
+                }
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+
+        }
+        /// <summary>
+        /// 生成VOUCHER
+        /// </summary>
+        /// <param name=""></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> HotelGenerate(HotelReservationsByIdDto dto)
+        {
+
+            Grp_HotelReservations h = _sqlSugar.Queryable<Grp_HotelReservations>().First(a => a.Id == dto.Id && a.IsDel == 0);
+
+            //判断数据是否完整
+            if (h != null)
+            {
+                if (!string.IsNullOrEmpty(h.DetermineNo))
+                {
+                    string strFileName = "HotelStatement/";
+                    Grp_DelegationInfo dele= _sqlSugar.Queryable<Grp_DelegationInfo>().First(a => a.Id == h.DiId && a.IsDel == 0);
+                    if (dele != null)
+                        strFileName += dele.TourCode;
+
+                    
+                     //载入模板
+                    string sss = AppSettingsHelper.Get("WordBasePath") + "Template/酒店预订模板.doc";
+
+                    Document doc = new Document(sss);
+                    DocumentBuilder builder = new DocumentBuilder(doc);
+                    try
+                    {
+                        #region 替换Word模板书签内容
+
+                        //这里可以创建个DataTable循环添加书签的值,这里提示一下就不多做修改了
+                        //入住卷预定号码
+                       
+                        if (doc.Range.Bookmarks["VNO"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["VNO"];
+                            mark.Text = h.CheckNumber;
+                        }
+                        //酒店时间
+                        if (doc.Range.Bookmarks["Date"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["Date"];
+                            mark.Text = Convert.ToDateTime(h.CreateTime).ToString("yyyy-MM-dd");
+                        }
+                        //团号
+                        if (doc.Range.Bookmarks["TNo"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["TNo"];
+                            mark.Text = dele.TourCode;
+                        }
+                        //预定号码
+                        if (doc.Range.Bookmarks["BookingId"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["BookingId"];
+                            mark.Text = h.ReservationsNo;
+                        }
+
+                        if (doc.Range.Bookmarks["HotelConfirmNo"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["HotelConfirmNo"];
+                            mark.Text = h.DetermineNo;
+                        }
+
+                        //酒店城市
+                        if (doc.Range.Bookmarks["City"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["City"];
+                            mark.Text = h.City;
+                        }
+                        //酒店名称
+                        if (doc.Range.Bookmarks["HName"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["HName"];
+                            mark.Text = h.HotelName;
+                        }
+                        //酒店地址
+                        if (doc.Range.Bookmarks["Address"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["Address"];
+                            mark.Text = h.HotelAddress;
+                        }
+                        //酒店电话
+                        if (doc.Range.Bookmarks["Tel"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["Tel"];
+                            mark.Text = h.HotelTel;
+                        }
+                        //酒店传真
+                        if (doc.Range.Bookmarks["Fax"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["Fax"];
+                            if (!string.IsNullOrWhiteSpace(h.HotelFax))
+                            {
+                                mark.Text = h.HotelFax;
+                            }
+                            
+                        }
+                        //入住时间
+                        if (doc.Range.Bookmarks["CIn"] != null)
+                        {
+                            DateTime dtCheckIn = Convert.ToDateTime(h.CheckInDate);
+                            Bookmark mark = doc.Range.Bookmarks["CIn"];
+                            mark.Text = dtCheckIn.Day + " " + dtCheckIn.ToString("MMMM", CultureInfo.GetCultureInfo("en-US")) + " " + dtCheckIn.Year;
+                        }
+                        //退房时间
+                        if (doc.Range.Bookmarks["COut"] != null)
+                        {
+                            DateTime dtCheckOut = Convert.ToDateTime(h.CheckOutDate);
+                            Bookmark mark = doc.Range.Bookmarks["COut"];
+                            mark.Text = dtCheckOut.Day + " " + dtCheckOut.ToString("MMMM", CultureInfo.GetCultureInfo("en-US")) + " " + dtCheckOut.Year;
+                        }
+                        //客户名称
+                        if (doc.Range.Bookmarks["GName"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["GName"];
+                            mark.Text = h.GuestName;
+                        }
+
+                        //房间介绍
+                        if (doc.Range.Bookmarks["ROOM"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["ROOM"];
+                            mark.Text = h.RoomExplanation;
+                        }
+
+                        //报价描述
+                        if (doc.Range.Bookmarks["NOTE"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["NOTE"];
+                            Sys_SetData ss = _sqlSugar.Queryable<Sys_SetData>().First(a=>a.Id==h.ReservationsWebsite);
+                            if (ss != null)
+                                mark.Text = ss.Name;
+                        }
+                        //入住时间
+                        if (doc.Range.Bookmarks["CheckIn"] != null)
+                        {
+                            DateTime dtCheckIn = Convert.ToDateTime(h.CheckInDate);
+                            Bookmark mark = doc.Range.Bookmarks["CheckIn"];
+                            mark.Text = dtCheckIn.Day + " " + dtCheckIn.ToString("MMMM", CultureInfo.GetCultureInfo("en-US")) + " " + dtCheckIn.Year + " ";
+                        }
+                        //退房时间
+                        if (doc.Range.Bookmarks["CheckOut"] != null)
+                        {
+                            DateTime dtCheckOut = Convert.ToDateTime(h.CheckOutDate);
+                            Bookmark mark = doc.Range.Bookmarks["CheckOut"];
+                            mark.Text = " " + dtCheckOut.Day + " " + dtCheckOut.ToString("MMMM", CultureInfo.GetCultureInfo("en-US")) + " " + dtCheckOut.Year;
+                        }
+                        //日期
+                        if (doc.Range.Bookmarks["DT"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["DT"];
+                            mark.Text = Convert.ToDateTime(h.CreateTime).ToString("yyyy-MM-dd");
+                        }
+                        //名称
+                        if (doc.Range.Bookmarks["VName"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["VName"];
+                            mark.Text = h.HotelName;
+                        }
+                        //号码
+                        if (doc.Range.Bookmarks["VOUCHERNO"] != null)
+                        {
+                            Bookmark mark = doc.Range.Bookmarks["VOUCHERNO"];
+                            mark.Text = h.CheckNumber;
+                        }
+
+                        #endregion
+                        //string fileName = "HotelStatement/" + diName + "机票费用报表" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
+
+                        strFileName += "VOUCHER.doc";
+
+                        var fileDir = AppSettingsHelper.Get("WordBasePath")+ strFileName;
+                        doc.Save(fileDir);
+                        string Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word" + strFileName;
+                        return Ok(JsonView(true, "成功!", Url));
+
+                        //保存为doc,并打开 
+                        
+                    }
+                    catch (Exception ex)
+                    {
+
+                        throw;
+                    }
+                    
+                }
+                else
+                {
+                    return Ok(JsonView(false, "酒店确定号码未填写,无法生成Voucher!"));
+                }
+            }
+            else
+            {
+                return Ok(JsonView(false, "酒店确定号码未填写,无法生成Voucher!"));
+            }
+            
+        }
+
+
         #endregion
+        /// <summary>
+        /// 导出确认单
+        /// </summary>
+        /// <param name=""></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> ConfirmWord(HotelReservationsByIdDto dto)
+        {
+            //团组信息
+
+            Grp_DelegationInfo di = _sqlSugar.Queryable<Grp_DelegationInfo>().First(a => a.Id == dto.Id);
+
+            //酒店数据
+            List<Grp_HotelReservations> listhoteldata = _sqlSugar.Queryable<Grp_HotelReservations>().Where(a => a.DiId == dto.Id && a.IsDel==0).ToList();
+
+            //利datatable存储
+            DataTable dt = new DataTable();
+            dt.Columns.Add("CheckInDate", typeof(string));
+            dt.Columns.Add("City", typeof(string));
+            dt.Columns.Add("Hotel", typeof(string));
+            dt.Columns.Add("Room", typeof(string));
+
+            for (int i = 0; i < listhoteldata.Count; i++)
+            {
+                DateTime dayStart = Convert.ToDateTime(listhoteldata[i].CheckInDate);
+                DateTime dayEnd = Convert.ToDateTime(listhoteldata[i].CheckOutDate);
+                while (dayStart < dayEnd)
+                {
+                    string temp = "";
+                    DataRow row = dt.NewRow();
+                    row["CheckInDate"] = dayStart.ToString("yyyy-MM-dd");
+                    row["City"] = listhoteldata[i].City;
+                    row["Hotel"] = listhoteldata[i].HotelName;
+                    if (listhoteldata[i].SingleRoomCount > 0)
+                    {
+                        temp = listhoteldata[i].SingleRoomCount + "个单间" + "\r\n";
+                    }
+                    if (listhoteldata[i].DoubleRoomCount > 0)
+                    {
+                        temp = temp + listhoteldata[i].DoubleRoomCount + "个表间" + "\r\n";
+                    }
+                    if (listhoteldata[i].SuiteRoomCount > 0)
+                    {
+                        temp = temp + listhoteldata[i].SuiteRoomCount + "个套房" + "\r\n";
+                    }
+                    if (listhoteldata[i].OtherRoomCount > 0)
+                    {
+                        temp = temp + listhoteldata[i].OtherRoomCount + "个其他房型" + "\r\n";
+                    }
+                    row["Room"] = temp;
+                    dt.Rows.Add(row);
+                    dayStart = dayStart.AddDays(1);
+                }
+            }
 
 
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+            dic.Add("Dele", di.TeamName);
+            dic.Add("City", di.VisitCountry);
+
+
+            //模板路径
+            //string sss = AppSettingsHelper.Get("WordBasePath") + "Template/酒店预订模板.doc";
+            string tempPath = AppSettingsHelper.Get("WordBasePath") + "Template/酒店用房确认单-模板.doc";
+            //载入模板
+            Aspose.Words.Document doc = new Aspose.Words.Document(tempPath);
+            DocumentBuilder builder = new DocumentBuilder(doc);
+
+            foreach (var key in dic.Keys)
+            {
+                builder.MoveToBookmark(key);
+                builder.Write(dic[key]);
+            }
+
+            //获取word里所有表格
+            NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+            //获取所填表格的序数
+            Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
+            var rowStart = tableOne.Rows[0]; //获取第1行
+            try
+            {
+                //循环赋值
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    builder.MoveToCell(0, i + 1, 0, 0);
+                    builder.Write(dt.Rows[i]["CheckInDate"].ToString());
+
+                    builder.MoveToCell(0, i + 1, 1, 0);
+                    builder.Write(dt.Rows[i]["City"].ToString());
+
+                    builder.MoveToCell(0, i + 1, 2, 0);
+                    builder.Write(dt.Rows[i]["Hotel"].ToString());
+
+                    builder.MoveToCell(0, i + 1, 3, 0);
+                    builder.Write(dt.Rows[i]["Room"].ToString());
+                }
+            }
+            catch
+            {
+            }
+            //删除多余行
+
+            while (tableOne.Rows.Count > dt.Rows.Count + 1)
+            {
+                tableOne.Rows.RemoveAt(dt.Rows.Count + 1);
+            }
+            string strFileName = di.TeamName + "酒店确认单.doc";
+            try
+            {
+                doc.Save(AppSettingsHelper.Get("WordBasePath") + "HotelStatement/" + strFileName);
+                string Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/HotelStatement/" + strFileName;
+                return Ok(JsonView(true, "成功", Url));
+            }
+            catch (Exception)
+            {
+                return Ok(JsonView(false, "当前文档已打开,请先关闭!"));
+                throw;
+            }
+            
+            //doc.Save(HttpUtility.UrlEncode(strFileName, Encoding.UTF8), Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInWord, Response);
+            
+        }
+
 
     }
 }

+ 2 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -143,6 +143,8 @@ namespace OASystem.Domain.AutoMappers
             #region 酒店预订
             CreateMap<Grp_HotelReservations, HotelReservationsByIdView>();
             CreateMap<Grp_CreditCardPayment, Grp_CreditCardView>();
+            CreateMap<OpHotelReservationsData, Grp_HotelReservations>();
+            CreateMap<OpHotelReservationsData, Grp_CreditCardPayment>();
             #endregion
 
             #endregion

+ 4 - 0
OASystem/OASystem.Domain/ViewModels/Groups/HotelReservationsByDiIdView.cs

@@ -330,6 +330,10 @@ namespace OASystem.Domain.ViewModels.Groups
         /// 费用标识文本
         /// </summary>
         public int OrbitalPrivateTransferStr { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string Remark { get; set; }
 
     }
     /// <summary>

+ 276 - 8
OASystem/OASystem.Infrastructure/Repositories/Groups/HotelPriceRepository.cs

@@ -1,8 +1,10 @@
 using AutoMapper;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Groups;
+using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Groups;
+using OASystem.Infrastructure.Tools;
 using SqlSugar;
 using System;
 using System.Collections.Generic;
@@ -20,7 +22,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
         {
             this._mapper = mapper;
         }
-
+        /// <summary>
+        /// 付款金额计算
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
         public async Task<Result> HotelConversionAmounts(HotelReservationsCNYDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
@@ -33,8 +39,79 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     reservationsView.CurrencyId = dto.CardPriceCurrency;
                     reservationsView.Price=Convert.ToDecimal((dto.CardPrice+dto.GovernmentRent+dto.CityTax).ToString("F2"));
                     reservationsView.CurrencyName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == dto.CardPriceCurrency).Name;
+                    return result = new Result() { Code = 0, Msg = "查询成功", Data = reservationsView };
+                }
+                else
+                {
+                    Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 76);
+                    List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
+                    decimal CardPrice = 0.00M;
+                    decimal GovernmentRent = 0.00M;
+                    decimal CityTax = 0.00M;
+                    if (_TeamRate != null)
+                    {
+                        Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == dto.CardPriceCurrency);
+                        if (_SetData != null)
+                        {
+                            if (_SetData.Name=="CNY")
+                            {
+                                CardPrice = dto.CardPrice;
+                            }
+                            else
+                            {
+                                currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
+                                CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
+                                if (CurrencyRate != null) CardPrice = dto.CardPrice * Convert.ToDecimal(CurrencyRate.Rate);
+                                else return result = new Result() { Code = -1, Msg = "暂未设置团组汇率,请前往设置!", Data = reservationsView };
+                            }
+                        }
+                        else return result = new Result() { Code = -1, Msg = "暂未设置团组汇率,请前往设置!", Data = reservationsView };
+
+                        Sys_SetData _SetData1 = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == dto.GovernmentRentCurrency);
+                        if (_SetData1 != null)
+                        {
+                            if (_SetData1.Name == "CNY")
+                            {
+                                GovernmentRent = dto.GovernmentRent;
+                            }
+                            else {
+                                currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
+                                CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData1.Name);
+                                if (CurrencyRate != null) GovernmentRent = dto.GovernmentRent * Convert.ToDecimal(CurrencyRate.Rate);
+                                else return result = new Result() { Code = -1, Msg = "暂未设置团组汇率,请前往设置!", Data = reservationsView };
+                            }
+                                
+                        }
+                        else return result = new Result() { Code = -1, Msg = "暂未设置团组汇率,请前往设置!", Data = reservationsView };
+
+                        Sys_SetData _SetData2 = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == dto.CityTaxCurrency);
+                        if (_SetData2 != null)
+                        {
+                            if (_SetData2.Name == "CNY")
+                            {
+                                CityTax = dto.CityTax;
+                            }
+                            else
+                            {
+                                currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
+                                CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData2.Name);
+                                if (CurrencyRate != null) CityTax = dto.CityTax * Convert.ToDecimal(CurrencyRate.Rate);
+                                else return result = new Result() { Code = -1, Msg = "暂未设置团组汇率,请前往设置!", Data = reservationsView };
+                            }
+                        }
+                        else return result = new Result() { Code = -1, Msg = "暂未设置团组汇率,请前往设置!", Data = reservationsView };
+                       
+                        reservationsView.CurrencyId = 836;
+                        reservationsView.Price = Convert.ToDecimal((CardPrice + GovernmentRent + CityTax).ToString("F2"));
+                        reservationsView.CurrencyName ="CNY";
+
+                        return result = new Result() { Code = 0, Msg = "查询成功", Data = reservationsView };
+                    }
+                    else
+                    {
+                       return result = new Result() { Code = -1, Msg = "暂未设置团组汇率,请前往设置!", Data= reservationsView };
+                    }
                 }
-                return result=new Result() { Code = 0, Msg = "查询成功",Data= reservationsView };
             }
             catch (Exception ex)
             {
@@ -43,6 +120,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
             }
         }
 
+       
+        /// <summary>
+        /// 根据团组id查询酒店数据
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
         public async Task<Result> HotelReservationsByDiId(HotelReservationsByDiIdDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
@@ -82,6 +165,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         else if (item.IsAuditGM == 2) item.IsAuditGMStr = "未通过";
                         else if (item.IsAuditGM == 3) item.IsAuditGMStr = "自动审核";
 
+                        item.CheckInDate=DateTime.Parse(item.CheckInDate).ToString("yyyy-MM-dd");
+                        item.CheckOutDate = DateTime.Parse(item.CheckOutDate).ToString("yyyy-MM-dd");
+
                     }
                     return result = new Result() { Code = 0, Msg = "查询成功!", Data = hotelDataList };
                 }
@@ -104,6 +190,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         else if (item.IsAuditGM == 1) item.IsAuditGMStr = "已通过";
                         else if (item.IsAuditGM == 2) item.IsAuditGMStr = "未通过";
                         else if (item.IsAuditGM == 3) item.IsAuditGMStr = "自动审核";
+                        item.CheckInDate = DateTime.Parse(item.CheckInDate).ToString("yyyy-MM-dd");
+                        item.CheckOutDate = DateTime.Parse(item.CheckOutDate).ToString("yyyy-MM-dd");
                     }
                     string CountSql = string.Format(@"Select COUNT(1) as Count From (	
                                                         Select h.Id,s1.Name as GuestType,h.ReservationsNo,h.HotelName,h.CheckInDate,
@@ -140,7 +228,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 throw;
             }
         }
-
+        /// <summary>
+        /// 根据酒店费用Id查询详细数据
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
         public async Task<Result> HotelReservationsById(HotelReservationsByIdDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
@@ -174,11 +266,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 string Sql = string.Format(@"select c.PayDId, s.Name asPayDIdStr,c.ConsumptionPatterns,c.ConsumptionDate,c.CTDId,
                                             s1.Name as CTDIdStr,c.BankNo,c.CardholderName,c.PayMoney,c.PaymentCurrency,s2.Name
                                             as PaymentCurrencyStr,c.DayRate,c.CompanyBankNo,c.OtherBankName,c.OtherSideNo,c.OtherSideName,
-                                            c.IsAuditGM,c.Payee,c.RMBPrice,c.OrbitalPrivateTransfer from Grp_CreditCardPayment c
+                                            c.IsAuditGM,c.Payee,c.RMBPrice,c.OrbitalPrivateTransfer,c.Remark from Grp_CreditCardPayment c
                                             left join Sys_SetData s on c.PayDId=s.Id
                                             left join Sys_SetData s1 on c.CTDId=s1.Id
                                             left join Sys_SetData s2 on c.PaymentCurrency=s2.Id
-                                            where c.CId ={0} and c.IsDel = 0 and c.CTable = 76",dto.Id);
+                                            where c.CId ={0} and c.IsDel = 0 and c.CTable = 76", dto.Id);
                 Grp_CreditCardView _CreditCardPayment = _sqlSugar.SqlQueryable<Grp_CreditCardView>(Sql).First();
                 if (_CreditCardPayment!=null)
                 {
@@ -197,7 +289,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 throw;
             }
         }
-
+        /// <summary>
+        /// 酒店页面下拉框等初始化
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
         public async Task<Result> HotelReservationsInitialize(HotelReservationsDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
@@ -259,10 +355,182 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 throw;
             }
         }
-
+        /// <summary>
+        /// 酒店操作
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        /// <exception cref="NotImplementedException"></exception>
         public async Task<Result> OpHotelReservations(OpHotelReservationsData dto)
         {
-            throw new NotImplementedException();
+            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            try
+            {
+                BeginTran();
+                int id = dto.Id;
+                Grp_HotelReservations hotelPrice = _mapper.Map<Grp_HotelReservations>(dto);
+                hotelPrice.IsCardPrice = hotelPrice.CardPrice!=0 ? 1:0;
+                hotelPrice.CboOne=hotelPrice.SingleRoomCount !=0 ? 1 : 0;
+                hotelPrice.CboTwo = hotelPrice.DoubleRoomCount != 0 ? 1 : 0;
+                hotelPrice.CboThree = hotelPrice.SuiteRoomCount != 0 ? 1 : 0;
+                hotelPrice.CboFour = hotelPrice.SuiteRoomCount != 0 ? 1 : 0;
+
+                Grp_CreditCardPayment c = _mapper.Map<Grp_CreditCardPayment>(dto);
+                c.Remark = dto.CRemark;
+                c.PayPercentage = 100;
+                c.CTable = 76;
+                c.CId = id;
+                c.IsAuditGM = 0;
+                if (c.PayDId == 72)
+                {
+                    c.IsPay = 1;
+                }
+                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 == 76);
+                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)
+                    {
+                        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;
+                        }
+                    }
+                }
+
+                if (dto.Status == 1)//添加
+                {
+                    Grp_HotelReservations grp_Hotel = _sqlSugar.Queryable<Grp_HotelReservations>().First(a => a.IsDel == 0 && a.HotelName == dto.HotelName && a.GuestName == dto.GuestName &&
+                    a.CheckInDate == dto.CheckInDate && a.CheckOutDate==dto.CheckOutDate && a.City==dto.City);
+                    if (grp_Hotel != null)
+                    {
+                        return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
+                    }
+                    else
+                    {
+                        id = await AddAsyncReturnId(hotelPrice);
+                        if (id != 0)
+                        {
+                            c.CId = id;
+                            int cId = await _sqlSugar.Insertable(c).ExecuteReturnIdentityAsync();
+                            if (cId != 0)
+                            {
+                                result = new Result() { Code = 0, Msg = "添加成功!" };
+
+                            }
+                            else
+                            {
+                                RollbackTran();
+                                result = new Result() { Code = -1, Msg = "添加失败!" };
+                            }
+                        }
+                        else
+                        {
+                            RollbackTran();
+                            result = new Result() { Code = -1, Msg = "添加失败,请稍后重试!" };
+                        }
+                    }
+
+                }
+                else if (dto.Status == 2)//修改
+                {
+                    bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Grp_HotelReservations
+                    {
+                        GTId=hotelPrice.GTId,
+                        CheckNumber=hotelPrice.CheckNumber,
+                        ReservationsWebsite=hotelPrice.ReservationsWebsite,
+                        ReservationsNo=hotelPrice.ReservationsNo,
+                        DetermineNo=hotelPrice.DetermineNo,
+                        City=hotelPrice.City,
+                        HotelName=hotelPrice.HotelName,
+                        HotelAddress=hotelPrice.HotelAddress,
+                        HotelTel=hotelPrice.HotelTel,
+                        GuestName=hotelPrice.GuestName,
+                        CheckInDate=hotelPrice.CheckInDate,
+                        BudgetCurrency=hotelPrice.BudgetCurrency,
+                        CheckOutDate=hotelPrice.CheckOutDate,
+                        SingleRoomCount=hotelPrice.SingleRoomCount,
+                        SingleRoomPrice=hotelPrice.SingleRoomPrice,
+                        DoubleRoomCount=hotelPrice.DoubleRoomCount,
+                        DoubleRoomPrice=hotelPrice.DoubleRoomPrice,
+                        SuiteRoomCount=hotelPrice.SuiteRoomCount,
+                        SuiteRoomPrice=hotelPrice.SuiteRoomPrice,
+                        OtherRoomCount=hotelPrice.OtherRoomCount,
+                        OtherRoomPrice=hotelPrice.OtherRoomPrice,
+                        RoomExplanation=hotelPrice.RoomExplanation,
+                        Attachment=hotelPrice.Attachment,
+                        CardPrice=hotelPrice.CardPrice,
+                        IsCardPrice=hotelPrice.IsCardPrice,
+                        PredictSingleRoom=hotelPrice.PredictSingleRoom,
+                        PredictDoubleRoom=hotelPrice.PredictDoubleRoom,
+                        PredictSuiteRoom=hotelPrice.PredictSuiteRoom,
+                        PredictOtherRoom=hotelPrice.PredictOtherRoom,
+                        GovernmentRent=hotelPrice.GovernmentRent,
+                        GovernmentRentCurrency=hotelPrice.GovernmentRentCurrency,
+                        CityTax=hotelPrice.CityTax,
+                        CityTaxCurrency=hotelPrice.CityTaxCurrency,
+                        CheckType=hotelPrice.CheckType,
+                        CboOne=hotelPrice.SingleRoomCount,
+                        CboTwo=hotelPrice.DoubleRoomCount,
+                        CboThree=hotelPrice.SuiteRoomCount,
+                        CboFour=hotelPrice.SuiteRoomCount,
+                        CreateUserId=hotelPrice.CreateUserId,
+                        Remark=hotelPrice.Remark
+                    });
+                    if (res)
+                    {
+                        int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>().Where(a => a.CId == hotelPrice.Id && a.CTable == 76).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
+                        {
+                            result = new Result() { Code = 0, Msg = "修改成功!" };
+                        }
+                        
+                    }
+                    else
+                    {
+                        RollbackTran();
+                        result = new Result() { Code = -1, Msg = "修改失败,请稍后重试!" };
+                    }
+                }
+                CommitTran();
+            }
+            catch (Exception ex)
+            {
+                return result = new Result() { Code = -2, Msg = "未知错误" };
+                throw;
+            }
+            return result;
         }
     }
 }