Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit f505cdf3
由
zshaohui
编写于
2024-11-13 15:21:16 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
odn出货,新功能修改
1 个父辈
5c03f747
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
62 行增加
和
44 行删除
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/wipstor/controller/OdnCheckOutNewController.java
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/wipstor/controller/OdnCheckOutNewController.java
查看文件 @
f505cdf
...
...
@@ -74,23 +74,24 @@ public class OdnCheckOutNewController {
@ApiOperation
(
"获取odn要出库的箱子"
)
@RequestMapping
(
"/getOdnCheckOutBox"
)
@AnonymousAccess
public
ResultBean
getOdnCheckOutBox
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
public
ResultBean
getOdnCheckOutBox
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
log
.
info
(
"收到odn出库信息为:"
+
JSON
.
toJSONString
(
paramMap
));
//判断有没有正在执行的任务
if
(
StringUtils
.
isNotEmpty
(
liteOrderCache
.
hasExecutingOrder
()))
{
//throw new ValidateException("","有正在执行的工单,不允许恢复");
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"有正在执行的工单"
+
liteOrderCache
.
hasExecutingOrder
()
+
",请确认"
);
}
//判断odn单号是否为空
String
odn
=
paramMap
.
get
(
"odn"
);
if
(
StringUtils
.
isEmpty
(
odn
))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"odn单号不能为空"
);
}
List
<
String
>
palletIdList
=
new
ArrayList
<>();
//解析手动输入的栈板id
List
<
String
>
inputPalletIdList
=
new
ArrayList
<>();
String
palletIdListStr
=
paramMap
.
get
(
"palletList"
);
if
(
StringUtils
.
isNotEmpty
(
palletIdListStr
))
{
palletIdList
=
JSONObject
.
parseArray
(
palletIdListStr
,
String
.
class
);
inputPalletIdList
=
JSONObject
.
parseArray
(
palletIdListStr
,
String
.
class
);
inputPalletIdList
=
inputPalletIdList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
//判断odn是否存在
...
...
@@ -102,67 +103,84 @@ public class OdnCheckOutNewController {
liteOrder
=
odnInfoToLiteOrder
(
odn
);
}
//获取hold库位
List
<
String
>
holdPosIdList
=
liteOrderCache
.
getHoldPosIdList
(
liteOrder
);
//List<String> holdPosIdList = new ArrayList<>();
//
判断输入的栈板号是否符合条件
List
<
StoragePos
>
s
toragePosList
=
new
ArrayList
<>();
if
(
palletIdList
!=
null
&&
!
p
alletIdList
.
isEmpty
())
{
storagePosList
=
findPosByPalletId
(
palletIdList
,
liteOrder
,
holdPosIdList
);
//
获取人员手动输入栈板id,对应的库位
List
<
StoragePos
>
inPutS
toragePosList
=
new
ArrayList
<>();
if
(
inputPalletIdList
!=
null
&&
!
inputP
alletIdList
.
isEmpty
())
{
inPutStoragePosList
=
findPosByPalletId
(
inputPalletIdList
,
liteOrder
,
holdPosIdList
);
}
//开始循环处理数据
List
<
String
>
excludePosIdList
=
new
ArrayList
<>();
for
(
LiteOrderItem
orderItem
:
liteOrder
.
getOrderItems
())
{
int
targetNum
=
orderItem
.
getNeedNum
()
-
orderItem
.
getTotalOutNum
();
if
(
targetNum
<=
0
){
if
(
targetNum
<=
0
)
{
continue
;
}
Collection
<
String
>
excludeOutPosIds
=
liteOrderCache
.
excludeOutPosIds
();
if
(
excludePosIdList
!=
null
&&
!
excludePosIdList
.
isEmpty
())
{
excludeOutPosIds
.
addAll
(
excludePosIdList
);
}
if
(
holdPosIdList
!=
null
&&
!
holdPosIdList
.
isEmpty
()){
excludeOutPosIds
.
addAll
(
holdPosIdList
);
}
List
<
StoragePos
>
needOutPosList
=
new
ArrayList
<>();
String
pn
=
orderItem
.
getPn
();
String
warehouseCode
=
orderItem
.
getWarehouseCode
();
//获取符合条件的pn
List
<
StoragePos
>
dbStoragePosList
=
storagePosManager
.
findOdnCalculatePos
(
pn
,
warehouseCode
,
excludeOutPosIds
);
if
(
dbStoragePosList
==
null
)
{
dbStoragePosList
=
new
ArrayList
<>();
}
if
(
storagePosList
!=
null
&&
!
storagePosList
.
isEmpty
())
{
dbStoragePosList
.
addAll
(
storagePosList
);
}
//去重
if
(
dbStoragePosList
==
null
||
dbStoragePosList
.
isEmpty
())
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"料号:"
+
pn
+
"库别:"
+
warehouseCode
+
"库存中未找到料箱"
);
}
Map
<
String
,
StoragePos
>
collect
=
dbStoragePosList
.
stream
().
collect
(
Collectors
.
toMap
(
StoragePos:
:
getId
,
storagePos
->
storagePos
,
(
existing
,
replacement
)
->
existing
));
dbStoragePosList
=
new
ArrayList
<>(
collect
.
values
());
List
<
StoragePos
>
combinationsPosList
=
CalculateUtil
.
findCombinationsByPos
(
dbStoragePosList
,
targetNum
);
if
(
combinationsPosList
==
null
||
combinationsPosList
.
isEmpty
()){
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"料号:"
+
pn
+
"库别:"
+
warehouseCode
+
"库存中未找到对应的组合数据"
);
if
(
inPutStoragePosList
!=
null
&&
!
inPutStoragePosList
.
isEmpty
())
{
for
(
StoragePos
pos
:
inPutStoragePosList
)
{
Barcode
barcode
=
pos
.
getBarcode
();
if
(
barcode
.
getPartNumber
().
equals
(
pn
)
&&
warehouseCode
.
equals
(
barcode
.
getWarehouseCode
()))
{
needOutPosList
.
add
(
pos
);
}
}
}
//加载orderItem中
for
(
StoragePos
pos
:
combinationsPosList
)
{
excludePosIdList
.
add
(
pos
.
getId
());
if
(
needOutPosList
!=
null
&&
!
needOutPosList
.
isEmpty
())
{
List
<
Barcode
>
barcodeList
=
needOutPosList
.
stream
().
map
(
StoragePos:
:
getBarcode
).
collect
(
Collectors
.
toList
());
int
count
=
barcodeList
.
stream
().
collect
(
Collectors
.
summingInt
(
Barcode:
:
getQty
));
if
(
count
>
targetNum
)
{
throw
new
ValidateException
(
""
,
"手动输入的料箱号数量为:"
+
count
+
"大于实际需要的数量:"
+
targetNum
+
"料号为:"
+
pn
+
"库别为:"
+
warehouseCode
);
}
targetNum
=
(
targetNum
-
count
);
}
if
(
targetNum
>
0
)
{
Collection
<
String
>
excludeOutPosIds
=
liteOrderCache
.
excludeOutPosIds
();
if
(
excludePosIdList
!=
null
&&
!
excludePosIdList
.
isEmpty
())
{
excludeOutPosIds
.
addAll
(
excludePosIdList
);
}
if
(
needOutPosList
!=
null
&&
!
needOutPosList
.
isEmpty
())
{
for
(
StoragePos
pos
:
needOutPosList
)
{
excludeOutPosIds
.
add
(
pos
.
getId
());
}
}
if
(
holdPosIdList
!=
null
&&
!
holdPosIdList
.
isEmpty
())
{
excludeOutPosIds
.
addAll
(
holdPosIdList
);
}
//获取符合条件的pn
List
<
StoragePos
>
dbStoragePosList
=
storagePosManager
.
findOdnCalculatePos
(
pn
,
warehouseCode
,
excludeOutPosIds
);
if
(
dbStoragePosList
==
null
)
{
dbStoragePosList
=
new
ArrayList
<>();
}
if
(
dbStoragePosList
==
null
||
dbStoragePosList
.
isEmpty
())
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"料号:"
+
pn
+
"库别:"
+
warehouseCode
+
"库存中未找到料箱"
);
}
List
<
StoragePos
>
combinationsPosList
=
CalculateUtil
.
findCombinationsByPos
(
dbStoragePosList
,
targetNum
);
if
(
combinationsPosList
==
null
||
combinationsPosList
.
isEmpty
())
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"料号:"
+
pn
+
"库别:"
+
warehouseCode
+
"库存中未找到对应的组合数据"
);
}
for
(
StoragePos
pos
:
combinationsPosList
)
{
excludePosIdList
.
add
(
pos
.
getId
());
needOutPosList
.
add
(
pos
);
}
}
List
<
Barcode
>
needOutBarcodeList
=
new
ArrayList
<>();
for
(
StoragePos
pos
:
combinations
PosList
)
{
for
(
StoragePos
pos
:
needOut
PosList
)
{
String
posName
=
pos
.
getPosName
();
Barcode
barcode
=
pos
.
getBarcode
();
barcode
.
setPosName
(
posName
);
needOutBarcodeList
.
add
(
barcode
);
log
.
info
(
barcode
.
getBarcode
()+
"------"
+
barcode
.
getPalletId
());
}
orderItem
.
setNeedOutBarcodeList
(
needOutBarcodeList
);
}
return
ResultBean
.
newOkResult
(
liteOrder
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论