Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
mini-wms
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
周海峰
mini-wms
Commits
13cec3ea
Commit
13cec3ea
authored
Dec 23, 2025
by
yubin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导入修改
parent
1a8aa820
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
79 行增加
和
51 行删除
+79
-51
ruoyi-admin-vue/src/views/inventory/orders/index.vue
+15
-43
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/vo/OutboundTemplateVO.java
+2
-4
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/OutboundOrdersServiceImpl.java
+62
-4
没有找到文件。
ruoyi-admin-vue/src/views/inventory/orders/index.vue
View file @
13cec3ea
...
...
@@ -92,15 +92,15 @@
style=
"width: 100%"
/>
</el-form-item>
<el-form-item
label=
"
出库
类型"
prop=
"orderTypeId"
>
<el-form-item
label=
"
订单
类型"
prop=
"orderTypeId"
>
<el-select
v-model=
"queryParams.orderTypeId"
placeholder=
"请输入
出库
类型"
placeholder=
"请输入
订单
类型"
clearable
style=
"width: 150px"
>
<el-option
v-for=
"dict in dict.type.o
utbound_o
rder_type"
v-for=
"dict in dict.type.order_type"
:key=
"dict.value"
:label=
"dict.label"
:value=
"Number(dict.value)"
...
...
@@ -172,16 +172,9 @@
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
fixed
/>
<el-table-column
label=
"出库单号"
align=
"center"
prop=
"orderId"
min-width=
"150"
fixed
/>
<el-table-column
label=
"系统编号"
align=
"center"
prop=
"systemNo"
min-width=
"150"
/>
<el-table-column
label=
"
出库
类型"
align=
"center"
prop=
"orderTypeId"
min-width=
"120"
>
<el-table-column
label=
"
订单
类型"
align=
"center"
prop=
"orderTypeId"
min-width=
"120"
>
<
template
slot-scope=
"scope"
>
<dict-tag
v-if=
"dict.type.outbound_order_type"
:options=
"dict.type.outbound_order_type"
:value=
"scope.row.orderTypeId"
/>
<span
v-else
>
-
</span>
</
template
>
</el-table-column>
<!-- 新增:订单类型列 -->
<el-table-column
label=
"订单类型"
align=
"center"
prop=
"orderType"
min-width=
"120"
>
<
template
slot-scope=
"scope"
>
<dict-tag
v-if=
"dict.type.order_type"
:options=
"dict.type.order_type"
:value=
"scope.row.orderType"
/>
<dict-tag
v-if=
"dict.type.order_type"
:options=
"dict.type.order_type"
:value=
"scope.row.orderTypeId"
/>
<span
v-else
>
-
</span>
</
template
>
</el-table-column>
...
...
@@ -277,10 +270,10 @@
<
/el-row
>
<
el
-
row
:
gutter
=
"20"
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"
出库
类型"
prop
=
"orderTypeId"
>
<
el
-
select
v
-
model
=
"form.orderTypeId"
placeholder
=
"请选择
出库
类型"
:
disabled
=
"isViewDetail || formDisabled.orderTypeId"
style
=
"width: 100%"
>
<
el
-
form
-
item
label
=
"
订单
类型"
prop
=
"orderTypeId"
>
<
el
-
select
v
-
model
=
"form.orderTypeId"
placeholder
=
"请选择
订单
类型"
:
disabled
=
"isViewDetail || formDisabled.orderTypeId"
style
=
"width: 100%"
>
<
el
-
option
v
-
for
=
"item in dict.type.o
utbound_o
rder_type"
v
-
for
=
"item in dict.type.order_type"
:
key
=
"item.value"
:
label
=
"item.label"
:
value
=
"item.value"
...
...
@@ -290,7 +283,6 @@
<
/el-select
>
<
/el-form-item
>
<
/el-col
>
<!--
新增:订单类型表单项
-->
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"仓库"
prop
=
"warehouseId"
>
<
el
-
input
...
...
@@ -357,20 +349,7 @@
<
/el-input
>
<
/el-form-item
>
<
/el-col
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"订单类型"
prop
=
"orderType"
>
<
el
-
select
v
-
model
=
"form.orderType"
placeholder
=
"请选择订单类型"
:
disabled
=
"isViewDetail || formDisabled.orderType"
style
=
"width: 100%"
>
<
el
-
option
v
-
for
=
"item in dict.type.order_type"
:
key
=
"item.value"
:
label
=
"item.label"
:
value
=
"item.value"
>
<
span
style
=
"margin-left: 8px;"
>
{{
item
.
label
}}
<
/span
>
<
/el-option
>
<
/el-select
>
<
/el-form-item
>
<
/el-col
>
<!--
订单类型已合并到出库类型控件(使用
orderTypeId
字段)
-->
<
/el-row
>
<
el
-
row
:
gutter
=
"20"
>
<
el
-
col
:
span
=
"12"
>
...
...
@@ -598,7 +577,6 @@ export default {
orderId
:
false
,
systemNo
:
false
,
orderTypeId
:
false
,
orderType
:
false
,
// 新增:订单类型禁用控制
batchCode
:
false
,
warehouseId
:
false
,
ownerId
:
false
,
...
...
@@ -611,7 +589,6 @@ export default {
orderId
:
null
,
systemNo
:
null
,
orderTypeId
:
null
,
orderType
:
null
,
// 新增:订单类型查询参数
batchCode
:
null
,
warehouseId
:
null
,
ownerId
:
null
,
...
...
@@ -635,14 +612,14 @@ export default {
ownerName
:
''
,
ownerId
:
''
,
// 【新增】补充货主ID字段
warehouseId
:
''
,
// 【新增】补充仓库ID字段
orderType
:
null
,
// 新增:订单类型表单字段
orderType
Id
:
null
,
// 使用 orderTypeId 表示订单类型
}
,
// 表单校验规则
rules
:
{
orderId
:
[{
required
:
true
,
message
:
'请输入出库单号'
,
trigger
:
'blur'
}
],
warehouseId
:
[{
required
:
true
,
message
:
'请选择仓库'
,
trigger
:
'blur'
}
],
inboundDate
:
[{
required
:
true
,
message
:
'请选择出库日期'
,
trigger
:
'change'
}
],
orderTypeId
:
[{
required
:
true
,
message
:
'请选择
出库
类型'
,
trigger
:
'change'
}
],
orderTypeId
:
[{
required
:
true
,
message
:
'请选择
订单
类型'
,
trigger
:
'change'
}
],
batchCode
:
[{
required
:
true
,
message
:
'请选输入批次号'
,
trigger
:
'change'
}
],
}
,
// 货主/仓库选择相关
...
...
@@ -1173,7 +1150,6 @@ export default {
outboundOrderId
:
null
,
// 主表ID,由后端生成
systemNo
:
null
,
orderTypeId
:
null
,
orderType
:
null
,
// 新增:订单类型重置
batchCode
:
null
,
warehouseId
:
null
,
warehouseName
:
''
,
...
...
@@ -1199,7 +1175,6 @@ export default {
orderId
:
false
,
systemNo
:
false
,
orderTypeId
:
false
,
orderType
:
false
,
// 新增:订单类型禁用重置
batchCode
:
false
,
warehouseId
:
false
,
ownerId
:
false
,
...
...
@@ -1235,7 +1210,6 @@ export default {
orderId
:
null
,
systemNo
:
null
,
orderTypeId
:
null
,
orderType
:
null
,
// 新增:订单类型重置
batchCode
:
null
,
warehouseId
:
null
,
ownerId
:
null
,
...
...
@@ -1272,7 +1246,6 @@ export default {
orderId
:
false
,
systemNo
:
false
,
orderTypeId
:
false
,
orderType
:
false
,
// 新增:订单类型启用
batchCode
:
false
,
warehouseId
:
false
,
ownerId
:
false
,
...
...
@@ -1305,7 +1278,7 @@ export default {
totalAmount
:
0.00
,
ownerId
:
response
.
data
.
ownerId
||
''
,
// 【新增】赋值货主ID
warehouseId
:
response
.
data
.
warehouseId
||
''
,
// 【新增】赋值仓库ID
orderType
:
response
.
data
.
orderType
||
null
,
// 新增:订单类型回显
orderType
Id
:
response
.
data
.
orderType
||
response
.
data
.
orderTypeId
||
null
,
// 订单类型回显到 orderTypeId
}
if
(
response
.
data
&&
response
.
data
.
outboundOrderItemsList
&&
Array
.
isArray
(
response
.
data
.
outboundOrderItemsList
))
{
// 按物料ID分组 + 库存ID去重
...
...
@@ -1369,7 +1342,6 @@ export default {
orderId
:
true
,
// 编辑时禁用出货单号修改
systemNo
:
true
,
orderTypeId
:
true
,
orderType
:
true
,
// 新增:订单类型禁用
batchCode
:
true
,
warehouseId
:
true
,
ownerId
:
true
,
...
...
@@ -1386,7 +1358,7 @@ export default {
totalAmount
:
0.00
,
ownerId
:
response
.
data
.
ownerId
||
''
,
// 【新增】赋值货主ID
warehouseId
:
response
.
data
.
warehouseId
||
''
,
// 【新增】赋值仓库ID
orderType
:
response
.
data
.
orderType
||
null
,
// 新增:订单类型回显
orderType
Id
:
response
.
data
.
orderType
||
response
.
data
.
orderTypeId
||
null
,
// 订单类型回显到 orderTypeId
}
console
.
log
(
"this.form"
,
this
.
form
)
if
(
response
.
data
&&
response
.
data
.
outboundOrderItemsList
&&
Array
.
isArray
(
response
.
data
.
outboundOrderItemsList
))
{
...
...
@@ -1491,7 +1463,7 @@ export default {
...
this
.
form
,
outboundOrderId
:
this
.
form
.
id
,
orderId
:
this
.
form
.
orderId
,
orderType
:
this
.
form
.
orderType
,
// 新增:提交订单类型
orderType
:
this
.
form
.
orderType
Id
,
// 新增:提交订单类型(使用 orderTypeId 字段)
outboundOrderItemsList
:
uniqueDetails
.
map
(
item
=>
{
const
{
index
,
materialUuids
,
warehouseName
,
locationName
,
...
rest
}
=
item
return
{
...
...
@@ -1564,7 +1536,7 @@ export default {
const
exportParams
=
{
...
restParams
,
outboundOrderId
:
this
.
queryParams
.
orderId
,
// 映射导出参数
orderType
:
this
.
queryParams
.
orderType
,
// 新增:导出订单类型参数
orderType
:
this
.
queryParams
.
orderType
Id
,
// 新增:导出订单类型参数
// 拆分日期范围
startDate
:
dateRange
?
dateRange
[
0
]
:
null
,
endDate
:
dateRange
?
dateRange
[
1
]
:
null
...
...
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/vo/OutboundTemplateVO.java
View file @
13cec3ea
...
...
@@ -27,7 +27,8 @@ public class OutboundTemplateVO extends BaseEntity {
@Excel
(
name
=
"日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
inboundDate
;
@Excel
(
name
=
"出库分类"
,
width
=
30
,
dictType
=
"outbound_order_type"
)
/** 订单类型 */
@Excel
(
name
=
"订单类型"
)
private
String
orderTypeId
;
/** SAP号 */
...
...
@@ -109,9 +110,6 @@ public class OutboundTemplateVO extends BaseEntity {
@Excel
(
name
=
"系统单号"
)
private
String
systemNo
;
/** 订单类型 */
@Excel
(
name
=
"订单类型"
)
private
String
orderType
;
/** 货主ID */
private
String
ownerId
;
...
...
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/OutboundOrdersServiceImpl.java
View file @
13cec3ea
...
...
@@ -194,13 +194,21 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
* 核心库存扣减逻辑(确保每个明细仅对应一个库存ID)
*/
private
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
deductInventory
(
List
<
OutboundOrderItems
>
outboundOrderItems
,
String
updateUser
,
Date
updateTime
)
{
return
deductInventory
(
outboundOrderItems
,
updateUser
,
updateTime
,
false
);
}
/**
* 核心库存扣减逻辑(确保每个明细仅对应一个库存ID)
* 增加参数 ignoreInventoryType:为 true 时在库存分组与扣减时忽略库存类型(用于导入场景)
*/
private
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
deductInventory
(
List
<
OutboundOrderItems
>
outboundOrderItems
,
String
updateUser
,
Date
updateTime
,
boolean
ignoreInventoryType
)
{
if
(
CollectionUtils
.
isEmpty
(
outboundOrderItems
))
{
return
Collections
.
emptyMap
();
}
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
deductRecordMap
=
new
HashMap
<>();
Map
<
String
,
List
<
Inventory
>>
inventoryGroupMap
=
this
.
loadInventoryGroupMap
();
Map
<
String
,
Long
>
deductQtyMap
=
this
.
buildDeductQtyMap
(
outboundOrderItems
);
Map
<
String
,
List
<
Inventory
>>
inventoryGroupMap
=
this
.
loadInventoryGroupMap
(
ignoreInventoryType
);
Map
<
String
,
Long
>
deductQtyMap
=
this
.
buildDeductQtyMap
(
outboundOrderItems
,
ignoreInventoryType
);
Map
<
String
,
Inventory
>
toUpdateInventoryMap
=
new
LinkedHashMap
<>();
for
(
Map
.
Entry
<
String
,
Long
>
entry
:
deductQtyMap
.
entrySet
())
{
...
...
@@ -213,7 +221,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
String
locationId
=
keyParts
.
length
>
1
?
keyParts
[
1
]
:
""
;
String
inventoryType
=
keyParts
.
length
>
2
?
keyParts
[
2
]
:
""
;
String
itemId
=
outboundOrderItems
.
stream
()
.
filter
(
item
->
key
.
equals
(
buildDeductKey
(
item
)))
.
filter
(
item
->
key
.
equals
(
buildDeductKey
(
item
,
ignoreInventoryType
)))
.
map
(
OutboundOrderItems:
:
getId
)
.
findFirst
()
.
orElse
(
null
);
...
...
@@ -499,6 +507,29 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
}
/**
* 预加载库存分组Map(按维度Key分组)
* 可选是否忽略库存类型(用于导入时不按orderType过滤库存)
*/
private
Map
<
String
,
List
<
Inventory
>>
loadInventoryGroupMap
(
boolean
ignoreInventoryType
)
{
Inventory
query
=
new
Inventory
();
query
.
setInventoryStatus
(
1L
);
// 只查可用状态库存
query
.
setIsUsed
(
1L
);
// 只查启用的库存
List
<
Inventory
>
allInventory
=
inventoryMapper
.
selectInventoryList
(
query
);
Map
<
String
,
List
<
Inventory
>>
inventoryGroupMap
=
new
LinkedHashMap
<>();
for
(
Inventory
inv
:
allInventory
)
{
String
invTypePart
=
ignoreInventoryType
?
""
:
Optional
.
ofNullable
(
inv
.
getInventoryType
()).
map
(
String:
:
valueOf
).
orElse
(
""
);
String
key
=
buildInventoryKey
(
inv
.
getMaterialId
(),
inv
.
getLocationId
(),
invTypePart
);
inventoryGroupMap
.
computeIfAbsent
(
key
,
k
->
new
ArrayList
<>()).
add
(
inv
);
}
return
inventoryGroupMap
;
}
/**
* 构建扣减数量Map
* Key规则:物料ID_库位ID_库存类型
*/
...
...
@@ -513,6 +544,20 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
}
/**
* 构建扣减数量Map(可选择是否忽略库存类型)
* Key规则:物料ID_库位ID_库存类型(inventoryType 可为空)
*/
private
Map
<
String
,
Long
>
buildDeductQtyMap
(
List
<
OutboundOrderItems
>
items
,
boolean
ignoreInventoryType
)
{
Map
<
String
,
Long
>
deductQtyMap
=
new
HashMap
<>();
for
(
OutboundOrderItems
item
:
items
)
{
String
key
=
buildDeductKey
(
item
,
ignoreInventoryType
);
Long
qty
=
Optional
.
ofNullable
(
item
.
getActualQuantity
()).
orElse
(
0L
);
deductQtyMap
.
put
(
key
,
deductQtyMap
.
getOrDefault
(
key
,
0L
)
+
qty
);
}
return
deductQtyMap
;
}
/**
* 构建明细的扣减Key
*/
private
String
buildDeductKey
(
OutboundOrderItems
item
)
{
...
...
@@ -524,6 +569,18 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
}
/**
* 构建明细的扣减Key(可选择是否忽略库存类型)
*/
private
String
buildDeductKey
(
OutboundOrderItems
item
,
boolean
ignoreInventoryType
)
{
String
invType
=
ignoreInventoryType
?
""
:
Optional
.
ofNullable
(
item
.
getInventoryType
()).
map
(
String:
:
valueOf
).
orElse
(
""
);
return
buildInventoryKey
(
item
.
getMaterialId
(),
item
.
getLocationId
(),
invType
);
}
/**
* 构建库存Key:物料ID_库位ID_库存类型
*/
private
String
buildInventoryKey
(
String
materialId
,
String
locationId
,
String
inventoryType
)
{
...
...
@@ -839,7 +896,8 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
for
(
Map
.
Entry
<
String
,
List
<
OutboundOrderItems
>>
entry
:
allItemListMap
.
entrySet
())
{
List
<
OutboundOrderItems
>
itemList
=
entry
.
getValue
();
// 执行库存扣减(精准提取被扣减的库存ID)
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
deductRecordMap
=
deductInventory
(
itemList
,
operId
,
now
);
// 导入场景:orderType 不参与库存查询,因此传入 ignoreInventoryType = true
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
deductRecordMap
=
deductInventory
(
itemList
,
operId
,
now
,
true
);
// 处理无库位明细拆分(仅拆分实际被扣减的库存ID)
handleNoLocationItemSplit
(
itemList
,
deductRecordMap
,
operId
,
now
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论