Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4a4451a0
由
LN
编写于
2023-03-15 10:01:03 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
hotayi接口完善
1 个父辈
842a3b07
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
182 行增加
和
40 行删除
src/main/java/com/neotel/smfcore/custom/hotayi20057/HotayiApi.java
src/main/java/com/neotel/smfcore/custom/hotayi20057/HotayiController.java
src/main/java/com/neotel/smfcore/custom/hotayi20057/bean/HotayiBean.java
src/main/java/com/neotel/smfcore/custom/hotayi20057/HotayiApi.java
查看文件 @
4a4451a
package
com
.
neotel
.
smfcore
.
custom
.
hotayi20057
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.DateUtil
;
import
com.neotel.smfcore.common.utils.HttpHelper
;
...
...
@@ -55,7 +56,7 @@ public class HotayiApi extends BaseSmfApiListener {
@Override
public
boolean
isForThisApi
(
String
apiName
)
{
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"20
393
"
);
return
apiName
!=
null
&&
apiName
.
equalsIgnoreCase
(
"20
057
"
);
}
...
...
@@ -149,17 +150,11 @@ public class HotayiApi extends BaseSmfApiListener {
String
requestParams
=
""
;
String
responseInfo
=
""
;
if
(
task
.
isFinished
())
{
HotayiBean
m10Bean
=
getM10Bean
(
task
.
getBarcode
(),
"1"
,
"2"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"reelId"
,
task
.
getBarcode
());
paramMap
.
put
(
"location"
,
task
.
getPosName
());
paramMap
.
put
(
"source"
,
"SMF"
);
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
task
.
getBarcode
());
String
fullCode
=
""
;
if
(
barcode
!=
null
)
{
fullCode
=
barcode
.
getFullCode
();
}
paramMap
.
put
(
"fullCode"
,
fullCode
);
paramMap
.
put
(
"Info"
,
m10Bean
.
getInfo
());
paramMap
.
put
(
"Date"
,
m10Bean
.
getData
());
try
{
requestParams
=
JsonUtil
.
toJsonStr
(
paramMap
);
log
.
info
(
task
.
getBarcode
()
+
"入库通知,参数"
+
requestParams
);
...
...
@@ -178,35 +173,14 @@ public class HotayiApi extends BaseSmfApiListener {
String
requestParams
=
""
;
String
responseInfo
=
""
;
if
(
task
.
isFinished
())
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"reelId"
,
task
.
getBarcode
());
paramMap
.
put
(
"partNum"
,
task
.
getPartNumber
());
paramMap
.
put
(
"qty"
,
task
.
getNum
()
+
""
);
paramMap
.
put
(
"boxNo"
,
task
.
getCid
());
paramMap
.
put
(
"location"
,
task
.
getPosName
());
String
hSerial
=
""
;
String
so
=
""
;
String
slotNum
=
""
;
String
feederInfo
=
""
;
String
sourceId
=
task
.
getSourceId
();
if
(
Strings
.
isNotBlank
(
sourceId
)){
LiteOrder
liteOrder
=
liteOrderManager
.
get
(
task
.
getSourceId
());
if
(
liteOrder
!=
null
){
hSerial
=
liteOrder
.
getOrderNo
();
so
=
liteOrder
.
getSo
();
}
String
subSourceId
=
task
.
getSubSourceId
();
LiteOrderItem
orderItem
=
liteOrderItemManager
.
get
(
subSourceId
);
if
(
orderItem
!=
null
){
slotNum
=
orderItem
.
getSlotNum
()
+
""
;
feederInfo
=
orderItem
.
getFeederInfo
();
}
String
type
=
"2"
;
if
(
ObjectUtil
.
isNotEmpty
(
task
.
getOperator
())
&&
task
.
getOperator
().
equals
(
"MES"
))
{
type
=
"1"
;
}
paramMap
.
put
(
"hSerial"
,
hSerial
);
paramMap
.
put
(
"so"
,
so
);
paramMap
.
put
(
"
slotNum"
,
slotNum
);
paramMap
.
put
(
"
feederInfo"
,
feederInfo
);
HotayiBean
m10Bean
=
getM10Bean
(
task
.
getBarcode
(),
"5"
,
type
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>(
);
paramMap
.
put
(
"
Info"
,
m10Bean
.
getInfo
()
);
paramMap
.
put
(
"
Date"
,
m10Bean
.
getData
()
);
try
{
requestParams
=
JsonUtil
.
toJsonStr
(
paramMap
);
...
...
@@ -221,4 +195,46 @@ public class HotayiApi extends BaseSmfApiListener {
}
}
// M10 Notification
// Direction: MES Machine
// Fields Type Range Optional Description
// Barcode String Any No Solder Paste
// Barcode
// OperationMode Int 1 = Stock In Complete
//2 = Take out from fridge
//3 = Standby Complete
//4 = Mixer Complete
//5 = Stock Out Complete
// No
// Mode Int 1 = MES
//2 = Manual
// No MES =
// Scheduling
// Manual = Non
// MES Prepared
// Sample:
// {
// “Info”: {
//“MachineID”: “00001”,
//“IPAddress”: “192.168.0.1”,
//“MessageNo”: “M10”
// },
//“Data”: {
// “Barcode”: “A005$$A”,
//“OperationMode”: “1”
//“Mode”: “1”
// }
// }
private
HotayiBean
getM10Bean
(
String
barcode
,
String
OperationMode
,
String
Mode
)
{
HotayiBean
bean
=
new
HotayiBean
();
bean
.
addInfo
(
"MachineID"
,
machineID
);
bean
.
addInfo
(
"IPAddress"
,
iPAddress
);
bean
.
addInfo
(
"MessageNo"
,
"M10"
);
bean
.
addData
(
"Barcode"
,
barcode
);
bean
.
addData
(
"OperationMode"
,
OperationMode
);
bean
.
addData
(
"Mode"
,
Mode
);
return
bean
;
}
}
src/main/java/com/neotel/smfcore/custom/hotayi20057/HotayiController.java
查看文件 @
4a4451a
package
com
.
neotel
.
smfcore
.
custom
.
hotayi20057
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.JsonUtil
;
import
com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.order.LiteOrderCache
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
import
com.neotel.smfcore.core.storage.service.dao.IStoragePosDao
;
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.util.TaskService
;
import
com.neotel.smfcore.custom.hotayi20057.bean.HotayiBean
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -36,6 +42,12 @@ public class HotayiController {
@Autowired
private
IStoragePosDao
storagePosDao
;
@Autowired
private
IStoragePosManager
storagePosManager
;
@Autowired
private
TaskService
taskService
;
/**
* 收到M1返回M2
* M2 Machine Information
...
...
@@ -138,4 +150,95 @@ public class HotayiController {
}
// Stock Out
// Message send by MES to request machine operation
// Direction: MES → Machine
// Fields Type Range Optional Description
// Barcode String Any No Solder Paste
// Barcode
// Request Date Datetime Any No Start Process
// Output Date
// (Include Cycle
//Time & Standby
// Hour etc.)
// Format: yyyymm-dd hh:mm
// MixerBySecond Int 1 ~ n No Mixer Time
// Standby Hour Int 1 ~ n No Standby Time
// Sample:
// {
// “Info”: {
//“MachineID”: “00001”,
//“IPAddress”: “192.168.0.1”,
//“MessageNo”: “M5”
// },
//“Data”: {
// “Barcode”: “A005$$A”,
//“RequestDate”: “2022-01-01 19:00”,
//“MixerBySecond”: 120,
//“StandbyHour”: 4
// }
// }
@RequestMapping
(
"/m7"
)
@AnonymousAccess
public
HotayiBean
m7
(
@RequestBody
HotayiBean
hotayiBean
)
{
log
.
info
(
"收到M7请求数据为:{0}"
,
JsonUtil
.
toJsonStr
(
hotayiBean
));
String
barcode
=
hotayiBean
.
getInfoItem
(
"Barcode"
);
String
RequestDate
=
hotayiBean
.
getInfoItem
(
"RequestDate"
);
String
MixerBySecond
=
hotayiBean
.
getInfoItem
(
"MixerBySecond"
);
String
StandbyHour
=
hotayiBean
.
getInfoItem
(
"StandbyHour"
);
Locale
locale
=
new
Locale
(
"en"
,
"US"
);
StoragePos
pos
=
storagePosManager
.
getByBarcode
(
barcode
);
if
(
pos
==
null
)
{
String
msg
=
MessageUtils
.
getText
(
"smfcore.queryPos.cannotFindBarcode"
,
locale
,
"cannot find barcode ["
+
barcode
+
"] In storage"
);
hotayiBean
.
setM90
(
71
,
msg
);
log
.
info
(
"M7返回M90,数据为:"
+
JsonUtil
.
toJsonStr
(
hotayiBean
));
return
hotayiBean
;
}
//判断是否在出库中
try
{
}
catch
(
ValidateException
ex
)
{
String
msg
=
MessageUtils
.
getText
(
ex
.
getMsgKey
(),
locale
,
ex
.
getDefaultMsg
());
hotayiBean
.
setM90
(
72
,
msg
);
log
.
info
(
"M7返回M90,数据为:"
+
JsonUtil
.
toJsonStr
(
hotayiBean
));
return
hotayiBean
;
}
Storage
storage
=
dataCache
.
getStorageById
(
pos
.
getStorageId
());
String
result
=
taskService
.
checkout
(
pos
,
true
,
null
,
false
);
if
(
ObjectUtil
.
isNotEmpty
(
result
))
{
String
msg
=
MessageUtils
.
getText
(
result
,
locale
,
"barcode ["
+
barcode
+
"] checkOut fail"
);
hotayiBean
.
setM90
(
73
,
msg
);
log
.
info
(
"M7返回M90,数据为:"
+
JsonUtil
.
toJsonStr
(
hotayiBean
));
return
hotayiBean
;
}
// M8 Action Status
// Direction: MES Machine
// Fields Type Range Optional Description
// Message String String No Error Message
// Success Message
// Sample:
// {
// “Info”: {
//“MachineID”: “00001”,
//“IPAddress”: “192.168.0.1”,
//“MessageNo”: “M8”
// },
//“Data”: {
// “Message”: “Standby Success”
// }
// }
hotayiBean
.
addInfo
(
"MessageNo"
,
"M8"
);
Map
<
String
,
Object
>
resultData
=
new
HashMap
<>();
resultData
.
put
(
"Message"
,
"Standby Success"
);
hotayiBean
.
setData
(
resultData
);
log
.
info
(
"M7返回M8,数据为:"
+
JsonUtil
.
toJsonStr
(
hotayiBean
));
return
hotayiBean
;
}
}
src/main/java/com/neotel/smfcore/custom/hotayi20057/bean/HotayiBean.java
查看文件 @
4a4451a
...
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.custom.hotayi20057.bean;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -11,7 +12,7 @@ import java.util.Map;
* @date 2023/1/11 3:01 PM
*/
@Data
public
class
HotayiBean
{
public
class
HotayiBean
implements
Serializable
{
@JsonProperty
(
"Info"
)
private
Map
<
String
,
String
>
info
=
new
HashMap
<>();
...
...
@@ -48,4 +49,26 @@ public class HotayiBean {
return
""
;
}
public
void
setM90
(
int
code
,
String
msg
){
// M90 Error Message
//
// Sample:
// {
// “Info”: {
// “MachineID”: “00001”,
// “IPAddress”: “192.168.0.1”,
// “MessageNo”: “M90”
// },
//“Data”: {
// “ErrorCode”: “1234”,
// “ErrorMessage”: “Machine error due to something”
// }
// }
this
.
addInfo
(
"MessageNo"
,
"M90"
);
data
=
new
HashMap
<>();
this
.
addData
(
"ErrorCode"
,
code
+
""
);
this
.
addData
(
"ErrorMessage"
,
msg
);
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论