wcs调度修改
This commit is contained in:
@@ -22,7 +22,6 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.device.agv.domain.AgvQueue;
|
||||
import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.device.ssj.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.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 输送机Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/device/ssj")
|
||||
public class DeviceSsjController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDeviceSsjService deviceSsjService;
|
||||
|
||||
/**
|
||||
* 查询输送机列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:ssj:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeviceSsj deviceSsj)
|
||||
{
|
||||
startPage();
|
||||
List<DeviceSsj> list = deviceSsjService.selectDeviceSsjList(deviceSsj);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出输送机列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:ssj:export')")
|
||||
@Log(title = "输送机", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DeviceSsj deviceSsj)
|
||||
{
|
||||
List<DeviceSsj> list = deviceSsjService.selectDeviceSsjList(deviceSsj);
|
||||
ExcelUtil<DeviceSsj> util = new ExcelUtil<DeviceSsj>(DeviceSsj.class);
|
||||
util.exportExcel(response, list, "输送机数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取输送机详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:ssj:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(deviceSsjService.selectDeviceSsjById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增输送机
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:ssj:add')")
|
||||
@Log(title = "输送机", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DeviceSsj deviceSsj)
|
||||
{
|
||||
return toAjax(deviceSsjService.insertDeviceSsj(deviceSsj));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改输送机
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:ssj:edit')")
|
||||
@Log(title = "输送机", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DeviceSsj deviceSsj)
|
||||
{
|
||||
return toAjax(deviceSsjService.updateDeviceSsj(deviceSsj));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除输送机
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:ssj:remove')")
|
||||
@Log(title = "输送机", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(deviceSsjService.deleteDeviceSsjByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.ruoyi.device.ssj.domain;
|
||||
|
||||
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
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
public class DeviceSsj extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 设备唯一编码 */
|
||||
@Excel(name = "设备唯一编码")
|
||||
private String deviceCode ;
|
||||
|
||||
/** 设备名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String name ;
|
||||
|
||||
/** 类型 */
|
||||
@Excel(name = "类型")
|
||||
private String type;
|
||||
|
||||
/** 设备IP */
|
||||
@Excel(name = "设备IP")
|
||||
private String ipAddress;
|
||||
|
||||
/** PLC读取地址 */
|
||||
@Excel(name = "PLC读取地址")
|
||||
private String plcDbReadAddress;
|
||||
|
||||
/** 0-F 1-T */
|
||||
@Excel(name = "0-F 1-T")
|
||||
private String isActive;
|
||||
|
||||
/** PLC写入地址 */
|
||||
@Excel(name = "PLC写入地址")
|
||||
private String plcDbWriteAddress;
|
||||
|
||||
/** 入库请求 */
|
||||
@Excel(name = "入库请求")
|
||||
private Integer rkqq;
|
||||
|
||||
/** 空闲 */
|
||||
@Excel(name = "空闲")
|
||||
private Integer kx;
|
||||
|
||||
/** 到位 */
|
||||
@Excel(name = "到位")
|
||||
private Integer dw;
|
||||
|
||||
/** 条码 */
|
||||
@Excel(name = "条码")
|
||||
private String trayCode;
|
||||
|
||||
/** 任务号 */
|
||||
@Excel(name = "任务号")
|
||||
private Integer taskNo;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDeviceCode() {
|
||||
return deviceCode;
|
||||
}
|
||||
|
||||
public void setDeviceCode(String deviceCode) {
|
||||
this.deviceCode = deviceCode;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
public void setIpAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
}
|
||||
|
||||
public String getPlcDbReadAddress() {
|
||||
return plcDbReadAddress;
|
||||
}
|
||||
|
||||
public void setPlcDbReadAddress(String plcDbReadAddress) {
|
||||
this.plcDbReadAddress = plcDbReadAddress;
|
||||
}
|
||||
|
||||
public String getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setIsActive(String isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public String getPlcDbWriteAddress() {
|
||||
return plcDbWriteAddress;
|
||||
}
|
||||
|
||||
public void setPlcDbWriteAddress(String plcDbWriteAddress) {
|
||||
this.plcDbWriteAddress = plcDbWriteAddress;
|
||||
}
|
||||
|
||||
public Integer getRkqq() {
|
||||
return rkqq;
|
||||
}
|
||||
|
||||
public void setRkqq(Integer rkqq) {
|
||||
this.rkqq = rkqq;
|
||||
}
|
||||
|
||||
public Integer getKx() {
|
||||
return kx;
|
||||
}
|
||||
|
||||
public void setKx(Integer kx) {
|
||||
this.kx = kx;
|
||||
}
|
||||
|
||||
public Integer getDw() {
|
||||
return dw;
|
||||
}
|
||||
|
||||
public void setDw(Integer dw) {
|
||||
this.dw = dw;
|
||||
}
|
||||
|
||||
public String getTrayCode() {
|
||||
return trayCode;
|
||||
}
|
||||
|
||||
public void setTrayCode(String trayCode) {
|
||||
this.trayCode = trayCode;
|
||||
}
|
||||
|
||||
public Integer getTaskNo() {
|
||||
return taskNo;
|
||||
}
|
||||
|
||||
public void setTaskNo(Integer taskNo) {
|
||||
this.taskNo = taskNo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.device.ssj.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
|
||||
/**
|
||||
* 输送机Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
public interface DeviceSsjMapper
|
||||
{
|
||||
/**
|
||||
* 查询输送机
|
||||
*
|
||||
* @param id 输送机主键
|
||||
* @return 输送机
|
||||
*/
|
||||
public DeviceSsj selectDeviceSsjById(Long id);
|
||||
|
||||
/**
|
||||
* 查询输送机列表
|
||||
*
|
||||
* @param deviceSsj 输送机
|
||||
* @return 输送机集合
|
||||
*/
|
||||
public List<DeviceSsj> selectDeviceSsjList(DeviceSsj deviceSsj);
|
||||
|
||||
/**
|
||||
* 新增输送机
|
||||
*
|
||||
* @param deviceSsj 输送机
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceSsj(DeviceSsj deviceSsj);
|
||||
|
||||
/**
|
||||
* 修改输送机
|
||||
*
|
||||
* @param deviceSsj 输送机
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceSsj(DeviceSsj deviceSsj);
|
||||
|
||||
/**
|
||||
* 删除输送机
|
||||
*
|
||||
* @param id 输送机主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceSsjById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除输送机
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceSsjByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.device.ssj.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
|
||||
/**
|
||||
* 输送机Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
public interface IDeviceSsjService
|
||||
{
|
||||
/**
|
||||
* 查询输送机
|
||||
*
|
||||
* @param id 输送机主键
|
||||
* @return 输送机
|
||||
*/
|
||||
public DeviceSsj selectDeviceSsjById(Long id);
|
||||
|
||||
/**
|
||||
* 查询输送机列表
|
||||
*
|
||||
* @param deviceSsj 输送机
|
||||
* @return 输送机集合
|
||||
*/
|
||||
public List<DeviceSsj> selectDeviceSsjList(DeviceSsj deviceSsj);
|
||||
|
||||
/**
|
||||
* 新增输送机
|
||||
*
|
||||
* @param deviceSsj 输送机
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceSsj(DeviceSsj deviceSsj);
|
||||
|
||||
/**
|
||||
* 修改输送机
|
||||
*
|
||||
* @param deviceSsj 输送机
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceSsj(DeviceSsj deviceSsj);
|
||||
|
||||
/**
|
||||
* 批量删除输送机
|
||||
*
|
||||
* @param ids 需要删除的输送机主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceSsjByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除输送机信息
|
||||
*
|
||||
* @param id 输送机主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceSsjById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.ruoyi.device.ssj.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.ssj.mapper.DeviceSsjMapper;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
||||
|
||||
/**
|
||||
* 输送机Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-04
|
||||
*/
|
||||
@Service
|
||||
public class DeviceSsjServiceImpl implements IDeviceSsjService
|
||||
{
|
||||
@Autowired
|
||||
private DeviceSsjMapper deviceSsjMapper;
|
||||
|
||||
/**
|
||||
* 查询输送机
|
||||
*
|
||||
* @param id 输送机主键
|
||||
* @return 输送机
|
||||
*/
|
||||
@Override
|
||||
public DeviceSsj selectDeviceSsjById(Long id)
|
||||
{
|
||||
return deviceSsjMapper.selectDeviceSsjById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询输送机列表
|
||||
*
|
||||
* @param deviceSsj 输送机
|
||||
* @return 输送机
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceSsj> selectDeviceSsjList(DeviceSsj deviceSsj)
|
||||
{
|
||||
return deviceSsjMapper.selectDeviceSsjList(deviceSsj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增输送机
|
||||
*
|
||||
* @param deviceSsj 输送机
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDeviceSsj(DeviceSsj deviceSsj)
|
||||
{
|
||||
deviceSsj.setCreateTime(DateUtils.getNowDate());
|
||||
return deviceSsjMapper.insertDeviceSsj(deviceSsj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改输送机
|
||||
*
|
||||
* @param deviceSsj 输送机
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDeviceSsj(DeviceSsj deviceSsj)
|
||||
{
|
||||
return deviceSsjMapper.updateDeviceSsj(deviceSsj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除输送机
|
||||
*
|
||||
* @param ids 需要删除的输送机主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeviceSsjByIds(Long[] ids)
|
||||
{
|
||||
return deviceSsjMapper.deleteDeviceSsjByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除输送机信息
|
||||
*
|
||||
* @param id 输送机主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeviceSsjById(Long id)
|
||||
{
|
||||
return deviceSsjMapper.deleteDeviceSsjById(id);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.ruoyi.schedule;
|
||||
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.PlcConnectInfo;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.CustomThread;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.Ssj;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -14,6 +17,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public class ScheduleThread {
|
||||
|
||||
public CustomThread customThread;
|
||||
@Autowired
|
||||
private IDeviceSsjService deviceSsjService;
|
||||
|
||||
/**
|
||||
* 项目初始化启动
|
||||
@@ -23,10 +28,12 @@ public class ScheduleThread {
|
||||
String ip = "192.168.0.1";
|
||||
int port = 80;
|
||||
PlcConnectInfo ssjPlcConnectInfo = new PlcConnectInfo(ip, port);
|
||||
ConcurrentHashMap<String, SsjDevice>list = new ConcurrentHashMap<>();
|
||||
ConcurrentHashMap<String, DeviceSsj>list = new ConcurrentHashMap<>();
|
||||
//获取要去取的输送机
|
||||
|
||||
|
||||
List<DeviceSsj> deviceSsjs = deviceSsjService.selectDeviceSsjList(new DeviceSsj());
|
||||
for (DeviceSsj deviceSsj : deviceSsjs) {
|
||||
list.put(deviceSsj.getDeviceCode(),deviceSsj);
|
||||
}
|
||||
|
||||
PlcRead plcRead = new PlcRead(list,ssjPlcConnectInfo);
|
||||
Thread plcReadThread = new Thread(plcRead);
|
||||
|
||||
@@ -6,9 +6,9 @@ import HslCommunication.Core.Types.OperateResult;
|
||||
import HslCommunication.Core.Types.OperateResultExOne;
|
||||
import HslCommunication.Profinet.Siemens.SiemensPLCS;
|
||||
import HslCommunication.Profinet.Siemens.SiemensS7Net;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.PlcConnectInfo;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.Ssj;
|
||||
import com.ruoyi.schedule.plcRead.util.ParseUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Slf4j
|
||||
public class PlcRead implements Runnable {
|
||||
|
||||
public static ConcurrentHashMap<String, SsjDevice> deviceMap;
|
||||
public static ConcurrentHashMap<String, DeviceSsj> deviceMap;
|
||||
private volatile boolean running = true;
|
||||
|
||||
public SiemensS7Net siemensS7Net = null;
|
||||
@@ -27,7 +27,7 @@ public class PlcRead implements Runnable {
|
||||
private int port;
|
||||
private boolean success = false;
|
||||
|
||||
public PlcRead(ConcurrentHashMap<String, SsjDevice> deviceMap, PlcConnectInfo plcConnectInfo) {
|
||||
public PlcRead(ConcurrentHashMap<String, DeviceSsj> deviceMap, PlcConnectInfo plcConnectInfo) {
|
||||
this.deviceMap = deviceMap;
|
||||
this.ip = plcConnectInfo.getIp();
|
||||
this.port = plcConnectInfo.getPort();
|
||||
@@ -40,7 +40,7 @@ public class PlcRead implements Runnable {
|
||||
if (IsConnect()) {
|
||||
|
||||
for (String ssjCode : deviceMap.keySet()) {
|
||||
SsjDevice ssjDevice = deviceMap.get(ssjCode);
|
||||
DeviceSsj ssjDevice = deviceMap.get(ssjCode);
|
||||
String readAddress = "";
|
||||
String writeAddress = "";
|
||||
|
||||
@@ -404,6 +404,9 @@ public class PlcRead implements Runnable {
|
||||
continue;
|
||||
}
|
||||
|
||||
ssjDevice.setPlcDbReadAddress(readAddress);
|
||||
ssjDevice.setPlcDbWriteAddress(writeAddress);
|
||||
|
||||
switch (ssjDevice.getType()) {
|
||||
case "1":
|
||||
readPlcOutSsj(ssjDevice);
|
||||
@@ -439,16 +442,14 @@ public class PlcRead implements Runnable {
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcOtherSsj(SsjDevice ssjDevice) {
|
||||
ssjDevice.setPlcReadAddress(ssjDevice.getPlcReadAddress());
|
||||
ssjDevice.setPlcWriteAddress(ssjDevice.getPlcWriteAddress());
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcReadAddress(), Short.parseShort("18"));
|
||||
private void readPlcOtherSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("18"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setEmpty(ParseUtil.optInt(0,ddsx1));
|
||||
ssjDevice.setInPlace(ParseUtil.optInt(1,ddsx1));
|
||||
ssjDevice.setEntryRequest(ParseUtil.optInt(2,ddsx1));
|
||||
ssjDevice.setKx(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setDw(ParseUtil.optInt(1, ddsx1));
|
||||
ssjDevice.setRkqq(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(3, ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||
}
|
||||
@@ -459,16 +460,14 @@ public class PlcRead implements Runnable {
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcInSsj(SsjDevice ssjDevice) {
|
||||
ssjDevice.setPlcReadAddress(ssjDevice.getPlcReadAddress());
|
||||
ssjDevice.setPlcWriteAddress(ssjDevice.getPlcWriteAddress());
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcReadAddress(), Short.parseShort("18"));
|
||||
private void readPlcInSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("18"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setEmpty(ParseUtil.optInt(0,ddsx1));
|
||||
ssjDevice.setInPlace(ParseUtil.optInt(1,ddsx1));
|
||||
ssjDevice.setEntryRequest(ParseUtil.optInt(2,ddsx1));
|
||||
ssjDevice.setKx(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setDw(ParseUtil.optInt(1, ddsx1));
|
||||
ssjDevice.setRkqq(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(3, ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||
}
|
||||
@@ -479,16 +478,14 @@ public class PlcRead implements Runnable {
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcPickSsj(SsjDevice ssjDevice) {
|
||||
ssjDevice.setPlcReadAddress(ssjDevice.getPlcReadAddress());
|
||||
ssjDevice.setPlcWriteAddress(ssjDevice.getPlcWriteAddress());
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcReadAddress(), Short.parseShort("18"));
|
||||
private void readPlcPickSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("18"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setEmpty(ParseUtil.optInt(0,ddsx1));
|
||||
ssjDevice.setInPlace(ParseUtil.optInt(1,ddsx1));
|
||||
ssjDevice.setEntryRequest(ParseUtil.optInt(2,ddsx1));
|
||||
ssjDevice.setKx(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setDw(ParseUtil.optInt(1, ddsx1));
|
||||
ssjDevice.setRkqq(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(3, ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||
}
|
||||
@@ -496,18 +493,17 @@ public class PlcRead implements Runnable {
|
||||
|
||||
/**
|
||||
* 出库输送机
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcOutSsj(SsjDevice ssjDevice) {
|
||||
ssjDevice.setPlcReadAddress(ssjDevice.getPlcReadAddress());
|
||||
ssjDevice.setPlcWriteAddress(ssjDevice.getPlcWriteAddress());
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcReadAddress(), Short.parseShort("18"));
|
||||
private void readPlcOutSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("18"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setEmpty(ParseUtil.optInt(0,ddsx1));
|
||||
ssjDevice.setInPlace(ParseUtil.optInt(1,ddsx1));
|
||||
ssjDevice.setEntryRequest(ParseUtil.optInt(2,ddsx1));
|
||||
ssjDevice.setKx(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setDw(ParseUtil.optInt(1, ddsx1));
|
||||
ssjDevice.setRkqq(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(3, ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SsjDevice {
|
||||
public class Ssj {
|
||||
private String deviceCode;
|
||||
|
||||
private String plcReadAddress;
|
||||
@@ -10,7 +10,9 @@ import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRequest
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.Ssj;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -23,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Component
|
||||
public class InSsjThread {
|
||||
|
||||
public ConcurrentHashMap<String, SsjDevice> deviceMap;
|
||||
public ConcurrentHashMap<String, DeviceSsj> deviceMap;
|
||||
|
||||
@Resource
|
||||
private IApiService apiService;
|
||||
@@ -31,9 +33,20 @@ public class InSsjThread {
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
|
||||
public void inDispatch(SsjDevice inSsjDevice) {
|
||||
public void run(){
|
||||
for (String ssjCode : PlcRead.deviceMap.keySet()) {
|
||||
DeviceSsj deviceSsj = PlcRead.deviceMap.get(ssjCode);
|
||||
if ("3".equals(deviceSsj.getType())){
|
||||
inDispatch(deviceSsj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void inDispatch(DeviceSsj inSsjDevice) {
|
||||
//如果入库请求1 并且 托盘码不为空
|
||||
if (inSsjDevice.getEntryRequest() == 1 && StrUtil.isNotEmpty(inSsjDevice.getTrayCode())) {
|
||||
if (inSsjDevice.getRkqq() == 1 && StrUtil.isNotEmpty(inSsjDevice.getTrayCode())) {
|
||||
//根据入口,查询对应的入库作业
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
//mydoJobParam.setEntranceId(inSsjDevice.getDeviceCode());
|
||||
@@ -103,7 +116,7 @@ public class InSsjThread {
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
private AgvQueue createAgvQueue(SsjDevice ssjDevice, MydoJob mydoJob) {
|
||||
private AgvQueue createAgvQueue(DeviceSsj ssjDevice, MydoJob mydoJob) {
|
||||
//生成ctu执行队列
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
String reqCode = IdUtil.fastSimpleUUID();
|
||||
|
||||
@@ -7,7 +7,9 @@ import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskRequest
|
||||
import com.ruoyi.api.domain.agv.genAgvSchedulingTask.GenAgvSchedulingTaskResponse;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.Ssj;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -20,17 +22,25 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Component
|
||||
public class OutSsjThread {
|
||||
|
||||
public ConcurrentHashMap<String, List<SsjDevice>> deviceMap;
|
||||
public ConcurrentHashMap<String, DeviceSsj> deviceMap;
|
||||
|
||||
@Resource
|
||||
private IApiService apiService;
|
||||
@Resource
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
public void run() {
|
||||
for (String ssjCode : PlcRead.deviceMap.keySet()) {
|
||||
DeviceSsj deviceSsj = PlcRead.deviceMap.get(ssjCode);
|
||||
if ("1".equals(deviceSsj.getType())){
|
||||
outDispatch(deviceSsj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void outDispatch(SsjDevice outSsjDevice) {
|
||||
public void outDispatch(DeviceSsj outSsjDevice) {
|
||||
//输送线出库
|
||||
if (outSsjDevice.getEmpty()==1){
|
||||
if (outSsjDevice.getKx()==1){
|
||||
//查询对应的作业
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
agvQueue.setPositionCode2(outSsjDevice.getDeviceCode());
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.ruoyi.device.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.api.domain.wcs2wms.MydoJob;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.SsjDevice;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.Ssj;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -18,16 +20,24 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Component
|
||||
public class PickSsjTread {
|
||||
|
||||
public ConcurrentHashMap<String, List<SsjDevice>> deviceMap;
|
||||
public ConcurrentHashMap<String, DeviceSsj> deviceMap;
|
||||
|
||||
@Resource
|
||||
private IApiService apiService;
|
||||
@Resource
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
public void run(){
|
||||
for (String ssjCode : PlcRead.deviceMap.keySet()) {
|
||||
DeviceSsj deviceSsj = PlcRead.deviceMap.get(ssjCode);
|
||||
if ("2".equals(deviceSsj.getType())){
|
||||
pickDispatch(deviceSsj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void pickDispatch(SsjDevice pickSsjDevice) {
|
||||
if (pickSsjDevice.getInPlace() == 1 && pickSsjDevice.getTaskNo() > 0){
|
||||
public void pickDispatch(DeviceSsj pickSsjDevice) {
|
||||
if (pickSsjDevice.getDw() == 1 && pickSsjDevice.getTaskNo() > 0){
|
||||
Integer taskNo = pickSsjDevice.getTaskNo();
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setStatus("3");
|
||||
|
||||
115
ruoyi-admin/src/main/resources/mapper/device/DeviceSsjMapper.xml
Normal file
115
ruoyi-admin/src/main/resources/mapper/device/DeviceSsjMapper.xml
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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.ssj.mapper.DeviceSsjMapper">
|
||||
|
||||
<resultMap type="DeviceSsj" id="DeviceSsjResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deviceCode " column="device_code " />
|
||||
<result property="name " column="name " />
|
||||
<result property="type" column="type" />
|
||||
<result property="ipAddress" column="ip_address" />
|
||||
<result property="plcDbReadAddress" column="plc_db_read_address" />
|
||||
<result property="isActive" column="is_active" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="plcDbWriteAddress" column="plc_db_write_address" />
|
||||
<result property="rkqq" column="rkqq" />
|
||||
<result property="kx" column="kx" />
|
||||
<result property="dw" column="dw" />
|
||||
<result property="trayCode" column="tray_code" />
|
||||
<result property="taskNo" column="task_no" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceSsjVo">
|
||||
select id, device_code , name , type, ip_address, plc_db_read_address, is_active, create_time, plc_db_write_address, rkqq, kx, dw, tray_code, task_no from device_ssj
|
||||
</sql>
|
||||
|
||||
<select id="selectDeviceSsjList" parameterType="DeviceSsj" resultMap="DeviceSsjResult">
|
||||
<include refid="selectDeviceSsjVo"/>
|
||||
<where>
|
||||
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode }</if>
|
||||
<if test="name != null and name != ''"> and name = #{name }</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
|
||||
<if test="plcDbReadAddress != null and plcDbReadAddress != ''"> and plc_db_read_address = #{plcDbReadAddress}</if>
|
||||
<if test="isActive != null and isActive != ''"> and is_active = #{isActive}</if>
|
||||
<if test="plcDbWriteAddress != null and plcDbWriteAddress != ''"> and plc_db_write_address = #{plcDbWriteAddress}</if>
|
||||
<if test="rkqq != null and rkqq != ''"> and rkqq = #{rkqq}</if>
|
||||
<if test="kx != null and kx != ''"> and kx = #{kx}</if>
|
||||
<if test="dw != null and dw != ''"> and dw = #{dw}</if>
|
||||
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
|
||||
<if test="taskNo != null and taskNo != ''"> and task_no = #{taskNo}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceSsjById" parameterType="Long" resultMap="DeviceSsjResult">
|
||||
<include refid="selectDeviceSsjVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDeviceSsj" parameterType="DeviceSsj" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into device_ssj
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceCode != null">device_code ,</if>
|
||||
<if test="name != null">name ,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="ipAddress != null">ip_address,</if>
|
||||
<if test="plcDbReadAddress != null">plc_db_read_address,</if>
|
||||
<if test="isActive != null">is_active,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="plcDbWriteAddress != null">plc_db_write_address,</if>
|
||||
<if test="rkqq != null">rkqq,</if>
|
||||
<if test="kx != null">kx,</if>
|
||||
<if test="dw != null">dw,</if>
|
||||
<if test="trayCode != null">tray_code,</if>
|
||||
<if test="taskNo != null">task_no,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceCode != null">#{deviceCode },</if>
|
||||
<if test="name != null">#{name },</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="ipAddress != null">#{ipAddress},</if>
|
||||
<if test="plcDbReadAddress != null">#{plcDbReadAddress},</if>
|
||||
<if test="isActive != null">#{isActive},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="plcDbWriteAddress != null">#{plcDbWriteAddress},</if>
|
||||
<if test="rkqq != null">#{rkqq},</if>
|
||||
<if test="kx != null">#{kx},</if>
|
||||
<if test="dw != null">#{dw},</if>
|
||||
<if test="trayCode != null">#{trayCode},</if>
|
||||
<if test="taskNo != null">#{taskNo},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDeviceSsj" parameterType="DeviceSsj">
|
||||
update device_ssj
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deviceCode != null">device_code = #{deviceCode },</if>
|
||||
<if test="name != null">name = #{name },</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
|
||||
<if test="plcDbReadAddress != null">plc_db_read_address = #{plcDbReadAddress},</if>
|
||||
<if test="isActive != null">is_active = #{isActive},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="plcDbWriteAddress != null">plc_db_write_address = #{plcDbWriteAddress},</if>
|
||||
<if test="rkqq != null">rkqq = #{rkqq},</if>
|
||||
<if test="kx != null">kx = #{kx},</if>
|
||||
<if test="dw != null">dw = #{dw},</if>
|
||||
<if test="trayCode != null">tray_code = #{trayCode},</if>
|
||||
<if test="taskNo != null">task_no = #{taskNo},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeviceSsjById" parameterType="Long">
|
||||
delete from device_ssj where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDeviceSsjByIds" parameterType="String">
|
||||
delete from device_ssj where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user