コード例 #1
0
        public void ProcessStockOutputRequest(StockOutputRequest stockOutputRequest)
        {
            StockOutputResponse stockOutputResponse = new StockOutputResponse(stockOutputRequest.ConverterStream);

            stockOutputResponse.AdoptHeader(stockOutputRequest);
            stockOutputResponse.Order = stockOutputRequest.Order.Clone();

            if ((this.generateBoxId) &&
                (String.IsNullOrEmpty(stockOutputRequest.Order.BoxNumber)))
            {
                stockOutputRequest.Order.BoxNumber = nextBoxId.ToString();
                nextBoxId++;
            }

            // create SimulatorOutputOrder to handle output result.
            SimulatorOutputOrder outputOrder = new SimulatorOutputOrder(
                this.stock,
                this.simulatorTenant,
                this.simulatorStockLocation,
                stockOutputRequest,
                this.outputResult,
                this.enableAutoReply,
                this.converterStreamList);

            outputOrder.OutputOrderUpdated += this.OutputOrder_OutputOrderUpdated;
            this.orderList.Add(outputOrder);

            stockOutputResponse.ConverterStream.Write(stockOutputResponse);

            this.DoOutputOrderListUpdated();
        }
コード例 #2
0
        public Task GetTaskInformation(Task requestedTask, bool includeTaskDetails)
        {
            SimulatorOutputOrder outputOrder = this.GetOutputOrderByID(requestedTask.ID);

            if (outputOrder != null)
            {
                return(outputOrder.GetTaskInformation(includeTaskDetails));
            }

            return(requestedTask);
        }
コード例 #3
0
        public void DirectOutput(RobotPack pack)
        {
            // send a output response to every PMR conencted and matching tenant.
            foreach (IConverterStream stream in this.converterStreamList)
            {
                if (pack.TenantID != stream.TenantID)
                {
                    continue;
                }

                StockOutputRequest stockOutputRequest = new StockOutputRequest(stream);
                stockOutputRequest.ID       = "1"; // is always 1
                stockOutputRequest.TenantID = pack.TenantID;

                int machineLocation;
                if (int.TryParse(pack.MachineLocation, out machineLocation))
                {
                    stockOutputRequest.Source = machineLocation;
                }
                stockOutputRequest.Destination = 100;

                stockOutputRequest.Order = new StockOutputOrder();
                stockOutputRequest.Order.OutputNumber = 1;

                StockOutputOrderItem orderItem = new StockOutputOrderItem();
                orderItem.RobotArticleCode = pack.RobotArticleCode;
                orderItem.PackID           = pack.ID;
                if (pack.SubItemQuantity == 0)
                {
                    orderItem.RequestedQuantity = 1;
                }
                else
                {
                    orderItem.RequestedSubItemQuantity = pack.SubItemQuantity;
                }

                stockOutputRequest.Order.Items.Add(orderItem);

                // create SimulatorOutputOrder to handle output result.
                SimulatorOutputOrder outputOrder = new SimulatorOutputOrder(
                    this.stock,
                    this.simulatorTenant,
                    this.simulatorStockLocation,
                    stockOutputRequest,
                    OutputResult.Normal,
                    this.enableAutoReply,
                    this.converterStreamList);
                outputOrder.OutputOrderUpdated += this.OutputOrder_OutputOrderUpdated;
                this.orderList.Add(outputOrder);

                this.DoOutputOrderListUpdated();
            }
        }
コード例 #4
0
        private SimulatorOutputOrder GetOutputOrderByID(string orderID)
        {
            SimulatorOutputOrder result = null;

            foreach (SimulatorOutputOrder outputOrder in this.orderList)
            {
                if (outputOrder.ID.ToString() == orderID)
                {
                    // if multiple order exist with the same ID, select lastest order.
                    result = outputOrder;
                }
            }

            return(result);
        }
コード例 #5
0
        public void ProcessTaskCancelRequest(TaskCancelRequest taskCancelRequest)
        {
            TaskCancelResponse taskCancelResponse = new TaskCancelResponse();

            taskCancelResponse.AdoptHeader(taskCancelRequest);

            foreach (Task task in taskCancelRequest.Tasks)
            {
                SimulatorOutputOrder outputOrder = this.GetOutputOrderByID(task.ID);

                if (outputOrder != null)
                {
                    taskCancelResponse.Tasks.Add(outputOrder.CancelOrder());
                }
            }

            taskCancelResponse.ConverterStream.Write(taskCancelResponse);
        }