This commit is contained in:
2022-07-05 14:09:26 +08:00
parent a73434b116
commit 34f4f08218
9 changed files with 295 additions and 34 deletions

View File

@@ -0,0 +1,46 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_xj_plc_test.HailiangHailiangxjplcTestDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
@Service("hailiang_xj_plc_test")
public class HailiangxjplcDevice extends AbstractDriverService {
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangHailiangxjplcTestDeviceDriver hailiangHailiangxjplcTestDeviceDriver = (HailiangHailiangxjplcTestDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangHailiangxjplcTestDeviceDriver,0);
jo.put("heartbeat",hailiangHailiangxjplcTestDeviceDriver.getHeartbeat());
jo.put("error",hailiangHailiangxjplcTestDeviceDriver.getError());
jo.put("error_num",hailiangHailiangxjplcTestDeviceDriver.getError_num());
jo.put("open_time",hailiangHailiangxjplcTestDeviceDriver.getOpen_time());
jo.put("close_time",hailiangHailiangxjplcTestDeviceDriver.getClose_time());
jo.put("ready_time",hailiangHailiangxjplcTestDeviceDriver.getReady_time());
jo.put("running_time",hailiangHailiangxjplcTestDeviceDriver.getRunning_time());
jo.put("error_time",hailiangHailiangxjplcTestDeviceDriver.getError_time());
jo.put("voltage",hailiangHailiangxjplcTestDeviceDriver.getVoltage());
jo.put("temperature",hailiangHailiangxjplcTestDeviceDriver.getTemperature());
jo.put("current",hailiangHailiangxjplcTestDeviceDriver.getCurrent());
jo.put("material",hailiangHailiangxjplcTestDeviceDriver.getMaterial());
jo.put("lack_material",hailiangHailiangxjplcTestDeviceDriver.getLack_material());
jo.put("full_material",hailiangHailiangxjplcTestDeviceDriver.getFull_material());
jo.put("storage_qty",hailiangHailiangxjplcTestDeviceDriver.getStorage_qty());
jo.put("feeding_qty",hailiangHailiangxjplcTestDeviceDriver.getFeeding_qty());
jo.put("blanking_qty",hailiangHailiangxjplcTestDeviceDriver.getBlanking_qty());
jo.put("qualified_qty",hailiangHailiangxjplcTestDeviceDriver.getQualified_qty());
jo.put("unqualified_qty",hailiangHailiangxjplcTestDeviceDriver.getUnqualified_qty());
jo.put("finish",hailiangHailiangxjplcTestDeviceDriver.getFinish());
jo.put("task",hailiangHailiangxjplcTestDeviceDriver.getTask());
jo.put("noload_electricity_consumption",hailiangHailiangxjplcTestDeviceDriver.getNoload_electricity_consumption());
jo.put("prod_electricity_consumption",hailiangHailiangxjplcTestDeviceDriver.getProd_electricity_consumption());
jo.put("gas_consumption",hailiangHailiangxjplcTestDeviceDriver.getGas_consumption());
jo.put("water_consumption",hailiangHailiangxjplcTestDeviceDriver.getWater_consumption());
jo.put("oil_level",hailiangHailiangxjplcTestDeviceDriver.getOil_level());
jo.put("pause",hailiangHailiangxjplcTestDeviceDriver.getPause());
jo.put("is_click",true);
jo.put("driver_type","hailiang_xj_plc_test");
jo.put("monthly_electricity_consumption",hailiangHailiangxjplcTestDeviceDriver.getMonthly_electricity_consumption());
return jo;
}
}

View File

@@ -1,30 +0,0 @@
package org.nl.acs.common;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_xj_plc_test.HailiangHailiangxjplcTestDeviceDriver;
import org.nl.acs.opc.Device;
import org.springframework.stereotype.Service;
/**
* @author geng by
*
*/
@Service("hailiang_xj_plc_test")
public class HailiangxjplcTestDevice extends AbstractDriverService{
@Override
public JSONObject getDeviceInfo(Device device) {
HailiangHailiangxjplcTestDeviceDriver hailiangHailiangxjplcTestDeviceDriver = (HailiangHailiangxjplcTestDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(hailiangHailiangxjplcTestDeviceDriver,0);
jo.put("mode", hailiangHailiangxjplcTestDeviceDriver.getMode());
jo.put("error", hailiangHailiangxjplcTestDeviceDriver.getError());
jo.put("error_num", hailiangHailiangxjplcTestDeviceDriver.getError_num());
jo.put("open_time", hailiangHailiangxjplcTestDeviceDriver.getOpen_time());
jo.put("close_time", hailiangHailiangxjplcTestDeviceDriver.getClose_time());
jo.put("feeding_qty", hailiangHailiangxjplcTestDeviceDriver.getFeeding_qty());
jo.put("finish", hailiangHailiangxjplcTestDeviceDriver.getFinish());
jo.put("task", hailiangHailiangxjplcTestDeviceDriver.getTask());
jo.put("qualified_qty", hailiangHailiangxjplcTestDeviceDriver.getQualified_qty());
return jo;
}
}

View File

@@ -263,6 +263,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
updatejson.put("islock","0");
updatejson.put("material_type",inst.getMaterial());
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "起点位置刻字机,缓存位锁定成功");
}
if (start_device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver){
writing("to_cache_write", "1");
@@ -273,6 +274,7 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver
updatejson.put("islock","0");
updatejson.put("material_type","");
runpointwo.update(updatejson, "device_code = '" + device_code + "'");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "起点位置刻字机,缓存位锁定成功");
}
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
OneNDCSocketConnectionAutoRun.write(data);

View File

@@ -342,13 +342,18 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
JSONObject param = new JSONObject();
param.put("ext_order_id",ext_order_id);
acsToWmsService.feedbackOrderStatus(param);
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的外部标识:"+ext_order_id);
}else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的没有外部标识");
}
}else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单信息为空");
}
produceshiftorderService.updateByOrderCode(dto);
this.writing("to_confirm_finished","1");
this.writing("to_clear","1");
this.writing("to_pause","1");
logServer.deviceLogToacs(this.device_code,"","",device_code+":,任务确认完成,电器信号写入成功");
}else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move + ",order_finish>"+ order_finish +",last_order_finish>"+last_order_finish);
}

View File

@@ -285,9 +285,17 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
JSONObject param = new JSONObject();
param.put("ext_order_id",ext_order_id);
acsToWmsService.feedbackOrderStatus(param);
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的外部标识:"+ext_order_id);
}else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单的没有外部标识");
}
}else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,对应的工单信息为空");
}
this.writing("to_confirm_finished","1");
this.writing("to_clear","1");
this.writing("to_pause","1");
logServer.deviceLogToacs(this.device_code,"","",device_code+":,任务确认完成,电器信号写入成功");
} else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":,move:"+move + ",order_finish>"+ order_finish +",last_order_finish>"+last_order_finish);
}
@@ -377,7 +385,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
inst = null;
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "反馈成功");
} else {
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈");
logServer.deviceLogToacs(this.device_code,"","","agvphase:" + agvphase + "等待反馈,move:"+move+",error:"+error+",inst:"+inst);
}
}

View File

@@ -78,6 +78,7 @@ public class HailiangHailiangxjplcTestDeviceDriver extends AbstractOpcDeviceDriv
//有货标记
protected boolean has_goods_tag = false;
int heartbeat = 0;
int mode =0;
int error =0;
int error_num =0;
@@ -193,6 +194,7 @@ public class HailiangHailiangxjplcTestDeviceDriver extends AbstractOpcDeviceDriv
@Override
public void execute() throws Exception {
device_code = this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
mode = this.itemProtocol.getItem_mode();
error = this.itemProtocol.getItem_error();
error_num = this.itemProtocol.getItem_error_num();

View File

@@ -33,6 +33,7 @@ public class DeviceStatusMonitor {
SocketMsg deviceInfo = new SocketMsg(json, MsgType.INFO);
WebSocketServer.sendInfo(deviceInfo, "device_monitor");
WebSocketServer.sendInfo(deviceInfo, "xj_device_monitor");
} catch (IOException e) {
e.printStackTrace();
}