| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -453,9 +453,15 @@ public class IoCodeTempController extends BaseController {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (StrUtil.isNotEmpty(orderId)) {//非首次添加
 | 
					 | 
					 | 
					 | 
					                if (StrUtil.isNotEmpty(orderId)) {//非首次添加
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
 | 
					 | 
					 | 
					 | 
					                    if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        //无序列号,则可能存在多个预验收入库单
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        IoCodeTempEntity codeTempEntity = codeTempService.findByUnique(orderId, code);
 | 
					 | 
					 | 
					 | 
					                        IoCodeTempEntity codeTempEntity = codeTempService.findByUnique(orderId, code);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        List<InvPreinDetailEntity> invPreinDetailEntities = invPreinDetailService.findByCode(code);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        int count = 0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        for (InvPreinDetailEntity temp : invPreinDetailEntities) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            count = count + temp.getCount();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        if (codeTempEntity != null) {
 | 
					 | 
					 | 
					 | 
					                        if (codeTempEntity != null) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            if (invProductDetailEntity.getCount() < (codeTempEntity.getMyCount() + 1)) {
 | 
					 | 
					 | 
					 | 
					                            if (count < (codeTempEntity.getMyCount() + 1)) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                return ResultVOUtils.error(500, "超出预验收库存数量");
 | 
					 | 
					 | 
					 | 
					                                return ResultVOUtils.error(500, "超出预验收库存数量");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            }
 | 
					 | 
					 | 
					 | 
					                            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        }
 | 
					 | 
					 | 
					 | 
					                        }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -497,6 +503,9 @@ public class IoCodeTempController extends BaseController {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (codeEnttitys.size() > 0) {
 | 
					 | 
					 | 
					 | 
					        if (codeEnttitys.size() > 0) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            exitLocalEntity = isExitLocal(code, codeEnttitys);
 | 
					 | 
					 | 
					 | 
					            exitLocalEntity = isExitLocal(code, codeEnttitys);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (exitLocalEntity != null) {
 | 
					 | 
					 | 
					 | 
					            if (exitLocalEntity != null) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (StrUtil.isEmpty(exitLocalEntity.getSupId()) || exitLocalEntity.getRelId() == null) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    return ResultVOUtils.error(500, "当前UDI码已存在,且存在异常未处理!");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(exitLocalEntity.getNameCode());
 | 
					 | 
					 | 
					 | 
					                udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(exitLocalEntity.getNameCode());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                BeanUtils.copyProperties(exitLocalEntity, genDetaiEntity);
 | 
					 | 
					 | 
					 | 
					                BeanUtils.copyProperties(exitLocalEntity, genDetaiEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                genDetaiEntity.setCount(1);
 | 
					 | 
					 | 
					 | 
					                genDetaiEntity.setCount(1);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -781,7 +790,7 @@ public class IoCodeTempController extends BaseController {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//                        return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
 | 
					 | 
					 | 
					 | 
					//                        return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//                    }
 | 
					 | 
					 | 
					 | 
					//                    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else {
 | 
					 | 
					 | 
					 | 
					            } else {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                int count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null);
 | 
					 | 
					 | 
					 | 
					                int count = invProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), codeTempEntity.getDeptCode(), codeTempEntity.getInvCode(), null);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (count <= 0) {
 | 
					 | 
					 | 
					 | 
					                if (count <= 0) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
 | 
					 | 
					 | 
					 | 
					                    return ResultVOUtils.error(500, "当前库存不足,不允许0库存出库");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } else {
 | 
					 | 
					 | 
					 | 
					                } else {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -857,7 +866,7 @@ public class IoCodeTempController extends BaseController {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        IoOrderEntity orderEntity = orderService.findByBillNo(codeTempEntity.getOrderId());
 | 
					 | 
					 | 
					 | 
					        IoOrderEntity orderEntity = orderService.findByBillNo(codeTempEntity.getOrderId());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (codeTempEntity.getMyCount() > 1) {
 | 
					 | 
					 | 
					 | 
					        if (codeTempEntity.getMyCount() > 1) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            codeTempEntity.setCount(codeTempEntity.getMyCount() - 1);
 | 
					 | 
					 | 
					 | 
					            codeTempEntity.setCount(codeTempEntity.getMyCount() - 1);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            codeTempEntity.setReCount(codeTempEntity.getMyCount() - udiCalCountUtil.getActCount(codeTempEntity.getRelId()));
 | 
					 | 
					 | 
					 | 
					            codeTempEntity.setReCount(codeTempEntity.getMyReCount() - udiCalCountUtil.getActCount(codeTempEntity.getRelId()));
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            codeTempService.updateById(codeTempEntity);
 | 
					 | 
					 | 
					 | 
					            codeTempService.updateById(codeTempEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else {
 | 
					 | 
					 | 
					 | 
					        } else {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            codeTempService.deleteById(id);
 | 
					 | 
					 | 
					 | 
					            codeTempService.deleteById(id);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -870,8 +879,8 @@ public class IoCodeTempController extends BaseController {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            int orderCount = orderDetailCodeEntity.getCount();
 | 
					 | 
					 | 
					 | 
					            int orderCount = orderDetailCodeEntity.getCount();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            int orderReCount = orderDetailCodeEntity.getReCount();
 | 
					 | 
					 | 
					 | 
					            int orderReCount = orderDetailCodeEntity.getReCount();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (orderCount > 1) {
 | 
					 | 
					 | 
					 | 
					            if (orderCount > 1) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                orderDetailCodeEntity.setCount(orderCount - codeTempEntity.getMyCount());
 | 
					 | 
					 | 
					 | 
					                orderDetailCodeEntity.setCount(orderCount - 1);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                orderDetailCodeEntity.setReCount(orderReCount - codeTempEntity.getMyReCount());
 | 
					 | 
					 | 
					 | 
					                orderDetailCodeEntity.setReCount(orderReCount - udiCalCountUtil.getActCount(codeTempEntity.getRelId()));
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ioOrderDetailCodeService.update(orderDetailCodeEntity);
 | 
					 | 
					 | 
					 | 
					                ioOrderDetailCodeService.update(orderDetailCodeEntity);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else {
 | 
					 | 
					 | 
					 | 
					            } else {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ioOrderDetailCodeService.deleteById(orderDetailCodeEntity.getId());
 | 
					 | 
					 | 
					 | 
					                ioOrderDetailCodeService.deleteById(orderDetailCodeEntity.getId());
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |