123
This commit is contained in:
@@ -46,9 +46,6 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
ssjCodes.add("L1001");
|
||||
ssjCodes.add("L1003");
|
||||
ssjCodeList.put("inout", ssjCodes);
|
||||
ssjCodes.add("L1001");
|
||||
ssjCodes.add("L1003");
|
||||
ssjCodeList.put("sm", ssjCodes);
|
||||
apiService = SpringUtils.getBean(IApiService.class);
|
||||
agvQueueService = SpringUtils.getBean(IAgvQueueService.class);
|
||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
||||
@@ -69,6 +66,7 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
try {
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
inDispatch1(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
}
|
||||
@@ -78,19 +76,7 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
|
||||
}
|
||||
break;
|
||||
case "sm":
|
||||
//入库扫码
|
||||
for (String ssjCode : ssjCodeList.get(type)) {
|
||||
try {
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch1(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
try {
|
||||
@@ -171,9 +157,9 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
}
|
||||
|
||||
public void inDispatch1(DeviceSsj ssjDevice) {
|
||||
//有入库请求就肯定是电气的任务号的作业,如果有正执行的出库作业退回
|
||||
if(StrUtil.isNotBlank(ssjDevice.getTrayCode()) && ssjDevice.getRkqq()==1 && ssjDevice.getTaskNo()<=1000){
|
||||
|
||||
//有入库请求就肯定是电气的任务号的作业
|
||||
if(StrUtil.isNotBlank(ssjDevice.getTrayCode()) && ssjDevice.getRkqq()==1 && ssjDevice.getTaskNo()<1000){
|
||||
//,如果有正执行的出库作业退回
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setInOut("2");
|
||||
mydoJobParam.setStatus("3");
|
||||
@@ -185,22 +171,19 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
if (i == 1) {
|
||||
log.info(ssjDevice.getDeviceCode()+"有正执行的出库作业退回" );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
mydoJob.setInOrOut("1");
|
||||
// mydoJob.setStatus("1");
|
||||
String[] split = ssjDevice.getTrayCode().split(" ");
|
||||
String serial = split[2].substring(7);
|
||||
mydoJob.setTrayCode(serial);
|
||||
mydoJob.setFlag("1");
|
||||
mydoJob.setEntranceId(ssjDevice.getDeviceCode());
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(mydoJob);
|
||||
if(!mydoJobs.isEmpty()){
|
||||
MydoJob mydoJob1 = mydoJobs.get(0);
|
||||
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob1.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
mydoJob1.setExecutionPhase(TASK_EP_SSJ);
|
||||
@@ -214,6 +197,8 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("trayCode",ssjDevice.getTrayCode());
|
||||
map.put("entranceId",ssjDevice.getDeviceCode());
|
||||
map.put("size", ssjDevice.getTraySize());
|
||||
map.put("floor", "2");
|
||||
AjaxResult ajaxResult = apiService.selectMydoJobByTrayCodeAndEntranceId(map);
|
||||
if(ajaxResult.isSuccess()){
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class) ;
|
||||
@@ -239,6 +224,57 @@ public class Floor2InOutSsjThread implements Runnable {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(StrUtil.isBlank(ssjDevice.getTrayCode()) && ssjDevice.getRkqq()==1 && ssjDevice.getTaskNo()<1000){
|
||||
|
||||
MydoJob mydoJob1 = new MydoJob();
|
||||
mydoJob1.setInOrOut("1");
|
||||
mydoJob1.setEntranceId(ssjDevice.getDeviceCode());
|
||||
// mydoJob1.setStatus("1");
|
||||
|
||||
List<MydoJob> mydoJobs = mydoJobService.selectInOrOutMydoJobList(mydoJob1);
|
||||
if(!mydoJobs.isEmpty()){
|
||||
MydoJob mydoJob2 = mydoJobs.get(0);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
mydoJob2.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJob2.setStatus("3");
|
||||
mydoJobService.updateMydoJob(mydoJob2);
|
||||
log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:" + mydoJob2.getTaskNo());
|
||||
}
|
||||
|
||||
}else{
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("size", ssjDevice.getTraySize());
|
||||
paramMap.put("entranceId", ssjDevice.getDeviceCode());
|
||||
AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
|
||||
if(ajaxResult.isSuccess()){
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class) ;
|
||||
mydoJob2.setStatus("1");
|
||||
mydoJob2.setExecutionPhase(TASK_EP_CREATE);
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
mydoJob2.setExecutionPhase(TASK_EP_SSJ);
|
||||
mydoJob2.setStatus("3");
|
||||
mydoJobService.updateMydoJob(mydoJob2);
|
||||
log.info(ssjDevice.getDeviceCode()+"输送机下发任务号成功:" + mydoJob2.getTaskNo());
|
||||
}
|
||||
}else{
|
||||
int i = writeToSsj(ssjDevice.getPlcDbWriteAddress(), "0", Integer.parseInt(ajaxResult.get("code").toString()), 2);
|
||||
if (i == 1) {
|
||||
log.info("G1005产线输送机下发错误信息成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -187,9 +187,13 @@ public class LineSsjThread implements Runnable {
|
||||
//没有,请求错误接口,找作业,返回成功,//拿到正常作业,插到wcs作业表,下发给输送机任务号,覆盖任务号,shibai...
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("size", SsjDevice.getTraySize());
|
||||
paramMap.put("entranceId", "G1005");
|
||||
AjaxResult ajaxResult = apiService.selectMydoJobByNoTrayCode(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
MydoJob mydoJob2 = BeanUtil.toBean(ajaxResult.get("data"), MydoJob.class);
|
||||
mydoJob2.setStatus("1");
|
||||
mydoJob2.setExecutionPhase("0");
|
||||
mydoJob2.setCreateTime(new Date());
|
||||
mydoJobService.insertMydoJob(mydoJob2);
|
||||
int i = writeToSsj(SsjDevice.getPlcDbWriteAddress(),mydoJob2.getTaskNo(),1,1);
|
||||
if (i == 1) {
|
||||
|
||||
Reference in New Issue
Block a user