fix: divece
This commit is contained in:
@@ -12,6 +12,11 @@ import org.springframework.stereotype.Component;
|
||||
public class CommonFinalParam {
|
||||
|
||||
private final String DELETE = "0";
|
||||
/**
|
||||
* 分隔符
|
||||
*/
|
||||
private final String BARRE = "-";
|
||||
private final String POINT = ".";
|
||||
/**
|
||||
* 开门
|
||||
*/
|
||||
|
||||
@@ -1,21 +1,32 @@
|
||||
package org.nl.acs.device.device_driver;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.acs.device.service.dto.DeviceExtraDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class DeviceDriverConfigDto {
|
||||
//设备驱动类型
|
||||
/**
|
||||
* 设备驱动类型
|
||||
*/
|
||||
private String type;
|
||||
//设备标识
|
||||
/**
|
||||
* 设备标识
|
||||
*/
|
||||
private String device_id;
|
||||
//设备编码
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String device_code;
|
||||
//扩展属性
|
||||
/**
|
||||
* 扩展属性
|
||||
*/
|
||||
private List<DeviceExtraDto> exaList;
|
||||
|
||||
//设备读db块列表
|
||||
/**
|
||||
* 设备读db块列表
|
||||
*/
|
||||
private List<Map> dbReadList;
|
||||
private List<Map> dbWriteList;
|
||||
}
|
||||
|
||||
@@ -43,18 +43,27 @@ public enum DriverTypeEnum {
|
||||
DOUBLE_STATION_STACKER(16, "double_station_stacker", "标准版-双工位堆垛机", "double_station_stacker");
|
||||
|
||||
|
||||
//驱动索引
|
||||
/**
|
||||
* 驱动索引
|
||||
*/
|
||||
private int index;
|
||||
//驱动编码
|
||||
/**
|
||||
* 驱动编码
|
||||
*/
|
||||
private String code;
|
||||
// 驱动名字
|
||||
/**
|
||||
* 驱动名字
|
||||
*/
|
||||
private String name;
|
||||
//驱动描述
|
||||
/**
|
||||
* 驱动描述
|
||||
*/
|
||||
private String desc;
|
||||
//设备驱动类型
|
||||
/**
|
||||
* 设备驱动类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
// 构造方法
|
||||
DriverTypeEnum(int index, String code, String name, String type) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
|
||||
@@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
//RD3.RD3.225.to_command
|
||||
@Slf4j
|
||||
public class ItemProtocol {
|
||||
public static String item_heartbeat = "heartbeat";
|
||||
|
||||
@@ -41,17 +41,9 @@ public class DeviceController {
|
||||
|
||||
private final DeviceService deviceService;
|
||||
|
||||
@Autowired
|
||||
private DeviceMappers deviceMappers;
|
||||
|
||||
/*
|
||||
@Log("导出设备服务")
|
||||
@ApiOperation("导出设备服务")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('device:list')")
|
||||
public void download(HttpServletResponse response, DeviceQueryParam query) throws IOException {
|
||||
deviceService.download(deviceService.queryAll(query), response);
|
||||
}*/
|
||||
|
||||
|
||||
@GetMapping
|
||||
@Log("查询设备")
|
||||
@ApiOperation("查询设备")
|
||||
|
||||
@@ -31,7 +31,6 @@ public class DeviceErpmappingController {
|
||||
@GetMapping
|
||||
@Log("查询设备-ERP映射")
|
||||
@ApiOperation("查询设备-ERP映射")
|
||||
//@PreAuthorize("@el.check('acsDeviceErpmapping:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(acsDeviceErpmappingService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
@@ -39,7 +38,6 @@ public class DeviceErpmappingController {
|
||||
@PostMapping
|
||||
@Log("新增设备-ERP映射")
|
||||
@ApiOperation("新增设备-ERP映射")
|
||||
//@PreAuthorize("@el.check('acsDeviceErpmapping:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody AcsDeviceErpmappingDto dto) {
|
||||
acsDeviceErpmappingService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -48,7 +46,6 @@ public class DeviceErpmappingController {
|
||||
@PutMapping
|
||||
@Log("修改设备-ERP映射")
|
||||
@ApiOperation("修改设备-ERP映射")
|
||||
//@PreAuthorize("@el.check('acsDeviceErpmapping:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody AcsDeviceErpmappingDto dto) {
|
||||
acsDeviceErpmappingService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -56,7 +53,6 @@ public class DeviceErpmappingController {
|
||||
|
||||
@Log("删除设备-ERP映射")
|
||||
@ApiOperation("删除设备-ERP映射")
|
||||
//@PreAuthorize("@el.check('acsDeviceErpmapping:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
acsDeviceErpmappingService.deleteAll(ids);
|
||||
@@ -66,7 +62,6 @@ public class DeviceErpmappingController {
|
||||
@Log("导出设备-ERP映射")
|
||||
@ApiOperation("导出设备-ERP映射")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('acsDeviceErpmapping:list')")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
acsDeviceErpmappingService.download(acsDeviceErpmappingService.queryAll(whereJson), response);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ public class DeviceExtraController {
|
||||
@GetMapping
|
||||
@Log("查询设备扩展")
|
||||
@ApiOperation("查询设备扩展")
|
||||
//@PreAuthorize("@el.check('deviceExtra:list')")
|
||||
public ResponseEntity query(DeviceExtraQueryParam query, Pageable pageable) {
|
||||
return new ResponseEntity<>(deviceExtraService.queryAll(query, pageable), HttpStatus.OK);
|
||||
}
|
||||
@@ -38,7 +37,6 @@ public class DeviceExtraController {
|
||||
@PostMapping
|
||||
@Log("新增设备扩展")
|
||||
@ApiOperation("新增设备扩展")
|
||||
//@PreAuthorize("@el.check('deviceExtra:add')")
|
||||
public ResponseEntity create(@Validated @RequestBody DeviceExtraDto resources) {
|
||||
return new ResponseEntity<>(deviceExtraService.insert(resources), HttpStatus.CREATED);
|
||||
}
|
||||
@@ -46,7 +44,6 @@ public class DeviceExtraController {
|
||||
@PutMapping
|
||||
@Log("修改设备扩展")
|
||||
@ApiOperation("修改设备扩展")
|
||||
//@PreAuthorize("@el.check('deviceExtra:edit')")
|
||||
public ResponseEntity update(@Validated @RequestBody DeviceExtraDto resources) {
|
||||
deviceExtraService.updateById(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -55,7 +52,6 @@ public class DeviceExtraController {
|
||||
@DeleteMapping
|
||||
@Log("删除设备扩展")
|
||||
@ApiOperation("删除设备扩展")
|
||||
//@PreAuthorize("@el.check('deviceExtra:del')")
|
||||
public ResponseEntity delete(@RequestBody Set<String> ids) {
|
||||
deviceExtraService.removeByIds(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -29,7 +29,6 @@ public class DeviceRunpointController {
|
||||
@GetMapping
|
||||
@Log("查询设备点位")
|
||||
@ApiOperation("查询设备点位")
|
||||
//@PreAuthorize("@el.check('deviceRunpoint:list')")
|
||||
public ResponseEntity query(DeviceRunpointQueryParam query, Pageable pageable) {
|
||||
return new ResponseEntity<>(deviceRunpointService.queryAll(query, pageable), HttpStatus.OK);
|
||||
}
|
||||
@@ -37,7 +36,6 @@ public class DeviceRunpointController {
|
||||
@PostMapping
|
||||
@Log("新增设备点位")
|
||||
@ApiOperation("新增设备点位")
|
||||
//@PreAuthorize("@el.check('deviceRunpoint:add')")
|
||||
public ResponseEntity create(@Validated @RequestBody DeviceRunpointDto resources) {
|
||||
return new ResponseEntity<>(deviceRunpointService.insert(resources), HttpStatus.CREATED);
|
||||
}
|
||||
@@ -45,7 +43,6 @@ public class DeviceRunpointController {
|
||||
@PutMapping
|
||||
@Log("修改设备点位")
|
||||
@ApiOperation("修改设备点位")
|
||||
//@PreAuthorize("@el.check('deviceRunpoint:edit')")
|
||||
public ResponseEntity update(@Validated @RequestBody DeviceRunpointDto resources) {
|
||||
deviceRunpointService.updateById(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -54,7 +51,6 @@ public class DeviceRunpointController {
|
||||
@DeleteMapping
|
||||
@Log("删除设备点位")
|
||||
@ApiOperation("删除设备点位")
|
||||
//@PreAuthorize("@el.check('deviceRunpoint:del')")
|
||||
public ResponseEntity delete(@RequestBody Set<String> ids) {
|
||||
deviceRunpointService.removeByIds(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -29,7 +29,6 @@ public class DeviceisonlineController {
|
||||
@GetMapping
|
||||
@Log("查询设备在线状态")
|
||||
@ApiOperation("查询设备在线状态")
|
||||
//@PreAuthorize("@el.check('deviceisonline:list')")
|
||||
public ResponseEntity query(DeviceisonlineQueryParam query, Pageable pageable) {
|
||||
return new ResponseEntity<>(deviceisonlineService.queryAll(query, pageable), HttpStatus.OK);
|
||||
}
|
||||
@@ -37,7 +36,6 @@ public class DeviceisonlineController {
|
||||
@PostMapping
|
||||
@Log("新增设备在线状态")
|
||||
@ApiOperation("新增设备在线状态")
|
||||
//@PreAuthorize("@el.check('deviceisonline:add')")
|
||||
public ResponseEntity create(@Validated @RequestBody DeviceisonlineDto resources) {
|
||||
return new ResponseEntity<>(deviceisonlineService.insert(resources), HttpStatus.CREATED);
|
||||
}
|
||||
@@ -45,7 +43,6 @@ public class DeviceisonlineController {
|
||||
@PutMapping
|
||||
@Log("修改设备在线状态")
|
||||
@ApiOperation("修改设备在线状态")
|
||||
//@PreAuthorize("@el.check('deviceisonline:edit')")
|
||||
public ResponseEntity update(@Validated @RequestBody DeviceisonlineDto resources) {
|
||||
deviceisonlineService.updateById(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -54,7 +51,6 @@ public class DeviceisonlineController {
|
||||
@DeleteMapping
|
||||
@Log("删除设备在线状态")
|
||||
@ApiOperation("删除设备在线状态")
|
||||
//@PreAuthorize("@el.check('deviceisonline:del')")
|
||||
public ResponseEntity delete(@RequestBody Set<String> ids) {
|
||||
deviceisonlineService.removeByIds(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -186,8 +186,8 @@ public interface DeviceService extends CommonService<Device> {
|
||||
JSONArray selectConveyorList();
|
||||
|
||||
/**
|
||||
* 根据区域查询设备
|
||||
*
|
||||
* 通过region获取device
|
||||
* @param region
|
||||
* @return
|
||||
*/
|
||||
JSONArray selectDeviceListByRegion(String region);
|
||||
@@ -264,6 +264,10 @@ public interface DeviceService extends CommonService<Device> {
|
||||
*/
|
||||
void responseAgv(JSONObject form);
|
||||
|
||||
/**
|
||||
* 自动创建任务
|
||||
* @param json
|
||||
*/
|
||||
void autoCreateTask(JSONObject json);
|
||||
|
||||
/**
|
||||
@@ -273,46 +277,84 @@ public interface DeviceService extends CommonService<Device> {
|
||||
*/
|
||||
void unlock(List<String> deviceCodes);
|
||||
|
||||
/**
|
||||
* 清理任务
|
||||
* @param json
|
||||
*/
|
||||
void cleanTask(JSONObject json);
|
||||
|
||||
/**
|
||||
* 清理材料
|
||||
* @param json
|
||||
*/
|
||||
void cleanMaterial(JSONObject json);
|
||||
|
||||
/**
|
||||
* 根据设备标识查询设备驱动配置,如果未配置过,就从驱动配置定义找,否则从数据库里面找
|
||||
*
|
||||
* @param device_id
|
||||
* @param driver_code
|
||||
* @return
|
||||
*/
|
||||
JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code);
|
||||
|
||||
/**
|
||||
* DB测试读
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
JSONArray testRead(Map map);
|
||||
|
||||
/**
|
||||
* DB测试写
|
||||
*
|
||||
* @return
|
||||
* @param map
|
||||
*/
|
||||
void testWrite(Map map);
|
||||
|
||||
/**
|
||||
* 导出设备协议
|
||||
* @param queryDeviceProtocol
|
||||
* @param response
|
||||
*/
|
||||
void downDeviceDBloadCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导出文件
|
||||
* @param queryDeviceProtocol
|
||||
* @param response
|
||||
*/
|
||||
void downDeviceDBloadOumulongCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 根据设备类型查询已配置设备
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
JSONArray selectDeviceListByType(String type);
|
||||
|
||||
/**
|
||||
* 根据货架号,查询扩展信息
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
JSONObject queryStorageExtra(String device_code);
|
||||
|
||||
/**
|
||||
* 查询条码
|
||||
* @param code
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
String queryScannerByCode(String code) throws Exception;
|
||||
|
||||
/**
|
||||
* 加载货位信息
|
||||
*/
|
||||
void reload();
|
||||
|
||||
/**
|
||||
* 查找所有货位
|
||||
* @return
|
||||
*/
|
||||
List<StorageCellDto> queryAllStorageCell();
|
||||
|
||||
/**
|
||||
@@ -322,18 +364,38 @@ public interface DeviceService extends CommonService<Device> {
|
||||
*/
|
||||
List<StorageCellDto> findAllStorageCellFromCache();
|
||||
|
||||
/**
|
||||
* 根据code获取地址
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
int queryAddressBydeviceCode(String code);
|
||||
|
||||
/**
|
||||
* 根据地址获取货位编码
|
||||
* @param address
|
||||
* @return
|
||||
*/
|
||||
String queryDeviceCodeByAddress(int address);
|
||||
|
||||
/**
|
||||
* 获取缓存设备
|
||||
* @return
|
||||
*/
|
||||
List<Device> findCacheDevice();
|
||||
|
||||
/**
|
||||
* 更新条码
|
||||
* @param json
|
||||
* @throws Exception
|
||||
*/
|
||||
void updateBarcode(JSONObject json) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据驱动编码获取db信息
|
||||
*
|
||||
* @param driver_code
|
||||
* @return
|
||||
*/
|
||||
JSONObject queryDBInfoByDriverCode(String driver_code);
|
||||
|
||||
@@ -346,8 +408,18 @@ public interface DeviceService extends CommonService<Device> {
|
||||
*/
|
||||
void downloadProtocolConfig(JSONObject whereJson, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 导出Smart设备协议CSV
|
||||
* @param queryDeviceProtocol
|
||||
* @param response
|
||||
*/
|
||||
void downDeviceDBloadSmartCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导出FX5U设备协议CSV
|
||||
* @param queryDeviceProtocol
|
||||
* @param response
|
||||
*/
|
||||
void downDeviceDBloadFX5UCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
@@ -361,8 +433,8 @@ public interface DeviceService extends CommonService<Device> {
|
||||
|
||||
/**
|
||||
* 下拉框查询设备驱动
|
||||
*
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
JSONArray selectDriverCodeList(String device_code);
|
||||
}
|
||||
|
||||
@@ -40,11 +40,9 @@ import java.util.*;
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
// @CacheConfig(cacheNames = DeviceErpmappingService.CACHE_KEY)
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DeviceErpmappingServiceImpl extends CommonServiceImpl<DeviceErpmappingMapper, DeviceErpmapping> implements DeviceErpmappingService {
|
||||
|
||||
// private final RedisUtils redisUtils;
|
||||
private final DeviceErpmappingMapper deviceErpmappingMapper;
|
||||
private final DeviceMapper deviceMapper;
|
||||
|
||||
@@ -66,7 +64,6 @@ public class DeviceErpmappingServiceImpl extends CommonServiceImpl<DeviceErpmapp
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Cacheable(key = "'id:' + #p0")
|
||||
public AcsDeviceErpmappingDto findById(String id) {
|
||||
return ConvertUtil.convert(getById(id), AcsDeviceErpmappingDto.class);
|
||||
}
|
||||
|
||||
@@ -41,11 +41,9 @@ import java.util.Set;
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
// @CacheConfig(cacheNames = DeviceExtraService.CACHE_KEY)
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DeviceExtraServiceImpl extends CommonServiceImpl<DeviceExtraMapper, DeviceExtra> implements DeviceExtraService {
|
||||
|
||||
// private final RedisUtils redisUtils;
|
||||
private final DeviceExtraMapper deviceExtraMapper;
|
||||
|
||||
@Override
|
||||
@@ -66,7 +64,6 @@ public class DeviceExtraServiceImpl extends CommonServiceImpl<DeviceExtraMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Cacheable(key = "'id:' + #p0")
|
||||
public DeviceExtraDto findById(String id) {
|
||||
return ConvertUtil.convert(getById(id), DeviceExtraDto.class);
|
||||
}
|
||||
|
||||
@@ -25,11 +25,9 @@ import java.util.*;
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
// @CacheConfig(cacheNames = DeviceRunpointService.CACHE_KEY)
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DeviceRunpointServiceImpl extends CommonServiceImpl<DeviceRunpointMapper, DeviceRunpoint> implements DeviceRunpointService {
|
||||
|
||||
// private final RedisUtils redisUtils;
|
||||
private final DeviceRunpointMapper deviceRunpointMapper;
|
||||
|
||||
@Override
|
||||
@@ -50,7 +48,6 @@ public class DeviceRunpointServiceImpl extends CommonServiceImpl<DeviceRunpointM
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Cacheable(key = "'id:' + #p0")
|
||||
public DeviceRunpointDto findById(String id) {
|
||||
return ConvertUtil.convert(getById(id), DeviceRunpointDto.class);
|
||||
}
|
||||
@@ -67,14 +64,12 @@ public class DeviceRunpointServiceImpl extends CommonServiceImpl<DeviceRunpointM
|
||||
public int updateById(DeviceRunpointDto resources) {
|
||||
DeviceRunpoint entity = ConvertUtil.convert(resources, DeviceRunpoint.class);
|
||||
int ret = deviceRunpointMapper.updateById(entity);
|
||||
// delCaches(resources.id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int removeByIds(Set<String> ids) {
|
||||
// delCaches(ids);
|
||||
return deviceRunpointMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@@ -86,39 +81,4 @@ public class DeviceRunpointServiceImpl extends CommonServiceImpl<DeviceRunpointM
|
||||
return this.removeByIds(set);
|
||||
}
|
||||
|
||||
/*
|
||||
private void delCaches(String id) {
|
||||
redisUtils.delByKey(CACHE_KEY + "::id:", id);
|
||||
}
|
||||
|
||||
private void delCaches(Set<String> ids) {
|
||||
for (String id: ids) {
|
||||
delCaches(id);
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void download(List<DeviceRunpointDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (DeviceRunpointDto deviceRunpoint : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("设备编码", deviceRunpoint.getDeviceCode());
|
||||
map.put("有货状态", deviceRunpoint.getHasgoods());
|
||||
map.put("载具号", deviceRunpoint.getContainer());
|
||||
map.put("任务号", deviceRunpoint.getTaskno());
|
||||
map.put("备注", deviceRunpoint.getRemark());
|
||||
map.put("是否启用", deviceRunpoint.getIsActive());
|
||||
map.put("是否删除", deviceRunpoint.getIsDelete());
|
||||
map.put("创建者", deviceRunpoint.getCreateBy());
|
||||
map.put("创建时间", deviceRunpoint.getCreateTime());
|
||||
map.put("修改者", deviceRunpoint.getUpdateBy());
|
||||
map.put("修改时间", deviceRunpoint.getUpdateTime());
|
||||
map.put("物料类型", deviceRunpoint.getMaterialType());
|
||||
map.put("批次", deviceRunpoint.getBatch());
|
||||
map.put("锁定", deviceRunpoint.getIslock());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -94,26 +94,20 @@ import java.util.*;
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
// @CacheConfig(cacheNames = DeviceService.CACHE_KEY)
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> implements DeviceService, ApplicationAutoInitial {
|
||||
|
||||
// private final RedisUtils redisUtils;
|
||||
private final DeviceMapper deviceMapper;
|
||||
private final RouteLineMapper routeLineMapper;
|
||||
// private final StageActorMapper stageActorMapper;
|
||||
private final StorageCellMapper storageCellMapper;
|
||||
private final DeviceExtraMapper deviceExtraMapper;
|
||||
private final DeviceRunpointMapper deviceRunpointMapper;
|
||||
|
||||
private final StageMapper stageMapper;
|
||||
private final DeviceExtraService deviceExtraService;
|
||||
private final OpcService opcService;
|
||||
private final RedisUtils redisUtils;
|
||||
private final OpcPlcService opcPlcService;
|
||||
private final DeviceDriverDefinationAppService deviceDriverDefinationAppService;
|
||||
private final DeviceAppService deviceAppService;
|
||||
private final ISysParamService paramService;
|
||||
|
||||
private final ISysDictService iSysDictService;
|
||||
List<StorageCellDto> storageCells = new ArrayList<>();
|
||||
@@ -948,9 +942,10 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
|
||||
@Override
|
||||
public void changeDeviceStatus(JSONObject form) {
|
||||
CommonFinalParam commonFinalParam = new CommonFinalParam();
|
||||
String device_code = form.getString("device_code");
|
||||
if (StrUtil.contains(device_code, "-") && StrUtil.count(device_code, "-") == 2) {
|
||||
String[] point = device_code.split("-");
|
||||
if (StrUtil.contains(device_code, commonFinalParam.getBARRE()) && StrUtil.count(device_code, commonFinalParam.getBARRE()) == 2) {
|
||||
String[] point = device_code.split(commonFinalParam.getBARRE());
|
||||
device_code = point[0];
|
||||
}
|
||||
//需要数量
|
||||
@@ -966,7 +961,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
String islock = form.getString("islock");
|
||||
String requireSucess = form.getString("requireSucess");
|
||||
String fullrequireSucess = form.getString("fullrequireSucess");
|
||||
if (device_code.indexOf(".") != -1) {
|
||||
if (device_code.indexOf(commonFinalParam.getPOINT()) != -1) {
|
||||
device_code = device_code.substring(0, device_code.indexOf("."));
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
@@ -1644,7 +1639,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载货位信息
|
||||
* 加载货位信息
|
||||
*/
|
||||
@Override
|
||||
public void reload() {
|
||||
|
||||
@@ -25,11 +25,9 @@ import java.util.*;
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
// @CacheConfig(cacheNames = DeviceisonlineService.CACHE_KEY)
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DeviceisonlineServiceImpl extends CommonServiceImpl<DeviceisonlineMapper, Deviceisonline> implements DeviceisonlineService {
|
||||
|
||||
// private final RedisUtils redisUtils;
|
||||
private final DeviceisonlineMapper deviceisonlineMapper;
|
||||
|
||||
@Override
|
||||
@@ -50,7 +48,6 @@ public class DeviceisonlineServiceImpl extends CommonServiceImpl<DeviceisonlineM
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Cacheable(key = "'id:' + #p0")
|
||||
public DeviceisonlineDto findById(String id) {
|
||||
return ConvertUtil.convert(getById(id), DeviceisonlineDto.class);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
*/
|
||||
@Repository
|
||||
public interface DeviceExtraMapper extends CommonMapper<DeviceExtra> {
|
||||
String queryDeviceProtocolSql = "SELECT " +
|
||||
String QUERY_DEVICE_PROTOCOL_SQL = "SELECT " +
|
||||
"d.device_id AS device_id," +
|
||||
"d.device_code AS device_code," +
|
||||
"d.driver_code AS driver_code," +
|
||||
@@ -31,7 +31,7 @@ public interface DeviceExtraMapper extends CommonMapper<DeviceExtra> {
|
||||
"LEFT JOIN acs_device d ON e.device_id = d.device_id " +
|
||||
"LEFT JOIN acs_opc opc ON d.opc_server_id = opc.opc_id " +
|
||||
"LEFT JOIN acs_opc_plc plc ON d.opc_plc_id = plc.plc_id ";
|
||||
String wrapperDeviceProtocolSql = queryDeviceProtocolSql + " ${ew.customSqlSegment} " + "ORDER BY d.device_code,e.extra_name";
|
||||
String WRAPPER_DEVICE_PROTOCOL_SQL = QUERY_DEVICE_PROTOCOL_SQL + " ${ew.customSqlSegment} " + "ORDER BY d.device_code,e.extra_name";
|
||||
|
||||
/**
|
||||
* 设备协议分页查询
|
||||
@@ -40,7 +40,7 @@ public interface DeviceExtraMapper extends CommonMapper<DeviceExtra> {
|
||||
* @param <P>
|
||||
* @return
|
||||
*/
|
||||
@Select(wrapperDeviceProtocolSql)
|
||||
@Select(WRAPPER_DEVICE_PROTOCOL_SQL)
|
||||
<P extends IPage<DeviceExtra>> P queryDeviceProtocolPage(P page, @Param("ew") Wrapper<DeviceExtra> queryWrapper);
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ public interface DeviceExtraMapper extends CommonMapper<DeviceExtra> {
|
||||
* @param queryWrapper
|
||||
* @return
|
||||
*/
|
||||
@Select(wrapperDeviceProtocolSql)
|
||||
@Select(WRAPPER_DEVICE_PROTOCOL_SQL)
|
||||
List<DeviceExtra> selectDeviceProtocolList(@Param("ew") Wrapper<DeviceExtra> queryWrapper);
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,18 +14,22 @@ import org.springframework.stereotype.Repository;
|
||||
*/
|
||||
@Repository
|
||||
public interface DeviceMapper extends CommonMapper<Device> {
|
||||
String queryDeviceSql = "SELECT d.*, dict.label AS device_type_name, dict2.label AS region_name " +
|
||||
String QUERY_DEVICE_SQL = "SELECT d.*, dict.label AS device_type_name, dict2.label AS region_name " +
|
||||
"FROM " +
|
||||
"ACS_DEVICE d " +
|
||||
"LEFT JOIN sys_dict dict ON dict.value = d.device_type " +
|
||||
"AND dict.`code` = 'device_type' " +
|
||||
"LEFT JOIN sys_dict dict2 ON dict2.value = d.region " +
|
||||
"AND dict2.`code` = 'region_type' ";
|
||||
String wrapperDeviceSql = queryDeviceSql + " ${ew.customSqlSegment}";
|
||||
String WRAPPER_DEVICE_SQL = QUERY_DEVICE_SQL + " ${ew.customSqlSegment}";
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param queryWrapper
|
||||
* @param <P>
|
||||
* @return
|
||||
*/
|
||||
@Select(wrapperDeviceSql)
|
||||
@Select(WRAPPER_DEVICE_SQL)
|
||||
<P extends IPage<Device>> P queryPage(P page, @Param("ew") Wrapper<Device> queryWrapper);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user