This commit is contained in:
2022-07-01 13:35:02 +08:00
parent c385740b22
commit 2073981be2
25 changed files with 608 additions and 380 deletions

View File

@@ -2,7 +2,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: dev
active: prod
jackson:
time-zone: GMT+8
data:

View File

@@ -0,0 +1,86 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.opc.Device;
import org.nl.acs.stage.service.utils.StageActorUtil;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* @author geng by
* @param <T>
* 抽象类
*/
public class AbstractDriverService<T> implements IDriverService{
@Override
public JSONObject getDeviceInfo(Device device) {
return null;
}
public JSONObject getCommonDeviceInfo(T t){
JSONObject map = new JSONObject();
try {
Class<?> tClass = t.getClass();
Method methodMode = tClass.getMethod("getMode");
Method methodMove = tClass.getMethod("getMove");
Integer mode = (Integer) methodMode.invoke(t);
Integer move = (Integer) methodMove.invoke(t);
map.put("move",StageActorUtil.getMove(move));
map.put("hasGoods",StageActorUtil.getHasGoods(move));
map.put("mode",StageActorUtil.getMode(mode));
map.put("isOnline",StageActorUtil.getIsOnline(mode));
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return map;
}
public JSONObject getCommonDeviceInfo(T t,int i){
JSONObject map = new JSONObject();
try {
Class<?> tClass = t.getClass();
Method methodMode = tClass.getMethod("getMode");
Integer mode = (Integer) methodMode.invoke(t);
map.put("mode",StageActorUtil.getMode(mode));
map.put("isOnline",StageActorUtil.getIsOnline(mode));
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return map;
}
public JSONObject getCommonDeviceInfo(T t,int i,int j){
JSONObject map = new JSONObject();
try {
Class<?> tClass = t.getClass();
Method methodMode = tClass.getMethod("getMode");
Method methodMove = tClass.getMethod("getMove");
Method methodGetHasGoods = tClass.getMethod("getHasGoods");
Method methodGetIsonline = tClass.getMethod("getIsonline");
Integer mode = (Integer) methodMode.invoke(t);
Integer move = (Integer) methodMove.invoke(t);
Integer hasGoods = (Integer) methodGetHasGoods.invoke(t);
Boolean isOnline = (Boolean) methodGetIsonline.invoke(t);
map.put("mode",StageActorUtil.getMode(mode,0));
map.put("move",StageActorUtil.getMove(move));
map.put("hasGoods",hasGoods);
map.put("isOnline",isOnline);
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return map;
}
}

View File

@@ -0,0 +1,33 @@
package org.nl.acs.common;
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_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
import org.nl.acs.device_driver.basedriver.agv.utils.IAgv;
import org.nl.acs.device_driver.basedriver.agv.utils.OneAgvPhase;
import org.nl.acs.opc.Device;
import org.nl.acs.stage.service.utils.StageActorUtil;
import org.nl.utils.SpringContextHolder;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 单工agv
*/
@Service("agv_ndc_one")
@RequiredArgsConstructor
@Slf4j
public class AgvNdcOneDevice extends AbstractDriverService {
private final StorageCellService storageCellService;
@Override
public JSONObject getDeviceInfo(Device device) {
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
IAgv oneAgv = SpringContextHolder.getBean(OneAgvPhase.class);
JSONObject jo = new JSONObject();
jo.put("address", StageActorUtil.getAddress(storageCellService.findByAddress(agvNdcOneDeviceDriver.getAgvaddr_copy() + "")));
jo.put("phaseName", oneAgv.getPhaseName(agvNdcOneDeviceDriver.getPhase()));
return jo;
}
}

View File

@@ -0,0 +1,32 @@
package org.nl.acs.common;
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_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver;
import org.nl.acs.device_driver.basedriver.agv.utils.IAgv;
import org.nl.acs.device_driver.basedriver.agv.utils.TwoAgvPhase;
import org.nl.acs.opc.Device;
import org.nl.acs.stage.service.utils.StageActorUtil;
import org.nl.utils.SpringContextHolder;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 双工agv
*/
@Service("agv_ndc_two")
@RequiredArgsConstructor
@Slf4j
public class AgvNdcTwoDevice extends AbstractDriverService {
private final StorageCellService storageCellService;
@Override
public JSONObject getDeviceInfo(Device device) {
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
IAgv twoAgv = SpringContextHolder.getBean(TwoAgvPhase.class);
JSONObject jo = new JSONObject();
jo.put("address", StageActorUtil.getAddress(storageCellService.findByAddress(agvNdcTwoDeviceDriver.getAgvaddr_copy() + "")));
jo.put("phaseName",twoAgv.getPhaseName(agvNdcTwoDeviceDriver.getPhase()));
return jo;
}
}

View File

@@ -0,0 +1,25 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_machine_storage_station.HailiangCleaningMachineStorageStationDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 清洗机
*/
@Service("hailiang_cleaning_machine_storage_station")
public class HailiangCleaningMachineStorageDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangCleaningMachineStorageStationDeviceDriver, 0);
jo.put("isError", hailiangCleaningMachineStorageStationDeviceDriver.getIserror());
jo.put("error", hailiangCleaningMachineStorageStationDeviceDriver.getError());
jo.put("weight", hailiangCleaningMachineStorageStationDeviceDriver.getSilo_weight());
jo.put("qty", hailiangCleaningMachineStorageStationDeviceDriver.getFull_number());
jo.put("material", hailiangCleaningMachineStorageStationDeviceDriver.getMaterial());
return jo;
}
}

View File

@@ -0,0 +1,23 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_cache.HailiangEngravingCacheDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 刻字缓存位
*/
@Service("hailiang_engraving_cache")
public class HailiangEngravingCacheDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangEngravingCacheDeviceDriver hailiangEngravingCacheDeviceDriver = (HailiangEngravingCacheDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangEngravingCacheDeviceDriver);
jo.put("is_click", true);
jo.put("device_type",device.getDevice_type());
jo.put("driver_type",device.getDeviceDriverDefination().getDriverCode());
jo.put("material_type",device.getMaterial_type());
return jo;
}
}

View File

@@ -0,0 +1,24 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_machine.HailiangEngravingMachineDeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.stage.service.utils.StageActorUtil;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 刻字机
*/
@Service("hailiang_engraving_machine")
public class HailiangEngravingMachineDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangEngravingMachineDeviceDriver hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangEngravingMachineDeviceDriver);
jo.put("empty_req",StageActorUtil.getIsOrNo(hailiangEngravingMachineDeviceDriver.getEmpty_req()));
jo.put("full_req", StageActorUtil.getIsOrNo(hailiangEngravingMachineDeviceDriver.getFull_req()));
jo.put("error", hailiangEngravingMachineDeviceDriver.getError());
jo.put("material_type", device.getMaterial_type());
return jo;
}
}

View File

@@ -0,0 +1,29 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_packer_station.HailiangPackerStationDeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.stage.service.utils.StageActorUtil;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 包装机
*/
@Service("hailiang_packer_station")
public class HailiangPackerStationDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangPackerStationDeviceDriver);
jo.put("material_type",device.getMaterial_type());
jo.put("lack_req", StageActorUtil.getIsOrNo(hailiangPackerStationDeviceDriver.getLack_req()));
jo.put("empty_req", StageActorUtil.getIsOrNo(hailiangPackerStationDeviceDriver.getReq_task_empty()));
jo.put("is_click", true);
jo.put("device_type",device.getDevice_type());
Boolean requireSucess = hailiangPackerStationDeviceDriver.getRequireSucess();
jo.put("requestSucess",StageActorUtil.getRequestSucess(requireSucess));
jo.put("requireSucess",StageActorUtil.getRequireSucess(requireSucess));
jo.put("driver_type",device.getDeviceDriverDefination().getDriverCode());
return jo;
}
}

View File

@@ -0,0 +1,37 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @author geng by
* 专机
*/
@Service("hailiang_special_device")
public class HailiangSpecialDevice extends AbstractDriverService{
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangSpecialDeviceDriver hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangSpecialDeviceDriver,0);
jo.put("isError", hailiangSpecialDeviceDriver.getIserror());
jo.put("error", hailiangSpecialDeviceDriver.getError());
jo.put("empty_is_lack", hailiangSpecialDeviceDriver.getEmpty_is_lack());
jo.put("empty_is_finish", hailiangSpecialDeviceDriver.getEmpty_is_finish());
jo.put("full_ready_req_agv", hailiangSpecialDeviceDriver.getFull_ready_req_agv());
jo.put("full_out", hailiangSpecialDeviceDriver.getFull_out());
jo.put("finish", hailiangSpecialDeviceDriver.getFinish());
jo.put("order_compel_finish", hailiangSpecialDeviceDriver.getOrder_compel_finish());
jo.put("now_order_prod_num", hailiangSpecialDeviceDriver.getNow_order_prod_num());
jo.put("now_one_prod_num", hailiangSpecialDeviceDriver.getNow_one_box_num());
jo.put("task", hailiangSpecialDeviceDriver.getTask());
jo.put("full_number", hailiangSpecialDeviceDriver.getFull_number());
jo.put("storage_stock_num", hailiangSpecialDeviceDriver.getStorage_stock_num());
jo.put("line_stock_num", hailiangSpecialDeviceDriver.getLine_stock_num());
jo.put("order_prod_allnum", hailiangSpecialDeviceDriver.getOrder_prod_allnum());
jo.put("order", hailiangSpecialDeviceDriver.getOrder());
return jo;
}
}

View File

@@ -0,0 +1,23 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_empty_station.HailiangSpecialEmptyStationDeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.stage.service.utils.StageActorUtil;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 空料口
*/
@Service("hailiang_special_empty_station")
public class HailiangSpecialEmptyDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangSpecialEmptyStationDeviceDriver hailiangSpecialEmptyStationDeviceDriver = (HailiangSpecialEmptyStationDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangSpecialEmptyStationDeviceDriver,0);
jo.put("move", StageActorUtil.getMove(hailiangSpecialEmptyStationDeviceDriver.getMove()));
jo.put("hasGoods", StageActorUtil.getHasGoods(hailiangSpecialEmptyStationDeviceDriver.getMove(),0));
jo.put("isError", hailiangSpecialEmptyStationDeviceDriver.getIserror());
return jo;
}
}

View File

@@ -0,0 +1,21 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_full_station.HailiangSpecialFullStationDeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.stage.service.utils.StageActorUtil;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 满料口
*/
@Service("hailiang_special_full_station")
public class HailiangSpecialFullDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangSpecialFullStationDeviceDriver hailiangSpecialFullStationDeviceDriver = (HailiangSpecialFullStationDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangSpecialFullStationDeviceDriver);
jo.put("isError", hailiangSpecialFullStationDeviceDriver.getIserror());
return jo;
}
}

View File

@@ -0,0 +1,21 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_pick_station.HailiangSpecialPickStationDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 接料口
*/
@Service("hailiang_special_pick_station")
public class HailiangSpecialPickDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangSpecialPickStationDeviceDriver hailiangSpecialPickStationDeviceDriver = (HailiangSpecialPickStationDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangSpecialPickStationDeviceDriver, 0);
jo.put("isError", hailiangSpecialPickStationDeviceDriver.getIserror());
jo.put("full_number", hailiangSpecialPickStationDeviceDriver.getFull_number());
return jo;
}
}

View File

@@ -0,0 +1,25 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_pour_station.HailiangSpecialPourStationDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 倒料
*/
@Service("hailiang_special_pour_station")
public class HailiangSpecialPourDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangSpecialPourStationDeviceDriver hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangSpecialPourStationDeviceDriver,0);
jo.put("isError", hailiangSpecialPourStationDeviceDriver.getIserror());
jo.put("full_number", hailiangSpecialPourStationDeviceDriver.getFull_number());
jo.put("storage_stock_num", hailiangSpecialPourStationDeviceDriver.getStorage_stock_num());
jo.put("line_stock_num", hailiangSpecialPourStationDeviceDriver.getLine_stock_num());
return jo;
}
}

View File

@@ -0,0 +1,9 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.opc.Device;
public interface IDriverService {
JSONObject getDeviceInfo(Device device);
}

View File

@@ -0,0 +1,33 @@
package org.nl.acs.common;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_plcscanner.StandardCoveyorControlWithPlcScannerDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 输送机-控制点-PLC扫码器
*/
@Service("standard_conveyor_control_with_plcscanner")
public class StandardCoveyorControlWithPlcScannerDevice extends AbstractDriverService{
@Override
public JSONObject getDeviceInfo(Device device) {
StandardCoveyorControlWithPlcScannerDeviceDriver standardCoveyorControlWithPlcScannerDeviceDriver = (StandardCoveyorControlWithPlcScannerDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(standardCoveyorControlWithPlcScannerDeviceDriver,0,0);
jo.put("error", standardCoveyorControlWithPlcScannerDeviceDriver.getError());
jo.put("isError", standardCoveyorControlWithPlcScannerDeviceDriver.getIserror());
jo.put("height", standardCoveyorControlWithPlcScannerDeviceDriver.getHeight());
jo.put("operation_type", standardCoveyorControlWithPlcScannerDeviceDriver.getOperation_type());
jo.put("direction", standardCoveyorControlWithPlcScannerDeviceDriver.getDirection());
jo.put("action", standardCoveyorControlWithPlcScannerDeviceDriver.getAction());
jo.put("ioaction", standardCoveyorControlWithPlcScannerDeviceDriver.getIoaction());
jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithPlcScannerDeviceDriver.getBarcode()) ? "" : standardCoveyorControlWithPlcScannerDeviceDriver.getBarcode());
jo.put("message", StrUtil.isEmpty(standardCoveyorControlWithPlcScannerDeviceDriver.getMessage()) ? "" : standardCoveyorControlWithPlcScannerDeviceDriver.getMessage());
jo.put("requestSucess", standardCoveyorControlWithPlcScannerDeviceDriver.getRequireSucess().toString());
jo.put("applySucess", standardCoveyorControlWithPlcScannerDeviceDriver.getApplySucess().toString());
jo.put("instruction_message", standardCoveyorControlWithPlcScannerDeviceDriver.getInst_message());
return jo;
}
}

View File

@@ -0,0 +1,39 @@
package org.nl.acs.common;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 输送机控制点-带扫描驱动
*
*/
@Service("standard_conveyor_control_with_scanner")
public class StandardCoveyorControlWithScannerDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(standardCoveyorControlWithScannerDeviceDriver,0,0);
jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError());
jo.put("isError", standardCoveyorControlWithScannerDeviceDriver.getIserror());
jo.put("height", standardCoveyorControlWithScannerDeviceDriver.getHeight());
jo.put("operation_type", standardCoveyorControlWithScannerDeviceDriver.getOperation_type());
jo.put("direction", standardCoveyorControlWithScannerDeviceDriver.getDirection());
jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction());
jo.put("ioaction", standardCoveyorControlWithScannerDeviceDriver.getIoaction());
try {
jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithScannerDeviceDriver.barcode()) ? "" : standardCoveyorControlWithScannerDeviceDriver.barcode());
} catch (Exception e) {
e.printStackTrace();
}
jo.put("message", StrUtil.equals(standardCoveyorControlWithScannerDeviceDriver.getMessage(), "null") ? "" : standardCoveyorControlWithScannerDeviceDriver.getMessage());
jo.put("requestSucess", standardCoveyorControlWithScannerDeviceDriver.getRequireSucess().toString());
jo.put("applySucess", standardCoveyorControlWithScannerDeviceDriver.getApplySucess().toString());
jo.put("instruction_message", standardCoveyorControlWithScannerDeviceDriver.getInst_message());
return jo;
}
}

View File

@@ -0,0 +1,24 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 检测站点
*/
@Service("standard_inspect_site")
public class StandardInspectSiteDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(standardInspectSiteDevicedriver, 0, 0);
jo.put("error", standardInspectSiteDevicedriver.getError());
jo.put("isError", standardInspectSiteDevicedriver.getIserror());
jo.put("container", standardInspectSiteDevicedriver.getContainer());
jo.put("message", standardInspectSiteDevicedriver.getMessage());
return jo;
}
}

View File

@@ -0,0 +1,35 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.stage.service.utils.StageActorUtil;
import org.springframework.stereotype.Service;
/**
* @author geng by
* 普通站点
*/
@Service("standard_ordinary_site")
public class StandardOrdinarySiteDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
JSONObject jo = new JSONObject();
jo.put("move", StageActorUtil.getMove(standardOrdinarySiteDeviceDriver.getHasGoods()));
jo.put("container", standardOrdinarySiteDeviceDriver.getContainer());
jo.put("hasGoods", standardOrdinarySiteDeviceDriver.getHasGoods());
jo.put("isOnline", true);
//点击弹出
jo.put("is_click", true);
jo.put("device_type", device.getDevice_type());
jo.put("error", standardOrdinarySiteDeviceDriver.getError());
jo.put("isError", standardOrdinarySiteDeviceDriver.getIserror());
jo.put("container", standardOrdinarySiteDeviceDriver.getContainer());
jo.put("message", standardOrdinarySiteDeviceDriver.getMessage());
jo.put("material", standardOrdinarySiteDeviceDriver.getMaterial());
jo.put("batch", standardOrdinarySiteDeviceDriver.getBatch());
return jo;
}
}

View File

@@ -260,6 +260,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
next_device.setMaterial_type(inst.getMaterial());
JSONObject updatejson = new JSONObject();
updatejson.put("hasgoods","2");
updatejson.put("islock","0");
updatejson.put("material_type",inst.getMaterial());
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
}
@@ -269,6 +270,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
next_device.setMaterial_type("");
JSONObject updatejson = new JSONObject();
updatejson.put("hasgoods","1");
updatejson.put("islock","0");
updatejson.put("material_type","");
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
}

View File

@@ -39,6 +39,7 @@ import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.WQLObject;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.unit.DataUnit;
import java.util.Date;
import java.util.HashMap;
@@ -555,6 +556,8 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
}
public synchronized boolean apply_task() throws Exception {
WQLObject runpointwo = WQLObject.getWQLObject("acs_device_runpoint");
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
@@ -590,6 +593,11 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
if(num != 0){
continue;
}
//判断缓存位是否锁定
JSONObject jsonObject = runpointwo.query("device_code = '" + next_device_code + "' and islock = '1'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)){
continue;
}
TaskDto onedto = new TaskDto();
String now = DateUtil.now();
onedto.setTask_id(IdUtil.simpleUUID());
@@ -611,9 +619,14 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
onedto.setNext_point_code(next_device_code);
onedto.setUpdate_time(now);
onedto.setCreate_time(now);
try {
taskserver.create(onedto);
//任务创建成功 锁定
JSONObject map = new JSONObject();
map.put("islock","1");
map.put("update_by","auto");
map.put("update_time", DateUtil.now());
runpointwo.update(map,"device_code = '" + next_device_code + "'");
flag = true;
break;
} catch (Exception e) {

View File

@@ -426,6 +426,8 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
public void set_last_container_type_desc(String type) {
}
public synchronized boolean apply_take_empty_task() throws Exception {
WQLObject runpointwo = WQLObject.getWQLObject("acs_device_runpoint");
Date date = new Date();
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
@@ -457,6 +459,11 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
if(num != 0){
continue;
}
//判断缓存位是否锁定
JSONObject jsonObject = runpointwo.query("device_code = '" + next_device_code + "' and islock = '1'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)){
continue;
}
TaskDto onedto = new TaskDto();
String now = DateUtil.now();
onedto.setTask_id(IdUtil.simpleUUID());
@@ -477,6 +484,12 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
onedto.setCreate_time(now);
try {
taskserver.create(onedto);
//任务创建成功 锁定
JSONObject map = new JSONObject();
map.put("islock","1");
map.put("update_by","auto");
map.put("update_time", DateUtil.now());
runpointwo.update(map,"device_code = '" + next_device_code + "'");
flag = true;
break;
} catch (Exception e) {

View File

@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.common.IDriverService;
import org.nl.acs.device.service.StorageCellService;
import org.nl.acs.device.service.dto.StorageCellDto;
import org.nl.acs.device_driver.DeviceDriver;
@@ -51,6 +52,7 @@ import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.ResultBean;
import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -74,7 +76,7 @@ import java.util.Map;
public class StageActorServiceImpl implements StageActorService {
private final RedisUtils redisUtils;
private final StorageCellService storageCellService;
private final ApplicationContext applicationContext;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
@@ -230,7 +232,7 @@ public class StageActorServiceImpl implements StageActorService {
JSONObject stageObj;
//先从缓存查找
stageObj = JSON.parseObject(redisUtils.get("stage:mst:" + stage_code)==null? (String) redisUtils.get("stage:mst:" + stage_code) :redisUtils.get("stage:mst:" + stage_code).toString());
stageObj = JSON.parseObject(redisUtils.get("stage:mst:" + stage_code) == null ? (String) redisUtils.get("stage:mst:" + stage_code) : redisUtils.get("stage:mst:" + stage_code).toString());
//缓存没找到去数据库查找
if (MapUtil.isEmpty(stageObj)) {
stageObj = stageTab.query("is_delete ='0' and stage_code = '" + stage_code + "'").uniqueResult(0);
@@ -255,7 +257,6 @@ public class StageActorServiceImpl implements StageActorService {
list = actorTab.query("stage_uuid = '" + stage_uuid + "'", "index_seq").getResultJSONArray(0);
}
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
for (int i = 0, j = list.size(); i < j; i++) {
JSONObject json = list.getJSONObject(i);
JSONObject obj = new JSONObject();
@@ -264,387 +265,27 @@ public class StageActorServiceImpl implements StageActorService {
obj.put("device_code", json.getString("device_code"));
String device_code = json.getString("device_code");
if (!StrUtil.isEmpty(device_code)) {
//作业状态
String mode = "";
//信号
String move = "";
//取放信号
String action = "";
//进出信号
String io_action = "";
//报警
String error = "";
//托盘数量
String number = "";
//异常或说明信息
String message = "";
//当前指令
String instruction = "";
//上次指令
String last_instruction = "";
//当前托盘号
String pallet = "";
//当前托盘号
String last_pallet = "";
boolean applySucess;
boolean requestSucess;
if (!StrUtil.isEmpty(json.getString("device_code")) || json.getString("device_code").length() > 0) {
JSONObject jo = new JSONObject();
Device device = appService.findDeviceByCode(device_code);
if (ObjectUtil.isNull(device)) {
continue;
}
//无光电普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//检测站点
StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
//专机设备
HailiangSpecialDeviceDriver hailiangSpecialDeviceDriver;
//倒料位
HailiangSpecialPourStationDeviceDriver hailiangSpecialPourStationDeviceDriver;
//接料位
HailiangSpecialPickStationDeviceDriver hailiangSpecialPickStationDeviceDriver;
//空料位
HailiangSpecialEmptyStationDeviceDriver hailiangSpecialEmptyStationDeviceDriver;
//满料位
HailiangSpecialFullStationDeviceDriver hailiangSpecialFullStationDeviceDriver;
//刻字缓存位
HailiangEngravingCacheDeviceDriver hailiangEngravingCacheDeviceDriver;
//控制点-带扫码
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
//控制点-PLC扫码
StandardCoveyorControlWithPlcScannerDeviceDriver standardCoveyorControlWithPlcScannerDeviceDriver;
//扫码器
StandardScannerDeviceDriver standardScannerDeviceDriver;
//包装机
HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver;
//自动门
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
//清洗倒料位
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver;
//单工agv
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
//双工agv
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
//刻字机
HailiangEngravingMachineDeviceDriver hailiangEngravingMachineDeviceDriver;
if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver) {
hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver();
obj.put("device_name", hailiangSpecialDeviceDriver.getDevice().getDevice_name());
jo.put("mode", StageActorUtil.getMode(hailiangSpecialDeviceDriver.getMode()));
jo.put("isOnline", StageActorUtil.getMode(hailiangSpecialDeviceDriver.getMode()));
jo.put("isError", hailiangSpecialDeviceDriver.getIserror());
jo.put("error", hailiangSpecialDeviceDriver.getError());
jo.put("empty_is_lack", hailiangSpecialDeviceDriver.getEmpty_is_lack());
jo.put("empty_is_finish", hailiangSpecialDeviceDriver.getEmpty_is_finish());
jo.put("full_ready_req_agv", hailiangSpecialDeviceDriver.getFull_ready_req_agv());
jo.put("full_out", hailiangSpecialDeviceDriver.getFull_out());
jo.put("finish", hailiangSpecialDeviceDriver.getFinish());
jo.put("order_compel_finish", hailiangSpecialDeviceDriver.getOrder_compel_finish());
jo.put("now_order_prod_num", hailiangSpecialDeviceDriver.getNow_order_prod_num());
jo.put("now_one_prod_num", hailiangSpecialDeviceDriver.getNow_one_box_num());
jo.put("task", hailiangSpecialDeviceDriver.getTask());
jo.put("full_number", hailiangSpecialDeviceDriver.getFull_number());
jo.put("storage_stock_num", hailiangSpecialDeviceDriver.getStorage_stock_num());
jo.put("line_stock_num", hailiangSpecialDeviceDriver.getLine_stock_num());
jo.put("order_prod_allnum", hailiangSpecialDeviceDriver.getOrder_prod_allnum());
jo.put("order", hailiangSpecialDeviceDriver.getOrder());
} else if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
jo.put("mode", StageActorUtil.getMode(hailiangSpecialPourStationDeviceDriver.getMode()));
jo.put("isOnline", StageActorUtil.getMode(hailiangSpecialPourStationDeviceDriver.getMode()));
jo.put("isError", hailiangSpecialPourStationDeviceDriver.getIserror());
obj.put("device_name", hailiangSpecialPourStationDeviceDriver.getDevice().getDevice_name());
jo.put("full_number", hailiangSpecialPourStationDeviceDriver.getFull_number());
jo.put("storage_stock_num", hailiangSpecialPourStationDeviceDriver.getStorage_stock_num());
jo.put("line_stock_num", hailiangSpecialPourStationDeviceDriver.getLine_stock_num());
} else if (device.getDeviceDriver() instanceof HailiangSpecialPickStationDeviceDriver) {
hailiangSpecialPickStationDeviceDriver = (HailiangSpecialPickStationDeviceDriver) device.getDeviceDriver();
jo.put("mode", StageActorUtil.getMode(hailiangSpecialPickStationDeviceDriver.getMode()));
jo.put("isOnline", StageActorUtil.getMode(hailiangSpecialPickStationDeviceDriver.getMode()));
jo.put("isError", hailiangSpecialPickStationDeviceDriver.getIserror());
obj.put("device_name", hailiangSpecialPickStationDeviceDriver.getDevice().getDevice_name());
jo.put("full_number", hailiangSpecialPickStationDeviceDriver.getFull_number());
} else if (device.getDeviceDriver() instanceof HailiangSpecialEmptyStationDeviceDriver) {
hailiangSpecialEmptyStationDeviceDriver = (HailiangSpecialEmptyStationDeviceDriver) device.getDeviceDriver();
jo.put("mode", StageActorUtil.getMode(hailiangSpecialEmptyStationDeviceDriver.getMode()));
jo.put("isOnline", StageActorUtil.getMode(hailiangSpecialEmptyStationDeviceDriver.getMode()));
obj.put("device_name", hailiangSpecialEmptyStationDeviceDriver.getDevice().getDevice_name());
jo.put("move", StageActorUtil.getMove(hailiangSpecialEmptyStationDeviceDriver.getMove()));
jo.put("hasGoods", StageActorUtil.getHasGoods(hailiangSpecialEmptyStationDeviceDriver.getMove(),0));
jo.put("isError", hailiangSpecialEmptyStationDeviceDriver.getIserror());
} else if (device.getDeviceDriver() instanceof HailiangSpecialFullStationDeviceDriver) {
hailiangSpecialFullStationDeviceDriver = (HailiangSpecialFullStationDeviceDriver) device.getDeviceDriver();
jo.put("move", StageActorUtil.getMove(hailiangSpecialFullStationDeviceDriver.getMove()));
jo.put("mode", StageActorUtil.getMode(hailiangSpecialFullStationDeviceDriver.getMode()));
jo.put("isOnline", StageActorUtil.getMode(hailiangSpecialFullStationDeviceDriver.getMode()));
jo.put("isError", hailiangSpecialFullStationDeviceDriver.getIserror());
jo.put("hasGoods", StageActorUtil.getHasGoods(hailiangSpecialFullStationDeviceDriver.getMove()));
obj.put("device_name", hailiangSpecialFullStationDeviceDriver.getDevice().getDevice_name());
} else if (device.getDeviceDriver() instanceof HailiangEngravingCacheDeviceDriver) {
hailiangEngravingCacheDeviceDriver = (HailiangEngravingCacheDeviceDriver) device.getDeviceDriver();
jo.put("hasGoods", StageActorUtil.getHasGoods(hailiangEngravingCacheDeviceDriver.getMove()));
jo.put("move", StageActorUtil.getCacheMove(hailiangEngravingCacheDeviceDriver.getMove()));
jo.put("mode", StageActorUtil.getMode(hailiangEngravingCacheDeviceDriver.getMode()));
jo.put("isOnline", StageActorUtil.getMode(hailiangEngravingCacheDeviceDriver.getMode()));
jo.put("is_click", true);
jo.put("device_type",device.getDevice_type());
jo.put("driver_type",device.getDeviceDriverDefination().getDriverCode());
jo.put("material_type",device.getMaterial_type());
obj.put("device_name", hailiangEngravingCacheDeviceDriver.getDevice().getDevice_name());
}else if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver) {
hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver();
jo.put("mode", StageActorUtil.getMode(hailiangPackerStationDeviceDriver.getMode()));
jo.put("isOnline", StageActorUtil.getMode(hailiangPackerStationDeviceDriver.getMode()));
jo.put("hasGoods", StageActorUtil.getHasGoods(hailiangPackerStationDeviceDriver.getMove()));
jo.put("move", StageActorUtil.getCacheMove(hailiangPackerStationDeviceDriver.getMove()));
jo.put("material_type",device.getMaterial_type());
jo.put("lack_req", StageActorUtil.getIsOrNo(hailiangPackerStationDeviceDriver.getLack_req()));
jo.put("empty_req", StageActorUtil.getIsOrNo(hailiangPackerStationDeviceDriver.getReq_task_empty()));
jo.put("is_click", true);
jo.put("device_type",device.getDevice_type());
Boolean requireSucess = hailiangPackerStationDeviceDriver.getRequireSucess();
jo.put("requestSucess",StageActorUtil.getRequestSucess(requireSucess));
jo.put("requireSucess",StageActorUtil.getRequireSucess(requireSucess));
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();
IAgv oneAgv = SpringContextHolder.getBean(OneAgvPhase.class);
jo.put("isOnline", true);
obj.put("device_name", agvNdcOneDeviceDriver.getDevice().getDevice_name());
jo.put("address",StageActorUtil.getAddress(storageCellService.findByAddress(agvNdcOneDeviceDriver.getAgvaddr_copy() + "")));
jo.put("phaseName", oneAgv.getPhaseName(agvNdcOneDeviceDriver.getPhase()));
} else if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
jo.put("isOnline", true);
IAgv twoAgv = SpringContextHolder.getBean(TwoAgvPhase.class);
obj.put("device_name", agvNdcTwoDeviceDriver.getDevice().getDevice_name());
jo.put("address",StageActorUtil.getAddress(storageCellService.findByAddress(agvNdcTwoDeviceDriver.getAgvaddr_copy() + "")));
jo.put("phaseName",twoAgv.getPhaseName(agvNdcTwoDeviceDriver.getPhase()));
} else if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
jo.put("mode", StageActorUtil.getMode(hailiangCleaningMachineStorageStationDeviceDriver.getMode()));
jo.put("isOnline", StageActorUtil.getIsOnline(hailiangCleaningMachineStorageStationDeviceDriver.getMode()));
jo.put("isError", hailiangCleaningMachineStorageStationDeviceDriver.getIserror());
obj.put("device_name", hailiangCleaningMachineStorageStationDeviceDriver.getDevice().getDevice_name());
jo.put("error", hailiangCleaningMachineStorageStationDeviceDriver.getError());
jo.put("weight", hailiangCleaningMachineStorageStationDeviceDriver.getSilo_weight());
jo.put("qty", hailiangCleaningMachineStorageStationDeviceDriver.getFull_number());
jo.put("material", hailiangCleaningMachineStorageStationDeviceDriver.getMaterial());
} else if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver) {
hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
jo.put("isOnline", StageActorUtil.getIsOnline(hailiangEngravingMachineDeviceDriver.getMode()));
jo.put("hasGoods",StageActorUtil.getHasGoods(hailiangEngravingMachineDeviceDriver.getMove()));
jo.put("empty_req",StageActorUtil.getIsOrNo(hailiangEngravingMachineDeviceDriver.getEmpty_req()));
jo.put("mode", StageActorUtil.getMode(hailiangEngravingMachineDeviceDriver.getMode()));
jo.put("full_req", StageActorUtil.getIsOrNo(hailiangEngravingMachineDeviceDriver.getFull_req()));
jo.put("move", StageActorUtil.getMove(hailiangEngravingMachineDeviceDriver.getMove()));
obj.put("device_name", hailiangEngravingMachineDeviceDriver.getDevice().getDevice_name());
jo.put("error", hailiangEngravingMachineDeviceDriver.getError());
jo.put("material_type", device.getMaterial_type());
} else if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
if (standardAutodoorDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (standardAutodoorDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (standardAutodoorDeviceDriver.getMode() == 2) {
mode = "联机";
}
if (standardAutodoorDeviceDriver.getAction() == 0) {
action = "未知";
} else if (standardAutodoorDeviceDriver.getAction() == 1) {
action = "开到位";
} else if (standardAutodoorDeviceDriver.getAction() == 2) {
action = "关到位";
}
obj.put("device_name", standardAutodoorDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("action", action);
jo.put("isOnline", true);
jo.put("error", standardAutodoorDeviceDriver.getError());
jo.put("isError", standardAutodoorDeviceDriver.getIserror());
} else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) {
standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver();
if (standardCoveyorControlWithScannerDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (standardCoveyorControlWithScannerDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (standardCoveyorControlWithScannerDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (standardCoveyorControlWithScannerDeviceDriver.getMode() == 3) {
mode = "运行中";
} else if (standardCoveyorControlWithScannerDeviceDriver.getMode() == 4) {
mode = "申请叫料";
} else if (standardCoveyorControlWithScannerDeviceDriver.getMode() == 5) {
mode = "申请空盘";
} else if (standardCoveyorControlWithScannerDeviceDriver.getMode() == 6) {
mode = "空盘入库";
}
if (standardCoveyorControlWithScannerDeviceDriver.getMove() == 0) {
move = "无货";
} else if (standardCoveyorControlWithScannerDeviceDriver.getMove() == 1) {
move = "有货";
} else if (standardCoveyorControlWithScannerDeviceDriver.getMove() == 2) {
move = "有托盘有货";
}
obj.put("device_name", standardCoveyorControlWithScannerDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("hasGoods", standardCoveyorControlWithScannerDeviceDriver.getHasGoods());
jo.put("isOnline", standardCoveyorControlWithScannerDeviceDriver.getIsonline());
jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError());
jo.put("isError", standardCoveyorControlWithScannerDeviceDriver.getIserror());
jo.put("height", standardCoveyorControlWithScannerDeviceDriver.getHeight());
jo.put("operation_type", standardCoveyorControlWithScannerDeviceDriver.getOperation_type());
jo.put("direction", standardCoveyorControlWithScannerDeviceDriver.getDirection());
jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction());
jo.put("ioaction", standardCoveyorControlWithScannerDeviceDriver.getIoaction());
jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithScannerDeviceDriver.barcode()) ? "" : standardCoveyorControlWithScannerDeviceDriver.barcode());
jo.put("message", StrUtil.equals(standardCoveyorControlWithScannerDeviceDriver.getMessage(), "null") ? "" : standardCoveyorControlWithScannerDeviceDriver.getMessage());
jo.put("requestSucess", standardCoveyorControlWithScannerDeviceDriver.getRequireSucess().toString());
jo.put("applySucess", standardCoveyorControlWithScannerDeviceDriver.getApplySucess().toString());
jo.put("instruction_message", standardCoveyorControlWithScannerDeviceDriver.getInst_message());
} else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithPlcScannerDeviceDriver) {
standardCoveyorControlWithPlcScannerDeviceDriver = (StandardCoveyorControlWithPlcScannerDeviceDriver) device.getDeviceDriver();
if (standardCoveyorControlWithPlcScannerDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (standardCoveyorControlWithPlcScannerDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (standardCoveyorControlWithPlcScannerDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (standardCoveyorControlWithPlcScannerDeviceDriver.getMode() == 3) {
mode = "运行中";
} else if (standardCoveyorControlWithPlcScannerDeviceDriver.getMode() == 4) {
mode = "申请叫料";
} else if (standardCoveyorControlWithPlcScannerDeviceDriver.getMode() == 5) {
mode = "申请空盘";
} else if (standardCoveyorControlWithPlcScannerDeviceDriver.getMode() == 6) {
mode = "空盘入库";
}
if (standardCoveyorControlWithPlcScannerDeviceDriver.getMove() == 0) {
move = "无货";
} else if (standardCoveyorControlWithPlcScannerDeviceDriver.getMove() == 1) {
move = "有货";
} else if (standardCoveyorControlWithPlcScannerDeviceDriver.getMove() == 2) {
move = "有托盘有货";
}
obj.put("device_name", standardCoveyorControlWithPlcScannerDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("hasGoods", standardCoveyorControlWithPlcScannerDeviceDriver.getHasGoods());
jo.put("isOnline", standardCoveyorControlWithPlcScannerDeviceDriver.getIsonline());
jo.put("error", standardCoveyorControlWithPlcScannerDeviceDriver.getError());
jo.put("isError", standardCoveyorControlWithPlcScannerDeviceDriver.getIserror());
jo.put("height", standardCoveyorControlWithPlcScannerDeviceDriver.getHeight());
jo.put("operation_type", standardCoveyorControlWithPlcScannerDeviceDriver.getOperation_type());
jo.put("direction", standardCoveyorControlWithPlcScannerDeviceDriver.getDirection());
jo.put("action", standardCoveyorControlWithPlcScannerDeviceDriver.getAction());
jo.put("ioaction", standardCoveyorControlWithPlcScannerDeviceDriver.getIoaction());
jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithPlcScannerDeviceDriver.getBarcode()) ? "" : standardCoveyorControlWithPlcScannerDeviceDriver.getBarcode());
jo.put("message", StrUtil.isEmpty(standardCoveyorControlWithPlcScannerDeviceDriver.getMessage()) ? "" : standardCoveyorControlWithPlcScannerDeviceDriver.getMessage());
jo.put("requestSucess", standardCoveyorControlWithPlcScannerDeviceDriver.getRequireSucess().toString());
jo.put("applySucess", standardCoveyorControlWithPlcScannerDeviceDriver.getApplySucess().toString());
jo.put("instruction_message", standardCoveyorControlWithPlcScannerDeviceDriver.getInst_message());
}
//检测站点
else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDevicedriver.getMode() == 0) {
mode = "未联机";
} else if (standardInspectSiteDevicedriver.getMode() == 1) {
mode = "单机";
} else if (standardInspectSiteDevicedriver.getMode() == 2) {
mode = "联机";
}
if (standardInspectSiteDevicedriver.getMove() == 0) {
move = "无货";
} else if (standardInspectSiteDevicedriver.getMove() == 1) {
move = "有货";
} else if (standardInspectSiteDevicedriver.getMove() == 2) {
move = "有托盘有货";
}
obj.put("device_name", standardInspectSiteDevicedriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("hasGoods", standardInspectSiteDevicedriver.getHasGoods());
jo.put("isOnline", standardInspectSiteDevicedriver.getIsonline());
jo.put("error", standardInspectSiteDevicedriver.getError());
jo.put("isError", standardInspectSiteDevicedriver.getIserror());
jo.put("container", standardInspectSiteDevicedriver.getContainer());
jo.put("message", standardInspectSiteDevicedriver.getMessage());
}
//普通站点
else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (standardOrdinarySiteDeviceDriver.getHasGoods() == 0) {
move = "无货";
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 1) {
move = "有货";
} else if (standardOrdinarySiteDeviceDriver.getHasGoods() == 2) {
move = "有托盘有货";
}
obj.put("device_name", standardOrdinarySiteDeviceDriver.getDevice().getDevice_name());
jo.put("move", move);
jo.put("container", standardOrdinarySiteDeviceDriver.getContainer());
jo.put("hasGoods", standardOrdinarySiteDeviceDriver.getHasGoods());
jo.put("isOnline", true);
//点击弹出
jo.put("is_click", true);
jo.put("device_type", device.getDevice_type());
jo.put("error", standardOrdinarySiteDeviceDriver.getError());
jo.put("isError", standardOrdinarySiteDeviceDriver.getIserror());
jo.put("container", standardOrdinarySiteDeviceDriver.getContainer());
jo.put("message", standardOrdinarySiteDeviceDriver.getMessage());
jo.put("material", standardOrdinarySiteDeviceDriver.getMaterial());
jo.put("batch", standardOrdinarySiteDeviceDriver.getBatch());
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDevicedriver.getMode() == 0) {
mode = "未联机";
} else if (standardInspectSiteDevicedriver.getMode() == 1) {
mode = "单机";
} else if (standardInspectSiteDevicedriver.getMode() == 2) {
mode = "联机";
}
if (standardInspectSiteDevicedriver.getMove() == 0) {
move = "无货";
} else if (standardInspectSiteDevicedriver.getMove() == 1) {
move = "有货";
} else if (standardInspectSiteDevicedriver.getMove() == 2) {
move = "有托盘有货";
}
obj.put("device_name", standardInspectSiteDevicedriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("hasGoods", standardInspectSiteDevicedriver.getHasGoods());
jo.put("isOnline", standardInspectSiteDevicedriver.getIsonline());
jo.put("error", standardInspectSiteDevicedriver.getError());
jo.put("isError", standardInspectSiteDevicedriver.getIserror());
jo.put("container", standardInspectSiteDevicedriver.getContainer());
jo.put("message", standardInspectSiteDevicedriver.getMessage());
if (ObjectUtil.isNotEmpty(device.getDeviceDriver())) {
IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefination().getDriverCode(), IDriverService.class);
obj.put("device_name", device.getDevice_name());
jo = driverService.getDeviceInfo(device);
}
obj.put("data", jo);
}
}
obj.put("img2", json.getString("image_name"));
obj.put("angle", json.getString("angle"));
arr.add(obj);
}
JSONObject result = new JSONObject();
result.put("form", stageObj);
result.put("detail", arr);
return result;
}
}

View File

@@ -14,11 +14,32 @@ public class StageActorUtil {
return "未联机";
}
public static String getMode(int mode,int i){
if (mode == 0) {
return "未联机";
} else if (mode == 1) {
return "单机";
} else if (mode == 2) {
return "联机";
} else if (mode == 3) {
return "运行中";
} else if (mode == 4) {
return "申请叫料";
} else if (mode == 5) {
return "申请空盘";
} else if (mode == 6) {
return "空盘入库";
}
return "";
}
public static String getMove(int move){
if (move == 0){
return "无货";
} else if (move == 1){
return "有货";
}
return "有货";
return "托盘有";
}
public static String getCacheMove(int move){

View File

@@ -761,17 +761,19 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override
@Transactional(rollbackFor = Exception.class)
public void createInst(String ids) throws Exception {
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
TaskDto acsTask = this.findById(ids);
if (acsTask == null) throw new BadRequestException("被删除或无权限,操作失败!");
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class);
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 ");
if (inst != null) throw new BadRequestException("有指令未完成!");
String link_no = CodeUtil.getNewCode("LINK_NO");
String taskid = acsTask.getTask_id();
String taskcode = acsTask.getTask_code();
String vehiclecode = acsTask.getVehicle_code();
String priority = acsTask.getPriority();
String material = acsTask.getMaterial();
String start_point_code = acsTask.getStart_point_code();
String start_device_code = acsTask.getStart_device_code();
String route_plan_code = acsTask.getRoute_plan_code();
@@ -780,21 +782,34 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String compound_task = acsTask.getCompound_task();
String next_point_code = acsTask.getNext_point_code();
String next_device_code = acsTask.getNext_device_code();
String maxInstnumber = acsConfigService.findConfigFromCache().get(AcsConfig.MAXINSTNUMBER);
String agv_system_type = acsTask.getAgv_system_type();
String put_device_code = acsTask.getPut_device_code();
String put_point_code = acsTask.getPut_point_code();
String remark = acsTask.getRemark();
String task_type = acsTask.getTask_type();
String quantity = acsTask.getQuantity();
String is_send = acsTask.getIs_send();
if(StrUtil.equals(is_send,"0")){
return;
}
Instruction instdto = new Instruction();
instdto.setInstruction_type(acsTask.getTask_type());
instdto.setInstruction_type(task_type);
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(acsTask.getRemark());
instdto.setMaterial(acsTask.getMaterial());
instdto.setQuantity(acsTask.getQuantity());
instdto.setRemark(remark);
instdto.setLink_num(link_no);
instdto.setMaterial(material);
instdto.setQuantity(quantity);
instdto.setPut_device_code(put_device_code);
instdto.setPut_point_code(put_point_code);
instdto.setAgv_system_type(agv_system_type);
instdto.setTask_id(taskid);
instdto.setTask_code(taskcode);
instdto.setVehicle_code(vehiclecode);
String now = DateUtil.now();
String currentUsername = SecurityUtils.getCurrentUsername();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setCreate_by(currentUsername);
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
@@ -803,8 +818,12 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
instdto.setInstruction_status("0");
instdto.setExecute_device_code(start_point_code);
instdto.setVehicle_type(vehicleType);
instructionservice.create(instdto);
//创建指令后修改任务状态
acsTask.setTask_status("1");
acsTask.setTask_type("2");
acsTask.setLink_num(link_no);
taskserver.update(acsTask);
}
@Override

View File

@@ -9,7 +9,7 @@ spring:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
#url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.225}:${DB_PORT:3306}/${DB_NAME:hl_acs_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.225}:${DB_PORT:3306}/${DB_NAME:hl_acs_one}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
password: ${DB_PWD:123456}
#password: ${DB_PWD:Root.123456}