MES物料消耗存储修改

This commit is contained in:
李兴辉 2025-04-07 14:50:30 +08:00
parent cdc5c3218b
commit 49b9e19090
2 changed files with 10 additions and 10 deletions

View File

@ -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<Map<String, Object>> maps = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, new HashMap<String,Object>());
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"));
}

View File

@ -75,7 +75,6 @@ public class MESToWMSServiceImpl implements MESToWMSService {
List<MaterialPackingKey> mpList = new ArrayList<>();
int success = 0;
String errorCode = "";
String wo = "";
//根据woqtymaterialSpecName生成物料消耗
/**
* 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<String, Object> bindMap = new HashMap<String, Object>() {
{
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<String, Object> 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));