其它入库 退货入库逻辑修改

This commit is contained in:
liuhanqing
2025-10-10 14:27:52 +08:00
parent e6ab8b2ada
commit f5c7552799
9 changed files with 66 additions and 40 deletions

View File

@@ -15,6 +15,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.job.domain.MydoJob; import com.ruoyi.job.domain.MydoJob;
import com.ruoyi.queue.agv.domain.AgvQueue; import com.ruoyi.queue.agv.domain.AgvQueue;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -126,5 +127,5 @@ public interface IApiService
AjaxResult receiveInMydoJob(ReceiveJob receiveInJob); AjaxResult receiveInMydoJob(ReceiveJob receiveInJob);
AjaxResult requestEnterByEnterId(String enterId); AjaxResult selectMydoJobByTrayCodeAndEntranceId(HashMap<String, Object> paramMap);
} }

View File

@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -369,8 +370,8 @@ public class ApiServiceImpl implements IApiService {
} }
@Override @Override
public AjaxResult requestEnterByEnterId(String enterId) { public AjaxResult selectMydoJobByTrayCodeAndEntranceId(HashMap<String, Object> paramMap) {
RequestLog requestLog = requestLogService.getRequestLog(REQUEST_ENTER_URL, "入库请求", JSONUtil.toJsonStr(enterId)); RequestLog requestLog = requestLogService.getRequestLog(REQUEST_ENTER_URL, "请求获取入库作业", JSONUtil.toJsonStr(paramMap));
if ("1".equals(requestLog.getIsSuccessful())) { if ("1".equals(requestLog.getIsSuccessful())) {
InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class); InterfaceReceive bean = JSONUtil.toBean(requestLog.getResponseBody(), InterfaceReceive.class);
return AjaxResult.success(bean.getData()); return AjaxResult.success(bean.getData());

View File

@@ -15,7 +15,7 @@ public class Constant {
public static final String REQUEST_MYDO_JOB_URL = WMS_BASE_URL+"requestByNoTrayCode"; public static final String REQUEST_MYDO_JOB_URL = WMS_BASE_URL+"requestByNoTrayCode";
public static final String RE_ASSIGN_URL = WMS_BASE_URL+"reAssign"; public static final String RE_ASSIGN_URL = WMS_BASE_URL+"reAssign";
public static final String RE_MATERIAL_URL = WMS_BASE_URL+"reMaterial"; public static final String RE_MATERIAL_URL = WMS_BASE_URL+"reMaterial";
public static final String REQUEST_ENTER_URL = WMS_BASE_URL+"requestEnterByEnterId"; public static final String REQUEST_ENTER_URL = WMS_BASE_URL+"requestEnterByTrayCodeAndEntranceId";
} }

View File

@@ -141,8 +141,8 @@ public class ScheduleThread {
*/ */
public void startAllThread2() { public void startAllThread2() {
monitoringCustomThread.thread.start(); monitoringCustomThread.thread.start();
//floor1BothWayInSsjCustomThread.thread.start(); floor1BothWayInSsjCustomThread.thread.start();
//floor1BothWayOutSsjCustomThread.thread.start(); floor1BothWayOutSsjCustomThread.thread.start();
floor1SingleSsjCustomThread.thread.start(); floor1SingleSsjCustomThread.thread.start();
floor2InSsjCustomThread.thread.start(); floor2InSsjCustomThread.thread.start();
lineSsjCustomThread.thread.start(); lineSsjCustomThread.thread.start();

View File

@@ -100,7 +100,7 @@ public class PlcSsjRead implements Runnable {
} }
/** /**
* 入库输送机 * 巷道输送机
* *
* @param ssjDevice * @param ssjDevice
*/ */
@@ -117,7 +117,7 @@ public class PlcSsjRead implements Runnable {
} }
/** /**
* 拣选口输送机 * 入出库输送机
* *
* @param ssjDevice * @param ssjDevice
*/ */
@@ -136,7 +136,7 @@ public class PlcSsjRead implements Runnable {
} }
/** /**
* 出库输送机 * 产线输送机
* *
* @param ssjDevice * @param ssjDevice
*/ */
@@ -151,8 +151,19 @@ public class PlcSsjRead implements Runnable {
ssjDevice.setTraySize(ParseUtil.optInt(6, ddsx1)); ssjDevice.setTraySize(ParseUtil.optInt(6, ddsx1));
ssjDevice.setTaskNo(ParseUtil.optDInt(8, ddsx1)); ssjDevice.setTaskNo(ParseUtil.optDInt(8, ddsx1));
String trayCodeReadAddress="";
OperateResultExOne<byte[]> trayCodeRead = readWriteNet.Read("DB502.0", Short.parseShort("220")); switch (ssjDevice.getDeviceCode()){
case "G1005":
trayCodeReadAddress = "DB502.0";
break;
case "L2012":
trayCodeReadAddress = "DB503.0";
break;
case "L2013":
trayCodeReadAddress = "DB504.0";
break;
}
OperateResultExOne<byte[]> trayCodeRead = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("220"));
if (trayCodeRead.IsSuccess){ if (trayCodeRead.IsSuccess){
byte[] content = trayCodeRead.Content; byte[] content = trayCodeRead.Content;
//去除bytes中 //去除bytes中
@@ -208,12 +219,12 @@ public class PlcSsjRead implements Runnable {
setIsConnect(false); setIsConnect(false);
} }
public static int writeToSsj(String address, String taskNo, int qx) { public static int writeToSsj(String address, String taskNo, int qx , int completed) {
int jym = Tools.getJYM(Integer.parseInt(taskNo), qx, 1); int jym = Tools.getJYM(Integer.parseInt(taskNo), qx, completed);
SendData taskNoSendData = new SendData(Tools.INT, taskNo); SendData taskNoSendData = new SendData(Tools.INT, taskNo);
SendData qxSendData = new SendData(Tools.INT, qx); SendData qxSendData = new SendData(Tools.INT, qx);
SendData completedSendData = new SendData(Tools.INT, 1); SendData completedSendData = new SendData(Tools.INT, completed);
SendData jymSendData = new SendData(Tools.INT, jym); SendData jymSendData = new SendData(Tools.INT, jym);
byte[] bytes = Tools.sendData(taskNoSendData, qxSendData, completedSendData, jymSendData); byte[] bytes = Tools.sendData(taskNoSendData, qxSendData, completedSendData, jymSendData);
return PlcSsjRead.WriteToSSJ(address, bytes); return PlcSsjRead.WriteToSSJ(address, bytes);

View File

@@ -1,5 +1,6 @@
package com.ruoyi.schedule.scheduleTask.ssj.floor1; package com.ruoyi.schedule.scheduleTask.ssj.floor1;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
@@ -50,7 +51,7 @@ public class Floor1BothWayInSsjThread implements Runnable {
ssjCodeList.put("roadway1", PlcSsjRead.deviceSsjMap.get("L2003")); ssjCodeList.put("roadway1", PlcSsjRead.deviceSsjMap.get("L2003"));
ssjCodeList.put("roadway2", PlcSsjRead.deviceSsjMap.get("L2005")); ssjCodeList.put("roadway2", PlcSsjRead.deviceSsjMap.get("L2005"));
ssjCodeList.put("in1", PlcSsjRead.deviceSsjMap.get("L2012")); ssjCodeList.put("in1", PlcSsjRead.deviceSsjMap.get("L2012"));
ssjCodeList.put("in2", PlcSsjRead.deviceSsjMap.get("L2005")); ssjCodeList.put("in2", PlcSsjRead.deviceSsjMap.get("L2013"));
apiService = SpringUtils.getBean(IApiService.class); apiService = SpringUtils.getBean(IApiService.class);
@@ -133,7 +134,7 @@ public class Floor1BothWayInSsjThread implements Runnable {
} }
private void dispatch2(DeviceSsj ssj) { private void dispatch2(DeviceSsj ssj) {
if (ssj.getDw() == 1 && ssj.getTaskNo() > 0 && ssj.getTaskNo() < 1000 && ssj.getRkqq() == 1) { if (ssj.getDw() == 1 && ssj.getTaskNo() > 0 && ssj.getTaskNo() < 1000 && ssj.getTraySize() != 0) {
//先检测有没有出库作业,有出库作业直接退回 //先检测有没有出库作业,有出库作业直接退回
MydoJob outMydoJob = mydoJobService.selectMydoJobByExitList(Collections.singletonList(ssj.getDeviceCode())); MydoJob outMydoJob = mydoJobService.selectMydoJobByExitList(Collections.singletonList(ssj.getDeviceCode()));
String l2012WriteAddress = "DB501.20"; String l2012WriteAddress = "DB501.20";
@@ -143,20 +144,18 @@ public class Floor1BothWayInSsjThread implements Runnable {
//下发去向 和任务号 //下发去向 和任务号
switch (ssj.getDeviceCode()) { switch (ssj.getDeviceCode()) {
case "L2012": case "L2012":
i = writeToSsj(l2012WriteAddress,"0",2); i = writeToSsj(l2012WriteAddress,"0",2,1);
break; break;
case "L2013": case "L2013":
i = writeToSsj(l2013WriteAddress,"0",2); i = writeToSsj(l2013WriteAddress,"0",2,1);
break; break;
} }
if (i == 1) { if (i == 1) {
log.info("未检测到托盘码下发回退 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode()); log.info("未检测到托盘码下发回退 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode());
} }
} else { } else {
if (StrUtil.isNotEmpty(ssj.getTrayCode())) { if (StrUtil.isNotBlank(ssj.getTrayCode())) {
MydoJob param = new MydoJob(); MydoJob param = new MydoJob();
param.setStatus(TASK_STATUS_CREATE);
param.setExecutionPhase("0");
param.setEntranceId(ssj.getDeviceCode()); param.setEntranceId(ssj.getDeviceCode());
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param); List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
MydoJob inJob = null; MydoJob inJob = null;
@@ -169,9 +168,10 @@ public class Floor1BothWayInSsjThread implements Runnable {
paramMap.put("size", ssj.getTraySize()); paramMap.put("size", ssj.getTraySize());
paramMap.put("floor", "1"); paramMap.put("floor", "1");
paramMap.put("entranceId",ssj.getDeviceCode()); paramMap.put("entranceId",ssj.getDeviceCode());
AjaxResult result = apiService.createInMydoJob(paramMap); AjaxResult result = apiService.selectMydoJobByTrayCodeAndEntranceId(paramMap);
if (result.isSuccess()) { if (result.isSuccess()) {
inJob = (MydoJob) result.get("data"); inJob = BeanUtil.toBean(result.get("data"), MydoJob.class);
inJob.setStatus(TASK_STATUS_CREATE);
mydoJobService.insertMydoJob(inJob); mydoJobService.insertMydoJob(inJob);
} else { } else {
log.info("未检测到托盘码请求入库作业 rwh:{},trayCode:{}", ssj.getTaskNo(), ssj.getTrayCode()); log.info("未检测到托盘码请求入库作业 rwh:{},trayCode:{}", ssj.getTaskNo(), ssj.getTrayCode());
@@ -182,10 +182,10 @@ public class Floor1BothWayInSsjThread implements Runnable {
//下发去向 和任务号 //下发去向 和任务号
switch (ssj.getDeviceCode()) { switch (ssj.getDeviceCode()) {
case "L2012": case "L2012":
i = writeToSsj(l2012WriteAddress,inJob.getTaskNo(),1); i = writeToSsj(l2012WriteAddress,inJob.getTaskNo(),1,1);
break; break;
case "L2013": case "L2013":
i = writeToSsj(l2013WriteAddress,inJob.getTaskNo(),1); i = writeToSsj(l2013WriteAddress,inJob.getTaskNo(),1,1);
break; break;
} }
if (i == 1) { if (i == 1) {
@@ -197,6 +197,28 @@ public class Floor1BothWayInSsjThread implements Runnable {
log.info("入库请求下发任务号加去向 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode()); log.info("入库请求下发任务号加去向 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode());
} }
} }
}else {
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("size", ssj.getTraySize());
AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
if (ajaxResult.isSuccess()) {
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
mydoJobService.insertMydoJob(mydoJob2);
int i = writeToSsj(ssj.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
if (i == 1) {
mydoJob2.setExecutionPhase("1");
mydoJobService.updateMydoJob(mydoJob2);
log.info("{}下发任务号{}成功:",ssj.getDeviceCode(),mydoJob2.getTaskNo());
}
} else if (ajaxResult.isError()) {
//超大,给plc下发错误信息,等待人工处理
//托盘大小对不上,给plc下发错误信息,等待人工处理
//码不对,给plc下发错误信息,等待人工处理
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "0", Integer.parseInt(ajaxResult.get("code").toString()), 2);
if (i == 1) {
log.info("{}下发错误信号{}成功:",ssj.getDeviceCode(),Integer.parseInt(ajaxResult.get("code").toString()));
}
}
} }
} }

View File

@@ -95,7 +95,7 @@ public class Floor2InOutSsjThread implements Runnable {
//不允许放货 //不允许放货
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 0) { if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 0) {
//如果有这个输送机口的agv队列并请求放货(状态为6) //如果有这个输送机口的agv队列并请求放货(状态为6)
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "0", Integer.parseInt(agvQueues.get(0).getCtnrType())); int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), "0", Integer.parseInt(agvQueues.get(0).getCtnrType()),1);
if (i == 1) { if (i == 1) {
log.info(inSsjDevice.getDeviceCode() + "输送机下发请求放货成功"); log.info(inSsjDevice.getDeviceCode() + "输送机下发请求放货成功");
} }
@@ -119,7 +119,7 @@ public class Floor2InOutSsjThread implements Runnable {
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode()); agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueue); List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueue);
if (!agvQueues.isEmpty()) { if (!agvQueues.isEmpty()) {
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), agvQueues.get(0).getWmsTaskNo(), 1); int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), agvQueues.get(0).getWmsTaskNo(), 1,1);
if (i == 1) { if (i == 1) {
log.info("输送机{}下发任务号{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getWmsTaskNo()); log.info("输送机{}下发任务号{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getWmsTaskNo());
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(agvQueues.get(0).getTaskCode()); MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(agvQueues.get(0).getTaskCode());

View File

@@ -23,6 +23,7 @@ import java.util.List;
import static com.ruoyi.common.TaskStatusCode.TASK_EP_AGV; import static com.ruoyi.common.TaskStatusCode.TASK_EP_AGV;
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.deviceSsjMap; import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.deviceSsjMap;
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
/** /**
* 生产线输送机 * 生产线输送机
@@ -129,7 +130,7 @@ public class LineSsjThread implements Runnable {
if (i == 1) { if (i == 1) {
//mydoJob2.setExecutionPhase("1"); //mydoJob2.setExecutionPhase("1");
mydoJobService.updateMydoJob(mydoJob2); mydoJobService.updateMydoJob(mydoJob2);
log.info("G1005产线输送机下发任务号成功:" + mydoJob2.getTaskNo()); log.info("G1005产线输送机下发任务号成功:{}" , mydoJob2.getTaskNo());
} }
} else { } else {
//超大,给plc下发错误信息,等待人工处理 //超大,给plc下发错误信息,等待人工处理
@@ -169,7 +170,7 @@ public class LineSsjThread implements Runnable {
paramMap.put("size", SsjDevice.getTraySize()); paramMap.put("size", SsjDevice.getTraySize());
AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap); AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
if (ajaxResult.isSuccess()) { if (ajaxResult.isSuccess()) {
MydoJob mydoJob2 = (MydoJob) ajaxResult.get("data"); MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
mydoJobService.insertMydoJob(mydoJob2); mydoJobService.insertMydoJob(mydoJob2);
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1); int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
if (i == 1) { if (i == 1) {
@@ -251,17 +252,7 @@ public class LineSsjThread implements Runnable {
} }
private static int writeToSsj(String address,String taskNo,int qx,int completed) {
int jym = Tools.getJYM(Integer.parseInt(taskNo), qx, 1);
SendData taskNoSendData = new SendData(Tools.INT, taskNo);
SendData qxSendData = new SendData(Tools.INT,qx);
SendData completedSendData = new SendData(Tools.INT, completed);
SendData jymSendData = new SendData(Tools.INT, jym);
byte[] bytes = Tools.sendData(taskNoSendData, qxSendData, completedSendData, jymSendData);
int i = PlcSsjRead.WriteToSSJ(address, bytes);
return i;
}
} }

View File

@@ -197,7 +197,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<foreach item="item" index="index" collection="entranceList" separator="," open="(" close=")"> <foreach item="item" index="index" collection="entranceList" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
and in_or_out &lt;= 20 ans status = 3 and in_or_out &lt;= 20 and status = 3
order by priority desc,create_time desc order by priority desc,create_time desc
</select> </select>
<select id="selectMydoJobFinishList" resultMap="MydoJobResult"> <select id="selectMydoJobFinishList" resultMap="MydoJobResult">