yaoyu 1 rok temu
rodzic
commit
39fbc5d108

+ 23 - 23
pu/pu/src/client/nc/ui/pu/m25/editor/card/beforeedit/body/Vbdef20.java

@@ -1,23 +1,23 @@
-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.pubapp.uif2app.event.card.CardBodyBeforeEditEvent;
-import nc.ui.pub.bill.BillCardPanel;
-public class Vbdef20 implements ICardBodyBeforeEditEventListener{
-
-	@Override 
-	public void beforeEdit(CardBodyBeforeEditEvent arg0) {
-		BillCardPanel cpanel=arg0.getBillCardPanel();
-		Object objvdef17=cpanel.getHeadItem("vdef17").getValueObject();//附件id
-		UIRefPane ref=(UIRefPane) cpanel.getBodyItem("vbdef20").getComponent();
-		ref.setMultiSelectedEnabled(true);
-		ref.setNotLeafSelectedEnabled(false);
-		StorDocReportRefModel storef=(StorDocReportRefModel) ref.getRefModel();
-		//storef.addWherePart(" and name6='"+objvdef17.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.pubapp.uif2app.event.card.CardBodyBeforeEditEvent;
+import nc.ui.pub.bill.BillCardPanel;
+public class Vbdef20 implements ICardBodyBeforeEditEventListener{
+
+	@Override 
+	public void beforeEdit(CardBodyBeforeEditEvent arg0) {
+		BillCardPanel cpanel=arg0.getBillCardPanel();
+		Object objvdef17=cpanel.getHeadItem("vdef17").getValueObject();//附件id
+		UIRefPane ref=(UIRefPane) cpanel.getBodyItem("vbdef20").getComponent();
+		ref.setMultiSelectedEnabled(true);
+		ref.setNotLeafSelectedEnabled(false);
+		StorDocReportRefModel storef=(StorDocReportRefModel) ref.getRefModel();
+		storef.addWherePart(" and name6='"+objvdef17.toString()+"' "); //附件主键过滤
+		
+		
+	}
+
+}

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

@@ -0,0 +1,88 @@
+package nc.bs.ic.base;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+import nc.bs.businessevent.IBusinessEvent;
+import nc.bs.businessevent.IBusinessListener;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.pu.event.PUBusinessEvent;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.processor.MapListProcessor;
+import nc.vo.pu.m25.entity.InvoiceItemVO;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.lang.UFDateTime;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+
+public class InvoiceAfterCheckEvent implements IBusinessListener{
+	
+	
+	IUAPQueryBS bs = NCLocator.getInstance().lookup(IUAPQueryBS.class);
+
+
+	@Override
+	public void doAction(IBusinessEvent event) throws BusinessException {
+		if (event instanceof PUBusinessEvent) {
+			PUBusinessEvent busiEvent = (PUBusinessEvent)event;
+			Object[] obj = busiEvent.getObjs();
+			if (obj == null) {
+				 return;
+			}
+			if (obj instanceof InvoiceVO[]) {
+				InvoiceVO InvoiceVO = (InvoiceVO) obj[0];
+				InvoiceItemVO[] invoiceItemListVO = (InvoiceItemVO[]) InvoiceVO.getChildren(InvoiceItemVO.class);
+				UFDateTime date = new UFDateTime(System.currentTimeMillis());
+				UFDateTime date2 = new UFDateTime("2023-01-01 00:00:01");
+				//当年只能报销当年的控制
+				if(date.getYear() != date2.getYear()) {
+					ExceptionUtils.wrappBusinessException("不能跨年报销发票!");
+				}
+				//参照上游单据的信息和发票信息一致性校验(抬头、税率)
+				//发票金额不可超过采购合同/订单金额
+				//购买方发票抬头、税号准确性
+				//来源单据类型
+				String csourcetypecode = invoiceItemListVO[0].getCsourcetypecode();
+				//来源单据主键
+				String csourceid = invoiceItemListVO[0].getCsourceid();
+				//来源单据是采购订单
+				if("21".equals(csourcetypecode)) {
+					String sql = "select po_order_b.pk_order_b,po_order_b.norigtaxmny,po_order_b.ntaxrate from po_order po_order" + 
+							" left join po_order_b po_order_b on po_order_b.pk_order = po_order.pk_order" + 
+							" where po_order.pk_order='"+csourceid+"'";
+					 List<Map<Object, Object>> listMap = (List<Map<Object, Object>>) bs.executeQuery(sql, new MapListProcessor());                
+					 for (InvoiceItemVO invoiceItemVO : invoiceItemListVO) { 
+						 for (Map<Object, Object> map : listMap) { 
+							 if (invoiceItemVO.getCsourcebid().equals(map.get("pk_order_b"))) { 
+								 UFDouble norigtaxmny1 = invoiceItemVO.getNorigtaxmny();
+								 UFDouble norigtaxmny2 = new UFDouble(map.get("norigtaxmny").toString());
+								 //比较价税合计							 
+								 if(norigtaxmny1.compareTo(norigtaxmny2) == 1) {
+									 ExceptionUtils.wrappBusinessException("行:"+invoiceItemVO.getCrowno()+"不可超过采购订单价税合计金额!");
+								 }
+								 //比较税率
+								 UFDouble ntaxrate1 = invoiceItemVO.getNtaxrate();
+								 UFDouble ntaxrate2 = new UFDouble(map.get("ntaxrate").toString());
+								 if(ntaxrate1.compareTo(ntaxrate2) != 0) {
+									 ExceptionUtils.wrappBusinessException("行:"+invoiceItemVO.getCrowno()+"与采购订单税率不同!");
+								 }
+								 //比较抬头
+								 
+								 //比较纳税人识别号
+								 break;
+							 }
+						 }
+					 }
+				}
+				
+				//来源单据是入库单
+				
+				String str = null;
+				System.out.println(str.toString());
+				
+			}
+		}
+	}
+}

+ 1 - 1
pu/pu/src/private/org/jeecg/common/util/HttpHelper.java

@@ -102,7 +102,7 @@ public class  HttpHelper {
 	     String newMd5 = DigestUtils.md5Hex(s2);
 	     String s4 = s1 + "&time=" + l + "&md5=" + newMd5;
 	     // дÈëÇëÇóÌå
-	     byte[] requestBodyBytes = s4.getBytes(StandardCharsets.UTF_8);
+	     byte[] requestBodyBytes = s4.getBytes("UTF-8");
 	     OutputStream outputStream = httpURLConnection.getOutputStream();
 	     outputStream.write(requestBodyBytes);
 	     outputStream.flush();