|
@ -20,6 +20,7 @@ import org.nl.acs.ext.wms.data.CancelTaskResponse; |
|
|
import org.nl.acs.ext.wms.data.CreateTaskRequest; |
|
|
import org.nl.acs.ext.wms.data.CreateTaskRequest; |
|
|
import org.nl.acs.ext.wms.data.CreateTaskResponse; |
|
|
import org.nl.acs.ext.wms.data.CreateTaskResponse; |
|
|
import org.nl.acs.ext.wms.data.JDCreateTaskRequest; |
|
|
import org.nl.acs.ext.wms.data.JDCreateTaskRequest; |
|
|
|
|
|
import org.nl.acs.ext.wms.data.JDCreateTaskResponse; |
|
|
import org.nl.acs.ext.wms.data.JsonUtl; |
|
|
import org.nl.acs.ext.wms.data.JsonUtl; |
|
|
import org.nl.acs.ext.wms.data.PutActionRequest; |
|
|
import org.nl.acs.ext.wms.data.PutActionRequest; |
|
|
import org.nl.acs.ext.wms.data.PutActionResponse; |
|
|
import org.nl.acs.ext.wms.data.PutActionResponse; |
|
@ -456,19 +457,17 @@ public class JDToAcsServiceImpl implements JDToAcsService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public CreateTaskResponse crateTask(List<JDCreateTaskRequest> reqs) { |
|
|
public JDCreateTaskResponse crateTask(JDCreateTaskRequest reqs) { |
|
|
try { |
|
|
try { |
|
|
MDC.put(log_file_type, log_type); |
|
|
MDC.put(log_file_type, log_type); |
|
|
log.info("crateTask-----输入参数{}", reqs); |
|
|
log.info("crateTask-----输入参数{}", reqs); |
|
|
CreateTaskResponse response = new CreateTaskResponse(); |
|
|
JDCreateTaskResponse response = new JDCreateTaskResponse(); |
|
|
JSONArray errArr = new JSONArray(); |
|
|
JSONArray errArr = new JSONArray(); |
|
|
for (int i = 0; i < reqs.size(); i++) { |
|
|
String task_code = reqs.getTaskNo(); |
|
|
JDCreateTaskRequest req = reqs.get(i); |
|
|
String start_device_code = reqs.getCarryTask().getFromPoint(); |
|
|
String task_code = req.getTaskNo(); |
|
|
String next_device_code = reqs.getCarryTask().getToPoint(); |
|
|
String start_device_code = req.getCarryTask().getFromPoint(); |
|
|
String priority = reqs.getPriority(); |
|
|
String next_device_code = req.getCarryTask().getToTurnPoint(); |
|
|
String vehicle_code = reqs.getDeviceNo(); |
|
|
String priority = req.getPriority(); |
|
|
|
|
|
String vehicle_code = req.getDeviceNo(); |
|
|
|
|
|
// String vehicle_type = req.getVehicle_type();
|
|
|
// String vehicle_type = req.getVehicle_type();
|
|
|
String task_type = "1"; |
|
|
String task_type = "1"; |
|
|
// String remark = req.getRemark();
|
|
|
// String remark = req.getRemark();
|
|
@ -477,25 +476,16 @@ public class JDToAcsServiceImpl implements JDToAcsService { |
|
|
String start_point_code = ""; |
|
|
String start_point_code = ""; |
|
|
String next_point_code = ""; |
|
|
String next_point_code = ""; |
|
|
if (StrUtil.isEmpty(task_code)) { |
|
|
if (StrUtil.isEmpty(task_code)) { |
|
|
JSONObject json = new JSONObject(); |
|
|
response.setMessage("任务号不能为空"); |
|
|
json.put("task_code", task_code); |
|
|
return response; |
|
|
json.put("message", "任务号不能为空"); |
|
|
|
|
|
errArr.add(json); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
} |
|
|
if (StrUtil.isEmpty(start_device_code)) { |
|
|
if (StrUtil.isEmpty(start_device_code)) { |
|
|
JSONObject json = new JSONObject(); |
|
|
response.setMessage("起点不能为空"); |
|
|
json.put("task_code", task_code); |
|
|
return response; |
|
|
json.put("message", "起点不能为空"); |
|
|
|
|
|
errArr.add(json); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
} |
|
|
if (StrUtil.isEmpty(next_device_code)) { |
|
|
if (StrUtil.isEmpty(next_device_code)) { |
|
|
JSONObject json = new JSONObject(); |
|
|
response.setMessage("终点不能为空"); |
|
|
json.put("task_code", task_code); |
|
|
return response; |
|
|
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); |
|
|
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0); |
|
|
if (!ObjectUtil.isEmpty(start_device_json)) { |
|
|
if (!ObjectUtil.isEmpty(start_device_json)) { |
|
@ -526,36 +516,24 @@ public class JDToAcsServiceImpl implements JDToAcsService { |
|
|
} |
|
|
} |
|
|
TaskDto taskDto = taskService.findByCodeFromCache(task_code); |
|
|
TaskDto taskDto = taskService.findByCodeFromCache(task_code); |
|
|
if (taskDto != null) { |
|
|
if (taskDto != null) { |
|
|
JSONObject json = new JSONObject(); |
|
|
response.setMessage("不能存在相同的任务号"); |
|
|
json.put("task_code", task_code); |
|
|
return response; |
|
|
json.put("message", "不能存在相同的任务号"); |
|
|
|
|
|
errArr.add(json); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
} |
|
|
if (!StrUtil.isEmpty(vehicle_code)) { |
|
|
if (!StrUtil.isEmpty(vehicle_code)) { |
|
|
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code); |
|
|
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code); |
|
|
if (vehicle_dto != null) { |
|
|
if (vehicle_dto != null) { |
|
|
JSONObject json = new JSONObject(); |
|
|
response.setMessage("不能存在相同的托盘号"); |
|
|
json.put("task_code", task_code); |
|
|
return response; |
|
|
json.put("message", "不能存在相同的托盘号"); |
|
|
|
|
|
errArr.add(json); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(start_point_code)) { |
|
|
if (StrUtil.isEmpty(start_point_code)) { |
|
|
JSONObject json = new JSONObject(); |
|
|
response.setMessage(reqs.getCarryTask().getFromPoint() + " 该设备号未找到对应点位"); |
|
|
json.put("task_code", task_code); |
|
|
return response; |
|
|
json.put("message", req.getCarryTask().getFromPoint() + " 该设备号未找到对应点位"); |
|
|
|
|
|
errArr.add(json); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
} |
|
|
if (StrUtil.isEmpty(next_point_code)) { |
|
|
if (StrUtil.isEmpty(next_point_code)) { |
|
|
JSONObject json = new JSONObject(); |
|
|
response.setMessage(reqs.getCarryTask().getToPoint() + " 该设备号未找到对应点位"); |
|
|
json.put("task_code", task_code); |
|
|
return response; |
|
|
json.put("message", req.getCarryTask().getToPoint() + " 该设备号未找到对应点位"); |
|
|
|
|
|
errArr.add(json); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
JSONObject jo = new JSONObject(); |
|
@ -579,25 +557,15 @@ public class JDToAcsServiceImpl implements JDToAcsService { |
|
|
try { |
|
|
try { |
|
|
taskService.create(task_dto); |
|
|
taskService.create(task_dto); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
// e.printStackTrace();
|
|
|
log.error("操作失败{}",e,e.getMessage()); |
|
|
JSONObject json = new JSONObject(); |
|
|
response.setMessage("操作失败"); |
|
|
json.put("task_code", task_code); |
|
|
return response; |
|
|
json.put("message", e.getMessage()); |
|
|
|
|
|
errArr.add(json); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
if (ObjectUtil.isEmpty(errArr)) { |
|
|
if (ObjectUtil.isEmpty(errArr)) { |
|
|
response.setStatus(200); |
|
|
response.setCode(200); |
|
|
response.setMessage("success"); |
|
|
response.setMessage("操作成功"); |
|
|
} else { |
|
|
} else { |
|
|
response.setStatus(400); |
|
|
response.setMessage("操作失败"); |
|
|
if (ObjectUtil.isNotEmpty(errArr)) { |
|
|
|
|
|
response.setMessage(errArr.getJSONObject(0).getString("message")); |
|
|
|
|
|
} else { |
|
|
|
|
|
response.setMessage("false"); |
|
|
|
|
|
} |
|
|
|
|
|
response.setErrArr(errArr); |
|
|
|
|
|
} |
|
|
} |
|
|
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response)); |
|
|
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response)); |
|
|
return response; |
|
|
return response; |
|
|