From 49b9e19090c470715376bfb44e9aa75bb46d5b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=B4=E8=BE=89?= Date: Mon, 7 Apr 2025 14:50:30 +0800 Subject: [PATCH] =?UTF-8?q?MES=E7=89=A9=E6=96=99=E6=B6=88=E8=80=97?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cim/idm/service/impl/ToSAPServiceImpl.java | 6 +++--- .../cim/idm/service/Impl/MESToWMSServiceImpl.java | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/zi-wms-inf/src/main/java/com/cim/idm/service/impl/ToSAPServiceImpl.java b/zi-wms-inf/src/main/java/com/cim/idm/service/impl/ToSAPServiceImpl.java index 0e93837..3503723 100644 --- a/zi-wms-inf/src/main/java/com/cim/idm/service/impl/ToSAPServiceImpl.java +++ b/zi-wms-inf/src/main/java/com/cim/idm/service/impl/ToSAPServiceImpl.java @@ -2384,7 +2384,7 @@ public class ToSAPServiceImpl { } //MES上报工单消耗数据-261工单投料 - public String mesMaterialConsume( String user,String wo) throws Exception { + public String mesMaterialConsume( String user ) throws Exception { String rcode; String undoId = ""; @@ -2424,7 +2424,7 @@ public class ToSAPServiceImpl { //用户名 body.put("USNAM", user); //查询临时表TEMP_MESCONSUME,从里面取数据 - String sql = "SELECT MATERIALSPECNAME, ERPFACTORY, ERPLOCATION, QTY, UNIT FROM TEMP_MESCONSUME"; + String sql = "SELECT MATERIALSPECNAME, ERPFACTORY, ERPLOCATION, QTY, UNIT,WO FROM TEMP_MESCONSUME"; List> maps = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, new HashMap()); if (maps == null || maps.size() < 1) { throw new RuntimeException("不存在需要发送的数据"); @@ -2453,7 +2453,7 @@ public class ToSAPServiceImpl { //ZLLITEM 自定义领料单行号 item.put("ZLLITEM", ""); //AUFNR 订单号 - item.put("AUFNR", wo); + item.put("AUFNR", maps.get(i).get("WO")); } diff --git a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MESToWMSServiceImpl.java b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MESToWMSServiceImpl.java index dbfba21..989cf1a 100644 --- a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MESToWMSServiceImpl.java +++ b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MESToWMSServiceImpl.java @@ -75,7 +75,6 @@ public class MESToWMSServiceImpl implements MESToWMSService { List mpList = new ArrayList<>(); int success = 0; String errorCode = ""; - String wo = ""; //根据wo,qty,materialSpecName生成物料消耗 /** * 1. 从MATERIALPACKINGMDC该要求先进先出取出满足消耗的charge @@ -88,11 +87,11 @@ public class MESToWMSServiceImpl implements MESToWMSService { JSONObject jb = in.getJSONObject(i); String materialSpecName = jb.get("materialSpecName").toString(); String qty = jb.get("qty").toString(); // 消耗数量 - wo = jb.get("requestName") == null ? "" : jb.get("requestName").toString(); // 工单 + String 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("参数不能为空"); + result = AjaxResult.me().setSuccess(false).setErrorCode(500).setMessage("料号或数量不能为空"); loginfo.setResultCode("1"); loginfo.setReturnMsg(JSONObject.toJSONString(result)); // 消息保存日志,erp推送wms的数据写入表BS_ERPMESSAGELOG中 @@ -113,12 +112,12 @@ public class MESToWMSServiceImpl implements MESToWMSService { // IDMFrameServiceProxy.getSqlTemplate().getJdbcTemplate().execute(procedureName); Map bindMap = new HashMap() { { - put("V_WO", materialSpecName); + put("V_WO", wo); put("V_MATERIALSPECNAME", materialSpecName); put("V_QTY", qty); put("V_FLAG", flag); -// put("V_RETURN_CODE", ""); -// put("V_RETURN_MESSAGE", ""); + put("V_RETURN_CODE", ""); + put("V_RETURN_MESSAGE", ""); } }; Map stringObjectMap = IDMFrameServiceProxy.getSqlTemplate().executeProcedure(procedureName, bindMap); @@ -128,13 +127,14 @@ public class MESToWMSServiceImpl implements MESToWMSService { 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); + return result; } } } // 将工单的物料消耗数据传给SAP - String undoId = toSAPService.mesMaterialConsume("MES", wo); + String undoId = toSAPService.mesMaterialConsume("MES"); result = AjaxResult.me().setSuccess(true).setErrorCode(200).setMessage("执行成功"); loginfo.setResultCode("0"); loginfo.setReturnMsg(JSONObject.toJSONString(result));