This commit is contained in:
mzr 2024-10-18 19:02:04 +08:00
commit 3dbe8f83cb
2 changed files with 36 additions and 2 deletions

View File

@ -46,6 +46,8 @@ public class ArriveToDhjydImpl implements IArriveToDhjyd {
masterVO.setVsourcecode(arriveHeadVo.getVbillcode());//来源单据号
masterVO.setSrcbilltype(arriveHeadVo.getCtrantypeid());//来源单据号
masterVO.setDapplydate(new UFDate());//报检日期
masterVO.setApprovestatus(-1);//单据审批状态-1自由态
masterVO.setDef1(arriveItems[0].getPk_arriveorder_b());//来源子表主键id
DhjydSlave0VO[] itemVOs = (DhjydSlave0VO[])vos[0].getChildrenVO();//检验单表体信息
if(itemVOs != null && itemVOs.length > 0) {

View File

@ -1,10 +1,13 @@
package nc.impl.pu.m23.approve.rule;
import java.util.ArrayList;
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.ArriveHeaderVO;
import nc.vo.pu.m23.entity.ArriveItemVO;
import nc.vo.pu.m23.entity.ArriveVO;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nccloud.commons.lang.ArrayUtils;
@ -24,12 +27,41 @@ public class ApproveAndSaveDhjyRule extends Object implements IRule<ArriveVO>
try {
IArriveToDhjyd service = (IArriveToDhjyd)NCLocator.getInstance().lookup(IArriveToDhjyd.class);
if (vos != null && vos.length > 0) {
for(int i = 0; i < vos.length; i++) {
service.createDhjyd_RequiresNew(vos[i]);
ArriveVO[] _vos = separateBill(vos);//到货单依据表体拆单处理
for(int i = 0; i < _vos.length; i++) {
service.createDhjyd_RequiresNew(_vos[i]);
}
}
} catch (Exception e) {
ExceptionUtils.wrappException(e);
}
}
/***
* 到货单按照表体拆单
* @author hefk
*
*/
private ArriveVO[] separateBill(ArriveVO[] vos) throws Exception {
ArriveVO _vo = null;//拆分后子到货单定义
ArrayList<ArriveVO> list = new ArrayList<ArriveVO>();//拆分后到货单集合
for(int i = 0; i < vos.length; i++) {
ArriveVO vo = vos[i];
ArriveHeaderVO arriveHeadVo = vo.getHVO();//获取到货单表头信息
ArriveItemVO[] arriveItems = vo.getBVO();//获取到货单表体信息
if(arriveItems != null && arriveItems.length > 0) {
for(int j = 0; j < arriveItems.length; j++) {
_vo = new ArriveVO();//实例生成
_vo.setHVO(arriveHeadVo);//表头设置
_vo.setBVO(new ArriveItemVO[] {arriveItems[j]});//表体设置
list.add(_vo);
}
}
}
return list.toArray(new ArriveVO[0]);
}
}