| | |
| | | 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) |
| | | { |
| | | 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); |
| | | } |
| | | 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()) |
| | | { |
| | |
| | | //娓呴櫎搴撳瓨鏁伴噺 |
| | | 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); |
| | | } |
| | |
| | | { |
| | | _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) |