优化
This commit is contained in:
21
ruoyi-admin/src/main/java/com/ruoyi/MyStartupRunner.java
Normal file
21
ruoyi-admin/src/main/java/com/ruoyi/MyStartupRunner.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import com.ruoyi.schedule.ScheduleThread;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MyStartupRunner implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
private ScheduleThread scheduleThread;
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
// 这里编写项目启动后要执行的方法逻辑
|
||||
//System.out.println("项目启动成功后自动执行此方法");
|
||||
scheduleThread.startAllThread();
|
||||
scheduleThread.startAllThread2();
|
||||
}
|
||||
}
|
||||
@@ -96,14 +96,13 @@ public class AgvController extends BaseController {
|
||||
cancelTaskRequest.setReqCode(IdUtil.fastSimpleUUID());
|
||||
cancelTaskRequest.setReqTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
cancelTaskRequest.setTaskCode(agvQueue.getTaskCode());
|
||||
|
||||
//取消rcs中指定的agv任务
|
||||
CancelTaskResponse cancelTaskResponse = apiService.cancelTask(cancelTaskRequest);
|
||||
|
||||
if(cancelTaskResponse.getCode() == 0 && "成功".equals(cancelTaskResponse.getMessage()) && cancelTaskResponse.getReqCode() == cancelTaskRequest.getReqCode()){
|
||||
if("0".equals(cancelTaskResponse.getCode())){
|
||||
agvQueueService.insertHistory(agvQueue.getReqCode());
|
||||
agvQueueService.deleteAgvQueueByReqCode(agvQueue.getReqCode());
|
||||
return AjaxResult.success("AGV任务队列取消成功!", cancelTaskResponse);
|
||||
}
|
||||
|
||||
return AjaxResult.error("取消RCS-AGV任务队列失败!");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,46 @@ package com.ruoyi.api.domain.agv.cancelTask;
|
||||
import com.ruoyi.api.domain.agv.ResponseBase;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CancelTaskResponse extends ResponseBase {
|
||||
public class CancelTaskResponse implements Serializable {
|
||||
|
||||
/**
|
||||
* 请求编号
|
||||
*/
|
||||
public String reqCode;
|
||||
|
||||
/**
|
||||
* 返回码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 返回消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public String getReqCode() {
|
||||
return reqCode;
|
||||
}
|
||||
|
||||
public void setReqCode(String reqCode) {
|
||||
this.reqCode = reqCode;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.ruoyi.common.Constant.*;
|
||||
import static com.ruoyi.common.TaskStatusCode.TASK_EP_CREATE;
|
||||
@@ -63,7 +61,6 @@ public class ApiServiceImpl implements IApiService {
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 下发agv编码
|
||||
*
|
||||
@@ -75,7 +72,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
RequestLog requestLog = requestLogService.getRequestLog2(GEN_AGV_SCHEDULING_TASK, "生成AGV任务", JSONUtil.toJsonStr(genAgvSchedulingTaskRequest));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(genAgvSchedulingTaskRequest.getTaskCode());
|
||||
if(agvQueue != null){
|
||||
if (agvQueue != null) {
|
||||
agvQueue.setStatus("1");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
}
|
||||
@@ -130,7 +127,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
String wmsTaskNo = param.get("wmsTaskNo");
|
||||
GenAgvSchedulingTaskResponse response = new GenAgvSchedulingTaskResponse();
|
||||
AgvQueue queue = agvQueueService.selectAgvQueueByTaskCode(param.get("taskCode"));
|
||||
if(queue == null){
|
||||
if (queue == null) {
|
||||
AgvQueue agvQueue = createAgvQueue(startPoint, endPoint, param.get("trayCode"), param.get("taskCode"), "1", traySize, wmsTaskNo);
|
||||
response = requestAgvQueue(agvQueue);
|
||||
if (response.getCode() == 0) {
|
||||
@@ -220,26 +217,23 @@ public class ApiServiceImpl implements IApiService {
|
||||
public AjaxResult cancelMydoJob(JobParam jobParam) {
|
||||
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(jobParam.getTaskNo()));
|
||||
if(mydoJob==null){
|
||||
if (mydoJob == null) {
|
||||
return AjaxResult.error("任务不存在");
|
||||
}
|
||||
if("1".equals(mydoJob.getStatus())){
|
||||
mydoJob.setStatus("5");
|
||||
mydoJobService.insertHistory(mydoJob.getJobId());
|
||||
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
|
||||
return AjaxResult.success();
|
||||
}else{
|
||||
return AjaxResult.error("任务已开始");
|
||||
}
|
||||
mydoJob.setStatus("5");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
mydoJob.setFinishTime(sdf.format(new Date()));
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
mydoJobService.insertHistory(mydoJob.getJobId());
|
||||
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult reAssign(JobParam jobParam) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(RE_ASSIGN_URL, "重新分配货位", JSONUtil.toJsonStr(jobParam));
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
|
||||
MydoJob wmsMydoJob = BeanUtil.toBean(bean.getData(), MydoJob.class);
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(wmsMydoJob.getJobId());
|
||||
@@ -253,7 +247,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
@Override
|
||||
public AjaxResult reMaterial(JobParam jobParam) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(RE_MATERIAL_URL, "重新分配物料", JSONUtil.toJsonStr(jobParam));
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
@@ -279,9 +273,9 @@ public class ApiServiceImpl implements IApiService {
|
||||
agvQueue.setReqTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
agvQueue.setAgvType("AGV");
|
||||
agvQueue.setPositionCode1(code1);
|
||||
if("4".equals(traySize) && "L1001".equals(code2)){
|
||||
if ("4".equals(traySize) && "L1001".equals(code2)) {
|
||||
agvQueue.setPositionCode2("L1001-1");
|
||||
}else{
|
||||
} else {
|
||||
agvQueue.setPositionCode2(code2);
|
||||
}
|
||||
|
||||
@@ -379,15 +373,19 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
@Override
|
||||
public AjaxResult receiveOutMydoJob(ReceiveJob receiveOutJob) {
|
||||
List<MydoJob> outList = mydoJobService.getJobById(receiveOutJob.getJobId());
|
||||
if (outList != null && outList.size() > 0) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setJobId(receiveOutJob.getJobId());
|
||||
mydoJob.setTaskNo(receiveOutJob.getTaskNo());
|
||||
mydoJob.setCargoSpaceId(receiveOutJob.getCargoSpaceId());
|
||||
|
||||
if("L2002".equals(receiveOutJob.getExitId()) || "L2008".equals(receiveOutJob.getExitId())
|
||||
if ("L2002".equals(receiveOutJob.getExitId()) || "L2008".equals(receiveOutJob.getExitId())
|
||||
|| "L2004".equals(receiveOutJob.getExitId()) || "L2006".equals(receiveOutJob.getExitId())) {
|
||||
mydoJob.setExitId("1");
|
||||
}else{
|
||||
} else {
|
||||
mydoJob.setExitId(receiveOutJob.getExitId());
|
||||
}
|
||||
mydoJob.setInOrOut(receiveOutJob.getInOrOut());
|
||||
@@ -401,7 +399,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
int i = mydoJobService.insertMydoJob(mydoJob);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success();
|
||||
}else{
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@@ -422,7 +420,8 @@ public class ApiServiceImpl implements IApiService {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
//todo 新增agv站点
|
||||
|
||||
//todo 新增agv站点
|
||||
@Override
|
||||
public AjaxResult deleteAgvTray(AgvQueue agvQueue) {
|
||||
Map<String, String> paramMap = new HashMap<>();
|
||||
@@ -430,13 +429,13 @@ public class ApiServiceImpl implements IApiService {
|
||||
paramMap.put("ctnrTyp", agvQueue.getCtnrType());
|
||||
paramMap.put("ctnrCode", agvQueue.getCtnrCode());
|
||||
|
||||
if("L1001".equals(agvQueue.getPositionCode2())){
|
||||
if ("L1001".equals(agvQueue.getPositionCode2())) {
|
||||
paramMap.put("stgBinCode", "JT000307001013");
|
||||
}
|
||||
if("L1003".equals(agvQueue.getPositionCode2())){
|
||||
if ("L1003".equals(agvQueue.getPositionCode2())) {
|
||||
paramMap.put("stgBinCode", "JT000206001013");
|
||||
}
|
||||
if("L1001-1".equals(agvQueue.getPositionCode2())){
|
||||
if ("L1001-1".equals(agvQueue.getPositionCode2())) {
|
||||
paramMap.put("stgBinCode", "JT000407001013");
|
||||
}
|
||||
// paramMap.put("binName", agvQueue.getPositionCode2());
|
||||
@@ -444,10 +443,10 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog2(DELETE_BIN_URL, "AGV解绑容器", JSONUtil.toJsonStr(paramMap));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
log.info("站点:"+agvQueue.getPositionCode2()+"{}AGV容器解绑成功!");
|
||||
log.info("站点:" + agvQueue.getPositionCode2() + "{}AGV容器解绑成功!");
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
log.info("站点:"+agvQueue.getPositionCode2()+"{}AGV容器解绑失败!");
|
||||
log.info("站点:" + agvQueue.getPositionCode2() + "{}AGV容器解绑失败!");
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
@@ -484,9 +483,9 @@ public class ApiServiceImpl implements IApiService {
|
||||
@Override
|
||||
public AjaxResult updateWcsPort(WcsPort wcsPort) {
|
||||
int i = wcsPortService.updateWcsPort(wcsPort);
|
||||
if(i>0){
|
||||
if (i > 0) {
|
||||
return AjaxResult.success();
|
||||
}else{
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.ruoyi.bas.sysDateConfig.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysDateConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String configId;
|
||||
private String sysDate;
|
||||
|
||||
public String getConfigId() {
|
||||
return configId;
|
||||
}
|
||||
|
||||
public void setConfigId(String configId) {
|
||||
this.configId = configId;
|
||||
}
|
||||
|
||||
public String getSysDate() {
|
||||
return sysDate;
|
||||
}
|
||||
|
||||
public void setSysDate(String sysDate) {
|
||||
this.sysDate = sysDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysDateConfig{" +
|
||||
"configId='" + configId + '\'' +
|
||||
", sysDate='" + sysDate + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ruoyi.bas.sysDateConfig.mapper;
|
||||
|
||||
import com.ruoyi.bas.sysDateConfig.domain.SysDateConfig;
|
||||
|
||||
public interface SysDateConfigMapper {
|
||||
|
||||
SysDateConfig getMsgById(String configId);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ruoyi.bas.sysDateConfig.service;
|
||||
|
||||
import com.ruoyi.bas.sysDateConfig.domain.SysDateConfig;
|
||||
|
||||
public interface SysDateConfigService {
|
||||
|
||||
SysDateConfig getMsgById(String number);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.bas.sysDateConfig.service.impl;
|
||||
|
||||
import com.ruoyi.bas.sysDateConfig.domain.SysDateConfig;
|
||||
import com.ruoyi.bas.sysDateConfig.mapper.SysDateConfigMapper;
|
||||
import com.ruoyi.bas.sysDateConfig.service.SysDateConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class SysDateConfigServiceImpl implements SysDateConfigService {
|
||||
|
||||
@Autowired
|
||||
private SysDateConfigMapper sysDateConfigMapper;
|
||||
|
||||
@Override
|
||||
public SysDateConfig getMsgById(String configId) {
|
||||
return sysDateConfigMapper.getMsgById(configId);
|
||||
}
|
||||
}
|
||||
@@ -114,4 +114,15 @@ public class MydoJobController extends BaseController
|
||||
{
|
||||
return mydoJobService.OuthandFinish(jobIds);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyPermi('job:mydoJob:confirmOut')")
|
||||
@Log(title = "手动出库", businessType = BusinessType.INSERT)
|
||||
@RequestMapping("/confirmOut")
|
||||
public AjaxResult confirmOut(@RequestParam("thePlatoon")String thePlatoon,
|
||||
@RequestParam("theColumn") String theColumn,
|
||||
@RequestParam("theFloor") String theFloor,
|
||||
@RequestParam("exitId") String exitId)
|
||||
{
|
||||
return mydoJobService.confirmOut(thePlatoon,theColumn,theFloor,exitId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,4 +92,10 @@ public interface MydoJobMapper
|
||||
List<MydoJob> getInJobByEntranceId(@Param("entranceId") String exitId);
|
||||
|
||||
MydoJob selectMydoJobByExitId(@Param("exitId") String exitId);
|
||||
|
||||
List<MydoJob> getJobById(@Param("jobId") String jobId);
|
||||
|
||||
void confirmOutJob(HashMap<String, Object> map);
|
||||
|
||||
List<MydoJob> getInJobByRoadAndFloor(@Param("entranceId") String entranceId, @Param("roadwayId") String roadwayId);
|
||||
}
|
||||
|
||||
@@ -91,4 +91,10 @@ public interface IMydoJobService
|
||||
List<MydoJob> getInJobByEntranceId(String exitId);
|
||||
|
||||
MydoJob selectMydoJobByExitId(String exitId);
|
||||
|
||||
List<MydoJob> getJobById(String jobId);
|
||||
|
||||
AjaxResult confirmOut(String thePlatoon, String theColumn, String theFloor,String exitId);
|
||||
|
||||
List<MydoJob> getInJobByRoadAndFloor(String entranceId, String roadwayId);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class JobCallBackServiceImpl implements IJobCallBackService
|
||||
param.put("taskNo", jobCallBack.getTaskNo());
|
||||
param.put("wmsType", jobCallBack.getType());
|
||||
RequestLog requestLog = apiService.finishMydoJob(param);
|
||||
if ("0".equals(requestLog.getIsSuccessful())){
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
jobCallBack.setStatus("1");
|
||||
jobCallBackMapper.updateJobCallBack(jobCallBack);
|
||||
}else{
|
||||
|
||||
@@ -202,6 +202,31 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
return mydoJobMapper.selectMydoJobByExitId(exitId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MydoJob> getJobById(String jobId) {
|
||||
return mydoJobMapper.getJobById(jobId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult confirmOut(String thePlatoon, String theColumn, String theFloor,String exitId) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_the_platoon", thePlatoon);
|
||||
map.put("v_the_column", theColumn);
|
||||
map.put("v_the_floor", theFloor);
|
||||
map.put("v_exit_id", exitId);
|
||||
mydoJobMapper.confirmOutJob(map);
|
||||
if (Convert.toInt(map.get("v_result"))==10){
|
||||
return AjaxResult.success("出库成功!");
|
||||
}else {
|
||||
return AjaxResult.error(map.get("v_resultMsg").toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MydoJob> getInJobByRoadAndFloor(String entranceId, String roadwayId) {
|
||||
return mydoJobMapper.getInJobByRoadAndFloor(entranceId,roadwayId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MydoJob> selectMydoJobFinishList(MydoJob mydoJob) {
|
||||
return mydoJobMapper.selectMydoJobFinishList(mydoJob);
|
||||
|
||||
@@ -64,4 +64,8 @@ public interface DdjDeviceExecutionQueueMapper
|
||||
List<DdjDeviceExecutionQueue> selectDdjDeviceExecutionQueueListByRwlx(@Param("rwlx")Integer rwlx,@Param("devId") Integer devId);
|
||||
|
||||
DdjDeviceExecutionQueue selectDdjDeviceExecutionQueueByRwhAndXd(@Param("rwh") Long rwh, @Param("devId") Integer devId);
|
||||
|
||||
void insertFinish(DdjDeviceExecutionQueue ddjDeviceExecutionQueue);
|
||||
|
||||
void deleteQueue(DdjDeviceExecutionQueue ddjDeviceExecutionQueue);
|
||||
}
|
||||
|
||||
@@ -62,4 +62,6 @@ public interface IDdjDeviceExecutionQueueService
|
||||
DdjDeviceExecutionQueue selectDdjDeviceExecutionQueueByRwh(Long rwh,Integer devId);
|
||||
|
||||
List<DdjDeviceExecutionQueue> selectDdjDeviceExecutionQueueListByRwlx(Integer rwlx,Integer devId);
|
||||
|
||||
void delQueue(DdjDeviceExecutionQueue ddjDeviceExecutionQueue);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.ruoyi.queue.ddj.service.impl;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -102,4 +104,13 @@ public class DdjDeviceExecutionQueueServiceImpl implements IDdjDeviceExecutionQu
|
||||
public List<DdjDeviceExecutionQueue> selectDdjDeviceExecutionQueueListByRwlx(Integer rwlx,Integer devId) {
|
||||
return ddjDeviceExecutionQueueMapper.selectDdjDeviceExecutionQueueListByRwlx(rwlx,devId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delQueue(DdjDeviceExecutionQueue ddjDeviceExecutionQueue) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
ddjDeviceExecutionQueue.setRwzt(5);
|
||||
ddjDeviceExecutionQueue.setJssj(sdf.format(new Date()));
|
||||
ddjDeviceExecutionQueueMapper.insertFinish(ddjDeviceExecutionQueue);
|
||||
ddjDeviceExecutionQueueMapper.deleteQueue(ddjDeviceExecutionQueue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ public class ScheduleThread {
|
||||
scheduleInit();
|
||||
log.info("调度服务执行成功");
|
||||
|
||||
startAllThread();
|
||||
startAllThread2();
|
||||
//startAllThread();
|
||||
//startAllThread2();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -114,8 +114,8 @@ public class PlcDdj1Read extends Thread {
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
if (readWriteNet != null) {
|
||||
readWriteNet.ConnectClose();
|
||||
if (siemensS7Net != null) {
|
||||
siemensS7Net.ConnectClose();
|
||||
}
|
||||
setIsConnect(false);
|
||||
}
|
||||
|
||||
@@ -114,8 +114,8 @@ public class PlcDdj2Read extends Thread {
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
if (readWriteNet != null) {
|
||||
readWriteNet.ConnectClose();
|
||||
if (siemensS7Net != null) {
|
||||
siemensS7Net.ConnectClose();
|
||||
}
|
||||
setIsConnect(false);
|
||||
}
|
||||
|
||||
@@ -190,11 +190,6 @@ public class PlcSsjRead implements Runnable {
|
||||
byte[] content = trayCodeRead.Content;
|
||||
//去除bytes中
|
||||
ssjDevice.setTrayCode(ParseUtil.filterAndConvert(trayCodeRead.Content));
|
||||
// if("L2004".equals(ssjDevice.getDeviceCode())){
|
||||
// ssjDevice.setTrayCode("gMODEL:1 COLOR:1 SERIAL:2 V:1 Hz:1 PH:1 N.W.:1 G.W.:1 ITEM_CODE:12345 @:1$S0T0S1T0S1T0S1T0$40001015202@");
|
||||
// }else{
|
||||
// ssjDevice.setTrayCode("gMODEL:1 COLOR:1 SERIAL:1 V:1 Hz:1 PH:1 N.W.:1 G.W.:1 ITEM_CODE:123456 @:1$S0T0S1T0S1T0S1T0$40001015202@");
|
||||
// }
|
||||
}
|
||||
}
|
||||
OperateResultExOne<byte[]> agvSsjTask = readWriteNet.Read("DB501.280", Short.parseShort("16"));
|
||||
@@ -258,8 +253,8 @@ public class PlcSsjRead implements Runnable {
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
if (readWriteNet != null) {
|
||||
readWriteNet.ConnectClose();
|
||||
if (siemensS7Net != null) {
|
||||
siemensS7Net.ConnectClose();
|
||||
}
|
||||
setIsConnect(false);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.ruoyi.api.domain.wcs2wms.JobParam;
|
||||
import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.bas.sysDateConfig.domain.SysDateConfig;
|
||||
import com.ruoyi.bas.sysDateConfig.service.SysDateConfigService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||
@@ -21,7 +23,10 @@ import com.ruoyi.schedule.plcRead.ddj.PlcDdj2Read;
|
||||
import com.ruoyi.schedule.plcRead.util.Tools;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@@ -36,6 +41,7 @@ public class DdjThread implements Runnable {
|
||||
private IDdjDeviceExecutionQueueFinishService ddjDeviceExecutionQueueFinishService;
|
||||
private IMydoJobService mydoJobService;
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
private SysDateConfigService sysDateConfigService;
|
||||
|
||||
public boolean isRun = true;
|
||||
|
||||
@@ -53,6 +59,7 @@ public class DdjThread implements Runnable {
|
||||
ddjDeviceExecutionQueueFinishService = SpringUtils.getBean(IDdjDeviceExecutionQueueFinishService.class);
|
||||
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
|
||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
||||
sysDateConfigService = SpringUtils.getBean(SysDateConfigService.class);
|
||||
log.info("初始化服务 {},{},{},{}", apiService, ddjDeviceExecutionQueueService, ddjDeviceExecutionQueueFinishService,mydoJobService);
|
||||
}
|
||||
|
||||
@@ -62,20 +69,35 @@ public class DdjThread implements Runnable {
|
||||
while (isRun) {
|
||||
for (String type : ddjCodeList.keySet()) {
|
||||
|
||||
if ("ddj".equals(type)) {
|
||||
for (String ddjCode : ddjCodeList.get(type)) {
|
||||
try {
|
||||
if ("ddj1".equals(ddjCode)) {
|
||||
ddjTask(PlcDdj1Read.deviceDdjMap.get(ddjCode));
|
||||
}
|
||||
//PlcDdj2Read.deviceDdjMap.containsKey(ddjCode)
|
||||
if ("ddj2".equals(ddjCode)) {
|
||||
ddjTask(PlcDdj2Read.deviceDdjMap.get(ddjCode));
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
SysDateConfig sysDateConfig = sysDateConfigService.getMsgById("1");
|
||||
if(sysDateConfig != null){
|
||||
String configDate = sysDateConfig.getSysDate();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date inputDate = null;
|
||||
try {
|
||||
inputDate = sdf.parse(configDate);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Date currentDate = new Date(); // 当前时间
|
||||
int comparison = inputDate.compareTo(currentDate);
|
||||
if(comparison > 0) {
|
||||
if ("ddj".equals(type)) {
|
||||
for (String ddjCode : ddjCodeList.get(type)) {
|
||||
try {
|
||||
if ("ddj1".equals(ddjCode)) {
|
||||
ddjTask(PlcDdj1Read.deviceDdjMap.get(ddjCode));
|
||||
}
|
||||
//PlcDdj2Read.deviceDdjMap.containsKey(ddjCode)
|
||||
if ("ddj2".equals(ddjCode)) {
|
||||
ddjTask(PlcDdj2Read.deviceDdjMap.get(ddjCode));
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,9 +121,14 @@ public class DdjThread implements Runnable {
|
||||
//完成作业
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh,ddj.getId());
|
||||
if (mydoJob != null && ddjDeviceExecutionQueue != null) {
|
||||
if (ddjDeviceExecutionQueue != null) {
|
||||
//回传完成信号
|
||||
ddjTaskFinish(rwh, ddj.getId());
|
||||
if(mydoJob != null){
|
||||
ddjTaskFinish(rwh, ddj.getId());
|
||||
}else{
|
||||
ddjDeviceExecutionQueueService.delQueue(ddjDeviceExecutionQueue);
|
||||
}
|
||||
|
||||
log.info("堆垛机:"+ddj.getId()+"任务完成,任务号:"+ddj.getRwh());
|
||||
}
|
||||
}
|
||||
@@ -131,24 +158,25 @@ public class DdjThread implements Runnable {
|
||||
Long rwh = ddj.getRwh();
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||
if ("0".equals(mydoJob.getFaultFlag()) && "1".equals(ddjDeviceExecutionQueue.getSpare1())) {
|
||||
mydoJob.setStatus("1");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
AjaxResult ajaxResult = apiService.reAssign(new JobParam(mydoJob.getJobId(), mydoJob.getTrayCode(), mydoJob.getTaskNo()));
|
||||
if (ajaxResult.isSuccess()){
|
||||
mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
mydoJob.setFaultFlag("2");
|
||||
if(mydoJob != null && Integer.parseInt(mydoJob.getInOrOut()) < 20){
|
||||
if ("0".equals(mydoJob.getFaultFlag()) && "1".equals(ddjDeviceExecutionQueue.getSpare1())) {
|
||||
mydoJob.setStatus("1");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
ddjDeviceExecutionQueue.setMbph(basCargoSpace.getThePlatoon());
|
||||
ddjDeviceExecutionQueue.setMblh(basCargoSpace.getTheColumn());
|
||||
ddjDeviceExecutionQueue.setMbch(basCargoSpace.getTheFloor());
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
AjaxResult ajaxResult = apiService.reAssign(new JobParam(mydoJob.getJobId(), mydoJob.getTrayCode(), mydoJob.getTaskNo()));
|
||||
if (ajaxResult.isSuccess()){
|
||||
mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
mydoJob.setFaultFlag("2");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
ddjDeviceExecutionQueue.setMbph(basCargoSpace.getThePlatoon());
|
||||
ddjDeviceExecutionQueue.setMblh(basCargoSpace.getTheColumn());
|
||||
ddjDeviceExecutionQueue.setMbch(basCargoSpace.getTheFloor());
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueueService.updateDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
第四部分
|
||||
取货无货,重新分配单据
|
||||
@@ -201,7 +229,6 @@ public class DdjThread implements Runnable {
|
||||
Long rwh = ddj.getRwh();
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueueRunningParam = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueueRunningParam.setDdjxf("1");
|
||||
//ddjDeviceExecutionQueueRunningParam.setSpare1("1");
|
||||
ddjDeviceExecutionQueueRunningParam.setDevId(ddj.getId());
|
||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionRunningQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueueRunningParam);
|
||||
if (CollUtil.isNotEmpty(ddjDeviceExecutionRunningQueues)) {
|
||||
@@ -268,7 +295,16 @@ public class DdjThread implements Runnable {
|
||||
int mbch = Convert.toInt(queue.getMbch());
|
||||
int mlfs = 5;
|
||||
int xfwc = 1;
|
||||
int hwlx = Convert.toInt(queue.getSpare1());
|
||||
int hwlx = 4;
|
||||
if(queue.getSpare1() != null && !"".equals(queue.getSpare1())){
|
||||
hwlx = Convert.toInt(queue.getSpare1());
|
||||
}else{
|
||||
if(devId == 1){
|
||||
hwlx = 4;
|
||||
}else{
|
||||
hwlx = 1;
|
||||
}
|
||||
}
|
||||
int jym = Tools.getJYM(taskNo, yph, ylh, ych, mbph, mblh, mbch, mlfs, hwlx);
|
||||
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, hwlx, xfwc, jym);
|
||||
if (devId==1){
|
||||
|
||||
@@ -141,6 +141,14 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
agvQueueService.updateAgvQueue(agvQueue1);
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("AGV放货完成,等待AGV退出输送机!");
|
||||
Thread.sleep(5000);
|
||||
log.info("AGV放货完成,AGV退出输送机结束!");
|
||||
} catch (InterruptedException e) {
|
||||
log.info("AGV放货完成,等待AGV退出输送机异常!");
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if("L1001".equals(inSsjDevice.getDeviceCode())) {
|
||||
int i = writeToSsj("DB802.100", agvQueues.get(0).getWmsTaskNo(), 2,Integer.parseInt(agvQueues.get(0).getCtnrCode()));
|
||||
if (i == 1) {
|
||||
|
||||
@@ -146,27 +146,22 @@ public class Floor2RoadWaySsjThread implements Runnable {
|
||||
}
|
||||
|
||||
if(roadSsjDevice.getKx()==1 && roadSsjDevice.getTaskNo() == 0){
|
||||
// List<String> exitList = new ArrayList<>();
|
||||
// if("L1002".equals(roadSsjDevice.getDeviceCode())){
|
||||
// exitList.add("L1001");
|
||||
// }
|
||||
// if("L1004".equals(roadSsjDevice.getDeviceCode())){
|
||||
// exitList.add("L1003");
|
||||
// }
|
||||
// List<MydoJob> inList = mydoJobService.getInJobByEntrance(exitList);
|
||||
String exitId = "";
|
||||
String roadwayId = "";
|
||||
String entranceId = "G1005";
|
||||
if("L1002".equals(roadSsjDevice.getDeviceCode())){
|
||||
exitId = "L1001";
|
||||
roadwayId = "1";
|
||||
}
|
||||
if("L1004".equals(roadSsjDevice.getDeviceCode())){
|
||||
exitId = "L1003";
|
||||
roadwayId = "2";
|
||||
}
|
||||
|
||||
List<MydoJob> inList = mydoJobService.getInJobByEntranceId(exitId);
|
||||
if(inList.size() == 0){
|
||||
// MydoJob mydoJob = mydoJobService.selectMydoJobByExitList(exitList);
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByExitId(exitId);
|
||||
if (ObjUtil.isNotNull(mydoJob)) {
|
||||
List<MydoJob> inList1 = mydoJobService.getInJobByRoadAndFloor(entranceId,roadwayId);
|
||||
List<MydoJob> inList2 = mydoJobService.getInJobByEntranceId(exitId);
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByExitId(exitId);
|
||||
if (ObjUtil.isNotNull(mydoJob)) {
|
||||
if(inList1.size() == 0 && inList2.size() == 0){
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
if (ObjUtil.isNull(basCargoSpace)) {
|
||||
log.error("货位不存在 cargoSpaceId{}", mydoJob.getCargoSpaceId());
|
||||
@@ -201,11 +196,10 @@ public class Floor2RoadWaySsjThread implements Runnable {
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
log.info("当前出口"+ exitId+"存在入库任务,无法出库!");
|
||||
}
|
||||
}else{
|
||||
log.info("当前出口"+ exitId+"存在入库任务,无法出库!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,6 @@ public class LineSsjThread implements Runnable {
|
||||
mydoJob.setTrayCode(serial);
|
||||
mydoJob.setEntranceId("G1005");
|
||||
mydoJob.setFlag("0");
|
||||
mydoJob.setStatus("1");
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectInOrOutMydoJobList(mydoJob);
|
||||
//有作业,下发输送机任务号,覆盖任务号
|
||||
if (!mydoJobs.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user