| | |
| | | |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | |
| | | #region 空箱å
¥åº/æ£éååº |
| | | if (task.TaskType == TaskTypeEnum.InEmpty.ObjToInt() || task.TaskType == TaskTypeEnum.InPick.ObjToInt()) |
| | | #region 空箱å
¥åº/æ£éååº/çäº§éæ |
| | | if (task.TaskType == TaskTypeEnum.InEmpty.ObjToInt() || task.TaskType == TaskTypeEnum.InPick.ObjToInt() || task.TaskType==TaskTypeEnum.ProductionReturn.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | stockInfo.Details.ForEach(x => |
| | | { |
| | | x.Status = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | }); |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.äººå·¥å®æ : OperateTypeEnum.èªå¨å®æ); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | |
| | | #endregion |
| | | |
| | | Dt_InboundOrder? inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x => x.Details).First(); |
| | | if (inboundOrder == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"对åºå
¥åºåä¸åå¨"); |
| | | } |
| | | //æ¥è¯¢å宿çå
¥åºæç»æ°é |
| | | int overCount = inboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count; |
| | | Dt_InboundOrderDetail? inboundOrderDetail = null; |
| | | if (stockInfo.StockStatus == StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt()) |
| | | //æ åå
¥åºæµç¨æ¥æ¾å
¥åºåæ® |
| | | if (inboundOrder != null && stockInfo.StockStatus == StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt()) |
| | | { |
| | | inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.RowNo == stockInfo.Details.FirstOrDefault()?.InboundOrderRowNo); |
| | | foreach (var item in stockInfo.Details) |
| | | //æ¥è¯¢å宿çå
¥åºæç»æ°é |
| | | int overCount = inboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count; |
| | | if (stockInfo.StockStatus == StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt()) |
| | | { |
| | | if (inboundOrderDetail == null) |
| | | inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.RowNo == stockInfo.Details.FirstOrDefault()?.InboundOrderRowNo); |
| | | foreach (var item in stockInfo.Details) |
| | | { |
| | | continue; |
| | | } |
| | | ERPInboundDetailModel detailModel = new ERPInboundDetailModel() |
| | | { |
| | | ExpiryDate = item.EffectiveDate ?? "", |
| | | LocationCode = warehouse.WarehouseCode, |
| | | MaterialsCode = item.MaterielCode, |
| | | MfgDate = item.ProductionDate ?? "", |
| | | QtyCustoms = "0", |
| | | Quantity = item.StockQuantity.ToString(), |
| | | Rack = stockInfo.LocationCode, |
| | | ReceiptCode = inboundOrder.UpperOrderNo, |
| | | ReceiptSerNo = item.InboundOrderRowNo.ToString() |
| | | }; |
| | | inboundOrderDetail.OverInQuantity += item.StockQuantity; |
| | | if (inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity) |
| | | { |
| | | inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | overCount += 1; |
| | | } |
| | | else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) |
| | | { |
| | | inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Inbounding.ObjToInt(); |
| | | if (inboundOrderDetail == null) |
| | | { |
| | | continue; |
| | | } |
| | | ERPInboundDetailModel detailModel = new ERPInboundDetailModel() |
| | | { |
| | | ExpiryDate = item.EffectiveDate ?? "", |
| | | LocationCode = warehouse.WarehouseCode, |
| | | MaterialsCode = item.MaterielCode, |
| | | MfgDate = item.ProductionDate ?? "", |
| | | QtyCustoms = "0", |
| | | Quantity = item.StockQuantity.ToString(), |
| | | Rack = stockInfo.LocationCode, |
| | | ReceiptCode = inboundOrder.UpperOrderNo, |
| | | ReceiptSerNo = item.InboundOrderRowNo.ToString() |
| | | }; |
| | | inboundOrderDetail.OverInQuantity += item.StockQuantity; |
| | | if (inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity) |
| | | { |
| | | inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt(); |
| | | overCount += 1; |
| | | } |
| | | else if (inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) |
| | | { |
| | | inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Inbounding.ObjToInt(); |
| | | } |
| | | } |
| | | } |
| | | if (inboundOrder.Details.Count == overCount) |
| | | { |
| | | inboundOrder.OrderStatus = InOrderStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | { |
| | | inboundOrder.OrderStatus = InOrderStatusEnum.å
¥åºä¸.ObjToInt(); |
| | | } |
| | | } |
| | | if (inboundOrder.Details.Count == overCount) |
| | | { |
| | | inboundOrder.OrderStatus = InOrderStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | |
| | | if ((stockInfo.StockStatus == StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt() || stockInfo.StockStatus == StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt()) && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString()) |
| | | { |
| | | foreach (var model in stockInfo.Details) |
| | |
| | | TestSynStock(new TestToolSynInfo() { ToolCode = model.BatchNo, MaterialName = model.MaterielName, Life = int.TryParse(model.Remark, out int val) ? val : 1000 }); |
| | | } |
| | | } |
| | | |
| | | //æµè¯æ¶å
¥åºåºåç¶æ |
| | | if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt()) |
| | | { |
| | |
| | | else |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | |
| | | } |
| | | stockInfo.Details.ForEach(x => |
| | | { |
| | | x.Status = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | }); |
| | | //æ´æ°ä»»å¡ç¶æ |
| | | task.TaskStatus = (int)TaskStatusEnum.Finish; |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.äººå·¥å®æ : OperateTypeEnum.èªå¨å®æ); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); |
| | |
| | | _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted); |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum); |
| | | _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder); |
| | | if (inboundOrderDetail != null) |
| | | if (inboundOrder != null) |
| | | { |
| | | _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder); |
| | | _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | if (inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | //åå¨å
¥åºåå¹¶ç¶æä¸ºå®æç¶ææ¨éè³ERP |
| | | if (inboundOrder != null && inboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | _inboundOrderService.FeedbackInboundOrder(inboundOrder); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |