# Conflicts:
#	acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java
#	acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/rest/DeviceController.java
#	acs2/nladmin-system/nlsso-server/src/main/resources/config/application.yml
This commit is contained in:
ludj
2024-01-16 20:19:59 +08:00
12 changed files with 126 additions and 472 deletions

View File

@@ -1,8 +1,8 @@
ENV = 'development' ENV = 'development'
# 接口地址 # 接口地址
VUE_APP_BASE_API = 'http://localhost:8011' VUE_APP_BASE_API = 'http://localhost:8010'
VUE_APP_WS_API = 'ws://localhost:8011' VUE_APP_WS_API = 'ws://localhost:8010'
# 是否启用 babel-plugin-dynamic-import-node插件 # 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@@ -2,6 +2,6 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇Nginx 配置 # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl需要将 https 改为 http # 接口地址,注意协议,如果你没有配置 ssl需要将 https 改为 http
VUE_APP_BASE_API = 'http://10.1.3.94:8011' VUE_APP_BASE_API = 'http://127.0.0.1:8010'
# 如果接口是 http 形式, wss 需要改为 ws # 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'ws://10.1.3.94:8011' VUE_APP_WS_API = 'ws://127.0.0.1:8010'

View File

@@ -1,9 +1,9 @@
window.g = { window.g = {
dev: { dev: {
VUE_APP_BASE_API: 'http://127.0.0.1:8015' VUE_APP_BASE_API: 'http://127.0.0.1:8010'
}, },
prod: { prod: {
VUE_APP_BASE_API: 'http://127.0.0.1:8012' VUE_APP_BASE_API: 'http://127.0.0.1:8010'
} }

View File

@@ -2,32 +2,23 @@ package org.nl.acs.device.rest;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import org.nl.acs.device.device_driver.DriverTypeEnum; import org.nl.acs.device.device_driver.DriverTypeEnum;
import org.nl.acs.device.device_driver.standard_inspect.OpcPlcDto;
import org.nl.acs.device.service.mapper.DeviceMapper;
import org.nl.acs.device.service.mapper.DeviceMappers;
import org.nl.common.logging.annotation.Log;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.dto.DeviceDto; import org.nl.acs.device.service.dto.DeviceDto;
import org.nl.acs.device.service.dto.DeviceQueryParam; import org.nl.common.logging.annotation.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* @author jiaolm * @author jiaolm
@@ -35,15 +26,12 @@ import java.util.Set;
**/ **/
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@RequestMapping("/api/device") @RequestMapping("/api/device")
public class DeviceController { public class DeviceController {
private final DeviceService deviceService; private final DeviceService deviceService;
@GetMapping @GetMapping
@Log("查询设备") @Log("查询设备")
@@ -53,20 +41,17 @@ public class DeviceController {
@GetMapping("/protocol") @GetMapping("/protocol")
@Log("查询设备协议") @Log("查询设备协议")
public ResponseEntity<Object> protocol(@RequestParam Map whereJson, Pageable page) { public ResponseEntity<Object> protocol(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(deviceService.queryDeviceProtocol(whereJson, page), HttpStatus.OK); return new ResponseEntity<>(deviceService.queryDeviceProtocol(whereJson, page), HttpStatus.OK);
} }
@Log("导出设备协议") @Log("导出设备协议")
@GetMapping(value = "/protocol/download") @GetMapping(value = "/protocol/download")
public void downDeviceDBload(HttpServletResponse response, @RequestParam Map whereJson) throws IOException { public void downDeviceDBload(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
deviceService.downDeviceDBload(deviceService.queryDeviceProtocol(whereJson), response); deviceService.downDeviceDBload(deviceService.queryDeviceProtocol(whereJson), response);
} }
@Log("导出设备协议") @Log("导出设备协议")
@GetMapping(value = "/protocol/downloadCSV") @GetMapping(value = "/protocol/downloadCSV")
public void downDeviceDBloadCSV(HttpServletResponse response, @RequestParam Map whereJson) throws IOException { public void downDeviceDBloadCSV(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
deviceService.downDeviceDBloadCSV(deviceService.queryDeviceProtocol(whereJson), response); deviceService.downDeviceDBloadCSV(deviceService.queryDeviceProtocol(whereJson), response);
@@ -82,14 +67,12 @@ public class DeviceController {
@PutMapping @PutMapping
@Log("修改设备") @Log("修改设备")
public ResponseEntity<Object> update(@Validated @RequestBody DeviceDto dto) { public ResponseEntity<Object> update(@Validated @RequestBody DeviceDto dto) {
deviceService.update(dto); deviceService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} }
@Log("删除设备") @Log("删除设备")
@DeleteMapping @DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) { public ResponseEntity<Object> delete(@RequestBody String[] ids) {
@@ -98,7 +81,6 @@ public class DeviceController {
} }
@Log("导出设备") @Log("导出设备")
@GetMapping(value = "/download") @GetMapping(value = "/download")
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException { public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
deviceService.download(deviceService.queryAll(whereJson), response); deviceService.download(deviceService.queryAll(whereJson), response);
@@ -106,39 +88,16 @@ public class DeviceController {
@GetMapping("/selectList") @GetMapping("/selectList")
@Log("下拉选设备") @Log("下拉选设备")
public ResponseEntity<Object> selectList() { public ResponseEntity<Object> selectList() {
return new ResponseEntity<>(deviceService.selectList(), HttpStatus.OK); return new ResponseEntity<>(deviceService.selectList(), HttpStatus.OK);
} }
@GetMapping("/region/{region}") @GetMapping("/region/{region}")
@Log("根据区域查询设备") @Log("根据区域查询设备")
public ResponseEntity<Object> selectList(@PathVariable String region) { public ResponseEntity<Object> selectList(@PathVariable String region) {
return new ResponseEntity<>(deviceService.selectDeviceListByRegion(region), HttpStatus.OK); return new ResponseEntity<>(deviceService.selectDeviceListByRegion(region), HttpStatus.OK);
} }
@GetMapping("/selectListOne")
@Log("查询区域一设备")
public ResponseEntity<Object> selectListOne() {
return new ResponseEntity<>(deviceService.selectDeviceListOne(), HttpStatus.OK);
}
@GetMapping("/selectListTwo")
@Log("查询区域二设备")
public ResponseEntity<Object> selectListTwo() {
return new ResponseEntity<>(deviceService.selectDeviceListTwo(), HttpStatus.OK);
}
@GetMapping("/selectListThree")
@Log("查询区域三设备")
public ResponseEntity<Object> selectListThree() {
return new ResponseEntity<>(deviceService.selectDeviceListThree(), HttpStatus.OK);
}
@GetMapping("/type/{type}") @GetMapping("/type/{type}")
@Log("根据设备类型查询已配置设备") @Log("根据设备类型查询已配置设备")
@@ -153,52 +112,17 @@ public class DeviceController {
return new ResponseEntity<>(deviceService.selectDeviceDevicerInfo(status), HttpStatus.OK); return new ResponseEntity<>(deviceService.selectDeviceDevicerInfo(status), HttpStatus.OK);
} }
@PostMapping("/callAgv")
@Log("呼叫请求")
public ResponseEntity<Object> callAgv(@RequestBody JSONObject json) {
deviceService.callAgv(json);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/addMaterial")
@Log("添加物料信息")
public ResponseEntity<Object> addMaterial(@RequestBody JSONObject json) {
deviceService.addMaterial(json);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/changeDeviceStatus") @PostMapping("/changeDeviceStatus")
@Log("改变设备状态") @Log("改变设备状态")
public ResponseEntity<Object> changeDeviceStatus(@RequestBody JSONObject json) { public ResponseEntity<Object> changeDeviceStatus(@RequestBody JSONObject json) {
deviceService.changeDeviceStatus(json); deviceService.changeDeviceStatus(json);
return new ResponseEntity<>(HttpStatus.CREATED); return new ResponseEntity<>(HttpStatus.CREATED);
} }
@PostMapping("/changeFenceStatus")
@Log("改变电子围栏状态")
public ResponseEntity<Object> changeFenceStatus(@RequestBody JSONObject json) {
deviceService.changeFenceStatus(json);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/responseAgv")
@Log("响应请求")
public ResponseEntity<Object> responseAgv(@RequestBody JSONObject json) {
deviceService.responseAgv(json);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/autoCreateTask") @PostMapping("/autoCreateTask")
@Log("自动创建接任务") @Log("自动创建接任务")
public ResponseEntity<Object> autoCreateTask(@RequestBody JSONObject json) { public ResponseEntity<Object> autoCreateTask(@RequestBody JSONObject json) {
deviceService.autoCreateTask(json); deviceService.autoCreateTask(json);
return new ResponseEntity<>(HttpStatus.CREATED); return new ResponseEntity<>(HttpStatus.CREATED);
} }
@@ -210,17 +134,8 @@ public class DeviceController {
return new ResponseEntity<>(HttpStatus.CREATED); return new ResponseEntity<>(HttpStatus.CREATED);
} }
@PostMapping("/cleanMaterial")
@Log("清除设备物料信息")
public ResponseEntity<Object> cleanMaterial(@RequestBody JSONObject json) {
deviceService.cleanMaterial(json);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@GetMapping("/selectDriverCodeList/{device_code}") @GetMapping("/selectDriverCodeList/{device_code}")
@Log("下拉选设备驱动") @Log("下拉选设备驱动")
public ResponseEntity<Object> selectDriverCodeList(@PathVariable String device_code) { public ResponseEntity<Object> selectDriverCodeList(@PathVariable String device_code) {
DeviceDto device = deviceService.findByCode(device_code); DeviceDto device = deviceService.findByCode(device_code);
JSONArray ja = deviceService.selectDriverCodeList(device_code); JSONArray ja = deviceService.selectDriverCodeList(device_code);

View File

@@ -201,27 +201,6 @@ public interface DeviceService extends CommonService<Device> {
*/ */
JSONArray selectDeviceDevicerInfo(String status); JSONArray selectDeviceDevicerInfo(String status);
/**
* 查询区域一设备
*
* @return
*/
JSONArray selectDeviceListOne();
/**
* 查询区域二设备
*
* @return
*/
JSONArray selectDeviceListTwo();
/**
* 查询区域三设备
*
* @return
*/
JSONArray selectDeviceListThree();
/** /**
* 更新驱动配置信息 * 更新驱动配置信息
* *
@@ -236,34 +215,6 @@ public interface DeviceService extends CommonService<Device> {
*/ */
void changeDeviceStatus(JSONObject form); void changeDeviceStatus(JSONObject form);
/**
* 改变电子围栏状态
*
* @param form
*/
void changeFenceStatus(JSONObject form);
/**
* 呼叫请求
*
* @param form
*/
void callAgv(JSONObject form);
/**
* 添加物料信息
*
* @param form
*/
void addMaterial(JSONObject form);
/**
* 响应请求参数
*
* @param form
*/
void responseAgv(JSONObject form);
/** /**
* 自动创建任务 * 自动创建任务
* @param json * @param json
@@ -283,11 +234,6 @@ public interface DeviceService extends CommonService<Device> {
*/ */
void cleanTask(JSONObject json); void cleanTask(JSONObject json);
/**
* 清理材料
* @param json
*/
void cleanMaterial(JSONObject json);
/** /**
* 根据设备标识查询设备驱动配置,如果未配置过,就从驱动配置定义找,否则从数据库里面找 * 根据设备标识查询设备驱动配置,如果未配置过,就从驱动配置定义找,否则从数据库里面找

View File

@@ -565,179 +565,6 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
return result; return result;
} }
@Override
public JSONArray selectDeviceListOne() {
//设备基础信息表【acs_device】
List<Device> deviceList = new LambdaQueryChainWrapper<>(deviceMapper)
.apply("is_delete= '0' AND is_active= '1' AND region = '1'")
.orderByAsc(Device::getSeq_num)
.list();
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(deviceList));
//acs_device_extra
JSONArray result = new JSONArray();
for (int i = 0; i < arr.size(); i++) {
JSONObject obj = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("device_id", obj.getString("device_id"));
json.put("device_code", obj.getString("device_code"));
json.put("checked", false);
json.put("device_name", obj.getString("device_name"));
Device device = deviceAppService.findDeviceByCode(obj.getString("device_code"));
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial());
json.put("remark", standardOrdinarySiteDeviceDriver.getRemark());
}
List<DeviceExtra> deviceExtraList = new LambdaQueryChainWrapper<>(deviceExtraMapper)
.eq(DeviceExtra::getDevice_id, obj.getString("device_id"))
.list();
JSONArray extraArr = JSONArray.parseArray(JSON.toJSONString(deviceExtraList));
for (int m = 0; m < extraArr.size(); m++) {
JSONObject jsonObject = extraArr.getJSONObject(m);
String extra_code = jsonObject.getString("extra_code");
//定点作业:自动创建任务
if ("auto_create_task".equals(extra_code)) {
json.put("auto_create_task", jsonObject.getBoolean("extra_value"));
}
//呼叫
if ("apply_task".equals(extra_code)) {
json.put("apply_task", jsonObject.getBoolean("extra_value"));
}
//响应
if ("manual_create_task".equals(extra_code)) {
json.put("manual_create_task", jsonObject.getBoolean("extra_value"));
}
//清除
if ("auto_clean_task".equals(extra_code)) {
json.put("auto_clean_task", jsonObject.getBoolean("extra_value"));
}
}
result.add(json);
}
return result;
}
@Override
public JSONArray selectDeviceListTwo() {
//设备基础信息表【acs_device】
// JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND region = '2'", "seq_num").getResultJSONArray(0);
List<Device> deviceList = new LambdaQueryChainWrapper<>(deviceMapper)
.apply("is_delete= '0' AND is_active= '1' AND region = '2'")
.orderByAsc(Device::getSeq_num)
.list();
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(deviceList));
//acs_device_extra
// WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra");
JSONArray result = new JSONArray();
for (int i = 0; i < arr.size(); i++) {
JSONObject obj = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("device_id", obj.getString("device_id"));
json.put("checked", false);
json.put("device_code", obj.getString("device_code"));
json.put("device_name", obj.getString("device_name"));
Device device = deviceAppService.findDeviceByCode(obj.getString("device_code"));
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial());
json.put("remark", standardOrdinarySiteDeviceDriver.getRemark());
}
// JSONArray extraArr = extraTab.query("device_id = '" + obj.getString("device_id") + "'").getResultJSONArray(0);
List<DeviceExtra> deviceExtraList = new LambdaQueryChainWrapper<>(deviceExtraMapper)
.eq(DeviceExtra::getDevice_id, obj.getString("device_id"))
.list();
JSONArray extraArr = JSONArray.parseArray(JSON.toJSONString(deviceExtraList));
for (int m = 0; m < extraArr.size(); m++) {
JSONObject jsonObject = extraArr.getJSONObject(m);
String extra_code = jsonObject.getString("extra_code");
//定点作业:自动创建任务
if ("auto_create_task".equals(extra_code)) {
json.put("auto_create_task", jsonObject.getBoolean("extra_value"));
}
//呼叫
if ("apply_task".equals(extra_code)) {
json.put("apply_task", jsonObject.getBoolean("extra_value"));
}
//响应
if ("manual_create_task".equals(extra_code)) {
json.put("manual_create_task", jsonObject.getBoolean("extra_value"));
}
//清除
if ("auto_clean_task".equals(extra_code)) {
json.put("auto_clean_task", jsonObject.getBoolean("extra_value"));
}
}
result.add(json);
}
return result;
}
@Override
public JSONArray selectDeviceListThree() {
//设备基础信息表【acs_device】
// JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND region = '3'", "seq_num").getResultJSONArray(0);
List<Device> deviceList = new LambdaQueryChainWrapper<>(deviceMapper)
.apply("is_delete= '0' AND is_active= '1' AND region = '3'")
.orderByAsc(Device::getSeq_num)
.list();
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(deviceList));
//acs_device_extra
// WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra");
JSONArray result = new JSONArray();
for (int i = 0; i < arr.size(); i++) {
JSONObject obj = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("device_id", obj.getString("device_id"));
json.put("device_code", obj.getString("device_code"));
json.put("checked", false);
json.put("device_name", obj.getString("device_name"));
Device device = deviceAppService.findDeviceByCode(obj.getString("device_code"));
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
json.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial());
json.put("remark", standardOrdinarySiteDeviceDriver.getRemark());
}
// JSONArray extraArr = extraTab.query("device_id = '" + obj.getString("device_id") + "'").getResultJSONArray(0);
List<DeviceExtra> deviceExtraList = new LambdaQueryChainWrapper<>(deviceExtraMapper)
.eq(DeviceExtra::getDevice_id, obj.getString("device_id"))
.list();
JSONArray extraArr = JSONArray.parseArray(JSON.toJSONString(deviceExtraList));
for (int m = 0; m < extraArr.size(); m++) {
JSONObject jsonObject = extraArr.getJSONObject(m);
String extra_code = jsonObject.getString("extra_code");
//定点作业:自动创建任务
if ("auto_create_task".equals(extra_code)) {
json.put("auto_create_task", jsonObject.getBoolean("extra_value"));
}
//呼叫
if ("apply_task".equals(extra_code)) {
json.put("apply_task", jsonObject.getBoolean("extra_value"));
}
//响应
if ("manual_create_task".equals(extra_code)) {
json.put("manual_create_task", jsonObject.getBoolean("extra_value"));
}
//清除
if ("auto_clean_task".equals(extra_code)) {
json.put("auto_clean_task", jsonObject.getBoolean("extra_value"));
}
}
result.add(json);
}
return result;
}
@Override @Override
public JSONArray selectDeviceDevicerInfo(String status) { public JSONArray selectDeviceDevicerInfo(String status) {
@@ -1196,18 +1023,6 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
} }
} }
@Override
public void changeFenceStatus(JSONObject form) {
String device_code = form.getString("device_code");
String suspended = form.getString("suspended");
if (StrUtil.isEmpty(suspended)) {
return;
}
Device device = deviceAppService.findDeviceByCode(device_code);
}
public String formatNum(int x) { public String formatNum(int x) {
if (x < 10) { if (x < 10) {
return "0" + x; return "0" + x;
@@ -1215,89 +1030,6 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
return String.valueOf(x); return String.valueOf(x);
} }
@Override
public void callAgv(JSONObject form) {
String device_code = form.getString("device_code");
//需要数量
String quantity = form.getString("quantity");
//物料类型
String material_type = form.getString("material_type");
String remark = form.getString("remark");
if (StrUtil.isEmpty(quantity) || StrUtil.isEmpty(material_type)) {
throw new BadRequestException(LangProcess.msg("error_checkNull", "quantity or material_type"));
}
Device device = deviceAppService.findDeviceByCode(device_code);
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (standardOrdinarySiteDeviceDriver.getBranchProtocol() == 2) {
throw new BadRequestException(LangProcess.msg("device_checkStatus"));
} else {
standardOrdinarySiteDeviceDriver.setBranchProtocol(2);
standardOrdinarySiteDeviceDriver.setQty(quantity);
standardOrdinarySiteDeviceDriver.setMaterial(material_type);
standardOrdinarySiteDeviceDriver.setRemark(remark);
}
}
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setBranchProtocol(2);
standardInspectSiteDeviceDriver.setQty(quantity);
standardInspectSiteDeviceDriver.setMaterial(material_type);
standardInspectSiteDeviceDriver.setRemark(remark);
}
}
@Override
public void addMaterial(JSONObject form) {
String device_code = form.getString("device_code");
//需要数量
String quantity = form.getString("quantity");
//物料类型
String material_type = form.getString("material_type");
String remark = form.getString("remark");
Device device = deviceAppService.findDeviceByCode(device_code);
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setQty(quantity);
standardOrdinarySiteDeviceDriver.setMaterial(material_type);
standardOrdinarySiteDeviceDriver.setRemark(remark);
device.setMaterial_type(material_type);
device.setQuantity(quantity);
device.setRemark(remark);
}
}
@Override
public void responseAgv(JSONObject form) {
//起始设备
String start_device_code = form.getString("start_device_code");
//下一设备
String next_device_code = form.getString("device_code");
//需要数量
String quantity = form.getString("qty");
//物料类型
String material_type = form.getString("material");
//备注信息
String remark = form.getString("remark");
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) startDevice.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setBranchProtocol(3);
standardOrdinarySiteDeviceDriver.setQty(quantity);
standardOrdinarySiteDeviceDriver.setMaterial(material_type);
standardOrdinarySiteDeviceDriver.setRemark(remark);
standardOrdinarySiteDeviceDriver.setPurpose(next_device_code);
}
}
@Override @Override
public void autoCreateTask(JSONObject form) { public void autoCreateTask(JSONObject form) {
//起始设备 //起始设备
@@ -1340,30 +1072,6 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
} }
} }
@Override
public void cleanMaterial(JSONObject json) {
String device_code = json.getString("device_code");
//需要数量
String quantity = json.getString("quantity");
//物料类型
String material_type = json.getString("material_type");
String remark = json.getString("remark");
Device device = deviceAppService.findDeviceByCode(device_code);
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setHasGoods(0);
standardOrdinarySiteDeviceDriver.setQty("");
standardOrdinarySiteDeviceDriver.setMaterial("");
standardOrdinarySiteDeviceDriver.setRemark("");
JSONObject jsonjo = new JSONObject();
jsonjo.put("device_code", device_code);
jsonjo.put("hasGoodStatus", "0");
changeDeviceStatus(jsonjo);
}
}
@Override @Override
public JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) { public JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) {
final JSONObject extraObj = new JSONObject(); final JSONObject extraObj = new JSONObject();

View File

@@ -242,11 +242,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
// 更新指令状态 // 更新指令状态
updateInstruct(); updateInstruct();
} catch (Exception var17) { } catch (Exception e) {
var17.printStackTrace(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + Arrays.toString(e.getStackTrace()));
feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
} }
if (mode == 0) { if (mode == 0) {

View File

@@ -33,8 +33,6 @@ public class DeviceExecuteLogServiceImpl implements DeviceExecuteLogService {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
MDC.remove("device_code_log"); MDC.remove("device_code_log");
System.out.println("successNum:" + OpcUtl.successNum);
System.out.println("errNum:" + OpcUtl.errNum);
} }
} }

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="ACSToLMS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/ACS请求LMS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!-- 打印sql -->
<logger name="org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl" level="info" additivity="true">
<appender-ref ref="ACSToLMS"/>
</logger>
</included>

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="LMSToACS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/LMS下发ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!-- 打印sql -->
<logger name="org.nl.acs.ext.wms.service.impl.WmsToAcsServiceImpl" level="info" additivity="true">
<appender-ref ref="LMSToACS"/>
</logger>
</included>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE10" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/一楼NDC系统/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>200MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!-- <logger name="org.nl.start.Init" level="info" additivity="true">
<appender-ref ref="FILE3"/>
</logger>-->
<!-- 打印sql -->
<logger name="org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun" level="info" additivity="true">
<appender-ref ref="FILE10"/>
</logger>
</included>

View File

@@ -21,9 +21,8 @@ https://juejin.cn/post/6844903775631572999
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="${logPath}"/> <property name="LOG_HOME" value="${logPath}"/>
<!--引入默认的一些设置--> <!--引入默认的一些设置-->
<!--<include resource="log/XrToMes.xml"/> <include resource="log/ACSToLMS.xml"/>
<include resource="log/MesToErp.xml"/>--> <include resource="log/LMSToACS.xml"/>
<include resource="log/XgAgvDeviceDriver.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--withJansi 参数改为true--> <!--withJansi 参数改为true-->
@@ -68,7 +67,7 @@ https://juejin.cn/post/6844903775631572999
<!--开发环境:打印控制台--> <!--开发环境:打印控制台-->
<springProfile name="dev"> <springProfile name="dev">
<root level="info"> <root level="debug">
<appender-ref ref="asyncLuceneAppender"/> <appender-ref ref="asyncLuceneAppender"/>
<appender-ref ref="CONSOLE"/> <appender-ref ref="CONSOLE"/>
</root> </root>