Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zhongtong-avi-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
中通客车项目
zhongtong-avi-service
Commits
ba769016
Commit
ba769016
authored
Nov 17, 2019
by
喻训浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: avi修改
parent
b32f34a4
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
426 additions
and
144 deletions
+426
-144
CacheConfig.java
...a/net/vtstar/zhongtong/avi/global/config/CacheConfig.java
+10
-0
Constant.java
...va/net/vtstar/zhongtong/avi/global/constant/Constant.java
+10
-2
LedController.java
...tstar/zhongtong/avi/ledlamp/controller/LedController.java
+7
-3
LedStationVO.java
.../vtstar/zhongtong/avi/ledlamp/domain/vo/LedStationVO.java
+2
-1
LedService.java
.../net/vtstar/zhongtong/avi/ledlamp/service/LedService.java
+67
-13
AreaController.java
...r/zhongtong/avi/monitoring/controller/AreaController.java
+130
-89
WaringRecord.java
.../vtstar/zhongtong/avi/monitoring/domain/WaringRecord.java
+17
-0
Warning.java
...a/net/vtstar/zhongtong/avi/monitoring/domain/Warning.java
+15
-1
WorkRoom.java
.../net/vtstar/zhongtong/avi/monitoring/domain/WorkRoom.java
+35
-0
AVIMonitorJob.java
...et/vtstar/zhongtong/avi/monitoring/job/AVIMonitorJob.java
+54
-10
WarningMapper.java
...vtstar/zhongtong/avi/monitoring/mapper/WarningMapper.java
+9
-0
WorkRoomMapper.java
...tstar/zhongtong/avi/monitoring/mapper/WorkRoomMapper.java
+9
-0
ReadDataToCacheRunner.java
...hongtong/avi/monitoring/runner/ReadDataToCacheRunner.java
+55
-16
AreaService.java
.../vtstar/zhongtong/avi/monitoring/service/AreaService.java
+0
-3
application-quartz.properties
src/main/resources/config/application-quartz.properties
+5
-5
application.properties
src/main/resources/config/application.properties
+1
-1
No files found.
src/main/java/net/vtstar/zhongtong/avi/global/config/CacheConfig.java
View file @
ba769016
...
...
@@ -52,4 +52,14 @@ public class CacheConfig {
Cache
webStationCache
(
ConcurrentMapCacheManager
cacheManager
)
{
return
cacheManager
.
getCache
(
"webStationCache"
);
}
@Bean
Cache
warningCache
(
ConcurrentMapCacheManager
cacheManager
)
{
return
cacheManager
.
getCache
(
"warningCache"
);
}
@Bean
Cache
roomCache
(
ConcurrentMapCacheManager
cacheManager
)
{
return
cacheManager
.
getCache
(
"roomCache"
);
}
}
src/main/java/net/vtstar/zhongtong/avi/global/constant/Constant.java
View file @
ba769016
...
...
@@ -6,13 +6,21 @@ public class Constant {
public
static
long
totalTimeOut
=
0
;
//redis滑撬前缀
public
static
final
String
SKID_PREFIX
=
"skid:"
;
//redis工位前缀
public
static
final
String
STATION_PREFIX
=
"station:"
;
//redis工作室前缀
public
static
final
String
ROOM_PREFIX
=
"room:"
;
//redis报警前缀
public
static
final
String
WARNING_PREFIX
=
"warning:"
;
public
static
final
String
AREA_PREFIX
=
"area:"
;
//根据屏号工作室分组key
public
static
final
String
LED_PREFIX
=
"led:"
;
//进车数统计
public
static
final
String
BUS_SIZE_IN
=
"BUS:IN"
;
//进车数统计
public
static
final
String
BUS_SIZE_OUT
=
"BUS:OUT"
;
...
...
src/main/java/net/vtstar/zhongtong/avi/ledlamp/controller/LedController.java
View file @
ba769016
...
...
@@ -8,6 +8,7 @@ import net.vtstar.zhongtong.avi.ledlamp.domain.RoomInfo;
import
net.vtstar.zhongtong.avi.ledlamp.domain.vo.LedStationVO
;
import
net.vtstar.zhongtong.avi.ledlamp.service.LedService
;
import
net.vtstar.zhongtong.avi.monitoring.domain.Warning
;
import
net.vtstar.zhongtong.avi.monitoring.domain.WorkRoom
;
import
net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState
;
import
net.vtstar.zhongtong.avi.monitoring.domain.vo.VocVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -31,6 +32,7 @@ public class LedController {
@ApiOperation
(
value
=
"工位级led大屏信息监控"
,
response
=
LedStationVO
.
class
)
@GetMapping
(
value
=
"/ledInfo"
)
private
Return
getLEDStationInfo
(
@RequestParam
(
value
=
"ledNo"
)
String
ledNo
)
{
LedStationVO
ledStationVO
=
new
LedStationVO
();
ledStationVO
.
setName
(
"电泳"
);
ArrayList
<
Warning
>
warnings
=
new
ArrayList
<>();
...
...
@@ -47,13 +49,13 @@ public class LedController {
ledStationVO
.
setBusOut
(
new
BigDecimal
(
44
));
ledStationVO
.
setWarningList
(
warnings
);
ArrayList
<
RoomInfo
>
roomInfos
=
new
ArrayList
<>();
RoomInfo
roomInfo
=
new
RoomInfo
();
ArrayList
<
WorkRoom
>
roomInfos
=
new
ArrayList
<>();
WorkRoom
roomInfo
=
new
WorkRoom
();
roomInfo
.
setName
(
"喷漆室1"
);
roomInfo
.
setStationState
(
StationState
.
USE
);
roomInfo
.
setWorkingHours
(
new
BigDecimal
(
30
));
RoomInfo
roomInfo2
=
new
RoomInfo
();
WorkRoom
roomInfo2
=
new
WorkRoom
();
roomInfo2
.
setName
(
"喷漆室2"
);
roomInfo2
.
setStationState
(
StationState
.
FREE
);
roomInfo2
.
setWorkingHours
(
new
BigDecimal
(
22
));
...
...
@@ -61,6 +63,8 @@ public class LedController {
roomInfos
.
add
(
roomInfo
);
roomInfos
.
add
(
roomInfo2
);
ledStationVO
.
setRoomInfoList
(
roomInfos
);
ledStationVO
=
ledService
.
getInfoByNo
(
ledNo
);
return
Return
.
success
(
ledStationVO
);
}
...
...
src/main/java/net/vtstar/zhongtong/avi/ledlamp/domain/vo/LedStationVO.java
View file @
ba769016
...
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
net.vtstar.zhongtong.avi.ledlamp.domain.RoomInfo
;
import
net.vtstar.zhongtong.avi.monitoring.domain.Warning
;
import
net.vtstar.zhongtong.avi.monitoring.domain.WorkRoom
;
import
java.math.BigDecimal
;
import
java.util.List
;
...
...
@@ -29,5 +30,5 @@ public class LedStationVO {
private
List
<
Warning
>
warningList
;
@ApiModelProperty
(
value
=
"室内信息"
)
private
List
<
RoomInfo
>
roomInfoList
;
private
List
<
WorkRoom
>
roomInfoList
;
}
src/main/java/net/vtstar/zhongtong/avi/ledlamp/service/LedService.java
View file @
ba769016
package
net
.
vtstar
.
zhongtong
.
avi
.
ledlamp
.
service
;
import
com.sun.jna.Library
;
import
com.sun.jna.Native
;
import
com.sun.jna.Platform
;
import
net.vtstar.zhongtong.avi.equipment.domain.PaintshopArea
;
import
net.vtstar.zhongtong.avi.global.constant.Constant
;
import
net.vtstar.zhongtong.avi.ledlamp.domain.vo.LedStationVO
;
import
net.vtstar.zhongtong.avi.monitoring.domain.Warning
;
import
net.vtstar.zhongtong.avi.monitoring.domain.WorkRoom
;
import
net.vtstar.zhongtong.avi.monitoring.domain.enums.BusType
;
import
net.vtstar.zhongtong.avi.monitoring.domain.enums.DateType
;
import
net.vtstar.zhongtong.avi.monitoring.domain.vo.CarStatisticsVO
;
import
org.springframework.cache.Cache
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
public
class
LedService
{
public
interface
test
extends
Library
{
@Resource
(
name
=
"warningCache"
)
private
Cache
warningCache
;
@Resource
(
name
=
"webStationCache"
)
private
Cache
webStationCache
;
@Resource
(
name
=
"stationCache"
)
private
Cache
stationCache
;
@Resource
(
name
=
"roomCache"
)
private
Cache
roomCache
;
test
INSTANCE
=
(
test
)
Native
.
loadLibrary
((
Platform
.
isWindows
()
?
"dll//lv_led"
:
"c"
),
test
.
class
);
int
CreateProgram
(
int
LedWidth
,
int
LedHeight
,
int
ColorType
);
}
public
LedStationVO
getInfoByNo
(
String
ledNo
)
{
public
static
void
main
(
String
[]
args
)
{
try
{
test
.
INSTANCE
.
CreateProgram
(
128
,
32
,
1
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
String
.
format
(
e
.
getMessage
(),
"utf-8"
));
LedStationVO
vo
=
new
LedStationVO
();
if
(
ledNo
.
equals
(
"1"
))
{
vo
.
setName
(
"电泳"
);
}
else
if
(
ledNo
.
equals
(
"2"
))
{
vo
.
setName
(
"腻子"
);
}
else
if
(
ledNo
.
equals
(
"3"
))
{
vo
.
setName
(
"中涂"
);
}
else
if
(
ledNo
.
equals
(
"4"
))
{
vo
.
setName
(
"面/清漆"
);
}
else
if
(
ledNo
.
equals
(
"5"
)
||
ledNo
.
equals
(
"6"
)
||
ledNo
.
equals
(
"7"
))
{
vo
.
setName
(
"喷漆室/烘干室"
);
}
}
//获得车辆区域进出车统计
List
<
CarStatisticsVO
>
sta
=
webStationCache
.
get
(
"busSta"
,
ArrayList
.
class
);
if
(
CollectionUtils
.
isEmpty
(
sta
))
return
null
;
for
(
CarStatisticsVO
carStatisticsVO
:
sta
)
{
if
(!
carStatisticsVO
.
getAreaNo
().
equals
(
ledNo
))
{
continue
;
}
if
(!
carStatisticsVO
.
getDateType
().
equals
(
DateType
.
TODAY
))
{
continue
;
}
if
(
carStatisticsVO
.
getBusType
().
equals
(
BusType
.
IN
))
{
vo
.
setBusIn
(
carStatisticsVO
.
getSize
());
}
if
(
carStatisticsVO
.
getBusType
().
equals
(
BusType
.
OUT
))
{
vo
.
setBusOut
(
carStatisticsVO
.
getSize
());
}
}
if
(
ledNo
.
equals
(
"1"
)
||
ledNo
.
equals
(
"2"
)
||
ledNo
.
equals
(
"3"
)
||
ledNo
.
equals
(
"4"
))
{
List
<
Warning
>
warnings
=
new
ArrayList
<>();
vo
.
setWarningList
(
warnings
);
vo
.
setRoomInfoList
(
new
ArrayList
<>());
warningCache
.
get
(
ledNo
);
}
else
{
List
<
WorkRoom
>
room
=
roomCache
.
get
(
Constant
.
LED_PREFIX
+
ledNo
,
ArrayList
.
class
);
if
(
CollectionUtils
.
isEmpty
(
room
))
{
vo
.
setRoomInfoList
(
new
ArrayList
<>());
}
else
{
vo
.
setRoomInfoList
(
room
);
}
}
return
vo
;
}
}
src/main/java/net/vtstar/zhongtong/avi/monitoring/controller/AreaController.java
View file @
ba769016
package
net
.
vtstar
.
zhongtong
.
avi
.
monitoring
.
controller
;
import
io.netty.buffer.ByteBuf
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
net.vtstar.protocol.modbus.tcp.netty.packet.ModbusResponse
;
import
net.vtstar.protocol.modbus.tcp.netty.packet.ReadCoilsRequest
;
import
net.vtstar.protocol.modbus.tcp.netty.packet.ReadCoilsResponse
;
import
net.vtstar.protocol.modbus.tcp.netty.service.ModbusTemplate
;
import
net.vtstar.protocol.modbus.tcp.netty.utils.PoolKey
;
import
net.vtstar.utils.domain.Return
;
import
net.vtstar.zhongtong.avi.equipment.domain.PaintshopArea
;
import
net.vtstar.zhongtong.avi.equipment.domain.PaintshopStation
;
...
...
@@ -33,85 +39,87 @@ public class AreaController {
@Autowired
private
AreaService
areaService
;
@Autowired
private
ModbusTemplate
template
;
@ApiOperation
(
value
=
"根据区域编号查询区域实时信息"
,
response
=
PaintshopArea
.
class
,
responseContainer
=
"List"
,
notes
=
"区域编号:\r\n"
+
@ApiOperation
(
value
=
"根据区域编号查询区域实时信息"
,
response
=
PaintshopArea
.
class
,
responseContainer
=
"List"
,
notes
=
"区域编号:\r\n"
+
"整体区域:0\r\n钣金:1\r\n电泳:2\r\n密封防腐:3\r\n腻子:4\r\n中涂:5\r\n面/色漆:6\r\n成品:7"
)
@GetMapping
(
"/areaInfo/realTime"
)
private
Return
getAreaInfo
(
@RequestParam
(
value
=
"areaNo"
,
required
=
false
)
String
areaNo
)
{
List
<
PaintshopArea
>
areas
2
=
areaService
.
getInfoByAreaNo
(
areaNo
);
List
<
PaintshopArea
>
areas
=
new
ArrayList
<>();
PaintshopArea
area
=
new
PaintshopArea
();
area
.
setCode
(
"2"
);
area
.
setName
(
"电泳"
);
area
.
setOnlineNum
(
"44"
);
Map
<
String
,
PaintshopStation
>
stationMap
=
new
HashMap
<>();
Map
<
String
,
PaintshopStation
>
stationMap2
=
new
HashMap
<>();
Map
<
String
,
PaintshopStation
>
stationMap3
=
new
HashMap
<>();
Map
<
String
,
PaintshopStation
>
stationMap4
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
9
;
i
++)
{
PaintshopStation
station
=
new
PaintshopStation
();
station
.
setBusNo
(
"No"
+
i
);
station
.
setKeyStation
(
true
);
station
.
setCode
(
"HDG1-4"
+
i
);
station
.
setState
(
StationState
.
USE
);
station
.
setBusType
(
ProductionType
.
OWN
);
stationMap
.
put
(
"HDG1-4"
+
i
,
station
);
}
PaintshopArea
area2
=
new
PaintshopArea
();
area2
.
setCode
(
"1"
);
area2
.
setName
(
"钣金"
);
area2
.
setOnlineNum
(
"44"
);
for
(
int
i
=
0
;
i
<
9
;
i
++)
{
PaintshopStation
station
=
new
PaintshopStation
();
station
.
setBusNo
(
"No"
+
i
);
station
.
setKeyStation
(
true
);
station
.
setCode
(
"HDG1-1"
+
i
);
station
.
setState
(
StationState
.
USE
);
station
.
setBusType
(
ProductionType
.
OWN
);
stationMap2
.
put
(
"HDG1-1"
+
i
,
station
);
}
PaintshopArea
area3
=
new
PaintshopArea
();
area3
.
setCode
(
"6"
);
area3
.
setName
(
"喷涂"
);
area3
.
setOnlineNum
(
"44"
);
for
(
int
i
=
0
;
i
<
9
;
i
++)
{
PaintshopStation
station
=
new
PaintshopStation
();
station
.
setBusNo
(
"No"
+
i
);
station
.
setKeyStation
(
true
);
station
.
setCode
(
"HDG1-19"
+
i
);
station
.
setState
(
StationState
.
USE
);
station
.
setBusType
(
ProductionType
.
OWN
);
stationMap3
.
put
(
"HDG1-19"
+
i
,
station
);
}
PaintshopArea
area4
=
new
PaintshopArea
();
area4
.
setCode
(
"5"
);
area4
.
setName
(
"中涂"
);
area4
.
setOnlineNum
(
"44"
);
for
(
int
i
=
0
;
i
<
9
;
i
++)
{
PaintshopStation
station
=
new
PaintshopStation
();
station
.
setBusNo
(
"No"
+
i
);
station
.
setKeyStation
(
true
);
station
.
setCode
(
"HDG1-12"
+
i
);
station
.
setState
(
StationState
.
USE
);
station
.
setBusType
(
ProductionType
.
OTHER
);
stationMap4
.
put
(
"HDG1-12"
+
i
,
station
);
}
area
.
setStationMap
(
stationMap
);
area2
.
setStationMap
(
stationMap2
);
area3
.
setStationMap
(
stationMap3
);
area4
.
setStationMap
(
stationMap4
);
areas
.
add
(
area4
);
areas
.
add
(
area
);
areas
.
add
(
area2
);
areas
.
add
(
area3
);
private
Return
getAreaInfo
(
@RequestParam
(
value
=
"areaNo"
,
required
=
false
)
String
areaNo
)
{
List
<
PaintshopArea
>
areas
=
areaService
.
getInfoByAreaNo
(
areaNo
);
//
List<PaintshopArea> areas = new ArrayList<>();
//
PaintshopArea area = new PaintshopArea();
//
area.setCode("2");
//
area.setName("电泳");
//
area.setOnlineNum("44");
//
Map<String, PaintshopStation> stationMap = new HashMap<>();
//
Map<String, PaintshopStation> stationMap2 = new HashMap<>();
//
Map<String, PaintshopStation> stationMap3 = new HashMap<>();
//
Map<String, PaintshopStation> stationMap4 = new HashMap<>();
//
for (int i = 0; i < 9; i++) {
//
PaintshopStation station = new PaintshopStation();
//
station.setBusNo("No" + i);
//
station.setKeyStation(true);
//
station.setCode("HDG1-4" + i);
//
station.setState(StationState.USE);
//
station.setBusType(ProductionType.OWN);
//
stationMap.put("HDG1-4" + i,station);
//
}
//
PaintshopArea area2 = new PaintshopArea();
//
area2.setCode("1");
//
area2.setName("钣金");
//
area2.setOnlineNum("44");
//
for (int i = 0; i < 9; i++) {
//
PaintshopStation station = new PaintshopStation();
//
station.setBusNo("No" + i);
//
station.setKeyStation(true);
//
station.setCode("HDG1-1" + i);
//
station.setState(StationState.USE);
//
station.setBusType(ProductionType.OWN);
//
stationMap2.put("HDG1-1" + i,station);
//
}
//
PaintshopArea area3 = new PaintshopArea();
//
area3.setCode("6");
//
area3.setName("喷涂");
//
area3.setOnlineNum("44");
//
for (int i = 0; i < 9; i++) {
//
PaintshopStation station = new PaintshopStation();
//
station.setBusNo("No" + i);
//
station.setKeyStation(true);
//
station.setCode("HDG1-19" + i);
//
station.setState(StationState.USE);
//
station.setBusType(ProductionType.OWN);
//
stationMap3.put("HDG1-19" + i,station);
//
}
//
PaintshopArea area4 = new PaintshopArea();
//
area4.setCode("5");
//
area4.setName("中涂");
//
area4.setOnlineNum("44");
//
for (int i = 0; i < 9; i++) {
//
PaintshopStation station = new PaintshopStation();
//
station.setBusNo("No" + i);
//
station.setKeyStation(true);
//
station.setCode("HDG1-12" + i);
//
station.setState(StationState.USE);
//
station.setBusType(ProductionType.OTHER);
//
stationMap4.put("HDG1-12" + i,station);
//
}
//
area.setStationMap(stationMap);
//
area2.setStationMap(stationMap2);
//
area3.setStationMap(stationMap3);
//
area4.setStationMap(stationMap4);
//
areas.add(area4);
//
areas.add(area);
//
areas.add(area2);
//
areas.add(area3);
return
Return
.
success
(
areas
);
}
@ApiOperation
(
value
=
"查询车间各区域进车及交车数量"
,
response
=
CarStatisticsVO
.
class
,
responseContainer
=
"List"
)
@GetMapping
(
"/bus/statistics"
)
private
Return
getRealtimeData
()
{
Array
List
<
CarStatisticsVO
>
vos
=
new
ArrayList
<>();
List
<
CarStatisticsVO
>
vos
=
new
ArrayList
<>();
CarStatisticsVO
carStatisticsVO
=
new
CarStatisticsVO
();
carStatisticsVO
.
setAreaNo
(
"1"
);
carStatisticsVO
.
setBusType
(
BusType
.
IN
);
...
...
@@ -126,35 +134,68 @@ public class AreaController {
vos
.
add
(
carStatisticsVO
);
vos
.
add
(
carStatisticsVO2
);
vos
=
areaService
.
getBusSta
();
return
Return
.
success
(
vos
);
}
@ApiOperation
(
value
=
"根据工单号及订单号定位车体当前位置"
,
response
=
PaintshopArea
.
class
,
responseContainer
=
"List"
)
@GetMapping
(
"/currentPosition/orderNo/workOrderNo"
)
private
Return
getPositionByOrderAndNo
(
@RequestParam
(
value
=
"orderNo"
,
required
=
false
)
String
orderNo
,
@RequestParam
(
value
=
"workOrderNo"
,
required
=
false
)
String
workOrderNo
)
{
List
<
Map
<
String
,
PaintshopStation
>>
s
=
new
ArrayList
<>();
Map
<
String
,
PaintshopStation
>
stationMap
=
new
HashMap
<>();
PaintshopStation
station
=
new
PaintshopStation
();
station
.
setBusNo
(
"aaa"
);
station
.
setKeyStation
(
true
);
station
.
setCode
(
"HDG1-4"
);
station
.
setState
(
StationState
.
USE
);
station
.
setBusType
(
ProductionType
.
OWN
);
stationMap
.
put
(
"HDG1-4"
,
station
);
PaintshopStation
station2
=
new
PaintshopStation
();
station2
.
setBusNo
(
"bbb"
);
station2
.
setKeyStation
(
false
);
station2
.
setBusType
(
ProductionType
.
OTHER
);
station2
.
setState
(
StationState
.
FREE
);
station2
.
setCode
(
"HDG1-3"
);
stationMap
.
put
(
"HDG1-3"
,
station2
);
s
.
add
(
stationMap
);
return
Return
.
success
(
stationMap
);
private
Return
getPositionByOrderAndNo
(
@RequestParam
(
value
=
"orderNo"
,
required
=
false
)
String
orderNo
,
@RequestParam
(
value
=
"workOrderNo"
,
required
=
false
)
String
workOrderNo
)
{
// List<Map<String, PaintshopStation>> s = new ArrayList<>();
// Map<String, PaintshopStation> stationMap = new HashMap<>();
// PaintshopStation station = new PaintshopStation();
// station.setBusNo("aaa");
// station.setKeyStation(true);
// station.setCode("HDG1-4");
// station.setState(StationState.USE);
// station.setBusType(ProductionType.OWN);
// stationMap.put("HDG1-4", station);
// PaintshopStation station2 = new PaintshopStation();
// station2.setBusNo("bbb");
// station2.setKeyStation(false);
// station2.setBusType(ProductionType.OTHER);
// station2.setState(StationState.FREE);
// station2.setCode("HDG1-3");
// stationMap.put("HDG1-3", station2);
// s.add(stationMap);
List
<
PaintshopArea
>
areas
=
areaService
.
findBusLocation
(
orderNo
,
workOrderNo
);
return
Return
.
success
(
areas
);
}
@ApiOperation
(
value
=
"根据车身号获得当前车体信息"
,
response
=
Bus
.
class
)
@GetMapping
(
"/detail/busNo"
)
private
Return
getBusDetail
(
@RequestParam
(
"busNo"
)
String
busNo
)
{
Bus
bus
=
areaService
.
getByBusNo
(
busNo
);
return
Return
.
success
(
bus
);
}
@GetMapping
(
"/test"
)
private
Return
test
()
{
PoolKey
key
=
new
PoolKey
(
"localhost"
,
502
);
ReadCoilsRequest
readCoilsRequest
=
new
ReadCoilsRequest
(
1
,
0
,
50
);
try
{
ModbusResponse
execute
=
template
.
execute
(
key
,
readCoilsRequest
,
ReadCoilsResponse
.
class
);
ByteBuf
body
=
execute
.
getBody
();
int
capacity
=
body
.
capacity
();
//byte b = body.readByte();
byte
aByte4
=
body
.
getByte
(
0
);
byte
aByte1
=
body
.
getByte
(
1
);
byte
aByte
=
body
.
getByte
(
2
);
int
length
=
body
.
readableBytes
();
// byte[] bytes = new byte[lenght];
// ByteBuf bytes1 = body.getBytes(body.readerIndex(), bytes);
int
a
=
1
;
}
catch
(
Exception
e
)
{
}
return
Return
.
success
();
}
}
src/main/java/net/vtstar/zhongtong/avi/monitoring/domain/WaringRecord.java
0 → 100644
View file @
ba769016
package
net
.
vtstar
.
zhongtong
.
avi
.
monitoring
.
domain
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
@Data
@ApiModel
(
value
=
"报警记录"
)
public
class
WaringRecord
{
private
Long
id
;
private
String
warningCode
;
private
String
name
;
private
String
equipName
;
}
src/main/java/net/vtstar/zhongtong/avi/monitoring/domain/Warning.java
View file @
ba769016
...
...
@@ -4,21 +4,35 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Table
;
import
java.util.Date
;
@Data
@Table
(
name
=
"warning"
)
@ApiModel
(
value
=
"报警信息"
)
public
class
Warning
{
@Column
(
name
=
"id"
)
private
Long
id
;
@Column
(
name
=
"info"
)
@ApiModelProperty
(
value
=
"报警信息描述"
)
private
String
info
;
@Column
(
name
=
"code"
)
@ApiModelProperty
(
value
=
"警告编号"
)
private
String
code
;
@Column
(
name
=
"type"
)
@ApiModelProperty
(
value
=
"类型"
)
private
String
type
;
@Column
(
name
=
"name"
)
@ApiModelProperty
(
value
=
"警告名"
)
private
String
name
;
@ApiModelProperty
(
value
=
"时间(前端用)"
)
@ApiModelProperty
(
value
=
"时间(前端用)
,适用于报警监控
"
)
private
String
time
;
@ApiModelProperty
(
value
=
"设备名"
)
...
...
src/main/java/net/vtstar/zhongtong/avi/monitoring/domain/WorkRoom.java
0 → 100644
View file @
ba769016
package
net
.
vtstar
.
zhongtong
.
avi
.
monitoring
.
domain
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState
;
import
javax.persistence.Column
;
import
javax.persistence.Table
;
import
java.math.BigDecimal
;
@Data
@Table
(
name
=
"work_room"
)
public
class
WorkRoom
{
@Column
(
name
=
"id"
)
private
Long
id
;
@Column
(
name
=
"name"
)
private
String
name
;
@Column
(
name
=
"code"
)
private
String
code
;
@Column
(
name
=
"led_no"
)
private
String
ledNo
;
@Column
(
name
=
"area_no"
)
private
String
areaNo
;
@ApiModelProperty
(
value
=
"状态"
)
private
StationState
stationState
;
@ApiModelProperty
(
value
=
"作业时间"
)
private
BigDecimal
workingHours
;
}
src/main/java/net/vtstar/zhongtong/avi/monitoring/job/AVIMonitorJob.java
View file @
ba769016
package
net
.
vtstar
.
zhongtong
.
avi
.
monitoring
.
job
;
import
lombok.extern.slf4j.Slf4j
;
import
net.vtstar.protocol.modbus.tcp.netty.packet.AbstractModbusResponse
;
import
net.vtstar.protocol.modbus.tcp.netty.packet.ModbusResponse
;
import
net.vtstar.protocol.modbus.tcp.netty.service.ModbusTemplate
;
import
net.vtstar.protocol.modbus.tcp.netty.utils.NettyUtils
;
import
net.vtstar.protocol.modbus.tcp.netty.utils.PoolKey
;
import
net.vtstar.scada.base.equipmgt.domain.*
;
...
...
@@ -11,7 +12,6 @@ import net.vtstar.scada.base.global.service.ModbusService;
import
net.vtstar.zhongtong.avi.equipment.domain.PaintshopStation
;
import
net.vtstar.zhongtong.avi.equipment.mapper.PaintshopStationMapper
;
import
net.vtstar.zhongtong.avi.global.constant.Constant
;
import
net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -23,6 +23,7 @@ import org.springframework.util.CollectionUtils;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Component
...
...
@@ -45,6 +46,8 @@ public class AVIMonitorJob extends GatherJob {
@Resource
(
name
=
"redisTemplate"
)
private
ValueOperations
valueOperations
;
@Autowired
private
ModbusTemplate
template
;
@Override
protected
void
executeInternal
(
JobExecutionContext
context
)
throws
JobExecutionException
{
...
...
@@ -85,9 +88,40 @@ public class AVIMonitorJob extends GatherJob {
continue
;
}
List
<
List
<
EquipDataTemplateItem
>>
lists
=
modbusService
.
groupByAddress
(
templateItemList
);
Map
<
Integer
,
List
<
EquipDataTemplateItem
>>
listMap
=
modbusService
.
groupByFuntionCode
(
templateItemList
);
for
(
Map
.
Entry
<
Integer
,
List
<
EquipDataTemplateItem
>>
entry
:
listMap
.
entrySet
())
{
List
<
EquipDataTemplateItem
>
value
=
entry
.
getValue
();
if
(
CollectionUtils
.
isEmpty
(
value
))
{
continue
;
}
Integer
start
=
value
.
get
(
0
).
getAddress
();
Integer
end
=
value
.
get
(
value
.
size
()
-
1
).
getAddress
();
Integer
size
=
value
.
get
(
value
.
size
()
-
1
).
getLength
();
Integer
quantity
=
end
+
size
-
start
;
ModbusResponse
response
=
null
;
Integer
functionCode
=
entry
.
getKey
();
try
{
if
(
1
==
functionCode
)
{
response
=
modbusService
.
readCoilRegister
(
slaveId
,
poolKey
,
start
,
quantity
);
}
else
if
(
2
==
functionCode
)
{
response
=
modbusService
.
readInputDiscretes
(
slaveId
,
poolKey
,
start
,
quantity
);
}
else
if
(
3
==
functionCode
)
{
response
=
modbusService
.
readMultipleRegister
(
slaveId
,
poolKey
,
start
,
quantity
);
}
else
if
(
4
==
functionCode
)
{
response
=
modbusService
.
readInputRegister
(
slaveId
,
poolKey
,
start
,
quantity
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"读取失败。ip{}, 端口{}, slave{}, start{}, size{}"
,
poolKey
.
getHost
(),
poolKey
.
getPort
(),
slaveId
,
start
,
quantity
);
continue
;
}
// response.getBody().re
}
for
(
List
<
EquipDataTemplateItem
>
itemList
:
lists
)
{
Constant
.
totalSize
++;
Constant
.
totalSize
++;
total
=
total
+
1
;
EquipDataTemplateItem
startTemplate
=
itemList
.
get
(
0
);
...
...
@@ -95,7 +129,7 @@ public class AVIMonitorJob extends GatherJob {
Integer
endAddress
=
itemList
.
get
(
itemList
.
size
()
-
1
).
getAddress
();
Integer
quantity
=
itemList
.
get
(
itemList
.
size
()
-
1
).
getLength
();
Integer
count
=
endAddress
+
quantity
-
startAddress
;
Abstract
ModbusResponse
response
=
null
;
ModbusResponse
response
=
null
;
long
start
=
System
.
currentTimeMillis
();
...
...
@@ -127,7 +161,7 @@ public class AVIMonitorJob extends GatherJob {
errorTotal
++;
String
error1
=
response
.
getError
();
if
(
error1
.
contains
(
"秒内与对端连接"
))
{
Constant
.
totalTimeOut
++
;
Constant
.
totalTimeOut
++
;
timeout
++;
log
.
error
(
"超时次数!:"
+
timeout
);
}
...
...
@@ -156,8 +190,7 @@ public class AVIMonitorJob extends GatherJob {
station
.
setOldState
(
station
.
getState
());
station
.
setArrive
(
state
==
1
?
true
:
false
);
valueOperations
.
set
(
Constant
.
STATION_PREFIX
+
stationCode
,
station
);
}
if
(
fieldName
.
startsWith
(
"station:turn"
))
{
}
else
if
(
fieldName
.
startsWith
(
"station:turn"
))
{
String
[]
split
=
fieldName
.
split
(
":"
);
String
stationCode
=
fieldName
.
split
(
":"
)[
2
];
...
...
@@ -180,22 +213,33 @@ public class AVIMonitorJob extends GatherJob {
station
.
setTurnR
(
state
==
1
?
true
:
false
);
}
valueOperations
.
set
(
Constant
.
STATION_PREFIX
+
stationCode
,
station
);
}
else
if
(
fieldName
.
startsWith
(
"warning"
))
{
String
[]
split
=
fieldName
.
split
(
":"
);
String
areaNo
=
split
[
1
];
String
warningCode
=
split
[
2
];
byte
state
=
response
.
getBody
().
readByte
();
valueOperations
.
set
(
Constant
.
WARNING_PREFIX
+
areaNo
+
":"
+
warningCode
,
state
);
}
else
if
(
fieldName
.
startsWith
(
"room"
))
{
String
[]
split
=
fieldName
.
split
(
":"
);
String
roomCode
=
split
[
1
];
byte
state
=
response
.
getBody
().
readByte
();
valueOperations
.
set
(
Constant
.
ROOM_PREFIX
+
roomCode
,
state
);
}
}
}
}
}
;
log
.
debug
(
"_________________________________________________"
);
log
.
debug
(
"_________________________________________________"
);
log
.
debug
(
"total"
+
total
);
log
.
debug
(
"error"
+
error
);
log
.
debug
(
"timeout"
+
timeout
);
long
l1
=
System
.
currentTimeMillis
();
log
.
debug
(
"time:"
+
(
l1
-
l
)
/
1000
)
;
log
.
debug
(
"time:"
+
(
l1
-
l
)
/
1000
);
log
.
error
(
"Constant size"
+
Constant
.
totalSize
);
log
.
error
(
"Constant timeout"
+
Constant
.
totalTimeOut
);
log
.
error
(
"Constant timeout"
+
Constant
.
totalTimeOut
);
}
}
src/main/java/net/vtstar/zhongtong/avi/monitoring/mapper/WarningMapper.java
0 → 100644
View file @
ba769016
package
net
.
vtstar
.
zhongtong
.
avi
.
monitoring
.
mapper
;
import
net.vtstar.user.mybatis.BaseMapper
;
import
net.vtstar.zhongtong.avi.monitoring.domain.Warning
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
WarningMapper
extends
BaseMapper
<
Warning
>
{
}
src/main/java/net/vtstar/zhongtong/avi/monitoring/mapper/WorkRoomMapper.java
0 → 100644
View file @
ba769016
package
net
.
vtstar
.
zhongtong
.
avi
.
monitoring
.
mapper
;
import
net.vtstar.user.mybatis.BaseMapper
;
import
net.vtstar.zhongtong.avi.monitoring.domain.WorkRoom
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
WorkRoomMapper
extends
BaseMapper
<
WorkRoom
>
{
}
src/main/java/net/vtstar/zhongtong/avi/monitoring/runner/Read
Station
ToCacheRunner.java
→
src/main/java/net/vtstar/zhongtong/avi/monitoring/runner/Read
Data
ToCacheRunner.java
View file @
ba769016
...
...
@@ -12,10 +12,14 @@ import net.vtstar.zhongtong.avi.equipment.mapper.PaintshopStationMapper;
import
net.vtstar.zhongtong.avi.global.constant.Constant
;
import
net.vtstar.zhongtong.avi.monitoring.domain.Skid
;
import
net.vtstar.zhongtong.avi.monitoring.domain.Vehicle
;
import
net.vtstar.zhongtong.avi.monitoring.domain.Warning
;
import
net.vtstar.zhongtong.avi.monitoring.domain.WorkRoom
;
import
net.vtstar.zhongtong.avi.monitoring.domain.enums.ProductionType
;
import
net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState
;
import
net.vtstar.zhongtong.avi.monitoring.mapper.SkidMapper
;
import
net.vtstar.zhongtong.avi.monitoring.mapper.VehicleMapper
;
import
net.vtstar.zhongtong.avi.monitoring.mapper.WarningMapper
;
import
net.vtstar.zhongtong.avi.monitoring.mapper.WorkRoomMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.cache.Cache
;
...
...
@@ -32,7 +36,7 @@ import java.util.stream.Collectors;
@Slf4j
@Order
(
value
=
1
)
@Component
public
class
Read
Station
ToCacheRunner
implements
CommandLineRunner
{
public
class
Read
Data
ToCacheRunner
implements
CommandLineRunner
{
@Resource
(
name
=
"stationCache"
)
private
Cache
stationCache
;
...
...
@@ -42,6 +46,10 @@ public class ReadStationToCacheRunner implements CommandLineRunner {
private
Cache
laneStationCache
;
@Resource
(
name
=
"webStationCache"
)
private
Cache
webStationCache
;
@Resource
(
name
=
"warningCache"
)
private
Cache
warningCache
;
@Resource
(
name
=
"roomCache"
)
private
Cache
roomCache
;
@Resource
(
name
=
"redisTemplate"
)
protected
HashOperations
hashOperations
;
...
...
@@ -57,16 +65,30 @@ public class ReadStationToCacheRunner implements CommandLineRunner {
private
SkidMapper
skidMapper
;
@Autowired
private
PaintshopAreaMapper
areaMapper
;
@Autowired
private
WarningMapper
warningMapper
;
@Autowired
private
WorkRoomMapper
workRoomMapper
;
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
// PaintshopStation paintshopStation = (PaintshopStation) valueOperations.get(Constant.STATION_PREFIX + "HDG1-13");
// Skid skid = new Skid();
// skid.setBusNo("eeee");
// skid.setBusType(ProductionType.OWN);
// paintshopStation.setState(StationState.USE);
// paintshopStation.setSkid(skid);
// valueOperations.set("station:HDG1-13",paintshopStation);
List
<
Warning
>
warnings
=
warningMapper
.
findList
(
new
WhereFilter
()
{
{
addOrderBy
(
"warning"
,
"id"
,
OrderBy
.
ASC
);
}
},
Warning
.
class
);
for
(
Warning
warning
:
warnings
)
{
warningCache
.
put
(
warning
.
getCode
(),
warning
);
}
List
<
WorkRoom
>
rooms
=
workRoomMapper
.
findList
(
new
WhereFilter
(),
WorkRoom
.
class
);
Map
<
String
,
List
<
WorkRoom
>>
listMap
=
rooms
.
stream
().
collect
(
Collectors
.
groupingBy
(
WorkRoom:
:
getLedNo
));
for
(
Map
.
Entry
<
String
,
List
<
WorkRoom
>>
entry
:
listMap
.
entrySet
())
{
roomCache
.
put
(
Constant
.
LED_PREFIX
+
entry
.
getKey
(),
entry
.
getValue
());
}
List
<
PaintshopStation
>
stations
=
stationMapper
.
findList
(
new
WhereFilter
()
{{
addJoin
(
PaintshopStation
.
class
,
"area_id"
,
PaintshopArea
.
class
,
"id"
);
...
...
@@ -74,8 +96,11 @@ public class ReadStationToCacheRunner implements CommandLineRunner {
addOrderBy
(
PaintshopStation
.
class
,
"id"
,
OrderBy
.
ASC
);
}},
PaintshopStation
.
class
);
for
(
PaintshopStation
station
:
stations
)
{
stationCache
.
put
(
station
.
getCode
(),
station
);
for
(
PaintshopStation
station
:
stations
)
{
stationCache
.
put
(
station
.
getCode
(),
station
);
// station.setTurnF(false);
// station.setTurnR(false);
// station.setArrive(false);
...
...
@@ -84,17 +109,24 @@ public class ReadStationToCacheRunner implements CommandLineRunner {
// station.setState(StationState.USE);
// valueOperations.set(Constant.STATION_PREFIX + station.getCode() ,station);
}
Map
<
String
,
List
<
PaintshopStation
>>
stationMap
=
stations
.
stream
().
filter
(
sta
->
sta
.
getLaneCode
()
!=
null
).
collect
(
Collectors
.
groupingBy
(
PaintshopStation:
:
getLaneCode
));
for
(
Map
.
Entry
<
String
,
List
<
PaintshopStation
>>
entry
:
stationMap
.
entrySet
())
{
laneStationCache
.
put
(
entry
.
getKey
(),
entry
.
getValue
());
for
(
Map
.
Entry
<
String
,
List
<
PaintshopStation
>>
entry
:
stationMap
.
entrySet
())
{
laneStationCache
.
put
(
entry
.
getKey
(),
entry
.
getValue
());
}
List
<
Vehicle
>
vehicles
=
vehicleMapper
.
findList
(
new
WhereFilter
(),
Vehicle
.
class
);
for
(
Vehicle
vehicle
:
vehicles
)
{
vehicleCache
.
put
(
vehicle
.
getMqttPrefix
(),
vehicle
);
for
(
Vehicle
vehicle
:
vehicles
)
{
vehicleCache
.
put
(
vehicle
.
getMqttPrefix
(),
vehicle
);
}
//
//
// Map<String, Skid> skidMap = hashOperations.entries("skid");
// if (null == skidMap) {
// List<Skid> skids = skidMapper.findList(null, Skid.class);
...
...
@@ -106,6 +138,13 @@ public class ReadStationToCacheRunner implements CommandLineRunner {
// stationCache.put(station.getCode(), station);
// }
List
<
PaintshopArea
>
list
=
areaMapper
.
findList
(
new
WhereFilter
(),
PaintshopArea
.
class
);
webStationCache
.
put
(
"stationList"
,
list
);
webStationCache
.
put
(
"stationList"
,
list
);
for
(
PaintshopArea
area
:
list
)
{
stationCache
.
put
(
Constant
.
AREA_PREFIX
+
area
.
getCode
(),
area
);
}
}
}
src/main/java/net/vtstar/zhongtong/avi/monitoring/service/AreaService.java
View file @
ba769016
...
...
@@ -105,9 +105,6 @@ public class AreaService {
}
public
List
<
CarStatisticsVO
>
getBusSta
()
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy:MM:dd"
);
Calendar
instance
=
Calendar
.
getInstance
();
String
format
=
dateFormat
.
format
(
instance
.
getTime
());
List
<
CarStatisticsVO
>
sta
=
webStationCache
.
get
(
"busSta"
,
ArrayList
.
class
);
return
sta
;
...
...
src/main/resources/config/application-quartz.properties
View file @
ba769016
...
...
@@ -229,11 +229,11 @@ quartz.job.taskInfos[26].start=false
#mavi 刷新工位信息
quartz.job.taskInfos[2
7
]
.jobName
=
net.vtstar.zhongtong.avi.monitoring.job.RedisToCacheJob
quartz.job.taskInfos[2
7
]
.jobGroup
=
RedisToCacheJob
quartz.job.taskInfos[2
7
]
.jobDescription
=
\u0041\u0056\u0049\u
5de5
\u
4f4d
\u
4fe1
\u
606f
\u
540c
\u
6b65Job
quartz.job.taskInfos[2
7]
.cronExpression
=
0/15
* * * * ?
quartz.job.taskInfos[2
7
]
.start
=
true
quartz.job.taskInfos[2
9
]
.jobName
=
net.vtstar.zhongtong.avi.monitoring.job.RedisToCacheJob
quartz.job.taskInfos[2
9
]
.jobGroup
=
RedisToCacheJob
quartz.job.taskInfos[2
9
]
.jobDescription
=
\u0041\u0056\u0049\u
5de5
\u
4f4d
\u
4fe1
\u
606f
\u
540c
\u
6b65Job
quartz.job.taskInfos[2
9]
.cronExpression
=
0/10
* * * * ?
quartz.job.taskInfos[2
9
]
.start
=
true
#quartz.job.taskInfos[8].jobName=net.vtstar.scada.base.equipmgt.job.CleanEquipStatusJob
##quartz.job.taskInfos[8].jobGroup=CleanEquipStatusJob
...
...
src/main/resources/config/application.properties
View file @
ba769016
...
...
@@ -9,7 +9,7 @@ spring.aop.auto=true
spring.main.allow-bean-definition-overriding
=
true
# server
server.port
=
808
2
server.port
=
808
5
spring.servlet.multipart.max-file-size
=
1000MB
spring.servlet.multipart.max-request-size
=
2000MB
spring.servlet.multipart.enabled
=
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment