更新
This commit is contained in:
@@ -2,6 +2,8 @@ package org.nl.acs.device_driver;
|
||||
|
||||
import org.nl.acs.opc.Device;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DeviceDriver {
|
||||
default String getDeviceCode() {
|
||||
return this.getDevice().getDevice_code();
|
||||
@@ -17,4 +19,5 @@ public interface DeviceDriver {
|
||||
return this.getDriverDefination().getDriverCode();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -123,5 +123,10 @@ public class ItemProtocol {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ 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.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -230,11 +231,11 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else if (error != 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "有报警";
|
||||
//无报警
|
||||
// } else if (error != 0) {
|
||||
// this.setIsonline(false);
|
||||
// this.setIserror(true);
|
||||
// message = "有报警";
|
||||
// //无报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
@@ -421,18 +422,24 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
}
|
||||
|
||||
// public void writing(int type, int command) {
|
||||
// String to_material_code = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
// + "." + ItemProtocol.item_to_material_code;
|
||||
// String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
// Server server = ReadUtil.getServer(opcservcerid);
|
||||
// Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
// if (type == 2) {
|
||||
// itemMap.put(to_material_code, command);
|
||||
// }
|
||||
// ReadUtil.write(itemMap, server);
|
||||
//
|
||||
// }
|
||||
public void writing(List list) {
|
||||
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Object ob = list.get(i);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
|
||||
if (!StrUtil.isEmpty(json.getString("value"))) {
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + json.getString("code");
|
||||
itemMap.put(to_param, json.getString("value"));
|
||||
}
|
||||
}
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -525,12 +532,42 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
taskserver.update(task);
|
||||
requireSucess = true;
|
||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||
this.writing("to_target", next_addr);
|
||||
this.writing("to_task", instdto.getInstruction_code());
|
||||
this.writing("to_command", "1");
|
||||
this.writing("to_task", instdto.getInstruction_code());
|
||||
this.writing("to_target", next_addr);
|
||||
this.writing("to_command", "1");
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code","to_target");
|
||||
map.put("value",next_addr);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_task");
|
||||
map2.put("value",instdto.getInstruction_code());
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_command");
|
||||
map3.put("value","1");
|
||||
list.add(map3);
|
||||
this.writing(list);
|
||||
|
||||
} else {
|
||||
Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
|
||||
Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code","to_target");
|
||||
map.put("value",next_addr);
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_task");
|
||||
map2.put("value",inst.getInstruction_code());
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_command");
|
||||
map3.put("value","1");
|
||||
list.add(map3);
|
||||
this.writing(list);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -598,4 +635,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -114,5 +114,11 @@ public class ItemProtocol {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
@@ -64,6 +65,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class);
|
||||
|
||||
@Autowired
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
String container;
|
||||
|
||||
protected String barcode = null;
|
||||
@@ -214,12 +217,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else if (error != 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "有报警";
|
||||
//无报警
|
||||
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
@@ -426,12 +424,50 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
instructionService.create(instdto);
|
||||
//创建指令后修改任务状态
|
||||
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
|
||||
task.setTask_status("1");
|
||||
//创建指令后修改任务状态
|
||||
task.setTask_status("1");
|
||||
taskserver.update(task);
|
||||
// this.writing("to_command","1");
|
||||
// if(StrUtil.isNotEmpty(task.getTo_z())){
|
||||
// if(StrUtil.equals(task.getTo_z(),"01")){
|
||||
// this.writing("to_target","102");
|
||||
// } else if(StrUtil.equals(task.getTo_z(),"02")){
|
||||
// this.writing("to_target","201");
|
||||
// } else if(StrUtil.equals(task.getTo_z(),"03")){
|
||||
// this.writing("to_target","301");
|
||||
// }
|
||||
// }
|
||||
// this.writing("to_command","1");
|
||||
// this.writing("to_task",instdto.getInstruction_code());
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
|
||||
if(StrUtil.isNotEmpty(task.getTo_z())){
|
||||
if(StrUtil.equals(task.getTo_z(),"01")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","102");
|
||||
} else if(StrUtil.equals(task.getTo_z(),"02")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","201");
|
||||
} else if(StrUtil.equals(task.getTo_z(),"03")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","301");
|
||||
}
|
||||
}
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_task");
|
||||
map2.put("value",instdto.getInstruction_code());
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_command");
|
||||
map3.put("value","1");
|
||||
list.add(map3);
|
||||
this.writing(list);
|
||||
|
||||
requireSucess = true;
|
||||
applySucess = true;
|
||||
} else {
|
||||
log.info("未找到载具号{}对应任务", container_code);
|
||||
@@ -531,15 +567,56 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
//创建指令后修改任务状态
|
||||
task.setTask_status("1");
|
||||
taskserver.update(task);
|
||||
|
||||
|
||||
|
||||
// this.writing("to_command","1");
|
||||
// if(StrUtil.isNotEmpty(task.getTo_z())){
|
||||
// if(StrUtil.equals(task.getTo_z(),"01")){
|
||||
// this.writing("to_target","102");
|
||||
// } else if(StrUtil.equals(task.getTo_z(),"02")){
|
||||
// this.writing("to_target","201");
|
||||
// } else if(StrUtil.equals(task.getTo_z(),"03")){
|
||||
// this.writing("to_target","301");
|
||||
// }
|
||||
// }
|
||||
// this.writing("to_command","1");
|
||||
// this.writing("to_task",instdto.getInstruction_code());
|
||||
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
|
||||
if(StrUtil.isNotEmpty(task.getTo_z())){
|
||||
if(StrUtil.equals(task.getTo_z(),"01")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","102");
|
||||
} else if(StrUtil.equals(task.getTo_z(),"02")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","201");
|
||||
} else if(StrUtil.equals(task.getTo_z(),"03")){
|
||||
map.put("code","to_target");
|
||||
map.put("value","301");
|
||||
}
|
||||
}
|
||||
list.add(map);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("code","to_task");
|
||||
map2.put("value",instdto.getInstruction_code());
|
||||
list.add(map2);
|
||||
Map map3 = new HashMap();
|
||||
map3.put("code","to_command");
|
||||
map3.put("value","1");
|
||||
list.add(map3);
|
||||
this.writing(list);
|
||||
|
||||
requireSucess = true;
|
||||
applySucess = true;
|
||||
} else {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
message = "申请任务中...";
|
||||
JSONObject apply = new JSONObject();
|
||||
apply.put("type", "6");
|
||||
apply.put("vehicle_code", container_code);
|
||||
apply.put("point_code", device_code);
|
||||
apply.put("device_code", device_code);
|
||||
String str = acsToWmsService.applyTaskToWms(apply);
|
||||
JSONObject jo = JSON.parseObject(str);
|
||||
if (ObjectUtil.isEmpty(jo)) {
|
||||
@@ -559,6 +636,39 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void writing(String param, String value) {
|
||||
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
|
||||
itemMap.put(to_param, Integer.parseInt(value));
|
||||
// itemMap.put(to_param, Integer.parseInt(value));
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
}
|
||||
|
||||
public void writing(List list) {
|
||||
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Object ob = list.get(i);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
|
||||
if (!StrUtil.isEmpty(json.getString("value"))) {
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + json.getString("code");
|
||||
itemMap.put(to_param, json.getString("value"));
|
||||
}
|
||||
}
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
@@ -11,12 +11,6 @@ public interface AcsToWmsService {
|
||||
|
||||
/**
|
||||
* ACS向WMS申请任务
|
||||
* type:必填;1共挤线申请空盘、2共挤线满托入库、3油漆线申请空盘、4油漆线申请物料、5油漆线空盘入库、6、一楼空托入库
|
||||
* point_code:必填;
|
||||
* vehicle_num 载具数量
|
||||
* vehicle_type 载具类型
|
||||
* vehicle_code 载具号
|
||||
* qty 物料数量
|
||||
*/
|
||||
String applyTaskToWms(JSONObject jo);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.nl.acs.ext.wms.RespUtil;
|
||||
import org.nl.acs.ext.wms.AcsUtil;
|
||||
import org.nl.acs.ext.wms.liKuData.*;
|
||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -22,61 +23,131 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
|
||||
|
||||
private final AddressService addressService;
|
||||
|
||||
private String log_file_type="log_file_type";
|
||||
private String log_type="ACS请求立库";
|
||||
|
||||
@Override
|
||||
public Resp<InStoreResponse> inStore(InStoreRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String api = addressService.findByCode("inStore").getMethods_url();
|
||||
log.info("inStore-----输入参数{}", requestParam);
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("inStore-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new InStoreResponse());
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resp<OutStoreResponse> outStore(OutStoreRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("outStore-----输入参数{}", requestParam);
|
||||
String api = addressService.findByCode("outStore").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("outStore-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new OutStoreResponse());
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resp<EmptyVehicleOutStoreResponse> emptyVehicleOutStore(EmptyVehicleOutStoreRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("emptyVehicleOutStore-----输入参数{}", requestParam);
|
||||
String api = addressService.findByCode("emptyVehicleOutStore").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("emptyVehicleOutStore-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new EmptyVehicleOutStoreResponse());
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resp<MoveStoreResponse> moveStore(MoveStoreRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("moveStore-----输入参数{}", requestParam);
|
||||
String api = addressService.findByCode("moveStore").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("moveStore-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new MoveStoreResponse());
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resp<InStoreResetResponse> inStoreReset(InStoreResetRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("inStoreReset-----输入参数{}", requestParam);
|
||||
String api = addressService.findByCode("inStoreReset").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("inStoreReset-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new InStoreResetResponse());
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resp<MoveStoreResetResponse> moveStoreReset(MoveStoreResetRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("moveStoreReset-----输入参数{}", requestParam);
|
||||
String api = addressService.findByCode("moveStoreReset").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("moveStoreReset-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new MoveStoreResetResponse());
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resp<RoadWayIsLockResponse> roadWayIsLock(RoadWayIsLockRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("roadWayIsLock-----输入参数{}", requestParam);
|
||||
String api = addressService.findByCode("roadWayIsLock").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("roadWayIsLock-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new RoadWayIsLockResponse());
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Resp<CancelTaskResponse> cancelTask(CancelTaskRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("cancelTask-----输入参数{}", requestParam);
|
||||
String api = addressService.findByCode("cancelTask").getMethods_url();
|
||||
String result = AcsUtil.notifyAcs(api, requestParam);
|
||||
log.info("cancelTask-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new CancelTaskResponse());
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ 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.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -48,12 +49,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
/*@Value("${acsTowms.token}")*/
|
||||
public String token;
|
||||
|
||||
|
||||
private String log_file_type="log_file_type";
|
||||
private String log_type="ACS请求LMS";
|
||||
|
||||
@Override
|
||||
public String applyTaskToWms(JSONObject jo) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("applyTaskToWms-----输入参数{}", jo);
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("applyTaskToWms");
|
||||
String url = wmsurl + addressDto.getMethods_url();
|
||||
log.info("applyTaskToWms-----请求参数{}", jo.toString());
|
||||
HttpResponse result2 = null;
|
||||
try {
|
||||
result2 = HttpRequest.post(url)
|
||||
@@ -74,10 +81,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
log.info("applyTaskToWms-----输出参数{}", result2.body());
|
||||
return result2.body();
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse feedbackTaskStatusToWms(JSONArray data) {
|
||||
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
|
||||
String task_code = "";
|
||||
@@ -114,6 +129,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
JSONObject jo = JSONObject.parseObject(result2.body());
|
||||
log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString());
|
||||
return result2;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -382,6 +401,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
@Override
|
||||
public ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = new ApplyLabelingAndBindingResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
@@ -404,10 +425,17 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
}
|
||||
return applyLabelingAndBindingResponse;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiKuApplyTakResponse liKuApplyTaskRequest(LiKuApplyTaskRequest param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
LiKuApplyTakResponse liKuApplyTakResponse = new LiKuApplyTakResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
@@ -430,25 +458,32 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
}
|
||||
return liKuApplyTakResponse;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public UpdateLKTaskResponse updateLKTaskRequest(UpdateLKTaskRequest param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("updateLKTaskRequest-----输入参数{}", param);
|
||||
UpdateLKTaskResponse updateLKTaskResponse = new UpdateLKTaskResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("liKuApplyTask");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("UpdateLKTaskResponse----请求参数{}", param);
|
||||
try {
|
||||
String result = HttpRequest.post(url)
|
||||
.body(JSON.toJSONString(param))
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("UpdateLKTaskResponse----返回参数{}", result);
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
updateLKTaskResponse = JSONObject.toJavaObject(jsonObject, UpdateLKTaskResponse.class);
|
||||
} catch (Exception e) {
|
||||
JSONObject map = new JSONObject();
|
||||
@@ -457,7 +492,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return JSONObject.toJavaObject(map, UpdateLKTaskResponse.class);
|
||||
}
|
||||
}
|
||||
|
||||
return updateLKTaskResponse;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -40,9 +41,16 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
|
||||
private final AcsToLiKuService acsToLiKuService;
|
||||
|
||||
|
||||
private String log_file_type="log_file_type";
|
||||
private String log_type="立库请求ACS";
|
||||
|
||||
//入库任务状态反馈
|
||||
@Override
|
||||
public Resp<InStoreReportResponse> inStoreReport(InStoreReportRequest requestParam) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("入库任务状态反馈-----输入参数{}", requestParam.toString());
|
||||
String inst_code = requestParam.getOrderId();
|
||||
String status = requestParam.getState();
|
||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||
@@ -104,12 +112,20 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
result.put("code", "0");
|
||||
result.put("comment", "");
|
||||
result.put("data", inStoreReportResponse );
|
||||
|
||||
log.info("入库任务状态反馈-----输出参数{}", result);
|
||||
return RespUtil.getResp(result.toString(), new InStoreReportResponse());
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resp<OutStoreReportResponse> outStoreReport(OutStoreReportRequest requestParam) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("出库任务状态反馈-----输入参数{}", requestParam.toString());
|
||||
String inst_code = requestParam.getOrderId();
|
||||
String status = requestParam.getState();
|
||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||
@@ -118,6 +134,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
// 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞
|
||||
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
} else if(StrUtil.equals(status,"3")){
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
@@ -149,8 +166,14 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
result.put("code", "0");
|
||||
result.put("comment", "");
|
||||
result.put("data", outStoreReportResponse );
|
||||
log.info("出库任务状态反馈-----输出参数{}", result);
|
||||
|
||||
return RespUtil.getResp(result.toString(), new OutStoreReportResponse());
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -158,6 +181,9 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
//移库任务上报
|
||||
@Override
|
||||
public Resp<MoveStoreReportResponse> moveStoreReport(MoveStoreReportRequest requestParam) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("移库任务上报-----输入参数{}", requestParam.toString());
|
||||
String inst_code = requestParam.getOrderId();
|
||||
String status = requestParam.getState();
|
||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||
@@ -165,6 +191,8 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
// 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞
|
||||
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
|
||||
} else if(StrUtil.equals(status,"3")){
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
@@ -220,8 +248,13 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
result.put("code", "0");
|
||||
result.put("comment", "");
|
||||
result.put("data", moveStoreReportResponse );
|
||||
log.info("移库任务上报-----输出参数{}", result);
|
||||
|
||||
return RespUtil.getResp(result.toString(), new MoveStoreReportResponse());
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ 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;
|
||||
@@ -49,6 +50,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final RouteLineService routeLineService;
|
||||
|
||||
private String log_file_type="log_file_type";
|
||||
private String log_type="LMS请求ACS";
|
||||
|
||||
@Override
|
||||
public CancelTaskResponse cancelFromWms(String param) throws Exception {
|
||||
@@ -137,6 +140,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
@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();
|
||||
@@ -161,10 +166,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
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);
|
||||
@@ -230,6 +241,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
resultJson.put("data", backja);
|
||||
log.info("queryDevice--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -276,6 +293,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
@Override
|
||||
public CreateTaskResponse crateTask(String param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("crateTask-----输入参数{}", param);
|
||||
JSONArray datas = JSONArray.parseArray(param);
|
||||
CreateTaskResponse response = new CreateTaskResponse();
|
||||
JSONArray errArr = new JSONArray();
|
||||
@@ -463,6 +483,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
log.info("createFromWms--------------:输出参数:" + response);
|
||||
|
||||
return response;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ public class AutoCreateInst {
|
||||
String taskcode = acsTask.getTask_code();
|
||||
String task_type = acsTask.getTask_type();
|
||||
String vehiclecode = acsTask.getVehicle_code();
|
||||
String storage_task_type = acsTask.getStorage_task_type();
|
||||
String priority = acsTask.getPriority();
|
||||
String is_send = acsTask.getIs_send();
|
||||
|
||||
@@ -70,6 +71,9 @@ public class AutoCreateInst {
|
||||
if (StrUtil.equals(is_send, "0")) {
|
||||
continue;
|
||||
}
|
||||
if(StrUtil.equals(storage_task_type,"1") || StrUtil.equals(storage_task_type,"2") ){
|
||||
continue;
|
||||
}
|
||||
//校验路由关系
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
|
||||
@@ -2,14 +2,13 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
redis:
|
||||
repositories:
|
||||
enabled: false
|
||||
|
||||
#配置 Jpa
|
||||
jpa:
|
||||
hibernate:
|
||||
@@ -18,7 +17,7 @@ spring:
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
enable_lazy_load_no_trans: true
|
||||
|
||||
task:
|
||||
pool:
|
||||
# 核心线程池大小
|
||||
@@ -44,37 +43,13 @@ rsa:
|
||||
private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
|
||||
logging:
|
||||
file:
|
||||
path: C:\log\wms
|
||||
config: classpath:logback-spring.xml
|
||||
# sa-token白名单配置
|
||||
security:
|
||||
# 排除路径
|
||||
excludes:
|
||||
# 认证
|
||||
- /auth/login
|
||||
- /auth/code
|
||||
- /auth/logout
|
||||
# swagger
|
||||
- /swagger-ui.html
|
||||
- /swagger-resources/**
|
||||
- /webjars/**
|
||||
- /file/**
|
||||
- /webSocket/**
|
||||
# 静态资源
|
||||
- /*.html
|
||||
- /**/*.html
|
||||
- /**/*.css
|
||||
- /**/*.js
|
||||
# swagger 文档配置
|
||||
- /favicon.ico
|
||||
- /*/api-docs
|
||||
- /*/api-docs/**
|
||||
# druid 监控配置
|
||||
- /druid/**
|
||||
# actuator 监控配置
|
||||
- /actuator
|
||||
- /actuator/**
|
||||
# 上传
|
||||
- /api/localStorage/pictures
|
||||
# 参数
|
||||
- /api/param/getValueByCode
|
||||
path: C:\logs\nlacs\
|
||||
demo:
|
||||
monitor:
|
||||
server-url: https://www.demo-monitor.com
|
||||
username: MessiLoveRidingBike
|
||||
password: 123456
|
||||
|
||||
acsTowms:
|
||||
token: Bearer eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiI2ZjI2OGMxZjAyOTE0MTNiOWU3YThmMTM2ZTc2MWJkYSIsImF1dGgiOiJhZG1pbiIsInN1YiI6ImFkbWluIn0.lKxY3Wc_efzmBXXAS_dDC_Sfh32kZInxYmaxBzg83e5gviSJPPKolNt4IlCCaGM8HOc_yKByiIu8YFlgQif01Q
|
||||
|
||||
|
||||
Reference in New Issue
Block a user