647556386
2026-02-02 95c92db3c831c73b05068b09221c13ad4a250322
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -88,33 +88,6 @@
                    _unitOfWorkManage.CommitTran();
                    //TaskModel esstask = new TaskModel()
                    //{
                    //    taskType = "carry",
                    //    taskGroupCode = "",
                    //    groupPriority = 0,
                    //    tasks = new List<TasksType>
                    //    {
                    //            new()
                    //            {
                    //                taskCode=task.TaskNum.ToString(),
                    //                taskPriority=0,
                    //                taskDescribe=new TaskDescribeType
                    //                {
                    //                    containerCode=stockInfo.PalletCode,
                    //                    containerType= "CT_KUBOT_STANDARD",
                    //                    fromLocationCode=stockInfo.LocationCode??"",
                    //                    toStationCode="",
                    //                    toLocationCode="1-2",
                    //                    deadline=0,
                    //                    storageTag=""
                    //                }
                    //            }
                    //    }
                    //};
                    //var result = await _eSSApiService.CreateTaskAsync(esstask);
                    //_logger.LogInformation("创建任务PalletOutboundTask è¿”回:  " + result);
                }
                return content.OK("空托出库成功!");
            }
@@ -393,7 +366,7 @@
                            TargetAddress = outStation,
                            TaskStatus = TaskStatusEnum.New.ObjToInt(),
                            TaskType = taskType.ObjToInt(),
                            // TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
                            //TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
                            PalletType = stockInfo.PalletType,
                            WarehouseId = stockInfo.WarehouseId,
                        };
@@ -830,7 +803,7 @@
        }
        #region åˆ†æ‰¹åˆ†é…åº“å­˜
        #region å†…存锁管理器
        private static readonly ConcurrentDictionary<string, SemaphoreSlim> _materialLocks =
@@ -1117,6 +1090,14 @@
            WebResponseContent content = new WebResponseContent();
            try
            {
                var allFactoryAreas = stockViews.SelectMany(sv => sv.Details)
                                                .Select(x => x.FactoryArea)
                                                .GroupBy(x => x)
                                                .ToList();
                if (allFactoryAreas.Count >= 2)
                {
                    return content.Error($"请选择同一厂区区域的库存进行盘点,当前涉及{allFactoryAreas.Count}个不同的厂区");
                }
                List<int> ids = stockViews.Select(x => x.StockId).ToList();
                //获取库存
                List<Dt_StockInfo> stockInfos = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => ids.Contains(x.Id)).Includes(x => x.Details).ToList();
@@ -1127,7 +1108,7 @@
                }
                //获取货位
                List<string> locStrs = stockInfos.Select(x => x.LocationCode).ToList();
                List<Dt_LocationInfo> locationInfos = (List<Dt_LocationInfo>)_locationInfoService.Db.Queryable<Dt_LocationInfo>().Where(x => locStrs.Contains(x.LocationCode));
                List<Dt_LocationInfo> locationInfos =_locationInfoService.Db.Queryable<Dt_LocationInfo>().Where(x => locStrs.Contains(x.LocationCode)).ToList();
                if (stockInfos.Count != locationInfos.Count)
                {
                    string? locStr = locStrs.FirstOrDefault(x => !locationInfos.Select(x => x.LocationCode).ToList().Contains(x));
@@ -1138,7 +1119,9 @@
                    WarehouseId = stockInfos.FirstOrDefault().WarehouseId,
                    TakeStockStatus = TakeStockStatusEnum.盘点中.ObjToInt(),
                    OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.PDCodeRule)),
                    Details = new List<Dt_TakeStockOrderDetail>()
                    AllPalletCode = string.Join(",", stockInfos.Select(item => item.PalletCode).Where(palletCode => !string.IsNullOrEmpty(palletCode))),
                    Remark = outStation
                };
                foreach (var item in stockInfos)
                {
@@ -1147,9 +1130,9 @@
                        return content.Error($"未找到{item.PalletCode}库存明细数据");
                    }
                    Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == item.LocationCode);
                    if (locationInfo == null && (locationInfo.EnableStatus == EnableStatusEnum.Disable.ObjToInt() || locationInfo.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && item.StockStatus != StockStatusEmun.入库完成.ObjToInt())
                    if (locationInfo == null || (locationInfo.EnableStatus == EnableStatusEnum.Disable.ObjToInt() || locationInfo.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) || locationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt() || item.StockStatus != StockStatusEmun.入库完成.ObjToInt())
                    {
                        content.Error($"{item.PalletCode}货位或库存状态不满足出库条件");
                        return content.Error($"{item.PalletCode}货位或库存状态不满足出库条件");
                    }   
                }
                List<Dt_Task> tasks = GetTasks(stockInfos, TaskTypeEnum.OutInventory,outStation);
@@ -1172,7 +1155,7 @@
                _unitOfWorkManage.BeginTran();
                //更新库存状态
                _stockRepository.UpdateData(stockInfos);
                BaseDal.Db.InsertNav(takeStockOrder);
                _takeStockOrder.AddData(takeStockOrder);
                //新建任务
                BaseDal.AddData(tasks);
                _locationInfoService.UpdateData(locationInfos);