yaoyu 2 年 前
コミット
c97ee6a530

+ 16 - 12
pu/pu/src/client/nc/pub/filesystem/newui/ThOCRAction.java

@@ -147,6 +147,7 @@ public class ThOCRAction extends AbstractNCAction{
 			for(int j = 0;j < infos.size();j++){
 				JSONObject info = infos.getJSONObject(j).getJSONObject("info");
 				String ret = infos.getJSONObject(j).getString("ret");
+				String is_valid = infos.getJSONObject(j).getString("is_valid");
 //				String name = filewjlis.get(i);
 				String name =newvo.getName();
 				String memo = info.getString("number");//发票号
@@ -161,7 +162,7 @@ public class ThOCRAction extends AbstractNCAction{
 					String message = infos.getJSONObject(j).getString("message");
 					MessageDialog.showErrorDlg(parentpanel, NCLangRes.getInstance().getStrByID("pc", "FileManageUI-000000")/*错误*/
 							,"ocr返回数据校验:\n"+"发票:"+name+":"+message);
-					return;
+					//return;
 				}
 				String ext = info.getString("ext");
 				JSONObject extobj = JSONObject.parseObject(ext);
@@ -175,13 +176,17 @@ public class ThOCRAction extends AbstractNCAction{
 				String kind = pro.getString("kind");//开票内容
 				JSONObject price = comm_info.getJSONObject("price");
 				//发票识别之后进行发票查验
-				try {
-					ocrservice.InvoiceCheck(token,fid);
-				} catch (Exception e) {
-					MessageDialog.showErrorDlg(parentpanel, NCLangRes.getInstance().getStrByID("pc", "FileManageUI-000000")/*错误*/
-							,"发票查验:\n"+"发票:"+name+":"+e.getMessage());
-					return;
+				//是否需要查验 0不需要 1需要
+				if("1".equals(is_valid)) {
+					try {
+						ocrservice.InvoiceCheck(token,fid);
+					} catch (Exception e) {
+						MessageDialog.showErrorDlg(parentpanel, NCLangRes.getInstance().getStrByID("pc", "FileManageUI-000000")/*错误*/
+								,"发票查验:\n"+"发票:"+name+":"+e.getMessage());
+						return;
+					}
 				}
+				
 				String amount = "";
 				String total = "";
 				String dtax = "";
@@ -207,7 +212,6 @@ public class ThOCRAction extends AbstractNCAction{
 				IDefdocService idefservice = NCLocator.getInstance().lookup(IDefdocService.class);
 				
 				DefdocVO[] updatevos=QryDefdocvoInfo(code);
-				
 				if(updatevos.length>0){
 					//自定义档案存在这个编码,走修改
 					DefdocVO defvo =updatevos[0];
@@ -225,12 +229,12 @@ public class ThOCRAction extends AbstractNCAction{
 					defvo.setAttributeValue("shortname", amount);
 					defvo.setAttributeValue("shortname2", total);
 					defvo.setAttributeValue("shortname3", dtax);
-					defvo.setAttributeValue("shortname4", date);
+					defvo.setAttributeValue("pid", date);
 					defvo.setAttributeValue("shortname5", cname);
 					defvo.setAttributeValue("shortname6", trate);
 					defvo.setAttributeValue("enablestate", 2);
 					defvo.setAttributeValue("innercode", "0");
-					defvo.setAttributeValue("pid", kind);
+					defvo.setAttributeValue("shortname4", kind);
 					
 					try {
 						idefservice.updateDefdocs(pk_group,updatevos);
@@ -263,11 +267,11 @@ public class ThOCRAction extends AbstractNCAction{
 					defvo.setAttributeValue("shortname", amount);
 					defvo.setAttributeValue("shortname2", total);
 					defvo.setAttributeValue("shortname3", dtax);
-					defvo.setAttributeValue("shortname4", date);
+					defvo.setAttributeValue("pid", date);
 					defvo.setAttributeValue("shortname5", cname);
 					defvo.setAttributeValue("shortname6", trate);
 					defvo.setAttributeValue("innercode", "0");
-					defvo.setAttributeValue("pid", kind);
+					defvo.setAttributeValue("shortname4", kind);
 					vos[0] = defvo;
 					try {
 				//		idefservice.insertDefdocs(pk_org, vos);

+ 2 - 2
pu/pu/src/client/nc/pub/filesystem/newui/ThSelectAction.java

@@ -143,12 +143,12 @@ public class ThSelectAction extends AbstractNCAction{
 					defvo.setAttributeValue("shortname", amount);
 					defvo.setAttributeValue("shortname2", total);
 					defvo.setAttributeValue("shortname3", dtax);
-					defvo.setAttributeValue("shortname4", date);
+					defvo.setAttributeValue("pid", date);
 					defvo.setAttributeValue("shortname5", cname);
 					defvo.setAttributeValue("shortname6", trate);
 					defvo.setAttributeValue("enablestate", 2);
 					defvo.setAttributeValue("innercode", "1");
-					defvo.setAttributeValue("pid", kind);
+					defvo.setAttributeValue("shortname4", kind);
 					vos[0] = defvo;
 					idefservice.insertDefdocs(pk_group, vos);
 					}

+ 157 - 0
pu/pu/src/client/nc/ui/pu/m25/action/processor/CopyActionProcessor.java

@@ -0,0 +1,157 @@
+package nc.ui.pu.m25.action.processor;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import nc.itf.pu.pub.IPURemoteCallCombinator;
+import nc.ui.pu.m25.model.InvoiceBillManageModel;
+import nc.ui.pu.m25.view.InvoiceUIState;
+import nc.ui.pu.pub.util.BusitypeSetter;
+import nc.ui.pubapp.uif2app.actions.intf.ICopyActionProcessor;
+import nc.ui.pubapp.uif2app.funcnode.trantype.TrantypeFuncUtils;
+import nc.vo.pu.m25.entity.InvoiceHeaderVO;
+import nc.vo.pu.m25.entity.InvoiceItemVO;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pu.pub.enumeration.POEnumBillStatus;
+import nc.vo.pu.pub.util.BillHelper;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDateTime;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.pubapp.AppContext;
+import nc.vo.scmpub.res.billtype.POBillType;
+import nc.vo.uif2.LoginContext;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+
+public class CopyActionProcessor implements ICopyActionProcessor<InvoiceVO> {
+	private InvoiceBillManageModel model = null;
+
+	public InvoiceBillManageModel getModel() {
+		return this.model;
+	}
+
+	public void processVOAfterCopy(InvoiceVO billVO, LoginContext context) {
+		if (billVO != null) {
+			this.batchProc(billVO, context);
+			this.setHeadDefaultValues(billVO, context);
+			this.setBodyDefaultValues(billVO);
+		}
+	}
+
+	public void setModel(InvoiceBillManageModel model) {
+		this.model = model;
+	}
+
+	private void batchProc(InvoiceVO vo, LoginContext context) {
+		List<IPURemoteCallCombinator> rccRuleLst = new ArrayList();
+		this.register_BizRule(rccRuleLst, vo, context);
+		Iterator i$ = rccRuleLst.iterator();
+
+		while (i$.hasNext()) {
+			IPURemoteCallCombinator rccRule = (IPURemoteCallCombinator) i$.next();
+			if (null != rccRule) {
+				rccRule.process();
+			}
+		}
+
+	}
+
+	private void copyTranstype(InvoiceVO vo, String transtype, String pk_trantype) {
+		vo.getParentVO().setPk_busitype((String) null);
+		if (StringUtils.isBlank(transtype)) {
+			vo.getParentVO().setVtrantypecode((String) null);
+			vo.getParentVO().setCtrantypeid((String) null);
+		} else {
+			vo.getParentVO().setVtrantypecode(transtype);
+			vo.getParentVO().setCtrantypeid(pk_trantype);
+		}
+
+	}
+
+	private void register_BizRule(List<IPURemoteCallCombinator> rccRuleLst, InvoiceVO vo, LoginContext context) {
+		String transtype = TrantypeFuncUtils.getTrantype(context);
+		String pk_trantype = TrantypeFuncUtils.getTrantypePk(context);
+		this.copyTranstype(vo, transtype, pk_trantype);
+		(new BusitypeSetter(POBillType.Invoice, new BillHelper(vo), context)).copySet(rccRuleLst);
+	}
+
+	private void setBodyDefaultValues(InvoiceVO billVO) {
+		InvoiceItemVO[] items = billVO.getChildrenVO();
+		if (!ArrayUtils.isEmpty(items)) {
+			InvoiceItemVO[] arr$ = items;
+			int len$ = items.length;
+
+			for (int i$ = 0; i$ < len$; ++i$) {
+				InvoiceItemVO vo = arr$[i$];
+				vo.setPk_invoice((String) null);
+				vo.setPk_invoice_b((String) null);
+				vo.setCfirstbid((String) null);
+				vo.setCfirstid((String) null);
+				vo.setCfirsttypecode((String) null);
+				vo.setVfirstcode((String) null);
+				vo.setVfirstrowno((String) null);
+				vo.setVfirsttrantype((String) null);
+				vo.setFirstbts((UFDateTime) null);
+				vo.setFirstts((UFDateTime) null);
+				vo.setCsourcebid((String) null);
+				vo.setCsourceid((String) null);
+				vo.setCsourcetypecode((String) null);
+				vo.setSourcebts((UFDateTime) null);
+				vo.setSourcets((UFDateTime) null);
+				vo.setVsourcecode((String) null);
+				vo.setVsourcerowno((String) null);
+				vo.setVsourcetrantype((String) null);
+				vo.setTs((UFDateTime) null);
+				vo.setNaccumsettmny((UFDouble) null);
+				vo.setNaccumsettnum((UFDouble) null);
+				vo.setPk_order((String) null);
+				vo.setPk_order_b((String) null);
+				vo.setVordercode((String) null);
+				vo.setVordertrantype((String) null);
+				vo.setVbdef13(null);
+				vo.setVbdef14(null);
+				vo.setVbdef15(null);
+				vo.setVbdef16(null);
+				vo.setVbdef17(null);
+				vo.setVbdef20(null);
+				
+			}
+
+		}
+	}
+
+	private void setHeadDefaultValues(InvoiceVO billVO, LoginContext context) {
+		InvoiceHeaderVO header = billVO.getParentVO();
+		if (header != null) {
+			header.setVbillcode((String) null);
+			header.setPk_invoice((String) null);
+			header.setTs((UFDateTime) null);
+			header.setTaudittime((UFDate) null);
+			header.setApprover((String) null);
+			header.setModifier((String) null);
+			header.setModifiedtime((UFDateTime) null);
+			header.setIprintcount(0);
+			header.setFbillstatus(POEnumBillStatus.FREE.toInteger());
+			UFDate curDate = AppContext.getInstance().getBusiDate();
+			header.setDarrivedate(curDate);
+			header.setDbilldate(curDate);
+			header.setCreator(context.getPk_loginUser());
+			header.setBillmaker(context.getPk_loginUser());
+			header.setBapflag(UFBoolean.FALSE);
+			if (this.model.getInvoiceUIState() != InvoiceUIState.FEE_INVC) {
+				header.setBfee(UFBoolean.FALSE);
+				header.setPk_parentinvoice((String) null);
+			}
+
+			header.setBfrozen(UFBoolean.FALSE);
+			header.setVfrozenreason((String) null);
+			header.setTfrozentime((UFDate) null);
+			header.setPk_frozenuser((String) null);
+			header.setBvirtual(UFBoolean.FALSE);
+			header.setBinitial(UFBoolean.FALSE);
+			header.setDmakedate((UFDate) null);
+			header.setVdef17(null);
+		}
+	}
+}

+ 193 - 183
pu/pu/src/client/nc/ui/pu/m25/editor/card/afteredit/body/OcrRefaft.java

@@ -1,184 +1,194 @@
-package nc.ui.pu.m25.editor.card.afteredit.body;
-
-import nc.bs.framework.common.NCLocator;
-import nc.itf.uap.IUAPQueryBS;
-import nc.jdbc.framework.processor.BeanProcessor;
-import nc.jdbc.framework.processor.ColumnProcessor;
-import nc.ui.pu.pub.editor.card.listener.ICardBodyAfterEditEventListener;
-import nc.ui.pub.beans.UIRefPane;
-import nc.ui.pub.beans.constenum.DefaultConstEnum;
-import nc.ui.pubapp.uif2app.event.card.CardBodyAfterEditEvent;
-import nc.vo.bd.defdoc.DefdocVO;
-import nc.vo.pub.BusinessException;
-import nc.vo.pub.lang.UFDate;
-import nc.vo.pub.lang.UFDouble;
-import nc.vo.pubapp.pattern.exception.ExceptionUtils;
-
-public class OcrRefaft implements ICardBodyAfterEditEventListener{
-	
-	public IUAPQueryBS iuap=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
-	@Override
-	public void afterEdit(CardBodyAfterEditEvent arg0) {
-		
-		UIRefPane ref=(UIRefPane) arg0.getBillCardPanel().getBodyItem("OCR").getComponent();
-		String[] pks = ref.getRefPKs();
-		StringBuffer sbf = new StringBuffer();
-		// 处理PK
-		if (pks == null || pks.length <= 0) {
-			//arg0.getBillCardPanel().setHeadItem("vdef19", null);//开票方
-			//arg0.getBillCardPanel().setHeadItem("dbilldate", null);//发票日期
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef15");//销售方公司
-		    arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef17");//发票分类
-		    arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ntaxrate");//税率
-	 	    arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ctaxcodeid");//税码
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nastnum");//数量
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nnum");//主数量
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nastorigprice");//无税单价
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nastprice");//本币无税单价
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "norigmny");//无税金额
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nmny");//本币无税金额
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nastorigtaxprice");//含税单价
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nasttaxprice");//本币含税单价
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "norigtaxmny");//价税合计
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ntaxmny");//本币价税合计
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ntax");//税额
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef20");//主键
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef16");//显示名称
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ncalcostmny");//计成本金额
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef13");//开票内容
-			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef14");
-			return;
-		}else {
-			for (int i = 0; i < pks.length; i++) {
-				sbf.append(pks[i]+",");
-			}	
-		}
-		
-		UFDouble SumAmount = UFDouble.ZERO_DBL;//不含税
-		UFDouble SumTotal = UFDouble.ZERO_DBL;//价税合计
-		UFDouble SumTax =UFDouble.ZERO_DBL;//税额
-		String shuilv = "";//记录第一条税率,和后面进行对比,若不同则报错不允许保存
-		String supplier = "";//记录第一条供应商,和后面进行对比,若不同则报错不允许保存
-		Object shuilvpk = "";
-		StringBuffer kind = new StringBuffer();
-		try {
-			if(pks.length > 1){
-				for(int j = 0;j < pks.length;j++){
-					String pk = pks[j];
-					String qrysql = "select * from bd_defdoc where dr=0 and pk_defdoc = '"+pk+"'";
-					DefdocVO defdocvo;
-					defdocvo = (DefdocVO) iuap.executeQuery(qrysql, new BeanProcessor(DefdocVO.class));
-					Object shortname6 = defdocvo.getShortname6();
-					String name4 = defdocvo.getName4();
-					if(shortname6 == null){
-						ExceptionUtils.wrappBusinessException("所选发票税率为空,不能保存!");
-						return;
-					}
-					if(j == 0 && shortname6 != null){
-						shuilv = shortname6.toString();
-					}
-					if(j == 0 || supplier == null){
-						supplier = name4;
-					}
-					if(j != 0 && !shortname6.toString().equals(shuilv)){
-						ExceptionUtils.wrappBusinessException("所选发票税率不同,不能保存!");
-						return;
-					}
-					if(j != 0 && name4 != null && supplier != null) {
-						if(!name4.equals(supplier)) {
-							ExceptionUtils.wrappBusinessException("所选发票供应商不同,不能保存!");
-							return;
-						}
-					}
-				}
-			}
-			for(int i = 0;i < pks.length;i++){
-				String pk = pks[i];
-				String qrysql = "select * from bd_defdoc where dr=0 and pk_defdoc = '"+pk+"'";
-				DefdocVO defdocvo;
-				
-					defdocvo = (DefdocVO) iuap.executeQuery(qrysql, new BeanProcessor(DefdocVO.class));
-					String qryshuilv = "select pk_taxcode from bd_taxrate where nvl(dr,0) = 0 and pk_taxcode not in (select pk_taxcode from bd_taxcode where code = '0') and taxrate = '"+defdocvo.getShortname6()+"'";
-					try {
-						shuilvpk = iuap.executeQuery(qryshuilv, new ColumnProcessor());
-						if(shuilvpk == null){
-							ExceptionUtils.wrappBusinessException("税率没有对应税码,请检查!");
-							return;
-						}
-					} catch (BusinessException e1) {
-						// TODO 自动生成的 catch 块
-						ExceptionUtils.wrappBusinessException(e1.getMessage());
-					}
-				//	arg0.getBillCardPanel().setHeadItem("vbillcode", defdocvo.getName());//发票号
-					//arg0.getBillCardPanel().setHeadItem("vdef19", defdocvo.getName4());//开票方
-	//					arg0.getBillCardPanel().setHeadItem("dbilldate", new UFDate(defdocvo.getShortname4()));//发票日期
-					arg0.getBillCardPanel().setBodyValueAt(defdocvo.getName4(), arg0.getRow(), "vbdef15");//销售方公司
-					arg0.getBillCardPanel().setBodyValueAt(defdocvo.getShortname5(), arg0.getRow(), "vbdef17");//发票分类
-					arg0.getBillCardPanel().setBodyValueAt(defdocvo.getShortname6(), arg0.getRow(), "ntaxrate");//税率
-					arg0.getBillCardPanel().setBodyValueAt(shuilvpk, arg0.getRow(), "ctaxcodeid");//税码
-					Object shortname = defdocvo.getShortname();
-					if(shortname != null && shortname.toString() != ""){
-						SumAmount = SumAmount.add(new UFDouble(shortname.toString()));
-					}
-					Object shortname2 = defdocvo.getShortname2();
-					if(shortname2 != null && shortname2.toString() != ""){
-						SumTotal = SumTotal.add(new UFDouble(shortname2.toString()));
-					}
-					Object shortname3 = defdocvo.getShortname3();
-					if(shortname3 != null && shortname3.toString() != ""){
-						SumTax = SumTax.add(new UFDouble(shortname3.toString()));
-					}
-					
-					kind.append(defdocvo.getPid()+",");
-			}
-			//销售方公司和供应商之间校验是否一致
-			String vbdef15 = (String) arg0.getBillCardPanel().getBodyValueAt(arg0.getRow(), "vbdef15");//销售方公司
-			String headSupplier = (String) arg0.getBillCardPanel().getHeadItem("pk_supplier").getValueObject();//供应商
-			if(vbdef15 == null && headSupplier == null) {
-				//一致
-				arg0.getBillCardPanel().setBodyValueAt("一致", arg0.getRow(), "vbdef14");
-			}else if(vbdef15 == null || headSupplier == null) {
-				//不一致
-				arg0.getBillCardPanel().setBodyValueAt("不一致", arg0.getRow(), "vbdef14");
-			}else {
-				String sql = "select name from bd_supplier where pk_supplier ='"+headSupplier+"'";
-				String name = (String) iuap.executeQuery(sql, new ColumnProcessor());
-				if(vbdef15.equals(name)) {
-					//一致
-					arg0.getBillCardPanel().setBodyValueAt("一致", arg0.getRow(), "vbdef14");
-				}else {
-					//不一致
-					arg0.getBillCardPanel().setBodyValueAt("不一致", arg0.getRow(), "vbdef14");
-				}
-			}
-				
-			arg0.getBillCardPanel().setBodyValueAt(1, arg0.getRow(), "nastnum");//数量
-			arg0.getBillCardPanel().setBodyValueAt(1, arg0.getRow(), "nnum");//主数量
-			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "nastorigprice");//无税单价
-			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "nastprice");//本币无税单价
-			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "norigmny");//无税金额
-			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "nmny");//本币无税金额
-			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "ncalcostmny");//计成本金额
-			arg0.getBillCardPanel().setBodyValueAt(SumTotal, arg0.getRow(), "nastorigtaxprice");//含税单价
-			arg0.getBillCardPanel().setBodyValueAt(SumTotal, arg0.getRow(), "nasttaxprice");//本币含税单价
-			arg0.getBillCardPanel().setBodyValueAt(SumTotal, arg0.getRow(), "norigtaxmny");//价税合计
-			arg0.getBillCardPanel().setBodyValueAt(SumTotal, arg0.getRow(), "ntaxmny");//本币价税合计
-			arg0.getBillCardPanel().setBodyValueAt(SumTax, arg0.getRow(), "ntax");//税额
-			
-			
-			
-			//存放PK
-		//	ref.setPKs(pks);
-			DefaultConstEnum refEnumxz = new DefaultConstEnum(sbf.toString().substring(0, sbf.toString().length()-1), ref.getRefShowName());
-			//DefaultConstEnum refEnum = new DefaultConstEnum("1001ZZ1000000097LQJ2", "发票信息已赋值");///默认值(发票信息已赋值)
-			//arg0.getBillCardPanel().setBodyValueAt(refEnum, arg0.getRow(), "OCR");//默认
-			arg0.getBillCardPanel().setBodyValueAt(kind.toString().substring(0, kind.toString().length()-1), arg0.getRow(), "vbdef13");//开票内容
-			arg0.getBillCardPanel().setBodyValueAt(sbf.toString().substring(0, sbf.toString().length()-1), arg0.getRow(), "vbdef20");//主键
-			arg0.getBillCardPanel().setBodyValueAt(refEnumxz, arg0.getRow(), "vbdef16");//显示名称
-		} catch (BusinessException e) {
-			// TODO 自动生成的 catch 块
-			ExceptionUtils.wrappBusinessException(e.getMessage());
-		}
-   }
-
+package nc.ui.pu.m25.editor.card.afteredit.body;
+
+import java.util.Arrays;
+
+import nc.bs.framework.common.NCLocator;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.processor.BeanProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.ui.pu.pub.editor.card.listener.ICardBodyAfterEditEventListener;
+import nc.ui.pub.beans.UIRefPane;
+import nc.ui.pub.beans.constenum.DefaultConstEnum;
+import nc.ui.pubapp.uif2app.event.card.CardBodyAfterEditEvent;
+import nc.vo.bd.defdoc.DefdocVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+
+public class OcrRefaft implements ICardBodyAfterEditEventListener{
+	
+	public IUAPQueryBS iuap=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+	@Override
+	public void afterEdit(CardBodyAfterEditEvent arg0) {
+		
+		UIRefPane ref=(UIRefPane) arg0.getBillCardPanel().getBodyItem("OCR").getComponent();
+		String[] pks = ref.getRefPKs();
+		StringBuffer sbf = new StringBuffer();
+		// 处理PK
+		if (pks == null || pks.length <= 0) {
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef15");//销售方公司
+		    arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef17");//发票分类
+		    arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ntaxrate");//税率
+	 	    arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ctaxcodeid");//税码
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nastnum");//数量
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nnum");//主数量
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nastorigprice");//无税单价
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nastprice");//本币无税单价
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nprice");//主本币无税单价
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "norigmny");//无税金额
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nmny");//本币无税金额
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nastorigtaxprice");//含税单价
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "nasttaxprice");//本币含税单价
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ntaxprice");//主本币含税单价
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "norigtaxmny");//价税合计
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ntaxmny");//本币价税合计
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ntax");//税额
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef20");//主键
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef16");//显示名称
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "ncalcostmny");//计成本金额
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef13");//开票内容
+			arg0.getBillCardPanel().setBodyValueAt(null, arg0.getRow(), "vbdef14");//是否一致
+			return;
+		}else {
+			for (int i = 0; i < pks.length; i++) {
+				sbf.append(pks[i]+",");
+			}	
+		}
+		
+		UFDouble SumAmount = UFDouble.ZERO_DBL;//不含税
+		UFDouble SumTotal = UFDouble.ZERO_DBL;//价税合计
+		UFDouble SumTax =UFDouble.ZERO_DBL;//税额
+		String shuilv = "";//记录第一条税率,和后面进行对比,若不同则报错不允许保存
+		String supplier = "";//记录第一条供应商,和后面进行对比,若不同则报错不允许保存
+		Object shuilvpk = "";
+		StringBuffer kind = new StringBuffer();
+		try {
+			if(pks.length > 1){
+				for(int j = 0;j < pks.length;j++){
+					String pk = pks[j];
+					String qrysql = "select * from bd_defdoc where dr=0 and pk_defdoc = '"+pk+"'";
+					DefdocVO defdocvo;
+					defdocvo = (DefdocVO) iuap.executeQuery(qrysql, new BeanProcessor(DefdocVO.class));
+					Object shortname6 = defdocvo.getShortname6();
+					String name4 = defdocvo.getName4();
+					if(shortname6 == null){
+						ExceptionUtils.wrappBusinessException("所选发票税率为空,不能保存!");
+						return;
+					}
+					if(j == 0 && shortname6 != null){
+						shuilv = shortname6.toString();
+					}
+					if(j == 0 || supplier == null){
+						supplier = name4;
+					}
+					if(j != 0 && !shortname6.toString().equals(shuilv)){
+						ExceptionUtils.wrappBusinessException("所选发票税率不同,不能保存!");
+						return;
+					}
+					if(j != 0 && name4 != null && supplier != null) {
+						if(!name4.equals(supplier)) {
+							ExceptionUtils.wrappBusinessException("所选发票供应商不同,不能保存!");
+							return;
+						}
+					}
+				}
+			}
+			for(int i = 0;i < pks.length;i++){
+				String pk = pks[i];
+				String qrysql = "select * from bd_defdoc where dr=0 and pk_defdoc = '"+pk+"'";
+				DefdocVO defdocvo;
+				
+					defdocvo = (DefdocVO) iuap.executeQuery(qrysql, new BeanProcessor(DefdocVO.class));
+					String qryshuilv = "select pk_taxcode from bd_taxrate where nvl(dr,0) = 0 and pk_taxcode not in (select pk_taxcode from bd_taxcode where code = '0') and taxrate = '"+defdocvo.getShortname6()+"'";
+					try {
+						shuilvpk = iuap.executeQuery(qryshuilv, new ColumnProcessor());
+						if(shuilvpk == null){
+							ExceptionUtils.wrappBusinessException("税率没有对应税码,请检查!");
+							return;
+						}
+					} catch (BusinessException e1) {
+						// TODO 自动生成的 catch 块
+						ExceptionUtils.wrappBusinessException(e1.getMessage());
+					}
+//					arg0.getBillCardPanel().setHeadItem("vbillcode", defdocvo.getName());//发票号
+//					arg0.getBillCardPanel().setHeadItem("vdef19", defdocvo.getName4());//开票方
+//					arg0.getBillCardPanel().setHeadItem("dbilldate", new UFDate(defdocvo.getPid()));//发票日期
+					arg0.getBillCardPanel().setBodyValueAt(defdocvo.getName4(), arg0.getRow(), "vbdef15");//销售方公司
+					arg0.getBillCardPanel().setBodyValueAt(defdocvo.getShortname5(), arg0.getRow(), "vbdef17");//发票分类
+					arg0.getBillCardPanel().setBodyValueAt(defdocvo.getShortname6(), arg0.getRow(), "ntaxrate");//税率
+					arg0.getBillCardPanel().setBodyValueAt(shuilvpk, arg0.getRow(), "ctaxcodeid");//税码
+					Object shortname = defdocvo.getShortname();
+					if(shortname != null && shortname.toString() != ""){
+						SumAmount = SumAmount.add(new UFDouble(shortname.toString()));
+					}
+					Object shortname2 = defdocvo.getShortname2();
+					if(shortname2 != null && shortname2.toString() != ""){
+						SumTotal = SumTotal.add(new UFDouble(shortname2.toString()));
+					}
+					Object shortname3 = defdocvo.getShortname3();
+					if(shortname3 != null && shortname3.toString() != ""){
+						SumTax = SumTax.add(new UFDouble(shortname3.toString()));
+					}
+					
+					kind.append(defdocvo.getShortname4()+",");
+			}
+			//销售方公司和供应商之间校验是否一致
+			String vbdef15 = (String) arg0.getBillCardPanel().getBodyValueAt(arg0.getRow(), "vbdef15");//销售方公司
+			String headSupplier = (String) arg0.getBillCardPanel().getHeadItem("pk_supplier").getValueObject();//供应商
+			if(vbdef15 == null && headSupplier == null) {
+				//一致
+				arg0.getBillCardPanel().setBodyValueAt("一致", arg0.getRow(), "vbdef14");
+			}else if(vbdef15 == null || headSupplier == null) {
+				//不一致
+				arg0.getBillCardPanel().setBodyValueAt("不一致", arg0.getRow(), "vbdef14");
+			}else {
+				String sql = "select name from bd_supplier where pk_supplier ='"+headSupplier+"'";
+				String name = (String) iuap.executeQuery(sql, new ColumnProcessor());
+				if(vbdef15.equals(name)) {
+					//一致
+					arg0.getBillCardPanel().setBodyValueAt("一致", arg0.getRow(), "vbdef14");
+				}else {
+					//不一致
+					arg0.getBillCardPanel().setBodyValueAt("不一致", arg0.getRow(), "vbdef14");
+				}
+			}
+				
+			arg0.getBillCardPanel().setBodyValueAt(1, arg0.getRow(), "nastnum");//数量
+			arg0.getBillCardPanel().setBodyValueAt(1, arg0.getRow(), "nnum");//主数量
+			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "nastorigprice");//无税单价
+			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "nastprice");//本币无税单价
+			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "nprice");//主本币无税单价
+			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "norigmny");//无税金额
+			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "nmny");//本币无税金额
+			arg0.getBillCardPanel().setBodyValueAt(SumAmount, arg0.getRow(), "ncalcostmny");//计成本金额
+			arg0.getBillCardPanel().setBodyValueAt(SumTotal, arg0.getRow(), "nastorigtaxprice");//含税单价
+			arg0.getBillCardPanel().setBodyValueAt(SumTotal, arg0.getRow(), "nasttaxprice");//本币含税单价
+			arg0.getBillCardPanel().setBodyValueAt(SumTotal, arg0.getRow(), "ntaxprice");//主本币含税单价
+			arg0.getBillCardPanel().setBodyValueAt(SumTotal, arg0.getRow(), "norigtaxmny");//价税合计
+			arg0.getBillCardPanel().setBodyValueAt(SumTotal, arg0.getRow(), "ntaxmny");//本币价税合计
+			arg0.getBillCardPanel().setBodyValueAt(SumTax, arg0.getRow(), "ntax");//税额
+			
+			
+			
+			//存放PK
+		//	ref.setPKs(pks);
+			DefaultConstEnum refEnumxz = new DefaultConstEnum(sbf.toString().substring(0, sbf.toString().length()-1), ref.getRefShowName());
+			//DefaultConstEnum refEnum = new DefaultConstEnum("1001ZZ1000000097LQJ2", "发票信息已赋值");///默认值(发票信息已赋值)
+			//arg0.getBillCardPanel().setBodyValueAt(refEnum, arg0.getRow(), "OCR");//默认
+			String str = kind.toString();
+			byte[] bytes = kind.toString().getBytes("UTF-8");
+			if (bytes.length > 101) {
+			    byte[] truncatedBytes = Arrays.copyOf(bytes, 101);
+			    str = new String(truncatedBytes, "UTF-8");
+			}
+			arg0.getBillCardPanel().setBodyValueAt(str, arg0.getRow(), "vbdef13");//开票内容
+			arg0.getBillCardPanel().setBodyValueAt(sbf.toString().substring(0, sbf.toString().length()-1), arg0.getRow(), "vbdef20");//主键
+			arg0.getBillCardPanel().setBodyValueAt(refEnumxz, arg0.getRow(), "vbdef16");//显示名称
+		} catch (Exception e) {
+			// TODO 自动生成的 catch 块
+			ExceptionUtils.wrappBusinessException(e.getMessage());
+		}
+   }
+
 }

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

@@ -1,49 +1,49 @@
-package nc.ui.pu.m25.editor.card.beforeedit.body;
-
-import nc.ui.bd.ref.model.StorDocReportRefModel;
-import nc.ui.pu.pub.editor.card.listener.ICardBodyBeforeEditEventListener;
-import nc.ui.pub.beans.UIRefPane;
-import nc.ui.pub.bill.BillCardPanel;
-import nc.ui.pubapp.uif2app.event.card.CardBodyBeforeEditEvent;
-import nc.vo.pubapp.pattern.exception.ExceptionUtils;
-import nc.vo.pubapp.pattern.pub.SqlBuilder;
-
-public class OcrRefbf  implements ICardBodyBeforeEditEventListener {
-
-	@Override
-	public void beforeEdit(CardBodyBeforeEditEvent cardbodybeforeeditevent) {
-		BillCardPanel cpanel=cardbodybeforeeditevent.getBillCardPanel();
-		Object objvdef17=cpanel.getHeadItem("vdef17").getValueObject();//附件id
-		UIRefPane ref=(UIRefPane) cpanel.getBodyItem("OCR").getComponent();
-		ref.setMultiSelectedEnabled(true);
-		ref.setNotLeafSelectedEnabled(false);
-		StorDocReportRefModel storef=(StorDocReportRefModel) ref.getRefModel();
-		if(objvdef17 == null || "".equals(objvdef17)){
-			ExceptionUtils.wrappBusinessException("请添加发票!");
-		}
-		int count=cpanel.getRowCount();
-		String vbdef20 = "";
-		for(int i=0;i<count;i++){
-			int ix=cardbodybeforeeditevent.getRow();
-			String str = (String) cpanel.getBodyValueAt(i, "vbdef20");
-			//当前行数据不需要过滤
-			if(i != ix && str != null) {
-				vbdef20 += str +",";
-			}
-		}
-		storef.addWherePart(" and name6='"+objvdef17.toString()+"' "); //附件主键过滤
-		if(!"".equals(vbdef20)) {
-			String[] arrVbdef20 = vbdef20.split(",");
-			if(arrVbdef20.length == 1) {
-				storef.addWherePart(" and pk_defdoc <> '"+arrVbdef20[0].toString()+"'");
-			}else {
-				SqlBuilder sqlb = new SqlBuilder();
-				sqlb.append("not", arrVbdef20);
-				storef.addWherePart(" and pk_defdoc "+sqlb.toString());
-			}
-			
-		}
-		
-	}
-
-}
+package nc.ui.pu.m25.editor.card.beforeedit.body;
+
+import nc.ui.bd.ref.model.StorDocReportRefModel;
+import nc.ui.pu.pub.editor.card.listener.ICardBodyBeforeEditEventListener;
+import nc.ui.pub.beans.UIRefPane;
+import nc.ui.pub.bill.BillCardPanel;
+import nc.ui.pubapp.uif2app.event.card.CardBodyBeforeEditEvent;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+import nc.vo.pubapp.pattern.pub.SqlBuilder;
+
+public class OcrRefbf  implements ICardBodyBeforeEditEventListener {
+
+	@Override
+	public void beforeEdit(CardBodyBeforeEditEvent cardbodybeforeeditevent) {
+		BillCardPanel cpanel=cardbodybeforeeditevent.getBillCardPanel();
+		Object objvdef17=cpanel.getHeadItem("vdef17").getValueObject();//附件id
+		UIRefPane ref=(UIRefPane) cpanel.getBodyItem("OCR").getComponent();
+		ref.setMultiSelectedEnabled(false);
+		ref.setNotLeafSelectedEnabled(false);
+		StorDocReportRefModel storef=(StorDocReportRefModel) ref.getRefModel();
+		if(objvdef17 == null || "".equals(objvdef17)){
+			ExceptionUtils.wrappBusinessException("请添加发票!");
+		}
+		int count=cpanel.getRowCount();
+		String vbdef20 = "";
+		for(int i=0;i<count;i++){
+			int ix=cardbodybeforeeditevent.getRow();
+			String str = (String) cpanel.getBodyValueAt(i, "vbdef20");
+			//当前行数据不需要过滤
+			if(i != ix && str != null) {
+				vbdef20 += str +",";
+			}
+		}
+		storef.addWherePart(" and name6='"+objvdef17.toString()+"' "); //附件主键过滤
+		if(!"".equals(vbdef20)) {
+			String[] arrVbdef20 = vbdef20.split(",");
+			if(arrVbdef20.length == 1) {
+				storef.addWherePart(" and name6='"+objvdef17.toString()+"' and pk_defdoc <> '"+arrVbdef20[0].toString()+"'");
+			}else {
+				SqlBuilder sqlb = new SqlBuilder();
+				sqlb.append("not", arrVbdef20);
+				storef.addWherePart("and name6='"+objvdef17.toString()+"' and pk_defdoc "+sqlb.toString());
+			}
+			
+		}
+		
+	}
+
+}

ファイルの差分が大きいため隠しています
+ 20 - 2
pu/pu/src/client/nc/ui/pubapp/uif2app/actions/MultiSelectDialog.java


+ 34 - 0
pu/pu/src/private/nc/bs/ic/base/InvoiceAfterApproveEvent.java

@@ -0,0 +1,34 @@
+package nc.bs.ic.base;
+
+import nc.bs.framework.common.NCLocator;
+import nc.impl.pubapp.pattern.rule.IRule;
+import nc.itf.th.IThOcrService;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pub.compiler.PfParameterVO;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+
+
+/**
+ * 采购发票审批通过传发票云
+ * @author Yaoyu
+ * 2023-05-25
+ *
+ */
+public class InvoiceAfterApproveEvent implements IRule<InvoiceVO>{
+	@Override
+	public void process(InvoiceVO[] vos) {
+		IThOcrService  iThOcrService=(IThOcrService) NCLocator.getInstance().lookup(IThOcrService.class.getName());
+		try {
+			if(vos != null) {
+				int vostatus = vos[0].getParentVO().getFbillstatus();
+				if(vostatus == 3) {
+					iThOcrService.UpdateInvoiceStatus("Y", vos);
+				}
+			}
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			ExceptionUtils.wrappBusinessException(e.getMessage());
+		}
+	}
+}

+ 2 - 2
pu/pu/src/private/nc/bs/ic/base/InvoiceAfterCheckEvent.java

@@ -22,7 +22,7 @@ import nc.vo.pubapp.pattern.exception.ExceptionUtils;
 
 /**
  * 采购发票保存后校验
- * @author yaoy
+ * @author Yaoyu
  * 2023-05-25
  *
  */
@@ -96,7 +96,7 @@ public class InvoiceAfterCheckEvent implements IBusinessListener{
 							for(String Vbdef20 : arrVbdef20) {
 								DefdocVO defdocVO = (DefdocVO) service.queryBillOfNCObjectByPKWithDR(DefdocVO.class, Vbdef20, true).getContainmentObject();
 								UFDate date = new UFDate(System.currentTimeMillis());
-								UFDate date2 = new UFDate(defdocVO.getShortname4());
+								UFDate date2 = new UFDate(defdocVO.getPid());
 								//当年只能报销当年的控制
 								if(date.getYear() != date2.getYear()) {
 									ExceptionUtils.wrappBusinessException("行:"+invoiceItemVO.getCrowno()+"不能跨年报销发票!");

+ 46 - 0
pu/pu/src/private/nc/bs/ic/base/InvoiceAfterDeleteEvent.java

@@ -0,0 +1,46 @@
+package nc.bs.ic.base;
+
+import nc.bs.framework.common.NCLocator;
+import nc.impl.pubapp.pattern.rule.IRule;
+import nc.itf.uap.IVOPersistence;
+import nc.vo.bd.defdoc.DefdocVO;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+import nc.vo.pubapp.pattern.pub.SqlBuilder;
+/**
+ * 
+ * 采购发票删除后删除匹配的发票数据
+ * @author Yaoyu
+ *
+ */
+public class InvoiceAfterDeleteEvent implements IRule<InvoiceVO>{
+
+	
+	private IVOPersistence IVOPersistence = (IVOPersistence) NCLocator.getInstance().lookup(IVOPersistence.class);
+	
+	@Override
+	public void process(InvoiceVO[] vos) {
+		try {
+				InvoiceVO InvoiceVO = (InvoiceVO) vos[0];
+				String vdef17 = (String) InvoiceVO.getParent().getAttributeValue("vdef17");
+				if(vdef17 != null && !"".equals(vdef17) ) {
+					DeleteDOC(vdef17);
+				}
+		} catch (Exception e) {
+			ExceptionUtils.wrappBusinessException("删除失败!");
+		}
+		
+	}
+	
+    private void DeleteDOC(String vdef17) throws Exception {
+    	SqlBuilder sql = new  SqlBuilder();
+    	sql.append(" name6 = '"+vdef17+"'");
+    	sql.append(" AND pk_defdoclist = ( SELECT pk_defdoclist FROM bd_defdoclist WHERE code = 'OCRTHNC' AND nvl( dr, 0 ) = 0 )");
+    	IVOPersistence.deleteByClause(DefdocVO.class, sql.toString());
+    }
+	
+
+
+
+
+}

+ 6 - 0
pu/pu/src/private/nc/bs/ic/base/InvoiceAfterSubmitEvent.java

@@ -6,6 +6,12 @@ import nc.itf.th.IThOcrService;
 import nc.vo.pu.m25.entity.InvoiceVO;
 import nc.vo.pubapp.pattern.exception.ExceptionUtils;
 
+
+/**
+ * 采购发票提交后传发票云
+ * @author Yaoyu
+ *
+ */
 public class InvoiceAfterSubmitEvent  implements IRule<InvoiceVO>{
 
 	@Override

+ 41 - 0
pu/pu/src/private/nc/bs/ic/base/InvoiceAfterUnApproveEvent.java

@@ -0,0 +1,41 @@
+package nc.bs.ic.base;
+
+import nc.bs.framework.common.NCLocator;
+import nc.impl.pubapp.pattern.rule.IRule;
+import nc.itf.th.IThOcrService;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+
+
+/**
+ * 采购发票审批通过取消审批传发票云
+ * @author Yaoyu
+ * 2023-05-25
+ *
+ */
+public class InvoiceAfterUnApproveEvent implements IRule<InvoiceVO>{
+	
+	private InvoiceVO[] orgVos = null;
+	
+	public  InvoiceAfterUnApproveEvent(InvoiceVO[] orgVos) {
+		this.orgVos = orgVos;
+	}
+	@Override
+	public void process(InvoiceVO[] vos) {
+		try {
+			IThOcrService  iThOcrService=(IThOcrService) NCLocator.getInstance().lookup(IThOcrService.class.getName());
+			int vostatus = orgVos[0].getParentVO().getFbillstatus();
+			if(vostatus == 3) {
+				System.out.println();
+				iThOcrService.UpdateInvoiceStatus("T", vos);
+			}
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			ExceptionUtils.wrappBusinessException(e.getMessage());
+		}
+		
+	}
+}
+
+

+ 28 - 0
pu/pu/src/private/nc/bs/ic/base/InvoiceAfterUnSubmitEvent.java

@@ -0,0 +1,28 @@
+package nc.bs.ic.base;
+
+import nc.bs.framework.common.NCLocator;
+import nc.impl.pubapp.pattern.rule.IRule;
+import nc.itf.th.IThOcrService;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+
+/**
+ * 
+ * 采购发票收回后传发票云
+ * @author Yaoyu
+ *
+ */
+public class InvoiceAfterUnSubmitEvent implements IRule<InvoiceVO>{
+
+	@Override
+	public void process(InvoiceVO[] vos) {
+		IThOcrService  iThOcrService=(IThOcrService) NCLocator.getInstance().lookup(IThOcrService.class.getName());
+		try {
+			iThOcrService.UpdateInvoiceStatus("S", vos);
+		} catch (Exception e) {
+			e.printStackTrace();
+			ExceptionUtils.wrappBusinessException(e.getMessage());
+		}
+	}
+}
+

+ 71 - 0
pu/pu/src/private/nc/impl/pu/m25/action/InvoiceApproveAction.java

@@ -0,0 +1,71 @@
+package nc.impl.pu.m25.action;
+
+import nc.bs.ic.base.InvoiceAfterApproveEvent;
+import nc.bs.pu.m25.plugin.InvoicePluginPoint;
+import nc.bs.pub.compiler.AbstractCompiler2;
+import nc.impl.pu.m25.action.rule.approve.ApproveAfterEventRuel;
+import nc.impl.pu.m25.action.rule.approve.ApproveBeforeEventRuel;
+import nc.impl.pu.m25.action.rule.approve.ApproveTogetherFeeProcRule;
+import nc.impl.pu.m25.action.rule.approve.SupplierInvoiceFrozenChkRule;
+import nc.impl.pu.m25.action.rule.approve.UpdateApproveInfoRule;
+import nc.impl.pu.m25.action.rule.approve.VOFilterFor55E6Rule;
+import nc.impl.pubapp.pattern.data.bill.BillQuery;
+import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool;
+import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
+import nc.itf.scmpub.reference.uap.pf.PfScriptClassAdaptor;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pu.m25.env.InvoiceUIToBSEnv;
+import nc.vo.pu.m25.rule.InvoiceAutoSettleRule;
+import nc.vo.pu.m25.rule.approve.ApproveStatusChkRule;
+import nc.vo.pu.pub.enumeration.PuBusiLogActionCode;
+import nc.vo.pu.pub.enumeration.PuBusiLogPathCode;
+import nc.vo.pu.pub.rule.busilog.WriteOperateLogRule;
+import nc.vo.pu.pub.rule.pf.ApprovedVOFilterRule;
+import nc.vo.pu.pub.rule.pf.UpdatePflowVORule;
+import nc.vo.pu.pub.util.AggVOUtil;
+import nc.vo.pub.compiler.PfParameterVO;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+
+public class InvoiceApproveAction {
+	public InvoiceVO[] approve(InvoiceVO[] invoiceVOs, AbstractCompiler2 script, InvoiceUIToBSEnv[] envs) {
+		BillTransferTool<InvoiceVO> tool = new BillTransferTool(invoiceVOs);
+		InvoiceVO[] vos = (InvoiceVO[]) tool.getClientFullInfoBill();
+		InvoiceVO[] orgVos = (InvoiceVO[]) tool.getOriginBills();
+		CompareAroundProcesser<InvoiceVO> prcr = new CompareAroundProcesser(InvoicePluginPoint.APPROVE);
+		this.addRule(prcr, envs, null != script ? script.getPfParameterVO() : null);
+		prcr.before(vos, vos);
+		if (null != script) {
+			try {
+				script.procFlowBacth(script.getPfParameterVO());
+			} catch (Exception var11) {
+				ExceptionUtils.wrappException(var11);
+			}
+
+			prcr.after((InvoiceVO[]) ((InvoiceVO[]) script.getPfParameterVO().m_preValueVos), orgVos);
+			String[] ids = AggVOUtil.getPrimaryKeys(vos);
+			InvoiceVO[] approvedVos = (InvoiceVO[]) (new BillQuery(InvoiceVO.class)).query(ids);
+			PfScriptClassAdaptor pfadptor = new PfScriptClassAdaptor(script);
+			pfadptor.setVo(null != approvedVos && approvedVos.length > 0 ? approvedVos[0] : null);
+			pfadptor.setVos(approvedVos);
+			return (InvoiceVO[]) tool.getBillForToClient(approvedVos);
+		} else {
+			return null;
+		}
+	}
+
+	private void addRule(CompareAroundProcesser<InvoiceVO> prcr, InvoiceUIToBSEnv[] envs, PfParameterVO pfParameterVO) {
+		prcr.addBeforeFinalRule(new ApproveStatusChkRule());
+		prcr.addBeforeFinalRule(new SupplierInvoiceFrozenChkRule());
+		prcr.addBeforeFinalRule(new ApproveBeforeEventRuel());
+		prcr.addAfterFinalRule(new WriteOperateLogRule(PuBusiLogPathCode.invoiceApprovePath.getCode(),
+				PuBusiLogActionCode.approve.getCode()));
+		prcr.addAfterFinalRule(new UpdateApproveInfoRule());
+		prcr.addAfterFinalRule(new ApprovedVOFilterRule());
+		prcr.addAfterFinalRule(new ApproveAfterEventRuel());
+		prcr.addAfterFinalRule(new VOFilterFor55E6Rule());
+		prcr.addAfterRule(new ApproveTogetherFeeProcRule(envs));
+		prcr.addAfterFinalRule(new InvoiceAutoSettleRule());
+		prcr.addAfterFinalRule(new UpdatePflowVORule(pfParameterVO));
+		prcr.addAfterFinalRule(new InvoiceAfterApproveEvent());	
+	}
+}

+ 130 - 0
pu/pu/src/private/nc/impl/pu/m25/action/InvoiceDeleteAction.java

@@ -0,0 +1,130 @@
+package nc.impl.pu.m25.action;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.ic.base.InvoiceAfterDeleteEvent;
+import nc.bs.ic.base.InvoiceAfterSubmitEvent;
+import nc.bs.pu.m25.maintain.InvoiceDeleteBP;
+import nc.bs.pu.m25.plugin.InvoicePluginPoint;
+import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool;
+import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
+import nc.itf.pu.m25.IInvoiceQuery;
+import nc.vo.ml.NCLangRes4VoTransl;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pu.m25.enumeration.InvoiceUserAnswerType;
+import nc.vo.pu.m25.env.InvoiceUIToBSEnv;
+import nc.vo.pu.m25.exception.InvoiceDelResumeException;
+import nc.vo.pu.m25.rule.maintain.InvoiceDelStatusChkRule;
+import nc.vo.pu.pub.util.ApproveFlowUtil;
+import nc.vo.pub.BusinessException;
+import nc.vo.pubapp.pattern.data.ValueUtils;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+import org.apache.commons.lang.ArrayUtils;
+
+public class InvoiceDeleteAction {
+	public void delete(InvoiceVO[] invoiceVOs, InvoiceUIToBSEnv[] envs) {
+		InvoiceVO[] fees = this.queryFeeVO(invoiceVOs);
+		InvoiceVO[] unApproveFees = this.pickupUnapproveFeeVO(fees);
+		InvoiceVO[] deleteFees = null;
+		InvoiceVO[] cutRelationFees = fees;
+		InvoiceUIToBSEnv env = ArrayUtils.isEmpty(envs) ? new InvoiceUIToBSEnv() : envs[0];
+		if (!ArrayUtils.isEmpty(unApproveFees)) {
+			InvoiceUserAnswerType atype = this.getAnswerType(env);
+			if (InvoiceUserAnswerType.NO_ANSWER == atype) {
+				ExceptionUtils.wrappException(new InvoiceDelResumeException(
+						NCLangRes4VoTransl.getNCLangRes().getStrByID("4004050_0", "04004050-0034")));
+			} else if (InvoiceUserAnswerType.YES == atype) {
+				deleteFees = unApproveFees;
+				cutRelationFees = this.pickupApproveFeeVO(fees);
+			}
+		}
+
+		BillTransferTool<InvoiceVO> tool = new BillTransferTool(invoiceVOs);
+		if (!ArrayUtils.isEmpty(fees)) {
+			new BillTransferTool(fees);
+		}
+
+		InvoiceVO[] vos = (InvoiceVO[]) tool.getClientFullInfoBill();
+		AroundProcesser<InvoiceVO> processer = new AroundProcesser(InvoicePluginPoint.DELETE);
+		this.addRule(processer);
+		processer.before(vos);
+		(new InvoiceDeleteBP(env)).delete(vos, deleteFees, cutRelationFees);
+		processer.after(vos);
+	}
+
+	private void addRule(AroundProcesser<InvoiceVO> processer) {
+		processer.addBeforeFinalRule(new InvoiceDelStatusChkRule());
+		processer.addAfterFinalRule(new InvoiceAfterDeleteEvent());	
+	}
+
+	private InvoiceUserAnswerType getAnswerType(InvoiceUIToBSEnv env) {
+		if (null == env) {
+			return InvoiceUserAnswerType.NO_ANSWER;
+		} else {
+			return null == env.getDelAnswer() ? InvoiceUserAnswerType.NO_ANSWER : env.getDelAnswer();
+		}
+	}
+
+	private InvoiceVO[] pickupApproveFeeVO(InvoiceVO[] fees) {
+		InvoiceVO[] unfees = this.pickupUnapproveFeeVO(fees);
+		if (ArrayUtils.isEmpty(unfees)) {
+			return fees;
+		} else {
+			Set<InvoiceVO> feeset = new HashSet(Arrays.asList(fees));
+			Set<InvoiceVO> unfeeset = new HashSet(Arrays.asList(unfees));
+			feeset.removeAll(unfeeset);
+			return (InvoiceVO[]) feeset.toArray(new InvoiceVO[feeset.size()]);
+		}
+	}
+
+	private InvoiceVO[] pickupUnapproveFeeVO(InvoiceVO[] fees) {
+		if (ArrayUtils.isEmpty(fees)) {
+			return null;
+		} else {
+			List<InvoiceVO> unfees = new ArrayList();
+			InvoiceVO[] arr$ = fees;
+			int len$ = fees.length;
+
+			for (int i$ = 0; i$ < len$; ++i$) {
+				InvoiceVO vo = arr$[i$];
+				if (ApproveFlowUtil.isCanDel(vo)) {
+					unfees.add(vo);
+				}
+			}
+
+			return (InvoiceVO[]) unfees.toArray(new InvoiceVO[unfees.size()]);
+		}
+	}
+
+	private InvoiceVO[] queryFeeVO(InvoiceVO[] vos) {
+		Set<String> ids = new HashSet();
+		InvoiceVO[] arr$ = vos;
+		int len$ = vos.length;
+
+		for (int i$ = 0; i$ < len$; ++i$) {
+			InvoiceVO vo = arr$[i$];
+			if (!ValueUtils.getBoolean(vo.getParentVO().getBfee())) {
+				ids.add(vo.getParentVO().getPk_invoice());
+			}
+		}
+
+		if (0 == ids.size()) {
+			return null;
+		} else {
+			IInvoiceQuery querysrv = (IInvoiceQuery) NCLocator.getInstance().lookup(IInvoiceQuery.class);
+			InvoiceVO[] feeVos = null;
+
+			try {
+				feeVos = querysrv.queryFee((String[]) ids.toArray(new String[ids.size()]));
+			} catch (BusinessException var7) {
+				ExceptionUtils.wrappException(var7);
+			}
+
+			return feeVos;
+		}
+	}
+}

+ 68 - 0
pu/pu/src/private/nc/impl/pu/m25/action/InvoiceUnApproveAction.java

@@ -0,0 +1,68 @@
+package nc.impl.pu.m25.action;
+
+import nc.bs.ic.base.InvoiceAfterUnApproveEvent;
+import nc.bs.pu.m25.plugin.InvoicePluginPoint;
+import nc.bs.pub.compiler.AbstractCompiler2;
+import nc.impl.pu.m25.action.rule.unapprove.CancelSendAPDriveChkRule;
+import nc.impl.pu.m25.action.rule.unapprove.SettledCheckRule;
+import nc.impl.pu.m25.action.rule.unapprove.UnApproveAfterEventRuel;
+import nc.impl.pu.m25.action.rule.unapprove.UnApproveBeforeEventRuel;
+import nc.impl.pubapp.pattern.data.bill.BillQuery;
+import nc.impl.pubapp.pattern.data.bill.BillUpdate;
+import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool;
+import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pu.m25.rule.approve.UnApproveStatusChkRule;
+import nc.vo.pu.pub.enumeration.PuBusiLogActionCode;
+import nc.vo.pu.pub.enumeration.PuBusiLogPathCode;
+import nc.vo.pu.pub.rule.ApproverPermissionRule;
+import nc.vo.pu.pub.rule.busilog.WriteOperateLogRule;
+import nc.vo.pu.pub.util.AggVOUtil;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+import nc.vo.scmpub.res.billtype.POBillType;
+
+public class InvoiceUnApproveAction {
+	public InvoiceVO[] unapprove(InvoiceVO[] invoiceVOs, AbstractCompiler2 script) {
+		BillTransferTool<InvoiceVO> tool = new BillTransferTool(invoiceVOs);
+		InvoiceVO[] vos = (InvoiceVO[]) tool.getClientFullInfoBill();
+		InvoiceVO[] orgVos = (InvoiceVO[]) tool.getOriginBills();
+		CompareAroundProcesser<InvoiceVO> prcr = new CompareAroundProcesser(InvoicePluginPoint.UNAPPROVE);
+		this.addRule(prcr,orgVos);
+		prcr.before(vos, orgVos);
+		InvoiceVO[] arr$;
+		if (null != script) {
+			try {
+				script.procUnApproveFlow(script.getPfParameterVO());
+				InvoiceVO[] unappovedVos = (InvoiceVO[]) ((InvoiceVO[]) script.getPfParameterVO().m_preValueVos);
+				arr$ = unappovedVos;
+				int len$ = unappovedVos.length;
+
+				for (int i$ = 0; i$ < len$; ++i$) {
+					InvoiceVO vo = arr$[i$];
+					vo.getParentVO().setStatus(1);
+				}
+
+				vos = (InvoiceVO[]) (new BillUpdate()).update(unappovedVos, orgVos);
+			} catch (Exception var12) {
+				ExceptionUtils.wrappException(var12);
+			}
+		}
+
+		prcr.after(vos, orgVos);
+		String[] ids = AggVOUtil.getPrimaryKeys(vos);
+		arr$ = (InvoiceVO[]) (new BillQuery(InvoiceVO.class)).query(ids);
+		return (InvoiceVO[]) tool.getBillForToClient(arr$);
+	}
+
+	private void addRule(CompareAroundProcesser<InvoiceVO> prcr,InvoiceVO[] orgVos) {
+		prcr.addBeforeFinalRule(new UnApproveStatusChkRule());
+		prcr.addBeforeFinalRule(new SettledCheckRule());
+		prcr.addBeforeRule(new ApproverPermissionRule(POBillType.Invoice.getCode()));
+		prcr.addBeforeFinalRule(new CancelSendAPDriveChkRule());
+		prcr.addBeforeFinalRule(new UnApproveBeforeEventRuel());
+		prcr.addAfterFinalRule(new UnApproveAfterEventRuel());
+		prcr.addAfterFinalRule(new WriteOperateLogRule(PuBusiLogPathCode.invoiceApprovePath.getCode(),
+				PuBusiLogActionCode.unapprove.getCode()));
+		prcr.addAfterFinalRule(new InvoiceAfterUnApproveEvent(orgVos));
+	}
+}

+ 80 - 0
pu/pu/src/private/nc/impl/pu/m25/action/InvoiceUnSendApproveAction.java

@@ -0,0 +1,80 @@
+/**
+ * $文件说明$
+ * 
+ * @author zhaoyha
+ * @version 6.0
+ * @see
+ * @since 6.0
+ * @time 2010-1-26 下午02:38:25
+ */
+package nc.impl.pu.m25.action;
+
+import nc.bs.ic.base.InvoiceAfterUnSubmitEvent;
+import nc.bs.pu.m25.plugin.InvoicePluginPoint;
+import nc.bs.pub.compiler.AbstractCompiler2;
+import nc.impl.pubapp.pattern.data.bill.BillQuery;
+import nc.impl.pubapp.pattern.data.bill.BillUpdate;
+import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool;
+import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pu.m25.rule.approve.UnSendApproveStatusChkRule;
+import nc.vo.pu.pub.util.AggVOUtil;
+import nc.vo.pub.VOStatus;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+
+/**
+ * <p>
+ * <b>本类主要完成以下功能:</b>
+ * <ul>
+ * <li>采购发票收回动作
+ * </ul>
+ * <p>
+ * <p>
+ * 
+ * @version 6.0
+ * @since 6.0
+ * @author zhaoyha
+ * @time 2010-1-26 下午02:38:25
+ */
+public class InvoiceUnSendApproveAction {
+  public InvoiceVO[] unSendApprove(InvoiceVO[] invoiceVOs,
+      AbstractCompiler2 script) {
+    InvoiceVO[] vos = invoiceVOs;
+    BillTransferTool<InvoiceVO> tool = new BillTransferTool<InvoiceVO>(vos);
+    vos = tool.getClientFullInfoBill();
+    InvoiceVO[] orgVos = tool.getOriginBills();
+    CompareAroundProcesser<InvoiceVO> prcr =
+        new CompareAroundProcesser<InvoiceVO>(InvoicePluginPoint.UNSENDAPPROVE);
+    this.addRule(prcr);
+    prcr.before(vos, orgVos);
+    if (null != script) {
+      try {
+        script.procRecallFlow(script.getPfParameterVO());
+        InvoiceVO[] unappovedVos =
+            (InvoiceVO[]) script.getPfParameterVO().m_preValueVos;
+        for (InvoiceVO vo : unappovedVos) {
+          vo.getParentVO().setStatus(VOStatus.UPDATED);
+        }
+        vos = new BillUpdate<InvoiceVO>().update(unappovedVos, orgVos);
+      }
+      catch (Exception e) {
+        // 日志异常
+        ExceptionUtils.wrappException(e);
+
+      }
+    }
+    prcr.after(vos, orgVos);
+    // 重新查一下VO
+    String[] ids = AggVOUtil.getPrimaryKeys(vos);
+    InvoiceVO[] approvedVos =
+        new BillQuery<InvoiceVO>(InvoiceVO.class).query(ids);
+    // 返回差异VO
+    return tool.getBillForToClient(approvedVos);
+  }
+
+  private void addRule(CompareAroundProcesser<InvoiceVO> prcr) {
+    // 发票可取消审批状态检查
+    prcr.addBeforeFinalRule(new UnSendApproveStatusChkRule());
+    prcr.addAfterFinalRule(new InvoiceAfterUnSubmitEvent());
+  }
+}

+ 88 - 20
pu/pu/src/private/nc/impl/th/ThOcrServiceImpl.java

@@ -28,6 +28,7 @@ import nc.bs.framework.common.RuntimeEnv;
 import nc.itf.uap.IUAPQueryBS;
 import nc.jdbc.framework.processor.ArrayListProcessor;
 import nc.jdbc.framework.processor.BeanListProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
 import nc.jdbc.framework.processor.MapProcessor;
 import nc.log.NcLog;
 import nc.vo.bd.defdoc.DefdocVO;
@@ -42,6 +43,7 @@ import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.RequestEntity;
 import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.bouncycastle.jce.provider.symmetric.Skipjack.Mac;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -51,6 +53,7 @@ import nc.itf.th.IThOcrService;
 import nc.pub.toolkits.Toolkits;
 import nc.th.redistoken.RedisTokenManager;
 import nc.vo.pub.filesystem.NCFileNode;
+import nc.vo.pub.lang.UFDouble;
 import nc.vo.th.ocr.OCRInvoiceVO;
 import weaver.fna.invoice.utils.InvoiceCloudAESUtil;
 /**
@@ -703,13 +706,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) {
-				int vostatus = invoiceVO.getParentVO().getFbillstatus();
-				//只有自由,审批成功,审批不通过才需要修改发票云发票状态
-				if(vostatus == 0 || vostatus == 3 || vostatus == 4){
+				//单据进行驳回,但不是驳回到制单人——单据状态自由,不调用接口
+				if("R".equals(status) && invoiceVO.getParentVO().getFbillstatus() != 0) {
+					continue;
+				}
 					Map<String,String> oamap = QueryOAUserid(invoiceVO.getParent().getAttributeValue("billmaker").toString());
-					//审批结果Y2代表通过 N0代表不通过 R0代表驳回T1报销中
 					InvoiceItemVO[] arrInvoiceItemVO = (InvoiceItemVO[]) invoiceVO.getChildren(InvoiceItemVO.class);
 					List<Map<Object, Object>> listMapVbdef20 = new ArrayList<Map<Object, Object>>();
 					List<String> listVbdef20 = new ArrayList<String>();
@@ -717,17 +721,83 @@ public class ThOcrServiceImpl implements IThOcrService{
 						if(invoiceItemVO.getVbdef20() != null && !"".equals(invoiceItemVO.getVbdef20())) {
 							String[] arrVbdef20 = invoiceItemVO.getVbdef20().split(",");
 							for(String Vbdef20 : arrVbdef20) {
-								StringBuffer sql = new StringBuffer();
-								sql.append("SELECT");
-								sql.append(" shortname2,");
-								sql.append(" name5");
-								sql.append(" FROM");
-								sql.append(" bd_defdoc ");
-								sql.append(" WHERE");
-								sql.append(" pk_defdoc = '"+Vbdef20+"'");
-								Map<Object, Object> mapdoc =  (Map<Object, Object>) iuap.executeQuery(sql.toString(), new MapProcessor());
-								listMapVbdef20.add(mapdoc);
-								listVbdef20.add(mapdoc.get("name5").toString());
+								//当前单据该发票价税合计,无税金额,税额
+								UFDouble norigtaxmny = invoiceItemVO.getNorigtaxmny();
+								UFDouble norigmny = invoiceItemVO.getNorigmny();
+								UFDouble ntax = invoiceItemVO.getNtax();
+								StringBuffer sql1 = new StringBuffer();
+								sql1.append("SELECT");
+								sql1.append(" shortname2,");
+								sql1.append(" shortname,");
+								sql1.append(" shortname3");
+								sql1.append(" FROM");
+								sql1.append(" bd_defdoc");
+								sql1.append(" WHERE");
+								sql1.append(" pk_defdoc = '"+Vbdef20+"'");
+								Map<String,String> mapdb = (Map<String, String>) iuap.executeQuery(sql1.toString(), new MapProcessor());
+								//该发票价税合计
+								UFDouble shortname2 = new UFDouble(mapdb.get("shortname2"));
+								//该发票无税金额
+								UFDouble shortname = new UFDouble(mapdb.get("shortname"));
+								//该发票税额
+								UFDouble shortname3 = new UFDouble(mapdb.get("shortname3"));
+								//提交情况下
+								if("T".equals(status)){
+									int index = invoiceItemVO.getVbdef16().indexOf("—");
+									//去掉拼接时间戳
+							    	String code = index == -1 ? invoiceItemVO.getVbdef16() : invoiceItemVO.getVbdef16().substring(0, index);
+							    	//查询该发票已使用价税合计,无税金额,税额
+									StringBuffer sql = new StringBuffer();
+									sql.append("SELECT");
+									//sql.append(" LISTAGG(po_invoice.vbillcode, ',') WITHIN GROUP (ORDER BY po_invoice.vbillcode) AS vbillcode,");
+									sql.append(" SUM( po_invoice_b.norigtaxmny ) as norigtaxmny,");
+									sql.append(" SUM( po_invoice_b.norigmny ) as norigmny,");
+									sql.append(" SUM( po_invoice_b.ntax ) as ntax");
+									sql.append(" FROM");
+									sql.append(" po_invoice po_invoice");
+									sql.append(" LEFT JOIN po_invoice_b po_invoice_b ON po_invoice.pk_invoice = po_invoice_b.pk_invoice ");
+									sql.append(" WHERE");
+									sql.append(" po_invoice.fbillstatus <> '0' ");
+									sql.append(" AND po_invoice.fbillstatus <> '1' ");
+									sql.append(" AND po_invoice.vbillcode <> '"+invoiceVO.getParentVO().getVbillcode()+"'");
+									sql.append(" AND po_invoice_b.vbdef20 IN ( SELECT pk_defdoc FROM bd_defdoc WHERE code LIKE '"+code+"%' )");
+									Map<String,String> mappo = (Map<String, String>) iuap.executeQuery(sql.toString(), new MapProcessor());
+									//价税合计
+									Object objectNorigtaxmny = mappo.get("norigtaxmny");
+									//无税金额
+									Object objectNorigmny = mappo.get("norigmny");
+									//税额
+									Object objectNtax = mappo.get("ntax");
+									UFDouble sumNorigtaxmny = new UFDouble(objectNorigtaxmny == null ? 0.00 : Double.valueOf(objectNorigtaxmny.toString()));
+									UFDouble sumNorigmny = new UFDouble(objectNorigmny == null ? 0.00 : Double.valueOf(objectNorigmny.toString()));
+									UFDouble sumNtax = new UFDouble(objectNtax == null ? 0.00 : Double.valueOf(objectNtax.toString()));
+									//我有预感会要具体的提示,先不放出来避免他得寸进尺!!!!!
+									if(sumNorigtaxmny.add(norigtaxmny).compareTo(shortname2)>0) {
+										// throw new Exception("行:"+invoiceItemVO.getCrowno()+"发票可用余额不足!关联单据"+mappo.get("vbillcode"));
+										 throw new Exception("行:"+invoiceItemVO.getCrowno()+"发票可用余额不足!差:"+(sumNorigtaxmny.add(norigtaxmny)).sub(shortname2));
+									}
+									if(sumNorigmny.add(norigmny).compareTo(shortname)>0) {
+										 //throw new Exception("行:"+invoiceItemVO.getCrowno()+"无税金额大于发票金额!关联单据"+mappo.get("vbillcode"));
+										 throw new Exception("行:"+invoiceItemVO.getCrowno()+"无税金额大于发票金额!差:"+(sumNorigmny.add(norigmny)).sub(shortname));
+									}
+									if(sumNtax.add(ntax).compareTo(shortname3)>0) {
+										 throw new Exception("行:"+invoiceItemVO.getCrowno()+"税额大于发票税额!差:"+(sumNtax.add(ntax)).sub(shortname3));
+										 //throw new Exception("行:"+invoiceItemVO.getCrowno()+"税额大于发票税额!关联单据"+mappo.get("vbillcode"));
+									}
+								}
+								StringBuffer sql2 = new StringBuffer();
+								sql2.append("SELECT");
+								sql2.append(" name5");
+								sql2.append(" FROM");
+								sql2.append(" bd_defdoc ");
+								sql2.append(" WHERE");
+								sql2.append(" pk_defdoc = '"+Vbdef20+"'");
+								String name5 = (String) iuap.executeQuery(sql2.toString(), new ColumnProcessor());
+								Map<Object, Object> map = new  HashMap<Object, Object>();
+								map.put("norigtaxmny", norigtaxmny.toString());
+								map.put("name5",name5);
+								listMapVbdef20.add(map);
+								listVbdef20.add(name5);
 							}
 						}
 					}
@@ -760,7 +830,7 @@ public class ThOcrServiceImpl implements IThOcrService{
 							JSONObject bodyJson2 = new JSONObject();
 							bodyJson2.put("dataid", invoiceVO.getParent().getAttributeValue("pk_invoice"));
 							bodyJson2.put("number", invoiceVO.getParent().getAttributeValue("pk_invoice"));
-							bodyJson2.put("amount", "0".equals(sreim) ? "0.00" : map.get("shortname2"));
+							bodyJson2.put("amount", map.get("norigtaxmny"));
 							bodyJson2.put("uid", oamap.get("id"));
 							bodyJson2.put("date",Long.toString(date));
 							bodyJson2.put("name", invoiceVO.getParent().getAttributeValue("pk_invoice"));
@@ -769,9 +839,9 @@ public class ThOcrServiceImpl implements IThOcrService{
 							arrinfos.add(bodyJson2);
 						}
 						bodyJson1.put("infos", arrinfos);
+						System.out.println();
 						NcLog.info("发票锁定修改返回json:"+UpdateInvoiceOCR(bodyJson1.toString()));
 					}
-				}
 			}
 		}
 		
@@ -832,11 +902,9 @@ public class ThOcrServiceImpl implements IThOcrService{
 			sql.append(" WHERE");
 			sql.append(" sm_user.cuserid = '"+cuserid+"'");
 			Map<String,String> map = (Map<String, String>) iuap.executeQuery(sql.toString(), new MapProcessor());
-			if(map == null) {
+			if(map.get("id") == null) {
 				throw new Exception("获取oaid失败,请检查用户和人员是否关联!");
 			}
 			return map;
 		}
-		
-		
 }

+ 62 - 0
pu/pu/src/public/nc/bs/pub/action/N_25_APPROVE.java

@@ -0,0 +1,62 @@
+package nc.bs.pub.action;
+
+import nc.bs.framework.common.NCLocator;
+import nc.bs.pub.compiler.AbstractCompiler2;
+import nc.itf.pu.m25.IInvoiceApprove;
+import nc.itf.th.IThOcrService;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.compiler.PfParameterVO;
+import nc.vo.uap.pf.PFBusinessException;
+
+/**
+ * 备注:采购发票的审批 单据动作执行中的动态执行类的动态执行类。 创建日期:(2009-7-3)
+ * 
+ * @author 平台脚本生成
+ */
+public class N_25_APPROVE extends AbstractCompiler2 {
+
+  /**
+   * N_25_APPROVE 构造子注解。
+   */
+  public N_25_APPROVE() {
+    super();
+  }
+
+  /*
+   * 备注:平台编写原始脚本
+   */
+  @Override
+  public String getCodeRemark() {
+    return "	/*************从平台取得由该动作传入的入口参数。本方法取得需要的VO。************/\n      nc.vo.pu.m25.entity.InvoiceVO inObject  =(nc.vo.pu.m25.entity.InvoiceVO) getVo();\n      /**************设置参数******************************************************/\n      setParameter(\"INVO\", inObject);\n	return null;\n";/* -=notranslate=- */
+  }
+
+  /*
+   * 备注:平台编写规则类 接口执行类
+   */
+  @Override
+  public Object runComClass(PfParameterVO vo) throws BusinessException {
+    try {
+      super.m_tmpVo = vo;
+
+      /************* 该组件为批动作工作流处理开始...不能进行修改 *********************/
+      Object retValue = null;
+      nc.vo.pu.m25.entity.InvoiceVO[] vos = (nc.vo.pu.m25.entity.InvoiceVO[]) this.getVos();
+      nc.vo.pu.m25.env.InvoiceUIToBSEnv[] envs = nc.vo.pu.m25.pub.InvoiceEnvExtractUtil.getEnvs(vo);
+      retValue = NCLocator.getInstance().lookup(IInvoiceApprove.class).approve(vos, this, envs);
+      String status = vo.m_workFlow.getApproveresult();
+      //只处理驳回的单据,并且是驳回到制单人,单据状态为自由
+		if("R".equals(status)) {
+			NCLocator.getInstance().lookup(IThOcrService.class).UpdateInvoiceStatus(status,vos);
+		}
+      
+      return retValue;
+      /**************************************************************************/
+    }
+    catch (Exception ex) {
+      if (ex instanceof BusinessException) {
+        throw (BusinessException) ex;
+      }
+      throw new PFBusinessException(ex.getMessage(), ex);
+    }
+  }
+}

+ 3 - 2
pu/pu/src/public/nc/ui/bd/ref/model/StorDocReportRefModel.java

@@ -50,8 +50,9 @@ public class StorDocReportRefModel extends AbstractRefModel{
             		"购买方公司名称", 
             		"销售方纳税人识别号",
             		"销售方公司名称",
-            		"开票内容",
-            		"发票时间"
+            		"发票时间",
+            		"开票内容"
+            		
             });
             this.setHiddenFieldCode(new String[] {
                 DefdocVO.PK_DEFDOC

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません