ic_采购入库新增接口清空字段为~的值

This commit is contained in:
李正@用友 2025-04-23 15:18:14 +08:00
parent 45b8f4c7a2
commit 9169a5cb9a
1 changed files with 34 additions and 22 deletions

View File

@ -38,12 +38,10 @@ import nccloud.openapi.scmpub.pub.TransferCodeToPKTool;
import nccloud.openapi.scmpub.pub.TransferMapToVOTool;
/**
*
* @version NCC1909
* @Description: 库存采购入库单维护接口实现类
*
* @author: 刘伟
* @date: 2019-5-7 下午3:22:00
* @version NCC1909
*/
public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
@ -59,7 +57,22 @@ public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
// 1传入数据基本非空校验
BillVOsCheckRule checker =
new BillVOsCheckRule(new CheckPurchaseInSaveValidator());
//2025年4月23日15点10分 采购入库单接口项目字段为波浪则清空 sdlizheng --start
for (PurchaseInVO vo : vos) {
PurchaseInBodyVO[] bodys = vo.getBodys();
if (bodys != null && bodys.length > 0) {
String[] attributeNames = bodys[0].getAttributeNames();
for (PurchaseInBodyVO body : bodys) {
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);
@ -69,8 +82,8 @@ public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
ICAPILocationVOUtils.translate(vos);
//begin没取到财务组织导致的报错在这里给财务组织赋值为库存组织
for(PurchaseInVO vo : vos ) {
if(vo.getHead().getCfanaceorgoid()!=null) {
for (PurchaseInVO vo : vos) {
if (vo.getHead().getCfanaceorgoid() != null) {
continue;
}
String cfinanceoid = (new OrgInfoQuery()).getFinanceOrgIDByCalBodyID(vo.getHead().getPk_org());
@ -89,20 +102,20 @@ public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
}
private void fillHeadDataBeforeCheck(PurchaseInVO[] vos) {
for(PurchaseInVO vo : vos) {
if(StringUtils.isEmpty(vo.getHead().getVtrantypecode())){
for (PurchaseInVO vo : vos) {
if (StringUtils.isEmpty(vo.getHead().getVtrantypecode())) {
//设置默认交易类型
vo.getHead().setVtrantypecode("45-01");
}
if(StringUtils.isEmpty(vo.getHead().getCvendorid())){
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)){
if ("23".equals(csourcetype) && StringUtils.isNotEmpty(csourcebillhid)) {
//上游到货单
ArriveHeaderVO[] srcHVOs = new VOQuery<>(ArriveHeaderVO.class).query(new String[]{csourcebillhid});
if(ArrayUtils.isNotEmpty(srcHVOs)){
if (ArrayUtils.isNotEmpty(srcHVOs)) {
vo.getHead().setCvendorid(srcHVOs[0].getPk_supplier());
}
}
@ -129,13 +142,13 @@ public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
}
SCMBillQuery<PurchaseInVO> queryTool =
new SCMBillQuery<PurchaseInVO>(PurchaseInVO.class);
PurchaseInVO[] purInVOs = queryTool.queryVOByIDs(new String[] {
PurchaseInVO[] purInVOs = queryTool.queryVOByIDs(new String[]{
cgeneralhid
});
Map<String, ICLocationVO[]> deleteLoc =
new HashMap<String, ICLocationVO[]>();
// 加载原始单据和货位信息
PurchaseInVO[] originBills = queryTool.queryVOByIDs(new String[] {
PurchaseInVO[] originBills = queryTool.queryVOByIDs(new String[]{
cgeneralhid
});
ICLocationUtil.loadLocationVOs(originBills);
@ -143,8 +156,7 @@ public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
throw new BusinessException(
nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0",
"04008027-0381")/* @res "没找到要修改的入库单信息请检查数据的表头主键cgeneralhid。" */);
}
else {
} else {
List<String> headProFields =
CheckProhibitUpdateFields.getHeadProhibitFields("45");
List<String> bodyProFields =
@ -170,7 +182,7 @@ public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID(
"4008027_0", "04008027-0363")/* @res "表头字段:" */ + attr
+ nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID(
"4008027_0", "04008027-0364")/* @res "不允许修改。" */ );
"4008027_0", "04008027-0364")/* @res "不允许修改。" */);
}
origVO.setAttributeValue(attr, newVO.getAttributeValue(attr));
}
@ -210,21 +222,21 @@ public class APIPurchaseInMaitainImpl implements IAPIPurchaseInMaitain {
nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID(
"4008027_0", "04008027-0366")/* @res "表体字段:" */ + battr
+ nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID(
"4008027_0", "04008027-0364")/* @res "不允许修改。" */ );
"4008027_0", "04008027-0364")/* @res "不允许修改。" */);
}
roigBvo.setAttributeValue(battr, newBvo.getAttributeValue(battr));
bfields.add(battr);
}
//设置货位序列号孙表,把原来的孙表删除修改的货位置为新增
if(null != newBvo.getLocationVOs()) {
if (null != newBvo.getLocationVOs()) {
List<ICLocationVO> allloc = new ArrayList<ICLocationVO>();
if(null != deleteLoc && null != deleteLoc.get(roigBvo.getCgeneralbid())) {
for(ICLocationVO delloc : deleteLoc.get(roigBvo.getCgeneralbid())) {
if (null != deleteLoc && null != deleteLoc.get(roigBvo.getCgeneralbid())) {
for (ICLocationVO delloc : deleteLoc.get(roigBvo.getCgeneralbid())) {
delloc.setStatus(VOStatus.DELETED);
allloc.add(delloc);
}
}
for(ICLocationVO loc : newBvo.getLocationVOs()) {
for (ICLocationVO loc : newBvo.getLocationVOs()) {
loc.setStatus(VOStatus.NEW);
allloc.add(loc);
}