| | |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// å åæºç³è¯·å
¥åº |
| | | /// </summary> |
| | | /// <param name="lineDTO"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent NewStackerCraneRequestInbound(ConveyorLineDTO lineDTO) |
| | | { |
| | | 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}]çå
¥åºä»»å¡ç¶æä¸å¹é
"); |
| | | |
| | | #region 夿æ¯å¦ä¸ºç©ºæå
¥åº |
| | | if (task.TaskType == TaskTypeEnum.PalletInbound.ObjToInt()) |
| | | return GetEmptyLocation(task); |
| | | #endregion |
| | | |
| | | Dt_InventoryInfo inventoryInfo = _stockService.InventoryInfoService.Repository.QueryFirst(x => x.PalletCode == lineDTO.Barcode); |
| | | if (inventoryInfo == null) throw new Exception($"æªæ¾å°æç[{lineDTO.Barcode}]çç»çä¿¡æ¯"); |
| | | if (inventoryInfo.StockStatus != StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt()) throw new Exception($"æç[{lineDTO.Barcode}],该ç»çç¶æä¸å¯å
¥åº"); |
| | | if (!string.IsNullOrEmpty(inventoryInfo.LocationCode)) throw new Exception($"æç[{lineDTO.Barcode}],å·²åé
ç»ç¹å°å"); |
| | | |
| | | Dt_InboundOrderDetail inboundOrderDetail = _inboundService.InboundOrderDetailService.Repository.QueryFirst(x => x.BatchNo == inventoryInfo.BatchNo); |
| | | if (inboundOrderDetail == null) throw new Exception($"æªæ¾å°æç[{lineDTO.Barcode}]çå
¥åºåæç»ä¿¡æ¯"); |
| | | Dt_LocationInfo? locationInfo = null; |
| | | |
| | | if (!string.IsNullOrEmpty(inboundOrderDetail.LocationCode)) |
| | | { |
| | | locationInfo = _basicService.LocationInfoService.GetLocation(inboundOrderDetail.LocationCode); |
| | | } |
| | | else |
| | | { |
| | | Dt_InventoryInfo? _InventoryInfo = _stockService.InventoryInfoService.Repository.QueryData(x => x.BatchNo == inventoryInfo.BatchNo && (x.StockStatus == StockStatusEmun.å
¥åºä¸.ObjToInt() || x.StockStatus == StockStatusEmun.å·²å
¥åº.ObjToInt())).OrderByDescending(x => x.ModifyDate).FirstOrDefault(); |
| | | |
| | | if (_InventoryInfo != null) |
| | | { |
| | | locationInfo = _basicService.LocationInfoService.GetLocation(_InventoryInfo.LocationCode); |
| | | if (locationInfo?.MaxQty <= locationInfo?.CurrentQty) locationInfo = null; |
| | | } |
| | | if (locationInfo == null)//åé
æ°è´§ä½ |
| | | { |
| | | var Qty = Convert.ToInt32(inboundOrderDetail.OrderQuantity - inboundOrderDetail.OverInQuantity); |
| | | var ts = Qty / 320; |
| | | if (Qty % 320 > 0) ts++; |
| | | int inboundOrderCount = ts > 12 ? 2 : 1; |
| | | 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.TargetAddress = task.NextAddress; |
| | | task.TargetIsPickPlace = locationInfo.MaxQty - locationInfo.CurrentQty == 1; |
| | | task.SourceIsPickPlace = false; |
| | | inventoryInfo.LocationCode = locationInfo.LocationCode; |
| | | inventoryInfo.StockStatus = StockStatusEmun.å
¥åºä¸.ObjToInt(); |
| | | locationInfo.CurrentQty++; |
| | | if (locationInfo.MaxQty < locationInfo.CurrentQty) locationInfo.CurrentQty = locationInfo.MaxQty; |
| | | inventoryInfo.SerialNumber = locationInfo.CurrentQty; |
| | | inboundOrderDetail.OverInQuantity = inboundOrderDetail.OverInQuantity + inventoryInfo.StockQuantity; |
| | | if (inboundOrderDetail.OverInQuantity > inboundOrderDetail.ReceiptQuantity) |
| | | inboundOrderDetail.OverInQuantity = inboundOrderDetail.ReceiptQuantity; |
| | | locationInfo.EnableStatus = EnableStatusEnum.OnlyOut.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.Inbounding.ObjToInt(); |
| | | |
| | | Db.Ado.BeginTran(); |
| | | UpdateData(task); |
| | | _stockService.InventoryInfoService.Repository.UpdateData(inventoryInfo); |
| | | if (inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity) |
| | | { |
| | | inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.Id == inboundOrderDetail.OrderId); |
| | | inboundOrder.OrderStatus = InboundStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | _inboundService.InbounOrderService.Repository.DeleteAndMoveIntoHty(inboundOrder, OperateType.èªå¨å®æ); |
| | | _inboundService.InboundOrderDetailService.Repository.DeleteAndMoveIntoHty(inboundOrderDetail, OperateType.èªå¨å®æ); |
| | | } |
| | | else |
| | | _inboundService.InboundOrderDetailService.Repository.UpdateData(inboundOrderDetail); |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | Db.Ado.CommitTran(); |
| | | #endregion |
| | | content.OK(data: new ReceiveWMSInfo() |
| | | { |
| | | TargetAddress = task.TargetAddress, |
| | | SourceIsPickPlace = task.SourceIsPickPlace, |
| | | TargetIsPickPlace = task.TargetIsPickPlace, |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å åæºç³è¯·å
¥åº |