请求错误信息显示优化
This commit is contained in:
@@ -27,6 +27,12 @@ public interface RequestLogMapper
|
||||
*/
|
||||
public List<RequestLog> selectRequestLogList(RequestLog requestLog);
|
||||
|
||||
/**
|
||||
* 获取最新的任务请求响应记录
|
||||
* @return
|
||||
*/
|
||||
public RequestLog selectRequestLogByLatestTask();
|
||||
|
||||
/**
|
||||
* 新增接口记录
|
||||
*
|
||||
@@ -58,4 +64,6 @@ public interface RequestLogMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRequestLogByRequestIds(Long[] requestIds);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,12 @@ public interface IRequestLogService
|
||||
*/
|
||||
public List<RequestLog> selectRequestLogList(RequestLog requestLog);
|
||||
|
||||
/**
|
||||
* 获取最新的任务请求响应记录
|
||||
* @return
|
||||
*/
|
||||
public RequestLog selectRequestLogByLatestTask();
|
||||
|
||||
/**
|
||||
* 新增接口记录
|
||||
*
|
||||
|
||||
@@ -60,6 +60,16 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
return requestLogMapper.selectRequestLogList(requestLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最新的请求记录
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public RequestLog selectRequestLogByLatestTask()
|
||||
{
|
||||
return requestLogMapper.selectRequestLogByLatestTask();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增接口记录
|
||||
*
|
||||
@@ -240,7 +250,7 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
// String resStr = HttpUtil.post(url, param, header, 3000);
|
||||
String resStr = HttpRequest.post(url)
|
||||
.body(param)
|
||||
.header("X-Service-Secret", HEADER_TOKEN)
|
||||
.header("X-Service-Secret", HEADER_TOKEN) // 向wms请求头必需添加的token
|
||||
.execute()
|
||||
.body();
|
||||
requestLog.setResponseBody(resStr);
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.ruoyi.schedule.scheduleTask.ssj;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.api.domain.wcs2wms.stockin.StockinReceive;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.api.service.IRequestLogService;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
@@ -46,6 +48,7 @@ public class PortConvThread implements Runnable {
|
||||
private IMydoJobService mydoJobService;
|
||||
private IJobCallBackService jobCallBackService;
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
private IRequestLogService requestLogService;
|
||||
|
||||
|
||||
public boolean isRun = true;
|
||||
@@ -95,7 +98,7 @@ public class PortConvThread implements Runnable {
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1500);
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -195,11 +198,12 @@ public class PortConvThread implements Runnable {
|
||||
StockinReceive result = BeanUtil.toBean(ajaxResult.get("data"), StockinReceive.class);
|
||||
|
||||
//校验:wms分配的货位(排列层)是否合法
|
||||
if (result.getSiteCode() == null || result.getSiteCode().isEmpty()) {
|
||||
if (ObjUtil.isNull(basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(result.getSiteCode()))) {
|
||||
errorMessage = "wms下发货位错误,任务生成失败!";
|
||||
paramMap.put("adverseCauses", errorMessage);
|
||||
apiService.createInMydoJobException(paramMap);
|
||||
log.info("【响应参数异常】分配货位:null,无法生成作业,托盘条码:{}",inSsjDevice.getTrayCode());
|
||||
writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 2, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -229,12 +233,14 @@ public class PortConvThread implements Runnable {
|
||||
}
|
||||
|
||||
}else{
|
||||
//请求生成wcs任务失败
|
||||
//todo 向输送机下发退回
|
||||
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 2, 1);
|
||||
|
||||
//todo 接口调用失败处理
|
||||
// 接口调用失败处理
|
||||
log.info("【入库请求】请求生成wcs作业失败退回,请检查网络或请求参数,请求内容:{}", JSON.toJSONString(paramMap));
|
||||
log.info("【错误信息】{}", requestLogService.selectRequestLogByLatestTask().getErrorDetails());
|
||||
|
||||
// 请求生成wcs任务失败
|
||||
// 向输送机下发退回
|
||||
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "99", 2, 1);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -280,7 +286,7 @@ public class PortConvThread implements Runnable {
|
||||
//查询该出库任务
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(outSsjDevice.getTaskNo()));
|
||||
if (mydoJob != null && Integer.parseInt(mydoJob.getInOrOut()) > 20) {
|
||||
log.info("【出库到位】设备:{},位置:{},任务号:{},出库到位", "输送线:", outSsjDevice.getDeviceCode(), mydoJob.getTaskNo());
|
||||
log.info("【出库完成】设备:{},位置:{},任务号:{},出库到位", "输送线:", outSsjDevice.getDeviceCode(), mydoJob.getTaskNo());
|
||||
mydoJob.setExecutionPhase(TASK_EP_SSJ_STOCKOUT_FINISH);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
mydoJobService.taskFinish(Long.valueOf(mydoJob.getTaskNo()));
|
||||
|
||||
@@ -47,6 +47,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by request_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectRequestLogByLatestTask" resultMap="RequestLogResult">
|
||||
select top 1 request_id, request_time, source_system, target_system, endpoint, request_url, request_method, request_headers, request_body, response_time, response_body, response_status, error_details, duration, Is_successful from request_log
|
||||
order by request_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectRequestLogByRequestId" parameterType="Long" resultMap="RequestLogResult">
|
||||
<include refid="selectRequestLogVo"/>
|
||||
where request_id = #{requestId}
|
||||
@@ -121,4 +126,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{requestId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user