MES物料消耗存储修改

This commit is contained in:
李兴辉 2025-04-07 13:42:59 +08:00
parent 1da12d1945
commit 4388d3abda

View File

@ -69,7 +69,7 @@ public class MESToWMSServiceImpl implements MESToWMSService {
loginfo.setEventName("materialConsume_Request");
String siteName = System.getProperty("company", "SDK");
Map<String, Object> bindMap = new HashMap<>();
List<String> boxIdList = new ArrayList<>();
List<String> qtyList = new ArrayList<>();
List<MaterialPackingKey> mpList = new ArrayList<>();
@ -90,10 +90,44 @@ public class MESToWMSServiceImpl implements MESToWMSService {
String qty = jb.get("qty").toString(); // 消耗数量
wo = jb.get("requestName") == null ? "" : jb.get("requestName").toString(); // 工单
String flag = jb.get("flag") == null ? "" : jb.get("flag").toString();
//判空
if (StringUtils.isBlank(materialSpecName) || StringUtils.isBlank(qty)) {
result = AjaxResult.me().setSuccess(false).setErrorCode(500).setMessage("参数不能为空");
loginfo.setResultCode("1");
loginfo.setReturnMsg(JSONObject.toJSONString(result));
// 消息保存日志erp推送wms的数据写入表BS_ERPMESSAGELOG中
MessageLogUtil.writeMessageLog(loginfo);
}
if (StringUtils.isBlank(wo)) {
result = AjaxResult.me().setSuccess(false).setErrorCode(500).setMessage("工单不能为空");
loginfo.setResultCode("1");
loginfo.setReturnMsg(JSONObject.toJSONString(result));
// 消息保存日志erp推送wms的数据写入表BS_ERPMESSAGELOG中
MessageLogUtil.writeMessageLog(loginfo);
}
//调用存储MES_CONSUME
String procedureName = "CALL MES_CONSUME('" + wo + "', '" + materialSpecName + "','" + qty + "','" + flag + "' )";
String procedureName = "MES_CONSUME";
// 调用存储过程返回参数
IDMFrameServiceProxy.getSqlTemplate().getJdbcTemplate().execute(procedureName);
// IDMFrameServiceProxy.getSqlTemplate().getJdbcTemplate().execute(procedureName);
Map<String, Object> bindMap = new HashMap<String, Object>() {
{
put("V_WO", materialSpecName);
put("V_MATERIALSPECNAME", materialSpecName);
put("V_QTY", qty);
put("V_FLAG", flag);
// put("V_RETURN_CODE", "");
// put("V_RETURN_MESSAGE", "");
}
};
Map<String, Object> stringObjectMap = IDMFrameServiceProxy.getSqlTemplate().executeProcedure(procedureName, bindMap);
if (stringObjectMap != null) {
if (stringObjectMap.get("V_RETURN_CODE") != null && !stringObjectMap.get("V_RETURN_CODE").toString().equals("0")) {
errorCode = stringObjectMap.get("V_RETURN_CODE").toString();
String vReturnMessage = stringObjectMap.get("V_RETURN_MESSAGE").toString();
log.error("MES_CONSUME返回错误码" + errorCode + ",错误信息:" + vReturnMessage);
result = AjaxResult.me().setSuccess(false).setErrorCode(Integer.parseInt(errorCode)).setMessage(vReturnMessage);
}
}
}