dengjunjie
2025-02-24 733e63cb362f17aea4a1020654fa348a0d0c1f06
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
@@ -214,40 +214,15 @@
                        if (instockInfoDetail != null) instockInfo = _stockService.StockInfoService.Repository.GetStockInfo(instockInfoDetail.StockId);
                        if (instockInfo != null)
                        {
                            locationInfo = _basicService.LocationInfoService.GetLocation(instockInfo.LocationCode);//查询已存在库存货位状态
                            #region MyRegion
                            //if (locationInfo.MaxQty == 12)
                            //{
                            //    locationInfo.EnableStatus = EnableStatusEnum.OnlyOut.ObjToInt();
                            //    _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
                            //    locationInfo = null;
                            //}
                            //if (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt()) locationInfo = null;
                            #endregion
                            if (locationInfo.LocationStatus > LocationStatusEnum.Inbounding.ObjToInt()) locationInfo = null;
                            else
                            Dt_LocationInfo? location = _basicService.LocationInfoService.GetLocation(instockInfo.LocationCode);//查询已存在库存货位状态
                            if (location?.Row == 1)
                            {
                                #region åˆ¤æ–­è´§ä½
                                if (locationInfo.Row == 1)//外侧货位,判断内侧货位
                                var newLocation = Db.Queryable<Dt_LocationInfo>().Where(x => x.Row == 2 && x.Layer == location.Layer && x.Column == location.Column).First();
                                if (newLocation != null && newLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt() && newLocation.CurrentQty == 0 && (newLocation.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || newLocation.EnableStatus == EnableStatusEnum.Normal.ObjToInt()))
                                {
                                    var newLocation = Db.Queryable<Dt_LocationInfo>().Where(x => x.LocationCode != locationInfo.LocationCode && x.Remark == locationInfo.Remark).First();
                                    if (newLocation != null)
                                    {
                                        if (newLocation.LocationStatus == LocationStatusEnum.Free.ObjToInt() &&
                                            (newLocation.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() ||
                                            newLocation.EnableStatus == EnableStatusEnum.Normal.ObjToInt()))
                                        {
                                            locationInfo = newLocation;
                                        }
                                    }
                                    locationInfo = newLocation;
                                }
                                #endregion
                                //List<Dt_StockInfoDetail> stockInfoDetails = _stockService.StockInfoDetailService.Get_StockInfoDetails(stockInfoDetail.OrderNo);//获取工单所有已入库或入库中库存
                                //if (stockInfoDetails.GroupBy(x => x.BatchNo).Count() < 2) locationInfo.EnableStatus = EnableStatusEnum.OnlyOut.ObjToInt();
                                //else locationInfo = null;
                            }
                            //if (locationInfo?.MaxQty <= locationInfo?.CurrentQty) locationInfo = null;
                        }
                    }
@@ -268,13 +243,17 @@
                task.CurrentAddress = task.NextAddress;
                task.NextAddress = locationInfo.LocationCode;//使用货位备注字段,对应堆垛机排列层
                task.TargetAddress = task.NextAddress;
                task.IsPickPlace = locationInfo.MaxQty - locationInfo.CurrentQty == 1;
                string[] targetCodes = task.NextAddress.Split("-");
                var Row = Convert.ToInt16(targetCodes[0]);
                task.TargetIsPickPlace = Row > 1 ? locationInfo.MaxQty - locationInfo.CurrentQty == 1 : false;
                task.SourceIsPickPlace = false;
                stockInfo.LocationCode = locationInfo.LocationCode;
                stockInfo.StockStatus = StockStatusEmun.入库中.ObjToInt();
                stockInfoDetail.Status = StockStatusEmun.入库中.ObjToInt();
                locationInfo.CurrentQty++;
                if (locationInfo.MaxQty < locationInfo.CurrentQty) throw new Exception();
                if (locationInfo.MaxQty == 12) locationInfo.EnableStatus = EnableStatusEnum.OnlyOut.ObjToInt();
                /*if (locationInfo.MaxQty == 12)*/
                locationInfo.EnableStatus = EnableStatusEnum.OnlyOut.ObjToInt();
                locationInfo.LocationStatus = LocationStatusEnum.Inbounding.ObjToInt();
                Db.Ado.BeginTran();
@@ -287,7 +266,8 @@
                content.OK(data: new ReceiveWMSInfo()
                {
                    TargetAddress = task.TargetAddress,
                    IsPickPlace = task.IsPickPlace,
                    SourceIsPickPlace = task.SourceIsPickPlace,
                    TargetIsPickPlace = task.TargetIsPickPlace,
                });
            }
            catch (Exception ex)