1
z8018
2025-04-08 e69f814f50fd59739dbedd88518dc8cb8d2ed3ee
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/PlaceBlockService.cs
@@ -25,6 +25,8 @@
        public PlaceBlockService(ContainerSize containerSize, List<PlacedBlock>? placedBlocks = null)
        {
            containerSize.Length = containerSize.Length + 2 * SPACING;
            containerSize.Width = containerSize.Width + 2 * SPACING;
            ContainerSize = containerSize;
            if (placedBlocks == null || placedBlocks.Count == 0)
            {
@@ -34,6 +36,7 @@
            {
                PlacedBlocks = placedBlocks;
            }
            containerFloor = new PlacedBlock(new Point3D(SPACING, SPACING, 0), ContainerSize.Length - 2 * SPACING, ContainerSize.Width - 2 * SPACING, 0);
        }
@@ -149,7 +152,7 @@
                            if (IsPositionValid(candidate, l, w, h))
                            {
                                var placed = new PlacedBlock(candidate, l, w, h);
                                PlacedBlocks.Add(placed);
                                //PlacedBlocks.Add(placed);
                                return candidate;
                            }
                        }
@@ -170,10 +173,10 @@
        {
            var blocks = PlacedBlocks
                .Where(b => b.Position.Z + b.Height == baseZ)
                .OrderByDescending(b => b.Length * b.Width);
                .OrderByDescending(b => b.Length * b.Width).ToList();
            // å½“baseZ=0时添加容器底部支撑
            if (baseZ == 0 && !blocks.Any())
            if (baseZ == 0 && blocks.Count == 0)
            {
                return new List<PlacedBlock> { containerFloor };
            }