Selaa lähdekoodia

采购发票行已经参照,不允许删除上传的发票

zthwr 1 vuosi sitten
vanhempi
commit
69d3f4ef22
1 muutettua tiedostoa jossa 74 lisäystä ja 1 poistoa
  1. 74 1
      pu/pu/src/client/nc/pub/filesystem/newui/ThFileContentPanel.java

+ 74 - 1
pu/pu/src/client/nc/pub/filesystem/newui/ThFileContentPanel.java

@@ -104,10 +104,12 @@ import nc.vo.pub.filesystem.FileTypeConst;
 import nc.vo.pub.filesystem.ItemObj;
 import nc.vo.pub.filesystem.NCFileNode;
 import nc.vo.pub.filesystem.NCFileVO;
+import nc.vo.pubapp.pattern.pub.SqlBuilder;
 import nc.vo.uap.rbac.FuncSubInfo;
 import nc.itf.bd.defdoc.IDefdocService;
 import nc.bs.framework.common.InvocationInfoProxy;
 import nc.jdbc.framework.processor.BeanListProcessor;
+import nc.jdbc.framework.processor.ColumnListProcessor;
 
 public class ThFileContentPanel extends JPanel {
 	/**
@@ -1765,6 +1767,41 @@ public class ThFileContentPanel extends JPanel {
 						NCFileVO filevo = (NCFileVO) getfiletablemodel().getVO(
 								row);
 						String filepath = filevo.getFullPath();
+						
+						
+						
+						 String[] filname=filepath.split("/");
+							
+						 /**
+						  * 
+						  * 已经勾选了发票参照信息的不允许删除
+						  * 
+						  */
+						
+						int count =editor_.getBillCardPanel().getBodyPanel().getTable().getRowCount();//明细行条数
+						//获取已经勾选的发票数据
+						List<String> lisvdef20=new ArrayList<String>();
+						for(int i=0;i<count;i++){
+							Object objvbdef20=editor_.getBillCardPanel().getBodyValueAt(i, "vbdef20");//主键
+							if(null!=objvbdef20){
+								String vbdef20=objvbdef20.toString();
+								String[] vbd20arry=vbdef20.split(",");
+								for(int j=0;j<vbd20arry.length;j++){
+									lisvdef20.add(vbd20arry[j]);
+								}
+							}
+						 }
+						
+						List<String> memoarry= QryDefMemo(lisvdef20);
+						
+						if(null!=memoarry&&memoarry.size()>0){
+							if(memoarry.contains(filname[1])){
+								 MessageDialog.showErrorDlg(ThFileContentPanel.this, "提示","发票已经被勾选,不允许删除!");
+								 return;
+							}
+						}
+						
+						
 						try {
 							// 删除文件
 							IFileSystemService service = NCLocator
@@ -1813,7 +1850,6 @@ public class ThFileContentPanel extends JPanel {
 					      }
 						 
 						 //由于删除太慢,改成自定义档案数据停用
-						 String[] filname=filepath.split("/");
 						 DefdocVO[] deletevos=QryDefdocvoInfo(filname[1]);
 						 IDefdocService idefservice = NCLocator.getInstance().lookup(IDefdocService.class);
 						 try {
@@ -1848,6 +1884,43 @@ public class ThFileContentPanel extends JPanel {
 	}
 	
 	
+	
+	@SuppressWarnings("unchecked")
+	private List<String> QryDefMemo(List<String> lisvdef20){
+	 String[] arraydef20=lisvdef20.toArray(new String[0]);
+	 List<String> arrayvos=new ArrayList<String>();
+	 if(null==arraydef20||arraydef20.length==0){
+		 return arrayvos; 
+	 }
+	 
+	 SqlBuilder	sqlb=new SqlBuilder();
+	 sqlb.append("select memo  ");
+	 sqlb.append("from  bd_defdoc ");
+	 sqlb.append("where nvl(dr, 0) = 0 and pk_defdoclist= ");
+	 sqlb.append("(select pk_defdoclist ");
+	 sqlb.append("from bd_defdoclist ");
+	 sqlb.append("where code='OCRTHNC' and nvl(dr,0)=0) ");
+	 sqlb.append("and ");
+	 sqlb.append("pk_defdoc", arraydef20);
+	 
+	
+	 try {
+		IUAPQueryBS iuap= (IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+		ArrayList<String> objts=(ArrayList<String>) iuap.executeQuery(sqlb.toString(), new ColumnListProcessor("memo"));
+		 if(null!=objts&&objts.size()>0){
+			 arrayvos= objts;
+		 }
+	 } catch (BusinessException e) {
+		// TODO 自动生成的 catch 块
+		e.printStackTrace();
+		MessageDialog.showErrorDlg(ThFileContentPanel.this, "提示","查询OCR参照报错!");
+	 }
+	
+		return arrayvos;
+	
+    } 
+	
+	
 	private DefdocVO[]  QryDefdocvoInfo(String name){
     	String sql = "select * from  bd_defdoc where  nvl(dr, 0) = 0 and pk_defdoclist="
     			+ "(select pk_defdoclist from bd_defdoclist where code='OCRTHNC' and nvl(dr,0)=0) and memo='" + name + "' ";