| 
					
				 | 
			
			
				@@ -16,6 +16,8 @@ import cn.hnthyy.thmz.service.his.yp.YpZdManufactoryService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.vo.YpBaseYfVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.vo.YpOutDetlVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.vo.YpZdDictVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Isolation; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -34,6 +36,7 @@ import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @time: 2021/7/28 17:09 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Service 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class YpBaseYfServiceImpl implements YpBaseYfService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @SuppressWarnings("all") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -131,12 +134,16 @@ public class YpBaseYfServiceImpl implements YpBaseYfService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ypBaseYf.setSplitPercent(ypOutDetlVo.getSplitPercent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if(ypBaseYfMapper.insertYpBaseYf(ypBaseYf) == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw new MzException("药品编码"+ypBaseYf.getChargeCode()+"入库出错"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.info("接收入库{},新增药房药品库存成功[{}]", ypOutDetlVo.getDrawNo(), JSONObject.valueToString(ypBaseYf)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }else{//更新药房药品库存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                stockValue = packRetprice.multiply(new BigDecimal(amount)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                stockValue = packRetprice.multiply(new BigDecimal(amount)).setScale(2,BigDecimal.ROUND_HALF_UP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if(ypBaseYfMapper.updateStockAmount(ypOutDetlVo.getChargeCode(),serial 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         ,ypOutDetlVo.getGroupNoOut(),amount, stockValue) == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw new MzException("药品编码"+ypOutDetlVo.getChargeCode()+"入库出错"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.info("接收入库{},更新药房药品库存成功,药品编码{},规格{},数量{}", ypOutDetlVo.getDrawNo(), ypOutDetlVo.getChargeCode(), serial, amount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 ypBaseYfMapper.updateResetVirtual(ypOutDetlVo.getChargeCode(), serial, ypOutDetlVo.getGroupNoOut()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 |