wangxinhui
2026-03-06 65a231315d1dcc35d2996106d36e9cca9aba6ce6
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_TaskInfoService/PackaxisTaskService.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -39,6 +40,7 @@
            _stationMangerRepository = stationMangerRepository;
            _unitOfWorkManage = unitOfWorkManage;
        }
        private static object lock_reqPackTask = new object();
        /// <summary>
        /// åˆ†é…ç åž›ä»»åŠ¡
        /// </summary>
@@ -46,6 +48,8 @@
        /// <param name="deviceCode"></param>
        /// <returns></returns>
        public WebResponseContent ReqPackTask(string barCode,string deviceCode)
        {
            lock (lock_reqPackTask)
        {
            WebResponseContent content= new WebResponseContent();
            try
@@ -92,14 +96,14 @@
                {
                    //获取当前空盘准备的码垛工位
                    List<string> stations = _stationMangerRepository.QueryData(x => x.StationDeviceCode == "CLC_CP" && x.IsOccupied == StationOccupiedEnum.None.ObjToInt()).Select(x => x.StationCode).ToList();
                    //获取码垛配置表查询有配置的码垛工位
                    List<Dt_Packaxis> packaxes = _packaxisRepository.QueryData(x => x.PackType == packinfo.PackType);
                        //获取码垛配置表查询可分配并已配置的码垛工位
                        List<Dt_Packaxis> packaxes = _packaxisRepository.QueryData(x => x.PackType == packinfo.PackType && stations.Contains(x.StationCode));
                    if (packaxes.Count==0)
                    {
                        return content.Error("未找到码垛坐标配置");
                            return content.Error("未找到可分配码垛配置");
                    }
                    List<string> packStations = packaxes.Select(x => x.StationCode).ToList();
                    Dt_StationPackInfo? packInfoAssign = stationPackInfos.Where(x => x.PackType == 0 && x.AssignNum == 0 && stations.Contains(x.StationCode) && packStations.Contains(x.StationCode)).OrderByDescending(x => x.StationCode).FirstOrDefault();
                        Dt_StationPackInfo? packInfoAssign = stationPackInfos.Where(x => x.PackType == 0 && x.AssignNum == 0 && packStations.Contains(x.StationCode)).OrderBy(x => x.OrderIndex).FirstOrDefault();
                    if (packInfoAssign == null)
                    {
                        return content.Error("未找到可分配垛位");
@@ -144,6 +148,7 @@
                content.Error(ex.Message);
            }
            return content;
            }
        }
        /// <summary>
        /// ç åž›ç»“托并上传码垛工位码垛明细数据
@@ -247,4 +252,10 @@
            }
        }
    }
    public class MDCount
    {
        public string MDNo { get; set; }
        public int Count { get; set; }
    }
}