请购单自动关闭增加校验,采购入库数量必须等于最终需求数量
This commit is contained in:
parent
3115d7a97d
commit
dfb71280b6
|
@ -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<PraybillViewVO> processer = new AroundProcesser(PraybillPluginPoint.REWRITENUM);
|
||||
this.addRule(processer, vos, views);
|
||||
processer.before(views);
|
||||
String[] wbNames = new String[]{"naccumulatenum"};
|
||||
ViewUpdate<PraybillViewVO> bo = new ViewUpdate();
|
||||
views = (PraybillViewVO[])bo.update(views, PraybillItemVO.class, wbNames);
|
||||
processer.after(views);
|
||||
String[] hids = PraybillVOUtil.getInstance().getHidsFromWBVos(vos);
|
||||
Set<String> 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<String> lbids = Arrays.asList(bids);
|
||||
PraybillVO[] origVos = null;
|
||||
BillTransferTool<PraybillVO> 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<PraybillViewVO> 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())));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue