From dfb71280b6636d3c62c6173458eefb29e0a73589 Mon Sep 17 00:00:00 2001 From: lihao Date: Fri, 17 Oct 2025 19:10:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B7=E8=B4=AD=E5=8D=95=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8C=EF=BC=8C?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93=E6=95=B0=E9=87=8F=E5=BF=85?= =?UTF-8?q?=E9=A1=BB=E7=AD=89=E4=BA=8E=E6=9C=80=E7=BB=88=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pu/m20/rewrite/ReWrite20ForOrderBP.java | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 pu/src/private/nc/bs/pu/m20/rewrite/ReWrite20ForOrderBP.java diff --git a/pu/src/private/nc/bs/pu/m20/rewrite/ReWrite20ForOrderBP.java b/pu/src/private/nc/bs/pu/m20/rewrite/ReWrite20ForOrderBP.java new file mode 100644 index 00000000..6cd51bc5 --- /dev/null +++ b/pu/src/private/nc/bs/pu/m20/rewrite/ReWrite20ForOrderBP.java @@ -0,0 +1,100 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nc.bs.pu.m20.rewrite; + +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import nc.bs.pu.m20.plugin.PraybillPluginPoint; +import nc.bs.pu.m20.rewrite.pu.rule.AccOrderNumCalcRule; +import nc.bs.pu.m20.rewrite.pu.rule.PrayOrderWriteBackTolerRule; +import nc.impl.pubapp.pattern.data.bill.BillQuery; +import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool; +import nc.impl.pubapp.pattern.data.view.ViewQuery; +import nc.impl.pubapp.pattern.data.view.ViewUpdate; +import nc.impl.pubapp.pattern.rule.processer.AroundProcesser; +import nc.vo.pu.m20.entity.PraybillItemVO; +import nc.vo.pu.m20.entity.PraybillVO; +import nc.vo.pu.m20.entity.PraybillViewVO; +import nc.vo.pu.m20.entity.writeback.OrderWriteBackVO; +import nc.vo.pu.m20.pub.PraybillVOUtil; +import nc.vo.pu.pub.util.PUSysParamUtil; +import nc.vo.pub.lang.UFBoolean; +import nc.vo.pub.lang.UFDouble; +import nccloud.commons.lang.ArrayUtils; +import nccloud.pubimpl.pu.pub.vocheck.ViewVoSagaStatusCheck; + +public class ReWrite20ForOrderBP { + public ReWrite20ForOrderBP() { + } + + public void backWriteNum(OrderWriteBackVO[] vos) { + String[] bids = PraybillVOUtil.getInstance().getBidsFromWBVos(vos); + PraybillViewVO[] views = (PraybillViewVO[])(new ViewQuery(PraybillViewVO.class)).query(bids); + if (!ArrayUtils.isEmpty(views)) { + (new ViewVoSagaStatusCheck(true)).processCheck(views, PraybillVO.class); + AroundProcesser processer = new AroundProcesser(PraybillPluginPoint.REWRITENUM); + this.addRule(processer, vos, views); + processer.before(views); + String[] wbNames = new String[]{"naccumulatenum"}; + ViewUpdate bo = new ViewUpdate(); + views = (PraybillViewVO[])bo.update(views, PraybillItemVO.class, wbNames); + processer.after(views); + String[] hids = PraybillVOUtil.getInstance().getHidsFromWBVos(vos); + Set set = new HashSet(); + + for(int i = 0; i < hids.length; ++i) { + set.add(hids[i]); + } + + String[] arrayResult = (String[])set.toArray(new String[set.size()]); + PraybillVO[] newVos = (PraybillVO[])(new BillQuery(PraybillVO.class)).query(arrayResult); + if (!ArrayUtils.isEmpty(newVos)) { + String pk_org = newVos[0].getHVO().getPk_org(); + UFBoolean po92 = PUSysParamUtil.getPO92(pk_org); + if (po92 != null && po92.booleanValue()) { + this.closeOrOpenBill(newVos, bids); + } + + } + } + } + + private void closeOrOpenBill(PraybillVO[] newVos, String[] bids) { + List lbids = Arrays.asList(bids); + PraybillVO[] origVos = null; + BillTransferTool tool = new BillTransferTool(newVos); + origVos = (PraybillVO[])tool.getOriginBills(); + + for(PraybillVO vo : newVos) { + vo.getHVO().setStatus(1); + PraybillItemVO[] itemvos = vo.getBVO(); + + for(PraybillItemVO itemvo : itemvos) { + if (lbids.contains(itemvo.getPk_praybill_b())) { + + if (itemvo.getNaccumulatenum().compareTo(itemvo.getNnum()) < 0 && ( null != itemvo.getAttributeValue("vbdef33") && itemvo.getNaccumulatenum().compareTo(new UFDouble((BigDecimal)itemvo.getAttributeValue("vbdef33"))) == 0)) { + itemvo.setStatus(1); + itemvo.setBrowclose(UFBoolean.FALSE); + } else { + itemvo.setStatus(1); + itemvo.setBrowclose(UFBoolean.TRUE); + } + } + } + } + + (new ReWrite20RowStatusForOrderBP()).closeOrOpenBillRow(newVos, origVos); + } + + private void addRule(AroundProcesser processer, OrderWriteBackVO[] vos, PraybillViewVO[] views) { + String pk_org = views[0].getPk_purchaseorg(); + processer.addBeforeRule(new AccOrderNumCalcRule(vos)); + processer.addAfterRule(new PrayOrderWriteBackTolerRule("intolerance", PUSysParamUtil.getPO47(pk_org), "naccumulatenum", UFBoolean.valueOf(vos[0].isUserConfirm()))); + } +}