opt: 修复3
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.ext_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -9,6 +10,7 @@ import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.ext_manage.enums.EXTConstant;
|
||||
import org.nl.wms.ext_manage.service.WmsToMesService;
|
||||
import org.nl.wms.ext_manage.service.util.AcsResponse;
|
||||
import org.nl.wms.ext_manage.service.util.MesTaskResponse;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
import org.nl.wms.system_manage.enums.SysParamConstant;
|
||||
import org.nl.wms.system_manage.service.param.ISysParamService;
|
||||
@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -36,6 +39,20 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
@Autowired
|
||||
private ISysParamService sysParamService;
|
||||
|
||||
/**
|
||||
* {
|
||||
* "action": "feedback",
|
||||
* "model": "lms2MesService",
|
||||
* "data": [
|
||||
* {
|
||||
* "task_code": "3000000056",
|
||||
* "request_time": ""
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JSONObject uploadMes(JSONObject whereJson) {
|
||||
log.info("uploadMes回传接口输入参数为:-------------------" + whereJson.toString());
|
||||
@@ -50,18 +67,28 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
return null;
|
||||
}
|
||||
|
||||
String url = sysParamService.findByCode(SysParamConstant.ERP_URL).getValue();
|
||||
String url = sysParamService.findByCode(SysParamConstant.MES_URL).getValue();
|
||||
url = url + EXTConstant.UPLOAD_MES_API;
|
||||
|
||||
// 组装参数
|
||||
MesTaskResponse.MesTaskData data = new MesTaskResponse.MesTaskData();
|
||||
data.setRequest_time(DateUtil.now());
|
||||
data.setTask_code(whereJson.getString("task_code"));
|
||||
MesTaskResponse mesTaskResponse = new MesTaskResponse();
|
||||
mesTaskResponse.setAction("feedback");
|
||||
mesTaskResponse.setModel("lms2MesService");
|
||||
mesTaskResponse.setData(Arrays.asList(data));
|
||||
log.info("组装数据:{}", mesTaskResponse);
|
||||
try {
|
||||
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(whereJson))
|
||||
.body(JSONObject.toJSONString(mesTaskResponse))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("uploadMes回传接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
|
||||
Integer status = result.getInteger("status");
|
||||
Integer status = result.getInteger("code");
|
||||
if (status != HttpStatus.OK.value()) {
|
||||
throw new BadRequestException(result.getString("message"));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.ext_manage.service.util;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 返回mes任务接口
|
||||
* @Author: lyd
|
||||
* @Date: 2025/10/30
|
||||
*/
|
||||
@Data
|
||||
public class MesTaskResponse {
|
||||
private String action;
|
||||
private String model;
|
||||
private List<MesTaskData> data;
|
||||
|
||||
@Data
|
||||
public static class MesTaskData {
|
||||
private String task_code;
|
||||
private String request_time;
|
||||
}
|
||||
}
|
||||
@@ -125,6 +125,7 @@ public class GetMaterialFromMesTask {
|
||||
material.setMaterial_name(mesRecord.getMaterial_description());
|
||||
material.setMaterial_id(mesRecord.getId());
|
||||
material.setExt_id(mesRecord.getCode());
|
||||
material.setBase_unit_id("16");
|
||||
material.setMaterial_type_id(mesRecord.getMaterial_classify());
|
||||
// material.setMaterial_spec(mesRecord.getMaterialModel());
|
||||
material.setMaterial_spec(mesRecord.getMaterial_mark());
|
||||
|
||||
@@ -218,7 +218,7 @@ public class BackInTask extends AbstractTask {
|
||||
jsonObject.put("status", 400);
|
||||
jsonObject.put("message", "任务被取消");
|
||||
jsonObject.put("task_code", taskObj.getExt_task_code());
|
||||
wmsToMesService.uploadMes(jsonObject);
|
||||
// wmsToMesService.uploadMes(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public class VehicleInTask extends AbstractTask {
|
||||
jsonObject.put("status",400);
|
||||
jsonObject.put("message","任务被取消");
|
||||
jsonObject.put("task_code",taskObj.getExt_task_code());
|
||||
wmsToMesService.uploadMes(jsonObject);
|
||||
// wmsToMesService.uploadMes(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ public class DownEmptyUpFullTask extends AbstractTask {
|
||||
jsonObject.put("status",400);
|
||||
jsonObject.put("message","任务被取消");
|
||||
jsonObject.put("task_code",taskObj.getExt_task_code());
|
||||
wmsToMesService.uploadMes(jsonObject);
|
||||
// wmsToMesService.uploadMes(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ public class SeparateMaterialTask extends AbstractTask {
|
||||
jsonObject.put("status",400);
|
||||
jsonObject.put("message","任务被取消");
|
||||
jsonObject.put("task_code",taskObj.getExt_task_code());
|
||||
wmsToMesService.uploadMes(jsonObject);
|
||||
// wmsToMesService.uploadMes(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user