1
yangpeixing
2026-04-01 f1bf3ef09713182d434e22dfd8623ea73e02d6d3
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -578,9 +578,9 @@
                                return WebResponseContent.Instance.Error("未找到入库单信息");
                            }
                            var allBoxCodesForDetail = BaseDal.Db.Queryable<Dt_StockInfoDetailCP>()
                              .Where(x => dt_StockInfo.Details.Select(d => d.Id).Contains(x.StockDetailId))
                              .Select(x => x.BoxCode)
                              .ToList();
              .Where(x => dt_StockInfo.Details.Select(d => d.Id).Contains(x.StockDetailId))
              .Select(x => x.BoxCode)
              .ToList();
                            // 2. 获取托盘下的所有箱号
                            var boxCodes = new List<string>();
@@ -617,7 +617,7 @@
                                return WebResponseContent.Instance.Error($"未找到对应的入库单明细");
                            }
                            // 更新入库单明细状态
                            // 更新入库单明细状态
                            foreach (var inboundOrderDetail in inboundOrderDetails)
                            {
                                // 检查该明细是否已全部入库
@@ -808,10 +808,9 @@
                                        // 判断Success的值
                                        if (!response.Success)
                                        {
                                            WriteLog.Write_Log("API", "SMOM立库回传给WMS", "请求失败", new { 请求报文 = houseInboundPassBack, 接收报文 = response });
                                            throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}");
                                        }
                                        WriteLog.Write_Log("API", "SMOM立库入库回传WMS", "请求成功", new { 请求报文 = houseInboundPassBack, 接收报文 = response });
                                    }
                                }
@@ -887,11 +886,8 @@
                                        var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "调拨入库数量回传WMS");
                                        if (!response.Success)
                                        {
                                            WriteLog.Write_Log("API", "SMOM调拨入库数量回传WMS", "请求失败", new { 请求报文 = inventoryAllocate, 接收报文 = response });
                                            throw new Exception($"操作失败:{response.Message ?? "未提供错误信息"}");
                                        }
                                        WriteLog.Write_Log("API", "SMOM调拨入库数量回传WMS", "请求成功", new { 请求报文 = inventoryAllocate, 接收报文 = response });
                                    }
                                }
                                else if (inboundOrder.OrderStatus == InboundStatusEnum.入库完成.ObjToInt() && inboundOrder.OrderType == 5 && inboundOrder.System.Equals("SMOM"))
@@ -917,28 +913,33 @@
                                            {
                                                Value =  new Parame.Syncretism
                                                {
                                                    OrderNo = inboundOrder.OrderNo,
                                                    Details = StockInfos.SelectMany(stockInfo =>
                                                        stockInfo.Details.Select(g =>
                                                        {
                                                            //var InboundOrderde1=dt_InboundOrder.Details.FirstOrDefault;
                                                    {
                                                        OrderNo = inboundOrder.OrderNo,
                                                        Details =   StockInfos.SelectMany(stockInfo =>
                                                            return new Parame.Syncretism.details
                                                            {
                                                                MoveType = 0,
                                                                WareHouseCode = warehouse.WarehouseCode,
                                                                ItemCode = g.MaterielCode,
                                                                MoveNumber = g.StockQuantity,
                                                                LotNo = g.BatchNo,
                                                                WipBatch = g.BatchNo,
                                                                Lpn = g.StockDetails.FirstOrDefault().LPNNO,
                                                                LocationName = g.StockDetails.FirstOrDefault().OrinalLocation,
                                                                TargetLocName = stockInfo.LocationCode, // 添加null检查
                                                                TargetLpn = stockInfo.PalletCode, // 添加null检查
                                                            };
                                                        })).ToList()
                                                }
                                                    stockInfo.Details.Select(g =>
                                                    {
                                                       //var InboundOrderde1=dt_InboundOrder.Details.FirstOrDefault;
                                                       return new Parame.Syncretism.details
                                                       {
                                                        MoveType = 0,
                                                        WareHouseCode = warehouse.WarehouseCode,
                                                        ItemCode = g.MaterielCode,
                                                        MoveNumber = g.StockQuantity,
                                                        LotNo = g.BatchNo,
                                                        WipBatch = g.BatchNo,
                                                        Lpn = g.StockDetails.FirstOrDefault().LPNNO,
                                                        LocationName = g.StockDetails.FirstOrDefault().OrinalLocation,
                                                        TargetLocName = stockInfo.LocationCode, // 添加null检查
                                                        TargetLpn = stockInfo.PalletCode, // 添加null检查
                                                       };
                                                    })).ToList()
                                                    }
                                            }
                                        }
                                    };
@@ -947,19 +948,17 @@
                                    if (authResult.IsSuccess)
                                    {
                                        houseSyncretism.Context = new Dictionary<string, string>
                                        {
                                            { "Ticket", authResult.Ticket },
                                            { "InvOrgId", authResult.InvOrgId }
                                            {
                                                { "Ticket", authResult.Ticket },
                                                { "InvOrgId", authResult.InvOrgId }
                                        };
                                            };
                                        var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, houseSyncretism, "立库入库数量回传WMS");
                                        if (!response.Success)
                                        {
                                            WriteLog.Write_Log("API", "SMOM立库入库数量回传WMS", "请求失败", new { 请求报文 = houseSyncretism, 接收报文 = response });
                                            throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}");
                                        }
                                        WriteLog.Write_Log("API", "SMOM立库入库数量回传WMS", "请求成功", new { 请求报文 = houseSyncretism, 接收报文 = response });
                                    }
@@ -1088,8 +1087,6 @@
                                if (inboundOrder.OrderStatus == InboundStatusEnum.入库完成.ObjToInt() && inboundOrder.OrderType == 0 && inboundOrder.System.Equals("SMOM"))
                                {
                                    //SendInboundInfoToWMS(task, inboundOrder, stockInfo);
                                    SendInboundInfoToWMS(task, inboundOrder, dt_StockInfo);
                                }
                                else if (inboundOrder.OrderStatus == InboundStatusEnum.入库完成.ObjToInt() && inboundOrder.OrderType == 2 && inboundOrder.System.Equals("SMOM"))
                                {
@@ -1509,13 +1506,11 @@
                // 判断Success的值
                if (response.Success)
                {
                    WriteLog.Write_Log("API", "SMOM立库入库回传WMS", "请求成功", new { 请求报文 = houseInboundPassBack, 接收报文 = response });
                    // 如果Success为true,返回需要的值(这里以返回整个响应对象为例)
                    return WebResponseContent.Instance.OK();
                }
                else
                {
                    WriteLog.Write_Log("API", "SMOM立库入库回传WMS", "请求失败", new { 请求报文 = houseInboundPassBack, 接收报文 = response });
                    // 如果Success为false,抛出异常并包含错误信息
                    throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}");
                }
@@ -1536,9 +1531,9 @@
                Parameters = new List<HouseBackboundPassBack.backdata>
                {
                   new HouseBackboundPassBack.backdata
                   {
                    {
                         Value= new List<backdata.backdata1>
                         {
                        {
                            new backdata.backdata1
                            {
                                OrderType = returnOrder.OrderType,
@@ -1554,7 +1549,7 @@
                                WarehouseCode = returnOrder.WarehouseCode,
                                System = returnOrder.System,
                            }
                         }
                        }
                   }
                }
            };
@@ -1570,16 +1565,11 @@
                // 判断Success的值
                if (response.Success)
                {
                    WriteLog.Write_Log("API", "取消发货后立库反拣入库回传WMS", "请求成功", new { 请求报文 = houseReturnOrders, 接收报文 = response });
                    // 如果Success为true,返回需要的值(这里以返回整个响应对象为例)
                    return WebResponseContent.Instance.OK();
                }
                else
                {
                    WriteLog.Write_Log("API", "取消发货后立库反拣入库回传WMS", "请求失败", new { 请求报文 = houseReturnOrders, 接收报文 = response });
                    // 如果Success为false,抛出异常并包含错误信息
                    throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}");
                }
@@ -1644,33 +1634,33 @@
                ApiType = "InventoryAllocateController",
                Method = "AsrsFinishedStockCount",
                Parameters = new List<InventoryAllocate.Allocate>
        {
             new InventoryAllocate.Allocate
            {
                Value = new List<Allocate.data1>
                {
                    new InventoryAllocate.Allocate
                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
                    {
                        Value = new List<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
                                {
                                    LinId = d.Details.FirstOrDefault()?.LinId?? "",
                                    MaterielCode = d.Details.FirstOrDefault()?.MaterielCode?? "",
                                    OrderQuantity = d.Details.FirstOrDefault().StockQuantity,
                                    BatchNo = d.BatchNo,
                                    LPNNo = d.PalletCode,
                                    FinishQty = d.Details.FirstOrDefault().StockQuantity,
                                    LocationName = d.LocationCode
                                }).ToList()
                            }
                        }
                    }
                        LinId = d.Details.FirstOrDefault()?.LinId?? "",
                        MaterielCode = d.Details.FirstOrDefault()?.MaterielCode?? "",
                        OrderQuantity = d.Details.FirstOrDefault().StockQuantity,
                        BatchNo = d.BatchNo,
                        LPNNo = d.PalletCode,
                        FinishQty = d.Details.FirstOrDefault().StockQuantity,
                        LocationName = d.LocationCode
                    }).ToList()
                }
                }
            }
        }
            };
            var authResult = AuthenticateWithWMS();
@@ -1683,8 +1673,6 @@
        };
                HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "调拨入库数量回传WMS");
                WriteLog.Write_Log("API", "调拨入库数量回传WMS", "请求", new { 请求报文 = inventoryAllocate, 接收报文 = inventoryAllocate });
            }
        }
@@ -1713,10 +1701,10 @@
            {
                ApiType = "AuthenticationController",
                Parameters = new List<Parameter>
                {
                    new Parameter { Value = "LK-Admin" },
                    new Parameter { Value = "LK-Admin" }
                },
        {
            new Parameter { Value = "LK-Admin" },
            new Parameter { Value = "LK-Admin" }
        },
                Method = "Login",
            };
@@ -1891,7 +1879,6 @@
                                        foreach (var orderDetail in outboundOrderDetails1.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()))
                                        {
                                            FeedBackOutERP(outboundOrder.OrderNo, orderDetail.LinId);
                                        }
                                        // 如果有完成的明细,下载报表
@@ -1918,33 +1905,33 @@
                                                ApiType = "ShippingOrderController",
                                                Method = "AsrsOutboundSO",
                                                Parameters = new List<HouseoutboundPassBack.datas>
                                                {
                                                    new HouseoutboundPassBack.datas
                                                    {
                                                        Value = new List<HouseoutboundPassBack.datas.data1>
                        {
                            new HouseoutboundPassBack.datas
                            {
                                Value = new List<HouseoutboundPassBack.datas.data1>
                                {
                                    new HouseoutboundPassBack.datas.data1
                                    {
                                        No = outboundOrder.OrderNo,
                                        OutWareHouse = task.Roadway,
                                        TransactionCode = outboundOrder.TransactionCode,
                                        InoutType = outboundOrder.OrderType,
                                        OrderType = outboundOrder.InoutType,
                                              DetailList = outStockLockInfoList.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
                                                        {
                                                            new HouseoutboundPassBack.datas.data1
                                                            {
                                                                No = outboundOrder.OrderNo,
                                                                OutWareHouse = task.Roadway,
                                                                TransactionCode = outboundOrder.TransactionCode,
                                                                InoutType = outboundOrder.OrderType,
                                                                OrderType = outboundOrder.InoutType,
                                                                DetailList = outStockLockInfoList.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
                                                                {
                                                                    LinId = d.LinId?? "",
                                                                    LPN_No = d.PalletCode,
                                                                    MaterielCode = d.MaterielCode?? "",
                                                                    OrderQuantity = d.OrderQuantity,
                                                                    BatchNo = d.BatchNo,
                                                                    FinishQty = d.OrderQuantity,
                                                                    LocationName = d.LocationCode
                                                                })
                                                                .ToList()
                                                            }
                                                        }
                                                    }
                                                }
                                                            LinId = d.LinId?? "",
                                                            LPN_No = d.PalletCode,
                                                            MaterielCode = d.MaterielCode?? "",
                                                            OrderQuantity = d.OrderQuantity,
                                                            BatchNo = d.BatchNo,
                                                            FinishQty = d.OrderQuantity,
                                                            LocationName = d.LocationCode
                                                        })
                                                        .ToList()
                                    }
                                }
                            }
                        }
                                            };
                                            //调用SMOM接口...
@@ -1959,11 +1946,8 @@
                                                var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "立库出库数量回传WMS");
                                                if (!response.Success)
                                                {
                                                    WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求失败", new { 请求报文 = passBack, 接收报文 = response });
                                                    throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}");
                                                }
                                                WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求成功", new { 请求报文 = passBack, 接收报文 = response });
                                            }
                                        }
@@ -1975,36 +1959,36 @@
                                                ApiType = "InventoryAllocateController",
                                                Method = "AsrsFinishedStockCount",
                                                Parameters = new List<Allocate>
                                                {
                                                    new Allocate
                                                    {
                                                        Value = new List<Allocate.data1>
                        {
                            new Allocate
                            {
                                Value = new List<Allocate.data1>
                                {
                                    new Allocate.data1
                                    {
                                        No = outboundOrder.OrderNo,
                                        InWarehouse = task.Roadway,
                                        TransactionCode = outboundOrder.TransactionCode,
                                        InoutType = outboundOrder.OrderType,
                                        OrderType = outboundOrder.InoutType,
                                        ActiveType = 2,
                                                DetailList = outStockLockInfoList.Select(item =>
                                                        {
                                                            new Allocate.data1
                                                            return new Allocate.data1.Inventory
                                                            {
                                                                No = outboundOrder.OrderNo,
                                                                InWarehouse = task.Roadway,
                                                                TransactionCode = outboundOrder.TransactionCode,
                                                                InoutType = outboundOrder.OrderType,
                                                                OrderType = outboundOrder.InoutType,
                                                                ActiveType = 2,
                                                                DetailList = outStockLockInfoList.Select(item =>
                                                                {
                                                                    return new Allocate.data1.Inventory
                                                                    {
                                                                        LinId = item.LinId,
                                                                        LPNNo = item.PalletCode,
                                                                        MaterielCode = item.MaterielCode,
                                                                        OrderQuantity = item.OrderQuantity,
                                                                        BatchNo = item.BatchNo,
                                                                        FinishQty = item.OrderQuantity,
                                                                        LocationName = task.SourceAddress
                                                                    };
                                                                }).ToList()
                                                            }
                                                        }
                                                    }
                                                }
                                                                LinId = item.LinId,
                                                                LPNNo = item.PalletCode,
                                                                MaterielCode = item.MaterielCode,
                                                                OrderQuantity = item.OrderQuantity,
                                                                BatchNo = item.BatchNo,
                                                                FinishQty = item.OrderQuantity,
                                                                LocationName = task.SourceAddress
                                                            };
                                                        }).ToList()
                                    }
                                }
                            }
                        }
                                            };
                                            // 调用SMOM接口...
@@ -2012,19 +1996,15 @@
                                            if (authResult.IsSuccess)
                                            {
                                                allocate.Context = new Dictionary<string, string>
                                                {
                                                    { "Ticket", authResult.Ticket },
                                                    { "InvOrgId", authResult.InvOrgId }
                                                };
                                        {
                                            { "Ticket", authResult.Ticket },
                                            { "InvOrgId", authResult.InvOrgId }
                                        };
                                                var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "立库入库数量回传WMS");
                                                if (!response.Success)
                                                {
                                                    WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求失败", new { 请求报文 = allocate, 接收报文 = response });
                                                    throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}");
                                                }
                                                WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求成功", new { 请求报文 = allocate, 接收报文 = response });
                                            }
                                        }
                                    }
@@ -2157,33 +2137,33 @@
                                                ApiType = "ShippingOrderController",
                                                Method = "AsrsOutboundSO",
                                                Parameters = new List<HouseoutboundPassBack.datas>
                                                {
                                                    new HouseoutboundPassBack.datas
                                                    {
                                                        Value = new List<HouseoutboundPassBack.datas.data1>
                        {
                            new HouseoutboundPassBack.datas
                            {
                                Value = new List<HouseoutboundPassBack.datas.data1>
                                {
                                    new HouseoutboundPassBack.datas.data1
                                    {
                                        No = outboundOrder.OrderNo,
                                        OutWareHouse = task.Roadway,
                                        TransactionCode = outboundOrder.TransactionCode,
                                        InoutType = outboundOrder.OrderType,
                                        OrderType = outboundOrder.InoutType,
                                              DetailList = outStockLockInfoList.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
                                                        {
                                                            new HouseoutboundPassBack.datas.data1
                                                            {
                                                                No = outboundOrder.OrderNo,
                                                                OutWareHouse = task.Roadway,
                                                                TransactionCode = outboundOrder.TransactionCode,
                                                                InoutType = outboundOrder.OrderType,
                                                                OrderType = outboundOrder.InoutType,
                                                                DetailList = outStockLockInfoList.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
                                                                {
                                                                    LinId = d.LinId?? "",
                                                                    LPN_No = d.PalletCode,
                                                                    MaterielCode = d.MaterielCode?? "",
                                                                    OrderQuantity = d.OrderQuantity,
                                                                    BatchNo = d.BatchNo,
                                                                    FinishQty = d.OrderQuantity,
                                                                    LocationName = d.LocationCode
                                                                })
                                                                .ToList()
                                                            }
                                                        }
                                                    }
                                                }
                                                            LinId = d.LinId?? "",
                                                            LPN_No = d.PalletCode,
                                                            MaterielCode = d.MaterielCode?? "",
                                                            OrderQuantity = d.OrderQuantity,
                                                            BatchNo = d.BatchNo,
                                                            FinishQty = d.OrderQuantity,
                                                            LocationName = d.LocationCode
                                                        })
                                                        .ToList()
                                    }
                                }
                            }
                        }
                                            };
                                            //调用SMOM接口...
@@ -2198,12 +2178,8 @@
                                                var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "立库出库数量回传WMS");
                                                if (!response.Success)
                                                {
                                                    WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求失败", new { 请求报文 = passBack, 接收报文 = response });
                                                    throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}");
                                                }
                                                WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求成功", new { 请求报文 = passBack, 接收报文 = response });
                                            }
                                        }
@@ -2215,36 +2191,36 @@
                                                ApiType = "InventoryAllocateController",
                                                Method = "AsrsFinishedStockCount",
                                                Parameters = new List<Allocate>
                                                {
                                                    new Allocate
                                                    {
                                                        Value = new List<Allocate.data1>
                        {
                            new Allocate
                            {
                                Value = new List<Allocate.data1>
                                {
                                    new Allocate.data1
                                    {
                                        No = outboundOrder.OrderNo,
                                        InWarehouse = task.Roadway,
                                        TransactionCode = outboundOrder.TransactionCode,
                                        InoutType = outboundOrder.OrderType,
                                        OrderType = outboundOrder.InoutType,
                                        ActiveType = 2,
                                                DetailList = outStockLockInfoList.Select(item =>
                                                        {
                                                            new Allocate.data1
                                                            return new Allocate.data1.Inventory
                                                            {
                                                                No = outboundOrder.OrderNo,
                                                                InWarehouse = task.Roadway,
                                                                TransactionCode = outboundOrder.TransactionCode,
                                                                InoutType = outboundOrder.OrderType,
                                                                OrderType = outboundOrder.InoutType,
                                                                ActiveType = 2,
                                                                DetailList = outStockLockInfoList.Select(item =>
                                                                {
                                                                    return new Allocate.data1.Inventory
                                                                    {
                                                                        LinId = item.LinId,
                                                                        LPNNo = item.PalletCode,
                                                                        MaterielCode = item.MaterielCode,
                                                                        OrderQuantity = item.OrderQuantity,
                                                                        BatchNo = item.BatchNo,
                                                                        FinishQty = item.OrderQuantity,
                                                                        LocationName = task.SourceAddress
                                                                    };
                                                                }).ToList()
                                                            }
                                                        }
                                                    }
                                                }
                                                                LinId = item.LinId,
                                                                LPNNo = item.PalletCode,
                                                                MaterielCode = item.MaterielCode,
                                                                OrderQuantity = item.OrderQuantity,
                                                                BatchNo = item.BatchNo,
                                                                FinishQty = item.OrderQuantity,
                                                                LocationName = task.SourceAddress
                                                            };
                                                        }).ToList()
                                    }
                                }
                            }
                        }
                                            };
                                            // 调用SMOM接口...
@@ -2259,12 +2235,8 @@
                                                var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "立库入库数量回传WMS");
                                                if (!response.Success)
                                                {
                                                    WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求失败", new { 请求报文 = allocate, 接收报文 = response });
                                                    throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}");
                                                }
                                                WriteLog.Write_Log("API", "SMOM立库库数量回传WMS", "请求成功", new { 请求报文 = allocate, 接收报文 = response });
                                            }
                                        }
                                    }
@@ -2303,11 +2275,11 @@
                        {
                            Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>()
                           .Where(x => x.OrderId == inboundOrder.Id && x.BatchNo == detail.BatchNo).First();
                            if(outboundOrderDetail != null)
                            if (outboundOrderDetail != null)
                            {
                                outboundOrderDetails.Add(outboundOrderDetail);
                            }
                        }
                        for (var i = 0; i < outboundOrderDetails.Count; i++)
@@ -2840,50 +2812,48 @@
                ApiType = "InventoryAllocateController",
                Method = "AsrsFinishedStockCount",
                Parameters = new List<Allocate>
        {
            new Allocate
            {
                Value = new List<Allocate.data1>
                {
                    new Allocate
                    new Allocate.data1
                    {
                        Value = new List<Allocate.data1>
                        No = outboundOrder.OrderNo,
                        InWarehouse = task.Roadway,
                        TransactionCode = outboundOrder.TransactionCode,
                        InoutType = outboundOrder.OrderType,
                        OrderType = outboundOrder.InoutType,
                        DetailList = outStockLockInfos.Select(item =>
                        {
                            new Allocate.data1
                            //var detail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == item.StockId);
                            return new Allocate.data1.Inventory
                            {
                                No = outboundOrder.OrderNo,
                                InWarehouse = task.Roadway,
                                TransactionCode = outboundOrder.TransactionCode,
                                InoutType = outboundOrder.OrderType,
                                OrderType = outboundOrder.InoutType,
                                DetailList = outStockLockInfos.Select(item =>
                                {
                                    //var detail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == item.StockId);
                                    return new Allocate.data1.Inventory
                                    {
                                        LinId = outDetail.LinId,
                                        LPNNo = item.PalletCode,
                                        MaterielCode = outDetail.MaterielCode,
                                        OrderQuantity = outDetail.OrderQuantity,
                                        BatchNo = outDetail.BatchNo,
                                        FinishQty = outDetail.OrderQuantity,
                                        LocationName = task.SourceAddress
                                    };
                                }).ToList()
                            }
                        }
                                LinId = outDetail.LinId,
                                LPNNo = item.PalletCode,
                                MaterielCode = outDetail.MaterielCode,
                                OrderQuantity = outDetail.OrderQuantity,
                                BatchNo = outDetail.BatchNo,
                                FinishQty = outDetail.OrderQuantity,
                                LocationName = task.SourceAddress
                            };
                        }).ToList()
                    }
                }
            }
        }
            };
            var authResult = AuthenticateWithWMS();
            if (authResult.IsSuccess)
            {
                allocate.Context = new Dictionary<string, string>
                {
                    { "Ticket", authResult.Ticket },
                    { "InvOrgId", authResult.InvOrgId }
                };
        {
            { "Ticket", authResult.Ticket },
            { "InvOrgId", authResult.InvOrgId }
        };
                var response = HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskin, allocate, "立库入库数量回传WMS");
                WriteLog.Write_Log("API", "SMOM立库入库数量回传WMS", "请求", new { 请求报文 = allocate, 接收报文 = response });
                HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskin, allocate, "立库入库数量回传WMS");
            }
        }
@@ -3080,7 +3050,8 @@
                        var matchedStockDetail = stockInfoDetails.FirstOrDefault(x => x.MaterielCode == outDetail.MaterielCode && x.BatchNo == outDetail.BatchNo);
                        if (matchedStockDetail == null)
                        {
                            matchedStockDetail = stockInfoDetails.FirstOrDefault(x =>x.MaterielCode == outDetail.MaterielCode);
                            matchedStockDetail = stockInfoDetails.FirstOrDefault(x =>
               x.MaterielCode == outDetail.MaterielCode);
                            if (matchedStockDetail == null)
                            {
@@ -3304,8 +3275,6 @@
                    result = response.Content.ReadAsStringAsync()
                        .ConfigureAwait(false).GetAwaiter().GetResult();
                    WriteLog.Write_Log("API", "单据明细出库完成回调ERP", "请求成功", new { 请求报文 = postContent, 接收报文 = response });
                }
                // 假设ERP返回成功时返回成功响应
@@ -3313,15 +3282,11 @@
            }
            catch (HttpRequestException ex)
            {
                WriteLog.Write_Log("API", "单据明细出库完成回调ERP", "请求失败", new { 请求报文 = postContent, 接收报文 = ex.Message });
                // 处理HTTP请求相关异常
                return WebResponseContent.Instance.Error($"HTTP请求错误: {ex.Message}");
            }
            catch (Exception ex)
            {
                WriteLog.Write_Log("API", "单据明细出库完成回调ERP", "请求失败", new { 请求报文 = postContent, 接收报文 = ex.Message });
                // 处理其他异常
                return WebResponseContent.Instance.Error($"处理失败: {ex.Message}");
            }
@@ -3349,15 +3314,11 @@
            // 判断Success的值
            if (response.Code == 0)
            {
                WriteLog.Write_Log("API", "任务回传给erp", "请求成功", new { 请求报文 = feedbackInboundOrder, 接收报文 = response });
                // 如果Success为true,返回需要的值(这里以返回整个响应对象为例)
                return WebResponseContent.Instance.OK();
            }
            else
            {
                WriteLog.Write_Log("API", "任务回传给erp", "请求失败", new { 请求报文 = feedbackInboundOrder, 接收报文 = response });
                // 如果Success为false,抛出异常并包含错误信息
                throw new Exception($"操作失败: {response.Message ?? "未提供错误信息"}");
            }