Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 854e05a4
由
LN
编写于
2025-07-08 11:52:36 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1568中车SP对接修改
1 个父辈
23014017
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
45 行增加
和
27 行删除
src/main/java/com/neotel/smfcore/core/solder/util/SolderBoxCache.java
src/main/java/com/neotel/smfcore/custom/zhongcheSp1568/ZhongCheSPApi.java
src/main/java/com/neotel/smfcore/core/solder/util/SolderBoxCache.java
查看文件 @
854e05a
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.solder.util;
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.solder.util;
import
com.google.common.base.Strings
;
import
com.google.common.base.Strings
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS
;
import
com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
...
@@ -18,6 +19,7 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
...
@@ -18,6 +19,7 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import
com.neotel.smfcore.core.system.service.dao.IDataLogDao
;
import
com.neotel.smfcore.core.system.service.dao.IDataLogDao
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.zhongcheSp1568.ZhongCheSPApi
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -43,6 +45,8 @@ public class SolderBoxCache {
...
@@ -43,6 +45,8 @@ public class SolderBoxCache {
@Value
(
"${sp.disStirring:}"
)
@Value
(
"${sp.disStirring:}"
)
private
String
disStirring
=
""
;
private
String
disStirring
=
""
;
@Value
(
"${api.taskNotifyUrl:}"
)
protected
String
taskNotifyUrl
=
""
;
@Autowired
@Autowired
private
DataCache
dataCache
;
private
DataCache
dataCache
;
@Autowired
@Autowired
...
@@ -101,6 +105,10 @@ public class SolderBoxCache {
...
@@ -101,6 +105,10 @@ public class SolderBoxCache {
}
}
@Autowired
protected
SmfApi
smfApi
;
@Autowired
private
ZhongCheSPApi
zhongCheSPApi
;
public
void
runTimer
(){
public
void
runTimer
(){
Collection
<
Storage
>
allStorage
=
dataCache
.
getAllStorage
().
values
();
Collection
<
Storage
>
allStorage
=
dataCache
.
getAllStorage
().
values
();
for
(
Storage
storage
:
allStorage
)
{
for
(
Storage
storage
:
allStorage
)
{
...
@@ -132,28 +140,27 @@ public class SolderBoxCache {
...
@@ -132,28 +140,27 @@ public class SolderBoxCache {
}
}
}
else
if
(
isInStatus
(
barcode
,
SOLDER_STATUS
.
REWARMING
)){
}
else
if
(
isInStatus
(
barcode
,
SOLDER_STATUS
.
REWARMING
)){
//回温中,看回温是否完成
//回温中,看回温是否完成
if
(
now
-
barcode
.
getStartWarmTime
()
>=
barcode
.
getWarmTime
()
*
60
*
1000
){
if
(
now
-
barcode
.
getStartWarmTime
()
>=
barcode
.
getWarmTime
()
*
60
*
1000
)
{
//回温完成,更改状态为待搅拌
//回温完成,更改状态为待搅拌
if
(
disStirring
.
trim
().
equalsIgnoreCase
(
"true"
))
{
if
(
disStirring
.
trim
().
equalsIgnoreCase
(
"true"
))
{
log
.
info
(
barcode
.
getBarcode
()
+
"到达回温时间,当前已配置为禁用搅拌功能,修改状态为待出库"
);
log
.
info
(
barcode
.
getBarcode
()
+
"到达回温时间,当前已配置为禁用搅拌功能,修改状态为待出库"
);
barcode
.
setSolderStatus
(
SOLDER_STATUS
.
TO_BE_OUT
.
name
());
barcode
.
setSolderStatus
(
SOLDER_STATUS
.
TO_BE_OUT
.
name
());
}
}
else
if
(
barcode
.
getMixTime
()
<=
0
)
{
else
if
(
barcode
.
getMixTime
()
<=
0
){
log
.
info
(
barcode
.
getBarcode
()
+
"到达回温时间,搅拌时间为0,修改状态为待出库"
);
log
.
info
(
barcode
.
getBarcode
()
+
"到达回温时间,搅拌时间为0,修改状态为待出库"
);
barcode
.
setSolderStatus
(
SOLDER_STATUS
.
TO_BE_OUT
.
name
());
barcode
.
setSolderStatus
(
SOLDER_STATUS
.
TO_BE_OUT
.
name
());
}
else
{
}
else
{
//判断是否自动开始搅拌
//判断是否自动开始搅拌
Boolean
autoStartMixed
=
dataCache
.
getCache
(
Constants
.
CACHE_SP_AUTO_START_MIXED
);
Boolean
autoStartMixed
=
dataCache
.
getCache
(
Constants
.
CACHE_SP_AUTO_START_MIXED
);
if
(
autoStartMixed
==
null
)
{
if
(
autoStartMixed
==
null
)
{
autoStartMixed
=
false
;
autoStartMixed
=
false
;
}
}
if
(
autoStartMixed
)
{
if
(
autoStartMixed
)
{
log
.
info
(
barcode
.
getBarcode
()
+
"到达回温时间,已配置CACHE_SP_AUTO_START_MIXED=true,自动开始搅拌,修改状态=TO_BE_MIXED"
);
log
.
info
(
barcode
.
getBarcode
()
+
"到达回温时间,已配置CACHE_SP_AUTO_START_MIXED=true,自动开始搅拌,修改状态=TO_BE_MIXED"
);
barcode
.
setSolderStatus
(
SOLDER_STATUS
.
TO_BE_MIXED
.
name
());
barcode
.
setSolderStatus
(
SOLDER_STATUS
.
TO_BE_MIXED
.
name
());
}
else
{
}
else
{
log
.
info
(
barcode
.
getBarcode
()
+
"到达回温时间,修改状态为等待搅拌,待手动开始搅拌后再开始搅拌"
);
log
.
info
(
barcode
.
getBarcode
()
+
"到达回温时间,修改状态为等待搅拌,待手动开始搅拌后再开始搅拌"
);
barcode
.
setSolderStatus
(
SOLDER_STATUS
.
WAIT_MIXED
.
name
());
barcode
.
setSolderStatus
(
SOLDER_STATUS
.
WAIT_MIXED
.
name
());
}
}
...
@@ -164,6 +171,11 @@ public class SolderBoxCache {
...
@@ -164,6 +171,11 @@ public class SolderBoxCache {
storagePos
.
setBarcode
(
barcode
);
storagePos
.
setBarcode
(
barcode
);
storagePosManager
.
save
(
storagePos
);
storagePosManager
.
save
(
storagePos
);
//通知
if
(
zhongCheSPApi
.
isForThisApi
(
smfApi
.
getApiName
()))
{
zhongCheSPApi
.
SPStatusChange
(
taskNotifyUrl
,
"HW_END"
,
barcode
,
new
Date
());
}
}
}
}
else
if
(
isInStatus
(
barcode
,
SOLDER_STATUS
.
TO_BE_MIXED
)){
}
else
if
(
isInStatus
(
barcode
,
SOLDER_STATUS
.
TO_BE_MIXED
)){
//待搅拌,生成搅拌任务
//待搅拌,生成搅拌任务
...
...
src/main/java/com/neotel/smfcore/custom/zhongcheSp1568/ZhongCheSPApi.java
查看文件 @
854e05a
...
@@ -291,19 +291,17 @@ public class ZhongCheSPApi extends BaseSmfApiListener {
...
@@ -291,19 +291,17 @@ public class ZhongCheSPApi extends BaseSmfApiListener {
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
task
.
getBarcode
());
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
task
.
getBarcode
());
String
rsType
=
null
;
String
rsType
=
null
;
if
(!
task
.
isFinished
()){
//
if(!task.isFinished()){
//只有结束的任务才更新
//
//只有结束的任务才更新
return
false
;
//
return false ;
}
//
}
if
(
barcode
==
null
)
{
if
(
barcode
==
null
)
{
log
.
error
(
"TaskStatusChange, 任务="
+
task
.
getBarcode
()
+
"/"
+
task
.
getPosName
()
+
" 未找到条码暂不处理: "
);
log
.
error
(
"TaskStatusChange, 任务="
+
task
.
getBarcode
()
+
"/"
+
task
.
getPosName
()
+
" 未找到条码暂不处理: "
);
return
false
;
return
false
;
}
}
if
(
task
.
isCheckOutTask
())
{
if
(
task
.
isCheckOutTask
())
{
// 领用 - 暂不支持,需要根据业务逻辑确定具体的操作类型
// log.warn("TaskStatusChange: 领用操作暂不支持,需要进一步确认业务逻辑");
return
false
;
return
false
;
}
else
if
(
task
.
isPutInTask
())
{
}
else
if
(
task
.
isPutInTask
()
&&
task
.
isFinished
()
)
{
StoragePos
pos
=
storagePosManager
.
getByPosName
(
task
.
getPosName
());
StoragePos
pos
=
storagePosManager
.
getByPosName
(
task
.
getPosName
());
if
(
pos
==
null
)
{
if
(
pos
==
null
)
{
log
.
error
(
"TaskStatusChange, 任务="
+
task
.
getBarcode
()
+
"/"
+
task
.
getPosName
()
+
" 未找到库位暂不处理 "
);
log
.
error
(
"TaskStatusChange, 任务="
+
task
.
getBarcode
()
+
"/"
+
task
.
getPosName
()
+
" 未找到库位暂不处理 "
);
...
@@ -313,15 +311,15 @@ public class ZhongCheSPApi extends BaseSmfApiListener {
...
@@ -313,15 +311,15 @@ public class ZhongCheSPApi extends BaseSmfApiListener {
// 入库到冷藏区
// 入库到冷藏区
rsType
=
"LC"
;
// 冷藏
rsType
=
"LC"
;
// 冷藏
}
}
}
else
if
(
task
.
isRewarm
TakingTask
())
{
}
else
if
(
task
.
isRewarm
PuttingTask
()&&
task
.
isFinished
())
{
// 回温取料 - 可能是
回温开始
rsType
=
"HW_BEGIN"
;
// 已放到回温区,
回温开始
rsType
=
"HW_BEGIN"
;
// 回温开始
}
}
else
if
(
task
.
isRewarmPuttingTask
())
{
else
if
(
task
.
isMixTask
()&&
task
.
isExecuting
())
{
// 回温放料 - 可能是回温结束
rsType
=
"JB_BEGIN"
;
// 搅拌任务开始执行,搅拌开始
rsType
=
"HW_END"
;
// 回温结束
}
}
else
if
(
task
.
isMixTask
()){
else
if
(
task
.
isMixTask
()&&
task
.
isFinished
()){
// 搅拌结束: JB_END
// 搅拌结束: JB_END
rsType
=
"JB_END"
;
// 搅拌结束
rsType
=
"JB_END"
;
// 搅拌
任务完成,搅拌
结束
}
}
// 可以根据具体业务需求添加搅拌相关的逻辑
// 可以根据具体业务需求添加搅拌相关的逻辑
...
@@ -332,7 +330,14 @@ public class ZhongCheSPApi extends BaseSmfApiListener {
...
@@ -332,7 +330,14 @@ public class ZhongCheSPApi extends BaseSmfApiListener {
log
.
warn
(
"TaskStatusChange: 未找到对应的操作类型,task类型: "
+
task
.
getType
());
log
.
warn
(
"TaskStatusChange: 未找到对应的操作类型,task类型: "
+
task
.
getType
());
return
false
;
return
false
;
}
}
return
SPStatusChange
(
url
,
rsType
,
barcode
,
task
.
getUpdateDate
());
}
public
boolean
SPStatusChange
(
String
url
,
String
rsType
,
Barcode
barcode
,
Date
updateTime
)
{
if
(
ObjectUtil
.
isEmpty
(
url
)){
return
false
;
}
try
{
try
{
// 构建请求数据使用Map
// 构建请求数据使用Map
Map
<
String
,
Object
>
request
=
new
HashMap
<>();
Map
<
String
,
Object
>
request
=
new
HashMap
<>();
...
@@ -348,11 +353,11 @@ public class ZhongCheSPApi extends BaseSmfApiListener {
...
@@ -348,11 +353,11 @@ public class ZhongCheSPApi extends BaseSmfApiListener {
dataItem
.
put
(
"rs_qty"
,
barcode
.
getAmount
());
// 默认数量为1,可根据实际业务调整
dataItem
.
put
(
"rs_qty"
,
barcode
.
getAmount
());
// 默认数量为1,可根据实际业务调整
// 格式化时间为 YYYY-MM-DD HH:mm:ss
// 格式化时间为 YYYY-MM-DD HH:mm:ss
String
time
=
DateUtil
.
toDateString
(
task
.
getUpdateDate
()
,
"yyyy-MM-dd HH:mm:ss"
);
String
time
=
DateUtil
.
toDateString
(
updateTime
,
"yyyy-MM-dd HH:mm:ss"
);
dataItem
.
put
(
"zzzc_rs_date"
,
time
);
dataItem
.
put
(
"zzzc_rs_date"
,
time
);
// 如果是冷藏操作,需要传生产日期
// 如果是冷藏操作,需要传生产日期
if
(
"LC"
.
equals
(
rsType
)
&&
ObjectUtil
.
isNotEmpty
(
barcode
.
getProduceDate
()))
{
if
(
"LC"
.
equals
(
rsType
)
&&
ObjectUtil
.
isNotEmpty
(
barcode
.
getProduceDate
()))
{
// 这里需要根据实际业务获取生产日期,暂时使用当前日期
// 这里需要根据实际业务获取生产日期,暂时使用当前日期
dataItem
.
put
(
"mf_date"
,
DateUtil
.
toDateString
(
barcode
.
getProduceDate
(),
"yyyy-MM-dd HH:mm:ss"
));
dataItem
.
put
(
"mf_date"
,
DateUtil
.
toDateString
(
barcode
.
getProduceDate
(),
"yyyy-MM-dd HH:mm:ss"
));
}
}
...
@@ -387,5 +392,6 @@ public class ZhongCheSPApi extends BaseSmfApiListener {
...
@@ -387,5 +392,6 @@ public class ZhongCheSPApi extends BaseSmfApiListener {
log
.
error
(
"TaskStatusChange, url="
+
url
+
" exception: "
+
exception
.
getMessage
());
log
.
error
(
"TaskStatusChange, url="
+
url
+
" exception: "
+
exception
.
getMessage
());
}
}
return
false
;
return
false
;
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论