京东接口实现
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
package org.nl.acs.auto.run;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
@@ -154,7 +159,33 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
inst.setAgv_jobno(String.valueOf(index));
|
||||
inst.setSend_status("1");
|
||||
instructionService.update(inst);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0")) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else {
|
||||
Object reqWms = device.getExtraValue().get("reqWms");
|
||||
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("uuid", IdUtil.simpleUUID());
|
||||
map.put("taskNo", inst.getTask_id());
|
||||
map.put("businessType", "PENDING");
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
if (resp.getInteger("status") == 200) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},acs请求wms任务执行申请成功,wms允许agv任务执行,已反馈agv任务执行", inst.getInstruction_code());
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms任务执行任务执行失败,wms不允许agv任务执行离开,未反馈agv任务执行", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms任务执行任务执行失败,连接被拒绝,未反馈agv任务执行", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//任务完毕
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.basedriver.agv.ndcone;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
@@ -169,35 +170,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0")) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else {
|
||||
Object reqWms = device.getExtraValue().get("reqWms");
|
||||
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "1");
|
||||
map.put("device_code", inst.getStart_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
if (resp.getInteger("status") == 200) {
|
||||
// if (resp.getJSONObject("payload").getInteger("status") == 200) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code());
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms取货申请失败,wms不允许agv取货,未反馈agv允许取货", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
//取货完毕
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x05) {
|
||||
@@ -242,10 +215,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "2");
|
||||
map.put("device_code", inst.getStart_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
map.put("uuid", IdUtil.simpleUUID());
|
||||
map.put("taskNo", inst.getTask_id());
|
||||
map.put("businessType", "LEAVE_FROM_POINT");
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
@@ -298,35 +270,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
return;
|
||||
}
|
||||
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0")) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else {
|
||||
Object reqWms = device.getExtraValue().get("reqWms");
|
||||
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "3");
|
||||
map.put("device_code", inst.getNext_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
if (resp.getInteger("status") == 200) {
|
||||
// if (resp.getJSONObject("payload").getInteger("status") == 200) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms放货申请失败,wms不允许agv放货,未反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
//放货完毕
|
||||
//(需要WCS反馈)
|
||||
@@ -369,10 +313,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "4");
|
||||
map.put("device_code", inst.getNext_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
map.put("uuid", IdUtil.simpleUUID());
|
||||
map.put("taskNo", inst.getTask_id());
|
||||
map.put("businessType", "ARRIVE_TO_POINT");
|
||||
req.add(map);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CarryTask extends BaseRequest {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 容器编号
|
||||
*/
|
||||
private String containerNo;
|
||||
|
||||
|
||||
/**
|
||||
* 容器面号
|
||||
*/
|
||||
String surfaceNo;
|
||||
|
||||
/**
|
||||
* 容器类型
|
||||
*/
|
||||
String containerType;
|
||||
|
||||
/**
|
||||
* 起始点位
|
||||
*/
|
||||
String fromPoint;
|
||||
|
||||
/**
|
||||
* 接驳点
|
||||
*/
|
||||
String fromTurnPoi;
|
||||
|
||||
/**
|
||||
* 接驳点
|
||||
*/
|
||||
String toTurnPoint;
|
||||
|
||||
|
||||
/**
|
||||
* 目标点位
|
||||
*/
|
||||
String toPoint;
|
||||
|
||||
|
||||
/**
|
||||
* 目标动作
|
||||
*/
|
||||
String toAction;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CarryTask{" +
|
||||
"containerNo='" + containerNo + '\'' +
|
||||
", surfaceNo='" + surfaceNo + '\'' +
|
||||
", containerType='" + containerType + '\'' +
|
||||
", fromPoint='" + fromPoint + '\'' +
|
||||
", fromTurnPoi='" + fromTurnPoi + '\'' +
|
||||
", toTurnPoint='" + toTurnPoint + '\'' +
|
||||
", toPoint='" + toPoint + '\'' +
|
||||
", toAction='" + toAction + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class JDCreateTaskRequest extends BaseRequest {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 场景编号
|
||||
*/
|
||||
private String scenarioNo;
|
||||
|
||||
|
||||
/**
|
||||
* 防重码
|
||||
*/
|
||||
String uuid;
|
||||
|
||||
/**
|
||||
* 当前时间
|
||||
*/
|
||||
Long currentTime;
|
||||
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
String taskNo;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
String taskType;
|
||||
|
||||
/**
|
||||
* 子任务类型
|
||||
*/
|
||||
String subTaskType;
|
||||
|
||||
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
String priority;
|
||||
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
String deviceNo;
|
||||
|
||||
CarryTask carryTask;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JDCreateTaskRequest{" +
|
||||
"scenarioNo='" + scenarioNo + '\'' +
|
||||
", uuid='" + uuid + '\'' +
|
||||
", currentTime=" + currentTime +
|
||||
", taskNo='" + taskNo + '\'' +
|
||||
", taskType='" + taskType + '\'' +
|
||||
", subTaskType='" + subTaskType + '\'' +
|
||||
", priority='" + priority + '\'' +
|
||||
", deviceNo='" + deviceNo + '\'' +
|
||||
", carryTask=" + carryTask +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
package org.nl.acs.ext.wms.rest;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.data.CancelTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.CreateTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.JDCreateTaskRequest;
|
||||
import org.nl.acs.ext.wms.service.JDToAcsService;
|
||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||
import org.nl.modules.logging.InterfaceLogType;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author psh
|
||||
* @date 2023-08-30
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "jd接口")
|
||||
@RequestMapping("/api/wms")
|
||||
@Slf4j
|
||||
public class JDToAcsController {
|
||||
private final JDToAcsService jDtoacsService;
|
||||
|
||||
@PostMapping("/carry_Task")
|
||||
@Log(value = "ACS接收WMS任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||
@ApiOperation("接收WMS任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> createFromWms(@RequestBody List<JDCreateTaskRequest> reqs) {
|
||||
return new ResponseEntity<>(jDtoacsService.crateTask(reqs), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package org.nl.acs.ext.wms.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.wms.data.CancelTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.CancelTaskResponse;
|
||||
import org.nl.acs.ext.wms.data.CreateTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.CreateTaskResponse;
|
||||
import org.nl.acs.ext.wms.data.JDCreateTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.PutActionResponse;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface JDToAcsService {
|
||||
|
||||
/**
|
||||
* 创建任务
|
||||
* @param reqs
|
||||
* @return
|
||||
*/
|
||||
CreateTaskResponse crateTask(List<JDCreateTaskRequest> reqs);
|
||||
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
*
|
||||
* @param reqs 条件
|
||||
*/
|
||||
CancelTaskResponse cancelFromWms(List<CancelTaskRequest> reqs) throws Exception;
|
||||
|
||||
/**
|
||||
* 修改设置有无货属性
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> updateDeviceGoodsFromWms(String jsonObject);
|
||||
|
||||
/**
|
||||
* 区域控制
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> areaControl(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 下发动作
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
PutActionResponse putAction(String jsonObject) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询设备状态
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryDevice(String jsonObject) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询设备DB值
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> queryDeviceDBValue(String whereJson);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ACS系统在获取空的托盘号
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> querydevice(String whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 下发插拔轴动作
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> putPlusPullAction(String whereJson);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,612 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.common.IDriverService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.CancelTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.CancelTaskResponse;
|
||||
import org.nl.acs.ext.wms.data.CreateTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.CreateTaskResponse;
|
||||
import org.nl.acs.ext.wms.data.JDCreateTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.JsonUtl;
|
||||
import org.nl.acs.ext.wms.data.PutActionRequest;
|
||||
import org.nl.acs.ext.wms.data.PutActionResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||
import org.nl.acs.ext.wms.service.JDToAcsService;
|
||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceExtraManageDto;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.exception.WDKException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class JDToAcsServiceImpl implements JDToAcsService {
|
||||
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
private final InstructionService InstructionService;
|
||||
private final TaskService taskService;
|
||||
private final DeviceService deviceService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final RouteLineService routeLineService;
|
||||
private final AcsToLiKuService acsToLiKuService;
|
||||
|
||||
|
||||
private String log_file_type = "log_file_type";
|
||||
private String log_type = "LMS请求ACS";
|
||||
|
||||
@Override
|
||||
public CancelTaskResponse cancelFromWms(List<CancelTaskRequest> reqs) throws Exception {
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
CancelTaskResponse response = new CancelTaskResponse();
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < reqs.size(); i++) {
|
||||
CancelTaskRequest request = reqs.get(i);
|
||||
String task_code = request.getTask_code();
|
||||
String vehicle_code = request.getVehicle_code();
|
||||
Map<String, String> params = request.getParams();
|
||||
if (StrUtil.isEmpty(task_code)) {
|
||||
throw new WDKException("任务号不能为空");
|
||||
}
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||
String cancelTaskCheck = paramService.findByCode(AcsConfig.CANCELTASKCHECK).getValue();
|
||||
if (StrUtil.equals(cancelTaskCheck, "1")) {
|
||||
taskService.cancelNoSendWms(taskDto.getTask_id());
|
||||
} else if (StrUtil.equals(cancelTaskCheck, "0")) {
|
||||
Instruction inst = instructionService.findByTaskcode(task_code);
|
||||
if (inst == null) {
|
||||
taskService.cancelNoSendWms(taskDto.getTask_id());
|
||||
} else {
|
||||
throw new RuntimeException("指令正在执行中,操作失败!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
response.setStatus(200);
|
||||
} else {
|
||||
response.setStatus(400);
|
||||
}
|
||||
response.setMessage("success");
|
||||
response.setErrArr(errArr);
|
||||
log.info("cancelFromWms--------------:输出参数:" + response);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> updateDeviceGoodsFromWms(String param) {
|
||||
JSONArray datas = JSONArray.parseArray(param);
|
||||
log.info("updateDeviceGoodsFromWms--------------:输入参数" + datas.toString());
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject data = datas.getJSONObject(i);
|
||||
String device_code = data.getString("point_code");
|
||||
String has_goods = data.getString("has_goods");
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("hasGoodStatus", has_goods);
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", new JSONObject());
|
||||
log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> areaControl(JSONObject form) {
|
||||
String device_code = form.getString("device_code");
|
||||
String type = form.getString("type");
|
||||
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", new JSONObject());
|
||||
log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutActionResponse putAction(String jsonObject) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("putAction--------------:输出参数" + jsonObject);
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
PutActionResponse response = new PutActionResponse();
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
String data = datas.get(i).toString();
|
||||
PutActionRequest request = JsonUtl.format(data, PutActionRequest.class);
|
||||
String device_code = request.getDevice_code();
|
||||
String code = request.getCode();
|
||||
String value = request.getValue();
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
HongXiangStationDeviceDriver hongXiangStationDeviceDriver;
|
||||
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
hongXiangStationDeviceDriver.writing(code, value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
response.setStatus(200);
|
||||
response.setMessage("success");
|
||||
log.info("putAction--------------:输出参数:" + response);
|
||||
return response;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDevice(String jsonObject) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
// log.info("queryDevice--------------:输入参数" + jsonObject.toString());
|
||||
JSONArray backja = new JSONArray();
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
|
||||
//AGV烘箱对接位
|
||||
HongXiangStationDeviceDriver hongXiangStationDeviceDriver;
|
||||
//烘箱工位
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
//货梯对接线-带扫码器
|
||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
||||
|
||||
if (datas.size() == 0) {
|
||||
throw new BadRequestException("缺少输入参数!");
|
||||
}
|
||||
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONObject data = datas.getJSONObject(i);
|
||||
String parent_device_code = data.getString("device_code");
|
||||
String device_code = "";
|
||||
JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + parent_device_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(device_json)) {
|
||||
device_code = (String) device_json.get("parent_storage_code") == null ? parent_device_code : (String) device_json.get("storage_code");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + parent_device_code);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
jo.put("device_code", parent_device_code);
|
||||
jo.put("mode", hongXiangStationDeviceDriver.getMode());
|
||||
jo.put("move", hongXiangStationDeviceDriver.getMove());
|
||||
|
||||
} else if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
|
||||
jo.put("device_code", parent_device_code);
|
||||
jo.put("mode", hongXiangConveyorDeviceDriver.getMode());
|
||||
jo.put("move", hongXiangConveyorDeviceDriver.getMove());
|
||||
jo.put("countdown_house", hongXiangConveyorDeviceDriver.getCountdown_house());
|
||||
jo.put("countdown_min", hongXiangConveyorDeviceDriver.getCountdown_min());
|
||||
jo.put("countdown_sec", hongXiangConveyorDeviceDriver.getCountdown_sec());
|
||||
//温度需要除以10
|
||||
jo.put("temperature", hongXiangConveyorDeviceDriver.getTemperature() / 10);
|
||||
jo.put("door", hongXiangConveyorDeviceDriver.getDoor());
|
||||
jo.put("finish", hongXiangConveyorDeviceDriver.getFinish());
|
||||
jo.put("task", hongXiangConveyorDeviceDriver.getTask());
|
||||
jo.put("error", hongXiangConveyorDeviceDriver.getError());
|
||||
} else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
|
||||
standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver();
|
||||
jo.put("device_code", parent_device_code);
|
||||
jo.put("move", standardCoveyorControlWithScannerDeviceDriver.getMove());
|
||||
jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction());
|
||||
jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError());
|
||||
} else {
|
||||
jo.put("device_code", parent_device_code);
|
||||
}
|
||||
backja.add(jo);
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK.value());
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", backja);
|
||||
// log.info("queryDevice--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryDeviceDBValue(String whereJson) {
|
||||
JSONArray datas = JSONArray.parseArray(whereJson);
|
||||
log.info("orderStatusUpdate--------------:输入参数" + datas.toString());
|
||||
JSONObject map = new JSONObject();
|
||||
if (datas.size() > 0) {
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject jsonObject = datas.getJSONObject(i);
|
||||
String device_code = jsonObject.getString("device_code");
|
||||
String dbName = jsonObject.getString("DB");
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
List<DeviceExtraManageDto> extra = device.getExtra();
|
||||
for (int j = 0; j < extra.size(); j++) {
|
||||
DeviceExtraManageDto deviceExtraManageDto = extra.get(j);
|
||||
String deviceCode = deviceExtraManageDto.getDevice_code();
|
||||
String extra_name = deviceExtraManageDto.getExtra_name();
|
||||
if (deviceCode.equals(device_code) && extra_name.equals(dbName)) {
|
||||
String extra_code = deviceExtraManageDto.getExtra_code();
|
||||
String[] split = extra_code.split("\\.");
|
||||
extra_code = split[split.length - 1];
|
||||
extra_code = extra_code.substring(0, 1).toUpperCase() + extra_code.substring(1);
|
||||
IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefination().getDriverCode(), IDriverService.class);
|
||||
Integer dbValue = driverService.getDbValue(device, extra_code);
|
||||
map.put(dbName, dbValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", map);
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> querydevice(String whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> putPlusPullAction(String param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("putPlusPullAction-----输入参数{}", param);
|
||||
JSONObject jo = JSON.parseObject(param);
|
||||
String device_code = jo.getString("device_code");
|
||||
String size = jo.getString("size");
|
||||
String type = jo.getString("type");
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "未找到对应的设备:" + device_code);
|
||||
return resultJson;
|
||||
}
|
||||
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
|
||||
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver();
|
||||
// 0 穿轴 1拔轴
|
||||
if (StrUtil.equals(type, "1")) {
|
||||
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() == 1) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备工作模式未自动");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() == 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备未全自动");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备未待机");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getControl() != 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备未远程控制");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getMove() != 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求拔轴,当前设备有轴");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1
|
||||
&& plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 0
|
||||
&& plugPullDeviceSiteDeviceDriver.getControl() == 0) {
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_size");
|
||||
map.put("value", size);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code", "to_type");
|
||||
map2.put("value", type);
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code", "to_command");
|
||||
map3.put("value", "1");
|
||||
list.add(map3);
|
||||
plugPullDeviceSiteDeviceDriver.writing(list);
|
||||
|
||||
} else {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "当前设备状态不满足下发条件");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
} else if (StrUtil.equals(type, "0")) {
|
||||
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() == 1) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备工作模式未自动");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getAction() == 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备未全自动");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备未待机");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getControl() != 0) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备未远程控制");
|
||||
return resultJson;
|
||||
}
|
||||
if (plugPullDeviceSiteDeviceDriver.getMove() != 1) {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "请求插轴,当前设备没有轴");
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1
|
||||
&& plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 1
|
||||
&& plugPullDeviceSiteDeviceDriver.getControl() == 0) {
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_size");
|
||||
map.put("value", size);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code", "to_type");
|
||||
map2.put("value", type);
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code", "to_command");
|
||||
map3.put("value", "1");
|
||||
list.add(map3);
|
||||
plugPullDeviceSiteDeviceDriver.writing(list);
|
||||
|
||||
} else {
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
resultJson.put("message", "当前设备状态不满足下发条件");
|
||||
return resultJson;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK.value());
|
||||
resultJson.put("message", "操作成功");
|
||||
log.info("putPlusPullAction--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CreateTaskResponse crateTask(List<JDCreateTaskRequest> reqs) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("crateTask-----输入参数{}", reqs);
|
||||
CreateTaskResponse response = new CreateTaskResponse();
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < reqs.size(); i++) {
|
||||
JDCreateTaskRequest req = reqs.get(i);
|
||||
String task_code = req.getTaskNo();
|
||||
String start_device_code = req.getCarryTask().getFromPoint();
|
||||
String next_device_code = req.getCarryTask().getToTurnPoint();
|
||||
String priority = req.getPriority();
|
||||
String vehicle_code = req.getDeviceNo();
|
||||
// String vehicle_type = req.getVehicle_type();
|
||||
String task_type = "1";
|
||||
// String remark = req.getRemark();
|
||||
// Map<String, String> params = req.getParams();
|
||||
|
||||
String start_point_code = "";
|
||||
String next_point_code = "";
|
||||
if (StrUtil.isEmpty(task_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", "任务号不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(start_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", "起点不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(next_device_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", "终点不能为空");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(start_device_json)) {
|
||||
start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code");
|
||||
}
|
||||
JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code + "'").uniqueResult(0);
|
||||
if (!ObjectUtil.isEmpty(next_device_json)) {
|
||||
next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) {
|
||||
String str[] = start_point_code.split("-");
|
||||
start_device_code = str[0];
|
||||
} else {
|
||||
start_device_code = start_point_code;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) {
|
||||
String str[] = next_point_code.split("-");
|
||||
next_device_code = str[0];
|
||||
} else {
|
||||
next_device_code = next_point_code;
|
||||
}
|
||||
|
||||
String route_plan_code = "";
|
||||
|
||||
if (StrUtil.isEmpty(route_plan_code)) {
|
||||
route_plan_code = "normal";
|
||||
}
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||
if (taskDto != null) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", "不能存在相同的任务号");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
|
||||
if (vehicle_dto != null) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", "不能存在相同的托盘号");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", req.getCarryTask().getFromPoint() + " 该设备号未找到对应点位");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isEmpty(next_point_code)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", req.getCarryTask().getToPoint() + " 该设备号未找到对应点位");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_code", task_code);
|
||||
jo.put("task_id", IdUtil.simpleUUID());
|
||||
jo.put("start_point_code", start_point_code);
|
||||
jo.put("next_point_code", next_point_code);
|
||||
jo.put("start_parent_code", start_point_code);
|
||||
jo.put("next_parent_code", next_point_code);
|
||||
jo.put("start_device_code", start_device_code);
|
||||
jo.put("next_device_code", next_device_code);
|
||||
jo.put("priority", priority);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
// jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("agv_system_type", "1");
|
||||
// jo.put("remark", remark);
|
||||
// jo.put("params", params);
|
||||
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
||||
|
||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||
try {
|
||||
taskService.create(task_dto);
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
response.setStatus(200);
|
||||
response.setMessage("success");
|
||||
} else {
|
||||
response.setStatus(400);
|
||||
if (ObjectUtil.isNotEmpty(errArr)) {
|
||||
response.setMessage(errArr.getJSONObject(0).getString("message"));
|
||||
} else {
|
||||
response.setMessage("false");
|
||||
}
|
||||
response.setErrArr(errArr);
|
||||
}
|
||||
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response));
|
||||
return response;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user