Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 2d5342eb
由
sunke
编写于
2021-11-19 16:28:02 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
改海拉料架为通用料架使用接口
1 个父辈
0adec304
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
92 行增加
和
6 行删除
src/main/java/com/neotel/smfcore/core/barcode/bean/BarcodeRule.java
src/main/java/com/neotel/smfcore/core/device/api/IOpAuthApi.java
src/main/java/com/neotel/smfcore/core/device/handler/impl/SensorShelfHandler.java
src/main/java/com/neotel/smfcore/core/order/enums/ORDER_COLOR.java
src/main/java/com/neotel/smfcore/core/barcode/bean/BarcodeRule.java
查看文件 @
2d5342e
...
...
@@ -415,7 +415,7 @@ public class BarcodeRule {
String
value
=
getStrValue
(
codeArr
);
if
(!
Strings
.
isNullOrEmpty
(
value
)){
try
{
return
Float
.
valueOf
(
value
).
intValue
();
return
Float
.
valueOf
(
value
.
trim
()
).
intValue
();
}
catch
(
Exception
ex
){
log
.
warn
(
value
+
" is not a validate int"
);
}
...
...
src/main/java/com/neotel/smfcore/core/device/api/IOpAuthApi.java
查看文件 @
2d5342e
...
...
@@ -10,6 +10,14 @@ import com.neotel.smfcore.core.barcode.service.po.Barcode;
public
interface
IOpAuthApi
{
/**
* 传入原始条码,API解析条码,注意条码中带有尺寸信息,此方法会在canPutIn方法之前调用,通常料架使用(其他设备会有尺寸信息且会有多个条码所以不适用此方法)
* @param code
* @return
* @throws ValidateException
*/
Barcode
resolveBarcode
(
String
code
)
throws
ValidateException
;
/**
* 是否可入库验证
*/
Barcode
canPutIn
(
Barcode
barcode
)
throws
ValidateException
;
...
...
src/main/java/com/neotel/smfcore/core/device/handler/impl/SensorShelfHandler.java
查看文件 @
2d5342e
...
...
@@ -4,6 +4,7 @@ import com.google.common.base.Strings;
import
com.google.common.collect.Lists
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.StorageConstants
;
import
com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
...
...
@@ -24,12 +25,13 @@ import com.neotel.smfcore.core.system.websocket.SocketMsg;
import
com.neotel.smfcore.core.system.websocket.WebSocketServer
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
com.neotel.smfcore.security.service.po.Group
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
...
...
@@ -47,6 +49,82 @@ public class SensorShelfHandler extends BaseDeviceHandler {
super
(
apiList
);
}
/**
* 扫码
*/
@ApiOperation
(
"扫码入库"
)
@PostMapping
(
"/codeIn"
)
@PreAuthorize
(
"@el.check('sensorShelf:putIn')"
)
public
ResultBean
codeIn
(
@RequestBody
Map
<
String
,
String
>
mapValues
)
{
String
code
=
mapValues
.
get
(
"code"
);
String
groupId
=
mapValues
.
get
(
"group"
);
String
storageId
=
mapValues
.
get
(
"storageId"
);
if
(
ObjectUtils
.
isEmpty
(
code
)){
throw
new
ValidateException
(
"smfcode.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"code"
});
}
if
(
groupId
==
null
&&
storageId
==
null
){
throw
new
ValidateException
(
"smfcode.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"group"
});
}
if
(
groupId
==
null
&&
storageId
!=
null
){
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
storage
!=
null
){
groupId
=
storage
.
getGroupId
();
}
}
if
(
groupId
!=
null
&&
groupId
.
equals
(
"-1"
)){
groupId
=
""
;
}
String
loginUser
=
SecurityUtils
.
getLoginUsername
();
Collection
<
DataLog
>
queueTasks
=
taskService
.
getQueueTasks
();
ResultBean
resultBean
=
null
;
for
(
DataLog
queueTask
:
queueTasks
)
{
if
(
queueTask
.
isPutInTask
()
&&
queueTask
.
isWait
())
{
if
(!
Strings
.
isNullOrEmpty
(
groupId
)
&&
queueTask
.
getGroupId
().
equals
(
groupId
))
{
log
.
info
(
"codeIn ["
+
code
+
"]["
+
groupId
+
"]入库失败:条码["
+
queueTask
.
getBarcode
()
+
"]的任务还未结束 "
);
throw
new
ValidateException
(
"smfcore.unfinished"
,
"the task of [{0}] is unfinished"
,
new
String
[]{
queueTask
.
getBarcode
()});
}
if
(!
Strings
.
isNullOrEmpty
(
storageId
)
&&
queueTask
.
getStorageId
().
equals
(
storageId
))
{
log
.
info
(
"codeIn ["
+
code
+
"]["
+
storageId
+
"]入库失败:条码["
+
queueTask
.
getBarcode
()
+
"]的任务还未结束 "
);
throw
new
ValidateException
(
"smfcore.unfinished"
,
"the task of [{0}] is unfinished"
,
new
String
[]{
queueTask
.
getBarcode
()});
}
}
}
Barcode
barcodeSave
=
resolveBarcodeFromApiForShelf
(
code
);
if
(
barcodeSave
==
null
){
barcodeSave
=
codeResolve
.
resolveOneValideBarcode
(
code
);
}
Date
expireDate
=
barcodeSave
.
getExpireDate
();
if
(
expireDate
!=
null
)
{
if
(
System
.
currentTimeMillis
()
>
expireDate
.
getTime
())
{
throw
new
ValidateException
(
"smfcore.error.barcode.expired"
,
"物料已过期,无法入库."
);
}
}
//从API验证
barcodeSave
=
verifyPutInFromApi
(
barcodeSave
);
// resultBean = hellaServiceHandler.checkMaterial(loginUser, groupId, code);
return
resultBean
;
}
/**
* 从API接口解析条码,通常料架使用(其他设备会有尺寸信息且会有多个条码所以不适用此方法)
*/
protected
Barcode
resolveBarcodeFromApiForShelf
(
String
code
)
throws
ValidateException
{
for
(
IOpAuthApi
opAuthApi
:
opAuthApiList
)
{
Barcode
responseBarcode
=
opAuthApi
.
resolveBarcode
(
code
);
if
(
responseBarcode
!=
null
){
return
responseBarcode
;
}
}
return
null
;
}
@Override
public
StatusBean
handleClientRequest
(
StatusBean
statusBean
,
HttpServletRequest
request
)
{
handleMsg
(
statusBean
);
...
...
src/main/java/com/neotel/smfcore/core/order/enums/ORDER_COLOR.java
查看文件 @
2d5342e
...
...
@@ -9,8 +9,8 @@ import java.util.Set;
*/
public
enum
ORDER_COLOR
{
//
magenta,
cyan,firebrick,purple,skyblue,pink,forestgreen,lightblue,indianred,darkgreen
//
洋红,
青色,砖红色,紫色,天蓝色,粉色,森林绿,浅蓝色,印度红,深绿色
//cyan,firebrick,purple,skyblue,pink,forestgreen,lightblue,indianred,darkgreen
//青色,砖红色,紫色,天蓝色,粉色,森林绿,浅蓝色,印度红,深绿色
// 'red':[1,125,0,0],
// 'yellow':[2,125,125,0],
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论