wangxinhui
2026-03-26 5c272c606bdf2da3577dbaa5f48d0ee163f1e7d2
ÏîÄ¿´úÂë/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -1,4 +1,4 @@

using System;
using System.Collections.Generic;
using System.Linq;
@@ -223,7 +223,7 @@
                            }
                            if (outStockLockInfosMES != null && outStockLockInfosMES.Count() > 0)
                            {
                                Dt_AGVStationInfo aGVStationInfo = _basicRepository.AGVStationInfoRepository.QueryFirst(x=>x.AGVStationCode==task.TargetAddress);
                                Dt_AGVStationInfo aGVStationInfo = _basicRepository.AGVStationInfoRepository.QueryFirst(x=>x.AGVStationCode==task.TargetAddress || x.MESPointCode == task.TargetAddress);
                                MESDeliveryModel mESDeliveryModel = MESDeliveryUp(outStockLockInfosMES, aGVStationInfo.MESPointCode);
                                MESResponse response = _invokeMESService.MESDelivery(mESDeliveryModel).DeserializeObject<MESResponse>() ?? throw new Exception("未获取到返回信息");
                                if (!response.Result)
@@ -709,7 +709,7 @@
                }
                content.Message = result.Item6;
                //处理出库数据
                return GenerateOutboundTaskDataUpdate(tasks, stockInfos, outSGOrderDetails, outStockLockInfos, locationInfos);
                return GenerateOutboundTaskDataUpdate(tasks, stockInfos, outSGOrderDetails, outStockLockInfos, locationInfos, result.Item6);
            }
            catch (Exception ex)
            {
@@ -746,6 +746,14 @@
            //分配库存
            (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>,string) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails);
            //保存缺料状态,无论是否生成了任务
            var shortageDetails = result.Item2.Where(x => x.OutSGOrderDetailStatus == OutOrderStatusEnum.缺料.ObjToInt()).ToList();
            if (shortageDetails.Any())
            {
                _outboundRepository.OutSGOrderDetailRepository.UpdateData(shortageDetails);
            }
            if (result.Item1 != null && result.Item1.Count > 0)
            {
                //获取任务
@@ -776,7 +784,8 @@
            }
            else
            {
                throw new Exception("无库存");
                //没有库存,但已经在AssignStockOutbound方法中标记了缺料状态,并且已经保存
                orderDetails = result.Item2;
            }
            return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos, result.Item5);
@@ -785,7 +794,7 @@
        /// å¤„理出库数据
        /// </summary>
        /// <returns></returns>
        public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutSGOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null)
        public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutSGOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null, string message = "")
        {
            try
            {
@@ -795,8 +804,12 @@
                {
                    tasks.ForEach(x =>
                    {
                        string orderNos = string.Join(",", outStockLockInfos.Where(t => t.PalletCode == x.PalletCode).Select(x => x.OrderNo).Distinct());
                        List<Dt_OutStockLockInfo> outStockNos = outStockLockInfos.Where(t => t.PalletCode == x.PalletCode).ToList();
                        List<int> outDetailIds = outStockNos.Select(t => t.OrderDetailId).ToList();
                        int numberNo = outboundOrderDetails.Where(t => outDetailIds.Contains(t.Id)).OrderBy(x => x.Number).FirstOrDefault().Number;
                        string orderNos = string.Join(",", outStockNos.Select(t => t.OrderNo).Distinct());
                        x.OrderNo = orderNos;
                        x.Grade = numberNo;
                    });
                }
                BaseDal.AddData(tasks);
@@ -825,7 +838,7 @@
                }
                _unitOfWorkManage.CommitTran();
                PushTasksToWCS(tasks);
                return WebResponseContent.Instance.OK();
                return WebResponseContent.Instance.OK(message);
            }
            catch (Exception ex)
            {