Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f7d9a30b
由
sunke
编写于
2022-11-10 18:07:40 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
908和西门子对接
1 个父辈
42452084
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
49 行增加
和
19 行删除
src/main/java/com/neotel/smfcore/common/utils/HttpHelper.java
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
src/main/java/com/neotel/smfcore/custom/siemens/SiemensApi.java
src/main/resources/config/application.yml
src/main/resources/log4j2-spring.xml
src/main/java/com/neotel/smfcore/common/utils/HttpHelper.java
查看文件 @
f7d9a30
...
@@ -45,9 +45,9 @@ public class HttpHelper {
...
@@ -45,9 +45,9 @@ public class HttpHelper {
String
requestBody
=
mapper
.
writeValueAsString
(
params
);
String
requestBody
=
mapper
.
writeValueAsString
(
params
);
httpPost
.
setEntity
(
new
StringEntity
(
requestBody
,
CONTENT_CHARSET
));
httpPost
.
setEntity
(
new
StringEntity
(
requestBody
,
CONTENT_CHARSET
));
}
catch
(
JsonProcessingException
e
)
{
}
catch
(
JsonProcessingException
e
)
{
throw
new
ApiException
(
"Request params to ["
+
url
+
"] failed:"
+
e
.
getMessage
());
throw
new
ApiException
(
"Request params to ["
+
url
+
"]
Json
failed:"
+
e
.
getMessage
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
ApiException
(
"Request params to ["
+
url
+
"]
failed
:"
+
e
.
getMessage
());
throw
new
ApiException
(
"Request params to ["
+
url
+
"]
json exception
:"
+
e
.
getMessage
());
}
}
}
}
try
{
try
{
...
...
src/main/java/com/neotel/smfcore/core/device/rest/DeviceController.java
查看文件 @
f7d9a30
...
@@ -10,6 +10,8 @@ import com.neotel.smfcore.common.bean.ResultBean;
...
@@ -10,6 +10,8 @@ import com.neotel.smfcore.common.bean.ResultBean;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.Constants
;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
import
com.neotel.smfcore.common.utils.ReelLockPosUtil
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.api.bean.CodeValidateParam
;
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.bean.PosInfo
;
import
com.neotel.smfcore.core.device.bean.PosInfo
;
...
@@ -27,6 +29,7 @@ import com.neotel.smfcore.core.device.handler.IDeviceHandler;
...
@@ -27,6 +29,7 @@ import com.neotel.smfcore.core.device.handler.IDeviceHandler;
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.storage.service.po.Storage
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.security.service.manager.IGroupManager
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -57,6 +60,12 @@ public class DeviceController {
...
@@ -57,6 +60,12 @@ public class DeviceController {
@Autowired
@Autowired
private
IStoragePosManager
storagePosManager
;
private
IStoragePosManager
storagePosManager
;
/**
* 权限验证API列表
*/
@Autowired
protected
SmfApi
smfApi
;
private
Map
<
String
,
IDeviceHandler
>
handlerMap
=
new
HashMap
<>();
private
Map
<
String
,
IDeviceHandler
>
handlerMap
=
new
HashMap
<>();
public
DeviceController
(
List
<
IDeviceHandler
>
deviceHandlerList
)
{
public
DeviceController
(
List
<
IDeviceHandler
>
deviceHandlerList
)
{
...
@@ -99,6 +108,21 @@ public class DeviceController {
...
@@ -99,6 +108,21 @@ public class DeviceController {
* 流水线提示消息
* 流水线提示消息
*/
*/
private
static
String
lineMsg
=
""
;
private
static
String
lineMsg
=
""
;
public
Barcode
resolveBarcodeFromApi
(
CodeValidateParam
params
){
Barcode
barcodeSave
=
smfApi
.
canPutInBeforeResolve
(
params
);
if
(
barcodeSave
==
null
){
barcodeSave
=
codeResolve
.
resolveOneValideBarcode
(
params
.
getCode
());
}
//从API验证
Barcode
barcodeFromApi
=
smfApi
.
canPutInAfterResolve
(
barcodeSave
);
if
(
barcodeFromApi
!=
null
)
{
barcodeSave
=
barcodeFromApi
;
}
return
barcodeSave
;
}
/**
/**
* 流水线入库查找空的料格
* 流水线入库查找空的料格
*/
*/
...
@@ -152,9 +176,9 @@ public class DeviceController {
...
@@ -152,9 +176,9 @@ public class DeviceController {
errorMsg
=
"无可用的料仓"
;
errorMsg
=
"无可用的料仓"
;
resultMap
.
put
(
"msg"
,
errorMsg
);
resultMap
.
put
(
"msg"
,
errorMsg
);
}
else
{
}
else
{
try
{
try
{
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
code
);
CodeValidateParam
params
=
new
CodeValidateParam
(
""
,
""
,
""
,
code
,
""
);
Barcode
barcode
=
resolveBarcodeFromApi
(
params
);
if
(
barcode
==
null
)
{
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
throw
new
ValidateException
(
"smfcore.error.barcode.invalid"
,
"{0}不是有效的条码"
,
new
String
[]{
code
});
}
}
...
...
src/main/java/com/neotel/smfcore/custom/siemens/SiemensApi.java
查看文件 @
f7d9a30
...
@@ -141,6 +141,12 @@ public class SiemensApi extends BaseSmfApiListener {
...
@@ -141,6 +141,12 @@ public class SiemensApi extends BaseSmfApiListener {
cid
=
storage
.
getCid
();
cid
=
storage
.
getCid
();
}
}
for
(
CodeBean
codebean
:
codeBeans
)
{
for
(
CodeBean
codebean
:
codeBeans
)
{
if
(
codebean
.
getReelHeight
()
<=
0
){
codebean
.
setReelHeight
(
1
);
}
if
(
codebean
.
getReelWidth
()
<=
0
){
codebean
.
setReelWidth
(
1
);
}
LotCheckInfo
info
=
lotCheckIn
(
codebean
.
getCodeStr
(),
inCheckUrl
,
cid
);
LotCheckInfo
info
=
lotCheckIn
(
codebean
.
getCodeStr
(),
inCheckUrl
,
cid
);
if
(
info
!=
null
&&
info
.
isStatus
()
&&
ObjectUtil
.
isNotEmpty
(
info
.
getPartnum
())
&&
ObjectUtil
.
isNotEmpty
(
info
.
getQuantity
()))
{
if
(
info
!=
null
&&
info
.
isStatus
()
&&
ObjectUtil
.
isNotEmpty
(
info
.
getPartnum
())
&&
ObjectUtil
.
isNotEmpty
(
info
.
getQuantity
()))
{
//查找元器件是否存在
//查找元器件是否存在
...
@@ -150,8 +156,8 @@ public class SiemensApi extends BaseSmfApiListener {
...
@@ -150,8 +156,8 @@ public class SiemensApi extends BaseSmfApiListener {
component
=
new
com
.
neotel
.
smfcore
.
core
.
barcode
.
service
.
po
.
Component
();
component
=
new
com
.
neotel
.
smfcore
.
core
.
barcode
.
service
.
po
.
Component
();
component
.
setPartNumber
(
info
.
getPartnum
());
component
.
setPartNumber
(
info
.
getPartnum
());
component
.
setAmount
(
info
.
getQuantity
());
component
.
setAmount
(
info
.
getQuantity
());
component
.
setHeight
(
1
);
component
.
setHeight
(
codebean
.
getReelWidth
()
);
component
.
setPlateSize
(
1
);
component
.
setPlateSize
(
codebean
.
getReelHeight
()
);
component
=
componentManager
.
saveComponent
(
component
);
component
=
componentManager
.
saveComponent
(
component
);
log
.
info
(
"siemensCheckCode 新增 元器件:["
+
component
.
getPartNumber
()
+
"]["
+
component
.
getAmount
()
+
"]["
+
component
.
getPlateSize
()
+
"]X["
+
component
.
getHeight
()
+
"]"
);
log
.
info
(
"siemensCheckCode 新增 元器件:["
+
component
.
getPartNumber
()
+
"]["
+
component
.
getAmount
()
+
"]["
+
component
.
getPlateSize
()
+
"]X["
+
component
.
getHeight
()
+
"]"
);
}
else
if
(
component
.
getAmount
()
!=
info
.
getQuantity
())
{
}
else
if
(
component
.
getAmount
()
!=
info
.
getQuantity
())
{
...
@@ -164,8 +170,8 @@ public class SiemensApi extends BaseSmfApiListener {
...
@@ -164,8 +170,8 @@ public class SiemensApi extends BaseSmfApiListener {
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
codebean
.
getCodeStr
());
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
codebean
.
getCodeStr
());
if
(
barcode
==
null
)
{
if
(
barcode
==
null
)
{
barcode
=
new
Barcode
();
barcode
=
new
Barcode
();
barcode
.
setPlateSize
(
co
mponent
.
getPlateSize
());
barcode
.
setPlateSize
(
co
debean
.
getReelWidth
());
barcode
.
setHeight
(
co
mponent
.
get
Height
());
barcode
.
setHeight
(
co
debean
.
getReel
Height
());
barcode
.
setBarcode
(
codebean
.
getCodeStr
());
barcode
.
setBarcode
(
codebean
.
getCodeStr
());
barcode
.
setAmount
(
component
.
getAmount
());
barcode
.
setAmount
(
component
.
getAmount
());
barcode
.
setFullCode
(
codebean
.
getCodeStr
());
barcode
.
setFullCode
(
codebean
.
getCodeStr
());
...
@@ -173,8 +179,8 @@ public class SiemensApi extends BaseSmfApiListener {
...
@@ -173,8 +179,8 @@ public class SiemensApi extends BaseSmfApiListener {
barcode
=
barcodeManager
.
saveBarcode
(
barcode
);
barcode
=
barcodeManager
.
saveBarcode
(
barcode
);
log
.
info
(
"siemensCheckCode 新增 条码:["
+
barcode
.
getBarcode
()
+
"] "
);
log
.
info
(
"siemensCheckCode 新增 条码:["
+
barcode
.
getBarcode
()
+
"] "
);
}
else
if
(!
barcode
.
getPartNumber
().
equals
(
component
.
getPartNumber
())){
}
else
if
(!
barcode
.
getPartNumber
().
equals
(
component
.
getPartNumber
())){
barcode
.
setPlateSize
(
co
mponent
.
getPlateSize
());
barcode
.
setPlateSize
(
co
debean
.
getReelWidth
());
barcode
.
setHeight
(
co
mponent
.
get
Height
());
barcode
.
setHeight
(
co
debean
.
getReel
Height
());
barcode
.
setBarcode
(
codebean
.
getCodeStr
());
barcode
.
setBarcode
(
codebean
.
getCodeStr
());
barcode
.
setAmount
(
component
.
getAmount
());
barcode
.
setAmount
(
component
.
getAmount
());
barcode
.
setPartNumber
(
component
.
getPartNumber
());
barcode
.
setPartNumber
(
component
.
getPartNumber
());
...
...
src/main/resources/config/application.yml
查看文件 @
f7d9a30
...
@@ -2,11 +2,11 @@ server:
...
@@ -2,11 +2,11 @@ server:
port
:
8800
port
:
8800
api
:
api
:
name
:
Neotel
# name: Siemens
inCheckUrl
:
#
inCheckUrl:
outNotifyUrl
:
# outNotifyUrl: http://cnctu04053:8015/api/JsonC
inNotifyUrl
:
# inNotifyUrl: http://cnctu04053:8015/api/JsonC
#codeResolveUrl: hellaCodeResolve
# codeResolveUrl: http://cnctu04053:8015/api/JsonC
hella
:
hella
:
#host: 127.0.0.1
#host: 127.0.0.1
...
...
src/main/resources/log4j2-spring.xml
查看文件 @
f7d9a30
...
@@ -2,14 +2,14 @@
...
@@ -2,14 +2,14 @@
<configuration
status=
"WARN"
>
<configuration
status=
"WARN"
>
<Properties>
<Properties>
<Property
name=
"LOG_HOME"
>
logs
</Property>
<Property
name=
"LOG_HOME"
>
logs
</Property>
<Property
name=
"LOG_NAME"
>
smf
.txt
</Property>
<Property
name=
"LOG_NAME"
>
smf
</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} %-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}
.txt"
filePattern=
"${LOG_HOME}/${LOG_NAME}.%d{yyyy-MM-dd}.txt
"
append=
"true"
>
<PatternLayout
charset=
"GB18030"
pattern=
"%d{yyyy-MM-dd HH:mm:ss} %-5level [%file:%line] - %msg%n"
/>
<PatternLayout
charset=
"GB18030"
pattern=
"%d{yyyy-MM-dd HH:mm:ss
.SSS
} %-5level [%file:%line] - %msg%n"
/>
<Policies>
<Policies>
<TimeBasedTriggeringPolicy
modulate=
"true"
interval=
"1"
/>
<TimeBasedTriggeringPolicy
modulate=
"true"
interval=
"1"
/>
</Policies>
</Policies>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论