物料推艾普MES-组织判断调整
This commit is contained in:
parent
395f09cdd5
commit
470de890c8
|
@ -19,7 +19,6 @@ import nc.vo.bd.material.marbasclass.MarBasClassVO;
|
|||
import nc.vo.bd.material.stock.MaterialStockVO;
|
||||
import nc.vo.org.OrgVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.baseapp.core.log.NCCForUAPLogger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -92,17 +91,18 @@ public class MaterialToEpicMesListener implements IBusinessListener {
|
|||
*/
|
||||
private void buildSyncData(MaterialVO[] useVOs, String eventType) throws BusinessException {
|
||||
for (MaterialVO vo : useVOs) {
|
||||
String pkMaterial = vo.getPk_material();
|
||||
// 判断物料的业务单元是否是电力电子公司,不是则跳过
|
||||
String pkOrg = vo.getPk_org();
|
||||
String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
||||
if (!"1009".equals(eventType) && MyHelper.checkIfDldzOrg(orgCode, configParams)) {
|
||||
Integer num = MyHelper.checkIfOrg(configParams, pkMaterial, "dldzOrg");
|
||||
if (!"1009".equals(eventType) && (num <= 0)) {
|
||||
continue;
|
||||
}
|
||||
// 字段值翻译
|
||||
String pk_marbasclass = vo.getPk_marbasclass();
|
||||
String mrlTypeCOde = MyHelper.transferField(MarBasClassVO.getDefaultTableName(), MarBasClassVO.CODE, MarBasClassVO.PK_MARBASCLASS, pk_marbasclass);
|
||||
// 计量单位
|
||||
String pkMaterial = vo.getPk_material();
|
||||
Map unitMap = getGoodsInfo(pkMaterial);
|
||||
|
||||
// 1=未启用;2=已启用;3=已停用;
|
||||
|
@ -140,7 +140,7 @@ public class MaterialToEpicMesListener implements IBusinessListener {
|
|||
SerializerFeature.WriteNullStringAsEmpty
|
||||
);
|
||||
logDl.error("EpicMes-Material-param = " + jsonStr);
|
||||
NCCForUAPLogger.debug("EpicMes-Material-param = " + jsonStr);
|
||||
// NCCForUAPLogger.debug("EpicMes-Material-param = " + jsonStr);
|
||||
String baseUrl = configParams.get("epicMesUrl");
|
||||
String requestUrl = baseUrl + reqUrl;
|
||||
logDl.error("EpicMes-Material-url = " + requestUrl);
|
||||
|
|
|
@ -4,12 +4,12 @@ import nc.bs.dao.BaseDAO;
|
|||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.logging.Logger;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.jdbc.framework.processor.BaseProcessor;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.jdbc.framework.processor.MapListProcessor;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.vo.bd.defdoc.DefdocVO;
|
||||
import nc.vo.cmp.util.StringUtils;
|
||||
import nc.vo.fi.pub.SqlUtils;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
||||
|
||||
|
@ -163,4 +163,25 @@ public class MyHelper {
|
|||
return map;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查当前组织是否为配置的组织
|
||||
*/
|
||||
public static Integer checkIfOrg(Map<String, String> configParams, String pkMaterial, String orgFlag) throws BusinessException {
|
||||
String targetCode = configParams.get(orgFlag);
|
||||
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
|
||||
throw new BusinessException("未配置组织参数");
|
||||
}
|
||||
String[] orgItem = targetCode.split(",");
|
||||
String inStr = SqlUtils.getInStr("b.code", orgItem, Boolean.TRUE);
|
||||
String countSql = "SELECT count(1)" +
|
||||
" FROM bd_materialstock a" +
|
||||
" LEFT JOIN org_stockorg b ON a.pk_org = b.pk_stockorg" +
|
||||
" WHERE " +
|
||||
" a.pk_material = '[pkMaterial]'" +
|
||||
" AND " + inStr;
|
||||
countSql = countSql.replace("[pkMaterial]", pkMaterial);
|
||||
// NCCForUAPLogger.debug(countSql);
|
||||
return (Integer) dao.executeQuery(countSql, new ColumnProcessor());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue