patch_dev_mmpsc_半成品收货单审批推送加工费_sdlizheng_20250616_增加mmpsc模块
This commit is contained in:
parent
96b7ce570c
commit
e785338212
|
@ -100,6 +100,11 @@
|
|||
<classpathentry kind="src" output="bin" path="imag/src/private"/>
|
||||
<classpathentry kind="src" output="bin" path="imag/src/test"/>
|
||||
<classpathentry kind="src" output="bin" path="imag/resources"/>
|
||||
<classpathentry kind="src" output="bin" path="mmpsc/src/public"/>
|
||||
<classpathentry kind="src" output="bin" path="mmpsc/src/client"/>
|
||||
<classpathentry kind="src" output="bin" path="mmpsc/src/private"/>
|
||||
<classpathentry kind="src" output="bin" path="mmpsc/src/test"/>
|
||||
<classpathentry kind="src" output="bin" path="mmpsc/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package nc.bs.mmpsc.pscrecive.bp;
|
||||
|
||||
import nc.bs.mmpsc.pscrecive.plugin.bpplugin.PscrecivePluginPoint;
|
||||
import nc.bs.mmpsc.pscrecive.rule.*;
|
||||
import nc.bs.mmpub.rule.MMVOSagaFrozenValidateRule;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
|
||||
import nc.util.mmf.framework.gc.GCUpdateBPTemplate;
|
||||
import nc.vo.mmpsc.pscrecive.entity.AggPscreciveVO;
|
||||
|
||||
/**
|
||||
* 单据审核的BP
|
||||
*
|
||||
* @since 6.0
|
||||
* @version 2014-01-27 15:02:41
|
||||
* @author computer
|
||||
*/
|
||||
public class PscreciveApproveBP {
|
||||
/**
|
||||
* 单据的持久化
|
||||
*
|
||||
* @param clientBills 单据VO
|
||||
* @param originBills 原始单据VO
|
||||
* @return 保存后的单据VO
|
||||
*/
|
||||
public AggPscreciveVO[] approve(AggPscreciveVO[] clientBills, AggPscreciveVO[] originBills) {
|
||||
// 调用修改模板
|
||||
GCUpdateBPTemplate<AggPscreciveVO> bp = new GCUpdateBPTemplate<AggPscreciveVO>(PscrecivePluginPoint.APPROVE);
|
||||
|
||||
// 执行前规则
|
||||
this.addBeforeRule(bp.getAroundProcesser());
|
||||
|
||||
// 执行后规则
|
||||
this.addAfterRule(bp.getAroundProcesser(), originBills);
|
||||
|
||||
return bp.update(clientBills, originBills);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param processer
|
||||
* @param originBills
|
||||
*/
|
||||
private void addAfterRule(CompareAroundProcesser<AggPscreciveVO> processer, AggPscreciveVO[] originBills) {
|
||||
// 自动业务关闭工序委外订单
|
||||
IRule<AggPscreciveVO> closerule = new CloseOrderRule();
|
||||
processer.addAfterRule(closerule);
|
||||
//添加审批推送加工费结算单逻辑
|
||||
IRule<AggPscreciveVO> pushrule = new Push55E6Rule();
|
||||
processer.addAfterFinalRule(pushrule);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param processer
|
||||
*/
|
||||
private void addBeforeRule(CompareAroundProcesser<AggPscreciveVO> processer) {
|
||||
// 校验冻结状态 added by zhanghr
|
||||
IRule<AggPscreciveVO> checkFrozenRule = new MMVOSagaFrozenValidateRule<AggPscreciveVO>(true);
|
||||
processer.addBeforeRule(checkFrozenRule);
|
||||
// 检查状态
|
||||
IRule<AggPscreciveVO> irule = new ApproveBillStatusRule();
|
||||
processer.addBeforeRule(irule);
|
||||
// 工序委外订单状态检查规则
|
||||
IRule<AggPscreciveVO> orderCheckRule = new CheckPscOrderStatusRule();
|
||||
processer.addBeforeRule(orderCheckRule);
|
||||
// 补充核销状态
|
||||
IRule<AggPscreciveVO> vrule = new ApproveVerifyStatusRule();
|
||||
processer.addBeforeRule(vrule);
|
||||
// 修改审核信息
|
||||
IRule<AggPscreciveVO> frule = new FillApprovePsnRule();
|
||||
processer.addBeforeRule(frule);
|
||||
// 更新审核状态
|
||||
IRule<AggPscreciveVO> updaterule = new ApproveStatusUpdateRule();
|
||||
processer.addBeforeRule(updaterule);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package nc.bs.mmpsc.pscrecive.bp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import nc.bs.mmpsc.pscrecive.plugin.bpplugin.PscrecivePluginPoint;
|
||||
import nc.bs.mmpsc.pscrecive.rule.*;
|
||||
import nc.bs.mmpub.rule.MMVOSagaFrozenValidateRule;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
|
||||
import nc.util.mmf.framework.base.MMArrayUtil;
|
||||
import nc.util.mmf.framework.base.MMVOUtil;
|
||||
import nc.util.mmf.framework.gc.GCUpdateBPTemplate;
|
||||
import nc.vo.mmpsc.pscrecive.entity.AggPscreciveVO;
|
||||
import nc.vo.mmpsc.pscrecive.entity.PscReciveTransTypeVO;
|
||||
import nc.vo.mmpsc.pscrecive.util.QueryUtil;
|
||||
import nc.vo.mmpsc.pscrecive.util.VOChangUtil;
|
||||
|
||||
/**
|
||||
* 收货单自动审核的BP
|
||||
*
|
||||
* @since 6.0
|
||||
* @version 2014-01-27 15:02:41
|
||||
* @author computer
|
||||
*/
|
||||
public class PscreciveAutoApproveBP {
|
||||
/**
|
||||
* 单据的持久化
|
||||
*
|
||||
* @param clientBills 单据VO
|
||||
* @param originBills 原始单据VO
|
||||
* @return 保存后的单据VO
|
||||
*/
|
||||
public AggPscreciveVO[] approve(AggPscreciveVO[] clientBills) {
|
||||
AggPscreciveVO[] approveVOs = this.filterAutoApprove(clientBills);
|
||||
if (MMArrayUtil.isEmpty(approveVOs)) {
|
||||
return clientBills;
|
||||
}
|
||||
AggPscreciveVO[] originBills = VOChangUtil.clone(approveVOs);
|
||||
// 调用修改模板
|
||||
GCUpdateBPTemplate<AggPscreciveVO> bp = new GCUpdateBPTemplate<AggPscreciveVO>(PscrecivePluginPoint.APPROVE);
|
||||
|
||||
// 执行前规则
|
||||
this.addBeforeRule(bp.getAroundProcesser());
|
||||
|
||||
// 执行后规则
|
||||
this.addAfterRule(bp.getAroundProcesser(), originBills);
|
||||
|
||||
AggPscreciveVO[] returnBills = bp.update(clientBills, originBills);
|
||||
return new QueryUtil().queryAfterUpdate(returnBills);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param processer
|
||||
* @param originBills
|
||||
*/
|
||||
private void addAfterRule(CompareAroundProcesser<AggPscreciveVO> processer, AggPscreciveVO[] originBills) {
|
||||
//暂时没有规则
|
||||
//添加审批推送加工费结算单逻辑
|
||||
IRule<AggPscreciveVO> pushrule = new Push55E6Rule();
|
||||
processer.addAfterFinalRule(pushrule);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param processer
|
||||
*/
|
||||
private void addBeforeRule(CompareAroundProcesser<AggPscreciveVO> processer) {
|
||||
// 校验冻结状态 added by zhanghr
|
||||
IRule<AggPscreciveVO> checkFrozenRule = new MMVOSagaFrozenValidateRule<AggPscreciveVO>(true);
|
||||
processer.addBeforeRule(checkFrozenRule);
|
||||
// 检查状态
|
||||
IRule<AggPscreciveVO> irule = new ApproveBillStatusRule();
|
||||
processer.addBeforeRule(irule);
|
||||
// 补充核销状态
|
||||
IRule<AggPscreciveVO> vrule = new ApproveVerifyStatusRule();
|
||||
processer.addBeforeRule(vrule);
|
||||
// 修改审核信息
|
||||
IRule<AggPscreciveVO> frule = new FillApprovePsnRule();
|
||||
processer.addBeforeRule(frule);
|
||||
// 更新审核状态
|
||||
IRule<AggPscreciveVO> updaterule = new ApproveStatusUpdateRule();
|
||||
processer.addBeforeRule(updaterule);
|
||||
// 自动业务关闭工序委外订单
|
||||
IRule<AggPscreciveVO> closerule = new CloseOrderRule();
|
||||
processer.addBeforeRule(closerule);
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤出需要自动审核
|
||||
*
|
||||
* @param nowBills
|
||||
* @return
|
||||
*/
|
||||
private AggPscreciveVO[] filterAutoApprove(AggPscreciveVO[] nowBills) {
|
||||
if (nowBills == null || nowBills.length == 0) {
|
||||
return null;
|
||||
}
|
||||
List<String> typeid = new ArrayList<String>();
|
||||
for (AggPscreciveVO bill : nowBills) {
|
||||
typeid.add(bill.getHeadVO().getCtrantype());
|
||||
}
|
||||
// 查询哪些交易类型需要自动审核
|
||||
Map<String, Boolean> autoMap = this.isAutoApprove(typeid.toArray(new String[0]));
|
||||
// 过滤
|
||||
List<AggPscreciveVO> reList = new ArrayList<AggPscreciveVO>();
|
||||
for (AggPscreciveVO bill : nowBills) {
|
||||
Boolean is = autoMap.get(bill.getHeadVO().getCtrantype());
|
||||
if (is != null && is.booleanValue()) {
|
||||
reList.add(bill);
|
||||
}
|
||||
}
|
||||
if (reList.size() > 0) {
|
||||
return reList.toArray(new AggPscreciveVO[0]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否自动审核
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
private Map<String, Boolean> isAutoApprove(String[] ids) {
|
||||
// 查询
|
||||
PscReciveTransTypeVO[] types = MMVOUtil.query(PscReciveTransTypeVO.class, PscReciveTransTypeVO.CTRANTYPEID, ids);
|
||||
Map<String, Boolean> map = new HashMap<String, Boolean>();
|
||||
if (MMArrayUtil.isEmpty(types)) {
|
||||
return map;
|
||||
}
|
||||
// 构造结果
|
||||
for (PscReciveTransTypeVO type : types) {
|
||||
if (type.getBautoapprove() != null && type.getBautoapprove().booleanValue()) {
|
||||
map.put(type.getCtrantypeid(), Boolean.TRUE);
|
||||
}
|
||||
else {
|
||||
map.put(type.getCtrantypeid(), Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package nc.bs.mmpsc.pscrecive.rule;
|
||||
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.itf.mmpsc.pscsettle.ISettleMaintain;
|
||||
import nc.itf.uap.pf.IPfExchangeService;
|
||||
import nc.util.mmf.framework.base.MMArrayUtil;
|
||||
import nc.util.mmf.framework.base.MMNumberUtil;
|
||||
import nc.vo.mmpsc.pscrecive.entity.AggPscreciveVO;
|
||||
import nc.vo.mmpsc.pscrecive.entity.PscreciveItemVO;
|
||||
import nc.vo.mmpsc.pscrecive.entity.PscreciveQcVO;
|
||||
import nc.vo.mmpsc.pscrecive.enumeration.PscReciveProcessMethodEnum;
|
||||
import nc.vo.mmpsc.pscrecive.enumeration.PscReciveStatusEnum;
|
||||
import nc.vo.mmpsc.pscsettle.entity.AggSettleVO;
|
||||
import nc.vo.mmpsc.pscsettle.entity.SettleHeadVO;
|
||||
import nc.vo.mmpsc.pscsettle.entity.SettleItemVO;
|
||||
import nc.vo.pub.compiler.PfParameterVO;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Classname Push55E6Rule
|
||||
* @Description TODO
|
||||
* @Version 1.0.0
|
||||
* @Date 2025/6/16 14:40
|
||||
* @Created by ame
|
||||
*/
|
||||
public class Push55E6Rule implements IRule<AggPscreciveVO> {
|
||||
|
||||
@Override
|
||||
public void process(AggPscreciveVO[] aggvos) {
|
||||
if(aggvos==null || aggvos.length<1){
|
||||
return;
|
||||
}
|
||||
ISettleMaintain service = NCLocator.getInstance().lookup(ISettleMaintain.class);
|
||||
try {
|
||||
AggPscreciveVO[] newAggvos = this.fiterData(aggvos);
|
||||
if(newAggvos!=null && newAggvos.length>0){
|
||||
IPfExchangeService ef = NCLocator.getInstance().lookup(IPfExchangeService.class);
|
||||
AggSettleVO[] aggSettleVOs = (AggSettleVO[])ef.runChangeDataAryNeedClassify("55E5", "55E6", newAggvos, (PfParameterVO)null, 1);
|
||||
if (aggSettleVOs != null && aggSettleVOs.length > 0) {
|
||||
this.fillData(aggSettleVOs);
|
||||
service.insertSettle(aggSettleVOs);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.wrappBusinessException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void fillData(AggSettleVO[] aggSettleVOs) {
|
||||
for (AggSettleVO aggSettleVO : aggSettleVOs) {
|
||||
SettleHeadVO headVO = aggSettleVO.getHeadVO();
|
||||
SettleItemVO[] itemVO = aggSettleVO.getItemVO();
|
||||
headVO.setStatus(2);
|
||||
headVO.setFstatusflag(1);
|
||||
//itemVOµÄvrowno¸ù¾ÝÐòºÅÉèÖÃÖµ£ºi*10
|
||||
for (int i = 0; i < itemVO.length; i++) {
|
||||
itemVO[i].setStatus(2);
|
||||
itemVO[i].setVrowno(String.valueOf((i+1) * 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private AggPscreciveVO[] fiterData(AggPscreciveVO[] aggPscreciveVOs) {
|
||||
AggPscreciveVO[] statusvos = this.fiterDataStatus(aggPscreciveVOs);
|
||||
AggPscreciveVO[] qcvos = this.fiterDataQc(statusvos);
|
||||
return qcvos;
|
||||
}
|
||||
|
||||
private AggPscreciveVO[] fiterDataStatus(AggPscreciveVO[] vos) {
|
||||
List<AggPscreciveVO> aggPscreciveVOs = new ArrayList<AggPscreciveVO>();
|
||||
for (AggPscreciveVO aggPscreciveVO : vos) {
|
||||
if (PscReciveStatusEnum.APPROVED.equalsValue(aggPscreciveVO.getHeadVO().getFstatusflag())) {
|
||||
aggPscreciveVOs.add(aggPscreciveVO);
|
||||
}
|
||||
}
|
||||
return aggPscreciveVOs.toArray(new AggPscreciveVO[aggPscreciveVOs.size()]);
|
||||
}
|
||||
|
||||
private AggPscreciveVO[] fiterDataQc(AggPscreciveVO[] vos) {
|
||||
if (MMArrayUtil.isEmpty(vos)) {
|
||||
return null;
|
||||
}
|
||||
List<AggPscreciveVO> aggPscreciveVOs = new ArrayList<AggPscreciveVO>();
|
||||
for (AggPscreciveVO aggPscreciveVO : vos) {
|
||||
List<PscreciveItemVO> pscreciveItemVOs = new ArrayList<PscreciveItemVO>();
|
||||
for (PscreciveItemVO pscreciveItemVO : aggPscreciveVO.getItemVO()) {
|
||||
PscreciveQcVO[] pscreciveQcVOs = pscreciveItemVO.getCpscrecive_qcid();
|
||||
if (MMArrayUtil.isNotEmpty(pscreciveQcVOs)) {
|
||||
UFDouble sumNum = UFDouble.ZERO_DBL;
|
||||
UFDouble sumAstNum = UFDouble.ZERO_DBL;
|
||||
for (PscreciveQcVO pscreciveQcVO : pscreciveQcVOs) {
|
||||
if (PscReciveProcessMethodEnum.PRODIN.equalsValue(pscreciveQcVO.getFqprocessmethod())
|
||||
|| PscReciveProcessMethodEnum.MATERREJECT
|
||||
.equalsValue(pscreciveQcVO.getFqprocessmethod())
|
||||
|| PscReciveProcessMethodEnum.REWORK.equalsValue(pscreciveQcVO.getFqprocessmethod())) {
|
||||
sumNum = MMNumberUtil.add(sumNum, pscreciveQcVO.getNqnum());
|
||||
sumAstNum = MMNumberUtil.add(sumAstNum, pscreciveQcVO.getNqastnum());
|
||||
}
|
||||
}
|
||||
if (MMNumberUtil.isGtZero(sumNum) && MMNumberUtil.isGtZero(sumAstNum)) {
|
||||
pscreciveItemVO.setProcessastnum(sumAstNum);
|
||||
pscreciveItemVO.setProcessnum(sumNum);
|
||||
pscreciveItemVOs.add(pscreciveItemVO);
|
||||
}
|
||||
} else if (aggPscreciveVO.getHeadVO().getBreturn() != null
|
||||
&& aggPscreciveVO.getHeadVO().getBreturn().booleanValue()) {
|
||||
pscreciveItemVO.setProcessastnum(MMNumberUtil.toNegValue(pscreciveItemVO.getNbastrecivenum()));
|
||||
pscreciveItemVO.setProcessnum(MMNumberUtil.toNegValue(pscreciveItemVO.getNbrecivenum()));
|
||||
pscreciveItemVOs.add(pscreciveItemVO);
|
||||
}
|
||||
}
|
||||
if (pscreciveItemVOs.size() > 0) {
|
||||
aggPscreciveVO.setChildrenVO(pscreciveItemVOs.toArray(new PscreciveItemVO[0]));
|
||||
aggPscreciveVOs.add(aggPscreciveVO);
|
||||
}
|
||||
}
|
||||
return aggPscreciveVOs.toArray(new AggPscreciveVO[aggPscreciveVOs.size()]);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue