Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
# 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:
@@ -1,8 +1,8 @@
|
||||
ENV = 'development'
|
||||
|
||||
# 接口地址
|
||||
VUE_APP_BASE_API = 'http://localhost:8011'
|
||||
VUE_APP_WS_API = 'ws://localhost:8011'
|
||||
VUE_APP_BASE_API = 'http://localhost:8010'
|
||||
VUE_APP_WS_API = 'ws://localhost:8010'
|
||||
|
||||
# 是否启用 babel-plugin-dynamic-import-node插件
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
@@ -2,6 +2,6 @@ ENV = 'production'
|
||||
|
||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||
# 接口地址,注意协议,如果你没有配置 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
|
||||
VUE_APP_WS_API = 'ws://10.1.3.94:8011'
|
||||
VUE_APP_WS_API = 'ws://127.0.0.1:8010'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
window.g = {
|
||||
dev: {
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8015'
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8010'
|
||||
},
|
||||
prod: {
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8012'
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8010'
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,32 +2,23 @@ package org.nl.acs.device.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.dto.DeviceDto;
|
||||
import org.nl.acs.device.service.dto.DeviceQueryParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author jiaolm
|
||||
@@ -35,15 +26,12 @@ import java.util.Set;
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@RequestMapping("/api/device")
|
||||
public class DeviceController {
|
||||
|
||||
private final DeviceService deviceService;
|
||||
|
||||
|
||||
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备")
|
||||
|
||||
@@ -53,20 +41,17 @@ public class DeviceController {
|
||||
|
||||
@GetMapping("/protocol")
|
||||
@Log("查询设备协议")
|
||||
|
||||
public ResponseEntity<Object> protocol(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(deviceService.queryDeviceProtocol(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出设备协议")
|
||||
|
||||
@GetMapping(value = "/protocol/download")
|
||||
public void downDeviceDBload(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
deviceService.downDeviceDBload(deviceService.queryDeviceProtocol(whereJson), response);
|
||||
}
|
||||
|
||||
@Log("导出设备协议")
|
||||
|
||||
@GetMapping(value = "/protocol/downloadCSV")
|
||||
public void downDeviceDBloadCSV(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
deviceService.downDeviceDBloadCSV(deviceService.queryDeviceProtocol(whereJson), response);
|
||||
@@ -82,14 +67,12 @@ public class DeviceController {
|
||||
|
||||
@PutMapping
|
||||
@Log("修改设备")
|
||||
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody DeviceDto dto) {
|
||||
deviceService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除设备")
|
||||
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
|
||||
@@ -98,7 +81,6 @@ public class DeviceController {
|
||||
}
|
||||
|
||||
@Log("导出设备")
|
||||
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
deviceService.download(deviceService.queryAll(whereJson), response);
|
||||
@@ -106,39 +88,16 @@ public class DeviceController {
|
||||
|
||||
@GetMapping("/selectList")
|
||||
@Log("下拉选设备")
|
||||
|
||||
public ResponseEntity<Object> selectList() {
|
||||
return new ResponseEntity<>(deviceService.selectList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/region/{region}")
|
||||
@Log("根据区域查询设备")
|
||||
|
||||
public ResponseEntity<Object> selectList(@PathVariable String region) {
|
||||
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}")
|
||||
@Log("根据设备类型查询已配置设备")
|
||||
|
||||
@@ -153,52 +112,17 @@ public class DeviceController {
|
||||
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")
|
||||
@Log("改变设备状态")
|
||||
|
||||
public ResponseEntity<Object> changeDeviceStatus(@RequestBody JSONObject json) {
|
||||
deviceService.changeDeviceStatus(json);
|
||||
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")
|
||||
@Log("自动创建接任务")
|
||||
|
||||
public ResponseEntity<Object> autoCreateTask(@RequestBody JSONObject json) {
|
||||
deviceService.autoCreateTask(json);
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -210,17 +134,8 @@ public class DeviceController {
|
||||
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}")
|
||||
@Log("下拉选设备驱动")
|
||||
|
||||
public ResponseEntity<Object> selectDriverCodeList(@PathVariable String device_code) {
|
||||
DeviceDto device = deviceService.findByCode(device_code);
|
||||
JSONArray ja = deviceService.selectDriverCodeList(device_code);
|
||||
|
||||
@@ -201,27 +201,6 @@ public interface DeviceService extends CommonService<Device> {
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 改变电子围栏状态
|
||||
*
|
||||
* @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
|
||||
@@ -283,11 +234,6 @@ public interface DeviceService extends CommonService<Device> {
|
||||
*/
|
||||
void cleanTask(JSONObject json);
|
||||
|
||||
/**
|
||||
* 清理材料
|
||||
* @param json
|
||||
*/
|
||||
void cleanMaterial(JSONObject json);
|
||||
|
||||
/**
|
||||
* 根据设备标识查询设备驱动配置,如果未配置过,就从驱动配置定义找,否则从数据库里面找
|
||||
|
||||
@@ -565,179 +565,6 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
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
|
||||
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) {
|
||||
if (x < 10) {
|
||||
return "0" + x;
|
||||
@@ -1215,89 +1030,6 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
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
|
||||
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
|
||||
public JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) {
|
||||
final JSONObject extraObj = new JSONObject();
|
||||
|
||||
@@ -242,11 +242,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
// 更新指令状态
|
||||
updateInstruct();
|
||||
|
||||
} catch (Exception var17) {
|
||||
var17.printStackTrace();
|
||||
feedMessage = var17.getMessage();
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
|
||||
|
||||
} catch (Exception e) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + Arrays.toString(e.getStackTrace()));
|
||||
}
|
||||
|
||||
if (mode == 0) {
|
||||
|
||||
@@ -33,8 +33,6 @@ public class DeviceExecuteLogServiceImpl implements DeviceExecuteLogService {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
MDC.remove("device_code_log");
|
||||
System.out.println("successNum:" + OpcUtl.successNum);
|
||||
System.out.println("errNum:" + OpcUtl.errNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -21,9 +21,8 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!--引入默认的一些设置-->
|
||||
<!--<include resource="log/XrToMes.xml"/>
|
||||
<include resource="log/MesToErp.xml"/>-->
|
||||
<include resource="log/XgAgvDeviceDriver.xml"/>
|
||||
<include resource="log/ACSToLMS.xml"/>
|
||||
<include resource="log/LMSToACS.xml"/>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!--withJansi 参数改为true-->
|
||||
@@ -68,7 +67,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--开发环境:打印控制台-->
|
||||
<springProfile name="dev">
|
||||
<root level="info">
|
||||
<root level="debug">
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
|
||||
Reference in New Issue
Block a user