Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 611e96e8
由
LN
编写于
2025-12-30 14:35:34 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.出入库次数记录。2.records报表增加设备过滤下拉框
1 个父辈
ab9dcf15
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
94 行增加
和
7 行删除
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
src/main/java/com/neotel/smfcore/core/inout/service/manager/IInOutDataManager.java
src/main/java/com/neotel/smfcore/core/inout/service/manager/impl/InOutDataManagerImpl.java
src/main/java/com/neotel/smfcore/core/inout/service/po/InOutData.java
src/main/java/com/neotel/smfcore/core/report/ReportController.java
src/main/java/com/neotel/smfcore/core/report/rest/query/ReportQuery.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/BaseDeviceHandler.java
查看文件 @
611e96e
...
@@ -22,6 +22,8 @@ import com.neotel.smfcore.core.device.enums.OP;
...
@@ -22,6 +22,8 @@ import com.neotel.smfcore.core.device.enums.OP;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.handler.IDeviceHandler
;
import
com.neotel.smfcore.core.device.handler.IDeviceHandler
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.inout.service.manager.IInOutDataManager
;
import
com.neotel.smfcore.core.inout.service.po.InOutData
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.message.util.DeviceMessageUtil
;
import
com.neotel.smfcore.core.message.util.DeviceMessageUtil
;
import
com.neotel.smfcore.core.msd.bean.MSDSettiings
;
import
com.neotel.smfcore.core.msd.bean.MSDSettiings
;
...
@@ -102,6 +104,8 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -102,6 +104,8 @@ public class BaseDeviceHandler implements IDeviceHandler {
protected
IComponentManager
componentManager
;
protected
IComponentManager
componentManager
;
@Autowired
@Autowired
private
SelfAuditUtil
selfAuditUtil
;
private
SelfAuditUtil
selfAuditUtil
;
@Autowired
private
IInOutDataManager
inOutDataManager
;
/**
/**
* CID的服务器消息(key 为 cid)
* CID的服务器消息(key 为 cid)
...
@@ -614,6 +618,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -614,6 +618,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
if
(
executeTime
>
0
)
{
if
(
executeTime
>
0
)
{
task
.
setExecuteTime
(
executeTime
);
task
.
setExecuteTime
(
executeTime
);
updatePosExecuteTime
(
task
.
getPosName
(),
executeTime
);
updatePosExecuteTime
(
task
.
getPosName
(),
executeTime
);
updateInOutDateExecuteTime
(
task
.
getPosName
(),
executeTime
);
}
}
log
.
info
(
task
.
getBarcode
()
+
"入仓位["
+
task
.
getPosName
()
+
"]完成,执行时间["
+
executeTime
+
"]秒"
);
log
.
info
(
task
.
getBarcode
()
+
"入仓位["
+
task
.
getPosName
()
+
"]完成,执行时间["
+
executeTime
+
"]秒"
);
List
<
DataLog
>
taskList
=
taskService
.
findFinishedTaskList
(
cid
,
task
.
getPosName
(),
task
.
getBarcode
(),
true
);
List
<
DataLog
>
taskList
=
taskService
.
findFinishedTaskList
(
cid
,
task
.
getPosName
(),
task
.
getBarcode
(),
true
);
...
@@ -636,6 +641,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -636,6 +641,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
if
(
executeTime
>
0
)
{
if
(
executeTime
>
0
)
{
task
.
setExecuteTime
(
executeTime
);
task
.
setExecuteTime
(
executeTime
);
updatePosExecuteTime
(
task
.
getPosName
(),
executeTime
);
updatePosExecuteTime
(
task
.
getPosName
(),
executeTime
);
updateInOutDateExecuteTime
(
task
.
getPosName
(),
executeTime
);
}
}
log
.
info
(
task
.
getBarcode
()
+
"入仓位["
+
task
.
getPosName
()
+
"]完成,但任务已被取消,修改为完成,执行时间["
+
executeTime
+
"]秒"
);
log
.
info
(
task
.
getBarcode
()
+
"入仓位["
+
task
.
getPosName
()
+
"]完成,但任务已被取消,修改为完成,执行时间["
+
executeTime
+
"]秒"
);
updatePutInData
(
task
);
updatePutInData
(
task
);
...
@@ -675,6 +681,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -675,6 +681,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
if
(
task
!=
null
&&
task
.
isCheckOutTask
())
{
if
(
task
!=
null
&&
task
.
isCheckOutTask
())
{
if
(
executeTime
>
0
)
{
if
(
executeTime
>
0
)
{
task
.
setExecuteTime
(
executeTime
);
task
.
setExecuteTime
(
executeTime
);
updateInOutDateExecuteTime
(
task
.
getPosName
(),
executeTime
);
}
}
log
.
info
(
task
.
getBarcode
()
+
"出仓位["
+
task
.
getPosName
()
+
"]完成,执行时间["
+
executeTime
+
"]秒"
);
log
.
info
(
task
.
getBarcode
()
+
"出仓位["
+
task
.
getPosName
()
+
"]完成,执行时间["
+
executeTime
+
"]秒"
);
DataLog
cancelTask
=
taskService
.
findFinishedOutTask
(
cid
,
task
.
getPosName
(),
task
.
getBarcode
());
DataLog
cancelTask
=
taskService
.
findFinishedOutTask
(
cid
,
task
.
getPosName
(),
task
.
getBarcode
());
...
@@ -692,6 +699,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -692,6 +699,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
if
(
task
.
isCancel
())
{
//被取消的任务,客户端发完成信号过来,修改取消状态为已完成
if
(
task
.
isCancel
())
{
//被取消的任务,客户端发完成信号过来,修改取消状态为已完成
if
(
executeTime
>
0
)
{
if
(
executeTime
>
0
)
{
task
.
setExecuteTime
(
executeTime
);
task
.
setExecuteTime
(
executeTime
);
updateInOutDateExecuteTime
(
task
.
getPosName
(),
executeTime
);
}
}
log
.
info
(
task
.
getBarcode
()
+
"出仓位["
+
task
.
getPosName
()
+
"]完成,但任务已被取消,修改为完成,执行时间["
+
executeTime
+
"]秒"
);
log
.
info
(
task
.
getBarcode
()
+
"出仓位["
+
task
.
getPosName
()
+
"]完成,但任务已被取消,修改为完成,执行时间["
+
executeTime
+
"]秒"
);
updateCheckoutData
(
task
,
outBoxStatus
);
updateCheckoutData
(
task
,
outBoxStatus
);
...
@@ -1067,6 +1075,20 @@ public class BaseDeviceHandler implements IDeviceHandler {
...
@@ -1067,6 +1075,20 @@ public class BaseDeviceHandler implements IDeviceHandler {
return
false
;
return
false
;
}
}
private
void
updateInOutDateExecuteTime
(
String
posName
,
int
executeTime
)
{
try
{
StoragePos
storagePos
=
storagePosManager
.
getByPosName
(
posName
);
if
(
storagePos
!=
null
)
{
Storage
storage
=
dataCache
.
getStorageById
(
storagePos
.
getStorageId
());
InOutData
inOutData
=
dataCache
.
getLastSaveInOutData
(
storage
.
getCid
(),
storage
.
getId
());
inOutData
.
setExecuteTime
(
inOutData
.
getExecuteTime
()
+
executeTime
);
inOutDataManager
.
save
(
inOutData
);
}
}
catch
(
Exception
exception
)
{
log
.
error
(
exception
.
toString
());
}
}
@Override
@Override
public
DeviceType
getDeviceType
()
{
public
DeviceType
getDeviceType
()
{
return
DeviceType
.
DEFAULT
;
return
DeviceType
.
DEFAULT
;
...
...
src/main/java/com/neotel/smfcore/core/device/util/DataCache.java
查看文件 @
611e96e
package
com
.
neotel
.
smfcore
.
core
.
device
.
util
;
package
com
.
neotel
.
smfcore
.
core
.
device
.
util
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.google.common.base.Strings
;
import
com.google.common.base.Strings
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
...
@@ -16,6 +18,7 @@ import com.neotel.smfcore.core.device.bean.BoxStatusBean;
...
@@ -16,6 +18,7 @@ import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.inList.util.InListCache
;
import
com.neotel.smfcore.core.inList.util.InListCache
;
import
com.neotel.smfcore.core.inout.service.manager.IInOutDataManager
;
import
com.neotel.smfcore.core.inout.service.manager.IInOutDataManager
;
import
com.neotel.smfcore.core.inout.service.po.InOutData
;
import
com.neotel.smfcore.core.language.service.bean.LanguageInfo
;
import
com.neotel.smfcore.core.language.service.bean.LanguageInfo
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.storage.bean.InventoryItem
;
import
com.neotel.smfcore.core.storage.bean.InventoryItem
;
...
@@ -737,6 +740,7 @@ public class DataCache {
...
@@ -737,6 +740,7 @@ public class DataCache {
storage
.
setFullReelCount
(
fullReelCount
);
storage
.
setFullReelCount
(
fullReelCount
);
updateSpUsePosCount
(
storage
,
pos
,
-
1
);
updateSpUsePosCount
(
storage
,
pos
,
-
1
);
removeUsedPosList
(
cid
,
pos
);
removeUsedPosList
(
cid
,
pos
);
updateInOutData
(
cid
,
storage
.
getId
(),
-
1
);
}
else
{
}
else
{
//入库
//入库
amount
=
barcode
.
getAmount
();
amount
=
barcode
.
getAmount
();
...
@@ -747,6 +751,7 @@ public class DataCache {
...
@@ -747,6 +751,7 @@ public class DataCache {
if
(
ObjectUtil
.
isNotEmpty
(
storage
.
getInListName
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
storage
.
getInListName
()))
{
inListCache
.
UpdateInList
(
storage
.
getInListName
(),
pos
,
barcode
);
inListCache
.
UpdateInList
(
storage
.
getInListName
(),
pos
,
barcode
);
}
}
updateInOutData
(
cid
,
storage
.
getId
(),
1
);
// if(ObjectUtil.isNotEmpty(barcode.getInListName())){
// if(ObjectUtil.isNotEmpty(barcode.getInListName())){
// loadingUtil.puEndUpdateTime(barcode.getBarcode(),pos.getPosName());
// loadingUtil.puEndUpdateTime(barcode.getBarcode(),pos.getPosName());
// }
// }
...
@@ -1012,4 +1017,34 @@ public class DataCache {
...
@@ -1012,4 +1017,34 @@ public class DataCache {
}
}
return
cache
;
return
cache
;
}
}
private
synchronized
void
updateInOutData
(
String
cid
,
String
storageId
,
int
amount
)
{
InOutData
inOutData
=
getLastSaveInOutData
(
cid
,
storageId
);
//如果amount小于0,则是出库,否则入库
if
(
amount
<
0
)
{
inOutData
.
setOutCount
(
inOutData
.
getOutCount
()
+
1
);
}
else
if
(
amount
>
0
)
{
inOutData
.
setInCount
(
inOutData
.
getInCount
()
+
1
);
}
inOutData
.
setUpdateDate
(
new
Date
());
inOutDataManager
.
save
(
inOutData
);
}
public
InOutData
getLastSaveInOutData
(
String
cid
,
String
storageId
)
{
InOutData
inOutData
=
inOutDataManager
.
findOneByCidAndStorageId
(
cid
,
storageId
);
if
(
inOutData
==
null
)
{
inOutData
=
new
InOutData
();
}
else
{
Date
createDate
=
inOutData
.
getCreateDate
();
//判断当前是否超过1个小时
String
createDateStr
=
DateUtil
.
format
(
createDate
,
"yyyy-MM-dd HH"
);
String
currentDateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH"
);
long
between
=
DateUtil
.
between
(
DateUtil
.
parse
(
createDateStr
,
"yyyy-MM-dd HH"
),
DateUtil
.
parse
(
currentDateStr
,
"yyyy-MM-dd HH"
),
DateUnit
.
HOUR
);
if
(
between
>=
1
)
{
inOutData
=
new
InOutData
();
}
}
inOutData
.
setCid
(
cid
);
inOutData
.
setStorageId
(
storageId
);
return
inOutData
;
}
}
}
src/main/java/com/neotel/smfcore/core/inout/service/manager/IInOutDataManager.java
查看文件 @
611e96e
...
@@ -2,9 +2,15 @@ package com.neotel.smfcore.core.inout.service.manager;
...
@@ -2,9 +2,15 @@ package com.neotel.smfcore.core.inout.service.manager;
import
com.neotel.smfcore.common.base.IBaseManager
;
import
com.neotel.smfcore.common.base.IBaseManager
;
import
com.neotel.smfcore.core.inout.service.po.InOutData
;
import
com.neotel.smfcore.core.inout.service.po.InOutData
;
import
org.springframework.data.mongodb.core.query.Query
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
public
interface
IInOutDataManager
extends
IBaseManager
<
InOutData
>
{
public
interface
IInOutDataManager
extends
IBaseManager
<
InOutData
>
{
InOutData
findOneByDate
(
Date
startDate
,
Date
endDate
);
List
<
InOutData
>
findByDate
(
Date
startDate
,
Date
endDate
,
List
<
String
>
storageIdList
);
InOutData
findOne
(
Query
query
);
InOutData
findOneByCidAndStorageId
(
String
cid
,
String
storageId
);
}
}
src/main/java/com/neotel/smfcore/core/inout/service/manager/impl/InOutDataManagerImpl.java
查看文件 @
611e96e
...
@@ -48,13 +48,24 @@ public class InOutDataManagerImpl implements IInOutDataManager {
...
@@ -48,13 +48,24 @@ public class InOutDataManagerImpl implements IInOutDataManager {
}
}
@Override
@Override
public
InOutData
findOneByDate
(
Date
startDate
,
Date
endDate
)
{
public
List
<
InOutData
>
findByDate
(
Date
startDate
,
Date
endDate
,
List
<
String
>
storageIdList
)
{
Query
q
=
new
Query
();
Query
q
=
new
Query
();
Criteria
c
=
Criteria
.
where
(
"createDate"
).
gte
(
startDate
);
Criteria
c
=
Criteria
.
where
(
"createDate"
).
gte
(
startDate
)
.
lt
(
endDate
)
;
if
(
endDate
!=
null
)
{
if
(
storageIdList
!=
null
&&
!
storageIdList
.
isEmpty
())
{
c
.
and
(
"
createDate"
).
lt
(
endDate
);
c
.
and
(
"
storageId"
).
in
(
storageIdList
);
}
}
Sort
s
=
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"createDate"
);
Sort
s
=
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"createDate"
);
return
inOutDataDao
.
findOne
(
q
.
addCriteria
(
c
).
with
(
s
));
return
inOutDataDao
.
findByQuery
(
q
.
addCriteria
(
c
).
with
(
s
));
}
@Override
public
InOutData
findOne
(
Query
query
)
{
return
inOutDataDao
.
findOne
(
query
);
}
@Override
public
InOutData
findOneByCidAndStorageId
(
String
cid
,
String
storageId
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"cid"
).
is
(
cid
).
and
(
"storageId"
).
is
(
storageId
)).
with
(
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"createDate"
));
return
inOutDataDao
.
findOne
(
query
);
}
}
}
}
src/main/java/com/neotel/smfcore/core/inout/service/po/InOutData.java
查看文件 @
611e96e
package
com
.
neotel
.
smfcore
.
core
.
inout
.
service
.
po
;
package
com
.
neotel
.
smfcore
.
core
.
inout
.
service
.
po
;
import
com.neotel.smfcore.common.base.BasePo
;
import
com.neotel.smfcore.common.base.BasePo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.data.mongodb.core.mapping.Document
;
@Data
@Data
@Document
@Document
@AllArgsConstructor
@NoArgsConstructor
public
class
InOutData
extends
BasePo
{
public
class
InOutData
extends
BasePo
{
/**
/**
* 设备cid
* 设备cid
...
@@ -26,4 +30,9 @@ public class InOutData extends BasePo {
...
@@ -26,4 +30,9 @@ public class InOutData extends BasePo {
* 出库数量
* 出库数量
*/
*/
private
int
outCount
=
0
;
private
int
outCount
=
0
;
/**
* 执行时间
*/
private
int
executeTime
=
0
;
}
}
src/main/java/com/neotel/smfcore/core/report/ReportController.java
查看文件 @
611e96e
...
@@ -85,7 +85,8 @@ public class ReportController {
...
@@ -85,7 +85,8 @@ public class ReportController {
String
pn
=
query
.
getPn
();
String
pn
=
query
.
getPn
();
List
<
ChartItem
>
chartItemList
=
storageManager
.
getRunStatusData
(
startDay
,
endDay
,
pn
,
null
);
List
<
ChartItem
>
chartItemList
=
storageManager
.
getRunStatusData
(
startDay
,
endDay
,
pn
,
query
.
getCidList
());
InoutDataDto
dto
=
new
InoutDataDto
();
InoutDataDto
dto
=
new
InoutDataDto
();
for
(
ChartItem
item
:
chartItemList
)
{
for
(
ChartItem
item
:
chartItemList
)
{
...
...
src/main/java/com/neotel/smfcore/core/report/rest/query/ReportQuery.java
查看文件 @
611e96e
...
@@ -7,10 +7,13 @@ import org.springframework.format.annotation.DateTimeFormat;
...
@@ -7,10 +7,13 @@ import org.springframework.format.annotation.DateTimeFormat;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
@Data
@Data
public
class
ReportQuery
implements
Serializable
{
public
class
ReportQuery
implements
Serializable
{
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
BetweenData
<
Date
>
updateDate
;
private
BetweenData
<
Date
>
updateDate
;
private
String
pn
;
private
String
pn
;
private
List
<
String
>
cidList
;
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论