rev 大屏首页需求数据

This commit is contained in:
张江玮
2023-09-20 17:59:07 +08:00
parent 7171a80f65
commit 122147fc24
28 changed files with 1610 additions and 562 deletions

View File

@@ -120,6 +120,9 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
if (status != last_status) {
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
logServer.deviceExecuteLog(this.device_code, "", "", "信号status" + last_status + " -> " + status);
if (status == 3) {
acsToWmsService.equipmentFailure(device_code);
}
}
if (!open_time.equals(last_open_time)) {
logServer.deviceItemValue(this.device_code, "open_time", open_time);

View File

@@ -11,6 +11,8 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
@@ -41,6 +43,7 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
String device_code;
int mode = 0;
@@ -109,6 +112,9 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements
if (status != last_status) {
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
logServer.deviceExecuteLog(this.device_code, "", "", "信号status" + last_status + " -> " + status);
if (status == 3) {
acsToWmsService.equipmentFailure(device_code);
}
}
if (!open_time.equals(last_open_time)) {
logServer.deviceItemValue(this.device_code, "open_time", open_time);

View File

@@ -112,6 +112,9 @@ public class LnshKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implement
if (status != last_status) {
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
logServer.deviceExecuteLog(this.device_code, "", "", "信号status" + last_status + " -> " + status);
if (status == 3) {
acsToWmsService.equipmentFailure(device_code);
}
}
if (kiln_number != last_kiln_number) {
logServer.deviceItemValue(this.device_code, "kiln_number", String.valueOf(kiln_number));

View File

@@ -142,6 +142,9 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
if (status != last_status) {
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
logServer.deviceExecuteLog(this.device_code,"","","信号status" + last_status + " -> " + status);
if (status == 3) {
acsToWmsService.equipmentFailure(device_code);
}
}
if (!open_time.equals(last_open_time)) {
logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time));

View File

@@ -135,6 +135,9 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
if (status != last_status) {
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
logServer.deviceExecuteLog(this.device_code,"","","信号status" + last_status + " -> " + status);
if (status == 3) {
acsToWmsService.equipmentFailure(device_code);
}
}
if (!open_time.equals(last_open_time)) {
logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time));

View File

@@ -163,6 +163,9 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
if (status != last_status) {
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
logServer.deviceExecuteLog(this.device_code,"","","信号status" + last_status + " -> " + status);
if (status == 3) {
acsToWmsService.equipmentFailure(device_code);
}
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error));

View File

@@ -126,6 +126,9 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
if (status != last_status) {
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
logServer.deviceExecuteLog(this.device_code,"","","信号status" + last_status + " -> " + status);
if (status == 3) {
acsToWmsService.equipmentFailure(device_code);
}
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code,"action" ,String.valueOf(action));

View File

@@ -151,6 +151,9 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
if (status != last_status) {
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
logServer.deviceExecuteLog(this.device_code, "", "", "信号status" + last_status + " -> " + status);
if (status == 3) {
acsToWmsService.equipmentFailure(device_code);
}
}
if (!open_time.equals(last_open_time)) {
logServer.deviceItemValue(this.device_code, "open_time", String.valueOf(open_time));

View File

@@ -182,4 +182,6 @@ public interface AcsToWmsService {
HttpResponse fjCallEmpty(JSONObject param);
HttpResponse fjNeed(JSONObject param);
void equipmentFailure(String deviceCode);
}

View File

@@ -1157,4 +1157,30 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.remove(log_file_type);
}
}
@Override
public void equipmentFailure(String deviceCode) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
JSONObject param = new JSONObject();
param.put("device_code", deviceCode);
log.info("equipmentFailure - 请求参数 {}", param);
AddressDto addressDto = addressService.findByCode("equipmentFailure");
String methods_url = addressDto.getMethods_url();
try {
HttpResponse response = HttpRequest
.post(wmsurl + methods_url)
.timeout(2000)
.body(param.toJSONString())
.execute();
log.info("equipmentFailure - 响应参数 {}", response.body());
} catch (Exception e) {
log.error("equipmentFailure - 请求错误!", e);
}
} finally {
MDC.remove(log_file_type);
}
}
}

View File

@@ -8,17 +8,19 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.LnshFoldDiscSiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_kiln_lane.LnshKilnLaneDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_kiln_truss.LnshKilnTrussDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_out_kiln_truss.LnshOutKilnTrussDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_package_line.LnshPackageLineDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_package_pallet_manipulator.LnshPackagePalletManipulatorDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_package_site.LnshPackageSiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator.LnshPalletizingManipulatorDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_press.LnshPressDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_rgv.LnshRGVDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_split_manipulator.LnshSplitManipulatorDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver;
import org.nl.acs.ext.wms.service.WmsToAcsService;
@@ -415,111 +417,156 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
continue;
}
String device_code = status.getString("device_code");
if (StrUtil.isBlank(device_code)) {
String deviceCode = status.getString("device_code");
if (StrUtil.isBlank(deviceCode)) {
continue;
} else if (deviceCode.startsWith("HLJ") && !deviceCode.contains("XL")) {
deviceCode = "HLJ";
}
Device device = DeviceAppService.findDeviceByCode(device_code);
Device device = DeviceAppService.findDeviceByCode(deviceCode);
if (ObjectUtil.isEmpty(device)) {
continue;
}
if (device.getDeviceDriver() instanceof LnshMixingMillDeviceDriver) {
LnshMixingMillDeviceDriver driver = (LnshMixingMillDeviceDriver) device.getDeviceDriver();
status.put("device_status", driver.getStatus());
DeviceDriver deviceDriver = device.getDeviceDriver();
if (deviceDriver instanceof LnshMixingMillDeviceDriver) {
LnshMixingMillDeviceDriver driver = (LnshMixingMillDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("status", driver.getStatus());
status.put("error", driver.getError());
status.put("open_time", driver.getOpen_time());
status.put("stand_time", driver.getStandby_time() / 3600);
status.put("work_time", driver.getProduction_time() / 3600);
status.put("error_time", driver.getError_time() / 3600);
status.put("real_qty", driver.getWeight());
status.put("standby_time", driver.getStandby_time());
status.put("production_time", driver.getProduction_time());
status.put("error_time", driver.getError_time());
status.put("weight", driver.getWeight());
status.put("mix_num", driver.getMix_num());
} else if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) {
LnshPressDeviceDriver driver = (LnshPressDeviceDriver) device.getDeviceDriver();
status.put("device_status", driver.getStatus());
status.put("material", driver.getMaterial());
} else if (deviceDriver instanceof LnshStationDeviceDriver) {
LnshStationDeviceDriver driver = (LnshStationDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("move", driver.getMove());
status.put("action", driver.getAction());
status.put("ioaction", driver.getIo_action());
status.put("error", driver.getError());
status.put("task", driver.getTask());
status.put("weight", driver.getWeight());
status.put("material", driver.getMaterial());
status.put("barcode", driver.getBarcode());
} else if (deviceDriver instanceof StandardInspectSiteDeviceDriver) {
StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("move", driver.getMove());
status.put("error", driver.getError());
status.put("task", driver.getTask());
} else if (deviceDriver instanceof LnshPressDeviceDriver) {
LnshPressDeviceDriver driver = (LnshPressDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("status", driver.getStatus());
status.put("error", driver.getError());
status.put("open_time", driver.getOpen_time());
status.put("stand_time", driver.getStandby_time() / 3600);
status.put("work_time", driver.getProduction_time() / 3600);
status.put("error_time", driver.getError_time() / 3600);
status.put("real_qty", driver.getQty());
status.put("current_weight", driver.getWeight());
} else if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
LnshPackagePalletManipulatorDeviceDriver driver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();
status.put("device_status", driver.getStatus());
status.put("standby_time", driver.getStandby_time());
status.put("production_time", driver.getProduction_time());
status.put("error_time", driver.getError_time());
status.put("material", driver.getMaterial());
status.put("qty", driver.getQty());
status.put("weight", driver.getWeight());
status.put("qualified", driver.getQualified());
status.put("unqualified", driver.getUnqualified());
status.put("order_No", driver.getOrder_No());
status.put("avg_piece_weight", driver.getAvg_piece_weight());
} else if (deviceDriver instanceof LnshPalletizingManipulatorDeviceDriver) {
LnshPalletizingManipulatorDeviceDriver driver = (LnshPalletizingManipulatorDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("status", driver.getStatus());
status.put("action", driver.getAction());
status.put("error", driver.getError());
status.put("open_time", driver.getOpen_time());
status.put("stand_time", driver.getStandby_time() / 3600);
status.put("work_time", driver.getProduction_time() / 3600);
status.put("error_time", driver.getError_time() / 3600);
status.put("real_qty", driver.getQty());
} else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
LnshPalletizingManipulatorDeviceDriver driver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
status.put("device_status", driver.getStatus());
status.put("standby_time", driver.getStandby_time());
status.put("production_time", driver.getProduction_time());
status.put("error_time", driver.getError_time());
} else if (deviceDriver instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
LnshPalletizingManipulatorSiteDeviceDriver driver = (LnshPalletizingManipulatorSiteDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("move", driver.getMove());
status.put("action", driver.getAction());
status.put("ioaction", driver.getIo_action());
status.put("error", driver.getError());
status.put("task", driver.getTask());
status.put("weight", driver.getWeight());
status.put("material", driver.getMaterial());
status.put("barcode", driver.getBarcode());
status.put("unqualified_qty", driver.getUnqualified_qty());
status.put("encoder_qty", driver.getEncoder_qty());
} else if (deviceDriver instanceof LnshKilnTrussDeviceDriver) {
LnshKilnTrussDeviceDriver driver = (LnshKilnTrussDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("status", driver.getStatus());
status.put("open_time", driver.getOpen_time());
status.put("stand_time", driver.getStandby_time() / 3600);
status.put("work_time", driver.getProduction_time() / 3600);
status.put("error_time", driver.getError_time() / 3600);
} else if (device.getDeviceDriver() instanceof LnshKilnTrussDeviceDriver) {
LnshKilnTrussDeviceDriver driver = (LnshKilnTrussDeviceDriver) device.getDeviceDriver();
status.put("device_status", driver.getStatus());
status.put("standby_time", driver.getStandby_time());
status.put("production_time", driver.getProduction_time());
status.put("error_time", driver.getError_time());
status.put("kiln_number", driver.getKiln_number());
status.put("barcode", driver.getBarcode());
} else if (deviceDriver instanceof LnshKilnLaneDeviceDriver) {
LnshKilnLaneDeviceDriver driver = (LnshKilnLaneDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("status", driver.getStatus());
status.put("open_time", driver.getOpen_time());
status.put("standby_time", driver.getStandby_time());
status.put("production_time", driver.getProduction_time());
status.put("error_time", driver.getError_time());
status.put("car_sum", driver.getCar_sum());
status.put("nullCar_qty", driver.getNullCar_qty());
status.put("burning_car_qty", driver.getBurning_car_qty());
} else if (deviceDriver instanceof LnshOutKilnTrussDeviceDriver) {
LnshOutKilnTrussDeviceDriver driver = (LnshOutKilnTrussDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("status", driver.getStatus());
status.put("outKiln_move", driver.getOutKiln_move());
status.put("outKiln_barcode", driver.getOutKiln_barcode());
status.put("outKiln_device", driver.getOutKiln_device());
status.put("open_time", driver.getOpen_time());
status.put("standby_time", driver.getStandby_time());
status.put("production_time", driver.getProduction_time());
status.put("error_time", driver.getError_time());
status.put("cool_number", driver.getCool_number());
} else if (deviceDriver instanceof LnshPackagePalletManipulatorDeviceDriver) {
LnshPackagePalletManipulatorDeviceDriver driver = (LnshPackagePalletManipulatorDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("status", driver.getStatus());
status.put("error", driver.getError());
status.put("putStation", driver.getPut_station());
status.put("material", driver.getMaterial());
status.put("qty", driver.getQty());
status.put("order_qty", driver.getOrder_qty());
status.put("open_time", driver.getOpen_time());
status.put("stand_time", driver.getStandby_time() / 3600);
status.put("work_time", driver.getProduction_time() / 3600);
status.put("error_time", driver.getError_time() / 3600);
} else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
LnshKilnLaneDeviceDriver driver = (LnshKilnLaneDeviceDriver) device.getDeviceDriver();
status.put("device_status", driver.getStatus());
status.put("standby_time", driver.getStandby_time());
status.put("production_time", driver.getProduction_time());
status.put("error_time", driver.getError_time());
status.put("order_No", driver.getOrder_No());
status.put("product_code", driver.getProduct_code());
status.put("AlongSide", driver.getAlongSide());
status.put("BshortSide", driver.getBshortSide());
status.put("Htrapezoidal", driver.getHtrapezoidal());
status.put("Wthickness", driver.getWthickness());
} else if (deviceDriver instanceof LnshLaminatingMachineDeviceDriver) {
LnshLaminatingMachineDeviceDriver driver = (LnshLaminatingMachineDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("move", driver.getMove());
status.put("container_type", driver.getContainer_type());
status.put("error", driver.getError());
status.put("task", driver.getTask());
} else if (deviceDriver instanceof LnshFoldDiscSiteDeviceDriver) {
LnshFoldDiscSiteDeviceDriver driver = (LnshFoldDiscSiteDeviceDriver) deviceDriver;
status.put("mode", driver.getMode());
status.put("status", driver.getStatus());
status.put("open_time", driver.getOpen_time());
status.put("stand_time", driver.getStandby_time() / 3600);
status.put("work_time", driver.getProduction_time() / 3600);
status.put("error_time", driver.getError_time() / 3600);
} else if (device.getDeviceDriver() instanceof LnshOutKilnTrussDeviceDriver) {
LnshOutKilnTrussDeviceDriver driver = (LnshOutKilnTrussDeviceDriver) device.getDeviceDriver();
status.put("device_status", driver.getStatus());
status.put("error", driver.getError());
status.put("open_time", driver.getOpen_time());
status.put("stand_time", driver.getStandby_time() / 3600);
status.put("work_time", driver.getProduction_time() / 3600);
status.put("error_time", driver.getError_time() / 3600);
} else if (device.getDeviceDriver() instanceof LnshRGVDeviceDriver) {
LnshRGVDeviceDriver driver = (LnshRGVDeviceDriver) device.getDeviceDriver();
status.put("device_status", driver.getStatus());
status.put("error", driver.getError());
status.put("open_time", driver.getOpen_time());
status.put("stand_time", driver.getStandby_time() / 3600);
status.put("work_time", driver.getProduction_time() / 3600);
status.put("error_time", driver.getError_time() / 3600);
} else if (device.getDeviceDriver() instanceof LnshPackageLineDeviceDriver) {
LnshPackageLineDeviceDriver driver = (LnshPackageLineDeviceDriver) device.getDeviceDriver();
status.put("device_status", driver.getStatus());
status.put("error", driver.getError());
status.put("open_time", driver.getOpen_time());
status.put("stand_time", driver.getStandby_time() / 3600);
status.put("work_time", driver.getProduction_time() / 3600);
status.put("error_time", driver.getError_time() / 3600);
} else if (device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
LnshFoldDiscSiteDeviceDriver driver = (LnshFoldDiscSiteDeviceDriver) device.getDeviceDriver();
status.put("device_status", driver.getStatus());
status.put("error", driver.getError());
status.put("open_time", driver.getOpen_time());
status.put("stand_time", driver.getStandby_time() / 3600);
status.put("work_time", driver.getProduction_time() / 3600);
status.put("error_time", driver.getError_time() / 3600);
status.put("close_time", driver.getClose_time());
status.put("standby_time", driver.getStandby_time());
status.put("production_time", driver.getProduction_time());
status.put("error_time", driver.getError_time());
status.put("container_qty", driver.getContainer_qty());
}
}
}

View File

@@ -10,15 +10,17 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.LinewayDeviceDriver;
import org.nl.acs.device_driver.driver.OpcDeviceDriver;
import org.nl.acs.instruction.service.dto.Instruction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoInitial {
private List<Device> devices = new ArrayList();
private List<Device> devices = new ArrayList<>();
private List<String> code_indexs = new ArrayList();
@Autowired
private DeviceManageService deviceManageService;
@@ -36,18 +38,12 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
return null;
}
Iterator var2 = this.findAllDevice().iterator();
Device device;
do {
if (!var2.hasNext()) {
return null;
}
device = (Device) var2.next();
} while (!StrUtil.equals(device.getDevice_code(), device_code));
return device;
List<Device> list = this.devices.stream().filter(d -> device_code.equals(d.getDevice_code())).collect(Collectors.toList());
if (list.isEmpty()) {
return null;
} else {
return list.get(0);
}
}
public Device findDeviceByAddress(String address) {