private void GetSqlByList(string companyCode, DataRow[] drs, ref Dictionary <string, List <RecList> > dic, ref Dictionary <string, T_SAP_COMPANYFUNDS_LINKS_QUEUE> dicQ)
        {
            T_SAP_COMPANYFUNDS_LINKS_QUEUE queue = new T_SAP_COMPANYFUNDS_LINKS_QUEUE();

            //companyCode = "1020";
            string filePath = "DICS_Path_Rec".ToAppSetting();
            string fileName = "DICS_Name_Rec".ToAppSetting() + "_" + companyCode + "_" + DateTime.Now.ToString("yyyyMMdd");
            string fileExt  = "DICS_Ext_Rec".ToAppSetting();
            //string sql = @"SELECT * FROM DABAN_BPM_DICS.DBO.V_EmptyAndClearSale_Post A
            //           INNER JOIN SAP_COMPANYFUNDS_LINKS_QUEUE B
            //           ON A.SN = B.APPLY_NO AND ISLINK = 0";
            //DataTable dt = SQLHelper.ExecuteDataset("BPMDB".ToConnectionString(), System.Data.CommandType.Text, sql).Tables[0];

            List <RecList> recList = new List <RecList>();

            if (dic.ContainsKey(companyCode))
            {
                recList = dic[companyCode];
            }
            if (dicQ.ContainsKey(companyCode))
            {
                queue = dicQ[companyCode];
            }
            for (int i = 0; i < drs.Length; i++)
            {
                queue.Add(Convert.ToString(drs[i]["SN"]));
                getDtFor40(drs[i], recList);
                getDtFor19(drs[i], recList);
            }

            if (dic.ContainsKey(companyCode))
            {
                dic[companyCode] = recList;
            }
            else
            {
                dic.Add(companyCode, recList);
            }

            if (dicQ.ContainsKey(companyCode))
            {
                dicQ[companyCode] = queue;
            }
            else
            {
                dicQ.Add(companyCode, queue);
            }
            //AccvouchEntityConvertStreamBaseManager accvouchEntityConvertStreamBaseManager = new AccvouchEntityConvertStreamBaseManager();
            //SapLinksQueueEntity sapLinksQueue = new SapLinksQueueEntity("BPMDB".ToConnectionString(), queue.GetSql_ISLINK1());
            //StringBuilder sb = new StringBuilder();
            //foreach (RecList item in recList)
            //{
            //    sb.AppendLine(item.ToVouchString());
            //}

            //SAPLinks.Helper.SaveFile.ISaveFileProvider saveFileProvider = SapSaveFileProviderFactory.CreateSaveProvider(sapLinksQueue);
            //saveFileProvider.AddFileInfo(new SapSaveFileInfo(filePath, fileName + fileExt, sb));
            //saveFileProvider.SaveFile();
        }
        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();
            }
        }
Beispiel #3
0
        private string GetUpdateSapLinkQueue(ApplyNoEntityCollection applyNoEntityCollection)
        {
            T_SAP_COMPANYFUNDS_LINKS_QUEUE tquere = new T_SAP_COMPANYFUNDS_LINKS_QUEUE();

            foreach (ApplyNoEntity applyNoEntity in applyNoEntityCollection)
            {
                tquere.Add(applyNoEntity.ApplyNo);
            }
            return(tquere.GetSql_ISLINK1());
        }
        private void GetSqlByList(string companyCode, DataRow[] drs, ref Dictionary <string, List <RecList> > dic, ref Dictionary <string, T_SAP_COMPANYFUNDS_LINKS_QUEUE> dicQ)
        {
            T_SAP_COMPANYFUNDS_LINKS_QUEUE queue = new T_SAP_COMPANYFUNDS_LINKS_QUEUE();

            string filePath = "DICS_Path_Rec".ToAppSetting();
            string fileName = "DICS_Name_Rec".ToAppSetting() + "_" + companyCode + "_" + DateTime.Now.ToString("yyyyMMdd");
            string fileExt  = "DICS_Ext_Rec".ToAppSetting();

            List <RecList> recList = new List <RecList>();

            if (dic.ContainsKey(companyCode))
            {
                recList = dic[companyCode];
            }
            if (dicQ.ContainsKey(companyCode))
            {
                queue = dicQ[companyCode];
            }
            for (int i = 0; i < drs.Length; i++)
            {
                queue.Add(Convert.ToString(drs[i]["BATCH_NO"]));
                getDtFor40(drs[i], recList);
                getDtFor50(drs[i], recList);
            }
            if (dic.ContainsKey(companyCode))
            {
                dic[companyCode] = recList;
            }
            else
            {
                dic.Add(companyCode, recList);
            }

            if (dicQ.ContainsKey(companyCode))
            {
                dicQ[companyCode] = queue;
            }
            else
            {
                dicQ.Add(companyCode, queue);
            }
            //AccvouchEntityConvertStreamBaseManager accvouchEntityConvertStreamBaseManager = new AccvouchEntityConvertStreamBaseManager();
            //SapLinksQueueEntity sapLinksQueue = new SapLinksQueueEntity("BPMDB".ToConnectionString(), queue.GetSql_ISLINK1());
            //StringBuilder sb = new StringBuilder();
            //foreach (RecList item in recList)
            //{
            //    sb.AppendLine(item.ToVouchString());
            //}

            //SAPLinks.Helper.SaveFile.ISaveFileProvider saveFileProvider = SapSaveFileProviderFactory.CreateSaveProvider(sapLinksQueue);
            //saveFileProvider.AddFileInfo(new SapSaveFileInfo(filePath, fileName + fileExt, sb));
            //saveFileProvider.SaveFile();
        }