Browse Source

增加校验

yaoyu 1 năm trước cách đây
mục cha
commit
216b335709

+ 163 - 164
pu/pu/src/client/nc/pub/filesystem/newui/ThUploadAction.java

@@ -1,164 +1,163 @@
-package nc.pub.filesystem.newui;
-
-import java.awt.event.ActionEvent;
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import nc.itf.th.IThOcrService;
-import nc.bs.framework.common.RuntimeEnv;
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JFileChooser;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-import nc.bs.framework.common.NCLocator;
-import nc.bs.logging.Logger;
-import nc.desktop.ui.WorkbenchEnvironment;
-import nc.funcnode.ui.action.AbstractNCAction;
-import nc.itf.pu.service.IInvoiceOCRMaintain;
-import nc.log.NcLog;
-import nc.ui.ml.NCLangRes;
-import nc.ui.pub.beans.MessageDialog;
-import nc.ui.pub.bill.BillCardPanel;
-import nc.ui.pub.filesystem.FileManageServletClient;
-import nc.vo.pub.filesystem.NCFileNode;
-import nc.vo.pub.lang.UFDate;
-import nc.vo.pub.lang.UFDouble;
-
-
-public class ThUploadAction extends AbstractNCAction {
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = 1L;
-	private ThFileContentPanel parentpanel ;
-	public ThUploadAction(ThFileContentPanel para){
-		parentpanel = para;
-		this.putValue(AbstractAction.NAME,NCLangRes.getInstance().getStrByID("sftemp", "UploadAction-0000")/*上传附件*/);
-		this.putValue(Action.SHORT_DESCRIPTION, NCLangRes.getInstance().getStrByID("sftemp", "UploadAction-0000")/*上传附件*/);
-//		this.putValue(AbstractAction.SMALL_ICON, ClientToolKit.loadImageIcon("images/filesystem/newfolder.png"));
-	}
-	
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		if (parentpanel.rootNode == null) {
-			return;
-		}
-		TreePath path = parentpanel.getPatchTree().getSelectionPath();
-		if (path == null) {
-			path = new TreePath(parentpanel.rootNode.getPath());
-		}
-		DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
-		
-		JFileChooser chooser = new JFileChooser();
-		//要求上传多个文件
-		chooser.setMultiSelectionEnabled(true);
-		if (chooser.showOpenDialog(parentpanel) == JFileChooser.APPROVE_OPTION) {
-			String pPath = "";
-			if (node instanceof NCFileNode) {
-				pPath = ((NCFileNode) node).getFullPath();
-			}
-//			File file = chooser.getSelectedFile();
-			//多文件上传
-			File[] arrfiles = chooser.getSelectedFiles();
-			if(arrfiles==null ||arrfiles.length==0){
-				//没有选择文件退出
-				return;
-			}
-			
-			String dsName = WorkbenchEnvironment.getInstance().getLoginBusiCenter().getDataSourceName();
-			
-			String creator = WorkbenchEnvironment.getInstance().getLoginUser().getCuserid();
-			FileInputStream input = null;
-			FileInputStream testinput = null;
-			
-			IThOcrService  ocrservice=(IThOcrService) NCLocator.getInstance().lookup(IThOcrService.class.getName());
-				
-			
-			try {
-				for(File file :arrfiles){
-					String fileName = file.getName();
-					//校验是否同名
-					if(parentpanel.CheckTheSameFileName((NCFileNode)node, fileName)){
-						continue ;
-					}
-					//检查 附件大小 ,文件超过  参数设置的大小不能上传
-					long size =(long)FileBroseConst.getfilelimit()*1024L*1024L;
-					if(size<file.length()){
-						MessageDialog.showErrorDlg(parentpanel, NCLangRes.getInstance().getStrByID("sftemp", "UploadAction-0001")/*文件超过限制*/, NCLangRes.getInstance().getStrByID("sftemp", "UploadAction-0002", null, new String[]{fileName})/*{0}大小超过限制不能上传!*/);
-						continue ;
-					}
-					input = new FileInputStream(file);
-					testinput = new FileInputStream(file);
-//					String absolutePath = file.getAbsolutePath();
-//					MessageDialog.showHintDlg(parentpanel, "提示","absolutePath:"+absolutePath);
-//					String pathww = file.getPath();
-//					MessageDialog.showHintDlg(parentpanel, "提示","pathww:"+pathww);
-					/***********************发票图片保存到文件夹 home/uploadfile/"+vdef17+"  ****************************/
-					BillCardPanel cpanel=parentpanel.editor_.getBillCardPanel();
-					String vdef17 = (String) cpanel.getHeadItem("vdef17").getValueObject();
-					//add by pcy
-					//把附件保存到文件资源管理器
-//					String filepath = ocrservice.UploadFile(vdef17, file);
-//					String filepath =  ocrservice.getNCHomePath()
-//						      +File.separator +"uploadfile" + File.separator+ vdef17; // 文件保存的路径
-//					File folder = new File(filepath);
-//					if(!folder.exists() && !folder.isDirectory()){
-//						folder.mkdirs();
-//					}
-//					String newFileName = filepath + File.separator + fileName;
-//					FileOutputStream outputStream = new FileOutputStream(newFileName);
-//					FileInputStream fis = new FileInputStream(file);
-//			        byte[] buffer = new byte[1024];
-//			        int len;
-//			        while ((len = fis.read(buffer)) != -1) {
-//			            outputStream.write(buffer, 0, len);
-//			        }
-//			        outputStream.close();
-//			        fis.close();
-					
-					NCFileNode newNode = FileManageServletClient.uploadFile(dsName, pPath, fileName, testinput, creator, file.length());
-					if (newNode != null) {
-//						NCFileVO  newfilevo = new NCFileVO();
-//						newfilevo.set
-//						newfilevo.setPath(newpath+newaddfilevo.getFullPath());
-//						newfilevo.setCreator(newaddfilevo.getCreator());
-//						newfilevo.setTime(newaddfilevo.getTime());
-//						newfilevo.setFileLen(newaddfilevo.getFileLen());
-						parentpanel.nodeToFileVO((NCFileNode)node, newNode);
-					}
-					
-					//转为byte传输
-					BufferedInputStream bis=new BufferedInputStream(input);
-                    ByteArrayOutputStream bos=new ByteArrayOutputStream();
-					int date=-1;
-					while ((date = bis.read()) != -1) {
-						bos.write(date);
-			        }
-					byte[] 	bytes=	bos.toByteArray();
-					
-					String patch=ocrservice.saveUploadFile(vdef17, fileName, bytes);//保存发票到home里
-			
-				}
-			} catch (Exception ex) {
-				Logger.error(ex.getMessage(), ex);
-				MessageDialog.showErrorDlg(parentpanel, NCLangRes.getInstance().getStrByID("pc", "FileManageUI-000000")/*错误*/,ex.getMessage()/*上传时发生错误!*/);
-				//MessageDialog.showErrorDlg(parentpanel, NCLangRes.getInstance().getStrByID("pc", "FileManageUI-000000")/*错误*/,NCLangRes.getInstance().getStrByID("sftemp", "UploadAction-0003")/*上传时发生错误!*/);
-			} finally {
-				try {
-					if (input != null) {
-						input.close();
-					}
-				} catch (Exception e2) {
-				}
-			}
-		}
-	
-	}
-}
+package nc.pub.filesystem.newui;
+
+import java.awt.event.ActionEvent;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import nc.itf.th.IThOcrService;
+import nc.bs.framework.common.RuntimeEnv;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JFileChooser;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreePath;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import nc.bs.framework.common.NCLocator;
+import nc.bs.logging.Logger;
+import nc.desktop.ui.WorkbenchEnvironment;
+import nc.funcnode.ui.action.AbstractNCAction;
+import nc.log.NcLog;
+import nc.ui.ml.NCLangRes;
+import nc.ui.pub.beans.MessageDialog;
+import nc.ui.pub.bill.BillCardPanel;
+import nc.ui.pub.filesystem.FileManageServletClient;
+import nc.vo.pub.filesystem.NCFileNode;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDouble;
+
+
+public class ThUploadAction extends AbstractNCAction {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private ThFileContentPanel parentpanel ;
+	public ThUploadAction(ThFileContentPanel para){
+		parentpanel = para;
+		this.putValue(AbstractAction.NAME,NCLangRes.getInstance().getStrByID("sftemp", "UploadAction-0000")/*上传附件*/);
+		this.putValue(Action.SHORT_DESCRIPTION, NCLangRes.getInstance().getStrByID("sftemp", "UploadAction-0000")/*上传附件*/);
+//		this.putValue(AbstractAction.SMALL_ICON, ClientToolKit.loadImageIcon("images/filesystem/newfolder.png"));
+	}
+	
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		if (parentpanel.rootNode == null) {
+			return;
+		}
+		TreePath path = parentpanel.getPatchTree().getSelectionPath();
+		if (path == null) {
+			path = new TreePath(parentpanel.rootNode.getPath());
+		}
+		DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
+		
+		JFileChooser chooser = new JFileChooser();
+		//要求上传多个文件
+		chooser.setMultiSelectionEnabled(true);
+		if (chooser.showOpenDialog(parentpanel) == JFileChooser.APPROVE_OPTION) {
+			String pPath = "";
+			if (node instanceof NCFileNode) {
+				pPath = ((NCFileNode) node).getFullPath();
+			}
+//			File file = chooser.getSelectedFile();
+			//多文件上传
+			File[] arrfiles = chooser.getSelectedFiles();
+			if(arrfiles==null ||arrfiles.length==0){
+				//没有选择文件退出
+				return;
+			}
+			
+			String dsName = WorkbenchEnvironment.getInstance().getLoginBusiCenter().getDataSourceName();
+			
+			String creator = WorkbenchEnvironment.getInstance().getLoginUser().getCuserid();
+			FileInputStream input = null;
+			FileInputStream testinput = null;
+			
+			IThOcrService  ocrservice=(IThOcrService) NCLocator.getInstance().lookup(IThOcrService.class.getName());
+				
+			
+			try {
+				for(File file :arrfiles){
+					String fileName = file.getName();
+					//校验是否同名
+					if(parentpanel.CheckTheSameFileName((NCFileNode)node, fileName)){
+						continue ;
+					}
+					//检查 附件大小 ,文件超过  参数设置的大小不能上传
+					long size =(long)FileBroseConst.getfilelimit()*1024L*1024L;
+					if(size<file.length()){
+						MessageDialog.showErrorDlg(parentpanel, NCLangRes.getInstance().getStrByID("sftemp", "UploadAction-0001")/*文件超过限制*/, NCLangRes.getInstance().getStrByID("sftemp", "UploadAction-0002", null, new String[]{fileName})/*{0}大小超过限制不能上传!*/);
+						continue ;
+					}
+					input = new FileInputStream(file);
+					testinput = new FileInputStream(file);
+//					String absolutePath = file.getAbsolutePath();
+//					MessageDialog.showHintDlg(parentpanel, "提示","absolutePath:"+absolutePath);
+//					String pathww = file.getPath();
+//					MessageDialog.showHintDlg(parentpanel, "提示","pathww:"+pathww);
+					/***********************发票图片保存到文件夹 home/uploadfile/"+vdef17+"  ****************************/
+					BillCardPanel cpanel=parentpanel.editor_.getBillCardPanel();
+					String vdef17 = (String) cpanel.getHeadItem("vdef17").getValueObject();
+					//add by pcy
+					//把附件保存到文件资源管理器
+//					String filepath = ocrservice.UploadFile(vdef17, file);
+//					String filepath =  ocrservice.getNCHomePath()
+//						      +File.separator +"uploadfile" + File.separator+ vdef17; // 文件保存的路径
+//					File folder = new File(filepath);
+//					if(!folder.exists() && !folder.isDirectory()){
+//						folder.mkdirs();
+//					}
+//					String newFileName = filepath + File.separator + fileName;
+//					FileOutputStream outputStream = new FileOutputStream(newFileName);
+//					FileInputStream fis = new FileInputStream(file);
+//			        byte[] buffer = new byte[1024];
+//			        int len;
+//			        while ((len = fis.read(buffer)) != -1) {
+//			            outputStream.write(buffer, 0, len);
+//			        }
+//			        outputStream.close();
+//			        fis.close();
+					
+					NCFileNode newNode = FileManageServletClient.uploadFile(dsName, pPath, fileName, testinput, creator, file.length());
+					if (newNode != null) {
+//						NCFileVO  newfilevo = new NCFileVO();
+//						newfilevo.set
+//						newfilevo.setPath(newpath+newaddfilevo.getFullPath());
+//						newfilevo.setCreator(newaddfilevo.getCreator());
+//						newfilevo.setTime(newaddfilevo.getTime());
+//						newfilevo.setFileLen(newaddfilevo.getFileLen());
+						parentpanel.nodeToFileVO((NCFileNode)node, newNode);
+					}
+					
+					//转为byte传输
+					BufferedInputStream bis=new BufferedInputStream(input);
+                    ByteArrayOutputStream bos=new ByteArrayOutputStream();
+					int date=-1;
+					while ((date = bis.read()) != -1) {
+						bos.write(date);
+			        }
+					byte[] 	bytes=	bos.toByteArray();
+					
+					String patch=ocrservice.saveUploadFile(vdef17, fileName, bytes);//保存发票到home里
+			
+				}
+			} catch (Exception ex) {
+				Logger.error(ex.getMessage(), ex);
+				MessageDialog.showErrorDlg(parentpanel, NCLangRes.getInstance().getStrByID("pc", "FileManageUI-000000")/*错误*/,ex.getMessage()/*上传时发生错误!*/);
+				//MessageDialog.showErrorDlg(parentpanel, NCLangRes.getInstance().getStrByID("pc", "FileManageUI-000000")/*错误*/,NCLangRes.getInstance().getStrByID("sftemp", "UploadAction-0003")/*上传时发生错误!*/);
+			} finally {
+				try {
+					if (input != null) {
+						input.close();
+					}
+				} catch (Exception e2) {
+				}
+			}
+		}
+	
+	}
+}

+ 30 - 0
pu/pu/src/client/nc/ui/pu/m25/action/InvoiceCopyAction.java

@@ -0,0 +1,30 @@
+package nc.ui.pu.m25.action;
+
+import nc.ui.pubapp.uif2app.actions.CopyAction;
+import nc.vo.pu.m25.entity.InvoiceItemVO;
+import nc.vo.pu.m25.entity.InvoiceVO;
+
+public class InvoiceCopyAction extends CopyAction {
+	private static final long serialVersionUID = 5294690646619221536L;
+	
+	/**
+	 * 有发票参照的单据不允许复制
+	 */
+	@Override
+	protected boolean isActionEnable() {
+		boolean isEnable = super.isActionEnable();
+		if (isEnable) {
+			InvoiceVO vo = (InvoiceVO) this.getModel().getSelectedData();
+			InvoiceItemVO[] invoiceItemVO = vo.getChildrenVO();
+			if(invoiceItemVO != null) {
+				for (int i = 0; i < invoiceItemVO.length; i++) {
+					
+					if(invoiceItemVO[i].getVbdef20() != null) {
+						isEnable = false;
+					}
+				}
+			}
+		}
+		return isEnable;
+	}
+}

+ 34 - 0
pu/pu/src/client/nc/ui/pu/m25/editor/card/beforeedit/CardHeadTailBeforeEditEventHandler.java

@@ -0,0 +1,34 @@
+package nc.ui.pu.m25.editor.card.beforeedit;
+
+import java.util.Map;
+
+import nc.ui.pu.m25.editor.card.beforeedit.header.Supplier;
+import nc.ui.pu.m25.editor.card.beforeedit.header.AccountBank;
+import nc.ui.pu.m25.editor.card.beforeedit.header.BizPerson;
+import nc.ui.pu.m25.editor.card.beforeedit.header.Dept;
+import nc.ui.pu.m25.editor.card.beforeedit.header.EditableByVAT;
+import nc.ui.pu.m25.editor.card.beforeedit.header.ExchangeRate;
+import nc.ui.pu.m25.editor.card.beforeedit.header.FreeCust;
+import nc.ui.pu.m25.editor.card.beforeedit.header.InvoiceTranstype;
+import nc.ui.pu.pub.editor.card.beforeedit.GlobalExchangeRate;
+import nc.ui.pu.pub.editor.card.beforeedit.GroupExchangeRate;
+import nc.ui.pu.pub.editor.card.handler.AbstractCardHeadTailBeforeEditEventHandler;
+import nc.ui.pu.pub.editor.card.listener.ICardHeadTailBeforeEditEventListener;
+
+public class CardHeadTailBeforeEditEventHandler extends AbstractCardHeadTailBeforeEditEventHandler {
+	public void registerEventListener(Map<String, ICardHeadTailBeforeEditEventListener> listenerMap) {
+		listenerMap.put("ctrantypeid", new InvoiceTranstype());
+		listenerMap.put("pk_bankaccbas", new AccountBank());
+		listenerMap.put("pk_bizpsn", new BizPerson());
+		listenerMap.put("pk_dept_v", new Dept());
+		listenerMap.put("nexchangerate", new ExchangeRate());
+		listenerMap.put("nglobalexchgrate", new GlobalExchangeRate());
+		listenerMap.put("ngroupexchgrate", new GroupExchangeRate());
+		listenerMap.put("pk_freecust", new FreeCust());
+		listenerMap.put("csendcountryid", new EditableByVAT());
+		listenerMap.put("crececountryid", new EditableByVAT());
+		listenerMap.put("ctaxcountryid", new EditableByVAT());
+		listenerMap.put("ctaxcountryid", new EditableByVAT());
+		listenerMap.put("pk_supplier",new Supplier());
+	}
+}

+ 96 - 90
pu/pu/src/client/nc/ui/pu/m25/editor/card/beforeedit/body/Material.java

@@ -1,90 +1,96 @@
-/**
- * $文件说明$
- * 
- * @author tianft
- * @version 6.0
- * @see
- * @since 6.0
- * @time 2010-3-17 上午09:40:30
- */
-package nc.ui.pu.m25.editor.card.beforeedit.body;
-
-import nc.ui.pu.pub.editor.card.listener.ICardBodyBeforeEditEventListener;
-import nc.ui.pub.beans.UIRefPane;
-import nc.ui.pub.bill.BillItem;
-import nc.ui.pubapp.uif2app.event.card.CardBodyBeforeEditEvent;
-import nc.ui.pubapp.util.CardPanelValueUtils;
-import nc.ui.scmpub.ref.FilterMaterialRefUtils;
-import nc.vo.pu.m25.entity.InvoiceHeaderVO;
-import nc.vo.pu.m25.entity.InvoiceItemVO;
-import nc.vo.pub.lang.UFBoolean;
-import nc.vo.scmpub.res.billtype.ICBillType;
-import nc.vo.scmpub.res.billtype.POBillType;
-
-/**
- * <p>
- * <b>本类主要完成以下功能:</b>
- * <ul>
- * <li>表体物料编辑前事件处理
- * </ul>
- * <p>
- * <p>
- * 
- * @version 6.0
- * @since 6.0
- * @author tianft
- * @time 2010-3-17 上午09:40:30
- */
-public class Material implements ICardBodyBeforeEditEventListener {
-
-  /**
-   * 父类方法重写
-   * 
-   * @see nc.ui.pu.pub.editor.card.listener.ICardHeadTailBeforeEditEventListener#beforeEdit(nc.ui.pubapp.uif2app.event.card.CardHeadTailBeforeEditEvent)
-   */
-  @Override
-  public void beforeEdit(CardBodyBeforeEditEvent e) {
-    CardPanelValueUtils cardUtil =
-        new CardPanelValueUtils(e.getBillCardPanel());
-    String sourceBillType =
-        cardUtil.getBodyStringValue(e.getRow(), InvoiceItemVO.CSOURCETYPECODE);
-    // 来源入库单时,物料不允许编辑(与V5逻辑一致)
-    if (ICBillType.PurchaseIn.getCode().equals(sourceBillType)
-        || ICBillType.SubContinIn.getCode().equals(sourceBillType)
-        || ICBillType.VmiSum.getCode().equals(sourceBillType)
-        || POBillType.InitEstimate.getCode().equals(sourceBillType)) {
-      e.setReturnValue(Boolean.FALSE);
-      return;
-
-    }
-    // 费用物料相关过滤
-    this.filterByFeeMaterial(e);
-
-  }
-
-  /**
-   * @param e
-   */
-  private void filterByFeeMaterial(CardBodyBeforeEditEvent e) {
-    BillItem feeItem = e.getBillCardPanel().getHeadItem(InvoiceHeaderVO.BFEE);
-
-    if (feeItem == null || feeItem.getValueObject() == null) {
-      return;
-    }
-    Boolean feeValue = (Boolean) feeItem.getValueObject();
-    // 根据”是否费用“过滤物料
-    BillItem materialItem =
-        e.getBillCardPanel().getBodyItem(InvoiceItemVO.PK_MATERIAL);
-    FilterMaterialRefUtils filterMaterialRefUtils =
-        new FilterMaterialRefUtils((UIRefPane) materialItem.getComponent());
-    // 费用发票过滤,否则不过滤
-    if (feeValue.booleanValue()) {
-      filterMaterialRefUtils.filterRefByFeeOrDiscount(UFBoolean.TRUE,
-          UFBoolean.TRUE);
-    }
-    else {
-      filterMaterialRefUtils.filterRefByFeeOrDiscount(null, null);
-    }
-  }
-
-}
+/**
+ * $文件说明$
+ * 
+ * @author tianft
+ * @version 6.0
+ * @see
+ * @since 6.0
+ * @time 2010-3-17 上午09:40:30
+ */
+package nc.ui.pu.m25.editor.card.beforeedit.body;
+
+import nc.ui.pu.pub.editor.card.listener.ICardBodyBeforeEditEventListener;
+import nc.ui.pub.beans.UIRefPane;
+import nc.ui.pub.bill.BillItem;
+import nc.ui.pubapp.uif2app.event.card.CardBodyBeforeEditEvent;
+import nc.ui.pubapp.util.CardPanelValueUtils;
+import nc.ui.scmpub.ref.FilterMaterialRefUtils;
+import nc.vo.pu.m25.entity.InvoiceHeaderVO;
+import nc.vo.pu.m25.entity.InvoiceItemVO;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+import nc.vo.scmpub.res.billtype.ICBillType;
+import nc.vo.scmpub.res.billtype.POBillType;
+
+/**
+ * <p>
+ * <b>本类主要完成以下功能:</b>
+ * <ul>
+ * <li>表体物料编辑前事件处理
+ * </ul>
+ * <p>
+ * <p>
+ * 
+ * @version 6.0
+ * @since 6.0
+ * @author tianft
+ * @time 2010-3-17 上午09:40:30
+ */
+public class Material implements ICardBodyBeforeEditEventListener {
+
+  /**
+   * 父类方法重写
+   * 
+   * @see nc.ui.pu.pub.editor.card.listener.ICardHeadTailBeforeEditEventListener#beforeEdit(nc.ui.pubapp.uif2app.event.card.CardHeadTailBeforeEditEvent)
+   */
+  @Override
+  public void beforeEdit(CardBodyBeforeEditEvent e) {
+		String vbdef20 = (String) e.getBillCardPanel().getBodyValueAt(e.getRow(), "vbdef20");
+		if(vbdef20 != null) {
+			ExceptionUtils.wrappBusinessException("参照已选中发票,不可修改物料!");
+			return;
+		}
+    CardPanelValueUtils cardUtil =
+        new CardPanelValueUtils(e.getBillCardPanel());
+    String sourceBillType =
+        cardUtil.getBodyStringValue(e.getRow(), InvoiceItemVO.CSOURCETYPECODE);
+    // 来源入库单时,物料不允许编辑(与V5逻辑一致)
+    if (ICBillType.PurchaseIn.getCode().equals(sourceBillType)
+        || ICBillType.SubContinIn.getCode().equals(sourceBillType)
+        || ICBillType.VmiSum.getCode().equals(sourceBillType)
+        || POBillType.InitEstimate.getCode().equals(sourceBillType)) {
+      e.setReturnValue(Boolean.FALSE);
+      return;
+
+    }
+    // 费用物料相关过滤
+    this.filterByFeeMaterial(e);
+
+  }
+
+  /**
+   * @param e
+   */
+  private void filterByFeeMaterial(CardBodyBeforeEditEvent e) {
+    BillItem feeItem = e.getBillCardPanel().getHeadItem(InvoiceHeaderVO.BFEE);
+
+    if (feeItem == null || feeItem.getValueObject() == null) {
+      return;
+    }
+    Boolean feeValue = (Boolean) feeItem.getValueObject();
+    // 根据”是否费用“过滤物料
+    BillItem materialItem =
+        e.getBillCardPanel().getBodyItem(InvoiceItemVO.PK_MATERIAL);
+    FilterMaterialRefUtils filterMaterialRefUtils =
+        new FilterMaterialRefUtils((UIRefPane) materialItem.getComponent());
+    // 费用发票过滤,否则不过滤
+    if (feeValue.booleanValue()) {
+      filterMaterialRefUtils.filterRefByFeeOrDiscount(UFBoolean.TRUE,
+          UFBoolean.TRUE);
+    }
+    else {
+      filterMaterialRefUtils.filterRefByFeeOrDiscount(null, null);
+    }
+  }
+
+}

+ 5 - 0
pu/pu/src/client/nc/ui/pu/m25/editor/card/beforeedit/body/OcrRefbf.java

@@ -21,10 +21,15 @@ public class OcrRefbf  implements ICardBodyBeforeEditEventListener {
 		if(objvdef17 == null || "".equals(objvdef17)){
 			ExceptionUtils.wrappBusinessException("请添加发票!");
 		}
+		Object pk_supplier  = cpanel.getHeadItem("pk_supplier").getValueObject();//供应商
+		if(pk_supplier == null) {
+			ExceptionUtils.wrappBusinessException("请先选择供应商!");
+		}
 		String pk_material = (String) cpanel.getBodyValueAt(cardbodybeforeeditevent.getRow(), "pk_material");
 		if(pk_material == null) {
 			ExceptionUtils.wrappBusinessException("请先选择物料!");
 		}
+		
 		int count=cpanel.getRowCount();
 		String vbdef20 = "";
 		for(int i=0;i<count;i++){

+ 21 - 0
pu/pu/src/client/nc/ui/pu/m25/editor/card/beforeedit/header/Supplier.java

@@ -0,0 +1,21 @@
+package nc.ui.pu.m25.editor.card.beforeedit.header;
+import nc.ui.pu.pub.editor.card.listener.ICardHeadTailBeforeEditEventListener;
+import nc.ui.pubapp.uif2app.event.card.CardHeadTailBeforeEditEvent;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+public class Supplier implements ICardHeadTailBeforeEditEventListener {
+
+	@Override
+	public void beforeEdit(CardHeadTailBeforeEditEvent event) {
+		int count = event.getBillCardPanel().getRowCount();
+		for(int i = 0;i<count;i++){
+			String vbdef20 = (String) event.getBillCardPanel().getBodyValueAt(i, "vbdef20"); 
+        	if(vbdef20 != null) {
+        		ExceptionUtils.wrappBusinessException("表体参照已有选中发票行,不可修改供应商!");
+        		return;
+        	}
+		}
+		
+	}
+
+}
+

+ 5 - 3
pu/pu/src/private/nc/impl/th/ThOcrServiceImpl.java

@@ -710,12 +710,14 @@ public class ThOcrServiceImpl implements IThOcrService{
 		@Override
 		public void UpdateInvoiceStatus(String status, InvoiceVO[] vos) throws Exception {
 			//T提交——1  S收回——0  //Y审批通过——2 //R驳回
-			NcLog.info("=======锁定发票、修改开始=======");
+			
 			for (InvoiceVO invoiceVO : vos) {
-				//单据进行驳回,但不是驳回到制单人——单据状态自由,不调用接口
-				if("R".equals(status) && invoiceVO.getParentVO().getFbillstatus() != 0) {
+				//没有发票不传发票云
+				if(invoiceVO.getParentVO().getVdef17() == null) {
 					continue;
 				}
+				
+					NcLog.info("=======锁定发票、修改开始=======");
 					Map<String,String> oamap = QueryOAUserid(invoiceVO.getParent().getAttributeValue("billmaker").toString());
 					InvoiceItemVO[] arrInvoiceItemVO = (InvoiceItemVO[]) invoiceVO.getChildren(InvoiceItemVO.class);
 					List<Map<Object, Object>> listMapVbdef20 = new ArrayList<Map<Object, Object>>();

+ 80 - 80
pu/pu/src/public/nc/log/NcLog.java

@@ -1,81 +1,81 @@
-package nc.log;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import nc.bs.framework.common.RuntimeEnv;
-
-import org.apache.log4j.Logger;
-/**
- * nclog
- * @author YY
- * @datetime 2021-9-29 
- */
-public class NcLog
-{
-  private static final Logger logger = Logger.getLogger(NcLog.class);
-  private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-  private static SimpleDateFormat format$ = new SimpleDateFormat("yyyy-MM-dd");
-
-  public static void info(String str)
-  {
-    String logFilePath = getLogFile();
-    File file = new File(logFilePath);
-    BufferedWriter fos = null;
-    try
-    {
-      fos = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
-      str = format.format(new Date()) + " " + str + "\r\n";
-      
-      fos.write(str + "\r\n");
-      fos.flush();
-    }
-    catch (Exception localException)
-    {
-      if (fos != null)
-        try
-        {
-          fos.close();
-        }
-        catch (IOException localIOException)
-        {
-        }
-    }
-    finally {
-      if (fos != null)
-        try
-        {
-          fos.close();
-        }
-        catch (IOException localIOException2)
-        {
-        }
-    }
-  }
-
-  private static String getLogFile() {
-    String destFileFolder = RuntimeEnv.getInstance().getNCHome() + File.separator + "mancLog" + File.separator + format$.format(new Date());
-    String destFilePath = destFileFolder + File.separator + "org.log";
-    File destFolder = new File(destFileFolder);
-    if (!destFolder.exists()) {
-      destFolder.mkdirs();
-    }
-    File destFile = new File(destFilePath);
-    if (!destFile.exists()) {
-      try
-      {
-        destFile.createNewFile();
-      }
-      catch (Exception e)
-      {
-        logger.info(e);
-      }
-    }
-    return destFilePath;
-  }
+package nc.log;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import nc.bs.framework.common.RuntimeEnv;
+
+import org.apache.log4j.Logger;
+/**
+ * nclog
+ * @author YY
+ * @datetime 2021-9-29 
+ */
+public class NcLog
+{
+  private static final Logger logger = Logger.getLogger(NcLog.class);
+  private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+  private static SimpleDateFormat format$ = new SimpleDateFormat("yyyy-MM-dd");
+
+  public static void info(String str)
+  {
+    String logFilePath = getLogFile();
+    File file = new File(logFilePath);
+    BufferedWriter fos = null;
+    try
+    {
+      fos = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
+      str = format.format(new Date()) + " " + str + "\r\n";
+      
+      fos.write(str + "\r\n");
+      fos.flush();
+    }
+    catch (Exception localException)
+    {
+      if (fos != null)
+        try
+        {
+          fos.close();
+        }
+        catch (IOException localIOException)
+        {
+        }
+    }
+    finally {
+      if (fos != null)
+        try
+        {
+          fos.close();
+        }
+        catch (IOException localIOException2)
+        {
+        }
+    }
+  }
+
+  private static String getLogFile() {
+    String destFileFolder = RuntimeEnv.getInstance().getNCHome() + File.separator + "mancLog" + File.separator + format$.format(new Date());
+    String destFilePath = destFileFolder + File.separator + "org.log";
+    File destFolder = new File(destFileFolder);
+    if (!destFolder.exists()) {
+      destFolder.mkdirs();
+    }
+    File destFile = new File(destFilePath);
+    if (!destFile.exists()) {
+      try
+      {
+        destFile.createNewFile();
+      }
+      catch (Exception e)
+      {
+        logger.info(e);
+      }
+    }
+    return destFilePath;
+  }
 }