更新
This commit is contained in:
@@ -49,6 +49,14 @@ public interface StorageCellService {
|
||||
*/
|
||||
StorageCellDto findByCode(String code);
|
||||
|
||||
/**
|
||||
* 根据地址查询
|
||||
*
|
||||
* @param address address
|
||||
* @return StorageCell
|
||||
*/
|
||||
StorageCellDto findByAddress(String address);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
|
||||
@@ -5,6 +5,7 @@ package org.nl.acs.device.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -64,16 +65,33 @@ public class StorageCellServiceImpl implements StorageCellService {
|
||||
public StorageCellDto findById(String storage_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
||||
JSONObject json = wo.query("storage_id ='" + storage_id + "'").uniqueResult(0);
|
||||
final StorageCellDto obj = json.toJavaObject(StorageCellDto.class);
|
||||
return obj;
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
final StorageCellDto obj = json.toJavaObject(StorageCellDto.class);
|
||||
return obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageCellDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final StorageCellDto obj = json.toJavaObject(StorageCellDto.class);
|
||||
return obj;
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
final StorageCellDto obj = json.toJavaObject(StorageCellDto.class);
|
||||
return obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageCellDto findByAddress(String address) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
||||
JSONObject json = wo.query("address ='" + address + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
final StorageCellDto obj = json.toJavaObject(StorageCellDto.class);
|
||||
return obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,11 +57,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
int agvaddr_copy = 0;
|
||||
int weight = 0;
|
||||
String device_code = "";
|
||||
|
||||
int phase = 0;
|
||||
public synchronized void processSocket(int[] arr) throws Exception {
|
||||
device_code = this.getDeviceCode();
|
||||
byte[] data = null;
|
||||
int phase = arr[16] * 256 + arr[17];
|
||||
phase = arr[16] * 256 + arr[17];
|
||||
// agv任务号
|
||||
int index = arr[12] * 256 + arr[13];
|
||||
//任务号
|
||||
|
||||
@@ -53,13 +53,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
int agvaddr_copy = 0;
|
||||
int weight = 0;
|
||||
String device_code = "";
|
||||
int phase = 0;
|
||||
|
||||
|
||||
public synchronized void processSocket(int[] arr) throws Exception {
|
||||
device_code = this.getDeviceCode();
|
||||
logServer.deviceLogToacs(this.device_code,"","","接收AGV上报信息:" + arr);
|
||||
|
||||
byte[] data = null;
|
||||
int phase = arr[16] * 256 + arr[17];
|
||||
phase = arr[16] * 256 + arr[17];
|
||||
// agv任务号
|
||||
int index = arr[12] * 256 + arr[13];
|
||||
//任务号
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.nl.acs.device_driver.basedriver.agv.utils;
|
||||
|
||||
public interface IAgv {
|
||||
String getPhaseName(Integer phase);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.nl.acs.device_driver.basedriver.agv.utils;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class OneAgvPhase implements IAgv{
|
||||
@Override
|
||||
public String getPhaseName(Integer phase) {
|
||||
if (phase == 0x01) {
|
||||
return "开始任务/上报订单号";
|
||||
} else if (phase == 0x02){
|
||||
return "分配车id";
|
||||
} else if (phase == 0x03){
|
||||
return "到达取货点";
|
||||
} else if (phase == 0x05){
|
||||
return "取货完毕";
|
||||
} else if (phase == 0x07){
|
||||
return "到达放货点";
|
||||
} else if (phase == 0x09){
|
||||
return "放货完毕";
|
||||
} else if (phase == 0x0A){
|
||||
return "任务完毕";
|
||||
} else if (phase == 0x30){
|
||||
return "请求删除任务";
|
||||
} else if (phase == 0xFF){
|
||||
return "任务删除确认";
|
||||
} else if (phase == 0x64){
|
||||
return "到达位置点";
|
||||
} else if (phase == 0x65){
|
||||
return "称重就绪";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.nl.acs.device_driver.basedriver.agv.utils;
|
||||
|
||||
public class TwoAgvPhase implements IAgv {
|
||||
@Override
|
||||
public String getPhaseName(Integer phase) {
|
||||
if (phase == 0x01) {
|
||||
return "开始任务/上报订单号";
|
||||
} else if (phase == 0x02){
|
||||
return "分配车id";
|
||||
} else if (phase == 0x03){
|
||||
return "到达取货点1";
|
||||
} else if (phase == 0x05){
|
||||
return "取货点1取货完毕";
|
||||
} else if (phase == 0x07){
|
||||
return "到达取货点2";
|
||||
} else if (phase == 0x09){
|
||||
return "取货点2取货完毕";
|
||||
} else if (phase == 0x0A){
|
||||
return "自动缓存线--到达送满框1";
|
||||
} else if (phase == 0x0B){
|
||||
return "到达倒料点1";
|
||||
} else if (phase == 0x0C){
|
||||
return "自动缓存线--送满框完毕1";
|
||||
} else if (phase == 0x0D){
|
||||
return "倒料点1倒料完毕";
|
||||
} else if (phase == 0x0E){
|
||||
return "自动缓存线--到达取空框1";
|
||||
} else if (phase == 0x0F){
|
||||
return "到达倒料点2";
|
||||
} else if (phase == 0x11){
|
||||
return "倒料点2倒料完毕";
|
||||
} else if (phase == 0x13){
|
||||
return "到达送箱点1";
|
||||
} else if (phase == 0x15){
|
||||
return "送箱点1送箱完毕";
|
||||
} else if (phase == 0x17){
|
||||
return "到达送箱点2";
|
||||
} else if (phase == 0x19){
|
||||
return "送箱完毕/送空框完毕2";
|
||||
} else if (phase == 0x30){
|
||||
return "请求删除任务";
|
||||
} else if (phase == 0xFF){
|
||||
return "任务删除确认";
|
||||
} else if (phase == 0x64){
|
||||
return "取货完毕/取满框完毕1/点对点取货完毕";
|
||||
} else if (phase == 0x65){
|
||||
return "称重就绪";
|
||||
} else if (phase == 0x1A){
|
||||
return "任务完毕";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -369,6 +369,9 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
writing("to_agv_release_finish", "1");
|
||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
||||
OneNDCSocketConnectionAutoRun.write(data);
|
||||
String next_device_code = inst.getNext_device_code();
|
||||
Device next_device = deviceAppservice.findDeviceByCode(next_device_code);
|
||||
next_device.setMaterial_type(inst.getMaterial());
|
||||
agvphase = 0;
|
||||
index = 0;
|
||||
inst = null;
|
||||
|
||||
@@ -12,7 +12,14 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.service.StorageCellService;
|
||||
import org.nl.acs.device.service.dto.StorageCellDto;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.agv.utils.IAgv;
|
||||
import org.nl.acs.device_driver.basedriver.agv.utils.OneAgvPhase;
|
||||
import org.nl.acs.device_driver.basedriver.agv.utils.TwoAgvPhase;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_machine_storage_station.HailiangCleaningMachineStorageStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_cache.HailiangEngravingCacheDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_packer_station.HailiangPackerStationDeviceDriver;
|
||||
@@ -305,12 +312,16 @@ public class StageActorServiceImpl implements StageActorService {
|
||||
StandardCoveyorControlWithPlcScannerDeviceDriver standardCoveyorControlWithPlcScannerDeviceDriver;
|
||||
//扫码器
|
||||
StandardScannerDeviceDriver standardScannerDeviceDriver;
|
||||
//包装机
|
||||
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver;
|
||||
//自动门
|
||||
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
|
||||
//清洗倒料位
|
||||
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver;
|
||||
|
||||
//单工agv
|
||||
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
|
||||
//双工agv
|
||||
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver) {
|
||||
hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangSpecialDeviceDriver.getMode() == 0) {
|
||||
@@ -464,6 +475,7 @@ public class StageActorServiceImpl implements StageActorService {
|
||||
} else {
|
||||
empty_req = "是";
|
||||
}
|
||||
jo.put("material_type",device.getMaterial_type());
|
||||
jo.put("lack_req", lack_req);
|
||||
jo.put("empty_req", empty_req);
|
||||
jo.put("is_click", true);
|
||||
@@ -483,6 +495,29 @@ public class StageActorServiceImpl implements StageActorService {
|
||||
jo.put("driver_type",device.getDeviceDriverDefination().getDriverCode());
|
||||
obj.put("device_name", hailiangPackerStationDeviceDriver.getDevice().getDevice_name());
|
||||
|
||||
} else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
|
||||
StorageCellService storageCellService = SpringContextHolder.getBean("StorageCellService");
|
||||
IAgv oneAgv = SpringContextHolder.getBean(OneAgvPhase.class);
|
||||
obj.put("device_name", agvNdcOneDeviceDriver.getDevice().getDevice_name());
|
||||
int agvaddr_copy = agvNdcOneDeviceDriver.getAgvaddr_copy();
|
||||
StorageCellDto storageCellDto = storageCellService.findByAddress(agvaddr_copy + "");
|
||||
jo.put("address",storageCellDto.getAddress());
|
||||
int phase = agvNdcOneDeviceDriver.getPhase();
|
||||
String phaseName = oneAgv.getPhaseName(phase);
|
||||
jo.put("phaseName",phaseName);
|
||||
} else if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
|
||||
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
|
||||
IAgv twoAgv = SpringContextHolder.getBean(TwoAgvPhase.class);
|
||||
obj.put("device_name", agvNdcTwoDeviceDriver.getDevice().getDevice_name());
|
||||
int agvaddr_copy = agvNdcTwoDeviceDriver.getAgvaddr_copy();
|
||||
StorageCellService storageCellService = SpringContextHolder.getBean("StorageCellService");
|
||||
StorageCellDto storageCellDto = storageCellService.findByAddress(agvaddr_copy + "");
|
||||
jo.put("address",storageCellDto.getAddress());
|
||||
int phase = agvNdcTwoDeviceDriver.getPhase();
|
||||
String phaseName = twoAgv.getPhaseName(phase);
|
||||
jo.put("phaseName",phaseName);
|
||||
|
||||
} else if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
// if (hailiangCleaningMachineStorageStationDeviceDriver.getMode() == 0) {
|
||||
|
||||
@@ -450,6 +450,12 @@ export default {
|
||||
} else if (val === 'empty_req') {
|
||||
const obj = { name: '请求取走空料斗', value: data[val] }
|
||||
arr.push(obj)
|
||||
} else if (val === 'address') {
|
||||
const obj = { name: 'agv位置', value: data[val] }
|
||||
arr.push(obj)
|
||||
} else if (val === 'phaseName') {
|
||||
const obj = { name: 'phase', value: data[val] }
|
||||
arr.push(obj)
|
||||
}
|
||||
}
|
||||
return arr
|
||||
|
||||
Reference in New Issue
Block a user