Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4e22f397
由
zshaohui
编写于
2023-10-25 15:53:24 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.增加云料仓看板功能
2.mimo增加呼叫agv 3.设备互联增加AGV,FUJINEOLINK,PANACIMNEOLINK类型 4.nexim功能提交
1 个父辈
10186043
全部展开
显示空白字符变更
内嵌
并排
正在显示
31 个修改的文件
包含
813 行增加
和
33 行删除
src/main/java/com/neotel/smfcore/common/init/MenuInit.java
src/main/java/com/neotel/smfcore/core/agv/AgvController.java
src/main/java/com/neotel/smfcore/core/agv/bean/AgvInfo.java
src/main/java/com/neotel/smfcore/core/agv/util/AgvCache.java
src/main/java/com/neotel/smfcore/core/dashboard/seconddashboard/SecondDashboardController.java
src/main/java/com/neotel/smfcore/core/device/util/EquipmentCache.java
src/main/java/com/neotel/smfcore/core/equipment/bean/EquipStatusBean.java
src/main/java/com/neotel/smfcore/core/equipment/enums/EquipmentType.java
src/main/java/com/neotel/smfcore/core/equipment/handler/impl/BaseEquipHandler.java
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipCommunicationController.java
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipViewController.java
src/main/java/com/neotel/smfcore/core/humiture/rest/HumitureController.java
src/main/java/com/neotel/smfcore/core/humiture/rest/bean/query/HumitureQueryCriteria.java
src/main/java/com/neotel/smfcore/core/system/util/EquipStatusUtil.java
src/main/java/com/neotel/smfcore/custom/nexim/NeximApi.java
src/main/java/com/neotel/smfcore/custom/nexim/bean/Notify.java
src/main/java/com/neotel/smfcore/custom/nexim/bean/OrderReq.java
src/main/java/com/neotel/smfcore/custom/nexim/bean/OrderResp.java
src/main/java/com/neotel/smfcore/custom/nexim/enums/Action.java
src/main/java/com/neotel/smfcore/custom/nexim/enums/ErrorCode.java
src/main/java/com/neotel/smfcore/custom/nexim/enums/NexObject.java
src/main/java/com/neotel/smfcore/custom/nexim/enums/OrderType.java
src/main/java/com/neotel/smfcore/custom/nexim/order/OrderCheckOutService.java
src/main/java/com/neotel/smfcore/custom/nexim/order/OrderHandler.java
src/main/java/com/neotel/smfcore/custom/nexim/util/NotifyUtil.java
src/main/java/com/neotel/smfcore/custom/nexim/util/OrderUtil.java
src/main/resources/messages.properties
src/main/resources/messages_en_US.properties
src/main/resources/messages_ja_JP.properties
src/main/resources/messages_zh_CN.properties
src/main/resources/messages_zh_TW.properties
src/main/java/com/neotel/smfcore/common/init/MenuInit.java
查看文件 @
4e22f39
...
@@ -116,6 +116,9 @@ public class MenuInit {
...
@@ -116,6 +116,9 @@ public class MenuInit {
//Mimo临时看板
//Mimo临时看板
addDefaultFunctionMenu
(
0
,
null
,
"SMD BOX MIMO"
,
"SMDBOXMIMO"
,
"smdBoxMimo/index"
,
"smdMimo"
);
addDefaultFunctionMenu
(
0
,
null
,
"SMD BOX MIMO"
,
"SMDBOXMIMO"
,
"smdBoxMimo/index"
,
"smdMimo"
);
//新的电子看板
addDefaultFunctionMenu
(
0
,
null
,
"云料仓看板"
,
"boxmimokanban"
,
"boxmimokanban/index"
,
"smdMimo"
);
//电子看板
//电子看板
addDefaultFunctionMenu
(
1
,
null
,
"电子看板"
,
"eleckanban"
,
"eleckanban/index"
,
"kanban"
);
addDefaultFunctionMenu
(
1
,
null
,
"电子看板"
,
"eleckanban"
,
"eleckanban/index"
,
"kanban"
);
...
...
src/main/java/com/neotel/smfcore/core/agv/AgvController.java
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
core
.
agv
;
package
com
.
neotel
.
smfcore
.
core
.
agv
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.core.agv.bean.AgvInfo
;
import
com.neotel.smfcore.core.agv.util.AgvCache
;
import
com.neotel.smfcore.core.agv.util.AgvCache
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -15,12 +14,32 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -15,12 +14,32 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RestController
public
class
AgvController
{
public
class
AgvController
{
@ApiOperation
(
"呼叫agv"
)
@RequestMapping
(
"/call"
)
@AnonymousAccess
public
ResultBean
call
()
{
boolean
callAgv
=
AgvCache
.
getCallAgv
();
if
(
callAgv
){
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.agv.already.call"
,
"已经呼叫"
);
}
AgvCache
.
updateCallAgv
(
true
);
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"定时请求agv是否呼叫"
)
@RequestMapping
(
"/agvIsAlready"
)
@AnonymousAccess
public
ResultBean
agvIsAlready
(){
return
ResultBean
.
newOkResult
(
AgvCache
.
getCallAgv
());
}
@ApiOperation
(
"
agv信息上传
"
)
@ApiOperation
(
"
完成呼叫
"
)
@RequestMapping
(
"/
agvInfoUpload
"
)
@RequestMapping
(
"/
finishCall
"
)
@AnonymousAccess
@AnonymousAccess
public
ResultBean
agvInfoUpload
(
@RequestBody
AgvInfo
agvInfo
)
{
public
ResultBean
finishCall
()
{
AgvCache
.
update
AgvInfo
(
agvInfo
);
AgvCache
.
update
CallAgv
(
false
);
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
""
);
}
}
}
}
src/main/java/com/neotel/smfcore/core/agv/bean/AgvInfo.java
查看文件 @
4e22f39
...
@@ -23,5 +23,5 @@ public class AgvInfo {
...
@@ -23,5 +23,5 @@ public class AgvInfo {
/**
/**
* 状态
* 状态
*/
*/
private
String
status
;
private
int
status
;
}
}
src/main/java/com/neotel/smfcore/core/agv/util/AgvCache.java
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
core
.
agv
.
util
;
package
com
.
neotel
.
smfcore
.
core
.
agv
.
util
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.neotel.smfcore.core.agv.bean.AgvInfo
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
@Component
@Component
public
class
AgvCache
{
public
class
AgvCache
{
public
static
Map
<
String
,
AgvInfo
>
agvInfoMap
=
Maps
.
newConcurrentMap
()
;
public
static
boolean
callAgv
=
false
;
public
static
void
updateAgvInfo
(
AgvInfo
agvInfo
){
public
static
void
updateCallAgv
(
boolean
isCall
)
{
String
name
=
agvInfo
.
getName
();
callAgv
=
isCall
;
agvInfoMap
.
put
(
name
,
agvInfo
);
}
}
public
static
Collection
<
AgvInfo
>
getAllAgvInfo
()
{
public
static
boolean
getCallAgv
()
{
return
agvInfoMap
.
values
()
;
return
callAgv
;
}
}
}
}
src/main/java/com/neotel/smfcore/core/dashboard/seconddashboard/SecondDashboardController.java
查看文件 @
4e22f39
...
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.core.agv.bean.AgvInfo
;
import
com.neotel.smfcore.core.agv.util.AgvCache
;
import
com.neotel.smfcore.core.agv.util.AgvCache
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.dashboard.bean.dto.seconddashboard.MachineStatusDto
;
import
com.neotel.smfcore.core.dashboard.bean.dto.seconddashboard.MachineStatusDto
;
...
@@ -12,10 +13,13 @@ import com.neotel.smfcore.core.dashboard.bean.dto.seconddashboard.UpcomingExpira
...
@@ -12,10 +13,13 @@ import com.neotel.smfcore.core.dashboard.bean.dto.seconddashboard.UpcomingExpira
import
com.neotel.smfcore.core.device.bean.BoxStatusBean
;
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.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.equipment.enums.EquipmentType
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.EquipStatusUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -26,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -26,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -134,14 +139,24 @@ public class SecondDashboardController {
...
@@ -134,14 +139,24 @@ public class SecondDashboardController {
@RequestMapping
(
"agv"
)
@RequestMapping
(
"agv"
)
@AnonymousAccess
@AnonymousAccess
public
ResultBean
agv
()
{
public
ResultBean
agv
()
{
return
ResultBean
.
newOkResult
(
AgvCache
.
getAllAgvInfo
());
}
public
static
void
main
(
String
[]
args
)
{
List
<
AgvInfo
>
agvCacheList
=
new
ArrayList
<>();
String
dateStr
=
"2023-11-23 00:00:00"
;
Collection
<
EquipStatusBean
>
allStatusBean
=
EquipStatusUtil
.
getAllStatusBean
();
DateTime
dateTime
=
DateUtil
.
parse
(
dateStr
,
"yyyy-MM-dd HH:mm:ss"
);
if
(
allStatusBean
!=
null
&&
!
allStatusBean
.
isEmpty
())
{
long
between
=
DateUtil
.
between
(
new
Date
(),
dateTime
,
DateUnit
.
DAY
,
false
);
for
(
EquipStatusBean
statusBean
:
allStatusBean
)
{
System
.
out
.
println
(
between
);
if
(
statusBean
.
getType
().
equals
(
EquipmentType
.
AGV
.
name
())){
AgvInfo
agvInfo
=
new
AgvInfo
();
agvInfo
.
setName
(
statusBean
.
getName
());
if
(
statusBean
.
timeOut
()){
agvInfo
.
setStatus
(
0
);
}
else
{
agvInfo
.
setStatus
(
statusBean
.
getStatus
());
}
agvInfo
.
setElec
(
statusBean
.
getData
().
get
(
"elec"
).
toString
());
agvCacheList
.
add
(
agvInfo
);
}
}
}
return
ResultBean
.
newOkResult
(
agvCacheList
);
}
}
}
}
src/main/java/com/neotel/smfcore/core/device/util/EquipmentCache.java
查看文件 @
4e22f39
...
@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.device.util;
...
@@ -2,6 +2,7 @@ package com.neotel.smfcore.core.device.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.StringUtils
;
import
com.neotel.smfcore.core.equipment.service.manager.IEquipmentManager
;
import
com.neotel.smfcore.core.equipment.service.manager.IEquipmentManager
;
import
com.neotel.smfcore.core.equipment.service.po.Equipment
;
import
com.neotel.smfcore.core.equipment.service.po.Equipment
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -86,7 +87,7 @@ public class EquipmentCache {
...
@@ -86,7 +87,7 @@ public class EquipmentCache {
}
}
}
}
public
Equipment
autoCreateEquip
(
String
cid
,
String
type
)
{
public
Equipment
autoCreateEquip
(
String
name
,
String
cid
,
String
type
)
{
//判断cid存在
//判断cid存在
Equipment
equipment
=
null
;
Equipment
equipment
=
null
;
equipment
=
getEquipment
(
cid
);
equipment
=
getEquipment
(
cid
);
...
@@ -101,7 +102,11 @@ public class EquipmentCache {
...
@@ -101,7 +102,11 @@ public class EquipmentCache {
equipment
=
new
Equipment
();
equipment
=
new
Equipment
();
equipment
.
setCid
(
cid
);
equipment
.
setCid
(
cid
);
equipment
.
setType
(
type
);
equipment
.
setType
(
type
);
if
(
StringUtils
.
isNotBlank
(
name
)){
equipment
.
setName
(
name
);
}
else
{
equipment
.
setName
(
cid
);
equipment
.
setName
(
cid
);
}
equipment
=
equipmentManager
.
save
(
equipment
);
equipment
=
equipmentManager
.
save
(
equipment
);
reloadEquipment
(
equipment
,
""
);
reloadEquipment
(
equipment
,
""
);
...
...
src/main/java/com/neotel/smfcore/core/equipment/bean/EquipStatusBean.java
查看文件 @
4e22f39
...
@@ -17,6 +17,11 @@ public class EquipStatusBean implements Serializable {
...
@@ -17,6 +17,11 @@ public class EquipStatusBean implements Serializable {
private
String
cid
;
private
String
cid
;
/**
/**
* 设备名称
*/
private
String
name
;
/**
* 设备类型 ,NEOSCAN=扫码贴标,COUNTING=点料机
* 设备类型 ,NEOSCAN=扫码贴标,COUNTING=点料机
*/
*/
private
String
type
=
EquipmentType
.
AUTO
.
name
();
private
String
type
=
EquipmentType
.
AUTO
.
name
();
...
@@ -87,7 +92,10 @@ public class EquipStatusBean implements Serializable {
...
@@ -87,7 +92,10 @@ public class EquipStatusBean implements Serializable {
}
}
public
void
addData
(
String
key
,
String
value
)
{
public
void
addData
(
String
key
,
String
value
)
{
String
oldValue
=
data
.
get
(
key
).
toString
();
String
oldValue
=
""
;
if
(
data
.
get
(
key
)
!=
null
){
oldValue
=
data
.
get
(
key
).
toString
();
}
String
valueStr
=
value
;
String
valueStr
=
value
;
if
(!
Strings
.
isNullOrEmpty
(
oldValue
))
{
if
(!
Strings
.
isNullOrEmpty
(
oldValue
))
{
valueStr
=
valueStr
+
"|"
+
oldValue
;
valueStr
=
valueStr
+
"|"
+
oldValue
;
...
@@ -95,12 +103,14 @@ public class EquipStatusBean implements Serializable {
...
@@ -95,12 +103,14 @@ public class EquipStatusBean implements Serializable {
data
.
put
(
key
,
valueStr
);
data
.
put
(
key
,
valueStr
);
}
}
public
EquipMsg
getMsgByType
(
String
type
){
public
EquipMsg
getMsgByType
(
String
type
)
{
for
(
EquipMsg
msg
:
getMsgList
()){
if
(
msgList
!=
null
&&
!
msgList
.
isEmpty
())
{
if
(
msg
.
getType
().
equals
(
type
)){
for
(
EquipMsg
msg
:
msgList
)
{
if
(
msg
.
getType
().
equals
(
type
))
{
return
msg
;
return
msg
;
}
}
}
}
}
return
null
;
return
null
;
}
}
...
...
src/main/java/com/neotel/smfcore/core/equipment/enums/EquipmentType.java
查看文件 @
4e22f39
...
@@ -25,4 +25,20 @@ public enum EquipmentType {
...
@@ -25,4 +25,20 @@ public enum EquipmentType {
* 3 插件机
* 3 插件机
*/
*/
NEOSTATION
(),
NEOSTATION
(),
/**
* 4 FUJINEOLINK
*/
FUJINEOLINK
(),
/**
* 5 PANACIMNEOLINK
*/
PANACIMNEOLINK
(),
/**
* 6 AGV
*/
AGV
()
}
}
src/main/java/com/neotel/smfcore/core/equipment/handler/impl/BaseEquipHandler.java
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
handler
.
impl
;
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
handler
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.neotel.smfcore.core.agv.util.AgvCache
;
import
com.neotel.smfcore.core.equipment.bean.EquipMsg
;
import
com.neotel.smfcore.core.equipment.bean.EquipMsg
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.equipment.enums.EquipmentType
;
import
com.neotel.smfcore.core.equipment.enums.EquipmentType
;
...
@@ -19,6 +20,15 @@ public class BaseEquipHandler implements IEquipmentHandler {
...
@@ -19,6 +20,15 @@ public class BaseEquipHandler implements IEquipmentHandler {
statusBean
.
setClientIp
(
request
.
getRemoteHost
());
statusBean
.
setClientIp
(
request
.
getRemoteHost
());
handleMsg
(
statusBean
);
handleMsg
(
statusBean
);
//处理AGV调度
if
(
statusBean
.
getType
().
equals
(
EquipmentType
.
AGV
.
name
())){
boolean
callAgv
=
AgvCache
.
getCallAgv
();
if
(
callAgv
){
statusBean
.
addData
(
"call"
,
"1"
);
}
else
{
statusBean
.
addData
(
"call"
,
"0"
);
}
}
return
statusBean
;
return
statusBean
;
}
}
/**
/**
...
...
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipCommunicationController.java
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
rest
;
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
rest
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.device.util.EquipmentCache
;
import
com.neotel.smfcore.core.device.util.EquipmentCache
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.equipment.enums.EquipmentType
;
import
com.neotel.smfcore.core.equipment.enums.EquipmentType
;
...
@@ -41,15 +42,23 @@ public class EquipCommunicationController {
...
@@ -41,15 +42,23 @@ public class EquipCommunicationController {
public
EquipStatusBean
communication
(
@RequestBody
final
EquipStatusBean
statusBean
,
HttpServletRequest
request
)
{
public
EquipStatusBean
communication
(
@RequestBody
final
EquipStatusBean
statusBean
,
HttpServletRequest
request
)
{
try
{
try
{
String
cid
=
statusBean
.
getCid
();
String
cid
=
statusBean
.
getCid
();
String
name
=
statusBean
.
getName
();
Equipment
equipment
=
equipmentCache
.
getEquipment
(
cid
);
Equipment
equipment
=
equipmentCache
.
getEquipment
(
cid
);
if
(
equipment
==
null
)
{
if
(
equipment
==
null
)
{
equipment
=
equipmentCache
.
autoCreateEquip
(
cid
,
statusBean
.
getType
());
equipment
=
equipmentCache
.
autoCreateEquip
(
name
,
cid
,
statusBean
.
getType
());
if
(
equipment
!=
null
)
{
if
(
equipment
!=
null
)
{
log
.
error
(
"设备cid: ["
+
cid
+
"]不存在,自动创建设备完成"
);
log
.
error
(
"设备cid: ["
+
cid
+
"]不存在,自动创建设备完成"
);
}
else
{
}
else
{
log
.
error
(
"设备cid: ["
+
cid
+
"]不存在,自动创建设备失败"
);
log
.
error
(
"设备cid: ["
+
cid
+
"]不存在,自动创建设备失败"
);
return
null
;
return
null
;
}
}
}
else
{
if
(
StringUtils
.
isNotBlank
(
name
)){
if
(!
name
.
equals
(
equipment
.
getName
())){
equipment
.
setName
(
name
);
equipment
=
equipmentCache
.
reloadEquipment
(
equipment
,
equipment
.
getCid
());
}
}
}
}
synchronized
(
equipment
)
{
synchronized
(
equipment
)
{
String
deviceType
=
equipment
.
getType
();
String
deviceType
=
equipment
.
getType
();
...
...
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipViewController.java
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
rest
;
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
rest
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.EquipmentCache
;
import
com.neotel.smfcore.core.device.util.EquipmentCache
;
import
com.neotel.smfcore.core.equipment.bean.EquipMsg
;
import
com.neotel.smfcore.core.equipment.bean.EquipMsg
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
import
com.neotel.smfcore.core.equipment.bean.EquipStatusBean
;
...
@@ -7,6 +9,9 @@ import com.neotel.smfcore.core.equipment.bean.EquipStatusDto;
...
@@ -7,6 +9,9 @@ import com.neotel.smfcore.core.equipment.bean.EquipStatusDto;
import
com.neotel.smfcore.core.equipment.service.po.Equipment
;
;
import
com.neotel.smfcore.core.equipment.service.po.Equipment
;
;
import
com.neotel.smfcore.core.message.enums.MessageType
;
import
com.neotel.smfcore.core.message.enums.MessageType
;
import
com.neotel.smfcore.core.message.service.po.Message
;
import
com.neotel.smfcore.core.message.service.po.Message
;
import
com.neotel.smfcore.core.storage.enums.DeviceType
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.util.DevicesStatusUtil
;
import
com.neotel.smfcore.core.system.util.EquipStatusUtil
;
import
com.neotel.smfcore.core.system.util.EquipStatusUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -19,10 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -19,10 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Map
;
@Slf4j
@Slf4j
...
@@ -35,6 +37,9 @@ public class EquipViewController {
...
@@ -35,6 +37,9 @@ public class EquipViewController {
@Autowired
@Autowired
private
EquipmentCache
equipmentCache
;
private
EquipmentCache
equipmentCache
;
@Autowired
private
DataCache
dataCache
;
@ApiOperation
(
"获取看板数据"
)
@ApiOperation
(
"获取看板数据"
)
@GetMapping
@GetMapping
@PreAuthorize
(
"@el.check('equipmentView:info')"
)
@PreAuthorize
(
"@el.check('equipmentView:info')"
)
...
@@ -72,8 +77,24 @@ public class EquipViewController {
...
@@ -72,8 +77,24 @@ public class EquipViewController {
// }
// }
}
}
}
}
resultList
.
add
(
dto
);
}
//再把NLL加进去
Collection
<
Storage
>
storages
=
dataCache
.
getAllStorage
().
values
();
for
(
Storage
storage
:
storages
)
{
if
(
storage
.
getType
().
equals
(
DeviceType
.
NLL
.
name
())){
EquipStatusDto
dto
=
new
EquipStatusDto
(
storage
.
getId
(),
storage
.
getName
(),
storage
.
getCid
(),
false
,
0
,
""
,
storage
.
getType
());
StatusBean
bean
=
DevicesStatusUtil
.
getStatusBean
(
storage
.
getCid
());
if
(
bean
==
null
||
bean
.
timeOut
()){
dto
.
setOnLine
(
false
);
}
else
{
dto
.
setOnLine
(
true
);
}
resultList
.
add
(
dto
);
resultList
.
add
(
dto
);
}
}
}
return
resultList
;
return
resultList
;
}
}
}
}
src/main/java/com/neotel/smfcore/core/humiture/rest/HumitureController.java
查看文件 @
4e22f39
...
@@ -52,14 +52,24 @@ public class HumitureController {
...
@@ -52,14 +52,24 @@ public class HumitureController {
Float
maxHumidity
=
msdSettiings
.
getMaxHumidity
();
Float
maxHumidity
=
msdSettiings
.
getMaxHumidity
();
Float
minTemperature
=
msdSettiings
.
getMinTemperature
();
Float
minTemperature
=
msdSettiings
.
getMinTemperature
();
Float
minHumidity
=
msdSettiings
.
getMinHumidity
();
Float
minHumidity
=
msdSettiings
.
getMinHumidity
();
List
<
String
>
cids
=
criteria
.
getCids
();
List
<
String
>
cids
=
criteria
.
getCids
();
String
storageId
=
criteria
.
getStorageId
();
if
(
StringUtils
.
isNotBlank
(
storageId
)){
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
cids
==
null
||
cids
.
isEmpty
()){
cids
=
new
ArrayList
<>();
}
cids
.
add
(
storage
.
getCid
());
criteria
.
setCids
(
cids
);
}
if
(
cids
==
null
||
cids
.
isEmpty
())
{
if
(
cids
==
null
||
cids
.
isEmpty
())
{
criteria
.
setCids
(
SecurityUtils
.
getUserGroupCid
());
criteria
.
setCids
(
SecurityUtils
.
getUserGroupCid
());
}
}
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"createDate"
));
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"createDate"
));
query
.
addCriteria
(
Criteria
.
where
(
"temperature"
).
ne
(
"0"
));
query
.
addCriteria
(
Criteria
.
where
(
"temperature"
).
ne
(
"0"
)
.
exists
(
true
)
);
PageData
<
Humiture
>
humitureList
=
humitureManager
.
findByPage
(
query
,
pageable
);
PageData
<
Humiture
>
humitureList
=
humitureManager
.
findByPage
(
query
,
pageable
);
HumitureDto
restultDto
=
new
HumitureDto
();
HumitureDto
restultDto
=
new
HumitureDto
();
restultDto
.
setMaxHumidity
(
maxHumidity
);
restultDto
.
setMaxHumidity
(
maxHumidity
);
...
@@ -90,6 +100,16 @@ public class HumitureController {
...
@@ -90,6 +100,16 @@ public class HumitureController {
Float
maxTemperature
=
msdSettiings
.
getMaxTemperature
();
Float
maxTemperature
=
msdSettiings
.
getMaxTemperature
();
Float
maxHumidity
=
msdSettiings
.
getMaxHumidity
();
Float
maxHumidity
=
msdSettiings
.
getMaxHumidity
();
List
<
String
>
cids
=
criteria
.
getCids
();
List
<
String
>
cids
=
criteria
.
getCids
();
String
storageId
=
criteria
.
getStorageId
();
if
(
StringUtils
.
isNotBlank
(
storageId
)){
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
cids
==
null
||
cids
.
isEmpty
()){
cids
=
new
ArrayList
<>();
}
cids
.
add
(
storage
.
getCid
());
}
if
(
cids
==
null
||
cids
.
isEmpty
())
{
if
(
cids
==
null
||
cids
.
isEmpty
())
{
criteria
.
setCids
(
SecurityUtils
.
getUserGroupCid
());
criteria
.
setCids
(
SecurityUtils
.
getUserGroupCid
());
}
}
...
...
src/main/java/com/neotel/smfcore/core/humiture/rest/bean/query/HumitureQueryCriteria.java
查看文件 @
4e22f39
...
@@ -25,4 +25,7 @@ public class HumitureQueryCriteria {
...
@@ -25,4 +25,7 @@ public class HumitureQueryCriteria {
@QueryCondition
(
type
=
QueryCondition
.
Type
.
BETWEEN
,
propName
=
"createDate"
)
@QueryCondition
(
type
=
QueryCondition
.
Type
.
BETWEEN
,
propName
=
"createDate"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
BetweenData
<
Date
>
createDate
;
private
BetweenData
<
Date
>
createDate
;
private
String
storageId
;
}
}
src/main/java/com/neotel/smfcore/core/system/util/EquipStatusUtil.java
查看文件 @
4e22f39
...
@@ -6,6 +6,7 @@ import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
...
@@ -6,6 +6,7 @@ import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -37,6 +38,13 @@ public class EquipStatusUtil {
...
@@ -37,6 +38,13 @@ public class EquipStatusUtil {
statusMap
.
put
(
statusBean
.
getCid
(),
statusBean
);
statusMap
.
put
(
statusBean
.
getCid
(),
statusBean
);
}
}
/**
* 获取所有的设备信息
* @return
*/
public
static
Collection
<
EquipStatusBean
>
getAllStatusBean
(){
return
statusMap
.
values
();
}
public
static
void
runTimer
()
{
public
static
void
runTimer
()
{
try
{
try
{
...
...
src/main/java/com/neotel/smfcore/custom/nexim/NeximApi.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.SmbUtil
;
import
com.neotel.smfcore.core.api.listener.BaseSmfApiListener
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.custom.nexim.bean.Notify
;
import
com.neotel.smfcore.custom.nexim.enums.Action
;
import
com.neotel.smfcore.custom.nexim.enums.NexObject
;
import
com.neotel.smfcore.custom.nexim.util.NotifyUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
java.io.File
;
@Service
@Slf4j
public
class
NeximApi
extends
BaseSmfApiListener
{
private
final
String
remoteFilePath
=
"smb://192.168.1.243/Test/"
;
@Override
public
boolean
isForThisApi
(
String
apiName
)
{
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"nexim"
);
}
@Override
public
void
inTaskStatusChange
(
String
inNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
())
{
Notify
notify
=
NotifyUtil
.
getNotifyByTask
(
Action
.
LOAD
.
name
(),
NexObject
.
CARRIER
.
name
(),
task
);
//创建本地文件
String
localFilePath
=
NotifyUtil
.
getLocalFilePathByNotify
(
notify
);
boolean
put
=
SmbUtil
.
smbPut
(
remoteFilePath
,
localFilePath
);
log
.
info
(
localFilePath
+
"入库通知结果为:"
+
put
);
FileUtil
.
del
(
new
File
(
localFilePath
));
}
}
@Override
public
void
outTaskStatusChange
(
String
outNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
())
{
Notify
notify
=
NotifyUtil
.
getNotifyByTask
(
Action
.
PROVIDE
.
name
(),
NexObject
.
CARRIER
.
name
(),
task
);
//创建本地文件
String
localFilePath
=
NotifyUtil
.
getLocalFilePathByNotify
(
notify
);
boolean
put
=
SmbUtil
.
smbPut
(
remoteFilePath
,
localFilePath
);
log
.
info
(
localFilePath
+
"出库通知结果为:"
+
put
);
FileUtil
.
del
(
new
File
(
localFilePath
));
}
}
}
src/main/java/com/neotel/smfcore/custom/nexim/bean/Notify.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
bean
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
Notify
implements
Serializable
{
/**
* action NEW = Object (item or carrier) creation
* DELETE = Object (item or carrier) deletion
* LOAD = Carrier check in
* PROVIDE = Carrier check out
*/
private
String
action
;
/**
* object ARTICLE or CARRIER
*/
private
String
object
;
/**
* objectname Item or carrier name(DID)
*/
private
String
name
;
/**
* Date of Action、yyyymmdd format
*/
private
String
date
;
/**
* Action Time
*/
private
String
time
;
/**
* Job name
*/
private
String
jobName
;
/**
* storage location (Only if object=CARRIER)
*/
private
String
depot
;
/**
* Item designation (Only if object=CARRIER)
*/
private
String
demand
;
/**
* Current carrier's parts inventory or total inventory of the item
*/
private
int
stock
;
}
\ No newline at end of file
\ No newline at end of file
src/main/java/com/neotel/smfcore/custom/nexim/bean/OrderReq.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
bean
;
import
lombok.Data
;
@Data
public
class
OrderReq
{
private
String
action
;
private
String
object
;
private
String
name
;
private
String
date
;
private
String
time
;
private
String
depot
;
private
String
stock
;
private
String
expiry
;
private
String
mSL
;
private
String
mSLWATCH
;
private
String
stockMin
;
private
String
stockMax
;
private
String
reelsMin
;
private
String
reelsMax
;
private
String
height
;
private
String
diameter
;
private
String
supply
;
private
String
stockNew
;
private
String
article
;
private
String
units
;
private
String
target
;
private
String
forceTower
;
private
String
demand
;
private
String
los
;
}
src/main/java/com/neotel/smfcore/custom/nexim/bean/OrderResp.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
bean
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
public
class
OrderResp
extends
OrderReq
{
private
String
answer
=
"TRUE"
;
private
int
error
;
private
String
carrier
;
private
String
values
;
private
List
<
String
>
carrierNameList
;
public
void
setCarrierNameList
(
String
carrierName
)
{
if
(
carrierNameList
==
null
||
carrierNameList
.
isEmpty
()){
carrierNameList
=
new
ArrayList
<>();
}
this
.
carrierNameList
.
add
(
carrierName
);
}
}
src/main/java/com/neotel/smfcore/custom/nexim/enums/Action.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
enums
;
/**
* Action 类型
*/
public
enum
Action
{
/**
* Object (item or carrier) creation
*/
NEW
,
/**
* Object (item or carrier) deletion
*/
DELETE
,
/**
* Carrier check in
*/
LOAD
,
/**
* Carrier check out
*/
PROVIDE
,
/**
* 修改
*/
UPDATE
,
/**
* 读取
*/
READ
}
src/main/java/com/neotel/smfcore/custom/nexim/enums/ErrorCode.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
enums
;
public
class
ErrorCode
{
public
static
final
int
ok
=
0
;
public
static
final
int
lockingError
=
1
;
public
static
final
int
unknownAction
=
9
;
}
src/main/java/com/neotel/smfcore/custom/nexim/enums/NexObject.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
enums
;
public
enum
NexObject
{
/**
* 料号
*/
ARTICLE
,
/**
* 唯一码
*/
CARRIER
,
/**
* 工单
*/
JOBLIST
}
src/main/java/com/neotel/smfcore/custom/nexim/enums/OrderType.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
enums
;
public
class
OrderType
{
public
static
final
String
order
=
"[Order]"
;
public
static
final
String
result
=
"[Result]"
;
public
static
final
String
data
=
"[Data]"
;
}
src/main/java/com/neotel/smfcore/custom/nexim/order/OrderCheckOutService.java
0 → 100644
查看文件 @
4e22f39
此文件的差异被折叠,
点击展开。
src/main/java/com/neotel/smfcore/custom/nexim/order/OrderHandler.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
order
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.common.utils.*
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.device.enums.OP
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
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.LiteOrderItem
;
import
com.neotel.smfcore.core.storage.enums.CHECKOUT_TYPE
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.nexim.bean.OrderReq
;
import
com.neotel.smfcore.custom.nexim.bean.OrderResp
;
import
com.neotel.smfcore.custom.nexim.enums.Action
;
import
com.neotel.smfcore.custom.nexim.enums.ErrorCode
;
import
com.neotel.smfcore.custom.nexim.enums.NexObject
;
import
com.neotel.smfcore.custom.nexim.enums.OrderType
;
import
com.neotel.smfcore.custom.nexim.util.OrderUtil
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
jcifs.smb.SmbFile
;
import
lombok.SneakyThrows
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.logging.log4j.util.Strings
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
javax.annotation.PostConstruct
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.*
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
@Slf4j
@Component
public
class
OrderHandler
{
private
static
IStoragePosManager
storagePosManager
;
@Autowired
public
void
setStoragePosManager
(
IStoragePosManager
manager
)
{
storagePosManager
=
manager
;
}
private
static
IBarcodeManager
barcodeManager
;
@Autowired
public
void
setBarcodeManager
(
IBarcodeManager
manager
)
{
barcodeManager
=
manager
;
}
private
static
DataCache
dataCache
;
@Autowired
public
void
setDataCache
(
DataCache
cache
)
{
dataCache
=
cache
;
}
private
static
TaskService
taskService
;
@Autowired
public
void
setTaskService
(
TaskService
service
)
{
taskService
=
service
;
}
private
static
ILiteOrderManager
liteOrderManager
;
@Autowired
public
void
setLiteOrderManager
(
ILiteOrderManager
manager
)
{
liteOrderManager
=
manager
;
}
private
static
LiteOrderCache
liteOrderCache
;
@Autowired
public
void
setLiteOrderCache
(
LiteOrderCache
cache
)
{
liteOrderCache
=
cache
;
}
private
static
OrderCheckOutService
checkOutService
;
@Autowired
public
void
setOrderCheckOutService
(
OrderCheckOutService
service
)
{
checkOutService
=
service
;
}
ScheduledExecutorService
scheduledThreadPool
=
Executors
.
newScheduledThreadPool
(
1
);
/*@PostConstruct
public void init() {
scheduledThreadPool.scheduleAtFixedRate(() -> {
try {
handler();
} catch (IOException e) {
e.printStackTrace();
}
}, 10, 5, TimeUnit.SECONDS);
}*/
public
static
void
handler
()
throws
IOException
{
String
path
=
dataCache
.
getOrderSetting
().
getOrderDir
();
File
file
=
new
File
(
path
);
if
(
file
.
exists
()
&&
file
.
isDirectory
())
{
File
[]
files
=
file
.
listFiles
();
List
<
File
>
fileList
=
Arrays
.
stream
(
files
).
sorted
(
Comparator
.
comparing
(
File:
:
lastModified
).
reversed
()).
collect
(
Collectors
.
toList
());
File
currentFile
=
fileList
.
get
(
0
);
List
<
String
>
lineList
=
OrderUtil
.
getLines
(
currentFile
.
getAbsolutePath
(),
StandardCharsets
.
US_ASCII
);
String
orderName
=
""
;
List
<
LiteOrderItem
>
orderItemList
=
new
ArrayList
<>();
for
(
String
line
:
lineList
)
{
if
(
line
.
split
(
"="
).
length
<
2
)
{
continue
;
}
String
value
=
line
.
split
(
"="
)[
1
];
if
(
line
.
startsWith
(
"Name"
))
{
orderName
=
value
;
}
if
(
line
.
startsWith
(
"Item"
))
{
String
[]
itemStr
=
value
.
split
(
"\\|"
,
-
1
);
LiteOrderItem
item
=
new
LiteOrderItem
();
item
.
setPn
(
itemStr
[
0
]);
item
.
setRi
(
itemStr
[
1
]);
int
needNum
=
1
;
try
{
needNum
=
Integer
.
valueOf
(
itemStr
[
2
]);
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
}
item
.
setNeedNum
(
needNum
);
int
needReelCount
=
1
;
try
{
needReelCount
=
Integer
.
valueOf
(
itemStr
[
3
]);
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
}
item
.
setNeedReelCount
(
needReelCount
);
orderItemList
.
add
(
item
);
}
}
LiteOrder
liteOrder
=
liteOrderManager
.
findByOrderNo
(
orderName
);
if
(
liteOrder
!=
null
)
{
return
;
}
LiteOrder
order
=
new
LiteOrder
();
order
.
setOrderItems
(
orderItemList
);
order
.
setOrderNo
(
orderName
);
liteOrderManager
.
createWithItems
(
order
);
liteOrderCache
.
addOrderToMap
(
order
);
checkOutService
.
checkOutLiteOrder
(
orderName
,
false
,
false
);
}
}
}
src/main/java/com/neotel/smfcore/custom/nexim/util/NotifyUtil.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
util
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.custom.nexim.bean.Notify
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.util.Date
;
@Slf4j
public
class
NotifyUtil
{
public
static
final
String
CHARSET_NAME
=
"ASCII"
;
public
static
Notify
getNotifyByTask
(
String
action
,
String
obj
,
DataLog
task
){
Notify
notify
=
new
Notify
();
notify
.
setAction
(
action
);
notify
.
setObject
(
obj
);
notify
.
setName
(
task
.
getBarcode
());
String
dateStr
=
DateUtil
.
format
(
new
Date
(),
"yyyyMMdd HH:mm:ss"
);
String
[]
date
=
dateStr
.
split
(
" "
);
notify
.
setDate
(
date
[
0
]);
notify
.
setTime
(
date
[
1
]);
if
(
StringUtils
.
isNotBlank
(
task
.
getSourceId
())){
notify
.
setJobName
(
task
.
getSourceName
());
}
else
{
notify
.
setJobName
(
""
);
}
notify
.
setDepot
(
task
.
getStorageName
());
notify
.
setDemand
(
task
.
getPosName
());
notify
.
setStock
(
task
.
getNum
());
return
notify
;
}
/**
* 出入库通知,获取本地路径
* @param notify
* @return
*/
public
static
String
getLocalFilePathByNotify
(
Notify
notify
)
{
String
localFilePath
=
notify
.
getName
()
+
".ETN"
;
log
.
info
(
"本地文件路径为:"
+
localFilePath
);
log
.
info
(
"内容为:"
+
JSON
.
toJSONString
(
notify
));
File
file
=
new
File
(
localFilePath
);
//创建一个文件
OutputStreamWriter
out
=
null
;
try
{
out
=
new
OutputStreamWriter
(
new
FileOutputStream
(
file
),
CHARSET_NAME
);
//打开文件输出流
out
.
write
(
"Action="
+
notify
.
getAction
());
out
.
write
(
'\r'
);
out
.
write
(
"Object="
+
notify
.
getObject
());
out
.
write
(
'\r'
);
out
.
write
(
"Name="
+
notify
.
getName
());
out
.
write
(
'\r'
);
out
.
write
(
"Date="
+
notify
.
getDate
());
out
.
write
(
'\r'
);
out
.
write
(
"Time="
+
notify
.
getTime
());
out
.
write
(
'\r'
);
out
.
write
(
"JOBNAME="
+
notify
.
getJobName
());
out
.
write
(
'\r'
);
out
.
write
(
"Depot="
+
notify
.
getDepot
());
out
.
write
(
'\r'
);
out
.
write
(
"Demand="
+
notify
.
getDemand
());
out
.
write
(
'\r'
);
out
.
write
(
"Stock="
+
notify
.
getStock
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
//内容总执行
if
(
out
!=
null
)
{
try
{
out
.
close
();
//关闭输出文件流
}
catch
(
IOException
el
)
{
}
}
}
return
localFilePath
;
}
}
src/main/java/com/neotel/smfcore/custom/nexim/util/OrderUtil.java
0 → 100644
查看文件 @
4e22f39
package
com
.
neotel
.
smfcore
.
custom
.
nexim
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.neotel.smfcore.common.utils.FileUtil
;
import
com.neotel.smfcore.common.utils.SmbUtil
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.custom.nexim.bean.Notify
;
import
com.neotel.smfcore.custom.nexim.bean.OrderReq
;
import
com.neotel.smfcore.custom.nexim.bean.OrderResp
;
import
com.neotel.smfcore.custom.nexim.enums.OrderType
;
import
jcifs.smb.SmbFile
;
import
lombok.extern.slf4j.Slf4j
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Slf4j
public
class
OrderUtil
{
//获取到远程最新的文件
public
static
SmbFile
getLatestFile
(
String
path
)
{
List
<
SmbFile
>
smbFileNameList
=
SmbUtil
.
smbFileList
(
path
);
if
(
smbFileNameList
!=
null
&&
!
smbFileNameList
.
isEmpty
())
{
smbFileNameList
=
smbFileNameList
.
stream
().
sorted
(
Comparator
.
comparing
(
SmbFile:
:
getDate
).
reversed
()).
collect
(
Collectors
.
toList
());
return
smbFileNameList
.
get
(
0
);
}
return
null
;
}
/**
* 获取所有的line信息
* @param filePath
* @param cs
* @return
* @throws IOException
*/
public
static
List
<
String
>
getLines
(
String
filePath
,
Charset
cs
)
throws
IOException
{
Path
path
=
Paths
.
get
(
filePath
);
return
Files
.
readAllLines
(
path
,
cs
);
}
/**
* 获取本地路径
* @param localPath
* @param name
* @param lineList
* @param cs
* @return
*/
public
static
String
getLocalFilePathByOrder
(
String
localPath
,
String
name
,
List
<
String
>
lineList
,
Charset
cs
)
{
String
localFilePath
=
""
;
OutputStreamWriter
out
=
null
;
try
{
localFilePath
=
localPath
+
name
;
log
.
info
(
"本地文件路径为:"
+
localFilePath
);
File
file
=
new
File
(
localFilePath
);
//创建一个文件
File
fileParent
=
file
.
getParentFile
();
if
(
null
!=
fileParent
&&
!
fileParent
.
exists
())
{
fileParent
.
mkdirs
();
}
out
=
new
OutputStreamWriter
(
new
FileOutputStream
(
file
),
cs
);
//打开文件输出流
for
(
int
i
=
0
;
i
<
lineList
.
size
();
i
++)
{
String
line
=
lineList
.
get
(
i
);
out
.
write
(
line
);
if
((
i
+
1
)
!=
lineList
.
size
())
{
out
.
write
(
'\r'
);
}
}
}
catch
(
IOException
e
)
{
localFilePath
=
""
;
e
.
printStackTrace
();
}
finally
{
//内容总执行
if
(
out
!=
null
)
{
try
{
out
.
close
();
//关闭输出文件流
}
catch
(
IOException
el
)
{
}
}
}
return
localFilePath
;
}
public
static
void
uploadRemoteFilePath
(
List
<
String
>
lineList
,
String
localRespFilePath
,
String
writeRemoteFilePath
,
OrderResp
resp
)
{
if
(
lineList
!=
null
&&
!
lineList
.
isEmpty
())
{
//开始写入本地文件
String
localFilePath
=
OrderUtil
.
getLocalFilePathByOrder
(
localRespFilePath
,
resp
.
getName
()
+
".ANS"
,
lineList
,
StandardCharsets
.
US_ASCII
);
//同步到远程
if
(
StringUtils
.
isNotBlank
(
localFilePath
))
{
SmbUtil
.
smbPut
(
writeRemoteFilePath
,
localFilePath
);
//TODO 暂时不删除本地文件
//FileUtil.del(new File(localFilePath));
}
}
}
}
src/main/resources/messages.properties
查看文件 @
4e22f39
...
@@ -374,3 +374,8 @@ smfcore.humiture.codetemperature=\u51B7\u85CF\u533A\u6E29\u5EA6
...
@@ -374,3 +374,8 @@ smfcore.humiture.codetemperature=\u51B7\u85CF\u533A\u6E29\u5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.cyclecount.executing
=
Cycle Count
\u
6B63
\u5728\u6267\u
884C
smfcore.cyclecount.executing
=
Cycle Count
\u
6B63
\u5728\u6267\u
884C
smfcore.eleckanban
=
\u7535\u
5B50
\u
770B
\u
677F
smfcore.eleckanban
=
\u7535\u
5B50
\u
770B
\u
677F
smfcore.agv.already.call
=
\u
5DF2
\u
7ECF
\u
547C
\u
53EB
smfcore.agv.pickup
=
AGV
\u
5DF2
\u
88AB
\u
53EB
\u6765\u
53D6
\u
8D27
smfcore.agv.dispatch
=
\u
8D27
\u7269\u
5DF2
\u
7ECF
\u
53D1
\u9001\u5230\u
5B58
\u
50A8
\u
7CFB
\u
7EDF
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.operation
=
AGV
\u5728\u
8FD0
\u
884C
\u
4E2D
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_en_US.properties
查看文件 @
4e22f39
...
@@ -363,3 +363,9 @@ smfcore.humiture.codetemperature=Refrigeration zone temperature
...
@@ -363,3 +363,9 @@ smfcore.humiture.codetemperature=Refrigeration zone temperature
smfcore.humiture.ntemperature
=
Return temperature zone temperature
smfcore.humiture.ntemperature
=
Return temperature zone temperature
smfcore.cyclecount.executing
=
Cycle Count are being executed
smfcore.cyclecount.executing
=
Cycle Count are being executed
smfcore.eleckanban
=
DashBoard
smfcore.eleckanban
=
DashBoard
smfcore.agv.already.call
=
Already called
smfcore.agv.pickup
=
AGV has been called to pick up goods
smfcore.agv.dispatch
=
Goods dispatched to storage system
smfcore.agv.awaitingInstruction
=
Awaiting instruction
smfcore.agv.operation
=
AGV is in operation
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_ja_JP.properties
查看文件 @
4e22f39
...
@@ -359,3 +359,9 @@ smfcore.spbox.expireOut=\u8FC7\u671F\u7269\u6599\u51FA\u5E93
...
@@ -359,3 +359,9 @@ smfcore.spbox.expireOut=\u8FC7\u671F\u7269\u6599\u51FA\u5E93
smfcore.humiture.codetemperature
=
\u
51B7
\u
85CF
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.codetemperature
=
\u
51B7
\u
85CF
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.cyclecount.executing
=
Cycle Count
\u
5B9F
\u
884C
smfcore.cyclecount.executing
=
Cycle Count
\u
5B9F
\u
884C
smfcore.agv.already.call
=
\u
65E2
\u
306B
\u
547C
\u3093\u3060
smfcore.agv.pickup
=
AGV
\u
304C
\u5546\u
54C1
\u3092\u
53D7
\u3051\u
53D6
\u
308B
\u
305F
\u3081\u
306B
\u
547C
\u3073\u
51FA
\u3055\u
308C
\u
307E
\u3057\u
305F
smfcore.agv.dispatch
=
\u
4FDD
\u
7BA1
\u
30B7
\u
30B9
\u
30C6
\u
30E0
\u
306B
\u
767A
\u9001\u3055\u
308C
\u
308B
\u5546\u
54C1
smfcore.agv.awaitingInstruction
=
\u6307\u
793A
\u
5F85
\u3061
smfcore.agv.operation
=
AGV
\u
52D5
\u
4F5C
\u
4E2D
\u3067\u3059
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_zh_CN.properties
查看文件 @
4e22f39
...
@@ -359,3 +359,8 @@ smfcore.spbox.expireOut=\u8FC7\u671F\u7269\u6599\u51FA\u5E93
...
@@ -359,3 +359,8 @@ smfcore.spbox.expireOut=\u8FC7\u671F\u7269\u6599\u51FA\u5E93
smfcore.humiture.codetemperature
=
\u
51B7
\u
85CF
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.codetemperature
=
\u
51B7
\u
85CF
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.cyclecount.executing
=
Cycle Count
\u
6B63
\u5728\u6267\u
884C
smfcore.cyclecount.executing
=
Cycle Count
\u
6B63
\u5728\u6267\u
884C
smfcore.agv.already.call
=
\u
5DF2
\u
7ECF
\u
547C
\u
53EB
smfcore.agv.pickup
=
AGV
\u
5DF2
\u
88AB
\u
53EB
\u6765\u
53D6
\u
8D27
smfcore.agv.dispatch
=
\u
8D27
\u7269\u
5DF2
\u
7ECF
\u
53D1
\u9001\u5230\u
5B58
\u
50A8
\u
7CFB
\u
7EDF
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.operation
=
AGV
\u5728\u
8FD0
\u
884C
\u
4E2D
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_zh_TW.properties
查看文件 @
4e22f39
...
@@ -360,3 +360,8 @@ smfcore.spbox.expireOut=\u904E\u671F\u7269\u6599\u51FA\u5EAB
...
@@ -360,3 +360,8 @@ smfcore.spbox.expireOut=\u904E\u671F\u7269\u6599\u51FA\u5EAB
smfcore.humiture.codetemperature
=
\u
51B7
\u
85CF
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.codetemperature
=
\u
51B7
\u
85CF
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.humiture.ntemperature
=
\u
56DE
\u
6E29
\u
533A
\u
6E29
\u
5EA6
smfcore.cyclecount.executing
=
Cycle Count
\u
6B63
\u5728\u
57F7
\u
884C
smfcore.cyclecount.executing
=
Cycle Count
\u
6B63
\u5728\u
57F7
\u
884C
smfcore.agv.already.call
=
\u
5DF2
\u
7D93
\u
547C
\u
7C72
smfcore.agv.pickup
=
AGV
\u
5DF2
\u
88AB
\u
53EB
\u
4F86
\u
53D6
\u
8CA8
smfcore.agv.dispatch
=
\u
8CA8
\u7269\u
767C
\u9001\u5230\u
5B58
\u5132\u
7CFB
\u
7D71
smfcore.agv.awaitingInstruction
=
\u
7B49
\u
5F85
\u6307\u
793A
smfcore.agv.operation
=
AGV
\u
6B63
\u5728\u
904B
\u
884C
\ No newline at end of file
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论