|  | @ -97,6 +97,8 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private MedicineWarrayRuleDao medicineWarrayRuleDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private MediicinestockoutdetailDao mediicinestockoutdetailDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -1957,7 +1959,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |                     "t.del = 1 AND  \n" +
 | 
	
		
			
				|  |  |                     "t.`status` = 0 and ',"+ deviceIds +",' LIKE CONCAT('%,',t.id,',%')\n";
 | 
	
		
			
				|  |  |             if (!StringUtils.isEmpty(content)) {
 | 
	
		
			
				|  |  |                 sencodSql += " AND CONCAT(IFNULL(tmu.`equ_num`,''), IFNULL(tmu.`equ_name`,'')) like '%" + content +"%'";
 | 
	
		
			
				|  |  |                 sencodSql += " AND CONCAT(IFNULL(tmu.equ_num,''), IFNULL(tmu.equ_name,'')) like '%" + content +"%'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |              deviceList = hibenateUtils.createSQLQuery(sencodSql);
 | 
	
		
			
				|  |  |         } else {
 | 
	
	
		
			
				|  | @ -2050,7 +2052,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |                     "t.del = 1 AND  \n" +
 | 
	
		
			
				|  |  |                     "t.`status` = 0 and ',"+ belongCommunitys +",' LIKE CONCAT('%,',t.belong_community,',%')\n";
 | 
	
		
			
				|  |  |             if (!StringUtils.isEmpty(content)) {
 | 
	
		
			
				|  |  |                 sencodSql += " AND CONCAT(IFNULL(tmu.`equ_num`,''), IFNULL(tmu.`equ_name`,'')) like '%" + content +"%'";
 | 
	
		
			
				|  |  |                 sencodSql += " AND CONCAT(IFNULL(tmu.equ_num,''), IFNULL(tmu.equ_name,'')) like '%" + content +"%'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -2584,7 +2586,9 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |                 stringObjectMap.put("lastTime",DateUtil.dateToStrLong(drugInventoryRecord.getCreateTime()));
 | 
	
		
			
				|  |  |                 stringObjectMap.put("lastQuanty",drugInventoryRecord.getQuantity());
 | 
	
		
			
				|  |  |                 UserDO userDO = userDao.findById(drugInventoryRecord.getCreateUser());
 | 
	
		
			
				|  |  |                 stringObjectMap.put("createName",userDO.getName());
 | 
	
		
			
				|  |  |                 if (userDO!=null){
 | 
	
		
			
				|  |  |                     stringObjectMap.put("createName",userDO.getName());
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 stringObjectMap.put("lastTime",null);
 | 
	
		
			
				|  |  |                 stringObjectMap.put("lastQuanty",null);
 | 
	
	
		
			
				|  | @ -3947,6 +3951,10 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |             //下架时,清空库存
 | 
	
		
			
				|  |  |             if ("0".equals(status)) {
 | 
	
		
			
				|  |  |                 inventory.setQty("0");
 | 
	
		
			
				|  |  |                 inventory.setDrugCode(null);
 | 
	
		
			
				|  |  |                 inventory.setDrugId(null);
 | 
	
		
			
				|  |  |                 inventory.setDrugName(null);
 | 
	
		
			
				|  |  |                 inventory.setPrice(null);
 | 
	
		
			
				|  |  |                 //设置额定库存
 | 
	
		
			
				|  |  |                 inventory.setRatedInventory(0);
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -4721,7 +4729,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |     public String batchAddInventory(String json, String userId) throws Exception{
 | 
	
		
			
				|  |  |     public String batchAddInventory(String json, String userId,String outDetailId) throws Exception{
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         JSONObject jsonObject = JSONObject.parseObject(json);
 | 
	
		
			
				|  |  |         JSONArray cargoList = jsonObject.getJSONArray("list");
 | 
	
	
		
			
				|  | @ -4730,6 +4738,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |             result.put("response", ConstantUtils.FAIL);
 | 
	
		
			
				|  |  |             return result.toJSONString();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         int total = 0;
 | 
	
		
			
				|  |  |         for (Object obj : cargoList) {
 | 
	
		
			
				|  |  |             InventoryDO inventoryDO = null;
 | 
	
		
			
				|  |  |             try {
 | 
	
	
		
			
				|  | @ -4765,8 +4774,14 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
 | 
	
		
			
				|  |  |                     updateMediicinecabineInventoryById(inventoryDO.getCargoId(), inventoryDO.getDrugId(), inventoryDO.getQty() + "", userId);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             total+=inventoryDO.getQty();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (org.apache.commons.lang3.StringUtils.isNoneBlank(outDetailId)){
 | 
	
		
			
				|  |  |             Mediicinestockoutdetail detail =mediicinestockoutdetailDao.findOne(outDetailId);
 | 
	
		
			
				|  |  |             detail.setBatchNum(total+"");
 | 
	
		
			
				|  |  |             mediicinestockoutdetailDao.save(detail);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         result.put("response", ConstantUtils.SUCCESS);
 | 
	
		
			
				|  |  |         result.put("msg", ConstantUtils.SUCCESS);
 | 
	
		
			
				|  |  |         return result.toJSONString();
 |