Commit fdee67de authored by zhoumaotao's avatar zhoumaotao

初始创建

parent be2bd693
Pipeline #200 canceled with stages
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gavel.manufacturing</groupId>
<artifactId>hcgd</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>mcs</name>
<description>华灿光电</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<mysql.version>8.0.24</mysql.version>
<t-io.version>3.6.0.v20200315-RELEASE</t-io.version>
<pom.package>war</pom.package>
<pom.packageName>mcs</pom.packageName>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.32-1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.gavel.platform</groupId>
<artifactId>gavel-persistence</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.gavel.platform</groupId>
<artifactId>gavel-common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.gavel.platform</groupId>
<artifactId>gavel-kzzx</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.zeromq</groupId>
<artifactId>jeromq</artifactId>
<version>0.5.2</version>
</dependency>
<dependency>
<groupId>com.gavel.platform</groupId>
<artifactId>gavel-framework</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.gavel.platform</groupId>
<artifactId>gavel-timer</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.gavel.platform</groupId>
<artifactId>gavel-monitor</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.gavel.webjars</groupId>
<artifactId>gavel-webjars</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-core</artifactId>
<version>8.18.0</version>
</dependency>
<dependency>
<groupId>com.netflix.feign</groupId>
<artifactId>feign-gson</artifactId>
<version>8.18.0</version>
</dependency>
<!-- rabbitmq dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.t-io</groupId>
<artifactId>tio-websocket-spring-boot-starter</artifactId>
<version>${t-io.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- 开发环境 -->
<id>jar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<pom.package>jar</pom.package>
<pom.packageName>${project.artifactId}-${project.version}</pom.packageName>
<pom.profiles.active>dev</pom.profiles.active>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
<id>war</id>
<properties>
<pom.package>war</pom.package>
<pom.packageName>${project.artifactId}</pom.packageName>
<pom.profiles.active>linux</pom.profiles.active>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<finalName>mcs</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.gavel.hcgd;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Profile;
@SpringBootApplication
@ComponentScan("com.gavel.*")
public class GavelApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(GavelApplication.class, args);
}
@Profile(value = { "war" })
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(GavelApplication.class);
}
}
package com.gavel.hcgd;
import org.springframework.stereotype.Service;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.IThrowableProxy;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;
@Service
public class LogFilter extends Filter<ILoggingEvent> {
@Override
public FilterReply decide(ILoggingEvent event) {
String exception = "";
IThrowableProxy iThrowableProxy1 = event.getThrowableProxy();
if(iThrowableProxy1!=null){
exception = "<span class='excehtext'>"+iThrowableProxy1.getClassName()+" "+iThrowableProxy1.getMessage()+"</span></br>";
for(int i=0; i<iThrowableProxy1.getStackTraceElementProxyArray().length;i++){
exception += "<span class='excetext'>"+iThrowableProxy1.getStackTraceElementProxyArray()[i].toString()+"</span></br>";
}
}
/*LoggerMessage loggerMessage = new LoggerMessage(
event.getMessage()
, DateFormat.getDateTimeInstance().format(new Date(event.getTimeStamp())),
event.getThreadName(),
event.getLoggerName(),
event.getLevel().levelStr,
exception,
""
);
LoggerQueue.getInstance().push(loggerMessage);*/
return FilterReply.ACCEPT;
}
}
\ No newline at end of file
package com.gavel.hcgd.agv.controller;
import com.gavel.common.BaseURL;
import com.gavel.common.base.BaseEditJSON;
import com.gavel.common.base.controller.BaseController;
import com.gavel.common.converter.DataConvert;
import com.gavel.common.utils.StringUtils;
import com.gavel.hcgd.agv.persistent.Agv;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.common.annotation.ResourcePermissions;
import com.gavel.common.SystemOperation;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.utils.ThreadContext;
import com.gavel.hcgd.agv.service.AgvService;
import com.gavel.hcgd.agv.vo.AgvCondition;
import com.gavel.hcgd.agv.vo.AgvVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
@Controller
@RequestMapping("agv/agv")
public class AgvController extends BaseController {
@Autowired
private AgvService agvService;
@ResourcePermissions()
@RequestMapping("/index")
public String index() {
return "agv/agv/index";
}
@ResourcePermissions({SystemOperation.BottonResource.ADD})
@RequestMapping("/add")
public String add() {
return "agv/agv/edit";
}
@ResourcePermissions({SystemOperation.BottonResource.EDIT})
@RequestMapping("/edit")
public String edit() {
return "agv/agv/edit";
}
@RequestMapping(value = BaseURL.GET, method = RequestMethod.POST)
@ResponseBody
public Object get(@RequestBody JSONObject param) {
AgvCondition condition = DataConvert.getCondition(param, AgvCondition.class);
RecordSet<AgvVO> records = agvService.query(condition);
if ( records.getRecords()!=null && records.getRecords().size()>=1 ){
return buildReturnData(AgvVO.class, records.getRecords().get(0));
}
return buildReturnData(AgvVO.class, null);
}
@RequestMapping(value = BaseURL.QUERY, method = RequestMethod.POST)
@ResponseBody
public Object query(@RequestBody JSONObject param) {
AgvCondition condition = DataConvert.getCondition(param, AgvCondition.class);
RecordSet<AgvVO> records = agvService.query(condition);
return buildReturnData(records, AgvVO.class);
}
@ResourcePermissions(SystemOperation.BottonResource.ADD)
@RequestMapping(value = BaseURL.ADD, method = RequestMethod.POST)
@ResponseBody
public Object insert(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvService.insert(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EDIT)
@RequestMapping(value = BaseURL.UPDATE, method = RequestMethod.POST)
@ResponseBody
public Object update(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvService.update(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.DELETE)
@RequestMapping(value = BaseURL.DELETE, method = RequestMethod.POST)
@ResponseBody
public Object delete(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvService.delete(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EDIT)
@RequestMapping(value = BaseURL.SETQT, method = RequestMethod.POST)
@ResponseBody
public Object recordSetQT(@RequestBody JSONObject param) {
agvService.recordSetQT(DataConvert.getData(param, Agv.class));
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EXPORT)
@RequestMapping(value = BaseURL.EXPORT, method = RequestMethod.POST)
@ResponseBody
public void export(HttpServletRequest request,HttpServletResponse response, @RequestBody JSONObject param) throws Exception {
AgvCondition condition = DataConvert.getCondition(param, AgvCondition.class);
RecordSet<AgvVO> records = agvService.query(condition);
doExport(request, response, param, records.getRecords());
}
/**
* 停止AGV
*
* @param param
* @return
*/
@PostMapping(value = "/stopRobot")
public Object stopRobot(@RequestBody JSONObject param) {
String agvCode = param.getString("agvCode");
if (StringUtils.isEmpty(agvCode)) {
ThreadContext.getReturnData().setSuccess(false);
ThreadContext.getReturnData().setMessage("不存在AGV运行");
}
try {
agvService.pauseAgv(agvCode);
} catch (Exception e) {
ThreadContext.getReturnData().setSuccess(false);
ThreadContext.getReturnData().setMessage(e.getMessage());
}
return ThreadContext.getReturnData();
}
/**
* 恢复AGV
*
* @param param
* @return
*/
@PostMapping(value = "/resumeRobot")
public Object resumeRobot(@RequestBody JSONObject param) {
String agvCode = param.getString("agvCode");
if (StringUtils.isEmpty(agvCode)) {
ThreadContext.getReturnData().setSuccess(false);
ThreadContext.getReturnData().setMessage("不存在AGV运行");
}
try {
agvService.recoverAgv(agvCode);
} catch (Exception e) {
ThreadContext.getReturnData().setSuccess(false);
ThreadContext.getReturnData().setMessage(e.getMessage());
}
return ThreadContext.getReturnData();
}
}
package com.gavel.hcgd.agv.controller;
import com.gavel.common.BaseURL;
import com.gavel.common.base.BaseEditJSON;
import com.gavel.common.base.controller.BaseController;
import com.gavel.common.converter.DataConvert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.common.annotation.ResourcePermissions;
import com.gavel.common.SystemOperation;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.utils.ThreadContext;
import com.gavel.hcgd.agv.service.AgvtaskService;
import com.gavel.hcgd.agv.vo.AgvtaskCondition;
import com.gavel.hcgd.agv.vo.AgvtaskInfo;
import com.gavel.hcgd.agv.vo.AgvtaskVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Controller
@RequestMapping("agv/agvtask")
public class AgvtaskController extends BaseController {
@Autowired
private AgvtaskService agvtaskService;
@ResourcePermissions()
@RequestMapping("/index")
public String index() {
return "agv/agvtask/index";
}
@ResourcePermissions({SystemOperation.BottonResource.ADD})
@RequestMapping("/add")
public String add() {
return "agv/agvtask/edit";
}
@ResourcePermissions({SystemOperation.BottonResource.EDIT})
@RequestMapping("/edit")
public String edit() {
return "agv/agvtask/edit";
}
@RequestMapping(value = BaseURL.GET, method = RequestMethod.POST)
@ResponseBody
public Object get(@RequestBody JSONObject param) {
AgvtaskCondition condition = DataConvert.getCondition(param, AgvtaskCondition.class);
RecordSet<AgvtaskVO> records = agvtaskService.query(condition);
if ( records.getRecords()!=null && records.getRecords().size()>=1 ){
return buildReturnData(AgvtaskVO.class, records.getRecords().get(0));
}
return buildReturnData(AgvtaskVO.class, null);
}
@RequestMapping(value = BaseURL.QUERY, method = RequestMethod.POST)
@ResponseBody
public Object query(@RequestBody JSONObject param) {
AgvtaskCondition condition = DataConvert.getCondition(param, AgvtaskCondition.class);
RecordSet<AgvtaskVO> records = agvtaskService.query(condition);
return buildReturnData(records, AgvtaskVO.class);
}
@RequestMapping(value = "queryAgvTasks", method = RequestMethod.POST)
@ResponseBody
public Object queryTasks(@RequestBody JSONObject param) {
AgvtaskCondition condition = DataConvert.getCondition(param, AgvtaskCondition.class);
AgvtaskInfo records = agvtaskService.queryAgvTasks(condition);
return buildReturnData(AgvtaskInfo.class,records);
}
@ResourcePermissions(SystemOperation.BottonResource.ADD)
@RequestMapping(value = BaseURL.ADD, method = RequestMethod.POST)
@ResponseBody
public Object insert(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvtaskService.insert(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EDIT)
@RequestMapping(value = BaseURL.UPDATE, method = RequestMethod.POST)
@ResponseBody
public Object update(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvtaskService.update(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.DELETE)
@RequestMapping(value = BaseURL.DELETE, method = RequestMethod.POST)
@ResponseBody
public Object delete(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvtaskService.delete(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EXPORT)
@RequestMapping(value = BaseURL.EXPORT, method = RequestMethod.POST)
@ResponseBody
public void export(HttpServletRequest request,HttpServletResponse response, @RequestBody JSONObject param) throws Exception {
AgvtaskCondition condition = DataConvert.getCondition(param, AgvtaskCondition.class);
RecordSet<AgvtaskVO> records = agvtaskService.query(condition);
doExport(request, response, param, records.getRecords());
}
}
package com.gavel.hcgd.agv.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.gavel.common.Constants;
import com.gavel.common.exception.ParamNullException;
import com.gavel.common.utils.StringUtils;
import com.gavel.hcgd.agv.persistent.Agvtaskqueue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.BaseURL;
import com.gavel.common.SystemOperation;
import com.gavel.common.annotation.ResourcePermissions;
import com.gavel.common.base.BaseEditJSON;
import com.gavel.common.base.controller.BaseController;
import com.gavel.common.converter.DataConvert;
import com.gavel.common.utils.ThreadContext;
import com.gavel.hcgd.agv.service.AgvtaskqueueService;
import com.gavel.hcgd.agv.utils.AgvQueueStatusEnum;
import com.gavel.hcgd.agv.vo.AgvtaskqueueCondition;
import com.gavel.hcgd.agv.vo.AgvtaskqueueVO;
import com.gavel.persistence.sql.RecordSet;
@Controller
@RequestMapping("agv/agvtaskqueue")
public class AgvtaskqueueController extends BaseController {
@Autowired
private AgvtaskqueueService agvtaskqueueService;
@ResourcePermissions()
@RequestMapping("/index")
public String index() {
return "agv/agvtaskqueue/index";
}
@RequestMapping(value = BaseURL.GET, method = RequestMethod.POST)
@ResponseBody
public Object get(@RequestBody JSONObject param) {
AgvtaskqueueCondition condition = DataConvert.getCondition(param, AgvtaskqueueCondition.class);
RecordSet<AgvtaskqueueVO> records = agvtaskqueueService.query(condition);
if ( records.getRecords()!=null && records.getRecords().size()>=1 ){
return buildReturnData(AgvtaskqueueVO.class, records.getRecords().get(0));
}
return buildReturnData(AgvtaskqueueVO.class, null);
}
@RequestMapping(value = BaseURL.QUERY, method = RequestMethod.POST)
@ResponseBody
public Object query(@RequestBody JSONObject param) {
AgvtaskqueueCondition condition = DataConvert.getCondition(param, AgvtaskqueueCondition.class);
RecordSet<AgvtaskqueueVO> records = agvtaskqueueService.query(condition);
return buildReturnData(records, AgvtaskqueueVO.class);
}
@ResourcePermissions(SystemOperation.BottonResource.ADD)
@RequestMapping(value = BaseURL.ADD, method = RequestMethod.POST)
@ResponseBody
public Object insert(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvtaskqueueService.insert(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EDIT)
@RequestMapping(value = BaseURL.UPDATE, method = RequestMethod.POST)
@ResponseBody
public Object update(@RequestBody JSONObject param) {
try {
String id = param.getString(Constants.ID);
if(StringUtils.isEmpty(id)){
throw new ParamNullException("参数ID不能为空");
}
agvtaskqueueService.updateById(id);
}catch (Exception e){
ThreadContext.getReturnData().setSuccess(false);
ThreadContext.getReturnData().setMessage(e.getMessage());
}
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.DELETE)
@RequestMapping(value = BaseURL.DELETE, method = RequestMethod.POST)
@ResponseBody
public Object delete(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvtaskqueueService.delete(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EXPORT)
@RequestMapping(value = BaseURL.EXPORT, method = RequestMethod.POST)
@ResponseBody
public void export(HttpServletRequest request,HttpServletResponse response, @RequestBody JSONObject param) throws Exception {
AgvtaskqueueCondition condition = DataConvert.getCondition(param, AgvtaskqueueCondition.class);
RecordSet<AgvtaskqueueVO> records = agvtaskqueueService.query(condition);
doExport(request, response, param, records.getRecords());
}
@RequestMapping(value = "init/zt", method = RequestMethod.POST)
@ResponseBody
public Object initZt(@RequestBody JSONObject param) throws Exception {
return buildReturnData(AgvQueueStatusEnum.toList());
}
}
package com.gavel.hcgd.agv.controller;
import com.gavel.common.BaseURL;
import com.gavel.common.base.BaseEditJSON;
import com.gavel.common.base.controller.BaseController;
import com.gavel.common.converter.DataConvert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.common.annotation.ResourcePermissions;
import com.gavel.common.SystemOperation;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.utils.ThreadContext;
import com.gavel.hcgd.agv.service.AgvwarnService;
import com.gavel.hcgd.agv.vo.AgvwarnCondition;
import com.gavel.hcgd.agv.vo.AgvwarnVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
@RequestMapping("agv/agvwarn")
public class AgvwarnController extends BaseController {
@Autowired
private AgvwarnService agvwarnService;
@ResourcePermissions()
@RequestMapping("/index")
public String index() {
return "agv/agvwarn/index";
}
@ResourcePermissions({SystemOperation.BottonResource.ADD})
@RequestMapping("/add")
public String add() {
return "agv/agvwarn/edit";
}
@ResourcePermissions({SystemOperation.BottonResource.EDIT})
@RequestMapping("/edit")
public String edit() {
return "agv/agvwarn/edit";
}
@RequestMapping(value = BaseURL.GET, method = RequestMethod.POST)
@ResponseBody
public Object get(@RequestBody JSONObject param) {
AgvwarnCondition condition = DataConvert.getCondition(param, AgvwarnCondition.class);
RecordSet<AgvwarnVO> records = agvwarnService.query(condition);
if ( records.getRecords()!=null && records.getRecords().size()>=1 ){
return buildReturnData(AgvwarnVO.class, records.getRecords().get(0));
}
return buildReturnData(AgvwarnVO.class, null);
}
@RequestMapping(value = BaseURL.QUERY, method = RequestMethod.POST)
@ResponseBody
public Object query(@RequestBody JSONObject param) {
AgvwarnCondition condition = DataConvert.getCondition(param, AgvwarnCondition.class);
RecordSet<AgvwarnVO> records = agvwarnService.query(condition);
return buildReturnData(records, AgvwarnVO.class);
}
@ResourcePermissions(SystemOperation.BottonResource.ADD)
@RequestMapping(value = BaseURL.ADD, method = RequestMethod.POST)
@ResponseBody
public Object insert(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvwarnService.insert(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EDIT)
@RequestMapping(value = BaseURL.UPDATE, method = RequestMethod.POST)
@ResponseBody
public Object update(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvwarnService.update(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.DELETE)
@RequestMapping(value = BaseURL.DELETE, method = RequestMethod.POST)
@ResponseBody
public Object delete(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
agvwarnService.delete(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EXPORT)
@RequestMapping(value = BaseURL.EXPORT, method = RequestMethod.POST)
@ResponseBody
public void export(HttpServletRequest request,HttpServletResponse response, @RequestBody JSONObject param) throws Exception {
AgvwarnCondition condition = DataConvert.getCondition(param, AgvwarnCondition.class);
RecordSet<AgvwarnVO> records = agvwarnService.query(condition);
doExport(request, response, param, records.getRecords());
}
}
package com.gavel.hcgd.agv.controller;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.BaseURL;
import com.gavel.common.SystemOperation;
import com.gavel.common.annotation.ResourcePermissions;
import com.gavel.common.base.BaseEditJSON;
import com.gavel.common.base.controller.BaseController;
import com.gavel.common.converter.DataConvert;
import com.gavel.common.utils.ThreadContext;
import com.gavel.hcgd.agv.service.EptaskService;
import com.gavel.hcgd.agv.utils.TaskModelEnum;
import com.gavel.hcgd.agv.vo.EptaskCondition;
import com.gavel.hcgd.agv.vo.EptaskVO;
import com.gavel.hcgd.mcs.utils.EpTask2Enum;
import com.gavel.persistence.sql.RecordSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
@RequestMapping("agv/eptask")
public class EptaskController extends BaseController {
@Autowired
private EptaskService eptaskService;
@ResourcePermissions()
@RequestMapping("/index")
public String index() {
return "agv/eptask/index";
}
@ResourcePermissions({SystemOperation.BottonResource.ADD})
@RequestMapping("/add")
public String add() {
return "agv/eptask/edit";
}
@ResourcePermissions({SystemOperation.BottonResource.EDIT})
@RequestMapping("/edit")
public String edit() {
return "agv/eptask/edit";
}
@RequestMapping(value = BaseURL.GET, method = RequestMethod.POST)
@ResponseBody
public Object get(@RequestBody JSONObject param) {
EptaskCondition condition = DataConvert.getCondition(param, EptaskCondition.class);
RecordSet<EptaskVO> records = eptaskService.query(condition);
if ( records.getRecords()!=null && records.getRecords().size()>=1 ){
return buildReturnData(EptaskVO.class, records.getRecords().get(0));
}
return buildReturnData(EptaskVO.class, null);
}
@RequestMapping(value = BaseURL.QUERY, method = RequestMethod.POST)
@ResponseBody
public Object query(@RequestBody JSONObject param) {
EptaskCondition condition = DataConvert.getCondition(param, EptaskCondition.class);
RecordSet<EptaskVO> records = eptaskService.query(condition);
return buildReturnData(records, EptaskVO.class);
}
@ResourcePermissions(SystemOperation.BottonResource.ADD)
@RequestMapping(value = BaseURL.ADD, method = RequestMethod.POST)
@ResponseBody
public Object insert(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
eptaskService.insert(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EDIT)
@RequestMapping(value = BaseURL.UPDATE, method = RequestMethod.POST)
@ResponseBody
public Object update(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
eptaskService.update(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.DELETE)
@RequestMapping(value = BaseURL.DELETE, method = RequestMethod.POST)
@ResponseBody
public Object delete(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
eptaskService.delete(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EXPORT)
@RequestMapping(value = BaseURL.EXPORT, method = RequestMethod.POST)
@ResponseBody
public void export(HttpServletRequest request,HttpServletResponse response, @RequestBody JSONObject param) throws Exception {
EptaskCondition condition = DataConvert.getCondition(param, EptaskCondition.class);
RecordSet<EptaskVO> records = eptaskService.query(condition);
doExport(request, response, param, records.getRecords());
}
@RequestMapping(value = "/init/type", method = RequestMethod.POST)
@ResponseBody
public Object initType() {
return buildReturnData(EpTask2Enum.toList());
}
@RequestMapping(value = "/init/taskType", method = RequestMethod.POST)
@ResponseBody
public Object initTaskType() {
return buildReturnData(TaskModelEnum.toList());
}
}
package com.gavel.hcgd.agv.controller;
import com.gavel.common.BaseURL;
import com.gavel.common.base.BaseEditJSON;
import com.gavel.common.base.controller.BaseController;
import com.gavel.common.converter.DataConvert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.common.annotation.ResourcePermissions;
import com.gavel.common.SystemOperation;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.utils.ThreadContext;
import com.gavel.hcgd.agv.service.HcMsglogService;
import com.gavel.hcgd.agv.vo.HcMsglogCondition;
import com.gavel.hcgd.agv.vo.HcMsglogVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
@RequestMapping("agv/msglog")
public class HcMsglogController extends BaseController {
@Autowired
private HcMsglogService hcMsglogService;
@ResourcePermissions()
@RequestMapping("/index")
public String index() {
return "agv/msglog/index";
}
@ResourcePermissions({SystemOperation.BottonResource.ADD})
@RequestMapping("/add")
public String add() {
return "agv/msglog/edit";
}
@ResourcePermissions({SystemOperation.BottonResource.EDIT})
@RequestMapping("/edit")
public String edit() {
return "agv/msglog/edit";
}
@RequestMapping(value = BaseURL.GET, method = RequestMethod.POST)
@ResponseBody
public Object get(@RequestBody JSONObject param) {
HcMsglogCondition condition = DataConvert.getCondition(param, HcMsglogCondition.class);
RecordSet<HcMsglogVO> records = hcMsglogService.query(condition);
if ( records.getRecords()!=null && records.getRecords().size()>=1 ){
return buildReturnData(HcMsglogVO.class, records.getRecords().get(0));
}
return buildReturnData(HcMsglogVO.class, null);
}
@RequestMapping(value = BaseURL.QUERY, method = RequestMethod.POST)
@ResponseBody
public Object query(@RequestBody JSONObject param) {
HcMsglogCondition condition = DataConvert.getCondition(param, HcMsglogCondition.class);
RecordSet<HcMsglogVO> records = hcMsglogService.query(condition);
return buildReturnData(records, HcMsglogVO.class);
}
@ResourcePermissions(SystemOperation.BottonResource.ADD)
@RequestMapping(value = BaseURL.ADD, method = RequestMethod.POST)
@ResponseBody
public Object insert(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
hcMsglogService.insert(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EDIT)
@RequestMapping(value = BaseURL.UPDATE, method = RequestMethod.POST)
@ResponseBody
public Object update(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
hcMsglogService.update(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.DELETE)
@RequestMapping(value = BaseURL.DELETE, method = RequestMethod.POST)
@ResponseBody
public Object delete(@RequestBody JSONObject param) {
BaseEditJSON editJson = BaseEditJSON.parseJSON(param);
hcMsglogService.delete(editJson);
return ThreadContext.getReturnData();
}
@ResourcePermissions(SystemOperation.BottonResource.EXPORT)
@RequestMapping(value = BaseURL.EXPORT, method = RequestMethod.POST)
@ResponseBody
public void export(HttpServletRequest request,HttpServletResponse response, @RequestBody JSONObject param) throws Exception {
HcMsglogCondition condition = DataConvert.getCondition(param, HcMsglogCondition.class);
RecordSet<HcMsglogVO> records = hcMsglogService.query(condition);
doExport(request, response, param, records.getRecords());
}
}
package com.gavel.hcgd.agv.dao;
import com.gavel.common.base.dao.BaseDao;
import com.gavel.hcgd.agv.vo.AgvCondition;
import com.gavel.hcgd.agv.vo.AgvVO;
import com.gavel.persistence.sql.RecordSet;
public interface AgvDao extends BaseDao {
public RecordSet<AgvVO> query(AgvCondition condition);
}
package com.gavel.hcgd.agv.dao;
import com.gavel.common.base.dao.BaseDao;
import com.gavel.hcgd.agv.persistent.Agvtask;
import com.gavel.hcgd.agv.vo.AgvtaskCondition;
import com.gavel.hcgd.agv.vo.AgvtaskVO;
import com.gavel.persistence.sql.RecordSet;
import java.util.List;
public interface AgvtaskDao extends BaseDao {
public RecordSet<AgvtaskVO> query(AgvtaskCondition condition);
public AgvtaskVO working(AgvtaskCondition condition);
public Agvtask loadTask(String taskCode);
public AgvtaskVO queryByWbcode(String usercallcode);
public List<AgvtaskVO> queryAgvTasks(AgvtaskCondition condition);
}
package com.gavel.hcgd.agv.dao;
import com.gavel.common.base.dao.BaseDao;
import com.gavel.hcgd.agv.persistent.Agvtaskqueue;
import com.gavel.hcgd.agv.vo.AgvtaskqueueCondition;
import com.gavel.hcgd.agv.vo.AgvtaskqueueVO;
import com.gavel.persistence.sql.RecordSet;
public interface AgvtaskqueueDao extends BaseDao {
public RecordSet<AgvtaskqueueVO> query(AgvtaskqueueCondition condition);
public Agvtaskqueue selectPop(String msgType);
public Agvtaskqueue queryAgvtask(String GUID,String msgType);
}
package com.gavel.hcgd.agv.dao;
import com.gavel.common.base.dao.BaseDao;
import com.gavel.hcgd.agv.vo.AgvwarnCondition;
import com.gavel.hcgd.agv.vo.AgvwarnVO;
import com.gavel.persistence.sql.RecordSet;
public interface AgvwarnDao extends BaseDao {
public RecordSet<AgvwarnVO> query(AgvwarnCondition condition);
}
package com.gavel.hcgd.agv.dao;
import com.gavel.common.base.dao.BaseDao;
import com.gavel.hcgd.agv.persistent.Eptask;
import com.gavel.hcgd.agv.vo.EptaskCondition;
import com.gavel.hcgd.agv.vo.EptaskVO;
import com.gavel.persistence.sql.RecordSet;
import java.util.List;
public interface EptaskDao extends BaseDao {
public RecordSet<EptaskVO> query(EptaskCondition condition);
public Eptask findExecutingTask(String wbCode, String type);
public Eptask findExecutingHcTask(String robotCode);
public int countExecutingHcTask(String s);
}
package com.gavel.hcgd.agv.dao;
import com.gavel.common.base.dao.BaseDao;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.hcgd.agv.vo.HcMsglogCondition;
import com.gavel.hcgd.agv.vo.HcMsglogVO;
public interface HcMsglogDao extends BaseDao {
public RecordSet<HcMsglogVO> query(HcMsglogCondition condition);
}
package com.gavel.hcgd.agv.dao.impl;
import com.gavel.common.base.dao.impl.BaseDaoImpl;
import com.gavel.common.utils.StringUtils;
import com.gavel.hcgd.agv.dao.AgvDao;
import com.gavel.hcgd.agv.vo.AgvCondition;
import com.gavel.hcgd.agv.vo.AgvVO;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.persistence.sql.SqlMap;
import com.gavel.persistence.sql.SqlUtil;
import org.springframework.stereotype.Repository;
@Repository("agvDao")
public class AgvDaoImpl extends BaseDaoImpl implements AgvDao {
public RecordSet<AgvVO> query(AgvCondition condition) {
SqlMap sqlMap = new SqlMap();
sqlMap.setPageNo(condition.getPageNo());
sqlMap.setRowCount(condition.getPageSize());
sqlMap.append("select AGV_ID, AGV_ROBOTCODE, AGV_ROBOTDIR, AGV_ROBOTIP, AGV_BATTERY, ");
sqlMap.append(" AGV_POSX, AGV_POSY, AGV_MAPCODE, AGV_SPEED, AGV_STATUS, ");
sqlMap.append(" AGV_EXCLTYPE, AGV_STOP, AGV_PODCODE, AGV_PODDIR, AGV_PATH, ");
sqlMap.append(" AGV_WARNCONTENT, AGVSTATUS_CODE, AGVSTATUS_CHINESE, AGVSTATUS_ENGLISH,AGV_TYBZ,AGV_TYRQ ");
sqlMap.append("from AGV ");
sqlMap.append(" left join AGVSTATUS on AGVSTATUS_CODE = AGV_STATUS ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getId())) {
sqlMap.append(" and " + SqlUtil.getWhereSql("AGV_ID", condition.getId()));
sqlMap.setParamValue("AGV_ID", condition.getId());
}
if (StringUtils.isNotEmpty(condition.getRobotcode())) {
sqlMap.append(" and " + SqlUtil.getWhereSql("AGV_ROBOTCODE", condition.getRobotcode()));
sqlMap.setParamValue("AGV_ROBOTCODE", condition.getRobotcode());
}
sqlMap.query(AgvVO.class);
return sqlMap.getRecordSet();
}
}
package com.gavel.hcgd.agv.dao.impl;
import com.gavel.common.base.dao.impl.BaseDaoImpl;
import com.gavel.common.utils.DateUtils;
import com.gavel.common.utils.StringUtils;
import com.gavel.hcgd.agv.dao.AgvtaskqueueDao;
import com.gavel.hcgd.agv.persistent.Agvtaskqueue;
import com.gavel.hcgd.agv.vo.AgvtaskqueueCondition;
import com.gavel.hcgd.agv.vo.AgvtaskqueueVO;
import com.gavel.hcgd.rabbitmq.handler.MessageHandler;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.persistence.sql.SqlMap;
import com.gavel.persistence.sql.SqlUtil;
import org.springframework.stereotype.Repository;
@Repository("agvtaskqueueDao")
public class AgvtaskqueueDaoImpl extends BaseDaoImpl implements AgvtaskqueueDao {
public RecordSet<AgvtaskqueueVO> query(AgvtaskqueueCondition condition){
SqlMap sqlMap = new SqlMap();
sqlMap.setPageNo(condition.getPageNo());
sqlMap.setRowCount(condition.getPageSize());
sqlMap.append("select AGVTASKQUEUE_ID, AGVTASKQUEUE_MSGTYPE, AGVTASKQUEUE_GUID, AGVTASKQUEUE_TASKTYPE, AGVTASKQUEUE_DESTTASK, ");
sqlMap.append(" AGVTASKQUEUE_NEXTTIME, AGVTASKQUEUE_ZT, AGVTASKQUEUE_WHSJ, AGVTASKQUEUE_CJSJ, AGVTASKQUEUE_SYSVERSION ");
sqlMap.append("from AGVTASKQUEUE ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getId())){
sqlMap.append(" and " + SqlUtil.getWhereSql("AGVTASKQUEUE_ID", condition.getId()));
sqlMap.setParamValue("AGVTASKQUEUE_ID", condition.getId());
}
sqlMap.append("order by AGVTASKQUEUE_CJSJ ");
return sqlMap.queryRecordset(AgvtaskqueueVO.class);
}
@Override
public Agvtaskqueue selectPop(String msgType) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select top 1 AGVTASKQUEUE_ID, AGVTASKQUEUE_MSGTYPE, AGVTASKQUEUE_GUID, AGVTASKQUEUE_TASKTYPE, AGVTASKQUEUE_DESTTASK, ");
sqlMap.append(" AGVTASKQUEUE_NEXTTIME, AGVTASKQUEUE_ZT, AGVTASKQUEUE_WHSJ, AGVTASKQUEUE_CJSJ, AGVTASKQUEUE_SYSVERSION, ");
sqlMap.append(" AGVTASKQUEUE_BODY");
sqlMap.append("from AGVTASKQUEUE ");
sqlMap.append("where AGVTASKQUEUE_ZT ='I' and AGVTASKQUEUE_NEXTTIME <= :AGVTASKQUEUE_NEXTTIME");
sqlMap.setParamValue("AGVTASKQUEUE_NEXTTIME", DateUtils.getDateTime());
if (StringUtils.equalsIgnoreCase(msgType, MessageHandler.TASK_CANCEL) ){
sqlMap.append(" and AGVTASKQUEUE_MSGTYPE = :AGVTASKQUEUE_MSGTYPE");
sqlMap.setParamValue("AGVTASKQUEUE_MSGTYPE", msgType);
}else if (StringUtils.equalsIgnoreCase(msgType, MessageHandler.TASK_PAUSE)){
sqlMap.append(" and (AGVTASKQUEUE_MSGTYPE = :PAUSE or AGVTASKQUEUE_MSGTYPE = :RECORVER)");
sqlMap.setParamValue("PAUSE", MessageHandler.TASK_PAUSE);
sqlMap.setParamValue("RECORVER", MessageHandler.TASK_RECORVER);
} else if (StringUtils.equalsIgnoreCase(msgType, MessageHandler.TASK_START)) {
sqlMap.append(" and AGVTASKQUEUE_MSGTYPE = :AGVTASKQUEUE_MSGTYPE");
sqlMap.setParamValue("AGVTASKQUEUE_MSGTYPE", MessageHandler.TASK_START);
} else {
sqlMap.append(" and 1<>1");
}
sqlMap.append("order by AGVTASKQUEUE_NEXTTIME ");
return sqlMap.queryEntity(Agvtaskqueue.class);
}
public Agvtaskqueue queryAgvtask(String GUID,String msgType) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select top 1 AGVTASKQUEUE_ID, AGVTASKQUEUE_MSGTYPE, AGVTASKQUEUE_GUID, AGVTASKQUEUE_TASKTYPE, AGVTASKQUEUE_DESTTASK, ");
sqlMap.append(" AGVTASKQUEUE_NEXTTIME, AGVTASKQUEUE_ZT, AGVTASKQUEUE_WHSJ, AGVTASKQUEUE_CJSJ, AGVTASKQUEUE_SYSVERSION ");
sqlMap.append("from AGVTASKQUEUE ");
sqlMap.append("where AGVTASKQUEUE_NEXTTIME <= :AGVTASKQUEUE_NEXTTIME");
sqlMap.setParamValue("AGVTASKQUEUE_NEXTTIME", DateUtils.getDateTime());
sqlMap.append("AND AGVTASKQUEUE_GUID=:AGVTASKQUEUE_GUID");
sqlMap.setParamValue("AGVTASKQUEUE_GUID", GUID);
if (StringUtils.equalsIgnoreCase(msgType, MessageHandler.TASK_CANCEL) ){
sqlMap.append(" and AGVTASKQUEUE_MSGTYPE = :AGVTASKQUEUE_MSGTYPE");
sqlMap.setParamValue("AGVTASKQUEUE_MSGTYPE", msgType);
}else if (StringUtils.equalsIgnoreCase(msgType, MessageHandler.TASK_PAUSE)){
sqlMap.append(" and (AGVTASKQUEUE_MSGTYPE = :PAUSE or AGVTASKQUEUE_MSGTYPE = :RECORVER)");
sqlMap.setParamValue("PAUSE", MessageHandler.TASK_PAUSE);
sqlMap.setParamValue("RECORVER", MessageHandler.TASK_RECORVER);
}else{
sqlMap.append(" and AGVTASKQUEUE_MSGTYPE = :AGVTASKQUEUE_MSGTYPE");
sqlMap.setParamValue("AGVTASKQUEUE_MSGTYPE", MessageHandler.TASK_START);
}
sqlMap.append("order by AGVTASKQUEUE_NEXTTIME ");
return sqlMap.queryEntity(Agvtaskqueue.class);
}
}
package com.gavel.hcgd.agv.dao.impl;
import com.gavel.common.base.dao.impl.BaseDaoImpl;
import com.gavel.common.utils.StringUtils;
import com.gavel.hcgd.agv.dao.AgvwarnDao;
import com.gavel.hcgd.agv.vo.AgvwarnCondition;
import com.gavel.hcgd.agv.vo.AgvwarnVO;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.persistence.sql.SqlMap;
import com.gavel.persistence.sql.SqlUtil;
import org.springframework.stereotype.Repository;
@Repository("agvwarnDao")
public class AgvwarnDaoImpl extends BaseDaoImpl implements AgvwarnDao {
public RecordSet<AgvwarnVO> query(AgvwarnCondition condition){
SqlMap sqlMap = new SqlMap();
sqlMap.setPageNo(condition.getPageNo());
sqlMap.setRowCount(condition.getPageSize());
sqlMap.append("select AGVWARN_ID, AGVWARN_REQCODE, AGVWARN_REQTIME, AGVWARN_CLIENTCODE, AGVWARN_TOKENCODE, ");
sqlMap.append(" AGVWARN_ROBOTCODE, AGVWARN_BEGINTIME, AGVWARN_WARNCONTENT, AGVWARN_TASKCODE ");
sqlMap.append("from AGVWARN ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getId())){
sqlMap.append(" and " + SqlUtil.getWhereSql("AGVWARN_ID", condition.getId()));
sqlMap.setParamValue("AGVWARN_ID", condition.getId());
}
if (StringUtils.isNotEmpty(condition.getTaskcode())) {
sqlMap.append(" and " + SqlUtil.getWhereSql("AGVWARN_TASKCODE", condition.getTaskcode()));
sqlMap.setParamValue("AGVWARN_TASKCODE", condition.getTaskcode());
}
if (StringUtils.isNotEmpty(condition.getRobotcode())) {
sqlMap.append(" and " + SqlUtil.getWhereSql("AGVWARN_ROBOTCODE", condition.getRobotcode()));
sqlMap.setParamValue("AGVWARN_ROBOTCODE", condition.getRobotcode());
}
sqlMap.query(AgvwarnVO.class);
return sqlMap.getRecordSet();
}
}
package com.gavel.hcgd.agv.dao.impl;
import com.gavel.common.base.dao.impl.BaseDaoImpl;
import com.gavel.common.utils.StringUtils;
import com.gavel.hcgd.agv.dao.EptaskDao;
import com.gavel.hcgd.agv.persistent.Eptask;
import com.gavel.hcgd.agv.vo.EptaskCondition;
import com.gavel.hcgd.agv.vo.EptaskVO;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.persistence.sql.SqlMap;
import com.gavel.persistence.sql.SqlUtil;
import org.springframework.stereotype.Repository;
@Repository("eptaskDao")
public class EptaskDaoImpl extends BaseDaoImpl implements EptaskDao {
public RecordSet<EptaskVO> query(EptaskCondition condition) {
SqlMap sqlMap = new SqlMap();
sqlMap.setPageNo(condition.getPageNo());
sqlMap.setRowCount(condition.getPageSize());
sqlMap.append("select EPTASK_ID, EPTASK_TASKCODE, EPTASK_TASKTYP, EPTASK_SCENETYP, EPTASK_WBCODE, ");
sqlMap.append(" EPTASK_PODCODE, EPTASK_SRCMAPDATA, EPTASK_MATERIAL, EPTASK_PRIORITY, EPTASK_AGVCODE, ");
sqlMap.append(" EPTASK_CREATE_DATE, EPTASK_TASKSTATUS, EPTASK_CXID, EPTASK_CALLERID, EPTASK_CALLDATE, ");
sqlMap.append(" EPTASK_SENDERID, EPTASK_SENDDATE, EPTASK_START_DATE, EPTASK_GETTO_DATE, EPTASK_END_DATE, ");
sqlMap.append(" EPTASK_CANCEL_DATE, EPTASK_DATA, TASKSTATUS_DESCZH, EPTASK_CKID, EPTASK_TYPE, CK_CODE, CK_NAME,");
sqlMap.append(" GW_NAME,POD_BERTHCODE, EPTASK_ORDERNUM,EPTASK_WAYS,EPTASK_DESTMAPDATA ");
sqlMap.append("from EPTASK ");
sqlMap.append(" left join TASKSTATUS on TASKSTATUS_CODE = EPTASK_TASKSTATUS ");
sqlMap.append(" left join CK on CK_CODE = EPTASK_CKID ");
sqlMap.append(" left join GW on GW_MAPDATACODE = EPTASK_WBCODE ");
sqlMap.append(" left join POD on POD_PODCODE = EPTASK_PODCODE ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getId())) {
sqlMap.append(" and " + SqlUtil.getWhereSql("EPTASK_ID", condition.getId()));
sqlMap.setParamValue("EPTASK_ID", condition.getId());
}
if (StringUtils.isNotEmpty(condition.getTaskCode())) {
sqlMap.append(" and " + SqlUtil.getWhereSql("EPTASK_TASKCODE", condition.getTaskCode()));
sqlMap.setParamValue("EPTASK_TASKCODE", condition.getTaskCode());
}
if (StringUtils.isNotEmpty(condition.getWbCode())) {
sqlMap.append(" and " + SqlUtil.getWhereSql("EPTASK_WBCODE", condition.getWbCode()));
sqlMap.setParamValue("EPTASK_WBCODE", condition.getWbCode());
}
if (StringUtils.isNotEmpty(condition.getTaskStatus())) {
sqlMap.append(" and " + SqlUtil.getWhereSql("EPTASK_TASKSTATUS", condition.getTaskStatus()));
sqlMap.setParamValue("EPTASK_TASKSTATUS", condition.getTaskStatus());
}
if (StringUtils.isNotEmpty(condition.getType())) {
sqlMap.append(" and " + SqlUtil.getWhereSql("EPTASK_TYPE", condition.getType()));
sqlMap.setParamValue("EPTASK_TYPE", condition.getType());
}
if(condition.getTaskStatusList() !=null && condition.getTaskStatusList().length>0){
sqlMap.append(" and " + SqlUtil.getWhereEqualSql("EPTASK_TASKSTATUS", condition.getTaskStatusList()));
}
sqlMap.append("order by EPTASK_TASKCODE desc");
sqlMap.query(EptaskVO.class);
return sqlMap.getRecordSet();
}
@Override
public Eptask findExecutingTask(String wbCode, String type) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select EPTASK_ID, EPTASK_TASKCODE, EPTASK_TASKTYP, EPTASK_SCENETYP, EPTASK_WBCODE, ");
sqlMap.append(" EPTASK_PODCODE, EPTASK_SRCMAPDATA, EPTASK_MATERIAL, EPTASK_PRIORITY, EPTASK_AGVCODE, ");
sqlMap.append(" EPTASK_CREATE_DATE, EPTASK_TASKSTATUS, EPTASK_CXID, EPTASK_CALLERID, EPTASK_CALLDATE, ");
sqlMap.append(" EPTASK_SENDERID, EPTASK_SENDDATE, EPTASK_START_DATE, EPTASK_GETTO_DATE, EPTASK_END_DATE, ");
sqlMap.append(" EPTASK_CANCEL_DATE, EPTASK_DATA, EPTASK_CKID, EPTASK_TYPE, EPTASK_ORDERNUM,EPTASK_WAYS ");
sqlMap.append("from EPTASK ");
sqlMap.append("where EPTASK_TASKSTATUS not in ('5', '9') and EPTASK_TYPE = :EPTASK_TYPE and EPTASK_WBCODE = :EPTASK_WBCODE ");
sqlMap.setParamValue("EPTASK_TYPE", type);
sqlMap.setParamValue("EPTASK_WBCODE", wbCode);
return sqlMap.queryEntity(Eptask.class);
}
@Override
public Eptask findExecutingHcTask(String taskCode) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select EPTASK_ID, EPTASK_TASKCODE, EPTASK_TASKTYP, EPTASK_SCENETYP, EPTASK_WBCODE, ");
sqlMap.append(" EPTASK_PODCODE, EPTASK_SRCMAPDATA, EPTASK_MATERIAL, EPTASK_PRIORITY, EPTASK_AGVCODE, ");
sqlMap.append(" EPTASK_CREATE_DATE, EPTASK_TASKSTATUS, EPTASK_CXID, EPTASK_CALLERID, EPTASK_CALLDATE, ");
sqlMap.append(" EPTASK_SENDERID, EPTASK_SENDDATE, EPTASK_START_DATE, EPTASK_GETTO_DATE, EPTASK_END_DATE, ");
sqlMap.append(" EPTASK_CANCEL_DATE, EPTASK_DATA, EPTASK_CKID, EPTASK_TYPE, EPTASK_ORDERNUM,EPTASK_WAYS ");
sqlMap.append("from EPTASK ");
sqlMap.append("where EPTASK_TASKSTATUS not in ('5', '9') and EPTASK_TASKCODE = :EPTASK_TASKCODE ");
sqlMap.setParamValue("EPTASK_TASKCODE", taskCode);
return sqlMap.queryEntity(Eptask.class);
}
@Override
public int countExecutingHcTask(String agvCode) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select count(*) from EPTASK ");
sqlMap.append("where EPTASK_TASKSTATUS not in ('5', '9') and EPTASK_AGVCODE = :EPTASK_AGVCODE ");
sqlMap.setParamValue("EPTASK_AGVCODE", agvCode);
return sqlMap.queryInt();
}
}
package com.gavel.hcgd.agv.dao.impl;
import com.gavel.common.base.dao.impl.BaseDaoImpl;
import com.gavel.common.utils.StringUtils;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.persistence.sql.SqlMap;
import com.gavel.persistence.sql.SqlUtil;
import org.springframework.stereotype.Repository;
import com.gavel.hcgd.agv.dao.HcMsglogDao;
import com.gavel.hcgd.agv.vo.HcMsglogCondition;
import com.gavel.hcgd.agv.vo.HcMsglogVO;
@Repository("hcMsglogDao")
public class HcMsglogDaoImpl extends BaseDaoImpl implements HcMsglogDao {
public RecordSet<HcMsglogVO> query(HcMsglogCondition condition){
SqlMap sqlMap = new SqlMap();
sqlMap.setPageNo(condition.getPageNo());
sqlMap.setRowCount(condition.getPageSize());
sqlMap.append("select HCMSGLOG_ID, HCMSGLOG_GUID, HCMSGLOG_TASKTYPE, HCMSGLOG_DESTTASK, HCMSGLOG_MSGCODE, ");
sqlMap.append(" HCMSGLOG_MESSAGE, HCMSGLOG_WHSJ, HCMSGLOG_CJSJ, HCMSGLOG_SYSVERSION,HCMSGLOG_REVTIME ");
sqlMap.append("from HCMSGLOG ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getId())){
sqlMap.append(" and " + SqlUtil.getWhereSql("HCMSGLOG_ID", condition.getId()));
sqlMap.setParamValue("HCMSGLOG_ID", condition.getId());
}
sqlMap.append("order by HCMSGLOG_REVTIME desc ");
sqlMap.query(HcMsglogVO.class);
return sqlMap.getRecordSet();
}
}
package com.gavel.hcgd.agv.persistent;
import com.gavel.common.base.entity.BaseEntity;
import com.gavel.common.utils.CodeStrategy;
import com.gavel.persistence.annotation.FieldMeta;
import com.gavel.persistence.annotation.TableMeta;
import java.util.Date;
@TableMeta(id = "AGV", name = "AGV")
public class Agv extends BaseEntity {
private static final long serialVersionUID = 1L;
@FieldMeta(fieldName = "AGV_ID", caption = "ID", primaryKey = true, notEmpty = true, codeStrategy = CodeStrategy.UUID)
private String id;
@FieldMeta(fieldName = "AGV_ROBOTCODE", caption = "机器人编号")
private String robotcode;
@FieldMeta(fieldName = "AGV_ROBOTDIR", caption = "机器人方向")
private String robotdir;
@FieldMeta(fieldName = "AGV_ROBOTIP", caption = "机器人 IP")
private String robotip;
@FieldMeta(fieldName = "AGV_BATTERY", caption = "机器人电量, 范围: 0-100")
private String battery;
@FieldMeta(fieldName = "AGV_POSX", caption = "机器人 x 坐标,单位:毫米")
private String posx;
@FieldMeta(fieldName = "AGV_POSY", caption = "机器人 y 坐标,单位:毫米")
private String posy;
@FieldMeta(fieldName = "AGV_MAPCODE", caption = "机器人所在地图")
private String mapcode;
@FieldMeta(fieldName = "AGV_SPEED", caption = "机器人当前速度")
private String speed;
@FieldMeta(fieldName = "AGV_STATUS", caption = "机器人状态")
private String status;
@FieldMeta(fieldName = "AGV_EXCLTYPE", caption = "是否已被排除")
private String excltype;
@FieldMeta(fieldName = "AGV_STOP", caption = "是否暂停 0-否 1-是")
private String stop;
@FieldMeta(fieldName = "AGV_PODCODE", caption = "背货架的编号")
private String podcode;
@FieldMeta(fieldName = "AGV_PODDIR", caption = "背货架的方向")
private String poddir;
@FieldMeta(fieldName = "AGV_PATH", caption = "执行路径")
private String path;
@FieldMeta(fieldName = "AGV_WARNCONTENT", caption = "告警信息")
private String warncontent;
@FieldMeta(fieldName = "AGV_TYBZ", caption = "停用标志")
private String tybz;
@FieldMeta(fieldName = "AGV_TYRQ", caption = "停用日期")
private Date tyrq;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRobotcode() {
return robotcode;
}
public void setRobotcode(String robotcode) {
this.robotcode = robotcode;
}
public String getRobotdir() {
return robotdir;
}
public void setRobotdir(String robotdir) {
this.robotdir = robotdir;
}
public String getRobotip() {
return robotip;
}
public void setRobotip(String robotip) {
this.robotip = robotip;
}
public String getBattery() {
return battery;
}
public void setBattery(String battery) {
this.battery = battery;
}
public String getPosx() {
return posx;
}
public void setPosx(String posx) {
this.posx = posx;
}
public String getPosy() {
return posy;
}
public void setPosy(String posy) {
this.posy = posy;
}
public String getMapcode() {
return mapcode;
}
public void setMapcode(String mapcode) {
this.mapcode = mapcode;
}
public String getSpeed() {
return speed;
}
public void setSpeed(String speed) {
this.speed = speed;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getExcltype() {
return excltype;
}
public void setExcltype(String excltype) {
this.excltype = excltype;
}
public String getStop() {
return stop;
}
public void setStop(String stop) {
this.stop = stop;
}
public String getPodcode() {
return podcode;
}
public void setPodcode(String podcode) {
this.podcode = podcode;
}
public String getPoddir() {
return poddir;
}
public void setPoddir(String poddir) {
this.poddir = poddir;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getWarncontent() {
return warncontent;
}
public void setWarncontent(String warncontent) {
this.warncontent = warncontent;
}
public String getTybz() {
return tybz;
}
public void setTybz(String tybz) {
this.tybz = tybz;
}
public Date getTyrq() {
return tyrq;
}
public void setTyrq(Date tyrq) {
this.tyrq = tyrq;
}
}
package com.gavel.hcgd.agv.persistent;
import com.gavel.common.base.entity.BaseEntity;
import com.gavel.common.utils.CodeStrategy;
import com.gavel.persistence.annotation.FieldMeta;
import com.gavel.persistence.annotation.TableMeta;
import java.util.Date;
@TableMeta(id = "AGVTASK", name = "AGVTASK")
public class Agvtask extends BaseEntity {
private static final long serialVersionUID = 1L;
@FieldMeta(fieldName = "AGVTASK_ID", caption = "ID", primaryKey = true, notEmpty = true, codeStrategy = CodeStrategy.UUID)
private String id;
@FieldMeta(fieldName = "AGVTASK_TASKTYP", caption = "任务类型")
private String tasktyp;
@FieldMeta(fieldName = "AGVTASK_SCENETYP", caption = "任务场景类型")
private String scenetyp;
@FieldMeta(fieldName = "AGVTASK_CTNRTYP", caption = "容器类型(叉车专用)")
private String ctnrtyp;
@FieldMeta(fieldName = "AGVTASK_CTNRCODE", caption = "容器编号(叉车专用)")
private String ctnrcode;
@FieldMeta(fieldName = "AGVTASK_WBCODE", caption = "工作位,一般为机台或工作台位置")
private String wbcode;
@FieldMeta(fieldName = "AGVTASK_POSITIONCODEPATH", caption = "列表长度 小于 50")
private String positionCodePath;
@FieldMeta(fieldName = "AGVTASK_PODCODE", caption = "货架编号,不指定货架可以为空")
private String podcode;
@FieldMeta(fieldName = "AGVTASK_PODDIR", caption = "指定方向")
private String poddir;
@FieldMeta(fieldName = "AGVTASK_PODTYP", caption = "货架类型")
private String podtyp;
@FieldMeta(fieldName = "AGVTASK_MATERIALLOT", caption = "物料批次或货架上的物料唯一编码")
private String materiallot;
@FieldMeta(fieldName = "AGVTASK_PRIORITY", caption = "优先级,从(1~127)级,最大优先级最高")
private String priority;
@FieldMeta(fieldName = "AGVTASK_TASKCODE", caption = "任务单号")
private String taskCode;
@FieldMeta(fieldName = "AGVTASK_AGVCODE", caption = "AGV 编号")
private String agvCode;
@FieldMeta(fieldName = "AGVTASK_CREATE_DATE", caption = "创建时间")
private Date createDate;
@FieldMeta(fieldName = "AGVTASK_TASKSTATUS", caption = "任务状态:1-已创建,2-正在执行,5-取消完成,9-已结束")
private String taskStatus;
@FieldMeta(fieldName = "AGVTASK_CJID", caption = "车间ID")
private String cjid;
@FieldMeta(fieldName = "AGVTASK_CXID", caption = "产线ID")
private String cxid;
@FieldMeta(fieldName = "AGVTASK_ZDID", caption = "站点ID")
private String zdid;
@FieldMeta(fieldName = "AGVTASK_GWID", caption = "工位ID")
private String gwid;
@FieldMeta(fieldName = "AGVTASK_CALLERID", caption = "叫料人ID")
private String callerId;
@FieldMeta(fieldName = "AGVTASK_CALLDATE", caption = "叫料时间")
private Date callDate;
@FieldMeta(fieldName = "AGVTASK_SENDERID", caption = "发料人ID")
private String senderId;
@FieldMeta(fieldName = "AGVTASK_SENDDATE", caption = "发料时间")
private Date sendDate;
@FieldMeta(fieldName = "AGVTASK_START_POINT", caption = "起点")
private String startPoint;
@FieldMeta(fieldName = "AGVTASK_END_POINT", caption = "终点")
private String endPoint;
@FieldMeta(fieldName = "AGVTASK_GETTO_DATE", caption = "到达工位时间")
private Date gettoDate;
@FieldMeta(fieldName = "AGVTASK_END_DATE", caption = "任务结束时间")
private Date endDate;
@FieldMeta(fieldName = "AGVTASK_START_DATE", caption = "任务开始时间")
private Date startDate;
@FieldMeta(fieldName = "AGVTASK_CANCEL_DATE", caption = "任务取消时间")
private Date cancelDate;
@FieldMeta(fieldName = "AGVTASK_DATA", caption = "自定义字段,不超过 2000 个字符")
private String data;
@FieldMeta(fieldName = "AGVTASK_WAYS", caption = "来源方式")
private String ways;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTasktyp() {
return tasktyp;
}
public void setTasktyp(String tasktyp) {
this.tasktyp = tasktyp;
}
public String getScenetyp() {
return scenetyp;
}
public void setScenetyp(String scenetyp) {
this.scenetyp = scenetyp;
}
public String getCtnrtyp() {
return ctnrtyp;
}
public void setCtnrtyp(String ctnrtyp) {
this.ctnrtyp = ctnrtyp;
}
public String getCtnrcode() {
return ctnrcode;
}
public void setCtnrcode(String ctnrcode) {
this.ctnrcode = ctnrcode;
}
public String getWbcode() {
return wbcode;
}
public void setWbcode(String wbcode) {
this.wbcode = wbcode;
}
public String getPositionCodePath() {
return positionCodePath;
}
public void setPositionCodePath(String positionCodePath) {
this.positionCodePath = positionCodePath;
}
public String getPodcode() {
return podcode;
}
public void setPodcode(String podcode) {
this.podcode = podcode;
}
public String getPoddir() {
return poddir;
}
public void setPoddir(String poddir) {
this.poddir = poddir;
}
public String getPodtyp() {
return podtyp;
}
public void setPodtyp(String podtyp) {
this.podtyp = podtyp;
}
public String getMateriallot() {
return materiallot;
}
public void setMateriallot(String materiallot) {
this.materiallot = materiallot;
}
public String getPriority() {
return priority;
}
public void setPriority(String priority) {
this.priority = priority;
}
public String getTaskCode() {
return taskCode;
}
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
public String getAgvCode() {
return agvCode;
}
public void setAgvCode(String agvCode) {
this.agvCode = agvCode;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getTaskStatus() {
return taskStatus;
}
public void setTaskStatus(String taskStatus) {
this.taskStatus = taskStatus;
}
public String getCjid() {
return cjid;
}
public void setCjid(String cjid) {
this.cjid = cjid;
}
public String getCxid() {
return cxid;
}
public void setCxid(String cxid) {
this.cxid = cxid;
}
public String getZdid() {
return zdid;
}
public void setZdid(String zdid) {
this.zdid = zdid;
}
public String getCallerId() {
return callerId;
}
public void setCallerId(String callerId) {
this.callerId = callerId;
}
public Date getCallDate() {
return callDate;
}
public void setCallDate(Date callDate) {
this.callDate = callDate;
}
public String getSenderId() {
return senderId;
}
public void setSenderId(String senderId) {
this.senderId = senderId;
}
public Date getSendDate() {
return sendDate;
}
public void setSendDate(Date sendDate) {
this.sendDate = sendDate;
}
public String getStartPoint() {
return startPoint;
}
public void setStartPoint(String startPoint) {
this.startPoint = startPoint;
}
public String getEndPoint() {
return endPoint;
}
public void setEndPoint(String endPoint) {
this.endPoint = endPoint;
}
public Date getGettoDate() {
return gettoDate;
}
public void setGettoDate(Date gettoDate) {
this.gettoDate = gettoDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getCancelDate() {
return cancelDate;
}
public void setCancelDate(Date cancelDate) {
this.cancelDate = cancelDate;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getGwid() {
return gwid;
}
public void setGwid(String gwid) {
this.gwid = gwid;
}
public String getWays() {
return ways;
}
public void setWays(String ways) {
this.ways = ways;
}
}
package com.gavel.hcgd.agv.persistent;
import java.util.Date;
import com.gavel.common.base.entity.BaseEntity;
import com.gavel.common.utils.CodeStrategy;
import com.gavel.persistence.annotation.FieldMeta;
import com.gavel.persistence.annotation.TableMeta;
@TableMeta(id = "AGVTASKQUEUE", name = "AGVTASKQUEUE")
public class Agvtaskqueue extends BaseEntity {
private static final long serialVersionUID = 1L;
@FieldMeta(fieldName = "AGVTASKQUEUE_ID", caption = "ID", primaryKey = true, codeStrategy = CodeStrategy.UUID)
private String id;
@FieldMeta(fieldName = "AGVTASKQUEUE_MSGTYPE", caption = "消息类型")
private String msgtype;
@FieldMeta(fieldName = "AGVTASKQUEUE_GUID", caption = "GUID")
private String guid;
@FieldMeta(fieldName = "AGVTASKQUEUE_TASKTYPE", caption = "任务类型")
private String tasktype;
@FieldMeta(fieldName = "AGVTASKQUEUE_DESTTASK", caption = "目标任务")
private String desttask;
@FieldMeta(fieldName = "AGVTASKQUEUE_ZT", caption = "状态")
private String zt;
@FieldMeta(fieldName = "AGVTASKQUEUE_NEXTTIME", caption = "下次执行时间")
private Date nexttime;
@FieldMeta(fieldName = "AGVTASKQUEUE_WHSJ", caption = "维护时间", autoDateTime = true)
private Date whsj;
@FieldMeta(fieldName = "AGVTASKQUEUE_CJSJ", caption = "创建时间", autoDateTime = true, initial = true)
private Date cjsj;
@FieldMeta(fieldName = "AGVTASKQUEUE_SYSVERSION", caption = "系统版本")
private Integer sysversion;
@FieldMeta(fieldName = "AGVTASKQUEUE_BODY", caption = "请求参数")
private String body;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMsgtype() {
return msgtype;
}
public void setMsgtype(String msgtype) {
this.msgtype = msgtype;
}
public String getGuid() {
return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public String getTasktype() {
return tasktype;
}
public void setTasktype(String tasktype) {
this.tasktype = tasktype;
}
public String getDesttask() {
return desttask;
}
public void setDesttask(String desttask) {
this.desttask = desttask;
}
public String getZt() {
return zt;
}
public void setZt(String zt) {
this.zt = zt;
}
public Date getNexttime() {
return nexttime;
}
public void setNexttime(Date nexttime) {
this.nexttime = nexttime;
}
public Date getWhsj() {
return whsj;
}
public void setWhsj(Date whsj) {
this.whsj = whsj;
}
public Date getCjsj() {
return cjsj;
}
public void setCjsj(Date cjsj) {
this.cjsj = cjsj;
}
public Integer getSysversion() {
return sysversion;
}
public void setSysversion(Integer sysversion) {
this.sysversion = sysversion;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
}
package com.gavel.hcgd.agv.persistent;
import com.gavel.common.base.entity.BaseEntity;
import com.gavel.common.utils.CodeStrategy;
import com.gavel.persistence.annotation.FieldMeta;
import com.gavel.persistence.annotation.TableMeta;
@TableMeta(id = "AGVWARN", name = "AGVWARN")
public class Agvwarn extends BaseEntity {
private static final long serialVersionUID = 1L;
@FieldMeta(fieldName = "AGVWARN_ID", caption = "ID", primaryKey = true, notEmpty = true, codeStrategy = CodeStrategy.UUID)
private String id;
@FieldMeta(fieldName = "AGVWARN_REQCODE", caption = "请求编号")
private String reqcode;
@FieldMeta(fieldName = "AGVWARN_REQTIME", caption = "请求时间戳")
private String reqtime;
@FieldMeta(fieldName = "AGVWARN_CLIENTCODE", caption = "客户端编号")
private String clientcode;
@FieldMeta(fieldName = "AGVWARN_TOKENCODE", caption = "令牌号")
private String tokencode;
@FieldMeta(fieldName = "AGVWARN_ROBOTCODE", caption = "车号")
private String robotcode;
@FieldMeta(fieldName = "AGVWARN_BEGINTIME", caption = "告警开始时间")
private String begintime;
@FieldMeta(fieldName = "AGVWARN_WARNCONTENT", caption = "告警内容")
private String warncontent;
@FieldMeta(fieldName = "AGVWARN_TASKCODE", caption = "任务号")
private String taskcode;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getReqcode() {
return reqcode;
}
public void setReqcode(String reqcode) {
this.reqcode = reqcode;
}
public String getReqtime() {
return reqtime;
}
public void setReqtime(String reqtime) {
this.reqtime = reqtime;
}
public String getClientcode() {
return clientcode;
}
public void setClientcode(String clientcode) {
this.clientcode = clientcode;
}
public String getTokencode() {
return tokencode;
}
public void setTokencode(String tokencode) {
this.tokencode = tokencode;
}
public String getRobotcode() {
return robotcode;
}
public void setRobotcode(String robotcode) {
this.robotcode = robotcode;
}
public String getBegintime() {
return begintime;
}
public void setBegintime(String begintime) {
this.begintime = begintime;
}
public String getWarncontent() {
return warncontent;
}
public void setWarncontent(String warncontent) {
this.warncontent = warncontent;
}
public String getTaskcode() {
return taskcode;
}
public void setTaskcode(String taskcode) {
this.taskcode = taskcode;
}
}
package com.gavel.hcgd.agv.persistent;
import java.util.Date;
import com.gavel.common.base.entity.BaseEntity;
import com.gavel.common.utils.CodeStrategy;
import com.gavel.persistence.annotation.FieldMeta;
import com.gavel.persistence.annotation.TableMeta;
@TableMeta(id = "EPTASK", name = "EPTASK")
public class Eptask extends BaseEntity {
private static final long serialVersionUID = 1L;
@FieldMeta(fieldName = "EPTASK_ID", caption = "ID", primaryKey = true, notEmpty = true, codeStrategy = CodeStrategy.UUID)
private String id;
@FieldMeta(fieldName = "EPTASK_TASKCODE", caption = "任务单号")
private String taskCode;
@FieldMeta(fieldName = "EPTASK_TASKTYP", caption = "任务类型")
private String taskTyp;
@FieldMeta(fieldName = "EPTASK_SCENETYP", caption = "任务场景类型")
private String sceneTyp;
@FieldMeta(fieldName = "EPTASK_WBCODE", caption = "工作位,一般为机台或工作台位置")
private String wbCode;
@FieldMeta(fieldName = "EPTASK_PODCODE", caption = "货架编号")
private String podCode;
@FieldMeta(fieldName = "EPTASK_SRCMAPDATA", caption = "货架来源地码")
private String srcMapdata;
@FieldMeta(fieldName = "EPTASK_DESTMAPDATA", caption = "货架目标地码")
private String destMapdata;
@FieldMeta(fieldName = "EPTASK_MATERIAL", caption = "物料")
private String material;
@FieldMeta(fieldName = "EPTASK_PRIORITY", caption = "优先级,从(1~127)级,最大优先级最高")
private String priority;
@FieldMeta(fieldName = "EPTASK_AGVCODE", caption = "AGV编号")
private String agvCode;
@FieldMeta(fieldName = "EPTASK_CREATE_DATE", caption = "创建时间")
private Date createDate;
@FieldMeta(fieldName = "EPTASK_TASKSTATUS", caption = "任务状态:1-已创建,2-正在执行,5-取消完成,9-已结束")
private String taskStatus;
@FieldMeta(fieldName = "EPTASK_CXID", caption = "产线ID")
private String cxId;
@FieldMeta(fieldName = "EPTASK_CALLERID", caption = "叫料人ID")
private String callerId;
@FieldMeta(fieldName = "EPTASK_CALLDATE", caption = "叫料时间")
private Date callDate;
@FieldMeta(fieldName = "EPTASK_SENDERID", caption = "发料人ID")
private String senderId;
@FieldMeta(fieldName = "EPTASK_SENDDATE", caption = "发料时间")
private Date sendDate;
@FieldMeta(fieldName = "EPTASK_START_DATE", caption = "任务开始时间")
private Date startDate;
@FieldMeta(fieldName = "EPTASK_GETTO_DATE", caption = "到达工位时间")
private Date gettoDate;
@FieldMeta(fieldName = "EPTASK_END_DATE", caption = "任务结束时间")
private Date endDate;
@FieldMeta(fieldName = "EPTASK_CANCEL_DATE", caption = "任务取消时间")
private Date cancelDate;
@FieldMeta(fieldName = "EPTASK_DATA", caption = "自定义字段,不超过 2000 个字符")
private String data;
@FieldMeta(fieldName = "EPTASK_CKID", caption = "目标区域")
private String ckId;
@FieldMeta(fieldName = "EPTASK_TYPE", caption = "任务分类")
private String type;
@FieldMeta(fieldName = "EPTASK_ORDERNUM", caption = "步号")
private Integer orderNum;
@FieldMeta(fieldName = "EPTASK_WAYS", caption = "来源方式")
private String ways;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTaskCode() {
return taskCode;
}
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
public String getTaskTyp() {
return taskTyp;
}
public void setTaskTyp(String taskTyp) {
this.taskTyp = taskTyp;
}
public String getSceneTyp() {
return sceneTyp;
}
public void setSceneTyp(String sceneTyp) {
this.sceneTyp = sceneTyp;
}
public String getWbCode() {
return wbCode;
}
public void setWbCode(String wbCode) {
this.wbCode = wbCode;
}
public String getPodCode() {
return podCode;
}
public void setPodCode(String podCode) {
this.podCode = podCode;
}
public String getSrcMapdata() {
return srcMapdata;
}
public void setSrcMapdata(String srcMapdata) {
this.srcMapdata = srcMapdata;
}
public String getDestMapdata() {
return destMapdata;
}
public void setDestMapdata(String destMapdata) {
this.destMapdata = destMapdata;
}
public String getMaterial() {
return material;
}
public void setMaterial(String material) {
this.material = material;
}
public String getPriority() {
return priority;
}
public void setPriority(String priority) {
this.priority = priority;
}
public String getAgvCode() {
return agvCode;
}
public void setAgvCode(String agvCode) {
this.agvCode = agvCode;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getTaskStatus() {
return taskStatus;
}
public void setTaskStatus(String taskStatus) {
this.taskStatus = taskStatus;
}
public String getCxId() {
return cxId;
}
public void setCxId(String cxId) {
this.cxId = cxId;
}
public String getCallerId() {
return callerId;
}
public void setCallerId(String callerId) {
this.callerId = callerId;
}
public Date getCallDate() {
return callDate;
}
public void setCallDate(Date callDate) {
this.callDate = callDate;
}
public String getSenderId() {
return senderId;
}
public void setSenderId(String senderId) {
this.senderId = senderId;
}
public Date getSendDate() {
return sendDate;
}
public void setSendDate(Date sendDate) {
this.sendDate = sendDate;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getGettoDate() {
return gettoDate;
}
public void setGettoDate(Date gettoDate) {
this.gettoDate = gettoDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Date getCancelDate() {
return cancelDate;
}
public void setCancelDate(Date cancelDate) {
this.cancelDate = cancelDate;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getCkId() {
return ckId;
}
public void setCkId(String ckId) {
this.ckId = ckId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getWays() {
return ways;
}
public void setWays(String ways) {
this.ways = ways;
}
}
package com.gavel.hcgd.agv.persistent;
import java.util.Date;
import com.gavel.common.base.entity.BaseEntity;
import com.gavel.common.utils.CodeStrategy;
import com.gavel.persistence.annotation.FieldMeta;
import com.gavel.persistence.annotation.TableMeta;
@TableMeta(id = "HCMSGLOG", name = "HCMSGLOG")
public class HcMsglog extends BaseEntity {
private static final long serialVersionUID = 1L;
@FieldMeta(fieldName = "HCMSGLOG_ID", caption = "ID", primaryKey = true,codeStrategy = CodeStrategy.UUID,notEmpty = true)
private String id;
@FieldMeta(fieldName = "HCMSGLOG_GUID", caption = "GUID")
private String guid;
@FieldMeta(fieldName = "HCMSGLOG_TASKTYPE", caption = "任务类型")
private String tasktype;
@FieldMeta(fieldName = "HCMSGLOG_DESTTASK", caption = "目标任务")
private String desttask;
@FieldMeta(fieldName = "HCMSGLOG_MSGCODE", caption = "返回代码")
private String msgcode;
@FieldMeta(fieldName = "HCMSGLOG_MESSAGE", caption = "反馈信息")
private String message;
@FieldMeta(fieldName = "HCMSGLOG_REVTIME", caption = "接收时间")
private Date revtime;
@FieldMeta(fieldName = "HCMSGLOG_WHSJ", caption = "维护时间")
private Date whsj;
@FieldMeta(fieldName = "HCMSGLOG_CJSJ", caption = "创建时间")
private Date cjsj;
@FieldMeta(fieldName = "HCMSGLOG_SYSVERSION", caption = "系统版本")
private Integer sysversion;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getGuid() {
return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public String getTasktype() {
return tasktype;
}
public void setTasktype(String tasktype) {
this.tasktype = tasktype;
}
public String getDesttask() {
return desttask;
}
public void setDesttask(String desttask) {
this.desttask = desttask;
}
public String getMsgcode() {
return msgcode;
}
public void setMsgcode(String msgcode) {
this.msgcode = msgcode;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Date getRevtime() {
return revtime;
}
public void setRevtime(Date revtime) {
this.revtime = revtime;
}
public Date getWhsj() {
return whsj;
}
public void setWhsj(Date whsj) {
this.whsj = whsj;
}
public Date getCjsj() {
return cjsj;
}
public void setCjsj(Date cjsj) {
this.cjsj = cjsj;
}
public Integer getSysversion() {
return sysversion;
}
public void setSysversion(Integer sysversion) {
this.sysversion = sysversion;
}
}
package com.gavel.hcgd.agv.process;
import com.gavel.common.utils.DateUtils;
import com.gavel.common.utils.SpringUtils;
import com.gavel.common.utils.StringUtils;
import com.gavel.hcgd.mcs.service.RcmsService;
import com.gavel.hcgd.rabbitmq.handler.RabbitMqSendMessage;
import com.gavel.hcgd.rabbitmq.model.AgvStatusModel;
import com.gavel.hcgd.rabbitmq.model.AgvStatusFeedback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AgvStatusHandler implements Runnable {
private static Logger logger = LoggerFactory.getLogger(AgvStatusHandler.class);
//任务单号
private AgvStatusModel agvStatus;
private RcmsService rcmsService;
public AgvStatusHandler(AgvStatusModel agvStatus) {
this.agvStatus = agvStatus;
}
private RcmsService rcmsService() {
if (rcmsService == null)
rcmsService = SpringUtils.getBean(RcmsService.class);
return rcmsService;
}
@Override
public void run() {
AgvStatusFeedback agvStatusFeedback = new AgvStatusFeedback();
try {
agvStatusFeedback.setMsgtype("反馈AGV状态");
agvStatusFeedback.setAgvCode(agvStatus.getAgvCode());
if(agvStatus == null){
return;
}
//获取状态
String status = rcmsService().serchAgvStatus(agvStatus.getAgvCode());
if(StringUtils.isEmpty(status)){
status ="未找到";
}
agvStatusFeedback.setStatus(status);
}catch (Exception ex) {
//执行失败,设置返回数据
logger.error("错误信息",ex);
}finally {
agvStatusFeedback.setTime(DateUtils.formatDate(DateUtils.getDateTime(),DateUtils.MillISECONDS_DATE_FORMAT));
SpringUtils.getBean(RabbitMqSendMessage.class).sendMessageStatus(agvStatusFeedback);
}
}
}
package com.gavel.hcgd.agv.process;
import com.gavel.common.utils.DateUtils;
import com.gavel.common.utils.SpringUtils;
import com.gavel.hcgd.agv.service.HcMsglogService;
import com.gavel.hcgd.mcs.service.RcmsService;
import com.gavel.hcgd.rabbitmq.handler.RabbitMqSendMessage;
import com.gavel.hcgd.rabbitmq.model.AgvTask;
import com.gavel.hcgd.rabbitmq.model.TaskFeedback;
public class AgvTaskHandler implements Runnable {
//任务单号
private AgvTask agvTask;
private RcmsService rcmsService;
private HcMsglogService hcMsglogService;
public AgvTaskHandler(AgvTask agvTask) {
this.agvTask = agvTask;
}
private RcmsService rcmsService() {
if (rcmsService == null)
rcmsService = SpringUtils.getBean(RcmsService.class);
return rcmsService;
}
private HcMsglogService hcMsglogService() {
if (hcMsglogService == null)
hcMsglogService = SpringUtils.getBean(HcMsglogService.class);
return hcMsglogService;
}
@Override
public void run() {
TaskFeedback feedback = new TaskFeedback();
boolean needWriteQueue = false;
try {
feedback.setGuid(agvTask.getGuid());
if(agvTask == null){
needWriteQueue = true;
feedback.setMsgcode("2");
feedback.setMessage("任务队列为空");
return;
}
if("任务下发".equals(agvTask.getMsgtype())){
needWriteQueue = true;
feedback.setMsgtype("接收任务反馈");
rcmsService().genHcTask(agvTask);
feedback.setMsgcode("1");
feedback.setMessage("任务下发成功,agvCode:"+agvTask.getTask().getAgvCode());
}else if("触发".equals(agvTask.getMsgtype())){
feedback.setMsgtype("任务触发反馈");
rcmsService().continueHcTask(agvTask);
feedback.setMsgcode("1");
feedback.setMessage("任务触发成功,任务单号:"+agvTask.getGuid());
}
}catch (Exception e) {
feedback.setMsgcode("2");
feedback.setMessage("任务失败:"+e.getMessage());
if (needWriteQueue)
rcmsService().delEptask(agvTask.getGuid());
}finally {
feedback.setTime(DateUtils.formatDate(DateUtils.getDateTime(),DateUtils.DATETIME_FORMAT));
//记录日志
hcMsglogService().addMsgLog(feedback,agvTask);
if (needWriteQueue)
SpringUtils.getBean(RabbitMqSendMessage.class).sendMessageAgvTask(feedback);
}
}
}
package com.gavel.hcgd.agv.service;
import com.gavel.common.base.service.BaseEditService;
import com.gavel.hcgd.agv.vo.AgvCondition;
import com.gavel.hcgd.agv.vo.AgvVO;
import com.gavel.hcgd.mcs.model.QueryAgvStatusResp;
import com.gavel.hcgd.rabbitmq.model.AgvTask;
import com.gavel.persistence.sql.RecordSet;
import java.util.List;
public interface AgvService extends BaseEditService {
public RecordSet<AgvVO> query(AgvCondition condition);
public void update(List<QueryAgvStatusResp.AgvStatus> datas, String mapCode);
public String findEmptyAgv(AgvTask agvTask);
public boolean pauseAgv(String agvCode);
public boolean recoverAgv(String agvCode);
}
package com.gavel.hcgd.agv.service;
import com.gavel.common.base.service.BaseEditService;
import com.gavel.hcgd.agv.vo.AgvtaskCondition;
import com.gavel.hcgd.agv.vo.AgvtaskInfo;
import com.gavel.hcgd.agv.vo.AgvtaskVO;
import com.gavel.persistence.sql.RecordSet;
public interface AgvtaskService extends BaseEditService {
public RecordSet<AgvtaskVO> query(AgvtaskCondition condition);
public AgvtaskVO working(AgvtaskCondition condition);
public AgvtaskInfo queryAgvTasks(AgvtaskCondition condition);
}
package com.gavel.hcgd.agv.service;
import com.gavel.common.base.service.BaseEditService;
import com.gavel.hcgd.agv.persistent.Agvtaskqueue;
import com.gavel.hcgd.agv.vo.AgvtaskqueueCondition;
import com.gavel.hcgd.agv.vo.AgvtaskqueueVO;
import com.gavel.persistence.sql.RecordSet;
public interface AgvtaskqueueService extends BaseEditService {
public RecordSet<AgvtaskqueueVO> query(AgvtaskqueueCondition condition);
public void writeMessage(String message);
/**
* 出队锁定
* @return
*/
public Agvtaskqueue popQueue(String msgType);
/**
* 确认出队
* @param id
* @return
*/
public boolean ackPopQueue(String id);
public boolean unAckPopQueue(String id);
public Agvtaskqueue query(String guid,String msgType);
public void updateById(String id);
}
package com.gavel.hcgd.agv.service;
import com.gavel.common.base.service.BaseEditService;
import com.gavel.hcgd.agv.vo.AgvwarnCondition;
import com.gavel.hcgd.agv.vo.AgvwarnVO;
import com.gavel.hcgd.mcs.model.AGVWarns;
import com.gavel.hcgd.mcs.model.AgvTaskStatus;
import com.gavel.persistence.sql.RecordSet;
public interface AgvwarnService extends BaseEditService {
public RecordSet<AgvwarnVO> query(AgvwarnCondition condition);
public void warnCallback(AGVWarns warnCallback);
public void agvCallback(AgvTaskStatus agvTaskStatus);
}
package com.gavel.hcgd.agv.service;
import com.gavel.common.base.service.BaseEditService;
import com.gavel.hcgd.agv.persistent.Agvtaskqueue;
import com.gavel.hcgd.agv.persistent.Eptask;
import com.gavel.hcgd.agv.vo.EptaskCondition;
import com.gavel.hcgd.agv.vo.EptaskVO;
import com.gavel.hcgd.rabbitmq.model.AgvTask;
import com.gavel.hcgd.rabbitmq.model.TaskFeedback;
import com.gavel.persistence.sql.RecordSet;
public interface EptaskService extends BaseEditService {
public RecordSet<EptaskVO> query(EptaskCondition condition);
public Eptask loadTask(String taskCode);
public Eptask loadOneTask(String wbCode);
public Eptask loadTwoTask(String wbCode);
public Eptask findExecutingTwoTask(String wbCode);
public Eptask loadExecutingOneTask(String wbCode);
public Eptask loadExecutingSixTask(String fullPoint);
public Eptask loadExecutingSevenTask(String wbcode);
public Eptask findExecutingTask(String wbCode, String type);
public void genTask(String message);
/**
* 生成任务
* @param agvTask
* @return
*/
public Eptask genAgvTask(AgvTask agvTask);
public boolean cancelAgvTask(Agvtaskqueue agvtaskqueue);
}
package com.gavel.hcgd.agv.service;
import com.gavel.common.base.service.BaseEditService;
import com.gavel.hcgd.agv.persistent.Agvtaskqueue;
import com.gavel.hcgd.rabbitmq.model.AgvTask;
import com.gavel.hcgd.rabbitmq.model.StepFeedback;
import com.gavel.hcgd.rabbitmq.model.TaskFeedback;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.hcgd.agv.vo.HcMsglogCondition;
import com.gavel.hcgd.agv.vo.HcMsglogVO;
public interface HcMsglogService extends BaseEditService {
public RecordSet<HcMsglogVO> query(HcMsglogCondition condition);
public void addMsgLog(TaskFeedback feedback, AgvTask agvTask);
public void addMsgStepFeedbackLog(StepFeedback stepFeedback);
public void addWarnMsglog(Agvtaskqueue agvtaskQueue, String message);
public void addCacelMsgLog(TaskFeedback taskFeedback);
public void addMsgLog(TaskFeedback feedback, Agvtaskqueue agvtaskqueue);
}
package com.gavel.hcgd.agv.service.impl;
import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.business.service.CommonService;
import com.gavel.common.lock.LockUtils;
import com.gavel.common.utils.BooleanEnum;
import com.gavel.common.utils.NumberUtils;
import com.gavel.common.utils.StringUtils;
import com.gavel.hcgd.agv.dao.AgvDao;
import com.gavel.hcgd.agv.dao.EptaskDao;
import com.gavel.hcgd.agv.persistent.Agv;
import com.gavel.hcgd.agv.service.AgvService;
import com.gavel.hcgd.agv.vo.AgvCondition;
import com.gavel.hcgd.agv.vo.AgvVO;
import com.gavel.hcgd.jcsj.persistent.Template;
import com.gavel.hcgd.jcsj.service.TemplateService;
import com.gavel.hcgd.jcsj.utils.JcsjParamEnum;
import com.gavel.hcgd.mcs.model.GenAgvTaskResp;
import com.gavel.hcgd.mcs.model.QueryAgvStatusResp;
import com.gavel.hcgd.mcs.service.RcmsService;
import com.gavel.hcgd.rabbitmq.model.AgvTask;
import com.gavel.persistence.sql.RecordSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("agvService")
@Transactional
public class AgvServiceImpl extends BaseEditServiceImpl implements AgvService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private AgvDao agvDao;
@Autowired
private RcmsService rcmsService;
@Autowired
private TemplateService templateService;
@Autowired
private CommonService commonService;
@Autowired
private EptaskDao eptaskDao;
@Override
public void initService() {
addMaster( Agv.class);
}
@Override
public RecordSet<AgvVO> query(AgvCondition condition) {
return agvDao.query(condition);
}
@Override
public void update(List<QueryAgvStatusResp.AgvStatus> datas, String mapCode) {
Agv conditon = new Agv();
conditon.setMapcode(mapCode);
List<Agv> exists = agvDao.queryListByEntity(conditon);
List<Agv> offlineList = new ArrayList<>();
Map<String, Agv> existAgvs = new HashMap<>();
if ( exists!=null ) {
for (Agv agv : exists) {
existAgvs.put(agv.getRobotcode(), agv);
offlineList.add(agv);
}
}
for (QueryAgvStatusResp.AgvStatus item : datas) {
Agv agv = existAgvs.get(item.getRobotCode());
if ( agv==null ) {
agv = new Agv();
}
agv.setRobotcode(item.getRobotCode());
agv.setRobotdir(item.getRobotDir());
agv.setRobotip(item.getRobotIp());
agv.setBattery(item.getBattery());
agv.setPosx(item.getPosX());
agv.setPosy(item.getPosY());
agv.setMapcode(item.getMapCode());
agv.setSpeed(item.getSpeed());
agv.setStatus(item.getStatus());
agv.setExcltype(item.getExclType());
agv.setStop(item.getStop());
agv.setPodcode(item.getPodCode());
agv.setPoddir(item.getPodDir());
if (StringUtils.isBlank(agv.getId()) ) {
agvDao.insert(agv);
} else {
agvDao.update(agv);
offlineList.remove(agv);
}
}
List<Agv> offlineUpdList = new ArrayList<>();
for (Agv agv : offlineList) {
Agv updAgv = new Agv();
updAgv.setId(agv.getId());
updAgv.setStatus("9999");
offlineUpdList.add(updAgv);
}
agvDao.batchUpdate(offlineUpdList);
}
@Override
public String findEmptyAgv(AgvTask agvTask) {
Template template = templateService.queryByCode(agvTask.getTasktype());//模板类型
if(template ==null){
logger.warn("模板类型{}未能找到, 生成任务失败!", agvTask.getTasktype());
return "";
}
String mapName = commonService.getStringOptionValue(JcsjParamEnum.MapDataSync.id());
if(StringUtils.isEmpty(mapName) ){
logger.warn("未配置地图编号,请联系管理员!");
return "";
}
//小车状态 2.任务执行 3.任务异常4.任务空闲状态,246,247,248
List<QueryAgvStatusResp.AgvStatus> agvStatusList = rcmsService.queryAgvStatus(mapName).getData();//地图简称,与地码类型一致
//如果小车空闲
for (QueryAgvStatusResp.AgvStatus agvStatus :agvStatusList) {
if (validStatusData(agvStatus.getStatus()) ) {
//检验小车
Agv agv = new Agv();
agv.setRobotcode(agvStatus.getRobotCode());
Agv agvExsit = agvDao.queryByEntity(agv);
if(agvExsit !=null && BooleanEnum.equalsYes(agvExsit.getTybz())){
continue;
}
//是否启用充电阈值设置
String isEnable = commonService.getStringOptionValue(JcsjParamEnum.AgvBatteryEnable.id());
//充电状态,阈值比较
if(StringUtils.equals(isEnable,"Y")){
if(StringUtils.equals("7",agvStatus.getStatus())) {
String agvdl = commonService.getStringOptionValue(JcsjParamEnum.AgvBatterySetting.id());
Integer yz = Integer.valueOf(agvdl);//设置值
Integer curValue = Integer.valueOf(agvStatus.getBattery());//获取小车值
if(NumberUtils.less(curValue , yz)){
continue;
}
}
}
//查询Eptask中是否已存在小车,如果存在,返回空,生成任务失败
if (eptaskDao.countExecutingHcTask(agvStatus.getRobotCode()) > 0) {
logger.error("小车"+agvStatus.getRobotCode()+"已存在执行任务,生成任务失败!");
continue;
}
if(StringUtils.isNotEmpty(template.getAgv())){
if(StringUtils.contains(template.getAgv(),agvStatus.getRobotCode())){
String lockKey = "AgvTask";
if(!LockUtils.lock(lockKey,agvStatus.getRobotCode())) {
continue;
}
LockUtils.releaseLock(lockKey,agvStatus.getRobotCode());
return agvStatus.getRobotCode();
}
}else {
String lockKey = "AgvTask";
if(!LockUtils.lock(lockKey,agvStatus.getRobotCode())) {
continue;
}
LockUtils.releaseLock(lockKey,agvStatus.getRobotCode());
return agvStatus.getRobotCode();
}
}
}
return "";
}
@Override
public boolean pauseAgv(String agvCode) {
List<String> agvs = new ArrayList<>();
agvs.add(agvCode);
GenAgvTaskResp genAgvTaskResp = rcmsService.stopRobot(agvs);
if ( genAgvTaskResp==null ) {
throw new RuntimeException("Rcs服务请求失败.");
}
if ( !"0".equalsIgnoreCase(genAgvTaskResp.getCode()) ) {
throw new RuntimeException(genAgvTaskResp.getMessage());
}
return true;
}
public boolean recoverAgv(String agvCode) {
List<String> agvs = new ArrayList<>();
agvs.add(agvCode);
GenAgvTaskResp genAgvTaskResp = rcmsService.continueRobot(agvs);
if ( genAgvTaskResp==null ) {
throw new RuntimeException("Rcs服务请求失败.");
}
if ( !"0".equalsIgnoreCase(genAgvTaskResp.getCode()) ) {
throw new RuntimeException(genAgvTaskResp.getMessage());
}
return true;
}
private static Map<String,String> statusMap = new HashMap<>();
static {
statusMap.put("4","小车空闲");
statusMap.put("246","待机模式中");
statusMap.put("247","低功耗模式中");
statusMap.put("248","休眠模式中");
statusMap.put("7","充电状态");
}
private boolean validStatusData(String status) {
return statusMap.containsKey(status);
}
}
package com.gavel.hcgd.agv.service.impl;
import com.gavel.common.Constants;
import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.business.service.CommonService;
import com.gavel.common.utils.StringUtils;
import com.gavel.hcgd.agv.dao.AgvtaskDao;
import com.gavel.hcgd.agv.persistent.Agvtask;
import com.gavel.hcgd.agv.service.AgvtaskService;
import com.gavel.hcgd.agv.vo.AgvtaskCondition;
import com.gavel.hcgd.agv.vo.AgvtaskInfo;
import com.gavel.hcgd.agv.vo.AgvtaskVO;
import com.gavel.hcgd.jcsj.utils.JcsjParamEnum;
import com.gavel.persistence.sql.RecordSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service("agvtaskService")
@Transactional
public class AgvtaskServiceImpl extends BaseEditServiceImpl implements AgvtaskService {
@Autowired
private AgvtaskDao agvtaskDao;
@Autowired
private CommonService commonService;
@Override
public void initService() {
addMaster( Agvtask.class);
}
@Override
public RecordSet<AgvtaskVO> query(AgvtaskCondition condition) {
if (condition.getCxids() == null || condition.getCxids().length == 0) {
String[] cxidsArray = StringUtils.str2Array(commonService.getStringOptionValue(JcsjParamEnum.MCSU002.id()), Constants.StringSplit.IDSPLIT);
if (cxidsArray.length > 0)
condition.setCxids(cxidsArray);
}
if (condition.getZdids() == null || condition.getZdids().length == 0) {
String[] zdidsArray = StringUtils.str2Array(commonService.getStringOptionValue(JcsjParamEnum.MCSU003.id()), Constants.StringSplit.IDSPLIT);
if (zdidsArray.length > 0)
condition.setZdids(zdidsArray);
}
return agvtaskDao.query(condition);
}
@Override
public AgvtaskVO working(AgvtaskCondition condition) {
return agvtaskDao.working(condition);
}
@Override
public AgvtaskInfo queryAgvTasks(AgvtaskCondition condition) {
AgvtaskInfo agvtaskInfo = new AgvtaskInfo();
if (condition.getCxids() == null || condition.getCxids().length == 0) {
String[] cxidsArray = StringUtils.str2Array(commonService.getStringOptionValue(JcsjParamEnum.MCSU002.id()), Constants.StringSplit.IDSPLIT);
if (cxidsArray.length > 0)
condition.setCxids(cxidsArray);
}
if (condition.getZdids() == null || condition.getZdids().length == 0) {
String[] zdidsArray = StringUtils.str2Array(commonService.getStringOptionValue(JcsjParamEnum.MCSU003.id()), Constants.StringSplit.IDSPLIT);
if (zdidsArray.length > 0)
condition.setZdids(zdidsArray);
}
List<AgvtaskVO> listnew = agvtaskDao.queryAgvTasks(condition);
if(condition.getIds().length == listnew.size()){
agvtaskInfo.setSign("false");
}else {
agvtaskInfo.setSign("true");
agvtaskInfo.setAgvtasks(listnew);
}
return agvtaskInfo;
}
}
package com.gavel.hcgd.agv.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.gavel.common.utils.CodeStrategy;
import com.gavel.common.utils.StringUtils;
import com.gavel.hcgd.agv.utils.AgvQueueStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.utils.DateUtils;
import com.gavel.hcgd.agv.dao.AgvtaskqueueDao;
import com.gavel.hcgd.agv.persistent.Agvtaskqueue;
import com.gavel.hcgd.agv.service.AgvtaskqueueService;
import com.gavel.hcgd.agv.vo.AgvtaskqueueCondition;
import com.gavel.hcgd.agv.vo.AgvtaskqueueVO;
import com.gavel.persistence.sql.RecordSet;
import com.ibm.icu.util.Calendar;
@Service("agvtaskqueueService")
@Transactional
public class AgvtaskqueueServiceImpl extends BaseEditServiceImpl implements AgvtaskqueueService {
@Autowired
private AgvtaskqueueDao agvtaskqueueDao;
@Override
public void initService() {
addMaster( Agvtaskqueue.class);
}
@Override
public RecordSet<AgvtaskqueueVO> query(AgvtaskqueueCondition condition) {
return agvtaskqueueDao.query(condition);
}
@Override
public void writeMessage(String message) {
Agvtaskqueue agvtaskqueue = JSONObject.parseObject(message, Agvtaskqueue.class);
Agvtaskqueue agvtaskqueueExsit = agvtaskqueueDao.queryAgvtask(agvtaskqueue.getGuid(),agvtaskqueue.getMsgtype());
if(agvtaskqueueExsit !=null){
throwReturnMessage("任务队列已存在这个单号:【"+agvtaskqueueExsit.getGuid()+"】");
}
if (StringUtils.isEmpty(agvtaskqueue.getDesttask())){
JSONArray jsonArray = new JSONArray();
agvtaskqueue.setDesttask(jsonArray.toJSONString());
}
agvtaskqueue.setId(CodeStrategy.getUUID());
agvtaskqueue.setNexttime(DateUtils.getDateTime());
agvtaskqueue.setBody(message);
agvtaskqueue.setZt(AgvQueueStatusEnum.H.getId());
agvtaskqueueDao.insert(agvtaskqueue);
}
@Override
public Agvtaskqueue popQueue(String msgType) {
Agvtaskqueue agvtaskqueue = agvtaskqueueDao.selectPop(msgType);
if (agvtaskqueue != null) {
//更新状态,如果更新失败,则递归调用
Agvtaskqueue updAgvTaskQueue = new Agvtaskqueue();
updAgvTaskQueue.setId(agvtaskqueue.getId());
updAgvTaskQueue.setSysversion(updAgvTaskQueue.getSysversion());
updAgvTaskQueue.setZt("F");
int rowAffected = agvtaskqueueDao.update(updAgvTaskQueue);
if (rowAffected != 1)
return popQueue(msgType);
}
return agvtaskqueue;
}
@Override
public boolean ackPopQueue(String id) {
Agvtaskqueue updAgvTaskQueue = new Agvtaskqueue();
updAgvTaskQueue.setId(id);
return agvtaskqueueDao.delete(updAgvTaskQueue) == 1;
}
@Override
public boolean unAckPopQueue(String id) {
Agvtaskqueue updAgvTaskQueue = new Agvtaskqueue();
updAgvTaskQueue.setId(id);
updAgvTaskQueue.setNexttime(DateUtils.plus(DateUtils.getDateTime(), Calendar.SECOND, 10));
updAgvTaskQueue.setZt("I");
return agvtaskqueueDao.update(updAgvTaskQueue) == 1;
}
@Override
public Agvtaskqueue query(String guid, String msgType) {
return agvtaskqueueDao.queryAgvtask(guid, msgType);
}
@Override
public void updateById(String id) {
Agvtaskqueue agvtaskqueue = agvtaskqueueDao.queryById(Agvtaskqueue.class,id);
if(agvtaskqueue !=null && StringUtils.equals("F",agvtaskqueue.getZt())){
agvtaskqueue.setZt("I");
agvtaskqueueDao.update(agvtaskqueue);
}
}
}
package com.gavel.hcgd.agv.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.converter.DataConvert;
import com.gavel.common.utils.DateUtils;
import com.gavel.hcgd.agv.persistent.Agvtaskqueue;
import com.gavel.hcgd.agv.utils.MsgCodeEnum;
import com.gavel.hcgd.rabbitmq.model.AgvTask;
import com.gavel.hcgd.rabbitmq.model.StepFeedback;
import com.gavel.hcgd.rabbitmq.model.TaskFeedback;
import com.gavel.persistence.sql.RecordSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.gavel.hcgd.agv.dao.HcMsglogDao;
import com.gavel.hcgd.agv.persistent.HcMsglog;
import com.gavel.hcgd.agv.service.HcMsglogService;
import com.gavel.hcgd.agv.vo.HcMsglogCondition;
import com.gavel.hcgd.agv.vo.HcMsglogVO;
@Service("hcMsglogService")
@Transactional
public class HcMsglogServiceImpl extends BaseEditServiceImpl implements HcMsglogService {
@Autowired
private HcMsglogDao hcMsglogDao;
@Override
public void initService() {
addMaster( HcMsglog.class);
}
@Override
public RecordSet<HcMsglogVO> query(HcMsglogCondition condition) {
return hcMsglogDao.query(condition);
}
@Override
public void addMsgLog(TaskFeedback feedback, AgvTask agvTask) {
HcMsglog hcMsglog = new HcMsglog();
hcMsglog.setGuid(agvTask.getGuid());
hcMsglog.setTasktype(agvTask.getTasktype());
hcMsglog.setRevtime(DateUtils.parseDate(feedback.getTime()));
hcMsglog.setDesttask(DataConvert.list2JSONString(agvTask.getDesttask()));
hcMsglog.setMsgcode(feedback.getMsgcode());
hcMsglog.setMessage(JSONObject.toJSONString(feedback));
hcMsglogDao.insert(hcMsglog);
}
@Override
public void addMsgLog(TaskFeedback feedback, Agvtaskqueue agvtaskqueue) {
HcMsglog hcMsglog = new HcMsglog();
hcMsglog.setGuid(agvtaskqueue.getGuid());
hcMsglog.setTasktype(agvtaskqueue.getTasktype());
hcMsglog.setRevtime(DateUtils.parseDate(feedback.getTime()));
hcMsglog.setDesttask(agvtaskqueue.getDesttask());
hcMsglog.setMsgcode(feedback.getMsgcode());
hcMsglog.setMessage(JSONObject.toJSONString(feedback));
hcMsglogDao.insert(hcMsglog);
}
@Override
public void addMsgStepFeedbackLog(StepFeedback stepFeedback) {
HcMsglog hcMsglog = new HcMsglog();
hcMsglog.setGuid(stepFeedback.getGuid());
hcMsglog.setTasktype(stepFeedback.getMsgtype());
hcMsglog.setRevtime(DateUtils.parseDate(stepFeedback.getTime()));
hcMsglog.setMsgcode(MsgCodeEnum.THREE.getId());//3代表步骤触发
hcMsglog.setMessage(JSONObject.toJSONString(stepFeedback));
hcMsglogDao.insert(hcMsglog);
}
@Override
public void addWarnMsglog(Agvtaskqueue agvtaskQueue, String message) {
HcMsglog hcMsglog = new HcMsglog();
hcMsglog.setGuid(agvtaskQueue.getGuid());
hcMsglog.setTasktype(agvtaskQueue.getMsgtype());
hcMsglog.setRevtime(DateUtils.getDateTime());
hcMsglog.setMsgcode(MsgCodeEnum.FOUR.getId());//4代表报错信息
hcMsglog.setMessage(message);
hcMsglogDao.insert(hcMsglog);
}
@Override
public void addCacelMsgLog(TaskFeedback taskFeedback) {
HcMsglog hcMsglog = new HcMsglog();
hcMsglog.setGuid(taskFeedback.getGuid());
hcMsglog.setTasktype(taskFeedback.getMsgtype());
hcMsglog.setRevtime(DateUtils.getDateTime());
hcMsglog.setMsgcode(MsgCodeEnum.FIVE.getId());//5代表取消任务信息
hcMsglog.setMessage(JSONObject.toJSONString(taskFeedback));
hcMsglogDao.insert(hcMsglog);
}
}
package com.gavel.hcgd.agv.utils;
import com.gavel.kzzx.model.GavelEnumModel;
import java.util.ArrayList;
import java.util.List;
public enum AgvQueueStatusEnum {
H("待处理", "I"),
Z("正在处理", "F");
private String id;
private String name;
AgvQueueStatusEnum(String name, String id){
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static List<GavelEnumModel> toList() {
List<GavelEnumModel> list = new ArrayList<>();
for (AgvQueueStatusEnum e : AgvQueueStatusEnum.values()) {
GavelEnumModel gavelEnumModel = new GavelEnumModel();
gavelEnumModel.setId(e.getId());
gavelEnumModel.setName(e.getName());
list.add(gavelEnumModel);
}
return list;
}
}
package com.gavel.hcgd.agv.utils;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.*;
/**
*
* @Description: 简单的内存缓存工具类
*/
public class CacheManger {
//键值对集合
private final static Map<String, Entity> map = new HashMap<>();
//定时器线程池,用于清除过期缓存
private final static ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
/**
* 添加缓存
*
* @param key 键
* @param data 值
*/
public synchronized static void put(String key, Object data) {
CacheManger.put(key, data, 0);
}
/**
* 添加缓存
*
* @param key 键
* @param data 值
* @param expire 过期时间,单位:毫秒, 0表示无限长
*/
public synchronized static void put(String key, Object data, long expire) {
//清除原键值对
CacheManger.remove(key);
//设置过期时间
if (expire > 0) {
Future future = executor.schedule(new Runnable() {
@Override
public void run() {
//过期后清除该键值对
synchronized (CacheManger.class) {
map.remove(key);
}
}
}, expire, TimeUnit.MILLISECONDS);
map.put(key, new Entity(data, future));
} else {
//不设置过期时间
map.put(key, new Entity(data, null));
}
}
/**
* 读取缓存
*
* @param key 键
* @return
*/
public synchronized static Object get(String key) {
Entity entity = map.get(key);
return entity == null ? null : entity.getValue();
}
/**
* 读取缓存
*
* @param key 键
* * @param clazz 值类型
* @return
*/
public synchronized static <T> T get(String key, Class<T> clazz) {
return clazz.cast(CacheManger.get(key));
}
/**
* 清除缓存
*
* @param key
* @return
*/
public synchronized static Object remove(String key) {
//清除原缓存数据
Entity entity = map.remove(key);
if (entity == null) return null;
//清除原键值对定时器
Future future = entity.getFuture();
if (future != null) future.cancel(true);
return entity.getValue();
}
/**
* 查询当前缓存的键值对数量
*
* @return
*/
public synchronized static int size() {
return map.size();
}
/**
* 缓存实体类
*/
private static class Entity {
//键值对的value
private Object value;
//定时器Future
private Future future;
public Entity(Object value, Future future) {
this.value = value;
this.future = future;
}
/**
* 获取值
*
* @return
*/
public Object getValue() {
return value;
}
/**
* 获取Future对象
*
* @return
*/
public Future getFuture() {
return future;
}
}
public static void main(String[] args) throws InterruptedException, ExecutionException {
String key = "id";
//不设置过期时间
System.out.println("***********不设置过期时间**********");
CacheManger.put(key, 123);
System.out.println("key:" + key + ", value:" + CacheManger.get(key));
System.out.println("key:" + key + ", value:" + CacheManger.remove(key));
System.out.println("key:" + key + ", value:" + CacheManger.get(key));
//设置过期时间
System.out.println("\n***********设置过期时间**********");
CacheManger.put(key, "123456", 1000);
System.out.println("key:" + key + ", value:" + CacheManger.get(key));
Thread.sleep(2000);
System.out.println("key:" + key + ", value:" + CacheManger.get(key));
/******************并发性能测试************/
System.out.println("\n***********并发性能测试************");
//创建有10个线程的线程池,将1000000次操作分10次添加到线程池
ExecutorService executorService = Executors.newFixedThreadPool(10);
Future[] futures = new Future[10];
/********添加********/
{
long start = System.currentTimeMillis();
for (int j = 0; j < 10; j++) {
futures[j] = executorService.submit(() -> {
for (int i = 0; i < 100000; i++) {
CacheManger.put(Thread.currentThread().getId() + key + i, i, 30000);
}
});
}
//等待全部线程执行完成,打印执行时间
for (Future future : futures) {
future.get();
}
System.out.printf("添加耗时:%dms\n", System.currentTimeMillis() - start);
}
/********查询********/
{
long start = System.currentTimeMillis();
for (int j = 0; j < 10; j++) {
futures[j] = executorService.submit(() -> {
for (int i = 0; i < 100000; i++) {
CacheManger.get(Thread.currentThread().getId() + key + i);
}
});
}
//等待全部线程执行完成,打印执行时间
for (Future future : futures) {
future.get();
}
System.out.printf("查询耗时:%dms\n", System.currentTimeMillis() - start);
}
System.out.println("当前缓存容量:" + CacheManger.size());
}
}
package com.gavel.hcgd.agv.utils;
import com.gavel.common.utils.StringUtils;
import com.gavel.kzzx.model.GavelEnumModel;
import java.util.ArrayList;
import java.util.List;
public enum MsgCodeEnum {
//任务类型
ONE("1", "任务成功"),
TWO("2","任务失败"),
THREE("3", "触发任务"),
FOUR("4","报错信息"),
FIVE("5","取消任务");
private String id;
private String name;
MsgCodeEnum(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static String getNameById(String id) {
for (MsgCodeEnum e : MsgCodeEnum.values()) {
if (StringUtils.equals(e.getId(), id))
return e.getName();
}
return "";
}
public static List<GavelEnumModel> toList() {
List<GavelEnumModel> list = new ArrayList<>();
for (MsgCodeEnum e : MsgCodeEnum.values()) {
GavelEnumModel gavelEnumModel = new GavelEnumModel();
gavelEnumModel.setId(e.getId());
gavelEnumModel.setName(e.getName());
list.add(gavelEnumModel);
}
return list;
}
}
package com.gavel.hcgd.agv.utils;
import com.gavel.common.utils.StringUtils;
import com.gavel.kzzx.model.GavelEnumModel;
import java.util.ArrayList;
import java.util.List;
public enum TaskModelEnum {
//模板类型
MES("S13","MES模板"),
POINT("S14","点到储位"),
AREA("S15", "点到区域");
private String id;
private String name;
TaskModelEnum(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static String getNameById(String id) {
for (TaskModelEnum e : TaskModelEnum.values()) {
if (StringUtils.equals(e.getId(), id))
return e.getName();
}
return "";
}
public static List<GavelEnumModel> toList() {
List<GavelEnumModel> list = new ArrayList<>();
for (TaskModelEnum e : TaskModelEnum.values()) {
GavelEnumModel gavelEnumModel = new GavelEnumModel();
gavelEnumModel.setId(e.getId());
gavelEnumModel.setName(e.getName());
list.add(gavelEnumModel);
}
return list;
}
}
package com.gavel.hcgd.agv.utils;
import com.gavel.common.utils.StringUtils;
import com.gavel.kzzx.model.GavelEnumModel;
import java.util.ArrayList;
import java.util.List;
public enum TaskWaysEnum {
//任务类型
MES("MES", "MES叫料"),
PAD("PAD","PAD叫料");
private String id;
private String name;
TaskWaysEnum(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static String getNameById(String id) {
for (TaskWaysEnum e : TaskWaysEnum.values()) {
if (StringUtils.equals(e.getId(), id))
return e.getName();
}
return "";
}
public static List<GavelEnumModel> toList() {
List<GavelEnumModel> list = new ArrayList<>();
for (TaskWaysEnum e : TaskWaysEnum.values()) {
GavelEnumModel gavelEnumModel = new GavelEnumModel();
gavelEnumModel.setId(e.getId());
gavelEnumModel.setName(e.getName());
list.add(gavelEnumModel);
}
return list;
}
}
package com.gavel.hcgd.agv.vo;
import com.gavel.common.base.entity.BaseEntity;
public class AgvCondition extends BaseEntity {
private static final long serialVersionUID = 1L;
private String id;
private String robotcode;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRobotcode() {
return robotcode;
}
public void setRobotcode(String robotcode) {
this.robotcode = robotcode;
}
}
package com.gavel.hcgd.agv.vo;
import com.gavel.hcgd.agv.persistent.Agv;
import com.gavel.persistence.annotation.FieldMeta;
public class AgvVO extends Agv {
private static final long serialVersionUID = 1L;
@FieldMeta(fieldName = "AGVSTATUS_CODE", caption = "状态码", primaryKey = true, notEmpty = true)
private String code;
@FieldMeta(fieldName = "AGVSTATUS_CHINESE", caption = "中文描述")
private String chinese;
@FieldMeta(fieldName = "AGVSTATUS_ENGLISH", caption = "英文描述")
private String english;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getChinese() {
return chinese;
}
public void setChinese(String chinese) {
this.chinese = chinese;
}
public String getEnglish() {
return english;
}
public void setEnglish(String english) {
this.english = english;
}
/*---------AutoBegin-----------*/
/*---------AutoEnd-------------*/
}
package com.gavel.hcgd.agv.vo;
import com.gavel.common.base.entity.BaseEntity;
public class AgvtaskCondition extends BaseEntity {
private static final long serialVersionUID = 1L;
private String id;
private String[] ids;
private String wbcode;
private String taskCode;
private String taskStatus;
private String cjid;
private String cxid;
private String zdid;
private String gwmc;
private String online;
private String[] cxids;
private String[] zdids;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String[] getIds() {
return ids;
}
public void setIds(String[] ids) {
this.ids = ids;
}
public String getWbcode() {
return wbcode;
}
public void setWbcode(String wbcode) {
this.wbcode = wbcode;
}
public String getTaskCode() {
return taskCode;
}
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
public String getTaskStatus() {
return taskStatus;
}
public void setTaskStatus(String taskStatus) {
this.taskStatus = taskStatus;
}
public String getCjid() {
return cjid;
}
public void setCjid(String cjid) {
this.cjid = cjid;
}
public String getCxid() {
return cxid;
}
public void setCxid(String cxid) {
this.cxid = cxid;
}
public String getGwmc() {
return gwmc;
}
public void setGwmc(String gwmc) {
this.gwmc = gwmc;
}
public String getZdid() {
return zdid;
}
public void setZdid(String zdid) {
this.zdid = zdid;
}
public String getOnline() {
return online;
}
public void setOnline(String online) {
this.online = online;
}
public String[] getCxids() {
return cxids;
}
public void setCxids(String[] cxids) {
this.cxids = cxids;
}
public String[] getZdids() {
return zdids;
}
public void setZdids(String[] zdids) {
this.zdids = zdids;
}
}
package com.gavel.hcgd.agv.vo;
import com.gavel.common.base.entity.BaseEntity;
import java.util.ArrayList;
import java.util.List;
public class AgvtaskInfo extends BaseEntity {
private String sign;
private List<AgvtaskVO> agvtasks = new ArrayList<AgvtaskVO>();
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public List<AgvtaskVO> getAgvtasks() {
return agvtasks;
}
public void setAgvtasks(List<AgvtaskVO> agvtasks) {
this.agvtasks = agvtasks;
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment