| 
					
				 | 
			
			
				@ -2166,6 +2166,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\ttmi.layer_no AS layerNo,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\ttmi.wayer_no AS wayerNo,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\ttmi.qty AS qty,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\ttmi.cargo_capacity AS cargoCapacity,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\ttmd.id AS id,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\ttmd.approval_num AS approvalNum,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\ttmd.barcode AS barcode,\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2215,13 +2216,15 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        list = hibenateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String, Object> stringObjectMap : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String tempStr = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            tempStr = sencordSql + " where ',"+stringObjectMap.get("id")+",' LIKE CONCAT('%,',tmi.id_device,',%')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tempStr = sencordSql + " WHERE tmi.id_device = '" + stringObjectMap.get("id").toString() + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //is not null 用于管理端,新增备货单时,获取设备缺货信息, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 没有绑定药品的货道也显示,导致,窗口不好看而增加的,操作员端的,有待观察 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            tempStr = sencordSql + " WHERE tmi.drug_code IS NOT NULL and tmi.org_code IS NOT NULL and tmi.id_device = '" + stringObjectMap.get("id").toString() + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String, Object>> childList = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            childList = hibenateUtils.createSQLQuery(tempStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (childList != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (Map<String, Object> objectMap : childList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    objectMap.put("upInventory", Integer.parseInt(stringObjectMap.get("cargoCapacity").toString()) - Integer.parseInt(objectMap.get("qty").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //待补数量,第一个objectMap,是有stringObjectMap变换过来的,即,采用单个货道容量来计算待补数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    objectMap.put("upInventory", Integer.parseInt(objectMap.get("cargoCapacity").toString()) - Integer.parseInt(objectMap.get("qty").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (stringObjectMap.get("state") != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (!StringUtils.isEmpty(stringObjectMap.get("state").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if ("1".equals(stringObjectMap.get("state").toString())) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2783,6 +2786,10 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        inventory.setSku(mediicinedrugs.getDrugSku()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        inventory.setShelfStatus("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        inventory.setDrugId(drugId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //更换药品,货道容量跟着药品数量变动 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (Integer.parseInt(qty) > Integer.parseInt(inventory.getCargoCapacity())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            inventory.setCargoCapacity(qty); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        inventory.setQty(qty); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        inventory.setPic(mediicinedrugs.getPic()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return inventoryDao.save(inventory); 
			 |