Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
47e1e4139a
|
|
@ -40,7 +40,7 @@ public class PmoToEpicMesAction implements ICommonAction {
|
|||
ExceptionUtils.wrapBusinessException("查询不到对应流程生产订单");
|
||||
}
|
||||
HttpPmoEpicMesUtil mesUtil = new HttpPmoEpicMesUtil();
|
||||
mesUtil.processData(pmoAggVOS, "Y", false);
|
||||
mesUtil.processData(pmoAggVOS, "Y", true);
|
||||
return ResultMessageUtil.toJSON(true, "推送成功");
|
||||
} catch (Exception e) {
|
||||
logDl.error("同步生产订单到艾普MES系统失败: " + e.getMessage(), e);
|
||||
|
|
|
|||
|
|
@ -8,9 +8,12 @@ import nc.bs.trade.business.HYPubBO;
|
|||
import nc.itf.mmpac.pmo.pac0002.IPMOBusinessService;
|
||||
import nc.itf.mmpac.pmo.pac0002.IPMOQueryService;
|
||||
import nc.jdbc.framework.SQLParameter;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.jdbc.framework.processor.MapListProcessor;
|
||||
import nc.util.mmf.framework.base.MMCollectionUtil;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOHeadVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.ws.opm.pub.utils.result.APIErrCodeEnum;
|
||||
|
|
@ -350,6 +353,93 @@ public class PmoResource extends AbstractNCCRestResource {
|
|||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("queryByCondition")
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString queryByCondition(Map<String, Object> paramMap) {
|
||||
if (MMValueCheck.isEmpty(paramMap)) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数不能为空", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||
}
|
||||
if (MMValueCheck.isEmpty(paramMap.get("pk_org"))) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,组织参数为空", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||
}
|
||||
try {
|
||||
StringBuilder whereSql = new StringBuilder();
|
||||
|
||||
// 处理时间范围参数 ts
|
||||
if (paramMap.containsKey("ts") && paramMap.get("ts") != null) {
|
||||
String tsRange = paramMap.get("ts").toString();
|
||||
if (tsRange.contains("~")) {
|
||||
String[] dates = tsRange.split("~");
|
||||
if (dates.length == 2) {
|
||||
whereSql.append(" AND ts BETWEEN '")
|
||||
.append(dates[0].trim())
|
||||
.append("' AND '")
|
||||
.append(dates[1].trim())
|
||||
.append("' ");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理修改时间范围参数 modifiedtime
|
||||
if (paramMap.containsKey("modifiedtime") && paramMap.get("modifiedtime") != null) {
|
||||
String tsRange = paramMap.get("modifiedtime").toString();
|
||||
if (tsRange.contains("~")) {
|
||||
String[] dates = tsRange.split("~");
|
||||
if (dates.length == 2) {
|
||||
whereSql.append(" AND modifiedtime BETWEEN '")
|
||||
.append(dates[0].trim())
|
||||
.append("' AND '")
|
||||
.append(dates[1].trim())
|
||||
.append("' ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理组织参数 pk_org
|
||||
if (paramMap.containsKey("pk_org") && paramMap.get("pk_org") != null) {
|
||||
String sql = " SELECT pk_factory FROM org_factory " +
|
||||
" WHERE nvl(dr,0)= 0 and code = '" + paramMap.get("pk_org") + "' ";
|
||||
String pkOrg = (String) BASE_DAO.executeQuery(sql, new ColumnProcessor());
|
||||
whereSql.append(" AND pk_org = '")
|
||||
.append(pkOrg)
|
||||
.append("' ");
|
||||
}
|
||||
|
||||
if (paramMap.containsKey("vbillcode") && paramMap.get("vbillcode") != null) {
|
||||
whereSql.append(" AND vbillcode = '")
|
||||
.append(paramMap.get("vbillcode").toString())
|
||||
.append("' ");
|
||||
}
|
||||
if (paramMap.containsKey("fbillstatus") && paramMap.get("fbillstatus") != null) {
|
||||
whereSql.append(" AND fbillstatus = '")
|
||||
.append(paramMap.get("fbillstatus").toString())
|
||||
.append("' ");
|
||||
}
|
||||
|
||||
String finalWhereSql = "";
|
||||
if (!whereSql.isEmpty()) {
|
||||
// finalWhereSql = whereSql.substring(5);
|
||||
finalWhereSql = " dr = 0 " + whereSql;
|
||||
}
|
||||
// NCCForUAPLogger.debug("查询流程生产订单参数:" + finalWhereSql);
|
||||
IPMOQueryService pmoQuery = NCLocator.getInstance().lookup(IPMOQueryService.class);
|
||||
PMOAggVO[] pmoAggVOS = pmoQuery.queryByWhereSql(finalWhereSql);
|
||||
if (pmoAggVOS != null) {
|
||||
for (PMOAggVO pmoAggVO : pmoAggVOS) {
|
||||
if (pmoAggVO.getChildrenVO() == null || pmoAggVO.getChildrenVO().length == 0) {
|
||||
PMOHeadVO headVO = pmoAggVO.getParentVO();
|
||||
PMOItemVO[] itemVOS = pmoQuery.getPMOItemVOsByids(new String[]{headVO.getPrimaryKey()}, null);
|
||||
pmoAggVO.setChildrenVO(itemVOS);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ResultMessageUtil.toJSON(pmoAggVOS, "流程生产订单查询成功");
|
||||
} catch (BusinessException e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("queryPmos")
|
||||
@Consumes({"application/json"})
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@ public class BomSaveAfterEpicMesRule implements IRule<AggBomVO> {
|
|||
if (!MMValueCheck.isEmpty(vos)) {
|
||||
try {
|
||||
configParams = MyHelper.getConfigParams("Dldz-config", null);
|
||||
JSONArray data = buildSyncData(vos);
|
||||
if (!data.isEmpty()) {
|
||||
pushData(data, vos);
|
||||
}
|
||||
buildSyncData(vos);
|
||||
} catch (BusinessException e) {
|
||||
String message = e.getMessage();
|
||||
logDl.error("EpicMes-BOM-exp:" + message, e);
|
||||
|
|
@ -70,8 +67,7 @@ public class BomSaveAfterEpicMesRule implements IRule<AggBomVO> {
|
|||
/**
|
||||
* 构建同步数据
|
||||
*/
|
||||
private JSONArray buildSyncData(AggBomVO[] useVOs) throws BusinessException {
|
||||
JSONArray data = new JSONArray();
|
||||
private void buildSyncData(AggBomVO[] useVOs) throws BusinessException {
|
||||
for (AggBomVO vo : useVOs) {
|
||||
// 判断物料的业务单元是否是电力电子公司,不是则跳过
|
||||
BomVO hvo = (BomVO) vo.getParentVO();
|
||||
|
|
@ -99,6 +95,7 @@ public class BomSaveAfterEpicMesRule implements IRule<AggBomVO> {
|
|||
|
||||
String mitm = MyHelper.getStrValByCondition(MaterialVO.getDefaultTableName(), MaterialVO.CODE,
|
||||
MaterialVO.PK_MATERIAL + " = '" + hcmaterialid + "'");
|
||||
JSONArray data = new JSONArray();
|
||||
for (BomItemVO childrenVO : childrenVOs) {
|
||||
String cmaterialid = childrenVO.getCmaterialid();
|
||||
String sitm = MyHelper.getStrValByCondition(MaterialVO.getDefaultTableName(), MaterialVO.CODE,
|
||||
|
|
@ -113,6 +110,7 @@ public class BomSaveAfterEpicMesRule implements IRule<AggBomVO> {
|
|||
singleObj.put("remark", childrenVO.getVnote()); // 备注
|
||||
data.add(singleObj);
|
||||
}
|
||||
pushData(data, new AggBomVO[]{vo});
|
||||
/**
|
||||
* [
|
||||
* {
|
||||
|
|
@ -127,7 +125,6 @@ public class BomSaveAfterEpicMesRule implements IRule<AggBomVO> {
|
|||
*/
|
||||
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -61,10 +61,7 @@ public class BomToEpicMesPlugin implements IBackgroundWorkPlugin {
|
|||
for (Map<String, String> map : pkList) {
|
||||
String cbomid = map.get("cbomid");
|
||||
AggBomVO[] vos = qry.queryAggBomByBomID(new String[]{cbomid});
|
||||
JSONArray data = buildSyncData(vos);
|
||||
if (!data.isEmpty()) {
|
||||
pushData(data, vos);
|
||||
}
|
||||
buildSyncData(vos);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
@ -76,8 +73,7 @@ public class BomToEpicMesPlugin implements IBackgroundWorkPlugin {
|
|||
/**
|
||||
* 构建同步数据
|
||||
*/
|
||||
private JSONArray buildSyncData(AggBomVO[] useVOs) throws BusinessException {
|
||||
JSONArray data = new JSONArray();
|
||||
private void buildSyncData(AggBomVO[] useVOs) throws BusinessException {
|
||||
for (AggBomVO vo : useVOs) {
|
||||
// 判断物料的业务单元是否是电力电子公司,不是则跳过
|
||||
BomVO hvo = (BomVO) vo.getParentVO();
|
||||
|
|
@ -105,6 +101,7 @@ public class BomToEpicMesPlugin implements IBackgroundWorkPlugin {
|
|||
|
||||
String mitm = MyHelper.getStrValByCondition(MaterialVO.getDefaultTableName(), MaterialVO.CODE,
|
||||
MaterialVO.PK_MATERIAL + " = '" + hcmaterialid + "'");
|
||||
JSONArray data = new JSONArray();
|
||||
for (BomItemVO childrenVO : childrenVOs) {
|
||||
String cmaterialid = childrenVO.getCmaterialid();
|
||||
String sitm = MyHelper.getStrValByCondition(MaterialVO.getDefaultTableName(), MaterialVO.CODE,
|
||||
|
|
@ -119,6 +116,7 @@ public class BomToEpicMesPlugin implements IBackgroundWorkPlugin {
|
|||
singleObj.put("remark", childrenVO.getVnote()); // 备注
|
||||
data.add(singleObj);
|
||||
}
|
||||
pushData(data, new AggBomVO[]{vo});
|
||||
/**
|
||||
* [
|
||||
* {
|
||||
|
|
@ -133,7 +131,6 @@ public class BomToEpicMesPlugin implements IBackgroundWorkPlugin {
|
|||
*/
|
||||
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue