Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
48fbaa1a
Commit
48fbaa1a
authored
May 13, 2024
by
lanbaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-05-13新功能和运维BUG处理
parent
ce9726ab
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
535 additions
and
310 deletions
+535
-310
CalculateCustomerTypeEvent.java
...pollo/core/event/Customer/CalculateCustomerTypeEvent.java
+37
-0
CalculateOrderVValueEvent.java
...rk/apollo/core/event/Order/CalculateOrderVValueEvent.java
+31
-0
CalculateCustomerType.java
...yudao/module/delivery/listener/CalculateCustomerType.java
+62
-0
BoxServiceImpl.java
...der/yudao/module/shipment/service/box/BoxServiceImpl.java
+22
-9
BoxPreloadGoodsServiceImpl.java
...t/service/boxPreloadGoods/BoxPreloadGoodsServiceImpl.java
+383
-301
No files found.
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/event/Customer/CalculateCustomerTypeEvent.java
0 → 100644
View file @
48fbaa1a
package
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
event
.
Customer
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
/*
lanbm 2024-05-07 添加公海捞取是计算客户类型
*/
@Data
public
class
CalculateCustomerTypeEvent
{
/**
* 客户编码
*/
private
String
customerNumber
;
/*
客户ID
*/
private
Long
customerId
;
/*
新客户经理
*/
private
Long
oldCustomerService
;
/*
老客户经理
*/
private
Long
newCustomerService
;
/*
客户状态:1.线索2.意向3.成交
通过客户状态来判断客户是否是已成交客户
*/
private
Integer
status
;
}
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/event/Order/CalculateOrderVValueEvent.java
0 → 100644
View file @
48fbaa1a
package
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
event
.
Order
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/*
lanbm 2024-05-13 add
计算订单V值
*/
@Data
public
class
CalculateOrderVValueEvent
{
/*
订单id
*/
private
Long
orderId
;
/*
根据体积或重量计算出的V值
*/
private
BigDecimal
calVvalue
;
/*
业绩产生时间
*/
private
Date
yejiCreateDate
;
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/listener/CalculateCustomerType.java
0 → 100644
View file @
48fbaa1a
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
listener
;
import
cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent
;
import
cn.iocoder.yudao.module.customer.service.customer.CustomerService
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/*
lanbm 2024-05-07 add
*/
@Component
(
"CalculateCustomerType"
)
@AllArgsConstructor
@Slf4j
public
class
CalculateCustomerType
{
//监听公海捞取事件,计算客户是新客户类型还是老客户类型,此字段用户计算订单业绩类型
@Resource
private
CustomerService
customerService
;
/**
* 客户捞取监听事件 lanbm 2024-05-07 add
* @param event
*/
@EventListener
(
CalculateCustomerTypeEvent
.
class
)
public
void
CalculateCustomerTypePushEvent
(
CalculateCustomerTypeEvent
event
)
{
if
(
event
.
getNewCustomerService
()
==
event
.
getOldCustomerService
())
{
//新客户经理和老客户经理是同一客户经理
//继续判断有无成交记录
//有成交记录 客户业绩类型=老客户
//没成交记录 客户业绩类型=新客户
boolean
bR
=
isHaving_TransactionRecords
(
event
);
if
(
bR
==
true
)
{
//有成交记录
customerService
.
updateCustomerNewOrOld
(
event
.
getCustomerId
(),
false
);
}
else
{
//无成交记录
customerService
.
updateCustomerNewOrOld
(
event
.
getCustomerId
(),
true
);
}
}
else
{
//新客户经理和老客户经理不是同一客户经理
//客户业绩类型=新客户
customerService
.
updateCustomerNewOrOld
(
event
.
getCustomerId
(),
true
);
}
}
/*
通过客户状态来判断有无成交记录
1.线索2.意向3.成交
*/
private
boolean
isHaving_TransactionRecords
(
CalculateCustomerTypeEvent
event
)
{
if
(
event
.
getStatus
()
==
3
)
return
true
;
else
return
false
;
}
}
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/box/BoxServiceImpl.java
View file @
48fbaa1a
...
...
@@ -1527,10 +1527,12 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
List
<
Long
>
warehouseIdList
;
if
(
countryId
!=
null
)
{
List
<
WarehouseDO
>
warehouseList
=
warehouseService
.
findByCountryIdList
(
Collections
.
singletonList
(
countryId
));
List
<
WarehouseDO
>
warehouseList
=
warehouseService
.
findByCountryIdList
(
Collections
.
singletonList
(
countryId
));
warehouseIdList
=
warehouseList
.
stream
().
map
(
WarehouseDO:
:
getId
).
collect
(
Collectors
.
toList
());
query
.
setWarehouseIdList
(
warehouseIdList
);
}
//上面都是处理查询条件相关逻辑
return
boxInfoQuery1
(
boxMapper
.
selectPage2
(
page
,
query
),
false
);
}
...
...
@@ -2292,7 +2294,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
.
map
(
BoxBaseBackVO:
:
getId
)
.
collect
(
Collectors
.
toList
());
Map
<
Long
,
BoxGoodsStatistics
>
shipmentStatisticsMap
=
boxPreloadGoodsService
.
getBoxStatistics
(
idList
);
//ecw_box_preload_goods 预装货物 lanbm 2024-05-13 添加注释
Map
<
Long
,
BoxGoodsStatistics
>
shipmentStatisticsMap
=
boxPreloadGoodsService
.
getBoxStatistics
(
idList
);
List
<
Long
>
cabinetIdList
=
boxBackList
.
stream
()
.
map
(
BoxBaseBackVO:
:
getCabinetId
)
...
...
@@ -2301,6 +2305,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
Map
<
Long
,
CabinetDO
>
cabinetMap
=
new
HashMap
<>();
//ecw_cabinet 柜型配置 lanbm 2024-05-13 添加注释
if
(
CollectionUtils
.
isNotEmpty
(
cabinetIdList
))
{
List
<
CabinetDO
>
cabinetDOList
=
cabinetService
.
getCabinetList
(
cabinetIdList
);
cabinetMap
=
cabinetDOList
.
stream
()
...
...
@@ -2310,7 +2315,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
Set
<
Long
>
destWarehouseIdList
=
boxBackList
.
stream
()
.
map
(
BoxBaseBackVO:
:
getDestWarehouseId
)
.
collect
(
Collectors
.
toSet
());
List
<
WarehouseDO
>
warehouseDOList
=
warehouseService
.
getByIdList
(
new
ArrayList
<>(
destWarehouseIdList
));
//ecw_warehouse 仓库相关信息
List
<
WarehouseDO
>
warehouseDOList
=
warehouseService
.
getByIdList
(
new
ArrayList
<>(
destWarehouseIdList
));
Map
<
Long
,
WarehouseDO
>
warehouseDOMap
=
warehouseDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
WarehouseDO:
:
getId
,
v
->
v
));
...
...
@@ -2340,22 +2347,28 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
//设置目的地
WarehouseDO
destWarehouse
=
warehouseDOMap
.
get
(
boxBackVO
.
getDestWarehouseId
());
WarehouseRespVO
destWarehouseResp
=
WarehouseConvert
.
INSTANCE
.
convert
(
destWarehouse
);
WarehouseDO
destWarehouse
=
warehouseDOMap
.
get
(
boxBackVO
.
getDestWarehouseId
());
WarehouseRespVO
destWarehouseResp
=
WarehouseConvert
.
INSTANCE
.
convert
(
destWarehouse
);
boxBackVO
.
setDestWarehouseResp
(
destWarehouseResp
);
Long
channelId
=
boxBackVO
.
getShippingChannelId
();
if
(
channelId
!=
null
&&
channelId
!=
0
)
{
ChannelDO
channelDO
=
channelMap
.
get
(
channelId
);
boxBackVO
.
setChannelRespVO
(
ChannelConvert
.
INSTANCE
.
convert
(
channelDO
));
boxBackVO
.
setChannelRespVO
(
ChannelConvert
.
INSTANCE
.
convert
(
channelDO
));
}
//统计信息
BoxGoodsStatistics
boxStatistics
=
shipmentStatisticsMap
.
get
(
shipmentId
);
//统计信息 lanbm2024-05-13 添加注释
BoxGoodsStatistics
boxStatistics
=
shipmentStatisticsMap
.
get
(
shipmentId
);
boxBackVO
.
setBoxStatistics
(
boxStatistics
);
if
(
searchDcDate
)
{
BoxCabinetUnloadDO
boxCabinetUnloadDO
=
boxCabinetUnloadService
.
getOne
(
new
LambdaQueryWrapperX
<
BoxCabinetUnloadDO
>()
BoxCabinetUnloadDO
boxCabinetUnloadDO
=
boxCabinetUnloadService
.
getOne
(
new
LambdaQueryWrapperX
<
BoxCabinetUnloadDO
>()
.
eq
(
BoxCabinetUnloadDO:
:
getShipmentId
,
shipmentId
)
.
last
(
"limit 1"
)
);
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/boxPreloadGoods/BoxPreloadGoodsServiceImpl.java
View file @
48fbaa1a
...
...
@@ -167,16 +167,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//找到出货单
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
if
(
boxDO
==
null
)
{
if
(
boxDO
==
null
)
{
throw
exception
(
BOX_NOT_EXISTS
);
}
boxService
.
checkApproval
(
shipmentId
,
null
);
if
(
createReqVO
.
getIsCover
()
==
0
)
{
if
(
createReqVO
.
getIsCover
()
==
0
)
{
//排单,先校验出货是否已经预装审核通过了
Integer
prStatus
=
boxDO
.
getPrStatus
();
if
(
prStatus
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
if
(
prStatus
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
throw
new
ServiceException
(
500
,
"出货已排单审核通过。"
);
}
}
...
...
@@ -194,14 +194,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//如果都符合,下面展示互斥和关联订单的弹窗
Integer
relationStatus
=
createReqVO
.
getRelationStatus
();
//校验是否是互斥订单
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
//校验互斥订单
checkMutualOrder
(
loadList
,
orderDO
);
}
List
<
OrderGuanlianDO
>
orderRelationList
=
null
;
boolean
hasRelationOrder
=
false
;
if
(!
createReqVO
.
isSingleLoad
())
{
if
(!
createReqVO
.
isSingleLoad
())
{
//所有关联订单
orderRelationList
=
orderGuanlianService
.
getRelationList
(
orderId
);
hasRelationOrder
=
CollectionUtil
.
isNotEmpty
(
orderRelationList
);
...
...
@@ -210,7 +210,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderDO
>
orderList
;
StringBuilder
sb
=
new
StringBuilder
();
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
Set
<
Long
>
orderIdSet
=
orderRelationList
.
stream
()
.
flatMap
(
o
->
Stream
.
of
(
o
.
getOrderId
(),
o
.
getRelateOrderId
()))
.
collect
(
Collectors
.
toSet
());
...
...
@@ -220,7 +220,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
in
(
BoxPreloadGoodsDO:
:
getOrderId
,
orderIdSet
)
.
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
)
);
if
(
CollectionUtil
.
isNotEmpty
(
orderLoadList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderLoadList
))
{
Set
<
Long
>
loadOrderIdList
=
orderLoadList
.
stream
()
.
map
(
BoxPreloadGoodsDO:
:
getOrderId
)
.
collect
(
Collectors
.
toSet
());
...
...
@@ -253,43 +253,43 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
collect
(
Collectors
.
toList
());
boolean
isSuit
=
true
;
if
(
CollectionUtil
.
isNotEmpty
(
notMatchStatusList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
notMatchStatusList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
notMatchStatusList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"不是已入仓状态,不能预装"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"不是已入仓状态,不能预装"
);
}
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
abnormalList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"存在异常"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"存在异常"
);
}
if
(
CollectionUtil
.
isNotEmpty
(
auditList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
auditList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
auditList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"审核中"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"审核中"
);
}
if
(!
isSuit
)
{
if
(!
isSuit
)
{
throw
new
ServiceException
(
500
,
sb
.
toString
());
}
...
...
@@ -299,7 +299,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//过滤了入仓为0的数据
List
<
OrderItemBackVO
>
orderItemList
=
orderItemService
.
getOrderItemBackByOrderId
(
orderIdList
);
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
{
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
{
throw
new
ServiceException
(
500
,
"订单项不存在"
);
}
...
...
@@ -331,15 +331,15 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
sb
.
append
(
"订单:"
).
append
(
item
.
getOrderNo
()).
append
(
","
).
append
(
e
.
getMessage
()).
append
(
"<br>"
);
}
}
if
(!
isSuit
)
{
if
(!
isSuit
)
{
throw
new
ServiceException
(
500
,
sb
.
toString
());
}
checkCabinet
(
boxDO
,
orderItemIdList
);
//都符合,预装,看是否弹出提示
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
if
(
hasRelationOrder
)
{
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
if
(
hasRelationOrder
)
{
throw
new
ServiceException
(
566
,
sb
.
toString
());
}
...
...
@@ -350,7 +350,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxPreloadGoodsDO
boxPreloadGoods
=
BoxPreloadGoodsConvert
.
INSTANCE
.
convert
(
createReqVO
);
boxPreloadGoods
.
setOrderItemId
(
orderItem
.
getOrderItemId
());
boxPreloadGoods
.
setOrderId
(
orderItem
.
getOrderId
());
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
boxPreloadGoods
.
setIsCover
(
createReqVO
.
getIsCover
());
}
preloadGoodsDOList
.
add
(
boxPreloadGoods
);
...
...
@@ -359,12 +359,12 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
// 插入
boxPreloadGoodsMapper
.
insertBatch
(
preloadGoodsDOList
);
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
())
{
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
())
{
//修改为预装中
boxDO
.
setPrStatus
(
PrStatusEnum
.
PRELOAD_ING
.
getPrStatus
());
boxService
.
updateById
(
boxDO
);
boxService
.
addOrderLog
(
orderIdList
,
OrderShipmentLog
.
PRELOAD_ADD
,
""
);
}
else
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
}
else
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
//补单。修改订单状态
for
(
Long
oId
:
orderIdList
)
{
boxService
.
updateOrderStatus
(
oId
,
OrderStatusEnum
.
PRE_INSTALLED
.
getValue
(),
0
,
...
...
@@ -394,7 +394,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//找到出货单
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
if
(
boxDO
==
null
)
{
if
(
boxDO
==
null
)
{
throw
exception
(
BOX_NOT_EXISTS
);
}
...
...
@@ -406,7 +406,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//过滤了入仓为0的数据
List
<
OrderItemBackVO
>
orderItemList
=
orderItemService
.
getOrderItemBackByOrderId
(
Collections
.
singletonList
(
orderId
));
if
(
CollectionUtil
.
isNotEmpty
(
orderItemList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderItemList
))
{
orderItemIdList
=
orderItemList
.
stream
()
.
map
(
OrderItemBackVO:
:
getOrderItemId
)
.
collect
(
Collectors
.
toList
());
...
...
@@ -426,7 +426,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//如果都符合,下面展示互斥和关联订单的弹窗
Integer
relationStatus
=
createReqVO
.
getRelationStatus
();
//校验是否是互斥订单
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
//校验互斥订单
checkMutualOrder
(
loadList
,
orderDO
);
}
...
...
@@ -436,7 +436,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
for
(
Long
orderItemId
:
orderItemIdList
)
{
BoxPreloadGoodsDO
boxPreloadGoods
=
BoxPreloadGoodsConvert
.
INSTANCE
.
convert
(
createReqVO
);
boxPreloadGoods
.
setOrderItemId
(
orderItemId
);
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
boxPreloadGoods
.
setIsCover
(
createReqVO
.
getIsCover
());
}
preloadGoodsDOList
.
add
(
boxPreloadGoods
);
...
...
@@ -445,12 +445,12 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
// 插入
boxPreloadGoodsMapper
.
insertBatch
(
preloadGoodsDOList
);
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
())
{
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
())
{
//修改为预装中
boxDO
.
setPrStatus
(
PrStatusEnum
.
PRELOAD_ING
.
getPrStatus
());
boxService
.
updateById
(
boxDO
);
boxService
.
addOrderLog
(
Collections
.
singletonList
(
orderId
),
OrderShipmentLog
.
PRELOAD_ADD
,
""
);
}
else
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
}
else
if
(
boxDO
.
getPrStatus
()
==
PrStatusEnum
.
PRELOAD_APPROVAL_SUCCESS
.
getPrStatus
())
{
//补单。修改订单状态
boxService
.
updateOrderStatus
(
orderId
,
OrderStatusEnum
.
PRE_INSTALLED
.
getValue
(),
0
,
BoxStatusEnum
.
PREINSTALL_EXAMINE_SUCCESS
.
getStatus
(),
null
,
null
,
Boolean
.
FALSE
);
...
...
@@ -469,9 +469,9 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
PreloadResultVO
preloadResultVO
=
new
PreloadResultVO
();
//校验关联订单
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
List
<
OrderDO
>
relationOrderList
=
checkRelationOrder
(
boxDO
,
secId
,
orderDO
,
orderItemIdList
,
loadList
);
if
(
CollectionUtil
.
isEmpty
(
relationOrderList
))
return
preloadResultVO
;
if
(
CollectionUtil
.
isEmpty
(
relationOrderList
))
return
preloadResultVO
;
//需要弹窗提醒关联单
List
<
String
>
orderNoList
=
relationOrderList
.
stream
()
...
...
@@ -496,6 +496,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 校验关联
*
* @param boxDO 出货单
* @param secId 预装部分
* @param orderDO 预装原始订单
...
...
@@ -508,16 +509,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
orderId
=
orderDO
.
getOrderId
();
String
transportType
=
boxDO
.
getTransportType
();
List
<
OrderGuanlianDO
>
guanlianList
=
orderGuanlianService
.
getGuanlianListByOrderId
(
orderId
);
if
(
CollectionUtil
.
isEmpty
(
guanlianList
))
return
null
;
if
(
CollectionUtil
.
isEmpty
(
guanlianList
))
return
null
;
//rIdList为此订单的所有关联订单
List
<
Long
>
rIdList
=
new
ArrayList
<>();
for
(
OrderGuanlianDO
orderGuanlianDO
:
guanlianList
)
{
Long
oId
=
orderGuanlianDO
.
getOrderId
();
Long
rId
=
orderGuanlianDO
.
getRelateOrderId
();
if
(
oId
.
equals
(
orderId
))
{
if
(
oId
.
equals
(
orderId
))
{
rIdList
.
add
((
rId
));
}
else
if
(
rId
.
equals
(
orderId
))
{
}
else
if
(
rId
.
equals
(
orderId
))
{
rIdList
.
add
(
oId
);
}
}
...
...
@@ -530,14 +531,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
PageResult
<
BoxOrderPreloadVo
>
pageResult
=
boxOrderPreloadStatistics
.
getDataList
();
List
<
BoxOrderPreloadVo
>
orderList
=
pageResult
.
getList
();
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
null
;
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
null
;
//找出符合条件的关联单
orderList
=
orderList
.
stream
()
.
filter
(
t
->
rIdList
.
contains
(
t
.
getOrderId
()))
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
null
;
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
null
;
//剩下的就是符合条件的关联单
//校验这些关联单是否可以和主订单一起合装
...
...
@@ -569,6 +570,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 校验互斥订单
*
* @param loadList 已装商品项
* @param orderDO 想要预装的订单
*/
...
...
@@ -579,19 +581,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
map
(
BoxPreloadGoodsDO:
:
getOrderId
)
.
collect
(
Collectors
.
toSet
());
//已装为空,则不需要校验,
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
return
;
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
return
;
orderIdSet
.
add
(
orderId
);
List
<
OrderDO
>
orderList
=
orderMutualService
.
searchMutualOrderList
(
orderId
,
orderIdSet
);
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
//过滤自己
orderList
=
orderList
.
stream
().
filter
(
t
->
!
t
.
getOrderId
().
equals
(
orderId
)).
collect
(
Collectors
.
toList
());
//过滤不在已装单里面的
orderList
=
orderList
.
stream
().
filter
(
t
->
orderIdSet
.
contains
(
t
.
getOrderId
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
List
<
String
>
orderNoList
=
orderList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
...
...
@@ -603,6 +605,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 校验柜子体积重量
*
* @param boxDO 出货
* @param orderItemIdList 订单项
*/
...
...
@@ -622,16 +625,17 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal
remainWeight
=
cabinetDO
.
getWeight
().
subtract
(
boxGoodsStatistics
.
getWeight
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
BoxGoodsStatistics
reloadGoodsStatistics
=
calculationStatistics
(
orderItemDOList
);
if
(
remainVolume
.
compareTo
(
reloadGoodsStatistics
.
getVolume
())
<
0
)
{
if
(
remainVolume
.
compareTo
(
reloadGoodsStatistics
.
getVolume
())
<
0
)
{
throw
exception
(
BOX_VOLUME_EXCEED
);
}
if
(
remainWeight
.
compareTo
(
reloadGoodsStatistics
.
getWeight
())
<
0
)
{
if
(
remainWeight
.
compareTo
(
reloadGoodsStatistics
.
getWeight
())
<
0
)
{
throw
exception
(
BOX_WEIGHT_EXCEED
);
}
}
/**
* 校验仓库始发地、目的地是否符合要求
*
* @param boxDO 出货
* @param orderDO 订单
*/
...
...
@@ -662,26 +666,27 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//始发仓调仓后的目的仓
Long
adjustToDestWarehouseId
=
orderDO
.
getAdjustToDestWarehouseId
();
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
//调仓了,看出货仓库是否与调仓id一样
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
{
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
{
throw
exception
(
BOX_WAREHOUSE_START_NOT_MATCH
);
}
}
else
{
//没有调仓,看出货仓库是否与订单仓库一样
if
(!
startWarehouseId
.
equals
(
orderStartWarehouseId
))
{
if
(!
startWarehouseId
.
equals
(
orderStartWarehouseId
))
{
throw
exception
(
BOX_WAREHOUSE_START_NOT_MATCH
);
}
}
//目的地看国家是否一致
if
(!
destCountryId
.
equals
(
orderDestCountryId
))
{
if
(!
destCountryId
.
equals
(
orderDestCountryId
))
{
throw
exception
(
BOX_WAREHOUSE_DEST_NOT_MATCH
);
}
}
/**
* 校验同一个订单只能装在同一个部分
*
* @param secId 部分
* @param loadList 已装
* @param orderAllItemIdList 订单项
...
...
@@ -694,13 +699,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
collect
(
Collectors
.
toSet
());
//有已装的部分,并且已装的部分和待装部分id不一致
if
(
sectionSets
.
size
()
>
0
&&
!
sectionSets
.
contains
(
secId
))
{
if
(
sectionSets
.
size
()
>
0
&&
!
sectionSets
.
contains
(
secId
))
{
throw
new
ServiceException
(
500
,
"同一订单只能装在同一部分下"
);
}
}
/**
* 校验订单项是否已装
*
* @param loadList 已装
* @param orderItemIdList 订单项
*/
...
...
@@ -711,7 +717,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
)
);
if
(
CollectionUtil
.
isNotEmpty
(
itemLoadList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
itemLoadList
))
{
Set
<
Long
>
loadItemIdList
=
itemLoadList
.
stream
()
.
map
(
BoxPreloadGoodsDO:
:
getOrderId
)
.
collect
(
Collectors
.
toSet
());
...
...
@@ -729,6 +735,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 校验订单预装是否可用
*
* @param boxDO 出货单
* @param secId 需要预装在的部分
* @param loadList 出货单已预装的商品项
...
...
@@ -790,13 +797,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 统计已装的学校
*
* @param shipmentId 出货单ID
* @param sectionId 部分ID,为空则统计所有
* @return
*/
private
BoxGoodsStatistics
calculationStatistics
(
Long
shipmentId
,
Long
sectionId
)
{
BoxPreloadGoodsQueryVO
queryVO
=
new
BoxPreloadGoodsQueryVO
();
if
(
sectionId
==
null
)
{
if
(
sectionId
==
null
)
{
queryVO
.
setShipmentId
(
shipmentId
);
}
else
{
queryVO
.
setSecId
(
sectionId
);
...
...
@@ -808,7 +816,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
map
(
BoxPreloadGoodsDO:
:
getOrderItemId
)
.
collect
(
Collectors
.
toList
());
List
<
OrderItemDO
>
orderItemDOList
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
orderItemIdList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderItemIdList
))
{
orderItemDOList
=
orderItemService
.
getOrderItemList
(
orderItemIdList
);
}
return
calculationStatistics
(
orderItemDOList
);
...
...
@@ -823,11 +831,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal
chargeVolumeSum
=
boxGoodsStatistics
.
getChargeVolume
();
BigDecimal
chargeWeightSum
=
boxGoodsStatistics
.
getChargeWeight
();
if
(
orderItemDO
.
getChargeVolume
()
!=
null
)
{
if
(
orderItemDO
.
getChargeVolume
()
!=
null
)
{
chargeVolumeSum
=
chargeVolumeSum
.
add
(
orderItemDO
.
getChargeVolume
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
boxGoodsStatistics
.
setChargeVolume
(
chargeVolumeSum
);
}
if
(
orderItemDO
.
getChargeWeight
()
!=
null
)
{
if
(
orderItemDO
.
getChargeWeight
()
!=
null
)
{
chargeWeightSum
=
chargeWeightSum
.
add
(
orderItemDO
.
getChargeWeight
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
boxGoodsStatistics
.
setChargeWeight
(
chargeWeightSum
);
}
...
...
@@ -836,7 +844,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
private
List
<
OrderDO
>
getOrderListByOrderItem
(
List
<
OrderItemDO
>
orderItemDOList
)
{
if
(
CollectionUtils
.
isEmpty
(
orderItemDOList
))
{
if
(
CollectionUtils
.
isEmpty
(
orderItemDOList
))
{
return
new
ArrayList
<>();
}
Set
<
Long
>
orderIdSet
=
orderItemDOList
.
stream
()
...
...
@@ -849,7 +857,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
@Override
public
BoxGoodsStatistics
calculationStatisticsByOrderList
(
Collection
<
OrderDO
>
orderDOList
)
{
BoxGoodsStatistics
boxGoodsStatistics
=
new
BoxGoodsStatistics
();
if
(
CollectionUtil
.
isEmpty
(
orderDOList
))
{
if
(
CollectionUtil
.
isEmpty
(
orderDOList
))
{
return
boxGoodsStatistics
;
}
for
(
OrderDO
orderDO
:
orderDOList
)
{
...
...
@@ -857,15 +865,15 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal
volumeSum
=
boxGoodsStatistics
.
getVolume
();
BigDecimal
weightSum
=
boxGoodsStatistics
.
getWeight
();
if
(
orderDO
.
getSumNum
()
!=
null
)
{
if
(
orderDO
.
getSumNum
()
!=
null
)
{
numSum
+=
orderDO
.
getSumNum
();
boxGoodsStatistics
.
setNum
(
numSum
);
}
if
(
orderDO
.
getSumVolume
()
!=
null
)
{
if
(
orderDO
.
getSumVolume
()
!=
null
)
{
volumeSum
=
volumeSum
.
add
(
orderDO
.
getSumVolume
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
boxGoodsStatistics
.
setVolume
(
volumeSum
);
}
if
(
orderDO
.
getSumWeight
()
!=
null
)
{
if
(
orderDO
.
getSumWeight
()
!=
null
)
{
weightSum
=
weightSum
.
add
(
orderDO
.
getSumWeight
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
boxGoodsStatistics
.
setWeight
(
weightSum
);
}
...
...
@@ -877,14 +885,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
public
void
delCheckStatus
(
Long
shipmentId
)
{
//>审核中就不可以移出,
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
if
(
boxDO
.
getTransportType
().
equals
(
TransportTypeEnum
.
AIR
.
getType
()))
{
if
(
boxDO
.
getTransportType
().
equals
(
TransportTypeEnum
.
AIR
.
getType
()))
{
Integer
airShipmentStatus
=
boxDO
.
getAirShipmentStatus
();
if
(
airShipmentStatus
==
AirShipmentStatusEnum
.
SHIPMENT
.
getStatus
())
{
if
(
airShipmentStatus
==
AirShipmentStatusEnum
.
SHIPMENT
.
getStatus
())
{
throw
new
ServiceException
(
500
,
"自编号通过出货审核,无法删除订单"
);
}
}
else
{
Integer
ldStatus
=
boxDO
.
getLdStatus
();
if
(
ldStatus
==
LdStatusEnum
.
INSTALLED_TO_BE_SEALED
.
getLdStatus
()
||
ldStatus
==
LdStatusEnum
.
CABINET_EXAMINE_ING
.
getLdStatus
()
if
(
ldStatus
==
LdStatusEnum
.
INSTALLED_TO_BE_SEALED
.
getLdStatus
()
||
ldStatus
==
LdStatusEnum
.
CABINET_EXAMINE_ING
.
getLdStatus
()
||
ldStatus
==
LdStatusEnum
.
CABINET_EXAMINE_SUCCESS
.
getLdStatus
()
||
ldStatus
==
LdStatusEnum
.
CABINET_SEALED
.
getLdStatus
())
{
throw
new
ServiceException
(
500
,
"自编号通过出货审核,无法删除订单"
);
}
...
...
@@ -896,7 +904,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
public
void
deleteBoxPreloadGoods
(
Collection
<
Long
>
ids
,
Integer
deleteType
)
{
//同时删除这些商品的订单下的所有商品
List
<
BoxPreloadGoodsDO
>
goodItemList
=
getBoxPreloadGoodsList
(
ids
);
if
(
CollectionUtil
.
isEmpty
(
goodItemList
))
return
;
if
(
CollectionUtil
.
isEmpty
(
goodItemList
))
return
;
//校验是否在审核中
BoxPreloadGoodsDO
boxPreloadGoodsDO
=
goodItemList
.
get
(
0
);
...
...
@@ -922,19 +930,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
@Override
public
Collection
<
Long
>
checkDeleteOrder
(
Long
shipmentId
,
Integer
deleteType
,
Collection
<
Long
>
orderIdList
)
{
if
(
deleteType
==
null
)
{
if
(
deleteType
==
null
)
{
//需要弹窗提示
//找出这些订单的关联单,提示
BoxOrderRemoveAO
ao
=
findRelationOrder
(
shipmentId
,
orderIdList
);
if
(
ao
.
isHasRelationOrder
())
{
if
(
ao
.
isHasRelationOrder
())
{
//有关联单,弹出提示
throw
new
ServiceException
(
666
,
ao
.
getMsg
());
}
}
else
{
//需要删除关联单
if
(
deleteType
==
2
)
{
if
(
deleteType
==
2
)
{
BoxOrderRemoveAO
ao
=
findRelationOrder
(
shipmentId
,
orderIdList
);
if
(
ao
.
isHasRelationOrder
())
{
if
(
ao
.
isHasRelationOrder
())
{
List
<
OrderDO
>
orderList
=
ao
.
getRemoveList
();
orderIdList
=
orderList
.
stream
()
.
map
(
OrderDO:
:
getOrderId
)
...
...
@@ -955,7 +963,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
if
(
CollectionUtil
.
isNotEmpty
(
orderIdList
))
{
List
<
OrderDO
>
removeOrderList
=
orderService
.
listByIds
(
orderIdList
);
Map
<
Long
,
OrderDO
>
orderMap
=
removeOrderList
.
stream
()
.
collect
(
Collectors
.
toMap
(
OrderDO:
:
getOrderId
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
.
collect
(
Collectors
.
toMap
(
OrderDO:
:
getOrderId
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
//找出这个出货所有预装的订单
Set
<
Long
>
preloadOrderIdSet
=
getShipOrderIdList
(
shipmentId
);
...
...
@@ -965,19 +973,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//订单的所有关联单
List
<
OrderGuanlianDO
>
orderRelationList
=
orderGuanlianService
.
getRelationList
(
orderId
);
if
(
orderRelationList
!=
null
)
{
if
(
orderRelationList
!=
null
)
{
//过滤掉不在这个出货的关联单
orderRelationList
=
orderRelationList
.
stream
()
.
filter
(
t
->
preloadOrderIdSet
.
contains
(
t
.
getOrderId
())
&&
preloadOrderIdSet
.
contains
(
t
.
getRelateOrderId
()))
.
collect
(
Collectors
.
toList
());
}
boolean
hasRelationOrder
=
CollectionUtil
.
isNotEmpty
(
orderRelationList
);
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
//从已经预装的里面过滤
orderRelationList
=
orderRelationList
.
stream
()
.
filter
(
t
->
preloadOrderIdSet
.
contains
(
t
.
getOrderId
())
||
preloadOrderIdSet
.
contains
(
t
.
getRelateOrderId
()))
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
orderRelationList
))
continue
;
if
(
CollectionUtils
.
isEmpty
(
orderRelationList
))
continue
;
relationOrder
=
true
;
...
...
@@ -1031,8 +1039,9 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
List
<
BoxPreloadSectionDO
>
sectionList
=
boxPreloadSectionService
.
selectList
(
"shipment_id"
,
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
sectionList
))
{
List
<
BoxPreloadSectionDO
>
sectionList
=
boxPreloadSectionService
.
selectList
(
"shipment_id"
,
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
sectionList
))
{
// sectionList = new ArrayList<>();
//
...
...
@@ -1040,9 +1049,9 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
DictDataExportReqVO
dictDataExportReqVO
=
new
DictDataExportReqVO
();
dictDataExportReqVO
.
setDictType
(
"part_function_switch"
);
List
<
DictDataDO
>
dictDataRespDTOS
=
dictDataService
.
getDictDatas
(
dictDataExportReqVO
);
if
(
query
.
getSmartInstall
()
!=
null
&&
query
.
getSmartInstall
()
==
1
)
{
if
(
query
.
getSmartInstall
()
!=
null
&&
query
.
getSmartInstall
()
==
1
)
{
int
defaultNum
=
5
;
if
(
boxDO
.
getTransportType
().
equals
(
TransportTypeEnum
.
AIR
.
getType
()))
{
if
(
boxDO
.
getTransportType
().
equals
(
TransportTypeEnum
.
AIR
.
getType
()))
{
defaultNum
=
1
;
}
//默认创建5个部分
...
...
@@ -1080,7 +1089,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
BoxPreloadGoodsBackVO
>
sectionGoodsList
=
sectionGoodsMap
.
get
(
sectionBackVO
.
getId
());
sectionBackVO
.
setSectionGoodsList
(
sectionGoodsList
);
if
(
sectionGoodsList
==
null
)
continue
;
if
(
sectionGoodsList
==
null
)
continue
;
for
(
BoxPreloadGoodsBackVO
boxPreloadGoodsBackVO
:
sectionGoodsList
)
{
boxPreloadGoodsBackVO
.
setAttrNameList
(
...
...
@@ -1108,7 +1117,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxPreloadSectionDetailVO
data
=
new
BoxPreloadSectionDetailVO
();
data
.
setLoadStatistics
(
loadStatistics
);
data
.
setSectionGoodList
(
sectionBackList
);
if
(
cabinetDO
!=
null
)
{
if
(
cabinetDO
!=
null
)
{
//计算剩余的体积和重量
BigDecimal
remainVolume
=
cabinetDO
.
getVolume
().
subtract
(
loadStatistics
.
getVolume
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
BigDecimal
remainWeight
=
cabinetDO
.
getWeight
().
subtract
(
loadStatistics
.
getWeight
()).
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
);
...
...
@@ -1122,13 +1131,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
* 智慧预装
* 按入仓时间最早、路线相同、方数符合要求的订单默认填充,可手动移出。
* 1.优先拆单、报关退场订单
*
*
<p>
* 预装规则:
* 第一部分:存放柜里货
* 第二部分:在非柜里货中筛选存在有牌的货,装在第二部分
* 第三部分:无牌的柜内货
* 第四部分:无牌的次封柜货
* 第五部分:无牌的封柜货
*
* @param boxDO 出货单
*/
private
void
smartInstall
(
BoxDO
boxDO
,
List
<
BoxPreloadSectionDO
>
sectionList
)
{
...
...
@@ -1152,11 +1162,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
orderPreloadReq
.
setPageSize
(
Integer
.
MAX_VALUE
);
BoxOrderPreloadStatistics
boxOrderPreloadStatistics
=
orderPreloadPage
(
orderPreloadReq
);
PageResult
<
BoxOrderPreloadVo
>
pageResult
=
boxOrderPreloadStatistics
.
getDataList
();
if
(
pageResult
==
null
)
return
;
if
(
pageResult
==
null
)
return
;
List
<
BoxOrderPreloadVo
>
orderList
=
pageResult
.
getList
();
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
if
(
CollectionUtil
.
isEmpty
(
orderList
))
return
;
//首先按照入仓时间排序
orderList
.
sort
((
o1
,
o2
)
->
o2
.
getRucangTime
().
compareTo
(
o1
.
getRucangTime
()));
...
...
@@ -1172,7 +1182,6 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemDO
>
orderItemList
=
boxService
.
getOrderItemListByOrderIdList
(
orderIdList
);
Map
<
Long
,
List
<
OrderItemDO
>>
orderItemMap
=
orderItemList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
OrderItemDO:
:
getOrderId
));
...
...
@@ -1189,10 +1198,10 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemDO
>
itemOrderItemList
=
orderItemMap
.
get
(
orderId
);
Integer
sectionPosition
=
checkSectionPosition
(
itemOrderItemList
);
//
if
(
sectionPosition
==
null
)
continue
;
if
(
sectionPosition
==
null
)
continue
;
BoxPreloadSectionDO
sectionDO
;
int
sectionSize
=
sectionList
.
size
();
if
(
sectionSize
>
sectionPosition
)
{
if
(
sectionSize
>
sectionPosition
)
{
sectionDO
=
sectionList
.
get
(
sectionPosition
);
}
else
{
int
needAdd
=
(
sectionPosition
+
1
)
-
sectionSize
;
...
...
@@ -1234,6 +1243,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
* 第三部分:无牌的柜内货
* 第四部分:无牌的次封柜货
* 第五部分:无牌的封柜货
*
* @param itemOrderItemList 订单项
* @return
*/
...
...
@@ -1242,30 +1252,30 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
proId
=
orderItemDO
.
getProdId
();
Long
lineId
=
orderItemDO
.
getLineId
();
Long
channelId
=
orderItemDO
.
getChannelId
();
if
(
channelId
==
null
)
channelId
=
0L
;
if
(
channelId
==
null
)
channelId
=
0L
;
ProductPriceDO
productPriceDO
=
boxService
.
getProductPrice
(
proId
,
lineId
,
channelId
);
String
containerLocation
=
productPriceDO
.
getContainerLocation
();
if
(
StringUtils
.
isEmpty
(
containerLocation
))
{
if
(
StringUtils
.
isEmpty
(
containerLocation
))
{
//未设置的话,默认为柜里货
containerLocation
=
ContainerLocation
.
GLH
.
getValue
();
}
Integer
brandType
=
orderItemDO
.
getBrandType
();
if
(
containerLocation
.
equals
(
ContainerLocation
.
GLH
.
getValue
()))
{
if
(
containerLocation
.
equals
(
ContainerLocation
.
GLH
.
getValue
()))
{
//柜里货,放第一部分
return
0
;
}
else
{
//有牌,放在第二部分
if
(
brandType
==
1
)
{
if
(
brandType
==
1
)
{
return
1
;
}
else
{
//
if
(
containerLocation
.
equals
(
ContainerLocation
.
GNH
.
getValue
()))
{
if
(
containerLocation
.
equals
(
ContainerLocation
.
GNH
.
getValue
()))
{
return
2
;
}
else
if
(
containerLocation
.
equals
(
ContainerLocation
.
CFHG
.
getValue
()))
{
}
else
if
(
containerLocation
.
equals
(
ContainerLocation
.
CFHG
.
getValue
()))
{
return
3
;
}
else
if
(
containerLocation
.
equals
(
ContainerLocation
.
FHG
.
getValue
()))
{
}
else
if
(
containerLocation
.
equals
(
ContainerLocation
.
FHG
.
getValue
()))
{
return
4
;
}
}
...
...
@@ -1276,6 +1286,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 获取部分列表
*
* @param shipmentId 出货单ID
* @return
*/
...
...
@@ -1294,19 +1305,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//首先判断是否是反审后回来的
BoxApprovalDO
boxApprovalDO
=
boxService
.
getLatestApproval
(
shipmentId
);
if
(
boxApprovalDO
!=
null
)
{
if
(
boxApprovalDO
!=
null
)
{
boolean
backApproval
=
boxApprovalDO
.
getApprovalType
()
==
BoxApprovalTypeEnum
.
PRELOAD_UMPIRE
.
getType
()
||
boxApprovalDO
.
getApprovalType
()
==
BoxApprovalTypeEnum
.
AIR_SORTING_BACK
.
getType
();
if
(
backApproval
)
tempSort
=
false
;
if
(
backApproval
)
tempSort
=
false
;
}
int
maxNum
=
0
;
if
(!
tempSort
)
{
if
(!
tempSort
)
{
List
<
BoxPreloadGoodsDO
>
settleList
=
preloadGoodsList
.
stream
().
filter
(
t
->
t
.
getTidanNum
()
!=
99999
)
.
collect
(
Collectors
.
toList
());
OptionalInt
optionalInt
=
settleList
.
stream
().
mapToInt
(
BoxPreloadGoodsDO:
:
getTidanNum
).
max
();
if
(
optionalInt
.
isPresent
())
{
if
(
optionalInt
.
isPresent
())
{
maxNum
=
optionalInt
.
getAsInt
();
}
...
...
@@ -1321,7 +1332,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
collect
(
Collectors
.
toList
());
//还未设置提单号
if
(
maxNum
==
0
)
{
if
(
maxNum
==
0
)
{
List
<
BoxPreloadSectionDO
>
sectionList
=
getSectionListByShipmentId
(
shipmentId
);
Map
<
Long
,
List
<
BoxPreloadGoodsDO
>>
sectionGoodsMap
=
preloadGoodsList
.
stream
()
...
...
@@ -1330,7 +1341,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
int
orderNum
=
1
;
for
(
BoxPreloadSectionDO
sectionDO
:
sectionList
)
{
List
<
BoxPreloadGoodsDO
>
sectionGoodsList
=
sectionGoodsMap
.
get
(
sectionDO
.
getId
());
if
(
CollectionUtil
.
isEmpty
(
sectionGoodsList
))
continue
;
if
(
CollectionUtil
.
isEmpty
(
sectionGoodsList
))
continue
;
sectionGoodsList
.
sort
(
Comparator
.
comparing
(
BoxPreloadGoodsDO:
:
getId
));
orderNum
=
setTidanNum
(
sectionGoodsList
,
orderNum
,
selfNo
,
updateOrder
);
...
...
@@ -1342,14 +1353,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
BoxPreloadGoodsDO
>
list
=
preloadGoodsList
.
stream
()
.
filter
(
t
->
t
.
getTidanNum
()
==
99999
)
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
//按照时间排序
list
.
sort
(
Comparator
.
comparing
(
BaseDO:
:
getCreateTime
));
int
orderNum
=
maxNum
+
1
;
List
<
Integer
>
missList
=
findDeletionList
(
preloadGoodsList
);
if
(
CollectionUtil
.
isEmpty
(
missList
))
{
if
(
CollectionUtil
.
isEmpty
(
missList
))
{
orderNum
=
setTidanNum
(
list
,
orderNum
,
selfNo
,
updateOrder
);
}
else
{
//list是需要补单的数据
...
...
@@ -1361,7 +1372,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
));
Iterator
<
Long
>
orderIdIt
=
orderMap
.
keySet
().
iterator
();
for
(
Integer
num
:
missList
)
{
if
(
orderIdIt
.
hasNext
())
{
if
(
orderIdIt
.
hasNext
())
{
Long
orderId
=
orderIdIt
.
next
();
List
<
BoxPreloadGoodsDO
>
orderGoodList
=
orderMap
.
get
(
orderId
);
setTidanNum
(
orderGoodList
,
num
,
selfNo
,
updateOrder
);
...
...
@@ -1372,7 +1383,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
BoxPreloadGoodsDO
>
resultList
=
orderMap
.
values
().
stream
()
.
flatMap
(
Collection:
:
stream
)
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
resultList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
resultList
))
{
setTidanNum
(
resultList
,
orderNum
,
selfNo
,
updateOrder
);
}
}
...
...
@@ -1380,13 +1391,13 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
if
(
updateOrder
)
{
if
(
updateOrder
)
{
Set
<
Long
>
orderIdSet
=
preloadGoodsList
.
stream
()
.
map
(
BoxPreloadGoodsDO:
:
getOrderId
)
.
collect
(
Collectors
.
toSet
());
Map
<
Long
,
Integer
>
tidanNumMap
=
preloadGoodsList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderId
,
BoxPreloadGoodsDO:
:
getTidanNum
,
(
v1
,
v2
)
->
v2
));
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderId
,
BoxPreloadGoodsDO:
:
getTidanNum
,
(
v1
,
v2
)
->
v2
));
for
(
Long
orderId
:
orderIdSet
)
{
Integer
orderNum
=
tidanNumMap
.
get
(
orderId
);
String
ladingBillNo
=
selfNo
+
"-"
+
orderNum
;
...
...
@@ -1397,6 +1408,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 找出有间隔的订单
*
* @param list 预装商品项
* @return
*/
...
...
@@ -1458,6 +1470,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 根据订单生成提单号
*
* @param orderId 订单ID
* @return
*/
...
...
@@ -1466,7 +1479,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
eq
(
BoxPreloadGoodsDO:
:
getOrderId
,
orderId
)
.
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
)
);
if
(
CollectionUtil
.
isEmpty
(
goodsDOList
))
{
if
(
CollectionUtil
.
isEmpty
(
goodsDOList
))
{
throw
new
IllegalStateException
(
"出货单不存在"
);
}
BoxPreloadGoodsDO
boxPreloadGoodsDO
=
goodsDOList
.
get
(
0
);
...
...
@@ -1536,8 +1549,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
Integer
prStatus
=
boxDO
.
getPrStatus
();
Set
<
Long
>
orderIdSet
=
getShipOrderIdList
(
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
{
if
(
prStatus
==
PrStatusEnum
.
PRELOAD_ING
.
getPrStatus
()
||
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
{
if
(
prStatus
==
PrStatusEnum
.
PRELOAD_ING
.
getPrStatus
()
||
prStatus
==
PrStatusEnum
.
PRELOAD_APPROVAL_FAIL
.
getPrStatus
()
)
{
//修改为已订舱,待预装
...
...
@@ -1546,7 +1559,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
else
{
//修改为预装中
if
(
prStatus
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
()
||
if
(
prStatus
==
PrStatusEnum
.
NO_PRELOAD
.
getPrStatus
()
||
prStatus
==
PrStatusEnum
.
PRELOAD_APPROVAL_FAIL
.
getPrStatus
()
)
{
//未预装和预装审核失败的情况才修改为预装中
...
...
@@ -1559,6 +1572,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 把订单从出货单中删除
*
* @param shipmentId 出货单ID
* @param orderIdCollection 订单列表
* @param type 1 预装移除 2 理货移除 3 装柜移除
...
...
@@ -1566,7 +1580,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
*/
@Override
public
void
deleteOrderList
(
Long
shipmentId
,
Collection
<
Long
>
orderIdCollection
,
Integer
type
,
boolean
hasExit
)
{
if
(
CollectionUtil
.
isNotEmpty
(
orderIdCollection
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderIdCollection
))
{
//删除装柜商品
boxPreloadGoodsMapper
.
delete
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>()
.
in
(
BoxPreloadGoodsDO:
:
getOrderId
,
orderIdCollection
)
...
...
@@ -1585,8 +1599,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//删除该订单在理货这合包时的装箱数据
boxOrderCheckInfoService
.
remove
(
new
LambdaQueryWrapperX
<
BoxOrderCheckInfoDO
>()
.
eq
(
BoxOrderCheckInfoDO:
:
getShipmentId
,
shipmentId
)
.
in
(
BoxOrderCheckInfoDO:
:
getOrderId
,
orderIdCollection
)
.
eq
(
BoxOrderCheckInfoDO:
:
getShipmentId
,
shipmentId
)
.
in
(
BoxOrderCheckInfoDO:
:
getOrderId
,
orderIdCollection
)
);
//删除已经理货的数据
...
...
@@ -1678,10 +1692,10 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
calculateBoxMergeSum
(
shipmentId
,
boxGoodsStatistics
);
boxLoadDetailBackVO
.
setTotalStatistics
(
boxGoodsStatistics
);
if
(
secId
!=
null
&&
secId
!=
0L
)
{
if
(
secId
!=
null
&&
secId
!=
0L
)
{
List
<
BoxPreloadGoodsBackVO
>
sectionGoodsList
=
sectionGoodsMap
.
get
(
secId
);
if
(
sectionGoodsList
!=
null
)
{
if
(
sectionGoodsList
!=
null
)
{
List
<
OrderItemDO
>
secOrderItemDOList
=
new
ArrayList
<>();
for
(
BoxPreloadGoodsBackVO
item
:
sectionGoodsList
)
{
OrderItemDO
orderItemDO
=
new
OrderItemDO
();
...
...
@@ -1690,7 +1704,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
BoxGoodsStatistics
secBoxGoodsStatistics
=
calculationStatistics
(
secOrderItemDOList
);
long
secUnloadNum
=
loadInfoList
.
stream
()
.
filter
(
t
->
t
.
getIsUnload
()
==
1
)
.
filter
(
t
->
t
.
getIsUnload
()
==
1
)
.
count
();
Set
<
Long
>
secOrderIdSet
=
secOrderItemDOList
.
stream
()
...
...
@@ -1717,13 +1731,13 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//
Long
sectionId
=
sectionDO
.
getId
();
if
(
secId
!=
null
&&
secId
!=
0
&&
!
sectionId
.
equals
(
secId
))
{
if
(
secId
!=
null
&&
secId
!=
0
&&
!
sectionId
.
equals
(
secId
))
{
continue
;
}
List
<
BoxPreloadGoodsBackVO
>
sectionGoodsList
=
sectionGoodsMap
.
get
(
sectionId
);
if
(
CollectionUtil
.
isEmpty
(
sectionGoodsList
))
continue
;
if
(
CollectionUtil
.
isEmpty
(
sectionGoodsList
))
continue
;
//按照订单分组
Map
<
Long
,
List
<
BoxPreloadGoodsBackVO
>>
orderItemsMap
=
sectionGoodsList
.
stream
()
...
...
@@ -1801,7 +1815,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
orderVO
.
setInstallNum
(
CollectionUtil
.
isNotEmpty
(
installList
)
?
installList
.
size
()
:
0
);
orderVO
.
setUnloadNum
(
0
);
if
(
installList
!=
null
)
{
if
(
installList
!=
null
)
{
List
<
BoxLoadInfoDO
>
unloadList
=
installList
.
stream
()
.
filter
(
t
->
t
.
getIsUnload
()
==
1
)
.
collect
(
Collectors
.
toList
());
...
...
@@ -1809,7 +1823,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
loadOrderList
.
sort
((
o1
,
o2
)
->
{
if
(
o1
.
getTidanNum
().
compareTo
(
o2
.
getTidanNum
())
==
0
)
{
if
(
o1
.
getTidanNum
().
compareTo
(
o2
.
getTidanNum
())
==
0
)
{
return
o1
.
getPreloadId
().
compareTo
(
o2
.
getPreloadId
());
}
return
o1
.
getTidanNum
().
compareTo
(
o2
.
getTidanNum
());
...
...
@@ -1819,7 +1833,6 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
@Override
public
BoxLoadDetailBackVO
loadGoodsList
(
Long
shipmentId
,
Long
secId
)
{
return
boxGoodsList
(
shipmentId
,
secId
,
null
,
0
);
...
...
@@ -1854,7 +1867,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//查询订单的报关费用
List
<
BoxLoadOrderVO
>
orderVOList
=
detailBackVO
.
getSectionOrderList
();
if
(
CollectionUtil
.
isNotEmpty
(
orderVOList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
orderVOList
))
{
List
<
Long
>
orderIdList
=
orderVOList
.
stream
()
.
map
(
BoxLoadOrderVO:
:
getOrderId
)
.
collect
(
Collectors
.
toList
());
...
...
@@ -1868,16 +1881,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
detailBackVO
.
setAbnormalList
(
BoxAbnormalConvert
.
INSTANCE
.
convertList
(
abnormalList
));
String
dealOrderIds
=
null
;
BoxAbnormalDO
boxAbnormalDO
=
null
;
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
boxAbnormalDO
=
abnormalList
.
get
(
0
);
dealOrderIds
=
boxAbnormalDO
.
getDealOrderIds
();
}
if
(
StringUtils
.
isEmpty
(
dealOrderIds
))
{
if
(
StringUtils
.
isEmpty
(
dealOrderIds
))
{
dealOrderIds
=
""
;
}
for
(
BoxLoadOrderVO
orderVO
:
orderVOList
)
{
orderVO
.
setCustomsFee
(
orderFeeMap
.
get
(
orderVO
.
getOrderId
()));
if
(
boxAbnormalDO
==
null
)
{
if
(
boxAbnormalDO
==
null
)
{
orderVO
.
setAbnormalDealStatus
(
1
);
}
else
{
boolean
isDeal
=
dealOrderIds
.
contains
(
orderVO
.
getOrderId
().
toString
());
...
...
@@ -1893,7 +1906,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//1.找出计划装箱的数量
//设置为不能移除的
List
<
BoxPreloadGoodsBackVO
>
goodsItemList
=
getShipGoodItemList
(
shipmentId
);
if
(
CollectionUtil
.
isEmpty
(
goodsItemList
))
{
if
(
CollectionUtil
.
isEmpty
(
goodsItemList
))
{
throw
exception
(
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.
ORDER_NOT_EXISTS
);
}
...
...
@@ -1904,7 +1917,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
orderDOList
=
orderDOList
.
stream
()
.
filter
(
t
->
t
.
getOrderNo
().
equals
(
orderNo
))
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
orderDOList
))
{
if
(
CollectionUtil
.
isEmpty
(
orderDOList
))
{
throw
exception
(
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.
ORDER_NOT_EXISTS
);
}
return
orderDOList
.
get
(
0
).
getOrderId
();
...
...
@@ -1917,21 +1930,22 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderPreloadVO
>
orderPreloadList
=
orderQueryService
.
orderPreloadList
(
query
);
if
(
CollectionUtil
.
isEmpty
(
orderPreloadList
))
return
new
BoxOrderPreloadStatistics
();
if
(
CollectionUtil
.
isEmpty
(
orderPreloadList
))
return
new
BoxOrderPreloadStatistics
();
Long
startWarehouseId
=
query
.
getStartWarehouseId
();
//校验始发仓
if
(
startWarehouseId
!=
null
)
{
if
(
startWarehouseId
!=
null
)
{
Iterator
<
OrderPreloadVO
>
it
=
orderPreloadList
.
iterator
();
while
(
it
.
hasNext
())
{
OrderPreloadVO
preloadVO
=
it
.
next
();
Long
adjustToDestWarehouseId
=
preloadVO
.
getAdjustToDestWarehouseId
();
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
//有调仓,判断调仓是否符合条件,不符合条件则直接移除
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
it
.
remove
();
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
it
.
remove
();
}
else
{
//没有调仓,判断始发仓是否符合条件
if
(!
startWarehouseId
.
equals
(
preloadVO
.
getStartWarehouseId
()))
it
.
remove
();
if
(!
startWarehouseId
.
equals
(
preloadVO
.
getStartWarehouseId
()))
it
.
remove
();
}
}
}
...
...
@@ -1959,7 +1973,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemBackVO
>
orderItemList
=
orderItemService
.
getOrderItemBackByOrderId
(
orderIdList
);
//订单项过滤了入仓为0的数据,
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
//订单对应的订单项列表
Map
<
Long
,
List
<
OrderItemBackVO
>>
orderItemMap
=
orderItemList
.
stream
()
...
...
@@ -1977,7 +1991,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
);
//订单项ID->已装商品
Map
<
Long
,
BoxPreloadGoodsDO
>
itemIdMap
=
boxPreloadGoodsDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderItemId
,
v
->
v
,
(
v1
,
v2
)->
v2
));
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderItemId
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
//获取出货单ID列表
List
<
Long
>
shipmentIdList
=
boxPreloadGoodsDOList
.
stream
()
...
...
@@ -1987,10 +2001,10 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Map
<
Long
,
BoxDO
>
boxMap
=
new
HashMap
<>();
Map
<
Long
,
List
<
BoxPreloadSectionDO
>>
sectionMap
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
shipmentIdList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
shipmentIdList
))
{
List
<
BoxDO
>
boxList
=
boxService
.
getBoxList
(
shipmentIdList
);
boxMap
=
boxList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BoxDO:
:
getId
,
v
->
v
));
.
collect
(
Collectors
.
toMap
(
BoxDO:
:
getId
,
v
->
v
));
//找到出货单下面的所有部分,确定已装商品在第几部分
List
<
BoxPreloadSectionDO
>
sectionDOList
=
boxPreloadSectionService
.
selectByShipmentIdList
(
shipmentIdList
);
...
...
@@ -2012,7 +2026,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemBackVO
>
itemList
=
orderItemMap
.
get
(
orderPreloadVO
.
getOrderId
());
//过滤了为入仓的订单项,所以会有为null的情况,
//没有订单项,删除这个订单,
if
(
CollectionUtil
.
isEmpty
(
itemList
))
{
if
(
CollectionUtil
.
isEmpty
(
itemList
))
{
it
.
remove
();
continue
;
}
...
...
@@ -2029,14 +2043,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
orderItemId
=
item
.
getOrderItemId
();
BoxPreloadGoodsDO
boxPreloadGoodsDO
=
itemIdMap
.
get
(
orderItemId
);
if
(
boxPreloadGoodsDO
==
null
)
{
if
(
boxPreloadGoodsDO
==
null
)
{
//未预装
unLoadItemList
.
add
(
OrderItemConvert
.
INSTANCE
.
convert
(
item
));
}
else
{
//已预装
Long
shipmentId
=
boxPreloadGoodsDO
.
getShipmentId
();
BoxDO
boxDO
=
boxMap
.
get
(
shipmentId
);
if
(
boxDO
==
null
)
{
if
(
boxDO
==
null
)
{
//出货单未找到?
unLoadItemList
.
add
(
OrderItemConvert
.
INSTANCE
.
convert
(
item
));
}
else
{
...
...
@@ -2050,7 +2064,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
}
if
(
boxOrderItemBackVOList
.
size
()
==
loadInfoList
.
size
())
{
if
(
boxOrderItemBackVOList
.
size
()
==
loadInfoList
.
size
())
{
//这个订单都已经被预装了
it
.
remove
();
}
...
...
@@ -2060,16 +2074,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
map
(
OrderPreloadVO:
:
getOrderId
)
.
collect
(
Collectors
.
toList
());
Integer
orderStatus
=
query
.
getOrderStatus
();
if
(
orderStatus
!=
null
&&
CollectionUtil
.
isNotEmpty
(
resultOrderIdList
))
{
if
(
orderStatus
!=
null
&&
CollectionUtil
.
isNotEmpty
(
resultOrderIdList
))
{
List
<
Long
>
matchIdList
=
new
ArrayList
<>();
if
(
orderStatus
==
1
)
{
//拆单
if
(
orderStatus
==
1
)
{
//拆单
//过滤掉不是拆单的订单
List
<
OrderDO
>
orderDOList
=
orderQueryService
.
getOrderList
(
resultOrderIdList
);
matchIdList
=
orderDOList
.
stream
()
.
filter
(
t
->
(
t
.
getParentOrderId
()
!=
null
&&
t
.
getParentOrderId
()
!=
0L
))
.
map
(
OrderDO:
:
getOrderId
)
.
collect
(
Collectors
.
toList
());
}
else
if
(
orderStatus
==
2
)
{
//关联单
}
else
if
(
orderStatus
==
2
)
{
//关联单
//找出所有的关联单
List
<
OrderGuanlianDO
>
guanlianList
=
orderGuanlianService
.
getGuanlianList
(
resultOrderIdList
);
matchIdList
=
guanlianList
.
stream
()
...
...
@@ -2088,7 +2102,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
filter
(
t
->
finalMatchIdList
.
contains
(
t
.
getOrderId
()))
.
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtil
.
isNotEmpty
(
unLoadItemList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
unLoadItemList
))
{
//过滤审核中的订单
Set
<
Long
>
oIdList
=
unLoadItemList
.
stream
()
.
map
(
OrderItemDO:
:
getOrderId
)
...
...
@@ -2106,15 +2120,21 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
//统计待预装箱数、重量、体积
BoxGoodsStatistics
boxGoodsStatistics
=
calculationStatistics
(
unLoadItemList
);
//按照最早入仓时间排序
list
.
sort
(
new
Comparator
<
BoxOrderPreloadVo
>()
{
@Override
public
int
compare
(
BoxOrderPreloadVo
o1
,
BoxOrderPreloadVo
o2
)
{
if
(
o1
.
getRucangTime
()
!=
null
&&
o2
.
getRucangTime
()
!=
null
)
{
return
o1
.
getRucangTime
().
compareTo
(
o2
.
getRucangTime
());
}
else
{
o1
.
setRucangTime
(
new
Date
());
o2
.
setRucangTime
(
new
Date
());
return
o1
.
getRucangTime
().
compareTo
(
o2
.
getRucangTime
());
}
}
});
...
...
@@ -2129,7 +2149,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
float
count
=
list
.
size
();
//计算最大页数
float
number
=
count
/
limit
;
int
pages
=
(
int
)
Math
.
ceil
(
number
);
int
pages
=
(
int
)
Math
.
ceil
(
number
);
mPage
.
setPages
(
pages
);
List
<
BoxOrderPreloadVo
>
records
=
list
.
stream
()
...
...
@@ -2182,7 +2202,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
OrderConsigneeDO
filterConsigneeDO
=
null
;
//已经有预装订单,并且需要限制只能放入一个客户订单
if
(
CollectionUtil
.
isNotEmpty
(
orderIdSets
)
&&
isLimit
)
{
if
(
CollectionUtil
.
isNotEmpty
(
orderIdSets
)
&&
isLimit
)
{
Long
existOrderId
=
new
ArrayList
<>(
orderIdSets
).
get
(
0
);
OrderDO
existDO
=
boxService
.
getOrder
(
existOrderId
);
filterConsigneeDO
=
boxService
.
getOrderConsignee
(
existDO
);
...
...
@@ -2196,7 +2216,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//找到出货单
BoxDO
boxDO
=
boxService
.
getBox
(
shipmentId
);
if
(
boxDO
==
null
)
{
if
(
boxDO
==
null
)
{
throw
exception
(
BOX_NOT_EXISTS
);
}
...
...
@@ -2204,15 +2224,15 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
orderId
=
createReqVO
.
getOrderId
();
Long
secId
=
createReqVO
.
getSecId
();
if
(
createReqVO
.
getIsCover
()
==
0
)
{
if
(
createReqVO
.
getIsCover
()
==
0
)
{
//排单,先校验出货是否已经预装审核通过了
Integer
prStatus
=
boxDO
.
getPrStatus
();
if
(
prStatus
==
StStatusEnum
.
SORTING_APPROVAL_SUCCESS
.
getStStatus
())
{
if
(
prStatus
==
StStatusEnum
.
SORTING_APPROVAL_SUCCESS
.
getStStatus
())
{
throw
new
ServiceException
(
500
,
"出货已分拣审核通过。"
);
}
}
else
{
Integer
airShipmentStatus
=
boxDO
.
getAirShipmentStatus
();
if
(
airShipmentStatus
==
AirShipmentStatusEnum
.
SHIPMENT
.
getStatus
())
{
if
(
airShipmentStatus
==
AirShipmentStatusEnum
.
SHIPMENT
.
getStatus
())
{
throw
new
ServiceException
(
500
,
"已出货不能补单。"
);
}
}
...
...
@@ -2226,13 +2246,13 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
OrderConsigneeDO
filterConsigneeDO
=
getFilterOrderConsigneeDO
(
boxDO
,
loadList
);
OrderDO
orderDO
=
orderService
.
getById
(
orderId
);
if
(
filterConsigneeDO
!=
null
)
{
if
(
filterConsigneeDO
!=
null
)
{
//校验收货人是否是同一个人
OrderConsigneeDO
consigneeDO
=
boxService
.
getOrderConsignee
(
orderDO
);
//校验是否是用一个人 ,通过手机号
if
(
consigneeDO
!=
null
&&
!
consigneeDO
.
getPhone
().
equals
(
filterConsigneeDO
.
getPhone
()))
{
if
(
consigneeDO
!=
null
&&
!
consigneeDO
.
getPhone
().
equals
(
filterConsigneeDO
.
getPhone
()))
{
throw
new
ServiceException
(
500
,
"当前自编号是客户+自清,收货人必须是手机号相同才可以进行分拣"
);
}
}
...
...
@@ -2240,7 +2260,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//如果都符合,下面展示互斥和关联订单的弹窗
Integer
relationStatus
=
createReqVO
.
getRelationStatus
();
//校验是否是互斥订单
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
if
(
relationStatus
==
null
||
relationStatus
==
2
)
{
//校验互斥订单
checkMutualOrder
(
loadList
,
orderDO
);
}
...
...
@@ -2251,7 +2271,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
boolean
hasRelationOrder
=
CollectionUtil
.
isNotEmpty
(
orderRelationList
);
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
Set
<
Long
>
orderIdSet
=
orderRelationList
.
stream
()
.
flatMap
(
o
->
Stream
.
of
(
o
.
getOrderId
(),
o
.
getRelateOrderId
()))
.
collect
(
Collectors
.
toSet
());
...
...
@@ -2281,43 +2301,43 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
collect
(
Collectors
.
toList
());
boolean
isSuit
=
true
;
if
(
CollectionUtil
.
isNotEmpty
(
notMatchStatusList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
notMatchStatusList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
notMatchStatusList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"未完成备货,不能排单"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"未完成备货,不能排单"
);
}
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
abnormalList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
abnormalList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"存在异常"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"存在异常"
);
}
if
(
CollectionUtil
.
isNotEmpty
(
auditList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
auditList
))
{
isSuit
=
false
;
if
(
hasRelationOrder
)
{
if
(
hasRelationOrder
)
{
sb
.
append
(
"<br>"
);
}
List
<
String
>
orderNoList
=
auditList
.
stream
()
.
map
(
OrderDO:
:
getOrderNo
)
.
collect
(
Collectors
.
toList
());
String
orderNos
=
Joiner
.
on
(
","
).
join
(
orderNoList
);
sb
.
append
(
"订单:"
)
.
append
(
orderNos
).
append
(
"审核中"
);
sb
.
append
(
"订单:"
).
append
(
orderNos
).
append
(
"审核中"
);
}
if
(!
isSuit
)
{
if
(!
isSuit
)
{
throw
new
ServiceException
(
500
,
sb
.
toString
());
}
...
...
@@ -2327,7 +2347,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//过滤了入仓为0的数据
List
<
OrderItemBackVO
>
orderItemList
=
orderItemService
.
getOrderItemBackByOrderId
(
orderIdList
);
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
{
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
{
throw
new
ServiceException
(
500
,
"订单项不存在"
);
}
...
...
@@ -2359,13 +2379,13 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
sb
.
append
(
"订单:"
).
append
(
item
.
getOrderNo
()).
append
(
","
).
append
(
e
.
getMessage
()).
append
(
"<br>"
);
}
}
if
(!
isSuit
)
{
if
(!
isSuit
)
{
throw
new
ServiceException
(
500
,
sb
.
toString
());
}
//都符合,预装,看是否弹出提示
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
if
(
hasRelationOrder
)
{
if
(
relationStatus
==
null
||
relationStatus
==
1
)
{
if
(
hasRelationOrder
)
{
throw
new
ServiceException
(
566
,
sb
.
toString
());
}
...
...
@@ -2376,7 +2396,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxPreloadGoodsDO
boxPreloadGoods
=
BoxPreloadGoodsConvert
.
INSTANCE
.
convert
(
createReqVO
);
boxPreloadGoods
.
setOrderItemId
(
orderItem
.
getOrderItemId
());
boxPreloadGoods
.
setOrderId
(
orderItem
.
getOrderId
());
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
boxPreloadGoods
.
setIsCover
(
createReqVO
.
getIsCover
());
}
preloadGoodsDOList
.
add
(
boxPreloadGoods
);
...
...
@@ -2385,12 +2405,12 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
// 插入
boxPreloadGoodsMapper
.
insertBatch
(
preloadGoodsDOList
);
if
(
boxDO
.
getPrStatus
()
==
StStatusEnum
.
NO_SORTING
.
getStStatus
())
{
if
(
boxDO
.
getPrStatus
()
==
StStatusEnum
.
NO_SORTING
.
getStStatus
())
{
//修改为分拣中
boxDO
.
setPrStatus
(
StStatusEnum
.
SORTING
.
getStStatus
());
boxService
.
updateById
(
boxDO
);
boxService
.
addOrderLog
(
orderIdList
,
OrderShipmentLog
.
SORTING_ADD
,
""
);
}
else
if
(
boxDO
.
getPrStatus
()
==
StStatusEnum
.
SORTING_APPROVAL_SUCCESS
.
getStStatus
())
{
}
else
if
(
boxDO
.
getPrStatus
()
==
StStatusEnum
.
SORTING_APPROVAL_SUCCESS
.
getStStatus
())
{
//补单。修改订单状态
for
(
Long
oId
:
orderIdList
)
{
boxService
.
updateOrderStatus
(
oId
,
OrderStatusEnum
.
PRE_INSTALLED
.
getValue
(),
0
,
...
...
@@ -2425,7 +2445,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
query
.
setLang
(
I18nMessage
.
getLang
());
Long
airShipmentId
=
query
.
getShipmentId
();
if
(
airShipmentId
==
null
)
{
if
(
airShipmentId
==
null
)
{
throw
new
ServiceException
(
500
,
"shipmentId不能为空"
);
}
BoxDO
airBox
=
boxService
.
getBox
(
airShipmentId
);
...
...
@@ -2438,7 +2458,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
);
OrderConsigneeDO
filterConsigneeDO
=
getFilterOrderConsigneeDO
(
airBox
,
loadList
);
if
(
filterConsigneeDO
!=
null
)
{
if
(
filterConsigneeDO
!=
null
)
{
filterConsigneeDO
.
setRelationId
(
filterConsigneeDO
.
getRelationId
());
}
...
...
@@ -2448,17 +2468,17 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
startWarehouseId
=
query
.
getStartWarehouseId
();
//校验始发仓
if
(
startWarehouseId
!=
null
)
{
if
(
startWarehouseId
!=
null
)
{
Iterator
<
OrderPreloadVO
>
it
=
orderPreloadList
.
iterator
();
while
(
it
.
hasNext
())
{
OrderPreloadVO
preloadVO
=
it
.
next
();
Long
adjustToDestWarehouseId
=
preloadVO
.
getAdjustToDestWarehouseId
();
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
if
(
adjustToDestWarehouseId
!=
null
&&
adjustToDestWarehouseId
!=
0
)
{
//有调仓,判断调仓是否符合条件,不符合条件则直接移除
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
it
.
remove
();
if
(!
startWarehouseId
.
equals
(
adjustToDestWarehouseId
))
it
.
remove
();
}
else
{
//没有调仓,判断始发仓是否符合条件
if
(!
startWarehouseId
.
equals
(
preloadVO
.
getStartWarehouseId
()))
it
.
remove
();
if
(!
startWarehouseId
.
equals
(
preloadVO
.
getStartWarehouseId
()))
it
.
remove
();
}
}
}
...
...
@@ -2486,17 +2506,17 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemBackVO
>
orderItemList
=
orderItemService
.
getOrderItemBackByOrderId
(
orderIdList
);
//订单项过滤了入仓为0的数据,
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
//过滤入仓特性条件
if
(
StringUtils
.
isNotBlank
(
query
.
getAttrId
()))
{
if
(
StringUtils
.
isNotBlank
(
query
.
getAttrId
()))
{
orderItemList
=
orderItemList
.
stream
()
.
filter
(
t
->
StringUtils
.
isNotBlank
(
t
.
getWarehouseInProdAttrIds
()))
.
filter
(
t
->
t
.
getWarehouseInProdAttrIds
().
contains
(
query
.
getAttrId
()))
.
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
if
(
CollectionUtil
.
isEmpty
(
orderItemList
))
return
new
BoxOrderPreloadStatistics
();
//订单对应的订单项列表
Map
<
Long
,
List
<
OrderItemBackVO
>>
orderItemMap
=
orderItemList
.
stream
()
...
...
@@ -2514,7 +2534,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
);
//订单项ID->已装商品
Map
<
Long
,
BoxPreloadGoodsDO
>
itemIdMap
=
boxPreloadGoodsDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderItemId
,
v
->
v
,
(
v1
,
v2
)->
v2
));
.
collect
(
Collectors
.
toMap
(
BoxPreloadGoodsDO:
:
getOrderItemId
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
//获取出货单ID列表
List
<
Long
>
shipmentIdList
=
boxPreloadGoodsDOList
.
stream
()
...
...
@@ -2524,10 +2544,10 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Map
<
Long
,
BoxDO
>
boxMap
=
new
HashMap
<>();
Map
<
Long
,
List
<
BoxPreloadSectionDO
>>
sectionMap
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
shipmentIdList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
shipmentIdList
))
{
List
<
BoxDO
>
boxList
=
boxService
.
getBoxList
(
shipmentIdList
);
boxMap
=
boxList
.
stream
()
.
collect
(
Collectors
.
toMap
(
BoxDO:
:
getId
,
v
->
v
));
.
collect
(
Collectors
.
toMap
(
BoxDO:
:
getId
,
v
->
v
));
//找到出货单下面的所有部分,确定已装商品在第几部分
List
<
BoxPreloadSectionDO
>
sectionDOList
=
boxPreloadSectionService
.
selectByShipmentIdList
(
shipmentIdList
);
...
...
@@ -2549,7 +2569,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List
<
OrderItemBackVO
>
itemList
=
orderItemMap
.
get
(
orderPreloadVO
.
getOrderId
());
//过滤了为入仓的订单项,所以会有为null的情况,
//没有订单项,删除这个订单,
if
(
CollectionUtil
.
isEmpty
(
itemList
))
{
if
(
CollectionUtil
.
isEmpty
(
itemList
))
{
it
.
remove
();
continue
;
}
...
...
@@ -2566,14 +2586,14 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
orderItemId
=
item
.
getOrderItemId
();
BoxPreloadGoodsDO
boxPreloadGoodsDO
=
itemIdMap
.
get
(
orderItemId
);
if
(
boxPreloadGoodsDO
==
null
)
{
if
(
boxPreloadGoodsDO
==
null
)
{
//未预装
unLoadItemList
.
add
(
OrderItemConvert
.
INSTANCE
.
convert
(
item
));
}
else
{
//已预装
Long
shipmentId
=
boxPreloadGoodsDO
.
getShipmentId
();
BoxDO
boxDO
=
boxMap
.
get
(
shipmentId
);
if
(
boxDO
==
null
)
{
if
(
boxDO
==
null
)
{
//出货单未找到?
unLoadItemList
.
add
(
OrderItemConvert
.
INSTANCE
.
convert
(
item
));
}
else
{
...
...
@@ -2587,7 +2607,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
}
if
(
boxOrderItemBackVOList
.
size
()
==
loadInfoList
.
size
())
{
if
(
boxOrderItemBackVOList
.
size
()
==
loadInfoList
.
size
())
{
//这个订单都已经被预装了
it
.
remove
();
}
...
...
@@ -2597,16 +2617,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
map
(
OrderPreloadVO:
:
getOrderId
)
.
collect
(
Collectors
.
toList
());
Integer
orderStatus
=
query
.
getOrderStatus
();
if
(
orderStatus
!=
null
&&
CollectionUtil
.
isNotEmpty
(
resultOrderIdList
))
{
if
(
orderStatus
!=
null
&&
CollectionUtil
.
isNotEmpty
(
resultOrderIdList
))
{
List
<
Long
>
matchIdList
=
new
ArrayList
<>();
if
(
orderStatus
==
1
)
{
//拆单
if
(
orderStatus
==
1
)
{
//拆单
//过滤掉不是拆单的订单
List
<
OrderDO
>
orderDOList
=
orderQueryService
.
getOrderList
(
resultOrderIdList
);
matchIdList
=
orderDOList
.
stream
()
.
filter
(
t
->
(
t
.
getParentOrderId
()
!=
null
&&
t
.
getParentOrderId
()
!=
0L
))
.
map
(
OrderDO:
:
getOrderId
)
.
collect
(
Collectors
.
toList
());
}
else
if
(
orderStatus
==
2
)
{
//关联单
}
else
if
(
orderStatus
==
2
)
{
//关联单
//找出所有的关联单
List
<
OrderGuanlianDO
>
guanlianList
=
orderGuanlianService
.
getGuanlianList
(
resultOrderIdList
);
matchIdList
=
guanlianList
.
stream
()
...
...
@@ -2625,7 +2645,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
filter
(
t
->
finalMatchIdList
.
contains
(
t
.
getOrderId
()))
.
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtil
.
isNotEmpty
(
unLoadItemList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
unLoadItemList
))
{
//过滤审核中的订单
Set
<
Long
>
oIdList
=
unLoadItemList
.
stream
()
.
map
(
OrderItemDO:
:
getOrderId
)
...
...
@@ -2643,7 +2663,6 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
//统计待预装箱数、重量、体积
BoxGoodsStatistics
boxGoodsStatistics
=
calculationStatistics
(
unLoadItemList
);
...
...
@@ -2658,7 +2677,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
float
count
=
list
.
size
();
//计算最大页数
float
number
=
count
/
limit
;
int
pages
=
(
int
)
Math
.
ceil
(
number
);
int
pages
=
(
int
)
Math
.
ceil
(
number
);
mPage
.
setPages
(
pages
);
List
<
BoxOrderPreloadVo
>
records
=
list
.
stream
()
...
...
@@ -2677,7 +2696,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.
map
(
OrderPreloadVO:
:
getChannelId
)
.
collect
(
Collectors
.
toSet
());
Map
<
Long
,
ChannelDO
>
channelDOMap
=
new
HashMap
<>();
if
(
CollectionUtil
.
isNotEmpty
(
lineIdList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
lineIdList
))
{
List
<
ChannelDO
>
channelDOList
=
channelService
.
getChannelList
(
lineIdList
);
channelDOMap
=
channelDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
ChannelDO:
:
getChannelId
,
v
->
v
));
...
...
@@ -2691,7 +2710,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
channelId
=
boxOrderPreloadVo
.
getChannelId
();
ChannelDO
channelDO
=
channelDOMap
.
get
(
channelId
);
if
(
channelDO
!=
null
)
{
if
(
channelDO
!=
null
)
{
boxOrderPreloadVo
.
setAttrNameList
(
getAttrNameByIds
(
channelDO
.
getAttrId
(),
idNameMap
));
}
...
...
@@ -2712,7 +2731,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
private
List
<
String
>
getAttrNameByIds
(
String
attrIds
,
Map
<
String
,
String
>
idNameMap
)
{
if
(
StringUtils
.
isNotBlank
(
attrIds
))
{
if
(
StringUtils
.
isNotBlank
(
attrIds
))
{
String
[]
attrIdArray
=
attrIds
.
split
(
","
);
List
<
String
>
nameList
=
new
ArrayList
<>();
for
(
String
attrId
:
attrIdArray
)
{
...
...
@@ -2729,9 +2748,9 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
while
(
it
.
hasNext
())
{
OrderPreloadVO
orderPreloadVO
=
it
.
next
();
String
guanlianOrderStatus
=
orderPreloadVO
.
getGuanLianOrderStatus
();
if
(
StringUtils
.
isEmpty
(
guanlianOrderStatus
))
continue
;
if
(
StringUtils
.
isEmpty
(
guanlianOrderStatus
))
continue
;
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
guanlianOrderStatus
);
if
(
jsonArray
.
size
()
>
0
)
{
if
(
jsonArray
.
size
()
>
0
)
{
//表示该订单的关联单-有异常或者在审核中或者未入仓
it
.
remove
();
}
...
...
@@ -2742,19 +2761,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Integer
lang
=
I18nMessage
.
getLang
();
StringBuilder
sb
=
new
StringBuilder
();
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
sb
.
append
(
"第"
);
}
else
{
sb
.
append
(
"section "
);
}
for
(
int
i
=
1
;
i
<=
boxSectionList
.
size
();
i
++)
{
BoxPreloadSectionDO
item
=
boxSectionList
.
get
(
i
-
1
);
if
(
item
.
getId
().
equals
(
secId
))
{
if
(
item
.
getId
().
equals
(
secId
))
{
sb
.
append
(
i
);
break
;
}
}
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
sb
.
append
(
"部分"
);
}
return
sb
.
toString
();
...
...
@@ -2765,20 +2784,20 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
StringBuilder
sb
=
new
StringBuilder
();
int
sectionIndex
=
1
;
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
sb
.
append
(
"第"
);
}
else
{
sb
.
append
(
"section "
);
}
for
(
int
i
=
1
;
i
<=
boxSectionList
.
size
();
i
++)
{
BoxPreloadSectionDO
item
=
boxSectionList
.
get
(
i
-
1
);
if
(
item
.
getId
().
equals
(
secId
))
{
if
(
item
.
getId
().
equals
(
secId
))
{
sb
.
append
(
i
);
sectionIndex
=
i
;
break
;
}
}
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
if
(
Objects
.
equals
(
lang
,
LangEnum
.
ZH
.
getLang
()))
{
sb
.
append
(
"部分"
);
}
orderVO
.
setSectionName
(
sb
.
toString
());
...
...
@@ -2819,11 +2838,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Map
<
Long
,
BoxGoodsStatistics
>
shipmentStaticsMap
=
new
HashMap
<>();
for
(
Long
shipmentId
:
shipmentIdList
)
{
List
<
BoxLoadInfoDO
>
loadList
=
shipmentLoadMap
.
get
(
shipmentId
);
if
(
loadList
==
null
)
loadList
=
new
ArrayList
<>();
if
(
loadList
==
null
)
loadList
=
new
ArrayList
<>();
Set
<
Long
>
itemOrderIdSet
=
shipmentOrderMap
.
get
(
shipmentId
);
List
<
OrderDO
>
itemOrderList
=
null
;
if
(
itemOrderIdSet
!=
null
)
{
if
(
itemOrderIdSet
!=
null
)
{
itemOrderList
=
orderDOList
.
stream
()
.
filter
(
t
->
itemOrderIdSet
.
contains
(
t
.
getOrderId
()))
.
collect
(
Collectors
.
toList
());
...
...
@@ -2859,7 +2878,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
boxStatistics
.
setUnloadNum
(
unloadList
.
size
());
long
planNum
=
boxStatistics
.
getNum
();
if
(
planNum
!=
0
)
{
if
(
planNum
!=
0
)
{
//平均计算
BigDecimal
planVolume
=
boxStatistics
.
getVolume
();
BigDecimal
planWeight
=
boxStatistics
.
getWeight
();
...
...
@@ -2869,7 +2888,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal
loadVolume
;
BigDecimal
loadWeight
;
if
(
planNum
==
loadNum
)
{
if
(
planNum
==
loadNum
)
{
loadVolume
=
planVolume
;
loadWeight
=
planWeight
;
...
...
@@ -2887,7 +2906,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal
unloadVolume
;
BigDecimal
unloadWeight
;
if
(
planNum
==
unloadNum
)
{
if
(
planNum
==
unloadNum
)
{
unloadVolume
=
planVolume
;
unloadWeight
=
planWeight
;
}
else
{
...
...
@@ -2922,16 +2941,23 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
return
boxGoodsStatistics
;
}
/*
lanbm 2024-05-13 处理问题添加注释
*/
@Override
public
Map
<
Long
,
BoxGoodsStatistics
>
getBoxStatistics
(
List
<
Long
>
idList
)
{
//设置为不能移除的
//获取所有预装的商品
List
<
BoxPreloadGoodsDO
>
allGoodsItemList
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>()
//lanbm 2024-05-13 添加注释
List
<
BoxPreloadGoodsDO
>
allGoodsItemList
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>()
.
in
(
BoxPreloadGoodsDO:
:
getShipmentId
,
idList
)
.
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
)
);
List
<
OrderItemDO
>
orderItemDOList
=
convertOrderItemList
(
BoxPreloadGoodsConvert
.
INSTANCE
.
convertList
(
allGoodsItemList
));
List
<
OrderItemDO
>
orderItemDOList
=
convertOrderItemList
(
BoxPreloadGoodsConvert
.
INSTANCE
.
convertList
(
allGoodsItemList
));
List
<
OrderDO
>
allOrderDOList
=
getOrderListByOrderItem
(
orderItemDOList
);
Map
<
Long
,
OrderDO
>
allOrderMap
=
allOrderDOList
.
stream
()
.
collect
(
Collectors
.
toMap
(
OrderDO:
:
getOrderId
,
v
->
v
));
...
...
@@ -2942,32 +2968,43 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Long
orderId
=
goodsItem
.
getOrderId
();
OrderDO
orderDO
=
allOrderMap
.
get
(
orderId
);
// 检查 Map 中是否已存在 shipmentId,如果不存在则创建一个新的 Set
shipmentOrderMap
.
computeIfAbsent
(
shipmentId
,
k
->
new
HashSet
<>()).
add
(
orderDO
);
shipmentOrderMap
.
computeIfAbsent
(
shipmentId
,
k
->
new
HashSet
<>()).
add
(
orderDO
);
}
List
<
BoxLoadInfoDO
>
allLoadList
=
boxLoadInfoService
.
list
(
new
LambdaQueryWrapperX
<
BoxLoadInfoDO
>()
//ecw_box_load_info 已装柜标签 lanbm 2024-05-13 添加注释
List
<
BoxLoadInfoDO
>
allLoadList
=
boxLoadInfoService
.
list
(
new
LambdaQueryWrapperX
<
BoxLoadInfoDO
>()
.
in
(
BoxLoadInfoDO:
:
getShipmentId
,
idList
)
);
List
<
BoxMergePkgDO
>
allPkgList
=
boxMergePkgService
.
list
(
new
LambdaQueryWrapper
<
BoxMergePkgDO
>()
//ecw_box_merge_pkg 合包箱表 添加注释
List
<
BoxMergePkgDO
>
allPkgList
=
boxMergePkgService
.
list
(
new
LambdaQueryWrapper
<
BoxMergePkgDO
>()
.
in
(
BoxMergePkgDO:
:
getShipmentId
,
idList
)
);
Map
<
Long
,
List
<
BoxLoadInfoDO
>>
shipmentLoadMap
=
allLoadList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
BoxLoadInfoDO:
:
getShipmentId
));
//合包箱数据
Map
<
Long
,
List
<
BoxMergePkgDO
>>
shipmentMergeMap
=
allPkgList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
BoxMergePkgDO:
:
getShipmentId
));
Map
<
Long
,
BoxGoodsStatistics
>
shipmentStatisticsMap
=
new
HashMap
<>();
for
(
Long
shipmentId
:
idList
)
{
List
<
BoxLoadInfoDO
>
loadInfoList
=
shipmentLoadMap
.
get
(
shipmentId
);
Set
<
OrderDO
>
orderDOList
=
shipmentOrderMap
.
get
(
shipmentId
);
if
(
loadInfoList
==
null
)
loadInfoList
=
new
ArrayList
<>();
if
(
orderDOList
==
null
)
orderDOList
=
new
HashSet
<>();
BoxGoodsStatistics
boxGoodsStatistics
=
calculateByOrderList
(
loadInfoList
,
orderDOList
);
calculateBoxMergeSum
(
shipmentMergeMap
.
get
(
shipmentId
),
boxGoodsStatistics
);
if
(
loadInfoList
==
null
)
loadInfoList
=
new
ArrayList
<>();
if
(
orderDOList
==
null
)
orderDOList
=
new
HashSet
<>();
BoxGoodsStatistics
boxGoodsStatistics
=
calculateByOrderList
(
loadInfoList
,
orderDOList
);
//lanbm 2024-05-13 添加参数,解决合包箱数据为空时不计算预装箱数的BUG
calculateBoxMergeSum
(
shipmentMergeMap
.
get
(
shipmentId
),
boxGoodsStatistics
,
shipmentId
);
shipmentStatisticsMap
.
put
(
shipmentId
,
boxGoodsStatistics
);
}
return
shipmentStatisticsMap
;
...
...
@@ -2976,7 +3013,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
@Override
public
String
getDocumentInfo
(
Long
shipmentId
)
{
Map
<
String
,
String
>
documentInfoMap
=
baseMapper
.
getShipmentCustomTypes
(
shipmentId
);
if
(
documentInfoMap
==
null
)
return
null
;
if
(
documentInfoMap
==
null
)
return
null
;
return
documentInfoMap
.
get
(
"customs_type"
);
}
...
...
@@ -3012,11 +3049,11 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Set
<
Long
>
orderIdSet
=
dataList
.
stream
()
.
map
(
BoxPreloadGoodsDO:
:
getOrderId
)
.
collect
(
Collectors
.
toSet
());
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
return
new
ArrayList
<>();
if
(
CollectionUtil
.
isEmpty
(
orderIdSet
))
return
new
ArrayList
<>();
List
<
Integer
>
customsTypeList
=
Arrays
.
asList
(
2
,
3
);
List
<
OrderDO
>
orderList
=
orderQueryService
.
getOrderList
(
orderIdSet
);
orderList
=
orderList
.
stream
()
.
filter
(
t
->
(
t
.
getCustomsType
()
!=
null
&&
customsTypeList
.
contains
(
t
.
getCustomsType
())))
.
filter
(
t
->
(
t
.
getCustomsType
()
!=
null
&&
customsTypeList
.
contains
(
t
.
getCustomsType
())))
.
collect
(
Collectors
.
toList
());
return
orderList
;
}
...
...
@@ -3026,24 +3063,49 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
return
boxPreloadGoodsMapper
.
orderPreloaded
(
query
);
}
private
void
calculateBoxMergeSum
(
List
<
BoxMergePkgDO
>
mergePkgDOList
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
if
(
CollectionUtil
.
isEmpty
(
mergePkgDOList
))
return
;
/*
shipmentId lanbm 2024-05-13 添加出货主表ID shipmentId
BoxMergePkgDO ecw_box_merge_pkg lanbm 2024-05-13 添加注释
*/
private
void
calculateBoxMergeSum
(
List
<
BoxMergePkgDO
>
mergePkgDOList
,
BoxGoodsStatistics
boxGoodsStatistics
,
long
shipmentId
)
{
//lanbm 2024-05-13 添加修改问题注释掉的代码
//if (CollectionUtil.isEmpty(mergePkgDOList)) return;
//shipmentId = mergePkgDOList.get(0).getShipmentId();
//end lanbm 2024-05-13 添加修改问题注释掉的代码
Long
shipmentId
=
mergePkgDOList
.
get
(
0
).
getShipmentId
();
BoxDO
box
=
boxService
.
getBox
(
shipmentId
);
if
(!
TransportTypeEnum
.
AIR
.
getType
().
equals
(
box
.
getTransportType
()))
{
return
;
}
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
);
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>().
eq
(
BoxPreloadGoodsDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
));
//合包箱数据
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
);
//合包箱数据和预装箱数据
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>().
eq
(
BoxPreloadGoodsDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
));
//合包箱计划数据
getMergeData
(
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
//已出合包数据
getCheckoutMergeData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
boxGoodsStatistics
.
setMergePlanVolume
(
boxGoodsStatistics
.
getMergeVolume
());
boxGoodsStatistics
.
setMergePlanWeight
(
boxGoodsStatistics
.
getMergeWeight
());
boxGoodsStatistics
.
setMergeRealVolume
(
boxGoodsStatistics
.
getCheckoutMergeVolume
());
boxGoodsStatistics
.
setMergeRealWeight
(
boxGoodsStatistics
.
getCheckoutMergeWeight
());
getCheckoutMergeData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
boxGoodsStatistics
.
setMergePlanVolume
(
boxGoodsStatistics
.
getMergeVolume
());
boxGoodsStatistics
.
setMergePlanWeight
(
boxGoodsStatistics
.
getMergeWeight
());
//已出数 lanbm 2024-04-13 添加注释
boxGoodsStatistics
.
setMergeRealVolume
(
boxGoodsStatistics
.
getCheckoutMergeVolume
());
boxGoodsStatistics
.
setMergeRealWeight
(
boxGoodsStatistics
.
getCheckoutMergeWeight
());
}
private
void
calculateBoxMergeSum
(
Long
shipmentId
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
...
...
@@ -3051,14 +3113,18 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
if
(!
TransportTypeEnum
.
AIR
.
getType
().
equals
(
box
.
getTransportType
()))
{
return
;
}
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
);
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>().
eq
(
BoxPreloadGoodsDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
));
List
<
BoxMergePkgDO
>
boxMergePkgDOS
=
boxMergePkgService
.
selectList
(
BoxMergePkgDO:
:
getShipmentId
,
shipmentId
);
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
=
boxPreloadGoodsMapper
.
selectList
(
new
LambdaQueryWrapperX
<
BoxPreloadGoodsDO
>().
eq
(
BoxPreloadGoodsDO:
:
getShipmentId
,
shipmentId
).
eq
(
BoxPreloadGoodsDO:
:
getIsRemove
,
0
));
//合包箱计划数据
getMergeData
(
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
//已出合包数据
getCheckoutMergeData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
getCheckoutMergeData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
//已出订单数据
getCheckoutOrderData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
getCheckoutOrderData
(
shipmentId
,
boxPreloadGoodsDOS
,
boxMergePkgDOS
,
boxGoodsStatistics
);
// calculateBoxMergeSum(mergePkgDOList, boxGoodsStatistics);
}
...
...
@@ -3086,7 +3152,10 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
boxGoodsStatistics
.
setCheckoutOrderWeight
(
checkoutOrderWeight
);
}
private
void
getCheckoutMergeData
(
Long
shipmentId
,
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
,
List
<
BoxMergePkgDO
>
boxMergePkgDOS
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
private
void
getCheckoutMergeData
(
Long
shipmentId
,
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
,
List
<
BoxMergePkgDO
>
boxMergePkgDOS
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
int
checkoutMergeNum
=
0
;
BigDecimal
checkoutMergeVolume
=
BigDecimal
.
ZERO
;
BigDecimal
checkoutMergeWeight
=
BigDecimal
.
ZERO
;
...
...
@@ -3101,7 +3170,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
int
orderSumNum
=
orderDOS
.
stream
().
mapToInt
(
OrderDO:
:
getSumNum
).
sum
();
Long
loadCount
=
boxLoadInfoService
.
selectCount
(
new
LambdaQueryWrapper
<
BoxLoadInfoDO
>()
.
eq
(
BoxLoadInfoDO:
:
getShipmentId
,
shipmentId
)
.
in
(
BoxLoadInfoDO:
:
getOrderId
,
orderIds
)
.
in
(
BoxLoadInfoDO:
:
getOrderId
,
orderIds
)
);
if
(
loadCount
.
intValue
()
==
orderSumNum
)
{
checkoutMergeNum
=
checkoutMergeNum
+
1
;
...
...
@@ -3141,30 +3210,43 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
boxGoodsStatistics
.
setCheckoutMergeWeight
(
checkoutMergeWeight
);
}
private
void
getMergeData
(
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
,
List
<
BoxMergePkgDO
>
boxMergePkgDOS
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
private
void
getMergeData
(
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsDOS
,
List
<
BoxMergePkgDO
>
boxMergePkgDOS
,
BoxGoodsStatistics
boxGoodsStatistics
)
{
int
mergeNum
=
0
;
BigDecimal
mergeVolume
=
BigDecimal
.
ZERO
;
BigDecimal
mergeWeight
=
BigDecimal
.
ZERO
;
List
<
Long
>
preloadOrderIds
=
boxPreloadGoodsDOS
.
stream
().
map
(
BoxPreloadGoodsDO:
:
getOrderId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
preloadOrderIds
=
boxPreloadGoodsDOS
.
stream
().
map
(
BoxPreloadGoodsDO:
:
getOrderId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
boxMergePkgDOS
))
{
List
<
Long
>
pkgIds
=
boxMergePkgDOS
.
stream
().
map
(
BoxMergePkgDO:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
BoxPkgOrderDO
>
boxPkgOrderDOS
=
boxPkgOrderService
.
selectList
(
BoxPkgOrderDO:
:
getPkgId
,
pkgIds
);
List
<
Long
>
pkgIds
=
boxMergePkgDOS
.
stream
().
map
(
BoxMergePkgDO:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
BoxPkgOrderDO
>
boxPkgOrderDOS
=
boxPkgOrderService
.
selectList
(
BoxPkgOrderDO:
:
getPkgId
,
pkgIds
);
if
(
CollectionUtil
.
isNotEmpty
(
boxPkgOrderDOS
))
{
List
<
Long
>
pkgOrderIds
=
boxPkgOrderDOS
.
stream
().
map
(
BoxPkgOrderDO:
:
getOrderId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
pkgOrderIds
=
boxPkgOrderDOS
.
stream
().
map
(
BoxPkgOrderDO:
:
getOrderId
).
collect
(
Collectors
.
toList
());
preloadOrderIds
.
removeAll
(
pkgOrderIds
);
}
mergeNum
=
mergeNum
+
boxMergePkgDOS
.
size
();
mergeVolume
=
mergeVolume
.
add
(
boxMergePkgDOS
.
stream
().
filter
(
item
->
Objects
.
nonNull
(
item
.
getSumVolume
())).
map
(
BoxMergePkgDO:
:
getSumVolume
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
mergeWeight
=
mergeWeight
.
add
(
boxMergePkgDOS
.
stream
().
filter
(
item
->
Objects
.
nonNull
(
item
.
getSumWeight
())).
map
(
BoxMergePkgDO:
:
getSumWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
mergeVolume
=
mergeVolume
.
add
(
boxMergePkgDOS
.
stream
().
filter
(
item
->
Objects
.
nonNull
(
item
.
getSumVolume
())).
map
(
BoxMergePkgDO:
:
getSumVolume
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
mergeWeight
=
mergeWeight
.
add
(
boxMergePkgDOS
.
stream
().
filter
(
item
->
Objects
.
nonNull
(
item
.
getSumWeight
())).
map
(
BoxMergePkgDO:
:
getSumWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
}
//合包数据和预装箱数据累加一起 lanbm 2024-05-13 添加注释
if
(
CollectionUtil
.
isNotEmpty
(
preloadOrderIds
))
{
List
<
OrderDO
>
orderDOS
=
orderService
.
selectList
(
OrderDO:
:
getOrderId
,
preloadOrderIds
);
mergeNum
=
mergeNum
+
orderDOS
.
stream
().
mapToInt
(
OrderDO:
:
getSumNum
).
sum
();
mergeVolume
=
mergeVolume
.
add
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getSumVolume
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
mergeWeight
=
mergeWeight
.
add
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getSumWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
List
<
OrderDO
>
orderDOS
=
orderService
.
selectList
(
OrderDO:
:
getOrderId
,
preloadOrderIds
);
mergeNum
=
mergeNum
+
orderDOS
.
stream
().
mapToInt
(
OrderDO:
:
getSumNum
).
sum
();
mergeVolume
=
mergeVolume
.
add
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getSumVolume
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
mergeWeight
=
mergeWeight
.
add
(
orderDOS
.
stream
().
map
(
OrderDO:
:
getSumWeight
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
}
boxGoodsStatistics
.
setMergeNum
(
mergeNum
);
boxGoodsStatistics
.
setMergeVolume
(
mergeVolume
);
boxGoodsStatistics
.
setMergeWeight
(
mergeWeight
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment