ic_采购入库新增接口交易类型和供应商默认值赋值
This commit is contained in:
parent
2746f49940
commit
888f728a53
|
@ -7,7 +7,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import nc.impl.pubapp.pattern.data.vo.VOQuery;
|
||||
import nc.vo.ic.org.OrgInfoQuery;
|
||||
import nc.vo.pu.m23.entity.ArriveHeaderVO;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
@ -57,6 +59,9 @@ public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
|
|||
// 1、传入数据基本非空校验
|
||||
BillVOsCheckRule checker =
|
||||
new BillVOsCheckRule(new CheckPurchaseInSaveValidator());
|
||||
|
||||
//添加供应商和交易类型为空赋值
|
||||
fillHeadDataBeforeCheck(vos);
|
||||
checker.check(vos);
|
||||
// 2、编码翻译成pk
|
||||
aggVOList = TransferCodeToPKTool.transferAggVO(aggVOList);
|
||||
|
@ -83,6 +88,28 @@ public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
|
|||
return tool.insert(vos);
|
||||
}
|
||||
|
||||
private void fillHeadDataBeforeCheck(PurchaseInVO[] vos) {
|
||||
for(PurchaseInVO vo : vos) {
|
||||
if(StringUtils.isEmpty(vo.getHead().getVtrantypecode())){
|
||||
//设置默认交易类型
|
||||
vo.getHead().setVtrantypecode("45-01");
|
||||
}
|
||||
if(StringUtils.isEmpty(vo.getHead().getCvendorid())){
|
||||
//根据上游获取数据
|
||||
PurchaseInBodyVO[] bodys = vo.getBodys();
|
||||
String csourcetype = bodys[0].getCsourcetype();
|
||||
String csourcebillhid = bodys[0].getCsourcebillhid();
|
||||
if("23".equals(csourcetype)&&StringUtils.isNotEmpty(csourcebillhid)){
|
||||
//上游到货单
|
||||
ArriveHeaderVO[] srcHVOs = new VOQuery<>(ArriveHeaderVO.class).query(new String[]{csourcebillhid});
|
||||
if(ArrayUtils.isNotEmpty(srcHVOs)){
|
||||
vo.getHead().setCvendorid(srcHVOs[0].getPk_supplier());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PurchaseInVO[] update(List<Map<String, Object>> paramList)
|
||||
throws BusinessException {
|
||||
|
|
Loading…
Reference in New Issue