| | |
| | | { |
| | | try |
| | | { |
| | | Db.Ado.BeginTran(); |
| | | Dt_OutStockLockInfo? outStockLockInfo = _outboundService.OutboundStockLockInfoService.Repository.QueryFirst(x => x.TaskNum == task.TaskNum); |
| | | Dt_OutboundOrder? outboundOrder = null; |
| | | Dt_OutboundOrderDetail? outboundOrderDetail = null; |
| | |
| | | if (outboundOrderDetail != null) |
| | | { |
| | | outboundOrder = Db.Queryable<Dt_OutboundOrder>().Where(x => x.Id == outboundOrderDetail.OrderId).Includes(x => x.Details).First(); |
| | | if (outboundOrder == null) throw new Exception("åºåºåä¸åå¨"); |
| | | outboundOrderDetail.OverOutQuantity++; |
| | | overCount = outboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).Count(); |
| | | if (outboundOrderDetail.OverOutQuantity == outboundOrderDetail.OrderQuantity) |
| | | if (outboundOrder != null) |
| | | { |
| | | outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | overCount++; |
| | | outboundOrderDetail.OverOutQuantity++; |
| | | overCount = outboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).Count(); |
| | | if (outboundOrderDetail.OverOutQuantity == outboundOrderDetail.OrderQuantity) |
| | | { |
| | | outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | overCount++; |
| | | } |
| | | } |
| | | } |
| | | outStockLockInfo.Status = OutLockStockStatusEnum.åºåºå®æ.ObjToInt(); |
| | | } |
| | | Db.Ado.BeginTran(); |
| | | if (outboundOrder != null && outboundOrder.Details.Count == overCount) |
| | | { |
| | | outboundOrder.OrderStatus = OutboundStatusEnum.åºåºå®æ.ObjToInt(); |
| | |
| | | Db.Ado.CommitTran(); |
| | | return content; |
| | | } |
| | | |
| | | Db.Ado.BeginTran(); |
| | | #region å
¥åºå |
| | | Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(stockInfoDetail.OrderNo); |
| | | if (inboundOrder == null || inboundOrder.Details.Count < 1) throw new Exception($"æªæ¾å°æç[{task.PalletCode}]çå
¥åºåæç»ä¿¡æ¯"); |
| | | Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfoDetail.BatchNo && x.MaterielCode == stockInfoDetail.MaterielCode); |
| | | //inboundOrderDetail.OverInQuantity++; |
| | | inboundOrderDetail.OrderDetailStatus = inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity ? OrderDetailStatusEnum.Over.ObjToInt() : OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); |
| | | if (inboundOrder != null) |
| | | { |
| | | Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == stockInfoDetail.BatchNo && x.MaterielCode == stockInfoDetail.MaterielCode); |
| | | if (inboundOrderDetail != null) |
| | | inboundOrderDetail.OrderDetailStatus = inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity ? OrderDetailStatusEnum.Over.ObjToInt() : OrderDetailStatusEnum.GroupAndInbound.ObjToInt(); |
| | | |
| | | if (inboundOrder.Details.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) == null) |
| | | { |
| | | inboundOrder.OrderStatus = InboundStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | if (inboundOrder.Details.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) == null) |
| | | { |
| | | inboundOrder.OrderStatus = InboundStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | else if (inboundOrder.OrderStatus == InboundStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | inboundOrder.OrderStatus = InboundStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | } |
| | | if (inboundOrder.OrderStatus != InboundStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | _inboundService.InbounOrderService.Repository.UpdateData(inboundOrder); |
| | | if (inboundOrderDetail != null) |
| | | _inboundService.InboundOrderDetailService.Repository.UpdateData(inboundOrderDetail); |
| | | } |
| | | else |
| | | { |
| | | List<Dt_InboundOrderDetail> orderDetails = inboundOrder.Details; |
| | | inboundOrder.Details = null; |
| | | _inboundService.InbounOrderService.Repository.DeleteAndMoveIntoHty(inboundOrder, OperateType.èªå¨å®æ); |
| | | _inboundService.InboundOrderDetailService.Repository.DeleteAndMoveIntoHty(orderDetails, OperateType.èªå¨å®æ); |
| | | } |
| | | } |
| | | else if (inboundOrder.OrderStatus == InboundStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | inboundOrder.OrderStatus = InboundStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | } |
| | | |
| | | #endregion |
| | | stockInfo.SerialNumber = stockInfos.Count + 1; |
| | | stockInfo.InDate = DateTime.Now; |
| | |
| | | locationInfo.LocationStatus = locationInfo.MaxQty - locationInfo.CurrentQty == 0 ? LocationStatusEnum.Fullload.ObjToInt() : LocationStatusEnum.InStock.ObjToInt(); |
| | | task.CurrentAddress = task.NextAddress; |
| | | task.NextAddress = string.Empty; |
| | | Db.Ado.BeginTran(); |
| | | #region ä»»å¡åå
¥åºå |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.èªå¨å®æ : OperateType.äººå·¥å®æ); |
| | | if (inboundOrder.OrderStatus != InboundStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | _inboundService.InbounOrderService.Repository.UpdateData(inboundOrder); |
| | | _inboundService.InboundOrderDetailService.Repository.UpdateData(inboundOrderDetail); |
| | | } |
| | | else |
| | | { |
| | | List<Dt_InboundOrderDetail> orderDetails = inboundOrder.Details; |
| | | inboundOrder.Details = null; |
| | | _inboundService.InbounOrderService.Repository.DeleteAndMoveIntoHty(inboundOrder, OperateType.èªå¨å®æ); |
| | | _inboundService.InboundOrderDetailService.Repository.DeleteAndMoveIntoHty(orderDetails, OperateType.èªå¨å®æ); |
| | | } |
| | | #endregion |
| | | _basicService.LocationInfoService.Repository.UpdateData(locationInfo); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfo); |
| | | _stockService.StockInfoDetailService.Repository.UpdateData(stockInfoDetail); |
| | | //_recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); |
| | | Db.Ado.CommitTran(); |
| | | } |
| | | catch (Exception ex) |