生成队列 测试入库取货逻辑 入库放货逻辑
This commit is contained in:
@@ -61,7 +61,7 @@ public interface IMydoJobService
|
||||
|
||||
MydoJob selectMydoJobByTaskNo(Long rwh);
|
||||
|
||||
boolean ddjTaskFinish(Long rwh, Integer id);
|
||||
boolean ddjTaskFinish(Long rwh, Integer id, Integer type);
|
||||
|
||||
boolean InvalidMydoJob(Long rwh, Integer id);
|
||||
|
||||
|
||||
@@ -103,9 +103,10 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ddjTaskFinish(Long rwh, Integer id) {
|
||||
public boolean ddjTaskFinish(Long rwh, Integer id,Integer type) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_rwh", rwh);
|
||||
map.put("v_type",type);
|
||||
map.put("v_ddj_id", id);
|
||||
mydoJobMapper.ddjTaskFinish(map);
|
||||
if (Convert.toInt(map.get("v_result"))==10){
|
||||
|
||||
@@ -33,11 +33,11 @@ public class ScheduleThread {
|
||||
|
||||
public CustomThread<MonitoringThread> monitoringCustomThread;
|
||||
public CustomThread<Ddj1Thread> ddj1CustomThread;
|
||||
public CustomThread<Ddj2Thread> ddj2CustomThread;
|
||||
/*public CustomThread<Ddj2Thread> ddj2CustomThread;
|
||||
public CustomThread<Ddj3Thread> ddj3CustomThread;
|
||||
public CustomThread<Ddj4Thread> ddj4CustomThread;
|
||||
public CustomThread<Ddj5Thread> ddj5CustomThread;
|
||||
public CustomThread<Ddj6Thread> ddj6CustomThread;
|
||||
public CustomThread<Ddj6Thread> ddj6CustomThread;*/
|
||||
@Autowired
|
||||
private IDeviceSsjService deviceSsjService;
|
||||
@Autowired
|
||||
@@ -67,7 +67,7 @@ public class ScheduleThread {
|
||||
monitoringCustomThread = new CustomThread<MonitoringThread>(new Thread(monitoringThread), monitoringThread);
|
||||
Ddj1Thread ddj1Thread = new Ddj1Thread();
|
||||
ddj1CustomThread = new CustomThread<>(new Thread(ddj1Thread), ddj1Thread);
|
||||
Ddj2Thread ddj2Thread = new Ddj2Thread();
|
||||
/*Ddj2Thread ddj2Thread = new Ddj2Thread();
|
||||
ddj2CustomThread = new CustomThread<>(new Thread(ddj2Thread), ddj2Thread);
|
||||
Ddj3Thread ddj3Thread = new Ddj3Thread();
|
||||
ddj3CustomThread = new CustomThread<>(new Thread(ddj3Thread), ddj3Thread);
|
||||
@@ -76,7 +76,7 @@ public class ScheduleThread {
|
||||
Ddj5Thread ddj5Thread = new Ddj5Thread();
|
||||
ddj5CustomThread = new CustomThread<>(new Thread(ddj5Thread), ddj5Thread);
|
||||
Ddj6Thread ddj6Thread = new Ddj6Thread();
|
||||
ddj6CustomThread = new CustomThread<>(new Thread(ddj6Thread), ddj6Thread);
|
||||
ddj6CustomThread = new CustomThread<>(new Thread(ddj6Thread), ddj6Thread);*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,11 +148,11 @@ public class ScheduleThread {
|
||||
public void startAllThread() {
|
||||
plcSsjReadCustomThread.getThread().start();
|
||||
plcDdj1ReadCustomThread.getThread().start();
|
||||
plcDdj2ReadCustomThread.getThread().start();
|
||||
/*plcDdj2ReadCustomThread.getThread().start();
|
||||
plcDdj3ReadCustomThread.getThread().start();
|
||||
plcDdj4ReadCustomThread.getThread().start();
|
||||
plcDdj5ReadCustomThread.getThread().start();
|
||||
plcDdj6ReadCustomThread.getThread().start();
|
||||
plcDdj6ReadCustomThread.getThread().start();*/
|
||||
isRun = true;
|
||||
}
|
||||
|
||||
@@ -162,11 +162,11 @@ public class ScheduleThread {
|
||||
public void startAllThread2() {
|
||||
monitoringCustomThread.thread.start();
|
||||
ddj1CustomThread.thread.start();
|
||||
ddj2CustomThread.thread.start();
|
||||
/*ddj2CustomThread.thread.start();
|
||||
ddj3CustomThread.thread.start();
|
||||
ddj4CustomThread.thread.start();
|
||||
ddj5CustomThread.thread.start();
|
||||
ddj6CustomThread.thread.start();
|
||||
ddj6CustomThread.thread.start();*/
|
||||
isRun2 = true;
|
||||
}
|
||||
|
||||
@@ -176,11 +176,11 @@ public class ScheduleThread {
|
||||
public void stopAllThread() {
|
||||
plcSsjReadCustomThread.runnable.isRun = false;
|
||||
plcDdj1ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj2ReadCustomThread.runnable.isRun = false;
|
||||
/* plcDdj2ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj3ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj4ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj5ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj6ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj6ReadCustomThread.runnable.isRun = false;*/
|
||||
plcReadInit();
|
||||
isRun = false;
|
||||
}
|
||||
@@ -191,11 +191,11 @@ public class ScheduleThread {
|
||||
public void stopAllThread2() {
|
||||
monitoringCustomThread.runnable.isRun = false;
|
||||
ddj1CustomThread.runnable.isRun = false;
|
||||
ddj2CustomThread.runnable.isRun = false;
|
||||
/*ddj2CustomThread.runnable.isRun = false;
|
||||
ddj3CustomThread.runnable.isRun = false;
|
||||
ddj4CustomThread.runnable.isRun = false;
|
||||
ddj5CustomThread.runnable.isRun = false;
|
||||
ddj6CustomThread.runnable.isRun = false;
|
||||
ddj6CustomThread.runnable.isRun = false;*/
|
||||
scheduleInit();
|
||||
isRun2 = false;
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ public class PlcDdjRead extends Thread {
|
||||
msgDdj.setMbch(ParseUtil.optInt(22, ddsx));
|
||||
msgDdj.setYxxf(ParseUtil.optInt(24, ddsx));
|
||||
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setTrayCode(ParseUtil.optString(30,4,ddsx));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ public class ParseUtil {
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static String optString(int start, String data) {
|
||||
byte[] bytes = SoftBasic.HexStringToBytes(data.substring(start * 2, (start + 7) * 2));
|
||||
public static String optString(int start,int length, String data) {
|
||||
byte[] bytes = SoftBasic.HexStringToBytes(data.substring(start * 2, (start + length) * 2));
|
||||
return Tools.bytetostringtool(bytes);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,13 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
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 cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||
@@ -27,6 +30,7 @@ import java.util.*;
|
||||
|
||||
import static com.ruoyi.common.Constant.WAREHOUSE_01;
|
||||
import static com.ruoyi.common.TaskStatusCode.*;
|
||||
import static com.ruoyi.common.TaskType.DDJ_RWLX_3;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@@ -40,6 +44,7 @@ public class Ddj1Thread implements Runnable {
|
||||
private IDdjDeviceExecutionQueueFinishService ddjDeviceExecutionQueueFinishService;
|
||||
private IMsgDdjService msgDdjService;
|
||||
private IMydoJobService mydoJobService;
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
private final Map<String, List<Integer>> roadwayMap = new HashMap<>();
|
||||
|
||||
public boolean isRun = true;
|
||||
@@ -48,6 +53,7 @@ public class Ddj1Thread implements Runnable {
|
||||
public void init() {
|
||||
//todo 获取设备编码列表
|
||||
ddjCodeList = new HashMap<>();
|
||||
ssjList = new HashMap<>();
|
||||
ArrayList<MsgDdj> ddjCodes = new ArrayList<>();
|
||||
ddjCodes.add(PlcDdjRead.deviceDdjMap.get("ddj1"));
|
||||
ddjCodeList.put("ddj", ddjCodes);
|
||||
@@ -79,6 +85,7 @@ public class Ddj1Thread implements Runnable {
|
||||
apiService = SpringUtils.getBean(IApiService.class);
|
||||
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
|
||||
ddjDeviceExecutionQueueFinishService = SpringUtils.getBean(IDdjDeviceExecutionQueueFinishService.class);
|
||||
basCargoSpaceService = SpringUtils.getBean(IBasCargoSpaceService.class);
|
||||
msgDdjService = SpringUtils.getBean(IMsgDdjService.class);
|
||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
||||
log.info("初始化服务 {},{},{},{}", apiService, ddjDeviceExecutionQueueService, ddjDeviceExecutionQueueFinishService, mydoJobService);
|
||||
@@ -183,9 +190,9 @@ public class Ddj1Thread implements Runnable {
|
||||
* 创建入库放货队列
|
||||
*/
|
||||
private void generateInBoundLoadQueue(MsgDdj ddj) {
|
||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 3) {
|
||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 3 && ddj.getYxxf() == 1) {
|
||||
//允许下发 联机 有货待机
|
||||
if (StrUtil.isNotEmpty(ddj.getTrayCode())) {
|
||||
if (StrUtil.isNotEmpty(ddj.getTrayCode().trim())) {
|
||||
MydoJob param = new MydoJob();
|
||||
param.setTrayCode(ddj.getTrayCode());
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
||||
@@ -212,17 +219,38 @@ public class Ddj1Thread implements Runnable {
|
||||
if (ObjUtil.isNotNull(inJob) && inJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) {
|
||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(inJob.getTaskNo()), ddj.getId());
|
||||
if (ObjUtil.isNull(ddjQueue)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
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);
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(inJob.getCargoSpaceId());
|
||||
if (ObjUtil.isNotNull(basCargoSpace)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(inJob.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName(ddj.getName());
|
||||
ddjDeviceExecutionQueue.setDevId(ddj.getId());
|
||||
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_3);
|
||||
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 {
|
||||
Integer mbph = ddj.getMbph();
|
||||
Integer mblh = ddj.getMblh();
|
||||
Integer mbch = ddj.getMbch();
|
||||
@@ -233,7 +261,7 @@ public class Ddj1Thread implements Runnable {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,9 +275,24 @@ public class Ddj1Thread implements Runnable {
|
||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(ssj.getTaskNo()), ddj.getId());
|
||||
if (ObjUtil.isNull(ddjQueue)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(ssj.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName(ddj.getName());
|
||||
ddjDeviceExecutionQueue.setDevId(ddj.getId());
|
||||
ddjDeviceExecutionQueue.setRwzt(0);
|
||||
ddjDeviceExecutionQueue.setYph(0);
|
||||
ddjDeviceExecutionQueue.setYlh(0);
|
||||
ddjDeviceExecutionQueue.setYch(0);
|
||||
List<Integer> integers = roadwayMap.get(ssj.getDeviceCode());
|
||||
ddjDeviceExecutionQueue.setMbph(integers.get(0));
|
||||
ddjDeviceExecutionQueue.setMblh(integers.get(1));
|
||||
ddjDeviceExecutionQueue.setMbch(integers.get(2));
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setRwlx(1);
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
ddjDeviceExecutionQueue.setMlfs(3);
|
||||
ddjDeviceExecutionQueue.setSpare1("0");
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
} else {
|
||||
log.info("任务已存在 rwh{}", ssj.getTaskNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,11 +307,18 @@ public class Ddj1Thread implements Runnable {
|
||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 0 && ddj.getJdbz() == 5) {
|
||||
Long rwh = ddj.getRwh();
|
||||
//完成作业
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||
if (mydoJob != null && ddjDeviceExecutionQueue != null) {
|
||||
//回传完成信号
|
||||
ddjTaskFinish(rwh, ddj.getId());
|
||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)){
|
||||
if (ddjDeviceExecutionQueue.getRwlx()==1){
|
||||
//完成队列
|
||||
ddjTaskFinish(rwh, ddj.getId(),2);
|
||||
}else {
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
if (ObjUtil.isNotNull(mydoJob)){
|
||||
//回传完成信号
|
||||
ddjTaskFinish(rwh, ddj.getId(),1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,8 +473,8 @@ public class Ddj1Thread implements Runnable {
|
||||
* @param rwh 作业单号
|
||||
* @param id 作业单id
|
||||
*/
|
||||
private void ddjTaskFinish(Long rwh, Integer id) {
|
||||
mydoJobService.ddjTaskFinish(rwh, id);
|
||||
private void ddjTaskFinish(Long rwh, Integer id,Integer type) {
|
||||
mydoJobService.ddjTaskFinish(rwh, id,type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -423,7 +423,7 @@ public class Ddj2Thread implements Runnable {
|
||||
* @param id 作业单id
|
||||
*/
|
||||
private void ddjTaskFinish(Long rwh, Integer id) {
|
||||
mydoJobService.ddjTaskFinish(rwh, id);
|
||||
mydoJobService.ddjTaskFinish(rwh, id,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -423,7 +423,7 @@ public class Ddj3Thread implements Runnable {
|
||||
* @param id 作业单id
|
||||
*/
|
||||
private void ddjTaskFinish(Long rwh, Integer id) {
|
||||
mydoJobService.ddjTaskFinish(rwh, id);
|
||||
mydoJobService.ddjTaskFinish(rwh, id,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ public class Ddj4Thread implements Runnable {
|
||||
* @param id 作业单id
|
||||
*/
|
||||
private void ddjTaskFinish(Long rwh, Integer id) {
|
||||
mydoJobService.ddjTaskFinish(rwh, id);
|
||||
mydoJobService.ddjTaskFinish(rwh, id,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ public class Ddj5Thread implements Runnable {
|
||||
* @param id 作业单id
|
||||
*/
|
||||
private void ddjTaskFinish(Long rwh, Integer id) {
|
||||
mydoJobService.ddjTaskFinish(rwh, id);
|
||||
mydoJobService.ddjTaskFinish(rwh, id,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ public class Ddj6Thread implements Runnable {
|
||||
* @param id 作业单id
|
||||
*/
|
||||
private void ddjTaskFinish(Long rwh, Integer id) {
|
||||
mydoJobService.ddjTaskFinish(rwh, id);
|
||||
mydoJobService.ddjTaskFinish(rwh, id,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="ddjTaskFinish" parameterType="java.util.Map" statementType="CALLABLE">
|
||||
{call proc_mydojob_finish(
|
||||
#{v_rwh,mode=IN,jdbcType=INTEGER},
|
||||
#{v_type,mode=IN,jdbcType=INTEGER},
|
||||
#{v_ddj_id,mode=IN,jdbcType=INTEGER},
|
||||
#{v_result,mode=OUT,jdbcType=INTEGER},
|
||||
#{v_resultmsg,mode=OUT,jdbcType=VARCHAR}
|
||||
|
||||
Reference in New Issue
Block a user