Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 93de5194
由
zshaohui
编写于
2024-10-31 13:46:39 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
fuji功能提交
1 个父辈
a364c784
全部展开
显示空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
180 行增加
和
105 行删除
src/main/java/com/neotel/smfcore/core/equipment/enums/EquipmentType.java
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipViewController.java
src/main/java/com/neotel/smfcore/core/equipment/rest/dto/EquipStatusDto.java
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
src/main/java/com/neotel/smfcore/core/order/rest/OrderController.java
src/main/java/com/neotel/smfcore/core/order/rest/bean/dto/OrderDto.java
src/main/java/com/neotel/smfcore/custom/fuji/FujiApi.java
src/main/java/com/neotel/smfcore/custom/fuji/FujiMenu.java
src/main/java/com/neotel/smfcore/custom/fuji/controller/FujiController.java
src/main/java/com/neotel/smfcore/custom/fuji/order/JobHandler.java
src/main/java/com/neotel/smfcore/custom/fuji/order/service/JobService.java
src/main/java/com/neotel/smfcore/custom/fuji/util/NotifyUtil.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/core/equipment/enums/EquipmentType.java
查看文件 @
93de519
...
@@ -50,5 +50,8 @@ public enum EquipmentType {
...
@@ -50,5 +50,8 @@ public enum EquipmentType {
/**
/**
* 韩华
* 韩华
*/
*/
HANWHA
()
HANWHA
(),
NEXIM
()
}
}
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipViewController.java
查看文件 @
93de519
...
@@ -16,6 +16,8 @@ import com.neotel.smfcore.core.storage.enums.DeviceType;
...
@@ -16,6 +16,8 @@ import com.neotel.smfcore.core.storage.enums.DeviceType;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
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.core.system.util.EquipStatusUtil
;
import
com.neotel.smfcore.custom.fuji.bean.FujiConfig
;
import
com.neotel.smfcore.custom.fuji.config.FujiCacheConfig
;
import
com.neotel.smfcore.custom.hanwha.handler.TMSCommunicator
;
import
com.neotel.smfcore.custom.hanwha.handler.TMSCommunicator
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -57,7 +59,7 @@ public class EquipViewController {
...
@@ -57,7 +59,7 @@ public class EquipViewController {
Map
<
String
,
Equipment
>
allEquipList
=
equipmentCache
.
getAllEquipment
();
Map
<
String
,
Equipment
>
allEquipList
=
equipmentCache
.
getAllEquipment
();
for
(
Equipment
equip
:
for
(
Equipment
equip
:
allEquipList
.
values
())
{
allEquipList
.
values
())
{
EquipStatusDto
dto
=
new
EquipStatusDto
(
equip
.
getId
(),
equip
.
getName
(),
equip
.
getCid
(),
false
,
0
,
""
,
equip
.
getType
());
EquipStatusDto
dto
=
new
EquipStatusDto
(
equip
.
getId
(),
equip
.
getName
(),
equip
.
getCid
(),
false
,
0
,
""
,
equip
.
getType
()
,
false
);
EquipStatusBean
bean
=
EquipStatusUtil
.
getStatusBean
(
equip
.
getCid
());
EquipStatusBean
bean
=
EquipStatusUtil
.
getStatusBean
(
equip
.
getCid
());
if
(
bean
!=
null
){
if
(
bean
!=
null
){
if
(
bean
.
timeOut
()){
if
(
bean
.
timeOut
()){
...
@@ -74,6 +76,11 @@ public class EquipViewController {
...
@@ -74,6 +76,11 @@ public class EquipViewController {
dto
.
setOnLine
(
true
);
dto
.
setOnLine
(
true
);
dto
.
setStatus
(
1
);
dto
.
setStatus
(
1
);
}
}
}
else
if
(
equip
.
getType
().
equalsIgnoreCase
(
EquipmentType
.
NEXIM
.
name
())){
FujiConfig
config
=
dataCache
.
getCache
(
FujiCacheConfig
.
FujiConfig_Cache_Name
);
if
(
config
!=
null
){
dto
.
setActivate
(
true
);
}
}
}
resultList
.
add
(
dto
);
resultList
.
add
(
dto
);
...
@@ -83,7 +90,7 @@ public class EquipViewController {
...
@@ -83,7 +90,7 @@ public class EquipViewController {
Collection
<
Storage
>
storages
=
dataCache
.
getAllStorage
().
values
();
Collection
<
Storage
>
storages
=
dataCache
.
getAllStorage
().
values
();
for
(
Storage
storage
:
storages
)
{
for
(
Storage
storage
:
storages
)
{
if
(
storage
.
getType
().
equals
(
DeviceType
.
NLL
.
name
())){
if
(
storage
.
getType
().
equals
(
DeviceType
.
NLL
.
name
())){
EquipStatusDto
dto
=
new
EquipStatusDto
(
storage
.
getId
(),
storage
.
getName
(),
storage
.
getCid
(),
false
,
0
,
""
,
storage
.
getType
());
EquipStatusDto
dto
=
new
EquipStatusDto
(
storage
.
getId
(),
storage
.
getName
(),
storage
.
getCid
(),
false
,
0
,
""
,
storage
.
getType
()
,
false
);
StatusBean
bean
=
DevicesStatusUtil
.
getStatusBean
(
storage
.
getCid
());
StatusBean
bean
=
DevicesStatusUtil
.
getStatusBean
(
storage
.
getCid
());
if
(
bean
==
null
||
bean
.
timeOut
()){
if
(
bean
==
null
||
bean
.
timeOut
()){
dto
.
setOnLine
(
false
);
dto
.
setOnLine
(
false
);
...
...
src/main/java/com/neotel/smfcore/core/equipment/rest/dto/EquipStatusDto.java
查看文件 @
93de519
...
@@ -33,5 +33,6 @@ public class EquipStatusDto implements Serializable {
...
@@ -33,5 +33,6 @@ public class EquipStatusDto implements Serializable {
@ApiModelProperty
(
"设备类型,NEOSCAN=扫码贴标,COUNTING=点料机"
)
@ApiModelProperty
(
"设备类型,NEOSCAN=扫码贴标,COUNTING=点料机"
)
private
String
type
=
EquipmentType
.
AUTO
.
name
();
private
String
type
=
EquipmentType
.
AUTO
.
name
();
@ApiModelProperty
(
"是否激活"
)
private
boolean
activate
=
false
;
}
}
src/main/java/com/neotel/smfcore/core/order/LiteOrderCache.java
查看文件 @
93de519
...
@@ -825,4 +825,8 @@ public class LiteOrderCache {
...
@@ -825,4 +825,8 @@ public class LiteOrderCache {
}
}
public
Collection
<
LiteOrder
>
getAllLiteOrder
(){
return
liteOrderMap
.
values
();
}
}
}
src/main/java/com/neotel/smfcore/core/order/rest/OrderController.java
查看文件 @
93de519
...
@@ -471,7 +471,7 @@ public class OrderController {
...
@@ -471,7 +471,7 @@ public class OrderController {
}
}
String
result
=
liteOrderCache
.
closeOrder
(
orderNo
);
String
result
=
liteOrderCache
.
closeOrder
(
orderNo
);
if
(
ObjectUtil
.
isEmpty
(
result
))
{
if
(
ObjectUtil
.
isEmpty
(
result
)
||
"smfcore.order.close.success"
.
equals
(
result
)
)
{
return
ResultBean
.
newOkResult
(
result
,
result
);
return
ResultBean
.
newOkResult
(
result
,
result
);
}
else
{
}
else
{
return
ResultBean
.
newErrorResult
(-
1
,
result
,
result
);
return
ResultBean
.
newErrorResult
(-
1
,
result
,
result
);
...
...
src/main/java/com/neotel/smfcore/core/order/rest/bean/dto/OrderDto.java
查看文件 @
93de519
...
@@ -9,7 +9,9 @@ import org.springframework.data.annotation.Transient;
...
@@ -9,7 +9,9 @@ import org.springframework.data.annotation.Transient;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@Getter
@Getter
@Setter
@Setter
...
@@ -89,4 +91,7 @@ public class OrderDto implements Serializable {
...
@@ -89,4 +91,7 @@ public class OrderDto implements Serializable {
@ApiModelProperty
(
"工单线别"
)
@ApiModelProperty
(
"工单线别"
)
private
String
line
=
""
;
private
String
line
=
""
;
@ApiModelProperty
(
"附加字段"
)
private
Map
<
String
,
String
>
appendData
=
new
HashMap
<>();
}
}
src/main/java/com/neotel/smfcore/custom/fuji/FujiApi.java
查看文件 @
93de519
...
@@ -74,8 +74,11 @@ public class FujiApi extends BaseSmfApiListener {
...
@@ -74,8 +74,11 @@ public class FujiApi extends BaseSmfApiListener {
@Override
@Override
public
void
outTaskStatusChange
(
String
outNotifyUrl
,
DataLog
task
)
{
public
void
outTaskStatusChange
(
String
outNotifyUrl
,
DataLog
task
)
{
if
(
task
.
isFinished
())
{
if
(
task
.
isFinished
())
{
//NotifyUtil.createLoadEtn(task.getBarcode(),task.getPosName(),task.getNum(),"",task.getW(),task.getH(),task.getPartNumber(),task.getStorageName(),FileDirectoryConfig.NOTIFY);
String
fileName
=
task
.
getAppendData
(
"fileName"
)
==
null
?
""
:
task
.
getAppendData
(
"fileName"
).
toString
();
NotifyUtil
.
createProvideEtn
(
task
.
getBarcode
(),
task
.
getPosName
(),
task
.
getNum
(),
""
,
task
.
getW
(),
task
.
getH
(),
task
.
getPartNumber
(),
task
.
getSourceName
(),
task
.
getLine
(),
task
.
getStorageName
(),
getNotifyEtn
());
String
sourceName
=
task
.
getAppendData
(
"jobName"
)
==
null
?
""
:
task
.
getAppendData
(
"jobName"
).
toString
();
NotifyUtil
.
createProvideEtn
(
task
.
getBarcode
(),
task
.
getPosName
(),
task
.
getNum
(),
""
,
task
.
getW
(),
task
.
getH
(),
task
.
getPartNumber
(),
sourceName
,
task
.
getLine
(),
task
.
getStorageName
(),
getNotifyEtn
(),
fileName
);
//NotifyUtil.createDeleteEtn(task.getBarcode(),task.getW(),task.getH(),task.getPartNumber(),FileDirectoryConfig.NOTIFY);
//NotifyUtil.createDeleteEtn(task.getBarcode(),task.getW(),task.getH(),task.getPartNumber(),FileDirectoryConfig.NOTIFY);
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/custom/fuji/FujiMenu.java
0 → 100644
查看文件 @
93de519
package
com
.
neotel
.
smfcore
.
custom
.
fuji
;
import
com.neotel.smfcore.common.init.MenuInit
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.security.service.po.Menu
;
import
org.apache.logging.log4j.util.Strings
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
@Component
public
class
FujiMenu
{
@Autowired
MenuInit
menuInit
;
@Autowired
SmfApi
smfApi
;
@PostConstruct
public
void
init
(){
String
menuLabel
=
"fuji"
;
Menu
nexim
=
Menu
.
CreatePMenu
(
"Nexim"
,
3
,
"nexim"
,
"nexim"
,
null
);
MenuInit
.
addMenu
(
menuLabel
,
nexim
,
3
,
"Nexim 工单"
,
"neximWorkOrder"
,
"neolight/neximWorkOrder/index"
,
"neximWorkOrder"
);
String
apiName
=
smfApi
.
getApiName
();
if
(
Strings
.
isNotBlank
(
apiName
)
&&
apiName
.
equals
(
menuLabel
)){
menuInit
.
showMenu
(
apiName
);
}
}
}
src/main/java/com/neotel/smfcore/custom/fuji/controller/FujiController.java
查看文件 @
93de519
...
@@ -6,9 +6,13 @@ import com.neotel.smfcore.common.utils.StringUtils;
...
@@ -6,9 +6,13 @@ import com.neotel.smfcore.common.utils.StringUtils;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
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.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrderItem
;
import
com.neotel.smfcore.custom.fuji.FujiApi
;
import
com.neotel.smfcore.custom.fuji.FujiApi
;
import
com.neotel.smfcore.custom.fuji.bean.FujiConfig
;
import
com.neotel.smfcore.custom.fuji.bean.FujiConfig
;
import
com.neotel.smfcore.custom.fuji.config.FujiCacheConfig
;
import
com.neotel.smfcore.custom.fuji.config.FujiCacheConfig
;
import
com.neotel.smfcore.custom.fuji.order.service.JobService
;
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
;
...
@@ -17,7 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -17,7 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Slf4j
@Slf4j
@RestController
@RestController
...
@@ -33,9 +38,15 @@ public class FujiController {
...
@@ -33,9 +38,15 @@ public class FujiController {
@Autowired
@Autowired
private
FujiApi
fujiApi
;
private
FujiApi
fujiApi
;
@Autowired
private
LiteOrderCache
liteOrderCache
;
@Autowired
private
JobService
jobService
;
@ApiOperation
(
"修改配置"
)
@ApiOperation
(
"修改配置"
)
@RequestMapping
(
"/updateFujiConfig"
)
@RequestMapping
(
"/updateFujiConfig"
)
@AnonymousAccess
//
@AnonymousAccess
public
ResultBean
updateFujiConfig
(
@RequestBody
FujiConfig
newConfig
)
{
public
ResultBean
updateFujiConfig
(
@RequestBody
FujiConfig
newConfig
)
{
log
.
info
(
"修改配置信息为:"
+
JSON
.
toJSONString
(
newConfig
));
log
.
info
(
"修改配置信息为:"
+
JSON
.
toJSONString
(
newConfig
));
FujiConfig
config
=
dataCache
.
getCache
(
FujiCacheConfig
.
FujiConfig_Cache_Name
);
FujiConfig
config
=
dataCache
.
getCache
(
FujiCacheConfig
.
FujiConfig_Cache_Name
);
...
@@ -54,7 +65,7 @@ public class FujiController {
...
@@ -54,7 +65,7 @@ public class FujiController {
@ApiOperation
(
"获取配置"
)
@ApiOperation
(
"获取配置"
)
@RequestMapping
(
"/getFujiConfig"
)
@RequestMapping
(
"/getFujiConfig"
)
@AnonymousAccess
//
@AnonymousAccess
public
ResultBean
getFujiConfig
()
{
public
ResultBean
getFujiConfig
()
{
FujiConfig
config
=
dataCache
.
getCache
(
FujiCacheConfig
.
FujiConfig_Cache_Name
);
FujiConfig
config
=
dataCache
.
getCache
(
FujiCacheConfig
.
FujiConfig_Cache_Name
);
if
(
config
==
null
)
{
if
(
config
==
null
)
{
...
@@ -65,7 +76,7 @@ public class FujiController {
...
@@ -65,7 +76,7 @@ public class FujiController {
@ApiOperation
(
"did注册"
)
@ApiOperation
(
"did注册"
)
@RequestMapping
(
"/didRegister"
)
@RequestMapping
(
"/didRegister"
)
@AnonymousAccess
//
@AnonymousAccess
public
ResultBean
didRegister
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
public
ResultBean
didRegister
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
code
=
paramMap
.
get
(
"code"
);
String
code
=
paramMap
.
get
(
"code"
);
if
(
StringUtils
.
isEmpty
(
code
))
{
if
(
StringUtils
.
isEmpty
(
code
))
{
...
@@ -84,4 +95,81 @@ public class FujiController {
...
@@ -84,4 +95,81 @@ public class FujiController {
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
""
);
}
}
@ApiOperation
(
"job出库"
)
@RequestMapping
(
"/jobCheckOut"
)
@AnonymousAccess
public
synchronized
ResultBean
jobCheckOut
(
String
orderNo
)
{
LiteOrder
liteOrder
=
liteOrderCache
.
getLiteOrder
(
orderNo
);
if
(
liteOrder
==
null
){
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.order.out.notFound"
,
"工单未找到"
);
}
if
(
liteOrder
.
isClosed
()){
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.order.hasClose"
,
"工单已关闭"
);
}
if
(!
liteOrder
.
isNew
()){
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.order.out.executing"
,
"工单正在执行"
);
}
liteOrder
=
jobService
.
executeJob
(
liteOrder
);
jobService
.
writeAns
(
liteOrder
);
return
ResultBean
.
newOkResult
(
""
);
}
@ApiOperation
(
"获取需要出库/正在执行中的job任务"
)
@RequestMapping
(
"/jobInfo"
)
@AnonymousAccess
public
ResultBean
getJobInfo
()
{
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
Collection
<
LiteOrder
>
allLiteOrder
=
liteOrderCache
.
getAllLiteOrder
();
if
(
allLiteOrder
!=
null
&&
!
allLiteOrder
.
isEmpty
())
{
List
<
LiteOrder
>
liteOrderList
=
new
ArrayList
<>();
for
(
LiteOrder
liteOrder
:
allLiteOrder
)
{
if
(
liteOrder
.
isNew
()
||
liteOrder
.
isOutTails
())
{
liteOrderList
.
add
(
liteOrder
);
}
else
{
//其他的默认超过2个小时 不展示
if
(
System
.
currentTimeMillis
()
-
liteOrder
.
getUpdateDate
().
getTime
()
<=
1000
*
60
*
60
*
2
){
liteOrderList
.
add
(
liteOrder
);
}
}
}
liteOrderList
=
liteOrderList
.
stream
().
sorted
(
Comparator
.
comparing
(
LiteOrder:
:
getCreateDate
).
reversed
()).
collect
(
Collectors
.
toList
());
for
(
LiteOrder
liteOrder
:
liteOrderList
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
String
jobState
=
liteOrder
.
getAppend
(
"jobState"
);
String
jobName
=
liteOrder
.
getAppend
(
"jobName"
);
String
fileName
=
liteOrder
.
getAppend
(
"fileName"
);
resultMap
.
put
(
"jobState"
,
jobState
);
resultMap
.
put
(
"jobName"
,
jobName
);
resultMap
.
put
(
"fileName"
,
fileName
);
List
<
Map
<
String
,
String
>>
itemList
=
new
ArrayList
<>();
for
(
LiteOrderItem
orderItem
:
liteOrder
.
getOrderItems
())
{
Map
<
String
,
String
>
itemMap
=
new
HashMap
<>();
String
item
=
orderItem
.
getAppend
(
"item"
);
String
errorCode
=
orderItem
.
getAppend
(
"errorCode"
);
String
errorText
=
orderItem
.
getAppend
(
"errorText"
);
String
ri
=
orderItem
.
getRi
();
String
pn
=
orderItem
.
getPn
();
int
needReelCount
=
orderItem
.
getNeedReelCount
();
itemMap
.
put
(
"item"
,
item
);
itemMap
.
put
(
"errorCode"
,
""
);
if
(!
"0"
.
equals
(
errorCode
)){
itemMap
.
put
(
"errorCode"
,
errorCode
);
}
itemMap
.
put
(
"errorText"
,
errorText
);
itemMap
.
put
(
"ri"
,
ri
);
itemMap
.
put
(
"pn"
,
pn
);
itemMap
.
put
(
"needReelCount"
,
needReelCount
+
""
);
itemList
.
add
(
itemMap
);
}
resultMap
.
put
(
"itemList"
,
itemList
);
resultList
.
add
(
resultMap
);
}
}
return
ResultBean
.
newOkResult
(
resultList
);
}
}
}
src/main/java/com/neotel/smfcore/custom/fuji/order/JobHandler.java
查看文件 @
93de519
...
@@ -70,7 +70,7 @@ public class JobHandler {
...
@@ -70,7 +70,7 @@ public class JobHandler {
config
=
new
FujiConfig
();
config
=
new
FujiConfig
();
}
}
if
(
System
.
currentTimeMillis
()-
lastHandleTime
>=
1000
*
config
.
getTime
()){
if
(
System
.
currentTimeMillis
()-
lastHandleTime
>=
1000
*
config
.
getTime
()){
log
.
info
(
DateUtil
.
toDateString
(
System
.
currentTimeMillis
(),
"yyyy-MM-dd HH:mm:ss"
));
//
log.info(DateUtil.toDateString(System.currentTimeMillis(),"yyyy-MM-dd HH:mm:ss"));
try
{
try
{
handler
();
handler
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -116,114 +116,34 @@ public class JobHandler {
...
@@ -116,114 +116,34 @@ public class JobHandler {
log
.
info
(
"获取到line为:"
+
JSON
.
toJSONString
(
lineList
));
log
.
info
(
"获取到line为:"
+
JSON
.
toJSONString
(
lineList
));
//开始处理每行数据
//开始处理每行数据
Job
job
=
getJob
(
lineList
);
Job
job
=
jobService
.
getJob
(
lineList
);
String
ansName
=
currentFile
.
getName
();
int
pos
=
ansName
.
lastIndexOf
(
"."
);
ansName
=
pos
>
0
?
ansName
.
substring
(
0
,
pos
)
:
ansName
;
//判断是否已经存在job
//判断是否已经存在job
/* boolean existJob = jobService.isExistJob(job.getName()
);
boolean
existJob
=
jobService
.
isExistJob
(
job
.
getName
(),
ansName
);
if
(
existJob
){
if
(
existJob
){
return
;
return
;
}
*/
}
job
=
jobService
.
getJobResultInfo
(
job
);
LiteOrder
liteOrder
=
jobService
.
getJobResultInfo
(
job
,
ansName
,
lineList
);
//旧的文件,移除到其他文件夹,写入ANS文件
//旧的文件,移除到其他文件夹,写入ANS文件
String
newFilePath
=
"nexim/eto/"
+
currentFile
.
getName
();
String
newFilePath
=
"nexim/eto/"
+
currentFile
.
getName
();
FileUtil
.
move
(
currentFile
,
new
File
(
newFilePath
),
true
);
FileUtil
.
move
(
currentFile
,
new
File
(
newFilePath
),
true
);
//新写入文件到当前文件夹
//判断是否为自动出库
List
<
JobItem
>
data
=
job
.
getData
();
if
(
"PROVIDE_DELETE"
.
equals
(
job
.
getJobState
())){
int
error
=
0
;
jobService
.
writeAns
(
liteOrder
);
for
(
JobItem
item
:
data
)
{
if
(
error
==
1
){
continue
;
}
else
{
if
(
item
.
getErrorCode
()
==
1902
||
item
.
getErrorCode
()
==
1928
){
error
=
2
;
}
else
if
(
item
.
getErrorCode
()
==
1876
||
item
.
getErrorCode
()
==
1877
||
item
.
getErrorCode
()
==
1878
||
item
.
getErrorCode
()
==
1886
||
item
.
getErrorCode
()
==
1901
){
error
=
1
;
}
}
}
}
}
}
lineList
.
add
(
"[Result]"
);
lineList
.
add
(
"Error="
+
error
);
for
(
JobItem
item
:
data
)
{
if
(
item
.
getErrorCode
()
!=
0
){
lineList
.
add
(
item
.
getItem
()+
"="
+
item
.
getErrorCode
()+
":"
+
item
.
getErrorText
());
}
}
//写入文件到当前文件夹
String
ansName
=
currentFile
.
getName
();
int
pos
=
ansName
.
lastIndexOf
(
"."
);
ansName
=
pos
>
0
?
ansName
.
substring
(
0
,
pos
)
:
ansName
;
String
ansFilePath
=
path
+
"\\"
+
ansName
+
".ANS"
;
try
(
BufferedWriter
writer
=
new
BufferedWriter
(
new
FileWriter
(
ansFilePath
)))
{
for
(
String
line
:
lineList
)
{
// 逐行写入 List 中的内容
writer
.
write
(
line
);
writer
.
newLine
();
// 写入换行符以分隔每一行
}
}
catch
(
IOException
e
)
{
// 处理可能发生的 IO 异常
log
.
info
(
"写入文件时发生错误: "
,
e
);
}
//生成出库任务
List
<
DataLog
>
dataLogList
=
job
.
getDataLogList
();
if
(
dataLogList
!=
null
&&
!
dataLogList
.
isEmpty
()){
for
(
DataLog
dataLog
:
dataLogList
)
{
taskService
.
updateQueueTask
(
dataLog
);
}
}
}
}
private
Job
getJob
(
List
<
String
>
lineList
)
{
Job
job
=
new
Job
();
for
(
String
line
:
lineList
)
{
String
[]
lineSpl
=
line
.
split
(
"="
);
if
(
line
.
startsWith
(
"Action"
))
{
job
.
setAction
(
lineSpl
[
1
]);
}
else
if
(
line
.
startsWith
(
"Object"
))
{
job
.
setObject
(
lineSpl
[
1
]);
}
else
if
(
line
.
startsWith
(
"Name"
))
{
job
.
setName
(
lineSpl
[
1
]);
}
else
if
(
line
.
startsWith
(
"Los"
))
{
job
.
setLos
(
lineSpl
[
1
]);
}
else
if
(
line
.
startsWith
(
"JobState"
))
{
job
.
setJobState
(
lineSpl
[
1
]);
}
else
if
(
line
.
startsWith
(
"ProdSite"
))
{
job
.
setProdSite
(
lineSpl
[
1
]);
}
else
if
(
line
.
startsWith
(
"Answer"
))
{
job
.
setAnswer
(
lineSpl
[
1
]);
}
}
List
<
JobItem
>
itemList
=
new
ArrayList
<>();
for
(
String
line
:
lineList
)
{
if
(
line
.
startsWith
(
"Item"
))
{
String
[]
lineSpl
=
line
.
split
(
"="
);
JobItem
item
=
new
JobItem
();
item
.
setItem
(
lineSpl
[
0
]);
String
[]
split
=
lineSpl
[
1
].
split
(
"\\|"
);
item
.
setPart
(
split
[
0
]);
item
.
setCarrier
(
split
[
1
]);
if
(
StringUtils
.
isNotEmpty
(
split
[
2
]))
{
item
.
setNeedNum
(
Integer
.
valueOf
(
split
[
2
]));
}
if
(
StringUtils
.
isNotEmpty
(
split
[
3
]))
{
item
.
setNeedReelCount
(
Integer
.
valueOf
(
split
[
3
]));
}
itemList
.
add
(
item
);
}
}
job
.
setData
(
itemList
);
return
job
;
}
}
}
src/main/java/com/neotel/smfcore/custom/fuji/order/service/JobService.java
查看文件 @
93de519
此文件的差异被折叠,
点击展开。
src/main/java/com/neotel/smfcore/custom/fuji/util/NotifyUtil.java
查看文件 @
93de519
...
@@ -91,13 +91,19 @@ public class NotifyUtil {
...
@@ -91,13 +91,19 @@ public class NotifyUtil {
String
sourceName
,
String
sourceName
,
String
line
,
String
line
,
String
storageName
,
String
storageName
,
String
path
)
{
String
path
,
String
fileName
)
{
OutputStreamWriter
out
=
null
;
OutputStreamWriter
out
=
null
;
String
localFilePath
=
""
;
String
localFilePath
=
""
;
try
{
try
{
//CARRIER_1608R-00002_LOAD_20240524_15_00_02.ETN
//CARRIER_1608R-00002_LOAD_20240524_15_00_02.ETN
//localFilePath = path + "CARRIER_" + barcode + "_PROVIDE_" + new SimpleDateFormat("yyyyMMdd_HH_mm_ss").format(new Date()) + ".ETN";
//localFilePath = path + "CARRIER_" + barcode + "_PROVIDE_" + new SimpleDateFormat("yyyyMMdd_HH_mm_ss").format(new Date()) + ".ETN";
localFilePath
=
path
+
"\\"
+
barcode
+
"_PROVIDE"
+
".ETN"
;
if
(
StringUtils
.
isEmpty
(
sourceName
))
{
localFilePath
=
path
+
"\\"
+
barcode
+
"_PROVIDE"
+
".ETN"
;
}
else
{
localFilePath
=
path
+
"\\"
+
fileName
+
".ETN"
;
}
//localFilePath = path +"\\"+barcode+"_PROVIDE"+".ETN";
log
.
info
(
"本地文件路径为:"
+
localFilePath
);
log
.
info
(
"本地文件路径为:"
+
localFilePath
);
//log.info("内容为:" + JSON.toJSONString(notify));
//log.info("内容为:" + JSON.toJSONString(notify));
...
...
src/main/resources/messages.properties
查看文件 @
93de519
...
@@ -388,3 +388,4 @@ smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u8D25
...
@@ -388,3 +388,4 @@ smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u8D25
smfcore.equip.notExist
=
\u
8BBE
\u5907\u
4E0D
\u
5B58
\u5728
smfcore.equip.notExist
=
\u
8BBE
\u5907\u
4E0D
\u
5B58
\u5728
smfcore.order.finished
=
\u
5DE5
\u5355
[{0}]
\u7684\u
4EFB
\u
52A1
\u
5DF2
\u5168\u
90E8
\u
5B8C
\u6210
smfcore.order.finished
=
\u
5DE5
\u5355
[{0}]
\u7684\u
4EFB
\u
52A1
\u
5DF2
\u5168\u
90E8
\u
5B8C
\u6210
smfcore.spkanban
=
SP
\u
4EEA
\u8868\u
76D8
smfcore.spkanban
=
SP
\u
4EEA
\u8868\u
76D8
smfcore.neximWorkOrder
=
Nexim
\u
5DE5
\u5355
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_en_US.properties
查看文件 @
93de519
...
@@ -379,3 +379,4 @@ smfcore.msg.op.fail=failure of an operation
...
@@ -379,3 +379,4 @@ smfcore.msg.op.fail=failure of an operation
smfcore.equip.notExist
=
Device does not exist
smfcore.equip.notExist
=
Device does not exist
smfcore.order.finished
=
workorder[{0}] has completed all of its tasks
smfcore.order.finished
=
workorder[{0}] has completed all of its tasks
smfcore.spkanban
=
SP Dash Board
smfcore.spkanban
=
SP Dash Board
smfcore.neximWorkOrder
=
Nexim WorkOrder
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_ja_JP.properties
查看文件 @
93de519
...
@@ -375,3 +375,4 @@ smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u8D25
...
@@ -375,3 +375,4 @@ smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u8D25
smfcore.equip.notExist
=
\u
8BBE
\u5907\u
4E0D
\u
5B58
\u5728
smfcore.equip.notExist
=
\u
8BBE
\u5907\u
4E0D
\u
5B58
\u5728
smfcore.order.finished
=
\u
30EF
\u
30FC
\u
30AF
\u
30AA
\u
30FC
\u
30C0
\u
30FC[{0}]
\u
306E
\u
30BF
\u
30B9
\u
30AF
\u
306F
\u3059\u3079\u3066\u
5B8C
\u
4E86
\u3057\u
307E
\u3057\u
305F
smfcore.order.finished
=
\u
30EF
\u
30FC
\u
30AF
\u
30AA
\u
30FC
\u
30C0
\u
30FC[{0}]
\u
306E
\u
30BF
\u
30B9
\u
30AF
\u
306F
\u3059\u3079\u3066\u
5B8C
\u
4E86
\u3057\u
307E
\u3057\u
305F
smfcore.spkanban
=
\u
30C0
\u
30C3
\u
30B7
\u
30E5
\u
30DC
\u
30FC
\u
30C9
smfcore.spkanban
=
\u
30C0
\u
30C3
\u
30B7
\u
30E5
\u
30DC
\u
30FC
\u
30C9
smfcore.neximWorkOrder
=
Nexim
\u
5DE5
\u
55AE
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_zh_CN.properties
查看文件 @
93de519
...
@@ -375,3 +375,4 @@ smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u8D25
...
@@ -375,3 +375,4 @@ smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u8D25
smfcore.equip.notExist
=
\u
8BBE
\u5907\u
4E0D
\u
5B58
\u5728
smfcore.equip.notExist
=
\u
8BBE
\u5907\u
4E0D
\u
5B58
\u5728
smfcore.order.finished
=
\u
5DE5
\u5355
[{0}]
\u7684\u
4EFB
\u
52A1
\u
5DF2
\u5168\u
90E8
\u
5B8C
\u6210
smfcore.order.finished
=
\u
5DE5
\u5355
[{0}]
\u7684\u
4EFB
\u
52A1
\u
5DF2
\u5168\u
90E8
\u
5B8C
\u6210
smfcore.spkanban
=
SP
\u
4EEA
\u8868\u
76D8
smfcore.spkanban
=
SP
\u
4EEA
\u8868\u
76D8
smfcore.neximWorkOrder
=
Nexim
\u
5DE5
\u5355
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_zh_TW.properties
查看文件 @
93de519
...
@@ -375,3 +375,4 @@ smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u6557
...
@@ -375,3 +375,4 @@ smfcore.msg.op.fail=\u64CD\u4F5C\u5931\u6557
smfcore.equip.notExist
=
\u
8A2D
\u5099\u
4E0D
\u
5B58
\u5728
smfcore.equip.notExist
=
\u
8A2D
\u5099\u
4E0D
\u
5B58
\u5728
smfcore.order.finished
=
\u
5DE5
\u
55AE[{0}]
\u7684\u
4EFB
\u
52D9
\u
5DF2
\u5168\u
90E8
\u
5B8C
\u6210
smfcore.order.finished
=
\u
5DE5
\u
55AE[{0}]
\u7684\u
4EFB
\u
52D9
\u
5DF2
\u5168\u
90E8
\u
5B8C
\u6210
smfcore.spkanban
=
SP
\u5100\u9336\u
76E4
smfcore.spkanban
=
SP
\u5100\u9336\u
76E4
smfcore.neximWorkOrder
=
Nexim
\u
30EF
\u
30FC
\u
30AF
\u
30AA
\u
30FC
\u
30C0
\u
30FC
\u
30A2
\u
30A6
\u
30C8
\ No newline at end of file
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论