public CheckForCompletedoutboundProcessResponse(IUnityContainer container, ProcessInfo processInfo,
                                                        MercurySettings mercurySettings, IQueryGenerator generator) : base(container, processInfo, mercurySettings)
        {
            EnableService <IDocumentReadService>();
            EnableService <IDocumentPersistService>();
            EnableService <ICacheManager>();
            EnableService <IMethaStorage>();
            EnableService <IMercuryQueueService>();


            AddArgument <Guid>(ARG_PAGE_ENTERPRISE_ID);
            AddArgument <IEnumerable <Guid> >(ARG_STOCK_ENTRY_IDS, Direction.In);
            AddArgument <bool>(ARG_REMOVE_IS_ABSENT, Direction.In, true);
            AddArgument <IList <Guid> >(ARG_UPDATED_STOCK_ENTRY_IDS, Direction.InOut, new List <Guid>());
            AddArgument <IList <Guid> >(ARG_SKIPEED_STOCK_ENTRY_IDS, Direction.InOut, new List <Guid>());
        }
Example #2
0
        /// <summary>
        /// Гененрирование XML запроса в меркурий
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name=ARG_PAGE_SIZE>Размер страницы</param>
        /// <param name="settings">Настройки</param>
        /// <returns></returns>
        private string GenerateRequest(int pageIndex, int pageSize, MercurySettings settings, string loginName, string enterpriseGUID, string enterpriseCode, DateTimeOffset?beginDate, DateTimeOffset?endDate)
        {
            int pageOffset = (pageIndex - 1) * pageSize;
            var model      = new CheckForCompletedOutboundRequestModel();

            model.Offset             = pageOffset;
            model.Count              = pageSize;
            model.LocalTransactionId = Guid.NewGuid().ToString();
            model.Login              = loginName;
            model.EnterpriseGuid     = enterpriseGUID;
            model.EnterpriseCode     = enterpriseCode;
            model.FillFromMercurySettings(settings);
            model.IssueDate        = MoscowDateTimeOffset();
            model.ReceiptBeginDate = beginDate;
            model.ReceiptEndDate   = endDate;
            return(messageGenerator.GetMessageBody(Consts.MERCURY_CHECK_FOR_COMPLETED_OUTBOUND_OPERATION, settings, model));
        }
Example #3
0
        public string GetMessageBodyNoNullTags(string operationName, MercurySettings mercurySettings, object model)
        {
            string    res = GetMessageBody(operationName, mercurySettings, model);
            XDocument xml = XDocument.Parse(res);

            var body = xml.Descendants().FirstOrDefault(a => a.Name.LocalName == "Body");

            if (body != null)
            {
                var emptyTags = body.Descendants().Where(a => ShouldDelete(a)).ToList();
                foreach (var t in emptyTags)
                {
                    t.Remove();
                }
            }
            return(xml.ToString());
        }
Example #4
0
        /// <summary>
        /// Генерирует тело сообщения в меркурий
        /// </summary>
        /// <param name="operationName">Наименование операции</param>
        /// <param name="mercurySettings">Настройки для коииуникации с Меркурием</param>
        /// <param name="model">Модель для формирования запроса</param>
        /// <returns>Сгенерированно тело сообщения</returns>
        public string GetMessageBody(string operationName, MercurySettings mercurySettings, object model)
        {
            // Ключ TemplateKey =  <API VERSION>\<OPERATION NAME>
            // Путь <TEMPLATE DIRECTORY>\TemplateKey
            string templateVersionKey = Path.Combine(mercurySettings.MecuryApiVersion, operationName);
            Type   modelType          = operationModel[operationName];

            if (!RazorEngine.Engine.Razor.IsTemplateCached(templateVersionKey, modelType))
            {
                // Прочитать шаблон с диска
                string path            = Path.Combine(mercurySettings.TemplateDirectory, String.Format("{0}.xml", templateVersionKey));
                string templateContent = File.ReadAllText(path, Encoding.UTF8);
                // Закэшировать и скомпилировать
                RazorEngine.Engine.Razor.Compile(templateContent, templateVersionKey, modelType);
            }
            string result = RazorEngine.Engine.Razor.Run(templateVersionKey, modelType, model);

            return(result);
        }
        public CheckForCompletedOutboundCalculatePageCount(IUnityContainer container, ProcessInfo processInfo, MercurySettings mercurySettings) : base(container, processInfo, mercurySettings)
        {
            EnableService <IDocumentReadService>();
            EnableService <IDocumentPersistService>();
            EnableService <ICacheManager>();
            EnableService <IMethaStorage>();
            EnableService <ISystemSettingManager>();

            AddArgument <int>(ARG_PAGE_SIZE, Direction.Out);
            AddArgument <int>(ARG_PAGE_COUNT, Direction.Out);
            AddArgument <int>(ARG_PAGE_START, Direction.Out);
        }
Example #6
0
 public CheckForCompletedOutboundMakeRequest(IUnityContainer container, ProcessInfo processInfo, MercurySettings mercurySettings) : base(container, processInfo, mercurySettings)
 {
     AddArgument <int>(ARG_PAGE_SIZE, Direction.In, 50);
     AddArgument <int>(ARG_PAGE_COUNT, Direction.In, 10);
     AddArgument <int>(ARG_PAGE_START, Direction.In, 1);
     AddArgument <Guid>(ARG_PAGE_ENTERPRISE_ID, Direction.In);
     AddArgument <string>(ARG_MERCURY_LOGIN, Direction.In);
     AddArgument <string>(ARG_SUFFIX, Direction.In, string.Empty);
     AddArgument <int?>(ARG_ITERATION, Direction.In, null);
     AddArgument <DateTimeOffset?>(ARG_BEGIN_DATE, Direction.In, null);
     AddArgument <DateTimeOffset?>(ARG_END_DATE, Direction.In, null);
 }
Example #7
0
        public IEnumerable <ExportServiceInfo> GetAvailableServices()
        {
            IList <ExportServiceInfo> result = new List <ExportServiceInfo>();

            //Все процессы
            Type t = typeof(IEventProcessor);

            foreach (var item in Assembly.GetExecutingAssembly().GetTypes().Where(x => t.IsAssignableFrom(x) && x.IsClass))
            {
                result.Add(new ExportServiceInfo()
                {
                    InterfaceType = t, ImplementType = item
                });
            }

            //Все действия
            t = typeof(IAction);
            foreach (var item in Assembly.GetExecutingAssembly().GetTypes().Where(x => t.IsAssignableFrom(x) && x.IsClass))
            {
                result.Add(new ExportServiceInfo()
                {
                    InterfaceType = t, ImplementType = item
                });
            }

            //Все команды
            //t = typeof(ISQLCommand);
            //foreach (var item in Assembly.GetExecutingAssembly().GetTypes().Where(x => t.IsAssignableFrom(x) && x.IsClass)) {
            //    result.Add(new ExportServiceInfo() { InterfaceType = t, ImplementType = item });
            //}
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(InitMercuryCommunicateDelayProcess)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(InitMercuryConnectSettingsProcess)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(InitMercurySettingsProcess)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryGetEVCDocuments)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryGetEVCDocuments_V2_0)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryGetEVCDocuments_V2_1)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryGetEVCByUuid)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryGetEVCChanges)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryGetReturnableEVCChanges)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryGetStockEntries)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryGetStockEntries_V2_0)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryGetStockEntries_V2_1)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryMergeOperation)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryResolveDiscrepancy)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryResolveDiscrepancyCopacking)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryOutboundOperation)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryOutboundExportOperation)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryIncomingOperation)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryReturnableOperation)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryIncomingEVCOperation)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryProductionOperation)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryFinalizeProductionOperation)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryWithdrawEVC)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryWithdrawInboundEVC)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryLaborResearch)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryLaborResearch_V2_0)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryLaborResearch_V2_1)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryModifyProducerStockList)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryCheckShipmentRegionalization)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(ResetGenerateLockerProcess)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryUpdateTransportMovementOperation)
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IProcess), ImplementType = typeof(MercuryCheckForCompletedOutbound)
            });

            //result.Add(new ExportServiceInfo() { InterfaceType = typeof(IDatabaseDataService), ImplementType = typeof(DatabaseDataService), Default = true });
            MercurySettings sett = new MercurySettings();

            result.Add(new ExportServiceInfo()
            {
                InterfaceType = null, ImplementType = typeof(MercurySettings), Default = true, IsSingleton = true, Object = sett
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = null, ImplementType = typeof(MercuryConnectSettings), Default = true, IsSingleton = true, Object = new MercuryConnectSettings()
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IMercuryUserPersistService), ImplementType = typeof(MercuryUserPersistService), Default = true
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IMercuryMessageBodyGenerator), ImplementType = typeof(MercuryMessageBodyGenerator), Default = true, IsSingleton = true
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IMercuryQueueStepService), ImplementType = typeof(MercuryQueueStepService), Default = true
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IMercuryQueueService), ImplementType = typeof(MercuryQueueService), Default = true
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IMercuryCommunicateDelaySettings), ImplementType = typeof(MercuryCommunicateDelaySettings), Default = true, IsSingleton = true
            });
            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IGenerateLocker), ImplementType = typeof(GenerateLocker), Default = true, IsSingleton = true
            });

            result.Add(new ExportServiceInfo()
            {
                InterfaceType = typeof(IGenerateProcessLogWriter), ImplementType = typeof(GenerateProcessLogWriter), Default = true
            });

            return(result);
        }