public void GetData() { #region 获取文件 ApplyNoBasicEntity applyNoBasicEntity = new ApplyNoBasicEntity(); applyNoBasicEntity.ApplyNoPrefix = ApplyNoPrefix; //"DSC04"; applyNoBasicEntity.Company = Company; //"DSC"; applyNoBasicEntity.ConnStr = ConnStr; applyNoBasicEntity.LinksType = new LinkType(LinkType.LinksFalse); //applyNoBasicEntity.FktzsProcessType = new FKTZSProcessType(FKTZSProcessType.FKTZS_YC); //applyNoBasicEntity.FktzsYcWcType = new FKTZSYCWCType(FKTZSYCWCType.YC); IFKTZSMainStartApp fktzsMainStartApp = new FKTZSMainStartApp(); List <AccVouch> listAccvouch = fktzsMainStartApp.Load(applyNoBasicEntity); AccvouchEntityConvertStreamBaseManager accvouchEntityConvertStreamBaseManager = new AccvouchEntityConvertStreamBaseManager(); StringBuilder sb = new StringBuilder(); foreach (AccVouch item in listAccvouch) { sb.AppendLine(accvouchEntityConvertStreamBaseManager.GetVouchString(item)); } #endregion #region 文件保存1 SaveFileEntityCollection saveFileEntityCollection = new SaveFileEntityCollection(); saveFileEntityCollection.UpdateLinkQueueSql = GetUpdateSapLinkQueue(fktzsMainStartApp.GetApplyNoEntitys());//获取队列applyNo集合 SaveFileEntity saveFileEntity = new SaveFileEntity(); saveFileEntity.SetFileNamePrefix(FileNamePrefix).SetFileNameMiddle(string.Format("_{0}_{1}", SapCD, DateTime.Now.ToString("yyyyMMddHHmm"))) .SetFileNameSuffix(FileNameSuffix).SetFilePath(FilePath).SetContent(sb.ToString()); saveFileEntityCollection.Add(saveFileEntity); ISaveFileProvider iSaveFileProvider = new SaveFileDBProvider(ConnStr); iSaveFileProvider.SaveFile(saveFileEntityCollection); #endregion #region 保存文件2 #endregion }
public void Start() { //T_SAP_COMPANYFUNDS_LINKS_QUEUE queue = new T_SAP_COMPANYFUNDS_LINKS_QUEUE(); Dictionary <string, List <RecList> > dic = new Dictionary <string, List <RecList> >(); Dictionary <string, T_SAP_COMPANYFUNDS_LINKS_QUEUE> dicQ = new Dictionary <string, T_SAP_COMPANYFUNDS_LINKS_QUEUE>(); //MLog.Log.Info("aaa").Info("11111"); try { LogInfo.Log.Info("职工机购买-收据开具SAP连携"); RecEntity recEntity = new RecEntity(); recEntity.GetSqlByList(ref dic, ref dicQ); } catch (Exception ex) { LogInfo.Log.Info("职工机购买-收据开具SAP连携——异常:" + ex.Message); } try { LogInfo.Log.Info("限时特卖-收据开具SAP连携"); SpecialSaleEntity sse = new SpecialSaleEntity(); sse.SyncSap(ref dic, ref dicQ); } catch (Exception ex) { LogInfo.Log.Info("限时特卖-收据开具SAP连携——异常:" + ex.Message); } try { LogInfo.Log.Info("解限SAP连携"); JXBatchListEntity jx = new JXBatchListEntity(); jx.SyncSap(ref dic, ref dicQ); } catch (Exception ex) { LogInfo.Log.Info("解限SAP连携——异常:" + ex.Message); } foreach (var item in dic) { string filePath = "DICS_Path_Rec".ToAppSetting(); string fileName = "DICS_Name_Rec".ToAppSetting() + "_" + item.Key + "_" + DateTime.Now.ToString("yyyyMMdd"); string fileExt = "DICS_Ext_Rec".ToAppSetting(); List <RecList> recList = dic[item.Key]; T_SAP_COMPANYFUNDS_LINKS_QUEUE queue = dicQ[item.Key]; AccvouchEntityConvertStreamBaseManager accvouchEntityConvertStreamBaseManager = new AccvouchEntityConvertStreamBaseManager(); SapLinksQueueEntity sapLinksQueue = new SapLinksQueueEntity("BPMDB".ToConnectionString(), queue.GetSql_ISLINK1()); StringBuilder sb = new StringBuilder(); foreach (RecList rl in recList) { sb.AppendLine(rl.ToVouchString()); } SAPLinks.Helper.SaveFile.ISaveFileProvider saveFileProvider = SapSaveFileProviderFactory.CreateSaveProvider(sapLinksQueue); saveFileProvider.AddFileInfo(new SapSaveFileInfo(filePath, fileName + fileExt, sb)); saveFileProvider.SaveFile(); } }