优化
This commit is contained in:
@@ -10,7 +10,7 @@ import com.ruoyi.schedule.plcRead.ddj.PlcDdj1Read;
|
||||
import com.ruoyi.schedule.plcRead.ddj.PlcDdj2Read;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import com.ruoyi.common.domain.CustomThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ddj.Ddj1Thread;
|
||||
import com.ruoyi.schedule.scheduleTask.ddj.DdjThread;
|
||||
import com.ruoyi.schedule.scheduleTask.monit.MonitoringThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ssj.floor1.Floor1BothWayInSsjThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ssj.floor1.Floor1BothWayOutSsjThread;
|
||||
@@ -23,6 +23,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -42,7 +48,7 @@ public class ScheduleThread {
|
||||
public CustomThread<Floor2RoadWaySsjThread> floor2OutSsjCustomThread;
|
||||
public CustomThread<LineSsjThread> lineSsjCustomThread;
|
||||
public CustomThread<MonitoringThread> monitoringCustomThread;
|
||||
public CustomThread<Ddj1Thread> ddj1CustomThread;
|
||||
public CustomThread<DdjThread> ddj1CustomThread;
|
||||
@Autowired
|
||||
private IDeviceSsjService deviceSsjService;
|
||||
@Autowired
|
||||
@@ -89,8 +95,8 @@ public class ScheduleThread {
|
||||
Floor2RoadWaySsjThread floor2OutSsjThread = new Floor2RoadWaySsjThread();
|
||||
floor2OutSsjCustomThread = new CustomThread<Floor2RoadWaySsjThread>(new Thread(floor2OutSsjThread), floor2OutSsjThread);
|
||||
|
||||
Ddj1Thread ddj1Thread = new Ddj1Thread();
|
||||
ddj1CustomThread = new CustomThread<Ddj1Thread>(new Thread(ddj1Thread), ddj1Thread);
|
||||
DdjThread ddj1Thread = new DdjThread();
|
||||
ddj1CustomThread = new CustomThread<DdjThread>(new Thread(ddj1Thread), ddj1Thread);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,9 +154,9 @@ public class ScheduleThread {
|
||||
*/
|
||||
public void startAllThread2() {
|
||||
monitoringCustomThread.thread.start();
|
||||
// floor1BothWayInSsjCustomThread.thread.start();
|
||||
// floor1BothWayOutSsjCustomThread.thread.start();
|
||||
// floor1SingleSsjCustomThread.thread.start();
|
||||
floor1BothWayInSsjCustomThread.thread.start();
|
||||
floor1BothWayOutSsjCustomThread.thread.start();
|
||||
floor1SingleSsjCustomThread.thread.start();
|
||||
floor2InSsjCustomThread.thread.start();
|
||||
lineSsjCustomThread.thread.start();
|
||||
floor2OutSsjCustomThread.thread.start();
|
||||
@@ -194,4 +200,75 @@ public class ScheduleThread {
|
||||
map.put("isRun2",isRun2);
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Socket socket = new Socket();
|
||||
// OutputStream out = null;
|
||||
// InputStream in = null;
|
||||
// try {
|
||||
//// socket.connect(new InetSocketAddress("192.168.56.32", 2002), 1000);
|
||||
//// in = socket.getInputStream();
|
||||
//// out = socket.getOutputStream();
|
||||
//
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
|
||||
// String code = sendWeight("192.168.56.33", 2002);
|
||||
// System.err.println(code);
|
||||
String pp = "MODEL:EX-1203 COLOR:9005 SERIAL:QT25C1879 V:220 Hz:50 PH:1 N.W.:207kg G.W.:238kg @:9781C52TQ$S0T0T0T3T0U7T0$7005280MA0A@";
|
||||
String ss = "MODEL:TR-360 COLOR:7016 SERIAL:QT25C1899 V:380 Hz:50 PH:3 N.W.:231kg G.W.:261kg @:9981C52TQ$S0T0U5RDS2S3S6T0T3T0U7T0$4105230IF0A@";
|
||||
System.err.println(pp);
|
||||
System.err.println(pp.length());
|
||||
System.err.println(ss.length());
|
||||
}
|
||||
|
||||
public static String sendWeight(String ip, int por) {
|
||||
|
||||
String zhi="";
|
||||
Socket socket = null;
|
||||
OutputStream os = null;
|
||||
InputStream is = null;
|
||||
try {
|
||||
//新建客户端并请求服务端的ip为localhost 端口为8088
|
||||
socket = new Socket(ip,por);
|
||||
// System.out.println("socket end ="+System.currentTimeMillis());
|
||||
//休眠3秒
|
||||
Thread.sleep(1000);
|
||||
char[] charArray = new char[500];
|
||||
//获取客户端发送的数据的输入流
|
||||
is = socket.getInputStream();
|
||||
//读取输入流
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(is);
|
||||
// System.out.println("read begin =" + System.currentTimeMillis());
|
||||
int readLength = inputStreamReader.read(charArray);
|
||||
System.out.println("readLength:"+readLength);
|
||||
if (readLength != -1) {
|
||||
String newString = new String(charArray, 0, readLength);
|
||||
// System.out.println("newString:"+newString+"长度"+newString.length());
|
||||
// newString=newString.replaceAll("\r|\n", "");
|
||||
// if(newString.length()==8&&!newString.equals("=0000000")){
|
||||
// newString=newString.substring(1,8);
|
||||
// newString=newString.replaceAll("^(0+)", "");
|
||||
// zhi=newString;
|
||||
// }
|
||||
zhi = newString;
|
||||
readLength = inputStreamReader.read(charArray);
|
||||
}
|
||||
// System.out.println("read end =" + System.currentTimeMillis());
|
||||
inputStreamReader.close();
|
||||
is.close();
|
||||
socket.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
socket.close();
|
||||
is.close();
|
||||
os.close();
|
||||
} catch (IOException e1)
|
||||
{ e1.printStackTrace(); }
|
||||
}
|
||||
|
||||
return zhi;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PlcDdj1Read extends Thread {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
readPlcDdj(msgDdj);
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(800);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PlcDdj2Read extends Thread {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
readPlcDdj(msgDdj);
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(800);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class PlcSsjRead implements Runnable {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(800);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
@@ -156,27 +156,27 @@ public class PlcSsjRead implements Runnable {
|
||||
String allot="";
|
||||
switch (ssjDevice.getDeviceCode()){
|
||||
case "G1005":
|
||||
trayCodeReadAddress = "DB5023.0";
|
||||
allot = "DB802.0";
|
||||
trayCodeReadAddress = "DB503.0";
|
||||
allot = "DB802.24";
|
||||
break;
|
||||
case "L2004":
|
||||
trayCodeReadAddress = "DB503.200";
|
||||
trayCodeReadAddress = "DB503.600";
|
||||
break;
|
||||
case "L2006":
|
||||
trayCodeReadAddress = "DB503.400";
|
||||
trayCodeReadAddress = "DB503.800";
|
||||
break;
|
||||
case "L1001":
|
||||
trayCodeReadAddress = "DB503.600";
|
||||
allot = "DB802.12";
|
||||
trayCodeReadAddress = "DB503.200";
|
||||
allot = "DB802.0";
|
||||
break;
|
||||
case "L1003":
|
||||
trayCodeReadAddress = "DB503.800";
|
||||
allot = "DB802.24";
|
||||
trayCodeReadAddress = "DB503.400";
|
||||
allot = "DB802.12";
|
||||
break;
|
||||
}
|
||||
|
||||
if(!"".equals(allot)){
|
||||
OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("12"));
|
||||
OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(allot, Short.parseShort("2"));
|
||||
if (agvSsj.IsSuccess){
|
||||
//去除bytes中
|
||||
ddsx1 = SoftBasic.ByteToHexString(agvSsj.Content);
|
||||
@@ -184,11 +184,27 @@ public class PlcSsjRead implements Runnable {
|
||||
}
|
||||
}
|
||||
if(!"".equals(trayCodeReadAddress)){
|
||||
OperateResultExOne<byte[]> trayCodeRead = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("220"));
|
||||
OperateResultExOne<byte[]> trayCodeRead = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("200"));
|
||||
if (trayCodeRead.IsSuccess){
|
||||
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("8"));
|
||||
String ddsx2 = "0";
|
||||
if (agvSsjTask.IsSuccess) {
|
||||
ddsx2 = SoftBasic.ByteToHexString(agvSsjTask.Content);
|
||||
if("L1001".equals(ssjDevice.getDeviceCode())){
|
||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(0, ddsx2));
|
||||
}
|
||||
if("L1003".equals(ssjDevice.getDeviceCode())){
|
||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(4, ddsx2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Tools implements Serializable {
|
||||
|
||||
public static void main(String[] arg) {
|
||||
int jym = getJYM(1, 2, 3);
|
||||
System.out.println(jym);
|
||||
//System.out.println(jym);
|
||||
}
|
||||
|
||||
/*4、CRC-16校验码计算方法:
|
||||
@@ -58,7 +58,7 @@ public class Tools implements Serializable {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
int s = j + i * 4;
|
||||
ints1[s] = son[j];
|
||||
System.out.println(Arrays.toString(ints1));
|
||||
//System.out.println(Arrays.toString(ints1));
|
||||
}
|
||||
}
|
||||
int a = 0;
|
||||
@@ -225,10 +225,10 @@ public class Tools implements Serializable {
|
||||
ints[22] = binaryTints8(printBits(a23));
|
||||
ints[23] = binaryTints8(printBits(a24));
|
||||
ints[24] = binaryTints8(printBits(a25));
|
||||
for (int anInt : ints) {
|
||||
System.out.print(anInt + " ");
|
||||
}
|
||||
System.out.println();
|
||||
// for (int anInt : ints) {
|
||||
// System.out.print(anInt + " ");
|
||||
// }
|
||||
// System.out.println();
|
||||
return BytesToInt(ints);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class Ddj1Thread implements Runnable {
|
||||
public class DdjThread implements Runnable {
|
||||
|
||||
public HashMap<String, List<String>> ddjCodeList;
|
||||
|
||||
@@ -133,7 +133,7 @@ public class Ddj1Thread implements Runnable {
|
||||
if ("0".equals(mydoJob.getFaultFlag()) && "1".equals(ddjDeviceExecutionQueue.getSpare1())) {
|
||||
mydoJob.setStatus("1");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
AjaxResult ajaxResult = apiService.reAssign(new JobParam(rwh.toString(), null, null));
|
||||
AjaxResult ajaxResult = apiService.reAssign(new JobParam(mydoJob.getJobId(), null, null));
|
||||
if (ajaxResult.isSuccess()){
|
||||
mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
mydoJob.setFaultFlag("2");
|
||||
@@ -141,19 +141,23 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
}
|
||||
|
||||
private void dispatch2(DeviceSsj ssj) {
|
||||
if (ssj.getDw() == 1 && ssj.getTaskNo() > 0 && ssj.getTaskNo() < 1000 && ssj.getTraySize() != 0) {
|
||||
if (ssj.getRkqq() == 1 && ssj.getTaskNo() > 0 && ssj.getTaskNo() < 1000 ) {
|
||||
//先检测有没有出库作业,有出库作业直接退回
|
||||
MydoJob outMydoJob = mydoJobService.selectRunningMydoJobByExitList(Collections.singletonList(ssj.getDeviceCode()));
|
||||
if (ObjUtil.isNotNull(outMydoJob) || StrUtil.isEmpty(ssj.getTrayCode())) {
|
||||
// || StrUtil.isEmpty(ssj.getTrayCode())
|
||||
if (ObjUtil.isNotNull(outMydoJob)) {
|
||||
//下发去向 和任务号
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "0", 2, 1);
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", 2, 2);
|
||||
if (i == 1) {
|
||||
log.info("未检测到托盘码下发回退 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode());
|
||||
log.info("当前输送机有出库任务下发退回 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 2, ssj.getTrayCode());
|
||||
}
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(ssj.getTrayCode())) {
|
||||
MydoJob param = new MydoJob();
|
||||
param.setEntranceId(ssj.getDeviceCode());
|
||||
String[] split = ssj.getTrayCode().split(" ");
|
||||
String serial = split[2].substring(7);
|
||||
param.setTrayCode(serial);
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
||||
MydoJob inJob = null;
|
||||
if (CollUtil.isNotEmpty(mydoJobs)) {
|
||||
@@ -162,7 +166,7 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
//根据托盘码请求入库作业
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("trayCode", ssj.getTrayCode());
|
||||
paramMap.put("size", ssj.getTraySize());
|
||||
//paramMap.put("size", ssj.getTraySize());
|
||||
paramMap.put("floor", "1");
|
||||
paramMap.put("entranceId",ssj.getDeviceCode());
|
||||
AjaxResult result = apiService.selectMydoJobByTrayCodeAndEntranceId(paramMap);
|
||||
@@ -170,9 +174,15 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
inJob = BeanUtil.toBean(result.get("data"), MydoJob.class);
|
||||
inJob.setStatus(TASK_STATUS_CREATE);
|
||||
inJob.setExecutionPhase(TASK_EP_CREATE);
|
||||
inJob.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(inJob);
|
||||
} else {
|
||||
log.info("未检测到托盘码请求入库作业 rwh:{},trayCode:{}", ssj.getTaskNo(), ssj.getTrayCode());
|
||||
log.info("托盘码请求作业成功, rwh:{},trayCode:{}", ssj.getTaskNo(), ssj.getTrayCode());
|
||||
}else{
|
||||
//下发去向 和任务号
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", 2, 2);
|
||||
if (i == 1) {
|
||||
log.info("托盘码请求作业失败, rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 2, ssj.getTrayCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inJob != null) {
|
||||
@@ -184,7 +194,13 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
inJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
inJob.setTargetRoadwayId(Convert.toStr(1));
|
||||
mydoJobService.updateMydoJob(inJob);
|
||||
log.info("入库请求下发任务号加去向 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode());
|
||||
log.info("托盘码请求作业成功,下发任务号 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 1, ssj.getTrayCode());
|
||||
}
|
||||
}else{
|
||||
//下发去向 和任务号
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", 2, 2);
|
||||
if (i == 1) {
|
||||
log.info("托盘码请求作业失败,下发回退 rwh:{},qx:{},trayCode:{}", ssj.getTaskNo(), 2, ssj.getTrayCode());
|
||||
}
|
||||
}
|
||||
}else {
|
||||
@@ -204,42 +220,37 @@ public class Floor1BothWayInSsjThread implements Runnable {
|
||||
if (i == 1) {
|
||||
mydoJob.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("{}已重复下发任务号{}:",ssj.getDeviceCode(),mydoJob.getTaskNo());
|
||||
log.info("{}无条码请求作业,二次下发任务号{}:",ssj.getDeviceCode(),mydoJob.getTaskNo());
|
||||
}
|
||||
}else {
|
||||
//不存在扫不到托盘码的任务
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("size", ssj.getTraySize());
|
||||
// paramMap.put("size", ssj.getTraySize());
|
||||
paramMap.put("entranceId",ssj.getDeviceCode());
|
||||
AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
mydoJob2.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob2);
|
||||
log.info("{}已下发任务号{}:",ssj.getDeviceCode(),mydoJob2.getTaskNo());
|
||||
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);
|
||||
int i = writeToSsj(ssj.getPlcDbWriteAddress(), "99", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("{}下发错误信号{}:",ssj.getDeviceCode(),Integer.parseInt(ajaxResult.get("code").toString()));
|
||||
log.info("{}无条码请求作业失败,下发退回{}:",ssj.getDeviceCode(),Integer.parseInt(ajaxResult.get("code").toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ public class Floor1BothWayOutSsjThread implements Runnable {
|
||||
|
||||
private void dispatch1(List<DeviceSsj> ssjList) {
|
||||
for (DeviceSsj ssj : ssjList) {
|
||||
|
||||
if (ssj.getDw()==1 && ssj.getTaskNo()>0){
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Convert.toLong(ssj.getTaskNo()));
|
||||
if (ObjUtil.isNotNull(mydoJob) && mydoJob.getExecutionPhase().equals(TASK_EP_ROADWAY_SSJ)) {
|
||||
|
||||
@@ -75,10 +75,8 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
try {
|
||||
@@ -102,15 +100,22 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
//不允许放货 等着
|
||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 0 && "L1001".equals(inSsjDevice.getDeviceCode())) {
|
||||
//下发输送线切换导向 DB未知
|
||||
int i = writeToSsjQH("inSsjDevice.getPlcDbWriteAddress()", Integer.parseInt(agvQueues.get(0).getCtnrType()));
|
||||
int i = writeToSsjQH("DB802.106", Integer.parseInt(agvQueues.get(0).getCtnrType()));
|
||||
if (i == 1) {
|
||||
log.info("输送机{}下发切换导向{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getCtnrType());
|
||||
}
|
||||
}
|
||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 0 && "L1003".equals(inSsjDevice.getDeviceCode())) {
|
||||
//下发输送线切换导向 DB未知
|
||||
int i = writeToSsjQH("DB802.118", Integer.parseInt(agvQueues.get(0).getCtnrType()));
|
||||
if (i == 1) {
|
||||
log.info("输送机{}下发切换导向{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getCtnrType());
|
||||
}
|
||||
}
|
||||
|
||||
//允许放货
|
||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 1) {
|
||||
log.info("设备:{} 位置:{} 任务号:{} 请求放货成功", inSsjDevice.getDeviceCode(), "输送线", agvQueues.get(0).getTaskCode());
|
||||
if (!agvQueues.isEmpty() && inSsjDevice.getAllowPut() == 2) {
|
||||
log.info("设备:{} 位置:{} 任务号:{} 请求放货成功", inSsjDevice.getDeviceCode(), "输送线", agvQueues.get(0).getWmsTaskNo());
|
||||
AjaxResult ajaxResult = apiService.continueTask(agvQueues.get(0));
|
||||
if (ajaxResult.isSuccess()) {
|
||||
log.info("下发agv允许放货成功" + agvQueues.get(0).getWmsTaskNo());
|
||||
@@ -127,25 +132,37 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
|
||||
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueue);
|
||||
if (!agvQueues.isEmpty()) {
|
||||
int i = writeToSsj(inSsjDevice.getPlcDbWriteAddress(), agvQueues.get(0).getWmsTaskNo(), 1,1);
|
||||
if (i == 1) {
|
||||
log.info("输送机{}下发任务号{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getWmsTaskNo());
|
||||
apiService.deleteAgvTray(agvQueues.get(0));
|
||||
if("L1001".equals(inSsjDevice.getDeviceCode())) {
|
||||
int i = writeToSsj("DB802.100", agvQueues.get(0).getWmsTaskNo(), 2,Integer.parseInt(agvQueues.get(0).getCtnrType()));
|
||||
if (i == 1) {
|
||||
log.info("输送机{}AGV放货完成下发任务号{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getWmsTaskNo());
|
||||
|
||||
}
|
||||
}
|
||||
if("L1003".equals(inSsjDevice.getDeviceCode())) {
|
||||
int i = writeToSsj("DB802.112", agvQueues.get(0).getWmsTaskNo(), 2,Integer.parseInt(agvQueues.get(0).getCtnrType()));
|
||||
if (i == 1) {
|
||||
log.info("输送机{}AGV放货完成下发任务号{}成功", inSsjDevice.getDeviceCode(), agvQueues.get(0).getWmsTaskNo());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(inSsjDevice.getKx() == 0 && inSsjDevice.getTaskNo() > 0){
|
||||
if(inSsjDevice.getKx() == 0 && inSsjDevice.getTaskNo2() > 0){
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
agvQueue.setStatus("7"); //end
|
||||
//todo 与agv对点
|
||||
agvQueue.setPositionCode2(inSsjDevice.getDeviceCode());
|
||||
List<AgvQueue> agvQueues = agvQueueService.selectAgvQueueList(agvQueue);
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(agvQueues.get(0).getTaskCode());
|
||||
mydoJob.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
agvQueueService.insertHistory(agvQueues.get(0).getReqCode());
|
||||
agvQueueService.deleteAgvQueueByReqCode(agvQueues.get(0).getReqCode());
|
||||
if(agvQueues.size() > 0){
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(agvQueues.get(0).getTaskCode());
|
||||
mydoJob.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
agvQueueService.insertHistory(agvQueues.get(0).getReqCode());
|
||||
agvQueueService.deleteAgvQueueByReqCode(agvQueues.get(0).getReqCode());
|
||||
}
|
||||
}
|
||||
//出库到位
|
||||
if (inSsjDevice.getDw() == 1 && inSsjDevice.getTaskNo() > 0) {
|
||||
@@ -178,7 +195,7 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
List<MydoJob> outMydoJobList = mydoJobService.selectInOrOutMydoJobList(mydoJobParam);
|
||||
if(!outMydoJobList.isEmpty()){
|
||||
//todo 去向不明朗
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"0",2,2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"99",2,2);
|
||||
if (i == 1) {
|
||||
log.info(ssjDevice.getDeviceCode()+"有正执行的出库作业退回" );
|
||||
}
|
||||
@@ -214,6 +231,7 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
mydoJob2.setStatus("1");
|
||||
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
@@ -224,7 +242,7 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
}
|
||||
}else{
|
||||
//todo 去向不明朗
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"0",2,2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),"99",2,2);
|
||||
if (i == 1) {
|
||||
log.info(ssjDevice.getDeviceCode()+"输送机没取到作业下发输送线" );
|
||||
}
|
||||
@@ -263,6 +281,7 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
mydoJob2.setStatus("1");
|
||||
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
@@ -272,9 +291,9 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:" + mydoJob2.getTaskNo());
|
||||
}
|
||||
}else{
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(), "0", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(), "99", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
log.info(ssjDevice.getDeviceCode()+"输送机下发错误信息成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,43 +138,49 @@ public class Floor2RoadWaySsjThread implements Runnable {
|
||||
if("L1004".equals(roadSsjDevice.getDeviceCode())){
|
||||
exitList.add("l1003");
|
||||
}
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList(exitList);
|
||||
if (ObjUtil.isNotNull(mydoJob)) {
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
if (ObjUtil.isNull(basCargoSpace)) {
|
||||
log.error("货位不存在 cargoSpaceId{}", mydoJob.getCargoSpaceId());
|
||||
} else {
|
||||
//生成队列
|
||||
List<DdjDeviceExecutionQueue> list = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_2, Convert.toInt(mydoJob.getRoadwayId()));
|
||||
List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());
|
||||
if (CollUtil.isEmpty(list) && CollUtil.isNotEmpty(pclList)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(mydoJob.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName(mydoJob.getRoadwayId());
|
||||
ddjDeviceExecutionQueue.setDevId(Convert.toInt(mydoJob.getRoadwayId()));
|
||||
ddjDeviceExecutionQueue.setRwzt(0);
|
||||
ddjDeviceExecutionQueue.setYph(Convert.toInt(basCargoSpace.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setYlh(Convert.toInt(basCargoSpace.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setYch(Convert.toInt(basCargoSpace.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setMbph(pclList.get(0));
|
||||
ddjDeviceExecutionQueue.setMblh(pclList.get(1));
|
||||
ddjDeviceExecutionQueue.setMbch(pclList.get(2));
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setMlfs(5);
|
||||
ddjDeviceExecutionQueue.setSpare1(mydoJob.getTraySize());
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_1);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
List<MydoJob> inList = mydoJobService.getInJobByEntrance(exitList);
|
||||
if(inList.size() == 0){
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByExitList(exitList);
|
||||
if (ObjUtil.isNotNull(mydoJob)) {
|
||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByWmsCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
if (ObjUtil.isNull(basCargoSpace)) {
|
||||
log.error("货位不存在 cargoSpaceId{}", mydoJob.getCargoSpaceId());
|
||||
} else {
|
||||
//生成队列
|
||||
List<DdjDeviceExecutionQueue> list = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueListByRwlx(DDJ_RWLX_2, Convert.toInt(mydoJob.getRoadwayId()));
|
||||
List<Integer> pclList = roadwayMap.get(roadSsjDevice.getDeviceCode());
|
||||
if (CollUtil.isEmpty(list) && CollUtil.isNotEmpty(pclList)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(mydoJob.getTaskNo()));
|
||||
ddjDeviceExecutionQueue.setDevName(mydoJob.getRoadwayId());
|
||||
ddjDeviceExecutionQueue.setDevId(Convert.toInt(mydoJob.getRoadwayId()));
|
||||
ddjDeviceExecutionQueue.setRwzt(0);
|
||||
ddjDeviceExecutionQueue.setYph(Convert.toInt(basCargoSpace.getThePlatoon()));
|
||||
ddjDeviceExecutionQueue.setYlh(Convert.toInt(basCargoSpace.getTheColumn()));
|
||||
ddjDeviceExecutionQueue.setYch(Convert.toInt(basCargoSpace.getTheFloor()));
|
||||
ddjDeviceExecutionQueue.setMbph(pclList.get(0));
|
||||
ddjDeviceExecutionQueue.setMblh(pclList.get(1));
|
||||
ddjDeviceExecutionQueue.setMbch(pclList.get(2));
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setMlfs(5);
|
||||
ddjDeviceExecutionQueue.setSpare1(mydoJob.getTraySize());
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_1);
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
|
||||
//修改作业状态
|
||||
mydoJob.setStatus(TASK_STATUS_RUNNING);
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ);
|
||||
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
//修改作业状态
|
||||
mydoJob.setStatus(TASK_STATUS_RUNNING);
|
||||
mydoJob.setExecutionPhase(TASK_EP_DDJ);
|
||||
mydoJob.setStartTime(DateUtil.formatDateTime(DateUtil.date()));
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
log.info("当前出口"+ exitList+"存在入库任务,无法出库!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ruoyi.common.TaskStatusCode.*;
|
||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.deviceSsjMap;
|
||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.writeToSsj;
|
||||
import static com.ruoyi.schedule.plcRead.ssj.PlcSsjRead.*;
|
||||
|
||||
/**
|
||||
* 生产线输送机
|
||||
@@ -92,7 +91,8 @@ public class LineSsjThread implements Runnable {
|
||||
|
||||
public void inDispatch(DeviceSsj SsjDevice) {
|
||||
//如果到位,扫到条码,托盘大小,执行阶段卡控一下(下发输送机后改执行阶段)
|
||||
if (SsjDevice.getDw() == 1 && StrUtil.isNotBlank(SsjDevice.getTrayCode()) && SsjDevice.getTraySize() != 0 && SsjDevice.getTaskNo() < 1000) {
|
||||
if (SsjDevice.getRkqq() == 1 && StrUtil.isNotBlank(SsjDevice.getTrayCode())
|
||||
&& SsjDevice.getTraySize() != 0 && SsjDevice.getTaskNo() < 1000) {
|
||||
log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}", SsjDevice.getDeviceCode(), "产线到位", SsjDevice.getTrayCode(), SsjDevice.getTraySize());
|
||||
|
||||
//查作业,入如果已经有了,直接下发输送线
|
||||
@@ -107,14 +107,14 @@ public class LineSsjThread implements Runnable {
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectInOrOutMydoJobList(mydoJob);
|
||||
//有作业,下发输送机任务号,覆盖任务号
|
||||
if (!mydoJobs.isEmpty()) {
|
||||
//永远有且只有一条
|
||||
//永远有且只有一条
|
||||
mydoJob = mydoJobs.get(0);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), 1, 1);
|
||||
if (i == 1) {
|
||||
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("G1005产线输送机下发任务号成功:" + mydoJob.getTaskNo());
|
||||
}
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), Integer.parseInt(mydoJob.getTraySize()), 1);
|
||||
if (i == 1) {
|
||||
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("G1005产线输送机下发任务号成功:" + mydoJob.getTaskNo());
|
||||
}
|
||||
} else {
|
||||
|
||||
//请求wms生成入库作业
|
||||
@@ -127,17 +127,18 @@ public class LineSsjThread implements Runnable {
|
||||
AjaxResult ajaxResult = apiService.createInMydoJob(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
//拿到正常作业,插到wcs作业表,下发给输送机任务号,覆盖任务号
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class) ;
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||
mydoJob2.setStatus("1");
|
||||
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJob2.setTraySize(Convert.toStr(SsjDevice.getTraySize()));
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob2.getTaskNo(), Integer.parseInt(mydoJob2.getTraySize()), 1);
|
||||
if (i == 1) {
|
||||
mydoJob2.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob2);
|
||||
log.info("G1005产线输送机下发任务号成功:{}" , mydoJob2.getTaskNo());
|
||||
log.info("G1005产线输送机下发任务号成功:{}", mydoJob2.getTaskNo());
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
@@ -152,18 +153,24 @@ public class LineSsjThread implements Runnable {
|
||||
* 9, "创建工艺入库单失败!"
|
||||
*/
|
||||
//超大,给plc下发错误信息,AGV搬到缓存区 其余人工处理
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "0", (Integer) ajaxResult.get("code"), 2);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
if((Integer) ajaxResult.get("code") == 5){
|
||||
if ((Integer) ajaxResult.get("code") == 5) {
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "2222", 1, 1);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
createMoveToPort(SsjDevice);
|
||||
} else {
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "99", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SsjDevice.getDw() == 1 && StrUtil.isBlank(SsjDevice.getTrayCode()) && SsjDevice.getTraySize() != 0 && SsjDevice.getTaskNo() < 1000) {
|
||||
if (SsjDevice.getRkqq() == 1 && StrUtil.isBlank(SsjDevice.getTrayCode()) &&
|
||||
SsjDevice.getTraySize() != 0 && SsjDevice.getTaskNo() < 1000) {
|
||||
|
||||
log.info("设备:{} 位置:{} 条码:{} 托盘大小:{}", SsjDevice.getDeviceCode(), "产线", SsjDevice.getTrayCode(), SsjDevice.getTraySize());
|
||||
//查wcs有没作业,有下发给输送机任务号,覆盖任务号
|
||||
@@ -177,11 +184,11 @@ public class LineSsjThread implements Runnable {
|
||||
if (!mydoJobs.isEmpty()) {
|
||||
mydoJob = mydoJobs.get(0);
|
||||
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), 1, 1);
|
||||
if (i == 1) {
|
||||
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("G1005产线输送机下发任务号成功:" + mydoJob.getTaskNo());
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob.getTaskNo(), 1, 1);
|
||||
if (i == 1) {
|
||||
mydoJob.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
log.info("G1005产线输送机下发任务号成功:" + mydoJob.getTaskNo());
|
||||
|
||||
}
|
||||
} else {
|
||||
@@ -196,8 +203,9 @@ public class LineSsjThread implements Runnable {
|
||||
mydoJob2.setExecutionPhase("0");
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJob2.setTraySize(Convert.toStr(SsjDevice.getTraySize()));
|
||||
mydoJob2.setFaultFlag("0");
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), mydoJob2.getTaskNo(), 1, 1);
|
||||
if (i == 1) {
|
||||
mydoJob2.setExecutionPhase(TASK_EP_LINE_SSJ);
|
||||
mydoJobService.updateMydoJob(mydoJob2);
|
||||
@@ -207,13 +215,18 @@ public class LineSsjThread implements Runnable {
|
||||
//超大,给plc下发错误信息,等待人工处理
|
||||
//托盘大小对不上,给plc下发错误信息,等待人工处理
|
||||
//码不对,给plc下发错误信息,等待人工处理
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "0", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
//7是报工单失败,不处理
|
||||
if(!"9".equals(Integer.parseInt(ajaxResult.get("code").toString()))){
|
||||
|
||||
if ((Integer) ajaxResult.get("code") == 5) {
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "2222", 1, 1);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
createMoveToPort(SsjDevice);
|
||||
} else {
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(), "99", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,24 +257,27 @@ public class LineSsjThread implements Runnable {
|
||||
if (outMydoJobList.isEmpty() && kx == 1) {
|
||||
//查是否有队列,如果有了请求放货修改为允许放货
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByTaskCode(mydoJob.getJobId());
|
||||
if (agvQueue != null){
|
||||
if ("3".equals(mydoJob.getStatus()) && "1".equals(agvQueue.getStatus()) && SsjDevice.getAllowPut() == 1){
|
||||
if (agvQueue != null) {
|
||||
if ("3".equals(mydoJob.getStatus()) && "2".equals(agvQueue.getStatus()) && SsjDevice.getAllowPut() == 1) {
|
||||
AjaxResult ajaxResult = apiService.continueTask(agvQueue);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
log.info("给agv下发允许取货继续任务成功"+agvQueue.getWmsTaskNo());
|
||||
log.info("给agv下发允许取货继续任务成功" + agvQueue.getWmsTaskNo());
|
||||
agvQueue.setStatus("2");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if ("1".equals(mydoJob.getStatus())){
|
||||
if("0".equals(agvQueue.getStatus())){
|
||||
apiService.requestAgvQueue(agvQueue);
|
||||
}
|
||||
} else {
|
||||
if ("1".equals(mydoJob.getStatus())) {
|
||||
HashMap<String, String> paramMap = new HashMap<>();
|
||||
// paramMap.put("trayCode", mydoJob.getTrayCode());
|
||||
paramMap.put("taskNo", mydoJob.getJobId());
|
||||
paramMap.put("trayCode", mydoJob.getTrayCode());
|
||||
paramMap.put("taskCode",mydoJobParam.getJobId());
|
||||
//todo 与agv对点
|
||||
paramMap.put("startPoint", "G1005");
|
||||
paramMap.put("endPoint", deviceCode);
|
||||
paramMap.put("traySize",mydoJob.getTraySize());
|
||||
paramMap.put("traySize", mydoJob.getTraySize());
|
||||
paramMap.put("wmsTaskNo", mydoJob.getTaskNo());
|
||||
AjaxResult ajaxResult = apiService.receiveAgvMoveJob(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
@@ -272,17 +288,37 @@ public class LineSsjThread implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (SsjDevice.getDw() == 1 && SsjDevice.getTaskNo() == 2222 && SsjDevice.getTraySize() == 4) {
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByWmsTask(SsjDevice.getTaskNo());
|
||||
if (agvQueue != null) {
|
||||
if ("2".equals(agvQueue.getStatus()) && SsjDevice.getAllowPut() == 1) {
|
||||
AjaxResult ajaxResult = apiService.continueTask(agvQueue);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
log.info("给agv下发允许取货继续任务成功" + agvQueue.getWmsTaskNo());
|
||||
agvQueue.setStatus("2");
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SsjDevice.getDw() == 0 && SsjDevice.getTaskNo() > 1000 && SsjDevice.getTraySize() > 0) {
|
||||
AgvQueue agvQueue = agvQueueService.selectAgvQueueByWmsTask(SsjDevice.getTaskNo());
|
||||
if (agvQueue != null) {
|
||||
if ("4".equals(agvQueue.getStatus())) {
|
||||
int i = writeToSsjQH("DB802.122", 1);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发取货完成成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void createMoveToPort(DeviceSsj SsjDevice){
|
||||
|
||||
void createMoveToPort(DeviceSsj SsjDevice) {
|
||||
WcsPort wcsPort = new WcsPort();
|
||||
wcsPort.setStatus("1");
|
||||
List<WcsPort> wcsPorts = wcsPortService.selectWcsPortList(wcsPort);
|
||||
@@ -294,29 +330,23 @@ public class LineSsjThread implements Runnable {
|
||||
.map(WcsPort::getPortCode)
|
||||
.anyMatch(portCode -> portCode.equals(positionCode2)));
|
||||
|
||||
if(hasMatchingPort==false){
|
||||
if (hasMatchingPort == false) {
|
||||
|
||||
if(!wcsPorts.isEmpty()){
|
||||
if (!wcsPorts.isEmpty()) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
// map.put("trayCode", mydoJob.getTrayCode());
|
||||
map.put("taskNo", StrUtil.uuid());
|
||||
//todo 与agv对点
|
||||
map.put("startPoint", "G1005");
|
||||
map.put("endPoint", wcsPorts.get(0).getPortCode());
|
||||
// map.put("traySize",String.valueOf(SsjDevice.getTraySize()));
|
||||
map.put("traySize", "5");
|
||||
// map.put("wmsTaskNo", mydoJob.getTaskNo());
|
||||
AjaxResult ajaxResult1 = apiService.receiveAgvMoveJob(map);
|
||||
if(ajaxResult1.isSuccess()){
|
||||
log.info("G1005产线生成作业失败,AGV下发搬运至缓存点任务成功:{}" , ajaxResult1.get("data"));
|
||||
if (ajaxResult1.isSuccess()) {
|
||||
log.info("G1005产线生成作业失败,AGV下发搬运至缓存点任务成功:{}", ajaxResult1.get("data"));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user