| | |
| | | Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(stockInfoDetail.OrderNo); |
| | | if (inboundOrder == null) throw new Exception($"æªæ¾å°æç[{lineDTO.Barcode}]çå
¥åºåä¿¡æ¯"); |
| | | |
| | | var BatchNo = stockInfoDetail.BatchNo; |
| | | #region 夿æ¯å¦æå®è´§ä½ |
| | | Dt_InboundOrderDetail? orderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfoDetail.BatchNo); |
| | | if (orderDetail == null) throw new Exception($"æªæ¾å°æç[{lineDTO.Barcode}]çå
¥åºåæç»ä¿¡æ¯"); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 夿å½åå
¥åºæçæ¹æ¬¡å·æ¯å¦åå¨å·²åé
å
¥åº |
| | | else |
| | | { |
| | | #region 夿å½åå
¥åºæçæ¹æ¬¡å·æ¯å¦åå¨å·²åé
å
¥åº |
| | | 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 |
| | | { |
| | | instockInfoDetail = _stockService.StockInfoDetailService.Get_StockInfoDetail(stockInfoDetail.OrderNo);//å
¥åºååå¨åºåï¼å¤æè´§ä½ |
| | | instockInfoDetail = _stockService.StockInfoDetailService.Get_StockInfoDetail(stockInfoDetail.OrderNo /*BatchNo*/);//å
¥åºååå¨åºåï¼å¤æè´§ä½ |
| | | if (instockInfoDetail != null) instockInfo = _stockService.StockInfoService.Repository.GetStockInfo(instockInfoDetail.StockId); |
| | | if (instockInfo != null) |
| | | { |
| | | Dt_LocationInfo? location = _basicService.LocationInfoService.GetLocation(instockInfo.LocationCode);//æ¥è¯¢å·²åå¨åºåè´§ä½ç¶æ |
| | | if (location?.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 instockInfos = _stockService.StockInfoService.Repository.GetDt_StockInfos(instockInfo.LocationCode); |
| | | List<Dt_StockInfoDetail> Details = new List<Dt_StockInfoDetail>(); |
| | | foreach (var item in instockInfos) |
| | | { |
| | | locationInfo = newLocation; |
| | | Details.AddRange(item.Details); |
| | | } |
| | | var count = Details.GroupBy(x => x.BatchNo).Count(); |
| | | if (count <= 1) locationInfo = location; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (locationInfo == null)//åé
æ°è´§ä½ |
| | | { |
| | | int inboundOrderCount = inboundOrder.Details.Count; |
| | | List<Dt_StockInfoDetail> stockInfoDetails = _stockService.StockInfoDetailService.Get_StockInfoDetails(stockInfoDetail.OrderNo);//è·å工忿已å
¥åºæå
¥åºä¸åºå |
| | | if (stockInfoDetails != null || stockInfoDetails.Count > 0) inboundOrderCount -= stockInfoDetails.GroupBy(x => x.BatchNo).Count(); |
| | | List<Dt_InboundOrderDetail> inboundOrderDetailList = inboundOrder.Details.Where(x => /*x.BatchNo.Contains(BatchNo) &&*/ x.OverInQuantity == 0).ToList(); |
| | | int inboundOrderCount = inboundOrderDetailList.Count; |
| | | locationInfo = _basicService.LocationInfoService.AssignLocation(inboundOrderCount);//éæ°åé
è´§ä½ |
| | | } |
| | | } |
| | |
| | | task.TargetAddress = task.NextAddress; |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | var Row = Convert.ToInt16(targetCodes[0]); |
| | | task.TargetIsPickPlace = Row > 1 ? locationInfo.MaxQty - locationInfo.CurrentQty == 1 : false; |
| | | task.TargetIsPickPlace = /*Row > 1 ?*/ locationInfo.MaxQty - locationInfo.CurrentQty == 1; |
| | | task.SourceIsPickPlace = false; |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºä¸.ObjToInt(); |
| | | stockInfoDetail.Status = StockStatusEmun.å
¥åºä¸.ObjToInt(); |
| | | locationInfo.CurrentQty++; |
| | | orderDetail.OverInQuantity++; |
| | | if (locationInfo.MaxQty < locationInfo.CurrentQty) throw new Exception(); |
| | | /*if (locationInfo.MaxQty == 12)*/ |
| | | locationInfo.EnableStatus = EnableStatusEnum.OnlyOut.ObjToInt(); |
| | |
| | | Db.Ado.BeginTran(); |
| | | UpdateData(task); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | _inboundService.InboundOrderDetailService.Repository.UpdateData(orderDetail); |
| | | _stockService.StockInfoDetailService.Repository.UpdateData(stockInfoDetail); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | Db.Ado.CommitTran(); |
| | |
| | | if (instockInfoDetails.Count < 1) |
| | | { |
| | | instockInfoDetails = _stockService.StockInfoDetailService.Repository.QueryData(x => x.MaterielCode == stockInfoDetail.MaterielCode && x.Status == StockStatusEmun.å·²å
¥åº.ObjToInt()); |
| | | if (instockInfoDetails != null && instockInfoDetails.Count > 0) |
| | | if (instockInfoDetails.Count > 0) |
| | | instockInfoDetail = instockInfoDetails.OrderByDescending(x => x.CreateDate).First(); |
| | | } |
| | | if (instockInfoDetail != null) instockInfo = _stockService.StockInfoService.Repository.GetStockInfo(instockInfoDetail.StockId); |
| | | if (instockInfo != null)//æ åºå |
| | | { |
| | | locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == instockInfo.LocationCode); |
| | | if (ChargingStations.Contains(locationInfo.LocationCode)) |
| | | //if (BaseDal.QueryFirst(x => x.SourceAddress == locationInfo.LocationCode && x.TaskState < OutTaskStatusEnum.SC_OutFinish.ObjToInt()) != null) locationInfo = null; |
| | | if (locationInfo != null && ChargingStations.Contains(locationInfo.LocationCode)) |
| | | { |
| | | if (locationInfo.MaxQty - locationInfo.CurrentQty <= 1) locationInfo = null; |
| | | } |
| | | else if (locationInfo.MaxQty - locationInfo.CurrentQty < 1) |
| | | else if (locationInfo != null && locationInfo.MaxQty - locationInfo.CurrentQty < 1) |
| | | { |
| | | locationInfo = null; |
| | | } |
| | | if (locationInfo == null) |
| | | { |
| | | locationInfo = _basicService.LocationInfoService.GetLocationPallet(); |
| | | var locationInfos = _basicService.LocationInfoService.GetLocationPallet(); |
| | | foreach (var item in locationInfos) |
| | | { |
| | | if (BaseDal.QueryFirst(x => x.SourceAddress == item.LocationCode) == null) |
| | | { |
| | | locationInfo = item; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | locationInfo = _basicService.LocationInfoService.AssignLocation(ChargingStations);//æ¥æ¾ç©¿æ¢è½¦å
çµè´§ä½ |
| | | } |
| | | //else |
| | | //{ |
| | | // locationInfo = _basicService.LocationInfoService.AssignLocation(ChargingStations);//æ¥æ¾ç©¿æ¢è½¦å
çµè´§ä½ |
| | | //} |
| | | if (locationInfo == null) locationInfo = _basicService.LocationInfoService.AssignLocation(2);//éæ°åé
è´§ä½ |
| | | if (locationInfo == null) throw new Exception($"æ å¯å
¥è´§ä½"); |
| | | Dt_LocationInfo? locationInfo1 = null; |