1
z8018
2025-06-10 e46aa927d231af83724683c7286d9db503e24cf7
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/BasicInfo/ContainerController.cs
@@ -4,9 +4,12 @@
using Microsoft.AspNetCore.Mvc;
using SqlSugar.Extensions;
using WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Common;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseController;
using WIDESEAWCS_DTO.PlacedBlockDTO;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_IBasicInfoService;
using WIDESEAWCS_Model.Models;
@@ -21,12 +24,21 @@
        private readonly IOrderContainerRepository _orderContainerRepository;
        private readonly IOrderDetailsRepository _orderDetailsRepository;
        private readonly IOrderrowsRepository _orderrowsRepository;
        public ContainerController(IContainerService service, IContainerRepository containerRepository, IOrderContainerRepository orderContainerRepository, IOrderDetailsRepository orderDetailsRepository, IOrderrowsRepository orderrowsRepository) : base(service)
        private readonly IContainerItemRepository _containerItemRepository;
        public ContainerController(IContainerService service, IContainerRepository containerRepository, IOrderContainerRepository orderContainerRepository, IOrderDetailsRepository orderDetailsRepository, IOrderrowsRepository orderrowsRepository, IContainerItemRepository containerItemRepository) : base(service)
        {
            _containerRepository = containerRepository;
            _orderContainerRepository = orderContainerRepository;
            _orderDetailsRepository = orderDetailsRepository;
            _orderrowsRepository = orderrowsRepository;
            _containerItemRepository = containerItemRepository;
        }
        [HttpPost, HttpGet, Route("GetTaskPosition"), AllowAnonymous]
        public TaskPosition GetTaskPosition([FromBody] Point3D point3D, int length, int width, int height, int edge)
        {
            PlaceBlockService placeBlockService = new PlaceBlockService(new ContainerSize(), null);
            return placeBlockService.GetTaskPosition(point3D, length, width, height, edge);
        }
        [HttpPost, HttpGet, Route("GetPutStations"), AllowAnonymous]
@@ -38,6 +50,8 @@
                List<object> list = new List<object>();
                foreach (var container in containers)
                {
                    List<string> containerItemCodes = _containerItemRepository.QueryData(x => x.ContainerId == container.Id).Select(x => x.ItemCode).ToList();
                    Dt_OrderContainer orderContainer = _orderContainerRepository.QueryFirst(x => x.ContainerId == container.Id && x.ContainerCode == container.ContainerCode);
                    if (orderContainer != null)
                    {
@@ -45,27 +59,34 @@
                        if (orderrows != null)
                        {
                            List<OrderDetails> totalDetails = _orderDetailsRepository.QueryData(x => x.Orderrowsid == orderrows.id);
                            List<OrderDetails> details = totalDetails.Where(x => x.Orderrowsid == orderrows.id && x.Orderdetails_status == PalletingStatusEnmu.PalletingSuccess.ObjToInt()).ToList();
                            List<OrderDetails> details = totalDetails.Where(x => x.Orderrowsid == orderrows.id && x.Orderdetails_status == PalletingStatusEnmu.PalletingSuccess.ObjToInt() && containerItemCodes.Contains(x.Orderdetails_outid)).ToList();
                            int sortedNum = totalDetails.Where(x => x.Orderrowsid == orderrows.id && x.Orderdetails_status == PalletingStatusEnmu.PalletingSuccess.ObjToInt()).Count();
                            List<object> orderData = new List<object>();
                            foreach (var item in details)
                            {
                                object obj = new
                                {
                                    orderCode = orderrows.Orderrows_orderid,
                                    cusName = orderrows.Orderrows_customer,
                                    orderName = orderrows.Orderrows_name,
                                    batch = orderrows.Orderrows_batchid,
                                    productName = ""
                                    name = item.Orderdetails_name,
                                    baseName = item.Orderdetails_productName,
                                    size = $"{item.Orderdetails_length}*{item.Orderdetails_width}*{item.Orderdetails_thickness}",
                                    process = "",
                                };
                                orderData.Add(obj);
                            }
                            object data = new
                            {
                                orderCode = orderrows.Orderrows_orderid,
                                orderName = orderrows.Orderrows_name,
                                cusName = orderrows.Orderrows_customer,
                                stationCode = container.ContainerCode,
                                orderTotalNum = totalDetails.Count,
                                sortedNum = details.Count,
                                unsortedNum = totalDetails.Count - details.Count,
                                orderData = orderData
                                sortedNum = sortedNum,
                                unsortedNum = totalDetails.Count - sortedNum,
                                stationSortedNum = details.Count,
                                orderData = orderData,
                                orderId = orderrows.id
                            };
                            list.Add(data);
                        }
@@ -73,6 +94,7 @@
                        {
                            object data = new
                            {
                                stationSortedNum = 0,
                                stationCode = container.ContainerCode,
                                orderTotalNum = 0,
                                sortedNum = 0,
@@ -90,6 +112,7 @@
                            orderTotalNum = 0,
                            sortedNum = 0,
                            unsortedNum = 0,
                            stationSortedNum = 0,
                            orderData = new List<object>()
                        };
                        list.Add(data);
@@ -107,5 +130,11 @@
                };
            }
        }
        [HttpPost, HttpGet, Route("ReleaseContainer"), AllowAnonymous]
        public WebResponseContent ReleaseContainer([FromBody] int[] keys)
        {
            return Service.AutoReleaseContainer(keys);
        }
    }
}