1
wankeda
2025-03-07 b55d324f4b7465f9a7dc50e999346697f5cc35a2
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -159,10 +159,10 @@
                    return WebResponseContent.Instance.Error($"未找到托盘对应的组盘信息");
                }
                //if (!string.IsNullOrEmpty(dt_StockInfo.LocationCode))
                //{
                //    return WebResponseContent.Instance.Error($"该托盘已绑定货位");
                //}
                if (!string.IsNullOrEmpty(dt_StockInfo.LocationCode))
                {
                    return WebResponseContent.Instance.Error($"该托盘已绑定货位");
                }
                if (dt_StockInfo.Details == null || dt_StockInfo.Details.Count == 0)
                {
@@ -174,10 +174,10 @@
                    return WebResponseContent.Instance.Error($"未找到目标货位信息");
                }
                //if (dt_LocationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
                //{
                //    return WebResponseContent.Instance.Error($"货位状态不正确");
                //}
                if (dt_LocationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt())
                {
                    return WebResponseContent.Instance.Error($"货位状态不正确");
                }
                int lastStatus = dt_LocationInfo.LocationStatus;
                dt_LocationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
@@ -209,8 +209,10 @@
                Dt_StockInfoDetail stockInfoDetail = _stockRepository.StockInfoDetailRepository.Db.Queryable<Dt_StockInfoDetail>().Where(x => x.StockId == dt_StockInfo.Id).First();
                Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderNo == stockInfoDetail.OrderNo).Includes(x => x.Details).First();
                Dt_InboundOrderDetail inboundOrderDetail = _inboundService.InboundOrderDetailService.Repository.QueryFirst(x => x.OrderId == inboundOrder.Id);
                //判断单据类型是入库还是调拨入库。。。入库
                if (inboundOrder.OrderType == 0)
                {
                    #region //判断入库单据明细只有最后一条完成时删除入库单
                    if (inboundOrder.Details.Count == 1)
                    {
                        Dt_InboundOrder_Hty inboundOrder_Hty = new Dt_InboundOrder_Hty
@@ -220,7 +222,7 @@
                            //SourceId = oldOutboundOrder.SourceId,
                            UpperOrderNo = inboundOrder.UpperOrderNo,
                            OrderNo = inboundOrder.OrderNo,
                            OutWareHouse = inboundOrder.OutWareHouse,
                            //OutWareHouse = inboundOrder.OutWareHouse,
                            TransactionCode = inboundOrder.TransactionCode,
                            InoutType = inboundOrder.InoutType,
                            OrderType = inboundOrder.OrderType,
@@ -245,11 +247,11 @@
                    };
                    _inboundOrderDetail_HtyService.AddData(dt_InboundOrderDetail_Hty);
                    _inboundService.InboundOrderDetailService.DeleteData(inboundOrderDetail);
                    #endregion
                    #region//入库信息返回上位WMS。。立库入库数量回传
                    HouseInboundPassBack houseInboundPassBack = new HouseInboundPassBack();
                    houseInboundPassBack.ApiType = "AsnController";
                    houseInboundPassBack.Method = "AsrsGroudingAsn";
                    data data = new data();
                    data.data1 data1 = new data.data1();
                    data1.AsnNo = task.OrderNo;
@@ -289,10 +291,11 @@
                        houseInboundPassBack.Context.Add("InvOrgId", InvOrgId);
                        var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskin, houseInboundPassBack, "立库入库数量回传WMS");
                    }
                    #endregion
                }
                else
                {
                    #region //判断调拨入库单据明细只有最后一条完成时删除入库单并一次返回入库明细信息
                    if (inboundOrder.Details.Count == 1)
                    {
                        List<Dt_StockInfo> StockInfo = _stockService.StockInfoService.Repository.QueryData(x => x.BatchNo == inboundOrderDetail.BatchNo);
@@ -303,7 +306,7 @@
                            //SourceId = oldOutboundOrder.SourceId,
                            UpperOrderNo = inboundOrder.UpperOrderNo,
                            OrderNo = inboundOrder.OrderNo,
                            OutWareHouse = inboundOrder.OutWareHouse,
                            //OutWareHouse = inboundOrder.OutWareHouse,
                            TransactionCode = inboundOrder.TransactionCode,
                            InoutType = inboundOrder.InoutType,
                            OrderType = inboundOrder.OrderType,
@@ -327,7 +330,8 @@
                        };
                        _inboundOrderDetail_HtyService.AddData(dt_InboundOrderDetail_HtyS);
                        _inboundService.InboundOrderDetailService.DeleteData(inboundOrderDetail);
                        #endregion
                        #region//调拨任务数量回传WMS
                        InventoryAllocate inventoryAllocate = new InventoryAllocate();
                        inventoryAllocate.ApiType = "InventoryAllocateController";
                        inventoryAllocate.Method = "AsrsFinishedStockCount";
@@ -376,6 +380,7 @@
                            var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "调拨入库数量回传WMS");
                        }
                    }
                    #endregion
                    Dt_InboundOrderDetail_Hty dt_InboundOrderDetail_Hty = new Dt_InboundOrderDetail_Hty
                    {
                        OrderId = inboundOrderDetail.OrderId,
@@ -461,9 +466,10 @@
                Dt_StockInfoDetail stockInfoDetail = _stockRepository.StockInfoDetailRepository.Db.Queryable<Dt_StockInfoDetail>().Where(x => x.StockId == stockInfo.Id).First();
                Dt_OutboundOrderDetail outDetail = _outboundService.OutboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>().Where(x => x.LPNNo == stockInfo.PalletCode).First();
                Dt_OutboundOrder outboundOrder = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrder>().Where(x => x.Id == outDetail.OrderId).Includes(x => x.Details).First();
                //判断单据类型是出库还是调拨出库。。。出库
                if (outboundOrder.OrderType == 1)
                {
                    #region //判断出库单据明细只有最后一条完成时删除出库单
                    if (outboundOrder.Details.Count == 1)
                    {
                        Dt_OutboundOrder_Hty inboundOrder_Hty = new Dt_OutboundOrder_Hty
@@ -498,7 +504,8 @@
                    };
                    _outboundOrderDetail_HtyService.AddData(dt_InboundOrderDetail_Hty);
                    _outboundService.OutboundOrderService.DeleteData(outDetail);
                    #endregion
                    #region//出库信息返回上位WMS。。。立库出库数量回传
                    HouseoutboundPassBack houseInboundPassBack = new HouseoutboundPassBack();
                    houseInboundPassBack.ApiType = "ShippingOrderController";
                    houseInboundPassBack.Method = "AsrsOutboundSO";
@@ -525,10 +532,10 @@
                    {
                        ApiType = "AuthenticationController",
                        Parameters = new List<Parameter>
                {
                    {
                     new Parameter { Value = "LKAdmin"},
                     new Parameter { Value = "LKAdmin"},
                },
                    },
                        Method = "Login",
                    };
                    var responses1 = HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskAUT, authentication, "登录WMS账号");
@@ -541,13 +548,18 @@
                        houseInboundPassBack.Context.Add("InvOrgId", InvOrgId);
                        var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskout, houseInboundPassBack, "立库出库数量回传WMS");
                    }
                    #endregion
                    //删除库存信息
                    _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateType.自动完成 : OperateType.人工完成);
                    _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateType.自动完成 : OperateType.人工完成);
                }
                else if (outboundOrder.OrderType == 240)
                {
                    //盘点出库任务完成、、、、、、、、、
                    //盘点出库任务完成、、、、、、、、、不能删除库存等逻辑
                }
                else
                {
                    List<Dt_StockInfo> StockInfo = _stockService.StockInfoService.Repository.QueryData(x => x.BatchNo == outDetail.BatchNo);
                    if (outboundOrder.Details.Count == 1)
                    {
@@ -634,9 +646,9 @@
                        inventoryAllocate.Context.Add("InvOrgId", InvOrgId);
                        var responses = HttpHelper.Post<WebResponseContent>(ReceiveWMSTaskAllocatein, inventoryAllocate, "调拨出库数量回传WMS");
                    }
                    _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateType.自动完成 : OperateType.人工完成);
                    _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateType.自动完成 : OperateType.人工完成);
                }
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)