| | |
| | | locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt(); |
| | | if (isUpdateStock) |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt(); |
| | | if (stockInfo != null && stockInfo.Details != null && stockInfo.Details.Count > 0) |
| | | { |
| | | orderNo = stockInfo.Details.FirstOrDefault()?.OrderNo ?? ""; |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_RoadwayInfo roadwayInfo = _basicRepository.RoadwayInfoRepository.QueryFirst(x => x.InStationCode == lineDTO.stationCode) ?? throw new Exception("æªæ¾å°è¯¥ç«å°å¯¹åºçå··éï¼è¯·æ£æ¥åºç¡é
置信æ¯"); |
| | | if (roadwayInfo.EnableStatus != EnableStatusEnum.Normal.ObjToInt() && roadwayInfo.EnableStatus != EnableStatusEnum.OnlyIn.ObjToInt()) |
| | | { |
| | | throw new Exception("该巷éä¸å¯å
¥åºï¼è¯·æ£æ¥å··éç¦ç¨ä¿¡æ¯"); |
| | | } |
| | | if (roadwayInfo.AreaId > 0) |
| | | { |
| | | Dt_AreaInfo areaInfo = _basicRepository.AreaInfoRepository.QueryFirst(x => x.Id == roadwayInfo.AreaId); |
| | | if (areaInfo != null && areaInfo.AreaStatus == EnableEnum.Disable.ObjToInt()) |
| | | { |
| | | throw new Exception("åºå被ç¦ç¨ï¼ä¸å¯å
¥åº"); |
| | | } |
| | | } |
| | | var task = BaseDal.QueryFirst(x => x.PalletCode == lineDTO.Barcode); |
| | | if (task == null) throw new Exception($"æªæ¾å°æçå·[{lineDTO.Barcode}]çå
¥åºä»»å¡"); |
| | | if (task.TaskState >= (int)InTaskStatusEnum.SC_InExecuting) throw new Exception($"æçå·[{lineDTO.Barcode}]çå
¥åºä»»å¡ç¶æä¸å¹é
"); |
| | |
| | | throw new Exception($"æç[{lineDTO.Barcode}],该ç»çç¶æä¸å¯å
¥åº"); |
| | | |
| | | Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(stockInfoDetail.OrderNo); |
| | | if (inboundOrder == null || inboundOrder.Details == null) throw new Exception($"æªæ¾å°æç[{lineDTO.Barcode}]çå
¥åºåæç»ä¿¡æ¯"); |
| | | Dt_LocationInfo locationInfo = null; |
| | | if (inboundOrder == null) throw new Exception($"æªæ¾å°æç[{lineDTO.Barcode}]çå
¥åºåä¿¡æ¯"); |
| | | |
| | | #region 夿æ¯å¦æå®è´§ä½ |
| | | Dt_InboundOrderDetail orderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfoDetail.BatchNo); |
| | | if (orderDetail != null && !string.IsNullOrEmpty(orderDetail.LocationCode)) |
| | | Dt_InboundOrderDetail? orderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfoDetail.BatchNo); |
| | | if (orderDetail == null) throw new Exception($"æªæ¾å°æç[{lineDTO.Barcode}]çå
¥åºåæç»ä¿¡æ¯"); |
| | | Dt_LocationInfo? locationInfo = null; |
| | | if (!string.IsNullOrEmpty(orderDetail.LocationCode)) |
| | | { |
| | | locationInfo = _basicService.LocationInfoService.GetLocation(orderDetail.LocationCode); |
| | | } |
| | |
| | | #region 夿å½åå
¥åºæçæ¹æ¬¡å·æ¯å¦åå¨å·²åé
å
¥åº |
| | | else |
| | | { |
| | | Dt_StockInfo instockInfo = null; |
| | | Dt_StockInfo? instockInfo = null; |
| | | Dt_StockInfoDetail instockInfoDetail = _stockService.StockInfoDetailService.Get_StockInfoDetail(stockInfoDetail.OrderNo, stockInfoDetail.BatchNo); |
| | | if (instockInfoDetail != null) instockInfo = _stockService.StockInfoService.Repository.GetStockInfo(instockInfoDetail.StockId); |
| | | if (instockInfo != null) |
| | | { |
| | | locationInfo = _basicService.LocationInfoService.GetLocation(instockInfo.LocationCode); |
| | | if (locationInfo?.MaxQty <= locationInfo?.CurrentQty) locationInfo = null; |
| | | if (locationInfo.MaxQty <= locationInfo.CurrentQty) locationInfo = null; |
| | | } |
| | | #endregion |
| | | else |
| | |
| | | if (instockInfoDetail != null) instockInfo = _stockService.StockInfoService.Repository.GetStockInfo(instockInfoDetail.StockId); |
| | | if (instockInfo != null) |
| | | { |
| | | locationInfo = _basicService.LocationInfoService.GetLocation(instockInfo.LocationCode); |
| | | 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; |
| | | //if (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt()) locationInfo = null; |
| | | #endregion |
| | | if (locationInfo.LocationStatus > LocationStatusEnum.Inbounding.ObjToInt()) locationInfo = null; |
| | | |
| | | else |
| | | { |
| | | 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; |
| | | #region å¤æè´§ä½ |
| | | if (locationInfo.Row == 1)//å¤ä¾§è´§ä½ï¼å¤æå
ä¾§è´§ä½ |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | #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; |
| | | //if (locationInfo?.MaxQty <= locationInfo?.CurrentQty) locationInfo = null; |
| | | } |
| | | } |
| | | |
| | | if (locationInfo == null) |
| | | if (locationInfo == null)//åé
æ°è´§ä½ |
| | | { |
| | | int inboundOrderCount = inboundOrder.Details.Count; |
| | | List<Dt_StockInfoDetail> stockInfoDetails = _stockService.StockInfoDetailService.Get_StockInfoDetails(stockInfoDetail.OrderNo);//è·å工忿已å
¥åºæå
¥åºä¸åºå |
| | |
| | | locationInfo = _basicService.LocationInfoService.AssignLocation(inboundOrderCount);//éæ°åé
è´§ä½ |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | if (locationInfo == null) throw new Exception($"æ å¯å
¥è´§ä½"); |
| | | |
| | | #region ä¿®æ¹åºååè´§ä½ä¿¡æ¯ |
| | | task.TaskState = (int)InTaskStatusEnum.SC_InExecuting; |
| | | task.CurrentAddress = task.NextAddress; |
| | | task.NextAddress = locationInfo.LocationCode; |
| | | task.NextAddress = locationInfo.LocationCode;//使ç¨è´§ä½å¤æ³¨å段ï¼å¯¹åºå åæºæåå± |
| | | task.TargetAddress = task.NextAddress; |
| | | task.IsPickPlace = locationInfo.MaxQty - locationInfo.CurrentQty == 1; |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |