From 1f361850d35ba47225951efbc49d592eea685cf8 Mon Sep 17 00:00:00 2001 From: z8018 <1282578289@qq.com> Date: 星期三, 16 四月 2025 17:35:53 +0800 Subject: [PATCH] 1 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/PlaceBlockService.cs | 113 ++------------------------------------------------------ 1 files changed, 4 insertions(+), 109 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 4248711..082fc1d 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" @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using WIDESEAWCS_DTO.PlacedBlockDTO; using WIDESEAWCS_IBasicInfoService; namespace WIDESEAWCS_BasicInfoService @@ -25,8 +26,8 @@ public PlaceBlockService(ContainerSize containerSize, List<PlacedBlock>? placedBlocks = null) { - containerSize.Length = containerSize.Length + 2 * SPACING; - containerSize.Width = containerSize.Width + 2 * SPACING; + containerSize.Length = containerSize.Length; + containerSize.Width = containerSize.Width; ContainerSize = containerSize; if (placedBlocks == null || placedBlocks.Count == 0) { @@ -38,7 +39,7 @@ } - containerFloor = new PlacedBlock(new Point3D(SPACING, SPACING, 0), ContainerSize.Length - 2 * SPACING, ContainerSize.Width - 2 * SPACING, 0); + containerFloor = new PlacedBlock(new Point3D(0, 0, 0), ContainerSize.Length, ContainerSize.Width, 0); } /// <summary> @@ -136,11 +137,6 @@ xEnd = Math.Min(xEnd, ContainerSize.Length - l - SPACING); yEnd = Math.Min(yEnd, ContainerSize.Width - w - SPACING); - // 楠岃瘉鏀拺闈㈢Н - //int supportArea = support.Length * support.Width; - //int requiredSupportArea = (int)(l * w * 0.7); // 鏀拺闈㈢Н >= 琚敮鎾戦潰闈㈢Н鐨�70% - //if (supportArea < requiredSupportArea) continue; - if (xStart > xEnd || yStart > yEnd) continue; // 浼樺寲鎼滅储锛氫紭鍏堣钀戒綅缃� @@ -182,38 +178,6 @@ } return blocks; - - - //// 鑾峰彇鎵�鏈夊湪 baseZ 楂樺害鐨勬敮鎾戝潡 - //var blocks = PlacedBlocks - // .Where(b => b.Position.Z + b.Height == baseZ) - // .ToList(); - - //// 褰� baseZ=0 鏃舵坊鍔犲鍣ㄥ簳閮ㄦ敮鎾� - //if (baseZ == 0 && !blocks.Any()) - //{ - // return new List<PlacedBlock> { containerFloor }; - //} - - //// 璁$畻鏁翠綋骞抽潰 - //if (blocks.Any()) - //{ - // int minX = blocks.Min(b => b.Position.X); - // int minY = blocks.Min(b => b.Position.Y); - // int maxX = blocks.Max(b => b.Position.X + b.Length); - // int maxY = blocks.Max(b => b.Position.Y + b.Width); - - // var overallSupport = new PlacedBlock( - // new Point3D(minX, minY, baseZ), - // maxX - minX, - // maxY - minY, - // 0 - // ); - - // return new List<PlacedBlock> { overallSupport }; - //} - - //return blocks; } /// <summary> @@ -252,75 +216,6 @@ return xOverlap && yOverlap && zOverlap; }); - } - } - - /// <summary> - /// 涓夌淮鍧愭爣缁撴瀯浣� - /// 琛ㄧず璐х墿鏀剧疆浣嶇疆鐨勫乏涓嬪墠瑙掑潗鏍囷紙X,Y,Z锛� - /// 鍧愭爣绯昏鏄庯細 - /// - X杞达細娌垮鍣ㄩ暱搴︽柟鍚� - /// - Y杞达細娌垮鍣ㄥ搴︽柟鍚� - /// - Z杞达細鍨傜洿鏂瑰悜锛堥珮搴︼級 - /// </summary> - public struct Point3D - { - /// <summary>X杞村潗鏍囷紙姣背锛�</summary> - public int X { get; } - - /// <summary>Y杞村潗鏍囷紙姣背锛�</summary> - public int Y { get; } - - /// <summary>Z杞村潗鏍囷紙姣背锛�</summary> - public int Z { get; } - - public Point3D(int x, int y, int z) - { - X = x; - Y = y; - Z = z; - } - } - - /// <summary> - /// 宸叉斁缃揣鐗╀俊鎭被 - /// 璁板綍姣忎釜璐х墿鐨勪綅缃拰灏哄淇℃伅 - /// 鍧愭爣绯昏鏄庯細浣嶇疆鐐逛负璐х墿鐨勫乏涓嬪墠瑙掑潗鏍� - /// </summary> - public class PlacedBlock - { - /// <summary>璐х墿宸︿笅鍓嶈鍧愭爣</summary> - public Point3D Position { get; } - - /// <summary>娌縓杞存柟鍚戦暱搴︼紙姣背锛�</summary> - public int Length { get; } - - /// <summary>娌縔杞存柟鍚戝搴︼紙姣背锛�</summary> - public int Width { get; } - - /// <summary>娌縕杞存柟鍚戦珮搴︼紙姣背锛�</summary> - public int Height { get; } - - public PlacedBlock(Point3D position, int length, int width, int height) - { - Position = position; - Length = length; - Width = width; - Height = height; - } - } - - public struct ContainerSize - { - public int Length { get; set; } - public int Width { get; set; } - public int Height { get; set; } - - public ContainerSize(int length, int width, int height) - { - Length = length; - Width = width; - Height = height; } } } \ No newline at end of file -- Gitblit v1.9.3