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
e6da6df6
Commit
e6da6df6
authored
Nov 14, 2024
by
yanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 出仓阶段入仓业务修改,处理预装单、理货、装柜事宜
parent
b5c72257
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
271 additions
and
31 deletions
+271
-31
20241112.sql
sql/v2.1/20241112.sql
+0
-3
BoxOrderShipmentWarehouseInEvent.java
...ollo/core/event/box/BoxOrderShipmentWarehouseInEvent.java
+24
-0
OrderWarehouseInDO.java
...r/dal/dataobject/orderWarehouseIn/OrderWarehouseInDO.java
+0
-6
OrderWarehouseInServiceImpl.java
...service/orderWarehouseIn/OrderWarehouseInServiceImpl.java
+40
-21
OrderWarehouseInController.http
...er/admin/orderWarehouseIn/OrderWarehouseInController.http
+1
-1
BoxOrderShipmentWarehouseInListener.java
...hipment/listener/BoxOrderShipmentWarehouseInListener.java
+206
-0
No files found.
sql/v2.1/20241112.sql
View file @
e6da6df6
-- 补充入仓记录出货添加新品名字段
alter
table
ecw_order_warehouse_in
add
COLUMN
`is_shipment_new_in`
bit
(
1
)
DEFAULT
0
COMMENT
'出货后新添加的商品'
;
-- 修改费用申请记录表批量审批流程id字段类型
alter
table
ecw_order_fee_application
...
...
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/event/box/BoxOrderShipmentWarehouseInEvent.java
0 → 100644
View file @
e6da6df6
package
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
event
.
box
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 出货中入仓修改 Event
*
* @author yanghao
*/
@Data
@AllArgsConstructor
public
class
BoxOrderShipmentWarehouseInEvent
{
/**
* 订单ID
*/
private
Long
orderId
;
}
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/dal/dataobject/orderWarehouseIn/OrderWarehouseInDO.java
View file @
e6da6df6
...
...
@@ -106,12 +106,6 @@ public class OrderWarehouseInDO extends BaseDO {
private
String
remark
;
/**
* 出货后新添加的商品
*/
private
Boolean
isShipmentNewIn
=
false
;
/**
* 入仓纪录明细VO
*/
...
...
yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/orderWarehouseIn/OrderWarehouseInServiceImpl.java
View file @
e6da6df6
This diff is collapsed.
Click to expand it.
yudao-module-order/yudao-module-order-rest/src/main/java/cn/iocoder/yudao/module/order/controller/admin/orderWarehouseIn/OrderWarehouseInController.http
View file @
e6da6df6
...
...
@@ -154,7 +154,7 @@ Content-Type: application/json
#### 入仓修改回调
GET {{baseUrl}}/order/order-warehouse-in/update-apply-callback?formId=
201
&result=2
GET {{baseUrl}}/order/order-warehouse-in/update-apply-callback?formId=
12128
&result=2
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
Content-Type: application/json
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/listener/BoxOrderShipmentWarehouseInListener.java
0 → 100644
View file @
e6da6df6
package
cn
.
iocoder
.
yudao
.
module
.
shipment
.
listener
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderShipmentWarehouseInEvent
;
import
cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO
;
import
cn.iocoder.yudao.module.order.dal.dataobject.orderLocation.OrderLocationDO
;
import
cn.iocoder.yudao.module.order.service.order.OrderItemService
;
import
cn.iocoder.yudao.module.order.service.order.OrderLocationService
;
import
cn.iocoder.yudao.module.order.service.order.OrderService
;
import
cn.iocoder.yudao.module.order.vo.orderLocation.OrderLocationCreateReqVO
;
import
cn.iocoder.yudao.module.shipment.convert.BoxPreloadGoodsConvert
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO
;
import
cn.iocoder.yudao.module.shipment.dal.dataobject.BoxPreloadGoodsDO
;
import
cn.iocoder.yudao.module.shipment.enums.LdStatusEnum
;
import
cn.iocoder.yudao.module.shipment.enums.TyStatueEnum
;
import
cn.iocoder.yudao.module.shipment.service.box.BoxService
;
import
cn.iocoder.yudao.module.shipment.service.boxLoadInfo.BoxLoadInfoService
;
import
cn.iocoder.yudao.module.shipment.service.boxPreloadGoods.BoxPreloadGoodsService
;
import
cn.iocoder.yudao.module.shipment.vo.boxLoadInfo.BoxLoadInfoCreateReqVO
;
import
cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods.BoxPreloadGoodsCreateReqVO
;
import
cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods.BoxPreloadGoodsQueryVO
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
order
.
enums
.
ErrorCodeConstants
.
ORDER_NOT_EXISTS
;
import
static
cn
.
iocoder
.
yudao
.
module
.
shipment
.
enums
.
ErrorCodeConstants
.
BOX_NOT_EXISTS
;
/**
* 出货中订单入仓修改业务
*
* @author yanghao
*/
@Component
(
"BoxOrderShipmentWarehouseInListener"
)
@AllArgsConstructor
@Slf4j
public
class
BoxOrderShipmentWarehouseInListener
{
@Resource
private
BoxLoadInfoService
boxLoadInfoService
;
@Resource
private
BoxPreloadGoodsService
boxPreloadGoodsService
;
@Resource
private
BoxService
boxService
;
@Resource
private
OrderService
orderService
;
@Resource
private
OrderItemService
orderItemService
;
@Resource
private
OrderLocationService
orderLocationService
;
/**
* 订单强制到仓业务执行
*
* @param event 订单信息
*/
@EventListener
(
BoxOrderShipmentWarehouseInEvent
.
class
)
public
void
boxOrderShipmentWarehouseIn
(
BoxOrderShipmentWarehouseInEvent
event
)
{
Long
orderId
=
event
.
getOrderId
();
OrderDO
orderDO
=
orderService
.
getById
(
orderId
);
if
(
Objects
.
isNull
(
orderDO
))
{
throw
exception
(
ORDER_NOT_EXISTS
);
}
String
containerNumber
=
orderDO
.
getContainerNumber
();
if
(
StringUtils
.
isEmpty
(
containerNumber
))
{
log
.
info
(
"订单号:{},没有箱号,不需要处理"
,
orderDO
.
getOrderNo
());
return
;
}
BoxDO
boxDO
=
boxService
.
getOne
(
new
LambdaQueryWrapper
<
BoxDO
>().
eq
(
BoxDO:
:
getSelfNo
,
containerNumber
));
if
(
boxDO
==
null
)
{
throw
exception
(
BOX_NOT_EXISTS
);
}
// 针对新添加的品名 生成预装单 并设置提单
boxPreloadInsert
(
orderId
,
boxDO
);
// 若理货完成,则自动修改储位。
batchOrderLocationUpdate
(
orderId
,
boxDO
);
// 若装柜完成,则自动装柜。
if
(
boxDO
.
getLdStatus
()
!=
null
&&
boxDO
.
getLdStatus
()
>=
LdStatusEnum
.
INSTALLED_TO_BE_SEALED
.
getLdStatus
())
{
// 海运
BoxLoadInfoCreateReqVO
boxLoadInfoCreateReqVO
=
new
BoxLoadInfoCreateReqVO
();
boxLoadInfoCreateReqVO
.
setOrderId
(
orderId
);
boxLoadInfoCreateReqVO
.
setOrderNo
(
orderDO
.
getOrderNo
());
boxLoadInfoCreateReqVO
.
setShipmentId
(
boxDO
.
getId
());
if
(
orderDO
.
getTransportId
()
==
1
||
orderDO
.
getTransportId
()
==
2
)
{
boxLoadInfoService
.
batchCreate
(
boxLoadInfoCreateReqVO
);
}
else
{
// 空运
boxLoadInfoService
.
batchAirCreate
(
boxLoadInfoCreateReqVO
);
}
}
}
private
void
boxPreloadInsert
(
Long
orderId
,
BoxDO
boxDO
)
{
// 1、查看此订单下的预装信息
BoxPreloadGoodsQueryVO
query
=
new
BoxPreloadGoodsQueryVO
();
query
.
setOrderId
(
orderId
);
query
.
setShipmentId
(
boxDO
.
getId
());
List
<
BoxPreloadGoodsDO
>
boxPreloadGoodsList
=
boxPreloadGoodsService
.
getBoxPreloadGoodsList
(
query
);
if
(
CollectionUtil
.
isNotEmpty
(
boxPreloadGoodsList
))
{
// 得到所有的orderItem
List
<
Long
>
orderItemIdListOld
=
boxPreloadGoodsList
.
stream
().
map
(
BoxPreloadGoodsDO:
:
getOrderItemId
).
collect
(
Collectors
.
toList
());
// 根据orderId查询OrderItemList,然后找出新增的OrderItemList
List
<
OrderItemDO
>
orderItemListNew
=
orderItemService
.
getOrderItemsByOrderId
(
Arrays
.
asList
(
orderId
));
// 找出新增的OrderItemId
List
<
Long
>
newOrderItemIdList
=
orderItemListNew
.
stream
().
map
(
OrderItemDO:
:
getOrderItemId
)
.
filter
(
t
->
!
orderItemIdListOld
.
contains
(
t
)).
collect
(
Collectors
.
toList
());
// 添加预装
BoxPreloadGoodsDO
boxPreloadGoodsDO
=
boxPreloadGoodsList
.
stream
().
findFirst
().
get
();
// 转换为BoxPreloadGoodsCreateReqVO
BoxPreloadGoodsCreateReqVO
createReqVO
=
new
BoxPreloadGoodsCreateReqVO
();
BeanUtils
.
copyProperties
(
boxPreloadGoodsDO
,
createReqVO
);
// 预装入库
List
<
BoxPreloadGoodsDO
>
preloadGoodsDOList
=
new
ArrayList
<>();
for
(
Long
orderItemId
:
newOrderItemIdList
)
{
BoxPreloadGoodsDO
boxPreloadGoods
=
BoxPreloadGoodsConvert
.
INSTANCE
.
convert
(
createReqVO
);
boxPreloadGoods
.
setOrderItemId
(
orderItemId
);
if
(
createReqVO
.
getIsCover
()
!=
null
)
{
boxPreloadGoods
.
setIsCover
(
createReqVO
.
getIsCover
());
}
preloadGoodsDOList
.
add
(
boxPreloadGoods
);
}
// 插入
boxPreloadGoodsService
.
insertBatch
(
preloadGoodsDOList
);
}
}
private
void
batchOrderLocationUpdate
(
Long
orderId
,
BoxDO
boxDO
)
{
if
(
boxDO
.
getTyStatus
()
!=
null
&&
boxDO
.
getTyStatus
().
equals
(
TyStatueEnum
.
HAS_TALLY
.
getTyStatus
()))
{
List
<
OrderLocationDO
>
orderLocationDOList
=
orderLocationService
.
getOrderLocationListByOrderId
(
orderId
);
if
(
CollectionUtil
.
isNotEmpty
(
orderLocationDOList
))
{
// 将orderLocationDOList按orderItemId分组后,获取到第一个OrderItemId的所有储位数据
Map
<
Long
,
List
<
OrderLocationDO
>>
groupedByOrderItemId
=
orderLocationDOList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
OrderLocationDO:
:
getOrderItemId
));
// 获取第一个OrderItemId的所有储位数据
if
(!
groupedByOrderItemId
.
isEmpty
())
{
Long
firstOrderItemId
=
groupedByOrderItemId
.
keySet
().
iterator
().
next
();
List
<
OrderLocationDO
>
firstOrderItemIdLocations
=
groupedByOrderItemId
.
get
(
firstOrderItemId
);
// 得到所有储位 并去重。
List
<
OrderLocationCreateReqVO
>
orderLocationCreateReqVOList
=
new
ArrayList
<>();
for
(
OrderLocationDO
location
:
firstOrderItemIdLocations
)
{
boolean
noneMatch
=
orderLocationCreateReqVOList
.
stream
().
noneMatch
(
t
->
t
.
getOrderId
().
equals
(
orderId
)
&&
Objects
.
equals
(
t
.
getWareId
(),
location
.
getWareId
())
&&
Objects
.
equals
(
t
.
getAreaId
(),
location
.
getAreaId
())
&&
Objects
.
equals
(
t
.
getLocationId
(),
location
.
getLocationId
()));
if
(
noneMatch
)
{
OrderLocationCreateReqVO
orderLocationCreateReqVO
=
new
OrderLocationCreateReqVO
();
orderLocationCreateReqVO
.
setOrderId
(
orderId
);
orderLocationCreateReqVO
.
setWareId
(
location
.
getWareId
());
orderLocationCreateReqVO
.
setAreaId
(
location
.
getAreaId
());
orderLocationCreateReqVO
.
setLocationId
(
location
.
getLocationId
());
orderLocationCreateReqVOList
.
add
(
orderLocationCreateReqVO
);
}
}
// 批量修改储位
orderLocationService
.
tallyUpdate
(
orderId
,
orderLocationCreateReqVOList
);
}
}
}
}
}
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