bom和物料增加默认值
This commit is contained in:
parent
938f0fbc1c
commit
ffa8c297e2
|
@ -0,0 +1,85 @@
|
||||||
|
package nc.bs.bd.pfxx.plugin;
|
||||||
|
|
||||||
|
import nccloud.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
import nc.bs.dao.BaseDAO;
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
|
import nc.bs.pfxx.ISwapContext;
|
||||||
|
import nc.itf.bd.material.marbasclass.IMaterialBasClassService;
|
||||||
|
import nc.vo.bd.material.marbasclass.MarBasClassVO;
|
||||||
|
import nc.vo.pfxx.auxiliary.AggxsysregisterVO;
|
||||||
|
import nc.vo.pfxx.util.PfxxPluginUtils;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.VOStatus;
|
||||||
|
import java.util.Collection;
|
||||||
|
/**
|
||||||
|
* 物料基本分类的外部交换平台导入插件
|
||||||
|
*
|
||||||
|
* @author jiangjuna
|
||||||
|
* @since NC6.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MarBasClassPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
|
||||||
|
|
||||||
|
private IMaterialBasClassService service = null;
|
||||||
|
|
||||||
|
private BaseDAO baseDAO = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object processBill(Object vo, ISwapContext swapContext, AggxsysregisterVO aggxsysvo)
|
||||||
|
throws BusinessException {
|
||||||
|
MarBasClassVO classVO = (MarBasClassVO) vo;
|
||||||
|
String pk = PfxxPluginUtils.queryBillPKBeforeSaveOrUpdate(swapContext.getBilltype(), swapContext.getDocID());
|
||||||
|
//合并start
|
||||||
|
if (swapContext.getSender().equals("BIP_NC")) {
|
||||||
|
String whereSql = MarBasClassVO.CODE + "='" + classVO.getCode() + "'";
|
||||||
|
Collection<MarBasClassVO> cols = new BaseDAO().retrieveByClause(MarBasClassVO.class, whereSql);
|
||||||
|
if (cols != null && !cols.isEmpty()) {
|
||||||
|
MarBasClassVO[] vos = cols.toArray(new MarBasClassVO[0]);
|
||||||
|
pk = vos[0].getPk_marbasclass();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//合并end
|
||||||
|
if (StringUtils.isBlank(pk)) {
|
||||||
|
classVO.setStatus(VOStatus.NEW);
|
||||||
|
classVO = getService().insertMaterialBasClass(classVO);
|
||||||
|
PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(), swapContext.getDocID(),
|
||||||
|
classVO.getPrimaryKey());
|
||||||
|
} else {
|
||||||
|
classVO = getService().updateMaterialBasClass(getUpdateVO(classVO, pk));
|
||||||
|
}
|
||||||
|
return classVO.getPrimaryKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
private MarBasClassVO getUpdateVO(MarBasClassVO classVO, String pk) throws BusinessException {
|
||||||
|
MarBasClassVO oldVO = (MarBasClassVO) getBaseDAO().retrieveByPK(MarBasClassVO.class, pk,
|
||||||
|
new String[] { MarBasClassVO.CREATOR, MarBasClassVO.CREATIONTIME, MarBasClassVO.INNERCODE,
|
||||||
|
MarBasClassVO.ENABLESTATE });
|
||||||
|
if (oldVO == null) {
|
||||||
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("bdpub", "0bdpub0057")
|
||||||
|
/* @res "该数据已被删除" */);
|
||||||
|
}
|
||||||
|
classVO.setPrimaryKey(pk);
|
||||||
|
classVO.setInnercode(oldVO.getInnercode());
|
||||||
|
classVO.setCreator(oldVO.getCreator());
|
||||||
|
classVO.setCreationtime(oldVO.getCreationtime());
|
||||||
|
classVO.setEnablestate(oldVO.getEnablestate());
|
||||||
|
classVO.setStatus(VOStatus.UPDATED);
|
||||||
|
return classVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BaseDAO getBaseDAO() {
|
||||||
|
if (baseDAO == null) {
|
||||||
|
baseDAO = new BaseDAO();
|
||||||
|
}
|
||||||
|
return baseDAO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IMaterialBasClassService getService() {
|
||||||
|
if (service == null) {
|
||||||
|
service = NCLocator.getInstance().lookup(IMaterialBasClassService.class);
|
||||||
|
}
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -60,6 +60,8 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
|
||||||
pk = vos[0].getPk_material();
|
pk = vos[0].getPk_material();
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(pk)) {
|
if (StringUtils.isBlank(pk)) {
|
||||||
|
//ĬÈÏÖµ
|
||||||
|
materialVO.setIsfeature(UFBoolean.FALSE);
|
||||||
materialVO = this.insertMaterialVO(materialVO);
|
materialVO = this.insertMaterialVO(materialVO);
|
||||||
PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(), swapContext.getDocID(), materialVO.getPrimaryKey());
|
PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(), swapContext.getDocID(), materialVO.getPrimaryKey());
|
||||||
return materialVO.getPrimaryKey();
|
return materialVO.getPrimaryKey();
|
||||||
|
@ -229,6 +231,8 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
|
||||||
materialVO.setTs(oldVO.getTs());
|
materialVO.setTs(oldVO.getTs());
|
||||||
materialVO.setMaterialconvert(this.getMaterialConvertVOs(materialVO));
|
materialVO.setMaterialconvert(this.getMaterialConvertVOs(materialVO));
|
||||||
materialVO.setMaterialtaxtype(this.getMaterialTaxTypeVOs(materialVO));
|
materialVO.setMaterialtaxtype(this.getMaterialTaxTypeVOs(materialVO));
|
||||||
|
materialVO.setIsfeature(UFBoolean.FALSE);
|
||||||
|
|
||||||
return materialVO;
|
return materialVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
package nc.bs.bd.pfxx.plugin;
|
||||||
|
|
||||||
|
import nccloud.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
import nc.bs.dao.BaseDAO;
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
|
import nc.bs.pfxx.ISwapContext;
|
||||||
|
import nc.itf.bd.material.measdoc.IMeasdocService;
|
||||||
|
import nc.vo.bd.material.marbasclass.MarBasClassVO;
|
||||||
|
import nc.vo.bd.material.measdoc.MeasdocVO;
|
||||||
|
import nc.vo.pfxx.auxiliary.AggxsysregisterVO;
|
||||||
|
import nc.vo.pfxx.util.PfxxPluginUtils;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.VOStatus;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
/**
|
||||||
|
* 计量单位的外部交换平台导入插件
|
||||||
|
*
|
||||||
|
* @author jiangjuna
|
||||||
|
* @since NC6.0
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MeasdocPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
|
||||||
|
|
||||||
|
private IMeasdocService service = null;
|
||||||
|
|
||||||
|
private BaseDAO baseDAO = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object processBill(Object vo, ISwapContext swapContext, AggxsysregisterVO aggxsysvo)
|
||||||
|
throws BusinessException {
|
||||||
|
MeasdocVO measdocVO = (MeasdocVO) vo;
|
||||||
|
String pk = PfxxPluginUtils.queryBillPKBeforeSaveOrUpdate(swapContext.getBilltype(), swapContext.getDocID());
|
||||||
|
//合并start
|
||||||
|
if (swapContext.getSender().equals("BIP_NC")) {
|
||||||
|
String whereSql = MarBasClassVO.CODE + "='" + measdocVO.getCode() + "'";
|
||||||
|
Collection<MeasdocVO> cols = new BaseDAO().retrieveByClause(MeasdocVO.class, whereSql);
|
||||||
|
if (cols != null && !cols.isEmpty()) {
|
||||||
|
MeasdocVO[] vos = cols.toArray(new MeasdocVO[0]);
|
||||||
|
pk = vos[0].getPk_measdoc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//合并end
|
||||||
|
if (StringUtils.isBlank(pk)) {
|
||||||
|
measdocVO.setStatus(VOStatus.NEW);
|
||||||
|
measdocVO = getService().insertMeasdocForPfxx(measdocVO);
|
||||||
|
PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(), swapContext.getDocID(),
|
||||||
|
measdocVO.getPrimaryKey());
|
||||||
|
} else {
|
||||||
|
getService().updateMeasdocForPfxx(getUpdateVO(measdocVO, pk));
|
||||||
|
}
|
||||||
|
return measdocVO.getPrimaryKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
private MeasdocVO getUpdateVO(MeasdocVO measdocVO, String pk) throws BusinessException {
|
||||||
|
MeasdocVO oldVO = (MeasdocVO) getBaseDAO().retrieveByPK(MeasdocVO.class, pk,
|
||||||
|
new String[] { MeasdocVO.CREATOR, MeasdocVO.CREATIONTIME, MeasdocVO.OPPDIMEN, MeasdocVO.BASECODEFLAG });
|
||||||
|
if (oldVO == null) {
|
||||||
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("bdpub", "0bdpub0057")
|
||||||
|
/* @res "该数据已被删除" */);
|
||||||
|
}
|
||||||
|
measdocVO.setPrimaryKey(pk);
|
||||||
|
measdocVO.setCreator(oldVO.getCreator());
|
||||||
|
measdocVO.setCreationtime(oldVO.getCreationtime());
|
||||||
|
measdocVO.setOppdimen(oldVO.getOppdimen());
|
||||||
|
measdocVO.setBasecodeflag(oldVO.getBasecodeflag());
|
||||||
|
measdocVO.setStatus(VOStatus.UPDATED);
|
||||||
|
return measdocVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BaseDAO getBaseDAO() {
|
||||||
|
if (baseDAO == null) {
|
||||||
|
baseDAO = new BaseDAO();
|
||||||
|
}
|
||||||
|
return baseDAO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IMeasdocService getService() {
|
||||||
|
if (service == null) {
|
||||||
|
service = NCLocator.getInstance().lookup(IMeasdocService.class);
|
||||||
|
}
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
package nc.bs.bd.pfxx.plugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import nc.bs.dao.BaseDAO;
|
||||||
|
import nccloud.commons.lang.ArrayUtils;
|
||||||
|
import nccloud.commons.lang.StringUtils;
|
||||||
|
import java.util.Collection;
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
|
import nc.bs.pfxx.ISwapContext;
|
||||||
|
import nc.itf.bd.psn.psndoc.IPsndocService;
|
||||||
|
import nc.md.data.access.NCObject;
|
||||||
|
import nc.md.model.MetaDataException;
|
||||||
|
import nc.md.persist.framework.IMDPersistenceQueryService;
|
||||||
|
import nc.vo.bd.psn.PsndocVO;
|
||||||
|
import nc.vo.bd.psn.PsnjobVO;
|
||||||
|
import nc.vo.pfxx.auxiliary.AggxsysregisterVO;
|
||||||
|
import nc.vo.pfxx.util.PfxxPluginUtils;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.VOStatus;
|
||||||
|
|
||||||
|
public class PsndocPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
|
||||||
|
|
||||||
|
private IPsndocService service = null;
|
||||||
|
private IMDPersistenceQueryService queryService = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object processBill(Object vo, ISwapContext swapContext, AggxsysregisterVO aggxsysvo)
|
||||||
|
throws BusinessException {
|
||||||
|
|
||||||
|
// 1.得到转换后的VO数据,取决于向导第一步注册的VO信息
|
||||||
|
PsndocVO resvo = (PsndocVO) vo;
|
||||||
|
checkBeforeImport(resvo);
|
||||||
|
String vopk = PfxxPluginUtils.queryBillPKBeforeSaveOrUpdate(swapContext.getBilltype(), swapContext.getDocID(),
|
||||||
|
swapContext.getOrgPk());
|
||||||
|
//合并start
|
||||||
|
if (swapContext.getSender().equals("BIP_NC")) {
|
||||||
|
String whereSql = PsndocVO.CODE + "='" + resvo.getCode()+ "'";
|
||||||
|
Collection<PsndocVO> cols = new BaseDAO().retrieveByClause(PsndocVO.class, whereSql);
|
||||||
|
if (cols != null && !cols.isEmpty()) {
|
||||||
|
PsndocVO[] vos = cols.toArray(new PsndocVO[0]);
|
||||||
|
vopk = vos[0].getPk_psndoc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//合并end
|
||||||
|
resvo = getPsndocVOForSave(resvo, vopk);
|
||||||
|
if (StringUtils.isBlank(vopk)) {
|
||||||
|
resvo = getPsndocService().insertPsndoc(resvo, false);
|
||||||
|
PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(), swapContext.getDocID(),
|
||||||
|
swapContext.getOrgPk(), resvo.getPrimaryKey());
|
||||||
|
return resvo.getPrimaryKey();
|
||||||
|
} else {
|
||||||
|
getPsndocService().updatePsndoc(resvo, false);
|
||||||
|
return vopk;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkBeforeImport(PsndocVO resvo) throws BusinessException {
|
||||||
|
if (ArrayUtils.isEmpty(resvo.getPsnjobs())) {
|
||||||
|
throw new BusinessException(
|
||||||
|
nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("10140psn", "010140psn0059"));// 人员必须有一条任职信息
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PsndocVO getPsndocVOForSave(PsndocVO resvo, String vopk) throws MetaDataException, BusinessException {
|
||||||
|
List<PsnjobVO> list = new ArrayList<PsnjobVO>();
|
||||||
|
addPsnjobVOToList(resvo, list, VOStatus.NEW);
|
||||||
|
if (StringUtils.isEmpty(vopk)) {
|
||||||
|
resvo.setStatus(VOStatus.NEW);
|
||||||
|
} else {
|
||||||
|
PsndocVO oldvo = queryOldPSndovCO(vopk);
|
||||||
|
resvo.setPrimaryKey(vopk);
|
||||||
|
resvo.setStatus(VOStatus.UPDATED);
|
||||||
|
resvo.setCreationtime(oldvo.getCreationtime());
|
||||||
|
resvo.setCreator(oldvo.getCreator());
|
||||||
|
addPsnjobVOToList(oldvo, list, VOStatus.DELETED);
|
||||||
|
}
|
||||||
|
resvo.setPsnjobs(list.toArray(new PsnjobVO[0]));
|
||||||
|
return resvo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addPsnjobVOToList(PsndocVO resvo, List<PsnjobVO> list, int status) {
|
||||||
|
PsnjobVO[] jobvos = resvo.getPsnjobs();
|
||||||
|
if (jobvos != null) {
|
||||||
|
for (PsnjobVO jobvo : jobvos) {
|
||||||
|
jobvo.setStatus(status);
|
||||||
|
list.add(jobvo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PsndocVO queryOldPSndovCO(String vopk) throws MetaDataException, BusinessException {
|
||||||
|
NCObject obj = getIPsndocQueryService().queryBillOfNCObjectByPK(PsndocVO.class, vopk);
|
||||||
|
if (obj == null) {
|
||||||
|
throw new BusinessException(
|
||||||
|
nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("10140psn", "110140psn0026"));// 该数据已被删除
|
||||||
|
}
|
||||||
|
PsndocVO oldvo = (PsndocVO) obj.getContainmentObject();
|
||||||
|
return oldvo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IPsndocService getPsndocService() {
|
||||||
|
if (service == null) {
|
||||||
|
service = NCLocator.getInstance().lookup(IPsndocService.class);
|
||||||
|
}
|
||||||
|
return service;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private IMDPersistenceQueryService getIPsndocQueryService() {
|
||||||
|
if (queryService == null) {
|
||||||
|
queryService = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
|
||||||
|
}
|
||||||
|
return queryService;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -146,7 +146,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
||||||
result = service.insertBom((AggBomVO[]) addAggvoList.toArray(new AggBomVO[0]));
|
result = service.insertBom((AggBomVO[]) addAggvoList.toArray(new AggBomVO[0]));
|
||||||
} else if (!commitAggvoList.isEmpty() && addAggvoList.isEmpty()) {
|
} else if (!commitAggvoList.isEmpty() && addAggvoList.isEmpty()) {
|
||||||
List<AggBomVO> newAggVOList = new ArrayList<>();
|
List<AggBomVO> newAggVOList = new ArrayList<>();
|
||||||
if("plm".equals(userCode)){
|
if("gaoning".equals(userCode)){
|
||||||
for(AggBomVO aggvo:commitAggvoList){
|
for(AggBomVO aggvo:commitAggvoList){
|
||||||
result = service.insertCommitBomWithParam(new AggBomVO[]{aggvo}, true, true);
|
result = service.insertCommitBomWithParam(new AggBomVO[]{aggvo}, true, true);
|
||||||
newAggVOList.add(result[0]);
|
newAggVOList.add(result[0]);
|
||||||
|
@ -676,7 +676,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
||||||
if (VersionTypeEnum.AVAILABLE.equalsValue(head.getHfversiontype())
|
if (VersionTypeEnum.AVAILABLE.equalsValue(head.getHfversiontype())
|
||||||
&& !head.getCbomid().equals(headvo.getCbomid())) {
|
&& !head.getCbomid().equals(headvo.getCbomid())) {
|
||||||
//sdlizheng --添加独立判断--plm三方越过此校验
|
//sdlizheng --添加独立判断--plm三方越过此校验
|
||||||
if ("plm".equals(userCode)||"dlkght".equals(userCode)) {
|
if ("gaoning".equals(userCode)||"dlkght".equals(userCode)) {
|
||||||
// AggBomVO afterVO = service.canceldefault(aggBomVO);
|
// AggBomVO afterVO = service.canceldefault(aggBomVO);
|
||||||
} else {
|
} else {
|
||||||
return UFBoolean.TRUE;
|
return UFBoolean.TRUE;
|
||||||
|
@ -730,7 +730,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
||||||
agg.getParent().setAttributeValue("fbillstatus", Integer.valueOf(-1));
|
agg.getParent().setAttributeValue("fbillstatus", Integer.valueOf(-1));
|
||||||
agg.getParent().setAttributeValue("hfbomsource", Integer.valueOf(1));
|
agg.getParent().setAttributeValue("hfbomsource", Integer.valueOf(1));
|
||||||
agg.getParent().setAttributeValue("hfbomcategory", Integer.valueOf(1));
|
agg.getParent().setAttributeValue("hfbomcategory", Integer.valueOf(1));
|
||||||
if ("plm".equals(userCode)||"dlkght".equals(userCode)) {
|
if ("gaoning".equals(userCode)||"dlkght".equals(userCode)) {
|
||||||
//sdlizheng 1、对于之前不存在的BOM,新增时:如果是传自由态,不默认且无效,走标准逻辑,如果传的是审批态默认且有效。2025年4月11日16点28分 start
|
//sdlizheng 1、对于之前不存在的BOM,新增时:如果是传自由态,不默认且无效,走标准逻辑,如果传的是审批态默认且有效。2025年4月11日16点28分 start
|
||||||
if (fbillstatus != null && "1".equals(fbillstatus.toString())) {
|
if (fbillstatus != null && "1".equals(fbillstatus.toString())) {
|
||||||
agg.getParent().setAttributeValue("hfversiontype", Integer.valueOf(1));
|
agg.getParent().setAttributeValue("hfversiontype", Integer.valueOf(1));
|
||||||
|
|
Loading…
Reference in New Issue