舞台更新

This commit is contained in:
lyd
2022-08-16 18:48:24 +08:00
parent 0ddbf33058
commit 8ef6a29f84
111 changed files with 5803 additions and 1473 deletions

View File

@@ -0,0 +1,9 @@
package org.nl.acs.agv.server;
/**
* @Author: lyd
* @Description:
* @Date: 2022-08-15
*/
public interface MagicAgvService {
}

View File

@@ -0,0 +1,9 @@
package org.nl.acs.agv.server;
/**
* @Author: lyd
* @Description:
* @Date: 2022-08-15
*/
public interface NDCAgvService {
}

View File

@@ -0,0 +1,9 @@
package org.nl.acs.agv.server;
/**
* @Author: lyd
* @Description:
* @Date: 2022-08-15
*/
public interface XianGongAgvService {
}

View File

@@ -0,0 +1,9 @@
package org.nl.acs.agv.server;
/**
* @Author: lyd
* @Description:
* @Date: 2022-08-15
*/
public interface ZheDaAgvService {
}

View File

@@ -82,4 +82,12 @@ public class AcsConfigController {
return new ResponseEntity<>(acsConfigService.findConfigFromCache(), HttpStatus.OK);
}
@PostMapping("/getStageCodeByCode")
@Log("根据编码获取舞台编码")
@ApiOperation("根据编码获取舞台编码")
public ResponseEntity<Object> getStageCodeByCode(@RequestBody String code) {
System.out.println(code);
return new ResponseEntity<>(acsConfigService.findByCode(code), HttpStatus.CREATED);
}
}

View File

@@ -59,6 +59,7 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.exception.WDKException;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.WQLObject;
import org.slf4j.MDC;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
@@ -77,12 +78,15 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
private final RouteLineService RouteLineService;
private final ProduceshiftorderService produceshiftorderService;
private String log_file_type = "log_file_type";
private String log_type = "WMSToACS";
@Override
public Map<String, Object> createFromWms(String param) {
JSONArray tasks = JSONArray.parseArray(param);
JSONObject resultJson = new JSONObject();
log.info("createFromWms--------------:输入参数:" + tasks.toString());
try{
try {
JSONArray errArr = new JSONArray();
for (int i = 0; i < tasks.size(); i++) {
JSONObject task = tasks.getJSONObject(i);
@@ -181,7 +185,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
nextjo.put("batch", "");
nextjo.put("islock", "false");
DeviceService.changeDeviceStatus(nextjo);
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try {
TaskService.create(task_dto);
} catch (Exception e) {
@@ -259,115 +263,122 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Override
public Map<String, Object> createOrder(String param) throws Exception {
JSONArray orders = JSONArray.parseArray(param);
log.info("createOrder--------------:输入参数:" + orders.toString());
try {
MDC.put(log_file_type, log_type);
JSONArray orders = JSONArray.parseArray(param);
log.info("createOrder--------------:输入参数:");
for (int i = 0; i < orders.size(); i++) {
Boolean is_flag = false;
for (int i = 0; i < orders.size(); i++) {
Boolean is_flag = false;
JSONObject json = orders.getJSONObject(i);
String producetask_code = json.getString("producetask_code");
String device_code = json.getString("device_code");
String product_code = json.getString("product_code");
String material_code = json.getString("material_code");
String material_name = json.getString("material_name");
String cust_code = json.getString("cust_code");
String cust_name = json.getString("cust_name");
String model = json.getString("model");
String molten_pool = json.getString("molten_pool");
String weight = json.getString("weight");
String qty = json.getString("plan_qty");
JSONObject json = orders.getJSONObject(i);
String producetask_code = json.getString("producetask_code");
String device_code = json.getString("device_code");
String product_code = json.getString("product_code");
String material_code = json.getString("material_code");
String material_name = json.getString("material_name");
String cust_code = json.getString("cust_code");
String cust_name = json.getString("cust_name");
String model = json.getString("model");
String molten_pool = json.getString("molten_pool");
String weight = json.getString("weight");
String qty = json.getString("plan_qty");
if (StrUtil.isEmpty(producetask_code)) {
throw new WDKException("工单号不能为空");
if (StrUtil.isEmpty(producetask_code)) {
throw new WDKException("工单号不能为空");
}
Device device = DeviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device)) {
throw new Exception("未找到对应设备:" + device_code);
}
LnshMixingMillDeviceDriver lnshMixingMillDeviceDriver;
LnshPressDeviceDriver lnshPressDeviceDriver;
LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver;
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
if (device.getDeviceDriver() instanceof LnshMixingMillDeviceDriver) {
lnshMixingMillDeviceDriver = (LnshMixingMillDeviceDriver) device.getDeviceDriver();
if (StrUtil.isEmpty(qty)) {
throw new WDKException("重量不能为空");
}
if (StrUtil.isEmpty(material_code)) {
throw new WDKException("物料编号不能为空!");
}
lnshMixingMillDeviceDriver.writing("to_order_No", producetask_code);
lnshMixingMillDeviceDriver.writing("to_weight", qty);
lnshMixingMillDeviceDriver.writing("to_material_code", material_code);
is_flag = true;
}
if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) {
lnshPressDeviceDriver = (LnshPressDeviceDriver) device.getDeviceDriver();
if (StrUtil.isEmpty(qty)) {
throw new WDKException("数量不能为空");
}
if (StrUtil.isEmpty(material_code)) {
throw new WDKException("物料编号不能为空!");
}
lnshPressDeviceDriver.writing("to_order_No", producetask_code);
lnshPressDeviceDriver.writing("to_qty", qty);
lnshPressDeviceDriver.writing("to_material_code", material_code);
is_flag = true;
}
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
if (StrUtil.isEmpty(qty)) {
throw new WDKException("数量不能为空");
}
if (StrUtil.isEmpty(material_code)) {
throw new WDKException("物料编号不能为空!");
}
lnshPalletizingManipulatorDeviceDriver.writing("to_order_No", producetask_code);
lnshPalletizingManipulatorDeviceDriver.writing("to_material_qty", qty);
lnshPalletizingManipulatorDeviceDriver.writing("to_material_code", material_code);
is_flag = true;
}
if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();
if (StrUtil.isEmpty(qty)) {
throw new WDKException("数量不能为空");
}
if (StrUtil.isEmpty(material_code)) {
throw new WDKException("物料编号不能为空!");
}
lnshPackagePalletManipulatorDeviceDriver.writing("to_order_No", producetask_code);
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_qty", qty);
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_code", material_code);
is_flag = true;
}
//下发成功后,写入工单信息表记录
if (is_flag) {
ProduceshiftorderDto dto = new ProduceshiftorderDto();
dto.setOrder_code(producetask_code);
dto.setProduct_code(product_code);
dto.setDevice_code(device_code);
dto.setOrder_status("1");
dto.setMaterial_code(material_code);
dto.setMaterial_name(material_name);
dto.setCust_code(cust_code);
dto.setCust_name(cust_name);
dto.setModel(model);
dto.setMolten_pool(molten_pool);
dto.setWeight(weight);
dto.setQty(qty);
produceshiftorderService.create(dto);
}
}
Device device = DeviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device)) {
throw new Exception("未找到对应设备:" + device_code);
}
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.OK);
resultJson.put("message", "操作成功");
resultJson.put("data", new JSONObject());
log.info("createOrder--------------:输出参数{}", param);
return resultJson;
LnshMixingMillDeviceDriver lnshMixingMillDeviceDriver;
LnshPressDeviceDriver lnshPressDeviceDriver;
LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver;
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
if (device.getDeviceDriver() instanceof LnshMixingMillDeviceDriver) {
lnshMixingMillDeviceDriver = (LnshMixingMillDeviceDriver) device.getDeviceDriver();
if (StrUtil.isEmpty(qty)) {
throw new WDKException("重量不能为空");
}
if (StrUtil.isEmpty(material_code)) {
throw new WDKException("物料编号不能为空!");
}
lnshMixingMillDeviceDriver.writing("to_order_No",producetask_code);
lnshMixingMillDeviceDriver.writing("to_weight",qty);
lnshMixingMillDeviceDriver.writing("to_material_code",material_code);
is_flag = true;
}
if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) {
lnshPressDeviceDriver = (LnshPressDeviceDriver) device.getDeviceDriver();
if (StrUtil.isEmpty(qty)) {
throw new WDKException("数量不能为空");
}
if (StrUtil.isEmpty(material_code)) {
throw new WDKException("物料编号不能为空!");
}
lnshPressDeviceDriver.writing("to_order_No",producetask_code);
lnshPressDeviceDriver.writing("to_qty",qty);
lnshPressDeviceDriver.writing("to_material_code",material_code);
is_flag = true;
}
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
if (StrUtil.isEmpty(qty)) {
throw new WDKException("数量不能为空");
}
if (StrUtil.isEmpty(material_code)) {
throw new WDKException("物料编号不能为空!");
}
lnshPalletizingManipulatorDeviceDriver.writing("to_order_No",producetask_code);
lnshPalletizingManipulatorDeviceDriver.writing("to_material_qty",qty);
lnshPalletizingManipulatorDeviceDriver.writing("to_material_code",material_code);
is_flag = true;
}
if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();
if (StrUtil.isEmpty(qty)) {
throw new WDKException("数量不能为空");
}
if (StrUtil.isEmpty(material_code)) {
throw new WDKException("物料编号不能为空!");
}
lnshPackagePalletManipulatorDeviceDriver.writing("to_order_No",producetask_code);
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_qty",qty);
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_code",material_code);
is_flag = true;
}
//下发成功后,写入工单信息表记录
if (is_flag) {
ProduceshiftorderDto dto = new ProduceshiftorderDto();
dto.setOrder_code(producetask_code);
dto.setProduct_code(product_code);
dto.setDevice_code(device_code);
dto.setOrder_status("1");
dto.setMaterial_code(material_code);
dto.setMaterial_name(material_name);
dto.setCust_code(cust_code);
dto.setCust_name(cust_name);
dto.setModel(model);
dto.setMolten_pool(molten_pool);
dto.setWeight(weight);
dto.setQty(qty);
produceshiftorderService.create(dto);
}
} finally {
MDC.remove(log_file_type);
}
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.OK);
resultJson.put("message", "操作成功");
resultJson.put("data", new JSONObject());
log.info("createOrder--------------:输出参数" + resultJson.toString());
return resultJson;
}
@Override
@@ -404,9 +415,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
electricFenceDeviceDriver = (ElectricFenceDeviceDriver) device.getDeviceDriver();
if (electricFenceDeviceDriver.getSuspended()) {
throw new RuntimeException("交通管制无法进入");
} else if (StrUtil.equals(type,"1")) {
} else if (StrUtil.equals(type, "1")) {
electricFenceDeviceDriver.setSuspended(true);
} else if (StrUtil.equals(type,"2")) {
} else if (StrUtil.equals(type, "2")) {
electricFenceDeviceDriver.setSuspended(false);
}
}
@@ -421,7 +432,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Override
public Map<String, Object> putAction(String jsonObject) throws Exception {
JSONArray datas = JSONArray.parseArray(jsonObject);
JSONArray datas = JSONArray.parseArray(jsonObject);
log.info("putAction--------------:输入参数" + datas.toString());
for (int i = 0; i < datas.size(); i++) {
JSONObject data = datas.getJSONObject(i);
@@ -593,9 +604,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("material", lnshMixingMillDeviceDriver.getMaterial());
jo.put("order_No", lnshMixingMillDeviceDriver.getOrder_No());
jo.put("mix_num", lnshMixingMillDeviceDriver.getMix_num());
}
else if (device.getDeviceDriver() instanceof LnshPressDeviceDriver ) {
lnshPressDeviceDriver = (LnshPressDeviceDriver ) device.getDeviceDriver();
} else if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) {
lnshPressDeviceDriver = (LnshPressDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPressDeviceDriver.getMode());
jo.put("status", lnshPressDeviceDriver.getStatus());
@@ -613,8 +623,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("qualified", lnshPressDeviceDriver.getQualified());
jo.put("unqualified", lnshPressDeviceDriver.getUnqualified());
jo.put("order_No", lnshPressDeviceDriver.getOrder_No());
}
else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPalletizingManipulatorDeviceDriver.getMode());
@@ -629,8 +638,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("specifications", lnshPalletizingManipulatorDeviceDriver.getSpecifications());
jo.put("isError", lnshPalletizingManipulatorDeviceDriver.getIserror());
jo.put("message", lnshPalletizingManipulatorDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshKilnTrussDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshKilnTrussDeviceDriver) {
lnshKilnTrussDeviceDriver = (LnshKilnTrussDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshKilnTrussDeviceDriver.getMode());
@@ -643,8 +651,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("error_time", lnshKilnTrussDeviceDriver.getError_time());
jo.put("isError", lnshKilnTrussDeviceDriver.getIserror());
jo.put("message", lnshKilnTrussDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
lnshKilnLaneDeviceDriver = (LnshKilnLaneDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshKilnLaneDeviceDriver.getMode());
@@ -660,8 +667,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("nullCar_qty", lnshKilnLaneDeviceDriver.getNullCar_qty());
jo.put("burning_car_qty", lnshKilnLaneDeviceDriver.getBurning_car_qty());
jo.put("message", lnshKilnLaneDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshOutKilnTrussDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshOutKilnTrussDeviceDriver) {
lnshOutKilnTrussDeviceDriver = (LnshOutKilnTrussDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshOutKilnTrussDeviceDriver.getMode());
@@ -677,8 +683,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("error_time", lnshOutKilnTrussDeviceDriver.getError_time());
jo.put("isError", lnshOutKilnTrussDeviceDriver.getIserror());
jo.put("message", lnshOutKilnTrussDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshFoldDiscSiteDeviceDriver.getMode());
@@ -693,8 +698,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("container_qty", lnshFoldDiscSiteDeviceDriver.getContainer_qty());
jo.put("isError", lnshFoldDiscSiteDeviceDriver.getIserror());
jo.put("message", lnshFoldDiscSiteDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshPalletStorageDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPalletStorageDeviceDriver) {
lnshPalletStorageDeviceDriver = (LnshPalletStorageDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPalletStorageDeviceDriver.getMode());
@@ -710,8 +714,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("total_container", lnshPalletStorageDeviceDriver.getTotal_container());
jo.put("isError", lnshPalletStorageDeviceDriver.getIserror());
jo.put("message", lnshPalletStorageDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPackagePalletManipulatorDeviceDriver.getMode());
@@ -732,8 +735,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("order_No", lnshPackagePalletManipulatorDeviceDriver.getOrder_No());
jo.put("isError", lnshPackagePalletManipulatorDeviceDriver.getIserror());
jo.put("message", lnshPackagePalletManipulatorDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof RljnPackagePalletSplitManipulatorDeviceDriver) {
} else if (device.getDeviceDriver() instanceof RljnPackagePalletSplitManipulatorDeviceDriver) {
rljnPackagePalletSplitManipulatorDeviceDriver = (RljnPackagePalletSplitManipulatorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", rljnPackagePalletSplitManipulatorDeviceDriver.getMode());
@@ -756,8 +758,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("total_split", rljnPackagePalletSplitManipulatorDeviceDriver.getTotal_split());
jo.put("isError", rljnPackagePalletSplitManipulatorDeviceDriver.getIserror());
jo.put("message", rljnPackagePalletSplitManipulatorDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshLabelingMachineDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshLabelingMachineDeviceDriver) {
lnshLabelingMachineDeviceDriver = (LnshLabelingMachineDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshLabelingMachineDeviceDriver.getMode());
@@ -771,8 +772,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("labeling_qty", lnshLabelingMachineDeviceDriver.getLabeling_qty());
jo.put("isError", lnshLabelingMachineDeviceDriver.getIserror());
jo.put("message", lnshLabelingMachineDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshSplitManipulatorDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshSplitManipulatorDeviceDriver) {
lnshSplitManipulatorDeviceDriver = (LnshSplitManipulatorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshSplitManipulatorDeviceDriver.getMode());
@@ -791,8 +791,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("error_time", lnshSplitManipulatorDeviceDriver.getError_time());
jo.put("isError", lnshSplitManipulatorDeviceDriver.getIserror());
jo.put("message", lnshSplitManipulatorDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshPackageLineDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPackageLineDeviceDriver) {
lnshPackageLineDeviceDriver = (LnshPackageLineDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPackageLineDeviceDriver.getMode());
@@ -805,8 +804,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("barcode", lnshPackageLineDeviceDriver.getBarcode());
jo.put("isError", lnshPackageLineDeviceDriver.getIserror());
jo.put("message", lnshPackageLineDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshLaminatingMachineDeviceDriver.getMode());
@@ -818,8 +816,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("isOnline", lnshLaminatingMachineDeviceDriver.getIsonline());
jo.put("isError", lnshLaminatingMachineDeviceDriver.getIserror());
jo.put("message", lnshLaminatingMachineDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshRGVDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshRGVDeviceDriver) {
lnshRGVDeviceDriver = (LnshRGVDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshRGVDeviceDriver.getMode());
@@ -859,7 +856,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
throw new Exception("未找到对应设备:" + device_code);
}
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardAutodoorDeviceDriver.getMode());
@@ -868,16 +865,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("error", standardAutodoorDeviceDriver.getError());
jo.put("isError", standardAutodoorDeviceDriver.getIserror());
} else if (device.getDeviceDriver() instanceof StandardCoveyorMonitorDeviceDriver) {
standardCoveyorMonitorDeviceDriver = (StandardCoveyorMonitorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardCoveyorMonitorDeviceDriver.getMode());
jo.put("move", standardCoveyorMonitorDeviceDriver.getMove());
jo.put("hasGoods", standardCoveyorMonitorDeviceDriver.getHasGoods());
jo.put("isOnline", standardCoveyorMonitorDeviceDriver.getIsonline());
jo.put("error", standardCoveyorMonitorDeviceDriver.getError());
jo.put("isError", standardCoveyorMonitorDeviceDriver.getIserror());
jo.put("message", standardCoveyorMonitorDeviceDriver.getMessage());
//普通站点
standardCoveyorMonitorDeviceDriver = (StandardCoveyorMonitorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", standardCoveyorMonitorDeviceDriver.getMode());
jo.put("move", standardCoveyorMonitorDeviceDriver.getMove());
jo.put("hasGoods", standardCoveyorMonitorDeviceDriver.getHasGoods());
jo.put("isOnline", standardCoveyorMonitorDeviceDriver.getIsonline());
jo.put("error", standardCoveyorMonitorDeviceDriver.getError());
jo.put("isError", standardCoveyorMonitorDeviceDriver.getIserror());
jo.put("message", standardCoveyorMonitorDeviceDriver.getMessage());
//普通站点
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
@@ -937,7 +934,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("isError", standardPhotoelectricInspectSiteDeviceDriver.getIserror());
jo.put("container", standardPhotoelectricInspectSiteDeviceDriver.getContainer());
jo.put("message", standardPhotoelectricInspectSiteDeviceDriver.getMessage());
}else if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) {
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshStationDeviceDriver.getMode());
@@ -957,7 +954,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("batch", lnshStationDeviceDriver.getBatch());
jo.put("pallet_type", lnshStationDeviceDriver.getContainer_type());
} else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPalletizingManipulatorSiteDeviceDriver.getMode());
@@ -1012,9 +1009,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("material", lnshMixingMillDeviceDriver.getMaterial());
jo.put("order_No", lnshMixingMillDeviceDriver.getOrder_No());
jo.put("mix_num", lnshMixingMillDeviceDriver.getMix_num());
}
else if (device.getDeviceDriver() instanceof LnshPressDeviceDriver ) {
lnshPressDeviceDriver = (LnshPressDeviceDriver ) device.getDeviceDriver();
} else if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) {
lnshPressDeviceDriver = (LnshPressDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPressDeviceDriver.getMode());
jo.put("status", lnshPressDeviceDriver.getStatus());
@@ -1032,8 +1028,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("qualified", lnshPressDeviceDriver.getQualified());
jo.put("unqualified", lnshPressDeviceDriver.getUnqualified());
jo.put("order_No", lnshPressDeviceDriver.getOrder_No());
}
else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPalletizingManipulatorDeviceDriver.getMode());
@@ -1048,8 +1043,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("specifications", lnshPalletizingManipulatorDeviceDriver.getSpecifications());
jo.put("isError", lnshPalletizingManipulatorDeviceDriver.getIserror());
jo.put("message", lnshPalletizingManipulatorDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshKilnTrussDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshKilnTrussDeviceDriver) {
lnshKilnTrussDeviceDriver = (LnshKilnTrussDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshKilnTrussDeviceDriver.getMode());
@@ -1062,8 +1056,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("error_time", lnshKilnTrussDeviceDriver.getError_time());
jo.put("isError", lnshKilnTrussDeviceDriver.getIserror());
jo.put("message", lnshKilnTrussDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
lnshKilnLaneDeviceDriver = (LnshKilnLaneDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshKilnLaneDeviceDriver.getMode());
@@ -1079,8 +1072,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("nullCar_qty", lnshKilnLaneDeviceDriver.getNullCar_qty());
jo.put("burning_car_qty", lnshKilnLaneDeviceDriver.getBurning_car_qty());
jo.put("message", lnshKilnLaneDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshOutKilnTrussDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshOutKilnTrussDeviceDriver) {
lnshOutKilnTrussDeviceDriver = (LnshOutKilnTrussDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshOutKilnTrussDeviceDriver.getMode());
@@ -1096,8 +1088,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("error_time", lnshOutKilnTrussDeviceDriver.getError_time());
jo.put("isError", lnshOutKilnTrussDeviceDriver.getIserror());
jo.put("message", lnshOutKilnTrussDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshFoldDiscSiteDeviceDriver.getMode());
@@ -1112,8 +1103,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("container_qty", lnshFoldDiscSiteDeviceDriver.getContainer_qty());
jo.put("isError", lnshFoldDiscSiteDeviceDriver.getIserror());
jo.put("message", lnshFoldDiscSiteDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshPalletStorageDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPalletStorageDeviceDriver) {
lnshPalletStorageDeviceDriver = (LnshPalletStorageDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPalletStorageDeviceDriver.getMode());
@@ -1129,8 +1119,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("total_container", lnshPalletStorageDeviceDriver.getTotal_container());
jo.put("isError", lnshPalletStorageDeviceDriver.getIserror());
jo.put("message", lnshPalletStorageDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPackagePalletManipulatorDeviceDriver.getMode());
@@ -1151,8 +1140,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("order_No", lnshPackagePalletManipulatorDeviceDriver.getOrder_No());
jo.put("isError", lnshPackagePalletManipulatorDeviceDriver.getIserror());
jo.put("message", lnshPackagePalletManipulatorDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof RljnPackagePalletSplitManipulatorDeviceDriver) {
} else if (device.getDeviceDriver() instanceof RljnPackagePalletSplitManipulatorDeviceDriver) {
rljnPackagePalletSplitManipulatorDeviceDriver = (RljnPackagePalletSplitManipulatorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", rljnPackagePalletSplitManipulatorDeviceDriver.getMode());
@@ -1175,8 +1163,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("total_split", rljnPackagePalletSplitManipulatorDeviceDriver.getTotal_split());
jo.put("isError", rljnPackagePalletSplitManipulatorDeviceDriver.getIserror());
jo.put("message", rljnPackagePalletSplitManipulatorDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshLabelingMachineDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshLabelingMachineDeviceDriver) {
lnshLabelingMachineDeviceDriver = (LnshLabelingMachineDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshLabelingMachineDeviceDriver.getMode());
@@ -1190,8 +1177,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("labeling_qty", lnshLabelingMachineDeviceDriver.getLabeling_qty());
jo.put("isError", lnshLabelingMachineDeviceDriver.getIserror());
jo.put("message", lnshLabelingMachineDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshSplitManipulatorDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshSplitManipulatorDeviceDriver) {
lnshSplitManipulatorDeviceDriver = (LnshSplitManipulatorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshSplitManipulatorDeviceDriver.getMode());
@@ -1210,8 +1196,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("error_time", lnshSplitManipulatorDeviceDriver.getError_time());
jo.put("isError", lnshSplitManipulatorDeviceDriver.getIserror());
jo.put("message", lnshSplitManipulatorDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshPackageLineDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPackageLineDeviceDriver) {
lnshPackageLineDeviceDriver = (LnshPackageLineDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshPackageLineDeviceDriver.getMode());
@@ -1224,8 +1209,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("barcode", lnshPackageLineDeviceDriver.getBarcode());
jo.put("isError", lnshPackageLineDeviceDriver.getIserror());
jo.put("message", lnshPackageLineDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshLaminatingMachineDeviceDriver.getMode());
@@ -1237,8 +1221,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("isOnline", lnshLaminatingMachineDeviceDriver.getIsonline());
jo.put("isError", lnshLaminatingMachineDeviceDriver.getIserror());
jo.put("message", lnshLaminatingMachineDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshRGVDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshRGVDeviceDriver) {
lnshRGVDeviceDriver = (LnshRGVDeviceDriver) device.getDeviceDriver();
jo.put("device_code", device.getDevice_code());
jo.put("mode", lnshRGVDeviceDriver.getMode());

View File

@@ -1,107 +0,0 @@
package org.nl.acs.stage.rest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.stage.service.StageActorService;
import org.nl.acs.stage.service.dto.StageActorDto;
import org.nl.annotation.Log;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
* @author ldjun
* @date 2021-04-12
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "舞台演员管理")
@RequestMapping("/api/stageActor")
@Slf4j
public class StageActorController {
private final StageActorService stageActorService;
@GetMapping
@Log("查询舞台演员")
@ApiOperation("查询舞台演员")
//@PreAuthorize("@el.check('stageActor:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(stageActorService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增舞台演员")
@ApiOperation("新增舞台演员")
//@PreAuthorize("@el.check('stageActor:add')")
public ResponseEntity<Object> create(@Validated @RequestBody StageActorDto dto) {
stageActorService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改舞台演员")
@ApiOperation("修改舞台演员")
//@PreAuthorize("@el.check('stageActor:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody StageActorDto dto) {
stageActorService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除舞台演员")
@ApiOperation("删除舞台演员")
//@PreAuthorize("@el.check('stageActor:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
stageActorService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("导出舞台演员")
@ApiOperation("导出舞台演员")
@GetMapping(value = "/download")
//@PreAuthorize("@el.check('stageActor:list')")
public void download(HttpServletResponse response, Map whereJson) throws IOException {
stageActorService.download(stageActorService.queryAll(whereJson), response);
}
@PostMapping("/saveData")
@Log("保存舞台演员")
@ApiOperation("修改舞台演员")
//@PreAuthorize("@el.check('stageActor:edit')")
public ResponseEntity<Object> saveData(@RequestBody Map map) throws IOException {
String stage_code = (String) map.get("stage_code");
String grid_width = String.valueOf(map.get("grid_width"));
String grid_length = String.valueOf(map.get("grid_length"));
JSONArray actors = JSONArray.parseArray((JSON.toJSONString(map.get("list"))));
JSONObject mstForm = new JSONObject();
mstForm.put("stage_code", stage_code);
mstForm.put("grid_width", grid_width);
mstForm.put("grid_length", grid_length);
stageActorService.saveData(mstForm, actors);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@GetMapping("/queryStageActor/{stage_code}")
@Log("查询舞台演员")
@ApiOperation("查询舞台演员")
//@PreAuthorize("@el.check('stageActor:list')")
public ResponseEntity<Object> queryStageActor(@PathVariable String stage_code) throws Exception {
return new ResponseEntity<>(stageActorService.queryStageActorByStageCode(stage_code), HttpStatus.OK);
}
}

View File

@@ -1,103 +0,0 @@
package org.nl.acs.stage.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.acs.stage.service.dto.StageActorDto;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @author ldjun
* @description 服务接口
* @date 2021-04-12
**/
public interface StageActorService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<StageActorDto>
*/
List<StageActorDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param actor_uuid ID
* @return StageActor
*/
StageActorDto findById(String actor_uuid);
/**
* 根据编码查询
*
* @param code code
* @return StageActor
*/
StageActorDto findByCode(String code);
/**
* 创建
*
* @param dto /
*/
void create(StageActorDto dto);
/**
* 编辑
*
* @param dto /
*/
void update(StageActorDto dto);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(String[] ids);
/**
* 导出数据
*
* @param dtos 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<StageActorDto> dtos, HttpServletResponse response) throws IOException;
/**
* 舞台编辑时候保存数据
*
* @param mstForm 舞台编码
* @param array 舞台演员明细
* @throws IOException
*/
void saveData(JSONObject mstForm, JSONArray array) throws IOException;
/**
* 根据舞台编码查询舞台演员
*
* @param stage_code 舞台编码
* @return
*/
JSONObject queryStageActorByStageCode(String stage_code) throws Exception;
}

View File

@@ -1,85 +0,0 @@
package org.nl.acs.stage.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author ldjun
* @description /
* @date 2021-04-12
**/
@Data
public class StageActorDto implements Serializable {
/**
* 图标标识
*/
private String actor_uuid;
/**
* 设备编码
*/
private String device_code;
/**
* 图标名字
*/
private String device_name;
/**
* 图标名字
*/
private String image_name;
/**
* 图标名字
*/
private String angle;
/**
* 舞台标识
*/
private String stage_uuid;
/**
* 备注
*/
private String remark;
/**
* 是否启用
*/
private String is_active;
/**
* 是否删除
*/
private String is_delete;
/**
* 创建者
*/
private String create_by;
/**
* 创建时间
*/
private String create_time;
/**
* 修改者
*/
private String update_by;
/**
* 修改时间
*/
private String update_time;
/**
* 数组下标
*/
private BigDecimal index_seq;
}

View File

@@ -1,150 +0,0 @@
package org.nl.acs.stage.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.stage.service.StageService;
import org.nl.acs.stage.service.dto.StageDto;
import org.nl.exception.BadRequestException;
import org.nl.utils.FileUtil;
import org.nl.utils.SecurityUtils;
import org.nl.wql.core.bean.ResultBean;
import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author ldjun
* @description 服务实现
* @date 2021-04-12
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class StageServiceImpl implements StageService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
WQLObject wo = WQLObject.getWQLObject("acs_stage");
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "update_time desc");
final JSONObject json = rb.pageResult();
return json;
}
@Override
public List<StageDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("acs_stage");
JSONArray arr = wo.query().getResultJSONArray(0);
List<StageDto> list = JSONObject.parseArray(arr.toJSONString(), StageDto.class);
return list;
}
@Override
public StageDto findById(String stage_uuid) {
WQLObject wo = WQLObject.getWQLObject("acs_stage");
JSONObject json = wo.query("stage_uuid ='" + stage_uuid + "'").uniqueResult(0);
final StageDto obj = json.toJavaObject(StageDto.class);
return obj;
}
@Override
public StageDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("acs_stage");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
final StageDto obj = json.toJavaObject(StageDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(StageDto dto) {
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
dto.setStage_uuid(IdUtil.simpleUUID());
dto.setCreate_by(currentUsername);
dto.setUpdate_by(currentUsername);
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("acs_stage");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(StageDto dto) {
StageDto entity = this.findById(dto.getStage_uuid());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
dto.setUpdate_time(now);
dto.setUpdate_by(currentUsername);
WQLObject wo = WQLObject.getWQLObject("acs_stage");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.update(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(String[] ids) {
WQLObject wo = WQLObject.getWQLObject("acs_stage");
for (String stage_uuid : ids) {
wo.delete("stage_uuid = '" + stage_uuid + "'");
}
}
@Override
public void download(List<StageDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (StageDto stage : all) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("舞台编码", stage.getStage_code());
map.put("舞台名字", stage.getStage_name());
map.put("备注", stage.getRemark());
map.put("是否启用", stage.getIs_active());
map.put("是否删除", stage.getIs_delete());
map.put("创建者", stage.getCreate_by());
map.put("创建时间", stage.getCreate_time());
map.put("修改者", stage.getUpdate_by());
map.put("修改时间", stage.getUpdate_time());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
@Override
public JSONArray selectList() {
//设备基础信息表【acs_stage】
JSONArray arr = WQLObject.getWQLObject("acs_stage").query("is_delete= '0' AND is_active= '1'").getResultJSONArray(0);
JSONArray result = new JSONArray();
for (int i = 0; i < arr.size(); i++) {
JSONObject obj = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("stage_id", obj.getString("stage_id"));
json.put("stage_code", obj.getString("stage_code"));
json.put("stage_name", obj.getString("stage_name"));
result.add(json);
}
return result;
}
}

View File

@@ -1,61 +0,0 @@
[交易说明]
交易名: 根据设备查询舞台编码
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
//设备编码
输入.device_code TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
QUERY
SELECT
stage_code
FROM
acs_stage
WHERE
stage_uuid IN (
SELECT
stage_uuid
FROM
acs_stage_actor
WHERE
1=1
OPTION 输入.device_code <> ""
device_code = 输入.device_code
ENDOPTION
)
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -1,37 +1,34 @@
package org.nl.logicflow.rest;
package org.nl.acs.stage.rest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.stage.service.StageService;
import org.nl.acs.stage.service.dto.StageDto;
import org.nl.annotation.Log;
import org.nl.logicflow.service.StageService;
import org.nl.logicflow.service.dto.StageDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
* @author ldjun
* @date 2021-04-12
**/
* @Author: lyd
* @Description: 舞台管理
* @Date: 2022-08-15
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "舞台管理")
@RequestMapping("/api/stage")
@Slf4j
public class StageController {
private final StageService stageService;
@GetMapping
@Log("查询舞台")
@ApiOperation("查询舞台")
@@ -67,14 +64,6 @@ public class StageController {
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("导出舞台")
@ApiOperation("导出舞台")
@GetMapping(value = "/download")
//@PreAuthorize("@el.check('stage:list')")
public void download(HttpServletResponse response, Map whereJson) throws IOException {
stageService.download(stageService.queryAll(whereJson), response);
}
@GetMapping("/selectList")
@Log("下拉选舞台")
@ApiOperation("下拉选舞台")
@@ -82,4 +71,29 @@ public class StageController {
public ResponseEntity<Object> selectList() {
return new ResponseEntity<>(stageService.selectList(), HttpStatus.OK);
}
@PostMapping("/addNewStage")
@Log("保存舞台数据")
@ApiOperation("保存舞台数据")
public ResponseEntity<Object> addNewStage(@Validated @RequestBody StageDto dto) {
log.info("dto{}",dto);
stageService.addNewStage(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/getNewStageDataByCode")
@Log("根据stage_code获取舞台数据")
@ApiOperation("根据stage_code获取舞台数据")
public ResponseEntity<Object> getNewStageDataByCode(@RequestBody String code) {
return new ResponseEntity<>(stageService.findByCode(code), HttpStatus.CREATED);
}
@PostMapping("/getDeviceByCodes")
@Log("获取舞台设备信息")
@ApiOperation("获取舞台设备信息")
public ResponseEntity<Object> getDeviceByCodes(@RequestBody String json) throws Exception{
JSONArray jsonArray = JSONArray.parseArray(json);
return new ResponseEntity<>(stageService.getDeviceByCodes(jsonArray),HttpStatus.OK);
}
}

View File

@@ -1,35 +1,31 @@
package org.nl.acs.stage.rest;
package org.nl.logicflow.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.stage.service.StageImageService;
import org.nl.acs.stage.service.dto.StageImageDto;
import org.nl.annotation.Log;
import org.nl.logicflow.service.StageImageService;
import org.nl.logicflow.service.dto.StageImageDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
* @author zhouz
* @date 2021-04-06
**/
* @Author: lyd
* @Description: 舞台图标控制层
* @Date: 2022-08-16
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "舞台管理")
@RequestMapping("/api/stageImage")
@Slf4j
public class StageImageController {
private final StageImageService stageImageService;
@GetMapping
@@ -67,11 +63,11 @@ public class StageImageController {
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("导出舞台")
@ApiOperation("导出舞台")
@GetMapping(value = "/download")
//@PreAuthorize("@el.check('stageImage:list')")
public void download(HttpServletResponse response, Map whereJson) throws IOException {
stageImageService.download(stageImageService.queryAll(whereJson), response);
@GetMapping("/selectList")
@Log("下拉选设备图标")
@ApiOperation("下拉选设备图标")
//@PreAuthorize("@el.check('routePlan:list')")
public ResponseEntity<Object> selectList() {
return new ResponseEntity<>(stageImageService.selectList(), HttpStatus.OK);
}
}

View File

@@ -1,21 +1,17 @@
package org.nl.logicflow.service;
package org.nl.acs.stage.service;
import org.nl.acs.stage.service.dto.StageImageDto;
import com.alibaba.fastjson.JSONArray;
import org.nl.logicflow.service.dto.StageImageDto;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @author zhouz
* @description 服务接口
* @date 2021-04-06
**/
* @Author: lyd
* @Description: 舞台图标的服务层
* @Date: 2022-08-16
*/
public interface StageImageService {
/**
* 查询数据分页
*
@@ -25,31 +21,6 @@ public interface StageImageService {
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<StageImageDto>
*/
List<StageImageDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param image_uuid ID
* @return StageImage
*/
StageImageDto findById(String image_uuid);
/**
* 根据编码查询
*
* @param code code
* @return StageImage
*/
StageImageDto findByCode(String code);
/**
* 创建
*
@@ -64,6 +35,14 @@ public interface StageImageService {
*/
void update(StageImageDto dto);
/**
* 根据ID查询
*
* @param image_uuid ID
* @return StageImage
*/
StageImageDto findById(String image_uuid);
/**
* 多选删除
*
@@ -72,11 +51,9 @@ public interface StageImageService {
void deleteAll(String[] ids);
/**
* 导出数据
* 前端舞台编辑选择设备图标下拉选列表
*
* @param dtos 待导出的数据
* @param response /
* @throws IOException /
* @return
*/
void download(List<StageImageDto> dtos, HttpServletResponse response) throws IOException;
JSONArray selectList();
}

View File

@@ -1,23 +1,18 @@
package org.nl.acs.stage.service;
package org.nl.logicflow.service;
import com.alibaba.fastjson.JSONArray;
import org.nl.acs.stage.service.dto.StageDto;
import com.alibaba.fastjson.JSONObject;
import org.nl.logicflow.service.dto.StageDto;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @author ldjun
* @description 服务接口
* @date 2021-04-12
**/
* @Author: lyd
* @Description:
* @Date: 2022-08-15
*/
public interface StageService {
/**
* 查询数据分页
*
@@ -27,31 +22,6 @@ public interface StageService {
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<StageDto>
*/
List<StageDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param stage_uuid ID
* @return Stage
*/
StageDto findById(String stage_uuid);
/**
* 根据编码查询
*
* @param code code
* @return Stage
*/
StageDto findByCode(String code);
/**
* 创建
*
@@ -66,6 +36,14 @@ public interface StageService {
*/
void update(StageDto dto);
/**
* 根据ID查询
*
* @param stage_uuid ID
* @return Stage
*/
StageDto findById(String stage_uuid);
/**
* 多选删除
*
@@ -73,20 +51,32 @@ public interface StageService {
*/
void deleteAll(String[] ids);
/**
* 导出数据
*
* @param dtos 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<StageDto> dtos, HttpServletResponse response) throws IOException;
/**
* 前端舞台下拉选列表
*
* @return
*/
JSONArray selectList();
/**
* 新增舞台信息
* 将数据保存到remark---保存数据
* @param dto
*/
void addNewStage(StageDto dto);
/**
* 根据编码查询
*
* @param code code
* @return Stage
*/
StageDto findByCode(String code);
/**
* 设备编号和组价id获取设备信息
* @param jsonArray
* @return
*/
JSONArray getDeviceByCodes(JSONArray jsonArray) throws Exception;
}

View File

@@ -1,17 +1,16 @@
package org.nl.acs.stage.service.dto;
package org.nl.logicflow.service.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @author ldjun
* @description /
* @date 2021-04-12
**/
* @Author: lyd
* @Description: 舞台数据的Dto
* @Date: 2022-08-15
*/
@Data
public class StageDto implements Serializable {
/**
* 舞台标识
*/
@@ -28,9 +27,9 @@ public class StageDto implements Serializable {
private String stage_name;
/**
* 备注
* 舞台数据
*/
private String remark;
private String stage_data;
/**
* 是否启用

View File

@@ -1,17 +1,16 @@
package org.nl.acs.stage.service.dto;
package org.nl.logicflow.service.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhouz
* @description /
* @date 2021-04-06
**/
* @Author: lyd
* @Description: 设备图标dto
* @Date: 2022-08-16
*/
@Data
public class StageImageDto implements Serializable {
/**
* 设备标识
*/
@@ -67,3 +66,4 @@ public class StageImageDto implements Serializable {
*/
private String image_code;
}

View File

@@ -1,6 +1,4 @@
package org.nl.acs.stage.service.impl;
package org.nl.logicflow.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
@@ -8,10 +6,9 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.stage.service.StageImageService;
import org.nl.acs.stage.service.dto.StageImageDto;
import org.nl.exception.BadRequestException;
import org.nl.utils.FileUtil;
import org.nl.logicflow.service.StageImageService;
import org.nl.logicflow.service.dto.StageImageDto;
import org.nl.utils.SecurityUtils;
import org.nl.wql.core.bean.ResultBean;
import org.nl.wql.core.bean.WQLObject;
@@ -20,59 +17,29 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author zhouz
* @description 服务实现
* @date 2021-04-06
**/
* @Author: lyd
* @Description: 舞台图标的服务实现
* @Date: 2022-08-16
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class StageImageServiceImpl implements StageImageService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String where = "1=1";
if (whereJson.get("device_type") != null) {
where = "driver_code_json like ('%" + whereJson.get("device_type") + "%')";
}
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
WQLObject wo = WQLObject.getWQLObject("stage_image");
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "update_time desc");
final JSONObject json = rb.pageResult();
return json;
}
@Override
public List<StageImageDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
JSONArray arr = wo.query().getResultJSONArray(0);
List<StageImageDto> list = arr.toJavaList(StageImageDto.class);
return list;
}
@Override
public StageImageDto findById(String image_uuid) {
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
JSONObject json = wo.query("image_uuid ='" + image_uuid + "'").uniqueResult(0);
final StageImageDto obj = json.toJavaObject(StageImageDto.class);
return obj;
}
@Override
public StageImageDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
final StageImageDto obj = json.toJavaObject(StageImageDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(StageImageDto dto) {
@@ -85,8 +52,8 @@ public class StageImageServiceImpl implements StageImageService {
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
WQLObject wo = WQLObject.getWQLObject("stage_image");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
}
@@ -102,38 +69,43 @@ public class StageImageServiceImpl implements StageImageService {
dto.setUpdate_time(now);
dto.setUpdate_by(currentUsername);
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
WQLObject wo = WQLObject.getWQLObject("stage_image");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.update(json);
}
@Override
public StageImageDto findById(String image_uuid) {
WQLObject wo = WQLObject.getWQLObject("stage_image");
JSONObject json = wo.query("image_uuid ='" + image_uuid + "'").uniqueResult(0);
final StageImageDto obj = json.toJavaObject(StageImageDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(String[] ids) {
WQLObject wo = WQLObject.getWQLObject("acs_stage_image");
WQLObject wo = WQLObject.getWQLObject("stage_image");
for (String image_uuid : ids) {
wo.delete("image_uuid = '" + image_uuid + "'");
}
}
@Override
public void download(List<StageImageDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (StageImageDto stageImage : all) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("设备名字", stageImage.getImage_name());
map.put("适用驱动", stageImage.getDriver_code_json());
map.put("备注", stageImage.getRemark());
map.put("是否启用", stageImage.getIs_active());
map.put("是否删除", stageImage.getIs_delete());
map.put("创建者", stageImage.getCreate_by());
map.put("创建时间", stageImage.getCreate_time());
map.put("修改者", stageImage.getUpdate_by());
map.put("修改时间", stageImage.getUpdate_time());
map.put("图标编码", stageImage.getImage_code());
list.add(map);
public JSONArray selectList() {
//设备基础信息表acs_stage_image
JSONArray arr = WQLObject.getWQLObject("stage_image").query("is_delete= '0' AND is_active= '1'", "update_time desc").getResultJSONArray(0);
JSONArray result = new JSONArray();
for (int i = 0; i < arr.size(); i++) {
JSONObject obj = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("image_uuid", obj.getString("image_uuid"));
json.put("image_code", obj.getString("image_code"));
json.put("image_name", obj.getString("image_code").toString().split("-")[0]);
result.add(json);
}
FileUtil.downloadExcel(list, response);
return result;
}
}

View File

@@ -1,33 +1,21 @@
package org.nl.acs.stage.service.impl;
package org.nl.logicflow.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.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.electric_fence.ElectricFenceDeviceDriver;
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_labeling_machine.LnshLabelingMachineDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_one_rgv.LnshOneRGVDeviceDriver;
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_pallet_storage.LnshPalletStorageDeviceDriver;
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;
@@ -53,11 +41,9 @@ import org.nl.acs.device_driver.weighing_site.WeighingSiteDeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.stage.service.StageActorService;
import org.nl.acs.stage.service.dto.StageActorDto;
import org.nl.exception.BadRequestException;
import org.nl.utils.FileUtil;
import org.nl.utils.RedisUtils;
import org.nl.logicflow.service.StageService;
import org.nl.logicflow.service.dto.StageDto;
import org.nl.utils.SecurityUtils;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.ResultBean;
@@ -67,70 +53,38 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.BindException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author ldjun
* @description 服务实现
* @date 2021-04-12
**/
* @Author: lyd
* @Description: 舞台编辑实现
* @Date: 2022-08-15
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class StageActorServiceImpl implements StageActorService {
private final RedisUtils redisUtils;
public class StageServiceImpl implements StageService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
WQLObject wo = WQLObject.getWQLObject("stage");
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "update_time desc");
final JSONObject json = rb.pageResult();
return json;
}
@Override
public List<StageActorDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
JSONArray arr = wo.query().getResultJSONArray(0);
List<StageActorDto> list = arr.toJavaList(StageActorDto.class);
return list;
}
@Override
public StageActorDto findById(String actor_uuid) {
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
JSONObject json = wo.query("actor_uuid ='" + actor_uuid + "'").uniqueResult(0);
final StageActorDto obj = json.toJavaObject(StageActorDto.class);
return obj;
}
@Override
public StageActorDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
final StageActorDto obj = json.toJavaObject(StageActorDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(StageActorDto dto) {
public void create(StageDto dto) {
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
dto.setActor_uuid(IdUtil.simpleUUID());
dto.setStage_uuid(IdUtil.simpleUUID());
dto.setCreate_by(currentUsername);
dto.setUpdate_by(currentUsername);
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
WQLObject wo = WQLObject.getWQLObject("stage");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
@@ -138,8 +92,8 @@ public class StageActorServiceImpl implements StageActorService {
@Override
@Transactional(rollbackFor = Exception.class)
public void update(StageActorDto dto) {
StageActorDto entity = this.findById(dto.getActor_uuid());
public void update(StageDto dto) {
StageDto entity = this.findById(dto.getStage_uuid());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
String currentUsername = SecurityUtils.getCurrentUsername();
@@ -147,165 +101,111 @@ public class StageActorServiceImpl implements StageActorService {
dto.setUpdate_time(now);
dto.setUpdate_by(currentUsername);
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
WQLObject wo = WQLObject.getWQLObject("stage");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.update(json);
}
@Override
public StageDto findById(String stage_uuid) {
WQLObject wo = WQLObject.getWQLObject("stage");
JSONObject json = wo.query("stage_uuid ='" + stage_uuid + "'").uniqueResult(0);
final StageDto obj = json.toJavaObject(StageDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(String[] ids) {
WQLObject wo = WQLObject.getWQLObject("acs_stage_actor");
for (String actor_uuid : ids) {
wo.delete("actor_uuid = '" + actor_uuid + "'");
WQLObject wo = WQLObject.getWQLObject("stage");
for (String stage_uuid : ids) {
wo.delete("stage_uuid = '" + stage_uuid + "'");
}
}
@Override
public void download(List<StageActorDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (StageActorDto stageActor : all) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("设备编码", stageActor.getDevice_code());
map.put("图标名字", stageActor.getDevice_name());
map.put("图标名字", stageActor.getImage_name());
map.put("图标名字", stageActor.getAngle());
map.put("舞台标识", stageActor.getStage_uuid());
map.put("备注", stageActor.getRemark());
map.put("是否启用", stageActor.getIs_active());
map.put("是否删除", stageActor.getIs_delete());
map.put("创建者", stageActor.getCreate_by());
map.put("创建时间", stageActor.getCreate_time());
map.put("修改者", stageActor.getUpdate_by());
map.put("修改时间", stageActor.getUpdate_time());
list.add(map);
public JSONArray selectList() {
//设备基础信息表stage
JSONArray arr = WQLObject.getWQLObject("stage").query("is_delete= '0' AND is_active= '1'").getResultJSONArray(0);
JSONArray result = new JSONArray();
for (int i = 0; i < arr.size(); i++) {
JSONObject obj = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("stage_id", obj.getString("stage_id"));
json.put("stage_code", obj.getString("stage_code"));
json.put("stage_name", obj.getString("stage_name"));
result.add(json);
}
FileUtil.downloadExcel(list, response);
return result;
}
@Override
public void saveData(JSONObject mstForm, JSONArray array) throws IOException {
String stage_code = mstForm.getString("stage_code");
String grid_width = mstForm.getString("grid_width");
String grid_length = mstForm.getString("grid_length");
//舞台主表acs_stage
WQLObject stageTab = WQLObject.getWQLObject("acs_stage");
JSONObject stageObj = stageTab.query("is_delete ='0' and stage_code = '" + stage_code + "'").uniqueResult(0);
if (ObjectUtil.isNull(stageObj)) {
throw new BindException("舞台为找到,操作失败!");
}
stageObj.put("grid_width", grid_width);
stageObj.put("grid_length", grid_length);
stageTab.update(stageObj);
//舞台实时监控表acs_stage_actor
WQLObject actorTab = WQLObject.getWQLObject("acs_stage_actor");
String stage_uuid = stageObj.getString("stage_uuid");
actorTab.delete("stage_uuid = '" + stage_uuid + "'");
JSONArray actors = new JSONArray();
for (int i = 0; i < array.size(); i++) {
JSONObject json = array.getJSONObject(i);
JSONObject param = new JSONObject();
param.put("actor_uuid", IdUtil.simpleUUID());
param.put("device_code", json.getString("device_code"));
param.put("device_name", json.getString("name"));
param.put("image_name", json.getString("img2"));
param.put("index_seq", json.getString("index"));
param.put("angle", json.getString("angle"));
param.put("stage_uuid", stage_uuid);
actors.add(param);
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
param.put("create_by", currentUsername);
param.put("create_time", now);
param.put("update_by", currentUsername);
param.put("update_time", now);
actorTab.insert(param);
}
redisUtils.del("stage:mst:" + stage_code);
redisUtils.del("stage:dtl:" + stage_code);
redisUtils.set("stage:mst:" + stage_code, stageObj.toString());
redisUtils.set("stage:dtl:" + stage_code, actors.toString());
public void addNewStage(StageDto dto) {
// 根据dto的code找到数据
StageDto stageDto = this.findByCode(dto.getStage_code());
// 设置内容
stageDto.setStage_data(dto.getStage_data());
// 获取当前用户与时间
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
stageDto.setUpdate_time(now);
stageDto.setUpdate_by(currentUsername);
WQLObject wo = WQLObject.getWQLObject("stage");
JSONObject json = (JSONObject) JSONObject.toJSON(stageDto);
wo.update(json);
}
@Override
public JSONObject queryStageActorByStageCode(String stage_code) throws Exception {
//舞台主表acs_stage
WQLObject stageTab = WQLObject.getWQLObject("acs_stage");
public StageDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("stage");
JSONObject json = wo.query("stage_code ='" + code + "'").uniqueResult(0);
final StageDto obj = json.toJavaObject(StageDto.class);
return obj;
}
JSONObject stageObj;
//先从缓存查找
stageObj = JSON.parseObject(redisUtils.get("stage:mst:" + stage_code).toString());
//缓存没找到去数据库查找
if (MapUtil.isEmpty(stageObj)) {
stageObj = stageTab.query("is_delete ='0' and stage_code = '" + stage_code + "'").uniqueResult(0);
}
if (MapUtil.isEmpty(stageObj)) {
throw new BindException("舞台为找到,操作失败!");
}
//舞台实时监控表acs_stage_actor
WQLObject actorTab = WQLObject.getWQLObject("acs_stage_actor");
String stage_uuid = stageObj.getString("stage_uuid");
JSONArray arr = new JSONArray();
JSONArray list = new JSONArray();
String dtl = (String) redisUtils.get("stage:dtl:" + stage_code);
if (StrUtil.isNotEmpty(dtl)) {
list = JSONArray.parseArray(dtl);
}
if (ObjectUtil.isNull(list) || list.size() < 1) {
list = actorTab.query("stage_uuid = '" + stage_uuid + "'", "index_seq").getResultJSONArray(0);
}
@Override
public JSONArray getDeviceByCodes(JSONArray jsonArray) throws Exception { // 前端传来设备编号和节点的id
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
for (int i = 0, j = list.size(); i < j; i++) {
JSONObject json = list.getJSONObject(i);
JSONArray arr = new JSONArray();
for (int i=0; i<jsonArray.size(); i++) {
JSONObject obj = new JSONObject();
obj.put("id", json.getInteger("index"));
obj.put("index", json.getInteger("index_seq"));
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 status = "";
//托盘数量
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;
}
JSONObject js = jsonArray.getJSONObject(i);
//作业状态
String mode = "";
//信号
String move = "";
//取放信号
String action = "";
//进出信号
String io_action = "";
//报警
String error = "";
//设备状态
String status = "";
//托盘数量
String number = "";
//异常或说明信息
String message = "";
//当前指令
String instruction = "";
//上次指令
String last_instruction = "";
//当前托盘号
String pallet = "";
//当前托盘号
String last_pallet = "";
boolean applySucess;
boolean requestSucess;
if (ObjectUtil.isNotEmpty(js.get("device_code"))) { // 查找有绑定了设备号的设备
JSONObject jo = new JSONObject();
Device device = appService.findDeviceByCode((String) js.get("device_code"));
if (!ObjectUtil.isNull(device)) {
// 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);
// }
//无光电普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//无光电特殊站点
@@ -344,22 +244,10 @@ public class StageActorServiceImpl implements StageActorService {
StandardRGVDeviceDriver standardRGVDeviceDriver;
//电子围栏
ElectricFenceDeviceDriver electricFenceDeviceDriver;
//晟华-混碾机
LnshMixingMillDeviceDriver lnshMixingMillDeviceDriver;
//晟华-压力机
LnshPressDeviceDriver lnshPressDeviceDriver;
//嘉耐-码垛机械手
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
//嘉耐-窑车道
LnshKilnLaneDeviceDriver lnshKilnLaneDeviceDriver;
//晟华-入出窑桁架
LnshKilnTrussDeviceDriver lnshKilnTrussDeviceDriver;
//晟华-出窑桁架
LnshOutKilnTrussDeviceDriver lnshOutKilnTrussDeviceDriver;
//晟华-叠盘工位
LnshFoldDiscSiteDeviceDriver lnshFoldDiscSiteDeviceDriver;
//晟华-托盘存储线
LnshPalletStorageDeviceDriver lnshPalletStorageDeviceDriver;
//嘉耐-包装码垛机械手
LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver;
//晟华-贴标机
@@ -370,14 +258,10 @@ public class StageActorServiceImpl implements StageActorService {
LnshRGVDeviceDriver lnshRGVDeviceDriver;
//嘉耐单工位RGV
LnshOneRGVDeviceDriver lnshOneRGVDeviceDriver;
//晟华-包装线
LnshPackageLineDeviceDriver lnshPackageLineDeviceDriver;
//嘉耐-工位(交互模板)
LnshStationDeviceDriver lnshStationDeviceDriver;
//嘉耐-缓存货架
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver;
//嘉耐-包装线工位
LnshPackageSiteDeviceDriver lnshPackageSiteDeviceDriver;
//嘉耐-包装码拆垛机械手
RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver;
//嘉耐-码垛机械手工位
@@ -1090,142 +974,7 @@ public class StageActorServiceImpl implements StageActorService {
jo.put("Htrapezoidal", lnshPalletizingManipulatorSiteDeviceDriver.getHtrapezoidal());
jo.put("Wthickness", lnshPalletizingManipulatorSiteDeviceDriver.getWthickness());
jo.put("batch", lnshPalletizingManipulatorSiteDeviceDriver.getBatch());
} else if (device.getDeviceDriver() instanceof LnshPackageSiteDeviceDriver) {
lnshPackageSiteDeviceDriver = (LnshPackageSiteDeviceDriver) device.getDeviceDriver();
if (lnshPackageSiteDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (lnshPackageSiteDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (lnshPackageSiteDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (lnshPackageSiteDeviceDriver.getMode() == 4) {
mode = "叫料";
} else if (lnshPackageSiteDeviceDriver.getMode() == 5) {
mode = "申请空盘";
} else if (lnshPackageSiteDeviceDriver.getMode() == 6) {
mode = "申请入库";
}
if (lnshPackageSiteDeviceDriver.getAction() == 0) {
action = "禁止取放";
} else if (lnshPackageSiteDeviceDriver.getAction() == 1) {
action = "允许取货";
} else if (lnshPackageSiteDeviceDriver.getAction() == 2) {
action = "允许放货";
} else if (lnshPackageSiteDeviceDriver.getAction() == 3) {
action = "允许取放";
}
if (lnshPackageSiteDeviceDriver.getIo_action() == 0) {
io_action = "禁止进出";
} else if (lnshPackageSiteDeviceDriver.getIo_action() == 1) {
io_action = "允许进入";
} else if (lnshPackageSiteDeviceDriver.getIo_action() == 2) {
io_action = "允许离开";
} else if (lnshPackageSiteDeviceDriver.getIo_action() == 3) {
io_action = "允许进出";
}
if (lnshPackageSiteDeviceDriver.getMove() == 0) {
move = "无货";
} else if (lnshPackageSiteDeviceDriver.getMove() == 1) {
move = "有货";
} else if (lnshPackageSiteDeviceDriver.getMove() == 2) {
move = "有托盘有货";
}
obj.put("device_name", lnshPackageSiteDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("io_action", io_action);
jo.put("hasGoods", lnshPackageSiteDeviceDriver.getHasGoods());
jo.put("isOnline", lnshPackageSiteDeviceDriver.getIsonline());
jo.put("error", lnshPackageSiteDeviceDriver.getError());
jo.put("isError", lnshPackageSiteDeviceDriver.getIserror());
jo.put("message", lnshPackageSiteDeviceDriver.getMessage());
jo.put("task", lnshPackageSiteDeviceDriver.getTask());
jo.put("weight", lnshPackageSiteDeviceDriver.getWeight());
jo.put("material", lnshPackageSiteDeviceDriver.getMaterial());
jo.put("barcode", lnshPackageSiteDeviceDriver.getBarcode());
}
else if (device.getDeviceDriver() instanceof LnshMixingMillDeviceDriver) {
lnshMixingMillDeviceDriver = (LnshMixingMillDeviceDriver) device.getDeviceDriver();
if (lnshMixingMillDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (lnshMixingMillDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (lnshMixingMillDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (lnshMixingMillDeviceDriver.getMode() == 3) {
mode = "人工排产确认";
} else if (lnshMixingMillDeviceDriver.getMode() == 4) {
mode = "工单完成";
}
if (lnshMixingMillDeviceDriver.getStatus() == 1) {
status = "待机";
} else if (lnshMixingMillDeviceDriver.getStatus() == 2) {
status = "生产中";
} else if (lnshMixingMillDeviceDriver.getStatus() == 3) {
status = "故障";
}
obj.put("device_name", lnshMixingMillDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("isOnline", lnshMixingMillDeviceDriver.getIsonline());
jo.put("error", lnshMixingMillDeviceDriver.getError());
jo.put("open_time", lnshMixingMillDeviceDriver.getOpen_time());
jo.put("standby_time", lnshMixingMillDeviceDriver.getStandby_time());
jo.put("production_time", lnshMixingMillDeviceDriver.getProduction_time());
jo.put("error_time", lnshMixingMillDeviceDriver.getError_time());
jo.put("isError", lnshMixingMillDeviceDriver.getIserror());
jo.put("message", lnshMixingMillDeviceDriver.getMessage());
jo.put("weight", lnshMixingMillDeviceDriver.getWeight());
jo.put("material", lnshMixingMillDeviceDriver.getMaterial());
jo.put("order_No", lnshMixingMillDeviceDriver.getOrder_No());
jo.put("mix_num", lnshMixingMillDeviceDriver.getMix_num());
}
else if (device.getDeviceDriver() instanceof LnshPressDeviceDriver ) {
lnshPressDeviceDriver = (LnshPressDeviceDriver ) device.getDeviceDriver();
if (lnshPressDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (lnshPressDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (lnshPressDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (lnshPressDeviceDriver.getMode() == 3) {
mode = "人工排产确认";
} else if (lnshPressDeviceDriver.getMode() == 4) {
mode = "工单完成";
}
if (lnshPressDeviceDriver.getStatus() == 1) {
status = "待机";
} else if (lnshPressDeviceDriver.getStatus() == 2) {
status = "生产中";
} else if (lnshPressDeviceDriver.getStatus() == 3) {
status = "故障";
}
obj.put("device_name", lnshPressDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("isOnline", lnshPressDeviceDriver.getIsonline());
jo.put("error", lnshPressDeviceDriver.getError());
jo.put("open_time", lnshPressDeviceDriver.getOpen_time());
jo.put("standby_time", lnshPressDeviceDriver.getStandby_time());
jo.put("production_time", lnshPressDeviceDriver.getProduction_time());
jo.put("error_time", lnshPressDeviceDriver.getError_time());
jo.put("isError", lnshPressDeviceDriver.getIserror());
jo.put("message", lnshPressDeviceDriver.getMessage());
jo.put("weight", lnshPressDeviceDriver.getWeight());
jo.put("qty", lnshPressDeviceDriver.getQty());
jo.put("material", lnshPressDeviceDriver.getMaterial());
jo.put("qualified", lnshPressDeviceDriver.getQualified());
jo.put("unqualified", lnshPressDeviceDriver.getUnqualified());
jo.put("order_No", lnshPressDeviceDriver.getOrder_No());
}
else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
if (lnshPalletizingManipulatorDeviceDriver.getMode() == 0) {
mode = "未联机";
@@ -1276,40 +1025,7 @@ public class StageActorServiceImpl implements StageActorService {
jo.put("batch", lnshPalletizingManipulatorDeviceDriver.getBatch());
jo.put("isError", lnshPalletizingManipulatorDeviceDriver.getIserror());
jo.put("message", lnshPalletizingManipulatorDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshKilnTrussDeviceDriver) {
lnshKilnTrussDeviceDriver = (LnshKilnTrussDeviceDriver) device.getDeviceDriver();
if (lnshKilnTrussDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (lnshKilnTrussDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (lnshKilnTrussDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (lnshKilnTrussDeviceDriver.getMode() == 3) {
mode = "运行中";
}
if (lnshKilnTrussDeviceDriver.getStatus() == 1) {
status = "待机";
} else if (lnshKilnTrussDeviceDriver.getStatus() == 2) {
status = "生产中";
} else if (lnshKilnTrussDeviceDriver.getStatus() == 3) {
status = "故障";
}
obj.put("device_name", lnshKilnTrussDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("isOnline", lnshKilnTrussDeviceDriver.getIsonline());
jo.put("error", lnshKilnTrussDeviceDriver.getError());
jo.put("open_time", lnshKilnTrussDeviceDriver.getOpen_time());
jo.put("standby_time", lnshKilnTrussDeviceDriver.getStandby_time());
jo.put("production_time", lnshKilnTrussDeviceDriver.getProduction_time());
jo.put("error_time", lnshKilnTrussDeviceDriver.getError_time());
jo.put("isError", lnshKilnTrussDeviceDriver.getIserror());
jo.put("message", lnshKilnTrussDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
lnshKilnLaneDeviceDriver = (LnshKilnLaneDeviceDriver) device.getDeviceDriver();
if (lnshKilnLaneDeviceDriver.getMode() == 0) {
mode = "未联机";
@@ -1341,112 +1057,7 @@ public class StageActorServiceImpl implements StageActorService {
jo.put("nullCar_qty", lnshKilnLaneDeviceDriver.getNullCar_qty());
jo.put("burning_car_qty", lnshKilnLaneDeviceDriver.getBurning_car_qty());
jo.put("message", lnshKilnLaneDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshOutKilnTrussDeviceDriver) {
lnshOutKilnTrussDeviceDriver = (LnshOutKilnTrussDeviceDriver) device.getDeviceDriver();
if (lnshOutKilnTrussDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (lnshOutKilnTrussDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (lnshOutKilnTrussDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (lnshOutKilnTrussDeviceDriver.getMode() == 3) {
mode = "运行中";
}
if (lnshOutKilnTrussDeviceDriver.getStatus() == 1) {
status = "待机";
} else if (lnshOutKilnTrussDeviceDriver.getStatus() == 2) {
status = "生产中";
} else if (lnshOutKilnTrussDeviceDriver.getStatus() == 3) {
status = "故障";
}
obj.put("device_name", lnshOutKilnTrussDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("isOnline", lnshOutKilnTrussDeviceDriver.getIsonline());
jo.put("error", lnshOutKilnTrussDeviceDriver.getError());
jo.put("outKiln_move", lnshOutKilnTrussDeviceDriver.getOutKiln_move());
jo.put("outKiln_barcode", lnshOutKilnTrussDeviceDriver.getOutKiln_barcode());
jo.put("outKiln_device", lnshOutKilnTrussDeviceDriver.getOutKiln_device());
jo.put("open_time", lnshOutKilnTrussDeviceDriver.getOpen_time());
jo.put("standby_time", lnshOutKilnTrussDeviceDriver.getStandby_time());
jo.put("production_time", lnshOutKilnTrussDeviceDriver.getProduction_time());
jo.put("error_time", lnshOutKilnTrussDeviceDriver.getError_time());
jo.put("isError", lnshOutKilnTrussDeviceDriver.getIserror());
jo.put("message", lnshOutKilnTrussDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) device.getDeviceDriver();
if (lnshFoldDiscSiteDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (lnshFoldDiscSiteDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (lnshFoldDiscSiteDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (lnshFoldDiscSiteDeviceDriver.getMode() == 3) {
mode = "运行中";
}
if (lnshFoldDiscSiteDeviceDriver.getStatus() == 1) {
status = "待机";
} else if (lnshFoldDiscSiteDeviceDriver.getStatus() == 2) {
status = "生产中";
} else if (lnshFoldDiscSiteDeviceDriver.getStatus() == 3) {
status = "故障";
}
obj.put("device_name", lnshFoldDiscSiteDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("isOnline", lnshFoldDiscSiteDeviceDriver.getIsonline());
jo.put("error", lnshFoldDiscSiteDeviceDriver.getError());
jo.put("open_time", lnshFoldDiscSiteDeviceDriver.getOpen_time());
jo.put("close_time", lnshFoldDiscSiteDeviceDriver.getClose_time());
jo.put("standby_time", lnshFoldDiscSiteDeviceDriver.getStandby_time());
jo.put("production_time", lnshFoldDiscSiteDeviceDriver.getProduction_time());
jo.put("error_time", lnshFoldDiscSiteDeviceDriver.getError_time());
jo.put("container_qty", lnshFoldDiscSiteDeviceDriver.getContainer_qty());
jo.put("isError", lnshFoldDiscSiteDeviceDriver.getIserror());
jo.put("message", lnshFoldDiscSiteDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshPalletStorageDeviceDriver) {
lnshPalletStorageDeviceDriver = (LnshPalletStorageDeviceDriver) device.getDeviceDriver();
if (lnshPalletStorageDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (lnshPalletStorageDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (lnshPalletStorageDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (lnshPalletStorageDeviceDriver.getMode() == 3) {
mode = "运行中";
}
if (lnshPalletStorageDeviceDriver.getStatus() == 1) {
status = "待机";
} else if (lnshPalletStorageDeviceDriver.getStatus() == 2) {
status = "生产中";
} else if (lnshPalletStorageDeviceDriver.getStatus() == 3) {
status = "故障";
}
obj.put("device_name", lnshPalletStorageDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("isOnline", lnshPalletStorageDeviceDriver.getIsonline());
jo.put("error", lnshPalletStorageDeviceDriver.getError());
jo.put("open_time", lnshPalletStorageDeviceDriver.getOpen_time());
jo.put("close_time", lnshPalletStorageDeviceDriver.getClose_time());
jo.put("standby_time", lnshPalletStorageDeviceDriver.getStandby_time());
jo.put("production_time", lnshPalletStorageDeviceDriver.getProduction_time());
jo.put("error_time", lnshPalletStorageDeviceDriver.getError_time());
jo.put("tray_crib_qty", lnshPalletStorageDeviceDriver.getTray_crib_qty());
jo.put("total_container", lnshPalletStorageDeviceDriver.getTotal_container());
jo.put("isError", lnshPalletStorageDeviceDriver.getIserror());
jo.put("message", lnshPalletStorageDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();
if (lnshPackagePalletManipulatorDeviceDriver.getMode() == 0) {
mode = "未联机";
@@ -1602,40 +1213,7 @@ public class StageActorServiceImpl implements StageActorService {
jo.put("onoff_status", onoff_status);
jo.put("isError", lnshSplitManipulatorDeviceDriver.getIserror());
jo.put("message", lnshSplitManipulatorDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshPackageLineDeviceDriver) {
lnshPackageLineDeviceDriver = (LnshPackageLineDeviceDriver) device.getDeviceDriver();
if (lnshPackageLineDeviceDriver.getMode() == 0) {
mode = "未联机";
} else if (lnshPackageLineDeviceDriver.getMode() == 1) {
mode = "单机";
} else if (lnshPackageLineDeviceDriver.getMode() == 2) {
mode = "联机";
} else if (lnshPackageLineDeviceDriver.getMode() == 3) {
mode = "运行中";
}
if (lnshPackageLineDeviceDriver.getStatus() == 1) {
status = "待机";
} else if (lnshPackageLineDeviceDriver.getStatus() == 2) {
status = "生产中";
} else if (lnshPackageLineDeviceDriver.getStatus() == 3) {
status = "故障";
}
obj.put("device_name", lnshPackageLineDeviceDriver.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("status", status);
jo.put("isOnline", lnshPackageLineDeviceDriver.getIsonline());
jo.put("open_time", lnshPackageLineDeviceDriver.getOpen_time());
jo.put("standby_time", lnshPackageLineDeviceDriver.getStandby_time());
jo.put("production_time", lnshPackageLineDeviceDriver.getProduction_time());
jo.put("error_time", lnshPackageLineDeviceDriver.getError_time());
jo.put("barcode", lnshPackageLineDeviceDriver.getBarcode());
jo.put("isError", lnshPackageLineDeviceDriver.getIserror());
jo.put("message", lnshPackageLineDeviceDriver.getMessage());
}
else if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
} else if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
lnshLaminatingMachineDeviceDriver = (LnshLaminatingMachineDeviceDriver) device.getDeviceDriver();
if (lnshLaminatingMachineDeviceDriver.getMode() == 0) {
mode = "未联机";
@@ -1815,18 +1393,13 @@ public class StageActorServiceImpl implements StageActorService {
jo.put("qty", lnshOneRGVDeviceDriver.getQty());
}
obj.put("data", jo);
obj.put("device_code", js.get("device_code"));
}
}
obj.put("img2", json.getString("image_name"));
obj.put("angle", json.getString("angle"));
obj.put("id", js.get("id")); // 设备不存在就只保留id方便前端查看
arr.add(obj);
}
JSONObject result = new JSONObject();
result.put("form", stageObj);
result.put("detail", arr);
return result;
return arr;
}
}

View File

@@ -60,7 +60,7 @@ public class LokiServiceImpl implements LokiService {
JSONObject parse = null;
String query = lokiUrl + "/query_range?query={" + logLabel + "=\"" + logLabelValue + "\"} |= `" + text + "`";
String result = "";
if (start.equals(0L)) {
if (start==0L) {
result = HttpUtil.get(query + "&limit=" + limit + "&direction=" + direction, CharsetUtil.CHARSET_UTF_8);
} else {
result = HttpUtil.get(query + "&limit=" + limit + "&start=" + start + "&end=" + end + "&direction=" + direction, CharsetUtil.CHARSET_UTF_8);

View File

@@ -4,7 +4,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.stage.service.StageActorService;
//import org.nl.acs.stage.service.StageActorService;
import org.nl.modules.mnt.websocket.MsgType;
import org.nl.modules.mnt.websocket.SocketMsg;
import org.nl.modules.mnt.websocket.WebSocketServer;
@@ -20,21 +20,21 @@ import java.io.IOException;
@Component
@RequiredArgsConstructor
public class DeviceStatusMonitor {
@Autowired
StageActorService stageActorService;
private String stage_code = "SHDP";
public void run(String stageCode) throws Exception {
try {
if (StrUtil.isNotEmpty(stageCode)) {
stage_code = stageCode;
}
JSONObject json = stageActorService.queryStageActorByStageCode(stage_code);
SocketMsg deviceInfo = new SocketMsg(json, MsgType.INFO);
WebSocketServer.sendInfo(deviceInfo, "device_monitor");
} catch (IOException e) {
e.printStackTrace();
}
}
// @Autowired
// StageActorService stageActorService;
// private String stage_code = "SHDP";
//
// public void run(String stageCode) throws Exception {
// try {
// if (StrUtil.isNotEmpty(stageCode)) {
// stage_code = stageCode;
// }
// JSONObject json = stageActorService.queryStageActorByStageCode(stage_code);
// SocketMsg deviceInfo = new SocketMsg(json, MsgType.INFO);
//
// WebSocketServer.sendInfo(deviceInfo, "device_monitor");
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
}

View File

@@ -1,30 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<springProperty scope="context" name="lokiUrl" source="loki.url"/>
<property name="LOKI_URL" value="${lokiUrl}"/>
<property name="log.pattern"
value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/>
<!--<?xml version="1.0" encoding="UTF-8"?>-->
<!--<included>-->
<!-- <springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>-->
<!-- <springProperty scope="context" name="lokiUrl" source="loki.url"/>-->
<!-- <property name="LOKI_URL" value="${lokiUrl}"/>-->
<!-- <property name="log.pattern"-->
<!-- value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/>-->
<!--添加loki-->
<appender name="lokiAppender" class="com.github.loki4j.logback.Loki4jAppender">
<batchTimeoutMs>1000</batchTimeoutMs>
<http class="com.github.loki4j.logback.ApacheHttpSender">
<url>${LOKI_URL}</url>
</http>
<format>
<label>
<pattern>logType=wms_to_acs</pattern>
</label>
<message>
<pattern>${log.pattern}</pattern>
</message>
<sortByTime>true</sortByTime>
</format>
</appender>
<!-- &lt;!&ndash;添加loki&ndash;&gt;-->
<!-- <appender name="lokiAppender" class="com.github.loki4j.logback.Loki4jAppender">-->
<!-- <batchTimeoutMs>1000</batchTimeoutMs>-->
<!-- <http class="com.github.loki4j.logback.ApacheHttpSender">-->
<!-- <url>${LOKI_URL}</url>-->
<!-- </http>-->
<!-- <format>-->
<!-- <label>-->
<!-- <pattern>logType=wms_to_acs</pattern>-->
<!-- </label>-->
<!-- <message>-->
<!-- <pattern>${log.pattern}</pattern>-->
<!-- </message>-->
<!-- <sortByTime>true</sortByTime>-->
<!-- </format>-->
<!-- </appender>-->
<!-- 打印sql -->
<logger name="org.nl.acs.ext.wms.service.impl.WmsToAcsServiceImpl" level="info" additivity="false">
<appender-ref ref="lokiAppender" />
</logger>
</included>
<!-- &lt;!&ndash; 打印sql &ndash;&gt;-->
<!-- <logger name="org.nl.acs.ext.wms.service.impl.WmsToAcsServiceImpl" level="info" additivity="false">-->
<!-- <appender-ref ref="lokiAppender" />-->
<!-- </logger>-->
<!--</included>-->

View File

@@ -25,7 +25,7 @@ https://juejin.cn/post/6844903775631572999
<include resource="log/AgvLeaveServlet.xml"/>
<include resource="log/AcsToErp.xml"/>
<include resource="log/AcsToWms.xml"/>
<include resource="log/WmsToAcs.xml"/>
<!-- <include resource="log/WmsToAcs.xml"/>-->
<include resource="log/QueryXZAgvTaskStatus.xml"/>
<include resource="log/NDCSocketConnectionAutoRun.xml"/>
<!-- <include resource="log/QueryMagicAgvDeviceStatus.xml"/>-->