Beispiel #1
0
        public void Load()
        {
            StorageSystemSerializer storageSystemSerializer = new StorageSystemSerializer();

            SimulatorTenant loadedTenant = (SimulatorTenant)storageSystemSerializer.Load("Tenant.xml", typeof(SimulatorTenant));

            this.simulatorTenant = loadedTenant != null ? loadedTenant : this.simulatorTenant;

            SimulatorStockLocation loadedStockLocation = (SimulatorStockLocation)storageSystemSerializer.Load("StockLocation.xml", typeof(SimulatorStockLocation));

            this.simulatorStockLocation = loadedStockLocation != null ? loadedStockLocation : this.simulatorStockLocation;

            StorageSystemStock loadedStock = (StorageSystemStock)storageSystemSerializer.LoadWithDataContract("Stock.xml", typeof(StorageSystemStock));

            this.stock = loadedStock != null ? loadedStock : this.stock;

            SimulatorArticleMasterSetCore loadedArticleMasterSetCore = (SimulatorArticleMasterSetCore)storageSystemSerializer.Load("ArticleMasterSet.xml", typeof(SimulatorArticleMasterSetCore));

            this.articleMasterSetCore = loadedArticleMasterSetCore != null ? loadedArticleMasterSetCore : this.articleMasterSetCore;

            SimulatorStockDeliverySetCore loadedStockDeliverySetCore = (SimulatorStockDeliverySetCore)storageSystemSerializer.LoadWithDataContract("StockDeliverySet.xml", typeof(SimulatorStockDeliverySetCore));

            this.stockDeliverySetCore = loadedStockDeliverySetCore != null ? loadedStockDeliverySetCore : this.stockDeliverySetCore;

            this.InitializeCores();
        }
Beispiel #2
0
        public void ClearSavedState()
        {
            StorageSystemSerializer storageSystemSerializer = new StorageSystemSerializer();

            storageSystemSerializer.DeleteFile("Tenant.xml");
            storageSystemSerializer.DeleteFile("StockLocation.xml");
            storageSystemSerializer.DeleteFile("Stock.xml");
            storageSystemSerializer.DeleteFile("ArticleMasterSet.xml");
            storageSystemSerializer.DeleteFile("StockDeliverySet.xml");
        }
Beispiel #3
0
        public void Save()
        {
            StorageSystemSerializer storageSystemSerializer = new StorageSystemSerializer();

            storageSystemSerializer.Save("Tenant.xml", this.simulatorTenant, typeof(SimulatorTenant));
            storageSystemSerializer.Save("StockLocation.xml", this.simulatorStockLocation, typeof(SimulatorStockLocation));
            storageSystemSerializer.SaveWithDataContract("Stock.xml", this.stock, typeof(StorageSystemStock));
            storageSystemSerializer.Save("ArticleMasterSet.xml", this.articleMasterSetCore, typeof(SimulatorArticleMasterSetCore));
            storageSystemSerializer.SaveWithDataContract("StockDeliverySet.xml", this.stockDeliverySetCore, typeof(SimulatorStockDeliverySetCore));
        }
Beispiel #4
0
        public bool Listen(int port, int subscriberID, int handshakeTimeout, bool enableKeepAlive,
                           int keepAliveInterval, int keepAliveTimeOut, bool useExternalIdAsSerialNumber)
        {
            if (this.listening)
            {
                throw new System.Exception("StorageSystemSimulatorCore already Listening");
            }

            List <ConfigurationValue> configurationForTcpInConnector = this.GetConfigurationForTcpInConnector(port);

            this.inConnector = new TcpInConnector();

            if (!this.inConnector.Initialize(1, configurationForTcpInConnector))
            {
                return(false);
            }

            List <ConfigurationValue> configurationForWwksConverter = this.GetConfigurationForWwksConverter(
                subscriberID, handshakeTimeout, enableKeepAlive, keepAliveInterval, keepAliveTimeOut, useExternalIdAsSerialNumber);

            this.convertor = new WwksConverter();
            this.convertor.Initialize(2, configurationForWwksConverter);

            this.inputCore.SetSubscriberID(subscriberID);
            _simulatorArticleInfoCore.SetSubscriberID(subscriberID);
            this.listening = true;

            this.listenThread      = new Thread(this.ExecuteListen);
            this.listenThread.Name = "StorageSystemSimulator Listen thread";
            this.listenThread.Start();

            StorageSystemSerializer storageSystemSerializer = new StorageSystemSerializer();

            storageSystemSerializer.SaveConnectionInformation("Connection.xml",
                                                              configurationForTcpInConnector, configurationForWwksConverter);

            return(true);
        }
        public FormMain()
        {
            InitializeComponent();
            this.simulatorCore = new StorageSystemSimulatorCore();
            this.simulatorCore.Load();

            this.simulatorCore.ConnectionAdd    += this.StorageSystemSimulatorCore_ConnectionAdd;
            this.simulatorCore.ConnectionRemove += this.StorageSystemSimulatorCore_ConnectionRemove;
            this.simulatorCore.StreamAdd        += this.StorageSystemSimulatorCore_StreamAdd;
            this.simulatorCore.StreamRemove     += this.StorageSystemSimulatorCore_StreamRemove;
            this.simulatorCore.InputCore.InputResponseReceived           += this.StorageSystemSimulatorCore_InputResponseReceived;
            this.simulatorCore.ArticleMasterSetCore.MasterArticleUpdated += this.StorageSystemSimulatorCore_MasterArticleUpdated;
            this.simulatorCore.StockDeliverySetCore.StockDeliveryUpdated += this.StorageSystemSimulatorCore_StockDeliveryUpdated;
            this.simulatorCore.Stock.StockUpdated += this.StorageSystemSimulatorCore_StockUpdated;
            this.simulatorCore.OutputCore.OutputOrderListUpdated           += this.StorageSystemSimulatorCore_OutputOrderListUpdated;
            this.simulatorCore.ArticleInfoCore.ArticleInfoResponseReceived += this.ArticleInfoCore_ArticleInfoResponseReceived;

            this.wwiLogger             = new WwiLogger();
            this.wwiLogger.WwiMessage += this.WwiLogger_WwiMessage;

            // tenant
            dataGridViewTenantList.AutoGenerateColumns = false;
            dataGridViewTenantList.DataSource          = new BindingSource(this.simulatorCore.SimulatorTenant.TenantList, "");
            this.DataGridViewSetAutoSize(dataGridViewTenantList);

            // stock location
            dataGridViewStockLocationList.AutoGenerateColumns = false;
            dataGridViewStockLocationList.DataSource          = new BindingSource(this.simulatorCore.SimulatorStockLocation.StockLocationList, "");
            this.DataGridViewSetAutoSize(dataGridViewStockLocationList);

            // Input
            this.inputRequestPackList = new List <RobotPack>();
            dataGridViewInputRequestPackList.AutoGenerateColumns = false;
            dataGridViewInputRequestPackList.DataSource          = new BindingSource(inputRequestPackList, "");
            this.DataGridViewSetAutoSize(dataGridViewInputRequestPackList);

            // Master Article
            dataGridViewMasterArticle.AutoGenerateColumns = false;
            this.UpdateDataGridView(dataGridViewMasterArticle,
                                    this.simulatorCore.ArticleMasterSetCore.MasterArticleList);
            this.DataGridViewSetAutoSize(dataGridViewMasterArticle);

            // stock delivery
            dataGridViewStockDeliveryMaster.AutoGenerateColumns = false;
            this.UpdateDataGridView(dataGridViewStockDeliveryMaster,
                                    this.simulatorCore.StockDeliverySetCore.StockDeliveryList);
            dataGridViewStockDeliveryDetail.AutoGenerateColumns = false;
            this.DataGridViewSetAutoSize(dataGridViewStockDeliveryDetail);

            // Article Info
            dataGridViewArticleInfoArticleList.AutoGenerateColumns = false;
            this.UpdateDataGridView(dataGridViewArticleInfoArticleList,
                                    this.simulatorCore.ArticleInfoCore.ArticleList);
            this.DataGridViewSetAutoSize(dataGridViewArticleInfoArticleList);

            // Stock
            this.DataGridViewSetAutoSize(dataGridViewProductStock);
            this.UpdateDataGridView(dataGridViewProductStock,
                                    this.simulatorCore.Stock.ArticleInformationList.ArticlesAsList);
            dataGridViewPackStock.AutoGenerateColumns = false;
            this.DataGridViewSetAutoSize(dataGridViewPackStock);

            // Output
            dataGridViewOutputOrderList.AutoGenerateColumns = false;
            this.DataGridViewSetAutoSize(dataGridViewOutputOrderList);
            dataGridViewOutputOrderItems.AutoGenerateColumns = false;
            this.DataGridViewSetAutoSize(dataGridViewOutputOrderItems);
            dataGridViewOutputDispensedPack.AutoGenerateColumns = false;
            this.DataGridViewSetAutoSize(dataGridViewOutputDispensedPack);

            dateTimePickerMasterDataExpiryDate.Value = DateTime.Now.AddMonths(6);

            tabControl.TabPages.Remove(tabPage5);

            TcpInConnectorConfiguration tcpInConnectorConfiguration = new TcpInConnectorConfiguration();
            WwksConverterConfiguration  wwksConverterConfiguration  = new WwksConverterConfiguration();

            if (StorageSystemSerializer.LoadConnectionInformation("Connection.xml",
                                                                  tcpInConnectorConfiguration,
                                                                  wwksConverterConfiguration))
            {
                numericUpDownPort.Value = tcpInConnectorConfiguration.Port;

                numericUpDownSubscriberID.Value             = wwksConverterConfiguration.SubscriberID;
                numericUpDownHandShakeTimeOut.Value         = wwksConverterConfiguration.HandshakeTimeout;
                checkBoxEnableKeepAlive.Checked             = wwksConverterConfiguration.EnableKeepAlive;
                numericUpDownKeepAliveInterval.Value        = wwksConverterConfiguration.KeepAliveInterval;
                numericUpDownKeepAliveTimeout.Value         = wwksConverterConfiguration.KeepAliveTimeOut;
                checkBoxUseExternalIdAsSerialNumber.Checked = wwksConverterConfiguration.UseExternalIdAsSerialNumber;
            }
        }