优化艾普MES接口代码-物料+生产订单

This commit is contained in:
mzr 2025-07-13 15:22:55 +08:00
parent 0d448df7f2
commit 370ccc0b35
3 changed files with 36 additions and 11 deletions

View File

@ -119,15 +119,17 @@ public class AfterApproveSyncEpicMesRule implements IRule<PMOAggVO> {
String pkOrg = aggVo.getParentVO().getPk_org();
String orgCode = MyHelper.transferField(FactoryVO.getDefaultTableName(), FactoryVO.CODE, FactoryVO.PK_FACTORY, pkOrg);
// 检查当前组织是否为电力电子
if (!MyHelper.checkIfDldzOrg(orgCode)) {
if (MyHelper.checkIfDldzOrg(orgCode)) {
continue;
}
// 按照部门筛选生产订单只传消弧车间电容车间成套车间部门是配置项
PMOItemVO[] childrenVO = aggVo.getChildrenVO();
for (PMOItemVO item : childrenVO) {
String cdeptid = item.getCdeptid();
PMOItemVO childrenVO = aggVo.getChildrenVO()[0];
String cdeptid = childrenVO.getCdeptid();
String deptCode = MyHelper.transferField(DeptVO.getDefaultTableName(), DeptVO.CODE, DeptVO.PK_DEPT, cdeptid);
// 如果部门不在范围内则跳过本次循环
String deptRange = "5020151,5020147,5020148";
if (deptCode == null || !deptRange.contains(deptCode)) {
continue;
}
aggvoList.add(aggVo);
}

View File

@ -53,7 +53,7 @@ public class MaterialToEpicMesListener implements IBusinessListener {
// 判断物料的业务单元是否是电力电子公司不是则跳过
String pkOrg = vo.getPk_org();
String orgCode = MyHelper.transferField(FactoryVO.getDefaultTableName(), FactoryVO.CODE, FactoryVO.PK_FACTORY, pkOrg);
if (!MyHelper.checkIfDldzOrg(orgCode)) {
if (MyHelper.checkIfDldzOrg(orgCode)) {
continue;
}
// 字段值翻译

View File

@ -1,10 +1,14 @@
package nc.bs.uapbd.util;
import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.bs.logging.Logger;
import nc.bs.trade.business.HYSuperDMO;
import nc.hr.utils.PubEnv;
import nc.itf.arap.goldentax.SysParaInitQuery;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.jdbc.framework.processor.MapProcessor;
import nc.vo.bd.defdoc.DefdocVO;
import nc.vo.cmp.util.StringUtils;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.pub.SqlBuilder;
@ -69,19 +73,19 @@ public class MyHelper {
* 检查当前组织是否为电力电子
*/
public static boolean checkIfDldzOrg(String code) throws BusinessException {
String targetCode = SysParaInitQuery.getParaString("GLOBLE00000000000000", "DLDZORG");
String targetCode = SysParaInitQuery.getParaString(PubEnv.getPk_group(), "DLDZORG");
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
throw new BusinessException("未配置组织参数,请前往 [业务参数设置-全局] 配置DLDZORG参数");
}
String[] orgItem = targetCode.split(";");
String[] orgItem = targetCode.split(",");
for (String orgCode : orgItem) {
if (!orgCode.isEmpty() && orgCode.equals(code)) {
Logger.debug("当前处理组织校验为电力电子:" + code);
return true;
}
}
return false;
}
}
return true;
}
/**
* 转换特殊字段 1/1 转换为小数 1.0
@ -108,4 +112,23 @@ public class MyHelper {
}
return field;
}
public static Map<String, String> getConfigParams(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";
strWhere = strWhere.replace("[code]", code);
try {
DefdocVO[] defdocVOs = (DefdocVO[]) new HYSuperDMO().queryByWhereClause(DefdocVO.class, strWhere);
if (defdocVOs != null) {
for (DefdocVO defdocVO : defdocVOs) {
String value = StringUtils.isEmpty(defdocVO.getMemo()) ? defdocVO.getName() : defdocVO.getMemo();
map.put(defdocVO.getCode().trim(), value);
}
}
} catch (DAOException e) {
Logger.error("getConfigParams-exp:" + e.getMessage());
}
return map;
}
}