销售订单修订-自定义字段取值调整和删除物料行调整

This commit is contained in:
mzr 2025-03-28 08:36:59 +08:00
parent 5c088e03f6
commit b2bc10147f
1 changed files with 44 additions and 8 deletions

View File

@ -2,7 +2,9 @@ package nccloud.api.impl.so.m30;
import nc.bd.itf.tools.BFPubTools;
import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.bs.framework.common.NCLocator;
import nc.bs.trade.business.HYSuperDMO;
import nc.itf.fi.pub.Currency;
import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil;
import nc.itf.so.m30.self.ISaleOrderMaintain;
@ -11,6 +13,7 @@ import nc.itf.uap.pf.IPFBusiAction;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.jdbc.framework.processor.MapProcessor;
import nc.pubitf.so.m30.api.ISaleOrderQueryAPI;
import nc.vo.bd.defdoc.DefdocVO;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pub.BusinessException;
import nc.vo.pub.VOStatus;
@ -280,15 +283,20 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
// Set<String> delBids = findOtherBids(bipVo.getChildrenVO(), vo.getChildrenVO());
// 设置单据状态
hvo.setStatus(VOStatus.UPDATED);
Map<String, SaleOrderBVO> bvoMap = new HashMap<>();
for (SaleOrderBVO saleOrderBVO : bipVo.getChildrenVO()) {
bvoMap.put(saleOrderBVO.getCsaleorderbid(), saleOrderBVO);
}
// 比较combinBillVOs中的BVO和vos中的BVO
for (SaleOrderBVO bvo : vo.getChildrenVO()) {
bvo.setStatus(VOStatus.UPDATED);
// 设置删除的物料行的状态
for (SaleOrderBVO bipBVO : bipVo.getChildrenVO()) {
if (bvo.getCsaleorderbid().equals(bipBVO.getCsaleorderbid()) && (1 == bipBVO.getDr())) {
// 设置删除的物料行的状态,在bip传的数据中找不到
String csaleorderbid = bvo.getCsaleorderbid();
if (bvoMap.get(csaleorderbid) == null) {
bvo.setStatus(VOStatus.DELETED);
NCCForUAPLogger.debug("findDeletedBids:" + VOStatus.DELETED + ",csaleorderbid = " + bvo.getCsaleorderbid());
}
NCCForUAPLogger.debug("findDeletedBids:" + VOStatus.DELETED + ",csaleorderbid = " + csaleorderbid);
}
}
// 更新 combinBillVO 中的字段为 vos 中的值
@ -516,16 +524,44 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
setMaterl(targetBVO);
}
// 自定义项赋值
targetBVO.setVbdef1(sourceBVO.getVbdef1());// 合同编号
targetBVO.setVbdef5(sourceBVO.getVbdef5());// 合同销售订单号
String vbdef1 = sourceBVO.getVbdef1();// 合同编号
Map<String, String> defList = getDefList("zdy-001");
targetBVO.setVbdef1(defList.getOrDefault(vbdef1, ""));
String vbdef5 = sourceBVO.getVbdef5();// 合同销售订单号
defList.clear();
defList = getDefList("BIP-ddh");
targetBVO.setVbdef5(defList.getOrDefault(vbdef5, ""));
targetBVO.setVbdef10(sourceBVO.getVbdef10());// 项目名称
targetBVO.setVbdef13(sourceBVO.getVbdef13());// 国网行项目号
NCCForUAPLogger.debug(String.format(
"cmaterialvid = [%S], vbdef1 = [%S], vbdef5 = [%S], vbdef10 = [%S], vbdef13 = [%S]",
cmaterialvid, targetBVO.getVbdef1(), targetBVO.getVbdef5(), targetBVO.getVbdef10(), targetBVO.getVbdef13()));
}
}
}
}
/**
* 获取自定义项信息
*/
private Map<String, String> getDefList(String code) {
Map<String, String> map = new HashMap<String, String>();
String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='" + code + "' and dr=0 ) and dr = 0";
try {
DefdocVO[] defdocVOs = (DefdocVO[]) new HYSuperDMO().queryByWhereClause(DefdocVO.class, strWhere);
if (defdocVOs != null && defdocVOs.length > 0) {
for (DefdocVO defdocVO : defdocVOs) {
map.put(defdocVO.getCode().trim(), defdocVO.getPk_defdoc());
}
}
} catch (DAOException e) {
e.printStackTrace();
}
return map;
}
@Override
public SaleOrderVO[] modify(SaleOrderHistoryVO[] vos) throws BusinessException {