# WARNING: head commit changed in the meantime

到货单生成接口
This commit is contained in:
hefengkai 2024-10-16 19:02:00 +08:00
parent baba360775
commit df2998ce3f
3 changed files with 172 additions and 0 deletions

View File

@ -0,0 +1,48 @@
package nc.impl.pu.dhjyd.dhjydmaster;
import java.util.ArrayList;
import java.util.Map;
import nc.bs.framework.common.NCLocator;
import nc.bs.pub.pf.PfUtilTools;
import nc.itf.pu.dhjyd.dhjydmaster.IArriveToDhjyd;
import nc.itf.pu.dhjyd.dhjydmaster.IDhjydMasterVOService;
import nc.vo.pu.dhjyd.AggDhjydMasterVO;
import nc.vo.pu.m23.entity.ArriveVO;
public class ArriveToDhjydImpl implements IArriveToDhjyd {
/***
* 到货单生成到货检验单
* @param ArriveVO
* @return
*/
@Override
public Map<String, String> createDhjyd_RequiresNew(ArriveVO arriveVO) {
try {
//到货单集合获取
ArrayList<ArriveVO> arrayList = new ArrayList<ArriveVO>();
arrayList.add(arriveVO);
// 单据转换 到货单-->到货检验单
AggDhjydMasterVO[] vos = (AggDhjydMasterVO[]) PfUtilTools.runChangeDataAry("23", "DHJY",
arrayList.toArray(new ArriveVO[0]));
// 到货检验单保存-生成保存态
IDhjydMasterVOService dhjydMasterVO = NCLocator.getInstance().lookup(IDhjydMasterVOService.class);
dhjydMasterVO.saveAggDhjydMasterVO(vos);
} catch (Exception e) {
String errMsg = e.toString();
if (e.getCause() != null) {
errMsg = e.getCause().toString();
}
}
// TODO Auto-generated method stub
return null;
}
}

View File

@ -0,0 +1,93 @@
package nc.impl.pu.m23.approve.action;
import nc.bs.pu.m23.fa.rule.CanStoreNumRule;
import nc.bs.pu.m23.plugin.ArriveActionPlugInPoint;
import nc.bs.pub.compiler.AbstractCompiler2;
import nc.bs.scmpub.pf.PfParameterUtil;
import nc.bs.scmpub.rule.VOSagaFrozenValidateRule;
import nc.impl.pu.m23.approve.rule.ApproveAfterEventRule;
import nc.impl.pu.m23.approve.rule.ApproveAndQualityCheckRule;
import nc.impl.pu.m23.approve.rule.ApproveAndSaveDhjyRule;
import nc.impl.pu.m23.approve.rule.ApproveBeforeEventRule;
import nc.impl.pu.m23.approve.rule.ApproveFilterRule;
import nc.impl.pu.m23.approve.rule.ChkCanApproveRule;
import nc.impl.pubapp.pattern.data.bill.BillUpdate;
import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pu.m23.entity.ArriveVO;
import nc.vo.pu.m23.rule.ArriveATPUpdateRule;
import nc.vo.pu.pub.enumeration.PuBusiLogActionCode;
import nc.vo.pu.pub.enumeration.PuBusiLogPathCode;
import nc.vo.pu.pub.rule.busilog.WriteOperateLogRule;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
public class ArriveApproveAction
{
public ArriveVO[] approveArrive(ArriveVO[] voArray, AbstractCompiler2 script) {
PfParameterUtil<ArriveVO> util = new PfParameterUtil<ArriveVO>((script == null) ? null : script.getPfParameterVO(), voArray);
ArriveVO[] originBills = (ArriveVO[])util.getOrginBills();
AroundProcesser<ArriveVO> processer = new AroundProcesser<ArriveVO>(ArriveActionPlugInPoint.ArriveApproveAction);
addBeforeRule(processer);
addAfterRule(processer);
addATPRule(processer);
(new ArriveATPUpdateRule(true)).process(voArray);
processer.before(voArray);
if (null != script) {
try {
script.procFlowBacth(script.getPfParameterVO());
} catch (Exception e) {
ExceptionUtils.wrappException(e);
}
}
if (script == null || (script.getPfParameterVO()).m_preValueVos == null) {
String msg = NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0115");
ExceptionUtils.wrappBusinessException(msg);
return null;
}
BillUpdate<ArriveVO> update = new BillUpdate<ArriveVO>();
ArriveVO[] returnVos = (ArriveVO[])update.update(voArray, originBills);
processer.after(returnVos);
return returnVos;
}
private void addAfterRule(AroundProcesser<ArriveVO> processer) {
processer.addAfterRule(new WriteOperateLogRule(PuBusiLogPathCode.puarrivalApprovePath
.getCode(), PuBusiLogActionCode.approve
.getCode()));
processer.addAfterRule(new ApproveFilterRule());
processer.addAfterRule(new ApproveAfterEventRule());
processer.addAfterRule(new ApproveAndQualityCheckRule());
//到货单审批后生成检验单-hefk
processer.addAfterRule(new ApproveAndSaveDhjyRule());
}
private void addATPRule(AroundProcesser<ArriveVO> processer) { processer.addAfterRule(new ArriveATPUpdateRule(false)); }
private void addBeforeRule(AroundProcesser<ArriveVO> processer) {
processer.addBeforeRule(new VOSagaFrozenValidateRule());
processer.addBeforeRule(new ChkCanApproveRule());
processer.addBeforeRule(new ApproveBeforeEventRule());
processer.addBeforeRule(new CanStoreNumRule());
}
}

View File

@ -0,0 +1,31 @@
package nc.impl.pu.m23.approve.rule;
import java.util.Map;
import nc.bs.framework.common.NCLocator;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.itf.pu.dhjyd.dhjydmaster.IArriveToDhjyd;
import nc.vo.pu.m23.entity.ArriveVO;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nccloud.commons.lang.ArrayUtils;
/***
* 到货单审核完成生成检验单
* @author hefk
*
*/
public class ApproveAndSaveDhjyRule extends Object implements IRule<ArriveVO>
{
public void process(ArriveVO[] vos) {
if (ArrayUtils.isEmpty(vos)) {
return;
}
try {
IArriveToDhjyd service = (IArriveToDhjyd)NCLocator.getInstance().lookup(IArriveToDhjyd.class);
Map<String,String> result = service.createDhjyd_RequiresNew(vos[0]);
} catch (Exception e) {
ExceptionUtils.wrappException(e);
}
}
}