项目更新

This commit is contained in:
loujf
2022-12-01 14:35:12 +08:00
parent eb13688871
commit 0d58335c3f
35 changed files with 9515 additions and 600 deletions

View File

@@ -9,7 +9,6 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.standard_autodoor.StandardAutodoorDeviceDriver;
@@ -22,6 +21,7 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.opc.DeviceType;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.slf4j.MDC;
import org.springframework.stereotype.Service;
@@ -36,7 +36,7 @@ import java.util.Map;
public class NDCAgvServiceImpl implements NDCAgvService {
private final DeviceAppService deviceAppService;
private final AcsConfigService acsConfigService;
private final ParamService acsConfigService;
private final AcsToWmsService acsToWmsService;
private final DeviceExecuteLogService logServer;
@@ -50,7 +50,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
public void deleteAgvInstToNDC(Instruction inst) throws Exception {
try {
MDC.put(log_file_type, log_type);
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
int index = Integer.parseInt(inst.getAgv_jobno());
byte indexhigh = (byte) IntToHexHigh(index);
@@ -127,7 +127,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
public void sendAgvInstToNDC(Instruction inst) {
try {
MDC.put(log_file_type, log_type);
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
String instcode = inst.getInstruction_code();
int type = Integer.parseInt(inst.getInstruction_type());
int priority = Integer.parseInt(inst.getPriority()) + 128;
@@ -243,7 +243,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
byte resulthigh = (byte) IntToHexHigh(result);
byte resultlow = (byte) IntToHexLow(result);
int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE));
int type = Integer.parseInt(acsConfigService.findByCode(AcsConfig.BUSINESSTYPE).getValue());
byte[] b = new byte[]{};
switch (type) {
case 0:
@@ -324,10 +324,10 @@ public class NDCAgvServiceImpl implements NDCAgvService {
try {
MDC.put(log_file_type, log_type);
log.info("AGV查询自动门状态,参数:{}", device);
int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE));
int type = Integer.parseInt(acsConfigService.findByCode(AcsConfig.BUSINESSTYPE).getValue());
switch (type) {
case 4:
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.HASOTHERSYSTEM).toString(), "1")) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.HASOTHERSYSTEM).getValue(), "1")) {
String result = acsToWmsService.queryDoorsStatus().body();
JSONArray ja = JSONArray.parseArray(result);
log.info("AGV查询自动门状态,反馈:{}", ja.toString());

View File

@@ -1,93 +1,93 @@
package org.nl.acs.config.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.config.dto.AcsConfigDto;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.modules.logging.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-01-14
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "系统参数管理")
@RequestMapping("/api/param")
@Slf4j
public class AcsConfigController {
private final AcsConfigService acsConfigService;
@GetMapping
@Log("查询系统参数")
@ApiOperation("查询系统参数")
//@PreAuthorize("@el.check('param:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(acsConfigService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增系统参数")
@ApiOperation("新增系统参数")
//@PreAuthorize("@el.check('param:add')")
public ResponseEntity<Object> create(@Validated @RequestBody AcsConfigDto dto) {
acsConfigService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改系统参数")
@ApiOperation("修改系统参数")
//@PreAuthorize("@el.check('param:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody AcsConfigDto dto) {
acsConfigService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除系统参数")
@ApiOperation("删除系统参数")
//@PreAuthorize("@el.check('param:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
acsConfigService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("导出系统参数")
@ApiOperation("导出系统参数")
@GetMapping(value = "/download")
//@PreAuthorize("@el.check('param:list')")
public void download(HttpServletResponse response, Map whereJson) throws IOException {
acsConfigService.download(acsConfigService.queryAll(whereJson), response);
}
@Log("缓存查询系统参数")
@ApiOperation("缓存查询系统参数")
@PostMapping(value = "/findByCodeFromCache")
public ResponseEntity<Object> findConfigFromCache() {
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);
}
}
//
//package org.nl.acs.config.rest;
//
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.nl.acs.config.dto.AcsConfigDto;
//import org.nl.acs.config.server.AcsConfigService;
//import org.nl.modules.logging.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-01-14
// **/
//@RestController
//@RequiredArgsConstructor
//@Api(tags = "系统参数管理")
//@RequestMapping("/api/param")
//@Slf4j
//public class AcsConfigController {
//
// private final AcsConfigService acsConfigService;
//
// @GetMapping
// @Log("查询系统参数")
// @ApiOperation("查询系统参数")
// //@PreAuthorize("@el.check('param:list')")
// public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
// return new ResponseEntity<>(acsConfigService.queryAll(whereJson, page), HttpStatus.OK);
// }
//
// @PostMapping
// @Log("新增系统参数")
// @ApiOperation("新增系统参数")
// //@PreAuthorize("@el.check('param:add')")
// public ResponseEntity<Object> create(@Validated @RequestBody AcsConfigDto dto) {
// acsConfigService.create(dto);
// return new ResponseEntity<>(HttpStatus.CREATED);
// }
//
// @PutMapping
// @Log("修改系统参数")
// @ApiOperation("修改系统参数")
// //@PreAuthorize("@el.check('param:edit')")
// public ResponseEntity<Object> update(@Validated @RequestBody AcsConfigDto dto) {
// acsConfigService.update(dto);
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
// }
//
// @Log("删除系统参数")
// @ApiOperation("删除系统参数")
// //@PreAuthorize("@el.check('param:del')")
// @DeleteMapping
// public ResponseEntity<Object> delete(@RequestBody String[] ids) {
// acsConfigService.deleteAll(ids);
// return new ResponseEntity<>(HttpStatus.OK);
// }
//
// @Log("导出系统参数")
// @ApiOperation("导出系统参数")
// @GetMapping(value = "/download")
// //@PreAuthorize("@el.check('param:list')")
// public void download(HttpServletResponse response, Map whereJson) throws IOException {
// acsConfigService.download(acsConfigService.queryAll(whereJson), response);
// }
//
// @Log("缓存查询系统参数")
// @ApiOperation("缓存查询系统参数")
// @PostMapping(value = "/findByCodeFromCache")
// public ResponseEntity<Object> findConfigFromCache() {
// 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

@@ -1,86 +1,86 @@
package org.nl.acs.config.server;
import org.nl.acs.config.dto.AcsConfigDto;
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-03-16
**/
public interface AcsConfigService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<AcsConfigDto>
*/
List<AcsConfigDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param id ID
* @return Param
*/
AcsConfigDto findById(String id);
/**
* 根据编码查询
*
* @param code code
* @return Param
*/
AcsConfigDto findByCode(String code);
/**
* 创建
*
* @param dto /
*/
void create(AcsConfigDto dto);
/**
* 编辑
*
* @param dto /
*/
void update(AcsConfigDto dto);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(String[] ids);
/**
* 导出数据
*
* @param dtos 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<AcsConfigDto> dtos, HttpServletResponse response) throws IOException;
void load();
Map<String, String> findConfigFromCache();
}
//
//package org.nl.acs.config.server;
//
//import org.nl.acs.config.dto.AcsConfigDto;
//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-03-16
// **/
//public interface AcsConfigService {
//
// /**
// * 查询数据分页
// *
// * @param whereJson 条件
// * @param page 分页参数
// * @return Map<String, Object>
// */
// Map<String, Object> queryAll(Map whereJson, Pageable page);
//
// /**
// * 查询所有数据不分页
// *
// * @param whereJson 条件参数
// * @return List<AcsConfigDto>
// */
// List<AcsConfigDto> queryAll(Map whereJson);
//
// /**
// * 根据ID查询
// *
// * @param id ID
// * @return Param
// */
// AcsConfigDto findById(String id);
//
// /**
// * 根据编码查询
// *
// * @param code code
// * @return Param
// */
// AcsConfigDto findByCode(String code);
//
//
// /**
// * 创建
// *
// * @param dto /
// */
// void create(AcsConfigDto dto);
//
// /**
// * 编辑
// *
// * @param dto /
// */
// void update(AcsConfigDto dto);
//
// /**
// * 多选删除
// *
// * @param ids /
// */
// void deleteAll(String[] ids);
//
// /**
// * 导出数据
// *
// * @param dtos 待导出的数据
// * @param response /
// * @throws IOException /
// */
// void download(List<AcsConfigDto> dtos, HttpServletResponse response) throws IOException;
//
// void load();
//
// Map<String, String> findConfigFromCache();
//}

View File

@@ -1,162 +1,162 @@
package org.nl.acs.config.server.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.config.dto.AcsConfigDto;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.wql.core.bean.ResultBean;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.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.*;
/**
* @author ldjun
* @description 服务实现
* @date 2021-03-16
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class AcsConfigServiceImpl implements AcsConfigService, ApplicationAutoInitial {
Map<String, String> acsconfigs = new HashMap<>();
@Override
public void load() {
Map map = new HashMap();
List<AcsConfigDto> listacsconfigs = this.queryAll(map);
Iterator item = listacsconfigs.iterator();
while (item.hasNext()) {
AcsConfigDto dto = (AcsConfigDto) item.next();
acsconfigs.put(dto.getCode(), dto.getValue());
}
}
@Override
public void autoInitial() throws Exception {
this.load();
}
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
WQLObject wo = WQLObject.getWQLObject("sys_param");
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "update_time desc");
final JSONObject json = rb.pageResult();
return json;
}
@Override
public List<AcsConfigDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONArray arr = wo.query().getResultJSONArray(0);
List<AcsConfigDto> list =arr.toJavaList(AcsConfigDto.class);
return list;
}
@Override
public AcsConfigDto findById(String id) {
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject json = wo.query("id ='" + id + "'").uniqueResult(0);
final AcsConfigDto obj = json.toJavaObject(AcsConfigDto.class);
return obj;
}
@Override
public AcsConfigDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
final AcsConfigDto obj = json.toJavaObject(AcsConfigDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(AcsConfigDto dto) {
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
dto.setId(IdUtil.simpleUUID());
dto.setCreate_by(currentUsername);
dto.setUpdate_by(currentUsername);
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
this.load();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(AcsConfigDto dto) {
AcsConfigDto entity = this.findById(dto.getId());
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("sys_param");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.update(json);
this.load();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(String[] ids) {
WQLObject wo = WQLObject.getWQLObject("sys_param");
for (String id : ids) {
wo.delete("id = '" + id + "'");
}
this.load();
}
@Override
public void download(List<AcsConfigDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (AcsConfigDto param : all) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("编码", param.getCode());
map.put("名称", param.getName());
map.put("", param.getValue());
map.put("备注", param.getRemark());
map.put("是否启用", param.getIs_active());
map.put("是否删除", param.getIs_delete());
map.put("创建者", param.getCreate_by());
map.put("创建时间", param.getCreate_time());
map.put("修改者", param.getUpdate_by());
map.put("修改时间", param.getUpdate_time());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Map<String, String> findConfigFromCache() {
Map<String, String> demo = (Map) ObjectUtil.clone(this.acsconfigs);
return demo;
}
}
//
//package org.nl.acs.config.server.impl;
//
//
//import cn.hutool.core.date.DateUtil;
//import cn.hutool.core.util.IdUtil;
//import cn.hutool.core.util.ObjectUtil;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.nl.acs.auto.initial.ApplicationAutoInitial;
//import org.nl.acs.config.dto.AcsConfigDto;
//import org.nl.acs.config.server.AcsConfigService;
//import org.nl.modules.common.exception.BadRequestException;
//import org.nl.modules.common.utils.FileUtil;
//import org.nl.modules.common.utils.SecurityUtils;
//import org.nl.modules.wql.core.bean.ResultBean;
//import org.nl.modules.wql.core.bean.WQLObject;
//import org.nl.modules.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.*;
//
///**
// * @author ldjun
// * @description 服务实现
// * @date 2021-03-16
// **/
//@Service
//@RequiredArgsConstructor
//@Slf4j
//public class AcsConfigServiceImpl implements AcsConfigService, ApplicationAutoInitial {
//
// Map<String, String> acsconfigs = new HashMap<>();
//
// @Override
// public void load() {
// Map map = new HashMap();
// List<AcsConfigDto> listacsconfigs = this.queryAll(map);
// Iterator item = listacsconfigs.iterator();
// while (item.hasNext()) {
// AcsConfigDto dto = (AcsConfigDto) item.next();
// acsconfigs.put(dto.getCode(), dto.getValue());
// }
//
// }
//
// @Override
// public void autoInitial() throws Exception {
// this.load();
// }
//
// @Override
// public Map<String, Object> queryAll(Map whereJson, Pageable page) {
// WQLObject wo = WQLObject.getWQLObject("sys_param");
// ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "update_time desc");
// final JSONObject json = rb.pageResult();
// return json;
// }
//
// @Override
// public List<AcsConfigDto> queryAll(Map whereJson) {
// WQLObject wo = WQLObject.getWQLObject("sys_param");
// JSONArray arr = wo.query().getResultJSONArray(0);
// List<AcsConfigDto> list =arr.toJavaList(AcsConfigDto.class);
// return list;
// }
//
// @Override
// public AcsConfigDto findById(String id) {
// WQLObject wo = WQLObject.getWQLObject("sys_param");
// JSONObject json = wo.query("id ='" + id + "'").uniqueResult(0);
// final AcsConfigDto obj = json.toJavaObject(AcsConfigDto.class);
// return obj;
// }
//
// @Override
// public AcsConfigDto findByCode(String code) {
// WQLObject wo = WQLObject.getWQLObject("sys_param");
// JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
// final AcsConfigDto obj = json.toJavaObject(AcsConfigDto.class);
// return obj;
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void create(AcsConfigDto dto) {
// String currentUsername = SecurityUtils.getCurrentUsername();
// String now = DateUtil.now();
//
// dto.setId(IdUtil.simpleUUID());
// dto.setCreate_by(currentUsername);
// dto.setUpdate_by(currentUsername);
// dto.setUpdate_time(now);
// dto.setCreate_time(now);
//
// WQLObject wo = WQLObject.getWQLObject("sys_param");
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
//
// wo.insert(json);
// this.load();
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void update(AcsConfigDto dto) {
// AcsConfigDto entity = this.findById(dto.getId());
// 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("sys_param");
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
// wo.update(json);
// this.load();
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void deleteAll(String[] ids) {
// WQLObject wo = WQLObject.getWQLObject("sys_param");
// for (String id : ids) {
// wo.delete("id = '" + id + "'");
// }
// this.load();
// }
//
// @Override
// public void download(List<AcsConfigDto> all, HttpServletResponse response) throws IOException {
// List<Map<String, Object>> list = new ArrayList<>();
// for (AcsConfigDto param : all) {
// Map<String, Object> map = new LinkedHashMap<>();
// map.put("编码", param.getCode());
// map.put("名称", param.getName());
// map.put("值", param.getValue());
// map.put("备注", param.getRemark());
// map.put("是否启用", param.getIs_active());
// map.put("是否删除", param.getIs_delete());
// map.put("创建者", param.getCreate_by());
// map.put("创建时间", param.getCreate_time());
// map.put("修改者", param.getUpdate_by());
// map.put("修改时间", param.getUpdate_time());
// list.add(map);
// }
// FileUtil.downloadExcel(list, response);
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public Map<String, String> findConfigFromCache() {
// Map<String, String> demo = (Map) ObjectUtil.clone(this.acsconfigs);
// return demo;
// }
//}

View File

@@ -9,8 +9,6 @@ import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.config.server.impl.AcsConfigServiceImpl;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
@@ -28,6 +26,8 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
@@ -52,7 +52,7 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
@Autowired
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
@Autowired
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigServiceImpl.class);
ParamService acsConfigService = SpringContextHolder.getBean(ParamServiceImpl.class);
@Autowired
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
@Autowired
@@ -175,7 +175,7 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
log.debug("设备运转模式:等待工作");
return;
case 2:
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS), "1")) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
if (number == max_emptypalletnum && !requireSucess && move > 0) {
apply_InEmpty();
}

View File

@@ -10,7 +10,6 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.address.service.AddressService;
import org.nl.acs.device.address.service.dto.AddressDto;
import org.nl.acs.device.service.DeviceService;
@@ -20,6 +19,7 @@ import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.util.DateUtil;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.core.bean.WQLObject;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,7 +35,7 @@ import java.util.Map;
public class AcsToWmsServiceImpl implements AcsToWmsService {
@Autowired
AcsConfigService acsConfigService;
ParamService acsConfigService;
@Autowired
DeviceService deviceService;
@@ -59,7 +59,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public String applyTaskToWms(String device_code, String container_code, int height, int weight) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyTaskToWms");
String url = wmsurl + addressDto.getMethods_url();
@@ -108,7 +108,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse applyTaskManipulatorToWms(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyTaskManipulatorToWms");
String url = wmsurl + addressDto.getMethods_url();
@@ -148,7 +148,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse applyOuttoKiln(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("ispackage");
String url = wmsurl + addressDto.getMethods_url();
@@ -189,7 +189,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse applyIntoKiln(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyIntoKiln");
String url = wmsurl + addressDto.getMethods_url();
@@ -232,7 +232,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse applyBarcode(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("getVehicleInfoBycode");
String url = wmsurl + addressDto.getMethods_url();
@@ -273,7 +273,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse lnshApplyTaskToWms(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("lnshApplyTaskToWms");
String url = wmsurl + addressDto.getMethods_url();
@@ -314,7 +314,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public JSONObject getVehicle(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("getVehicle");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
@@ -348,7 +348,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public JSONObject getVehicleTokiln(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("getVehicleTokiln");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
@@ -377,7 +377,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse inKiln(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("inKiln");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
@@ -406,7 +406,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse outKiln(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("outKiln");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
@@ -435,7 +435,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse enterOrder(JSONObject json) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("enterOrder");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
@@ -468,7 +468,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} finally {
MDC.remove(log_file_type);
}
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("getVehicleCode");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
@@ -503,7 +503,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} finally {
MDC.remove(log_file_type);
}
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("getVehiclePoint");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
@@ -535,7 +535,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} finally {
MDC.remove(log_file_type);
}
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
String task_code = "";
for (int i = 0; i < data.size(); i++) {
@@ -580,7 +580,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.put(log_file_type, log_type);
AddressDto addressDto = addressService.findByCode("feedbackPointStatusToWms");
String methods_url = addressDto.getMethods_url();
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
String url = wmsurl + methods_url;
JSONObject json = new JSONObject();
@@ -617,7 +617,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public JSONArray getDeviceStatusToWms() {
try {
MDC.put(log_file_type,log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("getDeviceStatusToWms");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
@@ -642,7 +642,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse requestSignalInteraction(String device_code, String vehicle_code, String action) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
JSONObject json = new JSONObject();
json.put("device_code", device_code);
json.put("vehicle_code", vehicle_code);
@@ -677,7 +677,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public String requestTaskAgain(String address, String task_id, String vehicle_code) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
String device_code = deviceService.queryDeviceCodeByAddress(Integer.parseInt(address));
JSONObject jo = new JSONObject();
jo.put("device_code", device_code);
@@ -716,7 +716,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
log.info("apply_InEmpty----空盘入库申请校验失败,{}{}", device_code, "设备条码为空");
throw new BadRequestException("地址对应设备未找到");
}
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
JSONObject jo = new JSONObject();
jo.put("device_code", device_code);
jo.put("type", type);
@@ -753,7 +753,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public String apply_OutEmpty(String device_code) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
JSONObject jo = new JSONObject();
jo.put("device_code", device_code);
String result2 = "";
@@ -785,7 +785,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse feedbackAgvStatus(String device_code, String error, String error_message) {
try {
MDC.put(log_file_type, log_type);
String wmsUrl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsUrl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
JSONObject json = new JSONObject();
json.put("device_code", device_code);
@@ -820,7 +820,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse feedbackDeviceStatus(String device_code, String code, String value) {
try {
MDC.put(log_file_type, log_type);
String wmsUrl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsUrl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
JSONObject json = new JSONObject();
json.put("device_code", device_code);
@@ -859,7 +859,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse feedbackAgv(JSONArray from) {
try {
MDC.put(log_file_type, log_type);
String wmsUrl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsUrl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("feedbackAgv");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
@@ -888,7 +888,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse applyOpenOrCloseDoor(String device_code, String status) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
JSONObject jo = new JSONObject();
jo.put("device_code", device_code);
jo.put("status", status);
@@ -919,7 +919,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse queryDoorsStatus() {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
HttpResponse result = null;
log.info("queryDoorStatus-----请求");
@@ -944,7 +944,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public HttpResponse feedbackActionStatusToWms(JSONArray data) {
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
String task_code = "";
for (int i = 0; i < data.size(); i++) {
@@ -998,7 +998,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse reverseGroup(JSONObject param) {
try {
MDC.put(log_file_type, log_type);
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
HttpResponse result = null;
log.info("queryDoorStatus-----请求");

View File

@@ -7,7 +7,6 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver;
@@ -35,6 +34,8 @@ import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.exception.WDKException;
import org.nl.modules.wql.util.SpringContextHolder;
@@ -212,7 +213,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
try {
MDC.put(log_file_type, log_type);
JSONArray tasks = JSONArray.parseArray(param);
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class);
ParamService acsConfigService = SpringContextHolder.getBean(ParamServiceImpl.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
log.debug(tasks.toString());
log.info("cancelFromWms--------------:输入参数" + tasks.toString());
@@ -229,7 +230,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
if (StrUtil.isEmpty(task_code)) {
throw new WDKException("任务号不能为空");
}
String cancelTaskCheck = acsConfigService.findConfigFromCache().get(AcsConfig.CANCELTASKCHECK);
String cancelTaskCheck = acsConfigService.findByCode(AcsConfig.CANCELTASKCHECK).getValue();
if (StrUtil.equals(cancelTaskCheck, "1")) {
TaskService.cancel(task_uuid);
} else if (StrUtil.equals(cancelTaskCheck, "0")) {

View File

@@ -17,7 +17,6 @@ import org.nl.acs.agv.server.impl.NDCAgvServiceImpl;
import org.nl.acs.agv.server.impl.XianGongAgvServiceImpl;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
@@ -36,6 +35,7 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -65,7 +65,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
private final DeviceAppService deviceAppService;
private final AcsConfigService acsConfigService;
private final ParamService acsConfigService;
private final RouteLineService routeLineService;
private final TaskService taskService;
@@ -298,7 +298,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
try {
// != 0 为agv任务
if (!StrUtil.equals(type, "0")) {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "1")) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.AGVTYPE).getValue(), "1")) {
MagicAgvServiceImpl magicAgvService = SpringContextHolder.getBean(MagicAgvServiceImpl.class);
HttpResponse result = magicAgvService.sendAgvInstToMagic(dto);
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
@@ -306,12 +306,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} else {
dto.setSend_status("1");
}
} else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "2")) {
} else if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
NDCAgvServiceImpl ndcAgvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
ndcAgvService.sendAgvInstToNDC(dto);
dto.setSend_status("1");
} else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "3")) {
} else if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
if (StrUtil.equals(task.getRequest_again_success(), "1")) {
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
//追加订单
@@ -735,13 +735,13 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
String type = shortPathsList.get(0).getType();
// != 0 为agv任务 1=magic 2=NDC 3=XZ
if (!StrUtil.equals(type, "0")) {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "1")
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.AGVTYPE).getValue(), "1")
&& !StrUtil.equals(entity.getSend_status(), "2")) {
MagicAgvServiceImpl magicAgvService = SpringContextHolder.getBean(MagicAgvServiceImpl.class);
magicAgvService.deleteAgvInst(entity.getInstruction_code());
flag = true;
} else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "2")) {
} else if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
//NDC agv指令不当场取消指令,需要等agv上报
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
NDCAgvServiceImpl ndcAgv = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
@@ -749,7 +749,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} else {
flag = true;
}
} else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "3")
} else if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")
&& !StrUtil.equals(entity.getSend_status(), "2")) {
XianGongAgvServiceImpl xianGongAgvService = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());

View File

@@ -5,13 +5,13 @@ package org.nl.acs.order.service.impl;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
@@ -45,7 +45,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
AcsToWmsService acsToWmsService;
@Autowired
AcsConfigService acsConfigService;
ParamService acsConfigService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
@@ -170,7 +170,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
this.update(dto);
//判断是否为wms下发的排产单
String hasWms = acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS);
String hasWms = acsConfigService.findByCode(AcsConfig.HASWMS).getValue();
if (StrUtil.isNotEmpty(dto.getProduct_code()) && hasWms.equals("1")) {
JSONObject json = new JSONObject();
json.put("producetask_code",dto.getOrder_code());

View File

@@ -15,7 +15,6 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.impl.XianGongAgvServiceImpl;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.service.DeviceAssignedService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.StorageCellService;
@@ -39,6 +38,8 @@ import org.nl.acs.task.service.dto.TaskFeedbackDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -77,7 +78,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Autowired
private TaskFeedbackService taskFeedbackService;
private final AcsConfigService acsConfigService;
private final ParamService acsConfigService;
private final RouteLineService routeLineService;
@@ -326,7 +327,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (routelineserver.getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code).size() == 0) {
throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!");
}
String createTaskCheck = acsConfigService.findConfigFromCache().get(AcsConfig.CREATETASKCHECK);
String createTaskCheck = acsConfigService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device nextdevice = appService.findDeviceByCode(next_device_code);
@@ -483,7 +484,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
tasks.add(dto);
}
//判断是否为WMS下发的任务如果是反馈任务状态给WMS
String hasWms = acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS);
String hasWms = acsConfigService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
JSONObject feed_jo = new JSONObject();
@@ -599,7 +600,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
wo.update(json);
removeByCodeFromCache(entity.getTask_code());
//判断是否为WMS下发的任务如果是反馈任务状态给WMS
String hasWms = acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS);
String hasWms = acsConfigService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
JSONObject feed_jo = new JSONObject();
@@ -694,7 +695,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
}
//如果属于先知AGV关闭运单序列
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "3")) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
try {
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
xianGongAgv.markComplete(entity.getTask_code());
@@ -728,7 +729,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
}
}
//判断是否为WMS下发的任务如果是反馈任务状态给WMS
String hasWms = acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS);
String hasWms = acsConfigService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
JSONObject feed_jo = new JSONObject();
feed_jo.put("ext_task_uuid", entity.getExt_task_uuid());
@@ -742,7 +743,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String type = shortPathsList.get(0).getType();
// != 0 为agv任务
if (!StrUtil.equals(type, "0")) {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "3")) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
xianGongAgv.markComplete(entity.getTask_code());
}
@@ -754,7 +755,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
public void createInst(String ids) throws Exception {
TaskDto acsTask = this.findById(ids);
if (acsTask == null) throw new BadRequestException("被删除或无权限,操作失败!");
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class);
ParamService acsConfigService = SpringContextHolder.getBean(ParamServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 ");
@@ -772,7 +773,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String compound_task = acsTask.getCompound_task();
String next_point_code = acsTask.getNext_point_code();
String next_device_code = acsTask.getNext_device_code();
String maxInstnumber = acsConfigService.findConfigFromCache().get(AcsConfig.MAXINSTNUMBER);
String maxInstnumber = acsConfigService.findByCode(AcsConfig.MAXINSTNUMBER).getValue();
/**
* 开始平均分解校验

View File

@@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver;
@@ -21,6 +20,7 @@ import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.stereotype.Component;
@@ -41,7 +41,7 @@ public class AutoCreateInst {
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigService.class);
ParamService acsConfigService = SpringContextHolder.getBean(ParamService.class);
List<TaskDto> list = taskserver.queryByStauts("0");
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
for (int i = 0; i < list.size(); i++) {
@@ -72,7 +72,7 @@ public class AutoCreateInst {
continue;
}
List<Instruction> instructions = instructionService.queryAll("instruction_status < 2");
String maxInstnumber = acsConfigService.findConfigFromCache().get(AcsConfig.MAXINSTNUMBER);
String maxInstnumber = acsConfigService.findByCode(AcsConfig.MAXINSTNUMBER).getValue();
if (ObjectUtils.isNotEmpty(maxInstnumber)) {
if (instructions.size() >= Integer.parseInt(maxInstnumber)) {
log.info("系统参数配置最大指令数为:" + maxInstnumber + "无法生成指令");
@@ -150,7 +150,7 @@ public class AutoCreateInst {
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
LnshFoldDiscSiteDeviceDriver lnshFoldDiscSiteDeviceDriver;
String createTaskCheck = acsConfigService.findConfigFromCache().get(AcsConfig.CREATETASKCHECK);
String createTaskCheck = acsConfigService.findByCode(AcsConfig.CREATETASKCHECK).getValue();
if (StrUtil.equals(createTaskCheck, "1")) {
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {

View File

@@ -59,7 +59,7 @@ public class ParamServiceImpl implements ParamService {
public ParamDto findById(String id) {
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject json = wo.query("id ='" + id + "'").uniqueResult(0);
final ParamDto obj = json.toJavaObject(ParamDto.class);;
final ParamDto obj = json.toJavaObject(ParamDto.class);
return obj;
}
@@ -67,7 +67,7 @@ public class ParamServiceImpl implements ParamService {
public ParamDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
final ParamDto obj = json.toJavaObject(ParamDto.class);;
final ParamDto obj = json.toJavaObject(ParamDto.class);
return obj;
}

View File

@@ -8,8 +8,6 @@ import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.auto.run.AbstractAutoRunnable;
import org.nl.acs.auto.run.AutoRunService;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.config.server.impl.AcsConfigServiceImpl;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
@@ -30,6 +28,8 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.log.service.impl.DeviceExecuteLogServiceImpl;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -61,7 +61,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
boolean isReConnect = false;
@Autowired
AcsConfigService acsConfigService;
ParamService acsConfigService;
@Autowired
AutoRunService autoRunService;
@@ -81,15 +81,15 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
public void autoRun() {
try {
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigServiceImpl.class);
ParamService acsConfigService = SpringContextHolder.getBean(ParamServiceImpl.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
NDCAgvService AgvService = SpringContextHolder.getBean(NDCAgvService.class);
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogServiceImpl.class);
ip = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
port = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT));
ip = acsConfigService.findByCode(AcsConfig.AGVURL).getValue();
port = Integer.parseInt(acsConfigService.findByCode(AcsConfig.AGVPORT).getValue());
byte[] b = new byte[1028];
s = new Socket(ip, port);
dos = new DataOutputStream(s.getOutputStream());
@@ -163,7 +163,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver;
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE));
int type = Integer.parseInt(acsConfigService.findByCode(AcsConfig.BUSINESSTYPE).getValue());
try {
if (phase == 0x01) {
@@ -233,7 +233,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//普通站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.IGNOREHASGOODS), "1")) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.IGNOREHASGOODS).getValue(), "1")) {
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);

View File

@@ -6,10 +6,10 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lnsh_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lnsh_acs2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:yongyu_acs2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
password: ${DB_PWD:123456}
password: ${DB_PWD:Root.123456}
# password: ${DB_PWD:Root.123456}
# 初始连接数
initial-size: 5

View File

@@ -84,7 +84,7 @@ https://juejin.cn/post/6844903775631572999
<!--开发环境:打印控制台-->
<springProfile name="dev">
<root level="info">
<root level="off">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="lokiAppender" />
</root>