| 
					
				 | 
			
			
				@ -94,7 +94,8 @@ public class MedicineStockUpService extends BaseJpaService<Mediicinestockup, Med 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //待补品类, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            mediicinestockup.setReplenishCate(String.valueOf(upDO.getDrugs().size())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            mediicinestockup.setReplenishEqu(upDO.getDeviceId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            mediicinestockup.setState("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //备货单状态, 1已生成, 2未生成, 3 删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            mediicinestockup.setState("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            mediicinestockup.setReplenishInventory(String.valueOf(upDO.getDrugs().stream().mapToInt(DrugDO::getQty).sum())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            mediicinestockup.setCreateUser(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            mediicinestockup.setCreateUserName(user.getName()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -167,6 +168,34 @@ public class MedicineStockUpService extends BaseJpaService<Mediicinestockup, Med 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result.toJSONString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param ids 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject deleteUp(String ids) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (ids == null || StringUtils.isEmpty(ids)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("msg", "ids is null or empty"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("response", ConstantUtils.FAIL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (String s : ids.split(",")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (!StringUtils.isEmpty(s)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Mediicinestockup mediicinestockup =  upDao.findOne(s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (mediicinestockup != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    mediicinestockup.setState("3"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    upDao.save(mediicinestockup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("msg", "删除成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("response", ConstantUtils.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 修改备货单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param jsonData 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -290,8 +319,8 @@ public class MedicineStockUpService extends BaseJpaService<Mediicinestockup, Med 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.update_user AS updateUser,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "t.update_user_name AS updateUserName\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t_mediicine_stockup AS t where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "    t_mediicine_stockup AS t where 1=1\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        conditionSql += " AND t.`state` != '3'\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //单据时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            conditionSql += " AND  t.doc_time >= '" + startTime +"'" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -318,7 +347,15 @@ public class MedicineStockUpService extends BaseJpaService<Mediicinestockup, Med 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Logger.getAnonymousLogger().info("finalCountSql="+countSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int count = jdbcTemplate.queryForObject(countSql,Integer.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(map.get("state").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("stateName", "已生成"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("2".equals(map.get("state").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("stateName", "未生成"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("3".equals(map.get("state").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("stateName", "删除"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("count", count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list)); 
			 |