销售订单取消审批后推送高压MES接口,销售订单审批后推送高压MES修改接口,生产订单审批后推送高压MES修改接口,生产订单取消审批后推送高压MES接口
This commit is contained in:
parent
c4a151c7e6
commit
06504b3aa8
|
|
@ -89,14 +89,14 @@ public class AfterApproveCancelSyncHighpressureMesRule implements IRule<PMOAggVO
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (cmoidObj.size() > 1) {
|
if (cmoidObj.size() > 1) {
|
||||||
for (int i = 0; i < cmoidObj.size(); i++) {
|
for (int i = 0; i < cmoidObj.size(); i++) {
|
||||||
sb.append("'").append(cmoidObj.get(i)).append("'");
|
sb.append(cmoidObj.get(i));
|
||||||
if (i < cmoidObj.size() - 1) {
|
if (i < cmoidObj.size() - 1) {
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = sb.toString();
|
result = sb.toString();
|
||||||
} else {
|
} else {
|
||||||
result = "'" + (String) cmoidObj.get(0) + "'";
|
result = (String) cmoidObj.get(0);
|
||||||
}
|
}
|
||||||
list.put("bipChildId", result); // ×ÓÏîÖ÷¼üID
|
list.put("bipChildId", result); // ×ÓÏîÖ÷¼üID
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
|
||||||
HYPubBO hybo = new HYPubBO();
|
HYPubBO hybo = new HYPubBO();
|
||||||
JSONObject list = new JSONObject();
|
JSONObject list = new JSONObject();
|
||||||
JSONArray jsonArray = new JSONArray();
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
String flags = "";//判断是否新增或修改
|
||||||
for (PMOAggVO vo : useVOs) {
|
for (PMOAggVO vo : useVOs) {
|
||||||
PMOHeadVO pmoHeadVO = vo.getParentVO();
|
PMOHeadVO pmoHeadVO = vo.getParentVO();
|
||||||
PMOItemVO[] itemVOS = vo.getChildrenVO();
|
PMOItemVO[] itemVOS = vo.getChildrenVO();
|
||||||
|
|
@ -74,84 +75,159 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
|
||||||
singleObj.put("billDate", pmoHeadVO.getDbilldate().toString()); // 单据日期
|
singleObj.put("billDate", pmoHeadVO.getDbilldate().toString()); // 单据日期
|
||||||
singleObj.put("orderVersion", pmoHeadVO.getVersion()); // 版本号
|
singleObj.put("orderVersion", pmoHeadVO.getVersion()); // 版本号
|
||||||
singleObj.put("orderTranType", pmoHeadVO.getVtrantypecode()); // 订单交易类型
|
singleObj.put("orderTranType", pmoHeadVO.getVtrantypecode()); // 订单交易类型
|
||||||
String sql1 = " select user_name from sm_user where cuserid = '" + pmoHeadVO.getCreator() + "' ";
|
|
||||||
String bipCreateBy = (String) baseDAO.executeQuery(sql1, new ColumnProcessor());
|
|
||||||
|
|
||||||
singleObj.put("bipCreateBy", bipCreateBy); // 创建人ID
|
|
||||||
|
|
||||||
// 创建子项数组
|
// 创建子项数组
|
||||||
JSONArray contentArray = new JSONArray();
|
JSONArray contentArray = new JSONArray();
|
||||||
|
|
||||||
for (PMOItemVO item : itemVOS) {
|
for (PMOItemVO item : itemVOS) {
|
||||||
JSONObject itemObj = new JSONObject();
|
//自定义项30是Y时调用修改口,若不是则调用新增口
|
||||||
|
String saleDef = (String) item.getAttributeValue("vdef30") == null ? "" : (String) item.getAttributeValue("vdef30");
|
||||||
|
if (!saleDef.equals("Y")) {
|
||||||
|
// 更新自定义项30为“Y”
|
||||||
|
String updatesql = "update mm_mo set vdef30 = '" + "Y" + "' where cmoid = '" + item.getCmoid() + "'";
|
||||||
|
baseDAO.executeUpdate(updatesql);
|
||||||
|
|
||||||
// 填充子项基础信息
|
JSONObject itemObj = new JSONObject();
|
||||||
|
// 填充子项基础信息
|
||||||
|
|
||||||
String sql = " select pk_defdoclist from bd_defdoclist where code='zdy-001' and dr=0 ";
|
String sql = " select pk_defdoclist from bd_defdoclist where code='zdy-001' and dr=0 ";
|
||||||
String o = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
|
String o = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
|
||||||
|
|
||||||
Object contractNum = hybo.findColValue("bd_defdoc", "code", " (pk_defdoclist = '" + o + "' and pk_defdoc='" + item.getVdef1() + "') ");
|
Object contractNum = hybo.findColValue("bd_defdoc", "code", " (pk_defdoclist = '" + o + "' and pk_defdoc='" + item.getVdef1() + "') ");
|
||||||
|
|
||||||
itemObj.put("contractNum", contractNum); // 合同编号
|
itemObj.put("contractNum", contractNum); // 合同编号
|
||||||
itemObj.put("cwarehouseid", item.getAttributeValue("vbdef35")); // 合同编号
|
itemObj.put("cwarehouseid", item.getAttributeValue("vbdef35")); // 合同编号
|
||||||
Object pk_project = hybo.findColValue("bd_project", "project_name", " pk_project = '" + item.getCprojectid() + "' ");
|
Object pk_project = hybo.findColValue("bd_project", "project_name", " pk_project = '" + item.getCprojectid() + "' ");
|
||||||
|
|
||||||
itemObj.put("entryName", pk_project); // 项目名称
|
itemObj.put("entryName", pk_project); // 项目名称
|
||||||
itemObj.put("bipChildId", item.getCmoid()); // 子项主键ID
|
itemObj.put("bipChildId", item.getCmoid()); // 子项主键ID
|
||||||
|
|
||||||
// 部门信息
|
// 部门信息
|
||||||
String deptsql = " select code,name from org_dept where pk_dept='" + item.getCdeptid() + "' and dr=0 ";
|
String deptsql = " select code,name from org_dept where pk_dept='" + item.getCdeptid() + "' and dr=0 ";
|
||||||
Map<String, Object> tr = (Map<String, Object>) baseDAO.executeQuery(deptsql, new MapProcessor());
|
Map<String, Object> tr = (Map<String, Object>) baseDAO.executeQuery(deptsql, new MapProcessor());
|
||||||
itemObj.put("bipDeptName", tr.get("name")); // 生产部门名称
|
itemObj.put("bipDeptName", tr.get("name")); // 生产部门名称
|
||||||
itemObj.put("bipDeptId", tr.get("code")); // 生产部门编码
|
itemObj.put("bipDeptId", tr.get("code")); // 生产部门编码
|
||||||
|
|
||||||
// 日期信息
|
// 日期信息
|
||||||
itemObj.put("requiredDate", item.getTrequiredate().toString()); // 需用日期
|
itemObj.put("requiredDate", item.getTrequiredate().toString()); // 需用日期
|
||||||
|
|
||||||
itemObj.put("bipParentProcessProductionOrderId", item.getVparentbillcode());
|
itemObj.put("bipParentProcessProductionOrderId", item.getVparentbillcode());
|
||||||
itemObj.put("bipParentProcessProductionOrderRowNum", item.getVparentmorowno());
|
itemObj.put("bipParentProcessProductionOrderRowNum", item.getVparentmorowno());
|
||||||
itemObj.put("bipOriginProcessProductionOrderId", item.getVsrccode());
|
itemObj.put("bipOriginProcessProductionOrderId", item.getVsrccode());
|
||||||
itemObj.put("bipOriginProcessProductionOrderRowNum", item.getVsrcrowno());
|
itemObj.put("bipOriginProcessProductionOrderRowNum", item.getVsrcrowno());
|
||||||
|
|
||||||
// 物料信息
|
// 物料信息
|
||||||
String mrlsql = "select code,name,graphid,pk_measdoc,materialspec from bd_material where pk_material = '" + item.getCmaterialvid() + "' ";
|
String mrlsql = "select code,name,graphid,pk_measdoc,materialspec from bd_material where pk_material = '" + item.getCmaterialvid() + "' ";
|
||||||
Map<String, Object> mrl = (Map<String, Object>) baseDAO.executeQuery(mrlsql, new MapProcessor());
|
Map<String, Object> mrl = (Map<String, Object>) baseDAO.executeQuery(mrlsql, new MapProcessor());
|
||||||
itemObj.put("materialCode", mrl.get("code")); // 物料编码
|
itemObj.put("materialCode", mrl.get("code")); // 物料编码
|
||||||
itemObj.put("materialName", mrl.get("name")); // 物料名称
|
itemObj.put("materialName", mrl.get("name")); // 物料名称
|
||||||
// itemObj.put("drawingNumber", mrl.get("graphid")); // 图号编码 graphid
|
// itemObj.put("drawingNumber", mrl.get("graphid")); // 图号编码 graphid
|
||||||
itemObj.put("drawingNumber","1234");
|
itemObj.put("drawingNumber", "1234");
|
||||||
Object unit = hybo.findColValue("bd_measdoc", "code", " pk_measdoc = '" + mrl.get("pk_measdoc") + "' ");
|
Object unit = hybo.findColValue("bd_measdoc", "code", " pk_measdoc = '" + mrl.get("pk_measdoc") + "' ");
|
||||||
|
|
||||||
itemObj.put("unit", unit); // 单位 pk_measdoc
|
itemObj.put("unit", unit); // 单位 pk_measdoc
|
||||||
|
|
||||||
// 生产信息
|
// 生产信息
|
||||||
itemObj.put("intervalModel", mrl.get("materialspec")); // 产品类型
|
itemObj.put("intervalModel", mrl.get("materialspec")); // 产品类型
|
||||||
// itemObj.put("processCode", item.getProcedures()); // 工序编码
|
// itemObj.put("processCode", item.getProcedures()); // 工序编码
|
||||||
itemObj.put("lineNumber", String.valueOf(item.getVrowno())); // 行号
|
itemObj.put("lineNumber", String.valueOf(item.getVrowno())); // 行号
|
||||||
|
|
||||||
// 库存信息
|
// 库存信息
|
||||||
itemObj.put("demandInventoryOrganization", item.getCrequireorg()); // 需求库存组织
|
itemObj.put("demandInventoryOrganization", item.getCrequireorg()); // 需求库存组织
|
||||||
itemObj.put("plannedInputQuantity",(int) item.getNplanputastnum().doubleValue()); // 计划投入量
|
itemObj.put("plannedInputQuantity", (int) item.getNplanputastnum().doubleValue()); // 计划投入量
|
||||||
itemObj.put("plannedOutputQuantity",(int)item.getNmmastnum().doubleValue()); // 计划产出量
|
itemObj.put("plannedOutputQuantity", (int) item.getNmmastnum().doubleValue()); // 计划产出量
|
||||||
itemObj.put("plannedStartTime", item.getTplanstarttime().toString()); // 计划开工时间
|
itemObj.put("plannedStartTime", item.getTplanstarttime().toString()); // 计划开工时间
|
||||||
itemObj.put("plannedCompletionTime", item.getTplanendtime().toString()); // 计划完工时间
|
itemObj.put("plannedCompletionTime", item.getTplanendtime().toString()); // 计划完工时间
|
||||||
itemObj.put("customerMaterialCode", item.getCcustmaterialid()); // 客户物料编码
|
itemObj.put("customerMaterialCode", item.getCcustmaterialid()); // 客户物料编码
|
||||||
itemObj.put("productionBatch", item.getCbatchid()); // 生产批次(按BIP格式)
|
itemObj.put("productionBatch", item.getCbatchid()); // 生产批次(按BIP格式)
|
||||||
itemObj.put("productionBatchNumber", item.getVbatchcode()); // 生产批次号(按BIP格式)
|
itemObj.put("productionBatchNumber", item.getVbatchcode()); // 生产批次号(按BIP格式)
|
||||||
|
|
||||||
|
contentArray.add(itemObj); // 将子项添加到数组
|
||||||
|
|
||||||
|
flags = "addOrder";
|
||||||
|
} else {
|
||||||
|
JSONObject itemObj = new JSONObject();
|
||||||
|
|
||||||
|
// 填充子项基础信息
|
||||||
|
|
||||||
|
String sql = " select pk_defdoclist from bd_defdoclist where code='zdy-001' and dr=0 ";
|
||||||
|
String o = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
|
||||||
|
|
||||||
|
Object contractNum = hybo.findColValue("bd_defdoc", "code", " (pk_defdoclist = '" + o + "' and pk_defdoc='" + item.getVdef1() + "') ");
|
||||||
|
|
||||||
|
itemObj.put("contractNum", contractNum); // 合同编号
|
||||||
|
// itemObj.put("cwarehouseid", item.getAttributeValue("vbdef35")); // 仓库编号
|
||||||
|
Object pk_project = hybo.findColValue("bd_project", "project_name", " pk_project = '" + item.getCprojectid() + "' ");
|
||||||
|
|
||||||
|
itemObj.put("entryName", pk_project); // 项目名称
|
||||||
|
|
||||||
|
// 部门信息
|
||||||
|
String deptsql = " select code,name from org_dept where pk_dept='" + item.getCdeptid() + "' and dr=0 ";
|
||||||
|
Map<String, Object> tr = (Map<String, Object>) baseDAO.executeQuery(deptsql, new MapProcessor());
|
||||||
|
itemObj.put("bipChildId", item.getCmoid()); // 子项主键ID
|
||||||
|
itemObj.put("bipDeptName", tr.get("name")); // 生产部门名称
|
||||||
|
itemObj.put("bipDeptId", tr.get("code")); // 生产部门编码
|
||||||
|
|
||||||
|
// 日期信息
|
||||||
|
itemObj.put("requiredDate", item.getTrequiredate().toString()); // 需用日期
|
||||||
|
|
||||||
|
itemObj.put("bipParentProcessProductionOrderId", item.getVparentbillcode());
|
||||||
|
itemObj.put("bipParentProcessProductionOrderRowNum", item.getVparentmorowno());
|
||||||
|
itemObj.put("bipOriginProcessProductionOrderId", item.getVsalebillcode());
|
||||||
|
itemObj.put("bipOriginProcessProductionOrderRowNum", "");
|
||||||
|
|
||||||
|
// 物料信息
|
||||||
|
String mrlsql = "select code,name,graphid,pk_measdoc,materialspec from bd_material where pk_material = '" + item.getCmaterialvid() + "' ";
|
||||||
|
Map<String, Object> mrl = (Map<String, Object>) baseDAO.executeQuery(mrlsql, new MapProcessor());
|
||||||
|
itemObj.put("materialCode", mrl.get("code")); // 物料编码
|
||||||
|
itemObj.put("materialName", mrl.get("name")); // 物料名称
|
||||||
|
// itemObj.put("drawingNumber", mrl.get("graphid")); // 图号编码 graphid
|
||||||
|
itemObj.put("drawingNumber", mrl.get("graphid"));
|
||||||
|
Object unit = hybo.findColValue("bd_measdoc", "code", " pk_measdoc = '" + mrl.get("pk_measdoc") + "' ");
|
||||||
|
|
||||||
|
itemObj.put("unit", unit); // 单位 pk_measdoc
|
||||||
|
|
||||||
|
// 生产信息
|
||||||
|
itemObj.put("intervalModel", mrl.get("materialspec")); // 产品类型
|
||||||
|
// itemObj.put("processCode", item.getProcedures()); // 工序编码
|
||||||
|
itemObj.put("lineNumber", String.valueOf(item.getVrowno())); // 行号
|
||||||
|
|
||||||
|
// 库存信息
|
||||||
|
itemObj.put("demandInventoryOrganization", item.getCrequireorg()); // 需求库存组织
|
||||||
|
itemObj.put("plannedInputQuantity", (int) item.getNplanputastnum().doubleValue()); // 计划投入量
|
||||||
|
itemObj.put("plannedOutputQuantity", (int) item.getNmmastnum().doubleValue()); // 计划产出量
|
||||||
|
itemObj.put("plannedStartTime", item.getTplanstarttime().toString()); // 计划开工时间
|
||||||
|
itemObj.put("plannedCompletionTime", item.getTplanendtime().toString()); // 计划完工时间
|
||||||
|
itemObj.put("customerMaterialCode", item.getCcustmaterialid()); // 客户物料编码
|
||||||
|
itemObj.put("productionBatch", item.getCbatchid()); // 生产批次(按BIP格式)
|
||||||
|
itemObj.put("productionBatchNumber", item.getVbatchcode()); // 生产批次号(按BIP格式)
|
||||||
|
|
||||||
|
contentArray.add(itemObj); // 将子项添加到数组
|
||||||
|
|
||||||
|
flags = "updateOrder";
|
||||||
|
}
|
||||||
|
|
||||||
contentArray.add(itemObj); // 将子项添加到数组
|
|
||||||
}
|
}
|
||||||
|
if (flags.equals("addOrder")) {
|
||||||
|
String sql1 = " select user_name from sm_user where cuserid = '" + pmoHeadVO.getCreator() + "' ";
|
||||||
|
String bipCreateBy = (String) baseDAO.executeQuery(sql1, new ColumnProcessor());
|
||||||
|
singleObj.put("bipCreateBy", bipCreateBy); // 创建人ID
|
||||||
|
} else if (flags.equals("updateOrder")){
|
||||||
|
String sql1 = " select user_name from sm_user where cuserid = '" + pmoHeadVO.getModifier() + "' ";
|
||||||
|
String bipUpdateBy = (String) baseDAO.executeQuery(sql1, new ColumnProcessor());
|
||||||
|
singleObj.put("bipUpdateBy", bipUpdateBy); // 修改人ID
|
||||||
|
}
|
||||||
singleObj.put("itemList", contentArray); // 将子项数组添加到主对象
|
singleObj.put("itemList", contentArray); // 将子项数组添加到主对象
|
||||||
jsonArray.add(singleObj);
|
jsonArray.add(singleObj);
|
||||||
list.put("list", jsonArray);
|
list.put("list", jsonArray);
|
||||||
}
|
}
|
||||||
pushData(list);
|
pushData(list, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送同步数据
|
* 推送同步数据
|
||||||
*/
|
*/
|
||||||
private void pushData(JSONObject param) throws BusinessException {
|
private void pushData(JSONObject param, String flags) throws BusinessException {
|
||||||
// 转json字符串的时候保留null值
|
// 转json字符串的时候保留null值
|
||||||
String jsonStr = JSON.toJSONString(param,
|
String jsonStr = JSON.toJSONString(param,
|
||||||
SerializerFeature.WriteMapNullValue,
|
SerializerFeature.WriteMapNullValue,
|
||||||
|
|
@ -159,7 +235,12 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
|
||||||
);
|
);
|
||||||
logger.error("gyMes-PMO-param = " + jsonStr);
|
logger.error("gyMes-PMO-param = " + jsonStr);
|
||||||
String baseUrl = configParams.get("mesBaseUrl");
|
String baseUrl = configParams.get("mesBaseUrl");
|
||||||
String requestUrl = baseUrl + configParams.get("productionOrderAdd");
|
String requestUrl = "";
|
||||||
|
if (flags.equals("addOrder")) {
|
||||||
|
requestUrl = baseUrl + configParams.get("productionOrderAdd");
|
||||||
|
} else if (flags.equals("updateOrder")) {//调用修改口
|
||||||
|
requestUrl = baseUrl + configParams.get("productionOrderUpdate");
|
||||||
|
}
|
||||||
logger.error("gyMes-PMO-url = " + requestUrl);
|
logger.error("gyMes-PMO-url = " + requestUrl);
|
||||||
String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr);
|
String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr);
|
||||||
JSONObject resultObj = JSONObject.parseObject(result);
|
JSONObject resultObj = JSONObject.parseObject(result);
|
||||||
|
|
|
||||||
|
|
@ -83,14 +83,14 @@ public class AfterSoCancelSyncRuleGyMes implements IRule<SaleOrderVO> {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (cmoidObj.size() > 1) {
|
if (cmoidObj.size() > 1) {
|
||||||
for (int i = 0; i < cmoidObj.size(); i++) {
|
for (int i = 0; i < cmoidObj.size(); i++) {
|
||||||
sb.append("'").append(cmoidObj.get(i)).append("'");
|
sb.append(cmoidObj.get(i));
|
||||||
if (i < cmoidObj.size() - 1) {
|
if (i < cmoidObj.size() - 1) {
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = sb.toString();
|
result = sb.toString();
|
||||||
} else {
|
} else {
|
||||||
result = "'" + (String) cmoidObj.get(0) + "'";
|
result = (String) cmoidObj.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// È¡ÏûÉóÅúÈË
|
// È¡ÏûÉóÅúÈË
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,10 @@ import nc.bs.uapbd.util.MyHelper;
|
||||||
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
||||||
import nc.impl.pubapp.pattern.rule.IRule;
|
import nc.impl.pubapp.pattern.rule.IRule;
|
||||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||||
|
import nc.jdbc.framework.processor.MapListProcessor;
|
||||||
import nc.jdbc.framework.processor.MapProcessor;
|
import nc.jdbc.framework.processor.MapProcessor;
|
||||||
import nc.vo.bd.defdoc.DefdocVO;
|
import nc.vo.bd.defdoc.DefdocVO;
|
||||||
|
import nc.vo.bd.material.MaterialVO;
|
||||||
import nc.vo.org.OrgVO;
|
import nc.vo.org.OrgVO;
|
||||||
import nc.vo.pmpub.project.ProjectHeadVO;
|
import nc.vo.pmpub.project.ProjectHeadVO;
|
||||||
import nc.vo.pub.BusinessException;
|
import nc.vo.pub.BusinessException;
|
||||||
|
|
@ -23,6 +25,9 @@ import nc.vo.so.m30.entity.SaleOrderHVO;
|
||||||
import nc.vo.so.m30.entity.SaleOrderVO;
|
import nc.vo.so.m30.entity.SaleOrderVO;
|
||||||
import nccloud.baseapp.core.log.NCCForUAPLogger;
|
import nccloud.baseapp.core.log.NCCForUAPLogger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -34,6 +39,7 @@ public class AfterSoSyncRuleGyMes implements IRule<SaleOrderVO> {
|
||||||
private static final String LOG_INFO_NAME = "gymeslog";
|
private static final String LOG_INFO_NAME = "gymeslog";
|
||||||
private static final Log logger = Log.getInstance(LOG_INFO_NAME);
|
private static final Log logger = Log.getInstance(LOG_INFO_NAME);
|
||||||
private static final String reqUrl = "/bip/order/saleOrderAdd";
|
private static final String reqUrl = "/bip/order/saleOrderAdd";
|
||||||
|
private static final String reqUrl_update = "/bip/order/saleOrderUpdate";
|
||||||
private Map<String, String> configParams;
|
private Map<String, String> configParams;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -77,27 +83,59 @@ public class AfterSoSyncRuleGyMes implements IRule<SaleOrderVO> {
|
||||||
// 合同编号
|
// 合同编号
|
||||||
String vdef6 = hvo.getVdef6();
|
String vdef6 = hvo.getVdef6();
|
||||||
String contractNum = getDefCode("zdy-001", vdef6);
|
String contractNum = getDefCode("zdy-001", vdef6);
|
||||||
for (SaleOrderBVO item : itemVOS) {
|
|
||||||
Object projectName =getDefName("zdy-001", vdef6);
|
|
||||||
// Object projectName = hybo.findColValue(ProjectHeadVO.getDefaultTableName(), ProjectHeadVO.PROJECT_NAME, ProjectHeadVO.PK_PROJECT + " = '" + item.getCprojectid() + "' ");
|
|
||||||
String wlsql = " select code,name,graphid from bd_material where dr = 0 and pk_material = '" + item.getCmaterialvid() + "' ";
|
|
||||||
Map<String, Object> mrlMap = (Map<String, Object>) baseDAO.executeQuery(wlsql, new MapProcessor());
|
|
||||||
|
|
||||||
JSONObject itemObj = new JSONObject();
|
//自定义项26是Y时调用修改口,若不是则调用新增口
|
||||||
itemObj.put("contractNum", contractNum);// 合同编码
|
String saleDef = hvo.getVdef26()== null ? "" : hvo.getVdef26();
|
||||||
itemObj.put("bipOrderId", hvo.getVbillcode());// 销售订单号
|
if (!saleDef.equals("Y")) {
|
||||||
itemObj.put("bipId", item.getCsaleorderbid());// 主键ID
|
// 更新自定义项26为“Y”
|
||||||
itemObj.put("entryName", projectName);// 项目名称
|
String sql = "update so_saleorder set vdef26 = '" + "Y" + "' where vbillcode = '" + hvo.getVbillcode() + "'";
|
||||||
itemObj.put("productQuantity", item.getNastnum().doubleValue());// 数量
|
baseDAO.executeUpdate(sql);
|
||||||
itemObj.put("materialCode", mrlMap.get("code"));// 物料编码
|
|
||||||
itemObj.put("materialName", mrlMap.get("name"));// 物料名称
|
for (SaleOrderBVO item : itemVOS) {
|
||||||
itemObj.put("drawingNumber", mrlMap.get("graphid"));// 图号
|
Object projectName = getDefName("zdy-001", vdef6);
|
||||||
itemObj.put("supplyDate", item.getDreceivedate().toString());// 供货日期-要求收货日期
|
// Object projectName = hybo.findColValue(ProjectHeadVO.getDefaultTableName(), ProjectHeadVO.PROJECT_NAME, ProjectHeadVO.PK_PROJECT + " = '" + item.getCprojectid() + "' ");
|
||||||
itemObj.put("remark", item.getVrownote());// 备注
|
String wlsql = " select code,name,graphid from bd_material where dr = 0 and pk_material = '" + item.getCmaterialvid() + "' ";
|
||||||
itemObj.put("bipCreateBy", createName);// 创建人
|
Map<String, Object> mrlMap = (Map<String, Object>) baseDAO.executeQuery(wlsql, new MapProcessor());
|
||||||
itemObj.put("customers", customerName);// 客户
|
|
||||||
pushData(itemObj);
|
JSONObject itemObj = new JSONObject();
|
||||||
|
itemObj.put("contractNum", contractNum);// 合同编码
|
||||||
|
itemObj.put("bipOrderId", hvo.getVbillcode());// 销售订单号
|
||||||
|
itemObj.put("bipId", item.getCsaleorderbid());// 主键ID
|
||||||
|
itemObj.put("entryName", projectName);// 项目名称
|
||||||
|
itemObj.put("productQuantity", (int) item.getNastnum().doubleValue());// 数量
|
||||||
|
itemObj.put("materialCode", mrlMap.get("code"));// 物料编码
|
||||||
|
itemObj.put("materialName", mrlMap.get("name"));// 物料名称
|
||||||
|
itemObj.put("drawingNumber", mrlMap.get("graphid"));// 图号
|
||||||
|
itemObj.put("supplyDate", item.getDreceivedate().toString());// 供货日期-要求收货日期
|
||||||
|
itemObj.put("remark", item.getVrownote());// 备注
|
||||||
|
itemObj.put("bipCreateBy", createName);// 创建人
|
||||||
|
itemObj.put("customers", customerName);// 客户
|
||||||
|
pushData(itemObj);
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (SaleOrderBVO item : itemVOS) {
|
||||||
|
Object projectName = getDefName("zdy-001", vdef6);
|
||||||
|
String wlsql = " select code,name,graphid from bd_material where dr = 0 and pk_material = '" + item.getCmaterialvid() + "' ";
|
||||||
|
Map<String, Object> mrlMap = (Map<String, Object>) baseDAO.executeQuery(wlsql, new MapProcessor());
|
||||||
|
|
||||||
|
JSONObject itemObj = new JSONObject();
|
||||||
|
itemObj.put("contractNum", contractNum);// 合同编码
|
||||||
|
itemObj.put("bipOrderId", hvo.getVbillcode());// 销售订单号
|
||||||
|
itemObj.put("entryName", projectName);// 项目名称
|
||||||
|
itemObj.put("productQuantity", (int) item.getNastnum().doubleValue());// 数量
|
||||||
|
itemObj.put("materialCode", mrlMap.get("code"));// 物料编码
|
||||||
|
itemObj.put("materialName", mrlMap.get("name"));// 物料名称
|
||||||
|
itemObj.put("drawingNumber", mrlMap.get("graphid"));// 图号
|
||||||
|
itemObj.put("supplyDate", item.getDreceivedate().toString());// 供货日期-要求收货日期
|
||||||
|
itemObj.put("remark", item.getVrownote());// 备注
|
||||||
|
itemObj.put("bipUpdateBy", createName);// 修改人
|
||||||
|
itemObj.put("customers", customerName);// 客户
|
||||||
|
pushData_Update(itemObj);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {
|
* {
|
||||||
* "contractNum": "TZF2520201225 合同编码",
|
* "contractNum": "TZF2520201225 合同编码",
|
||||||
|
|
@ -139,6 +177,28 @@ public class AfterSoSyncRuleGyMes implements IRule<SaleOrderVO> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送同步数据_修改口
|
||||||
|
*/
|
||||||
|
private void pushData_Update(JSONObject param) throws BusinessException {
|
||||||
|
// String jsonString = param.toJSONString();
|
||||||
|
// 转json字符串的时候保留null值
|
||||||
|
String jsonStr = JSON.toJSONString(param, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
|
||||||
|
logger.error("gyMes-SaleOrder-param = " + jsonStr);
|
||||||
|
NCCForUAPLogger.debug("gyMes-SaleOrder-param = " + jsonStr);
|
||||||
|
String baseUrl = configParams.get("mesBaseUrl");
|
||||||
|
String requestUrl = baseUrl + reqUrl_update;
|
||||||
|
logger.error("gyMes-SaleOrder-url = " + requestUrl);
|
||||||
|
String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr);
|
||||||
|
JSONObject resultObj = JSONObject.parseObject(result);
|
||||||
|
logger.error("gyMes-SaleOrder-res = " + result);
|
||||||
|
|
||||||
|
if (!"200".equals(resultObj.getString("code"))) {
|
||||||
|
logger.error("gyMes-SaleOrder-error,result[" + resultObj.toJSONString() + "]");
|
||||||
|
throw new BusinessException("销售订单推送高压MES错误:" + resultObj.getString("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean checkIfOrg(String code, Map<String, String> configParams) throws BusinessException {
|
private boolean checkIfOrg(String code, Map<String, String> configParams) throws BusinessException {
|
||||||
String targetCode = configParams.get("gyOrg");
|
String targetCode = configParams.get("gyOrg");
|
||||||
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
|
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
|
||||||
|
|
@ -170,6 +230,7 @@ public class AfterSoSyncRuleGyMes implements IRule<SaleOrderVO> {
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取自定义项信息
|
* 获取自定义项信息
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue