Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0b074730
由
zshaohui
编写于
2024-08-02 15:37:23 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
sorting扫描料盘出库
1 个父辈
2205f05b
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
225 行增加
和
24 行删除
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/TicketSortingController.java
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/TicketSortingController.java
查看文件 @
0b07473
package
com
.
neotel
.
smfcore
.
custom
.
luxsan
.
factory_c
.
rawstor
.
controller
;
package
com
.
neotel
.
smfcore
.
custom
.
luxsan
.
factory_c
.
rawstor
.
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.enums.BARCODE_STATUS
;
import
com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
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.order.service.manager.ILiteOrderItemManager
;
import
com.neotel.smfcore.core.order.service.manager.ILiteOrderManager
;
import
com.neotel.smfcore.core.order.service.po.LiteOrder
;
import
com.neotel.smfcore.core.order.service.po.LiteOrderItem
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.service.manager.IDataLogManager
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil
;
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
javafx.concurrent.Task
;
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
;
...
@@ -33,6 +45,15 @@ public class TicketSortingController {
...
@@ -33,6 +45,15 @@ public class TicketSortingController {
@Autowired
@Autowired
private
IBarcodeManager
barcodeManager
;
private
IBarcodeManager
barcodeManager
;
@Autowired
private
ILiteOrderItemManager
liteOrderItemManager
;
@Autowired
private
TaskService
taskService
;
@Autowired
private
IDataLogManager
dataLogManager
;
@ApiOperation
(
"获取料箱信息"
)
@ApiOperation
(
"获取料箱信息"
)
@RequestMapping
(
"/boxInfo"
)
@RequestMapping
(
"/boxInfo"
)
...
@@ -103,44 +124,224 @@ public class TicketSortingController {
...
@@ -103,44 +124,224 @@ public class TicketSortingController {
boxInfoList
.
add
(
list
);
boxInfoList
.
add
(
list
);
}
}
List
<
List
<
Object
>>
resultList
=
new
ArrayList
<>();
if
(
boxStr
.
startsWith
(
"C07"
))
{
if
(
boxStr
.
startsWith
(
"C07"
))
{
if
(
boxStr
.
endsWith
(
"A"
))
{
if
(
boxStr
.
endsWith
(
"A"
))
{
boxInfo
List
.
add
(
boxInfoList
.
get
(
1
));
result
List
.
add
(
boxInfoList
.
get
(
1
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
3
));
result
List
.
add
(
boxInfoList
.
get
(
3
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
5
));
result
List
.
add
(
boxInfoList
.
get
(
5
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
0
));
result
List
.
add
(
boxInfoList
.
get
(
0
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
2
));
result
List
.
add
(
boxInfoList
.
get
(
2
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
4
));
result
List
.
add
(
boxInfoList
.
get
(
4
));
}
else
{
}
else
{
boxInfo
List
.
add
(
boxInfoList
.
get
(
4
));
result
List
.
add
(
boxInfoList
.
get
(
4
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
2
));
result
List
.
add
(
boxInfoList
.
get
(
2
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
0
));
result
List
.
add
(
boxInfoList
.
get
(
0
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
5
));
result
List
.
add
(
boxInfoList
.
get
(
5
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
3
));
result
List
.
add
(
boxInfoList
.
get
(
3
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
1
));
result
List
.
add
(
boxInfoList
.
get
(
1
));
}
}
}
else
if
(
boxStr
.
startsWith
(
"C13"
))
{
}
else
if
(
boxStr
.
startsWith
(
"C13"
))
{
if
(
boxStr
.
endsWith
(
"A"
))
{
if
(
boxStr
.
endsWith
(
"A"
))
{
boxInfo
List
.
add
(
boxInfoList
.
get
(
0
));
result
List
.
add
(
boxInfoList
.
get
(
0
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
1
));
result
List
.
add
(
boxInfoList
.
get
(
1
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
2
));
result
List
.
add
(
boxInfoList
.
get
(
2
));
}
else
{
}
else
{
boxInfo
List
.
add
(
boxInfoList
.
get
(
2
));
result
List
.
add
(
boxInfoList
.
get
(
2
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
1
));
result
List
.
add
(
boxInfoList
.
get
(
1
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
0
));
result
List
.
add
(
boxInfoList
.
get
(
0
));
}
}
}
else
if
(
boxStr
.
startsWith
(
"C15"
))
{
}
else
if
(
boxStr
.
startsWith
(
"C15"
))
{
if
(
boxStr
.
endsWith
(
"A"
))
{
if
(
boxStr
.
endsWith
(
"A"
))
{
boxInfo
List
.
add
(
boxInfoList
.
get
(
0
));
result
List
.
add
(
boxInfoList
.
get
(
0
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
1
));
result
List
.
add
(
boxInfoList
.
get
(
1
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
2
));
result
List
.
add
(
boxInfoList
.
get
(
2
));
}
else
{
}
else
{
boxInfo
List
.
add
(
boxInfoList
.
get
(
2
));
result
List
.
add
(
boxInfoList
.
get
(
2
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
1
));
result
List
.
add
(
boxInfoList
.
get
(
1
));
boxInfo
List
.
add
(
boxInfoList
.
get
(
0
));
result
List
.
add
(
boxInfoList
.
get
(
0
));
}
}
}
}
return
ResultBean
.
newOkResult
(
boxInfoList
);
return
ResultBean
.
newOkResult
(
boxInfoList
);
}
}
@ApiOperation
(
"扫描隔扣码"
)
@RequestMapping
(
"/scanPar"
)
@AnonymousAccess
public
ResultBean
scanPar
(
String
boxStr
,
String
parStr
)
{
if
(
StringUtils
.
isEmpty
(
parStr
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"料格条码不能为空"
);
}
if
(!
parStr
.
startsWith
(
"C07"
)
&&
!
parStr
.
startsWith
(
"C15"
)
&&
!
parStr
.
startsWith
(
"C15"
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
parStr
+
"料格条码不正确"
);
}
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
boxStr
);
if
(
barcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
boxStr
+
"料箱条码不正确"
);
}
StoragePos
pos
=
BoxHandleUtil
.
locOnePos
(
barcode
);
if
(
pos
!=
null
)
{
if
(
pos
.
getBarcode
()
!=
null
)
{
barcode
=
pos
.
getBarcode
();
}
}
if
(!
parStr
.
startsWith
(
barcode
.
getBarcode
()))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
parStr
+
"与不是料箱:"
+
boxStr
+
"的料格"
);
}
int
outBarcodeCount
=
0
;
List
<
Barcode
>
needOutBarcodeList
=
new
ArrayList
<>();
List
<
Barcode
>
subCodeList
=
barcode
.
getSubCodeList
();
for
(
Barcode
subCode
:
subCodeList
)
{
if
(
parStr
.
equals
(
subCode
.
getPosName
()))
{
needOutBarcodeList
.
add
(
subCode
);
if
(
subCode
.
isOut
())
{
outBarcodeCount
=
outBarcodeCount
+
1
;
}
}
}
//判断有没有出库的物料
if
(
outBarcodeCount
==
0
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
parStr
+
"没有sorting的物料"
);
}
if
(
needOutBarcodeList
==
null
||
needOutBarcodeList
.
isEmpty
())
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
parStr
+
"没有sorting的物料"
);
}
for
(
Barcode
needOutBarcode
:
needOutBarcodeList
)
{
needOutBarcode
.
updateExtraData
(
"status"
,
"1"
);
barcodeManager
.
save
(
needOutBarcode
);
barcode
.
updateSubCodes
(
needOutBarcode
);
}
barcode
=
barcodeManager
.
save
(
barcode
);
if
(
pos
!=
null
)
{
pos
.
setBarcode
(
barcode
);
storagePosManager
.
save
(
pos
);
}
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"all"
,
needOutBarcodeList
.
size
());
resultMap
.
put
(
"ng"
,
outBarcodeCount
);
return
ResultBean
.
newOkResult
(
resultMap
);
}
@ApiOperation
(
"扫描物料条码"
)
@RequestMapping
(
"/scanReel"
)
@AnonymousAccess
public
ResultBean
scanReel
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
codeStr
=
paramMap
.
get
(
"codeStr"
);
String
parStr
=
paramMap
.
get
(
"parStr"
);
String
boxStr
=
paramMap
.
get
(
"boxStr"
);
if
(
StringUtils
.
isEmpty
(
codeStr
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"料盘条码不能为空"
);
}
Barcode
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
boxStr
);
if
(
boxBarcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
boxStr
+
"料箱条码不正确"
);
}
StoragePos
pos
=
BoxHandleUtil
.
locOnePos
(
boxBarcode
);
if
(
pos
!=
null
){
if
(
pos
.
getBarcode
()
!=
null
){
boxBarcode
=
pos
.
getBarcode
();
}
}
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
codeStr
);
if
(
barcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
codeStr
+
"料箱条码不正确"
);
}
if
(!
barcode
.
getPosName
().
equals
(
parStr
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"不在料格:"
+
parStr
+
"中"
);
}
Map
<
String
,
Integer
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"ng"
,
0
);
//判断是不是要出库的物料
if
(
barcode
.
isOut
())
{
barcode
.
setOut
(
false
);
barcode
.
setOrderItemId
(
""
);
barcode
.
setPosName
(
""
);
barcode
=
barcodeManager
.
save
(
barcode
);
boxBarcode
.
removeFromSubCodes
(
barcode
);
boxBarcode
=
barcodeManager
.
save
(
boxBarcode
);
if
(
pos
!=
null
){
pos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
pos
);
}
DataLog
task
=
new
DataLog
();
task
.
setBarcode
(
barcode
.
getBarcode
());
task
.
setPartNumber
(
barcode
.
getPartNumber
());
task
.
setNum
(
barcode
.
getAmount
());
task
.
setType
(
OP
.
CHECKOUT
);
task
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
task
.
setOperator
(
SecurityUtils
.
getLoginUsername
()+
"Sorting出库"
);
//生成出库任务
String
itemId
=
barcode
.
getOrderItemId
();
if
(
StringUtils
.
isNotEmpty
(
itemId
)){
LiteOrderItem
item
=
liteOrderItemManager
.
get
(
itemId
);
if
(
item
!=
null
){
task
.
setSourceId
(
item
.
getOrderId
());
task
.
setSourceName
(
item
.
getOrderNo
());
task
.
setSubSourceId
(
item
.
getId
());
}
}
dataLogManager
.
save
(
task
);
taskService
.
moveTaskToFinished
(
task
);
resultMap
.
put
(
"ng"
,
1
);
}
else
{
barcode
.
setSeq
(
getSeq
(
boxBarcode
,
barcode
.
getPosName
()));
barcode
.
updateExtraData
(
"status"
,
null
);
barcodeManager
.
save
(
barcode
);
boxBarcode
.
updateSubCodes
(
barcode
);
boxBarcode
=
barcodeManager
.
save
(
boxBarcode
);
if
(
pos
!=
null
){
pos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
pos
);
}
}
return
ResultBean
.
newOkResult
(
resultMap
);
}
public
int
getSeq
(
Barcode
boxBarcode
,
String
posName
)
{
int
seq
=
0
;
List
<
Barcode
>
subCodeList
=
boxBarcode
.
getSubCodeList
();
if
(
subCodeList
!=
null
&&
!
subCodeList
.
isEmpty
())
{
for
(
Barcode
subCode
:
subCodeList
)
{
if
(
subCode
.
getPosName
().
equals
(
posName
))
{
String
status
=
subCode
.
getExtraData
(
"status"
);
if
(
StringUtils
.
isEmpty
(
status
))
{
if
(
seq
<
subCode
.
getSeq
())
{
seq
=
subCode
.
getSeq
();
}
}
}
}
}
seq
=
seq
+
1
;
return
seq
;
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论