rev:acs/lms优化项
1.ACS新增查询任务状态接口 2.MES取消任务接口 3.acs控制钢平台任务只能同时只有一个入库一个出库的任务 4.acs任务页面显示mes点位
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.acs.service.dto.ResultForAcs;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.DeviceInfoDto;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest;
|
||||
@@ -39,4 +40,12 @@ public interface WmsToAcsService {
|
||||
* @return
|
||||
*/
|
||||
AcsResponse getDeviceStatusByCode(List<DeviceInfoDto> list);
|
||||
|
||||
/**
|
||||
* 删除任务
|
||||
*
|
||||
* @param taskCode
|
||||
* @return
|
||||
*/
|
||||
JSONObject cancelTask(JSONObject taskCode);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.acs.service.dto.ResultForAcs;
|
||||
@@ -9,7 +10,6 @@ import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.sch.task_manage.AcsTaskDto;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.task.AcsUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -53,4 +53,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
// interactRecordService.saveRecord("获取设备信息", list, resultForAcs, GeneralDefinition.LMS_ACS);
|
||||
return resultForAcs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject cancelTask(JSONObject taskCode) {
|
||||
String api = "/api/wms/cancelTask";
|
||||
JSONObject acsResponse = AcsUtil.cancelTask(api, taskCode);
|
||||
return acsResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,10 +211,11 @@ public class MesToWmsServiceImpl implements MesToWmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断此任务的状态是否能删除
|
||||
if (Integer.parseInt(taskDao.getTask_status()) > Integer.parseInt(TaskStatus.ISSUED.getCode())) {
|
||||
// 调用ACS删除任务
|
||||
JSONObject json = wmsToAcsService.cancelTask(jo);
|
||||
if (json.getIntValue("status") == HttpStatus.HTTP_BAD_REQUEST) {
|
||||
result.put("ReturnStatus", 1);
|
||||
result.put("ReturnInfo", "任务号为【"+jo.getString("TaskCode")+"】的任务正在执行中或者已完成,不能取消任务!");
|
||||
result.put("ReturnInfo", "任务号为【"+jo.getString("TaskCode")+"】删除失败!"+ json.getString("message"));
|
||||
result.put("MsgTime", DateUtil.now());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
@@ -111,4 +112,43 @@ public class AcsUtil {
|
||||
}
|
||||
return resultForAcs;
|
||||
}
|
||||
|
||||
public static JSONObject cancelTask(String api, JSONObject taskCode) {
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
|
||||
//判断是否连接ACS系统
|
||||
Param isConnectAcs = sysParamService.findByCode(GeneralDefinition.IS_CONNECT_ACS);
|
||||
if (ObjectUtil.isEmpty(isConnectAcs)) {
|
||||
result.put("status", "400");
|
||||
result.put("message", "参数表中:" + GeneralDefinition.IS_CONNECT_ACS + "不存在");
|
||||
return result;
|
||||
}
|
||||
String isConnect = isConnectAcs.getValue();
|
||||
//ACS地址:127.0.0.1:8010
|
||||
Param acsUrlObj = sysParamService.findByCode(GeneralDefinition.ACS_URL);
|
||||
if (ObjectUtil.isEmpty(acsUrlObj)) {
|
||||
result.put("status", "400");
|
||||
result.put("message", "参数表中:" + GeneralDefinition.ACS_URL + "不存在");
|
||||
return result;
|
||||
}
|
||||
String acsUrl = acsUrlObj.getValue();
|
||||
if (StrUtil.equals(GeneralDefinition.NO, isConnect)) {
|
||||
result.put("status", "200");
|
||||
return result;
|
||||
}
|
||||
String url = acsUrl + api;
|
||||
log.info("删除acs任务的输入参数为:{}", taskCode);
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(taskCode))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
} catch (Exception e) {
|
||||
result.put("status", "400");
|
||||
result.put("message", "ACS网络不通");
|
||||
}
|
||||
log.info("删除acs任务的输出参数为:{}", result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user