wankeda
2 天以前 97073e9e6d03114221436ee0aa1e143d6e2c4a09
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -19,6 +19,7 @@
using MailKit.Search;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Database;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Org.BouncyCastle.Asn1.Tsp;
using SqlSugar;
@@ -444,18 +445,18 @@
            Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details
                .FirstOrDefault(x => x.LinId == stockInfo.Details.FirstOrDefault()?.LinId);
            if (inboundOrder.OrderType == 0 && inboundOrder != null && stockInfo.StockStatus == StockStatusEmun.入库确认.ObjToInt())
            {
                //入库数量回传
                return ProcessNormalInbound(task, stockInfo, locationInfo, lastStatus, inboundOrder, inboundOrderDetail);
            }
            else
            {
                //调拨出入库任务数量回传
                return ProcessAllocateInbound(task, stockInfo, locationInfo, lastStatus, inboundOrder, inboundOrderDetail);
            }
            //if (inboundOrder != null && stockInfo.StockStatus == StockStatusEmun.入库确认.ObjToInt())
            //{
            //入库数量回传
            return ProcessNormalInbound(task, stockInfo, locationInfo, lastStatus, inboundOrder, inboundOrderDetail);
            //}
            //else
            //{
            //    //调拨出入库任务数量回传
            //    return ProcessAllocateInbound(task, stockInfo, locationInfo, lastStatus, inboundOrder, inboundOrderDetail);
            //}
        }
        //其他入库
        private WebResponseContent ProcessNormalInbound(Dt_Task task, Dt_StockInfo stockInfo, Dt_LocationInfo locationInfo,
            int lastStatus, Dt_InboundOrder inboundOrder, Dt_InboundOrderDetail inboundOrderDetail)
        {
@@ -485,11 +486,15 @@
                UpdateInboundOrder(inboundOrder, inboundOrderDetail);
                // 单据数量全部上架完成,处理WMS回传
                //if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
                //{
                //    var stockInfoDetail = stockInfo.Details.FirstOrDefault();
                //    SendInboundInfoToWMS(task, inboundOrder, stockInfo);
                //}
                if (inboundOrder.OrderStatus == InboundStatusEnum.入库完成.ObjToInt() && inboundOrder.OrderType == 0)
                {
                    var stockInfoDetail = stockInfo.Details.FirstOrDefault();
                    SendInboundInfoToWMS(task, inboundOrder, stockInfo);
                }
                else if (inboundOrder.OrderStatus == InboundStatusEnum.入库完成.ObjToInt() && inboundOrder.OrderType == 2)
                {
                    SendAllocateInfoToWMS(task, inboundOrder, stockInfo);
                }
                _unitOfWorkManage.CommitTran();
                return WebResponseContent.Instance.OK();
@@ -500,81 +505,51 @@
                throw;
            }
        }
        ////调拨入库
        //private WebResponseContent ProcessAllocateInbound(Dt_Task task, Dt_StockInfo stockInfo, Dt_LocationInfo locationInfo,
        //    int lastStatus, Dt_InboundOrder inboundOrder, Dt_InboundOrderDetail inboundOrderDetail)
        //{
        //    // 更新入库单明细状态
        //    UpdateInboundOrderDetails(stockInfo, inboundOrder, ref inboundOrderDetail);
        private WebResponseContent ProcessAllocateInbound(Dt_Task task, Dt_StockInfo stockInfo, Dt_LocationInfo locationInfo,
            int lastStatus, Dt_InboundOrder inboundOrder, Dt_InboundOrderDetail inboundOrderDetail)
        {
            //// 如果是最后一条明细
            //if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
            //{
            //    try
            //    {
            //        _unitOfWorkManage.BeginTran();
        //    // 更新库存明细状态
        //    stockInfo.Details.ForEach(x => x.Status = StockStatusEmun.入库完成.ObjToInt());
            //        // 处理调拨入库单
            //        ProcessAllocateInboundOrder(inboundOrder, inboundOrderDetail);
        //    try
        //    {
        //        _unitOfWorkManage.BeginTran();
            //        // 获取相关库存信息
            //        var relatedStockInfo = _stockService.StockInfoService.Repository
            //            .QueryData(x => x.BatchNo == inboundOrderDetail.BatchNo);
        //        // 更新任务状态
        //        UpdateTaskStatus(task);
            //        // 发送调拨信息到WMS
            //        SendAllocateInfoToWMS(task, inboundOrder, relatedStockInfo);
        //        // 更新货位状态
        //        UpdateLocationStatus(locationInfo, lastStatus);
            //        _unitOfWorkManage.CommitTran();
            //    }
            //    catch
            //    {
            //        _unitOfWorkManage.RollbackTran();
            //        throw;
            //    }
            //}
        //        // 更新库存信息
        //        UpdateStockInfo(stockInfo);
            //// 添加历史记录
            //AddInboundOrderDetailHistory(inboundOrderDetail);
        //        // 添加记录
        //        AddRecords(task, stockInfo, locationInfo, lastStatus);
            //return WebResponseContent.Instance.OK();
            // 更新入库单明细状态
            UpdateInboundOrderDetails(stockInfo, inboundOrder, ref inboundOrderDetail);
        //        // 更新入库单
        //        UpdateInboundOrder(inboundOrder, inboundOrderDetail);
            // 更新库存明细状态
            stockInfo.Details.ForEach(x => x.Status = StockStatusEmun.入库完成.ObjToInt());
        //        // 单据数量全部上架完成,处理WMS回传
        //        if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
        //        {
        //            var stockInfoDetail = stockInfo.Details.FirstOrDefault();
        //            SendInboundInfoToWMS(task, inboundOrder, stockInfo);
        //        }
            try
            {
                _unitOfWorkManage.BeginTran();
                // 更新任务状态
                UpdateTaskStatus(task);
                // 更新货位状态
                UpdateLocationStatus(locationInfo, lastStatus);
                // 更新库存信息
                UpdateStockInfo(stockInfo);
                // 添加记录
                AddRecords(task, stockInfo, locationInfo, lastStatus);
                // 更新入库单
                UpdateInboundOrder(inboundOrder, inboundOrderDetail);
                // 单据数量全部上架完成,处理WMS回传
                //if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
                //{
                //    var stockInfoDetail = stockInfo.Details.FirstOrDefault();
                //    SendInboundInfoToWMS(task, inboundOrder, stockInfo);
                //}
                _unitOfWorkManage.CommitTran();
                return WebResponseContent.Instance.OK();
            }
            catch
            {
                _unitOfWorkManage.RollbackTran();
                throw;
            }
        }
        //        _unitOfWorkManage.CommitTran();
        //        return WebResponseContent.Instance.OK();
        //    }
        //    catch
        //    {
        //        _unitOfWorkManage.RollbackTran();
        //        throw;
        //    }
        //}
        #region Helper Methods
@@ -598,7 +573,12 @@
                else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
                {
                    inboundOrderDetail.OrderDetailStatus = InboundStatusEnum.入库中.ObjToInt();
                    inboundOrder.OrderStatus = InboundStatusEnum.入库中.ObjToInt();
                }
            }
            if (inboundOrder.Details.Count == overCount)
            {
                inboundOrder.OrderStatus = InboundStatusEnum.入库完成.ObjToInt();
            }
        }
@@ -739,40 +719,48 @@
            _inboundService.InboundOrderDetailService.DeleteData(inboundOrderDetail);
        }
        private void SendAllocateInfoToWMS(Dt_Task task, Dt_InboundOrder inboundOrder, List<Dt_StockInfo> stockInfos)
        private void SendAllocateInfoToWMS(Dt_Task task, Dt_InboundOrder inboundOrder, Dt_StockInfo stockInfos)
        {
            var detail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfos.FirstOrDefault().Id);
            List<Dt_StockInfo> StockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.WarehouseId == task.WarehouseId).Includes(x => x.Details).Where(x => x.Details.Any(v => v.OrderNo == inboundOrder.OrderNo)).ToList();
            //var dt_StockInfo = _stockRepository.StockInfoRepository.QueryData(x => x.Id == stockInfo.Id).ToList();
            //List<Dt_StockInfo> StockInfos = new List<Dt_StockInfo>();
            //foreach (var item in dt_StockInfo)
            //{
            //    Dt_StockInfo StockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.Id == item.Id).Includes(x => x.Details).First();
            //    StockInfos.Add(StockInfo);
            //}
            if (StockInfos.Count == 0) throw new Exception("未找到库存信息");
            var inventoryAllocate = new InventoryAllocate
            {
                ApiType = "AsnController",
                Method = "AsrsGroudingAsn",
                ApiType = "InventoryAllocateController",
                Method = "AsrsFinishedStockCount",
                Parameters = new List<InventoryAllocate.Allocate>
        {
             new InventoryAllocate.Allocate
            {
                Value = new List<Allocate.data1>
                {
                    new Allocate.data1
                new Allocate.data1
                {
                    No = inboundOrder.OrderNo,
                    //InWarehouse = task.Roadway,
                    TransactionCode = inboundOrder.TransactionCode,
                    InoutType = inboundOrder.OrderType,
                    OrderType = inboundOrder.InoutType,
                    // 遍历所有库存明细,添加到 DetailList
                    DetailList = StockInfos.Select(d => new Allocate.data1.Inventory
                    {
                        No = task.OrderNo,
                        InWarehouse = task.Roadway,
                        TransactionCode = inboundOrder.TransactionCode,
                        InoutType = inboundOrder.OrderType,
                        OrderType = inboundOrder.InoutType,
                        DetailList = new List<Allocate.data1.Inventory>
                        {
                            new Allocate.data1.Inventory
                            {
                                LinId = detail.LinId,
                                MaterielCode = detail.MaterielCode,
                                OrderQuantity = detail.StockQuantity,
                                BatchNo = detail.BatchNo,
                                FinishQty = detail.StockQuantity,
                                LocationName = task.TargetAddress
                            }
                        }
                    }
                        LinId = d.Details.FirstOrDefault()?.LinId?? "",
                        MaterielCode = d.Details.FirstOrDefault()?.MaterielCode?? "",
                        OrderQuantity = d.Details.FirstOrDefault().StockQuantity,
                        BatchNo = d.BatchNo,
                        LPN_No = d.PalletCode,
                        FinishQty = d.Details.FirstOrDefault().StockQuantity,
                        LocationName = d.LocationCode
                    }).ToList()
                }
                }
            }
        }
@@ -849,8 +837,26 @@
                    out var locationInfo, out var outStockLockInfos);
                if (!validationResult.Status) return validationResult;
                int lastStatus = locationInfo.LocationStatus;
                locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
                Dt_OutboundOrderDetail outboundOrderDetails = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>()
                    .Where(x => x.BatchNo == stockInfo.Details.FirstOrDefault().BatchNo)
                    .First();
                if (outboundOrderDetails == null) return WebResponseContent.Instance.Error("未找到出库单信息");
                Dt_OutboundOrder inboundOrder = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrder>()
    .Where(x => x.Id == outboundOrderDetails.OrderId)
    .Includes(x => x.Details)
    .First();
                if (inboundOrder == null) return WebResponseContent.Instance.Error("未找到出库单信息");
                // 2. 处理出库订单详情
                var outboundOrderDetails = ProcessOutboundOrderDetails(outStockLockInfos);
                //var outboundOrderDetails = ProcessOutboundOrderDetails(outStockLockInfos);
                UpdateOutboundOrderDetails(stockInfo, inboundOrder, ref outboundOrderDetails);
                // 3. 执行核心出库逻辑
                return ExecuteOutboundLogic(task, stockInfo, locationInfo, outboundOrderDetails);
@@ -889,33 +895,34 @@
            return WebResponseContent.Instance.OK();
        }
        private List<Dt_OutboundOrderDetail> ProcessOutboundOrderDetails(List<Dt_OutStockLockInfo> outStockLockInfos)
        {
            var outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
        //private List<Dt_OutboundOrderDetail> ProcessOutboundOrderDetails(List<Dt_OutStockLockInfo> outStockLockInfos)
        //{
        //    var outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
            foreach (var lockInfo in outStockLockInfos)
            {
                var detail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.BatchNo == lockInfo.BatchNo);
                if (detail != null)
                {
                    detail.OverOutQuantity = lockInfo.OriginalQuantity;
                    if (detail.LockQuantity == detail.OrderQuantity)
                    {
                        detail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
                    }
                    outboundOrderDetails.Add(detail);
                }
            }
        //    foreach (var lockInfo in outStockLockInfos)
        //    {
        //        List<Dt_OutboundOrderDetail> detail = _outboundService.OutboundOrderDetailService.Repository.QueryData(x => x.Id == lockInfo.Id);
        //        if (detail != null)
        //        {
        //            detail.OverOutQuantity = lockInfo.OriginalQuantity;
        //            if (detail.LockQuantity == detail.OrderQuantity)
        //            {
        //                detail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
        //            }
        //            outboundOrderDetails.Add(detail);
        //        }
        //    }
            return outboundOrderDetails;
        }
        //    return outboundOrderDetails;
        //}
        private WebResponseContent ExecuteOutboundLogic(Dt_Task task, Dt_StockInfo stockInfo,
            Dt_LocationInfo locationInfo, List<Dt_OutboundOrderDetail> outboundOrderDetails)
            Dt_LocationInfo locationInfo, Dt_OutboundOrderDetail outboundOrderDetails)
        {
            try
            {
                _unitOfWorkManage.BeginTran();
                // 更新出库订单详情
                _outboundService.OutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails);
@@ -934,22 +941,26 @@
                // 根据订单类型处理不同逻辑
                var outDetail = _outboundService.OutboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
                    .Where(x => x.BatchNo == outboundOrderDetails.FirstOrDefault().BatchNo).First();
                    .Where(x => x.BatchNo == outboundOrderDetails.BatchNo).First();
                var outboundOrder = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrder>()
                    .Where(x => x.Id == outDetail.OrderId).Includes(x => x.Details).First();
                if (outboundOrder.OrderType == 1) // 普通出库 && outDetail.OrderDetailStatus = OutboundStatusEnum.出库完成
                if (outboundOrder.OrderStatus == OutboundStatusEnum.出库完成.ObjToInt())
                {
                    ProcessNormalOutbound(task, stockInfo, outboundOrder, outDetail);
                    var stockInfoDetail = stockInfo.Details.FirstOrDefault();
                    //ProcessNormalOutbound(task, stockInfo, outboundOrder, outDetail);
                    SendNormalOutboundToWMS(task, outboundOrder, stockInfoDetail, outDetail);
                }
                else if (outboundOrder.OrderType == 240) // 盘点出库
                if (outboundOrder.OrderType == 240) // 盘点出库
                {
                    // 盘点出库特殊处理逻辑
                }
                else // 调拨出库
                {
                    ProcessAllocateOutbound(task, stockInfo, outboundOrder, outDetail);
                }
                //else // 调拨出库
                //{
                //    ProcessAllocateOutbound(task, stockInfo, outboundOrder, outDetail);
                //}
                _unitOfWorkManage.CommitTran();
                return WebResponseContent.Instance.OK();
@@ -960,12 +971,45 @@
                throw;
            }
        }
        private void UpdateOutboundOrderDetails(Dt_StockInfo stockInfo, Dt_OutboundOrder inboundOrder,
    ref Dt_OutboundOrderDetail inboundOrderDetail)
        {
            int overCount = inboundOrder.Details.Count(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
            inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfo.Details.FirstOrDefault()?.BatchNo);
            foreach (var item in stockInfo.Details)
            {
                if (inboundOrderDetail == null) continue;
                inboundOrderDetail.OverOutQuantity += item.OutboundQuantity;
                if (inboundOrderDetail.OverOutQuantity == inboundOrderDetail.OrderQuantity)
                {
                    inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
                    overCount++;
                }
                else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
                {
                    inboundOrderDetail.OrderDetailStatus = OutboundStatusEnum.出库中.ObjToInt();
                    inboundOrder.OrderStatus = OutboundStatusEnum.出库中.ObjToInt();
                }
            }
            if (inboundOrder.Details.Count == overCount)
            {
                inboundOrder.OrderStatus = OutboundStatusEnum.出库完成.ObjToInt();
            }
        }
        private void UpdateStockStatus(Dt_StockInfo stockInfo, Dt_LocationInfo locationInfo)
        {
            stockInfo.LocationCode = locationInfo.LocationCode;
            stockInfo.LocationCode = "";
            stockInfo.StockStatus = StockStatusEmun.出库完成.ObjToInt();
            _stockService.StockInfoService.Repository.UpdateData(stockInfo);
            stockInfo.Details.ForEach(x =>
            {
                x.Status = StockStatusEmun.出库完成.ObjToInt();
            });
            _stockRepository.StockInfoRepository.UpdateData(stockInfo);
            _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details);
        }
        private void UpdateLocationStatus(Dt_LocationInfo locationInfo)
@@ -996,32 +1040,40 @@
            var stockInfoDetail = _stockRepository.StockInfoDetailRepository.Db.Queryable<Dt_StockInfoDetail>()
                .Where(x => x.StockId == stockInfo.Id).First();
            if (outboundOrder.OrderStatus == OutboundStatusEnum.出库完成.ObjToInt())
            {
                var history = new Dt_OutboundOrder_Hty
                {
                    OrderStatus = outboundOrder.OrderStatus,
                    CreateType = outboundOrder.CreateType,
                    UpperOrderNo = outboundOrder.UpperOrderNo,
                    OrderNo = outboundOrder.OrderNo,
                    OutWareHouse = outboundOrder.OutWareHouse,
                    TransactionCode = outboundOrder.TransactionCode,
                    InoutType = outboundOrder.InoutType,
                    OrderType = outboundOrder.OrderType,
                    Creater = "WMS",
                    CreateDate = DateTime.Now,
                };
                _outboundOrder_HtyService.AddData(history);
                _outboundService.OutboundOrderService.DeleteData(outboundOrder);
            }
            //if (outboundOrder.OrderStatus == OutboundStatusEnum.出库完成.ObjToInt())
            //{
            //    var history = new Dt_OutboundOrder_Hty
            //    {
            //        OrderStatus = outboundOrder.OrderStatus,
            //        CreateType = outboundOrder.CreateType,
            //        UpperOrderNo = outboundOrder.UpperOrderNo,
            //        OrderNo = outboundOrder.OrderNo,
            //        OutWareHouse = outboundOrder.OutWareHouse,
            //        TransactionCode = outboundOrder.TransactionCode,
            //        InoutType = outboundOrder.InoutType,
            //        OrderType = outboundOrder.OrderType,
            //        Creater = "WMS",
            //        CreateDate = DateTime.Now,
            //    };
            //    _outboundOrder_HtyService.AddData(history);
            //    _outboundService.OutboundOrderService.DeleteData(outboundOrder);
            //}
            MoveOutboundDetailToHistory(outDetail);
            //MoveOutboundDetailToHistory(outDetail);
            // 发送出库信息到WMS
            SendNormalOutboundToWMS(task, outboundOrder, stockInfoDetail, outDetail);
            if (outboundOrder.OrderStatus == OutboundStatusEnum.出库完成.ObjToInt() && outboundOrder.OrderType == 0)
            {
                SendNormalOutboundToWMS(task, outboundOrder, stockInfoDetail, outDetail);
            }
            else if (outboundOrder.OrderStatus == OutboundStatusEnum.出库完成.ObjToInt() && outboundOrder.OrderType == 2)
            {
                SendAllocateOutboundToWMS(task, outboundOrder, stockInfoDetail, outDetail);
            }
            // 删除库存信息
            DeleteStockInfo(stockInfo);
            //DeleteStockInfo(stockInfo);
        }
        private void ProcessAllocateOutbound(Dt_Task task, Dt_StockInfo stockInfo,
@@ -1051,7 +1103,7 @@
            MoveOutboundDetailToHistory(outDetail);
            // 发送调拨出库信息到WMS
            SendAllocateOutboundToWMS(task, outboundOrder, outDetail, relatedStockInfos);
            // 删除库存信息
            DeleteStockInfo(stockInfo);
@@ -1080,51 +1132,46 @@
        {
            List<Dt_StockInfo> StockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.WarehouseId == task.WarehouseId).Includes(x => x.Details).Where(x => x.Details.Any(v => v.OrderNo == outboundOrder.OrderNo)).ToList();
            //var dt_StockInfo = _stockRepository.StockInfoRepository.QueryData(x => x.Id == stockInfo.Id).ToList();
            //List<Dt_StockInfo> StockInfos = new List<Dt_StockInfo>();
            //foreach (var item in dt_StockInfo)
            //{
            //    Dt_StockInfo StockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.Id == item.Id).Includes(x => x.Details).First();
            //    StockInfos.Add(StockInfo);
            //}
            //List<Dt_StockInfo> StockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.WarehouseId == task.WarehouseId).Includes(x => x.Details).Where(x => x.Details.Any(v => v.BatchNo == outDetail.BatchNo)).ToList();
            List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.OrderNo == outboundOrder.OrderNo);
            if (StockInfos.Count == 0) throw new Exception("未找到库存信息");
            if (outStockLockInfos.Count == 0) throw new Exception("未找到库存信息");
            // 构建回传数据,将所有匹配的库存明细加入 DetailList
            var passBack = new HouseoutboundPassBack
            {
                ApiType = "ShippingOrderController",
                Method = "AsrsOutboundSO",
                ApiType = "InventoryAllocateController",
                Method = "AsrsFinishedStockCount",
                Parameters = new List<HouseoutboundPassBack.datas>
    {
        new HouseoutboundPassBack.datas
        {
            new HouseoutboundPassBack.datas
            Value = new List<HouseoutboundPassBack.datas.data1>
            {
                Value = new List<HouseoutboundPassBack.datas.data1>
                new HouseoutboundPassBack.datas.data1
                {
                    new HouseoutboundPassBack.datas.data1
                    {
                        No = outboundOrder.OrderNo,
                        OutWareHouse = task.Roadway,
                        TransactionCode = outboundOrder.TransactionCode,
                        InoutType = outboundOrder.OrderType,
                        OrderType = outboundOrder.InoutType,
                        DetailList = new List<HouseoutboundPassBack.datas.data1.Inbound>
                    No = outboundOrder.OrderNo,
                    OutWareHouse = task.Roadway,
                    TransactionCode = outboundOrder.TransactionCode,
                    InoutType = outboundOrder.OrderType,
                    OrderType = outboundOrder.InoutType,
                    DetailList = outStockLockInfos.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
                        {
                            new HouseoutboundPassBack.datas.data1.Inbound
                            {
                                LinId = outDetail.LinId,
                                LPN_No = task.PalletCode,
                                MaterielCode = stockInfoDetail.MaterielCode,
                                OrderQuantity = stockInfoDetail.OutboundQuantity,
                                BatchNo = stockInfoDetail.BatchNo,
                                FinishQty = stockInfoDetail.OutboundQuantity,
                                LocationName = task.SourceAddress
                            }
                        }
                    }
                            LinId = d.LinId?? "",
                            LPN_No = d.PalletCode,
                            MaterielCode = d.MaterielCode?? "",
                            OrderQuantity = d.OrderQuantity,
                            BatchNo = d.BatchNo,
                            FinishQty = d.OrderQuantity,
                            LocationName = d.LocationCode
                        })
                        .ToList()
                }
            }
        }
    }
            };
            var authResult = AuthenticateWithWMS();
@@ -1141,8 +1188,12 @@
        }
        private void SendAllocateOutboundToWMS(Dt_Task task, Dt_OutboundOrder outboundOrder,
            Dt_OutboundOrderDetail outDetail, List<Dt_StockInfo> stockInfos)
            Dt_StockInfoDetail stockInfoDetail, Dt_OutboundOrderDetail outDetail)
        {
            List<Dt_OutStockLockInfo> outStockLockInfos = _outboundService.OutboundStockLockInfoService.Repository.QueryData(x => x.OrderNo == outboundOrder.OrderNo);
            if (outStockLockInfos.Count == 0) throw new Exception("未找到库存信息");
            var allocate = new InventoryAllocate
            {
                ApiType = "InventoryAllocateController",
@@ -1160,7 +1211,7 @@
                        TransactionCode = outboundOrder.TransactionCode,
                        InoutType = outboundOrder.OrderType,
                        OrderType = outboundOrder.InoutType,
                        DetailList = stockInfos.Select(item =>
                        DetailList = outStockLockInfos.Select(item =>
                        {
                            var detail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == item.Id);
                            return new Allocate.data1.Inventory