/// <summary> /// 导出 /// </summary> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="outTradeNo"></param> /// <param name="orderNo"></param> /// <returns></returns> public FileResult ExportCashExcel(DateTime?startTime, DateTime?endTime, string outTradeNo, string orderNo) { ExportExcelContext export = new ExportExcelContext("Excel2003"); DataTable dt = new DataTable("账户明细"); List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { //new KeyValuePair<string,Type>("流水号",typeof(string)), new KeyValuePair <string, Type>("交易号", typeof(string)), new KeyValuePair <string, Type>("日期", typeof(DateTime)), new KeyValuePair <string, Type>("收支(元)", typeof(decimal)), //new KeyValuePair<string,Type>("支付方式 ",typeof(string)), new KeyValuePair <string, Type>("账户余额(元) ", typeof(decimal)), new KeyValuePair <string, Type>("备注 ", typeof(string)), }; headArray.ForEach(p => dt.Columns.Add(p.Key, p.Value)); CommunicateManager.Invoke <IAccountService>(service => { endTime = endTime != null ? endTime.Value.AddDays(1).AddSeconds(-1) : endTime; service.GetReadyAccountDetails(startTime, endTime, outTradeNo, orderNo, 0, 65535).List.ForEach(m => { dt.Rows.Add( // m.SerialNum, m.OutTradeNo, m.CreateAmount, m.Amount, //m.PayType, m.LeaveAmount, m.OperationType ); }); }); return(File(export.GetMemoryStream(dt), "application/ms-excel", HttpUtility.UrlEncode(string.Format("{1}.{0}", export.TypeName, dt.TableName + DateTime.Now.ToString("yyyyMMdd")), Encoding.UTF8))); }
//导出excel public ActionResult ExportExcel(string code, string name, DateTime?startTime, DateTime?endTime, string exportType) { ExportExcelContext export = new ExportExcelContext(exportType); DataTable dt = new DataTable("商户信息"); List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("商户号", typeof(string)), new KeyValuePair <string, Type>("商户名称", typeof(string)), new KeyValuePair <string, Type>("业务员", typeof(string)), new KeyValuePair <string, Type>("业务员电话", typeof(string)), new KeyValuePair <string, Type>("联系人", typeof(string)), new KeyValuePair <string, Type>("联系电话", typeof(string)), new KeyValuePair <string, Type>("联系地址", typeof(string)), new KeyValuePair <string, Type>("状态", typeof(string)), new KeyValuePair <string, Type>("创建时间", typeof(string)) }; headArray.ForEach(p => dt.Columns.Add(p.Key, p.Value)); CommunicateManager.Invoke <IConsoBusinessmanService>(p => { p.GetBusinessmanBuyerByCode(code, name, startTime, endTime, 1, 1000).Rows.ForEach(n => { dt.Rows.Add(n.Code, n.Name, n.ContactName, n.Phone, n.ContactWay.Contact, n.ContactWay.Tel, n.ContactWay.Address, n.IsEnable ? "正常" : "禁用", n.CreateTime); }); }); return(File(export.GetMemoryStream(dt), "application/ms-excel", HttpUtility.UrlEncode(string.Format("{1}.{0}", export.TypeName, dt.TableName + DateTime.Now.ToString("yyyyMMdd")), System.Text.Encoding.UTF8))); }
public bool Execute() { var unitOfWork = ObjectFactory.GetNamedInstance<IUnitOfWork>(EnumModule.SystemSetting.ToString()); var unitOfWorkRepository = ObjectFactory.GetNamedInstance<IUnitOfWorkRepository>(EnumModule.SystemSetting.ToString()); var openScanRepository = ObjectFactory.GetInstance<IOPENScanRepository>(); var pidService = ObjectFactory.GetInstance<BPiaoBao.AppServices.DomesticTicket.PidService>(); var scanList = openScanRepository.FindAll(p => p.State == EnumOPEN.NoScan).ToList(); if (scanList.Count == 0) return false; scanList.ForEach(p => { p.State = EnumOPEN.Scanning; unitOfWorkRepository.PersistUpdateOf(p); }); unitOfWork.Commit(); Parallel.ForEach(scanList, (item) => { string result = HttpHelper.Get(item.TemplateName); var ticketNumList = result.Split(new string[] { "\r", "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(); OpenTicketResponse openTicketResponse = pidService.ScanOpenTicket(item.IP, item.Port.ToString(), item.OfficeNum, ticketNumList); item.ScanCount = openTicketResponse.OpenTKList.Count; item.OPENCount = openTicketResponse.OpenTKList.Where(p => string.Equals(p.TKStatus, "OPEN FOR USE", StringComparison.OrdinalIgnoreCase)).Count(); item.State = EnumOPEN.Scaned; unitOfWorkRepository.PersistUpdateOf(item); DataTable dt = new DataTable(item.TemplateName); List<KeyValuePair<string, Type>> headArray = new List<KeyValuePair<string, Type>> { new KeyValuePair<string,Type>("票号",typeof(string)), new KeyValuePair<string,Type>("扫描状态",typeof(string)), new KeyValuePair<string,Type>("扫描OFFICE",typeof(string)), new KeyValuePair<string,Type>("备注",typeof(string)) }; headArray.ForEach(p => dt.Columns.Add(p.Key, p.Value)); openTicketResponse.OpenTKList.ForEach(p => dt.Rows.Add(p.TKNumber, p.TKStatus, item.OfficeNum, p.DetrData)); ExportExcelContext export = new ExportExcelContext("Excel2003"); item.TemplateUrl = export.Write(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Export"), dt); }); unitOfWork.Commit(); return true; }
/// <summary> /// 航变信息导出EXCEL表 /// </summary> /// <param name="qtDate"></param> /// <param name="qtDateTime"></param> /// <param name="?"></param> /// <returns></returns> public FileResult ExportExcelAriChang(DateTime?startDate, DateTime?endDate, string startTime, string endTime, string PNR, string Passenger, bool?statue) { ExportExcelContext export = new ExportExcelContext("Excel2003"); DataTable dt = new DataTable("航变信息"); List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("qt日期", typeof(string)), new KeyValuePair <string, Type>("qt时间", typeof(string)), new KeyValuePair <string, Type>("qt条数", typeof(string)), new KeyValuePair <string, Type>("商户信息", typeof(string)), new KeyValuePair <string, Type>("PNR", typeof(string)), new KeyValuePair <string, Type>("订单号", typeof(string)), new KeyValuePair <string, Type>("CTCT", typeof(string)), new KeyValuePair <string, Type>("乘机人", typeof(string)), new KeyValuePair <string, Type>("出票", typeof(string)), new KeyValuePair <string, Type>("通知方式", typeof(string)), }; headArray.ForEach(p => dt.Columns.Add(p.Key, p.Value)); BPiaoBao.AppServices.StationContracts.StationMap.PagedList <ResponeAirChange> list = _service.GetAirChangeList(startDate, endDate, startTime, endTime, PNR, Passenger, statue, 1, 10000); list.Rows.ForEach( x => { dt.Rows.Add( x.QTDate.ToString("yyyy-MM-dd"), x.QTDate.ToString("HH:mm"), x.QTCount, x.BusinessmanName, x.PNR, x.OrderId, x.CTCT, string.Join("|", x.PassengerName), x.OfficeNum, ((EnumAriChangNotifications)x.NotifyWay).ToEnumDesc() ); }); return(File(export.GetMemoryStream(dt), "application/ms-excel", HttpUtility.UrlEncode(string.Format(dt.TableName + ".{0}", export.TypeName), System.Text.Encoding.UTF8))); }
/// <summary> /// 商户分类数据导出 /// </summary> /// <returns></returns> public ActionResult ImportStatistics(string BusinessmanCode, string BusinessmanName, string exportType) { ExportExcelContext export = new ExportExcelContext(exportType); DataTable dt = new DataTable("行程单商户分类"); List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("商户名称", typeof(string)), new KeyValuePair <string, Type>("商户号", typeof(string)), new KeyValuePair <string, Type>("全部行程单", typeof(string)), new KeyValuePair <string, Type>("已使用", typeof(string)), new KeyValuePair <string, Type>("未使用", typeof(string)), new KeyValuePair <string, Type>("可使用", typeof(string)), new KeyValuePair <string, Type>("已作废", typeof(string)) }; headArray.ForEach(p => dt.Columns.Add(p.Key, p.Value)); using (ChannelFactory <ITravelPaperService> cf = new ChannelFactory <ITravelPaperService>(typeof(ITravelPaperService).Name)) { var client = cf.CreateChannel(); TravelPaperStaticsDto travelPaperStaticsDto = client.FindTravelPaperStatistics(BusinessmanCode, BusinessmanName); travelPaperStaticsDto.ItemStaticsList.Add(travelPaperStaticsDto.Total); travelPaperStaticsDto.ItemStaticsList.ForEach(p => { dt.Rows.Add( p.UseBusinessmanName, p.UseBusinessmanCode, p.TotalCount, p.TotalUse, p.TotalNoUse, p.TotalValidateUse, p.TotalVoid ); }); } return(File(export.GetMemoryStream(dt), "application/ms-excel", HttpUtility.UrlEncode(string.Format("商户分类查询_{0}.{1}", System.DateTime.Now.ToString("yyy-MM-ddHHMMss"), export.TypeName), System.Text.Encoding.UTF8))); }
/// <summary> /// 机票明细导出(供应) /// <returns></returns> public FileResult ExportExcelSupplierTicketDetail(string OrderId, string PNR, DateTime?StartIssueRefundTime, DateTime?EndIssueRefundTime, string TicketNumber, string PlatformCode, string PolicyType, string CarrayCode, string FromCity, string ToCity, string TicketStatus, string BusinessmanCode, string OperatorAccount, int?PayWay) { ExportExcelContext export = new ExportExcelContext("Excel2003"); DataTable dt = new DataTable("机票明细报表"); List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("订单号", typeof(string)), new KeyValuePair <string, Type>("Pnr编码", typeof(string)), new KeyValuePair <string, Type>("大编码", typeof(string)), new KeyValuePair <string, Type>("票号", typeof(string)), new KeyValuePair <string, Type>("实收金额", typeof(decimal)), new KeyValuePair <string, Type>("机票状态", typeof(string)), new KeyValuePair <string, Type>("(出/退)票时间", typeof(string)), new KeyValuePair <string, Type>("起飞时间", typeof(string)), new KeyValuePair <string, Type>("承运人", typeof(string)), new KeyValuePair <string, Type>("航班号", typeof(string)), new KeyValuePair <string, Type>("舱位", typeof(string)), new KeyValuePair <string, Type>("航程", typeof(string)), new KeyValuePair <string, Type>("乘机人", typeof(string)), new KeyValuePair <string, Type>("舱位价", typeof(decimal)), new KeyValuePair <string, Type>("机建费", typeof(decimal)), new KeyValuePair <string, Type>("燃油费", typeof(decimal)), new KeyValuePair <string, Type>("票面价", typeof(decimal)), new KeyValuePair <string, Type>("政策点数", typeof(decimal)) }; headArray.ForEach(p => dt.Columns.Add(p.Key, p.Value)); TicketDetailSearch ticketquery = new TicketDetailSearch() { orderId = OrderId, pnr = PNR, ticketNumber = TicketNumber, platformCode = PlatformCode, policyType = PolicyType, carrayCode = CarrayCode, fromCity = FromCity, toCity = ToCity, ticketStatus = TicketStatus, businessmanCode = BusinessmanCode, operatorAccount = OperatorAccount, startIssueRefundTime = StartIssueRefundTime, endIssueRefundTime = EndIssueRefundTime.Value.AddHours(23).AddMinutes(59).AddSeconds(59), PayWay = PayWay, page = 1, rows = 10000 }; PagedList <ResponseTicket> dp = null; CommunicateManager.Invoke <IConsoOrderService>(p => dp = p.GetConsoTicketSumDetail(ticketquery) ); dp.Rows.ForEach(p => { dt.Rows.Add( p.OrderID, p.PNR, p.BigCode, p.TicketNum, p.Money, p.TicketState, p.CreateDate, p.StartTime, p.CarryCode, p.FlightNum, p.Seat, p.Voyage, p.PassengerName, p.SeatPrice, p.ABFee, p.RQFee, p.PMFee, p.PolicyPoint ); }); return(File(export.GetMemoryStream(dt), "application/ms-excel", HttpUtility.UrlEncode(string.Format(dt.TableName + ".{0}", export.TypeName), System.Text.Encoding.UTF8))); }
public FileResult Export(BehaviorStatModel query) { ExportExcelContext export = new ExportExcelContext("Excel2003"); DataTable dt = new DataTable("用户行为"); List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { // new KeyValuePair<string,Type>("查询日期",typeof(string)), new KeyValuePair <string, Type>("业务经理", typeof(string)), // new KeyValuePair<string,Type>("操作员",typeof(string)), new KeyValuePair <string, Type>("商户号", typeof(string)), new KeyValuePair <string, Type>("公司名称", typeof(string)), new KeyValuePair <string, Type>("商户类型", typeof(string)), new KeyValuePair <string, Type>("登录次数", typeof(int)), new KeyValuePair <string, Type>("(机票)查询次数", typeof(int)), new KeyValuePair <string, Type>("(机票)导入次数 ", typeof(int)), new KeyValuePair <string, Type>("(机票)出票量 ", typeof(int)), new KeyValuePair <string, Type>("(机票)退票量 ", typeof(int)), new KeyValuePair <string, Type>("(机票)废票量 ", typeof(int)), new KeyValuePair <string, Type>("(理财)访问次数 ", typeof(int)), new KeyValuePair <string, Type>("(理财)理财笔数 ", typeof(int)), new KeyValuePair <string, Type>("(信用)使用笔数 ", typeof(int)), }; headArray.ForEach(p => dt.Columns.Add(p.Key, p.Value)); var queryCon = new RequestQueryBehaviorStatQuery(); queryCon.BusinessmanCode = query.BusinessmanCode; queryCon.BusinessmanName = query.BusinessmanName; queryCon.BusinessmanType = query.BusinessmanType; queryCon.StartDateTime = Convert.ToDateTime(query.StartDateTime); queryCon.EndDateTime = Convert.ToDateTime(query.EndDateTime); queryCon.PageIndex = 1; queryCon.PageSize = 65535; queryCon.Sort = query.sort; queryCon.Order = query.order; CommunicateManager.Invoke <IBehaviorStatService>(service => { service.Query(queryCon).List.ForEach(m => { var businessType = ""; if (m.BusinessmanType.ToLower().Equals("buyer")) { businessType = "采购商"; } else if (m.BusinessmanType.ToLower().Equals("supplier")) { businessType = "供应商"; } else { businessType = "运营商"; } dt.Rows.Add( // m.OpDateTime.ToString("yyyy-MM-dd"), m.ContactName, // m.OperatorName, m.BusinessmanCode, m.BusinessmanName, businessType, m.LoginCount, m.QueryCount, m.ImportCount, m.OutTicketCount, m.BackTicketCount, m.AbolishTicketCount, m.AccessCount, m.FinancingCount, m.UseCount ); }); }); return(File(export.GetMemoryStream(dt), "application/ms-excel", HttpUtility.UrlEncode(string.Format("{1}.{0}", export.TypeName, dt.TableName + query.StartDateTime + "至" + query.EndDateTime), Encoding.UTF8))); }
/// <summary> /// 空白行程单详情导出 空白行程单管理 /// </summary> /// <returns></returns> public ActionResult ImportTravelDetail(string UseBusinessmanCode, string UseBusinessmanName, string startTripNumber, string endTripNumber, string startTicketNumber, string endTicketNumber, string useOffice, int?TripStatus, DateTime?startGrantTime, DateTime?endGrantTime, DateTime?startCreateTime, DateTime?endCreateTime, DateTime?startVoidTime, DateTime?endVoidTime, string exportType, string BuyerType, int page = 1, int rows = 10) { DateTime defaultTime = DateTime.Parse("1900-01-01"); ExportExcelContext export = new ExportExcelContext(exportType); DataTable table = new DataTable(); if (string.IsNullOrEmpty(BuyerType)) { table.TableName = "空白行程单管理"; List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("商户名称", typeof(string)), new KeyValuePair <string, Type>("商户号", typeof(string)), new KeyValuePair <string, Type>("Office", typeof(string)), new KeyValuePair <string, Type>("行程单号", typeof(string)), new KeyValuePair <string, Type>("行程单状态", typeof(string)), new KeyValuePair <string, Type>("回收时间", typeof(string)), new KeyValuePair <string, Type>("分配时间", typeof(string)) }; headArray.ForEach(p => table.Columns.Add(p.Key, p.Value)); } else if (BuyerType == "0")// 采购详情 { table.TableName = "行程单详情"; List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("领用商户名", typeof(string)), new KeyValuePair <string, Type>("行程单号", typeof(string)), new KeyValuePair <string, Type>("Office号", typeof(string)), new KeyValuePair <string, Type>("票号", typeof(string)), new KeyValuePair <string, Type>("状态", typeof(string)), new KeyValuePair <string, Type>("分配时间", typeof(string)), new KeyValuePair <string, Type>("回收时间", typeof(string)), new KeyValuePair <string, Type>("创建打印时间", typeof(string)), new KeyValuePair <string, Type>("作废时间", typeof(string)), new KeyValuePair <string, Type>("备注", typeof(string)) }; headArray.ForEach(p => table.Columns.Add(p.Key, p.Value)); } else if (BuyerType == "1")//行程单综合查询 { table.TableName = "行程单综合查询"; List <KeyValuePair <string, Type> > headArray = new List <KeyValuePair <string, Type> > { new KeyValuePair <string, Type>("商户名", typeof(string)), new KeyValuePair <string, Type>("商户号", typeof(string)), new KeyValuePair <string, Type>("Office", typeof(string)), new KeyValuePair <string, Type>("票号", typeof(string)), new KeyValuePair <string, Type>("行程单号", typeof(string)), new KeyValuePair <string, Type>("状态", typeof(string)), new KeyValuePair <string, Type>("回收时间", typeof(string)), new KeyValuePair <string, Type>("分配时间", typeof(string)), new KeyValuePair <string, Type>("创建时间", typeof(string)), new KeyValuePair <string, Type>("作废时间", typeof(string)) }; headArray.ForEach(p => table.Columns.Add(p.Key, p.Value)); } using (ChannelFactory <ITravelPaperService> cf = new ChannelFactory <ITravelPaperService>(typeof(ITravelPaperService).Name)) { var client = cf.CreateChannel(); DataPack <TravelPaperDto> datapackList = client.FindTravelPaper(UseBusinessmanCode, UseBusinessmanName, useOffice, startTripNumber, endTripNumber, startTicketNumber, endTicketNumber , startCreateTime, endCreateTime, startVoidTime, endVoidTime, startGrantTime, endGrantTime, null, null, (string.IsNullOrEmpty(BuyerType) ? "black" : ""), TripStatus, page, rows, false); List <TravelPaperDto> TravelPaperList = datapackList.List; if (string.IsNullOrEmpty(BuyerType)) { TravelPaperList.ForEach(p => { table.Rows.Add( p.BusinessmanName, p.BusinessmanCode, p.UseOffice, p.TripNumber, EnumItemManager.GetDesc(p.TripStatus), p.BlankRecoveryTime > defaultTime ? p.BlankRecoveryTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.GrantTime > defaultTime ? p.GrantTime.ToString("yyyy-MM-dd HH:mm:ss") : "" ); }); } else if (BuyerType == "0")// 采购详情 { TravelPaperList.ForEach(p => { table.Rows.Add( p.BusinessmanName, p.TripNumber, p.UseOffice, p.TicketNumber, EnumItemManager.GetDesc(p.TripStatus), p.GrantTime > defaultTime ? p.GrantTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.BlankRecoveryTime > defaultTime ? p.BlankRecoveryTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.PrintTime > defaultTime ? p.PrintTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.InvalidTime > defaultTime ? p.InvalidTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.UseTripRemark ); }); } else if (BuyerType == "1")// 综合查询 { TravelPaperList.ForEach(p => { table.Rows.Add( p.BusinessmanName, p.BusinessmanCode, p.UseOffice, p.TicketNumber, p.TripNumber, EnumItemManager.GetDesc(p.TripStatus), p.BlankRecoveryTime > defaultTime ? p.BlankRecoveryTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.GrantTime > defaultTime ? p.GrantTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.PrintTime > defaultTime ? p.PrintTime.ToString("yyyy-MM-dd HH:mm:ss") : "", p.InvalidTime > defaultTime ? p.InvalidTime.ToString("yyyy-MM-dd HH:mm:ss") : "" ); }); } } return(File(export.GetMemoryStream(table), "application/ms-excel", HttpUtility.UrlEncode(string.Format("{0}_{1}.{2}", table.TableName, System.DateTime.Now.ToString("yyy-MM-ddHHMMss"), export.TypeName), System.Text.Encoding.UTF8))); }