Index: forgon-tools/src/main/java/com/forgon/tools/FileSystemHelper.java =================================================================== diff -u -r12331 -r26537 --- forgon-tools/src/main/java/com/forgon/tools/FileSystemHelper.java (.../FileSystemHelper.java) (revision 12331) +++ forgon-tools/src/main/java/com/forgon/tools/FileSystemHelper.java (.../FileSystemHelper.java) (revision 26537) @@ -1,16 +1,23 @@ package com.forgon.tools; import java.io.BufferedReader; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.lang.StringUtils; +import org.apache.commons.net.ftp.FTPClient; +import org.apache.commons.net.ftp.FTPFile; +import org.apache.commons.net.ftp.FTPFileFilter; /** - * @author LiNanChang + * @author LiNanChang,zc.li * * 2009-3-23 上午11:16:15 */ @@ -107,4 +114,97 @@ return null; } } + /** + * 复制文件 + * @param fileName 原文件名 + * @param newFileName 新的文件名 + * @param ftpClient + * @param sourceRoute 原路径 + * @param targetRoute 目标路径 + * @param isReturnNewFile 是否返回新的文件 + * @param isChangeWorkDir 是否改变工作目录 + * @throws IOException + */ + public static FTPFile copyFile(String fileName, String newFileName,FTPClient ftpClient,String sourceRoute, String targetRoute, boolean isReturnNewFile, boolean isChangeWorkDir) throws IOException{ + FTPFile file = null; + ByteArrayOutputStream fos = new ByteArrayOutputStream(); + ftpClient.retrieveFile(fileName, fos); + ByteArrayInputStream in = new ByteArrayInputStream(fos.toByteArray()); + boolean changeResult = false; + try { + changeResult = ftpClient.changeWorkingDirectory(targetRoute); + if(!changeResult){ + throw new IOException("复制文件"+ fileName + "至" + new String(targetRoute.getBytes("iso-8859-1"),"UTF-8") +"时,切换目录失败"); + } + boolean flag = ftpClient.storeFile(newFileName, in); + if(!flag){ + throw new IOException("复制文件"+ fileName + "至" + newFileName +"失败"); + } + if(isReturnNewFile){ + try { + file = getFileByFileName(newFileName, "", ftpClient); + } catch (Exception e) { + throw new IOException(e.getMessage()); + } + } + fos.close(); + in.close(); + } catch (IOException e) { + throw new IOException("从"+ new String(sourceRoute.getBytes("iso-8859-1"),"UTF-8") +"复制文件"+ fileName + "至" + newFileName +"发生异常"); + }finally{ + if(changeResult && !isChangeWorkDir){ + boolean successChange = ftpClient.changeWorkingDirectory(sourceRoute); + if(!successChange){ + throw new IOException("复制文件返回原路径"+ new String(sourceRoute.getBytes("iso-8859-1"),"UTF-8") + "异常"); + } + } + } + return file; + } + /** + * 获取指定目录下的文件fileName + * @param fileName 文件名 + * @param targetRoute 路径 "":当前目录 + * @param ftp + * @return + * @throws IOException + */ + public static FTPFile getFileByFileName(String fileName, String targetRoute, FTPClient ftp) throws IOException{ + FTPFile file = null; + try { + FTPFileFilter filter = new FTPFileFilter() { + @Override + public boolean accept(FTPFile file) { + if(file.getName().equals(fileName)){ + return true; + } + return false; + } + }; + file = ftp.listFiles(targetRoute, filter)[0]; + } catch (Exception e) { + throw new IOException("获取文件"+ fileName +"失败"); + } + return file; + } + /** + * 获取FTPClient当前绝对路径 + * @param ftp + * @return FTPClient当前绝对路径 + * @throws IOException + */ + public static String getCurrentPath(FTPClient ftp) throws IOException{ + String path = null; + try { + String[] rt = ftp.doCommandAsStrings("pwd",""); + Pattern p = Pattern.compile("\"(.*?)\""); + Matcher m = p.matcher(rt[0]); + if(m.find()){ + path = m.group(0).replace("\"",""); + } + } catch (Exception e) { + throw new IOException("获取当前绝对路径失败"); + } + return path; + } } Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/deviceinterface/DeviceInterface.java =================================================================== diff -u -r26443 -r26537 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/deviceinterface/DeviceInterface.java (.../DeviceInterface.java) (revision 26443) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/basedatamanager/deviceinterface/DeviceInterface.java (.../DeviceInterface.java) (revision 26537) @@ -119,7 +119,18 @@ * 不保存到数据库,用于前后台传输数据 */ private String OldDeviceId; - + /** + * 接口类型 + */ + private String interfaceType; + /** + * 共享文件夹方式 + */ + public static final String INTERFACETYPE_SHAREFOLDER = "共享文件夹"; + /** + * FTP方式 + */ + public static final String INTERFACETYPE_FTP = "FTP"; @Id @GeneratedValue(strategy = GenerationType.AUTO) public Long getId() { @@ -211,5 +222,11 @@ OldDeviceId = oldDeviceId; } - + public String getInterfaceType() { + return interfaceType; + } + + public void setInterfaceType(String interfaceType) { + this.interfaceType = interfaceType; + } } Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/deviceInterface/deviceInterfaceView.js =================================================================== diff -u -r25306 -r26537 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/deviceInterface/deviceInterfaceView.js (.../deviceInterfaceView.js) (revision 25306) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/deviceInterface/deviceInterfaceView.js (.../deviceInterfaceView.js) (revision 26537) @@ -89,6 +89,10 @@ width : 80, dataIndex : 'deviceBrand' }, { + header : "远程方式", + width : 80, + dataIndex : 'interfaceType' + }, { header : "IP地址", width : 100, dataIndex : 'IP' @@ -117,6 +121,7 @@ {type:'string',dataIndex:'folderPath'}, {type:'string',dataIndex:'userName'}, {type:'string',dataIndex:'deviceBrand'}, + {type:'string',dataIndex:'interfaceType'}, {type:'string',dataIndex:'deviceId'} ] @@ -139,6 +144,8 @@ },{ name : 'deviceBrand' },{ + name : 'interfaceType' + },{ name : 'deviceId' }]; Index: ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/device/service/XinHuaDataManagerImpl.java =================================================================== diff -u -r26048 -r26537 --- ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/device/service/XinHuaDataManagerImpl.java (.../XinHuaDataManagerImpl.java) (revision 26048) +++ ssts-maintain/src/main/java/com/forgon/disinfectsystem/maintain/device/service/XinHuaDataManagerImpl.java (.../XinHuaDataManagerImpl.java) (revision 26537) @@ -1,5 +1,6 @@ package com.forgon.disinfectsystem.maintain.device.service; +import java.io.ByteArrayInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -12,15 +13,19 @@ import net.sf.json.JSONObject; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.net.ftp.FTPClient; +import org.apache.commons.net.ftp.FTPFile; +import org.apache.commons.net.ftp.FTPFileFilter; +import org.apache.commons.net.ftp.FTPReply; import org.apache.log4j.Logger; import org.hibernate.Query; import org.hibernate.Session; import org.springframework.integration.smb.session.SmbSession; import org.springframework.integration.smb.session.SmbShare; import com.forgon.Constants; -import com.forgon.databaseadapter.service.DateQueryAdapter; import com.forgon.directory.acegi.tools.AcegiHelper; import com.forgon.disinfectsystem.entity.basedatamanager.deviceinterface.DeviceInterface; import com.forgon.disinfectsystem.entity.basedatamanager.rinser.Rinser; @@ -32,12 +37,11 @@ import com.forgon.disinfectsystem.washanddisinfectmanager.washanddisinfectrecord.service.WashAndDisinfectRecordManager; import com.forgon.log.model.Log; import com.forgon.log.service.LogManager; +import com.forgon.tools.FileSystemHelper; import com.forgon.tools.MathTools; import com.forgon.tools.date.DateTools; -import com.forgon.tools.db.InitDbConnection; import com.forgon.tools.hibernate.ObjectDao; import com.forgon.tools.string.StringTools; - /** * 新华灭菌炉、清洗机数据处理 * @author shuyongfu @@ -48,18 +52,7 @@ private ObjectDao objectDao; private SterilizationRecordManager sterilizationRecordManager; private WashAndDisinfectRecordManager washAndDisinfectRecordManager; - private DateQueryAdapter dateQueryAdapter; - private InitDbConnection dbConnection; - - - public void setDbConnection(InitDbConnection dbConnection) { - this.dbConnection = dbConnection; - } - public void setDateQueryAdapter(DateQueryAdapter dateQueryAdapter) { - this.dateQueryAdapter = dateQueryAdapter; - } - private static final Logger logger = Logger .getLogger(XinHuaDataManagerImpl.class); @@ -92,6 +85,20 @@ logger.debug(".......devInterface或机器号是空的"); return ; } + if(DeviceInterface.INTERFACETYPE_FTP.equals(devInterface.getInterfaceType())){//ftp方式 + readAndSaveRecordByFtp(devInterface, machineNo, brand, isAutoCompleteSterilization); + }else{//共享文件夹方式 + readAndSaveRecordByShareFolder(devInterface, machineNo, brand, isAutoCompleteSterilization); + } + } + /** + * 共享文件夹方式读取 + * @param devInterface 设备接口 + * @param machineNo 机器号 + * @param brand 接口品牌 + * @param isAutoCompleteSterilization 灭菌炉是否自动完成灭菌 + */ + public void readAndSaveRecordByShareFolder(DeviceInterface devInterface,String machineNo,String brand,String isAutoCompleteSterilization){ SmbSession session = null; String ip = devInterface.getIP(); String directory = devInterface.getFolderPath(); @@ -111,6 +118,8 @@ String backUpDirURL = rootURL + "backUp/"; //用于保存读取文件的临时复制文件 String cacheDirURL = rootURL + "cache/"; + //用于保存已读取的文件 + String readedFileDirURL = rootURL + "readedFile/"; if(!session.exists(backUpDirURL)){ logger.debug("创建文件夹..."); session.mkdir(backUpDirURL); @@ -119,6 +128,10 @@ logger.debug("创建文件夹..."); session.mkdir(cacheDirURL); } + if(!session.exists(readedFileDirURL)){ + logger.debug("创建文件夹..."); + session.mkdir(readedFileDirURL); + } for (String fileName : share.list()){ //1、判断文件名是否正确 // 只处理.txt文件 @@ -158,7 +171,7 @@ file.copyTo(cacheFile); //灭菌炉数据处理 logger.debug(String.format("开始处理灭菌炉数据:品牌【%s】,机器号【%s】,循环次数【%s】", brand,machineNumber,cycleCounter)); - JSONObject jsObject = sterilizerDataReadAndSave(cacheFile,devInterface); + JSONObject jsObject = sterilizerDataReadAndSave(cacheFile,devInterface,null,null); if( jsObject != null){ machineNumber = jsObject.getString("machineNumber");//机器号 cycleCounter = jsObject.getString("cycleCounter");//循环次数 @@ -172,21 +185,35 @@ //若灭菌炉的灭菌阶段为:已结束,则把该文件放进backUp文件夹中 if(isEnd){ SmbFile desFile = session.createSmbFileObject(backUpDirURL + fileName); + SmbFile readedFile = session.createSmbFileObject(readedFileDirURL + fileName); try{ file.copyTo(desFile); + file.copyTo(readedFile); file.delete(); }catch(Exception e){ e.printStackTrace(); logger.debug(fileName+"文件在移动和删除过程中发生错误"); + throw new IOException(fileName + "文件在移动和删除过程中发生错误"); } } + }else{ + try{ + SmbFile readedFile = session.createSmbFileObject(readedFileDirURL + fileName); + file.copyTo(readedFile); + file.delete(); + }catch(Exception e){ + e.printStackTrace(); + logger.debug(fileName + "文件在移动和删除过程中发生错误"); + throw new IOException(fileName + "文件在移动和删除过程中发生错误"); + } + } } } catch (IOException e) { // 捕获BufferedReader对象关闭时的异常 logger.warn(e.getMessage()); e.printStackTrace(); - appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, "设备接口连接异常," + e.getMessage()); + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, "rootURL:" + rootURL +",userName:"+ userName +",设备接口连接异常," + e.getMessage()); } finally{ session.close(); } @@ -200,8 +227,186 @@ { } - /** + * ftp方式读取 + * @param devInterface 设备接口 + * @param machineNo 机器号 + * @param brand 设备品牌 + * @param isAutoCompleteSterilization 灭菌炉是否自动完成灭菌 + * @author zc.li + */ + public void readAndSaveRecordByFtp(DeviceInterface devInterface,String machineNo,String brand,String isAutoCompleteSterilization){ + String ip = devInterface.getIP(); + String directory = devInterface.getFolderPath(); + String userName = devInterface.getUserName(); + String pwd = devInterface.getPassword(); + logger.debug("设备IP===="+ip); + logger.debug("用户名===="+userName); + logger.debug("密码===="+pwd); + FTPClient ftp = new FTPClient(); + if(!directory.startsWith("/")){ + directory = "/" + directory; + } + //用于保存不再需要读取的文件 + String backUpDirURL = "backUp"; + //用于保存读取文件的临时复制文件 + String cacheDirURL = "cache"; + //用于保存已经读取的文件 + String readedDirURL = "readedFile"; + try { + try { + ftp.connect(ip, 21); + } catch (Exception e) { + throw new RuntimeException("连接失败,ip:" + ip + ",端口:" + 21); + } + int reply = ftp.getReplyCode(); + if (!FTPReply.isPositiveCompletion(reply)) { + ftp.disconnect(); + ftp = null; + throw new RuntimeException("连接失败,ReplyCode无效值:" + reply); + } + boolean loginSuccess = false; + try { + loginSuccess = ftp.login(userName, pwd); + } catch (IOException e1) { + throw new RuntimeException("登录异常,用户名:"+ userName +"和密码是否正确"); + } + if(!loginSuccess){ + throw new RuntimeException("登录失败,请检查用户名:"+ userName +"密码是否正确"); + } + ftp.setControlEncoding("UTF-8"); + ftp.setFileType(FTPClient.BINARY_FILE_TYPE); + ftp.enterLocalPassiveMode(); + ftp.setBufferSize(1024); + ftp.setAutodetectUTF8(true); + //切换目录 + String directoryIso = new String(directory.getBytes("UTF-8"),"iso-8859-1"); + Boolean changeResult = ftp.changeWorkingDirectory(directoryIso); + if(!changeResult){ + throw new RuntimeException("切换目录[" + directory + "]失败"); + } + //绝对路径 + String backUpAbsolutePath = directoryIso + "/" + backUpDirURL; + String cacheAbsolutePath = directoryIso + "/" + cacheDirURL; + String readedAbsolutePath = directoryIso + "/" + readedDirURL; + try { + ftp.makeDirectory(backUpDirURL); + ftp.makeDirectory(cacheDirURL); + ftp.makeDirectory(readedDirURL); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("创建文件夹失败"); + } + FTPFile[] files = null; + FTPFileFilter filterTxt = new FTPFileFilter() { + @Override + public boolean accept(FTPFile file) { + if(file.getName().endsWith("txt") || file.getName().endsWith("TXT")){ + return true; + } + return false; + } + }; + try { + files = ftp.listFiles("",filterTxt); + } catch (IOException e2) { + e2.printStackTrace(); + throw new RuntimeException("查看文件" + directory + "异常"); + } + for (int i = 0; i < files.length; i++) { + FTPFile directoryFile = files[i]; + String fileName = directoryFile.getName(); + if(directoryFile.isDirectory()){ + continue; + } + JSONObject machineData = getMachineNo(fileName); + if(machineData == null){ + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, fileName + "文件名格式有误"); + continue; + } + //机器号 + String machineNumber = machineData.optString("machineNo"); + //循环次数 + String cycleCounter = machineData.optString("cycleCounter"); + // 机器号和品牌都要匹配,才处理 + if(!StringUtils.equals(brand, devInterface.XINHUA)){ + logger.debug(String.format("品牌【%s】,机器号【%s】,循环次数【%s】品牌不对->continue",brand,machineNumber,cycleCounter)); + continue; + } + if(!StringUtils.equals(machineNumber, machineNo)){ + logger.debug(String.format("品牌【%s】,机器号【%s】,循环次数【%s】机器号不对->continue",brand,machineNumber,cycleCounter)); + continue ; + } + if(StringUtils.isBlank(cycleCounter)){ + logger.debug(String.format("品牌【%s】,机器号【%s】,循环次数【%s】循环次数不能为空->contine",brand,machineNumber,cycleCounter)); + continue ; + } + //2、处理文件数据 + //避免读取时源文件有写入,所以先把源文件复制到cache文件夹里,再读取复制的文件 + FTPFile cacheFile = null; + try { + cacheFile = FileSystemHelper.copyFile(fileName, fileName, ftp, FileSystemHelper.getCurrentPath(ftp), cacheAbsolutePath, true , true); + } catch (Exception e) { + throw new RuntimeException(e.getMessage()); + } + //灭菌炉数据处理 + logger.debug(String.format("开始处理灭菌炉数据:品牌【%s】,机器号【%s】,循环次数【%s】", brand,machineNumber,cycleCounter)); + JSONObject jsObject = sterilizerDataReadAndSave(null, devInterface, cacheFile, ftp); + changeResult = ftp.changeWorkingDirectory(directoryIso); + if(!changeResult){ + throw new RuntimeException("切换目录[" + directory + "]失败"); + } + if( jsObject != null){ + machineNumber = jsObject.getString("machineNumber");//机器号 + cycleCounter = jsObject.getString("cycleCounter");//循环次数 + boolean isEnd = jsObject.getBoolean("isEnd");//灭菌阶段是否为已结束 + // 灭菌炉是否自动完成灭菌 + if( !StringUtils.isNotBlank(isAutoCompleteSterilization) || isAutoCompleteSterilization.equals(Constants.STR_YES)){ + autoFinishSterilizerRecord(devInterface.getId().toString(),Long.parseLong(cycleCounter),machineNumber); + } + //更新灭菌记录的温度压力数据条数 + refreshSterilizaerRecordAmounts(devInterface.getId().toString(),Long.parseLong(cycleCounter),machineNumber); + //若灭菌炉的灭菌阶段为:已结束,则把该文件放进backUp文件夹中 + try{ + if(isEnd){ + FileSystemHelper.copyFile(fileName, fileName, ftp, FileSystemHelper.getCurrentPath(ftp), backUpAbsolutePath, false, false); + } + FileSystemHelper.copyFile(fileName, fileName, ftp, FileSystemHelper.getCurrentPath(ftp), readedAbsolutePath, false, false); + boolean delResult = ftp.deleteFile(fileName); + if(!delResult){ + throw new RuntimeException("删除文件"+ fileName +"失败"); + } + }catch(Exception e){ + e.printStackTrace(); + logger.debug(e.getMessage()); + } + }else{ + try { + FileSystemHelper.copyFile(fileName, fileName, ftp, FileSystemHelper.getCurrentPath(ftp), readedAbsolutePath, false , false); + boolean delResult = ftp.deleteFile(fileName); + if(!delResult){ + throw new RuntimeException("删除文件"+ fileName +"失败"); + } + } catch (Exception e) { + throw new RuntimeException(e.getMessage()); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.warn(e.getMessage()); + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, e.getMessage()); + }finally{ + try { + ftp.disconnect(); + } catch (IOException e) { + logger.warn(e.getMessage()); + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, "关闭连接失败"); + } + } + } + + /** * 根据文件获取相关信息 * @param file 文件 * @return @@ -236,19 +441,37 @@ } /** - * 新华灭菌炉数据处理 + * 新华灭菌炉数据处理 如果remoteFile不为null,则使用共享文件夹方式;如果remoteFile为null,则使用FTP方式 + * @param remoteFile 共享文件夹方式的远程文件 + * @param devInterface 设备接口 + * @param ftpFile ftp方式的远程文件 + * @param ftp fTPclient对象 + * @return */ - private JSONObject sterilizerDataReadAndSave(SmbFile remoteFile,DeviceInterface devInterface){ + private JSONObject sterilizerDataReadAndSave(SmbFile remoteFile,DeviceInterface devInterface, FTPFile ftpFile, FTPClient ftp){ //文件名称 - String fileName = remoteFile.getName(); + String fileName = null; + if(remoteFile != null){ + fileName = remoteFile.getName(); + }else{ + fileName = ftpFile.getName(); + } InputStream inputStream = null; try{ //1、获取文件输入流(有可能不是第一次读取该文件) - inputStream = remoteFile.getInputStream(); + //文件字节长度 + long remoteFileLength = 0L; + if(remoteFile != null){ + inputStream = remoteFile.getInputStream(); + remoteFileLength = remoteFile.length(); + }else{ + ByteArrayOutputStream fos = new ByteArrayOutputStream(); + ftp.retrieveFile(fileName, fos); + inputStream = new ByteArrayInputStream(fos.toByteArray()); + remoteFileLength = ftpFile.getSize(); + } //要跳过的字节数 long skip = 0L; - //文件字节长度 - long remoteFileLength = remoteFile.length(); //获取该文件名的灭菌文件记录 SterilizerFileName sterilizerFileName = (SterilizerFileName) objectDao.getByProperty( SterilizerFileName.class.getSimpleName(), "fileName", fileName); @@ -266,7 +489,13 @@ sterilizerFileName.setSkip(skip); } //若文件位置并没有这么多,则从头开始 - if(remoteFile.length() < skip){ + long nowLength = 0L; + if(remoteFile != null){ + nowLength = remoteFile.length(); + }else{ + nowLength = ftpFile.getSize(); + } + if(nowLength < skip){ skip = 0L; sterilizerFileName.setSkip(skip); } @@ -283,7 +512,7 @@ //2、根据文件名称获取信息 JSONObject machineData = getMachineNo(fileName); if(machineData == null){ - appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, remoteFile.getName() + "文件名格式有误"); + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_QUERY, fileName + "文件名格式有误"); return null; } //机器号 @@ -345,17 +574,21 @@ return null; } catch (IOException e) { logger.warn(e.getMessage()); - appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, "设备接口连接异常," + e.getMessage()); + String inputStreamStr = ""; + if(inputStream == null){ + inputStreamStr = "inputStream is null"; + } + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, fileName +"处理时设备接口连接异常,"+ inputStreamStr + "," + e.getMessage()); return null; } catch (Exception e) { logger.warn(e.getMessage()); - appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, "设备接口运行异常," + e.getMessage()); + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, fileName + "处理时设备接口运行异常," + e.getMessage()); return null; }finally{ try { inputStream.close(); } catch (IOException e) { - appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, "设备接口运行异常," + e.getMessage()); + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_DEVICE_INTERFACE, Log.TYPE_ADD, fileName + "处理时设备接口运行异常," + e.getMessage()); e.printStackTrace(); } } Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/deviceInterface/deviceInterfaceForm.js =================================================================== diff -u -r26443 -r26537 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/deviceInterface/deviceInterfaceForm.js (.../deviceInterfaceForm.js) (revision 26443) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/deviceInterface/deviceInterfaceForm.js (.../deviceInterfaceForm.js) (revision 26537) @@ -25,7 +25,7 @@ layout : 'column', items : [ { layout : 'form', - columnWidth : 1, + columnWidth : .5, labelWidth : 70, items : [ { xtype : 'textfield', @@ -41,6 +41,31 @@ layout : 'form', columnWidth : 0.5, labelWidth : 70, + id : 'interfaceTypeWrap', + items : [{ + xtype : 'combo', + fieldLabel : '接口类型', + id : 'interfaceType', + name : 'interfaceType', + width : 130, + valueField : 'value', + displayField : 'value', + store : new Ext.data.SimpleStore({ + fields : [ 'value' ], + data : [[SHAREFOLDER],[FTP]] + } + ), + forceSelection : true, + allowBlank : false, + editable : false, + mode : 'local', + triggerAction : 'all', + anchor : '95%' + }] + },{ + layout : 'form', + columnWidth : 0.5, + labelWidth : 70, items : [ { xtype : 'textfield', fieldLabel : "IP地址", @@ -213,6 +238,9 @@ waitMsg : '正在加载数据,请稍候', success : function(form, action) { top.Ext.getCmp("oldDeviceId").setValue(action.result.data.deviceId); + if(action.result.data.deviceBrand == XINHUA && action.result.data.interfaceType == ''){ + top.Ext.getCmp("interfaceType").setValue(SHAREFOLDER); + } onDeviceBrandChange(); }, failure : function(form, action) { @@ -250,6 +278,7 @@ hideCmt('portWrap','port',true); hideCmt('deviceIdWrap','deviceId',true); hideCmt('deviceModelWrap','deviceModel',true); + hideCmt('interfaceTypeWrap','interfaceType',true); showCmt('userNameWrap','userName',false); showCmt('folderPathWrap','folderPath',false); showCmt('passwordWrap','password',false); @@ -273,7 +302,12 @@ fields : [ 'value' ], data : [[CHANGLONG]] }) + var interfaceTypeComboStore = new Ext.data.SimpleStore({ + fields : [ 'value' ], + data : [[SHAREFOLDER],[FTP]] + }) showCmt('deviceModelWrap','deviceModel',true,xinhuaModelComboStore); + showCmt('interfaceTypeWrap','interfaceType',true,interfaceTypeComboStore); }else{ // top.Ext.getCmp('deviceIdWrap').hide(); // top.Ext.getCmp('portWrap').hide(); Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/deviceInterface/deviceInterfaceView.jsp =================================================================== diff -u -r26443 -r26537 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/deviceInterface/deviceInterfaceView.jsp (.../deviceInterfaceView.jsp) (revision 26443) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/deviceInterface/deviceInterfaceView.jsp (.../deviceInterfaceView.jsp) (revision 26537) @@ -30,7 +30,9 @@ var GETINGE = '<%=DeviceInterface.GETINGE%>'; var STERIS = '<%=DeviceInterface.STERIS%>'; var BELIMED = '<%=DeviceInterface.BELIMED%>'; - +//远程方式 +var SHAREFOLDER = '<%=DeviceInterface.INTERFACETYPE_SHAREFOLDER%>'; +var FTP = '<%=DeviceInterface.INTERFACETYPE_FTP%>'; /** * 《供应商包添加》权限 */