Explorar o código

新增附件发票删除时,删除uploadfile文件夹里对应发票

zthwr %!s(int64=2) %!d(string=hai) anos
pai
achega
de2213d511

+ 24 - 5
pu/pu/src/client/nc/pub/filesystem/newui/ThFileContentPanel.java

@@ -1,5 +1,6 @@
 package nc.pub.filesystem.newui;
 import nc.vo.arap.utils.StringUtil;
+
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Component;
@@ -66,6 +67,7 @@ import javax.swing.tree.TreeNode;
 import javax.swing.tree.TreePath;
 
 import nc.bs.framework.common.NCLocator;
+import nc.bs.framework.common.RuntimeEnv;
 import nc.bs.logging.Logger;
 import nc.bs.pub.filesystem.IFileSystemActionConst;
 import nc.bs.pub.filesystem.IFileSystemService;
@@ -93,7 +95,6 @@ import nc.ui.pub.beans.UITree;
 import nc.ui.pub.beans.table.VOTableModel;
 import nc.ui.pub.bill.BillCardPanel;
 import nc.ui.pub.filesystem.FileManageServletClient;
-import nc.ui.uif2.editor.BillForm;
 import nc.uitheme.ui.ThemeResourceCenter;
 import nc.vo.pub.BusinessException;
 import nc.vo.pub.ValueObject;
@@ -118,7 +119,8 @@ public class ThFileContentPanel extends JPanel {
 	public static final int BROWSESINGLEICON_STATE =2;
 	//缩略图浏览
 	public static final int BROWSESMALLICON_STATE =3; 
-	protected BillForm editor_;
+	
+	public BillCardPanel fpcpanel;
 	private int colnumbtnpane =5 ;
 	private int colnumbtnbrow =1;
 	protected String rootDirStr = "dir1/dir2/ewei";
@@ -196,10 +198,10 @@ public class ThFileContentPanel extends JPanel {
 		setUIEnable();
 		initUI();
 	}
-	public ThFileContentPanel(String root,BillForm editor) {		
+	public ThFileContentPanel(String root,BillCardPanel cpanel) {		
 		super();
 		rootDirStr = root ;
-		editor_ = editor;
+		this.fpcpanel=cpanel;
 		//设置权限		
 		initUI();
 	}
@@ -1741,7 +1743,8 @@ public class ThFileContentPanel extends JPanel {
 					getPatchInfoTable().setRowSelectionInterval(rowindex,
 							rowindex);
 					if (MessageDialog.showOkCancelDlg(ThFileContentPanel.this,
-							NCLangRes.getInstance().getStrByID("sftemp", "FileContentPanel-0011")/*确认删除*/, NCLangRes.getInstance().getStrByID("sftemp", "FileContentPanel-0012")/*确定要删除文件?*/) == MessageDialog.ID_OK) {
+							NCLangRes.getInstance().getStrByID("sftemp", "FileContentPanel-0011")/*确认删除*/,
+							NCLangRes.getInstance().getStrByID("sftemp", "FileContentPanel-0012")/*确定要删除文件?*/) == MessageDialog.ID_OK) {
 						int row = getPatchInfoTable().getSelectedRow();
 						NCFileVO filevo = (NCFileVO) getfiletablemodel().getVO(
 								row);
@@ -1754,6 +1757,10 @@ public class ThFileContentPanel extends JPanel {
 
 							service
 									.deleteNCFileNodes(new String[] { filepath });
+							
+							
+							
+							
 
 							// 刷新table
 							getfiletablemodel().removeVO(row);
@@ -1770,6 +1777,18 @@ public class ThFileContentPanel extends JPanel {
 						} catch (BusinessException ex) {
 							Logger.error(ex.getMessage(), ex);
 						}
+						
+						//删除home发票文件夹里的对应发票 add by ZTH
+						String deletefilepath =  RuntimeEnv.getInstance().getNCHome()
+							      +File.separator +"uploadfile" + File.separator+ filepath; // 文件保存的路径
+						
+						 File file = new File(deletefilepath);
+						
+						 if (file.delete()) {
+							 MessageDialog.showHintDlg(ThFileContentPanel.this, "提示","删除成功!");
+					      } else {
+					    	  MessageDialog.showErrorDlg(ThFileContentPanel.this, "提示","删除操作失败。");
+					      }
 					}
 				}
 			});