更新
This commit is contained in:
@@ -46,4 +46,11 @@ public class AcsToWmsZDController {
|
||||
public ResponseEntity<Object> taskDeprecate(@RequestBody Map whereJson) throws Exception {
|
||||
return new ResponseEntity<>(acsToWmsZDService.taskDeprecate(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/checkDeviceStatus")
|
||||
@Log("设备状态获取")
|
||||
@ApiOperation("设备状态获取")
|
||||
public ResponseEntity<Object> checkDeviceStatus(@RequestBody Map whereJson) throws Exception {
|
||||
return new ResponseEntity<>(acsToWmsZDService.checkDeviceStatus(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,5 +36,5 @@ public interface AcsToWmsZDService {
|
||||
*
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
HttpResponse deviceStatusQuery(JSONObject whereJson) throws Exception;
|
||||
Map<String, Object> checkDeviceStatus(Map whereJson) throws Exception;
|
||||
}
|
||||
|
||||
@@ -8,30 +8,26 @@ import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.config.server.AcsConfigService;
|
||||
import org.nl.acs.device.address.service.AddressService;
|
||||
import org.nl.acs.device.address.service.dto.AddressDto;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.device_driver.standard_conveyor_line.StandardConveyorLineDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsZDService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.exception.WDKException;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -40,6 +36,8 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
|
||||
private final DeviceAppService deviceAppService;
|
||||
|
||||
@Autowired
|
||||
RouteLineService routeLineService;
|
||||
|
||||
@@ -64,11 +62,8 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> taskCreate(JSONObject whereJson) {
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
log.info("taskCreate--------------:输入参数:" + whereJson.toString());
|
||||
try {
|
||||
JSONArray errArr = new JSONArray();
|
||||
|
||||
//获取甲方wcs传过来的参数
|
||||
String houseCode = whereJson.optString("houseCode");
|
||||
@@ -87,16 +82,24 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
String next_device_code = "";
|
||||
//判断必填项是否为空
|
||||
if (StrUtil.isEmpty(taskCode)) {
|
||||
throw new WDKException("任务号不能为空");
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "任务号不能为空");
|
||||
return map;
|
||||
}
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
throw new WDKException("起点不能为空");
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "起点不能为空");
|
||||
return map;
|
||||
}
|
||||
if (StrUtil.isEmpty(next_point_code)) {
|
||||
throw new WDKException("终点不能为空");
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "终点不能为空");
|
||||
return map;
|
||||
}
|
||||
if (StrUtil.isEmpty(containerCode)) {
|
||||
throw new WDKException("容器编号不能为空");
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "容器编号不能为空");
|
||||
return map;
|
||||
}
|
||||
|
||||
if (start_point_code.indexOf("-") > 0) {
|
||||
@@ -116,18 +119,24 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
//查询wcs传过来的起点终点路由
|
||||
List<RouteLineDto> list = routeLineService.getShortPathLines(start_device_code, next_device_code, "normal");
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
throw new WDKException("路由不通!");
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "路由不通!");
|
||||
return map;
|
||||
}
|
||||
//查询任务编码是否重复
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(taskCode);
|
||||
if (taskDto != null) {
|
||||
throw new WDKException("不能存在相同的任务号!");
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "不能存在相同的任务号!");
|
||||
return map;
|
||||
}
|
||||
//判断载具编码是否相同
|
||||
if (!StrUtil.isEmpty(containerCode)) {
|
||||
TaskDto vehicle_dto = taskService.findByContainer(containerCode);
|
||||
if (vehicle_dto != null) {
|
||||
throw new WDKException("已存在该容器号的任务!");
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "已存在该容器号的任务!");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,36 +158,21 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
taskService.create(task_dto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", taskCode);
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", e.getMessage());
|
||||
return map;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
resultJson.put("responseCode", 0);
|
||||
resultJson.put("responseMessage", "操作成功");
|
||||
} else {
|
||||
resultJson.put("responseCode", 400);
|
||||
resultJson.put("responseMessage", "操作失败");
|
||||
}
|
||||
resultJson.put("parameters", errArr);
|
||||
log.info("taskCreate--------------:输出参数:" + resultJson.toString());
|
||||
|
||||
} catch (Exception e) {
|
||||
resultJson.put("responseCode", 400);
|
||||
resultJson.put("parameters", e.getMessage());
|
||||
resultJson.put("responseMessage", "操作失败");
|
||||
log.info("taskCreate--------------:输出参数:" + resultJson.toString());
|
||||
}
|
||||
return resultJson;
|
||||
map.put("responseCode", 0);
|
||||
map.put("responseMessage", "创建任务成功!");
|
||||
map.put("parameters", new HashMap<>());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> taskFeedback(Map whereJson) {
|
||||
log.info("taskFeedback-----请求参数{}", whereJson.toString());
|
||||
String taskCode = (String) whereJson.get("task_code");
|
||||
String vehicle_code = (String) whereJson.get("carId");
|
||||
String taskCode = MapUtil.getStr(whereJson, "taskCode");
|
||||
String carId = MapUtil.getStr(whereJson, "carId");
|
||||
HttpResponse result = null;
|
||||
AddressDto addressDto = addressService.findByCode("taskFeedback");
|
||||
String wcsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WCSURL);
|
||||
@@ -189,47 +183,22 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
.header("Authorization", token).body(String.valueOf(whereJson))
|
||||
.execute();
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
logServer.log(taskCode, "taskFeedback", "error", whereJson.toString(), msg, String.valueOf(result.getStatus()), url, vehicle_code);
|
||||
log.info("taskFeedback-----异常输出参数{}", msg);
|
||||
logServer.log(taskCode, "taskFeedback", "error", whereJson.toString(), result.body(), String.valueOf(result.getStatus()), url, carId);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", e.getMessage());
|
||||
map.put("parameters", new HashMap<>());
|
||||
return map;
|
||||
}
|
||||
String type = "";
|
||||
if(!ObjectUtil.isEmpty(result)){
|
||||
if (result.getStatus() == 0) {
|
||||
type = "info";
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
|
||||
logServer.log(taskCode, "taskFeedback", type, whereJson.toString(), result.body(), String.valueOf(result.getStatus()), url, vehicle_code);
|
||||
logServer.log(taskCode, "taskFeedback", "success", whereJson.toString(), result.body(), String.valueOf(result.getStatus()), url, carId);
|
||||
JSONObject jo = JSONObject.fromObject(result.body());
|
||||
log.info("taskFeedback-----输出参数{}", jo.toString());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> taskDeprecate(Map whereJson) throws Exception {
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
public Map<String, Object> taskDeprecate(Map whereJson) {
|
||||
log.info("taskDeprecate--------------:输入参数" + whereJson.toString());
|
||||
String taskCode = MapUtil.getStr(whereJson, "task_code");
|
||||
String houseCode =MapUtil.getStr(whereJson,"taskhouseCode_code");
|
||||
Object parameters = whereJson.get("parameters");
|
||||
String systemCode = MapUtil.getStr(whereJson,"systemCode");
|
||||
String reason = MapUtil.getStr(whereJson,"reason");
|
||||
if(ObjectUtil.isEmpty(taskCode)){
|
||||
throw new BadRequestException("任务编号不能为空");
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("houseCode",houseCode);
|
||||
map.put("systemCode",systemCode);
|
||||
map.put("parameters",parameters);
|
||||
map.put("taskCode",taskCode);
|
||||
map.put("reason",reason);
|
||||
HttpResponse result = null;
|
||||
AddressDto addressDto = addressService.findByCode("deprecateTask");
|
||||
String wcsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WCSURL);
|
||||
@@ -240,50 +209,57 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService {
|
||||
.header("Authorization", token).body(String.valueOf(whereJson))
|
||||
.execute();
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
logServer.log(taskCode, "taskFeedback", "error", whereJson.toString(), msg, String.valueOf(result.getStatus()), url, "");
|
||||
log.info("taskFeedback-----异常输出参数{}", msg);
|
||||
e.printStackTrace();
|
||||
logServer.log(taskCode, "taskFeedback", "error", whereJson.toString(), e.getMessage(), String.valueOf(result.getStatus()), url, "");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", e.getMessage());
|
||||
return map;
|
||||
}
|
||||
String type = "";
|
||||
if(!ObjectUtil.isEmpty(result)){
|
||||
if (result.getStatus() == 0) {
|
||||
type = "info";
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
|
||||
logServer.log(taskCode, "taskDeprecate", type, whereJson.toString(), result.body(), String.valueOf(result.getStatus()), url, "");
|
||||
logServer.log(taskCode, "taskDeprecate", "success", whereJson.toString(), result.body(), String.valueOf(result.getStatus()), url, "");
|
||||
JSONObject jo = JSONObject.fromObject(result.body());
|
||||
log.info("taskDeprecate-----输出参数{}", jo.toString());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse deviceStatusQuery(JSONObject whereJson) throws Exception {
|
||||
String wmsUrl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
|
||||
public Map<String, Object> checkDeviceStatus(Map whereJson) throws Exception {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String systemCode = MapUtil.getStr(whereJson, "systemCode");
|
||||
String houseCode = MapUtil.getStr(whereJson, "houseCode");
|
||||
String parameters = MapUtil.getStr(whereJson, "parameters");
|
||||
String deviceCode = MapUtil.getStr(whereJson, "deviceCode");
|
||||
if (StrUtil.isEmpty(deviceCode)) {
|
||||
map.put("responseCode", 1);
|
||||
map.put("responseMessage", "请求设备号不能为空!");
|
||||
map.put("parameters", new HashMap<>());
|
||||
return map;
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(deviceCode);
|
||||
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
|
||||
int status = 0;
|
||||
Boolean hasGoods = false;
|
||||
String statusDescription = "正常";
|
||||
if (device.getDeviceDriver() instanceof StandardConveyorLineDeviceDriver) {
|
||||
standardConveyorLineDeviceDriver = (StandardConveyorLineDeviceDriver) device.getDeviceDriver();
|
||||
status = standardConveyorLineDeviceDriver.getError();
|
||||
int move = standardConveyorLineDeviceDriver.getMove();
|
||||
if (status != 0) {
|
||||
statusDescription = "异常";
|
||||
}
|
||||
if (move == 1) {
|
||||
hasGoods = true;
|
||||
}
|
||||
} else if (1 == 1) {
|
||||
|
||||
AddressDto addressDto = addressService.findByCode("deviceStatusQuery");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
HttpResponse result = null;
|
||||
log.info("feedWeighing----请求参数{}", whereJson);
|
||||
}
|
||||
map.put("responseCode", 0);
|
||||
map.put("responseMessage", "响应成功!");
|
||||
map.put("parameters", new HashMap<>());
|
||||
map.put("status", status);
|
||||
map.put("statusDescription", statusDescription);
|
||||
map.put("hasGoods", hasGoods);
|
||||
return map;
|
||||
}
|
||||
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.body(String.valueOf(whereJson))
|
||||
.execute();
|
||||
System.out.println(result);
|
||||
log.info("feedWeighing----返回参数{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> waitpointRequest(JSONObject param) {
|
||||
// TODO 待定
|
||||
String inst_code = param.getString("task_code");
|
||||
String address = param.getString("address");
|
||||
StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver;
|
||||
@@ -44,7 +43,6 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
map.put("status", 400);
|
||||
map.put("message", "请求失败,指令为空!");
|
||||
logServer.log("", "waitpointRequest", "erro", param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", "");
|
||||
// return map;
|
||||
throw new BadRequestException("请求失败,指令为空!");
|
||||
}
|
||||
String task_code = instructionDto.getTask_code();
|
||||
@@ -156,7 +154,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
logServer.log(task_code, "waitpointRequest", type, param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,终点位置无货!");
|
||||
} else {
|
||||
standardConveyorLineDeviceDriver.writing(1, 2);
|
||||
standardConveyorLineDeviceDriver.writing(1, 3);
|
||||
feedMap.put("feedbackStatus", "putFinish");
|
||||
Map<String, Object> feedback = acsToWmsZDService.taskFeedback(feedMap);
|
||||
int responseCode = (int) feedback.get("responseCode");
|
||||
@@ -182,6 +180,5 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
|
||||
map.put("message", "请求失败,IN OUT 站点错误!");
|
||||
logServer.log(task_code, "waitpointRequest", "erro", param.toString(), String.valueOf(map), "400", "api/agv/waitpointRequest", instructionDto.getVehicle_code());
|
||||
throw new BadRequestException("请求失败,终点位置无货!");
|
||||
//return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +108,14 @@ public class InstructionController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("强制取消指令")
|
||||
@ApiOperation("强制取消指令")
|
||||
@PostMapping(value = "/forceCancel/{id}")
|
||||
public ResponseEntity<Object> forceCancel(@RequestBody String id) throws Exception {
|
||||
instructionService.cancelNOSendAgv(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出指令")
|
||||
@ApiOperation("导出指令")
|
||||
@GetMapping(value = "/download")
|
||||
|
||||
@@ -774,7 +774,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("task_code",entity.getTask_code());
|
||||
// map.put("reason",entity.getTask_code());
|
||||
map.put("reason","acs手动取消!");
|
||||
acsToWmsZDService.taskDeprecate(map);
|
||||
}
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(entity.getStart_device_code(), entity.getNext_device_code(), entity.getRoute_plan_code());
|
||||
|
||||
@@ -60,7 +60,7 @@ spring:
|
||||
multi-statement-alagvslow: true
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:0}
|
||||
database: ${REDIS_DB:11}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
||||
@@ -159,6 +159,7 @@
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'a')">完成</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'b')">取消</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'c')">强制取消</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
@@ -290,6 +291,14 @@ export default {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
forceCancel(index, row) {
|
||||
crudInstruction.forceCancel(row.instruction_id).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('强制取消成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
reload() {
|
||||
crudInstruction.reload().then(res => {
|
||||
this.crud.toQuery()
|
||||
@@ -313,6 +322,9 @@ export default {
|
||||
case 'b':// 取消
|
||||
this.cancel(command.index, command.row)
|
||||
break
|
||||
case 'c':// 强制取消
|
||||
this.forceCancel(command.index, command.row)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -315,6 +315,13 @@ export default {
|
||||
this.form.next_device_code = Array.of(data.form.next_device_code.split('').join(''))
|
||||
return true
|
||||
},
|
||||
[CRUD.HOOK.beforeSubmit](data) {
|
||||
if (this.crud.status.edit === 1) {
|
||||
this.form.device_code = data.form.device_code.join('')
|
||||
this.form.next_device_code = data.form.next_device_code.join('')
|
||||
}
|
||||
return true
|
||||
},
|
||||
// 改变状态
|
||||
changeEnabled(data) {
|
||||
var msg = '停用'
|
||||
|
||||
Reference in New Issue
Block a user