负计划采购入库回写校验
This commit is contained in:
parent
8c76f8e3e9
commit
9d13298270
|
|
@ -0,0 +1,108 @@
|
||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package nc.bs.pu.m23.writeback.ic.m45;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import nc.bs.pu.m23.plugin.ArriveBPPlugInPoint;
|
||||||
|
import nc.bs.pu.m23.writeback.ic.rule.*;
|
||||||
|
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.pubitf.pu.m23.ic.m45.IWriteback23For45Para;
|
||||||
|
import nc.vo.ml.NCLangRes4VoTransl;
|
||||||
|
import nc.vo.pu.m23.entity.ArriveItemVO;
|
||||||
|
import nc.vo.pu.m23.entity.ArriveViewVO;
|
||||||
|
import nc.vo.pu.m23.utils.ArrivePublicUtil;
|
||||||
|
import nc.vo.pub.lang.UFBoolean;
|
||||||
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
|
import nccloud.commons.lang.ArrayUtils;
|
||||||
|
import nccloud.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
public class Writeback23For45BP {
|
||||||
|
public Writeback23For45BP() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeback(IWriteback23For45Para[] paras) {
|
||||||
|
if (!ArrayUtils.isEmpty(paras)) {
|
||||||
|
this.checkWritePara(paras);
|
||||||
|
String[] bidArray = ArrivePublicUtil.getWriteParaBidArray(paras);
|
||||||
|
ViewQuery<ArriveViewVO> q = new ViewQuery(ArriveViewVO.class);
|
||||||
|
q.setSharedHead(true);
|
||||||
|
Set<String> bidSet = new HashSet();
|
||||||
|
|
||||||
|
for(int i = 0; i < bidArray.length; ++i) {
|
||||||
|
bidSet.add(bidArray[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ArriveViewVO[] oldViewVOArray = (ArriveViewVO[])q.query((String[])bidSet.toArray(new String[bidSet.size()]));
|
||||||
|
ArriveBPPlugInPoint point = ArriveBPPlugInPoint.Writeback23For45BP;
|
||||||
|
AroundProcesser<ArriveViewVO> pc = new AroundProcesser(point);
|
||||||
|
this.addBeforeFinalRule(pc, paras);
|
||||||
|
this.addAfterRule(pc, paras);
|
||||||
|
pc.before(oldViewVOArray);
|
||||||
|
String[] names = new String[]{"naccumstorenum", "bletgostate", "naccumletgoinnum"};
|
||||||
|
ViewUpdate<ArriveViewVO> bo = new ViewUpdate();
|
||||||
|
oldViewVOArray = (ArriveViewVO[])bo.update(oldViewVOArray, ArriveItemVO.class, names);
|
||||||
|
pc.after(oldViewVOArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addAfterRule(AroundProcesser<ArriveViewVO> processer, IWriteback23For45Para[] paras) {
|
||||||
|
processer.addAfterRule(new ChkBStoreNumRule(UFBoolean.valueOf(paras[0].isNumUserConfirm())));
|
||||||
|
|
||||||
|
processer.addAfterRule(new ChknaccumstorenumRule());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addBeforeFinalRule(AroundProcesser<ArriveViewVO> processer, IWriteback23For45Para[] paras) {
|
||||||
|
processer.addBeforeFinalRule(new ChkBCreateFaCardRule());
|
||||||
|
processer.addBeforeFinalRule(new UpdateBBStoreNumRule(paras));
|
||||||
|
processer.addBeforeFinalRule(new UpdateViewStoreNumRule(paras));
|
||||||
|
processer.addBeforeFinalRule(new WriteAccumLetgoInnumRule(paras));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkWritePara(IWriteback23For45Para[] paras) {
|
||||||
|
for(IWriteback23For45Para para : paras) {
|
||||||
|
if (StringUtils.isEmpty(para.getHID())) {
|
||||||
|
String message = NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0092");
|
||||||
|
ExceptionUtils.wrappBusinessException(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(para.getBID())) {
|
||||||
|
String message = NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0093");
|
||||||
|
ExceptionUtils.wrappBusinessException(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writebackSagasCheck(IWriteback23For45Para[] paras) {
|
||||||
|
if (!ArrayUtils.isEmpty(paras)) {
|
||||||
|
this.checkWritePara(paras);
|
||||||
|
String[] bidArray = ArrivePublicUtil.getWriteParaBidArray(paras);
|
||||||
|
ViewQuery<ArriveViewVO> q = new ViewQuery(ArriveViewVO.class);
|
||||||
|
q.setSharedHead(true);
|
||||||
|
Set<String> bidSet = new HashSet();
|
||||||
|
|
||||||
|
for(int i = 0; i < bidArray.length; ++i) {
|
||||||
|
bidSet.add(bidArray[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ArriveViewVO[] oldViewVOArray = (ArriveViewVO[])q.query((String[])bidSet.toArray(new String[bidSet.size()]));
|
||||||
|
ArriveBPPlugInPoint point = ArriveBPPlugInPoint.Writeback23For45BP;
|
||||||
|
AroundProcesser<ArriveViewVO> pc = new AroundProcesser(point);
|
||||||
|
this.addBeforeFinalSagasCheckRule(pc, paras);
|
||||||
|
pc.before(oldViewVOArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addBeforeFinalSagasCheckRule(AroundProcesser<ArriveViewVO> processer, IWriteback23For45Para[] paras) {
|
||||||
|
processer.addBeforeFinalRule(new ChkBCreateFaCardRule());
|
||||||
|
processer.addBeforeFinalRule(new UpdateBBStoreNumRule(paras, true));
|
||||||
|
processer.addBeforeFinalRule(new UpdateViewStoreNumRule(paras));
|
||||||
|
processer.addBeforeFinalRule(new WriteAccumLetgoInnumRule(paras, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package nc.bs.pu.m23.writeback.ic.rule;
|
||||||
|
|
||||||
|
import nc.bs.dao.BaseDAO;
|
||||||
|
import nc.bs.dao.DAOException;
|
||||||
|
import nc.impl.pubapp.pattern.rule.IRule;
|
||||||
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||||
|
import nc.jdbc.framework.processor.MapProcessor;
|
||||||
|
import nc.vo.ml.NCLangRes4VoTransl;
|
||||||
|
import nc.vo.pu.m23.entity.ArriveItemVO;
|
||||||
|
import nc.vo.pu.m23.entity.ArriveViewVO;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.lang.UFDouble;
|
||||||
|
import nc.vo.pubapp.pattern.data.ValueUtils;
|
||||||
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ChknaccumstorenumRule implements IRule<ArriveViewVO> {
|
||||||
|
public ChknaccumstorenumRule() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(ArriveViewVO[] vos) {
|
||||||
|
if (vos != null && vos.length != 0) {
|
||||||
|
for(ArriveViewVO view : vos) {
|
||||||
|
try {
|
||||||
|
UFDouble naccumstorenum1= getNaccumstorenum(view.getBVO().getPk_arriveorder_b());
|
||||||
|
} catch (DAOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
UFDouble naccumstorenum = view.getBVO().getNaccumstorenum();
|
||||||
|
Object vbdef33 = view.getBVO().getVbdef33();
|
||||||
|
if(null != vbdef33 && null!=naccumstorenum && naccumstorenum.compareTo(new UFDouble(String.valueOf(vbdef33)))>0) {
|
||||||
|
try {
|
||||||
|
throw new BusinessException("累计入库主数量大于最终需求数量不能生成采购入库!");
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private UFDouble getNaccumstorenum(String pkArriveorderB) throws DAOException {
|
||||||
|
|
||||||
|
// csourcebid
|
||||||
|
String mrlsql = "select naccumstorenum from po_arriveorder_b where pk_arriveorder_b = '" + pkArriveorderB + "' ";
|
||||||
|
Object mrl = new BaseDAO().executeQuery(mrlsql, new ColumnProcessor());
|
||||||
|
return new UFDouble(String.valueOf(mrl));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue