提交 c3a1e9da authored 作者: zjm's avatar zjm

Merge branch 'read-dev' of git.yfzx.zjtys.com.cn:matrix/device-back into dev

......@@ -931,8 +931,6 @@ public class AllotBillController {
}
//父任务未被完成 可以被撤回
Integer billId = taskBto.getBillId();
String title = taskBto.getTitle();
AllotBill allotBill = allotBillService.getOne(billId);
Integer currentUserId = userUtils.getCurrentUserId();
List<Integer> idList = userPublicService.findOtherUser(currentUserId);
......@@ -946,18 +944,6 @@ public class AllotBillController {
.map(User::getUserId)
.collect(Collectors.toList()));
}
//给同单位专管员和收件单位专管员推阅知
// messageBto1.setContent(title.substring(0,4)+"撤回"+title.substring(4));
// messageBto1.setContent("撤回对" + allotBill.getReceiveUnit()+"的型号为"+"的任务");
// MessageBto messageBto = new MessageBto(-1, parentTask.getBusinessType(), messageBto1.getContent(), idList, 1);
// BeanUtils.copyProperties(messageBto1,messageBto);
// messageBto.setTaskId(-1);
// messageService.add(messageBto);
// myWebSocket.sendMessage1();
// //将任务都完结
// taskService.moveToRevoke(taskBto);
// taskService.moveToRevoke(parentTask);
List<DeviceLibrary> deviceLibraryList = null;
if (allotBill.getAllotCheckDetail() != null) {
List<Integer> ids = StringSplitUtil.split(allotBill.getAllotCheckDetail());
......@@ -972,21 +958,20 @@ public class AllotBillController {
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + deviceLibrary.getName() + "配发撤回", null, null, null);
deviceLogDtos.add(deviceLogDto);
});
//设置装备为在库
deviceLibraryService.updateLifeStatus2(2,ids);
deviceLibraryList = deviceLibraryService.findByIds(ids);
//添加日志
deviceLogService.addAllLog(deviceLogDtos);
allotBill.setDeviceLibraries(deviceLibraryList);
allotBillService.delete(allotBill.getId());
}
messageBto1.setContent("撤回对" + allotBill.getReceiveUnit()+"的型号为"+deviceLibraryList.stream().map(DeviceLibrary::getModel)
.collect(Collectors.toList())+"的任务");
// 配发撤回:操作人 撤回 配发:【发送单位】至【发往单位】【型号数量】
// 例:市A 撤回 配发:【杭州市机要局】至【萧山机要局】【型号:A001,A002共3件】
messageBto1.setContent("撤回 配发:"+MessageFormatUtil.spellTwoWicket(allotBill.getSendUnit(),allotBill.getReceiveUnit())+
MessageFormatUtil.spellModelSetAndCount(deviceLibraryList.stream().map(DeviceLibrary::getModel)
.collect(Collectors.toSet()),allotBill.getAllotCount()));
MessageBto messageBto = new MessageBto(-1, taskBto.getBusinessType(), messageBto1.getContent(), idList, 1);
BeanUtils.copyProperties(messageBto1,messageBto);
messageBto.setTaskId(-1);
......@@ -994,7 +979,6 @@ public class AllotBillController {
myWebSocket.sendMessage1();
//将任务都完结
taskService.moveToRevoke(taskBto);
return ResponseEntity.ok(messageBto);
}
......
......@@ -798,7 +798,15 @@ public class DeviceApplyController {
@PostMapping("/removeSameSeq")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity removeSameSeq(@RequestBody RemoveSameSeqVo removeSameSeqVo) {
ApplyRemoveSeqVo applyRemoveSeqVo = deviceApplyBillService.removeSameSeq(removeSameSeqVo);
ApplyRemoveSeqVo applyRemoveSeqVo = new ApplyRemoveSeqVo();
if (removeSameSeqVo.getRemoveSameSeq() != null){
applyRemoveSeqVo = deviceApplyBillService.removeSameSeq(removeSameSeqVo);
}else {
//没有重复的
List<String> list = DeviceSeqUtil.selectDeviceSeqs(removeSameSeqVo.getSeqNumberList());
applyRemoveSeqVo.setSeqList(list);
applyRemoveSeqVo.setCount(list.size());
}
return ResponseEntity.ok(applyRemoveSeqVo);
}
......
package com.tykj.dev.device.apply.subject.vo;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.task.subject.vo.TaskLogUserVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -23,5 +19,4 @@ public class ApplyRemoveSeqVo {
@ApiModelProperty(name = "区间数量")
private Integer count;
}
//package com.tykj.dev.config;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//
///**
// * @author zsp
// * @create 2021/12/13 14:20
// */
//@Configuration
//public class ReadMachineLoader {
//
// @PostConstruct
// private void getLoader(){
// if (System.getProperty("myapplibrary") == null){
// System.setProperty("myapplibrary","libModuleAPIJni.so");
// System.loadLibrary("libModuleAPIJni");
// }
// }
//}
package com.tykj.dev.device.library.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceLibraryPositionService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition;
import com.tykj.dev.device.library.subject.vo.DeviceLibraryPositionMessageVo;
import com.tykj.dev.device.library.subject.vo.RotationVo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.misc.utils.JacksonUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* DATE:2021-8-11
* Author:zsp
*/
@RestController
@RequestMapping(value = "/deviceLibraryPosition")
@AutoDocument
@Api(tags = "装备3D模块", description = "装备3D模块")
@Slf4j
public class DeviceLibraryPositionController {
@Resource
private DeviceLibraryPositionService deviceLibraryPositionService;
@GetMapping("/findByStorageLocationId")
@ApiOperation(value = "根据库房位置查询装备")
public ResponseEntity<List<DeviceLibraryPosition>> findByStorageLocationId(Integer StorageLocationId){
List<DeviceLibraryPosition> deviceLibraryPositions = new ArrayList<>();
for (DeviceLibraryPosition deviceLibraryPosition : deviceLibraryPositionService.findByStorageLocationId(StorageLocationId)) {
deviceLibraryPosition.setDeviceLibraryPositionMessageVo(
JacksonUtil.readValue(deviceLibraryPosition.getDeviceLibraryPositionMessage(), new TypeReference<DeviceLibraryPositionMessageVo>() {}));
deviceLibraryPosition.setRotationVo(
JacksonUtil.readValue(deviceLibraryPosition.getRotation(), new TypeReference<RotationVo>() {}));
deviceLibraryPositions.add(deviceLibraryPosition);
}
return ResponseEntity.ok(deviceLibraryPositions);
}
@PostMapping("/updateDeviceLibraryPosition")
@ApiOperation(value = "修改3D")
public ResponseEntity<String> updateDeviceLibraryPosition(@RequestBody DeviceLibraryPosition deviceLibraryPosition){
String messageVo = deviceLibraryPosition.getDeviceLibraryPositionMessageVo().toJson();
String rotationVo = deviceLibraryPosition.getRotationVo().toJson();
deviceLibraryPosition.setDeviceLibraryPositionMessage(messageVo);
deviceLibraryPosition.setRotation(rotationVo);
deviceLibraryPositionService.updateDeviceLibraryPosition(deviceLibraryPosition);
return ResponseEntity.ok("修改成功");
}
@GetMapping("/findById")
@ApiOperation(value = "根据id查询")
public ResponseEntity<DeviceLibraryPosition> findById(Integer id){
DeviceLibraryPosition deviceLibraryPosition = deviceLibraryPositionService.findById(id);
return ResponseEntity.ok(deviceLibraryPosition);
}
@GetMapping("/delete")
@ApiOperation(value = "根据id删除")
public ResponseEntity<String> deleteByPosition(Integer id){
deviceLibraryPositionService.deleteByPosition(id);
return ResponseEntity.ok("删除成功");
}
}
package com.tykj.dev.device.library.repository;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
/**
* @author zsp
*/
@SuppressWarnings("SqlResolve")
public interface DeviceLibraryPositionDao extends JpaRepository<DeviceLibraryPosition, Integer>, JpaSpecificationExecutor<DeviceLibraryPosition> {
List<DeviceLibraryPosition> findAllByStorageLocationId(Integer StorageLocationId);
}
package com.tykj.dev.device.library.service;
import com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition;
import java.util.List;
/**
* @author zsp
* @create 2021/12/13 16:23
*/
public interface DeviceLibraryPositionService {
void addDeviceLibraryPosition(DeviceLibraryPosition deviceLibraryPosition);
void updateDeviceLibraryPosition(DeviceLibraryPosition deviceLibraryPosition);
void batchDeviceLibraryPositions(List<DeviceLibraryPosition> deviceLibraryPositions);
List<DeviceLibraryPosition> findByStorageLocationId(Integer StorageLocationId);
DeviceLibraryPosition findById(Integer id);
void deleteByPosition(Integer id);
}
......@@ -527,4 +527,7 @@ public interface DeviceLibraryService {
List<DeviceLibrary> findAllByRfids(List<String> rfids);
List<DeviceLibrary> batchDevices(List<DeviceLibrary> deviceLibraryEntity);
}
//package com.tykj.dev.device.library.service.impl;
//
//import com.tykj.dev.device.library.repository.DeviceLibraryPositionDao;
//import com.tykj.dev.device.library.service.DeviceLibraryPositionService;
//import com.tykj.dev.device.library.service.DeviceLibraryService;
//import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
//import com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition;
//import com.tykj.dev.device.user.util.UserUtils;
//import lombok.val;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//import java.util.Optional;
//
///**
// * @author zsp
// * @create 2021/12/13 16:23
// */
//@Service
//public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionService {
//
// @Autowired
// private UserUtils userUtils;
//
// @Autowired
// private DeviceLibraryService deviceLibraryService;
//
// @Autowired
// private DeviceLibraryPositionDao deviceLibraryPositionDao;
//
// @Override
// public void addDeviceLibraryPosition(DeviceLibraryPosition deviceLibraryPosition) {
// deviceLibraryPositionDao.save(deviceLibraryPosition);
// }
//
// @Override
// public void updateDeviceLibraryPosition(DeviceLibraryPosition deviceLibraryPosition) {
// deviceLibraryPositionDao.save(deviceLibraryPosition);
// }
//
// @Override
// public void batchDeviceLibraryPositions(List<DeviceLibraryPosition> deviceLibraryPositions) {
// deviceLibraryPositionDao.saveAll(deviceLibraryPositions);
// }
//
// @Override
// public List<DeviceLibraryPosition> findByStorageLocationId(Integer StorageLocationId) {
// return deviceLibraryPositionDao.findAllByStorageLocationId(StorageLocationId);
//
// }
//
// @Override
// public DeviceLibraryPosition findById(Integer id) {
// DeviceLibraryPosition deviceLibraryPosition = new DeviceLibraryPosition();
// Optional<DeviceLibraryPosition> positionDaoById = deviceLibraryPositionDao.findById(id);
// if(positionDaoById.isPresent()){
// deviceLibraryPosition = positionDaoById.get();
// }
// return deviceLibraryPosition;
// }
//
// @Override
// public void deleteByPosition(Integer id) {
// DeviceLibraryPosition deviceLibraryPosition= findById(id);
// DeviceLibrary deviceLibrary = deviceLibraryService.getOne(deviceLibraryPosition.getDeviceId());
// deviceLibrary.setStorageLocation(null);
// deviceLibrary.setStorageLocationId(null);
// deviceLibraryPositionDao.delete(deviceLibraryPosition);
// deviceLibraryService.update(deviceLibrary);
// }
//}
......@@ -1239,6 +1239,12 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return deviceLibraryDao.findAllByRfidCardIdIn(rfids);
}
@Override
@UpdateCache
public List<DeviceLibrary> batchDevices(List<DeviceLibrary> deviceLibraryEntity) {
return deviceLibraryDao.saveAll(deviceLibraryEntity);
}
// @Override
// @UpdateCache
// public int updatePartParentId(List<Integer> deviceIds) {
......@@ -1395,6 +1401,8 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
if (deviceLibrarySelectVo.getSeqInterval()!=null&&DeviceSeqUtil.selectDeviceSeqs(deviceLibrarySelectVo.getSeqInterval()).size()>0){
predicateBuilder.in("seqNumber", DeviceSeqUtil.selectDeviceSeqs(deviceLibrarySelectVo.getSeqInterval()));
}
predicateBuilder.like(deviceLibrarySelectVo.getRfidCardId() != null,"rfidCardId",
"%"+deviceLibrarySelectVo.getRfidCardId()+"%");
//新增库房位置
predicateBuilder.eq(deviceLibrarySelectVo.getStorageLocationId() != null,"storageLocationId",deviceLibrarySelectVo.getStorageLocationId());
//新增装备的形态
......
package com.tykj.dev.device.library.subject.domin;
import com.tykj.dev.device.library.subject.vo.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* @author zsp
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update device_library_position set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("装备3D位置存储库")
public class DeviceLibraryPosition implements Serializable {
/**
* 主键id
*/
@Id
@GeneratedValue
@ApiModelProperty(name = "主键id")
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer id;
/**
* 型号
*/
@ApiModelProperty(value = "型号")
private String model;
/**
* 型号
*/
@ApiModelProperty(value = "装备的id")
private Integer deviceId;
/**
* 密级
*/
@ApiModelProperty(value = "密级")
private Integer secretLevel;
/**
* 装备名称
*/
@ApiModelProperty(value = "装备名称")
private String name;
/**
* 装备序列号
*/
@ApiModelProperty(value = "装备序列号")
private String seqNumber;
/**
* 生产序列号
*/
@ApiModelProperty(value = "生产序列号")
private String prodNumber;
/**
* rfid表面号
*/
@ApiModelProperty(value = "rfid表面号")
private String rfidSurfaceId;
/**
* rfid卡号
*/
@ApiModelProperty(value = "rfid卡号")
private String rfidCardId;
/**
* 所在单位
*/
@ApiModelProperty(value = "所在单位")
private String locationUnit;
/**
* 所属单位
*/
@ApiModelProperty(value = "所属单位")
private String ownUnit;
/**
* 创建用户id
*/
@CreatedBy
@ApiModelProperty(value = "创建用户id")
private Integer createUserId;
/**
* 创建时间
*/
@CreatedDate
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新用户id
*/
@LastModifiedBy
@ApiModelProperty(value = "更新用户id")
private Integer updateUserId;
/**
* 更新时间
*/
@LastModifiedDate
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 删除标记(0:未删除,1:已删除)
*/
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag = 0;
@ApiModelProperty(value = "库房位置",notes = "默认是库房")
private String storageLocation;
@ApiModelProperty(value = "装备存放位置Id",notes = "默认是库房")
private Integer storageLocationId;
@ApiModelProperty(value = "DeviceLibraryPosition名称",notes = "")
private String deviceLibraryPositionName;
@ApiModelProperty(value = "位置信息",notes = "{x, y, z}")
@Column(name = "Device_Library_Position_Message",columnDefinition = "TEXT")
private String deviceLibraryPositionMessage;
@ApiModelProperty(value = "旋转信息",notes = "{x, y, z}")
@Column(name = "Rotation",columnDefinition = "TEXT")
private String rotation;
@ApiModelProperty(value = "是否在机柜中 ",notes = "0 不在 1 在")
private Integer ifCabinet = 0;
@ApiModelProperty(value = "在几号机柜里",notes = "1")
private Integer cabinetPosition;
@ApiModelProperty(value = "u位",notes = "1-1")
private String uNum;
@ApiModelProperty("旋转信息vo")
@Transient
private DeviceLibraryPositionMessageVo deviceLibraryPositionMessageVo;
@ApiModelProperty("位置信息vo")
@Transient
private RotationVo rotationVo;
}
package com.tykj.dev.device.library.subject.vo;
import com.tykj.dev.misc.utils.JacksonUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.stereotype.Repository;
/**
* @author zsp
* @create 2021/12/13 16:46
*/
@Data
@ApiModel("位置信息")
@Repository
public class DeviceLibraryPositionMessageVo {
@ApiModelProperty("位置信息")
private String x;
private String y;
private String z;
public String toJson(){
return JacksonUtil.toJSon(this);
}
}
package com.tykj.dev.device.library.subject.vo;
import com.tykj.dev.misc.utils.JacksonUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.stereotype.Repository;
/**
* @author zsp
*/
@Data
@ApiModel("旋转信息")
@Repository
public class RotationVo {
@ApiModelProperty("位置信息")
private String x;
private String y;
private String z;
public String toJson(){
return JacksonUtil.toJSon(this);
}
}
......@@ -395,6 +395,8 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
predicateBuilder.in("rfidCardId", "");
}
}
predicateBuilder.like(matchingDeviceSelectVo.getRfidCardId() != null,"rfidCardId",
"%"+matchingDeviceSelectVo.getRfidCardId()+"%");
predicateBuilder.eq(matchingDeviceSelectVo.getMatchingDeviceStorageLocationId() != null,
"matchingDeviceStorageLocationId",matchingDeviceSelectVo.getMatchingDeviceStorageLocationId());
return predicateBuilder;
......
......@@ -36,6 +36,9 @@ public class MatchingDeviceSelectVo extends CustomPage {
@ApiModelProperty(value = "存放位置id")
private Integer matchingDeviceStorageLocationId;
@ApiModelProperty(value = "rfidCardId")
private Integer rfidCardId;
private String typeDim;
private String modelDim;
......
......@@ -121,6 +121,7 @@ public enum BusinessEnum {
SUSPENSION(29,"中止业务"),
READMACHINE(30,"盘存"),
;
public Integer id;
......
......@@ -317,7 +317,15 @@ public enum StatusEnum {
SCRAP_2222(2222, "等待上传报废签收单"),
SCRAP_2223(2223, "报废草稿"),
SCRAP_2224(2224, "报废出库签章审核"),
SCRAP_2225(2225, "报废出库等待盖电子签章");
SCRAP_2225(2225, "报废出库等待盖电子签章"),
/**
* 盘存状态draft
*/
READ_DEAFT(3000, "保存盘存草稿"),
READ_End(3001, "结束盘存任务"),
;
public Integer id;
......
......@@ -493,14 +493,27 @@ public class PackingController {
@ApiOperation(value = "判断序列号区间是否存在")
@PostMapping("/seqsExist/{id}/{num}/{seq}")
public ResponseEntity seqsExist(@PathVariable("id") int id,@PathVariable("num") int num,@PathVariable("seq") String seq){
// List<DeviceLibrary> deviceLibraries = packingLibraryService.getAllDevSeqs(id);
List<DeviceLibrary> deviceLibraries = deviceLibraryCacheService.getAllDeviceLibraryList();
List<DeviceLibrary> deviceLibraries = packingLibraryService.getAllDevSeqs(id);
// List<DeviceLibrary> deviceLibraries = deviceLibraryCacheService.getAllDeviceLibraryList();
List<String> existSeqs = deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
//输入的区间序列号
List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(seq);
List<String> hasApplySeqs = deviceLibraries.stream()
.filter(deviceLibrary -> deviceLibrary.getApplyTaskId()!=null)
.map(DeviceLibrary::getSeqNumber)
.collect(Collectors.toList());
//新增判断
if (!inputSeqs.isEmpty()){
for (String inputSeq : inputSeqs) {
if (!existSeqs.contains(inputSeq)){
return ResponseEntity.ok("序列号为"+inputSeq+"与型号不匹配");
}
if (deviceLibraryService.findBySeqNumber(inputSeq).getPackingId() != id){
return ResponseEntity.ok("序列号为"+inputSeq+"与型号不匹配");
}
}
}
if (inputSeqs.size()!=num){
return ResponseEntity.ok("序列号区间总数为"+inputSeqs.size()+",与装备数量不匹配");
}
......@@ -1008,7 +1021,7 @@ public class PackingController {
packingLogService.add(packingLog);
packingLibrary.setFileDb(FilesUtil.stringFileToList(packingLibraryUpdateVo.getFileList()));
}
packingLibraryService.update(packingLibrary);
PackingLibrary library = packingLibraryService.update(packingLibrary);
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
// originalMap.entrySet().forEach(
......@@ -1022,7 +1035,7 @@ public class PackingController {
MessageBto messageBto = new MessageBto(0, 1, "修改" + packingLibraryUpdateVo.getModel() + "列装信息:原" + mapToString(originalMap) + "-->现" + mapToString(nowMap), userIds, 0);
messageService.add(messageBto);
}
return ResponseEntity.ok("编辑成功");
return ResponseEntity.ok(library);
}
......
......@@ -61,6 +61,7 @@ public class PackingLibraryController {
@ApiOperation(value = "申请后入库获取父子结构列装(去除已入库序列号)", notes = "获取父子结构列装")
@PostMapping("/merge")
public ResponseEntity merge(@RequestBody List<PackingLibrary> packingLibraries){
List<MergeVo> mergeVos = new ArrayList<>();
Map<String,DeviceLibrary> map = deviceLibraryService.getAllDeviceSeqMap();
packingLibraries.forEach(packingLibrary -> {
List<String> inputSeqs = DeviceSeqUtil.selectDeviceSeqs(packingLibrary.getSeq());
......@@ -72,8 +73,14 @@ public class PackingLibraryController {
// });
// packingLibrary.setSeq(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(outputSeqs)));
packingLibrary.setSeq(StringSplitUtil.stringListToString(DeviceSeqUtil.getContinuousSeqs(inputSeqs)));
MergeVo mergeVo = new MergeVo();
mergeVo.setStorageCount(packingLibrary.getWaitNum());
// mergeVo.setPackingLibrary(packingLibrary);
mergeVo.setSeqInterval(packingLibrary.getSeq());
mergeVo.setSeqList(inputSeqs);
packingLibrary.setMergeVo(mergeVo);
});
//返回父子结构
Map<Integer, PackingLibrary> nodeCollect =
packingLibraries.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibrary -> packingLibrary));
......
......@@ -3,6 +3,7 @@ package com.tykj.dev.device.packing.subject.domin;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.packing.subject.vo.MergeVo;
import com.tykj.dev.misc.utils.SpringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -304,6 +305,10 @@ public class PackingLibrary {
@ApiModelProperty(value = "等级")
private Integer level;
@Transient
@ApiModelProperty(value = "merge")
private MergeVo mergeVo;
public void addChildNode(PackingLibrary packingLibraryEntity) {
childs.add(packingLibraryEntity);
......
package com.tykj.dev.device.packing.subject.vo;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author dengdiyi
*/
@Data
@ApiModel("合并vo")
@Repository
public class MergeVo {
@ApiModelProperty(name = "列装对象")
private PackingLibrary packingLibrary;
@ApiModelProperty(name = "入库数量",example = "1")
private Integer storageCount;
@ApiModelProperty(name = "生成的序列号区间",example = "1")
private String seqInterval;
@ApiModelProperty(name = "生成的序列号集合")
private List<String> seqList;
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>equip</artifactId>
<groupId>com.tykj</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.tykj.dev</groupId>
<artifactId>dev-readmachine</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>dev-readmachine</name>
<description>dev-readmachine</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-library</artifactId>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>rfid</artifactId>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>socket</artifactId>
</dependency>
<dependency>
<groupId>com.zebra</groupId>
<artifactId>sdk1</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/ModuleAPI_J.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.tykj.dev.readmachine.devreadmachine;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = {
"com.tykj.dev.*",
})
public class DevReadmachineApplication {
public static void main(String[] args) {
SpringApplication.run(DevReadmachineApplication.class, args);
}
}
package com.tykj.dev.readmachine.devreadmachine.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.*;
import java.util.Date;
/**
* @author zsp
* @create 2021/12/3 10:24
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update read_machine_bill set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("盘存账单")
public class ReadMachineBill {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ApiModelProperty(value = "盘存标题")
@Column(name = "title",columnDefinition = "TEXT")
private String title;
@CreatedBy
@ApiModelProperty(value = "创建用户id")
private Integer createUserId;
@ApiModelProperty(value = "操作单位的id")
private Integer createUnitId;
@ApiModelProperty(value = "删除标志位")
private Integer deleteTag = 0;
@CreatedDate
@ApiModelProperty(value = "创建时间")
private Date createTime;
@LastModifiedBy
@ApiModelProperty(value = "更新用户id")
private Integer updateUserId;
@ApiModelProperty(value = "入库的数量")
private Integer readNum;
@ApiModelProperty(value = "账单的状态",notes = "0 是草稿 1 是已完成")
private Integer status;
/**
* 更新时间
*/
@LastModifiedDate
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "任务id")
@Transient
private Integer taskId;
@ApiModelProperty(value = "操作人的名称")
@Transient
private String createUserName;
}
package com.tykj.dev.readmachine.devreadmachine.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
/**
* @author zsp
* @create 2021/12/3 10:24
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update read_machine_ip set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("读写机ip表")
public class ReadMachineIp {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ApiModelProperty(value = "ip")
private String ip;
@ApiModelProperty(value = "子网掩码")
private String mask;
@ApiModelProperty(value = "网关")
private String gateway;
@ApiModelProperty(value = "读写机名称")
private String readMachineName;
@ApiModelProperty(value = "删除标志位")
private Integer deleteTag = 0;
@ApiModelProperty(value = "老的ip")
private String oldIp;
}
package com.tykj.dev.readmachine.devreadmachine.Entity;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.misc.utils.SpringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
/**
* @author zsp
* @create 2021/12/3 10:24
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update read_machine_library set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("盘存账单")
public class ReadMachineLibrary {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ApiModelProperty(value = "型号")
private String model;
@ApiModelProperty(value = "删除标志位")
private Integer deleteTag = 0;
/**
* 密级
*/
@ApiModelProperty(value = "密级")
private Integer secretLevel;
/**
* 装备名称
*/
@ApiModelProperty(value = "装备名称")
private String name;
/**
* 装备序列号
*/
@ApiModelProperty(value = "装备序列号")
private String seqNumber;
/**
* rfid卡号
*/
@ApiModelProperty(value = "rfid卡号")
private String rfidCardId;
@ApiModelProperty(value = "readMachineId",example = "111")
private Integer readMachineId;
@ApiModelProperty(value = "存放位置id")
private Integer storageLocationId;
@ApiModelProperty(value = "存放位置名称")
private String storageLocation;
@ApiModelProperty(value = "状态",notes = "0 是草稿或者未入库 1是入库")
private Integer status;
@ApiModelProperty(value = "所在单位")
private String locationUnit;
/**
* 所属单位
*/
@ApiModelProperty(value = "所属单位")
private String ownUnit;
@ApiModelProperty(value = "生命状态")
private Integer lifeStatus;
@CreatedDate
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*/
@LastModifiedDate
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "生命状态")
@Transient
private String lifeStatusName;
public ReadMachineLibrary setConfigName(){
ConfigCache configCache = SpringUtils.getBean("initConfigCache");
if (configCache != null) {
setLifeStatusName(configCache.getLifeStatusMap().get(this.lifeStatus)==null?"-":configCache.getLifeStatusMap().get(this.lifeStatus));
}
return this;
}
}
package com.tykj.dev.readmachine.devreadmachine.Vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
* @create 2021/12/3 12:31
*/
@Data
@ApiModel("读取装备信息的vo")
public class ReadDeviceVo {
@ApiModelProperty(value = "装备RFID集合")
private List<String> rfids;
}
package com.tykj.dev.readmachine.devreadmachine.Vo;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
* @create 2021/12/3 12:31
*/
@Data
@ApiModel("保存草稿返回前端的vo")
public class SaveDefatVos {
@ApiModelProperty(value = "保存盘存库的vo的集合")
private List<ReadMachineLibrary> readMachineLibraries;
@ApiModelProperty(value = "任务id")
private Integer taskId;
@ApiModelProperty(value = "账单的id")
private Integer readMachineBillId;
}
package com.tykj.dev.readmachine.devreadmachine.Vo;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import java.util.Date;
/**
* @author zsp
* @create 2021/12/3 12:31
*/
@Data
@ApiModel("保存盘存库的vo")
public class SaveReadMachineVo {
@ApiModelProperty(value = "装备的id")
private Integer deviceId;
@ApiModelProperty(value = "装备的型号")
private String model;
@ApiModelProperty(value = "装备的名称")
private String name;
@ApiModelProperty(value = "装备的序列号")
private String seqNumber;
@ApiModelProperty(value = "rfid表面号")
private String rfidCardId;
@ApiModelProperty(value = "存放位置")
private Integer storageLocationId;
@ApiModelProperty(value = "存放位置名称")
private String storageLocation;
@ApiModelProperty(value = "状态",notes = "0 是草稿或者未入库 1是入库")
private Integer status = 0;
@ApiModelProperty(value = "所在单位")
private String locationUnit;
@ApiModelProperty(value = "生命状态")
private Integer lifeStatus;
/**
* 所属单位
*/
@ApiModelProperty(value = "所属单位")
private String ownUnit;
public ReadMachineLibrary toEntity(){
ReadMachineLibrary readMachineLibrary = new ReadMachineLibrary();
BeanUtils.copyProperties(this,readMachineLibrary);
return readMachineLibrary;
}
}
package com.tykj.dev.readmachine.devreadmachine.Vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
* @create 2021/12/3 12:31
*/
@Data
@ApiModel("保存盘存库的vos")
public class SaveReadMachineVos {
@ApiModelProperty(value = "保存盘存库的vo的集合")
private List<SaveReadMachineVo> saveReadMachineVo;
@ApiModelProperty(value = "任务id")
private Integer taskId;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "入库的数量")
private Integer readNum;
}
package com.tykj.dev.readmachine.devreadmachine.Vo;
import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author zsp
* @create 2021/12/3 11:22
*/
@Data
@ApiModel("查询账单vo")
public class SelectBillVo extends CustomPage {
@ApiModelProperty(value = "开始时间")
private Date startTime;
@ApiModelProperty(value = "结束时间")
private Date endTime;
// @ApiModelProperty(value = "当前登录的单位id")
// private Integer unitId;
}
package com.tykj.dev.readmachine.devreadmachine.controller;
import cn.hutool.core.util.ObjectUtil;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.user.cache.UserCache;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.utils.*;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineBill;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineLibrary;
import com.tykj.dev.readmachine.devreadmachine.Vo.*;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineBillService;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineIpService;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineLibraryService;
import com.tykj.dev.readmachine.devreadmachine.socket.ReadWebSocket;
import com.tykj.dev.readmachine.devreadmachine.toBack.BackReadDetailVo;
import com.tykj.dev.readmachine.devreadmachine.util.ReadUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zsp
* @create 2021/12/3 10:59
*/
@RestController
@RequestMapping(value = "/readMachine")
@AutoDocument
@Api(tags = "盘存模块", description = "盘存接口")
@Validated
@Slf4j
public class ReadMachineBillController {
@Autowired
private ReadMachineBillService readMachineBillService;
@Resource
private DeviceLibraryService deviceLibraryService;
@Resource
private ReadWebSocket readWebSocket;
@Resource
private UserCache userCache;
@Autowired
private ReadMachineIpService readMachineIpService;
@Autowired
private ReadMachineLibraryService readMachineLibraryService;
private List<String> RFIDS = new ArrayList<>();
private List<String> existRFIDS = new ArrayList<>();
private List<String> notExistRFIDS = new ArrayList<>();
public static Boolean localFlag = false;
private List<DeviceLibrary> deviceLibraries = new ArrayList<>();
@Autowired
private TaskService taskService;
// static{
// //增加一个全局变量,只要加载过这个so就不再执行,除非进程重启才会清掉该变量。
// if(System.getProperty("myapplibrary")==null){
// log.info("myapplibrary:{}",System.getProperty("myapplibrary"));
// System.setProperty("myapplibrary", "libModuleAPIJni.so");
//// System.loadLibrary("libModuleAPIJni");
// System.load("/usr/lib/libModuleAPIJni.so");
// }
// }
@ApiOperation(value = "保存盘存接口", notes = "保存盘存接口")
@PostMapping(value = "/addReadMachineBill")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<String> addReadMachineBill(@RequestBody SaveReadMachineVos saveReadMachineVos) {
readMachineBillService.saveReadMachineBill(saveReadMachineVos);
return ResponseEntity.ok("保存成功");
}
@ApiOperation(value = "保存盘存草稿接口", notes = "保存盘存草稿接口")
@PostMapping(value = "/saveReadMachineBillForDraft")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<String> saveReadMachineBillForDraft(@RequestBody SaveReadMachineVos saveReadMachineVos) {
readMachineBillService.saveReadMachineBillForDraft(saveReadMachineVos);
return ResponseEntity.ok("保存草稿成功");
}
@ApiOperation(value = "查询账单的接口", notes = "查询账单的接口")
@PostMapping(value = "/findAllBySpec")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<Page<ReadMachineBill>> findAllBySpec(@RequestBody SelectBillVo selectBillVo) {
List<ReadMachineBill> spec = readMachineBillService.findAllBySpec(selectBillVo);
spec.forEach(readMachineBill -> {
readMachineBill.setCreateUserName(
userCache.findById(readMachineBill.getCreateUserId()).getName());
readMachineBill.setTaskId(taskService.get(readMachineBill.getId(), BusinessEnum.READMACHINE.id).getId());
});
Page<ReadMachineBill> perPage = PageUtil.getPerPage(selectBillVo.getPage(), selectBillVo.getSize(),spec, selectBillVo.getPageable());
return ResponseEntity.ok(perPage);
}
@ApiOperation(value = "读取装备信息对比的接口", notes = "读取装备信息对比的接口")
@GetMapping(value = "/compareDeviceDetail")
@Transactional(rollbackFor = Exception.class)
public void readDeviceDetail(Boolean flag) {
if (flag) {
if (!localFlag) {
localFlag = true;
startDeviceDetail();
}
} else {
localFlag = false;
}
}
@ApiOperation(value = "查询详情接口", notes = "查询详情接口")
@GetMapping(value = "/readDetail")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<BackReadDetailVo> readDetail(Integer billId) {
BackReadDetailVo backReadDetailVo = new BackReadDetailVo();
ReadMachineBill readMachineBill = readMachineBillService.findById(billId);
List<ReadMachineLibrary> readMachineLibraryList =
readMachineLibraryService.findByReadMachineBillId(readMachineBill.getId());
readMachineLibraryList.forEach(ReadMachineLibrary::setConfigName);
backReadDetailVo.setReadNum(readMachineBill.getReadNum());
backReadDetailVo.setReadMachineLibraries(readMachineLibraryList);
backReadDetailVo.setCreateUserName(userCache.findById(readMachineBill.getCreateUserId()).getName());
return ResponseEntity.ok(backReadDetailVo);
}
@ApiOperation(value = "读取ISO放置的位置", notes = "读取ISO放置的位置")
@GetMapping(value = "/receiveString")
public ResponseEntity<String> receiveString() {
return ResponseEntity.ok(System.getProperty("java.library.path"));
}
@ApiOperation(value = "任务不保存", notes = "任务不保存")
@PostMapping(value = "/notSaveTask")
public ResponseEntity<String> notSaveTask(@RequestBody SaveDefatVos saveDefatVos) {
readMachineBillService.deleteReadMachineBillForDraft(saveDefatVos);
return ResponseEntity.ok("任务已取消");
}
/**
* 读取装备信息
*/
public List<DeviceLibrary> startDeviceDetail(){
ReadUtils readUtils = new ReadUtils();
//先获取ip1
//TODO 后续考虑做成ip的选择,目前先写死
String ip = readMachineIpService.findById(1).getIp();
//先开启
readUtils.testinitreader(ip);
while (localFlag){
//开始盘存
List<String> rfids = readUtils.testinventory1();
log.info("rfid's:{}",rfids);
RFIDS.clear();
RFIDS.addAll(rfids);
List<DeviceLibrary> deviceLibraryList = deviceLibraryService.findAllByRfids(RFIDS);
List<String> existRfids =
deviceLibraryList.stream().map(DeviceLibrary::getRfidCardId).collect(Collectors.toList());
existRFIDS.clear();
existRFIDS.addAll(existRfids);
RFIDS.removeAll(existRFIDS);
notExistRFIDS.clear();
notExistRFIDS.addAll(RFIDS);
if (!notExistRFIDS.isEmpty()){
notExistRFIDS.forEach(s -> readWebSocket.sendMessageForReadMachineError(s));
}
deviceLibraries.clear();
deviceLibraries.addAll(deviceLibraryList);
log.info("deviceLibraries:{}",deviceLibraries.size());
if (!deviceLibraries.isEmpty()){
deviceLibraries.forEach(deviceLibrary -> {
if (ObjectUtil.isNotNull(deviceLibrary)){
deviceLibrary.setConfigName();
readWebSocket.sendMessageForReadMachine(deviceLibrary);
}
});
}
}
return deviceLibraries;
}
}
package com.tykj.dev.readmachine.devreadmachine.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineIp;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineIpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zsp
* @create 2021/12/3 10:59
*/
@RestController
@RequestMapping(value = "/readIp")
@AutoDocument
@Api(tags = "修改ip", description = "修改ip")
@Slf4j
public class ReadMachineIpController {
@Autowired
private ReadMachineIpService readMachineIpService;
@ApiOperation(value = "修改ip的接口", notes = "修改ip的接口")
@PostMapping(value = "/updateIp")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<ReadMachineIp> updateIp(@RequestBody ReadMachineIp readMachineIp) {
ReadMachineIp readMachineIp1 = readMachineIpService.updateIp(readMachineIp);
return ResponseEntity.ok(readMachineIp1);
}
@ApiOperation(value = "新增ip接口", notes = "新增ip接口")
@PostMapping(value = "/addIp")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<String> addIp(@RequestBody ReadMachineIp readMachineIp) {
//先判断名称是否存在
List<String> names =
readMachineIpService.findAll().stream().map(ReadMachineIp::getReadMachineName).collect(Collectors.toList());
if (!names.isEmpty()){
if (names.contains(readMachineIp.getReadMachineName())){
throw new ApiException("该名称已经存在,请更换名称");
}
}
readMachineIpService.addIp(readMachineIp);
return ResponseEntity.ok("新增ip成功");
}
@ApiOperation(value = "查询ip列表", notes = "查询ip列表")
@PostMapping(value = "/findAllIp")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<List<ReadMachineIp>> findAllIp() {
List<ReadMachineIp> readMachineIpList = readMachineIpService.findAll();
return ResponseEntity.ok(readMachineIpList);
}
@ApiOperation(value = "选中要使用的读写机", notes = "选中要使用的读写机")
@GetMapping(value = "/selectIp")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<ReadMachineIp> selectIp(Integer id) {
ReadMachineIp readMachineIp = readMachineIpService.findById(id);
return ResponseEntity.ok(readMachineIp);
}
}
package com.tykj.dev.rfid.controller;
package com.tykj.dev.readmachine.devreadmachine.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.rfid.timeTask.ReadUtils;
import com.tykj.dev.readmachine.devreadmachine.Vo.SaveReadMachineVos;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineBillService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author zsp
* @create 2021/12/2 10:39
* @create 2021/12/3 10:59
*/
@RestController
@Api(tags = "读写机模块", description = "读写机模块")
@RequestMapping(value = "/readMachineLibrary")
@AutoDocument
@RequestMapping("/readMachine")
@Api(tags = "盘存库模块", description = "盘存库接口")
@Slf4j
public class ReadController {
public class ReadMachineLibraryController {
@Resource
private ReadMachineBillService readMachineBillService;
@PostMapping("/startReadMachine")
@ApiOperation(value = "开始扫描读写机")
public ResponseEntity startReadMachine(){
ReadUtils readUtils = new ReadUtils();
//先开启
readUtils.testinitreader();
//开始盘存
readUtils.testinventory1();
//关闭
readUtils.getJreader().CloseReader();
return ResponseEntity.ok("读写成功");
}
}
package com.tykj.dev.readmachine.devreadmachine.repository;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineBill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
/**
* @author zsp
* @create 2021/12/3 10:52
*/
public interface ReadMachineBillDao extends JpaRepository<ReadMachineBill,Integer>, JpaSpecificationExecutor<ReadMachineBill> {
}
package com.tykj.dev.readmachine.devreadmachine.repository;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineIp;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineLibrary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author zsp
* @create 2021/12/3 10:52
*/
public interface ReadMachineIpDao extends JpaRepository<ReadMachineIp,Integer>, JpaSpecificationExecutor<ReadMachineIp> {
}
package com.tykj.dev.readmachine.devreadmachine.repository;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineBill;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineLibrary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author zsp
* @create 2021/12/3 10:52
*/
public interface ReadMachineLibraryDao extends JpaRepository<ReadMachineLibrary,Integer>, JpaSpecificationExecutor<ReadMachineLibrary> {
List<ReadMachineLibrary> findAllByReadMachineId(Integer readMachineId);
}
package com.tykj.dev.readmachine.devreadmachine.service;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineBill;
import com.tykj.dev.readmachine.devreadmachine.Vo.SaveDefatVos;
import com.tykj.dev.readmachine.devreadmachine.Vo.SaveReadMachineVo;
import com.tykj.dev.readmachine.devreadmachine.Vo.SaveReadMachineVos;
import com.tykj.dev.readmachine.devreadmachine.Vo.SelectBillVo;
import java.util.List;
/**
* @author zsp
* @create 2021/12/3 10:59
*/
public interface ReadMachineBillService {
/**
* 新增读写盘存账单
* @param readMachineBill 账单实体
* @return 账单实体
*/
ReadMachineBill addEntity(ReadMachineBill readMachineBill);
/**
* 根据id查询账单
* @param id 账单id
* @return 账单实体
*/
ReadMachineBill findById(Integer id);
/**
* 更新实体
* @param readMachineBill 需要修改账单的实体
* @return 更新后的实体
*/
ReadMachineBill updateEntity(ReadMachineBill readMachineBill);
void deleteEntity(Integer id);
/**
* 条件查询
* @param selectBillVo 查询条件的vo
* @return 账单实体的集合
*/
List<ReadMachineBill> findAllBySpec(SelectBillVo selectBillVo);
/**
* 开始盘点s
* @param saveReadMachineVos 盘点的vo
* @return 账单实体
*/
ReadMachineBill saveReadMachineBill(SaveReadMachineVos saveReadMachineVos);
/**
* 保存草稿
* @param saveReadMachineVos 盘点的vos
* @return 账单实体
*/
SaveDefatVos saveReadMachineBillForDraft(SaveReadMachineVos saveReadMachineVos);
/**
* 删除草稿
* @param saveDefatVos saveDefatVos
*/
void deleteReadMachineBillForDraft(SaveDefatVos saveDefatVos);
}
package com.tykj.dev.readmachine.devreadmachine.service;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineIp;
import java.util.List;
/**
* @author zsp
* @create 2021/12/3 10:59
*/
public interface ReadMachineIpService {
/**
* add
* @param machineIp addIp
*/
void addIp(ReadMachineIp machineIp);
/**
* update
* @param machineIp updateIp
*/
ReadMachineIp updateIp(ReadMachineIp machineIp);
/**
* 根据id查询
*/
ReadMachineIp findById(Integer id);
/**
* 查询全部
*/
List<ReadMachineIp> findAll();
void deleteById(Integer id);
ReadMachineIp findByName(String name);
}
package com.tykj.dev.readmachine.devreadmachine.service;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineLibrary;
import java.util.List;
/**
* @author zsp
* @create 2021/12/3 10:59
*/
public interface ReadMachineLibraryService {
/**
* 新增盘存库
* @param readMachineLibrary 盘存库实体
* @return 盘存库实体
*/
ReadMachineLibrary addEntity(ReadMachineLibrary readMachineLibrary);
void batchDeleteEntity(List<ReadMachineLibrary> readMachineLibraries);
/**
* 根据账单id查询盘存库
* @param readMachineBillId 账单id
* @return 盘存库的集合
*/
List<ReadMachineLibrary> findByReadMachineBillId(Integer readMachineBillId);
/**
* 保存全部
* @param readMachineLibraries 全部的实体
*/
void saveAll(List<ReadMachineLibrary> readMachineLibraries);
/**
* 批量更新
*/
void batchUpdate(List<ReadMachineLibrary> readMachineLibraries);
}
package com.tykj.dev.readmachine.devreadmachine.service.impl;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.library.repository.DeviceLibraryPositionDao;
import com.tykj.dev.device.library.service.DeviceLibraryPositionService;
import com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition;
import com.tykj.dev.device.user.util.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
* @author zsp
* @create 2021/12/13 16:23
*/
@Service
public class DeviceLibraryPositionServiceImpl implements DeviceLibraryPositionService {
@Autowired
private UserUtils userUtils;
@Autowired
private DeviceLibraryPositionDao deviceLibraryPositionDao;
@Override
public void addDeviceLibraryPosition(DeviceLibraryPosition deviceLibraryPosition) {
deviceLibraryPositionDao.save(deviceLibraryPosition);
}
@Override
public void updateDeviceLibraryPosition(DeviceLibraryPosition deviceLibraryPosition) {
deviceLibraryPositionDao.save(deviceLibraryPosition);
}
@Override
public void batchDeviceLibraryPositions(List<DeviceLibraryPosition> deviceLibraryPositions) {
deviceLibraryPositionDao.saveAll(deviceLibraryPositions);
}
@Override
public List<DeviceLibraryPosition> findByStorageLocationId(Integer StorageLocationId) {
return deviceLibraryPositionDao.findAllByStorageLocationId(StorageLocationId);
}
@Override
public DeviceLibraryPosition findById(Integer id) {
DeviceLibraryPosition deviceLibraryPosition = new DeviceLibraryPosition();
Optional<DeviceLibraryPosition> positionDaoById = deviceLibraryPositionDao.findById(id);
if(positionDaoById.isPresent()){
deviceLibraryPosition = positionDaoById.get();
}
return deviceLibraryPosition;
}
@Override
public void deleteByPosition(Integer id) {
deviceLibraryPositionDao.deleteById(id);
}
}
package com.tykj.dev.readmachine.devreadmachine.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.DeviceSeqUtil;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineBill;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineLibrary;
import com.tykj.dev.readmachine.devreadmachine.Vo.SaveDefatVos;
import com.tykj.dev.readmachine.devreadmachine.Vo.SaveReadMachineVo;
import com.tykj.dev.readmachine.devreadmachine.Vo.SaveReadMachineVos;
import com.tykj.dev.readmachine.devreadmachine.Vo.SelectBillVo;
import com.tykj.dev.readmachine.devreadmachine.repository.ReadMachineBillDao;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineBillService;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineLibraryService;
import com.tykj.dev.readmachine.devreadmachine.util.BeanDtoVoUtils;
import com.tykj.dev.socket.MyWebSocket;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* @author zsp
* @create 2021/12/3 11:00
*/
@Service
@Slf4j
public class ReadMachineBillServiceImpl implements ReadMachineBillService {
@Autowired
private ReadMachineBillDao readMachineBillDao;
@Resource
private UserUtils userUtils;
@Autowired
private ReadMachineLibraryService readMachineLibraryService;
@Resource
private TaskService taskService;
@Resource
private MyWebSocket myWebSocket;
@Resource
private DeviceLibraryService deviceLibraryService;
@Override
public ReadMachineBill addEntity(ReadMachineBill readMachineBill) {
return readMachineBillDao.save(readMachineBill);
}
@Override
public ReadMachineBill findById(Integer id) {
Optional<ReadMachineBill> byId = readMachineBillDao.findById(id);
ReadMachineBill readMachineBill = new ReadMachineBill();
if (byId.isPresent()){
readMachineBill = byId.get();
}
return readMachineBill;
}
@Override
public ReadMachineBill updateEntity(ReadMachineBill readMachineBill) {
return readMachineBillDao.save(readMachineBill);
}
@Override
public void deleteEntity(Integer id) {
readMachineBillDao.deleteById(id);
}
@Override
public List<ReadMachineBill> findAllBySpec(SelectBillVo selectBillVo) {
PredicateBuilder<ReadMachineBill> predicateBuilder = getPredicateBuilder(selectBillVo);
//查询当前登录的单位id
predicateBuilder.eq("createUnitId",userUtils.getCurrentUnitId());
return readMachineBillDao.findAll(predicateBuilder.build());
}
@Override
public ReadMachineBill saveReadMachineBill(SaveReadMachineVos saveReadMachineVos) {
//构建task涉及人员集合
List<Integer> userIds = new ArrayList<>();
userIds.add(userUtils.getCurrentUserId());
userIds.add(0);
List<ReadMachineLibrary> readMachineLibraries = new ArrayList<>();
//保存后的账单实体
ReadMachineBill readMachineBill1 = null;
TaskBto start;
if (ObjectUtil.isNotNull(saveReadMachineVos)){
//判断是不是从草稿进来的
if(saveReadMachineVos.getTaskId()!=null){
//说明是从草稿进来的
start = taskService.get(saveReadMachineVos.getTaskId());
readMachineLibraries =
readMachineLibraryService.findByReadMachineBillId(start.getBillId());
ReadMachineBill readMachineBill = findById(start.getBillId());
readMachineBill.setStatus(1);
readMachineBill1 = updateEntity(readMachineBill);
}else {
List<SaveReadMachineVo> saveReadMachineVo = saveReadMachineVos.getSaveReadMachineVo();
ReadMachineBill readMachineBill = new ReadMachineBill();
readMachineBill.setTitle(saveReadMachineVos.getTitle());
readMachineBill.setReadNum(saveReadMachineVos.getReadNum());
readMachineBill.setStatus(1);
readMachineBill1 = addEntity(readMachineBill);
String content = "完结盘存盘点任务";
TaskBto taskBto = new TaskBto(StatusEnum.READ_DEAFT.id,content,".",readMachineBill1.getId(),
BusinessEnum.READMACHINE.id, userUtils.getCurrentUnitId(),0,userIds);
start = taskService.start(taskBto);
readMachineBill1.setTaskId(start.getId());
if (!saveReadMachineVo.isEmpty()){
for (SaveReadMachineVo readMachineVo : saveReadMachineVo) {
ReadMachineLibrary readMachineLibrary = readMachineVo.toEntity();
readMachineLibrary.setReadMachineId(readMachineBill1.getId());
readMachineLibraries.add(readMachineLibrary);
}
}
}
//做异步保存
List<ReadMachineLibrary> finalReadMachineLibraries = readMachineLibraries;
CompletableFuture.runAsync(()->readMachineLibraryService.saveAll(finalReadMachineLibraries));
taskService.moveToEnd(start);
assert readMachineBill1 != null;
readMachineBill1.setCreateUnitId(userUtils.getCurrentUnitId());
readMachineBill1= updateEntity(readMachineBill1);
}
return readMachineBill1;
}
@Override
public SaveDefatVos saveReadMachineBillForDraft(SaveReadMachineVos saveReadMachineVos) {
SaveDefatVos saveDefatVos = new SaveDefatVos();
List<ReadMachineLibrary> readMachineLibraries = new ArrayList<>();
if (saveReadMachineVos.getTaskId() == null){
//第一次保存
//构建task涉及人员集合
List<Integer> userIds = new ArrayList<>();
userIds.add(userUtils.getCurrentUserId());
userIds.add(0);
ReadMachineBill readMachineBill1 = null;
TaskBto start;
if (ObjectUtil.isNotNull(saveReadMachineVos)){
List<SaveReadMachineVo> saveReadMachineVo = saveReadMachineVos.getSaveReadMachineVo();
ReadMachineBill readMachineBill = new ReadMachineBill();
readMachineBill.setTitle(saveReadMachineVos.getTitle());
readMachineBill.setReadNum(saveReadMachineVos.getReadNum());
readMachineBill.setCreateUnitId(userUtils.getCurrentUnitId());
readMachineBill.setStatus(0);
readMachineBill1 = addEntity(readMachineBill);
//保存草稿
String content = "保存盘存草稿";
TaskBto taskBto = new TaskBto(StatusEnum.READ_DEAFT.id,content,".",readMachineBill1.getId(),
BusinessEnum.READMACHINE.id, userUtils.getCurrentUnitId(),0,userIds);
start= taskService.start(taskBto);
readMachineBill1.setTaskId(start.getId());
if (!saveReadMachineVo.isEmpty()){
for (SaveReadMachineVo readMachineVo : saveReadMachineVo) {
ReadMachineLibrary readMachineLibrary = readMachineVo.toEntity();
readMachineLibrary.setReadMachineId(readMachineBill1.getId());
readMachineLibraries.add(readMachineLibrary);
}
}
saveDefatVos.setTaskId(start.getId());
saveDefatVos.setReadMachineLibraries(readMachineLibraries);
saveDefatVos.setReadMachineBillId(readMachineBill1.getId());
}
}else {
//更新 账单和库存
TaskBto taskBto = taskService.get(saveReadMachineVos.getTaskId());
ReadMachineBill readMachineBill = findById(taskBto.getBillId());
readMachineBill.setReadNum(saveReadMachineVos.getReadNum());
readMachineBill.setStatus(0);
updateEntity(readMachineBill);
List<ReadMachineLibrary> saveReadMachineVo =
readMachineLibraryService.findByReadMachineBillId(taskBto.getBillId());
if (!saveReadMachineVo.isEmpty()){
// saveReadMachineVo.forEach(saveReadMachineVo1 -> {
// ReadMachineLibrary readMachineLibrary = new ReadMachineLibrary();
// BeanUtils.copyProperties(saveReadMachineVo1,readMachineLibrary);
// readMachineLibraries.add(readMachineLibrary);
// });
readMachineLibraries.addAll(Objects.requireNonNull(BeanDtoVoUtils.listVo(saveReadMachineVo,
ReadMachineLibrary.class)));
}
saveDefatVos.setTaskId(taskBto.getId());
saveDefatVos.setReadMachineLibraries(readMachineLibraries);
saveDefatVos.setReadMachineBillId(taskBto.getBillId());
}
//做异步保存
CompletableFuture.runAsync(()->readMachineLibraryService.batchUpdate(readMachineLibraries));
return saveDefatVos;
}
@Override
public void deleteReadMachineBillForDraft(SaveDefatVos saveDefatVos) {
Integer taskId = saveDefatVos.getTaskId();
taskService.deleteById(taskId);
//账单也删除
deleteEntity(saveDefatVos.getReadMachineBillId());
//库存也删除
CompletableFuture.runAsync(()->readMachineLibraryService.batchDeleteEntity(saveDefatVos.getReadMachineLibraries()));
}
/**
* 构建条件插叙构造器
* @param selectBillVo 条件查询构造器
* @return
*/
private PredicateBuilder<ReadMachineBill> getPredicateBuilder(SelectBillVo selectBillVo) {
PredicateBuilder<ReadMachineBill> predicateBuilder = Specifications.and();
//根据操作时间查询
predicateBuilder.ge(selectBillVo.getStartTime()!= null,"createTime", selectBillVo.getStartTime());
predicateBuilder.le(selectBillVo.getEndTime()!= null,"createTime", selectBillVo.getEndTime());
return predicateBuilder;
}
}
package com.tykj.dev.readmachine.devreadmachine.service.impl;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineIp;
import com.tykj.dev.readmachine.devreadmachine.repository.ReadMachineIpDao;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineIpService;
import com.tykj.dev.readmachine.devreadmachine.util.ReadUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Optional;
/**
* @author zsp
* @create 2021/12/14 13:18
*/
@Service
@Slf4j
public class ReadMachineIpServiceImpl implements ReadMachineIpService {
@Autowired
private ReadMachineIpDao readMachineIpDao;
@Override
public void addIp(ReadMachineIp machineIp) {
readMachineIpDao.save(machineIp);
}
@Override
public ReadMachineIp updateIp(ReadMachineIp machineIp) {
ReadUtils readUtils = new ReadUtils();
readUtils.testinitreader(machineIp.getOldIp());
try {
readUtils.testsetip(machineIp.getIp(),machineIp.getMask(), machineIp.getGateway());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
System.out.println("e = " + e);
}
log.info("读写机ip修改成功");
machineIp.setOldIp(machineIp.getIp());
return readMachineIpDao.save(machineIp);
}
@Override
public ReadMachineIp findById(Integer id) {
Optional<ReadMachineIp> re = readMachineIpDao.findById(id);
ReadMachineIp readMachineIp = new ReadMachineIp();
if (re.isPresent()){
readMachineIp = re.get();
}
return readMachineIp;
}
@Override
public List<ReadMachineIp> findAll() {
return readMachineIpDao.findAll();
}
@Override
public void deleteById(Integer id) {
readMachineIpDao.deleteById(id);
}
@Override
public ReadMachineIp findByName(String name) {
return null;
}
}
package com.tykj.dev.readmachine.devreadmachine.service.impl;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineLibrary;
import com.tykj.dev.readmachine.devreadmachine.repository.ReadMachineLibraryDao;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineLibraryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author zsp
* @create 2021/12/3 11:00
*/
@Service
public class ReadMachineLibraryServiceImpl implements ReadMachineLibraryService {
@Autowired
private ReadMachineLibraryDao readMachineLibraryDao;
/**
* 新增盘存库
*
* @param readMachineLibrary 盘存库实体
* @return 盘存库实体
*/
@Override
public ReadMachineLibrary addEntity(ReadMachineLibrary readMachineLibrary) {
return readMachineLibraryDao.save(readMachineLibrary);
}
@Override
public void batchDeleteEntity(List<ReadMachineLibrary> readMachineLibraries) {
readMachineLibraryDao.deleteAll(readMachineLibraries);
}
/**
* 根据账单id查询盘存库
*
* @param readMachineBillId 账单id
* @return 盘存库的集合
*/
@Override
public List<ReadMachineLibrary> findByReadMachineBillId(Integer readMachineBillId) {
return readMachineLibraryDao.findAllByReadMachineId(readMachineBillId);
}
/**
* 保存全部
*
* @param readMachineLibraries 全部的实体
*/
@Override
public void saveAll(List<ReadMachineLibrary> readMachineLibraries) {
readMachineLibraryDao.saveAll(readMachineLibraries);
}
@Override
public void batchUpdate(List<ReadMachineLibrary> readMachineLibraries) {
readMachineLibraryDao.saveAll(readMachineLibraries);
}
}
package com.tykj.dev.readmachine.devreadmachine.socket;
/**
* @author zjm
* @version 1.0.0
* @ClassName Message.java
* @Description TODO
* @createTime 2020年08月23日 12:30:00
*/
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Message {
private Integer isRequest;
}
package com.tykj.dev.readmachine.devreadmachine.socket;
/**
* zsp
*/
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class MessageError {
private String rfid;
private String message;
}
package com.tykj.dev.readmachine.devreadmachine.socket;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.tykj.dev.readmachine.devreadmachine.controller.ReadMachineBillController;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author zjm
* @version 1.0.0
* @ClassName MyWebSocket.java
* @Description TODO
* @createTime 2020年08月19日 23:53:00
*/
@Slf4j
@ServerEndpoint(value = "/websocket/{userId}") //接受websocket请求路径
@Component //注册到spring容器中
@Data
public class ReadWebSocket {
/**
* concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
*/
private static ConcurrentHashMap<String, ReadWebSocket> webSocketMap = new ConcurrentHashMap<>();
/**
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
*/
private Session session;
/**
* 接收userId
*/
private String userId;
/**
* 发送自定义消息
*/
public static void sendInfo(String message, String userId) throws IOException {
log.info("发送消息到:" + userId + ",报文:" + message);
if (StringUtils.isNotBlank(userId) && webSocketMap.containsKey(userId)) {
webSocketMap.get(userId).sendMessage(message);
} else {
log.error("用户" + userId + ",不在线!");
}
}
/**
* 连接建立成功调用的方法
*/
@OnOpen
public void onOpen(Session session, @PathParam("userId") String userId) {
this.session = session;
this.userId = userId;
if (webSocketMap.containsKey(userId)) {
webSocketMap.remove(userId);
webSocketMap.put(userId, this);
//加入set中
} else {
webSocketMap.put(userId, this);
//加入set中
//在线数加1
}
log.info("用户连接:" + userId + ",当前在线人数为:" + webSocketMap.size());
sendMessage("连接成功");
}
/**
* 连接关闭调用的方法
*/
@OnClose
public void onClose() {
//从set中删除
webSocketMap.remove(userId);
if (webSocketMap.size() == 0){
ReadMachineBillController.localFlag= false;
}
log.info("用户退出:" + userId + ",当前在线人数为:" + webSocketMap.size());
}
public void Close(String userId) {
//从set中删除
webSocketMap.remove(userId);
log.info("用户退出:" + userId + ",当前在线人数为:" + webSocketMap.size());
}
public ReadWebSocket getMap(String userId) {
ReadWebSocket myWebSocket = webSocketMap.get(userId);
log.info("用户退出:" + userId + ",当前在线人数为:" + webSocketMap.size());
return myWebSocket;
}
/**
* 收到客户端消息后调用的方法
* @param message 客户端发送过来的消息
*/
@OnMessage
public void onMessage(String message, Session session) {
log.info("用户消息:" + userId + ",报文:" + message);
//可以群发消息
//消息保存到数据库、redis
if (StringUtils.isNotBlank(message)) {
try {
//解析发送的报文
JSONObject jsonObject = JSON.parseObject(message);
//追加发送人(防止串改)
jsonObject.put("fromUserId", this.userId);
String toUserId = jsonObject.getString("toUserId");
//传送给对应toUserId用户的websocket
if (StringUtils.isNotBlank(toUserId) && webSocketMap.containsKey(toUserId)) {
webSocketMap.get(toUserId).sendMessage(jsonObject.toJSONString());
} else {
log.error("请求的userId:" + toUserId + "不在该服务器上");
//否则不在这个服务器上,发送到mysql或者redis
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* @param session
* @param error
*/
@OnError
public void onError(Session session, Throwable error) {
log.error("用户错误:" + this.userId + ",原因:" + error.getMessage());
error.printStackTrace();
}
/**
* 实现服务器主动推送
*/
public void sendMessage(String message) {
try {
this.session.getBasicRemote().sendText(JSONObject.toJSONString(new Message(1)));
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 实现服务器主动推送
*/
public void sendMessage2(Object o) {
try {
this.session.getBasicRemote().sendText(JSONObject.toJSONString(o));
} catch (IOException e) {
e.printStackTrace();
}
}
public void sendMessage1() {
for (String i : webSocketMap.keySet()) {
webSocketMap.get(i).sendMessage("1");
}
}
public void sendMessageForReadMachine(Object o) {
for (String i : webSocketMap.keySet()) {
webSocketMap.get(i).sendMessage2(o);
}
}
public void sendMessageForReadMachine1(Object o,Integer userId) {
webSocketMap.get(String.valueOf(userId)).sendMessage2(o);
}
public void sendMessageForReadMachineError(String rfid) {
for (String i : webSocketMap.keySet()) {
webSocketMap.get(i).sendMessage2(new MessageError(rfid,"该RFID为:"+rfid+"设备查询不到"));
}
}
/**
* 判断是否断开连接,断开返回true,没有返回false
* @param socket
* @return
*/
// public Boolean isServerClose(Socket socket){
// try{
// socket.sendUrgentData(0xFF);//发送1个字节的紧急数据,默认情况下,服务器端没有开启紧急数据处理,不影响正常通信
// return false;
// }catch(Exception se){
// return true;
// }
// }
}
package com.tykj.dev.readmachine.devreadmachine.toBack;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
* @create 2021/12/7 9:24
*/
@Data
@ApiModel("详情的返回vo")
public class BackReadDetailVo {
@ApiModelProperty(value = "本次盘存的盘存库")
private List<ReadMachineLibrary> readMachineLibraries;
@ApiModelProperty(value = "操作人")
private String createUserName;
@ApiModelProperty(value = "本次盘存的数量")
private Integer readNum;
}
package com.tykj.dev.readmachine.devreadmachine.util;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zsp
* @create 2021/12/7 10:15
*/
public class BeanDtoVoUtils {
/**
* TODO dot ,Do ,entity 相互转换
* 同:BeanUtils.copyProperties(dtoEntity, newInstance);
*
* @param oldClass 原数据--Dto,Vo,entity
* @param newClass 转换为--Dto,Vo,entity
* @return
*/
public static <E> E convert(Object oldClass, Class<E> newClass) {
// 判断oldClass 是否为空!
if (oldClass == null) {
return null;
}
// 判断newClass 是否为空
if (newClass == null) {
return null;
}
try {
// 创建新的对象实例
E newInstance = newClass.newInstance();
// 把原对象数据拷贝到新的对象
BeanUtils.copyProperties(oldClass, newInstance);
// 返回新对象
return newInstance;
} catch (Exception e) {
return null;
}
}
//TODO Page<Entity> 分页对象转 Page<Vo> ( list 循环)
public static <T, V> Page<V> pageVo(Page<T> page, Class<V> v) {
try {
List<T> tList = page.getContent();
List<V> voList = new ArrayList<>();
for (T t : tList) {
V newv = (V) BeanDtoVoUtils.convert(t, v.newInstance().getClass());
voList.add(newv);
}
Page<V> vs = new PageImpl<>(voList, page.getPageable(), page.getTotalElements());
return vs;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
//TODO Page<Entity> 分页对象转 Page<Vo> (Stream 方式)
public static <T, V> Page<V> pageVoStream(Page<T> page, Class<V> v) {
List<V> voList = page.getContent().stream().map(item -> {
try {
return (V) BeanDtoVoUtils.convert(item, v.newInstance().getClass());
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return null;
}).collect(Collectors.toList());
Page<V> vs = new PageImpl<>(voList, page.getPageable(), page.getTotalElements());
return vs;
}
//TODO list<Entity> 集合对象转list<Vo> ( list 循环)
public static <T, V> List<V> listVo(List<T> oldList, Class<V> v) {
try {
List<V> voList = new ArrayList<>();
for (T t : oldList) {
V newv = (V) BeanDtoVoUtils.convert(t, v.newInstance().getClass());
voList.add(newv);
}
return voList;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
//TODO list<Entity> 集合对象转list<Vo> (Stream 方式)
public static <T, V> List<V> listVoStream(List<T> oldList, Class<V> v) {
List<V> voList = oldList.stream().map(item -> {
try {
return (V) BeanDtoVoUtils.convert(item, v.newInstance().getClass());
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return null;
}).collect(Collectors.toList());
return voList;
}
}
package com.tykj.dev.readmachine.devreadmachine.util;
import com.uhf.api.cls.Reader;
import com.uhf.api.cls.Reader.*;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@Data
@Slf4j
public class ReadUtils {
/**
* @param args
*/
int AntCount=1;
//公司测试网段ip
// String ReaderAddr="192.168.101.201";
//公司测试读写机实验室ip
// String ReaderAddr="192.168.0.201";
//公司正式读写机实验室ip
String ReaderAddr;
Reader Jreader;
public ReadUtils(){
Jreader=new Reader();
}
public void testtran(){
byte[] hex=new byte[]{(byte) 0xA2,(byte) 0xC8,(byte) 0xD4,(byte) 0xE5};
int len=4;
char[] str=new char[4*2];
Jreader.Hex2Str(hex, len, str);
String hstr = "";
for(int i=0;i<8;i++)
hstr+=(char)str[i];
System.out.println("test tohexstr:"+hstr);
String buf="0011110000001111";
byte[] binarybuf=new byte[2];
String buf2="abcdef08";
byte[] hexbuf=new byte[4];
Jreader.Str2Binary(buf, buf.length(), binarybuf);
System.out.println("test binary:");
for(int i=0;i<binarybuf.length;i++)
System.out.println(binarybuf[i]);
Jreader.Str2Hex(buf2, 8, hexbuf);
System.out.println("test hex:");
for(int i=0;i<hexbuf.length;i++)
System.out.println(hexbuf[i]);
}
public void testpsam(){
int soltid=1;
int coslen=2;
byte[] cos=new byte[]{0x11,0x22,0x33,0x44,0x55,0x66,0x77,(byte) 0x88,(byte) 0x99,0x12,0x34};
int[] cosresplen=new int[1];
byte[] cosresp=new byte[cos.length+13];
byte[] errcode=new byte[4];
READER_ERR er=Jreader.PsamTransceiver(soltid, coslen, cos, cosresplen, cosresp,
errcode, (short)1000);
}
public void testcustomcmd() {
//m4 qt
IMPINJM4QtPara CustomPara=Jreader.new IMPINJM4QtPara();
CustomPara.TimeOut=800;
CustomPara.CmdType=1;
CustomPara.MemType=2;
CustomPara.PersistType=3;
CustomPara.RangeType=4;
CustomPara.AccessPwd=new byte[]{0x11,0x22,0x33,0x44};
IMPINJM4QtResult CustomRet=Jreader.new IMPINJM4QtResult();
Jreader.CustomCmd(1, CustomCmdType.IMPINJ_M4_Qt, CustomPara, CustomRet);
//allen h3
ALIENHiggs3BlockReadLockPara CustomPara2=Jreader.new ALIENHiggs3BlockReadLockPara();
CustomPara2.AccessPwd=new byte[]{0x55,0x66,0x77,(byte) 0x88};
CustomPara2.BlkBits=6;
CustomPara2.TimeOut=890;
Jreader.CustomCmd(1, CustomCmdType.ALIEN_Higgs3_BlockReadLock, CustomPara2, null);
//nexp eas
NXPChangeEASPara CustomPara3=Jreader.new NXPChangeEASPara();
CustomPara3.AccessPwd=new byte[]{(byte) 0x99,(byte) 0xaa,(byte) 0xbb,(byte) 0xcc};
CustomPara3.isSet=1;
CustomPara3.TimeOut=900;
Jreader.CustomCmd(1, CustomCmdType.NXP_ChangeEAS, CustomPara3, null);
//nxp easl
NXPEASAlarmPara CustomPara4=Jreader.new NXPEASAlarmPara();
CustomPara4.DR=7;
CustomPara4.MC=11;
CustomPara4.TimeOut=950;
CustomPara4.TrExt=17;
NXPEASAlarmResult CustomRet2=Jreader.new NXPEASAlarmResult();
Jreader.CustomCmd(1, CustomCmdType.NXP_EASAlarm, CustomPara4, CustomRet2);
//basetype
Jreader.CustomCmd_BaseType(1, 1, new byte[]{0x11,(byte) 0x99,(byte) 0xbb}, new byte[]{});
}
public void testreadandwrite(){
/*
* READER_ERR WriteTagData(int ant,char bank,int address, byte[] data, int datalen, byte[] accesspasswd,short timeout);
* ant 操作的单天线
* bank 表示区域 0表示保留区 1表示epc区 2表示tid区 3表示user区
* address 表示地址块, 注意epc区从第二块开始
* data 写的数据
* datalen 表示写的数据长度
* accesspwd 表示密码,默认"00000000" 8个十六进制字符
* timeout 操作超时时间
*/
String pwd="00000000";
byte[] data=new byte[]{0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,(byte) 0x88,(byte) 0x99,(byte) 0xaa,(byte) 0xbb};
byte[] pwdb=new byte[4];
Jreader.Str2Hex(pwd, pwd.length(), pwdb);
//?????
READER_ERR er=Jreader.WriteTagData(1, (char)1, 2, data, 6, pwdb, (short)1000);
byte[] datar=new byte[12];
//??????
/*
* READER_ERR GetTagData(int ant,char bank, int address, int blkcnt,byte[] data, byte[] accesspasswd, short timeout);
* ant 操作的单天线
* bank 表示区域 0表示保留区 1表示epc区 2表示tid区 3表示user区
* address 表示地址块, 注意epc区从第二块开始
* blkcnt 表示读块数
* data 存放数据的字节,应该不小于blkcnt*2
* accesspwd 表示密码,默认"00000000" 8个十六进制字符
* timeout 操作超时时间
*/
er=Jreader.GetTagData(1, (char)1, 2, 6, datar, null, (short)1000);
String str1="";
for(int i=0;i<12;i++)
{
str1+=Integer.toHexString(datar[i]&0xff);
}
System.out.println(er.toString()+" "+str1.toUpperCase());
byte[] data2=new byte[]{(byte) 0xFF,0x01,0x22,0x03,0x44,0x05,0x66,0x07,(byte) 0x88,(byte) 0x09,(byte) 0xaa,(byte) 0x0b};
er=Jreader.WriteTagEpcEx(1, data2, 12, null, (short)1000);
er=Jreader.GetTagData(1, (char)1, 2, 6, datar, null, (short)1000);
str1="";
for(int i=0;i<12;i++)
{
str1+=Integer.toHexString(datar[i]&0xff);
}
System.out.println(er.toString()+" "+str1.toUpperCase());
}
public void testblockop() {
String pwd="11000000";
byte[] data=new byte[4];
Jreader.Str2Hex(pwd, pwd.length(), data);
//擦除块
READER_ERR er=Jreader.BlockErase(1, (char)1, 2, 12, data, (short)1000);
//永久锁块
Jreader.BlockPermaLock(1, 1, 2, 6, new byte[]{(byte) 0xff,(byte) 0xff}, data, (short)1000);
}
public void testinitreader(String ip) {
//创建读写器
/* 根据天线口连接读写器
* src 是地址 ip地址或者串口号
* rtype 是天线口数,4口天线传入4
* 返回类型:READER_ERR ,MT_OK_ERR表示正常,其他表示错误
*/
// READER_ERR er=Jreader.InitReader(ReaderAddr,Reader_Type.MODULE_ONE_ANT);
log.info("ip:{}",ip);
// READER_ERR er=Jreader.InitReader_Notype(ReaderAddr,AntCount);
READER_ERR er=Jreader.InitReader_Notype(ip,AntCount);
System.out.println(er.toString());
/*
* 构建天线组功率:AntPowerConf
* 成员:
* AntPower数组
* antcnt表示天线个数
* AntPower类型
* antid 天线号
* readPower 读功率
* writePower 写功率
*/
AntPowerConf apcf=Jreader.new AntPowerConf();
apcf.antcnt=AntCount;
for(int i=0;i<apcf.antcnt;i++) {
AntPower jaap=Jreader.new AntPower();
jaap.antid=i+1;
// jaap.readPower=2800;
jaap.readPower=1000;
jaap.writePower=1000;
// jaap.writePower=2750;
apcf.Powers[i]=jaap;
}
AntPowerConf apcf2=Jreader.new AntPowerConf();
er=Jreader.ParamSet( Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf);
er=Jreader.ParamGet( Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf2);
for(int i=0;i<apcf2.antcnt;i++){
System.out.print("antid:"+apcf2.Powers[i].antid);
System.out.print(" rp:"+apcf2.Powers[i].readPower);
System.out.print(" wp:"+apcf2.Powers[i].writePower);
System.out.println();
}
Inv_Potls_ST ipst=Jreader.new Inv_Potls_ST();
ipst.potlcnt=1;
ipst.potls=new Inv_Potl[1];
for(int i=0;i<ipst.potlcnt;i++){
Inv_Potl ipl=Jreader.new Inv_Potl();
ipl.weight=30;
ipl.potl=SL_TagProtocol.SL_TAG_PROTOCOL_GEN2;
ipst.potls[0]=ipl;
}
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst);
/*
* 设置是否检查天线
* 当参数值传入1的时候表示要检查,0表示不检查
*/
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_IS_CHK_ANT, 0);
}
public List<String> testinventory1() {
/*
*
* 设置频率,对于某天线设置频率表可以提搞读效果
* HoptableData_ST 天线频率表类
* lenhtb 表示频率表长度
* htb 数组int类型,表示具体频点
HoptableData_ST hdst=Jreader.new HoptableData_ST();
hdst.lenhtb=2;
hdst.htb[0]=915250;
hdst.htb[1]=915750;
READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE,hdst);
*/
/* ants 轮询使用的天线,即连接天线口的天线
* antcnt 使用的天线个数
* timeout 读标签的时间
* pTInfo 存放标签数据的数组
* tagcnt 存放标签的个数,只需传入一个元素的数组
*/
int[] tagcnt=new int[1];
TAGINFO[] taginfo=new TAGINFO[200];
READER_ERR er=Jreader.TagInventory(new int[]{1}, 1, (short)1000, taginfo, tagcnt);
List<String> result = new ArrayList<>();
if(er==READER_ERR.MT_OK_ERR) {
for(int i=0;i<tagcnt[0];i++) {
result.add(Reader.bytes_Hexstr(taginfo[i].EpcId));
// System.out.println("inv1_epc:"+Reader.bytes_Hexstr(taginfo[i].EpcId));
}
}
return result;
}
public void testinventory2() {
int[] tagcnt=new int[1];
TAGINFO taginfo = Jreader.new TAGINFO();
READER_ERR er=Jreader.TagInventory_Raw(new int[]{1}, 1, (short)1000, tagcnt);
for(int i=0;i<tagcnt[0];i++)
{
er=Jreader.GetNextTag(taginfo);
if(taginfo!=null)
System.out.println("inv2_epc:"+Reader.bytes_Hexstr(taginfo.EpcId));
}
byte[] outbuf=new byte[800];
er=Jreader.TagInventory_Raw(new int[]{1}, 1, (short)1000, tagcnt);
er=Jreader.GetNextTag_BaseType(outbuf);
}
public void testdataonreader() {
byte[] data3=new byte[100];
READER_ERR er=Jreader.ReadDataOnReader(0, data3, 100);
er=Jreader.SaveDataOnReader(0, data3, 100);
//擦除读写器上数据
er=Jreader.EraseDataOnReader();
}
public void testkilltag() {
String pwd="11000000";
byte[] data=new byte[4];
Jreader.Str2Hex(pwd, pwd.length(), data);
READER_ERR er=Jreader.KillTag(1, data, (short) 1000);
}
public void testlocktag() {
String pwd="12340000";
// READER_ERR er=Jreader.Lock180006BTag(1, 2, 6, (short) 1000);
byte[] data=new byte[4];
Jreader.Str2Hex(pwd, pwd.length(), data);
//写数据
READER_ERR er=Jreader.WriteTagData(1, (char)0, 2, data, 2, null, (short)1000);
er=Jreader.LockTag(1, (byte)Lock_Obj.LOCK_OBJECT_BANK1.value(), (short)Lock_Type.BANK1_LOCK.value(), data, (short)1000);
//写数据
er=Jreader.WriteTagData(1, (char)1, 2, new byte[]{0x11,0x22}, 2, null, (short)1000);
System.out.println("no pwd write"+er.toString());
//写数据
er=Jreader.WriteTagData(1, (char)1, 2, new byte[]{0x11,0x22}, 2, data, (short)1000);
System.out.println("pwd write"+er.toString());
er=Jreader.LockTag(1, (byte)Lock_Obj.LOCK_OBJECT_BANK1.value(), (short)Lock_Type.BANK1_UNLOCK.value(), data, (short)1000);
}
public void testsetip(String ip ,String mask,String gateway) throws UnsupportedEncodingException {
Reader_Ip rip=Jreader.new Reader_Ip();
/*
rip.ip=new byte[]{'1','9','2','.','1','6','8','.','1','.','1','0','1'};
rip.mask=new byte[]{'2','5','5','.','2','5','5','.','2','5','5','.','0'};
rip.gateway=new byte[]{'1','9','2','.','1','6','8','.','1','.','2','5','4'};
//*/
// rip.ip="192.168.1.100".getBytes();
// rip.mask="255.255.255.0".getBytes();
// rip.gateway="192.168.1.1".getBytes();"US-ASCII"
rip.ip=ip.getBytes();
rip.mask=mask.getBytes();
rip.gateway=gateway.getBytes();
//*/
READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_IP, rip);
}
public void testrparams() {
HoptableData_ST hdst=Jreader.new HoptableData_ST();
hdst.lenhtb=5;
hdst.htb[0]=915250;
hdst.htb[1]=916750;
hdst.htb[2]=917250;
hdst.htb[3]=925750;
hdst.htb[4]=926750;
READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE,hdst);
HoptableData_ST hdst2=Jreader.new HoptableData_ST();
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE, hdst2);
for(int i=0;i<hdst2.lenhtb;i++)
{
System.out.print("htb:"+i);
System.out.println(" "+(hdst2.htb[i]));
}
//
Region_Conf rcf1=Region_Conf.RG_NA;
Region_Conf[] rcf2=new Region_Conf[1];
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_REGION,rcf1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_FREQUENCY_REGION,rcf2);
int[] val1=new int[]{250};
int[] val2=new int[]{-1};
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_BLF, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_BLF, val2);
val1[0]=496;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_MAXEPCLEN, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_MAXEPCLEN, val2);
val1[0]=10;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_Q, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_Q, val2);
val1[0]=2;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_SESSION, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_SESSION, val2);
val1[0]=2;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_TAGENCODING, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_TAGENCODING, val2);
val1[0]=1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARGET, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARGET, val2);
val1[0]=3;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARI, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARI, val2);
val1[0]=1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_WRITEMODE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_WRITEMODE, val2);
val1[0]=2;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_BLF, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_BLF, val2);
val1[0]=1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_DELIMITER, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_DELIMITER, val2);
val1[0]=2;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_MODULATION_DEPTH, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_MODULATION_DEPTH, val2);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_SUPPORTEDPROTOCOLS, val1);
//er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_SUPPORTEDPROTOCOLS, val2);
val1[0]=1;
val2[0]=-1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POWERSAVE_MODE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POWERSAVE_MODE, val2);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_AVAILABLE_ANTPORTS, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_AVAILABLE_ANTPORTS, val2);
ConnAnts_ST cast=Jreader.new ConnAnts_ST();
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_CONN_ANTS, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_CONN_ANTS, cast);
Reader_Ip rip2=Jreader.new Reader_Ip();
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_IP, rip2);
System.out.print("ip:"+rip2.ip.length+" ");
System.out.println(new String(rip2.ip));
System.out.println(new String(rip2.mask));
System.out.println(new String(rip2.gateway));
val1[0]=1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_IS_CHK_ANT, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_IS_CHK_ANT, val2);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_VERSION, val1);
//er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_VERSION, val2);
AntPowerConf apcf=Jreader.new AntPowerConf();
apcf.antcnt=1;
for(int i=0;i<apcf.antcnt;i++)
{
AntPower jaap=Jreader.new AntPower();
jaap.antid=i+1;
jaap.readPower=2800;
jaap.writePower=2750;
apcf.Powers[i]=jaap;
}
AntPowerConf apcf2=Jreader.new AntPowerConf();
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf2);
for(int i=0;i<apcf2.antcnt;i++)
{
System.out.print("antid:"+apcf2.Powers[i].antid);
System.out.print(" rp:"+apcf2.Powers[i].readPower);
System.out.print(" wp:"+apcf2.Powers[i].writePower);
System.out.println();
}
val1[0]=100;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_HOPTIME, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_HOPTIME, val2);
val1[0]=1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_LBT_ENABLE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_LBT_ENABLE, val2);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_MAXPOWER, val1);
short[] valso=new short[1];
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_MAXPOWER, valso);
System.out.println("max:"+valso[0]);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_MINPOWER, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_MINPOWER, valso);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_SUPPORTEDREGIONS, val1);
//er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_SUPPORTEDREGIONS, val2);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_TEMPERATURE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_TEMPERATURE, val2);
EmbededData_ST edst = Jreader.new EmbededData_ST();
edst.startaddr=0;
edst.bank=2;
//bytecnt=0 取消嵌入数据
edst.bytecnt=2;
edst.accesspwd=null;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMBEDEDDATA, edst);
EmbededData_ST edst2 = Jreader.new EmbededData_ST();
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_EMBEDEDDATA, edst2);
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMBEDEDDATA, null);
EmbededSecureRead_ST esrst=Jreader.new EmbededSecureRead_ST();
esrst.accesspwd=1280;
esrst.address=2;
esrst.ApIndexBitsNumInEpc=1;
esrst.ApIndexStartBitsInEpc=3;
esrst.bank=1;
//blkcnt =0 取消。
esrst.blkcnt=2;
esrst.pwdtype=1;
esrst.tagtype=2;
EmbededSecureRead_ST esrst2=Jreader.new EmbededSecureRead_ST();
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMDSECUREREAD, esrst);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_EMDSECUREREAD, esrst2);
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMDSECUREREAD, null);
TagFilter_ST tfst=Jreader.new TagFilter_ST();
tfst.bank=1;
tfst.fdata=new byte[]{(byte) 0xE2,(byte) 0x00};
//flen 0 为取消过滤
tfst.flen=2;
tfst.isInvert=0;
tfst.startaddr=2;
TagFilter_ST tfst2=Jreader.new TagFilter_ST();
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_FILTER, tfst);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_FILTER, tfst2);
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_FILTER, null);
Inv_Potls_ST ipst=Jreader.new Inv_Potls_ST();
ipst.potlcnt=1;
ipst.potls=new Inv_Potl[1];
for(int i=0;i<ipst.potlcnt;i++)
{
Inv_Potl ipl=Jreader.new Inv_Potl();
ipl.weight=30;
ipl.potl=SL_TagProtocol.SL_TAG_PROTOCOL_GEN2;
ipst.potls[0]=ipl;
}
Inv_Potls_ST ipst2=Jreader.new Inv_Potls_ST();
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst2);
for(int i=0;i<ipst2.potlcnt;i++)
System.out.println(ipst2.potls[i].potl);
val1[0]=1;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_SEARCH_MODE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_SEARCH_MODE, val2);
val1[0]=1;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAGDATA_RECORDHIGHESTRSSI, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAGDATA_RECORDHIGHESTRSSI, val2);
val1[0]=1;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYANT, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYANT, val2);
val1[0]=1;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYEMDDATA, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYEMDDATA, val2);
val1[0]=300;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TRANS_TIMEOUT, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TRANS_TIMEOUT, val2);
val1[0]=1;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TRANSMIT_MODE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TRANSMIT_MODE, val2);
}
public void testgpio() {
READER_ERR er=Jreader.SetGPO(1, 1);
er=Jreader.SetGPO(2, 0);
er=Jreader.SetGPO(3, 0);
er=Jreader.SetGPO(4, 1);
int[] val=new int[1];
er=Jreader.GetGPI(1, val);
er=Jreader.GetGPI(2, val);
er=Jreader.GetGPI(3, val);
er=Jreader.GetGPI(4, val);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
ReadUtils mt=new ReadUtils();
//测试初始化
//启动
// mt.testinitreader();
//测试转换
//mt.testtran();
//测试gpio
//mt.testgpio();
//测试参数
//mt.testrparams();
//测试块操作
//mt.testblockop();
//测试特殊指令
//mt.testcustomcmd();
//测试读写器内部数据
//mt.testdataonreader();
//测试盘点方式1
//盘存
mt.testinventory1();
//测试盘点方式2
// mt.testinventory2();
//测试销毁密码
//mt.testkilltag();
//测试锁标签
//mt.testlocktag();
//测试读写标签
// mt.testreadandwrite();
//测试改ip地址
//可以修改ip
// mt.testsetip();
//测试psam
//mt.testpsam();
//关闭读写器
//关闭
mt.Jreader.CloseReader();
System.out.println("test over");
}
}
package com.tykj.dev.readmachine.devreadmachine;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DevReadmachineApplicationTests {
@Test
void contextLoads() {
}
}
......@@ -37,13 +37,13 @@
<systemPath>${project.basedir}/src/main/resources/lib/ZSDK_API.jar</systemPath>
</dependency>
<dependency>
<!--<dependency>
<groupId>com.zebra</groupId>
<artifactId>sdk1</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/ModuleAPI_Java_2.2.0.0.jar</systemPath>
</dependency>
</dependency>-->
<dependency>
<groupId>com.rfid</groupId>
......
......@@ -27,6 +27,8 @@ public class InventoryThread extends Thread {
private static int CURRENT_READ_POINT = 0;
private final int ANT_COUNT = 2;
private final String PanIP = "192.168.101.201";
/**
* 每次盘存的临时变量
*/
......@@ -137,12 +139,12 @@ public class InventoryThread extends Thread {
@Override
public void run() {
mReaderHelper = mConnector.connectNet("192.168.0.178", 4001);
mReaderHelper = mConnector.connectNet(PanIP, 8080);
if (mReaderHelper != null) {
try {
mReaderHelper.registerObserver(mObserver);
//默认切换到默认天线
changeAnt(currentAnt);
// changeAnt(currentAnt);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
......@@ -151,6 +153,7 @@ public class InventoryThread extends Thread {
log.error("连接天线失败");
mConnector.disConnect();
}
readTag();
}
/**
......
package com.tykj.dev.rfid.timeTask;
import com.uhf.api.cls.Reader;
import com.uhf.api.cls.Reader.*;
import lombok.Data;
@Data
public class ReadUtils {
/**
* @param args
*/
int AntCount=1;
// String ReaderAddr="192.168.101.201";
//读写机ip
String ReaderAddr="192.168.0.201";
Reader Jreader;
public ReadUtils()
{
Jreader=new Reader();
}
public void testtran(){
byte[] hex=new byte[]{(byte) 0xA2,(byte) 0xC8,(byte) 0xD4,(byte) 0xE5};
int len=4;
char[] str=new char[4*2];
Jreader.Hex2Str(hex, len, str);
String hstr = "";
for(int i=0;i<8;i++)
hstr+=(char)str[i];
System.out.println("test tohexstr:"+hstr);
String buf="0011110000001111";
byte[] binarybuf=new byte[2];
String buf2="abcdef08";
byte[] hexbuf=new byte[4];
Jreader.Str2Binary(buf, buf.length(), binarybuf);
System.out.println("test binary:");
for(int i=0;i<binarybuf.length;i++)
System.out.println(binarybuf[i]);
Jreader.Str2Hex(buf2, 8, hexbuf);
System.out.println("test hex:");
for(int i=0;i<hexbuf.length;i++)
System.out.println(hexbuf[i]);
}
public void testpsam(){
int soltid=1;
int coslen=2;
byte[] cos=new byte[]{0x11,0x22,0x33,0x44,0x55,0x66,0x77,(byte) 0x88,(byte) 0x99,0x12,0x34};
int[] cosresplen=new int[1];
byte[] cosresp=new byte[cos.length+13];
byte[] errcode=new byte[4];
READER_ERR er=Jreader.PsamTransceiver(soltid, coslen, cos, cosresplen, cosresp,
errcode, (short)1000);
}
public void testcustomcmd() {
//m4 qt
IMPINJM4QtPara CustomPara=Jreader.new IMPINJM4QtPara();
CustomPara.TimeOut=800;
CustomPara.CmdType=1;
CustomPara.MemType=2;
CustomPara.PersistType=3;
CustomPara.RangeType=4;
CustomPara.AccessPwd=new byte[]{0x11,0x22,0x33,0x44};
IMPINJM4QtResult CustomRet=Jreader.new IMPINJM4QtResult();
Jreader.CustomCmd(1, CustomCmdType.IMPINJ_M4_Qt, CustomPara, CustomRet);
//allen h3
ALIENHiggs3BlockReadLockPara CustomPara2=Jreader.new ALIENHiggs3BlockReadLockPara();
CustomPara2.AccessPwd=new byte[]{0x55,0x66,0x77,(byte) 0x88};
CustomPara2.BlkBits=6;
CustomPara2.TimeOut=890;
Jreader.CustomCmd(1, CustomCmdType.ALIEN_Higgs3_BlockReadLock, CustomPara2, null);
//nexp eas
NXPChangeEASPara CustomPara3=Jreader.new NXPChangeEASPara();
CustomPara3.AccessPwd=new byte[]{(byte) 0x99,(byte) 0xaa,(byte) 0xbb,(byte) 0xcc};
CustomPara3.isSet=1;
CustomPara3.TimeOut=900;
Jreader.CustomCmd(1, CustomCmdType.NXP_ChangeEAS, CustomPara3, null);
//nxp easl
NXPEASAlarmPara CustomPara4=Jreader.new NXPEASAlarmPara();
CustomPara4.DR=7;
CustomPara4.MC=11;
CustomPara4.TimeOut=950;
CustomPara4.TrExt=17;
NXPEASAlarmResult CustomRet2=Jreader.new NXPEASAlarmResult();
Jreader.CustomCmd(1, CustomCmdType.NXP_EASAlarm, CustomPara4, CustomRet2);
//basetype
Jreader.CustomCmd_BaseType(1, 1, new byte[]{0x11,(byte) 0x99,(byte) 0xbb}, new byte[]{});
}
public void testreadandwrite(){
/*
* READER_ERR WriteTagData(int ant,char bank,int address, byte[] data, int datalen, byte[] accesspasswd,short timeout);
* ant ???????????
* bank ??????? 0????????? 1???epc?? 2???tid?? 3???user??
* address ???????? ???epc?????????
* data ???????
* datalen ?????????????
* accesspwd ??????????"00000000" 8????????????
* timeout ??????????
*/
String pwd="00000000";
byte[] data=new byte[]{0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,(byte) 0x88,(byte) 0x99,(byte) 0xaa,(byte) 0xbb};
byte[] pwdb=new byte[4];
Jreader.Str2Hex(pwd, pwd.length(), pwdb);
//?????
READER_ERR er=Jreader.WriteTagData(1, (char)1, 2, data, 6, pwdb, (short)1000);
byte[] datar=new byte[12];
//??????
/*
* READER_ERR GetTagData(int ant,char bank, int address, int blkcnt,byte[] data, byte[] accesspasswd, short timeout);
* ant ???????????
* bank ??????? 0????????? 1???epc?? 2???tid?? 3???user??
* address ???????? ???epc?????????
* blkcnt ?????????
* data ??????????????ò????blkcnt*2
* accesspwd ??????????"00000000" 8????????????
* timeout ??????????
*/
er=Jreader.GetTagData(1, (char)1, 2, 6, datar, null, (short)1000);
String str1="";
for(int i=0;i<12;i++)
{
str1+=Integer.toHexString(datar[i]&0xff);
}
System.out.println(er.toString()+" "+str1.toUpperCase());
byte[] data2=new byte[]{(byte) 0xFF,0x01,0x22,0x03,0x44,0x05,0x66,0x07,(byte) 0x88,(byte) 0x09,(byte) 0xaa,(byte) 0x0b};
er=Jreader.WriteTagEpcEx(1, data2, 12, null, (short)1000);
er=Jreader.GetTagData(1, (char)1, 2, 6, datar, null, (short)1000);
str1="";
for(int i=0;i<12;i++)
{
str1+=Integer.toHexString(datar[i]&0xff);
}
System.out.println(er.toString()+" "+str1.toUpperCase());
}
public void testblockop() {
String pwd="11000000";
byte[] data=new byte[4];
Jreader.Str2Hex(pwd, pwd.length(), data);
//??????
READER_ERR er=Jreader.BlockErase(1, (char)1, 2, 12, data, (short)1000);
//????????
Jreader.BlockPermaLock(1, 1, 2, 6, new byte[]{(byte) 0xff,(byte) 0xff}, data, (short)1000);
}
public void testinitreader() {
//?????????
/* ?????????????????
* src ???? ip???????????
* rtype ???????????4?????????4
* ?????????READER_ERR ,MT_OK_ERR????????????????????
*/
READER_ERR er=Jreader.InitReader(ReaderAddr,Reader_Type.MODULE_ONE_ANT);
//package com.tykj.dev.rfid.timeTask;
//
//import com.uhf.api.cls.Reader;
//import com.uhf.api.cls.Reader.*;
//import lombok.Data;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
//import java.util.ArrayList;
//import java.util.List;
//
//@Data
//@Slf4j
//public class ReadUtils {
//
//
// /**
// * @param args
// */
//
// int AntCount=1;
// //公司测试网段ip
//// String ReaderAddr="192.168.101.201";
// //公司测试读写机实验室ip
//// String ReaderAddr="192.168.0.201";
// //公司正式读写机实验室ip
// String ReaderAddr="192.168.0.100";
//// @Value("${readMachine.ip}")
//// public String ReaderAddr;
//
// Reader Jreader;
// public ReadUtils()
// {
// Jreader=new Reader();
// }
//
// public void testtran(){
// byte[] hex=new byte[]{(byte) 0xA2,(byte) 0xC8,(byte) 0xD4,(byte) 0xE5};
// int len=4;
// char[] str=new char[4*2];
// Jreader.Hex2Str(hex, len, str);
// String hstr = "";
// for(int i=0;i<8;i++)
// hstr+=(char)str[i];
// System.out.println("test tohexstr:"+hstr);
//
// String buf="0011110000001111";
//
// byte[] binarybuf=new byte[2];
// String buf2="abcdef08";
// byte[] hexbuf=new byte[4];
// Jreader.Str2Binary(buf, buf.length(), binarybuf);
// System.out.println("test binary:");
// for(int i=0;i<binarybuf.length;i++)
// System.out.println(binarybuf[i]);
//
// Jreader.Str2Hex(buf2, 8, hexbuf);
// System.out.println("test hex:");
// for(int i=0;i<hexbuf.length;i++)
// System.out.println(hexbuf[i]);
// }
//
// public void testpsam(){
// int soltid=1;
// int coslen=2;
// byte[] cos=new byte[]{0x11,0x22,0x33,0x44,0x55,0x66,0x77,(byte) 0x88,(byte) 0x99,0x12,0x34};
// int[] cosresplen=new int[1];
// byte[] cosresp=new byte[cos.length+13];
// byte[] errcode=new byte[4];
//
// READER_ERR er=Jreader.PsamTransceiver(soltid, coslen, cos, cosresplen, cosresp,
// errcode, (short)1000);
// }
//
// public void testcustomcmd() {
// //m4 qt
// IMPINJM4QtPara CustomPara=Jreader.new IMPINJM4QtPara();
// CustomPara.TimeOut=800;
// CustomPara.CmdType=1;
// CustomPara.MemType=2;
// CustomPara.PersistType=3;
// CustomPara.RangeType=4;
// CustomPara.AccessPwd=new byte[]{0x11,0x22,0x33,0x44};
//
// IMPINJM4QtResult CustomRet=Jreader.new IMPINJM4QtResult();
// Jreader.CustomCmd(1, CustomCmdType.IMPINJ_M4_Qt, CustomPara, CustomRet);
//
// //allen h3
// ALIENHiggs3BlockReadLockPara CustomPara2=Jreader.new ALIENHiggs3BlockReadLockPara();
// CustomPara2.AccessPwd=new byte[]{0x55,0x66,0x77,(byte) 0x88};
// CustomPara2.BlkBits=6;
// CustomPara2.TimeOut=890;
// Jreader.CustomCmd(1, CustomCmdType.ALIEN_Higgs3_BlockReadLock, CustomPara2, null);
//
// //nexp eas
// NXPChangeEASPara CustomPara3=Jreader.new NXPChangeEASPara();
// CustomPara3.AccessPwd=new byte[]{(byte) 0x99,(byte) 0xaa,(byte) 0xbb,(byte) 0xcc};
// CustomPara3.isSet=1;
// CustomPara3.TimeOut=900;
// Jreader.CustomCmd(1, CustomCmdType.NXP_ChangeEAS, CustomPara3, null);
//
// //nxp easl
// NXPEASAlarmPara CustomPara4=Jreader.new NXPEASAlarmPara();
// CustomPara4.DR=7;
// CustomPara4.MC=11;
// CustomPara4.TimeOut=950;
// CustomPara4.TrExt=17;
//
// NXPEASAlarmResult CustomRet2=Jreader.new NXPEASAlarmResult();
// Jreader.CustomCmd(1, CustomCmdType.NXP_EASAlarm, CustomPara4, CustomRet2);
//
// //basetype
// Jreader.CustomCmd_BaseType(1, 1, new byte[]{0x11,(byte) 0x99,(byte) 0xbb}, new byte[]{});
//
// }
//
// public void testreadandwrite(){
// /*
// * READER_ERR WriteTagData(int ant,char bank,int address, byte[] data, int datalen, byte[] accesspasswd,short timeout);
// * ant 操作的单天线
// * bank 表示区域 0表示保留区 1表示epc区 2表示tid区 3表示user区
// * address 表示地址块, 注意epc区从第二块开始
// * data 写的数据
// * datalen 表示写的数据长度
// * accesspwd 表示密码,默认"00000000" 8个十六进制字符
// * timeout 操作超时时间
// */
//
// String pwd="00000000";
// byte[] data=new byte[]{0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,(byte) 0x88,(byte) 0x99,(byte) 0xaa,(byte) 0xbb};
// byte[] pwdb=new byte[4];
// Jreader.Str2Hex(pwd, pwd.length(), pwdb);
// //?????
// READER_ERR er=Jreader.WriteTagData(1, (char)1, 2, data, 6, pwdb, (short)1000);
//
// byte[] datar=new byte[12];
// //??????
// /*
// * READER_ERR GetTagData(int ant,char bank, int address, int blkcnt,byte[] data, byte[] accesspasswd, short timeout);
// * ant 操作的单天线
// * bank 表示区域 0表示保留区 1表示epc区 2表示tid区 3表示user区
// * address 表示地址块, 注意epc区从第二块开始
// * blkcnt 表示读块数
// * data 存放数据的字节,应该不小于blkcnt*2
// * accesspwd 表示密码,默认"00000000" 8个十六进制字符
// * timeout 操作超时时间
// */
// er=Jreader.GetTagData(1, (char)1, 2, 6, datar, null, (short)1000);
// String str1="";
//
// for(int i=0;i<12;i++)
// {
// str1+=Integer.toHexString(datar[i]&0xff);
// }
// System.out.println(er.toString()+" "+str1.toUpperCase());
//
// byte[] data2=new byte[]{(byte) 0xFF,0x01,0x22,0x03,0x44,0x05,0x66,0x07,(byte) 0x88,(byte) 0x09,(byte) 0xaa,(byte) 0x0b};
//
// er=Jreader.WriteTagEpcEx(1, data2, 12, null, (short)1000);
//
// er=Jreader.GetTagData(1, (char)1, 2, 6, datar, null, (short)1000);
//
// str1="";
//
// for(int i=0;i<12;i++)
// {
// str1+=Integer.toHexString(datar[i]&0xff);
// }
// System.out.println(er.toString()+" "+str1.toUpperCase());
//
// }
//
// public void testblockop() {
// String pwd="11000000";
// byte[] data=new byte[4];
// Jreader.Str2Hex(pwd, pwd.length(), data);
// //擦除块
// READER_ERR er=Jreader.BlockErase(1, (char)1, 2, 12, data, (short)1000);
//
// //永久锁块
// Jreader.BlockPermaLock(1, 1, 2, 6, new byte[]{(byte) 0xff,(byte) 0xff}, data, (short)1000);
//
// }
//
// public void testinitreader() {
// //创建读写器
// /* 根据天线口连接读写器
// * src 是地址 ip地址或者串口号
// * rtype 是天线口数,4口天线传入4
// * 返回类型:READER_ERR ,MT_OK_ERR表示正常,其他表示错误
// */
//// READER_ERR er=Jreader.InitReader(ReaderAddr,Reader_Type.MODULE_ONE_ANT);
// log.info("ReaderAddr:{}",ReaderAddr);
// READER_ERR er=Jreader.InitReader_Notype(ReaderAddr,AntCount);
System.out.println(er.toString());
/*
* ?????????????AntPowerConf
* ?????
* AntPower????
* antcnt??????????
* AntPower????
* antid ?????
* readPower ??????
* writePower ?????
*/
AntPowerConf apcf=Jreader.new AntPowerConf();
apcf.antcnt=AntCount;
for(int i=0;i<apcf.antcnt;i++)
{
AntPower jaap=Jreader.new AntPower();
jaap.antid=i+1;
jaap.readPower=2800;
jaap.writePower=2750;
apcf.Powers[i]=jaap;
}
AntPowerConf apcf2=Jreader.new AntPowerConf();
er=Jreader.ParamSet( Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf);
er=Jreader.ParamGet( Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf2);
for(int i=0;i<apcf2.antcnt;i++)
{
System.out.print("antid:"+apcf2.Powers[i].antid);
System.out.print(" rp:"+apcf2.Powers[i].readPower);
System.out.print(" wp:"+apcf2.Powers[i].writePower);
System.out.println();
}
Inv_Potls_ST ipst=Jreader.new Inv_Potls_ST();
ipst.potlcnt=1;
ipst.potls=new Inv_Potl[1];
for(int i=0;i<ipst.potlcnt;i++)
{
Inv_Potl ipl=Jreader.new Inv_Potl();
ipl.weight=30;
ipl.potl=SL_TagProtocol.SL_TAG_PROTOCOL_GEN2;
ipst.potls[0]=ipl;
}
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst);
/*
* ?????????????
* ???????????1???????????0????????
*/
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_IS_CHK_ANT, 0);
}
public void testinventory1() {
/*
*
* ???????????????????????????????????
* HoptableData_ST ??????????
* lenhtb ?????????
* htb ????int???????????????
HoptableData_ST hdst=Jreader.new HoptableData_ST();
hdst.lenhtb=2;
hdst.htb[0]=915250;
hdst.htb[1]=915750;
READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE,hdst);
*/
/* ants ????????????????????????????
* antcnt ???????????
* timeout ??????????
* pTInfo ??????????????
* tagcnt ????????????????????????????
*/
int[] tagcnt=new int[1];
TAGINFO[] taginfo=new TAGINFO[200];
READER_ERR er=Jreader.TagInventory(new int[]{1}, 1, (short)1000, taginfo, tagcnt);
if(er==READER_ERR.MT_OK_ERR) {
for(int i=0;i<tagcnt[0];i++) {
System.out.println("inv1_epc:"+Reader.bytes_Hexstr(taginfo[i].EpcId));
}
}
}
public void testinventory2() {
int[] tagcnt=new int[1];
TAGINFO taginfo = Jreader.new TAGINFO();
READER_ERR er=Jreader.TagInventory_Raw(new int[]{1}, 1, (short)1000, tagcnt);
for(int i=0;i<tagcnt[0];i++)
{
er=Jreader.GetNextTag(taginfo);
if(taginfo!=null)
System.out.println("inv2_epc:"+Reader.bytes_Hexstr(taginfo.EpcId));
}
byte[] outbuf=new byte[800];
er=Jreader.TagInventory_Raw(new int[]{1}, 1, (short)1000, tagcnt);
er=Jreader.GetNextTag_BaseType(outbuf);
}
public void testdataonreader() {
byte[] data3=new byte[100];
READER_ERR er=Jreader.ReadDataOnReader(0, data3, 100);
er=Jreader.SaveDataOnReader(0, data3, 100);
//???????????????
er=Jreader.EraseDataOnReader();
}
public void testkilltag() {
String pwd="11000000";
byte[] data=new byte[4];
Jreader.Str2Hex(pwd, pwd.length(), data);
READER_ERR er=Jreader.KillTag(1, data, (short) 1000);
}
public void testlocktag() {
String pwd="12340000";
// READER_ERR er=Jreader.Lock180006BTag(1, 2, 6, (short) 1000);
byte[] data=new byte[4];
Jreader.Str2Hex(pwd, pwd.length(), data);
//?????
READER_ERR er=Jreader.WriteTagData(1, (char)0, 2, data, 2, null, (short)1000);
er=Jreader.LockTag(1, (byte)Lock_Obj.LOCK_OBJECT_BANK1.value(), (short)Lock_Type.BANK1_LOCK.value(), data, (short)1000);
//?????
er=Jreader.WriteTagData(1, (char)1, 2, new byte[]{0x11,0x22}, 2, null, (short)1000);
System.out.println("no pwd write"+er.toString());
//?????
er=Jreader.WriteTagData(1, (char)1, 2, new byte[]{0x11,0x22}, 2, data, (short)1000);
System.out.println("pwd write"+er.toString());
er=Jreader.LockTag(1, (byte)Lock_Obj.LOCK_OBJECT_BANK1.value(), (short)Lock_Type.BANK1_UNLOCK.value(), data, (short)1000);
}
public void testsetip() {
Reader_Ip rip=Jreader.new Reader_Ip();
/*
rip.ip=new byte[]{'1','9','2','.','1','6','8','.','1','.','1','0','1'};
rip.mask=new byte[]{'2','5','5','.','2','5','5','.','2','5','5','.','0'};
rip.gateway=new byte[]{'1','9','2','.','1','6','8','.','1','.','2','5','4'};
//*/
rip.ip="192.168.1.100".getBytes();
rip.mask="255.255.255.0".getBytes();
rip.gateway="192.168.1.1".getBytes();
//*/
READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_IP, rip);
}
public void testrparams() {
HoptableData_ST hdst=Jreader.new HoptableData_ST();
hdst.lenhtb=5;
hdst.htb[0]=915250;
hdst.htb[1]=916750;
hdst.htb[2]=917250;
hdst.htb[3]=925750;
hdst.htb[4]=926750;
READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE,hdst);
HoptableData_ST hdst2=Jreader.new HoptableData_ST();
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE, hdst2);
for(int i=0;i<hdst2.lenhtb;i++)
{
System.out.print("htb:"+i);
System.out.println(" "+(hdst2.htb[i]));
}
//
Region_Conf rcf1=Region_Conf.RG_NA;
Region_Conf[] rcf2=new Region_Conf[1];
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_REGION,rcf1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_FREQUENCY_REGION,rcf2);
int[] val1=new int[]{250};
int[] val2=new int[]{-1};
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_BLF, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_BLF, val2);
val1[0]=496;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_MAXEPCLEN, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_MAXEPCLEN, val2);
val1[0]=10;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_Q, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_Q, val2);
val1[0]=2;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_SESSION, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_SESSION, val2);
val1[0]=2;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_TAGENCODING, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_TAGENCODING, val2);
val1[0]=1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARGET, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARGET, val2);
val1[0]=3;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARI, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARI, val2);
val1[0]=1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_WRITEMODE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_WRITEMODE, val2);
val1[0]=2;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_BLF, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_BLF, val2);
val1[0]=1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_DELIMITER, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_DELIMITER, val2);
val1[0]=2;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_MODULATION_DEPTH, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_MODULATION_DEPTH, val2);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_SUPPORTEDPROTOCOLS, val1);
//er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_SUPPORTEDPROTOCOLS, val2);
val1[0]=1;
val2[0]=-1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POWERSAVE_MODE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POWERSAVE_MODE, val2);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_AVAILABLE_ANTPORTS, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_AVAILABLE_ANTPORTS, val2);
ConnAnts_ST cast=Jreader.new ConnAnts_ST();
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_CONN_ANTS, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_CONN_ANTS, cast);
Reader_Ip rip2=Jreader.new Reader_Ip();
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_IP, rip2);
System.out.print("ip:"+rip2.ip.length+" ");
System.out.println(new String(rip2.ip));
System.out.println(new String(rip2.mask));
System.out.println(new String(rip2.gateway));
val1[0]=1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_IS_CHK_ANT, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_IS_CHK_ANT, val2);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_VERSION, val1);
//er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_VERSION, val2);
AntPowerConf apcf=Jreader.new AntPowerConf();
apcf.antcnt=1;
for(int i=0;i<apcf.antcnt;i++)
{
AntPower jaap=Jreader.new AntPower();
jaap.antid=i+1;
jaap.readPower=2800;
jaap.writePower=2750;
apcf.Powers[i]=jaap;
}
AntPowerConf apcf2=Jreader.new AntPowerConf();
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf2);
for(int i=0;i<apcf2.antcnt;i++)
{
System.out.print("antid:"+apcf2.Powers[i].antid);
System.out.print(" rp:"+apcf2.Powers[i].readPower);
System.out.print(" wp:"+apcf2.Powers[i].writePower);
System.out.println();
}
val1[0]=100;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_HOPTIME, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_HOPTIME, val2);
val1[0]=1;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_LBT_ENABLE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_LBT_ENABLE, val2);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_MAXPOWER, val1);
short[] valso=new short[1];
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_MAXPOWER, valso);
System.out.println("max:"+valso[0]);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_MINPOWER, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_MINPOWER, valso);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_SUPPORTEDREGIONS, val1);
//er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_SUPPORTEDREGIONS, val2);
//er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_TEMPERATURE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_TEMPERATURE, val2);
EmbededData_ST edst = Jreader.new EmbededData_ST();
edst.startaddr=0;
edst.bank=2;
//bytecnt=0 ??????????
edst.bytecnt=2;
edst.accesspwd=null;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMBEDEDDATA, edst);
EmbededData_ST edst2 = Jreader.new EmbededData_ST();
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_EMBEDEDDATA, edst2);
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMBEDEDDATA, null);
EmbededSecureRead_ST esrst=Jreader.new EmbededSecureRead_ST();
esrst.accesspwd=1280;
esrst.address=2;
esrst.ApIndexBitsNumInEpc=1;
esrst.ApIndexStartBitsInEpc=3;
esrst.bank=1;
//blkcnt =0 ?????
esrst.blkcnt=2;
esrst.pwdtype=1;
esrst.tagtype=2;
EmbededSecureRead_ST esrst2=Jreader.new EmbededSecureRead_ST();
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMDSECUREREAD, esrst);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_EMDSECUREREAD, esrst2);
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMDSECUREREAD, null);
TagFilter_ST tfst=Jreader.new TagFilter_ST();
tfst.bank=1;
tfst.fdata=new byte[]{(byte) 0xE2,(byte) 0x00};
//flen 0 ????????
tfst.flen=2;
tfst.isInvert=0;
tfst.startaddr=2;
TagFilter_ST tfst2=Jreader.new TagFilter_ST();
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_FILTER, tfst);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_FILTER, tfst2);
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_FILTER, null);
Inv_Potls_ST ipst=Jreader.new Inv_Potls_ST();
ipst.potlcnt=1;
ipst.potls=new Inv_Potl[1];
for(int i=0;i<ipst.potlcnt;i++)
{
Inv_Potl ipl=Jreader.new Inv_Potl();
ipl.weight=30;
ipl.potl=SL_TagProtocol.SL_TAG_PROTOCOL_GEN2;
ipst.potls[0]=ipl;
}
Inv_Potls_ST ipst2=Jreader.new Inv_Potls_ST();
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst2);
for(int i=0;i<ipst2.potlcnt;i++)
System.out.println(ipst2.potls[i].potl);
val1[0]=1;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_SEARCH_MODE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_SEARCH_MODE, val2);
val1[0]=1;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAGDATA_RECORDHIGHESTRSSI, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAGDATA_RECORDHIGHESTRSSI, val2);
val1[0]=1;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYANT, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYANT, val2);
val1[0]=1;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYEMDDATA, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYEMDDATA, val2);
val1[0]=300;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TRANS_TIMEOUT, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TRANS_TIMEOUT, val2);
val1[0]=1;
val2[0]=0;
er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TRANSMIT_MODE, val1);
er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TRANSMIT_MODE, val2);
}
public void testgpio() {
READER_ERR er=Jreader.SetGPO(1, 1);
er=Jreader.SetGPO(2, 0);
er=Jreader.SetGPO(3, 0);
er=Jreader.SetGPO(4, 1);
int[] val=new int[1];
er=Jreader.GetGPI(1, val);
er=Jreader.GetGPI(2, val);
er=Jreader.GetGPI(3, val);
er=Jreader.GetGPI(4, val);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
// maintest mt=new maintest();
// //????????
// System.out.println(er.toString());
// /*
// * 构建天线组功率:AntPowerConf
// * 成员:
// * AntPower数组
// * antcnt表示天线个数
// * AntPower类型
// * antid 天线号
// * readPower 读功率
// * writePower 写功率
// */
//
// AntPowerConf apcf=Jreader.new AntPowerConf();
// apcf.antcnt=AntCount;
// for(int i=0;i<apcf.antcnt;i++)
// {
// AntPower jaap=Jreader.new AntPower();
// jaap.antid=i+1;
//// jaap.readPower=2800;
// jaap.readPower=1000;
// jaap.writePower=1000;
//// jaap.writePower=2750;
// apcf.Powers[i]=jaap;
// }
// AntPowerConf apcf2=Jreader.new AntPowerConf();
// er=Jreader.ParamSet( Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf);
// er=Jreader.ParamGet( Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf2);
// for(int i=0;i<apcf2.antcnt;i++){
// System.out.print("antid:"+apcf2.Powers[i].antid);
// System.out.print(" rp:"+apcf2.Powers[i].readPower);
// System.out.print(" wp:"+apcf2.Powers[i].writePower);
// System.out.println();
// }
//
// Inv_Potls_ST ipst=Jreader.new Inv_Potls_ST();
// ipst.potlcnt=1;
// ipst.potls=new Inv_Potl[1];
// for(int i=0;i<ipst.potlcnt;i++){
// Inv_Potl ipl=Jreader.new Inv_Potl();
// ipl.weight=30;
// ipl.potl=SL_TagProtocol.SL_TAG_PROTOCOL_GEN2;
// ipst.potls[0]=ipl;
// }
//
//
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst);
//
// /*
// * 设置是否检查天线
// * 当参数值传入1的时候表示要检查,0表示不检查
// */
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_IS_CHK_ANT, 0);
// }
//
// public List<String> testinventory1() {
// /*
// *
// * 设置频率,对于某天线设置频率表可以提搞读效果
// * HoptableData_ST 天线频率表类
// * lenhtb 表示频率表长度
// * htb 数组int类型,表示具体频点
// HoptableData_ST hdst=Jreader.new HoptableData_ST();
// hdst.lenhtb=2;
// hdst.htb[0]=915250;
// hdst.htb[1]=915750;
//
// READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE,hdst);
// */
//
// /* ants 轮询使用的天线,即连接天线口的天线
// * antcnt 使用的天线个数
// * timeout 读标签的时间
// * pTInfo 存放标签数据的数组
// * tagcnt 存放标签的个数,只需传入一个元素的数组
// */
// int[] tagcnt=new int[1];
// TAGINFO[] taginfo=new TAGINFO[200];
// READER_ERR er=Jreader.TagInventory(new int[]{1}, 1, (short)1000, taginfo, tagcnt);
// List<String> result = new ArrayList<>();
// if(er==READER_ERR.MT_OK_ERR) {
// for(int i=0;i<tagcnt[0];i++) {
// result.add(Reader.bytes_Hexstr(taginfo[i].EpcId));
//// System.out.println("inv1_epc:"+Reader.bytes_Hexstr(taginfo[i].EpcId));
// }
// }
// return result;
// }
//
// public void testinventory2() {
// int[] tagcnt=new int[1];
// TAGINFO taginfo = Jreader.new TAGINFO();
// READER_ERR er=Jreader.TagInventory_Raw(new int[]{1}, 1, (short)1000, tagcnt);
// for(int i=0;i<tagcnt[0];i++)
// {
// er=Jreader.GetNextTag(taginfo);
// if(taginfo!=null)
// System.out.println("inv2_epc:"+Reader.bytes_Hexstr(taginfo.EpcId));
// }
//
// byte[] outbuf=new byte[800];
//
// er=Jreader.TagInventory_Raw(new int[]{1}, 1, (short)1000, tagcnt);
// er=Jreader.GetNextTag_BaseType(outbuf);
//
// }
//
// public void testdataonreader() {
// byte[] data3=new byte[100];
// READER_ERR er=Jreader.ReadDataOnReader(0, data3, 100);
// er=Jreader.SaveDataOnReader(0, data3, 100);
//
// //擦除读写器上数据
// er=Jreader.EraseDataOnReader();
// }
//
// public void testkilltag() {
// String pwd="11000000";
// byte[] data=new byte[4];
// Jreader.Str2Hex(pwd, pwd.length(), data);
// READER_ERR er=Jreader.KillTag(1, data, (short) 1000);
// }
//
// public void testlocktag() {
// String pwd="12340000";
// // READER_ERR er=Jreader.Lock180006BTag(1, 2, 6, (short) 1000);
// byte[] data=new byte[4];
// Jreader.Str2Hex(pwd, pwd.length(), data);
//
// //写数据
// READER_ERR er=Jreader.WriteTagData(1, (char)0, 2, data, 2, null, (short)1000);
// er=Jreader.LockTag(1, (byte)Lock_Obj.LOCK_OBJECT_BANK1.value(), (short)Lock_Type.BANK1_LOCK.value(), data, (short)1000);
//
// //写数据
// er=Jreader.WriteTagData(1, (char)1, 2, new byte[]{0x11,0x22}, 2, null, (short)1000);
// System.out.println("no pwd write"+er.toString());
//
// //写数据
// er=Jreader.WriteTagData(1, (char)1, 2, new byte[]{0x11,0x22}, 2, data, (short)1000);
// System.out.println("pwd write"+er.toString());
//
// er=Jreader.LockTag(1, (byte)Lock_Obj.LOCK_OBJECT_BANK1.value(), (short)Lock_Type.BANK1_UNLOCK.value(), data, (short)1000);
// }
//
// public void testsetip(String ip ,String mask,String gateway) {
// Reader_Ip rip=Jreader.new Reader_Ip();
// /*
// rip.ip=new byte[]{'1','9','2','.','1','6','8','.','1','.','1','0','1'};
// rip.mask=new byte[]{'2','5','5','.','2','5','5','.','2','5','5','.','0'};
// rip.gateway=new byte[]{'1','9','2','.','1','6','8','.','1','.','2','5','4'};
// //*/
//
//// rip.ip="192.168.1.100".getBytes();
//// rip.mask="255.255.255.0".getBytes();
//// rip.gateway="192.168.1.1".getBytes();
// rip.ip=ip.getBytes();
// rip.mask=mask.getBytes();
// rip.gateway=gateway.getBytes();
// //*/
// READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_IP, rip);
//
// }
// public void testrparams() {
// HoptableData_ST hdst=Jreader.new HoptableData_ST();
// hdst.lenhtb=5;
// hdst.htb[0]=915250;
// hdst.htb[1]=916750;
// hdst.htb[2]=917250;
// hdst.htb[3]=925750;
// hdst.htb[4]=926750;
// READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE,hdst);
//
// HoptableData_ST hdst2=Jreader.new HoptableData_ST();
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE, hdst2);
// for(int i=0;i<hdst2.lenhtb;i++)
// {
// System.out.print("htb:"+i);
// System.out.println(" "+(hdst2.htb[i]));
// }
//
// //
// Region_Conf rcf1=Region_Conf.RG_NA;
// Region_Conf[] rcf2=new Region_Conf[1];
//
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_REGION,rcf1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_FREQUENCY_REGION,rcf2);
//
// int[] val1=new int[]{250};
// int[] val2=new int[]{-1};
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_BLF, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_BLF, val2);
//
// val1[0]=496;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_MAXEPCLEN, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_MAXEPCLEN, val2);
//
// val1[0]=10;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_Q, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_Q, val2);
//
// val1[0]=2;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_SESSION, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_SESSION, val2);
//
// val1[0]=2;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_TAGENCODING, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_TAGENCODING, val2);
//
// val1[0]=1;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARGET, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARGET, val2);
//
// val1[0]=3;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARI, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_TARI, val2);
//
// val1[0]=1;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_GEN2_WRITEMODE, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_GEN2_WRITEMODE, val2);
//
// val1[0]=2;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_BLF, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_BLF, val2);
//
// val1[0]=1;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_DELIMITER, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_DELIMITER, val2);
//
// val1[0]=2;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_MODULATION_DEPTH, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_ISO180006B_MODULATION_DEPTH, val2);
//
// //er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POTL_SUPPORTEDPROTOCOLS, val1);
// //er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POTL_SUPPORTEDPROTOCOLS, val2);
//
// val1[0]=1;
// val2[0]=-1;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_POWERSAVE_MODE, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_POWERSAVE_MODE, val2);
//
// //er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_AVAILABLE_ANTPORTS, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_AVAILABLE_ANTPORTS, val2);
//
// ConnAnts_ST cast=Jreader.new ConnAnts_ST();
// //er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_CONN_ANTS, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_CONN_ANTS, cast);
//
//
// Reader_Ip rip2=Jreader.new Reader_Ip();
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_IP, rip2);
// System.out.print("ip:"+rip2.ip.length+" ");
// System.out.println(new String(rip2.ip));
// System.out.println(new String(rip2.mask));
// System.out.println(new String(rip2.gateway));
//
// val1[0]=1;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_IS_CHK_ANT, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_IS_CHK_ANT, val2);
//
//
// //er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_READER_VERSION, val1);
// //er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_READER_VERSION, val2);
//
// AntPowerConf apcf=Jreader.new AntPowerConf();
// apcf.antcnt=1;
// for(int i=0;i<apcf.antcnt;i++)
// {
// AntPower jaap=Jreader.new AntPower();
// jaap.antid=i+1;
// jaap.readPower=2800;
// jaap.writePower=2750;
// apcf.Powers[i]=jaap;
// }
// AntPowerConf apcf2=Jreader.new AntPowerConf();
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_ANTPOWER, apcf2);
// for(int i=0;i<apcf2.antcnt;i++)
// {
// System.out.print("antid:"+apcf2.Powers[i].antid);
// System.out.print(" rp:"+apcf2.Powers[i].readPower);
// System.out.print(" wp:"+apcf2.Powers[i].writePower);
// System.out.println();
// }
//
// val1[0]=100;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_HOPTIME, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_HOPTIME, val2);
//
// val1[0]=1;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_LBT_ENABLE, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_LBT_ENABLE, val2);
//
//
// //er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_MAXPOWER, val1);
// short[] valso=new short[1];
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_MAXPOWER, valso);
// System.out.println("max:"+valso[0]);
//
// //er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_MINPOWER, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_MINPOWER, valso);
//
// //er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_SUPPORTEDREGIONS, val1);
// //er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_SUPPORTEDREGIONS, val2);
//
// //er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_RF_TEMPERATURE, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_RF_TEMPERATURE, val2);
//
// EmbededData_ST edst = Jreader.new EmbededData_ST();
// edst.startaddr=0;
// edst.bank=2;
// //bytecnt=0 取消嵌入数据
// edst.bytecnt=2;
// edst.accesspwd=null;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMBEDEDDATA, edst);
//
// EmbededData_ST edst2 = Jreader.new EmbededData_ST();
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_EMBEDEDDATA, edst2);
//
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMBEDEDDATA, null);
//
// EmbededSecureRead_ST esrst=Jreader.new EmbededSecureRead_ST();
// esrst.accesspwd=1280;
// esrst.address=2;
// esrst.ApIndexBitsNumInEpc=1;
// esrst.ApIndexStartBitsInEpc=3;
// esrst.bank=1;
// //blkcnt =0 取消。
// esrst.blkcnt=2;
// esrst.pwdtype=1;
// esrst.tagtype=2;
// EmbededSecureRead_ST esrst2=Jreader.new EmbededSecureRead_ST();
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMDSECUREREAD, esrst);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_EMDSECUREREAD, esrst2);
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_EMDSECUREREAD, null);
//
// TagFilter_ST tfst=Jreader.new TagFilter_ST();
// tfst.bank=1;
// tfst.fdata=new byte[]{(byte) 0xE2,(byte) 0x00};
// //flen 0 为取消过滤
// tfst.flen=2;
// tfst.isInvert=0;
// tfst.startaddr=2;
// TagFilter_ST tfst2=Jreader.new TagFilter_ST();
//
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_FILTER, tfst);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_FILTER, tfst2);
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_FILTER, null);
//
// Inv_Potls_ST ipst=Jreader.new Inv_Potls_ST();
// ipst.potlcnt=1;
// ipst.potls=new Inv_Potl[1];
// for(int i=0;i<ipst.potlcnt;i++)
// {
// Inv_Potl ipl=Jreader.new Inv_Potl();
// ipl.weight=30;
// ipl.potl=SL_TagProtocol.SL_TAG_PROTOCOL_GEN2;
// ipst.potls[0]=ipl;
// }
//
// Inv_Potls_ST ipst2=Jreader.new Inv_Potls_ST();
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_INVPOTL, ipst2);
// for(int i=0;i<ipst2.potlcnt;i++)
// System.out.println(ipst2.potls[i].potl);
//
// val1[0]=1;
// val2[0]=0;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAG_SEARCH_MODE, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAG_SEARCH_MODE, val2);
//
// val1[0]=1;
// val2[0]=0;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAGDATA_RECORDHIGHESTRSSI, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAGDATA_RECORDHIGHESTRSSI, val2);
//
// val1[0]=1;
// val2[0]=0;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYANT, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYANT, val2);
//
// val1[0]=1;
// val2[0]=0;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYEMDDATA, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TAGDATA_UNIQUEBYEMDDATA, val2);
//
// val1[0]=300;
// val2[0]=0;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TRANS_TIMEOUT, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TRANS_TIMEOUT, val2);
//
// val1[0]=1;
// val2[0]=0;
// er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_TRANSMIT_MODE, val1);
// er=Jreader.ParamGet(Mtr_Param.MTR_PARAM_TRANSMIT_MODE, val2);
// }
//
// public void testgpio() {
// READER_ERR er=Jreader.SetGPO(1, 1);
// er=Jreader.SetGPO(2, 0);
// er=Jreader.SetGPO(3, 0);
// er=Jreader.SetGPO(4, 1);
//
// int[] val=new int[1];
// er=Jreader.GetGPI(1, val);
// er=Jreader.GetGPI(2, val);
// er=Jreader.GetGPI(3, val);
// er=Jreader.GetGPI(4, val);
// }
//
//
// public static void main(String[] args) {
// // TODO Auto-generated method stub
//
// ReadUtils mt=new ReadUtils();
// //测试初始化
// //启动
// mt.testinitreader();
//???????
//mt.testtran();
//????gpio
//mt.testgpio();
//???????
//mt.testrparams();
//????????
//mt.testblockop();
//???????????
//mt.testcustomcmd();
//???????????????
//mt.testdataonreader();
//????????1
//盘存
// //测试转换
// //mt.testtran();
// //测试gpio
// //mt.testgpio();
// //测试参数
// //mt.testrparams();
// //测试块操作
// //mt.testblockop();
// //测试特殊指令
// //mt.testcustomcmd();
// //测试读写器内部数据
// //mt.testdataonreader();
// //测试盘点方式1
// //盘存
// mt.testinventory1();
//????????2
// mt.testinventory2();
//????????????
//mt.testkilltag();
//?????????
//mt.testlocktag();
//?????????
// mt.testreadandwrite();
//?????ip???
//可以修改ip
// //测试盘点方式2
//// mt.testinventory2();
// //测试销毁密码
// //mt.testkilltag();
// //测试锁标签
// //mt.testlocktag();
// //测试读写标签
//// mt.testreadandwrite();
// //测试改ip地址
// //可以修改ip
// mt.testsetip();
//????psam
//mt.testpsam();
//???????
//关闭
//
// //测试psam
// //mt.testpsam();
//
// //关闭读写器
// //关闭
// mt.Jreader.CloseReader();
// System.out.println("test over");
}
}
// }
//
//}
package com.tykj.dev.socket;
/**
* zsp
*/
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class MessageError {
private String rfid;
private String message;
}
......@@ -2,14 +2,17 @@ package com.tykj.dev.socket;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import java.io.IOException;
import java.net.Socket;
import java.util.concurrent.ConcurrentHashMap;
/**
......@@ -20,8 +23,9 @@ import java.util.concurrent.ConcurrentHashMap;
* @createTime 2020年08月19日 23:53:00
*/
@Slf4j
@ServerEndpoint(value = "/websocket/{userId}") //接受websocket请求路径
@ServerEndpoint(value = "/public/websocket/{userId}") //接受websocket请求路径
@Component //注册到spring容器中
@Data
public class MyWebSocket {
/**
* concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
......@@ -66,12 +70,13 @@ public class MyWebSocket {
//加入set中
//在线数加1
}
log.info("用户连接:" + userId + ",当前在线人数为:" + webSocketMap.size());
sendMessage("连接成功");
}
/**
* 连接关闭调用的方法
*/
......@@ -89,9 +94,15 @@ public class MyWebSocket {
log.info("用户退出:" + userId + ",当前在线人数为:" + webSocketMap.size());
}
public MyWebSocket getMap(String userId) {
MyWebSocket myWebSocket = webSocketMap.get(userId);
log.info("用户退出:" + userId + ",当前在线人数为:" + webSocketMap.size());
return myWebSocket;
}
/**
* 收到客户端消息后调用的方法
*
* @param message 客户端发送过来的消息
*/
@OnMessage
......@@ -141,10 +152,55 @@ public class MyWebSocket {
}
}
/**
* 实现服务器主动推送
*/
public void sendMessage2(Object o) {
try {
this.session.getBasicRemote().sendText(JSONObject.toJSONString(o));
} catch (IOException e) {
e.printStackTrace();
}
}
public void sendMessage1() {
for (String i : webSocketMap.keySet()) {
webSocketMap.get(i).sendMessage("1");
}
}
public void sendMessageForReadMachine(Object o) {
for (String i : webSocketMap.keySet()) {
webSocketMap.get(i).sendMessage2(o);
}
}
public void sendMessageForReadMachine1(Object o,Integer userId) {
webSocketMap.get(String.valueOf(userId)).sendMessage2(o);
}
public void sendMessageForReadMachineError(String rfid) {
for (String i : webSocketMap.keySet()) {
webSocketMap.get(i).sendMessage2(new MessageError(rfid,"该RFID为:"+rfid+"设备查询不到"));
}
}
/**
* 判断是否断开连接,断开返回true,没有返回false
* @param socket
* @return
*/
// public Boolean isServerClose(Socket socket){
// try{
// socket.sendUrgentData(0xFF);//发送1个字节的紧急数据,默认情况下,服务器端没有开启紧急数据处理,不影响正常通信
// return false;
// }catch(Exception se){
// return true;
// }
// }
}
......@@ -10,12 +10,16 @@ import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceLibraryPositionService;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLibraryPosition;
import com.tykj.dev.device.library.subject.vo.DeviceLibraryPositionMessageVo;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySaveVo;
import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.library.subject.vo.RotationVo;
import com.tykj.dev.device.library.utils.DeviceNumberUtils;
import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
......@@ -44,6 +48,7 @@ import com.tykj.dev.rfid.service.impl.RfidServiceImpl;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
......@@ -51,15 +56,18 @@ import org.springframework.cache.annotation.CacheEvict;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StopWatch;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.Executor;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toMap;
/**
......@@ -69,6 +77,7 @@ import static java.util.stream.Collectors.toMap;
@RequestMapping(value = "/storage")
@AutoDocument
@Api(tags = "装备入库模块", description = "装备入库接口")
@Slf4j
public class StorageBillController {
@Autowired
TaskService taskService;
......@@ -126,6 +135,9 @@ public class StorageBillController {
@Autowired
private DeviceLibraryCacheService cacheLibraryService;
@Resource
private DeviceLibraryPositionService positionService;
@ApiOperation(value = "判断序列号是否存在申请任务中", notes = "判断序列号是否存在申请任务中")
@PostMapping(value = "/existApplyTask")
public ResponseEntity existApplyTask(@RequestBody List<String> seqs){
......@@ -161,9 +173,25 @@ public class StorageBillController {
}
}
// @ApiOperation(value = "自动生成装备序列号", notes = "可以通过这个接口自动生成序列号")
// @PostMapping(value = "/autoCreate/{num}")
// public ResponseEntity autoCreate(@PathVariable("num") int num){
// Long seq = snowflake.creatNextId();
// StringBuffer stringBuffer = new StringBuffer();
// stringBuffer.append(seq);
// if (num>1) {
// stringBuffer.append("-");
// stringBuffer.append(seq + num - 1);
// }
// //根据区间生成一个集合
// List<String> seqs = DeviceSeqUtil.selectDeviceSeqs(stringBuffer.toString());
// return ResponseEntity.ok(stringBuffer.toString());
// }
@ApiOperation(value = "自动生成装备序列号", notes = "可以通过这个接口自动生成序列号")
@PostMapping(value = "/autoCreate/{num}")
public ResponseEntity autoCreate(@PathVariable("num") int num){
@PostMapping(value = "/autoCreate")
public ResponseEntity<CreateSeqVo> autoCreate(@RequestBody ReceiveCreateSeqVo receiveCreateSeqVo){
CreateSeqVo createSeqVo = new CreateSeqVo();
Integer num = receiveCreateSeqVo.getStorageCount();
Long seq = snowflake.creatNextId();
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(seq);
......@@ -171,47 +199,53 @@ public class StorageBillController {
stringBuffer.append("-");
stringBuffer.append(seq + num - 1);
}
return ResponseEntity.ok(stringBuffer.toString());
//根据区间生成一个集合
List<String> selectDeviceSeqs = DeviceSeqUtil.selectDeviceSeqs(stringBuffer.toString());
createSeqVo.setSeqInterval(stringBuffer.toString());
createSeqVo.setSeqList(selectDeviceSeqs);
createSeqVo.setStorageCount(num);
createSeqVo.setPackingLibrary(packingLibraryService.getOne(receiveCreateSeqVo.getPackingId()));
return ResponseEntity.ok(createSeqVo);
}
@ApiOperation(value = "自动生成配件序列号", notes = "可以通过这个接口自动生成序列号")
@PostMapping(value = "/autoCreateForPart")
public ResponseEntity autoCreateForPart(@RequestBody CreateSeqVo createSeqVo){
Integer num = createSeqVo.getNum();
//根据型号查询数据库
// int maxSeqNumber = deviceLibraryService.getMaxSeqNumber(createSeqVo.getModel());
// List<String> seqList = IntStream.rangeClosed(maxSeqNumber + 1, num)
// .mapToObj(DeviceNumberUtils::parseNumber2Seq)
// .collect(Collectors.toList());
List<String> strings = deviceLibraryService.getMaxPartSeqNumber(createSeqVo.getModel(), 1);
int start =0;
if (!CollectionUtils.isEmpty(strings)){
//说明数据库中存有该集合中的数字
String s = strings.get(0);
start = Integer.parseInt(s);
}
List<String> seq2 = createSeq2(start+1, start+1+num);
// StringJoiner stringBuffer = new StringJoiner("-");
StringBuilder stringBuilder = new StringBuilder();
String model = createSeqVo.getModel();
String type = createSeqVo.getType();
String style = createSeqVo.getStyle();
if (style.length()<2){
style = "0"+style;
}
if (type.length()<2){
type = "0"+type;
}
String modelTypeStyle = model+type+style;
stringBuilder
.append(modelTypeStyle)
.append(seq2.get(0))
.append("-")
.append(modelTypeStyle)
.append(seq2.get(seq2.size()-1));
return ResponseEntity.ok(stringBuilder);
}
// @ApiOperation(value = "自动生成配件序列号", notes = "可以通过这个接口自动生成序列号")
// @PostMapping(value = "/autoCreateForPart")
// public ResponseEntity autoCreateForPart(@RequestBody CreateSeqVo createSeqVo){
// Integer num = createSeqVo.getNum();
//
// //根据型号查询数据库
//// int maxSeqNumber = deviceLibraryService.getMaxSeqNumber(createSeqVo.getModel());
//// List<String> seqList = IntStream.rangeClosed(maxSeqNumber + 1, num)
//// .mapToObj(DeviceNumberUtils::parseNumber2Seq)
//// .collect(Collectors.toList());
// List<String> strings = deviceLibraryService.getMaxPartSeqNumber(createSeqVo.getModel(), 1);
// int start =0;
// if (!CollectionUtils.isEmpty(strings)){
// //说明数据库中存有该集合中的数字
// String s = strings.get(0);
// start = Integer.parseInt(s);
// }
// List<String> seq2 = createSeq2(start+1, start+1+num);
//// StringJoiner stringBuffer = new StringJoiner("-");
// StringBuilder stringBuilder = new StringBuilder();
// String model = createSeqVo.getModel();
// String type = createSeqVo.getType();
// String style = createSeqVo.getStyle();
// if (style.length()<2){
// style = "0"+style;
// }
// if (type.length()<2){
// type = "0"+type;
// }
// String modelTypeStyle = model+type+style;
// stringBuilder
// .append(modelTypeStyle)
// .append(seq2.get(0))
// .append("-")
// .append(modelTypeStyle)
// .append(seq2.get(seq2.size()-1));
// return ResponseEntity.ok(stringBuilder);
// }
@ApiOperation(value = "获取序列号区间列表", notes = "可以通过这个接口获取序列号区间列表")
@GetMapping(value = "/getSeq/{num}/{string}")
......@@ -225,178 +259,218 @@ public class StorageBillController {
return ResultUtil.success(DeviceSeqUtil.createDeviceSeqs(s,num));
}
// @ApiOperation(value = "选择入库型号数量", notes = "可以通过这个接口选择入库型号数量")
// @PostMapping(value = "/addStorageDetail")
// public ResponseEntity addStorageDetail(@RequestBody List<StorageBillDetailVo> list) {
// //存放所有的列装
// List<PackingLibrary> libraryEntities = new ArrayList<>();
//
// Map<Integer, List<PackingLibrary>> map = new HashMap<>();
// //所有的序列号
// List<String> seqs = new ArrayList<>();
// for (StorageBillDetailVo s : list) {
// if (s.getStorageCount()>0) {
// //序列号区间
// List<String> strings = DeviceSeqUtil.createDeviceSeqs(s.getSeqInterval(), s.getStorageCount());
// //生产号区间
// List<String> strings3 = DeviceSeqUtil.createDeviceSeqs(s.getProdInterval(), s.getStorageCount());
// List<List<String>> sons = new ArrayList<>();
// List<List<String>> sons2 = new ArrayList<>();
// List<List<String>> sons3 = new ArrayList<>();
// List<List<String>> sons4 = new ArrayList<>();
// int count = 1;
// //入库的数量
// Integer deviceNum = s.getStorageCount();
//
// while (deviceNum >= count) {
// PackingLibrary packingLibraryEntity = new PackingLibrary();
// BeanUtils.copyProperties(packingLibraryService.getOne(s.getPackingId()), packingLibraryEntity);
// packingLibraryEntity.setCorresponding(count);
//// packingLibraryEntity.setIsSinglePart(1);
// if (!strings3.isEmpty()) {
// packingLibraryEntity.setProdNumber(strings3.get(0));
// strings3.remove(0);
// }
// if (!strings.isEmpty()) {
// if (deviceLibraryDao.getAllBySeqNumber(strings.get(0)).size() > 0) {
// throw new ApiException("序列号" + strings.get(0) + "已存在");
// }
// if (seqs.contains(strings.get(0))){
// throw new ApiException("序列号" + strings.get(0) + "不能重复");
// }
// packingLibraryEntity.setSeq(strings.get(0));
// strings.remove(0);
// }
// seqs.add(packingLibraryEntity.getSeq());
// libraryEntities.add(packingLibraryEntity);
// if (s.getList() != null && s.getList().size() != 0) {
// for (int j = 0; j < s.getList().size(); j++) {
// StorageBillDetailVo s2 = s.getList().get(j);
// if (j >= sons.size()) {
// sons.add(DeviceSeqUtil.createDeviceSeqs(s2.getSeqInterval(), s2.getStorageCount()));
// sons2.add(DeviceSeqUtil.createDeviceSeqs(s2.getProdInterval(), s2.getStorageCount()));
// }
// packingLibraryEntity = packingLibraryService.getOne(s2.getPackingId());
// List<String> strings2 = sons.get(j);
// List<String> strings1 = sons2.get(j);
// if (s2.getStorageCount() >= count) {
// packingLibraryEntity.setIsSinglePart(0);
// packingLibraryEntity.setCorresponding(count);
// if (!strings2.isEmpty()) {
// if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) {
// throw new ApiException("序列号" + strings2.get(0) + "已存在");
// }
// if (seqs.contains(strings2.get(0))){
// throw new ApiException("序列号" + strings2.get(0) + "不能重复");
// }
// packingLibraryEntity.setSeq(strings2.get(0));
// strings2.remove(0);
// }
// if (!strings1.isEmpty()) {
// packingLibraryEntity.setProdNumber(strings1.get(0));
// strings1.remove(0);
// }
// seqs.add(packingLibraryEntity.getSeq());
// libraryEntities.add(packingLibraryEntity);
// }
// if (s2.getStorageCount() - strings2.size() == deviceNum) {
// List<PackingLibrary> packingLibraries = new ArrayList<>();
// for (int i = 0; i < s2.getStorageCount() - deviceNum; i++) {
// packingLibraryEntity = packingLibraryService.getOne(s2.getPackingId());
// packingLibraryEntity.setCorresponding(0);
//// packingLibraryEntity.setIsSinglePart(1);
//
// if (!strings2.isEmpty()) {
// if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) {
// throw new ApiException("序列号" + strings2.get(0) + "已存在");
// }
// if (seqs.contains(strings2.get(0))){
// throw new ApiException("序列号" + strings2.get(0) + "不能重复");
// }
// packingLibraryEntity.setSeq(strings2.get(0));
// strings2.remove(0);
// }
// if (!strings1.isEmpty()) {
// packingLibraryEntity.setProdNumber(strings1.get(0));
// strings1.remove(0);
// }
// seqs.add(packingLibraryEntity.getSeq());
// packingLibraries.add(packingLibraryEntity);
// }
// map.put(s2.getPackingId(), packingLibraries);
// }
// if (s2.getList() != null && s2.getList().size() != 0) {
// for (int k = 0; k < s2.getList().size(); k++) {
// StorageBillDetailVo s3 = s2.getList().get(k);
// if (k >= sons3.size()) {
// sons3.add(DeviceSeqUtil.createDeviceSeqs(s3.getSeqInterval(), s3.getStorageCount()));
// sons4.add(DeviceSeqUtil.createDeviceSeqs(s3.getProdInterval(), s3.getStorageCount()));
// }
// packingLibraryEntity = packingLibraryService.getOne(s3.getPackingId());
// List<String> strings4 = sons3.get(k);
// List<String> strings5 = sons4.get(k);
// if (s3.getStorageCount() >= count) {
//// packingLibraryEntity.setIsSinglePart(0);
// packingLibraryEntity.setCorresponding(count);
//
// if (!strings4.isEmpty()) {
// if (deviceLibraryDao.getAllBySeqNumber(strings4.get(0)).size() > 0) {
// throw new ApiException("序列号" + strings4.get(0) + "已存在");
// }
// if (seqs.contains(strings4.get(0))){
// throw new ApiException("序列号" + strings4.get(0) + "不能重复");
// }
// packingLibraryEntity.setSeq(strings4.get(0));
// strings4.remove(0);
// }
// if (!strings5.isEmpty()) {
// packingLibraryEntity.setProdNumber(strings5.get(0));
// strings5.remove(0);
// }
// seqs.add(packingLibraryEntity.getSeq());
// libraryEntities.add(packingLibraryEntity);
// }
// if (s3.getStorageCount() - strings4.size() == deviceNum) {
// List<PackingLibrary> packingLibraries = new ArrayList<>();
// for (int i = 0; i < s3.getStorageCount() - deviceNum; i++) {
// packingLibraryEntity = packingLibraryService.getOne(s3.getPackingId());
// packingLibraryEntity.setCorresponding(0);
//// packingLibraryEntity.setIsSinglePart(1);
//
//
// if (!strings4.isEmpty()) {
// if (deviceLibraryDao.getAllBySeqNumber(strings4.get(0)).size() > 0) {
// throw new ApiException("序列号" + strings4.get(0) + "已存在");
// }
// if (seqs.contains(strings4.get(0))){
// throw new ApiException("序列号" + strings4.get(0) + "不能重复");
// }
// packingLibraryEntity.setSeq(strings4.get(0));
// strings4.remove(0);
// }
// if (!strings5.isEmpty()) {
// packingLibraryEntity.setProdNumber(strings5.get(0));
// strings5.remove(0);
// }
// seqs.add(packingLibraryEntity.getSeq());
// packingLibraries.add(packingLibraryEntity);
// }
// map.put(s3.getPackingId(), packingLibraries);
// }
// }
//
// }
// }
//
// }
// count = count + 1;
// }
// }
// }
// for (Integer i : map.keySet()) {
// libraryEntities.addAll(map.get(i));
// }
// return ResultUtil.success(libraryEntities);
// }
@ApiOperation(value = "选择入库型号数量", notes = "可以通过这个接口选择入库型号数量")
@PostMapping(value = "/addStorageDetail")
public ResponseEntity addStorageDetail(@RequestBody List<StorageBillDetailVo> list) {
//存放所有的列装
List<PackingLibrary> libraryEntities = new ArrayList<>();
Map<Integer, List<PackingLibrary>> map = new HashMap<>();
//所有的序列号
List<String> seqs = new ArrayList<>();
for (StorageBillDetailVo s : list) {
if (s.getStorageCount()>0) {
//序列号区间
List<String> strings = DeviceSeqUtil.createDeviceSeqs(s.getSeqInterval(), s.getStorageCount());
//生产号区间
List<String> strings3 = DeviceSeqUtil.createDeviceSeqs(s.getProdInterval(), s.getStorageCount());
List<List<String>> sons = new ArrayList<>();
List<List<String>> sons2 = new ArrayList<>();
List<List<String>> sons3 = new ArrayList<>();
List<List<String>> sons4 = new ArrayList<>();
int count = 1;
//入库的数量
Integer deviceNum = s.getStorageCount();
while (deviceNum >= count) {
PackingLibrary packingLibraryEntity = new PackingLibrary();
BeanUtils.copyProperties(packingLibraryService.getOne(s.getPackingId()), packingLibraryEntity);
packingLibraryEntity.setCorresponding(count);
packingLibraryEntity.setIsSinglePart(1);
if (!strings3.isEmpty()) {
packingLibraryEntity.setProdNumber(strings3.get(0));
strings3.remove(0);
}
if (!strings.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings.get(0)).size() > 0) {
throw new ApiException("序列号" + strings.get(0) + "已存在");
}
if (seqs.contains(strings.get(0))){
throw new ApiException("序列号" + strings.get(0) + "不能重复");
}
packingLibraryEntity.setSeq(strings.get(0));
strings.remove(0);
}
seqs.add(packingLibraryEntity.getSeq());
libraryEntities.add(packingLibraryEntity);
if (s.getList() != null && s.getList().size() != 0) {
for (int j = 0; j < s.getList().size(); j++) {
StorageBillDetailVo s2 = s.getList().get(j);
if (j >= sons.size()) {
sons.add(DeviceSeqUtil.createDeviceSeqs(s2.getSeqInterval(), s2.getStorageCount()));
sons2.add(DeviceSeqUtil.createDeviceSeqs(s2.getProdInterval(), s2.getStorageCount()));
}
packingLibraryEntity = packingLibraryService.getOne(s2.getPackingId());
List<String> strings2 = sons.get(j);
List<String> strings1 = sons2.get(j);
if (s2.getStorageCount() >= count) {
packingLibraryEntity.setIsSinglePart(0);
packingLibraryEntity.setCorresponding(count);
if (!strings2.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) {
throw new ApiException("序列号" + strings2.get(0) + "已存在");
}
if (seqs.contains(strings2.get(0))){
throw new ApiException("序列号" + strings2.get(0) + "不能重复");
}
packingLibraryEntity.setSeq(strings2.get(0));
strings2.remove(0);
}
if (!strings1.isEmpty()) {
packingLibraryEntity.setProdNumber(strings1.get(0));
strings1.remove(0);
}
seqs.add(packingLibraryEntity.getSeq());
libraryEntities.add(packingLibraryEntity);
}
if (s2.getStorageCount() - strings2.size() == deviceNum) {
List<PackingLibrary> packingLibraries = new ArrayList<>();
for (int i = 0; i < s2.getStorageCount() - deviceNum; i++) {
packingLibraryEntity = packingLibraryService.getOne(s2.getPackingId());
packingLibraryEntity.setCorresponding(0);
packingLibraryEntity.setIsSinglePart(1);
if (!strings2.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings2.get(0)).size() > 0) {
throw new ApiException("序列号" + strings2.get(0) + "已存在");
}
if (seqs.contains(strings2.get(0))){
throw new ApiException("序列号" + strings2.get(0) + "不能重复");
}
packingLibraryEntity.setSeq(strings2.get(0));
strings2.remove(0);
}
if (!strings1.isEmpty()) {
packingLibraryEntity.setProdNumber(strings1.get(0));
strings1.remove(0);
}
seqs.add(packingLibraryEntity.getSeq());
packingLibraries.add(packingLibraryEntity);
}
map.put(s2.getPackingId(), packingLibraries);
}
if (s2.getList() != null && s2.getList().size() != 0) {
for (int k = 0; k < s2.getList().size(); k++) {
StorageBillDetailVo s3 = s2.getList().get(k);
if (k >= sons3.size()) {
sons3.add(DeviceSeqUtil.createDeviceSeqs(s3.getSeqInterval(), s3.getStorageCount()));
sons4.add(DeviceSeqUtil.createDeviceSeqs(s3.getProdInterval(), s3.getStorageCount()));
}
packingLibraryEntity = packingLibraryService.getOne(s3.getPackingId());
List<String> strings4 = sons3.get(k);
List<String> strings5 = sons4.get(k);
if (s3.getStorageCount() >= count) {
packingLibraryEntity.setIsSinglePart(0);
packingLibraryEntity.setCorresponding(count);
if (!strings4.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings4.get(0)).size() > 0) {
throw new ApiException("序列号" + strings4.get(0) + "已存在");
}
if (seqs.contains(strings4.get(0))){
throw new ApiException("序列号" + strings4.get(0) + "不能重复");
}
packingLibraryEntity.setSeq(strings4.get(0));
strings4.remove(0);
}
if (!strings5.isEmpty()) {
packingLibraryEntity.setProdNumber(strings5.get(0));
strings5.remove(0);
}
seqs.add(packingLibraryEntity.getSeq());
libraryEntities.add(packingLibraryEntity);
}
if (s3.getStorageCount() - strings4.size() == deviceNum) {
List<PackingLibrary> packingLibraries = new ArrayList<>();
for (int i = 0; i < s3.getStorageCount() - deviceNum; i++) {
packingLibraryEntity = packingLibraryService.getOne(s3.getPackingId());
packingLibraryEntity.setCorresponding(0);
packingLibraryEntity.setIsSinglePart(1);
if (!strings4.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings4.get(0)).size() > 0) {
throw new ApiException("序列号" + strings4.get(0) + "已存在");
}
if (seqs.contains(strings4.get(0))){
throw new ApiException("序列号" + strings4.get(0) + "不能重复");
}
packingLibraryEntity.setSeq(strings4.get(0));
strings4.remove(0);
}
if (!strings5.isEmpty()) {
packingLibraryEntity.setProdNumber(strings5.get(0));
strings5.remove(0);
}
seqs.add(packingLibraryEntity.getSeq());
packingLibraries.add(packingLibraryEntity);
}
map.put(s3.getPackingId(), packingLibraries);
}
}
}
}
}
count = count + 1;
public ResponseEntity<List<BackCreateSeqVo>> addStorageDetail(@RequestBody List<CreateSeqVo> createSeqVos) {
List<BackCreateSeqVo> backCreateSeqVos = new ArrayList<>();
//当手动输入序列号的时候 需要进行遍历成集合
createSeqVos.forEach(createSeqVo -> {
List<String> deviceSeqs = DeviceSeqUtil.selectDeviceSeqs(createSeqVo.getSeqInterval());
createSeqVo.setSeqList(deviceSeqs);
});
//做校验 数量跟序列号
createSeqVos.forEach(createSeqVo -> {
if (createSeqVo.getStorageCount()!=createSeqVo.getSeqList().size()){
throw new ApiException("序列号与入库数量不匹配");
}
});
//做校验 检查序列号是否重复
//1.查询出所有的序列号
List<String> allSeqList =
cacheLibraryService.getAllDeviceLibraryList().stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
createSeqVos.forEach(createSeqVo -> {
List<String> seqList = createSeqVo.getSeqList();
seqList.forEach(s -> {
if (allSeqList.contains(s)){
throw new ApiException("序列号"+s+"已存在");
}
});
});
// 开始拆分装备
for (CreateSeqVo createSeqVo : createSeqVos) {
List<String> seqList = createSeqVo.getSeqList();
for (int i = 0; i < seqList.size(); i++) {
BackCreateSeqVo backCreateSeqVo = new BackCreateSeqVo();
BeanUtils.copyProperties(createSeqVo,backCreateSeqVo);
backCreateSeqVo.setSeqNumber(seqList.get(i));
backCreateSeqVos.add(backCreateSeqVo);
}
}
for (Integer i : map.keySet()) {
libraryEntities.addAll(map.get(i));
}
return ResultUtil.success(libraryEntities);
return ResponseEntity.ok(backCreateSeqVos);
}
@ApiOperation(value = "办结后添加其他单据", notes = "办结后添加其他单据")
......@@ -481,9 +555,96 @@ public class StorageBillController {
}
//存放所有save的装备
List<DeviceLibrary> saveDevices = new ArrayList<>();
String currentUserUnitName = userUtils.getCurrentUserUnitName();
StopWatch stopWatch = new StopWatch();
stopWatch.start();
//保存不需要绑定的装备集合
List<DeviceLibrary> batchEntitiesIsBinding1 = new ArrayList<>();
//保存需要绑定总的集合
List<DeviceLibrary> batchEntitiesIsBinding0 = new ArrayList<>();
//保存单独的配件的集合
List<DeviceLibrary> batchEntitiesSinglePart = new ArrayList<>();
//保存父子集合
List<DeviceLibrary> batchEntities = new ArrayList<>();
// for (DeviceLibrarySaveVo d : storageBillSaveVo.getDeviceLibrarySaveVoList()) {
// if (d.getRfidCardId()==null|| "".equals(d.getRfidCardId()) ||deviceLibraryDao.getAllByRfidCardId(d.getRfidCardId()).size()==0) {
// DeviceLibrary saveEntity = new DeviceLibrary();
// DeviceLibrary deviceLibraryEntity = new DeviceLibrary();
// PackingLibrary packingLibraryEntity = packingLibraryService.getOne(d.getPackingId());
// BeanUtils.copyProperties(packingLibraryEntity, deviceLibraryEntity);
// deviceLibraryEntity.setId(null);
// deviceLibraryEntity.setLifeStatus(2);//设置为在库状态
// BeanUtils.copyProperties(d, deviceLibraryEntity);
// deviceLibraryEntity.setStorageBillId(storageBillId);
// deviceLibraryEntity.setLocationUnit(currentUserUnitName);
// deviceLibraryEntity.setOwnUnit(currentUserUnitName);
// deviceLibraryEntity.setPartParentId(null);
//
// //如果不是单独的配件,设置父装备id为上一个装备的id 0-不是,1-是 0 装备 1 配件
// if (d.getIsBinding() == 0){
// if (d.getIsSinglePart() == 0) {
// //0 不是,1:是
// if (deviceLibraryEntity.getIsPart() == 0) {
// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
// }
// if (deviceLibraryEntity.getIsPart() == 1) {
// if (parentPackingId!=null) {
// for (int i = saveDevices.size()-1;i>=0;i--){
// if (packingLibraryEntity.getPartParentId().equals(saveDevices.get(i).getPackingId())){
// deviceLibraryEntity.setPartParentId(saveDevices.get(i).getId());
// break;
// }
// }
// }
// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
// }
// }
// else {
// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
// }
// }
//// if (d.getIsSinglePart() == 0) {
//// //0 不是,1:是
//// if (deviceLibraryEntity.getIsPart() == 0) {
//// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
//// }
//// if (deviceLibraryEntity.getIsPart() == 1) {
//// if (parentPackingId!=null) {
//// for (int i = saveDevices.size()-1;i>=0;i--){
//// if (packingLibraryEntity.getPartParentId().equals(saveDevices.get(i).getPackingId())){
//// deviceLibraryEntity.setPartParentId(saveDevices.get(i).getId());
//// }
//// }
//// }
//// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
//// }
//// }
// //如果是单独的配件,不用设置父装备id
// else {
// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
// }
// saveDevices.add(saveEntity);
//// parentId = saveEntity.getId();
// parentPackingId = packingLibraryEntity.getId();
// saveEntities.add(saveEntity);
// stringBuffer.append(saveEntity.getId());
// //存装备日志
// DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), logMessage, fileVoList,null,taskEntity1.getId());
// deviceLogDtos.add(deviceLogDto);
// stringBuffer.append("x");
// //申请业务列装入库数量+1
// if (map.get(d.getPackingId())!=null){
// ApplyBillDetailVo applyBillDetailVo = map.get(d.getPackingId());
// applyBillDetailVo.setCompleteCount(applyBillDetailVo.getCompleteCount()+1);
// map.put(d.getPackingId(),applyBillDetailVo);
// }
// }
// else {
// throw new ApiException("系统中已存在rfid卡号为"+d.getRfidCardId()+"的装备!");
// }
// }
for (DeviceLibrarySaveVo d : storageBillSaveVo.getDeviceLibrarySaveVoList()) {
if (d.getRfidCardId()==null|| "".equals(d.getRfidCardId()) ||deviceLibraryDao.getAllByRfidCardId(d.getRfidCardId()).size()==0) {
DeviceLibrary saveEntity = new DeviceLibrary();
DeviceLibrary deviceLibraryEntity = new DeviceLibrary();
PackingLibrary packingLibraryEntity = packingLibraryService.getOne(d.getPackingId());
BeanUtils.copyProperties(packingLibraryEntity, deviceLibraryEntity);
......@@ -491,63 +652,21 @@ public class StorageBillController {
deviceLibraryEntity.setLifeStatus(2);//设置为在库状态
BeanUtils.copyProperties(d, deviceLibraryEntity);
deviceLibraryEntity.setStorageBillId(storageBillId);
deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setLocationUnit(currentUserUnitName);
deviceLibraryEntity.setOwnUnit(currentUserUnitName);
deviceLibraryEntity.setPartParentId(null);
//如果不是单独的配件,设置父装备id为上一个装备的id 0-不是,1-是
//自己的逻辑
//1.将装备全部保存
//1.1不需要绑定
//1.2需要绑定保存以后,将附件的父id进行赋值
//如果不是单独的配件,设置父装备id为上一个装备的id 0-不是,1-是 0 装备 1 配件
if (d.getIsBinding() == 0){
if (d.getIsSinglePart() == 0) {
//0 不是,1:是
if (deviceLibraryEntity.getIsPart() == 0) {
saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
}
if (deviceLibraryEntity.getIsPart() == 1) {
if (parentPackingId!=null) {
for (int i = saveDevices.size()-1;i>=0;i--){
if (packingLibraryEntity.getPartParentId().equals(saveDevices.get(i).getPackingId())){
deviceLibraryEntity.setPartParentId(saveDevices.get(i).getId());
break;
}
}
}
saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
}
}
else {
saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
}
//存放父子集合
batchEntities.add(deviceLibraryEntity);
}
// if (d.getIsSinglePart() == 0) {
// //0 不是,1:是
// if (deviceLibraryEntity.getIsPart() == 0) {
// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
// }
// if (deviceLibraryEntity.getIsPart() == 1) {
// if (parentPackingId!=null) {
// for (int i = saveDevices.size()-1;i>=0;i--){
// if (packingLibraryEntity.getPartParentId().equals(saveDevices.get(i).getPackingId())){
// deviceLibraryEntity.setPartParentId(saveDevices.get(i).getId());
// }
// }
// }
// saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
// }
// }
//如果是单独的配件,不用设置父装备id
else {
saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
batchEntitiesIsBinding1.add(deviceLibraryEntity);
}
saveDevices.add(saveEntity);
// parentId = saveEntity.getId();
parentPackingId = packingLibraryEntity.getId();
saveEntities.add(saveEntity);
stringBuffer.append(saveEntity.getId());
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), logMessage, fileVoList,null,taskEntity1.getId());
// DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), logMessage, fileVoList,null,null);
deviceLogDtos.add(deviceLogDto);
stringBuffer.append("x");
//申请业务列装入库数量+1
if (map.get(d.getPackingId())!=null){
ApplyBillDetailVo applyBillDetailVo = map.get(d.getPackingId());
......@@ -559,6 +678,124 @@ public class StorageBillController {
throw new ApiException("系统中已存在rfid卡号为"+d.getRfidCardId()+"的装备!");
}
}
// 批量保存
batchEntities = deviceLibraryService.batchDevices(batchEntities);
//将父子集合的进行赋值 然后更新
//思路: 1.拿到所有的附件 2.拿到所有的装备 3.判断附件中的列装的id的父id是不是等于装备的列装id
List<DeviceLibrary> parts = batchEntities.stream().filter(deviceLibrary -> deviceLibrary.getIsPart() == 1)
.collect(Collectors.toList());
List<DeviceLibrary> saveParts = new ArrayList<>();
List<DeviceLibrary> devs = batchEntities.stream().filter(deviceLibrary -> deviceLibrary.getIsPart() == 0)
.collect(Collectors.toList());
Map<String, List<DeviceLibrary>> modelsDev = devs.stream().collect(groupingBy(DeviceLibrary::getModel));
Map<String, List<DeviceLibrary>> modelsPart = parts.stream().collect(groupingBy(DeviceLibrary::getModel));
//存放附件
List<DeviceLibrary> deviceLibraries2 = new ArrayList<>();
for (String model : modelsDev.keySet()) {
if (modelsPart.get(model)!=null){
//说明同型号的附件存在
//装备集合
List<DeviceLibrary> deviceLibraries = modelsDev.get(model);
//附件集合
List<DeviceLibrary> deviceLibraries1 = modelsPart.get(model);
if (deviceLibraries.size()>deviceLibraries1.size()){
deviceLibraries = deviceLibraries.subList(0,deviceLibraries1.size());
}
if (deviceLibraries.size()<deviceLibraries1.size()){
//将长度设为一致 截取和装备集合相同数量
// deviceLibraries2 = deviceLibraries1.subList(0, deviceLibraries.size());
List<DeviceLibrary> deviceLibraries3 = deviceLibraries1.subList(0, deviceLibraries.size());
deviceLibraries2.addAll(deviceLibraries3);
deviceLibraries1.removeAll(deviceLibraries2);
//处理多余的附件
saveParts.addAll(deviceLibraries1);
}
if (deviceLibraries2.size()>0){
if (deviceLibraries.size() == deviceLibraries2.size()){
for (int i = 0; i < deviceLibraries.size(); i++) {
for (int j = 0; j < deviceLibraries2.size(); j++) {
if(deviceLibraries.get(i).getPackingId().equals(packingLibraryService.getOne(deviceLibraries2.get(j).getPackingId()).getPartParentId())){
deviceLibraries2.get(j).setPartParentId(deviceLibraries.get(i).getId());
saveParts.add(deviceLibraries2.get(j));
i++;
}
}
}
}
}else {
if (deviceLibraries.size() == deviceLibraries1.size()){
for (int i = 0; i < deviceLibraries1.size(); i++) {
for (int j = 0; j < deviceLibraries1.size(); j++) {
if(deviceLibraries.get(i).getPackingId().equals(packingLibraryService.getOne(deviceLibraries1.get(j).getPackingId()).getPartParentId())){
deviceLibraries1.get(j).setPartParentId(deviceLibraries.get(i).getId());
saveParts.add(deviceLibraries1.get(j));
i++;
}
}
}
}
}
}
}
// if (!devs.isEmpty()){
// if (!parts.isEmpty()){
// if (devs.size()>parts.size()){
// devs = devs.subList(0,parts.size());
// }
// if (devs.size()<parts.size()){
// //将长度设为一致
// List<DeviceLibrary> deviceLibraries = parts.subList(0, devs.size());
// parts.removeAll(deviceLibraries);
// saveParts.addAll(parts);
// }
//
// if (devs.size() == parts.size()){
// for (int i = 0; i < devs.size(); i++) {
// for (int j = 0; j < parts.size(); j++) {
// if(devs.get(i).getPackingId().equals(packingLibraryService.getOne(parts.get(j).getPackingId()).getPartParentId())){
// parts.get(j).setPartParentId(devs.get(i).getId());
// saveParts.add(parts.get(j));
// i++;
// }
// }
// }
// }
//
// }
// }
//批量更新
List<DeviceLibrary> updateParts = deviceLibraryService.batchDevices(saveParts);
batchEntitiesIsBinding0.addAll(updateParts);
batchEntitiesIsBinding0.addAll(devs);
batchEntitiesIsBinding0.addAll(batchEntitiesSinglePart);
if (!batchEntitiesIsBinding1.isEmpty()){
saveDevices.addAll(batchEntitiesIsBinding1);
saveEntities.addAll(batchEntitiesIsBinding1);
}else {
saveDevices.addAll(batchEntitiesIsBinding0);
saveEntities.addAll(batchEntitiesIsBinding0);
}
if (!batchEntitiesIsBinding1.isEmpty()){
batchEntitiesIsBinding1.forEach(deviceLibrary -> {
stringBuffer.append(deviceLibrary.getId());
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceLibrary.getId(), logMessage, fileVoList,null,taskEntity1.getId());
deviceLogDtos.add(deviceLogDto);
stringBuffer.append("x");
});
}else if (!batchEntitiesIsBinding0.isEmpty()){
batchEntitiesIsBinding0.forEach(deviceLibrary -> {
stringBuffer.append(deviceLibrary.getId());
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceLibrary.getId(), logMessage, fileVoList,null,taskEntity1.getId());
deviceLogDtos.add(deviceLogDto);
stringBuffer.append("x");
});
}
stopWatch.stop();
log.info("存放所有save的装备时间:{}",stopWatch.getTotalTimeMillis()+"ms");
//若要打印标签
if(storageBillSaveVo.getIsPrint()==1){
List<PrintVo> printVos = new ArrayList<>();
......@@ -569,7 +806,6 @@ public class StorageBillController {
}
rfidService.printString(printVos);
}
//更新申请业务入库数量
if (deviceApplyBills.size()>0){
deviceApplyBills.forEach(deviceApplyBill -> {
......@@ -618,7 +854,6 @@ public class StorageBillController {
deviceApplyBillService.update(deviceApplyBill);
});
}
deviceLogService.addAllLog(deviceLogDtos);
//4.更新入库单入库详情
storageBillEntity.setStorageDetail(stringBuffer.toString());
......@@ -670,7 +905,27 @@ public class StorageBillController {
}
}
}
log.info("saveDevices:{}",saveDevices.size());
List<DeviceLibraryPosition> deviceLibraryPositions = new ArrayList<>();
//开始存储装备的3D
saveDevices = saveDevices.stream().filter(deviceLibrary -> deviceLibrary.getIsPart() == 0).collect(Collectors.toList());
saveDevices.forEach(deviceLibrary -> {
DeviceLibraryPosition deviceLibraryPosition = new DeviceLibraryPosition();
deviceLibraryPosition.setDeviceId(deviceLibrary.getId());
BeanUtils.copyProperties(deviceLibrary,deviceLibraryPosition);
RotationVo rotationVo = new RotationVo();
String s = rotationVo.toJson();
deviceLibraryPosition.setRotation(s);
DeviceLibraryPositionMessageVo deviceLibraryPositionMessageVo = new DeviceLibraryPositionMessageVo();
String s1 = deviceLibraryPositionMessageVo.toJson();
deviceLibraryPosition.setDeviceLibraryPositionMessage(s1);
deviceLibraryPosition.setStorageLocation(storageBillSaveVo.getStorageLocation());
deviceLibraryPosition.setStorageLocationId(storageBillSaveVo.getStorageLocationId());
deviceLibraryPositions.add(deviceLibraryPosition);
});
log.info("存储3D完成");
//异步存储
executor.execute(()->positionService.batchDeviceLibraryPositions(deviceLibraryPositions));
//完成更新试用修改为正式
if (storageBillSaveVo.getTryOutDevice() == 0 ){
if (storageBillSaveVo.getDeviceIds().size()>0){
......
package com.tykj.dev.device.storage.subject.vo;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
*/
@Data
@ApiModel("拆分之后的装备")
public class BackCreateSeqVo {
@ApiModelProperty(name = "列装对象")
private PackingLibrary packingLibrary;
@ApiModelProperty(name = "入库数量",example = "1")
private Integer storageCount;
@ApiModelProperty(name = "生成的序列号区间",example = "1")
private String seqInterval;
@ApiModelProperty(name = "生成的序列号集合")
private List<String> seqList;
@ApiModelProperty(name = "生成的装备序列号")
private String seqNumber;
}
package com.tykj.dev.device.storage.subject.vo;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
*/
......@@ -11,15 +14,18 @@ import lombok.Data;
@ApiModel("生成附件的装备序列号")
public class CreateSeqVo {
@ApiModelProperty(name = "型号")
private String model;
@ApiModelProperty(name = "列装对象")
private PackingLibrary packingLibrary;
@ApiModelProperty(name = "入库数量",example = "1")
private Integer storageCount;
@ApiModelProperty(name = "生成的序列号区间",example = "1")
private String seqInterval;
@ApiModelProperty(name = "生成的序列号集合")
private List<String> seqList;
@ApiModelProperty(name = "类型",example = "1")
private String type;
@ApiModelProperty(name = "形态",example = "1")
private String style;
@ApiModelProperty(name = "数量")
private Integer num;
}
package com.tykj.dev.device.storage.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author zsp
*/
@Data
@ApiModel("生成装备序列号")
public class ReceiveCreateSeqVo {
@ApiModelProperty(name = "列装id")
private Integer packingId;
@ApiModelProperty(name = "入库数量",example = "1")
private Integer storageCount;
}
......@@ -127,6 +127,18 @@ public class TaskBto {
this.exhibit = exhibit;
}
public TaskBto(Integer billStatus, String title, String nodeIdDetail, Integer billId, Integer businessType, Integer ownUnit, Integer currentPoint, List<Integer> involveUserIdList) {
this.billStatus = billStatus;
this.title = title;
this.nodeIdDetail = nodeIdDetail;
this.billId = billId;
this.businessType = businessType;
this.ownUnit = ownUnit;
this.currentPoint = currentPoint;
this.involveUserIdList = involveUserIdList;
}
/**
* bto类转化为do类
*/
......
......@@ -63,6 +63,10 @@
<groupId>com.tykj</groupId>
<artifactId>dev-sendback</artifactId>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>dev-readmachine</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -36,6 +36,7 @@ import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.taskselect.vo.SignatureSaveVo;
import com.tykj.dev.device.user.cache.UserCache;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.misc.base.ResultObj;
import com.tykj.dev.misc.exception.ApiException;
......@@ -43,12 +44,18 @@ import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.Snowflake;
import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineBill;
import com.tykj.dev.readmachine.devreadmachine.Entity.ReadMachineLibrary;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineBillService;
import com.tykj.dev.readmachine.devreadmachine.service.ReadMachineLibraryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.Area;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -111,9 +118,18 @@ public class TaskSelectController {
@Autowired
private TaskDao taskDao;
@Autowired
private ReadMachineBillService readMachineBillService;
@Autowired
private ReadMachineLibraryService readMachineLibraryService;
// @Autowired
// private DeviceLibraryDao deviceLibraryDao;
@Resource
private UserCache userCache;
@ApiOperation(value = "查询业务对应页面的数据", notes = "可以通过这个接口查询业务对应页面的数据")
@GetMapping("/manage/detail/{id}")
public ResponseEntity selectData(@PathVariable("id") int taskId) {
......@@ -469,6 +485,19 @@ public class TaskSelectController {
list.add(deviceLibraries);
return ResponseEntity.ok(new ResultObj(list, "查询成功"));
case 30:
Map<String,Object> map1 = new HashMap<>();
ReadMachineBill readMachineBill = readMachineBillService.findById(taskBto.getBillId());
readMachineBill.setCreateUserName(userCache.findById(readMachineBill.getCreateUserId()).getName());
readMachineBill.setTaskId(taskId);
//通过盘存账单id查询盘存库
List<ReadMachineLibrary> readMachineLibraries =
readMachineLibraryService.findByReadMachineBillId(readMachineBill.getId());
map1.put("readMachineBill",readMachineBill);
readMachineLibraries.forEach(ReadMachineLibrary::setConfigName);
map1.put("readMachineLibraries",readMachineLibraries);
return ResponseEntity.ok(map1);
default:
throw new ApiException(ResultUtil.failed("该接口不支持当前task业务类型"));
}
......
......@@ -214,6 +214,17 @@
</exclusions>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>dev-readmachine</artifactId>
<exclusions>
<exclusion>
<groupId>com.tykj.dev</groupId>
<artifactId>union</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-destroy</artifactId>
......@@ -509,6 +520,13 @@
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>../dev-readmachine/src/main/resources/lib/</directory>
<targetPath>WEB-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</webResources>
<!-- maven打包的时候告诉maven不需要web.xml,否刚会报找不到web.xml错误 -->
<failOnMissingWebXml>false</failOnMissingWebXml>
......
package com.tykj.dev.union;
import com.tykj.dev.device.allot.repository.AllotBackBillDao;
import com.tykj.dev.device.allot.repository.AllotBillDao;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.repair.repository.RepairBackBillDao;
import com.tykj.dev.device.repair.repository.RepairBillDao;
import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.repository.RepairSendBillDao;
import com.tykj.dev.device.repair.subject.domin.RepairBackBill;
import com.tykj.dev.device.repair.subject.domin.RepairBill;
import com.tykj.dev.device.repair.subject.domin.RepairDetail;
import com.tykj.dev.device.repair.subject.domin.RepairSendBill;
import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.util.AuthenticationUtils;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.device.usereport.repository.DeviceUseReportDao;
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
import com.tykj.dev.misc.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.DependsOn;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Slf4j
@Component
public class DataInit {
@Resource
private UnitsDao unitsDao;
@Autowired
private AllotBillDao allotBillDao;
@Autowired
private AllotBackBillDao allotBackBillDao;
@Autowired
private RepairBackBillDao repairBackBillDao;
@Autowired
private RepairDetailDao repairDetailDao;
@Autowired
private RepairSendBillDao repairSendBillDao;
@Autowired
private RepairBillDao repairBillDao;
@Autowired
private SelfCheckBillDao selfCheckBillDao;
@Autowired
private DeviceUseReportDao deviceUseReportDao;
@Autowired
private MatchingDeviceLibraryDao matchingDeviceLibraryDao;
@Autowired
private UserUtils userUtils;
@Autowired
private SpringUtils springUtils;
@Autowired
private com.tykj.dev.device.user.util.AuthenticationUtils AuthenticationUtils;
private void initCheckDetailUnitName() {
// 对现有的数据补充unitId信息
allotBillDao.findAll().forEach(this::saveModifyDetail1);
allotBackBillDao.findAll().forEach(this::saveModifyDetail2);
selfCheckBillDao.findAll().forEach(this::saveModifyDetail3);
repairBillDao.findAll().forEach(this::saveModifyDetail4);
repairSendBillDao.findAll().forEach(this::saveModifyDetail5);
repairDetailDao.findAll().forEach(this::saveModifyDetail6);
repairBackBillDao.findAll().forEach(this::saveModifyDetail7);
deviceUseReportDao.findAll().forEach(this::saveModifyDetail8);
matchingDeviceLibraryDao.findAll().forEach(this::saveModifyDetail9);
}
private void saveModifyDetail1(AllotBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId);
log.info("[配发] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
allotBillDao.save(allotBill);
}
}
private void saveModifyDetail2(AllotBackBill allotBackBill) {
String receiveUnit = allotBackBill.getReceiveUnit();
String sendUnit = allotBackBill.getSendUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBackBill.setReceiveUnitId(receiveUnitId);
allotBackBill.setSendUnitId(sendUnitId);
log.info("[退回] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
allotBackBillDao.save(allotBackBill);
}
}
private void saveModifyDetail3(SelfCheckBill selfCheckBill) {
String receiveUnit = selfCheckBill.getCheckUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
if (receiveUnitId != -1) {
selfCheckBill.setCheckUnitId(receiveUnitId);
log.info("[自查] 修正selfCheckBill历史数据,修正的单位:{},接收单位id:{}",
receiveUnit,receiveUnitId);
selfCheckBillDao.save(selfCheckBill);
}
}
private void saveModifyDetail4(RepairBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId);
log.info("[维修] 修正RepairBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairBillDao.save(allotBill);
}
}
private void saveModifyDetail5(RepairSendBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId);
log.info("[送修] 修正RepairSendBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairSendBillDao.save(allotBill);
}
}
private void saveModifyDetail6(RepairDetail allotBill) {
String receiveUnit = allotBill.getLocationUnit();
String sendUnit = allotBill.getOwnUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setLocationUnitId(receiveUnitId);
allotBill.setOwnUnitId(sendUnitId);
log.info("[维修详情] 修正RepairDetail历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairDetailDao.save(allotBill);
}
}
private void saveModifyDetail7(RepairBackBill allotBill) {
String receiveUnit = allotBill.getReceiveUnit();
String sendUnit = allotBill.getSendUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
Integer sendUnitId = getUnitId(sendUnit);
if (receiveUnitId != -1 && sendUnitId != -1) {
allotBill.setReceiveUnitId(receiveUnitId);
allotBill.setSendUnitId(sendUnitId);
log.info("[维修退回] 修正RepairBackBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
sendUnit, receiveUnit,sendUnitId,receiveUnitId);
repairBackBillDao.save(allotBill);
}
}
private void saveModifyDetail8(DeviceUseReport allotBill) {
String receiveUnit = allotBill.getUnit();
Integer receiveUnitId = getUnitId(receiveUnit);
if (receiveUnitId != -1 ) {
allotBill.setUnitId(receiveUnitId);
log.info("[用户使用报告] 修正DeviceUseReport历史数据,修正的单位:{},接收单位id:{}",
receiveUnit,receiveUnitId);
deviceUseReportDao.save(allotBill);
}
}
private void saveModifyDetail9(MatchingDeviceLibrary matchingDeviceLibrary) {
String createUnit = matchingDeviceLibrary.getCreateUnit();
Integer createUnitId = getUnitId(createUnit);
if (createUnitId != -1 ) {
matchingDeviceLibrary.setCreateUnitId(createUnitId);
log.info("[配套设备库] 修正MatchingDeviceLibrary历史数据,修正的单位:{},接收单位id:{}",
createUnit,createUnitId);
matchingDeviceLibraryDao.save(matchingDeviceLibrary);
}
}
private Integer getUnitId(String unitName) {
List<Units> units = unitsDao.findAllByName(unitName).orElse(Collections.emptyList());
return units.size() == 1 ? units.get(0).getUnitId() : -1;
}
// @Bean
// @DependsOn("userUtils")
@PostConstruct
public void init2(){
log.info("单位名称初始化-----");
initCheckDetailUnitName();
initCheckDetailUnitName2();
}
@Autowired
private DeviceCheckDetailDao
deviceCheckDetailDao;
private void initCheckDetailUnitName2() {
// 对现有的数据补充unitId信息
deviceCheckDetailDao.findAll().forEach(this::saveModifyDetail);
}
private void saveModifyDetail(DeviceCheckDetail deviceCheckDetail) {
String checkUnit = deviceCheckDetail.getCheckUnit();
Integer unitId = getUnitId(checkUnit);
if (unitId != -1) {
deviceCheckDetail.setCheckUnitId(unitId);
log.info("[核查] 修正detail历史数据,修正的单位:{},单位id:{}", checkUnit, unitId);
deviceCheckDetailDao.save(deviceCheckDetail);
}
}
// @Override
// @Order(value = 1)
// public void run(String... args) throws Exception {
//package com.tykj.dev.union;
//
//import com.tykj.dev.device.allot.repository.AllotBackBillDao;
//import com.tykj.dev.device.allot.repository.AllotBillDao;
//import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
//import com.tykj.dev.device.allot.subject.domin.AllotBill;
//import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail;
//import com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao;
//import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
//import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
//import com.tykj.dev.device.repair.repository.RepairBackBillDao;
//import com.tykj.dev.device.repair.repository.RepairBillDao;
//import com.tykj.dev.device.repair.repository.RepairDetailDao;
//import com.tykj.dev.device.repair.repository.RepairSendBillDao;
//import com.tykj.dev.device.repair.subject.domin.RepairBackBill;
//import com.tykj.dev.device.repair.subject.domin.RepairBill;
//import com.tykj.dev.device.repair.subject.domin.RepairDetail;
//import com.tykj.dev.device.repair.subject.domin.RepairSendBill;
//import com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao;
//import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
//import com.tykj.dev.device.user.subject.dao.UnitsDao;
//import com.tykj.dev.device.user.subject.entity.Units;
//import com.tykj.dev.device.user.util.AuthenticationUtils;
//import com.tykj.dev.device.user.util.UserUtils;
//import com.tykj.dev.device.usereport.repository.DeviceUseReportDao;
//import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
//import com.tykj.dev.misc.utils.SpringUtils;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.DependsOn;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//import org.springframework.transaction.annotation.Transactional;
//
//import javax.annotation.PostConstruct;
//import javax.annotation.Resource;
//import java.util.Collections;
//import java.util.List;
//
//@Slf4j
//@Component
//public class DataInit {
//
// @Resource
// private UnitsDao unitsDao;
//
// @Autowired
// private AllotBillDao allotBillDao;
// @Autowired
// private AllotBackBillDao allotBackBillDao;
// @Autowired
// private RepairBackBillDao repairBackBillDao;
// @Autowired
// private RepairDetailDao repairDetailDao;
// @Autowired
// private RepairSendBillDao repairSendBillDao;
// @Autowired
// private RepairBillDao repairBillDao;
// @Autowired
// private SelfCheckBillDao selfCheckBillDao;
// @Autowired
// private DeviceUseReportDao deviceUseReportDao;
//
// @Autowired
// private MatchingDeviceLibraryDao matchingDeviceLibraryDao;
//
// @Autowired
// private UserUtils userUtils;
//
// @Autowired
// private SpringUtils springUtils;
//
// @Autowired
// private com.tykj.dev.device.user.util.AuthenticationUtils AuthenticationUtils;
//
// private void initCheckDetailUnitName() {
// // 对现有的数据补充unitId信息
// allotBillDao.findAll().forEach(this::saveModifyDetail1);
// allotBackBillDao.findAll().forEach(this::saveModifyDetail2);
// selfCheckBillDao.findAll().forEach(this::saveModifyDetail3);
// repairBillDao.findAll().forEach(this::saveModifyDetail4);
// repairSendBillDao.findAll().forEach(this::saveModifyDetail5);
// repairDetailDao.findAll().forEach(this::saveModifyDetail6);
// repairBackBillDao.findAll().forEach(this::saveModifyDetail7);
// deviceUseReportDao.findAll().forEach(this::saveModifyDetail8);
// matchingDeviceLibraryDao.findAll().forEach(this::saveModifyDetail9);
// }
//
//
// private void saveModifyDetail1(AllotBill allotBill) {
// String receiveUnit = allotBill.getReceiveUnit();
// String sendUnit = allotBill.getSendUnit();
//
// Integer receiveUnitId = getUnitId(receiveUnit);
// Integer sendUnitId = getUnitId(sendUnit);
//
// if (receiveUnitId != -1 && sendUnitId != -1) {
// allotBill.setReceiveUnitId(receiveUnitId);
// allotBill.setSendUnitId(sendUnitId);
// log.info("[配发] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
// allotBillDao.save(allotBill);
// }
//
// }
//
// private void saveModifyDetail2(AllotBackBill allotBackBill) {
// String receiveUnit = allotBackBill.getReceiveUnit();
// String sendUnit = allotBackBill.getSendUnit();
//
// Integer receiveUnitId = getUnitId(receiveUnit);
// Integer sendUnitId = getUnitId(sendUnit);
//
// if (receiveUnitId != -1 && sendUnitId != -1) {
// allotBackBill.setReceiveUnitId(receiveUnitId);
// allotBackBill.setSendUnitId(sendUnitId);
// log.info("[退回] 修正allotBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
// allotBackBillDao.save(allotBackBill);
// }
//
// }
//
// private void saveModifyDetail3(SelfCheckBill selfCheckBill) {
// String receiveUnit = selfCheckBill.getCheckUnit();
// Integer receiveUnitId = getUnitId(receiveUnit);
// if (receiveUnitId != -1) {
// selfCheckBill.setCheckUnitId(receiveUnitId);
// log.info("[自查] 修正selfCheckBill历史数据,修正的单位:{},接收单位id:{}",
// receiveUnit,receiveUnitId);
// selfCheckBillDao.save(selfCheckBill);
// }
//
// }
//
// private void saveModifyDetail4(RepairBill allotBill) {
// String receiveUnit = allotBill.getReceiveUnit();
// String sendUnit = allotBill.getSendUnit();
//
// Integer receiveUnitId = getUnitId(receiveUnit);
// Integer sendUnitId = getUnitId(sendUnit);
//
// if (receiveUnitId != -1 && sendUnitId != -1) {
// allotBill.setReceiveUnitId(receiveUnitId);
// allotBill.setSendUnitId(sendUnitId);
// log.info("[维修] 修正RepairBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
// repairBillDao.save(allotBill);
// }
//
// }
//
// private void saveModifyDetail5(RepairSendBill allotBill) {
// String receiveUnit = allotBill.getReceiveUnit();
// String sendUnit = allotBill.getSendUnit();
//
// Integer receiveUnitId = getUnitId(receiveUnit);
// Integer sendUnitId = getUnitId(sendUnit);
//
// if (receiveUnitId != -1 && sendUnitId != -1) {
// allotBill.setReceiveUnitId(receiveUnitId);
// allotBill.setSendUnitId(sendUnitId);
// log.info("[送修] 修正RepairSendBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
// repairSendBillDao.save(allotBill);
// }
//
// }
//
// private void saveModifyDetail6(RepairDetail allotBill) {
// String receiveUnit = allotBill.getLocationUnit();
// String sendUnit = allotBill.getOwnUnit();
//
// Integer receiveUnitId = getUnitId(receiveUnit);
// Integer sendUnitId = getUnitId(sendUnit);
//
// if (receiveUnitId != -1 && sendUnitId != -1) {
// allotBill.setLocationUnitId(receiveUnitId);
// allotBill.setOwnUnitId(sendUnitId);
// log.info("[维修详情] 修正RepairDetail历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
// repairDetailDao.save(allotBill);
// }
//
// }
// private void saveModifyDetail7(RepairBackBill allotBill) {
// String receiveUnit = allotBill.getReceiveUnit();
// String sendUnit = allotBill.getSendUnit();
//
// Integer receiveUnitId = getUnitId(receiveUnit);
// Integer sendUnitId = getUnitId(sendUnit);
//
// if (receiveUnitId != -1 && sendUnitId != -1) {
// allotBill.setReceiveUnitId(receiveUnitId);
// allotBill.setSendUnitId(sendUnitId);
// log.info("[维修退回] 修正RepairBackBill历史数据,修正的发件单位:{},修正的接收单位:{},发送单位id:{},接收单位id:{}",
// sendUnit, receiveUnit,sendUnitId,receiveUnitId);
// repairBackBillDao.save(allotBill);
// }
//
// }
//
// private void saveModifyDetail8(DeviceUseReport allotBill) {
// String receiveUnit = allotBill.getUnit();
// Integer receiveUnitId = getUnitId(receiveUnit);
// if (receiveUnitId != -1 ) {
// allotBill.setUnitId(receiveUnitId);
// log.info("[用户使用报告] 修正DeviceUseReport历史数据,修正的单位:{},接收单位id:{}",
// receiveUnit,receiveUnitId);
// deviceUseReportDao.save(allotBill);
// }
//
// }
//
// private void saveModifyDetail9(MatchingDeviceLibrary matchingDeviceLibrary) {
// String createUnit = matchingDeviceLibrary.getCreateUnit();
// Integer createUnitId = getUnitId(createUnit);
// if (createUnitId != -1 ) {
// matchingDeviceLibrary.setCreateUnitId(createUnitId);
// log.info("[配套设备库] 修正MatchingDeviceLibrary历史数据,修正的单位:{},接收单位id:{}",
// createUnit,createUnitId);
// matchingDeviceLibraryDao.save(matchingDeviceLibrary);
// }
//
// }
//
// private Integer getUnitId(String unitName) {
// List<Units> units = unitsDao.findAllByName(unitName).orElse(Collections.emptyList());
// return units.size() == 1 ? units.get(0).getUnitId() : -1;
// }
//
//// @Bean
//// @DependsOn("userUtils")
// @PostConstruct
// public void init2(){
// log.info("单位名称初始化-----");
// initCheckDetailUnitName();
// initCheckDetailUnitName2();
// }
//
// @Autowired
// private DeviceCheckDetailDao
// deviceCheckDetailDao;
//
// private void initCheckDetailUnitName2() {
// // 对现有的数据补充unitId信息
// deviceCheckDetailDao.findAll().forEach(this::saveModifyDetail);
// }
//
// private void saveModifyDetail(DeviceCheckDetail deviceCheckDetail) {
// String checkUnit = deviceCheckDetail.getCheckUnit();
// Integer unitId = getUnitId(checkUnit);
// if (unitId != -1) {
// deviceCheckDetail.setCheckUnitId(unitId);
// log.info("[核查] 修正detail历史数据,修正的单位:{},单位id:{}", checkUnit, unitId);
// deviceCheckDetailDao.save(deviceCheckDetail);
// }
// }
}
//// @Override
//// @Order(value = 1)
//// public void run(String... args) throws Exception {
//// log.info("单位名称初始化-----");
//// initCheckDetailUnitName();
//// }
//}
......@@ -11,3 +11,4 @@ preview.path=http://192.168.102.169:8087/file/
spring.boot.admin.client.url=http://localhost:8769
spring.boot.admin.client.instance.serviceBaseUrl=http://localhost:8087w
block.flag=true
readMachine.ip=192.168.101.201
......@@ -9,4 +9,5 @@ file.path=/opt/zb/
preview.path=http://192.168.0.80:8088/equip/file/
spring.boot.admin.client.url=http://localhost:8769
spring.boot.admin.client.instance.serviceBaseUrl=http://localhost:8087
block.flag=true
\ No newline at end of file
block.flag=true
readMachine.ip=192.168.101.202
\ No newline at end of file
......@@ -50,6 +50,7 @@
<module>dev-policydocument</module>
<module>dev-questionbank</module>
<module>dev-zxing</module>
<module>dev-readmachine</module>
</modules>
<properties>
......@@ -254,6 +255,12 @@
<artifactId>dev-zxing</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>dev-readmachine</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论