| | |
| | | { |
| | | return content.Error($"æ°éè¶
åº"); |
| | | } |
| | | if (checkResult.Result == InspectResultEnum.Return.ToString())//éè´§ |
| | | //夿æ£éªç»æ |
| | | if (checkResult.Result == InspectResultEnum.Return.ToString()) |
| | | { |
| | | checkOrder.DefectedNote = checkResult.Note; |
| | | checkOrder.ReturnQuantity += checkResult.Quantity; |
| | |
| | | Note = checkResult.Note, |
| | | SampleCount = checkResult.SampleCount, |
| | | }; |
| | | if (Math.Round(checkResult.Quantity,2) == Math.Round(stockInfoDetails.Sum(x=>x.StockQuantity),2)) |
| | | foreach (var item in stockInfo.Details) |
| | | { |
| | | DelStockDetails = stockInfo.Details; |
| | | } |
| | | else |
| | | { |
| | | foreach (var item in stockInfo.Details) |
| | | if (checkResult.Quantity == 0) |
| | | { |
| | | if (checkResult.Quantity == 0) |
| | | { |
| | | break; |
| | | } |
| | | else if(checkResult.Quantity< item.StockQuantity) |
| | | { |
| | | checkResult.Quantity = 0; |
| | | item.StockQuantity -= checkResult.Quantity; |
| | | stockInfoDetails.Add(item); |
| | | } |
| | | else if (checkResult.Quantity >= item.StockQuantity) |
| | | { |
| | | checkResult.Quantity = (float)Math.Round((checkResult.Quantity-item.StockQuantity), 2); |
| | | DelStockDetails.Add(item); |
| | | } |
| | | break; |
| | | } |
| | | else if (checkResult.Quantity < item.StockQuantity) |
| | | { |
| | | item.StockQuantity -= checkResult.Quantity; |
| | | item.OutboundQuantity = 0; |
| | | checkResult.Quantity = 0; |
| | | stockInfoDetails.Add(item); |
| | | } |
| | | else if (checkResult.Quantity >= item.StockQuantity) |
| | | { |
| | | checkResult.Quantity = (float)Math.Round((checkResult.Quantity - item.StockQuantity), 2); |
| | | DelStockDetails.Add(item); |
| | | } |
| | | } |
| | | |
| | | } |
| | | if (IsAccept == InspectAcceptEnum.Accept.ObjToInt()) |
| | | { |
| | |
| | | checkOrder.QualifiedQuantity = checkOrder.ReceivedQuantity; |
| | | } |
| | | checkOrder.CheckUserName = App.User.UserName; |
| | | List<Dt_StockInfoDetail> initialStockDetails = stockInfo.Details.Where(x=> !(stockInfoDetails.Select(v=>v.Id).ToList()).Contains(x.Id)).ToList(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | if (checkOrderResult != null) |
| | |
| | | //æ¸
é¤åºåæ°é |
| | | if (stockInfoDetails.Count>0) |
| | | { |
| | | stockInfoDetails.ForEach(x => |
| | | { |
| | | x.Status = StockStatusEmun.鿣åºå宿.ObjToInt(); |
| | | }); |
| | | _stockRepository.StockInfoDetailRepository.UpdateData(stockInfoDetails); |
| | | } |
| | | if (initialStockDetails.Count>0) |
| | | { |
| | | initialStockDetails.ForEach(x => |
| | | { |
| | | x.OutboundQuantity = 0; |
| | | x.Status = StockStatusEmun.鿣åºå宿.ObjToInt(); |
| | | }); |
| | | _stockRepository.StockInfoDetailRepository.UpdateData(initialStockDetails); |
| | | } |
| | | if (DelStockDetails.Count>0) |
| | | { |
| | |
| | | { |
| | | _stockRepository.StockInfoRepository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | } |
| | | else |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.鿣åºå宿.ObjToInt(); |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | } |
| | | //ERP䏿¥ |
| | | WebResponseContent responseContent = _checkOrderService.FeedbackInspectResult(checkOrder, checkOrderResult != null ? new List<Dt_CheckOrderResult> { checkOrderResult } : new List<Dt_CheckOrderResult>()); |
| | | if (!responseContent.Status) |