wangxinhui
昨天 011ca316e6ec2ed93e31c45a9ebd9d3c66664871
ÏîÄ¿´úÂë/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -61,7 +61,7 @@
                }
                tasks.ForEach(x =>
                {
                    x.Grade = 99;
                    x.Grade = 1;
                });
                stockInfos.ForEach(x =>
                {
@@ -907,7 +907,6 @@
                        item.StockLength = 0;
                        item.MaterielWeight = 0;
                        item.MaterielThickness = 0;
                        item.MaterielWide = 0;
                        item.StockOutLength = 0;
                        item.IsFull = WhetherEnum.True.ObjToInt();
                        item.IsPick = WhetherEnum.True.ObjToInt();
@@ -960,6 +959,76 @@
            }
            return content;
        }
        /// <summary>
        /// åˆ›å»ºé”€å”®å‡ºåº“
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public WebResponseContent CreateProDeliveryTasks(List<int> ids)
        {
            WebResponseContent content=new WebResponseContent();
            try
            {
                ////获取销售出库单据
                //List<Dt_ProDeliveryOrder> deliveryOrders = BaseDal.Db.Queryable<Dt_ProDeliveryOrder>().Where(x=> ids.Contains(x.Id)).Includes(x=>x.Details).ToList();
                //Dt_ProDeliveryOrder? proDeliveryOrder = deliveryOrders.FirstOrDefault(x => x.ProDeliveryStatus != OutOrderStatusEnum.未开始.ObjToInt());
                //if (proDeliveryOrder != null)
                //{
                //    return content.Error($"单号{proDeliveryOrder.DeliveryCode},订单状态{(OutOrderStatusEnum)proDeliveryOrder.ProDeliveryStatus}");
                //}
                //List<Dt_ProDeliveryOrderDetail> proDeliveryOrderDetails = deliveryOrders.SelectMany(x=>x.Details).ToList();
                //if (!proDeliveryOrderDetails.Any())
                //{
                //    throw new Exception($"未找到需出库的明细信息");
                //}
                //_unitOfWorkManage.BeginTran();
                //List<Dt_Task> tasks = new List<Dt_Task>();
                //List<Dt_ProStockInfo>? stockInfos = null;
                //List<Dt_ProDeliveryOrder>? Orders = null;
                //List<Dt_ProDeliveryOrderDetail>? OrderDetails = null;
                //List<Dt_OutStockLockInfo>? outStockLockInfos = null;
                //List<Dt_LocationInfo>? locationInfos = null;
                //{
                //    //分配库存
                //    (List<Dt_ProStockInfo>, List<Dt_ProDeliveryOrder>, List<Dt_ProDeliveryOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.ProDeliveryOrderService.AssignProStockOutbound(deliveryOrders, proDeliveryOrderDetails);
                //    if (result.Item1 != null && result.Item1.Count > 0)
                //    {
                //        //创建任务
                //        tasks = GetTasks(result.Item1, result.Item3);
                //        result.Item3.ForEach(x =>
                //        {
                //            x.Status = OutLockStockStatusEnum.出库中.ObjToInt();
                //        });
                //        stockInfos = result.Item1;
                //        Orders = result.Item2;
                //        outStockLockInfos = result.Item3;
                //        locationInfos = result.Item4;
                //    }
                //}
                //if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count > 0)
                //{
                //    BaseDal.AddData(tasks);
                //    stockInfos.ForEach(x =>
                //    {
                //        x.StockStatus = StockStatusEmun.出库锁定.ObjToInt();
                //    });
                //    WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
                //    if (!contentResponse.Status)
                //    {
                //        _unitOfWorkManage.RollbackTran();
                //        return content.Error(contentResponse.Message);
                //    }
                //}
                //_unitOfWorkManage.CommitTran();
            }
            catch (Exception ex)
            {
                _unitOfWorkManage.RollbackTran();
                content.Error(ex.Message);
            }
            return content;
        }
        List<string> GradeCodes = new List<string>
        {
            "001"