コード例 #1
0
        public void TestGetWarehouseIndex(PositionCodes code, int expectedRow, int expectedCol)
        {
            var state = new ProductionState();
            var res   = state.GetWarehouseIndex(code);

            Assert.AreEqual((expectedRow, expectedCol), res);
        }
コード例 #2
0
        public void TestGetTimeMatrixIndex(PositionCodes code, int expected)
        {
            var state = new ProductionState();
            var res   = state.GetTimeMatrixIndex(code);

            Assert.AreEqual(expected, res);
        }
コード例 #3
0
 public static string ToGuiString(this PositionCodes code) => code switch
 {
コード例 #4
0
        private void WarehouseSwap(ProductionState productionState, Tuple <PositionCodes, PositionCodes> currentSwap, PositionCodes previousPosition, List <BaseStepModel> logger, bool isLastSwap = false)
        {
            (int r, int c) = productionState.GetWarehouseIndex(currentSwap.Item1);
            var    itemType = productionState.WarehouseState[r, c];
            var    swapTime = productionState.SwapWarehouseItems(currentSwap.Item1, currentSwap.Item2);
            double moveToDifferentCellTime;

            moveToDifferentCellTime = productionState.TimeMatrix[
                productionState.GetTimeMatrixIndex(previousPosition),
                productionState.GetTimeMatrixIndex(currentSwap.Item1)
                                      ];

            if (isLastSwap)
            {
                var extraTime = productionState.TimeMatrix[
                    productionState.GetTimeMatrixIndex(currentSwap.Item2),
                    productionState.GetTimeMatrixIndex(PositionCodes.Stacker)
                                ];

                logger.Add(new WarehouseSwapStepModel
                {
                    MoveTime     = moveToDifferentCellTime,
                    SwapFromCell = currentSwap.Item1,
                    SwapTime     = swapTime,
                    SwapToCell   = currentSwap.Item2,
                    SwapElement  = itemType,
                    ExtraTime    = extraTime
                });
            }
            else
            {
                logger.Add(new WarehouseSwapStepModel
                {
                    MoveTime     = moveToDifferentCellTime,
                    SwapFromCell = currentSwap.Item1,
                    SwapTime     = swapTime,
                    SwapToCell   = currentSwap.Item2,
                    SwapElement  = itemType,
                });
            }
        }