Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 40ff0fc6
由
zshaohui
编写于
2023-07-21 15:32:07 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.neoteapi修改
2.mimo电子看板
1 个父辈
afbbc4b7
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
487 行增加
和
3 行删除
src/main/java/com/neotel/smfcore/common/init/MenuInit.java
src/main/java/com/neotel/smfcore/common/utils/SmbUtil.java
src/main/java/com/neotel/smfcore/core/barcode/rest/BarcodeController.java
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
src/main/java/com/neotel/smfcore/custom/neotel/NeotelApi.java
src/main/java/com/neotel/smfcore/mimo/controller/SmdBoxMimoController.java
src/main/resources/config/application.yml
src/main/java/com/neotel/smfcore/common/init/MenuInit.java
查看文件 @
40ff0fc
...
...
@@ -115,7 +115,7 @@ public class MenuInit {
//设备看板
addDefaultFunctionMenu
(
1
,
null
,
"设备看板"
,
"lockMaterial"
,
"lockMaterial/material/index"
,
"kanban"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
1
,
null
,
"电子看板"
,
"eleckanban"
,
"elecKanban/index"
,
"kanban"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
1
,
null
,
"电子看板"
,
"eleckanban"
,
"elecKanban/index"
,
"kanban"
);
//设备互联
addDefaultFunctionMenu
(
2
,
null
,
"设备互联"
,
"equipmentView"
,
"neolight/equipmentView/index"
,
"sKanban"
);
...
...
@@ -218,6 +218,7 @@ public class MenuInit {
addDefaultFunctionMenu
(
99991
,
helpAbout
,
"说明书"
,
"instruction"
,
"system/instruction/index"
,
"aboutBook"
);
addDefaultFunctionMenu
(
99992
,
helpAbout
,
"关于"
,
"about"
,
"system/about/index"
,
"message"
,
DEFAULT_SHOW_MENU
);
addDefaultFunctionMenu
(
123
,
null
,
"LNB残数"
,
"LNBResidue"
,
"neolight/lnbResidue/index"
,
"kanban"
);
return
allMenuMap
;
}
...
...
src/main/java/com/neotel/smfcore/common/utils/SmbUtil.java
查看文件 @
40ff0fc
...
...
@@ -123,4 +123,45 @@ public class SmbUtil {
}
return
false
;
}
/**
* @Title smbGet
* @Param shareUrl 共享目录中的文件路径,如smb://132.20.2.33/CIMPublicTest/eg.txt
* @Param localDirectory 本地目录,如tempStore/smb
*/
public
static
boolean
smbGetByAuth
(
String
smbFile
,
NtlmPasswordAuthentication
auth
,
String
localDirectory
){
InputStream
in
=
null
;
OutputStream
out
=
null
;
try
{
Config
.
registerSmbURLHandler
();
SmbFile
remoteFile
=
new
SmbFile
(
smbFile
,
auth
);
if
(!
remoteFile
.
exists
())
{
log
.
info
(
"共享文件不存在"
);
return
false
;
}
// 有文件的时候再初始化输入输出流
log
.
info
(
"下载共享目录的文件 "
+
smbFile
+
" 到 "
+
localDirectory
);
String
fileName
=
remoteFile
.
getName
();
File
localFile
=
new
File
(
localDirectory
+
File
.
separator
+
fileName
);
File
fileParent
=
localFile
.
getParentFile
();
if
(
null
!=
fileParent
&&
!
fileParent
.
exists
())
{
fileParent
.
mkdirs
();
}
in
=
new
BufferedInputStream
(
new
SmbFileInputStream
(
remoteFile
));
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
localFile
));
byte
[]
buffer
=
new
byte
[
1024
];
while
(
in
.
read
(
buffer
)
!=
-
1
)
{
out
.
write
(
buffer
);
buffer
=
new
byte
[
1024
];
}
out
.
flush
();
//刷新缓冲区输出流
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
"获取 SMB 文件出错"
,
e
);
}
finally
{
close
(
in
,
out
);
}
return
false
;
}
}
src/main/java/com/neotel/smfcore/core/barcode/rest/BarcodeController.java
查看文件 @
40ff0fc
...
...
@@ -7,6 +7,7 @@ import com.neotel.smfcore.common.csv.CsvReader;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.core.barcode.bean.BarcodeRule
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeRuleDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.mapstruct.BarcodeMapper
;
...
...
@@ -179,6 +180,15 @@ public class BarcodeController {
return
ResultBean
.
newOkResult
(
resultMsg
);
}
@ApiOperation
(
"根据条码信息获取条码规则"
)
@PostMapping
(
value
=
"getBarcodeRule"
)
public
ResultBean
getBarcodeRule
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
ruleStr
=
BarcodeRule
.
toCodeRule
(
paramMap
.
get
(
"codeStr"
),
paramMap
);
return
ResultBean
.
newOkResult
(
ruleStr
);
}
protected
String
handleBarcode
(
String
fileURL
)
throws
Exception
{
log
.
info
(
"开始读取文件:"
+
fileURL
);
CsvReader
csvRead
=
CsvReader
.
newReader
(
fileURL
,
"条码"
,
"RI"
);
...
...
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
查看文件 @
40ff0fc
...
...
@@ -8,6 +8,7 @@ import com.google.common.collect.Lists;
import
com.google.common.collect.Maps
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.core.barcode.service.manager.IComponentManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Component
;
...
...
@@ -35,6 +36,7 @@ import com.neotel.smfcore.core.storage.service.po.Storage;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.query.Criteria
;
...
...
@@ -44,6 +46,7 @@ import org.springframework.stereotype.Repository;
import
javax.annotation.PostConstruct
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.regex.Pattern
;
/**
* 缓存
...
...
@@ -942,4 +945,15 @@ public class DataCache {
return
inOutData
;
}
public
List
getCacheList
(
String
keyStr
)
{
List
<
Object
>
list
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
cacheMap
.
entrySet
())
{
String
key
=
entry
.
getKey
();
Object
value
=
entry
.
getValue
();
if
(
key
.
startsWith
(
keyStr
))
{
list
.
add
(
value
);
}
}
return
list
;
}
}
src/main/java/com/neotel/smfcore/custom/neotel/NeotelApi.java
查看文件 @
40ff0fc
...
...
@@ -292,7 +292,7 @@ public class NeotelApi extends BaseSmfApiListener {
log
.
error
(
"日期转换出错"
,
e
);
}
barcode
=
barcodeManager
.
save
Barcode
(
barcode
);
barcode
=
barcodeManager
.
save
(
barcode
);
return
barcode
;
}
else
{
return
null
;
...
...
src/main/java/com/neotel/smfcore/mimo/controller/SmdBoxMimoController.java
0 → 100644
查看文件 @
40ff0fc
package
com
.
neotel
.
smfcore
.
mimo
.
controller
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.neotel.smfcore.common.bean.BetweenData
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.elecKanban.bean.dto.ElecKanbanBoxStatusDto
;
import
com.neotel.smfcore.core.elecKanban.bean.dto.InOutDataDto
;
import
com.neotel.smfcore.core.inout.service.manager.IInOutDataManager
;
import
com.neotel.smfcore.core.inout.service.po.InOutData
;
import
com.neotel.smfcore.core.kanban.rest.bean.dto.BoxStatusDto
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.message.rest.bean.dto.MessageDto
;
import
com.neotel.smfcore.core.message.rest.bean.mapstruct.MessageMapper
;
import
com.neotel.smfcore.core.message.rest.bean.query.MessageCriteria
;
import
com.neotel.smfcore.core.message.service.manager.IMessageManager
;
import
com.neotel.smfcore.core.message.service.po.Message
;
import
com.neotel.smfcore.core.msd.bean.MSDSettiings
;
import
com.neotel.smfcore.core.report.rest.dto.InventoryBoxDto
;
import
com.neotel.smfcore.core.report.rest.dto.InventoryGroupDto
;
import
com.neotel.smfcore.core.report.rest.query.ReportExtQuery
;
import
com.neotel.smfcore.core.storage.bean.UsageItem
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.service.manager.IGroupManager
;
import
com.neotel.smfcore.security.service.po.Group
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@RestController
@RequestMapping
(
"/smdBoxMimo"
)
public
class
SmdBoxMimoController
{
@Autowired
private
IGroupManager
groupManager
;
@Autowired
DataCache
dataCache
;
@Autowired
IInOutDataManager
inOutDataManager
;
@Autowired
IMessageManager
messageManager
;
@Autowired
MessageMapper
messageMapper
;
@Autowired
TaskService
taskService
;
public
static
Storage
storage
=
null
;
@ApiOperation
(
"库存分布"
)
@GetMapping
(
value
=
"/inventory"
)
@AnonymousAccess
public
List
<
InventoryGroupDto
>
inventory
(
String
cid
)
{
if
(
StringUtils
.
isBlank
(
cid
))
{
Storage
storage
=
getDefaultBox
();
if
(
storage
!=
null
)
{
cid
=
storage
.
getCid
();
}
}
List
<
InventoryGroupDto
>
groupDtos
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
cid
))
{
List
<
Group
>
allGroup
=
groupManager
.
findAll
();
allGroup
.
add
(
Group
.
defaulGroup
());
for
(
Group
group
:
allGroup
)
{
List
<
InventoryBoxDto
>
boxDtos
=
new
ArrayList
<>();
List
<
String
>
cidList
=
dataCache
.
getCidsByGroupId
(
group
.
getId
(),
false
);
for
(
String
cidStr
:
cidList
)
{
if
(!
cid
.
equals
(
cidStr
)){
continue
;
}
Storage
storage
=
dataCache
.
getStorage
(
cidStr
);
if
(
storage
==
null
)
{
continue
;
}
int
posCount
=
0
;
int
usePosCount
=
0
;
for
(
UsageItem
item
:
storage
.
getUsageMap
().
values
())
{
posCount
+=
item
.
getTotalCount
();
usePosCount
+=
item
.
getUsedCount
();
}
InventoryBoxDto
boxDto
=
new
InventoryBoxDto
(
storage
.
getId
(),
storage
.
getName
(),
storage
.
getCid
(),
storage
.
getType
(),
storage
.
getUsageMap
(),
posCount
,
usePosCount
);
boxDtos
.
add
(
boxDto
);
}
if
(
boxDtos
.
size
()
>
0
)
{
InventoryGroupDto
groupDto
=
new
InventoryGroupDto
(
group
.
getId
(),
group
.
getGroupName
(),
boxDtos
);
groupDtos
.
add
(
groupDto
);
}
}
}
return
groupDtos
;
}
@ApiOperation
(
"出入库统计"
)
@RequestMapping
(
"/getInOutData"
)
@AnonymousAccess
public
InOutDataDto
getInOutData
(
ReportExtQuery
query
)
{
InOutDataDto
dto
=
new
InOutDataDto
();
List
<
String
>
dateStrList
=
new
ArrayList
<>();
List
<
Integer
>
inDataList
=
new
ArrayList
<>();
List
<
Integer
>
outDataList
=
new
ArrayList
<>();
if
(
query
.
getStorageIdList
()
==
null
||
query
.
getStorageIdList
().
isEmpty
()){
Storage
storage
=
getDefaultBox
();
if
(
storage
!=
null
)
{
query
.
setStorageIdList
(
Arrays
.
asList
(
storage
.
getId
()));
}
}
if
(
query
.
getStorageIdList
()
!=
null
&&
!
query
.
getStorageIdList
().
isEmpty
())
{
//开始时间与结束时间赋值
String
currentDateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH"
);
Date
startDate
=
DateUtil
.
parse
(
currentDateStr
,
"yyyy-MM-dd HH"
);
Date
endDate
=
DateUtil
.
parse
(
currentDateStr
,
"yyyy-MM-dd HH"
);
BetweenData
<
Date
>
updateDate
=
query
.
getUpdateDate
();
if
(
updateDate
!=
null
&&
updateDate
.
size
()
>
0
)
{
Date
from
=
updateDate
.
getFrom
();
Date
to
=
updateDate
.
getTo
();
if
(
from
!=
null
)
{
startDate
=
from
;
}
if
(
to
!=
null
)
{
endDate
=
to
;
}
}
else
{
endDate
=
DateUtil
.
parse
(
currentDateStr
,
"yyyy-MM-dd"
);
endDate
=
DateUtil
.
offsetDay
(
endDate
,
1
);
startDate
=
DateUtil
.
offsetDay
(
endDate
,
-
7
);
}
//增加用户所属分组id
List
<
String
>
storageIdList
=
QueryHelp
.
getGroupStorageIdList
(
query
.
getStorageIdList
());
//判断相差小时数,是否超过48小时
long
between
=
DateUtil
.
between
(
startDate
,
endDate
,
DateUnit
.
HOUR
);
List
<
InOutData
>
inOutDataList
=
inOutDataManager
.
findByDate
(
startDate
,
endDate
,
storageIdList
);
while
(
startDate
.
getTime
()
<
endDate
.
getTime
())
{
DateTime
nextDayTime
;
if
(
between
>
48
)
{
dateStrList
.
add
(
DateUtil
.
format
(
startDate
,
"MM/dd"
));
nextDayTime
=
DateUtil
.
offsetDay
(
startDate
,
1
);
}
else
{
dateStrList
.
add
(
DateUtil
.
format
(
startDate
,
"MM/dd HH"
));
nextDayTime
=
DateUtil
.
offsetHour
(
startDate
,
1
);
}
int
inCount
=
0
,
outCount
=
0
;
for
(
InOutData
inOutData
:
inOutDataList
)
{
if
(
inOutData
.
getCreateDate
().
getTime
()
>=
startDate
.
getTime
()
&&
inOutData
.
getCreateDate
().
getTime
()
<
nextDayTime
.
getTime
())
{
inCount
=
inCount
+
inOutData
.
getInCount
();
outCount
=
outCount
+
inOutData
.
getOutCount
();
}
}
inDataList
.
add
(
inCount
);
outDataList
.
add
(
outCount
);
if
(
between
>
48
)
{
startDate
=
DateUtil
.
offsetDay
(
startDate
,
1
);
}
else
{
startDate
=
DateUtil
.
offsetHour
(
startDate
,
1
);
}
}
}
dto
.
setDateStrList
(
dateStrList
);
dto
.
setInDataList
(
inDataList
);
dto
.
setOutDataList
(
outDataList
);
return
dto
;
}
@ApiOperation
(
"设备状态"
)
@RequestMapping
(
"/getBoxStatusDto"
)
@AnonymousAccess
public
List
<
ElecKanbanBoxStatusDto
>
getElecKanbanBoxStatusDto
(
String
cid
)
throws
ParseException
{
List
<
ElecKanbanBoxStatusDto
>
resultList
=
new
ArrayList
<>();
if
(
StringUtils
.
isBlank
(
cid
))
{
Storage
storage
=
getDefaultBox
();
if
(
storage
!=
null
)
{
cid
=
storage
.
getCid
();
}
}
if
(
StringUtils
.
isNotBlank
(
cid
))
{
Date
currentDate
=
com
.
neotel
.
smfcore
.
common
.
utils
.
DateUtil
.
getCurrentDate
(
"yyyy-MM-dd"
);
List
<
InOutData
>
inOutDataList
=
inOutDataManager
.
findByDate
(
currentDate
,
com
.
neotel
.
smfcore
.
common
.
utils
.
DateUtil
.
addDays
(
currentDate
,
1
),
null
);
ElecKanbanBoxStatusDto
dto
=
new
ElecKanbanBoxStatusDto
();
StatusBean
statusBean
=
DevicesStatusUtil
.
getStatusBean
(
cid
);
if
(
statusBean
!=
null
)
{
dto
.
setStatus
(
statusBean
.
getStatus
());
Collection
<
BoxStatusBean
>
boxStatusBeans
=
statusBean
.
getBoxStatus
().
values
();
if
(
boxStatusBeans
!=
null
&&
!
boxStatusBeans
.
isEmpty
())
{
for
(
BoxStatusBean
boxStatusBean
:
boxStatusBeans
)
{
dto
.
setHumidity
(
boxStatusBean
.
getHumidity
());
dto
.
setTemperature
(
boxStatusBean
.
getTemperature
());
}
}
}
Storage
storage
=
dataCache
.
getStorage
(
cid
);
if
(
storage
.
isNLShelf
()
||
storage
.
isNLPShelf
()
||
storage
.
isNLMShelf
()
||
storage
.
isShelf
())
{
dto
.
setType
(
0
);
}
else
{
dto
.
setType
(
1
);
}
int
usage
=
(
storage
.
getTotalSlots
()
-
storage
.
getEmptySlots
())
*
100
/
storage
.
getTotalSlots
();
dto
.
setUsage
(
usage
);
int
inCount
=
getTodayInOutCount
(
storage
.
getId
(),
inOutDataList
,
true
);
int
outCount
=
getTodayInOutCount
(
storage
.
getId
(),
inOutDataList
,
false
);
dto
.
setTodayInCount
(
inCount
);
dto
.
setTodayOutCount
(
outCount
);
dto
.
setName
(
storage
.
getName
());
resultList
.
add
(
dto
);
}
return
resultList
;
}
@ApiOperation
(
"查询消息列表"
)
@GetMapping
(
"/getMessage"
)
@AnonymousAccess
public
PageData
<
MessageDto
>
getMessage
(
MessageCriteria
criteria
,
Pageable
pageable
,
HttpServletRequest
request
)
{
if
(
StringUtils
.
isBlank
(
criteria
.
getDeviceName
()))
{
Storage
defaultBox
=
getDefaultBox
();
if
(
defaultBox
!=
null
)
{
criteria
.
setDeviceName
(
defaultBox
.
getName
());
}
}
if
(
StringUtils
.
isNotBlank
(
criteria
.
getDeviceName
()))
{
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
PageData
<
Message
>
messagePageData
=
messageManager
.
findByPage
(
query
,
pageable
);
List
<
MessageDto
>
dtos
=
messageMapper
.
toDto
(
messagePageData
.
getContent
());
for
(
int
i
=
0
;
i
<
dtos
.
size
();
i
++)
{
if
(
ObjectUtil
.
isNotEmpty
(
dtos
.
get
(
i
).
getMsgCode
()))
{
dtos
.
get
(
i
).
setMsg
(
MessageUtils
.
getText
(
dtos
.
get
(
i
).
getMsgCode
(),
dtos
.
get
(
i
).
getMsgParams
(),
request
.
getLocale
(),
dtos
.
get
(
i
).
getMsg
()));
}
}
return
new
PageData
(
dtos
,
messagePageData
.
getTotalElements
());
}
return
new
PageData
<>(
new
ArrayList
<>(),
0
);
}
@ApiOperation
(
"料仓详情"
)
@GetMapping
(
"/boxView"
)
@AnonymousAccess
public
BoxStatusDto
boxView
(
String
id
,
HttpServletRequest
servletRequest
)
{
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
Storage
storage
=
dataCache
.
getStorageById
(
id
);
if
(
storage
==
null
){
storage
=
getDefaultBox
();
}
if
(
storage
==
null
)
{
throw
new
ValidateException
(
"smfcore.storage.error.notExist"
,
"未找到料仓{0}"
,
new
String
[]{
id
});
}
BoxStatusDto
dto
=
getBoxDto
(
storage
,
allTasks
,
servletRequest
.
getLocale
());
return
dto
;
}
/*@ApiOperation("删除消息列表")
@GetMapping("/deleteMessage")
@AnonymousAccess
public ResultBean deleteMessage(String id){
Message message = new Message();
message.setId(id);
messageManager.delete(message);
return ResultBean.newOkResult("");
}*/
private
Storage
getDefaultBox
()
{
if
(
storage
!=
null
)
{
return
storage
;
}
for
(
Storage
stor
:
dataCache
.
getAllStorage
().
values
())
{
storage
=
stor
;
return
storage
;
}
return
null
;
}
private
int
getTodayInOutCount
(
String
storageId
,
List
<
InOutData
>
inOutDataList
,
boolean
isInCount
)
{
if
(
inOutDataList
==
null
||
inOutDataList
.
isEmpty
()){
return
0
;
}
if
(
isInCount
){
return
inOutDataList
.
stream
().
filter
(
inOutData
->
inOutData
.
getStorageId
().
equals
(
storageId
)).
collect
(
Collectors
.
summingInt
(
InOutData
::
getInCount
)).
intValue
();
}
else
{
return
inOutDataList
.
stream
().
filter
(
inOutData
->
inOutData
.
getStorageId
().
equals
(
storageId
)).
collect
(
Collectors
.
summingInt
(
InOutData
::
getOutCount
)).
intValue
();
}
}
private
BoxStatusDto
getBoxDto
(
Storage
storage
,
List
<
DataLog
>
allTasks
,
Locale
locale
)
{
int
inTask
=
0
;
int
outTask
=
0
;
for
(
DataLog
data
:
allTasks
)
{
if
(
data
.
getStorageId
().
equals
(
storage
.
getId
()))
{
if
(
data
.
getType
()
==
1
)
{
inTask
++;
}
else
if
(
data
.
getType
()
==
2
)
{
outTask
++;
}
}
}
// if(storage.isSolderPaste()){
// outTask=solderBoxCache.getSpTaskCount(storage.getId());
// }
int
allCount
=
inTask
+
outTask
;
BoxStatusDto
boxDto
=
new
BoxStatusDto
(
storage
.
getId
(),
storage
.
getName
(),
storage
.
getCid
(),
false
,
0
,
"0"
,
"0"
,
"0"
,
""
,
allCount
,
inTask
,
outTask
,
0
,
""
,
""
,
""
,
""
,
""
,
storage
.
getType
(),
storage
.
getUsageMap
(),
new
HashMap
<>(),
storage
.
getInListName
());
//获取设备状态,设置状态和当前任务信息
StatusBean
bean
=
DevicesStatusUtil
.
getStatusBean
(
storage
.
getCid
());
if
(
bean
==
null
||
bean
.
getBoxStatus
()
==
null
)
{
boxDto
.
setOnLine
(
false
);
//如果是虚拟仓,默认在线
if
(
storage
.
isVirtual
()){
boxDto
.
setOnLine
(
true
);
boxDto
.
setStatus
(
1
);
}
}
else
{
if
(
bean
.
timeOut
())
{
boxDto
.
setOnLine
(
false
);
for
(
BoxStatusBean
boxStatus
:
bean
.
getBoxStatus
().
values
())
{
// boxDto.setMsg(bean.getShowMsg(locale));
boxDto
.
setBarcode
(
bean
.
getCode
());
boxDto
.
setPosName
(
bean
.
getPosId
());
break
;
}
}
else
{
boxDto
.
setOnLine
(
true
);
for
(
BoxStatusBean
boxStatus
:
bean
.
getBoxStatus
().
values
())
{
String
humidity
=
boxStatus
.
getHumidity
();
String
temperature
=
boxStatus
.
getTemperature
();
boxDto
.
setHumidity
(
humidity
);
boxDto
.
setTemperature
(
temperature
);
MSDSettiings
settiings
=
dataCache
.
getCache
(
Constants
.
CACHE_msdSetting
);
if
(
settiings
!=
null
)
{
if
(
settiings
.
getMinHumidity
()
==
-
1
f
)
{
boxDto
.
setHumidity
(
0
+
""
);
}
if
(
settiings
.
getMinTemperature
()
==
-
1
f
)
{
boxDto
.
setTemperature
(
0
+
""
);
}
}
boxDto
.
setCodeAirTemp
(
boxStatus
.
getCodeAirTemp
());
boxDto
.
setStatus
(
bean
.
getStatus
());
boxDto
.
setMsg
(
bean
.
getShowMsg
(
locale
));
boxDto
.
setBarcode
(
bean
.
getCode
());
boxDto
.
setPosName
(
bean
.
getPosId
());
boxDto
.
setData
(
bean
.
getData
());
if
(!
StringUtils
.
isEmpty
(
bean
.
getPosId
()))
{
DataLog
task
=
taskService
.
findExecutingTask
(
storage
.
getCid
(),
bean
.
getPosId
());
if
(
task
!=
null
)
{
boxDto
.
setPartNumber
(
task
.
getPartNumber
());
boxDto
.
setSourceName
(
task
.
getSourceName
());
boxDto
.
setCurrTaskType
(
task
.
getType
());
boxDto
.
setCurrTaskStatus
(
task
.
getStatus
());
}
}
break
;
}
}
}
//如果是锡膏料仓,需要把回温区物料数量,冷藏区物料数量显示
if
(
storage
.
isSolderPaste
()){
Integer
warmUseCount
=
dataCache
.
getSpUsePosCount
(
storage
.
getCid
(),
DataCache
.
warmPosUseCount
);
Integer
coldingUseCount
=
dataCache
.
getSpUsePosCount
(
storage
.
getCid
(),
DataCache
.
coldingPosUseCount
);
boxDto
.
getData
().
put
(
DataCache
.
warmPosUseCount
,
warmUseCount
.
toString
());
boxDto
.
getData
().
put
(
DataCache
.
coldingPosUseCount
,
coldingUseCount
.
toString
());
Integer
warmCount
=
dataCache
.
getSpUsePosCount
(
storage
.
getCid
(),
DataCache
.
warmPosCount
);
Integer
coldingCount
=
dataCache
.
getSpUsePosCount
(
storage
.
getCid
(),
DataCache
.
coldingPosCount
);
boxDto
.
getData
().
put
(
DataCache
.
warmPosCount
,
warmCount
.
toString
());
boxDto
.
getData
().
put
(
DataCache
.
coldingPosCount
,
coldingCount
.
toString
());
}
return
boxDto
;
}
}
src/main/resources/config/application.yml
查看文件 @
40ff0fc
...
...
@@ -2,7 +2,7 @@ server:
port
:
8800
api
:
name
:
name
:
neotel
inCheckUrl
:
outNotifyUrl
:
inNotifyUrl
:
...
...
@@ -48,3 +48,7 @@ menu:
show
:
hide
:
smd
:
filePath
:
userName
:
password
:
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论