Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit c0583e42
由
zshaohui
编写于
2023-08-24 13:47:47 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.增加 获取出库信息 根据barcode
2.料箱离开工位,bug修改
1 个父辈
1b368d99
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
223 行增加
和
30 行删除
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
src/main/java/com/neotel/smfcore/core/system/service/manager/IDataLogManager.java
src/main/java/com/neotel/smfcore/core/system/service/manager/impl/DataLogManagerImpl.java
src/main/java/com/neotel/smfcore/core/system/util/TaskService.java
src/main/java/com/neotel/smfcore/custom/lizhen/LizhenApi.java
src/main/java/com/neotel/smfcore/custom/lizhen/LizhenController.java
src/main/java/com/neotel/smfcore/custom/lizhen/innerBox/rest/InnerBoxRestController.java
src/main/java/com/neotel/smfcore/custom/lizhen/innerBox/util/PreWarningItemCache.java
src/main/java/com/neotel/smfcore/custom/lizhen/innerBox/util/StorageExportUtil.java
src/main/resources/log4j2-spring.xml
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
查看文件 @
c0583e4
...
@@ -179,7 +179,7 @@ public class LiteOrderCache {
...
@@ -179,7 +179,7 @@ public class LiteOrderCache {
String
msg
=
MessageUtils
.
getText
(
result
,
MessageUtils
.
getDefaultLocal
(),
""
);
String
msg
=
MessageUtils
.
getText
(
result
,
MessageUtils
.
getDefaultLocal
(),
""
);
log
.
info
(
"自动执行工单 【"
+
order
.
getOrderNo
()
+
"】 失败:"
+
msg
);
log
.
info
(
"自动执行工单 【"
+
order
.
getOrderNo
()
+
"】 失败:"
+
msg
);
}
else
{
}
else
{
log
.
info
(
"自动执行工单 【"
+
order
.
getOrderNo
()
+
"】 成功"
);
//
log.info("自动执行工单 【" + order.getOrderNo() + "】 成功");
break
;
break
;
}
}
}
}
...
@@ -440,7 +440,7 @@ public class LiteOrderCache {
...
@@ -440,7 +440,7 @@ public class LiteOrderCache {
}
}
}
}
if
(!
hasOutTask
)
{
if
(!
hasOutTask
)
{
log
.
info
(
"空闲料仓:"
+
storage
.
getName
());
//
log.info("空闲料仓:" + storage.getName());
freeStorageIds
.
add
(
storageId
);
freeStorageIds
.
add
(
storageId
);
}
}
}
}
...
@@ -661,6 +661,7 @@ public class LiteOrderCache {
...
@@ -661,6 +661,7 @@ public class LiteOrderCache {
return
"smfcore.order.out.noTask"
;
return
"smfcore.order.out.noTask"
;
}
}
log
.
info
(
cacheOrder
.
getOrderNo
()+
"分配出料口为:"
+
exportStr
+
"line为:"
+
cacheOrder
.
getLine
()+
"剩余任务数为:"
+
taskReelCount
);
StorageExportUtil
.
updateExport
(
exportStr
,
cacheOrder
.
getOrderNo
(),
cacheOrder
.
getLine
(),
taskReelCount
);
StorageExportUtil
.
updateExport
(
exportStr
,
cacheOrder
.
getOrderNo
(),
cacheOrder
.
getLine
(),
taskReelCount
);
return
""
;
return
""
;
...
...
src/main/java/com/neotel/smfcore/core/system/service/manager/IDataLogManager.java
查看文件 @
c0583e4
...
@@ -20,4 +20,6 @@ public interface IDataLogManager extends IBaseManager<DataLog> {
...
@@ -20,4 +20,6 @@ public interface IDataLogManager extends IBaseManager<DataLog> {
int
countBySourceName
(
String
barcodeStr
,
String
orderNo
);
int
countBySourceName
(
String
barcodeStr
,
String
orderNo
);
int
countByQuery
(
Query
subSourceId
);
int
countByQuery
(
Query
subSourceId
);
DataLog
getOutReelInfo
(
String
barcode
);
}
}
src/main/java/com/neotel/smfcore/core/system/service/manager/impl/DataLogManagerImpl.java
查看文件 @
c0583e4
...
@@ -5,6 +5,7 @@ import com.neotel.smfcore.common.exception.ValidateException;
...
@@ -5,6 +5,7 @@ import com.neotel.smfcore.common.exception.ValidateException;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
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.system.service.dao.IDataLogDao
;
import
com.neotel.smfcore.core.system.service.dao.IDataLogDao
;
import
com.neotel.smfcore.core.system.service.manager.IDataLogManager
;
import
com.neotel.smfcore.core.system.service.manager.IDataLogManager
;
...
@@ -13,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -13,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.logging.log4j.util.Strings
;
import
org.apache.logging.log4j.util.Strings
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -129,4 +131,12 @@ public class DataLogManagerImpl implements IDataLogManager {
...
@@ -129,4 +131,12 @@ public class DataLogManagerImpl implements IDataLogManager {
public
int
countByQuery
(
Query
query
)
{
public
int
countByQuery
(
Query
query
)
{
return
dataLogDao
.
countByQuery
(
query
);
return
dataLogDao
.
countByQuery
(
query
);
}
}
@Override
public
DataLog
getOutReelInfo
(
String
barcode
)
{
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
"barcode"
).
is
(
barcode
).
and
(
"status"
).
is
(
OP_STATUS
.
FINISHED
.
name
()).
and
(
"type"
).
is
(
OP
.
CHECKOUT
).
and
(
"subSourceId"
).
exists
(
true
).
ne
(
""
));
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"createDate"
,
"updateDate"
));
return
dataLogDao
.
findOne
(
query
);
}
}
}
src/main/java/com/neotel/smfcore/core/system/util/TaskService.java
查看文件 @
c0583e4
...
@@ -32,7 +32,9 @@ import com.neotel.smfcore.core.system.bean.MSDAppendInfo;
...
@@ -32,7 +32,9 @@ import com.neotel.smfcore.core.system.bean.MSDAppendInfo;
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.custom.lizhen.LizhenApi
;
import
com.neotel.smfcore.custom.lizhen.LizhenApi
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.StorageExport
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType
;
import
com.neotel.smfcore.custom.lizhen.innerBox.util.StorageExportUtil
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/LizhenApi.java
查看文件 @
c0583e4
...
@@ -81,7 +81,7 @@ public class LizhenApi extends DefaultSmfApiListener {
...
@@ -81,7 +81,7 @@ public class LizhenApi extends DefaultSmfApiListener {
werks
=
dataCache
.
getConfigCache
(
"werks"
,
werks
);
werks
=
dataCache
.
getConfigCache
(
"werks"
,
werks
);
outNotifyUrlPK
=
dataCache
.
getConfigCache
(
"api.outNotifyUrlPK"
,
outNotifyUrlPK
);
outNotifyUrlPK
=
dataCache
.
getConfigCache
(
"api.outNotifyUrlPK"
,
outNotifyUrlPK
);
batchCheckUrl
=
dataCache
.
getConfigCache
(
"api.batchCheckUrl"
,
batchCheckUrl
);
batchCheckUrl
=
dataCache
.
getConfigCache
(
"api.batchCheckUrl"
,
batchCheckUrl
);
checkReelMeasureUrl
=
dataCache
.
getConfigCache
(
"api.checkReelMeasure"
,
checkReelMeasureUrl
);
//
checkReelMeasureUrl = dataCache.getConfigCache("api.checkReelMeasure",checkReelMeasureUrl);
}
}
/**
/**
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/LizhenController.java
查看文件 @
c0583e4
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
;
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ApiException
;
import
com.neotel.smfcore.common.exception.ApiException
;
...
@@ -8,17 +7,25 @@ import com.neotel.smfcore.common.utils.Constants;
...
@@ -8,17 +7,25 @@ import com.neotel.smfcore.common.utils.Constants;
import
com.neotel.smfcore.common.utils.HttpHelper
;
import
com.neotel.smfcore.common.utils.HttpHelper
;
import
com.neotel.smfcore.common.utils.JsonUtil
;
import
com.neotel.smfcore.common.utils.JsonUtil
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
import
com.neotel.smfcore.core.order.enums.LITEORDER_SOURCE
;
import
com.neotel.smfcore.core.order.enums.LITEORDER_SOURCE
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrderItem
;
import
com.neotel.smfcore.core.order.service.po.LiteOrderItem
;
import
com.neotel.smfcore.core.system.service.manager.IDataLogManager
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.PreWarningItem
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.PreWarningItem
;
import
com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache
;
import
com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -43,6 +50,15 @@ public class LizhenController {
...
@@ -43,6 +50,15 @@ public class LizhenController {
@Autowired
@Autowired
private
DataCache
dataCache
;
private
DataCache
dataCache
;
@Autowired
private
IDataLogManager
dataLogManager
;
@Autowired
private
ILiteOrderItemManager
liteOrderItemManager
;
@Autowired
private
CodeResolve
codeResolve
;
@Value
(
"${lizhen.F2.line}"
)
@Value
(
"${lizhen.F2.line}"
)
private
String
F2Line
;
private
String
F2Line
;
...
@@ -188,7 +204,7 @@ public class LizhenController {
...
@@ -188,7 +204,7 @@ public class LizhenController {
String
id
=
param
.
get
(
"ID"
);
String
id
=
param
.
get
(
"ID"
);
try
{
try
{
String
result
=
HttpHelper
.
postJson
(
forwardUrl
,
param
);
String
result
=
HttpHelper
.
postJson
(
forwardUrl
,
param
);
log
.
info
(
id
+
"机台叫料结果为--"
+
result
);
//
log.info(id + "机台叫料结果为--" + result);
}
catch
(
ApiException
e
)
{
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
log
.
info
(
id
+
"机台叫料转发失败---"
+
e
.
getMessage
());
log
.
info
(
id
+
"机台叫料转发失败---"
+
e
.
getMessage
());
...
@@ -203,10 +219,10 @@ public class LizhenController {
...
@@ -203,10 +219,10 @@ public class LizhenController {
@AnonymousAccess
@AnonymousAccess
public
ResultBean
machineCallMaterial
(
@RequestBody
Map
<
String
,
String
>
data
)
{
public
ResultBean
machineCallMaterial
(
@RequestBody
Map
<
String
,
String
>
data
)
{
boolean
startJob
=
dataCache
.
getCache
(
Constants
.
CACHE_StartJob
);
boolean
startJob
=
dataCache
.
getCache
(
Constants
.
CACHE_StartJob
);
if
(!
startJob
){
if
(!
startJob
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"定时任务未开启"
);
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"定时任务未开启"
);
}
}
log
.
info
(
"Mes缺料预警---"
+
JSONObject
.
toJSONString
(
data
));
//
log.info("Mes缺料预警---" + JSONObject.toJSONString(data));
PreWarningItem
item
=
new
PreWarningItem
();
PreWarningItem
item
=
new
PreWarningItem
();
item
.
setMachinename
(
data
.
get
(
"MACHINENAME"
));
item
.
setMachinename
(
data
.
get
(
"MACHINENAME"
));
item
.
setStation
(
data
.
get
(
"STATION"
));
item
.
setStation
(
data
.
get
(
"STATION"
));
...
@@ -224,6 +240,43 @@ public class LizhenController {
...
@@ -224,6 +240,43 @@ public class LizhenController {
}
}
/**
* 根据唯一码,查找最近的一次工单信息
*
* @param barcodeStr
* @return
*/
@RequestMapping
(
"/getOutReelInfo"
)
@AnonymousAccess
public
ResultBean
getOutReelInfo
(
String
barcodeStr
)
{
CodeBean
codeBean
=
codeResolve
.
resolveSingleCode
(
barcodeStr
);
Barcode
barcode
=
codeBean
.
getBarcode
();
if
(
barcode
!=
null
)
{
DataLog
dataLog
=
dataLogManager
.
getOutReelInfo
(
barcode
.
getBarcode
());
if
(
dataLog
!=
null
)
{
LiteOrderItem
orderItem
=
liteOrderItemManager
.
get
(
dataLog
.
getSubSourceId
());
if
(
orderItem
!=
null
)
{
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"barcode"
,
dataLog
.
getBarcode
());
resultMap
.
put
(
"orderNo"
,
orderItem
.
getOrderNo
());
resultMap
.
put
(
"line"
,
orderItem
.
getLine
());
resultMap
.
put
(
"side"
,
orderItem
.
getSide
());
resultMap
.
put
(
"vendor"
,
orderItem
.
getBrand
());
resultMap
.
put
(
"partNumber"
,
dataLog
.
getPartNumber
());
resultMap
.
put
(
"slot"
,
orderItem
.
getSlot
());
resultMap
.
put
(
"subSlot"
,
orderItem
.
getSubSlot
());
resultMap
.
put
(
"station"
,
orderItem
.
getTableNo
());
resultMap
.
put
(
"machinename"
,
orderItem
.
getMachineName
());
return
ResultBean
.
newOkResult
(
resultMap
);
}
}
}
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"未找到相关信息"
);
}
private
String
getForwardUrl
(
String
line
)
{
private
String
getForwardUrl
(
String
line
)
{
String
url
=
""
;
String
url
=
""
;
for
(
Map
.
Entry
<
String
,
String
>
lineUrlEntry
:
lineUrlMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
String
>
lineUrlEntry
:
lineUrlMap
.
entrySet
())
{
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/innerBox/rest/InnerBoxRestController.java
查看文件 @
c0583e4
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
innerBox
.
rest
;
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
innerBox
.
rest
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
...
@@ -145,13 +146,16 @@ public class InnerBoxRestController {
...
@@ -145,13 +146,16 @@ public class InnerBoxRestController {
int
remainTaskCount
=
0
;
int
remainTaskCount
=
0
;
List
<
DataLog
>
dataLogList
=
taskService
.
getAllTasks
();
List
<
DataLog
>
dataLogList
=
taskService
.
getAllTasks
();
for
(
DataLog
dataLog
:
dataLogList
)
{
for
(
DataLog
dataLog
:
dataLogList
)
{
if
(
dataLog
.
getSourceId
().
equals
(
opTask
.
getSourceId
())){
if
(
StringUtils
.
isNotBlank
(
dataLog
.
getSourceId
())){
if
(!
dataLog
.
isFinished
()){
if
(
dataLog
.
getSourceId
().
equals
(
opTask
.
getSourceId
())){
remainTaskCount
++;
if
(!
dataLog
.
isFinished
()){
remainTaskCount
++;
}
}
}
}
}
}
}
storageExport
.
setRemainTaskCount
(
remainTaskCount
);
storageExport
.
setRemainTaskCount
(
remainTaskCount
);
log
.
info
(
opTask
.
getBarcode
()+
"任务完成,更新出料口信息:"
+
JSON
.
toJSONString
(
storageExport
));
StorageExportUtil
.
updateExport
(
outlet
,
storageExport
);
StorageExportUtil
.
updateExport
(
outlet
,
storageExport
);
}
}
}
}
...
@@ -236,7 +240,7 @@ public class InnerBoxRestController {
...
@@ -236,7 +240,7 @@ public class InnerBoxRestController {
if
(
codeBean
.
getBarcode
()
!=
null
)
{
if
(
codeBean
.
getBarcode
()
!=
null
)
{
Collection
<
DataLog
>
dataLogs
=
taskService
.
getAllTasks
();
Collection
<
DataLog
>
dataLogs
=
taskService
.
getAllTasks
();
for
(
DataLog
dataLog
:
dataLogs
)
{
for
(
DataLog
dataLog
:
dataLogs
)
{
if
(
dataLog
.
getBarcode
().
equals
(
codeBean
.
getBarcode
().
getBarcode
()))
{
if
(
dataLog
.
isCheckOutTask
()
&&
dataLog
.
getBarcode
().
equals
(
codeBean
.
getBarcode
().
getBarcode
()))
{
if
(!
dataLog
.
isCancel
()
&&
!
dataLog
.
isFinished
())
{
if
(!
dataLog
.
isCancel
()
&&
!
dataLog
.
isFinished
())
{
LiteOrder
liteOrder
=
liteOrderManager
.
get
(
dataLog
.
getSourceId
());
LiteOrder
liteOrder
=
liteOrderManager
.
get
(
dataLog
.
getSourceId
());
LiteOrderItem
liteOrderItem
=
liteOrderItemManager
.
get
(
dataLog
.
getSubSourceId
());
LiteOrderItem
liteOrderItem
=
liteOrderItemManager
.
get
(
dataLog
.
getSubSourceId
());
...
@@ -439,10 +443,21 @@ public class InnerBoxRestController {
...
@@ -439,10 +443,21 @@ public class InnerBoxRestController {
if
(
codeBean
.
getBarcode
()
!=
null
)
{
if
(
codeBean
.
getBarcode
()
!=
null
)
{
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
for
(
DataLog
dataLog
:
allTasks
)
{
for
(
DataLog
dataLog
:
allTasks
)
{
if
(
dataLog
.
getBarcode
().
equals
(
codeBean
.
getBarcode
().
getBarcode
()))
{
if
(
dataLog
.
isCheckOutTask
()
&&
dataLog
.
getBarcode
().
equals
(
codeBean
.
getBarcode
().
getBarcode
()))
{
resultMap
.
put
(
"export"
,
""
);
//如果sourceName和subSourceId都不为空时,则返回目标位置
String
sourceName
=
dataLog
.
getSourceName
();
String
sourceName
=
dataLog
.
getSourceName
();
String
export
=
StorageExportUtil
.
getExportByOrderNo
(
sourceName
);
String
sourceId
=
dataLog
.
getSourceId
();
resultMap
.
put
(
"export"
,
export
);
if
(
StringUtils
.
isNotBlank
(
sourceId
)
&&
StringUtils
.
isNotBlank
(
sourceName
))
{
String
export
=
StorageExportUtil
.
getExportByOrderNo
(
sourceName
);
log
.
info
(
dataLog
.
getBarcode
()
+
"获取出料口信息为:"
+
export
);
resultMap
.
put
(
"export"
,
export
);
}
else
{
String
export
=
StorageExportUtil
.
getExportByOrderNo
(
""
);
log
.
info
(
dataLog
.
getBarcode
()
+
"手动出库获取出料口信息为:"
+
export
);
resultMap
.
put
(
"export"
,
export
);
}
resultMap
.
put
(
"height"
,
codeBean
.
getBarcode
().
getHeight
());
resultMap
.
put
(
"height"
,
codeBean
.
getBarcode
().
getHeight
());
resultMap
.
put
(
"plateSize"
,
codeBean
.
getBarcode
().
getPlateSize
());
resultMap
.
put
(
"plateSize"
,
codeBean
.
getBarcode
().
getPlateSize
());
resultMap
.
put
(
"barcode"
,
codeBean
.
getBarcode
().
getBarcode
());
resultMap
.
put
(
"barcode"
,
codeBean
.
getBarcode
().
getBarcode
());
...
@@ -465,8 +480,9 @@ public class InnerBoxRestController {
...
@@ -465,8 +480,9 @@ public class InnerBoxRestController {
@ApiOperation
(
"清空出料口缓存信息"
)
@ApiOperation
(
"清空出料口缓存信息"
)
@RequestMapping
(
"/clearExport"
)
@RequestMapping
(
"/clearExport"
)
@AnonymousAccess
@AnonymousAccess
public
ResultBean
clearExport
(
String
export
){
public
ResultBean
clearExport
(
String
export
)
{
StorageExportUtil
.
clearExport
(
export
);
log
.
info
(
"开始清空出料口信息:"
+
export
);
StorageExportUtil
.
clearExport
(
export
+
StorageExportUtil
.
OUT_STATION
);
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
""
);
}
}
...
@@ -475,9 +491,55 @@ public class InnerBoxRestController {
...
@@ -475,9 +491,55 @@ public class InnerBoxRestController {
@AnonymousAccess
@AnonymousAccess
public
ResultBean
getExport
(
String
export
)
{
public
ResultBean
getExport
(
String
export
)
{
StorageExport
storageExport
=
StorageExportUtil
.
getExport
(
export
);
StorageExport
storageExport
=
StorageExportUtil
.
getExport
(
export
);
if
(
StringUtils
.
isNotBlank
(
storageExport
.
getHSerial
())){
int
remainTaskCount
=
0
;
List
<
DataLog
>
allTasks
=
taskService
.
getAllTasks
();
for
(
DataLog
dataLog
:
allTasks
)
{
if
(
dataLog
.
isCheckOutTask
()
&&
storageExport
.
getHSerial
().
equals
(
dataLog
.
getSourceName
())){
if
(!
dataLog
.
isFinished
()
&&
!
dataLog
.
isCancel
()){
remainTaskCount
++;
}
}
}
storageExport
.
setRemainTaskCount
(
remainTaskCount
);
StorageExportUtil
.
updateExport
(
export
,
storageExport
);
}
return
ResultBean
.
newOkResult
(
storageExport
);
}
@ApiOperation
(
"agv获取目的地"
)
@RequestMapping
(
"/getAgvLine"
)
@AnonymousAccess
public
ResultBean
getAgvLine
(
String
export
)
{
StorageExport
storageExport
=
StorageExportUtil
.
getExport
(
export
+
StorageExportUtil
.
OUT_STATION
);
if
(
storageExport
==
null
||
StringUtils
.
isBlank
(
storageExport
.
getHSerial
()))
{
storageExport
=
StorageExportUtil
.
getExport
(
export
);
}
log
.
info
(
export
+
"获取目的地信息:"
+
JSON
.
toJSONString
(
storageExport
));
return
ResultBean
.
newOkResult
(
storageExport
);
}
@ApiOperation
(
"料箱离开工位"
)
@RequestMapping
(
"/boxOutStation"
)
@AnonymousAccess
public
ResultBean
boxOutStation
(
String
export
)
{
StorageExport
storageExport
=
StorageExportUtil
.
getExport
(
export
);
String
hSerial
=
storageExport
.
getHSerial
();
if
(
StringUtils
.
isNotBlank
(
hSerial
))
{
LiteOrder
order
=
liteOrderCache
.
getOrderSortItems
(
hSerial
);
if
(
order
!=
null
)
{
if
(!
order
.
isClosed
()
&&
!
order
.
isTaskFinished
())
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
export
+
"工位任务未完成,暂不离开"
);
}
}
}
StorageExportUtil
.
clearExport
(
export
);
StorageExportUtil
.
updateExport
(
export
+
StorageExportUtil
.
OUT_STATION
,
storageExport
);
log
.
info
(
export
+
StorageExportUtil
.
OUT_STATION
+
"料箱离开工位,信息为:"
+
JSON
.
toJSONString
(
storageExport
));
return
ResultBean
.
newOkResult
(
storageExport
);
return
ResultBean
.
newOkResult
(
storageExport
);
}
}
/*@ApiOperation("手动发料")
/*@ApiOperation("手动发料")
@PostMapping("/manualFeeding")
@PostMapping("/manualFeeding")
@AnonymousAccess
@AnonymousAccess
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/innerBox/util/PreWarningItemCache.java
查看文件 @
c0583e4
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
innerBox
.
util
;
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
innerBox
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
...
@@ -172,7 +173,7 @@ public class PreWarningItemCache {
...
@@ -172,7 +173,7 @@ public class PreWarningItemCache {
for
(
PreWarningItem
item
:
queueItemList
)
{
for
(
PreWarningItem
item
:
queueItemList
)
{
if
(
preWarningItem
.
getItemId
().
equals
(
item
.
getItemId
()))
{
if
(
preWarningItem
.
getItemId
().
equals
(
item
.
getItemId
()))
{
newItems
=
newItems
.
stream
().
filter
(
t
->
!
t
.
getItemId
().
equals
(
item
.
getItemId
())).
collect
(
Collectors
.
toList
());
newItems
=
newItems
.
stream
().
filter
(
t
->
!
t
.
getItemId
().
equals
(
item
.
getItemId
())).
collect
(
Collectors
.
toList
());
log
.
info
(
"Mes缺料预警重复物料:"
+
item
.
getItemId
()
+
"PN为:"
+
item
.
getPartnumber
());
//
log.info("Mes缺料预警重复物料:" + item.getItemId() + "PN为:" + item.getPartnumber());
break
;
break
;
}
}
}
}
...
@@ -186,7 +187,7 @@ public class PreWarningItemCache {
...
@@ -186,7 +187,7 @@ public class PreWarningItemCache {
List
<
LiteOrderItem
>
orderItems
=
liteOrderItemManager
.
findByQuery
(
q
.
addCriteria
(
c
));
List
<
LiteOrderItem
>
orderItems
=
liteOrderItemManager
.
findByQuery
(
q
.
addCriteria
(
c
));
if
(
orderItems
!=
null
&&
!
orderItems
.
isEmpty
())
{
if
(
orderItems
!=
null
&&
!
orderItems
.
isEmpty
())
{
newItems
=
newItems
.
stream
().
filter
(
t
->
!
t
.
getItemId
().
equals
(
item
.
getItemId
())).
collect
(
Collectors
.
toList
());
newItems
=
newItems
.
stream
().
filter
(
t
->
!
t
.
getItemId
().
equals
(
item
.
getItemId
())).
collect
(
Collectors
.
toList
());
log
.
info
(
"Mes缺料预警已经生成工单:"
+
item
.
getItemId
()
+
"PN为:"
+
item
.
getPartnumber
());
//
log.info("Mes缺料预警已经生成工单:" + item.getItemId() + "PN为:" + item.getPartnumber());
}
}
}
}
if
(
queueItemList
==
null
||
queueItemList
.
isEmpty
())
{
if
(
queueItemList
==
null
||
queueItemList
.
isEmpty
())
{
...
@@ -195,6 +196,7 @@ public class PreWarningItemCache {
...
@@ -195,6 +196,7 @@ public class PreWarningItemCache {
queueItemList
.
addAll
(
newItems
);
queueItemList
.
addAll
(
newItems
);
}
}
for
(
PreWarningItem
item
:
newItems
)
{
for
(
PreWarningItem
item
:
newItems
)
{
log
.
info
(
"mes缺料预警信息为:"
+
JSON
.
toJSONString
(
item
));
preWarningItemManager
.
save
(
item
);
preWarningItemManager
.
save
(
item
);
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/custom/lizhen/innerBox/util/StorageExportUtil.java
查看文件 @
c0583e4
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
innerBox
.
util
;
package
com
.
neotel
.
smfcore
.
custom
.
lizhen
.
innerBox
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.StorageExport
;
import
com.neotel.smfcore.custom.lizhen.innerBox.bean.StorageExport
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -11,6 +13,7 @@ import javax.annotation.PostConstruct;
...
@@ -11,6 +13,7 @@ import javax.annotation.PostConstruct;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
@Slf4j
@Component
@Component
public
class
StorageExportUtil
{
public
class
StorageExportUtil
{
...
@@ -21,6 +24,7 @@ public class StorageExportUtil {
...
@@ -21,6 +24,7 @@ public class StorageExportUtil {
dataCache
=
cache
;
dataCache
=
cache
;
}
}
public
static
final
String
OUT_STATION
=
"_outStation"
;
private
static
String
disableExport
=
""
;
private
static
String
disableExport
=
""
;
...
@@ -31,8 +35,19 @@ public class StorageExportUtil {
...
@@ -31,8 +35,19 @@ public class StorageExportUtil {
}
}
}
}
private
static
String
manualCheckoutExport
=
""
;
@Value
(
"${manualcheckout.export}"
)
void
setManualCheckoutExport
(
String
export
)
{
if
(
StringUtils
.
isNotBlank
(
export
))
{
manualCheckoutExport
=
export
;
}
}
//出料口名称
//出料口名称
private
final
String
[]
exportStr
=
new
String
[]{
"MU1_1"
,
"MU1_2"
,
"MU2_1"
,
"MU4_1"
,
"MU4_2"
,
"MU5_1"
,
"MU5_2"
};
private
final
static
String
[]
exportStr
=
new
String
[]{
"MU1_1"
,
"MU1_2"
,
"MU2_1"
,
"MU4_1"
,
"MU4_2"
,
"MU5_1"
,
"MU5_2"
};
//料仓前缀
//料仓前缀
private
static
final
String
EXPORT_PREFIX
=
"Storage_Export"
;
private
static
final
String
EXPORT_PREFIX
=
"Storage_Export"
;
...
@@ -49,13 +64,14 @@ public class StorageExportUtil {
...
@@ -49,13 +64,14 @@ public class StorageExportUtil {
storageExport
=
new
StorageExport
();
storageExport
=
new
StorageExport
();
}
}
exportMap
.
put
(
export
,
storageExport
);
exportMap
.
put
(
export
,
storageExport
);
dataCache
.
updateCache
(
EXPORT_PREFIX
+
"_"
+
export
,
storageExport
);
}
}
}
}
//根据工单号,获取目的地信息
//根据工单号,获取目的地信息
public
static
synchronized
String
getExportByOrderNo
(
String
orderNo
)
{
public
static
synchronized
String
getExportByOrderNo
(
String
orderNo
)
{
if
(
StringUtils
.
isBlank
(
orderNo
))
{
if
(
StringUtils
.
isBlank
(
orderNo
))
{
return
""
;
return
manualCheckoutExport
;
}
}
String
exportStr
=
""
;
String
exportStr
=
""
;
//判断是否有相同工单
//判断是否有相同工单
...
@@ -70,13 +86,16 @@ public class StorageExportUtil {
...
@@ -70,13 +86,16 @@ public class StorageExportUtil {
if
(
StringUtils
.
isBlank
(
exportStr
))
{
if
(
StringUtils
.
isBlank
(
exportStr
))
{
for
(
Map
.
Entry
<
String
,
StorageExport
>
entry
:
exportMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
StorageExport
>
entry
:
exportMap
.
entrySet
())
{
//判断是否有禁用工位信息
//判断是否有禁用工位信息
if
(
StringUtils
.
isNotBlank
(
disableExport
)){
if
(
StringUtils
.
isNotBlank
(
disableExport
))
{
if
(
disableExport
.
contains
(
entry
.
getKey
())){
if
(
disableExport
.
contains
(
entry
.
getKey
()))
{
continue
;
continue
;
}
}
}
}
if
(
entry
.
getKey
().
contains
(
StorageExportUtil
.
OUT_STATION
))
{
continue
;
}
StorageExport
export
=
entry
.
getValue
();
StorageExport
export
=
entry
.
getValue
();
if
(
StringUtils
.
isBlank
(
export
.
getHSerial
())){
if
(
StringUtils
.
isBlank
(
export
.
getHSerial
()))
{
exportStr
=
entry
.
getKey
();
exportStr
=
entry
.
getKey
();
break
;
break
;
}
}
...
@@ -89,21 +108,41 @@ public class StorageExportUtil {
...
@@ -89,21 +108,41 @@ public class StorageExportUtil {
//清空出料口信息
//清空出料口信息
public
static
void
clearExport
(
String
key
)
{
public
static
void
clearExport
(
String
key
)
{
if
(
exportMap
.
get
(
key
)
!=
null
)
{
if
(
exportMap
.
get
(
key
)
!=
null
)
{
log
.
info
(
"清除出料口信息为:"
+
JSON
.
toJSONString
(
exportMap
.
get
(
key
)));
StorageExport
storageExport
=
new
StorageExport
();
StorageExport
storageExport
=
new
StorageExport
();
exportMap
.
put
(
key
,
storageExport
);
exportMap
.
put
(
key
,
storageExport
);
dataCache
.
updateCache
(
EXPORT_PREFIX
+
"_"
+
key
,
storageExport
);
dataCache
.
updateCache
(
EXPORT_PREFIX
+
"_"
+
key
,
storageExport
);
}
}
}
}
public
static
void
updateExport
(
String
outlet
,
StorageExport
storageExport
){
public
static
void
updateExport
(
String
outlet
,
StorageExport
storageExport
)
{
exportMap
.
put
(
outlet
,
storageExport
);
boolean
hasOutLet
=
false
;
dataCache
.
updateCache
(
EXPORT_PREFIX
+
"_"
+
outlet
,
storageExport
);
for
(
String
export
:
exportStr
)
{
if
(
outlet
.
startsWith
(
export
))
{
hasOutLet
=
true
;
break
;
}
}
if
(
hasOutLet
)
{
exportMap
.
put
(
outlet
,
storageExport
);
dataCache
.
updateCache
(
EXPORT_PREFIX
+
"_"
+
outlet
,
storageExport
);
}
}
}
//更新出料口信息
//更新出料口信息
public
static
void
updateExport
(
String
key
,
String
hSerial
,
String
line
,
int
remainTaskCount
)
{
public
static
void
updateExport
(
String
key
,
String
hSerial
,
String
line
,
int
remainTaskCount
)
{
StorageExport
storageExport
=
exportMap
.
get
(
key
);
boolean
hasOutLet
=
false
;
if
(
storageExport
!=
null
)
{
for
(
String
export
:
exportStr
)
{
if
(
export
.
equals
(
key
))
{
hasOutLet
=
true
;
break
;
}
}
if
(
hasOutLet
)
{
StorageExport
storageExport
=
exportMap
.
get
(
key
);
if
(
storageExport
==
null
)
{
storageExport
=
new
StorageExport
();
}
if
(
StringUtils
.
isNotBlank
(
hSerial
))
{
if
(
StringUtils
.
isNotBlank
(
hSerial
))
{
storageExport
.
setHSerial
(
hSerial
);
storageExport
.
setHSerial
(
hSerial
);
}
}
...
@@ -111,7 +150,8 @@ public class StorageExportUtil {
...
@@ -111,7 +150,8 @@ public class StorageExportUtil {
storageExport
.
setLine
(
line
);
storageExport
.
setLine
(
line
);
}
}
storageExport
.
setRemainTaskCount
(
remainTaskCount
);
storageExport
.
setRemainTaskCount
(
remainTaskCount
);
exportMap
.
put
(
key
,
storageExport
);
//storageExport.setRemainTaskCount(100);
exportMap
.
put
(
key
,
storageExport
);
dataCache
.
updateCache
(
EXPORT_PREFIX
+
"_"
+
key
,
storageExport
);
dataCache
.
updateCache
(
EXPORT_PREFIX
+
"_"
+
key
,
storageExport
);
}
}
}
}
...
...
src/main/resources/log4j2-spring.xml
查看文件 @
c0583e4
...
@@ -3,11 +3,13 @@
...
@@ -3,11 +3,13 @@
<Properties>
<Properties>
<Property
name=
"LOG_HOME"
>
D:/Smflogs
</Property>
<Property
name=
"LOG_HOME"
>
D:/Smflogs
</Property>
<Property
name=
"LOG_NAME"
>
smf.txt
</Property>
<Property
name=
"LOG_NAME"
>
smf.txt
</Property>
<Property
name=
"LOG_MES"
>
mes.txt
</Property>
</Properties>
</Properties>
<appenders>
<appenders>
<Console
name=
"Console"
target=
"SYSTEM_OUT"
>
<Console
name=
"Console"
target=
"SYSTEM_OUT"
>
<PatternLayout
pattern=
"%d{yyyy-MM-dd HH:mm:ss:SSS} %-5level [%file:%line] - %msg%n"
/>
<PatternLayout
pattern=
"%d{yyyy-MM-dd HH:mm:ss:SSS} %-5level [%file:%line] - %msg%n"
/>
</Console>
</Console>
<RollingFile
name=
"log"
fileName=
"${LOG_HOME}/${LOG_NAME}"
filePattern=
"${LOG_HOME}/%d{yyyy-MM-dd}.${LOG_NAME}"
append=
"true"
>
<RollingFile
name=
"log"
fileName=
"${LOG_HOME}/${LOG_NAME}"
filePattern=
"${LOG_HOME}/%d{yyyy-MM-dd}.${LOG_NAME}"
append=
"true"
>
<PatternLayout
charset=
"GB18030"
pattern=
"%d{yyyy-MM-dd HH:mm:ss:SSS} %-5level [%file:%line] - %msg%n"
/>
<PatternLayout
charset=
"GB18030"
pattern=
"%d{yyyy-MM-dd HH:mm:ss:SSS} %-5level [%file:%line] - %msg%n"
/>
<Policies>
<Policies>
...
@@ -15,8 +17,27 @@
...
@@ -15,8 +17,27 @@
</Policies>
</Policies>
<DefaultRolloverStrategy
max=
"180"
/>
<DefaultRolloverStrategy
max=
"180"
/>
</RollingFile>
</RollingFile>
<RollingFile
name=
"lizhen"
fileName=
"${LOG_HOME}/${LOG_MES}"
filePattern=
"${LOG_HOME}/%d{yyyy-MM-dd}.${LOG_NAME}"
append=
"true"
>
<PatternLayout
charset=
"GB18030"
pattern=
"%d{yyyy-MM-dd HH:mm:ss:SSS} %-5level [%file:%line] - %msg%n"
/>
<Policies>
<TimeBasedTriggeringPolicy
modulate=
"true"
interval=
"1"
/>
</Policies>
<DefaultRolloverStrategy
max=
"180"
/>
</RollingFile>
</appenders>
</appenders>
<loggers>
<loggers>
<logger
name=
"com.neotel.smfcore.custom.lizhen.LizhenController"
level=
"INFO"
additivity=
"false"
>
<appender-ref
ref=
"Console"
/>
<appender-ref
ref=
"lizhen"
/>
</logger>
<logger
name=
"org"
level=
"WARN"
>
<logger
name=
"org"
level=
"WARN"
>
</logger>
</logger>
<logger
name=
"ro"
level=
"WARN"
>
<logger
name=
"ro"
level=
"WARN"
>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论