物料新增修改后同步艾普MES的物料-参数取值调整
This commit is contained in:
parent
92c621ce56
commit
749bfa0775
|
@ -11,7 +11,6 @@ import nc.bs.dao.BaseDAO;
|
|||
import nc.bs.logging.Log;
|
||||
import nc.bs.uapbd.util.MyHelper;
|
||||
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
||||
import nc.itf.arap.goldentax.SysParaInitQuery;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.vo.bd.material.MaterialVO;
|
||||
import nc.vo.bd.material.marbasclass.MarBasClassVO;
|
||||
|
@ -31,6 +30,7 @@ public class MaterialToEpicMesListener implements IBusinessListener {
|
|||
private static final String LOG_INFO_NAME = "dldzlog";
|
||||
private static final Log logDl = Log.getInstance(LOG_INFO_NAME);
|
||||
private static final String reqUrl = "/prj-v5-web/ext/api/mrl";
|
||||
private Map<String, String> configParams;
|
||||
|
||||
@Override
|
||||
public void doAction(IBusinessEvent event) throws BusinessException {
|
||||
|
@ -38,10 +38,19 @@ public class MaterialToEpicMesListener implements IBusinessListener {
|
|||
String eventType = event.getEventType();
|
||||
Object[] objs = e.getObjs();
|
||||
MaterialVO[] useVOs = ArrayClassConvertUtil.convert(objs, MaterialVO.class);
|
||||
|
||||
// EventType是事件编码 1002-新增后 1004-修改后 1071-状态由停用变为启用后 1069-状态由启用变为停用后
|
||||
if ("1002".equals(eventType) || "1004".equals(eventType)) {
|
||||
configParams = MyHelper.getConfigParams("Dldz-config");
|
||||
if (configParams.isEmpty()) {
|
||||
throw new BusinessException("电力电子的艾普MES接口缺少配置");
|
||||
}
|
||||
buildSyncData(useVOs, eventType);
|
||||
} else if ("1071".equals(eventType) || "1069".equals(eventType)) {
|
||||
configParams = MyHelper.getConfigParams("Dldz-config");
|
||||
if (configParams.isEmpty()) {
|
||||
throw new BusinessException("电力电子的艾普MES接口缺少配置");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +63,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, configParams)) {
|
||||
continue;
|
||||
}
|
||||
// 字段值翻译
|
||||
|
@ -99,8 +108,7 @@ public class MaterialToEpicMesListener implements IBusinessListener {
|
|||
SerializerFeature.WriteNullStringAsEmpty
|
||||
);
|
||||
logDl.error("EpicMes-Material-param = " + jsonStr);
|
||||
String baseUrl = SysParaInitQuery.getParaString("GLOBLE00000000000000", "EPICMESURL");
|
||||
baseUrl = "http://192.168.55.39:8080";
|
||||
String baseUrl = configParams.get("epicMesUrl");
|
||||
String requestUrl = baseUrl + reqUrl;
|
||||
logDl.error("EpicMes-Material-url = " + requestUrl);
|
||||
String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr);
|
||||
|
|
|
@ -4,8 +4,6 @@ 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;
|
||||
|
@ -72,15 +70,15 @@ public class MyHelper {
|
|||
/**
|
||||
* 检查当前组织是否为电力电子
|
||||
*/
|
||||
public static boolean checkIfDldzOrg(String code) throws BusinessException {
|
||||
String targetCode = SysParaInitQuery.getParaString(PubEnv.getPk_group(), "DLDZORG");
|
||||
public static boolean checkIfDldzOrg(String code, Map<String, String> configParams) throws BusinessException {
|
||||
String targetCode = configParams.get("dldzOrg");
|
||||
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
|
||||
throw new BusinessException("未配置组织参数,请前往 [业务参数设置-全局] 配置DLDZORG参数");
|
||||
throw new BusinessException("未配置组织参数");
|
||||
}
|
||||
String[] orgItem = targetCode.split(",");
|
||||
for (String orgCode : orgItem) {
|
||||
if (!orgCode.isEmpty() && orgCode.equals(code)) {
|
||||
Logger.debug("当前处理组织校验为电力电子:" + code);
|
||||
Logger.info("当前处理组织校验为电力电子:" + code);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue