Переглянути джерело

明源接口传应付付款自动核销日志记录

wenfx 3 роки тому
батько
коміт
3aebc7eb80

+ 56 - 0
arap_patch/src/private/nc/bs/arap/busireg/BillRegisterForBusiDataBO.java

@@ -15,6 +15,7 @@ import nc.bs.arap.bill.ArapBillCalUtil;
 import nc.bs.arap.billact.LogTime;
 import nc.bs.arap.cache.ArapBusiPluginCenter;
 import nc.bs.arap.verify.FaDMO;
+import nc.bs.bgy.pub.VerifyLogger;
 import nc.bs.businessevent.BdUpdateEvent;
 import nc.bs.businessevent.BusinessEvent;
 import nc.bs.businessevent.IBusinessEvent;
@@ -30,6 +31,7 @@ import nc.itf.arap.fieldmap.IBillFieldGet;
 import nc.itf.arap.prv.IArapVerifyLogPrivate;
 import nc.itf.fi.pub.Currency;
 import nc.itf.fi.pub.SysInit;
+import nc.itf.uap.IUAPQueryBS;
 import nc.itf.uap.busibean.SysinitAccessor;
 import nc.jdbc.framework.processor.ColumnListProcessor;
 import nc.md.data.access.NCObject;
@@ -58,6 +60,7 @@ import nc.vo.arap.gathering.GatheringBillItemVO;
 import nc.vo.arap.global.ArapBillDealVOConsts;
 import nc.vo.arap.pay.PayBillItemVO;
 import nc.vo.arap.payable.PayableBillItemVO;
+import nc.vo.arap.payable.PayableBillVO;
 import nc.vo.arap.pfflow.ArapBillMapVO;
 import nc.vo.arap.pfflow.ArapBillMapVOTool;
 import nc.vo.arap.pub.ArapBillTypeInfo;
@@ -110,6 +113,13 @@ public class BillRegisterForBusiDataBO {
 	Map<String, ArrayList<AggverifyVO>> aggMap = new HashMap<String, ArrayList<AggverifyVO>>();
 
 	AggregatedValueObject[] aggvos = null;
+	
+	// add by wenfx 20220615 start
+	// TODO 增加明源应付,找明源付款核销的日志记录
+	private VerifyLogger log = new VerifyLogger(BillRegisterForBusiDataBO.class.getName());
+
+	private boolean logFlag = false;
+	// add by wenfx 20220615 end
 
 	public AggregatedValueObject[] getAggvos() {
 		return this.aggvos;
@@ -299,12 +309,30 @@ public class BillRegisterForBusiDataBO {
 			BusinessEvent e = (BusinessEvent) event;
 			if (null != e.getUserObject()) {
 				AggregatedValueObject[] vos = this.dealUserObj(e.getUserObject());
+				
+				// add by wenfx 20220615 start
+				// TODO 只记录从明源传过来的应付单的生效核销过程
+				if ("F1-Cxx-W02".equals(vos[0].getParentVO().getAttributeValue(PayableBillVO.PK_TRADETYPE))
+						&& vos[0].getParentVO().getAttributeValue(PayableBillVO.DEF1) != null) {
+//					List<Object> ret = (List<Object>) NCLocator.getInstance().lookup(IUAPQueryBS.class).executeQuery(
+//							"select billid from sap_po_log where billid='" + vos[0].getParentVO().getPrimaryKey() + "'",
+//							new ColumnListProcessor());
+//					if (ret != null && ret.size() > 0) {
+						log.info(vos[0].getParentVO().getPrimaryKey());
+						logFlag = true;
+//					}
+				}
+				// add by wenfx 20220615 end
+				
 				this.setAggvos(vos);
 				for (AggregatedValueObject obj : vos) {
 					CircularlyAccessibleValueObject parentVO = obj.getParentVO();
 					UFBoolean isinit = (UFBoolean) parentVO.getAttributeValue("isinit");
 					if (isinit != null && isinit.booleanValue()) {
 						// 如果是期初单据,不用审核监听,直接返回
+						if(logFlag) {
+							log.info("期初标识为期初,未核销直接结束");
+						}
 						return;
 					}
 				}
@@ -323,6 +351,9 @@ public class BillRegisterForBusiDataBO {
 					String billclass = (String) obj.getParentVO().getAttributeValue("billclass");
 					if (billclass != null && (billclass.equals(ArapConstant.ARAP_ZS_BILLCLASS)
 							|| billclass.equals(ArapConstant.ARAP_ZF_BILLCLASS))) {
+						if (logFlag) {
+							log.info("billclass为" + billclass + ",未核销直接结束");
+						}
 						return;
 					}
 				}
@@ -685,6 +716,9 @@ public class BillRegisterForBusiDataBO {
 						if (scmList.get(0).getS_billtype() == null) {
 							// 采购订单-》应付, 采购订单-》合同-》付款 ,自动核销
 							this.VerifyByContractNo(scmList, com, ruleVOMap);
+							if (logFlag) {
+								log.info("走供应链核销,未核销直接结束");
+							}
 							return;
 						}
 						List<ArapBillMapVO> newList = new ArrayList<ArapBillMapVO>();
@@ -2690,6 +2724,9 @@ public class BillRegisterForBusiDataBO {
 				// def109是否含质保金付款def14
 				iszhibaojin = vos[0].getParentVO().getAttributeValue("def14") == null ? UFBoolean.FALSE
 						: new UFBoolean(vos[0].getParentVO().getAttributeValue("def14").toString());
+				if (logFlag) {
+					log.info("iszhibaojin:"+iszhibaojin);
+				}
 			}
 
 			if ("F3-Cxx-W01".equals(pk_tradetype)) {
@@ -2710,6 +2747,9 @@ public class BillRegisterForBusiDataBO {
 				Object def3 = headValueObject.getAttributeValue("def3");
 
 				UFBoolean isticketpay = null == def3 ? UFBoolean.FALSE : new UFBoolean(def3.toString());
+				if (logFlag) {
+					log.info("isticketpay:"+isticketpay);
+				}
 
 				if (isticketpay.booleanValue() && iszhibaojin.booleanValue()) {
 					qryitemsql = "select p.pk_paybill\n" + "  from ap_paybill p\n" + " where p.def11 = '" + guid + "'\n"
@@ -2724,6 +2764,9 @@ public class BillRegisterForBusiDataBO {
 			}
 			pk_itemList.add(headValueObject.getPrimaryKey());
 
+			if (logFlag) {
+				log.info("qryitemsql:"+qryitemsql);
+			}
 			if (qryitemsql == "") {
 				return;
 			}
@@ -2737,8 +2780,17 @@ public class BillRegisterForBusiDataBO {
 			List<ArapBusiDataVO> dataList = new ArrayList<ArapBusiDataVO>();
 			List<ArapBusiDataVO> jfdataList = new ArrayList<ArapBusiDataVO>();
 			List<ArapBusiDataVO> dfdataList = new ArrayList<ArapBusiDataVO>();
+			if (logFlag) {
+				log.info("qrySql:"+qrySql);
+			}
 			NCObject[] ncObjects = MDPersistenceService.lookupPersistenceQueryService()
 					.queryBillOfNCObjectByCond(ArapBusiDataVO.class, qrySql, false);
+			if (logFlag) {
+				for (NCObject ncObject : ncObjects) {
+					log.info("ncObject_pk:" + ((ArapBusiDataVO) ncObject.getContainmentObject()).getPk_bill() + ":"
+							+ ((ArapBusiDataVO) ncObject.getContainmentObject()).getMoney_bal());
+				}
+			}
 			if (!ArrayUtils.isEmpty(ncObjects)) {
 				for (DefaultVerifyRuleVO rule : ruleVOMap.values()) {
 					rule.setM_creditObjKeys(new String[] { ArapBusiDataVO.DEF1,ArapBusiDataVO.DEF19});//明源GUID和表体分摊期间做为核销的条件
@@ -2775,7 +2827,11 @@ public class BillRegisterForBusiDataBO {
 				// 核销结果保存
 				if (aggVOList != null && aggVOList.size() > 0) {
 					NCLocator.getInstance().lookup(IArapVerifyLogPrivate.class).save(aggVOList, ruleVOMap, com);
+				}else if (logFlag) {
+					log.info("核销结果aggVOList为空");
 				}
+			}else if(logFlag) {
+				log.info("ncObjects为空,未核销直接返回");
 			}
 		} catch (Exception e) {
 			ExceptionUtils.wrappBusinessException(e.getMessage());

+ 42 - 0
arap_patch/src/public/nc/bs/bgy/pub/VerifyLogger.java

@@ -0,0 +1,42 @@
+package nc.bs.bgy.pub;
+
+import nc.bs.logging.Log;
+
+public class VerifyLogger {
+
+	private Log log = Log.getInstance("myverifylog");
+
+	private String logHead;
+
+	public VerifyLogger() {
+	}
+
+	public VerifyLogger(String logHead) {
+		this.logHead = "<" + logHead + ">:  ";
+	}
+
+	public void debug(String msg) {
+		log.debug(logHead + msg);
+	}
+
+	public void info(String msg) {
+		log.info(logHead + msg);
+	}
+
+	public void warn(String msg) {
+		log.warn(logHead + msg);
+	}
+
+	public void error(String msg) {
+		log.error(logHead + msg);
+	}
+
+	public void error(Throwable throwable) {
+		log.error(logHead, throwable);
+	}
+
+	public void error(String msg, Throwable throwable) {
+		log.error(logHead + msg, throwable);
+	}
+
+}