采购入库增加保存方法

This commit is contained in:
mzr 2025-11-20 14:49:22 +08:00
parent 9c725d2c9a
commit 747e94d84d
2 changed files with 81 additions and 0 deletions

View File

@ -125,6 +125,66 @@ public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
return insert;
}
@Override
public PurchaseInVO[] save_RequiresNew(List<Map<String, Object>> paramList) throws BusinessException {
// MapList转聚合VOList
List<PurchaseInVO> aggVOList = TransferMapToVOTool.transferMapToAggVO(paramList, PurchaseInVO.class);
String creatorCode = aggVOList.get(0).getHead().getCreator();
PurchaseInVO[] vos = aggVOList.toArray(new PurchaseInVO[aggVOList.size()]);
// 设置货位序列号VO
ICAPILocationVOUtils.setLocationVO(ICBillType.PurchaseIn.getCode(), vos);
// 1传入数据基本非空校验
BillVOsCheckRule checker = new BillVOsCheckRule(new CheckPurchaseInSaveValidator());
// 2025年4月23日15点10分 采购入库单接口项目字段为波浪则清空 sdlizheng --start
for (PurchaseInVO vo : vos) {
PurchaseInBodyVO[] bodys = vo.getBodys();
vo.getHead().setStatus(VOStatus.NEW);
if (bodys != null && bodys.length > 0) {
String[] attributeNames = bodys[0].getAttributeNames();
for (PurchaseInBodyVO body : bodys) {
body.setStatus(VOStatus.NEW);
for (String fildName : attributeNames) {
if (body.getAttributeValue(fildName) != null && "~".equals(body.getAttributeValue(fildName))) {
body.setAttributeValue(fildName, null);
}
}
}
}
}
// 2025年4月23日15点10分 采购入库单接口项目字段为波浪则清空 sdlizheng --end
// 添加供应商和交易类型为空赋值
fillHeadDataBeforeCheck(vos);
checker.check(vos);
// 2编码翻译成pk
aggVOList = TransferCodeToPKTool.transferAggVO(aggVOList);
if (aggVOList == null || aggVOList.size() < 1) {
throw new BusinessException("翻译采购入库对象失败,检查数据格式");
}
// 翻译货位
ICAPILocationVOUtils.translate(vos);
// begin没取到财务组织导致的报错在这里给财务组织赋值为库存组织
for (PurchaseInVO vo : vos) {
if (vo.getHead().getCfanaceorgoid() != null) {
continue;
}
String cfinanceoid = (new OrgInfoQuery()).getFinanceOrgIDByCalBodyID(vo.getHead().getPk_org());
String cfinancevid = (new OrgInfoQuery()).getFinanceOrgVIDByCalBodyID(vo.getHead().getPk_org());
vo.getHead().setCfanaceorgoid(cfinanceoid);
vo.getHead().setCfanaceorgvid(cfinancevid);
}
// end
// 3其他数据填充
new PurchaseInSaveFillValue().setDefaultValue(vos);
BillMaintainTool<PurchaseInVO> tool = new BillMaintainTool<PurchaseInVO>(PurchaseInVO.class,
ICBillType.PurchaseIn.getCode());
PurchaseInVO[] insert = tool.insert(vos);
return insert;
}
private UFBoolean checkWmsOrg(List<PurchaseInVO> paramList) throws BusinessException {
if (paramList == null || paramList.size() < 1) {
throw new BusinessException("转换采购入库对象失败,检查报文结构及数据格式");

View File

@ -0,0 +1,21 @@
package nccloud.api.ic.m45;
import nc.vo.ic.m45.entity.PurchaseInVO;
import nc.vo.pub.BusinessException;
import java.util.List;
import java.util.Map;
public interface IAPIPurchaseInMaitain {
PurchaseInVO[] save(List<Map<String, Object>> paramList) throws BusinessException;
PurchaseInVO[] save_RequiresNew(List<Map<String, Object>> paramList) throws BusinessException;
PurchaseInVO[] update(List<Map<String, Object>> paramList) throws BusinessException;
void delete(PurchaseInVO[] vos) throws BusinessException;
PurchaseInVO[] sign(PurchaseInVO[] vos) throws BusinessException;
PurchaseInVO[] unSign(PurchaseInVO[] vos) throws BusinessException;
}