fix: divece

This commit is contained in:
2023-12-07 15:56:17 +08:00
parent 69a7c4e256
commit 63eb594141
17 changed files with 134 additions and 113 deletions

View File

@@ -12,6 +12,11 @@ import org.springframework.stereotype.Component;
public class CommonFinalParam { public class CommonFinalParam {
private final String DELETE = "0"; private final String DELETE = "0";
/**
* 分隔符
*/
private final String BARRE = "-";
private final String POINT = ".";
/** /**
* 开门 * 开门
*/ */

View File

@@ -1,21 +1,32 @@
package org.nl.acs.device.device_driver; package org.nl.acs.device.device_driver;
import lombok.Data;
import org.nl.acs.device.service.dto.DeviceExtraDto; import org.nl.acs.device.service.dto.DeviceExtraDto;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Data
public class DeviceDriverConfigDto { public class DeviceDriverConfigDto {
//设备驱动类型 /**
* 设备驱动类型
*/
private String type; private String type;
//设备标识 /**
* 设备标识
*/
private String device_id; private String device_id;
//设备编码 /**
* 设备编码
*/
private String device_code; private String device_code;
//扩展属性 /**
* 扩展属性
*/
private List<DeviceExtraDto> exaList; private List<DeviceExtraDto> exaList;
//设备读db块列表 /**
* 设备读db块列表
*/
private List<Map> dbReadList; private List<Map> dbReadList;
private List<Map> dbWriteList; private List<Map> dbWriteList;
} }

View File

@@ -43,18 +43,27 @@ public enum DriverTypeEnum {
DOUBLE_STATION_STACKER(16, "double_station_stacker", "标准版-双工位堆垛机", "double_station_stacker"); DOUBLE_STATION_STACKER(16, "double_station_stacker", "标准版-双工位堆垛机", "double_station_stacker");
//驱动索引 /**
* 驱动索引
*/
private int index; private int index;
//驱动编码 /**
* 驱动编码
*/
private String code; private String code;
// 驱动名字 /**
* 驱动名字
*/
private String name; private String name;
//驱动描述 /**
* 驱动描述
*/
private String desc; private String desc;
//设备驱动类型 /**
* 设备驱动类型
*/
private String type; private String type;
// 构造方法
DriverTypeEnum(int index, String code, String name, String type) { DriverTypeEnum(int index, String code, String name, String type) {
this.index = index; this.index = index;
this.code = code; this.code = code;

View File

@@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
//RD3.RD3.225.to_command
@Slf4j @Slf4j
public class ItemProtocol { public class ItemProtocol {
public static String item_heartbeat = "heartbeat"; public static String item_heartbeat = "heartbeat";

View File

@@ -41,17 +41,9 @@ public class DeviceController {
private final DeviceService deviceService; 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 @GetMapping
@Log("查询设备") @Log("查询设备")
@ApiOperation("查询设备") @ApiOperation("查询设备")

View File

@@ -31,7 +31,6 @@ public class DeviceErpmappingController {
@GetMapping @GetMapping
@Log("查询设备-ERP映射") @Log("查询设备-ERP映射")
@ApiOperation("查询设备-ERP映射") @ApiOperation("查询设备-ERP映射")
//@PreAuthorize("@el.check('acsDeviceErpmapping:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) { public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(acsDeviceErpmappingService.queryAll(whereJson, page), HttpStatus.OK); return new ResponseEntity<>(acsDeviceErpmappingService.queryAll(whereJson, page), HttpStatus.OK);
} }
@@ -39,7 +38,6 @@ public class DeviceErpmappingController {
@PostMapping @PostMapping
@Log("新增设备-ERP映射") @Log("新增设备-ERP映射")
@ApiOperation("新增设备-ERP映射") @ApiOperation("新增设备-ERP映射")
//@PreAuthorize("@el.check('acsDeviceErpmapping:add')")
public ResponseEntity<Object> create(@Validated @RequestBody AcsDeviceErpmappingDto dto) { public ResponseEntity<Object> create(@Validated @RequestBody AcsDeviceErpmappingDto dto) {
acsDeviceErpmappingService.create(dto); acsDeviceErpmappingService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED); return new ResponseEntity<>(HttpStatus.CREATED);
@@ -48,7 +46,6 @@ public class DeviceErpmappingController {
@PutMapping @PutMapping
@Log("修改设备-ERP映射") @Log("修改设备-ERP映射")
@ApiOperation("修改设备-ERP映射") @ApiOperation("修改设备-ERP映射")
//@PreAuthorize("@el.check('acsDeviceErpmapping:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody AcsDeviceErpmappingDto dto) { public ResponseEntity<Object> update(@Validated @RequestBody AcsDeviceErpmappingDto dto) {
acsDeviceErpmappingService.update(dto); acsDeviceErpmappingService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -56,7 +53,6 @@ public class DeviceErpmappingController {
@Log("删除设备-ERP映射") @Log("删除设备-ERP映射")
@ApiOperation("删除设备-ERP映射") @ApiOperation("删除设备-ERP映射")
//@PreAuthorize("@el.check('acsDeviceErpmapping:del')")
@DeleteMapping @DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) { public ResponseEntity<Object> delete(@RequestBody String[] ids) {
acsDeviceErpmappingService.deleteAll(ids); acsDeviceErpmappingService.deleteAll(ids);
@@ -66,7 +62,6 @@ public class DeviceErpmappingController {
@Log("导出设备-ERP映射") @Log("导出设备-ERP映射")
@ApiOperation("导出设备-ERP映射") @ApiOperation("导出设备-ERP映射")
@GetMapping(value = "/download") @GetMapping(value = "/download")
//@PreAuthorize("@el.check('acsDeviceErpmapping:list')")
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException { public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
acsDeviceErpmappingService.download(acsDeviceErpmappingService.queryAll(whereJson), response); acsDeviceErpmappingService.download(acsDeviceErpmappingService.queryAll(whereJson), response);
} }

View File

@@ -30,7 +30,6 @@ public class DeviceExtraController {
@GetMapping @GetMapping
@Log("查询设备扩展") @Log("查询设备扩展")
@ApiOperation("查询设备扩展") @ApiOperation("查询设备扩展")
//@PreAuthorize("@el.check('deviceExtra:list')")
public ResponseEntity query(DeviceExtraQueryParam query, Pageable pageable) { public ResponseEntity query(DeviceExtraQueryParam query, Pageable pageable) {
return new ResponseEntity<>(deviceExtraService.queryAll(query, pageable), HttpStatus.OK); return new ResponseEntity<>(deviceExtraService.queryAll(query, pageable), HttpStatus.OK);
} }
@@ -38,7 +37,6 @@ public class DeviceExtraController {
@PostMapping @PostMapping
@Log("新增设备扩展") @Log("新增设备扩展")
@ApiOperation("新增设备扩展") @ApiOperation("新增设备扩展")
//@PreAuthorize("@el.check('deviceExtra:add')")
public ResponseEntity create(@Validated @RequestBody DeviceExtraDto resources) { public ResponseEntity create(@Validated @RequestBody DeviceExtraDto resources) {
return new ResponseEntity<>(deviceExtraService.insert(resources), HttpStatus.CREATED); return new ResponseEntity<>(deviceExtraService.insert(resources), HttpStatus.CREATED);
} }
@@ -46,7 +44,6 @@ public class DeviceExtraController {
@PutMapping @PutMapping
@Log("修改设备扩展") @Log("修改设备扩展")
@ApiOperation("修改设备扩展") @ApiOperation("修改设备扩展")
//@PreAuthorize("@el.check('deviceExtra:edit')")
public ResponseEntity update(@Validated @RequestBody DeviceExtraDto resources) { public ResponseEntity update(@Validated @RequestBody DeviceExtraDto resources) {
deviceExtraService.updateById(resources); deviceExtraService.updateById(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -55,7 +52,6 @@ public class DeviceExtraController {
@DeleteMapping @DeleteMapping
@Log("删除设备扩展") @Log("删除设备扩展")
@ApiOperation("删除设备扩展") @ApiOperation("删除设备扩展")
//@PreAuthorize("@el.check('deviceExtra:del')")
public ResponseEntity delete(@RequestBody Set<String> ids) { public ResponseEntity delete(@RequestBody Set<String> ids) {
deviceExtraService.removeByIds(ids); deviceExtraService.removeByIds(ids);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);

View File

@@ -29,7 +29,6 @@ public class DeviceRunpointController {
@GetMapping @GetMapping
@Log("查询设备点位") @Log("查询设备点位")
@ApiOperation("查询设备点位") @ApiOperation("查询设备点位")
//@PreAuthorize("@el.check('deviceRunpoint:list')")
public ResponseEntity query(DeviceRunpointQueryParam query, Pageable pageable) { public ResponseEntity query(DeviceRunpointQueryParam query, Pageable pageable) {
return new ResponseEntity<>(deviceRunpointService.queryAll(query, pageable), HttpStatus.OK); return new ResponseEntity<>(deviceRunpointService.queryAll(query, pageable), HttpStatus.OK);
} }
@@ -37,7 +36,6 @@ public class DeviceRunpointController {
@PostMapping @PostMapping
@Log("新增设备点位") @Log("新增设备点位")
@ApiOperation("新增设备点位") @ApiOperation("新增设备点位")
//@PreAuthorize("@el.check('deviceRunpoint:add')")
public ResponseEntity create(@Validated @RequestBody DeviceRunpointDto resources) { public ResponseEntity create(@Validated @RequestBody DeviceRunpointDto resources) {
return new ResponseEntity<>(deviceRunpointService.insert(resources), HttpStatus.CREATED); return new ResponseEntity<>(deviceRunpointService.insert(resources), HttpStatus.CREATED);
} }
@@ -45,7 +43,6 @@ public class DeviceRunpointController {
@PutMapping @PutMapping
@Log("修改设备点位") @Log("修改设备点位")
@ApiOperation("修改设备点位") @ApiOperation("修改设备点位")
//@PreAuthorize("@el.check('deviceRunpoint:edit')")
public ResponseEntity update(@Validated @RequestBody DeviceRunpointDto resources) { public ResponseEntity update(@Validated @RequestBody DeviceRunpointDto resources) {
deviceRunpointService.updateById(resources); deviceRunpointService.updateById(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -54,7 +51,6 @@ public class DeviceRunpointController {
@DeleteMapping @DeleteMapping
@Log("删除设备点位") @Log("删除设备点位")
@ApiOperation("删除设备点位") @ApiOperation("删除设备点位")
//@PreAuthorize("@el.check('deviceRunpoint:del')")
public ResponseEntity delete(@RequestBody Set<String> ids) { public ResponseEntity delete(@RequestBody Set<String> ids) {
deviceRunpointService.removeByIds(ids); deviceRunpointService.removeByIds(ids);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);

View File

@@ -29,7 +29,6 @@ public class DeviceisonlineController {
@GetMapping @GetMapping
@Log("查询设备在线状态") @Log("查询设备在线状态")
@ApiOperation("查询设备在线状态") @ApiOperation("查询设备在线状态")
//@PreAuthorize("@el.check('deviceisonline:list')")
public ResponseEntity query(DeviceisonlineQueryParam query, Pageable pageable) { public ResponseEntity query(DeviceisonlineQueryParam query, Pageable pageable) {
return new ResponseEntity<>(deviceisonlineService.queryAll(query, pageable), HttpStatus.OK); return new ResponseEntity<>(deviceisonlineService.queryAll(query, pageable), HttpStatus.OK);
} }
@@ -37,7 +36,6 @@ public class DeviceisonlineController {
@PostMapping @PostMapping
@Log("新增设备在线状态") @Log("新增设备在线状态")
@ApiOperation("新增设备在线状态") @ApiOperation("新增设备在线状态")
//@PreAuthorize("@el.check('deviceisonline:add')")
public ResponseEntity create(@Validated @RequestBody DeviceisonlineDto resources) { public ResponseEntity create(@Validated @RequestBody DeviceisonlineDto resources) {
return new ResponseEntity<>(deviceisonlineService.insert(resources), HttpStatus.CREATED); return new ResponseEntity<>(deviceisonlineService.insert(resources), HttpStatus.CREATED);
} }
@@ -45,7 +43,6 @@ public class DeviceisonlineController {
@PutMapping @PutMapping
@Log("修改设备在线状态") @Log("修改设备在线状态")
@ApiOperation("修改设备在线状态") @ApiOperation("修改设备在线状态")
//@PreAuthorize("@el.check('deviceisonline:edit')")
public ResponseEntity update(@Validated @RequestBody DeviceisonlineDto resources) { public ResponseEntity update(@Validated @RequestBody DeviceisonlineDto resources) {
deviceisonlineService.updateById(resources); deviceisonlineService.updateById(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -54,7 +51,6 @@ public class DeviceisonlineController {
@DeleteMapping @DeleteMapping
@Log("删除设备在线状态") @Log("删除设备在线状态")
@ApiOperation("删除设备在线状态") @ApiOperation("删除设备在线状态")
//@PreAuthorize("@el.check('deviceisonline:del')")
public ResponseEntity delete(@RequestBody Set<String> ids) { public ResponseEntity delete(@RequestBody Set<String> ids) {
deviceisonlineService.removeByIds(ids); deviceisonlineService.removeByIds(ids);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);

View File

@@ -186,8 +186,8 @@ public interface DeviceService extends CommonService<Device> {
JSONArray selectConveyorList(); JSONArray selectConveyorList();
/** /**
* 根据区域查询设备 * 通过region获取device
* * @param region
* @return * @return
*/ */
JSONArray selectDeviceListByRegion(String region); JSONArray selectDeviceListByRegion(String region);
@@ -264,6 +264,10 @@ public interface DeviceService extends CommonService<Device> {
*/ */
void responseAgv(JSONObject form); void responseAgv(JSONObject form);
/**
* 自动创建任务
* @param json
*/
void autoCreateTask(JSONObject json); void autoCreateTask(JSONObject json);
/** /**
@@ -273,46 +277,84 @@ public interface DeviceService extends CommonService<Device> {
*/ */
void unlock(List<String> deviceCodes); void unlock(List<String> deviceCodes);
/**
* 清理任务
* @param json
*/
void cleanTask(JSONObject json); void cleanTask(JSONObject json);
/**
* 清理材料
* @param json
*/
void cleanMaterial(JSONObject json); void cleanMaterial(JSONObject json);
/** /**
* 根据设备标识查询设备驱动配置,如果未配置过,就从驱动配置定义找,否则从数据库里面找 * 根据设备标识查询设备驱动配置,如果未配置过,就从驱动配置定义找,否则从数据库里面找
*
* @param device_id * @param device_id
* @param driver_code
* @return
*/ */
JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code); JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code);
/** /**
* DB测试读 * DB测试读
* * @param map
* @return * @return
*/ */
JSONArray testRead(Map map); JSONArray testRead(Map map);
/** /**
* DB测试写 * DB测试写
* * @param map
* @return
*/ */
void testWrite(Map map); void testWrite(Map map);
/**
* 导出设备协议
* @param queryDeviceProtocol
* @param response
*/
void downDeviceDBloadCSV(JSONArray queryDeviceProtocol, HttpServletResponse response); void downDeviceDBloadCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
/**
* 导出文件
* @param queryDeviceProtocol
* @param response
*/
void downDeviceDBloadOumulongCSV(JSONArray queryDeviceProtocol, HttpServletResponse response); void downDeviceDBloadOumulongCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
/**
* 根据设备类型查询已配置设备
* @param type
* @return
*/
JSONArray selectDeviceListByType(String type); JSONArray selectDeviceListByType(String type);
/** /**
* 根据货架号,查询扩展信息 * 根据货架号,查询扩展信息
* @param device_code
* @return
*/ */
JSONObject queryStorageExtra(String device_code); JSONObject queryStorageExtra(String device_code);
/**
* 查询条码
* @param code
* @return
* @throws Exception
*/
String queryScannerByCode(String code) throws Exception; String queryScannerByCode(String code) throws Exception;
/**
* 加载货位信息
*/
void reload(); void reload();
/**
* 查找所有货位
* @return
*/
List<StorageCellDto> queryAllStorageCell(); List<StorageCellDto> queryAllStorageCell();
/** /**
@@ -322,18 +364,38 @@ public interface DeviceService extends CommonService<Device> {
*/ */
List<StorageCellDto> findAllStorageCellFromCache(); List<StorageCellDto> findAllStorageCellFromCache();
/**
* 根据code获取地址
* @param code
* @return
*/
int queryAddressBydeviceCode(String code); int queryAddressBydeviceCode(String code);
/**
* 根据地址获取货位编码
* @param address
* @return
*/
String queryDeviceCodeByAddress(int address); String queryDeviceCodeByAddress(int address);
/**
* 获取缓存设备
* @return
*/
List<Device> findCacheDevice(); List<Device> findCacheDevice();
/**
* 更新条码
* @param json
* @throws Exception
*/
void updateBarcode(JSONObject json) throws Exception; void updateBarcode(JSONObject json) throws Exception;
/** /**
* 根据驱动编码获取db信息 * 根据驱动编码获取db信息
* *
* @param driver_code * @param driver_code
* @return
*/ */
JSONObject queryDBInfoByDriverCode(String driver_code); JSONObject queryDBInfoByDriverCode(String driver_code);
@@ -346,8 +408,18 @@ public interface DeviceService extends CommonService<Device> {
*/ */
void downloadProtocolConfig(JSONObject whereJson, HttpServletResponse response) throws IOException; void downloadProtocolConfig(JSONObject whereJson, HttpServletResponse response) throws IOException;
/**
* 导出Smart设备协议CSV
* @param queryDeviceProtocol
* @param response
*/
void downDeviceDBloadSmartCSV(JSONArray queryDeviceProtocol, HttpServletResponse response); void downDeviceDBloadSmartCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
/**
* 导出FX5U设备协议CSV
* @param queryDeviceProtocol
* @param response
*/
void downDeviceDBloadFX5UCSV(JSONArray queryDeviceProtocol, HttpServletResponse response); void downDeviceDBloadFX5UCSV(JSONArray queryDeviceProtocol, HttpServletResponse response);
/** /**
@@ -361,8 +433,8 @@ public interface DeviceService extends CommonService<Device> {
/** /**
* 下拉框查询设备驱动 * 下拉框查询设备驱动
*
* @param device_code * @param device_code
* @return
*/ */
JSONArray selectDriverCodeList(String device_code); JSONArray selectDriverCodeList(String device_code);
} }

View File

@@ -40,11 +40,9 @@ import java.util.*;
*/ */
@Service @Service
@AllArgsConstructor @AllArgsConstructor
// @CacheConfig(cacheNames = DeviceErpmappingService.CACHE_KEY)
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class DeviceErpmappingServiceImpl extends CommonServiceImpl<DeviceErpmappingMapper, DeviceErpmapping> implements DeviceErpmappingService { public class DeviceErpmappingServiceImpl extends CommonServiceImpl<DeviceErpmappingMapper, DeviceErpmapping> implements DeviceErpmappingService {
// private final RedisUtils redisUtils;
private final DeviceErpmappingMapper deviceErpmappingMapper; private final DeviceErpmappingMapper deviceErpmappingMapper;
private final DeviceMapper deviceMapper; private final DeviceMapper deviceMapper;
@@ -66,7 +64,6 @@ public class DeviceErpmappingServiceImpl extends CommonServiceImpl<DeviceErpmapp
} }
@Override @Override
// @Cacheable(key = "'id:' + #p0")
public AcsDeviceErpmappingDto findById(String id) { public AcsDeviceErpmappingDto findById(String id) {
return ConvertUtil.convert(getById(id), AcsDeviceErpmappingDto.class); return ConvertUtil.convert(getById(id), AcsDeviceErpmappingDto.class);
} }

View File

@@ -41,11 +41,9 @@ import java.util.Set;
*/ */
@Service @Service
@AllArgsConstructor @AllArgsConstructor
// @CacheConfig(cacheNames = DeviceExtraService.CACHE_KEY)
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class DeviceExtraServiceImpl extends CommonServiceImpl<DeviceExtraMapper, DeviceExtra> implements DeviceExtraService { public class DeviceExtraServiceImpl extends CommonServiceImpl<DeviceExtraMapper, DeviceExtra> implements DeviceExtraService {
// private final RedisUtils redisUtils;
private final DeviceExtraMapper deviceExtraMapper; private final DeviceExtraMapper deviceExtraMapper;
@Override @Override
@@ -66,7 +64,6 @@ public class DeviceExtraServiceImpl extends CommonServiceImpl<DeviceExtraMapper,
} }
@Override @Override
// @Cacheable(key = "'id:' + #p0")
public DeviceExtraDto findById(String id) { public DeviceExtraDto findById(String id) {
return ConvertUtil.convert(getById(id), DeviceExtraDto.class); return ConvertUtil.convert(getById(id), DeviceExtraDto.class);
} }

View File

@@ -25,11 +25,9 @@ import java.util.*;
*/ */
@Service @Service
@AllArgsConstructor @AllArgsConstructor
// @CacheConfig(cacheNames = DeviceRunpointService.CACHE_KEY)
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class DeviceRunpointServiceImpl extends CommonServiceImpl<DeviceRunpointMapper, DeviceRunpoint> implements DeviceRunpointService { public class DeviceRunpointServiceImpl extends CommonServiceImpl<DeviceRunpointMapper, DeviceRunpoint> implements DeviceRunpointService {
// private final RedisUtils redisUtils;
private final DeviceRunpointMapper deviceRunpointMapper; private final DeviceRunpointMapper deviceRunpointMapper;
@Override @Override
@@ -50,7 +48,6 @@ public class DeviceRunpointServiceImpl extends CommonServiceImpl<DeviceRunpointM
} }
@Override @Override
// @Cacheable(key = "'id:' + #p0")
public DeviceRunpointDto findById(String id) { public DeviceRunpointDto findById(String id) {
return ConvertUtil.convert(getById(id), DeviceRunpointDto.class); return ConvertUtil.convert(getById(id), DeviceRunpointDto.class);
} }
@@ -67,14 +64,12 @@ public class DeviceRunpointServiceImpl extends CommonServiceImpl<DeviceRunpointM
public int updateById(DeviceRunpointDto resources) { public int updateById(DeviceRunpointDto resources) {
DeviceRunpoint entity = ConvertUtil.convert(resources, DeviceRunpoint.class); DeviceRunpoint entity = ConvertUtil.convert(resources, DeviceRunpoint.class);
int ret = deviceRunpointMapper.updateById(entity); int ret = deviceRunpointMapper.updateById(entity);
// delCaches(resources.id);
return ret; return ret;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int removeByIds(Set<String> ids) { public int removeByIds(Set<String> ids) {
// delCaches(ids);
return deviceRunpointMapper.deleteBatchIds(ids); return deviceRunpointMapper.deleteBatchIds(ids);
} }
@@ -86,39 +81,4 @@ public class DeviceRunpointServiceImpl extends CommonServiceImpl<DeviceRunpointM
return this.removeByIds(set); 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);
}*/
} }

View File

@@ -94,26 +94,20 @@ import java.util.*;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
@Slf4j @Slf4j
// @CacheConfig(cacheNames = DeviceService.CACHE_KEY)
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> implements DeviceService, ApplicationAutoInitial { public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> implements DeviceService, ApplicationAutoInitial {
// private final RedisUtils redisUtils;
private final DeviceMapper deviceMapper; private final DeviceMapper deviceMapper;
private final RouteLineMapper routeLineMapper; private final RouteLineMapper routeLineMapper;
// private final StageActorMapper stageActorMapper;
private final StorageCellMapper storageCellMapper; private final StorageCellMapper storageCellMapper;
private final DeviceExtraMapper deviceExtraMapper; private final DeviceExtraMapper deviceExtraMapper;
private final DeviceRunpointMapper deviceRunpointMapper; private final DeviceRunpointMapper deviceRunpointMapper;
private final StageMapper stageMapper;
private final DeviceExtraService deviceExtraService; private final DeviceExtraService deviceExtraService;
private final OpcService opcService; private final OpcService opcService;
private final RedisUtils redisUtils;
private final OpcPlcService opcPlcService; private final OpcPlcService opcPlcService;
private final DeviceDriverDefinationAppService deviceDriverDefinationAppService; private final DeviceDriverDefinationAppService deviceDriverDefinationAppService;
private final DeviceAppService deviceAppService; private final DeviceAppService deviceAppService;
private final ISysParamService paramService;
private final ISysDictService iSysDictService; private final ISysDictService iSysDictService;
List<StorageCellDto> storageCells = new ArrayList<>(); List<StorageCellDto> storageCells = new ArrayList<>();
@@ -948,9 +942,10 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
@Override @Override
public void changeDeviceStatus(JSONObject form) { public void changeDeviceStatus(JSONObject form) {
CommonFinalParam commonFinalParam = new CommonFinalParam();
String device_code = form.getString("device_code"); String device_code = form.getString("device_code");
if (StrUtil.contains(device_code, "-") && StrUtil.count(device_code, "-") == 2) { if (StrUtil.contains(device_code, commonFinalParam.getBARRE()) && StrUtil.count(device_code, commonFinalParam.getBARRE()) == 2) {
String[] point = device_code.split("-"); String[] point = device_code.split(commonFinalParam.getBARRE());
device_code = point[0]; device_code = point[0];
} }
//需要数量 //需要数量
@@ -966,7 +961,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
String islock = form.getString("islock"); String islock = form.getString("islock");
String requireSucess = form.getString("requireSucess"); String requireSucess = form.getString("requireSucess");
String fullrequireSucess = form.getString("fullrequireSucess"); 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_code = device_code.substring(0, device_code.indexOf("."));
} }
Device device = deviceAppService.findDeviceByCode(device_code); Device device = deviceAppService.findDeviceByCode(device_code);

View File

@@ -25,11 +25,9 @@ import java.util.*;
*/ */
@Service @Service
@AllArgsConstructor @AllArgsConstructor
// @CacheConfig(cacheNames = DeviceisonlineService.CACHE_KEY)
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class DeviceisonlineServiceImpl extends CommonServiceImpl<DeviceisonlineMapper, Deviceisonline> implements DeviceisonlineService { public class DeviceisonlineServiceImpl extends CommonServiceImpl<DeviceisonlineMapper, Deviceisonline> implements DeviceisonlineService {
// private final RedisUtils redisUtils;
private final DeviceisonlineMapper deviceisonlineMapper; private final DeviceisonlineMapper deviceisonlineMapper;
@Override @Override
@@ -50,7 +48,6 @@ public class DeviceisonlineServiceImpl extends CommonServiceImpl<DeviceisonlineM
} }
@Override @Override
// @Cacheable(key = "'id:' + #p0")
public DeviceisonlineDto findById(String id) { public DeviceisonlineDto findById(String id) {
return ConvertUtil.convert(getById(id), DeviceisonlineDto.class); return ConvertUtil.convert(getById(id), DeviceisonlineDto.class);
} }

View File

@@ -16,7 +16,7 @@ import java.util.List;
*/ */
@Repository @Repository
public interface DeviceExtraMapper extends CommonMapper<DeviceExtra> { public interface DeviceExtraMapper extends CommonMapper<DeviceExtra> {
String queryDeviceProtocolSql = "SELECT " + String QUERY_DEVICE_PROTOCOL_SQL = "SELECT " +
"d.device_id AS device_id," + "d.device_id AS device_id," +
"d.device_code AS device_code," + "d.device_code AS device_code," +
"d.driver_code AS driver_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_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 opc ON d.opc_server_id = opc.opc_id " +
"LEFT JOIN acs_opc_plc plc ON d.opc_plc_id = plc.plc_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> * @param <P>
* @return * @return
*/ */
@Select(wrapperDeviceProtocolSql) @Select(WRAPPER_DEVICE_PROTOCOL_SQL)
<P extends IPage<DeviceExtra>> P queryDeviceProtocolPage(P page, @Param("ew") Wrapper<DeviceExtra> queryWrapper); <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 * @param queryWrapper
* @return * @return
*/ */
@Select(wrapperDeviceProtocolSql) @Select(WRAPPER_DEVICE_PROTOCOL_SQL)
List<DeviceExtra> selectDeviceProtocolList(@Param("ew") Wrapper<DeviceExtra> queryWrapper); List<DeviceExtra> selectDeviceProtocolList(@Param("ew") Wrapper<DeviceExtra> queryWrapper);
/** /**

View File

@@ -14,18 +14,22 @@ import org.springframework.stereotype.Repository;
*/ */
@Repository @Repository
public interface DeviceMapper extends CommonMapper<Device> { 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 " + "FROM " +
"ACS_DEVICE d " + "ACS_DEVICE d " +
"LEFT JOIN sys_dict dict ON dict.value = d.device_type " + "LEFT JOIN sys_dict dict ON dict.value = d.device_type " +
"AND dict.`code` = 'device_type' " + "AND dict.`code` = 'device_type' " +
"LEFT JOIN sys_dict dict2 ON dict2.value = d.region " + "LEFT JOIN sys_dict dict2 ON dict2.value = d.region " +
"AND dict2.`code` = 'region_type' "; "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); <P extends IPage<Device>> P queryPage(P page, @Param("ew") Wrapper<Device> queryWrapper);
} }