Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f405289c
由
zshaohui
编写于
2024-07-19 16:16:25 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
物料放入料格
1 个父辈
f4860b50
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
249 行增加
和
4 行删除
src/main/java/com/neotel/smfcore/custom/luxsan_sp/api/bean/request/SpareInHourseRequest.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/api/bean/result/GetSpareNoResult.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/bean/CodeBarcode.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/bean/SpareNo.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/controller/SpBoxPutInController.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/controller/SpSpareNoController.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/util/CodeUtil.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/util/SpareNoCache.java
src/main/java/com/neotel/smfcore/custom/luxsan_sp/api/bean/request/SpareInHourseRequest.java
查看文件 @
f405289
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
api
.
bean
.
request
;
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
api
.
bean
.
request
;
import
com.neotel.smfcore.custom.luxsan_sp.api.bean.result.SpareInHourseDetail
;
import
com.neotel.smfcore.custom.luxsan_sp.api.bean.result.SpareInHourseDetail
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.List
;
@AllArgsConstructor
@Data
@Data
public
class
SpareInHourseRequest
{
public
class
SpareInHourseRequest
{
...
...
src/main/java/com/neotel/smfcore/custom/luxsan_sp/api/bean/result/GetSpareNoResult.java
查看文件 @
f405289
...
@@ -22,7 +22,7 @@ public class GetSpareNoResult {
...
@@ -22,7 +22,7 @@ public class GetSpareNoResult {
private
String
status
;
private
String
status
;
//厂区id
//厂区id
private
int
deptId
;
private
String
deptId
;
//料号明细
//料号明细
private
List
<
GetSpareNoDetail
>
detailList
;
private
List
<
GetSpareNoDetail
>
detailList
;
...
...
src/main/java/com/neotel/smfcore/custom/luxsan_sp/bean/CodeBarcode.java
0 → 100644
查看文件 @
f405289
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
bean
;
import
lombok.Data
;
@Data
public
class
CodeBarcode
{
private
String
partNumber
;
private
int
qty
;
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/bean/SpareNo.java
查看文件 @
f405289
...
@@ -4,6 +4,7 @@ import com.neotel.smfcore.common.base.BasePo;
...
@@ -4,6 +4,7 @@ import com.neotel.smfcore.common.base.BasePo;
import
com.neotel.smfcore.custom.luxsan_sp.enums.SpareNostatus
;
import
com.neotel.smfcore.custom.luxsan_sp.enums.SpareNostatus
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
@Data
@Data
...
@@ -24,7 +25,7 @@ public class SpareNo extends BasePo {
...
@@ -24,7 +25,7 @@ public class SpareNo extends BasePo {
private
String
status
;
private
String
status
;
//厂区id
//厂区id
private
int
deptId
;
private
String
deptId
;
//料号明细
//料号明细
private
List
<
SpareNoDetail
>
detailList
;
private
List
<
SpareNoDetail
>
detailList
;
...
@@ -38,4 +39,18 @@ public class SpareNo extends BasePo {
...
@@ -38,4 +39,18 @@ public class SpareNo extends BasePo {
public
boolean
isExecutIng
(){
public
boolean
isExecutIng
(){
return
spareNostatus
==
SpareNostatus
.
EXECUTING_STATUS
;
return
spareNostatus
==
SpareNostatus
.
EXECUTING_STATUS
;
}
}
public
void
updateDetailList
(
SpareNoDetail
spareNoDetail
)
{
if
(
detailList
==
null
)
{
detailList
=
new
ArrayList
<>();
}
if
(
detailList
==
null
||
detailList
.
isEmpty
())
{
detailList
.
add
(
spareNoDetail
);
}
else
{
//移除
detailList
.
removeIf
(
t
->
t
.
getPartno
().
equals
(
spareNoDetail
.
getPartno
()));
detailList
.
add
(
spareNoDetail
);
}
}
}
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/controller/SpBoxPutInController.java
查看文件 @
f405289
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
controller
;
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
controller
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
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.enums.OP
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
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.lizhen.agvBox.bean.Station
;
import
com.neotel.smfcore.custom.lizhen.agvBox.bean.Station
;
import
com.neotel.smfcore.custom.lizhen.agvBox.util.StationCacheUtil
;
import
com.neotel.smfcore.custom.lizhen.agvBox.util.StationCacheUtil
;
import
com.neotel.smfcore.custom.luxsan_sp.api.LuxsanSpApi
;
import
com.neotel.smfcore.custom.luxsan_sp.api.bean.request.SpareInHourseRequest
;
import
com.neotel.smfcore.custom.luxsan_sp.api.bean.result.SpareInHourseDetail
;
import
com.neotel.smfcore.custom.luxsan_sp.bean.CodeBarcode
;
import
com.neotel.smfcore.custom.luxsan_sp.bean.SpareNo
;
import
com.neotel.smfcore.custom.luxsan_sp.bean.SpareNoDetail
;
import
com.neotel.smfcore.custom.luxsan_sp.enums.SpareNostatus
;
import
com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager
;
import
com.neotel.smfcore.custom.luxsan_sp.util.CodeUtil
;
import
com.neotel.smfcore.custom.luxsan_sp.util.SpBoxUtil
;
import
com.neotel.smfcore.custom.luxsan_sp.util.SpBoxUtil
;
import
com.neotel.smfcore.custom.luxsan_sp.util.SpareNoCache
;
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
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -26,6 +46,20 @@ public class SpBoxPutInController {
...
@@ -26,6 +46,20 @@ public class SpBoxPutInController {
@Autowired
@Autowired
private
CodeResolve
codeResolve
;
private
CodeResolve
codeResolve
;
@Autowired
private
IStoragePosManager
storagePosManager
;
@Autowired
private
IBarcodeManager
barcodeManager
;
@Autowired
private
SpareNoCache
spareNoCache
;
@Autowired
private
ISpareNoManager
spareNoManager
;
@Autowired
private
TaskService
taskService
;
@ApiOperation
(
"获取当前工位的料箱信息"
)
@ApiOperation
(
"获取当前工位的料箱信息"
)
@RequestMapping
(
"/getStationInfo"
)
@RequestMapping
(
"/getStationInfo"
)
...
@@ -61,4 +95,140 @@ public class SpBoxPutInController {
...
@@ -61,4 +95,140 @@ public class SpBoxPutInController {
}
}
//以料格为维度,一个料格
@ApiOperation
(
"物料放入料格"
)
@RequestMapping
(
"/reelToBox"
)
@AnonymousAccess
public
synchronized
ResultBean
reelToBox
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
boxStr
=
paramMap
.
get
(
"boxStr"
);
String
codeStr
=
paramMap
.
get
(
"codeStr"
);
String
binCodeStr
=
paramMap
.
get
(
"binCodeStr"
);
//解析料箱信息
Barcode
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
"=2x2="
+
boxStr
);
if
(
boxBarcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
boxStr
+
"不是有效的条码"
);
}
//解析料格信息
Barcode
binBarcode
=
codeResolve
.
resolveOneValideBarcode
(
"=2x2="
+
binCodeStr
);
if
(
binBarcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
binCodeStr
+
"不是有效的条码"
);
}
//1.判断料格信息与料箱信息是否匹配
if
(!
binBarcode
.
getBarcode
().
startsWith
(
boxBarcode
.
getBarcode
()))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
binCodeStr
+
"不是当前料箱:"
+
boxStr
+
"的隔口"
);
}
//2.解析条码信息
CodeBarcode
codeBarcode
=
CodeUtil
.
getCodeBarcode
(
codeStr
);
if
(
codeBarcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
codeStr
+
"不是有效的条码"
);
}
//判断有没有正在执行入库单
//TODO 等到做退库单的时候,再判断有没有正在执行的入库单
SpareNo
spareNo
=
spareNoCache
.
getExecutIngSpareNo
();
if
(
spareNo
==
null
){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"没有找到正在执行的入库单或者退库单"
);
}
//3.判断与当前隔口的料号是否匹配
String
binPartNumber
=
binBarcode
.
getPartNumber
();
if
(
binPartNumber
.
equals
(
"CS"
)
||
binPartNumber
.
equals
(
"CB"
)
||
binPartNumber
.
equals
(
"CM"
))
{
binPartNumber
=
""
;
}
String
codePartNumber
=
codeBarcode
.
getPartNumber
();
if
(
StringUtils
.
isEmpty
(
binPartNumber
))
{
binPartNumber
=
codePartNumber
;
}
else
{
if
(!
binPartNumber
.
equals
(
codePartNumber
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
codeStr
+
"与隔口:"
+
binCodeStr
+
"的料号不匹配"
);
}
}
//判断当前入库的是否和入库单一样
//TODO 后续需要判断是否和退库单一样
if
(
spareNo
!=
null
)
{
List
<
SpareNoDetail
>
detailList
=
spareNo
.
getDetailList
();
SpareNoDetail
spareNoDetail
=
null
;
for
(
SpareNoDetail
detail
:
detailList
)
{
//如果相同的话,判断数量是否大于需求数量
if
(
detail
.
getPartno
().
equals
(
codePartNumber
))
{
if
(
detail
.
getAlrInQty
()
+
codeBarcode
.
getQty
()
<=
detail
.
getInQty
())
{
spareNoDetail
=
detail
;
break
;
}
}
}
if
(
spareNoDetail
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
codePartNumber
+
"没有入退库需求,请检查是否存在或者不符合入退库数量"
);
}
//先调用入库接口
SpareInHourseDetail
detail
=
new
SpareInHourseDetail
();
detail
.
setInQty
(
codeBarcode
.
getQty
());
detail
.
setPartno
(
codeBarcode
.
getPartNumber
());
detail
.
setLocationCode
(
binBarcode
.
getBarcode
());
LuxsanSpApi
.
spareInHourse
(
new
SpareInHourseRequest
(
spareNo
.
getDeptId
(),
spareNo
.
getSpareNo
(),
spareNo
.
getWhCode
(),
Arrays
.
asList
(
detail
)));
//数量加1
spareNoDetail
.
setAlrInQty
(
spareNoDetail
.
getAlrInQty
()+
codeBarcode
.
getQty
());
spareNo
.
updateDetailList
(
spareNoDetail
);
//判断是否已经完成了
boolean
finish
=
true
;
for
(
SpareNoDetail
noDetail
:
spareNo
.
getDetailList
())
{
if
(
noDetail
.
getInQty
()
<
noDetail
.
getAlrInQty
()){
finish
=
false
;
}
}
if
(
finish
){
spareNo
.
setSpareNostatus
(
SpareNostatus
.
CLOSE_STATUS
);
}
spareNoCache
.
addToMap
(
spareNo
);
spareNoManager
.
save
(
spareNo
);
}
//4.开始放入料箱
binBarcode
.
setAmount
(
binBarcode
.
getAmount
()+
codeBarcode
.
getQty
());
boxBarcode
.
updateSubCodes
(
binBarcode
);
barcodeManager
.
save
(
boxBarcode
);
//5.寻找空库位
StoragePos
pos
=
SpBoxUtil
.
locOnePos
(
boxBarcode
);
if
(
pos
==
null
){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
boxStr
+
"未找到可用的库位"
);
}
//6.生成入库任务
DataLog
dataLog
=
new
DataLog
();
dataLog
.
setPartNumber
(
codeBarcode
.
getPartNumber
());
dataLog
.
setOperator
(
SecurityUtils
.
getLoginUsername
());
dataLog
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
dataLog
.
setPosName
(
binBarcode
.
getBarcode
());
dataLog
.
setType
(
OP
.
PUT_IN
);
taskService
.
updateFinishedTask
(
dataLog
);
pos
.
setBarcode
(
boxBarcode
);
pos
.
setUsed
(
true
);
storagePosManager
.
save
(
pos
);
return
ResultBean
.
newOkResult
(
""
);
}
}
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/controller/SpSpareNoController.java
查看文件 @
f405289
...
@@ -55,7 +55,7 @@ public class SpSpareNoController {
...
@@ -55,7 +55,7 @@ public class SpSpareNoController {
@AnonymousAccess
@AnonymousAccess
public
ResultBean
checkSpareNo
(
String
spareNoStr
)
{
public
ResultBean
checkSpareNo
(
String
spareNoStr
)
{
//判断有没有正在执行的任务单
//判断有没有正在执行的任务单
String
no
=
spareNoCache
.
getExecutIngSpareNo
();
String
no
=
spareNoCache
.
getExecutIngSpareNo
Str
();
if
(
StringUtils
.
isNotEmpty
(
no
))
{
if
(
StringUtils
.
isNotEmpty
(
no
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"有正在执行的入库单:"
+
no
);
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"有正在执行的入库单:"
+
no
);
}
}
...
...
src/main/java/com/neotel/smfcore/custom/luxsan_sp/util/CodeUtil.java
0 → 100644
查看文件 @
f405289
package
com
.
neotel
.
smfcore
.
custom
.
luxsan_sp
.
util
;
import
com.neotel.smfcore.custom.luxsan_sp.bean.CodeBarcode
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
public
class
CodeUtil
{
public
static
CodeBarcode
getCodeBarcode
(
String
codeStr
){
if
(!
codeStr
.
contains
(
"&&"
)){
return
null
;
}
try
{
String
[]
split
=
codeStr
.
split
(
"&&"
);
String
partNumber
=
split
[
0
];
int
qty
=
Integer
.
parseInt
(
split
[
1
]);
CodeBarcode
codeBarcode
=
new
CodeBarcode
();
codeBarcode
.
setQty
(
qty
);
codeBarcode
.
setPartNumber
(
partNumber
);
return
codeBarcode
;
}
catch
(
NumberFormatException
e
)
{
e
.
printStackTrace
();
log
.
info
(
codeStr
+
"解析失败:"
+
e
.
getMessage
());
}
return
null
;
}
}
src/main/java/com/neotel/smfcore/custom/luxsan_sp/util/SpareNoCache.java
查看文件 @
f405289
...
@@ -26,6 +26,7 @@ public class SpareNoCache {
...
@@ -26,6 +26,7 @@ public class SpareNoCache {
cacheMap
.
put
(
spareNo
.
getSpareNo
(),
spareNo
);
cacheMap
.
put
(
spareNo
.
getSpareNo
(),
spareNo
);
}
}
public
SpareNo
getBySpareNo
(
String
spareNoStr
)
{
public
SpareNo
getBySpareNo
(
String
spareNoStr
)
{
SpareNo
spareNo
=
cacheMap
.
get
(
spareNoStr
);
SpareNo
spareNo
=
cacheMap
.
get
(
spareNoStr
);
if
(
spareNo
==
null
){
if
(
spareNo
==
null
){
...
@@ -38,7 +39,7 @@ public class SpareNoCache {
...
@@ -38,7 +39,7 @@ public class SpareNoCache {
}
}
public
String
getExecutIngSpareNo
(){
public
String
getExecutIngSpareNo
Str
(){
for
(
String
spareNoStr
:
cacheMap
.
keySet
())
{
for
(
String
spareNoStr
:
cacheMap
.
keySet
())
{
SpareNo
spareNo
=
cacheMap
.
get
(
spareNoStr
);
SpareNo
spareNo
=
cacheMap
.
get
(
spareNoStr
);
if
(
spareNo
.
getSpareNostatus
()
==
SpareNostatus
.
EXECUTING_STATUS
){
if
(
spareNo
.
getSpareNostatus
()
==
SpareNostatus
.
EXECUTING_STATUS
){
...
@@ -48,6 +49,16 @@ public class SpareNoCache {
...
@@ -48,6 +49,16 @@ public class SpareNoCache {
return
""
;
return
""
;
}
}
public
SpareNo
getExecutIngSpareNo
(){
for
(
String
spareNoStr
:
cacheMap
.
keySet
())
{
SpareNo
spareNo
=
cacheMap
.
get
(
spareNoStr
);
if
(
spareNo
.
getSpareNostatus
()
==
SpareNostatus
.
EXECUTING_STATUS
){
return
spareNo
;
}
}
return
null
;
}
public
SpareNo
getSpareNoResultToSpareNo
(
GetSpareNoResult
result
)
{
public
SpareNo
getSpareNoResultToSpareNo
(
GetSpareNoResult
result
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论