电力电子、箱变、精密物料手动推送按钮后端
This commit is contained in:
parent
163d854ace
commit
3605f9ceb1
|
|
@ -25,10 +25,8 @@ import nc.vo.pub.BusinessException;
|
|||
import nc.vo.pub.lang.UFDouble;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.framework.core.exception.ExceptionUtils;
|
||||
import nccloud.framework.core.json.IJson;
|
||||
import nccloud.framework.web.action.itf.ICommonAction;
|
||||
import nccloud.framework.web.container.IRequest;
|
||||
import nccloud.framework.web.json.JsonFactory;
|
||||
import nccloud.web.mmpub.pub.resexp.PfResumeExceptionNccUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -57,15 +55,11 @@ public class MaterialJmPushToQyMesAction implements ICommonAction {
|
|||
|
||||
@Override
|
||||
public Object doAction(IRequest request) {
|
||||
String read = request.read();
|
||||
|
||||
JSONObject jsonObject = getParamJson(request);
|
||||
List<String> pks = JSONObject.parseArray(jsonObject.get("pks").toString(), String.class);
|
||||
HYPubBO hyPub = new HYPubBO();
|
||||
try {
|
||||
IJson json = JsonFactory.create();
|
||||
Map<String, Object> info = json.fromJson(read, Map.class);
|
||||
// 获取所有物料编码
|
||||
String pks = (String) info.get("pks");
|
||||
if (pks == null) {
|
||||
if (MMValueCheck.isEmpty(pks)) {
|
||||
ExceptionUtils.wrapBusinessException("物料不能为空");
|
||||
}
|
||||
configParams = MyHelper.getConfigParams("jm-config", null);
|
||||
|
|
@ -74,12 +68,17 @@ public class MaterialJmPushToQyMesAction implements ICommonAction {
|
|||
}
|
||||
pkOrg1 = MyHelper.getStrValByCondition(OrgVO.getDefaultTableName(), OrgVO.PK_ORG, OrgVO.CODE + " = 'C038' and ISBUSINESSUNIT = 'Y'");
|
||||
List<MaterialVO> useVOs = new ArrayList<>();
|
||||
MaterialVO useVO = (MaterialVO) hyPub.queryByPrimaryKey(MaterialVO.class, pks);
|
||||
Integer num = MyHelper.checkIfOrg(configParams, pks, "jmOrg");
|
||||
if (num <= 0) {
|
||||
ExceptionUtils.wrapBusinessException("请先将物料分配给精密");
|
||||
for (String pkMaterial : pks) {
|
||||
MaterialVO materialVO = (MaterialVO) hyPub.queryByPrimaryKey(MaterialVO.class, pkMaterial);
|
||||
Integer num = MyHelper.checkIfOrg(configParams, pkMaterial, "jmOrg");
|
||||
if (materialVO == null) {
|
||||
continue;
|
||||
}
|
||||
if (num <= 0) {
|
||||
ExceptionUtils.wrapBusinessException("ÇëÏȽ«ÎïÁÏ·ÖÅ䏸¾«ÃÜ");
|
||||
}
|
||||
useVOs.add(materialVO);
|
||||
}
|
||||
useVOs.add(useVO);
|
||||
buildSyncData(useVOs);
|
||||
return ResultMessageUtil.toJSON(true, "推送成功");
|
||||
} catch (Exception ex) {
|
||||
|
|
@ -87,6 +86,13 @@ public class MaterialJmPushToQyMesAction implements ICommonAction {
|
|||
}
|
||||
}
|
||||
|
||||
private JSONObject getParamJson(IRequest iRequest) {
|
||||
String json = iRequest.getJson();
|
||||
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
JSONObject busiParamJson = jsonObject.getJSONObject("busiParamJson");
|
||||
return busiParamJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建同步数据
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,231 @@
|
|||
package nccloud.web.uapbd.material.action;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.trade.business.HYPubBO;
|
||||
import nc.bs.uapbd.util.MyHelper;
|
||||
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.vo.bd.material.MaterialVO;
|
||||
import nc.vo.fi.pub.SqlUtils;
|
||||
import nc.vo.org.OrgVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.framework.core.exception.ExceptionUtils;
|
||||
import nccloud.framework.web.action.itf.ICommonAction;
|
||||
import nccloud.framework.web.container.IRequest;
|
||||
import nccloud.web.mmpub.pub.resexp.PfResumeExceptionNccUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 电力电子-物料同步艾普MES
|
||||
*
|
||||
* @author mzr
|
||||
* @date 2025/11/12
|
||||
*/
|
||||
public class MaterialPushToEpicMesAction implements ICommonAction {
|
||||
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;
|
||||
private BaseDAO dao;
|
||||
|
||||
public BaseDAO getDao() {
|
||||
if (dao == null) {
|
||||
dao = new BaseDAO();
|
||||
}
|
||||
return dao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object doAction(IRequest request) {
|
||||
JSONObject jsonObject = getParamJson(request);
|
||||
List<String> pks = JSONObject.parseArray(jsonObject.get("pks").toString(), String.class);
|
||||
try {
|
||||
if (MMValueCheck.isEmpty(pks)) {
|
||||
ExceptionUtils.wrapBusinessException("物料不能为空");
|
||||
}
|
||||
configParams = MyHelper.getConfigParams("Dldz-config", null);
|
||||
if (configParams.isEmpty()) {
|
||||
throw new BusinessException("电力电子的艾普MES接口缺少配置");
|
||||
}
|
||||
HYPubBO hyPub = new HYPubBO();
|
||||
List<MaterialVO> voList = new ArrayList<>();
|
||||
for (String pkMaterial : pks) {
|
||||
MaterialVO materialVO = (MaterialVO) hyPub.queryByPrimaryKey(MaterialVO.class, pkMaterial);
|
||||
if (materialVO == null) {
|
||||
continue;
|
||||
}
|
||||
Integer num = MyHelper.checkIfOrg(configParams, pkMaterial, "dldzOrg");
|
||||
if (num <= 0) {
|
||||
throw new BusinessException("物料组织非电力电子,物料主键:" + pkMaterial + ",物料编码:" + materialVO.getCode());
|
||||
}
|
||||
voList.add(materialVO);
|
||||
}
|
||||
if (!voList.isEmpty()) {
|
||||
buildSyncData(voList);
|
||||
}
|
||||
return ResultMessageUtil.toJSON(true, "推送成功");
|
||||
} catch (Exception ex) {
|
||||
return PfResumeExceptionNccUtils.handleResumeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private JSONObject getParamJson(IRequest iRequest) {
|
||||
String json = iRequest.getJson();
|
||||
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
JSONObject busiParamJson = jsonObject.getJSONObject("busiParamJson");
|
||||
return busiParamJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建同步数据
|
||||
*/
|
||||
private void buildSyncData(List<MaterialVO> useVOs) 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);
|
||||
// 字段值翻译
|
||||
// 计量单位
|
||||
Map unitMap = getGoodsInfo(pkMaterial);
|
||||
|
||||
// 1=未启用;2=已启用;3=已停用;
|
||||
Integer enablestate = vo.getEnablestate();
|
||||
String statusCode = (3 == enablestate) ? "N" : "Y";
|
||||
// 组装数据
|
||||
JSONObject singleObj = new JSONObject();
|
||||
singleObj.put("id", null);// 唯一标识(主键)
|
||||
singleObj.put("siteCode", orgCode);// 工厂编码
|
||||
singleObj.put("mrlCode", vo.getCode());// 物料编码
|
||||
singleObj.put("mrlName", vo.getName());// 物料名称
|
||||
singleObj.put("unit", unitMap.get("unitname"));// 单位
|
||||
singleObj.put("model", vo.getMaterialtype());// 型号
|
||||
singleObj.put("specification", vo.getMaterialspec());// 规格
|
||||
String type = "Y".equals(vo.getDef30()) ? "U" : "I";
|
||||
singleObj.put("type", type);// 类型(I:新增 U:修改 D:删除)
|
||||
singleObj.put("deputyUnit", unitMap.get("deputy_unitname"));// 副单位
|
||||
singleObj.put("auditCode", "1");// 审核码
|
||||
singleObj.put("statusCode", statusCode);// 状态码(Y表示启用,N表示停用)
|
||||
// singleObj.put("mrlTypeErp", getGoodsProject(pkMaterial));// 物料类型ERP(1:专用件,3:通用件)
|
||||
singleObj.put("mrlType", getGoodsType(pkMaterial));// 物料分类 制造1 其它0
|
||||
singleObj.put("convertRate", unitMap.getOrDefault("convertRate", "1"));// 单位换算率
|
||||
// singleObj.put("isCheck", "1");// 是否选中(1:是,0:否)
|
||||
pushData(singleObj, pkMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送同步数据
|
||||
*/
|
||||
private void pushData(JSONObject param, String pkMaterial) throws BusinessException {
|
||||
// String jsonString = param.toJSONString();
|
||||
// 转json字符串的时候保留null值
|
||||
String jsonStr = JSON.toJSONString(param,
|
||||
SerializerFeature.WriteMapNullValue,
|
||||
SerializerFeature.WriteNullStringAsEmpty
|
||||
);
|
||||
logDl.error("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);
|
||||
String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr);
|
||||
JSONObject resultObj = JSONObject.parseObject(result);
|
||||
logDl.error("EpicMes-Material-res = " + result);
|
||||
|
||||
if (!"1".equals(resultObj.getString("flag"))) {
|
||||
// throw new BusinessException("EpicMes-Material-error:" + resultObj.getString("msg"));
|
||||
logDl.error("EpicMes-Material-error,result[" + resultObj.toJSONString() + "]");
|
||||
} else {
|
||||
handleSyncMaterialExp(pkMaterial, "Y");
|
||||
}
|
||||
}
|
||||
|
||||
private String getType(String eventType) {
|
||||
// 类型(I:新增 U:修改 D:删除)
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("1002", "I");
|
||||
map.put("1009", "I");
|
||||
map.put("1004", "U");
|
||||
map.put("1069", "U");
|
||||
map.put("1071", "U");
|
||||
return map.getOrDefault(eventType, "I");
|
||||
}
|
||||
|
||||
private Map getGoodsInfo(String pkMaterial) throws BusinessException {
|
||||
String sql = " select a.pk_measdoc, c.name unitname, b.pk_measdoc deputyUnit, d.name deputy_unitname, nvl(b.measrate, '1/1') measrate " +
|
||||
"from bd_material a " +
|
||||
"left join bd_materialconvert b on a.pk_material = b.pk_material " +
|
||||
"left join bd_measdoc c on a.pk_measdoc = c.pk_measdoc " +
|
||||
"left join bd_measdoc d on b.pk_measdoc = d.pk_measdoc " +
|
||||
"where a.pk_material = '" + pkMaterial + "' ";
|
||||
// logDl.error("EpicMes-Material-getUnitInfo-sql = " + sql);
|
||||
Map map = (Map) getDao().executeQuery(sql, new MapProcessor());
|
||||
map.put("convertRate", MyHelper.transferSpecialField(map.get("measrate") + ""));
|
||||
return map;
|
||||
}
|
||||
|
||||
private String getGoodsType(String pkMaterial) throws BusinessException {
|
||||
String targetCode = configParams.get("dldzOrg");
|
||||
String[] orgItem = targetCode.split(",");
|
||||
String inStr = SqlUtils.getInStr("b.code", orgItem, Boolean.TRUE);
|
||||
// 物料-库存信息-物料类型 DR=分销补货;FR=工厂补货;MR=制造件;PR=采购件;OT=委外件;ET=其他
|
||||
// mes物料类型 制造1 其它0(ERP多个组织中如果有一个是制造件或虚拟件(其他)就传1)
|
||||
String mesType = "0";
|
||||
// String martype = MyHelper.transferField(MaterialStockVO.getDefaultTableName(), MaterialStockVO.MARTYPE, MaterialStockVO.PK_MATERIAL, pkMaterial);
|
||||
String countSql = "SELECT count(1)" +
|
||||
" FROM bd_materialstock a" +
|
||||
" LEFT JOIN org_stockorg b ON a.pk_org = b.pk_stockorg" +
|
||||
" WHERE a.dr = 0 AND a.martype IN ('MR','ET') " +
|
||||
" AND a.pk_material = '[pkMaterial]'" +
|
||||
" AND " + inStr;
|
||||
countSql = countSql.replace("[pkMaterial]", pkMaterial);
|
||||
Integer num = (Integer) getDao().executeQuery(countSql, new ColumnProcessor());
|
||||
if (num > 0) {
|
||||
mesType = "1";
|
||||
}
|
||||
// 判断物料是否是虚拟件,只要有一个组织是就赋值0
|
||||
String countSql1 = "SELECT count(1)" +
|
||||
" FROM bd_materialplan a" +
|
||||
" LEFT JOIN org_orgs b ON a.pk_org = b.pk_org" +
|
||||
" WHERE a.dr = 0 AND a.isvirtual = 'Y' " +
|
||||
" AND a.pk_material = '[pkMaterial]'" +
|
||||
" AND b.isbusinessunit = 'Y'" +
|
||||
" AND " + inStr;
|
||||
countSql1 = countSql1.replace("[pkMaterial]", pkMaterial);
|
||||
Integer num1 = (Integer) getDao().executeQuery(countSql1, new ColumnProcessor());
|
||||
if (num1 > 0) {
|
||||
mesType = "0";
|
||||
}
|
||||
return mesType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新错误信息
|
||||
*/
|
||||
private void handleSyncMaterialExp(String pk_material, String errorCode) {
|
||||
if (MMValueCheck.isEmpty(pk_material)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String updateSql = "update bd_material set def30 = '[errorCode]' where pk_material = '[pk_material]'";
|
||||
updateSql = updateSql.replace("[pk_material]", pk_material);
|
||||
updateSql = updateSql.replace("[errorCode]", errorCode);
|
||||
int updatedRows = getDao().executeUpdate(updateSql);
|
||||
} catch (BusinessException e) {
|
||||
logDl.error("EpicMes-Material-handleSyncMaterialExp = " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,32 +6,25 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.trade.business.HYPubBO;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.bs.uapbd.util.MyHelper;
|
||||
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.pubitf.uapbd.IMaterialPubService;
|
||||
import nc.vo.bd.defdoc.DefdocVO;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.vo.bd.material.MaterialVO;
|
||||
import nc.vo.bd.material.marbasclass.MarBasClassVO;
|
||||
import nc.vo.bd.material.plan.MaterialPlanVO;
|
||||
import nc.vo.org.OrgVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.framework.core.exception.ExceptionUtils;
|
||||
import nccloud.framework.core.json.IJson;
|
||||
import nccloud.framework.web.action.itf.ICommonAction;
|
||||
import nccloud.framework.web.container.IRequest;
|
||||
import nccloud.framework.web.json.JsonFactory;
|
||||
import nccloud.web.mmpub.pub.resexp.PfResumeExceptionNccUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 箱变-物料同步启源
|
||||
|
|
@ -44,48 +37,57 @@ public class MaterialPushToQmsAction implements ICommonAction {
|
|||
private static final Log logger = Log.getInstance(LOG_INFO_NAME);
|
||||
private static final String reqUrl = "/IF_QyErpApi.ashx?action=addwlxx";
|
||||
private Map<String, String> configParams;
|
||||
private BaseDAO dao;
|
||||
|
||||
public BaseDAO getDao() {
|
||||
if (dao == null) {
|
||||
dao = new BaseDAO();
|
||||
}
|
||||
return dao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object doAction(IRequest request) {
|
||||
String read = request.read();
|
||||
|
||||
JSONObject jsonObject = getParamJson(request);
|
||||
List<String> pks = JSONObject.parseArray(jsonObject.get("pks").toString(), String.class);
|
||||
HYPubBO hyPub = new HYPubBO();
|
||||
IJson json = JsonFactory.create();
|
||||
Map<String, Object> info = json.fromJson(read, Map.class);
|
||||
try {
|
||||
String materialCodeArr = (String) info.get("pk_material"); // 获取所有物料编码
|
||||
if (materialCodeArr == null) {
|
||||
if (MMValueCheck.isEmpty(pks)) {
|
||||
ExceptionUtils.wrapBusinessException("物料不能为空");
|
||||
}
|
||||
// String[] pks = materialCodeArr.split(",");
|
||||
MaterialVO useVOs = (MaterialVO) hyPub.queryByPrimaryKey(MaterialVO.class, materialCodeArr);
|
||||
// MaterialVO[] materialVOS=new MaterialVO[(useVOs)];
|
||||
configParams = MyHelper.getConfigParams("xb-config", null);
|
||||
if (configParams.isEmpty()) {
|
||||
throw new BusinessException("箱变的QMS接口缺少配置");
|
||||
}
|
||||
buildSyncData(new MaterialVO[]{useVOs}, "1002");
|
||||
|
||||
} catch (Exception ex) {
|
||||
try {
|
||||
throw new BusinessException(ex.getMessage());
|
||||
} catch (BusinessException e) {
|
||||
throw new RuntimeException(e);
|
||||
List<MaterialVO> voList = new ArrayList<>();
|
||||
for (String pkMaterial : pks) {
|
||||
MaterialVO materialVO = (MaterialVO) hyPub.queryByPrimaryKey(MaterialVO.class, pkMaterial);
|
||||
if (materialVO == null) {
|
||||
continue;
|
||||
}
|
||||
Integer num = MyHelper.checkIfOrg(configParams, pkMaterial, "xbOrg");
|
||||
if (num <= 0) {
|
||||
throw new BusinessException("物料组织非箱变,物料主键:" + pkMaterial + ",物料编码:" + materialVO.getCode());
|
||||
}
|
||||
voList.add(materialVO);
|
||||
}
|
||||
buildSyncData(voList);
|
||||
return ResultMessageUtil.toJSON(true, "推送成功");
|
||||
} catch (Exception ex) {
|
||||
return PfResumeExceptionNccUtils.handleResumeException(ex);
|
||||
}
|
||||
return "success";
|
||||
}
|
||||
|
||||
private void buildSyncData(MaterialVO[] useVOs, String eventType) throws BusinessException {
|
||||
private JSONObject getParamJson(IRequest iRequest) {
|
||||
String json = iRequest.getJson();
|
||||
JSONObject jsonObject = JSONObject.parseObject(json);
|
||||
JSONObject busiParamJson = jsonObject.getJSONObject("busiParamJson");
|
||||
return busiParamJson;
|
||||
}
|
||||
|
||||
private void buildSyncData(List<MaterialVO> useVOs) 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);
|
||||
Integer num = MyHelper.checkIfOrg(configParams, pkMaterial, "xbOrg");
|
||||
if (!"1002".equals(eventType) && (num <= 0)) {
|
||||
continue;
|
||||
}
|
||||
// 字段值翻译
|
||||
String pk_marbasclass = vo.getPk_marbasclass();
|
||||
String mrlTypeName = MyHelper.getStrValByCondition(MarBasClassVO.getDefaultTableName(), MarBasClassVO.CODE,
|
||||
|
|
@ -109,7 +111,7 @@ public class MaterialPushToQmsAction implements ICommonAction {
|
|||
String wlxhgg = MyHelper.skipNull(vo.getMaterialtype()) + MyHelper.skipNull(vo.getMaterialspec());
|
||||
contentObj.put("wlxhgg", wlxhgg); // 物料型号规格
|
||||
contentObj.put("wlfl", mrlTypeName); // 物料分类
|
||||
contentObj.put("wlbz", getMrlType(vo.getPk_material(),configParams.get("mrlOrg"))); // 物料标志
|
||||
contentObj.put("wlbz", getMrlType(pkMaterial, configParams.get("mrlOrg"))); // 物料标志
|
||||
contentObj.put("sjjldw", unitMap.get("unitname")); // 设计计量单位
|
||||
contentObj.put("cgjldw", unitMap.get("deputy_unitname")); // 采购计量单位
|
||||
contentObj.put("zhxs", unitMap.getOrDefault("convertRate", "1.00")); // 转换系数
|
||||
|
|
@ -143,17 +145,16 @@ public class MaterialPushToQmsAction implements ICommonAction {
|
|||
}
|
||||
|
||||
private void updateBs(String pkMaterial) throws DAOException {
|
||||
BaseDAO dao = new BaseDAO();
|
||||
String sql = "update BD_MATERIAL set def36='Y' where pk_material='"
|
||||
+ pkMaterial + "'";
|
||||
dao.executeUpdate(sql);
|
||||
getDao().executeUpdate(sql);
|
||||
}
|
||||
|
||||
|
||||
private Object getMrlType(String pkMaterial, String xbOrg) throws DAOException {
|
||||
String sql = " select martype from bd_materialstock left join org_stockorg on org_stockorg.pk_stockorg = bd_materialstock.pk_org " +
|
||||
" where pk_material = '" + pkMaterial + "' AND bd_materialstock.dr=0 " + " and org_stockorg.code = '" + xbOrg + "' ";
|
||||
Object map = (Object) new BaseDAO().executeQuery(sql,new ColumnProcessor());
|
||||
Object map = (Object) getDao().executeQuery(sql, new ColumnProcessor());
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +163,6 @@ public class MaterialPushToQmsAction implements ICommonAction {
|
|||
* 推送同步数据
|
||||
*/
|
||||
private void pushData(JSONObject param) throws BusinessException {
|
||||
// String jsonString = param.toJSONString();
|
||||
// 转json字符串的时候保留null值
|
||||
String jsonStr = JSON.toJSONString(param,
|
||||
SerializerFeature.WriteMapNullValue,
|
||||
|
|
@ -190,53 +190,9 @@ public class MaterialPushToQmsAction implements ICommonAction {
|
|||
"left join bd_measdoc c on a.pk_measdoc = c.pk_measdoc " +
|
||||
"left join bd_measdoc d on b.pk_measdoc = d.pk_measdoc " +
|
||||
"where a.pk_material = '" + pkMaterial + "' ";
|
||||
Map map = (Map) new BaseDAO().executeQuery(sql, new MapProcessor());
|
||||
Map map = (Map) getDao().executeQuery(sql, new MapProcessor());
|
||||
map.put("convertRate", MyHelper.transferSpecialField(map.get("measrate") + ""));
|
||||
return map;
|
||||
}
|
||||
|
||||
private boolean checkIfOrg(String code, Map<String, String> configParams) throws BusinessException {
|
||||
String targetCode = configParams.get("jmOrg");
|
||||
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
|
||||
throw new BusinessException("未配置组织参数");
|
||||
}
|
||||
String[] orgItem = targetCode.split(",");
|
||||
for (String orgCode : orgItem) {
|
||||
if (!orgCode.isEmpty() && orgCode.equals(code)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Map<String, MaterialPlanVO> queryMaterialPlanInfoByPks(String[] pks, String pk_stockorg,
|
||||
String[] fields) throws BusinessException {
|
||||
Map<String, MaterialPlanVO> map = null;
|
||||
List<String> vids = Stream.of(pks).filter(Objects::nonNull).distinct().toList();
|
||||
if (vids.isEmpty()) {
|
||||
map = new HashMap<>();
|
||||
} else {
|
||||
map = NCLocator.getInstance().lookup(IMaterialPubService.class)
|
||||
.queryMaterialPlanInfoByPks(vids.toArray(new String[0]), pk_stockorg, fields);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自定义项信息
|
||||
*/
|
||||
private String getDefName(String code, String pk_defdoc) {
|
||||
String res = "";
|
||||
String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='" + code + "' and dr=0 ) and dr = 0 and pk_defdoc = '" + pk_defdoc + "'";
|
||||
try {
|
||||
DefdocVO[] defdocVOs = (DefdocVO[]) new HYSuperDMO().queryByWhereClause(DefdocVO.class, strWhere);
|
||||
if (defdocVOs != null && defdocVOs.length > 0) {
|
||||
res = defdocVOs[0].getName().trim();
|
||||
}
|
||||
} catch (DAOException e) {
|
||||
logger.error("gyMes-SaleOrder-error,getDefName[" + e.getMessage() + "]");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,4 +15,9 @@
|
|||
<label>精密物料推送启源MES</label>
|
||||
<clazz>nccloud.web.uapbd.material.action.MaterialJmPushToQyMesAction</clazz>
|
||||
</action>
|
||||
<action>
|
||||
<name>uapbd.material.pushtodldzmes</name>
|
||||
<label>电力电子物料推送艾普MES</label>
|
||||
<clazz>nccloud.web.uapbd.material.action.MaterialPushToEpicMesAction</clazz>
|
||||
</action>
|
||||
</actions>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<action>uapbd.material.downloadPlmFile</action>
|
||||
<action>uapbd.material.pushtoqms</action>
|
||||
<action>uapbd.material.pushtojmqy</action>
|
||||
<action>uapbd.material.pushtodldzmes</action>
|
||||
</actions>
|
||||
</authorize>
|
||||
</authorizes>
|
||||
|
|
|
|||
Loading…
Reference in New Issue