Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
d5a90058
提交
d5a90058
authored
12月 10, 2021
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(盘存模块): 新增盘存模块
新增盘存模块
上级
4ad27adb
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
38 个修改的文件
包含
1530 行增加
和
101 行删除
+1530
-101
BusinessEnum.java
...sc/src/main/java/com/tykj/dev/misc/base/BusinessEnum.java
+1
-0
StatusEnum.java
...misc/src/main/java/com/tykj/dev/misc/base/StatusEnum.java
+9
-1
pom.xml
dev-readmachine/pom.xml
+71
-0
DevReadmachineApplication.java
...readmachine/devreadmachine/DevReadmachineApplication.java
+15
-0
ReadMachineBill.java
...ev/readmachine/devreadmachine/Entity/ReadMachineBill.java
+80
-0
ReadMachineLibrary.java
...readmachine/devreadmachine/Entity/ReadMachineLibrary.java
+105
-0
ReadDeviceVo.java
.../tykj/dev/readmachine/devreadmachine/Vo/ReadDeviceVo.java
+19
-0
SaveDefatVos.java
.../tykj/dev/readmachine/devreadmachine/Vo/SaveDefatVos.java
+27
-0
SaveReadMachineVo.java
.../dev/readmachine/devreadmachine/Vo/SaveReadMachineVo.java
+61
-0
SaveReadMachineVos.java
...dev/readmachine/devreadmachine/Vo/SaveReadMachineVos.java
+29
-0
SelectBillVo.java
.../tykj/dev/readmachine/devreadmachine/Vo/SelectBillVo.java
+27
-0
ReadMachineBillController.java
.../devreadmachine/controller/ReadMachineBillController.java
+185
-0
ReadMachineLibraryController.java
...vreadmachine/controller/ReadMachineLibraryController.java
+33
-0
ReadMachineBillDao.java
...machine/devreadmachine/repository/ReadMachineBillDao.java
+13
-0
ReadMachineLibraryDao.java
...hine/devreadmachine/repository/ReadMachineLibraryDao.java
+17
-0
ReadMachineBillService.java
...achine/devreadmachine/service/ReadMachineBillService.java
+68
-0
ReadMachineLibraryService.java
...ine/devreadmachine/service/ReadMachineLibraryService.java
+40
-0
ReadMachineBillServiceImpl.java
...vreadmachine/service/impl/ReadMachineBillServiceImpl.java
+0
-0
ReadMachineLibraryServiceImpl.java
...admachine/service/impl/ReadMachineLibraryServiceImpl.java
+61
-0
Message.java
...m/tykj/dev/readmachine/devreadmachine/socket/Message.java
+20
-0
MessageError.java
...j/dev/readmachine/devreadmachine/socket/MessageError.java
+21
-0
ReadWebSocket.java
.../dev/readmachine/devreadmachine/socket/ReadWebSocket.java
+208
-0
BackReadDetailVo.java
...v/readmachine/devreadmachine/toBack/BackReadDetailVo.java
+26
-0
BeanDtoVoUtils.java
...j/dev/readmachine/devreadmachine/util/BeanDtoVoUtils.java
+110
-0
ReadUtils.java
...m/tykj/dev/readmachine/devreadmachine/util/ReadUtils.java
+0
-0
application.properties
dev-readmachine/src/main/resources/application.properties
+1
-0
ModuleAPI_Java_2.2.0.0.jar
...machine/src/main/resources/lib/ModuleAPI_Java_2.2.0.0.jar
+0
-0
DevReadmachineApplicationTests.java
...achine/devreadmachine/DevReadmachineApplicationTests.java
+13
-0
RepairController.java
...m/tykj/dev/device/repair/controller/RepairController.java
+27
-9
InventoryThread.java
...main/java/com/tykj/dev/rfid/timeTask/InventoryThread.java
+5
-2
ReadUtils.java
...d/src/main/java/com/tykj/dev/rfid/timeTask/ReadUtils.java
+94
-86
MessageError.java
...ocket/src/main/java/com/tykj/dev/socket/MessageError.java
+21
-0
MyWebSocket.java
...socket/src/main/java/com/tykj/dev/socket/MyWebSocket.java
+59
-3
TaskBto.java
...in/java/com/tykj/dev/device/task/subject/bto/TaskBto.java
+12
-0
pom.xml
dev-taskselect/pom.xml
+5
-0
TaskSelectController.java
...ev/device/taskselect/controller/TaskSelectController.java
+29
-0
pom.xml
dev-union/pom.xml
+11
-0
pom.xml
pom.xml
+7
-0
没有找到文件。
dev-misc/src/main/java/com/tykj/dev/misc/base/BusinessEnum.java
浏览文件 @
d5a90058
...
@@ -121,6 +121,7 @@ public enum BusinessEnum {
...
@@ -121,6 +121,7 @@ public enum BusinessEnum {
SUSPENSION
(
29
,
"中止业务"
),
SUSPENSION
(
29
,
"中止业务"
),
READMACHINE
(
30
,
"盘存"
),
;
;
public
Integer
id
;
public
Integer
id
;
...
...
dev-misc/src/main/java/com/tykj/dev/misc/base/StatusEnum.java
浏览文件 @
d5a90058
...
@@ -317,7 +317,15 @@ public enum StatusEnum {
...
@@ -317,7 +317,15 @@ public enum StatusEnum {
SCRAP_2222
(
2222
,
"等待上传报废签收单"
),
SCRAP_2222
(
2222
,
"等待上传报废签收单"
),
SCRAP_2223
(
2223
,
"报废草稿"
),
SCRAP_2223
(
2223
,
"报废草稿"
),
SCRAP_2224
(
2224
,
"报废出库签章审核"
),
SCRAP_2224
(
2224
,
"报废出库签章审核"
),
SCRAP_2225
(
2225
,
"报废出库等待盖电子签章"
);
SCRAP_2225
(
2225
,
"报废出库等待盖电子签章"
),
/**
* 盘存状态draft
*/
READ_DEAFT
(
3000
,
"保存盘存草稿"
),
READ_End
(
3001
,
"结束盘存任务"
),
;
public
Integer
id
;
public
Integer
id
;
...
...
dev-readmachine/pom.xml
0 → 100644
浏览文件 @
d5a90058
<?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_Java_2.2.0.0.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>
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/DevReadmachineApplication.java
0 → 100644
浏览文件 @
d5a90058
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
);
}
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/Entity/ReadMachineBill.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/Entity/ReadMachineLibrary.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/Vo/ReadDeviceVo.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/Vo/SaveDefatVos.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/Vo/SaveReadMachineVo.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/Vo/SaveReadMachineVos.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/Vo/SelectBillVo.java
0 → 100644
浏览文件 @
d5a90058
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;
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/controller/ReadMachineBillController.java
0 → 100644
浏览文件 @
d5a90058
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.ReadMachineLibraryService
;
import
com.tykj.dev.readmachine.devreadmachine.socket.ReadWebSocket
;
import
com.tykj.dev.readmachine.devreadmachine.toBack.BackReadDetailVo
;
import
com.tykj.dev.rfid.timeTask.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
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
;
@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
();
//先开启
readUtils
.
testinitreader
();
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
;
}
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/controller/ReadMachineLibraryController.java
0 → 100644
浏览文件 @
d5a90058
package
com
.
tykj
.
dev
.
readmachine
.
devreadmachine
.
controller
;
import
com.tykj.dev.config.swagger.AutoDocument
;
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/3 10:59
*/
@RestController
@RequestMapping
(
value
=
"/readMachineLibrary"
)
@AutoDocument
@Api
(
tags
=
"盘存库模块"
,
description
=
"盘存库接口"
)
@Slf4j
public
class
ReadMachineLibraryController
{
@Resource
private
ReadMachineBillService
readMachineBillService
;
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/repository/ReadMachineBillDao.java
0 → 100644
浏览文件 @
d5a90058
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
>
{
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/repository/ReadMachineLibraryDao.java
0 → 100644
浏览文件 @
d5a90058
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
);
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/service/ReadMachineBillService.java
0 → 100644
浏览文件 @
d5a90058
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
);
void
readDevice
();
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/service/ReadMachineLibraryService.java
0 → 100644
浏览文件 @
d5a90058
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
);
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/service/impl/ReadMachineBillServiceImpl.java
0 → 100644
浏览文件 @
d5a90058
差异被折叠。
点击展开。
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/service/impl/ReadMachineLibraryServiceImpl.java
0 → 100644
浏览文件 @
d5a90058
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
);
}
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/socket/Message.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/socket/MessageError.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/socket/ReadWebSocket.java
0 → 100644
浏览文件 @
d5a90058
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;
// }
// }
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/toBack/BackReadDetailVo.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/util/BeanDtoVoUtils.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
}
dev-readmachine/src/main/java/com/tykj/dev/readmachine/devreadmachine/util/ReadUtils.java
0 → 100644
浏览文件 @
d5a90058
差异被折叠。
点击展开。
dev-readmachine/src/main/resources/application.properties
0 → 100644
浏览文件 @
d5a90058
dev-readmachine/src/main/resources/lib/ModuleAPI_Java_2.2.0.0.jar
0 → 100644
浏览文件 @
d5a90058
File added
dev-readmachine/src/test/java/com/tykj/dev/readmachine/devreadmachine/DevReadmachineApplicationTests.java
0 → 100644
浏览文件 @
d5a90058
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
()
{
}
}
dev-repair/src/main/java/com/tykj/dev/device/repair/controller/RepairController.java
浏览文件 @
d5a90058
...
@@ -339,7 +339,9 @@ public class RepairController {
...
@@ -339,7 +339,9 @@ public class RepairController {
});
});
}
}
Integer
userId
=
userUtils
.
getCurrentUserId
();
Integer
userId
=
userUtils
.
getCurrentUserId
();
Integer
level
=
userUtils
.
getCurrentUnitLevel
();
// Integer level = userUtils.getCurrentUnitLevel();
Integer
unitId
=
userUtils
.
getCurrentUnitId
();
Units
units
=
unitsCache
.
findById
(
unitId
);
//添加维修单和送修单
//添加维修单和送修单
RepairBill
repairBill
;
RepairBill
repairBill
;
RepairSendBill
deviceRepairSendBillEntity
;
RepairSendBill
deviceRepairSendBillEntity
;
...
@@ -362,7 +364,7 @@ public class RepairController {
...
@@ -362,7 +364,7 @@ public class RepairController {
deviceRepairSendBillEntity
.
setScriptJson
(
JacksonUtil
.
toJSon
(
repairBillSaveVo
.
getScriptSaveVos
()));
deviceRepairSendBillEntity
.
setScriptJson
(
JacksonUtil
.
toJSon
(
repairBillSaveVo
.
getScriptSaveVos
()));
}
}
//如果当前为省向国家发起的
//如果当前为省向国家发起的
if
(
level
==
1
)
{
if
(
units
.
getType
()
==
1
&&
units
.
getLevel
()
==
1
)
{
repairBill
.
setRepairStatus
(
4
);
//维修中
repairBill
.
setRepairStatus
(
4
);
//维修中
deviceRepairSendBillEntity
.
setRepairStatus
(
5
);
//维修中
deviceRepairSendBillEntity
.
setRepairStatus
(
5
);
//维修中
}
else
{
}
else
{
...
@@ -473,17 +475,27 @@ public class RepairController {
...
@@ -473,17 +475,27 @@ public class RepairController {
//当前单位其他专管员id集合
//当前单位其他专管员id集合
List
<
Integer
>
ids
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
List
<
Integer
>
ids
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
//省向国家发起的
//省向国家发起的
if
(
level
==
1
)
{
if
(
units
.
getType
()
==
1
&&
units
.
getLevel
()
==
1
)
{
ownUnit
=
userUtils
.
getCurrentUnitId
();
ownUnit
=
userUtils
.
getCurrentUnitId
();
//直接发起的
//直接发起的
if
(
repairBillSaveVo
.
getTaskId
()
==
null
)
{
if
(
repairBillSaveVo
.
getTaskId
()
==
null
)
{
TaskBto
taskBto
;
TaskBto
taskBto
;
if
(
repairBillSaveVo
.
getReceiveUnit
().
contains
(
"中办"
)){
if
(
repairBillSaveVo
.
getReceiveUnit
().
contains
(
"中办"
)){
// taskBto = new TaskBto(StatusEnum.WAIT_UPLOAD_FILE.id, "["+repairBillSaveVo.getReceiveUnit() + "]型号" + StringSplitUtil.stringListToString(repairBillSaveVo.getScriptSaveVos().stream().map(ScriptSaveVo::getModel).distinct().collect(Collectors.toList())) + "共有" + repairBillSaveVo.getSendingCount() + "件", null, ".", repairBill1.getId(), 5, ownUnit, 1, "country", userIds);
// taskBto = new TaskBto(StatusEnum.WAIT_UPLOAD_FILE.id, "["+repairBillSaveVo.getReceiveUnit() + "]型号" + StringSplitUtil.stringListToString(repairBillSaveVo.getScriptSaveVos().stream().map(ScriptSaveVo::getModel).distinct().collect(Collectors.toList())) + "共有" + repairBillSaveVo.getSendingCount() + "件", null, ".", repairBill1.getId(), 5, ownUnit, 1, "country", userIds);
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_FILE
.
id
,
"["
+
DeviceModelSort
.
unitNameToDisName
(
repairBillSaveVo
.
getReceiveUnit
())
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
,
null
,
"."
,
repairBill1
.
getId
(),
5
,
ownUnit
,
1
,
"country"
,
userIds
);
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_FILE
.
id
,
"["
+
DeviceModelSort
.
unitNameToDisName
(
repairBillSaveVo
.
getReceiveUnit
())
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
()
.
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
,
null
,
"."
,
repairBill1
.
getId
(),
5
,
ownUnit
,
1
,
"country"
,
userIds
);
}
else
{
}
else
{
// taskBto = new TaskBto(StatusEnum.WAIT_UPLOAD_FILE.id, "["+repairBillSaveVo.getReceiveUnit().substring(0,3) + "]型号" + StringSplitUtil.stringListToString(repairBillSaveVo.getScriptSaveVos().stream().map(ScriptSaveVo::getModel).distinct().collect(Collectors.toList())) + "共有" + repairBillSaveVo.getSendingCount() + "件", null, ".", repairBill1.getId(), 5, ownUnit, 1, "country", userIds);
// taskBto = new TaskBto(StatusEnum.WAIT_UPLOAD_FILE.id, "["+repairBillSaveVo.getReceiveUnit().substring(0,3) + "]型号" + StringSplitUtil.stringListToString(repairBillSaveVo.getScriptSaveVos().stream().map(ScriptSaveVo::getModel).distinct().collect(Collectors.toList())) + "共有" + repairBillSaveVo.getSendingCount() + "件", null, ".", repairBill1.getId(), 5, ownUnit, 1, "country", userIds);
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_FILE
.
id
,
"["
+
DeviceModelSort
.
unitNameToDisName
(
repairBillSaveVo
.
getReceiveUnit
())
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
,
null
,
"."
,
repairBill1
.
getId
(),
5
,
ownUnit
,
1
,
"country"
,
userIds
);
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_FILE
.
id
,
"["
+
DeviceModelSort
.
unitNameToDisName
(
repairBillSaveVo
.
getReceiveUnit
())
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
()
.
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
,
null
,
"."
,
repairBill1
.
getId
(),
5
,
ownUnit
,
1
,
"country"
,
userIds
);
}
}
saveEntity
=
taskService
.
start
(
taskBto
);
saveEntity
=
taskService
.
start
(
taskBto
);
}
}
...
@@ -588,7 +600,7 @@ public class RepairController {
...
@@ -588,7 +600,7 @@ public class RepairController {
deviceRepairDetailService
.
save
(
repairDetail
);
deviceRepairDetailService
.
save
(
repairDetail
);
}
}
//如果当前为省像国家发起的
//如果当前为省像国家发起的
if
(
level
==
1
)
{
if
(
units
.
getType
()
==
1
&&
units
.
getLevel
()
==
1
)
{
deviceLibraryEntity
.
setLifeStatus
(
4
);
deviceLibraryEntity
.
setLifeStatus
(
4
);
deviceLibraryEntity
.
setLocationUnit
(
repairBillSaveVo
.
getReceiveUnit
());
deviceLibraryEntity
.
setLocationUnit
(
repairBillSaveVo
.
getReceiveUnit
());
}
else
{
}
else
{
...
@@ -607,7 +619,7 @@ public class RepairController {
...
@@ -607,7 +619,7 @@ public class RepairController {
String
deviceIdDetail
=
deviceRepairSendBillEntity
.
getRepairDeviceCheckDetail
();
String
deviceIdDetail
=
deviceRepairSendBillEntity
.
getRepairDeviceCheckDetail
();
List
<
Integer
>
idList
=
StringSplitUtil
.
split
(
deviceIdDetail
);
List
<
Integer
>
idList
=
StringSplitUtil
.
split
(
deviceIdDetail
);
//如果当前为省,改变装备的所在为中办
//如果当前为省,改变装备的所在为中办
if
(
level
==
1
)
{
if
(
units
.
getType
()
==
1
&&
units
.
getLevel
()
==
1
)
{
//获取当前业务维修详情 记录
//获取当前业务维修详情 记录
List
<
RepairDetail
>
repairDetailEntities
=
deviceRepairDetailService
.
findByBillId
(
repairBill
.
getId
());
List
<
RepairDetail
>
repairDetailEntities
=
deviceRepairDetailService
.
findByBillId
(
repairBill
.
getId
());
//改变维修详情装备所在单位为中办,状态为维修中
//改变维修详情装备所在单位为中办,状态为维修中
...
@@ -967,6 +979,7 @@ public class RepairController {
...
@@ -967,6 +979,7 @@ public class RepairController {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
saveRepairBackBill
(
@RequestBody
RepairBackBillSaveVo
repairBackBillSaveVo
)
{
public
ResponseEntity
saveRepairBackBill
(
@RequestBody
RepairBackBillSaveVo
repairBackBillSaveVo
)
{
Integer
currentUnitLevel
=
userUtils
.
getCurrentUnitLevel
();
Integer
currentUnitLevel
=
userUtils
.
getCurrentUnitLevel
();
Units
units
=
unitsCache
.
findById
(
userUtils
.
getCurrentUnitId
());
//第一次保存
//第一次保存
if
(
repairBackBillSaveVo
.
getTaskId
()
==
null
)
{
if
(
repairBackBillSaveVo
.
getTaskId
()
==
null
)
{
Integer
userId
=
userUtils
.
getCurrentUserId
();
Integer
userId
=
userUtils
.
getCurrentUserId
();
...
@@ -988,7 +1001,10 @@ public class RepairController {
...
@@ -988,7 +1001,10 @@ public class RepairController {
//发起任务
//发起任务
// TaskBto taskBto = new TaskBto(StatusEnum.REPAIR_BACK_DRAFT.id, "["+repairBackBillSaveVo.getReceiveUnit().substring(0,3) + "]型号" + repairBackBillSaveVo.getScriptSaveVos().get(0).getModel() + "共有" + repairBackBillSaveVo.getSendingCount() + "件至", null, ".", repairBackBill1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 0, null, userIds);
// TaskBto taskBto = new TaskBto(StatusEnum.REPAIR_BACK_DRAFT.id, "["+repairBackBillSaveVo.getReceiveUnit().substring(0,3) + "]型号" + repairBackBillSaveVo.getScriptSaveVos().get(0).getModel() + "共有" + repairBackBillSaveVo.getSendingCount() + "件至", null, ".", repairBackBill1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
REPAIR_BACK_DRAFT
.
id
,
"["
+
DeviceModelSort
.
unitNameToDisName
(
repairBackBillSaveVo
.
getReceiveUnit
())
+
"]型号"
+
repairBackBillSaveVo
.
getScriptSaveVos
().
get
(
0
).
getModel
()
+
"共有"
+
repairBackBillSaveVo
.
getSendingCount
()
+
"件至"
,
null
,
"."
,
repairBackBill1
.
getId
(),
BusinessEnum
.
REPAIR_BACK
.
id
,
userUtils
.
getCurrentUnitId
(),
0
,
null
,
userIds
);
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
REPAIR_BACK_DRAFT
.
id
,
"["
+
DeviceModelSort
.
unitNameToDisName
(
repairBackBillSaveVo
.
getReceiveUnit
())
+
"]型号"
+
repairBackBillSaveVo
.
getScriptSaveVos
().
get
(
0
).
getModel
()
+
"共有"
+
repairBackBillSaveVo
.
getSendingCount
()
+
"件至"
,
null
,
"."
,
repairBackBill1
.
getId
(),
BusinessEnum
.
REPAIR_BACK
.
id
,
userUtils
.
getCurrentUnitId
(),
0
,
null
,
userIds
);
if
(
currentUnitLevel
==
1
){
// if (currentUnitLevel == 1){
// taskBto.setCustomInfo("country");
// }
if
(
currentUnitLevel
==
1
&&
units
.
getType
()
==
1
){
taskBto
.
setCustomInfo
(
"country"
);
taskBto
.
setCustomInfo
(
"country"
);
}
}
TaskBto
taskBto1
=
taskService
.
start
(
taskBto
);
TaskBto
taskBto1
=
taskService
.
start
(
taskBto
);
...
@@ -1973,9 +1989,11 @@ public class RepairController {
...
@@ -1973,9 +1989,11 @@ public class RepairController {
//已领取装备
//已领取装备
else
if
(
type
==
4
)
{
else
if
(
type
==
4
)
{
Integer
level
=
userUtils
.
getCurrentUnitLevel
();
Integer
level
=
userUtils
.
getCurrentUnitLevel
();
Units
byId
=
unitsCache
.
findById
(
unitId
);
String
currentUserUnitName
=
userUtils
.
getCurrentUserUnitName
();
String
currentUserUnitName
=
userUtils
.
getCurrentUserUnitName
();
List
<
RepairDetail
>
repairDetails
;
List
<
RepairDetail
>
repairDetails
;
if
(
level
==
1
)
{
// if (level == 1) {
if
(
level
==
1
&&
byId
.
getType
()
==
1
)
{
repairDetails
=
repairDetailDao
.
findAllByRepairStatus
(
5
,
repairTaskSelectVo
.
getPageable
().
getSort
());
repairDetails
=
repairDetailDao
.
findAllByRepairStatus
(
5
,
repairTaskSelectVo
.
getPageable
().
getSort
());
}
else
if
(
level
==
2
)
{
}
else
if
(
level
==
2
)
{
...
...
dev-rfid/src/main/java/com/tykj/dev/rfid/timeTask/InventoryThread.java
浏览文件 @
d5a90058
...
@@ -27,6 +27,8 @@ public class InventoryThread extends Thread {
...
@@ -27,6 +27,8 @@ public class InventoryThread extends Thread {
private
static
int
CURRENT_READ_POINT
=
0
;
private
static
int
CURRENT_READ_POINT
=
0
;
private
final
int
ANT_COUNT
=
2
;
private
final
int
ANT_COUNT
=
2
;
private
final
String
PanIP
=
"192.168.101.201"
;
/**
/**
* 每次盘存的临时变量
* 每次盘存的临时变量
*/
*/
...
@@ -137,12 +139,12 @@ public class InventoryThread extends Thread {
...
@@ -137,12 +139,12 @@ public class InventoryThread extends Thread {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
mReaderHelper
=
mConnector
.
connectNet
(
"192.168.0.178"
,
4001
);
mReaderHelper
=
mConnector
.
connectNet
(
PanIP
,
8080
);
if
(
mReaderHelper
!=
null
)
{
if
(
mReaderHelper
!=
null
)
{
try
{
try
{
mReaderHelper
.
registerObserver
(
mObserver
);
mReaderHelper
.
registerObserver
(
mObserver
);
//默认切换到默认天线
//默认切换到默认天线
changeAnt
(
currentAnt
);
//
changeAnt(currentAnt);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
// TODO Auto-generated catch block
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -151,6 +153,7 @@ public class InventoryThread extends Thread {
...
@@ -151,6 +153,7 @@ public class InventoryThread extends Thread {
log
.
error
(
"连接天线失败"
);
log
.
error
(
"连接天线失败"
);
mConnector
.
disConnect
();
mConnector
.
disConnect
();
}
}
readTag
();
}
}
/**
/**
...
...
dev-rfid/src/main/java/com/tykj/dev/rfid/timeTask/ReadUtils.java
浏览文件 @
d5a90058
...
@@ -4,6 +4,9 @@ import com.uhf.api.cls.Reader;
...
@@ -4,6 +4,9 @@ import com.uhf.api.cls.Reader;
import
com.uhf.api.cls.Reader.*
;
import
com.uhf.api.cls.Reader.*
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
@Data
public
class
ReadUtils
{
public
class
ReadUtils
{
...
@@ -104,13 +107,13 @@ public class ReadUtils {
...
@@ -104,13 +107,13 @@ public class ReadUtils {
public
void
testreadandwrite
(){
public
void
testreadandwrite
(){
/*
/*
* READER_ERR WriteTagData(int ant,char bank,int address, byte[] data, int datalen, byte[] accesspasswd,short timeout);
* READER_ERR WriteTagData(int ant,char bank,int address, byte[] data, int datalen, byte[] accesspasswd,short timeout);
* ant
???????????
* ant
操作的单天线
* bank
??????? 0????????? 1???epc?? 2???tid?? 3???user??
* bank
表示区域 0表示保留区 1表示epc区 2表示tid区 3表示user区
* address
???????? ???epc?????????
* address
表示地址块, 注意epc区从第二块开始
* data
???????
* data
写的数据
* datalen
?????????????
* datalen
表示写的数据长度
* accesspwd
??????????"00000000" 8????????????
* accesspwd
表示密码,默认"00000000" 8个十六进制字符
* timeout
??????????
* timeout
操作超时时间
*/
*/
String
pwd
=
"00000000"
;
String
pwd
=
"00000000"
;
...
@@ -124,13 +127,13 @@ public class ReadUtils {
...
@@ -124,13 +127,13 @@ public class ReadUtils {
//??????
//??????
/*
/*
* READER_ERR GetTagData(int ant,char bank, int address, int blkcnt,byte[] data, byte[] accesspasswd, short timeout);
* READER_ERR GetTagData(int ant,char bank, int address, int blkcnt,byte[] data, byte[] accesspasswd, short timeout);
* ant
???????????
* ant
操作的单天线
* bank
??????? 0????????? 1???epc?? 2???tid?? 3???user??
* bank
表示区域 0表示保留区 1表示epc区 2表示tid区 3表示user区
* address
???????? ???epc?????????
* address
表示地址块, 注意epc区从第二块开始
* blkcnt
?????????
* blkcnt
表示读块数
* data
??????????????ò????
blkcnt*2
* data
存放数据的字节,应该不小于
blkcnt*2
* accesspwd
??????????"00000000" 8????????????
* accesspwd
表示密码,默认"00000000" 8个十六进制字符
* timeout
??????????
* timeout
操作超时时间
*/
*/
er
=
Jreader
.
GetTagData
(
1
,
(
char
)
1
,
2
,
6
,
datar
,
null
,
(
short
)
1000
);
er
=
Jreader
.
GetTagData
(
1
,
(
char
)
1
,
2
,
6
,
datar
,
null
,
(
short
)
1000
);
String
str1
=
""
;
String
str1
=
""
;
...
@@ -161,33 +164,33 @@ public class ReadUtils {
...
@@ -161,33 +164,33 @@ public class ReadUtils {
String
pwd
=
"11000000"
;
String
pwd
=
"11000000"
;
byte
[]
data
=
new
byte
[
4
];
byte
[]
data
=
new
byte
[
4
];
Jreader
.
Str2Hex
(
pwd
,
pwd
.
length
(),
data
);
Jreader
.
Str2Hex
(
pwd
,
pwd
.
length
(),
data
);
//
??????
//
擦除块
READER_ERR
er
=
Jreader
.
BlockErase
(
1
,
(
char
)
1
,
2
,
12
,
data
,
(
short
)
1000
);
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
);
Jreader
.
BlockPermaLock
(
1
,
1
,
2
,
6
,
new
byte
[]{(
byte
)
0xff
,(
byte
)
0xff
},
data
,
(
short
)
1000
);
}
}
public
void
testinitreader
()
{
public
void
testinitreader
()
{
//
?????????
//
创建读写器
/*
?????????????????
/*
根据天线口连接读写器
* src
???? ip???????????
* src
是地址 ip地址或者串口号
* rtype
???????????4?????????
4
* rtype
是天线口数,4口天线传入
4
*
?????????READER_ERR ,MT_OK_ERR????????????????????
*
返回类型:READER_ERR ,MT_OK_ERR表示正常,其他表示错误
*/
*/
READER_ERR
er
=
Jreader
.
InitReader
(
ReaderAddr
,
Reader_Type
.
MODULE_ONE_ANT
);
//
READER_ERR er=Jreader.InitReader(ReaderAddr,Reader_Type.MODULE_ONE_ANT);
//
READER_ERR er=Jreader.InitReader_Notype(ReaderAddr,AntCount);
READER_ERR
er
=
Jreader
.
InitReader_Notype
(
ReaderAddr
,
AntCount
);
System
.
out
.
println
(
er
.
toString
());
System
.
out
.
println
(
er
.
toString
());
/*
/*
*
?????????????AntPowerConf
*
构建天线组功率:AntPowerConf
*
?????
*
成员:
* AntPower
????
* AntPower
数组
* antcnt
??????????
* antcnt
表示天线个数
* AntPower
????
* AntPower
类型
* antid
?????
* antid
天线号
* readPower
??????
* readPower
读功率
* writePower
?????
* writePower
写功率
*/
*/
AntPowerConf
apcf
=
Jreader
.
new
AntPowerConf
();
AntPowerConf
apcf
=
Jreader
.
new
AntPowerConf
();
...
@@ -196,15 +199,16 @@ public class ReadUtils {
...
@@ -196,15 +199,16 @@ public class ReadUtils {
{
{
AntPower
jaap
=
Jreader
.
new
AntPower
();
AntPower
jaap
=
Jreader
.
new
AntPower
();
jaap
.
antid
=
i
+
1
;
jaap
.
antid
=
i
+
1
;
jaap
.
readPower
=
2800
;
// jaap.readPower=2800;
jaap
.
writePower
=
2750
;
jaap
.
readPower
=
1000
;
apcf
.
Powers
[
i
]=
jaap
;
jaap
.
writePower
=
1000
;
// jaap.writePower=2750;
apcf
.
Powers
[
i
]=
jaap
;
}
}
AntPowerConf
apcf2
=
Jreader
.
new
AntPowerConf
();
AntPowerConf
apcf2
=
Jreader
.
new
AntPowerConf
();
er
=
Jreader
.
ParamSet
(
Mtr_Param
.
MTR_PARAM_RF_ANTPOWER
,
apcf
);
er
=
Jreader
.
ParamSet
(
Mtr_Param
.
MTR_PARAM_RF_ANTPOWER
,
apcf
);
er
=
Jreader
.
ParamGet
(
Mtr_Param
.
MTR_PARAM_RF_ANTPOWER
,
apcf2
);
er
=
Jreader
.
ParamGet
(
Mtr_Param
.
MTR_PARAM_RF_ANTPOWER
,
apcf2
);
for
(
int
i
=
0
;
i
<
apcf2
.
antcnt
;
i
++)
for
(
int
i
=
0
;
i
<
apcf2
.
antcnt
;
i
++){
{
System
.
out
.
print
(
"antid:"
+
apcf2
.
Powers
[
i
].
antid
);
System
.
out
.
print
(
"antid:"
+
apcf2
.
Powers
[
i
].
antid
);
System
.
out
.
print
(
" rp:"
+
apcf2
.
Powers
[
i
].
readPower
);
System
.
out
.
print
(
" rp:"
+
apcf2
.
Powers
[
i
].
readPower
);
System
.
out
.
print
(
" wp:"
+
apcf2
.
Powers
[
i
].
writePower
);
System
.
out
.
print
(
" wp:"
+
apcf2
.
Powers
[
i
].
writePower
);
...
@@ -214,8 +218,7 @@ public class ReadUtils {
...
@@ -214,8 +218,7 @@ public class ReadUtils {
Inv_Potls_ST
ipst
=
Jreader
.
new
Inv_Potls_ST
();
Inv_Potls_ST
ipst
=
Jreader
.
new
Inv_Potls_ST
();
ipst
.
potlcnt
=
1
;
ipst
.
potlcnt
=
1
;
ipst
.
potls
=
new
Inv_Potl
[
1
];
ipst
.
potls
=
new
Inv_Potl
[
1
];
for
(
int
i
=
0
;
i
<
ipst
.
potlcnt
;
i
++)
for
(
int
i
=
0
;
i
<
ipst
.
potlcnt
;
i
++){
{
Inv_Potl
ipl
=
Jreader
.
new
Inv_Potl
();
Inv_Potl
ipl
=
Jreader
.
new
Inv_Potl
();
ipl
.
weight
=
30
;
ipl
.
weight
=
30
;
ipl
.
potl
=
SL_TagProtocol
.
SL_TAG_PROTOCOL_GEN2
;
ipl
.
potl
=
SL_TagProtocol
.
SL_TAG_PROTOCOL_GEN2
;
...
@@ -224,21 +227,21 @@ public class ReadUtils {
...
@@ -224,21 +227,21 @@ public class ReadUtils {
er
=
Jreader
.
ParamSet
(
Mtr_Param
.
MTR_PARAM_TAG_INVPOTL
,
ipst
);
er
=
Jreader
.
ParamSet
(
Mtr_Param
.
MTR_PARAM_TAG_INVPOTL
,
ipst
);
/*
/*
*
?????????????
*
设置是否检查天线
*
???????????1???????????0????????
*
当参数值传入1的时候表示要检查,0表示不检查
*/
*/
er
=
Jreader
.
ParamSet
(
Mtr_Param
.
MTR_PARAM_READER_IS_CHK_ANT
,
0
);
er
=
Jreader
.
ParamSet
(
Mtr_Param
.
MTR_PARAM_READER_IS_CHK_ANT
,
0
);
}
}
public
void
testinventory1
()
{
public
List
<
String
>
testinventory1
()
{
/*
/*
*
*
*
???????????????????????????????????
*
设置频率,对于某天线设置频率表可以提搞读效果
* HoptableData_ST
??????????
* HoptableData_ST
天线频率表类
* lenhtb
?????????
* lenhtb
表示频率表长度
* htb
????int???????????????
* htb
数组int类型,表示具体频点
HoptableData_ST hdst=Jreader.new HoptableData_ST();
HoptableData_ST hdst=Jreader.new HoptableData_ST();
hdst.lenhtb=2;
hdst.lenhtb=2;
hdst.htb[0]=915250;
hdst.htb[0]=915250;
...
@@ -246,20 +249,25 @@ public class ReadUtils {
...
@@ -246,20 +249,25 @@ public class ReadUtils {
READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE,hdst);
READER_ERR er=Jreader.ParamSet(Mtr_Param.MTR_PARAM_FREQUENCY_HOPTABLE,hdst);
*/
*/
/* ants ????????????????????????????
* antcnt ???????????
* timeout ??????????
/* ants 轮询使用的天线,即连接天线口的天线
* pTInfo ??????????????
* antcnt 使用的天线个数
* tagcnt ????????????????????????????
* timeout 读标签的时间
* pTInfo 存放标签数据的数组
* tagcnt 存放标签的个数,只需传入一个元素的数组
*/
*/
int
[]
tagcnt
=
new
int
[
1
];
int
[]
tagcnt
=
new
int
[
1
];
TAGINFO
[]
taginfo
=
new
TAGINFO
[
200
];
TAGINFO
[]
taginfo
=
new
TAGINFO
[
200
];
READER_ERR
er
=
Jreader
.
TagInventory
(
new
int
[]{
1
},
1
,
(
short
)
1000
,
taginfo
,
tagcnt
);
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
)
{
if
(
er
==
READER_ERR
.
MT_OK_ERR
)
{
for
(
int
i
=
0
;
i
<
tagcnt
[
0
];
i
++)
{
for
(
int
i
=
0
;
i
<
tagcnt
[
0
];
i
++)
{
System
.
out
.
println
(
"inv1_epc:"
+
Reader
.
bytes_Hexstr
(
taginfo
[
i
].
EpcId
));
result
.
add
(
Reader
.
bytes_Hexstr
(
taginfo
[
i
].
EpcId
));
// System.out.println("inv1_epc:"+Reader.bytes_Hexstr(taginfo[i].EpcId));
}
}
}
}
return
result
;
}
}
public
void
testinventory2
()
{
public
void
testinventory2
()
{
...
@@ -284,8 +292,8 @@ public class ReadUtils {
...
@@ -284,8 +292,8 @@ public class ReadUtils {
byte
[]
data3
=
new
byte
[
100
];
byte
[]
data3
=
new
byte
[
100
];
READER_ERR
er
=
Jreader
.
ReadDataOnReader
(
0
,
data3
,
100
);
READER_ERR
er
=
Jreader
.
ReadDataOnReader
(
0
,
data3
,
100
);
er
=
Jreader
.
SaveDataOnReader
(
0
,
data3
,
100
);
er
=
Jreader
.
SaveDataOnReader
(
0
,
data3
,
100
);
//
???????????????
//
擦除读写器上数据
er
=
Jreader
.
EraseDataOnReader
();
er
=
Jreader
.
EraseDataOnReader
();
}
}
...
@@ -301,16 +309,16 @@ public class ReadUtils {
...
@@ -301,16 +309,16 @@ public class ReadUtils {
// READER_ERR er=Jreader.Lock180006BTag(1, 2, 6, (short) 1000);
// READER_ERR er=Jreader.Lock180006BTag(1, 2, 6, (short) 1000);
byte
[]
data
=
new
byte
[
4
];
byte
[]
data
=
new
byte
[
4
];
Jreader
.
Str2Hex
(
pwd
,
pwd
.
length
(),
data
);
Jreader
.
Str2Hex
(
pwd
,
pwd
.
length
(),
data
);
//?????
//写数据
READER_ERR
er
=
Jreader
.
WriteTagData
(
1
,
(
char
)
0
,
2
,
data
,
2
,
null
,
(
short
)
1000
);
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
.
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
);
er
=
Jreader
.
WriteTagData
(
1
,
(
char
)
1
,
2
,
new
byte
[]{
0x11
,
0x22
},
2
,
null
,
(
short
)
1000
);
System
.
out
.
println
(
"no pwd write"
+
er
.
toString
());
System
.
out
.
println
(
"no pwd write"
+
er
.
toString
());
//?????
//写数据
er
=
Jreader
.
WriteTagData
(
1
,
(
char
)
1
,
2
,
new
byte
[]{
0x11
,
0x22
},
2
,
data
,
(
short
)
1000
);
er
=
Jreader
.
WriteTagData
(
1
,
(
char
)
1
,
2
,
new
byte
[]{
0x11
,
0x22
},
2
,
data
,
(
short
)
1000
);
System
.
out
.
println
(
"pwd write"
+
er
.
toString
());
System
.
out
.
println
(
"pwd write"
+
er
.
toString
());
...
@@ -481,7 +489,7 @@ public class ReadUtils {
...
@@ -481,7 +489,7 @@ public class ReadUtils {
EmbededData_ST
edst
=
Jreader
.
new
EmbededData_ST
();
EmbededData_ST
edst
=
Jreader
.
new
EmbededData_ST
();
edst
.
startaddr
=
0
;
edst
.
startaddr
=
0
;
edst
.
bank
=
2
;
edst
.
bank
=
2
;
//bytecnt=0
??????????
//bytecnt=0
取消嵌入数据
edst
.
bytecnt
=
2
;
edst
.
bytecnt
=
2
;
edst
.
accesspwd
=
null
;
edst
.
accesspwd
=
null
;
er
=
Jreader
.
ParamSet
(
Mtr_Param
.
MTR_PARAM_TAG_EMBEDEDDATA
,
edst
);
er
=
Jreader
.
ParamSet
(
Mtr_Param
.
MTR_PARAM_TAG_EMBEDEDDATA
,
edst
);
...
@@ -497,7 +505,7 @@ public class ReadUtils {
...
@@ -497,7 +505,7 @@ public class ReadUtils {
esrst
.
ApIndexBitsNumInEpc
=
1
;
esrst
.
ApIndexBitsNumInEpc
=
1
;
esrst
.
ApIndexStartBitsInEpc
=
3
;
esrst
.
ApIndexStartBitsInEpc
=
3
;
esrst
.
bank
=
1
;
esrst
.
bank
=
1
;
//blkcnt =0
?????
//blkcnt =0
取消。
esrst
.
blkcnt
=
2
;
esrst
.
blkcnt
=
2
;
esrst
.
pwdtype
=
1
;
esrst
.
pwdtype
=
1
;
esrst
.
tagtype
=
2
;
esrst
.
tagtype
=
2
;
...
@@ -509,7 +517,7 @@ public class ReadUtils {
...
@@ -509,7 +517,7 @@ public class ReadUtils {
TagFilter_ST
tfst
=
Jreader
.
new
TagFilter_ST
();
TagFilter_ST
tfst
=
Jreader
.
new
TagFilter_ST
();
tfst
.
bank
=
1
;
tfst
.
bank
=
1
;
tfst
.
fdata
=
new
byte
[]{(
byte
)
0xE2
,(
byte
)
0x00
};
tfst
.
fdata
=
new
byte
[]{(
byte
)
0xE2
,(
byte
)
0x00
};
//flen 0
????????
//flen 0
为取消过滤
tfst
.
flen
=
2
;
tfst
.
flen
=
2
;
tfst
.
isInvert
=
0
;
tfst
.
isInvert
=
0
;
tfst
.
startaddr
=
2
;
tfst
.
startaddr
=
2
;
...
@@ -584,44 +592,44 @@ public class ReadUtils {
...
@@ -584,44 +592,44 @@ public class ReadUtils {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
// maintest mt=new maintest
();
ReadUtils
mt
=
new
ReadUtils
();
// //????????
//测试初始化
//
//启动
//启动
//
mt.testinitreader();
mt
.
testinitreader
();
//???????
//测试转换
//mt.testtran();
//mt.testtran();
//????
gpio
//测试
gpio
//mt.testgpio();
//mt.testgpio();
//???????
//测试参数
//mt.testrparams();
//mt.testrparams();
//????????
//测试块操作
//mt.testblockop();
//mt.testblockop();
//???????????
//测试特殊指令
//mt.testcustomcmd();
//mt.testcustomcmd();
//???????????????
//测试读写器内部数据
//mt.testdataonreader();
//mt.testdataonreader();
//????????
1
//测试盘点方式
1
//盘存
//盘存
//
mt.testinventory1();
mt
.
testinventory1
();
//
????????
2
//
测试盘点方式
2
// mt.testinventory2();
// mt.testinventory2();
//????????????
//测试销毁密码
//mt.testkilltag();
//mt.testkilltag();
//?????????
//测试锁标签
//mt.testlocktag();
//mt.testlocktag();
//?????????
//测试读写标签
// mt.testreadandwrite();
// mt.testreadandwrite();
//?????ip???
//测试改ip地址
//可以修改ip
//可以修改ip
// mt.testsetip();
// mt.testsetip();
//????
psam
//测试
psam
//mt.testpsam();
//mt.testpsam();
//
???????
//
关闭读写器
//关闭
//关闭
//
mt.Jreader.CloseReader();
mt
.
Jreader
.
CloseReader
();
//
System.out.println("test over");
System
.
out
.
println
(
"test over"
);
}
}
}
}
dev-socket/src/main/java/com/tykj/dev/socket/MessageError.java
0 → 100644
浏览文件 @
d5a90058
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
;
}
dev-socket/src/main/java/com/tykj/dev/socket/MyWebSocket.java
浏览文件 @
d5a90058
...
@@ -2,14 +2,17 @@ package com.tykj.dev.socket;
...
@@ -2,14 +2,17 @@ package com.tykj.dev.socket;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.websocket.*
;
import
javax.websocket.*
;
import
javax.websocket.server.PathParam
;
import
javax.websocket.server.PathParam
;
import
javax.websocket.server.ServerEndpoint
;
import
javax.websocket.server.ServerEndpoint
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.Socket
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
/**
...
@@ -20,8 +23,9 @@ import java.util.concurrent.ConcurrentHashMap;
...
@@ -20,8 +23,9 @@ import java.util.concurrent.ConcurrentHashMap;
* @createTime 2020年08月19日 23:53:00
* @createTime 2020年08月19日 23:53:00
*/
*/
@Slf4j
@Slf4j
@ServerEndpoint
(
value
=
"/websocket/{userId}"
)
//接受websocket请求路径
@ServerEndpoint
(
value
=
"/
public/
websocket/{userId}"
)
//接受websocket请求路径
@Component
//注册到spring容器中
@Component
//注册到spring容器中
@Data
public
class
MyWebSocket
{
public
class
MyWebSocket
{
/**
/**
* concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
* concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
...
@@ -66,12 +70,13 @@ public class MyWebSocket {
...
@@ -66,12 +70,13 @@ public class MyWebSocket {
//加入set中
//加入set中
//在线数加1
//在线数加1
}
}
log
.
info
(
"用户连接:"
+
userId
+
",当前在线人数为:"
+
webSocketMap
.
size
());
log
.
info
(
"用户连接:"
+
userId
+
",当前在线人数为:"
+
webSocketMap
.
size
());
sendMessage
(
"连接成功"
);
sendMessage
(
"连接成功"
);
}
}
/**
/**
* 连接关闭调用的方法
* 连接关闭调用的方法
*/
*/
...
@@ -89,9 +94,15 @@ public class MyWebSocket {
...
@@ -89,9 +94,15 @@ public class MyWebSocket {
log
.
info
(
"用户退出:"
+
userId
+
",当前在线人数为:"
+
webSocketMap
.
size
());
log
.
info
(
"用户退出:"
+
userId
+
",当前在线人数为:"
+
webSocketMap
.
size
());
}
}
public
MyWebSocket
getMap
(
String
userId
)
{
MyWebSocket
myWebSocket
=
webSocketMap
.
get
(
userId
);
log
.
info
(
"用户退出:"
+
userId
+
",当前在线人数为:"
+
webSocketMap
.
size
());
return
myWebSocket
;
}
/**
/**
* 收到客户端消息后调用的方法
* 收到客户端消息后调用的方法
*
* @param message 客户端发送过来的消息
* @param message 客户端发送过来的消息
*/
*/
@OnMessage
@OnMessage
...
@@ -141,10 +152,55 @@ public class MyWebSocket {
...
@@ -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
()
{
public
void
sendMessage1
()
{
for
(
String
i
:
webSocketMap
.
keySet
())
{
for
(
String
i
:
webSocketMap
.
keySet
())
{
webSocketMap
.
get
(
i
).
sendMessage
(
"1"
);
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;
// }
// }
}
}
dev-task/src/main/java/com/tykj/dev/device/task/subject/bto/TaskBto.java
浏览文件 @
d5a90058
...
@@ -127,6 +127,18 @@ public class TaskBto {
...
@@ -127,6 +127,18 @@ public class TaskBto {
this
.
exhibit
=
exhibit
;
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类
* bto类转化为do类
*/
*/
...
...
dev-taskselect/pom.xml
浏览文件 @
d5a90058
...
@@ -63,6 +63,10 @@
...
@@ -63,6 +63,10 @@
<groupId>
com.tykj
</groupId>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-sendback
</artifactId>
<artifactId>
dev-sendback
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
dev-readmachine
</artifactId>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
dev-taskselect/src/main/java/com/tykj/dev/device/taskselect/controller/TaskSelectController.java
浏览文件 @
d5a90058
...
@@ -36,6 +36,7 @@ import com.tykj.dev.device.task.service.TaskService;
...
@@ -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.bto.TaskBto
;
import
com.tykj.dev.device.task.subject.domin.Task
;
import
com.tykj.dev.device.task.subject.domin.Task
;
import
com.tykj.dev.device.taskselect.vo.SignatureSaveVo
;
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.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.misc.base.ResultObj
;
import
com.tykj.dev.misc.base.ResultObj
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.exception.ApiException
;
...
@@ -43,12 +44,18 @@ import com.tykj.dev.misc.utils.JacksonUtil;
...
@@ -43,12 +44,18 @@ import com.tykj.dev.misc.utils.JacksonUtil;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.Snowflake
;
import
com.tykj.dev.misc.utils.Snowflake
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
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.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.checkerframework.checker.units.qual.Area
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -111,9 +118,18 @@ public class TaskSelectController {
...
@@ -111,9 +118,18 @@ public class TaskSelectController {
@Autowired
@Autowired
private
TaskDao
taskDao
;
private
TaskDao
taskDao
;
@Autowired
private
ReadMachineBillService
readMachineBillService
;
@Autowired
private
ReadMachineLibraryService
readMachineLibraryService
;
// @Autowired
// @Autowired
// private DeviceLibraryDao deviceLibraryDao;
// private DeviceLibraryDao deviceLibraryDao;
@Resource
private
UserCache
userCache
;
@ApiOperation
(
value
=
"查询业务对应页面的数据"
,
notes
=
"可以通过这个接口查询业务对应页面的数据"
)
@ApiOperation
(
value
=
"查询业务对应页面的数据"
,
notes
=
"可以通过这个接口查询业务对应页面的数据"
)
@GetMapping
(
"/manage/detail/{id}"
)
@GetMapping
(
"/manage/detail/{id}"
)
public
ResponseEntity
selectData
(
@PathVariable
(
"id"
)
int
taskId
)
{
public
ResponseEntity
selectData
(
@PathVariable
(
"id"
)
int
taskId
)
{
...
@@ -469,6 +485,19 @@ public class TaskSelectController {
...
@@ -469,6 +485,19 @@ public class TaskSelectController {
list
.
add
(
deviceLibraries
);
list
.
add
(
deviceLibraries
);
return
ResponseEntity
.
ok
(
new
ResultObj
(
list
,
"查询成功"
));
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
:
default
:
throw
new
ApiException
(
ResultUtil
.
failed
(
"该接口不支持当前task业务类型"
));
throw
new
ApiException
(
ResultUtil
.
failed
(
"该接口不支持当前task业务类型"
));
}
}
...
...
dev-union/pom.xml
浏览文件 @
d5a90058
...
@@ -214,6 +214,17 @@
...
@@ -214,6 +214,17 @@
</exclusions>
</exclusions>
</dependency>
</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>
<dependency>
<groupId>
com.tykj
</groupId>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-destroy
</artifactId>
<artifactId>
dev-destroy
</artifactId>
...
...
pom.xml
浏览文件 @
d5a90058
...
@@ -50,6 +50,7 @@
...
@@ -50,6 +50,7 @@
<module>
dev-policydocument
</module>
<module>
dev-policydocument
</module>
<module>
dev-questionbank
</module>
<module>
dev-questionbank
</module>
<module>
dev-zxing
</module>
<module>
dev-zxing
</module>
<module>
dev-readmachine
</module>
</modules>
</modules>
<properties>
<properties>
...
@@ -254,6 +255,12 @@
...
@@ -254,6 +255,12 @@
<artifactId>
dev-zxing
</artifactId>
<artifactId>
dev-zxing
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
dev-readmachine
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论