From e69f814f50fd59739dbedd88518dc8cb8d2ed3ee Mon Sep 17 00:00:00 2001 From: z8018 <1282578289@qq.com> Date: 星期二, 08 四月 2025 21:18:47 +0800 Subject: [PATCH] 1 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/PlaceBlockService.cs | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/PlaceBlockService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/PlaceBlockService.cs" index f61e79a..4248711 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/PlaceBlockService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/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(); // 褰揵aseZ=0鏃舵坊鍔犲鍣ㄥ簳閮ㄦ敮鎾� - if (baseZ == 0 && !blocks.Any()) + if (baseZ == 0 && blocks.Count == 0) { return new List<PlacedBlock> { containerFloor }; } -- Gitblit v1.9.3