小车设备表初始化

This commit is contained in:
liuhanqing
2025-11-21 09:00:54 +08:00
parent 3464e5c4d8
commit d5ba1a5e29
14 changed files with 849 additions and 69 deletions

View File

@@ -44,25 +44,24 @@ public class TaskStatusCode {
public static final String TASK_EP_TJS_MC_LOAD = "10"; public static final String TASK_EP_TJS_MC_LOAD = "10";
public static final String TASK_EP_SRGV_MC_TSJ_CK = "11"; public static final String TASK_EP_SRGV_MC_TSJ_CK = "11";
public static final String TASK_EP_SRGV_FH = "12"; public static final String TASK_EP_SRGV_FH = "12";
public static final String TASK_EP_SSJ = "13";
public static final String TASK_EP_CK = "14"; public static final String TASK_EP_CK = "14";
/** /**
* 任务执行阶段 入口输送机 * 任务执行阶段 入口输送机
*/ */
//public static final String TASK_EP_SSJ = "2"; public static final String TASK_EP_SSJ = "2";
/** /**
* 任务执行阶段 巷道口 * 任务执行阶段 巷道口
*/ */
//public static final String TASK_EP_ROADWAY_SSJ = "3"; public static final String TASK_EP_ROADWAY_SSJ = "3";
/** /**
* 任务执行阶段 堆垛机 * 任务执行阶段 堆垛机
*/ */
//public static final String TASK_EP_DDJ = "4"; public static final String TASK_EP_DDJ = "4";
/** /**
* 任务执行阶段 回传wms完成 * 任务执行阶段 回传wms完成
*/ */
//public static final String TASK_EP_WMS_FINISH = "5"; public static final String TASK_EP_WMS_FINISH = "5";
} }

View File

@@ -0,0 +1,104 @@
package com.ruoyi.device.srgv.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.device.srgv.domain.DeviceSrgv;
import com.ruoyi.device.srgv.service.IDeviceSrgvService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 四向小车设备表Controller
*
* @author ruoyi
* @date 2025-11-21
*/
@RestController
@RequestMapping("/device/srgv")
public class DeviceSrgvController extends BaseController
{
@Autowired
private IDeviceSrgvService deviceSrgvService;
/**
* 查询四向小车设备表列表
*/
@PreAuthorize("@ss.hasPermi('device:srgv:list')")
@GetMapping("/list")
public TableDataInfo list(DeviceSrgv deviceSrgv)
{
startPage();
List<DeviceSrgv> list = deviceSrgvService.selectDeviceSrgvList(deviceSrgv);
return getDataTable(list);
}
/**
* 导出四向小车设备表列表
*/
@PreAuthorize("@ss.hasPermi('device:srgv:export')")
@Log(title = "四向小车设备表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DeviceSrgv deviceSrgv)
{
List<DeviceSrgv> list = deviceSrgvService.selectDeviceSrgvList(deviceSrgv);
ExcelUtil<DeviceSrgv> util = new ExcelUtil<DeviceSrgv>(DeviceSrgv.class);
util.exportExcel(response, list, "四向小车设备表数据");
}
/**
* 获取四向小车设备表详细信息
*/
@PreAuthorize("@ss.hasPermi('device:srgv:query')")
@GetMapping(value = "/{guid}")
public AjaxResult getInfo(@PathVariable("guid") String guid)
{
return success(deviceSrgvService.selectDeviceSrgvByGuid(guid));
}
/**
* 新增四向小车设备表
*/
@PreAuthorize("@ss.hasPermi('device:srgv:add')")
@Log(title = "四向小车设备表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DeviceSrgv deviceSrgv)
{
return toAjax(deviceSrgvService.insertDeviceSrgv(deviceSrgv));
}
/**
* 修改四向小车设备表
*/
@PreAuthorize("@ss.hasPermi('device:srgv:edit')")
@Log(title = "四向小车设备表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DeviceSrgv deviceSrgv)
{
return toAjax(deviceSrgvService.updateDeviceSrgv(deviceSrgv));
}
/**
* 删除四向小车设备表
*/
@PreAuthorize("@ss.hasPermi('device:srgv:remove')")
@Log(title = "四向小车设备表", businessType = BusinessType.DELETE)
@DeleteMapping("/{guids}")
public AjaxResult remove(@PathVariable String[] guids)
{
return toAjax(deviceSrgvService.deleteDeviceSrgvByGuids(guids));
}
}

View File

@@ -1,58 +1,174 @@
package com.ruoyi.device.srgv.domain; package com.ruoyi.device.srgv.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.ToString;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* 输送机对象 device_ssj * 四向小车设备表对象 device_srgv
* *
* @author ruoyi * @author ruoyi
* @date 2025-07-04 * @date 2025-11-21
*/ */
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ToString
public class DeviceSrgv extends BaseEntity public class DeviceSrgv extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/*
* 实时数据
* */
private int taskNo;//任务号
private String srcSite;//原地址
private String tarSite;//目标地址
private String currSite;//当期地址
private int taskType;//任务类型 /** 唯一id */
private String guid;
private int battery;//电量 /** 设备id */
private int workMode;//工作模式 @Excel(name = "设备id")
private int alarm;//报警 private Integer deviceId;
private int status;//车状态
private int finish;//接收完成标志 1接收完成
private int chargeFlag;//充电标志 todo 充电状态值确认
private int workPhase;//工作阶段
private int errorMsg;//异常信息
private int deviceRequest;//输送机对接请求
private int changeLayer;//换层标志
private int cargoFlag;//载货 0未知 1空载 2载货
private int manualCharge;//手动充电 0未知 1充电
private int undefined1;// /** 设备名称 */
private int undefined2;// @Excel(name = "设备名称")
private String deviceName;
private String path;//路径 /** ip */
@Excel(name = "ip")
private String ip;
//其他属性 /** 端口 */
private int currFloor;//当前层 @Excel(name = "端口")
private Integer port;
private String spaceArea;//当前库存 01小库 02大库 /** 类型 */
@Excel(name = "类型")
private String type;
private int allowSend;//1允许下发 /** 设置层 */
@Excel(name = "设置层")
private Integer setFloor;
/** 上次充电时间 */
@Excel(name = "上次充电时间")
private String powerTime;
/** 最后任务时间 */
@Excel(name = "最后任务时间")
private String lastTime;
/** 0 初始化 1正常 */
@Excel(name = "0 初始化 1正常")
private String agvStatus;
/** 任务号 */
@Excel(name = "任务号")
private Integer taskNo;
/** 原位置 */
@Excel(name = "原位置")
private String srcSite;
/** 目标位置 */
@Excel(name = "目标位置")
private String tarSite;
/** 当前位置 */
@Excel(name = "当前位置")
private String currSite;
/** 任务类型 */
@Excel(name = "任务类型")
private Integer taskType;
/** 电量 */
@Excel(name = "电量")
private Integer battery;
/** 工作模式 */
@Excel(name = "工作模式")
private Integer workMode;
/** 报警 */
@Excel(name = "报警")
private Integer alarm;
/** 车状态 */
@Excel(name = "车状态")
private Integer status;
/** 完成下发标志 */
@Excel(name = "完成下发标志")
private Integer finish;
/** 充电标志 */
@Excel(name = "充电标志")
private Integer chargeFlag;
/** 执行阶段 */
@Excel(name = "执行阶段")
private Integer workPhase;
/** 异常信息 */
@Excel(name = "异常信息")
private Integer errMsg;
/** 输送机请求 */
@Excel(name = "输送机请求")
private Integer ssjRequest;
/** 换层标志 */
@Excel(name = "换层标志")
private Integer changeLayer;
/** 载货标志 */
@Excel(name = "载货标志")
private Integer cargoFlag;
/** 手动充电 */
@Excel(name = "手动充电")
private Integer manualCharge;
/** 路径 */
@Excel(name = "路径")
private String path;
/** 允许下发 */
@Excel(name = "允许下发")
private Integer allowSend;
/** 当前层数 */
@Excel(name = "当前层数")
private Integer currFloor;
/** 离线站点 */
@Excel(name = "离线站点")
private String offlineSite;
/** 车辆锁 */
@Excel(name = "车辆锁")
private Integer locked;
/** */
@Excel(name = "")
private String spare1;
/** */
@Excel(name = "")
private String spare2;
/** */
@Excel(name = "")
private String spare3;
/** */
@Excel(name = "")
private String spare4;
/** */
@Excel(name = "")
private String spare5;
} }

View File

@@ -0,0 +1,61 @@
package com.ruoyi.device.srgv.mapper;
import java.util.List;
import com.ruoyi.device.srgv.domain.DeviceSrgv;
/**
* 四向小车设备表Mapper接口
*
* @author ruoyi
* @date 2025-11-21
*/
public interface DeviceSrgvMapper
{
/**
* 查询四向小车设备表
*
* @param guid 四向小车设备表主键
* @return 四向小车设备表
*/
public DeviceSrgv selectDeviceSrgvByGuid(String guid);
/**
* 查询四向小车设备表列表
*
* @param deviceSrgv 四向小车设备表
* @return 四向小车设备表集合
*/
public List<DeviceSrgv> selectDeviceSrgvList(DeviceSrgv deviceSrgv);
/**
* 新增四向小车设备表
*
* @param deviceSrgv 四向小车设备表
* @return 结果
*/
public int insertDeviceSrgv(DeviceSrgv deviceSrgv);
/**
* 修改四向小车设备表
*
* @param deviceSrgv 四向小车设备表
* @return 结果
*/
public int updateDeviceSrgv(DeviceSrgv deviceSrgv);
/**
* 删除四向小车设备表
*
* @param guid 四向小车设备表主键
* @return 结果
*/
public int deleteDeviceSrgvByGuid(String guid);
/**
* 批量删除四向小车设备表
*
* @param guids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDeviceSrgvByGuids(String[] guids);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.device.srgv.service;
import java.util.List;
import com.ruoyi.device.srgv.domain.DeviceSrgv;
/**
* 四向小车设备表Service接口
*
* @author ruoyi
* @date 2025-11-21
*/
public interface IDeviceSrgvService
{
/**
* 查询四向小车设备表
*
* @param guid 四向小车设备表主键
* @return 四向小车设备表
*/
public DeviceSrgv selectDeviceSrgvByGuid(String guid);
/**
* 查询四向小车设备表列表
*
* @param deviceSrgv 四向小车设备表
* @return 四向小车设备表集合
*/
public List<DeviceSrgv> selectDeviceSrgvList(DeviceSrgv deviceSrgv);
/**
* 新增四向小车设备表
*
* @param deviceSrgv 四向小车设备表
* @return 结果
*/
public int insertDeviceSrgv(DeviceSrgv deviceSrgv);
/**
* 修改四向小车设备表
*
* @param deviceSrgv 四向小车设备表
* @return 结果
*/
public int updateDeviceSrgv(DeviceSrgv deviceSrgv);
/**
* 批量删除四向小车设备表
*
* @param guids 需要删除的四向小车设备表主键集合
* @return 结果
*/
public int deleteDeviceSrgvByGuids(String[] guids);
/**
* 删除四向小车设备表信息
*
* @param guid 四向小车设备表主键
* @return 结果
*/
public int deleteDeviceSrgvByGuid(String guid);
}

View File

@@ -0,0 +1,93 @@
package com.ruoyi.device.srgv.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.srgv.mapper.DeviceSrgvMapper;
import com.ruoyi.device.srgv.domain.DeviceSrgv;
import com.ruoyi.device.srgv.service.IDeviceSrgvService;
/**
* 四向小车设备表Service业务层处理
*
* @author ruoyi
* @date 2025-11-21
*/
@Service
public class DeviceSrgvServiceImpl implements IDeviceSrgvService
{
@Autowired
private DeviceSrgvMapper deviceSrgvMapper;
/**
* 查询四向小车设备表
*
* @param guid 四向小车设备表主键
* @return 四向小车设备表
*/
@Override
public DeviceSrgv selectDeviceSrgvByGuid(String guid)
{
return deviceSrgvMapper.selectDeviceSrgvByGuid(guid);
}
/**
* 查询四向小车设备表列表
*
* @param deviceSrgv 四向小车设备表
* @return 四向小车设备表
*/
@Override
public List<DeviceSrgv> selectDeviceSrgvList(DeviceSrgv deviceSrgv)
{
return deviceSrgvMapper.selectDeviceSrgvList(deviceSrgv);
}
/**
* 新增四向小车设备表
*
* @param deviceSrgv 四向小车设备表
* @return 结果
*/
@Override
public int insertDeviceSrgv(DeviceSrgv deviceSrgv)
{
return deviceSrgvMapper.insertDeviceSrgv(deviceSrgv);
}
/**
* 修改四向小车设备表
*
* @param deviceSrgv 四向小车设备表
* @return 结果
*/
@Override
public int updateDeviceSrgv(DeviceSrgv deviceSrgv)
{
return deviceSrgvMapper.updateDeviceSrgv(deviceSrgv);
}
/**
* 批量删除四向小车设备表
*
* @param guids 需要删除的四向小车设备表主键
* @return 结果
*/
@Override
public int deleteDeviceSrgvByGuids(String[] guids)
{
return deviceSrgvMapper.deleteDeviceSrgvByGuids(guids);
}
/**
* 删除四向小车设备表信息
*
* @param guid 四向小车设备表主键
* @return 结果
*/
@Override
public int deleteDeviceSrgvByGuid(String guid)
{
return deviceSrgvMapper.deleteDeviceSrgvByGuid(guid);
}
}

View File

@@ -6,12 +6,12 @@ import HslCommunication.Core.Transfer.IByteTransform;
import HslCommunication.Core.Types.OperateResult; import HslCommunication.Core.Types.OperateResult;
import HslCommunication.Core.Types.OperateResultExOne; import HslCommunication.Core.Types.OperateResultExOne;
import HslCommunication.ModBus.ModbusTcpNet; import HslCommunication.ModBus.ModbusTcpNet;
import cn.hutool.core.convert.Convert;
import com.ruoyi.common.domain.HslRead; import com.ruoyi.common.domain.HslRead;
import com.ruoyi.common.domain.PlcConnectInfo; import com.ruoyi.common.domain.PlcConnectInfo;
import com.ruoyi.device.srgv.domain.DeviceSrgv; import com.ruoyi.device.srgv.domain.DeviceSrgv;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@Slf4j @Slf4j
public class PlcSrgvRead implements Runnable{ public class PlcSrgvRead implements Runnable{
@@ -88,21 +88,21 @@ public class PlcSrgvRead implements Runnable{
//单字 //单字
private void setValueByByte1(byte[] content , DeviceSrgv agvData) { private void setValueByByte1(byte[] content , DeviceSrgv agvData) {
agvData.setTaskType(byteTransform.TransInt16(content,0)); agvData.setTaskType(Convert.toInt(byteTransform.TransInt16(content,0)));
agvData.setBattery(byteTransform.TransInt16(content,2)); agvData.setBattery(Convert.toInt(byteTransform.TransInt16(content,2)));
agvData.setWorkMode(byteTransform.TransInt16(content,4)); agvData.setWorkMode(Convert.toInt(byteTransform.TransInt16(content,4)));
agvData.setAlarm(byteTransform.TransInt16(content,6)); agvData.setAlarm(Convert.toInt(byteTransform.TransInt16(content,6)));
agvData.setStatus(byteTransform.TransInt16(content,8)); agvData.setStatus(Convert.toInt(byteTransform.TransInt16(content,8)));
agvData.setFinish(byteTransform.TransInt16(content,10)); agvData.setFinish(Convert.toInt(byteTransform.TransInt16(content,10)));
agvData.setChargeFlag(byteTransform.TransInt16(content,12)); agvData.setChargeFlag(Convert.toInt(byteTransform.TransInt16(content,12)));
agvData.setWorkPhase(byteTransform.TransInt16(content,14)); agvData.setWorkPhase(Convert.toInt(byteTransform.TransInt16(content,14)));
agvData.setErrorMsg(byteTransform.TransInt16(content,16)); agvData.setErrMsg(Convert.toInt(byteTransform.TransInt16(content,16)));
agvData.setDeviceRequest(byteTransform.TransInt16(content,18)); agvData.setSsjRequest(Convert.toInt(byteTransform.TransInt16(content,18)));
agvData.setChangeLayer(byteTransform.TransInt16(content,20)); agvData.setChangeLayer(Convert.toInt(byteTransform.TransInt16(content,20)));
agvData.setCargoFlag(byteTransform.TransInt16(content,22)); agvData.setCargoFlag(Convert.toInt(byteTransform.TransInt16(content,22)));
agvData.setManualCharge(byteTransform.TransInt16(content,24)); agvData.setManualCharge(Convert.toInt(byteTransform.TransInt16(content,24)));
agvData.setUndefined1(byteTransform.TransInt16(content,26)); agvData.setSpare1(Convert.toStr(byteTransform.TransInt16(content,0)));
agvData.setAllowSend(byteTransform.TransInt16(content,16)); agvData.setAllowSend(Convert.toInt(byteTransform.TransInt16(content,16)));
} }
@@ -118,13 +118,6 @@ public class PlcSrgvRead implements Runnable{
//设置库区 //设置库区
String currSite = agvData.getCurrSite(); String currSite = agvData.getCurrSite();
String l = currSite.substring(2, 4); String l = currSite.substring(2, 4);
int li = Integer.parseInt(l);//列
if(li<23){
agvData.setSpaceArea("01");
}else {
agvData.setSpaceArea("02");
}
//截取cur的后俩位,获取当前楼层 //截取cur的后俩位,获取当前楼层
int floor = FloorUtils.extractFloor(Integer.parseInt(agvData.getCurrSite())); int floor = FloorUtils.extractFloor(Integer.parseInt(agvData.getCurrSite()));
this.layer = floor; this.layer = floor;

View File

@@ -132,15 +132,5 @@ public class PlcTsjRead implements Runnable {
setIsConnect(false); setIsConnect(false);
} }
public static int writeToSsj(String address, String taskNo, int qx, int completed) {
int jym = Tools.getJYM(Integer.parseInt(taskNo), qx, completed);
SendData taskNoSendData = new SendData(Tools.INT, taskNo);
SendData qxSendData = new SendData(Tools.INT, qx);
SendData completedSendData = new SendData(Tools.INT, completed);
SendData jymSendData = new SendData(Tools.INT, jym);
byte[] bytes = Tools.sendData(taskNoSendData, qxSendData, completedSendData, jymSendData);
return PlcTsjRead.WriteToTSJ(address, bytes);
}
} }

View File

@@ -0,0 +1,105 @@
package com.ruoyi.schedule.scheduleTask.srgv;
import cn.hutool.core.util.ObjUtil;
import com.ruoyi.device.srgv.domain.DeviceSrgv;
import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
import java.util.List;
@Slf4j
public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
public boolean isRun = true;
public HashMap<String, List<DeviceSrgv>> sRgvCodeList;
public void init() {
}
@Override
public void run() {
init();
while (isRun) {
for (String type : sRgvCodeList.keySet()) {
for (DeviceSrgv deviceSrgv : sRgvCodeList.get(type)) {
try {
if (ObjUtil.isNotNull(deviceSrgv)) {
sRgvTask(deviceSrgv);
} else {
log.error("堆垛机设备为空");
}
} catch (RuntimeException e) {
log.error(e.getMessage(), e);
}
}
}
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
/**
* 四向小车任务处理
*/
private void sRgvTask(DeviceSrgv deviceSrgv) {
//处理队列下发
resQueue(deviceSrgv);
//小车完成队列
completeCarTask(deviceSrgv);
//小车发送任务
sendTask(deviceSrgv);
//小车充电任务
inCharging(deviceSrgv);
//小车离开充电桩
outCharging(deviceSrgv);
}
/**
* 小车离开充电桩
*/
private void outCharging(DeviceSrgv deviceSrgv) {
}
/**
* 小车充电任务
*/
private void inCharging(DeviceSrgv deviceSrgv) {
}
/**
* 小车发送任务
*/
private void sendTask(DeviceSrgv deviceSrgv) {
}
/**
* 小车完成队列
*/
private void completeCarTask(DeviceSrgv deviceSrgv) {
}
/**
* 队列处理
* @param deviceSrgv
*/
private void resQueue(DeviceSrgv deviceSrgv) {
}
}

View File

@@ -0,0 +1,4 @@
package com.ruoyi.schedule.scheduleTask.srgv;
public interface SRgvThreadInterface {
}

View File

@@ -0,0 +1,7 @@
package com.ruoyi.schedule.scheduleTask.srgv.impl;
import com.ruoyi.schedule.scheduleTask.srgv.BaseSRgvThread;
public class SRgv1Thread extends BaseSRgvThread {
}

View File

@@ -0,0 +1,7 @@
package com.ruoyi.schedule.scheduleTask.srgv.impl;
import com.ruoyi.schedule.scheduleTask.srgv.BaseSRgvThread;
public class SRgv2Thread extends BaseSRgvThread {
}

View File

@@ -0,0 +1,7 @@
package com.ruoyi.schedule.scheduleTask.srgv.impl;
import com.ruoyi.schedule.scheduleTask.srgv.BaseSRgvThread;
public class SRgv3Thread extends BaseSRgvThread {
}

View File

@@ -0,0 +1,233 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.srgv.mapper.DeviceSrgvMapper">
<resultMap type="DeviceSrgv" id="DeviceSrgvResult">
<result property="guid" column="guid" />
<result property="deviceId" column="device_id" />
<result property="deviceName" column="device_name" />
<result property="ip" column="ip" />
<result property="port" column="port" />
<result property="type" column="type" />
<result property="setFloor" column="set_floor" />
<result property="powerTime" column="power_time" />
<result property="lastTime" column="last_time" />
<result property="agvStatus" column="agv_status" />
<result property="taskNo" column="task_no" />
<result property="srcSite" column="src_site" />
<result property="tarSite" column="tar_site" />
<result property="currSite" column="curr_site" />
<result property="taskType" column="task_type" />
<result property="battery" column="battery" />
<result property="workMode" column="work_mode" />
<result property="alarm" column="alarm" />
<result property="status" column="status" />
<result property="finish" column="finish" />
<result property="chargeFlag" column="charge_flag" />
<result property="workPhase" column="work_phase" />
<result property="errMsg" column="err_msg" />
<result property="ssjRequest" column="ssj_request" />
<result property="changeLayer" column="change_layer" />
<result property="cargoFlag" column="cargo_flag" />
<result property="manualCharge" column="manual_charge" />
<result property="path" column="path" />
<result property="allowSend" column="allow_send" />
<result property="currFloor" column="curr_floor" />
<result property="offlineSite" column="offline_site" />
<result property="locked" column="locked" />
<result property="spare1" column="spare1" />
<result property="spare2" column="spare2" />
<result property="spare3" column="spare3" />
<result property="spare4" column="spare4" />
<result property="spare5" column="spare5" />
</resultMap>
<sql id="selectDeviceSrgvVo">
select guid, device_id, device_name, ip, port, type, set_floor, power_time, last_time, agv_status, task_no, src_site, tar_site, curr_site, task_type, battery, work_mode, alarm, status, finish, charge_flag, work_phase, err_msg, ssj_request, change_layer, cargo_flag, manual_charge, path, allow_send, curr_floor, offline_site, locked, spare1, spare2, spare3, spare4, spare5 from device_srgv
</sql>
<select id="selectDeviceSrgvList" parameterType="DeviceSrgv" resultMap="DeviceSrgvResult">
<include refid="selectDeviceSrgvVo"/>
<where>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="ip != null and ip != ''"> and ip = #{ip}</if>
<if test="port != null "> and port = #{port}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="setFloor != null "> and set_floor = #{setFloor}</if>
<if test="powerTime != null and powerTime != ''"> and power_time = #{powerTime}</if>
<if test="lastTime != null and lastTime != ''"> and last_time = #{lastTime}</if>
<if test="agvStatus != null and agvStatus != ''"> and agv_status = #{agvStatus}</if>
<if test="taskNo != null "> and task_no = #{taskNo}</if>
<if test="srcSite != null and srcSite != ''"> and src_site = #{srcSite}</if>
<if test="tarSite != null and tarSite != ''"> and tar_site = #{tarSite}</if>
<if test="currSite != null and currSite != ''"> and curr_site = #{currSite}</if>
<if test="taskType != null "> and task_type = #{taskType}</if>
<if test="battery != null "> and battery = #{battery}</if>
<if test="workMode != null "> and work_mode = #{workMode}</if>
<if test="alarm != null "> and alarm = #{alarm}</if>
<if test="status != null "> and status = #{status}</if>
<if test="finish != null "> and finish = #{finish}</if>
<if test="chargeFlag != null "> and charge_flag = #{chargeFlag}</if>
<if test="workPhase != null "> and work_phase = #{workPhase}</if>
<if test="errMsg != null "> and err_msg = #{errMsg}</if>
<if test="ssjRequest != null "> and ssj_request = #{ssjRequest}</if>
<if test="changeLayer != null "> and change_layer = #{changeLayer}</if>
<if test="cargoFlag != null "> and cargo_flag = #{cargoFlag}</if>
<if test="manualCharge != null "> and manual_charge = #{manualCharge}</if>
<if test="path != null and path != ''"> and path = #{path}</if>
<if test="allowSend != null "> and allow_send = #{allowSend}</if>
<if test="currFloor != null "> and curr_floor = #{currFloor}</if>
<if test="offlineSite != null and offlineSite != ''"> and offline_site = #{offlineSite}</if>
<if test="locked != null "> and locked = #{locked}</if>
<if test="spare1 != null and spare1 != ''"> and spare1 = #{spare1}</if>
<if test="spare2 != null and spare2 != ''"> and spare2 = #{spare2}</if>
<if test="spare3 != null and spare3 != ''"> and spare3 = #{spare3}</if>
<if test="spare4 != null and spare4 != ''"> and spare4 = #{spare4}</if>
<if test="spare5 != null and spare5 != ''"> and spare5 = #{spare5}</if>
</where>
</select>
<select id="selectDeviceSrgvByGuid" parameterType="String" resultMap="DeviceSrgvResult">
<include refid="selectDeviceSrgvVo"/>
where guid = #{guid}
</select>
<insert id="insertDeviceSrgv" parameterType="DeviceSrgv">
insert into device_srgv
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="guid != null">guid,</if>
<if test="deviceId != null">device_id,</if>
<if test="deviceName != null">device_name,</if>
<if test="ip != null">ip,</if>
<if test="port != null">port,</if>
<if test="type != null">type,</if>
<if test="setFloor != null">set_floor,</if>
<if test="powerTime != null">power_time,</if>
<if test="lastTime != null">last_time,</if>
<if test="agvStatus != null">agv_status,</if>
<if test="taskNo != null">task_no,</if>
<if test="srcSite != null">src_site,</if>
<if test="tarSite != null">tar_site,</if>
<if test="currSite != null">curr_site,</if>
<if test="taskType != null">task_type,</if>
<if test="battery != null">battery,</if>
<if test="workMode != null">work_mode,</if>
<if test="alarm != null">alarm,</if>
<if test="status != null">status,</if>
<if test="finish != null">finish,</if>
<if test="chargeFlag != null">charge_flag,</if>
<if test="workPhase != null">work_phase,</if>
<if test="errMsg != null">err_msg,</if>
<if test="ssjRequest != null">ssj_request,</if>
<if test="changeLayer != null">change_layer,</if>
<if test="cargoFlag != null">cargo_flag,</if>
<if test="manualCharge != null">manual_charge,</if>
<if test="path != null">path,</if>
<if test="allowSend != null">allow_send,</if>
<if test="currFloor != null">curr_floor,</if>
<if test="offlineSite != null">offline_site,</if>
<if test="locked != null">locked,</if>
<if test="spare1 != null">spare1,</if>
<if test="spare2 != null">spare2,</if>
<if test="spare3 != null">spare3,</if>
<if test="spare4 != null">spare4,</if>
<if test="spare5 != null">spare5,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="guid != null">#{guid},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="ip != null">#{ip},</if>
<if test="port != null">#{port},</if>
<if test="type != null">#{type},</if>
<if test="setFloor != null">#{setFloor},</if>
<if test="powerTime != null">#{powerTime},</if>
<if test="lastTime != null">#{lastTime},</if>
<if test="agvStatus != null">#{agvStatus},</if>
<if test="taskNo != null">#{taskNo},</if>
<if test="srcSite != null">#{srcSite},</if>
<if test="tarSite != null">#{tarSite},</if>
<if test="currSite != null">#{currSite},</if>
<if test="taskType != null">#{taskType},</if>
<if test="battery != null">#{battery},</if>
<if test="workMode != null">#{workMode},</if>
<if test="alarm != null">#{alarm},</if>
<if test="status != null">#{status},</if>
<if test="finish != null">#{finish},</if>
<if test="chargeFlag != null">#{chargeFlag},</if>
<if test="workPhase != null">#{workPhase},</if>
<if test="errMsg != null">#{errMsg},</if>
<if test="ssjRequest != null">#{ssjRequest},</if>
<if test="changeLayer != null">#{changeLayer},</if>
<if test="cargoFlag != null">#{cargoFlag},</if>
<if test="manualCharge != null">#{manualCharge},</if>
<if test="path != null">#{path},</if>
<if test="allowSend != null">#{allowSend},</if>
<if test="currFloor != null">#{currFloor},</if>
<if test="offlineSite != null">#{offlineSite},</if>
<if test="locked != null">#{locked},</if>
<if test="spare1 != null">#{spare1},</if>
<if test="spare2 != null">#{spare2},</if>
<if test="spare3 != null">#{spare3},</if>
<if test="spare4 != null">#{spare4},</if>
<if test="spare5 != null">#{spare5},</if>
</trim>
</insert>
<update id="updateDeviceSrgv" parameterType="DeviceSrgv">
update device_srgv
<trim prefix="SET" suffixOverrides=",">
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="ip != null">ip = #{ip},</if>
<if test="port != null">port = #{port},</if>
<if test="type != null">type = #{type},</if>
<if test="setFloor != null">set_floor = #{setFloor},</if>
<if test="powerTime != null">power_time = #{powerTime},</if>
<if test="lastTime != null">last_time = #{lastTime},</if>
<if test="agvStatus != null">agv_status = #{agvStatus},</if>
<if test="taskNo != null">task_no = #{taskNo},</if>
<if test="srcSite != null">src_site = #{srcSite},</if>
<if test="tarSite != null">tar_site = #{tarSite},</if>
<if test="currSite != null">curr_site = #{currSite},</if>
<if test="taskType != null">task_type = #{taskType},</if>
<if test="battery != null">battery = #{battery},</if>
<if test="workMode != null">work_mode = #{workMode},</if>
<if test="alarm != null">alarm = #{alarm},</if>
<if test="status != null">status = #{status},</if>
<if test="finish != null">finish = #{finish},</if>
<if test="chargeFlag != null">charge_flag = #{chargeFlag},</if>
<if test="workPhase != null">work_phase = #{workPhase},</if>
<if test="errMsg != null">err_msg = #{errMsg},</if>
<if test="ssjRequest != null">ssj_request = #{ssjRequest},</if>
<if test="changeLayer != null">change_layer = #{changeLayer},</if>
<if test="cargoFlag != null">cargo_flag = #{cargoFlag},</if>
<if test="manualCharge != null">manual_charge = #{manualCharge},</if>
<if test="path != null">path = #{path},</if>
<if test="allowSend != null">allow_send = #{allowSend},</if>
<if test="currFloor != null">curr_floor = #{currFloor},</if>
<if test="offlineSite != null">offline_site = #{offlineSite},</if>
<if test="locked != null">locked = #{locked},</if>
<if test="spare1 != null">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="spare3 != null">spare3 = #{spare3},</if>
<if test="spare4 != null">spare4 = #{spare4},</if>
<if test="spare5 != null">spare5 = #{spare5},</if>
</trim>
where guid = #{guid}
</update>
<delete id="deleteDeviceSrgvByGuid" parameterType="String">
delete from device_srgv where guid = #{guid}
</delete>
<delete id="deleteDeviceSrgvByGuids" parameterType="String">
delete from device_srgv where guid in
<foreach item="guid" collection="array" open="(" separator="," close=")">
#{guid}
</foreach>
</delete>
</mapper>