| 
															
																@ -737,8 +737,8 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    /** 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * 合并和分离货道, state《---1单列货道,21合并货道的主货道,20次货道 
															 | 
															
															 | 
															
																     * 合并和分离货道, state《---1单列货道,21合并货道的主货道,20次货道 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param cargoIds 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @param isMerge 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param cargoIds          需合并的货道id 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param isMerge           true,合并,false,分解 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     * @return 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     */ 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public String mergeAndSplitCargo(String cargoIds, Boolean isMerge, String userId){ 
															 | 
															
															 | 
															
																    public String mergeAndSplitCargo(String cargoIds, Boolean isMerge, String userId){ 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -750,7 +750,9 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //对cargoIds重排 
															 | 
															
															 | 
															
																        //对cargoIds重排 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String[] cargoIdsArray = cargoIds.split(","); 
															 | 
															
															 | 
															
																        String[] cargoIdsArray = cargoIds.split(","); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //100percent,cargoCapacityChanged 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        boolean cargoCapacityChanged = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        int changedCapacity = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String deviceID = ""; 
															 | 
															
															 | 
															
																        String deviceID = ""; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //true,标识合并货道 
															 | 
															
															 | 
															
																        //true,标识合并货道 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (isMerge) { 
															 | 
															
															 | 
															
																        if (isMerge) { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -804,9 +806,12 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    inventory.setRatedInventory(0); 
															 | 
															
															 | 
															
																                    inventory.setRatedInventory(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    //清空药品 
															 | 
															
															 | 
															
																                    //清空药品 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    if (isFirst) { 
															 | 
															
															 | 
															
																                    if (isFirst) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                        changedCapacity -= Integer.parseInt(inventory.getCargoCapacity()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        inventory.setState("21"); 
															 | 
															
															 | 
															
																                        inventory.setState("21"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        isFirst = false; 
															 | 
															
															 | 
															
																                        isFirst = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    } else { 
															 | 
															
															 | 
															
																                    } else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        //累计副货道的货道容量 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        changedCapacity += Integer.parseInt(inventory.getCargoCapacity()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        inventory.setState("20"); 
															 | 
															
															 | 
															
																                        inventory.setState("20"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        //副货道内容操作-start-------》bug:13570 
															 | 
															
															 | 
															
																                        //副货道内容操作-start-------》bug:13570 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        inventory.setShelfStatus("0"); 
															 | 
															
															 | 
															
																                        inventory.setShelfStatus("0"); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -837,6 +842,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                inventoryRecord.setType("4"); 
															 | 
															
															 | 
															
																                inventoryRecord.setType("4"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                inventoryRecordDao.save(inventoryRecord); 
															 | 
															
															 | 
															
																                inventoryRecordDao.save(inventoryRecord); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            deviceID = inventory.getIdDevice(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            //清空药品 
															 | 
															
															 | 
															
																            //清空药品 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            inventory.setQty("0"); 
															 | 
															
															 | 
															
																            inventory.setQty("0"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            inventory.setDrugName(null); 
															 | 
															
															 | 
															
																            inventory.setDrugName(null); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -851,7 +857,12 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            //清空药品 
															 | 
															
															 | 
															
																            //清空药品 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            inventory.setState("1"); 
															 | 
															
															 | 
															
																            inventory.setState("1"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            inventoryDao.save(inventory); 
															 | 
															
															 | 
															
																            inventoryDao.save(inventory); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            boolean jumpFirst = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            for (MediicinecabinetInventory mediicinecabinetInventory : list) { 
															 | 
															
															 | 
															
																            for (MediicinecabinetInventory mediicinecabinetInventory : list) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if(jumpFirst) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    changedCapacity += Integer.parseInt(mediicinecabinetInventory.getCargoCapacity()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                jumpFirst = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                mediicinecabinetInventory.setMerge(mediicinecabinetInventory.getWayerNo()); 
															 | 
															
															 | 
															
																                mediicinecabinetInventory.setMerge(mediicinecabinetInventory.getWayerNo()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                mediicinecabinetInventory.setState("1"); 
															 | 
															
															 | 
															
																                mediicinecabinetInventory.setState("1"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                inventoryDao.save(mediicinecabinetInventory); 
															 | 
															
															 | 
															
																                inventoryDao.save(mediicinecabinetInventory); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -879,21 +890,50 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    "AND (t.state = '1' OR t.state = '21')"; 
															 | 
															
															 | 
															
																                    "AND (t.state = '1' OR t.state = '21')"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            mediicinedevice.setAisles(String.valueOf(jdbcTemplate.queryForObject(tempSql, Integer.class))); 
															 | 
															
															 | 
															
																            mediicinedevice.setAisles(String.valueOf(jdbcTemplate.queryForObject(tempSql, Integer.class))); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            //重算货道容量 
															 | 
															
															 | 
															
																            //重算货道容量 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            tempSql = "SELECT\n" + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    "\tifnull(sum(t.cargo_capacity), 0) as cargoCapacity\n" + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    "FROM\n" + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    "\tt_mediicinecabinet_inventory t\n" + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    "WHERE\n" + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    "\tt.id_device = '"+deviceID+"'\n" + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    "AND (t.state = '1' OR t.state = '21')"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            Map<String,Object> totalMap = jdbcTemplate.queryForMap(tempSql); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            Integer noOnlineTotal1 = 0; 
															 | 
															
															 | 
															
																            Integer noOnlineTotal1 = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            if (totalMap!=null){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                if (totalMap.get("cargoCapacity") != null) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    noOnlineTotal1 = (int) Double.parseDouble(totalMap.get("cargoCapacity").toString()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            //防止出现问题 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            noOnlineTotal1 = Integer.parseInt(mediicinedevice.getCapacity()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if (cargoCapacityChanged) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                tempSql = "SELECT\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "\tifnull(sum(t.cargo_capacity), 0) as cargoCapacity\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "FROM\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "\tt_mediicinecabinet_inventory t\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "WHERE\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "\tt.id_device = '"+mediicinedevice.getId()+"'\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "AND t.id not in ('"+cargoIds+"')\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "AND (t.state = '1' OR t.state = '21')"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                Map<String,Object> totalMap = jdbcTemplate.queryForMap(tempSql); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (totalMap != null){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    if (totalMap.get("cargoCapacity") != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        if (isMerge) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                            //合并货道,搜的是单列 货道,包含了现在要合并的内容,changedCapacity的是没了的 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                            noOnlineTotal1 = (int) Double.parseDouble(totalMap.get("cargoCapacity").toString() ); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        } else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                            //分离货道,主货道,也包含了现在恢复的主货道的容量 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                            noOnlineTotal1 = (int) Double.parseDouble(String.valueOf(totalMap.get("cargoCapacity"))) + changedCapacity; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                } 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                mediicinedevice.setCapacity(String.valueOf(noOnlineTotal1)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                deviceDao.save(mediicinedevice); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//            tempSql = "SELECT\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    "\tifnull(sum(t.cargo_capacity), 0) as cargoCapacity\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    "FROM\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    "\tt_mediicinecabinet_inventory t\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    "WHERE\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    "\tt.id_device = '"+deviceID+"'\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    "AND (t.state = '1' OR t.state = '21')"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																// 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//            Map<String,Object> totalMap = jdbcTemplate.queryForMap(tempSql); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//            Integer noOnlineTotal1 = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//            if (totalMap!=null){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                if (totalMap.get("cargoCapacity") != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    noOnlineTotal1 = (int) Double.parseDouble(totalMap.get("cargoCapacity").toString()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            mediicinedevice.setCapacity(String.valueOf(noOnlineTotal1)); 
															 | 
															
															 | 
															
																            mediicinedevice.setCapacity(String.valueOf(noOnlineTotal1)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            deviceDao.save(mediicinedevice); 
															 | 
															
															 | 
															
																            deviceDao.save(mediicinedevice); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -914,13 +954,42 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            result.put("response", ConstantUtils.FAIL); 
															 | 
															
															 | 
															
																            result.put("response", ConstantUtils.FAIL); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            return result.toJSONString(); 
															 | 
															
															 | 
															
																            return result.toJSONString(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String deviceId = null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        int changedCargoCapacity = 0; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        for (String cargoId : cargoIds.split(",")) { 
															 | 
															
															 | 
															
																        for (String cargoId : cargoIds.split(",")) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            if(!StringUtils.isEmpty(cargoId)){ 
															 | 
															
															 | 
															
																            if(!StringUtils.isEmpty(cargoId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                MediicinecabinetInventory inventory = inventoryDao.findOne(cargoId); 
															 | 
															
															 | 
															
																                MediicinecabinetInventory inventory = inventoryDao.findOne(cargoId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                inventory.setCargoState(cargoState); 
															 | 
															
															 | 
															
																                inventory.setCargoState(cargoState); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (cargoState.equals("1")) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    changedCargoCapacity += Integer.parseInt(inventory.getCargoCapacity()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                deviceId = inventory.getIdDevice(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                inventoryDao.save(inventory); 
															 | 
															
															 | 
															
																                inventoryDao.save(inventory); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if (!StringUtils.isEmpty(deviceId)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            Mediicinedevice mediicinedevice = deviceDao.findOne(deviceId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if (mediicinedevice != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                int oldCapacity = Integer.parseInt(mediicinedevice.getCapacity()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                String tempSql = "SELECT\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "\tifnull(sum(t.cargo_capacity), 0) as cargoCapacity\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "FROM\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "\tt_mediicinecabinet_inventory t\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "WHERE\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "\tt.id_device = '"+mediicinedevice.getId()+"'\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "AND t.id not in ('"+cargoIds+"')\n" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        "AND (t.state = '1' OR t.state = '21')"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                Map<String,Object> totalMap = jdbcTemplate.queryForMap(tempSql); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                if (totalMap != null){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    if (totalMap.get("cargoCapacity") != null) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        oldCapacity = (int) Double.parseDouble(String.valueOf(totalMap.get("cargoCapacity"))) + changedCargoCapacity; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                mediicinedevice.setCapacity(String.valueOf(oldCapacity)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                deviceDao.save(mediicinedevice); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        result.put("response",ConstantUtils.SUCCESS); 
															 | 
															
															 | 
															
																        result.put("response",ConstantUtils.SUCCESS); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return result.toJSONString(); 
															 | 
															
															 | 
															
																        return result.toJSONString(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1675,16 +1744,16 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql); 
															 | 
															
															 | 
															
																        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        int closedCapacity = list.stream() 
															 | 
															
															 | 
															
																        int closedCapacity = list.stream() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                .filter(item -> "0".equals(String.valueOf(item.get("cargoState")))  && "0".equals(String.valueOf(item.get("faultState")))) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                .filter(item -> "0".equals(String.valueOf(item.get("cargoState")))) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                .mapToInt(item -> Integer.parseInt(String.valueOf(item.get("cargoCapacity")))).sum(); 
															 | 
															
															 | 
															
																                .mapToInt(item -> Integer.parseInt(String.valueOf(item.get("cargoCapacity")))).sum(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        int faultCapacity = list.stream() 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                .filter(item -> "1".equals(String.valueOf(item.get("cargoState")))  && "1".equals(String.valueOf(item.get("faultState")))) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                .mapToInt(item -> Integer.parseInt(String.valueOf(item.get("cargoCapacity")))).sum(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//        int faultCapacity = list.stream() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                .filter(item -> "1".equals(String.valueOf(item.get("cargoState")))  && "1".equals(String.valueOf(item.get("faultState")))) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                .mapToInt(item -> Integer.parseInt(String.valueOf(item.get("cargoCapacity")))).sum(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //closedAndFaultCapacity 
															 | 
															
															 | 
															
																        //closedAndFaultCapacity 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        int closedAndFaultCapacity = list.stream() 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                .filter(item -> "0".equals(String.valueOf(item.get("cargoState")))  && "1".equals(String.valueOf(item.get("faultState")))) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                .mapToInt(item -> Integer.parseInt(String.valueOf(item.get("cargoCapacity")))).sum(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//        int closedAndFaultCapacity = list.stream() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                .filter(item -> "0".equals(String.valueOf(item.get("cargoState")))  && "1".equals(String.valueOf(item.get("faultState")))) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                .mapToInt(item -> Integer.parseInt(String.valueOf(item.get("cargoCapacity")))).sum(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        int drugNumber = list.stream() 
															 | 
															
															 | 
															
																        int drugNumber = list.stream() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                .filter(item -> "1".equals(String.valueOf(item.get("cargoState")))  && "0".equals(String.valueOf(item.get("faultState")))) 
															 | 
															
															 | 
															
																                .filter(item -> "1".equals(String.valueOf(item.get("cargoState")))  && "0".equals(String.valueOf(item.get("faultState")))) 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -1738,7 +1807,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                "AND (t.state = '1' OR t.state = '21')"; 
															 | 
															
															 | 
															
																//                "AND (t.state = '1' OR t.state = '21')"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        int drugNumber = jdbcTemplate.queryForObject(tempSql, Integer.class); 
															 | 
															
															 | 
															
																//        int drugNumber = jdbcTemplate.queryForObject(tempSql, Integer.class); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        int outOfStock = Integer.parseInt(device.getCapacity()) - closedAndFaultCapacity - faultCapacity - closedCapacity - drugNumber; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        int outOfStock = Integer.parseInt(device.getCapacity()) - closedCapacity - drugNumber; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        jsonObject.put("outOfStock", outOfStock); 
															 | 
															
															 | 
															
																        jsonObject.put("outOfStock", outOfStock); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //缺货库存----end 
															 | 
															
															 | 
															
																        //缺货库存----end 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        tempSql = "SELECT\n" + 
															 | 
															
															 | 
															
																        tempSql = "SELECT\n" + 
															 |