调度修改
This commit is contained in:
@@ -0,0 +1,104 @@
|
|||||||
|
package com.ruoyi.bas.fault.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.bas.fault.domain.BasFaultRecord;
|
||||||
|
import com.ruoyi.bas.fault.service.IBasFaultRecordService;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备故障记录Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-16
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/bas/falut")
|
||||||
|
public class BasFaultRecordController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IBasFaultRecordService basFaultRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备故障记录列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:falut:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(BasFaultRecord basFaultRecord)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<BasFaultRecord> list = basFaultRecordService.selectBasFaultRecordList(basFaultRecord);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备故障记录列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:falut:export')")
|
||||||
|
@Log(title = "设备故障记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, BasFaultRecord basFaultRecord)
|
||||||
|
{
|
||||||
|
List<BasFaultRecord> list = basFaultRecordService.selectBasFaultRecordList(basFaultRecord);
|
||||||
|
ExcelUtil<BasFaultRecord> util = new ExcelUtil<BasFaultRecord>(BasFaultRecord.class);
|
||||||
|
util.exportExcel(response, list, "设备故障记录数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备故障记录详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:falut:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(basFaultRecordService.selectBasFaultRecordById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备故障记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:falut:add')")
|
||||||
|
@Log(title = "设备故障记录", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody BasFaultRecord basFaultRecord)
|
||||||
|
{
|
||||||
|
return toAjax(basFaultRecordService.insertBasFaultRecord(basFaultRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备故障记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:falut:edit')")
|
||||||
|
@Log(title = "设备故障记录", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody BasFaultRecord basFaultRecord)
|
||||||
|
{
|
||||||
|
return toAjax(basFaultRecordService.updateBasFaultRecord(basFaultRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备故障记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('bas:falut:remove')")
|
||||||
|
@Log(title = "设备故障记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(basFaultRecordService.deleteBasFaultRecordByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
package com.ruoyi.bas.fault.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备故障记录对象 bas_fault_record
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-16
|
||||||
|
*/
|
||||||
|
public class BasFaultRecord extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** id 主键 */
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/** 设备id */
|
||||||
|
@Excel(name = "设备id")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/** 设备名称 */
|
||||||
|
@Excel(name = "设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/** 设备类型 */
|
||||||
|
@Excel(name = "设备类型")
|
||||||
|
private String deviceType;
|
||||||
|
|
||||||
|
/** 任务号 */
|
||||||
|
@Excel(name = "任务号")
|
||||||
|
private String taskNo;
|
||||||
|
|
||||||
|
/** 作业id */
|
||||||
|
@Excel(name = "作业id ")
|
||||||
|
private String jobId;
|
||||||
|
|
||||||
|
/** 报警信息 */
|
||||||
|
@Excel(name = "报警信息")
|
||||||
|
private String fault;
|
||||||
|
|
||||||
|
/** 报警开始时间 */
|
||||||
|
@Excel(name = "报警开始时间")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
/** 报警结束时间 */
|
||||||
|
@Excel(name = "报警结束时间")
|
||||||
|
private String finishTime;
|
||||||
|
|
||||||
|
public void setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(String deviceId)
|
||||||
|
{
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceId()
|
||||||
|
{
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceName(String deviceName)
|
||||||
|
{
|
||||||
|
this.deviceName = deviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceName()
|
||||||
|
{
|
||||||
|
return deviceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceType(String deviceType)
|
||||||
|
{
|
||||||
|
this.deviceType = deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceType()
|
||||||
|
{
|
||||||
|
return deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskNo(String taskNo)
|
||||||
|
{
|
||||||
|
this.taskNo = taskNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskNo()
|
||||||
|
{
|
||||||
|
return taskNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJobId(String jobId)
|
||||||
|
{
|
||||||
|
this.jobId = jobId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJobId()
|
||||||
|
{
|
||||||
|
return jobId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFault(String fault)
|
||||||
|
{
|
||||||
|
this.fault = fault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFault()
|
||||||
|
{
|
||||||
|
return fault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartTime(String startTime)
|
||||||
|
{
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartTime()
|
||||||
|
{
|
||||||
|
return startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFinishTime(String finishTime)
|
||||||
|
{
|
||||||
|
this.finishTime = finishTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFinishTime()
|
||||||
|
{
|
||||||
|
return finishTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("deviceId", getDeviceId())
|
||||||
|
.append("deviceName", getDeviceName())
|
||||||
|
.append("deviceType", getDeviceType())
|
||||||
|
.append("taskNo", getTaskNo())
|
||||||
|
.append("jobId", getJobId())
|
||||||
|
.append("fault", getFault())
|
||||||
|
.append("startTime", getStartTime())
|
||||||
|
.append("finishTime", getFinishTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.bas.fault.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.bas.fault.domain.BasFaultRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备故障记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-16
|
||||||
|
*/
|
||||||
|
public interface BasFaultRecordMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询设备故障记录
|
||||||
|
*
|
||||||
|
* @param id 设备故障记录主键
|
||||||
|
* @return 设备故障记录
|
||||||
|
*/
|
||||||
|
public BasFaultRecord selectBasFaultRecordById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备故障记录列表
|
||||||
|
*
|
||||||
|
* @param basFaultRecord 设备故障记录
|
||||||
|
* @return 设备故障记录集合
|
||||||
|
*/
|
||||||
|
public List<BasFaultRecord> selectBasFaultRecordList(BasFaultRecord basFaultRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备故障记录
|
||||||
|
*
|
||||||
|
* @param basFaultRecord 设备故障记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBasFaultRecord(BasFaultRecord basFaultRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备故障记录
|
||||||
|
*
|
||||||
|
* @param basFaultRecord 设备故障记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBasFaultRecord(BasFaultRecord basFaultRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备故障记录
|
||||||
|
*
|
||||||
|
* @param id 设备故障记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasFaultRecordById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除设备故障记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasFaultRecordByIds(String[] ids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.bas.fault.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.bas.fault.domain.BasFaultRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备故障记录Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-16
|
||||||
|
*/
|
||||||
|
public interface IBasFaultRecordService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询设备故障记录
|
||||||
|
*
|
||||||
|
* @param id 设备故障记录主键
|
||||||
|
* @return 设备故障记录
|
||||||
|
*/
|
||||||
|
public BasFaultRecord selectBasFaultRecordById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备故障记录列表
|
||||||
|
*
|
||||||
|
* @param basFaultRecord 设备故障记录
|
||||||
|
* @return 设备故障记录集合
|
||||||
|
*/
|
||||||
|
public List<BasFaultRecord> selectBasFaultRecordList(BasFaultRecord basFaultRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备故障记录
|
||||||
|
*
|
||||||
|
* @param basFaultRecord 设备故障记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBasFaultRecord(BasFaultRecord basFaultRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备故障记录
|
||||||
|
*
|
||||||
|
* @param basFaultRecord 设备故障记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBasFaultRecord(BasFaultRecord basFaultRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除设备故障记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的设备故障记录主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasFaultRecordByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备故障记录信息
|
||||||
|
*
|
||||||
|
* @param id 设备故障记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBasFaultRecordById(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.ruoyi.bas.fault.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.bas.fault.mapper.BasFaultRecordMapper;
|
||||||
|
import com.ruoyi.bas.fault.domain.BasFaultRecord;
|
||||||
|
import com.ruoyi.bas.fault.service.IBasFaultRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备故障记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2026-01-16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BasFaultRecordServiceImpl implements IBasFaultRecordService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private BasFaultRecordMapper basFaultRecordMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备故障记录
|
||||||
|
*
|
||||||
|
* @param id 设备故障记录主键
|
||||||
|
* @return 设备故障记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BasFaultRecord selectBasFaultRecordById(String id)
|
||||||
|
{
|
||||||
|
return basFaultRecordMapper.selectBasFaultRecordById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备故障记录列表
|
||||||
|
*
|
||||||
|
* @param basFaultRecord 设备故障记录
|
||||||
|
* @return 设备故障记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BasFaultRecord> selectBasFaultRecordList(BasFaultRecord basFaultRecord)
|
||||||
|
{
|
||||||
|
return basFaultRecordMapper.selectBasFaultRecordList(basFaultRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备故障记录
|
||||||
|
*
|
||||||
|
* @param basFaultRecord 设备故障记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertBasFaultRecord(BasFaultRecord basFaultRecord)
|
||||||
|
{
|
||||||
|
return basFaultRecordMapper.insertBasFaultRecord(basFaultRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备故障记录
|
||||||
|
*
|
||||||
|
* @param basFaultRecord 设备故障记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateBasFaultRecord(BasFaultRecord basFaultRecord)
|
||||||
|
{
|
||||||
|
return basFaultRecordMapper.updateBasFaultRecord(basFaultRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除设备故障记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的设备故障记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBasFaultRecordByIds(String[] ids)
|
||||||
|
{
|
||||||
|
return basFaultRecordMapper.deleteBasFaultRecordByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备故障记录信息
|
||||||
|
*
|
||||||
|
* @param id 设备故障记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBasFaultRecordById(String id)
|
||||||
|
{
|
||||||
|
return basFaultRecordMapper.deleteBasFaultRecordById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ package com.ruoyi.common;
|
|||||||
|
|
||||||
public class Constant {
|
public class Constant {
|
||||||
|
|
||||||
public static final String WMS_BASE_URL = "http://localhost:8080/api2wcs/";
|
public static final String WMS_BASE_URL = "http://172.19.1.117:8080/api2wcs/";
|
||||||
public static final String RCS_BASE_URL = "http://127.0.0.1:8081/rcms-dps/rest/";
|
public static final String RCS_BASE_URL = "http://127.0.0.1:8081/rcms-dps/rest/";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class ScheduleThread {
|
|||||||
private void scheduleInit() {
|
private void scheduleInit() {
|
||||||
MonitoringThread monitoringThread = new MonitoringThread();
|
MonitoringThread monitoringThread = new MonitoringThread();
|
||||||
monitoringCustomThread = new CustomThread<MonitoringThread>(new Thread(monitoringThread), monitoringThread);
|
monitoringCustomThread = new CustomThread<MonitoringThread>(new Thread(monitoringThread), monitoringThread);
|
||||||
Ddj4Thread ddj4Thread = new Ddj4Thread(plcDdj4ReadCustomThread.runnable);
|
Ddj4Thread ddj4Thread = new Ddj4Thread(plcDdj4ReadCustomThread.runnable,plcSsjReadCustomThread.runnable);
|
||||||
ddj4CustomThread = new CustomThread<>(new Thread(ddj4Thread), ddj4Thread);
|
ddj4CustomThread = new CustomThread<>(new Thread(ddj4Thread), ddj4Thread);
|
||||||
/*Ddj2Thread ddj2Thread = new Ddj2Thread();
|
/*Ddj2Thread ddj2Thread = new Ddj2Thread();
|
||||||
ddj2CustomThread = new CustomThread<>(new Thread(ddj2Thread), ddj2Thread);
|
ddj2CustomThread = new CustomThread<>(new Thread(ddj2Thread), ddj2Thread);
|
||||||
@@ -177,6 +177,7 @@ public class ScheduleThread {
|
|||||||
plcDdj2ReadCustomThread.runnable.isRun = false;
|
plcDdj2ReadCustomThread.runnable.isRun = false;
|
||||||
plcDdj3ReadCustomThread.runnable.isRun = false;
|
plcDdj3ReadCustomThread.runnable.isRun = false;
|
||||||
plcDdj4ReadCustomThread.runnable.isRun = false;
|
plcDdj4ReadCustomThread.runnable.isRun = false;
|
||||||
|
plcDdj4ReadCustomThread.thread.interrupt();
|
||||||
plcDdj5ReadCustomThread.runnable.isRun = false;
|
plcDdj5ReadCustomThread.runnable.isRun = false;
|
||||||
plcDdj6ReadCustomThread.runnable.isRun = false;
|
plcDdj6ReadCustomThread.runnable.isRun = false;
|
||||||
plcReadInit();
|
plcReadInit();
|
||||||
@@ -189,13 +190,8 @@ public class ScheduleThread {
|
|||||||
public void stopAllThread2() {
|
public void stopAllThread2() {
|
||||||
monitoringCustomThread.runnable.isRun = false;
|
monitoringCustomThread.runnable.isRun = false;
|
||||||
monitoringCustomThread.thread.interrupt();
|
monitoringCustomThread.thread.interrupt();
|
||||||
ddj1CustomThread.runnable.isRun = false;
|
|
||||||
ddj1CustomThread.thread.interrupt();
|
|
||||||
/*ddj2CustomThread.runnable.isRun = false;
|
|
||||||
ddj3CustomThread.runnable.isRun = false;
|
|
||||||
ddj4CustomThread.runnable.isRun = false;
|
ddj4CustomThread.runnable.isRun = false;
|
||||||
ddj5CustomThread.runnable.isRun = false;
|
ddj4CustomThread.thread.interrupt();
|
||||||
ddj6CustomThread.runnable.isRun = false;*/
|
|
||||||
scheduleInit();
|
scheduleInit();
|
||||||
isRun2 = false;
|
isRun2 = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,9 +74,8 @@ public class PlcDdjRead extends Thread {
|
|||||||
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
|
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
|
||||||
msgDdj.setHeight(ParseUtil.optInt(40, ddsx));
|
msgDdj.setHeight(ParseUtil.optInt(40, ddsx));
|
||||||
String trayCode = ParseUtil.optString(32, 8, ddsx);
|
String trayCode = ParseUtil.optString(32, 8, ddsx);
|
||||||
if (! "11111111".equals(trayCode) && !"NoRead00".equals(trayCode)){
|
|
||||||
msgDdj.setTrayCode(trayCode);
|
msgDdj.setTrayCode(trayCode);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -235,6 +235,14 @@ public class PlcSsjRead implements Runnable {
|
|||||||
return PlcSsjRead.WriteToSSJ(address, bytes);
|
return PlcSsjRead.WriteToSSJ(address, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int writeToSsJ(String address, byte[] data) {
|
||||||
|
int a = 0;
|
||||||
|
if (readWriteNet != null) {
|
||||||
|
a = HslRead.WriteResultRender(readWriteNet.Write(address, data), address);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.ruoyi.api.service.IApiService;
|
|||||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.domain.SendData;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||||
import com.ruoyi.device.ddj.service.IMsgDdjService;
|
import com.ruoyi.device.ddj.service.IMsgDdjService;
|
||||||
@@ -46,19 +47,21 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
private IBasCargoSpaceService basCargoSpaceService;
|
private IBasCargoSpaceService basCargoSpaceService;
|
||||||
public Map<String, List<Integer>> roadwayMap = new HashMap<>();
|
public Map<String, List<Integer>> roadwayMap = new HashMap<>();
|
||||||
private PlcDdjRead plcDdjRead;
|
private PlcDdjRead plcDdjRead;
|
||||||
|
private PlcSsjRead plcSsjRead;
|
||||||
|
|
||||||
public Map<String,String> czRoadwayMap = new HashMap<>();
|
public Map<String, String> czRoadwayMap = new HashMap<>();
|
||||||
|
|
||||||
public BaseDdjThread(PlcDdjRead plcDdjRead) {
|
public BaseDdjThread(PlcDdjRead plcDdjRead,PlcSsjRead plcSsjRead) {
|
||||||
this.plcDdjRead = plcDdjRead;
|
this.plcDdjRead = plcDdjRead;
|
||||||
|
this.plcSsjRead = plcSsjRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String,Integer> roadwayRollback = new HashMap<>();
|
public Map<String, Integer> roadwayRollback = new HashMap<>();
|
||||||
|
|
||||||
public boolean isRun = true;
|
public boolean isRun = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract HashMap<String, Object> getParamMap(String trayCode,Integer height,double weight);
|
public abstract HashMap<String, Object> getParamMap(String trayCode, Integer height, double weight);
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -87,6 +90,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
generateInBoundPickQueue(msgDdj);
|
generateInBoundPickQueue(msgDdj);
|
||||||
generateInBoundLoadQueue(msgDdj);
|
generateInBoundLoadQueue(msgDdj);
|
||||||
generateOutBoundQueue(msgDdj);
|
generateOutBoundQueue(msgDdj);
|
||||||
|
setOutSsjStatus(msgDdj);
|
||||||
ddjTask(msgDdj);
|
ddjTask(msgDdj);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -107,89 +111,104 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setOutSsjStatus(MsgDdj msgDdj) {
|
||||||
|
Long rwh = msgDdj.getRwh();
|
||||||
|
|
||||||
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, msgDdj.getId());
|
||||||
|
if (ddjDeviceExecutionQueue !=null && ddjDeviceExecutionQueue.getDdjxf().equals("1") && (ddjDeviceExecutionQueue.getRwlx().equals(DDJ_RWLX_3)||ddjDeviceExecutionQueue.getRwlx().equals(DDJ_RWLX_4))){
|
||||||
|
DeviceSsj deviceSsj = PlcSsjRead.deviceSsjMap.get(ddjDeviceExecutionQueue.getSpare2());
|
||||||
|
SendData by1 = new SendData(Tools.INT,1);
|
||||||
|
byte[] sendData = Tools.sendData(by1);
|
||||||
|
plcSsjRead.writeToSsJ(deviceSsj.getPlcDbWriteAddress(),sendData);
|
||||||
|
}//else if (ddjDeviceExecutionQueue !=null){
|
||||||
|
// DeviceSsj deviceSsj = PlcSsjRead.deviceSsjMap.get(ddjDeviceExecutionQueue.getSpare2());
|
||||||
|
// SendData by1 = new SendData(Tools.INT,0);
|
||||||
|
// byte[] sendData = Tools.sendData(by1);
|
||||||
|
// plcSsjRead.writeToSsJ(deviceSsj.getPlcDbWriteAddress(),sendData);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建出库队列
|
* 创建出库队列
|
||||||
*/
|
*/
|
||||||
private void generateOutBoundQueue(MsgDdj ddj) {
|
private void generateOutBoundQueue(MsgDdj ddj) {
|
||||||
List<MydoJob> outJobList = mydoJobService.selectMydoJobList(getOutJobParam());
|
List<MydoJob> outJobList = mydoJobService.selectMydoJobList(getOutJobParam());
|
||||||
if (CollUtil.isNotEmpty(outJobList)) {
|
if (CollUtil.isNotEmpty(outJobList)) {
|
||||||
for (MydoJob outJob : outJobList) {
|
MydoJob outJob = outJobList.get(0);
|
||||||
String exitId = outJob.getExitId();
|
String exitId = outJob.getExitId();
|
||||||
|
|
||||||
String outSsj = "";
|
String outSsj = "";
|
||||||
switch (exitId) {
|
switch (exitId) {
|
||||||
case "1":
|
case "1":
|
||||||
List<DeviceSsj> outSsj1 = getDeviceSsjs("outSsj1");
|
List<DeviceSsj> outSsj1 = getDeviceSsjs("outSsj1");
|
||||||
if (outSsj1.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() ==0 && ddj.getHczt()==0 && ddj.getSbzt()==0)) {
|
if (outSsj1.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
||||||
outSsj = outSsj1.get(0).getDeviceCode();
|
outSsj = outSsj1.get(0).getDeviceCode();
|
||||||
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
||||||
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount==0){
|
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
List<DeviceSsj> outSsj2 = getDeviceSsjs("outSsj2");
|
|
||||||
if (outSsj2.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() ==0&& ddj.getHczt()==0 && ddj.getSbzt()==0)) {
|
|
||||||
outSsj = outSsj2.get(0).getDeviceCode();
|
|
||||||
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
|
||||||
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount==0){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "2":
|
|
||||||
List<DeviceSsj> outSsj3 = getDeviceSsjs("outSsj3");
|
|
||||||
if (outSsj3.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() ==0&& ddj.getHczt()==0 && ddj.getSbzt()==0)) {
|
|
||||||
outSsj = outSsj3.get(0).getDeviceCode();
|
|
||||||
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
|
||||||
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount==0){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<DeviceSsj> outSsj4 = getDeviceSsjs("outSsj4");
|
|
||||||
if (outSsj4.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() ==0&& ddj.getHczt()==0 && ddj.getSbzt()==0)) {
|
|
||||||
outSsj = outSsj4.get(0).getDeviceCode();
|
|
||||||
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
|
||||||
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount==0){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
log.error("出库任务出口错误");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("0".equals(outJob.getExecutionPhase()) && StrUtil.isNotEmpty(outSsj)) {
|
|
||||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(outJob.getTaskNo()), ddj.getId());
|
|
||||||
//查询这个站点是否存在任务
|
|
||||||
if (ObjUtil.isNull(ddjQueue) ) {
|
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
|
||||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
|
||||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(outJob.getTaskNo()));
|
|
||||||
ddjDeviceExecutionQueue.setDevName(ddj.getName());
|
|
||||||
ddjDeviceExecutionQueue.setDevId(ddj.getId());
|
|
||||||
ddjDeviceExecutionQueue.setRwzt(0);
|
|
||||||
|
|
||||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(outJob.getCargoSpaceId());
|
|
||||||
ddjDeviceExecutionQueue.setYph(basCargoSpace.getThePlatoon());
|
|
||||||
ddjDeviceExecutionQueue.setYlh(basCargoSpace.getTheColumn());
|
|
||||||
ddjDeviceExecutionQueue.setYch(basCargoSpace.getTheFloor());
|
|
||||||
List<Integer> integers = roadwayMap.get(outSsj);
|
|
||||||
ddjDeviceExecutionQueue.setMbph(integers.get(0));
|
|
||||||
ddjDeviceExecutionQueue.setMblh(integers.get(1));
|
|
||||||
ddjDeviceExecutionQueue.setMbch(integers.get(2));
|
|
||||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
|
||||||
ddjDeviceExecutionQueue.setMlfs(5);
|
|
||||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
|
||||||
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_3);
|
|
||||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
|
||||||
outJob.setStatus("3");
|
|
||||||
outJob.setStartTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
||||||
outJob.setExecutionPhase(TASK_EP_DDJ);
|
|
||||||
mydoJobService.updateMydoJob(outJob);
|
|
||||||
} else {
|
|
||||||
log.info("任务已存在 rwh{}", outJob.getTaskNo());
|
|
||||||
}
|
}
|
||||||
|
List<DeviceSsj> outSsj2 = getDeviceSsjs("outSsj2");
|
||||||
|
if (outSsj2.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
||||||
|
outSsj = outSsj2.get(0).getDeviceCode();
|
||||||
|
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
||||||
|
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
List<DeviceSsj> outSsj3 = getDeviceSsjs("outSsj3");
|
||||||
|
if (outSsj3.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getYxxf() == 1 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
||||||
|
outSsj = outSsj3.get(0).getDeviceCode();
|
||||||
|
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
||||||
|
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<DeviceSsj> outSsj4 = getDeviceSsjs("outSsj4");
|
||||||
|
if (outSsj4.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getYxxf() == 1 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
||||||
|
outSsj = outSsj4.get(0).getDeviceCode();
|
||||||
|
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
||||||
|
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log.error("出库任务出口错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("0".equals(outJob.getExecutionPhase()) && StrUtil.isNotEmpty(outSsj)) {
|
||||||
|
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(outJob.getTaskNo()), ddj.getId());
|
||||||
|
//查询这个站点是否存在任务
|
||||||
|
if (ObjUtil.isNull(ddjQueue)) {
|
||||||
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||||
|
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||||
|
ddjDeviceExecutionQueue.setRwh(Convert.toLong(outJob.getTaskNo()));
|
||||||
|
ddjDeviceExecutionQueue.setDevName(ddj.getName());
|
||||||
|
ddjDeviceExecutionQueue.setDevId(ddj.getId());
|
||||||
|
ddjDeviceExecutionQueue.setRwzt(0);
|
||||||
|
|
||||||
|
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(outJob.getCargoSpaceId());
|
||||||
|
ddjDeviceExecutionQueue.setYph(basCargoSpace.getThePlatoon());
|
||||||
|
ddjDeviceExecutionQueue.setYlh(basCargoSpace.getTheColumn());
|
||||||
|
ddjDeviceExecutionQueue.setYch(basCargoSpace.getTheFloor());
|
||||||
|
List<Integer> integers = roadwayMap.get(outSsj);
|
||||||
|
ddjDeviceExecutionQueue.setMbph(integers.get(0));
|
||||||
|
ddjDeviceExecutionQueue.setMblh(integers.get(1));
|
||||||
|
ddjDeviceExecutionQueue.setMbch(integers.get(2));
|
||||||
|
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||||
|
ddjDeviceExecutionQueue.setMlfs(5);
|
||||||
|
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||||
|
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_3);
|
||||||
|
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||||
|
outJob.setStatus("3");
|
||||||
|
outJob.setStartTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
outJob.setExecutionPhase(TASK_EP_DDJ);
|
||||||
|
mydoJobService.updateMydoJob(outJob);
|
||||||
|
} else {
|
||||||
|
log.info("任务已存在 rwh{}", outJob.getTaskNo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,106 +231,113 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
* 创建入库放货队列
|
* 创建入库放货队列
|
||||||
*/
|
*/
|
||||||
private void generateInBoundLoadQueue(MsgDdj ddj) {
|
private void generateInBoundLoadQueue(MsgDdj ddj) {
|
||||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 0 && ddj.getHczt()==1 && ddj.getYxxf() == 1 && ddj.getHeight()>0) {
|
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 0 && ddj.getHczt() == 1 && ddj.getYxxf() == 1 && ddj.getHeight() > 0) {
|
||||||
//允许下发 联机 有货待机
|
//允许下发 联机 有货待机
|
||||||
if (ddj.getTrayCode() != null && StrUtil.isNotEmpty(ddj.getTrayCode().trim()) && !ddj.getTrayCode().equals("00000000")) {
|
if (ddj.getTrayCode() != null && StrUtil.isNotEmpty(ddj.getTrayCode().trim())) {
|
||||||
MydoJob param = new MydoJob();
|
if ("11111111".equals(ddj.getTrayCode()) || "NoRead00".equalsIgnoreCase(ddj.getTrayCode())){
|
||||||
param.setTrayCode(ddj.getTrayCode());
|
createRollbackQueue(ddj, 1);
|
||||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
|
||||||
MydoJob inJob = null;
|
}else if (!"00000000".equals(ddj.getTrayCode())){
|
||||||
if (CollUtil.isEmpty(mydoJobs)) {
|
String trayCode = ddj.getTrayCode();
|
||||||
//获取 重量spare3
|
trayCode = trayCode.substring(trayCode.length()-4);
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(ddj.getRwh(), ddj.getId());
|
MydoJob param = new MydoJob();
|
||||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)){
|
param.setTrayCode(trayCode);
|
||||||
//请求wms获取任务 并生成队列
|
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
||||||
AjaxResult result = apiService.selectMydoJobByTrayCodeAndEntranceId(getParamMap(ddj.getTrayCode(),Convert.toInt(ddj.getHeight()),Convert.toDouble(ddjDeviceExecutionQueue.getSpare3())));
|
MydoJob inJob = null;
|
||||||
if (result.isSuccess()) {
|
if (CollUtil.isEmpty(mydoJobs)) {
|
||||||
inJob = BeanUtil.toBean(result.get("data"), MydoJob.class);
|
//获取 重量spare3
|
||||||
inJob.setStatus(TASK_STATUS_CREATE);
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(ddj.getRwh(), ddj.getId());
|
||||||
inJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ);
|
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) {
|
||||||
inJob.setRoadwayId(Convert.toStr(ddj.getId()));
|
//请求wms获取任务 并生成队列
|
||||||
inJob.setFaultFlag("0");
|
AjaxResult result = apiService.selectMydoJobByTrayCodeAndEntranceId(getParamMap(trayCode, Convert.toInt(ddj.getHeight()), Convert.toDouble(ddjDeviceExecutionQueue.getSpare3())));
|
||||||
mydoJobService.insertMydoJob(inJob);
|
if (result.isSuccess()) {
|
||||||
} else {
|
inJob = BeanUtil.toBean(result.get("data"), MydoJob.class);
|
||||||
createRollbackQueue(ddj,2);
|
inJob.setStatus(TASK_STATUS_CREATE);
|
||||||
log.error(result.get("msg").toString());
|
inJob.setExecutionPhase(TASK_EP_ROADWAY_SSJ);
|
||||||
|
inJob.setRoadwayId(Convert.toStr(ddj.getId()));
|
||||||
|
inJob.setFaultFlag("0");
|
||||||
|
mydoJobService.insertMydoJob(inJob);
|
||||||
|
} else {
|
||||||
|
createRollbackQueue(ddj, 2);
|
||||||
|
log.error(result.get("msg").toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
inJob = mydoJobs.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
if (ObjUtil.isNotNull(inJob) && inJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) {
|
||||||
inJob = mydoJobs.get(0);
|
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(inJob.getTaskNo()), ddj.getId());
|
||||||
}
|
if (ObjUtil.isNull(ddjQueue)) {
|
||||||
|
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(inJob.getCargoSpaceId());
|
||||||
|
if (ObjUtil.isNotNull(basCargoSpace)) {
|
||||||
|
ddjTaskFinish(ddj.getRwh(), ddj.getId(), 2);
|
||||||
|
|
||||||
if (ObjUtil.isNotNull(inJob) && inJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) {
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(inJob.getTaskNo()), ddj.getId());
|
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||||
if (ObjUtil.isNull(ddjQueue)) {
|
ddjDeviceExecutionQueue.setRwh(Convert.toLong(inJob.getTaskNo()));
|
||||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(inJob.getCargoSpaceId());
|
ddjDeviceExecutionQueue.setDevName(ddj.getName());
|
||||||
if (ObjUtil.isNotNull(basCargoSpace)) {
|
ddjDeviceExecutionQueue.setDevId(ddj.getId());
|
||||||
ddjTaskFinish(ddj.getRwh(), ddj.getId(),2);
|
ddjDeviceExecutionQueue.setRwzt(0);
|
||||||
|
ddjDeviceExecutionQueue.setYph(1);
|
||||||
|
ddjDeviceExecutionQueue.setYlh(1);
|
||||||
|
ddjDeviceExecutionQueue.setYch(1);
|
||||||
|
ddjDeviceExecutionQueue.setMbph(Convert.toInt(basCargoSpace.getThePlatoon()));
|
||||||
|
ddjDeviceExecutionQueue.setMblh(Convert.toInt(basCargoSpace.getTheColumn()));
|
||||||
|
ddjDeviceExecutionQueue.setMbch(Convert.toInt(basCargoSpace.getTheFloor()));
|
||||||
|
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||||
|
ddjDeviceExecutionQueue.setMlfs(5);
|
||||||
|
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||||
|
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_2);
|
||||||
|
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||||
|
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
inJob.setStatus("3");
|
||||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
inJob.setStartTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(inJob.getTaskNo()));
|
inJob.setExecutionPhase(TASK_EP_DDJ);
|
||||||
ddjDeviceExecutionQueue.setDevName(ddj.getName());
|
mydoJobService.updateMydoJob(inJob);
|
||||||
ddjDeviceExecutionQueue.setDevId(ddj.getId());
|
} else {
|
||||||
ddjDeviceExecutionQueue.setRwzt(0);
|
log.error("货位不存在 basCargoSpace{}", inJob.getCargoSpaceId());
|
||||||
ddjDeviceExecutionQueue.setYph(1);
|
}
|
||||||
ddjDeviceExecutionQueue.setYlh(1);
|
} else {
|
||||||
ddjDeviceExecutionQueue.setYch(1);
|
log.info("任务已存在 rwh{}", inJob.getTaskNo());
|
||||||
ddjDeviceExecutionQueue.setMbph(Convert.toInt(basCargoSpace.getThePlatoon()));
|
|
||||||
ddjDeviceExecutionQueue.setMblh(Convert.toInt(basCargoSpace.getTheColumn()));
|
|
||||||
ddjDeviceExecutionQueue.setMbch(Convert.toInt(basCargoSpace.getTheFloor()));
|
|
||||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
|
||||||
ddjDeviceExecutionQueue.setMlfs(5);
|
|
||||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
|
||||||
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_2);
|
|
||||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
|
||||||
|
|
||||||
inJob.setStatus("3");
|
|
||||||
inJob.setStartTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
||||||
inJob.setExecutionPhase(TASK_EP_DDJ);
|
|
||||||
mydoJobService.updateMydoJob(inJob);
|
|
||||||
}else {
|
|
||||||
log.error("货位不存在 basCargoSpace{}",inJob.getCargoSpaceId());
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
log.info("任务已存在 rwh{}", inJob.getTaskNo());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
createRollbackQueue(ddj,1);
|
createRollbackQueue(ddj, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createRollbackQueue(MsgDdj ddj,int type) {
|
private void createRollbackQueue(MsgDdj ddj, int type) {
|
||||||
DdjDeviceExecutionQueue pickQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(ddj.getRwh(), ddj.getId());
|
DdjDeviceExecutionQueue pickQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(ddj.getRwh(), ddj.getId());
|
||||||
if (pickQueue != null){
|
if (pickQueue != null) {
|
||||||
Integer mbph = pickQueue.getYph();
|
Integer mbph = pickQueue.getYph();
|
||||||
Integer mblh = pickQueue.getYlh();
|
Integer mblh = pickQueue.getYlh();
|
||||||
Integer mbch = pickQueue.getYch();
|
Integer mbch = pickQueue.getYch();
|
||||||
String road = "";
|
String road = "";
|
||||||
for (String roadway : roadwayMap.keySet()) {
|
for (String roadway : roadwayMap.keySet()) {
|
||||||
List<Integer> integers = roadwayMap.get(roadway);
|
List<Integer> integers = roadwayMap.get(roadway);
|
||||||
if (integers.get(0).equals(mbph) && integers.get(1).equals(mblh) && integers.get(2).equals(mbch)){
|
if (integers.get(0).equals(mbph) && integers.get(1).equals(mblh) && integers.get(2).equals(mbch)) {
|
||||||
road = roadway;
|
road = roadway;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!roadwayRollback.containsKey(road)){
|
if (!roadwayRollback.containsKey(road)) {
|
||||||
log.error("未找到回滚任务号 p:{} l:{} c:{}",mbph,mblh,mbch);
|
log.error("未找到回滚任务号 p:{} l:{} c:{}", mbph, mblh, mbch);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DeviceSsj roadWay = PlcSsjRead.deviceSsjMap.get(road);
|
DeviceSsj roadWay = PlcSsjRead.deviceSsjMap.get(road);
|
||||||
if (roadWay.getKx()==1){
|
if (roadWay.getKx() == 1) {
|
||||||
long rwh = roadwayRollback.get(road);
|
long rwh = roadwayRollback.get(road);
|
||||||
log.info("扫码失败,放回原位 排:{} 列:{} 层:{} 任务号:{}", mbph, mblh, mbch, rwh);
|
log.info("扫码失败,放回原位 排:{} 列:{} 层:{} 任务号:{}", mbph, mblh, mbch, rwh);
|
||||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||||
if (ObjUtil.isNull(ddjQueue)) {
|
if (ObjUtil.isNull(ddjQueue)) {
|
||||||
ddjTaskFinish(ddj.getRwh(), ddj.getId(),2);
|
ddjTaskFinish(ddj.getRwh(), ddj.getId(), 2);
|
||||||
|
|
||||||
if (type == 2){
|
if (type == 2) {
|
||||||
rwh = rwh+100;
|
rwh = rwh + 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -335,8 +361,8 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
log.error("未找到回滚任务号 rwh{}",ddj.getRwh());
|
log.error("未找到回滚任务号 rwh{}", ddj.getRwh());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -350,13 +376,14 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
for (DeviceSsj ssj : roadSsjList) {
|
for (DeviceSsj ssj : roadSsjList) {
|
||||||
int taskNo = ssj.getTaskNo();
|
int taskNo = ssj.getTaskNo();
|
||||||
int rkqq = ssj.getRkqq();
|
int rkqq = ssj.getRkqq();
|
||||||
if (taskNo > 0 && rkqq == 1) {
|
if (taskNo > 0 && rkqq == 1) {
|
||||||
//todo 连接称重 并保存数据
|
//todo 连接称重 并保存数据
|
||||||
String czDeviceIpPort = czRoadwayMap.get(ssj.getDeviceCode());
|
String czDeviceIpPort = czRoadwayMap.get(ssj.getDeviceCode());
|
||||||
String[] split = czDeviceIpPort.split(":");
|
String[] split = czDeviceIpPort.split(":");
|
||||||
String weight = CheckWeight.sendWeight(split[0], Convert.toInt(split[1]));
|
String weight = CheckWeight.sendWeight(split[0], Convert.toInt(split[1]));
|
||||||
|
Double aDouble = Convert.toDouble(weight);
|
||||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(ssj.getTaskNo()), ddj.getId());
|
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(ssj.getTaskNo()), ddj.getId());
|
||||||
if (ObjUtil.isNull(ddjQueue) ) {
|
if (ObjUtil.isNull(ddjQueue) && aDouble > 0) {
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(ssj.getTaskNo()));
|
ddjDeviceExecutionQueue.setRwh(Convert.toLong(ssj.getTaskNo()));
|
||||||
@@ -393,15 +420,15 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
Long rwh = ddj.getRwh();
|
Long rwh = ddj.getRwh();
|
||||||
//完成作业
|
//完成作业
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)){
|
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)) {
|
||||||
if (ddjDeviceExecutionQueue.getRwlx()==2 || ddjDeviceExecutionQueue.getRwlx()==3 ){
|
if (ddjDeviceExecutionQueue.getRwlx() == 2 || ddjDeviceExecutionQueue.getRwlx() == 3) {
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||||
if (ObjUtil.isNotNull(mydoJob)){
|
if (ObjUtil.isNotNull(mydoJob)) {
|
||||||
//回传完成信号
|
//回传完成信号
|
||||||
ddjTaskFinish(rwh, ddj.getId(),1);
|
ddjTaskFinish(rwh, ddj.getId(), 1);
|
||||||
}
|
}
|
||||||
}else if (ddjDeviceExecutionQueue.getRwlx() == 4){
|
} else if (ddjDeviceExecutionQueue.getRwlx() == 4) {
|
||||||
ddjTaskFinish(rwh, ddj.getId(),2);
|
ddjTaskFinish(rwh, ddj.getId(), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -497,12 +524,12 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//正常下发
|
//正常下发
|
||||||
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5 ) {
|
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5) {
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionRunningQueueParam = new DdjDeviceExecutionQueue();
|
DdjDeviceExecutionQueue ddjDeviceExecutionRunningQueueParam = new DdjDeviceExecutionQueue();
|
||||||
ddjDeviceExecutionRunningQueueParam.setDdjxf("1");
|
ddjDeviceExecutionRunningQueueParam.setDdjxf("1");
|
||||||
|
|
||||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues1 = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionRunningQueueParam);
|
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues1 = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionRunningQueueParam);
|
||||||
if (CollUtil.isNotEmpty(ddjDeviceExecutionQueues1)){
|
if (CollUtil.isNotEmpty(ddjDeviceExecutionQueues1)) {
|
||||||
log.info("正在执行任务 {}", ddjDeviceExecutionQueues1.get(0).getRwh());
|
log.info("正在执行任务 {}", ddjDeviceExecutionQueues1.get(0).getRwh());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -576,8 +603,8 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
* @param rwh 作业单号
|
* @param rwh 作业单号
|
||||||
* @param id 作业单id
|
* @param id 作业单id
|
||||||
*/
|
*/
|
||||||
private void ddjTaskFinish(Long rwh, Integer id,Integer type) {
|
private void ddjTaskFinish(Long rwh, Integer id, Integer type) {
|
||||||
mydoJobService.ddjTaskFinish(rwh, id,type);
|
mydoJobService.ddjTaskFinish(rwh, id, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -601,4 +628,11 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, xfwc, jym);
|
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, xfwc, jym);
|
||||||
return plcDdjRead.WriteToDDJ("DB61.0", sendData);
|
return plcDdjRead.WriteToDDJ("DB61.0", sendData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String a = "00001234";
|
||||||
|
String b = "004567";
|
||||||
|
System.out.println(a.substring(a.length()-4));
|
||||||
|
System.out.println(b.substring(b.length()-4));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static com.ruoyi.common.Constant.ROADWAY_ID_01;
|
import static com.ruoyi.common.Constant.ROADWAY_ID_01;
|
||||||
import static com.ruoyi.common.Constant.WAREHOUSE_01;
|
import static com.ruoyi.common.Constant.WAREHOUSE_01;
|
||||||
@@ -22,49 +23,55 @@ public class Ddj1Thread extends BaseDdjThread {
|
|||||||
|
|
||||||
public volatile boolean isRun = true;
|
public volatile boolean isRun = true;
|
||||||
|
|
||||||
public Ddj1Thread(PlcDdjRead plcDdjRead) {
|
public Ddj1Thread(PlcDdjRead plcDdjRead,PlcSsjRead plcSsjRead) {
|
||||||
super(plcDdjRead);
|
super(plcDdjRead,plcSsjRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
/*super.init();
|
super.init();
|
||||||
ddjCodeList = new HashMap<>();
|
ddjCodeList = new HashMap<>();
|
||||||
ssjList = new HashMap<>();
|
ssjList = new HashMap<>();
|
||||||
ArrayList<MsgDdj> ddjCodes = new ArrayList<>();
|
ArrayList<String> ddjCodes = new ArrayList<>();
|
||||||
ddjCodes.add(PlcDdjRead.deviceDdjMap.get("ddj1"));
|
ddjCodes.add("ddj1");
|
||||||
ddjCodeList.put("ddj", ddjCodes);
|
ddjCodeList.put("ddj", ddjCodes);
|
||||||
ArrayList<DeviceSsj> roadSsjList = new ArrayList<>();
|
ArrayList<String> roadSsjList = new ArrayList<>();
|
||||||
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L2001"));
|
roadSsjList.add("L2001");
|
||||||
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L2002"));
|
roadSsjList.add("L2002");
|
||||||
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L2007"));
|
roadSsjList.add("L2007");
|
||||||
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L2008"));
|
roadSsjList.add("L2008");
|
||||||
ssjList.put("roadSsjList", roadSsjList);
|
ssjList.put("roadSsjList", roadSsjList);
|
||||||
ArrayList<DeviceSsj> outSsj1 = new ArrayList<>();
|
ArrayList<String> outSsj1 = new ArrayList<>();
|
||||||
outSsj1.add(PlcSsjRead.deviceSsjMap.get("L2001"));
|
outSsj1.add("L2001");
|
||||||
ssjList.put("outSsj1", outSsj1);
|
ssjList.put("outSsj1", outSsj1);
|
||||||
ArrayList<DeviceSsj> outSsj2 = new ArrayList<>();
|
ArrayList<String> outSsj2 = new ArrayList<>();
|
||||||
outSsj2.add(PlcSsjRead.deviceSsjMap.get("L2002"));
|
outSsj2.add("L2002");
|
||||||
ssjList.put("outSsj2", outSsj2);
|
ssjList.put("outSsj2", outSsj2);
|
||||||
ArrayList<DeviceSsj> outSsj3 = new ArrayList<>();
|
ArrayList<String> outSsj3 = new ArrayList<>();
|
||||||
outSsj3.add(PlcSsjRead.deviceSsjMap.get("L2007"));
|
outSsj3.add("L2007");
|
||||||
ssjList.put("outSsj3", outSsj3);
|
ssjList.put("outSsj3", outSsj3);
|
||||||
ArrayList<DeviceSsj> outSsj4 = new ArrayList<>();
|
ArrayList<String> outSsj4 = new ArrayList<>();
|
||||||
outSsj4.add(PlcSsjRead.deviceSsjMap.get("L2008"));
|
outSsj4.add("L2008");
|
||||||
ssjList.put("outSsj4", outSsj4);
|
ssjList.put("outSsj4", outSsj4);
|
||||||
|
|
||||||
//初始化巷道口 排 列 层
|
//初始化巷道口 排 列 层
|
||||||
roadwayMap.put("L2001", Arrays.asList(1, 0, 1));
|
roadwayMap.put("L2001", Arrays.asList(1, 0, 1));
|
||||||
roadwayMap.put("L2002", Arrays.asList(2, 0, 1));
|
roadwayMap.put("L2002", Arrays.asList(2, 0, 1));
|
||||||
roadwayMap.put("L2007", Arrays.asList(1, 22, 1));
|
roadwayMap.put("L2007", Arrays.asList(1, 20, 1));
|
||||||
roadwayMap.put("L2008", Arrays.asList(2, 22, 1));
|
roadwayMap.put("L2008", Arrays.asList(2, 20, 1));
|
||||||
roadwayRollback.put("L2001", 80);
|
roadwayRollback.put("L2001", 80);
|
||||||
roadwayRollback.put("L2002", 81);
|
roadwayRollback.put("L2002", 81);
|
||||||
roadwayRollback.put("L2007", 82);
|
roadwayRollback.put("L2007", 82);
|
||||||
roadwayRollback.put("L2008", 83);
|
roadwayRollback.put("L2008", 83);
|
||||||
|
//初始化称重设备连接ip port
|
||||||
|
czRoadwayMap.put("L2001", "172.19.50.72:4001");
|
||||||
|
czRoadwayMap.put("L2002", "172.19.50.72:4001");
|
||||||
|
czRoadwayMap.put("L2007", "172.19.50.73:4001");
|
||||||
|
czRoadwayMap.put("L2008", "172.19.50.74:4001");
|
||||||
|
|
||||||
log.info("Ddj1Thread init");*/
|
|
||||||
|
log.info("Ddj1Thread init");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +97,13 @@ public class Ddj1Thread extends BaseDdjThread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
||||||
return null;
|
List<Integer> integers = roadwayMap.get(exitSsj);
|
||||||
|
DdjDeviceExecutionQueue param = new DdjDeviceExecutionQueue();
|
||||||
|
param.setDevId(1);
|
||||||
|
param.setMbph(integers.get(0));
|
||||||
|
param.setMblh(integers.get(1));
|
||||||
|
param.setMbch(integers.get(2));
|
||||||
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import static com.ruoyi.common.Constant.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class Ddj2Thread extends BaseDdjThread {
|
public class Ddj2Thread extends BaseDdjThread {
|
||||||
|
|
||||||
public Ddj2Thread(PlcDdjRead plcDdjRead) {
|
public Ddj2Thread(PlcDdjRead plcDdjRead,PlcSsjRead plcSsjRead) {
|
||||||
super(plcDdjRead);
|
super(plcDdjRead,plcSsjRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import static com.ruoyi.common.Constant.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class Ddj3Thread extends BaseDdjThread {
|
public class Ddj3Thread extends BaseDdjThread {
|
||||||
|
|
||||||
public Ddj3Thread(PlcDdjRead plcDdjRead) {
|
public Ddj3Thread(PlcDdjRead plcDdjRead,PlcSsjRead plcSsjRead) {
|
||||||
super(plcDdjRead);
|
super(plcDdjRead,plcSsjRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import static com.ruoyi.common.Constant.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class Ddj4Thread extends BaseDdjThread {
|
public class Ddj4Thread extends BaseDdjThread {
|
||||||
|
|
||||||
public Ddj4Thread(PlcDdjRead plcDdjRead) {
|
public Ddj4Thread(PlcDdjRead plcDdjRead,PlcSsjRead plcSsjRead) {
|
||||||
super(plcDdjRead);
|
super(plcDdjRead,plcSsjRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -51,8 +51,8 @@ public class Ddj4Thread extends BaseDdjThread {
|
|||||||
roadwayRollback.put("L1002", 93);
|
roadwayRollback.put("L1002", 93);
|
||||||
|
|
||||||
//初始化称重设备连接ip port
|
//初始化称重设备连接ip port
|
||||||
czRoadwayMap.put("L1001", "192.168.57.101:4001");
|
czRoadwayMap.put("L1001", "172.19.40.203:4001");
|
||||||
czRoadwayMap.put("L1002", "192.168.57.101:4001");
|
czRoadwayMap.put("L1002", "172.19.40.202:4001");
|
||||||
log.info("Ddj4Thread init");
|
log.info("Ddj4Thread init");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import static com.ruoyi.common.Constant.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class Ddj5Thread extends BaseDdjThread {
|
public class Ddj5Thread extends BaseDdjThread {
|
||||||
|
|
||||||
public Ddj5Thread(PlcDdjRead plcDdjRead) {
|
public Ddj5Thread(PlcDdjRead plcDdjRead,PlcSsjRead plcSsjRead) {
|
||||||
super(plcDdjRead);
|
super(plcDdjRead,plcSsjRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import static com.ruoyi.common.Constant.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class Ddj6Thread extends BaseDdjThread {
|
public class Ddj6Thread extends BaseDdjThread {
|
||||||
|
|
||||||
public Ddj6Thread(PlcDdjRead plcDdjRead) {
|
public Ddj6Thread(PlcDdjRead plcDdjRead,PlcSsjRead plcSsjRead) {
|
||||||
super(plcDdjRead);
|
super(plcDdjRead,plcSsjRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
package com.ruoyi.schedule.scheduleTask.monit;
|
package com.ruoyi.schedule.scheduleTask.monit;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.ruoyi.bas.fault.domain.BasFaultRecord;
|
||||||
|
import com.ruoyi.bas.fault.service.IBasFaultRecordService;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
|
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||||
import com.ruoyi.device.ddj.service.IMsgDdjService;
|
import com.ruoyi.device.ddj.service.IMsgDdjService;
|
||||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||||
import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
||||||
@@ -8,6 +15,9 @@ import com.ruoyi.schedule.plcRead.ddj.PlcDdjRead;
|
|||||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监控线程
|
* 监控线程
|
||||||
*/
|
*/
|
||||||
@@ -18,11 +28,13 @@ public class MonitoringThread implements Runnable {
|
|||||||
|
|
||||||
private IDeviceSsjService deviceSsjService;
|
private IDeviceSsjService deviceSsjService;
|
||||||
private IMsgDdjService msgDdjService;
|
private IMsgDdjService msgDdjService;
|
||||||
|
private IBasFaultRecordService basFaultRecordService;
|
||||||
|
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
deviceSsjService = SpringUtils.getBean(IDeviceSsjService.class);
|
deviceSsjService = SpringUtils.getBean(IDeviceSsjService.class);
|
||||||
msgDdjService = SpringUtils.getBean(IMsgDdjService.class);
|
msgDdjService = SpringUtils.getBean(IMsgDdjService.class);
|
||||||
|
basFaultRecordService = SpringUtils.getBean(IBasFaultRecordService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -35,7 +47,38 @@ public class MonitoringThread implements Runnable {
|
|||||||
deviceSsjService.updateDeviceSsj(deviceSsj);
|
deviceSsjService.updateDeviceSsj(deviceSsj);
|
||||||
}
|
}
|
||||||
for (String ddjCode : PlcDdjRead.deviceDdjMap.keySet()) {
|
for (String ddjCode : PlcDdjRead.deviceDdjMap.keySet()) {
|
||||||
msgDdjService.updateMsgDdj(PlcDdjRead.deviceDdjMap.get(ddjCode));
|
MsgDdj msgDdj = PlcDdjRead.deviceDdjMap.get(ddjCode);
|
||||||
|
msgDdjService.updateMsgDdj(msgDdj);
|
||||||
|
if (msgDdj.getSbzt() > 1000) {
|
||||||
|
//查询记录,添加故障开始时间
|
||||||
|
BasFaultRecord param = new BasFaultRecord();
|
||||||
|
param.setTaskNo(Convert.toStr(msgDdj.getRwh()));
|
||||||
|
param.setDeviceId(Convert.toStr(msgDdj.getId()));
|
||||||
|
List<BasFaultRecord> basFaultRecords = basFaultRecordService.selectBasFaultRecordList(param);
|
||||||
|
if (CollUtil.isEmpty(basFaultRecords)){
|
||||||
|
BasFaultRecord record = new BasFaultRecord();
|
||||||
|
record.setId(IdUtil.simpleUUID());
|
||||||
|
record.setDeviceId(Convert.toStr(msgDdj.getId()));
|
||||||
|
record.setDeviceName(msgDdj.getName());
|
||||||
|
record.setDeviceType("ddj");
|
||||||
|
record.setTaskNo(Convert.toStr(msgDdj.getRwh()));
|
||||||
|
record.setStartTime(DateUtil.formatDateTime(new Date()));
|
||||||
|
record.setFault(Convert.toStr(msgDdj.getSbzt()));
|
||||||
|
basFaultRecordService.insertBasFaultRecord(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (msgDdj.getSbzt() < 1000 && msgDdj.getCzfs()==5){
|
||||||
|
//查询记录 更新故障结束时间
|
||||||
|
BasFaultRecord param = new BasFaultRecord();
|
||||||
|
param.setTaskNo(Convert.toStr(msgDdj.getRwh()));
|
||||||
|
param.setDeviceId(Convert.toStr(msgDdj.getId()));
|
||||||
|
List<BasFaultRecord> basFaultRecords = basFaultRecordService.selectBasFaultRecordList(param);
|
||||||
|
if (CollUtil.isNotEmpty(basFaultRecords)){
|
||||||
|
BasFaultRecord record = basFaultRecords.get(0);
|
||||||
|
record.setFinishTime(DateUtil.formatDateTime(new Date()));
|
||||||
|
basFaultRecordService.updateBasFaultRecord(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.ruoyi.schedule.util;
|
package com.ruoyi.schedule.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
@@ -48,8 +50,11 @@ public class CheckWeight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
CheckWeight checkWeight = new CheckWeight();
|
/*CheckWeight checkWeight = new CheckWeight();
|
||||||
System.out.println(checkWeight.sendWeight("192.168.56.101", 4001));
|
System.out.println(checkWeight.sendWeight("172.19.40.203", 4001));
|
||||||
|
System.out.println(checkWeight.sendWeight("172.19.40.202", 4001));*/
|
||||||
|
Double aDouble = Convert.toDouble("-000019");
|
||||||
|
System.out.println(aDouble);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
<?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.bas.fault.mapper.BasFaultRecordMapper">
|
||||||
|
|
||||||
|
<resultMap type="BasFaultRecord" id="BasFaultRecordResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="deviceName" column="device_name" />
|
||||||
|
<result property="deviceType" column="device_type" />
|
||||||
|
<result property="taskNo" column="task_no" />
|
||||||
|
<result property="jobId" column="job_id" />
|
||||||
|
<result property="fault" column="fault" />
|
||||||
|
<result property="startTime" column="start_time" />
|
||||||
|
<result property="finishTime" column="finish_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBasFaultRecordVo">
|
||||||
|
select id, device_id, device_name, device_type, task_no, job_id, fault, start_time, finish_time from bas_fault_record
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectBasFaultRecordList" parameterType="BasFaultRecord" resultMap="BasFaultRecordResult">
|
||||||
|
<include refid="selectBasFaultRecordVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
||||||
|
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
||||||
|
<if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
|
||||||
|
<if test="taskNo != null and taskNo != ''"> and task_no = #{taskNo}</if>
|
||||||
|
<if test="jobId != null and jobId != ''"> and job_id = #{jobId}</if>
|
||||||
|
<if test="fault != null and fault != ''"> and fault = #{fault}</if>
|
||||||
|
<if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
|
||||||
|
<if test="finishTime != null and finishTime != ''"> and finish_time = #{finishTime}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBasFaultRecordById" parameterType="String" resultMap="BasFaultRecordResult">
|
||||||
|
<include refid="selectBasFaultRecordVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertBasFaultRecord" parameterType="BasFaultRecord">
|
||||||
|
insert into bas_fault_record
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="deviceId != null and deviceId != ''">device_id,</if>
|
||||||
|
<if test="deviceName != null and deviceName != ''">device_name,</if>
|
||||||
|
<if test="deviceType != null and deviceType != ''">device_type,</if>
|
||||||
|
<if test="taskNo != null">task_no,</if>
|
||||||
|
<if test="jobId != null">job_id,</if>
|
||||||
|
<if test="fault != null">fault,</if>
|
||||||
|
<if test="startTime != null">start_time,</if>
|
||||||
|
<if test="finishTime != null">finish_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id},</if>
|
||||||
|
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
|
||||||
|
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||||
|
<if test="deviceType != null and deviceType != ''">#{deviceType},</if>
|
||||||
|
<if test="taskNo != null">#{taskNo},</if>
|
||||||
|
<if test="jobId != null">#{jobId},</if>
|
||||||
|
<if test="fault != null">#{fault},</if>
|
||||||
|
<if test="startTime != null">#{startTime},</if>
|
||||||
|
<if test="finishTime != null">#{finishTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBasFaultRecord" parameterType="BasFaultRecord">
|
||||||
|
update bas_fault_record
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
|
||||||
|
<if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
|
||||||
|
<if test="deviceType != null and deviceType != ''">device_type = #{deviceType},</if>
|
||||||
|
<if test="taskNo != null">task_no = #{taskNo},</if>
|
||||||
|
<if test="jobId != null">job_id = #{jobId},</if>
|
||||||
|
<if test="fault != null">fault = #{fault},</if>
|
||||||
|
<if test="startTime != null">start_time = #{startTime},</if>
|
||||||
|
<if test="finishTime != null">finish_time = #{finishTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteBasFaultRecordById" parameterType="String">
|
||||||
|
delete from bas_fault_record where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteBasFaultRecordByIds" parameterType="String">
|
||||||
|
delete from bas_fault_record where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@@ -131,9 +131,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="xtxh != null">xtxh = #{xtxh},</if>
|
<if test="xtxh != null">xtxh = #{xtxh},</if>
|
||||||
<if test="dqxd != null">dqxd = #{dqxd},</if>
|
<if test="dqxd != null">dqxd = #{dqxd},</if>
|
||||||
<if test="hczt != null">hczt = #{hczt},</if>
|
<if test="hczt != null">hczt = #{hczt},</if>
|
||||||
<if test="spare1 != null">spare1 = #{spare1},</if>
|
|
||||||
<if test="spare2 != null">spare2 = #{spare2},</if>
|
|
||||||
<if test="spare3 != null">spare3 = #{spare3},</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
Reference in New Issue
Block a user