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
6d104f90
Commit
6d104f90
authored
Dec 03, 2025
by
yubin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
e76b86c2
56696fb5
显示空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
3639 行增加
和
368 行删除
+3639
-368
ruoyi-admin-vue/src/api/inventory/inbound.js
+44
-0
ruoyi-admin-vue/src/api/inventory/inbound_items.js
+44
-0
ruoyi-admin-vue/src/views/inventory/inbound/index.vue
+663
-0
ruoyi-admin-vue/src/views/inventory/inbound_items/index.vue
+956
-0
ruoyi-admin-vue/src/views/inventory/materials_category/index.vue
+190
-368
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/InboundOrderItemsController.java
+107
-0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/InboundOrdersController.java
+106
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/InboundOrderItems.java
+340
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/InboundOrders.java
+313
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/InboundOrderItemsMapper.java
+61
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/InboundOrdersMapper.java
+87
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IInboundOrderItemsService.java
+61
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IInboundOrdersService.java
+61
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/InboundOrderItemsServiceImpl.java
+96
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/InboundOrdersServiceImpl.java
+137
-0
ruoyi-inventory/src/main/resources/mapper/inventory/InboundOrderItemsMapper.xml
+166
-0
ruoyi-inventory/src/main/resources/mapper/inventory/InboundOrdersMapper.xml
+207
-0
没有找到文件。
ruoyi-admin-vue/src/api/inventory/inbound.js
0 → 100644
View file @
6d104f90
import
request
from
'@/utils/request'
// 查询入库列表
export
function
listInbound
(
query
)
{
return
request
({
url
:
'/inventory/inbound/list'
,
method
:
'get'
,
params
:
query
})
}
// 查询入库详细
export
function
getInbound
(
id
)
{
return
request
({
url
:
'/inventory/inbound/'
+
id
,
method
:
'get'
})
}
// 新增入库
export
function
addInbound
(
data
)
{
return
request
({
url
:
'/inventory/inbound'
,
method
:
'post'
,
data
:
data
})
}
// 修改入库
export
function
updateInbound
(
data
)
{
return
request
({
url
:
'/inventory/inbound'
,
method
:
'put'
,
data
:
data
})
}
// 删除入库
export
function
delInbound
(
id
)
{
return
request
({
url
:
'/inventory/inbound/'
+
id
,
method
:
'delete'
})
}
ruoyi-admin-vue/src/api/inventory/inbound_items.js
0 → 100644
View file @
6d104f90
import
request
from
'@/utils/request'
// 查询入库单明细列表
export
function
listInbound_items
(
query
)
{
return
request
({
url
:
'/inventory/inbound_items/list'
,
method
:
'get'
,
params
:
query
})
}
// 查询入库单明细详细
export
function
getInbound_items
(
id
)
{
return
request
({
url
:
'/inventory/inbound_items/'
+
id
,
method
:
'get'
})
}
// 新增入库单明细
export
function
addInbound_items
(
data
)
{
return
request
({
url
:
'/inventory/inbound_items'
,
method
:
'post'
,
data
:
data
})
}
// 修改入库单明细
export
function
updateInbound_items
(
data
)
{
return
request
({
url
:
'/inventory/inbound_items'
,
method
:
'put'
,
data
:
data
})
}
// 删除入库单明细
export
function
delInbound_items
(
id
)
{
return
request
({
url
:
'/inventory/inbound_items/'
+
id
,
method
:
'delete'
})
}
ruoyi-admin-vue/src/views/inventory/inbound/index.vue
0 → 100644
View file @
6d104f90
<
template
>
<div
class=
"app-container"
>
<!-- 修改查询表单,将 form 改为 queryParams -->
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
v-show=
"showSearch"
label-width=
"100px"
>
<el-form-item
label=
"入库单号"
prop=
"orderId"
>
<el-input
v-model=
"queryParams.orderId"
placeholder=
"请输入入库单号"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"系统编号"
prop=
"systemNo"
>
<el-input
v-model=
"queryParams.systemNo"
placeholder=
"请输入系统编号"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"批次ID"
prop=
"batchCode"
>
<el-input
v-model=
"queryParams.batchCode"
placeholder=
"请输入批次ID"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"入库类型"
prop=
"orderTypeId"
>
<el-select
v-model=
"queryParams.orderTypeId"
placeholder=
"请选择入库类型"
clearable
>
<el-option
v-for=
"item in inBoundTypeOptions"
:key=
"item.orderTypeId"
:label=
"item.orderTypeName"
:value=
"item.orderTypeId"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"入库单状态"
prop=
"orderStatus"
>
<el-select
v-model=
"queryParams.orderStatus"
placeholder=
"请选择入库单状态"
clearable
>
<el-option
v-for=
"item in inBoundStatusOptions"
:key=
"item.orderStatus"
:label=
"item.orderStatusName"
:value=
"item.orderStatus"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"订单类型"
prop=
"orderType"
>
<el-select
v-model=
"queryParams.orderType"
placeholder=
"请选择订单类型"
clearable
>
<el-option
v-for=
"item in orderTypeOptions"
:key=
"item.orderType"
:label=
"item.orderTypeName"
:value=
"item.orderType"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<!-- 工具栏保持不变 -->
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
v-hasPermi=
"['inventory:inbound:add']"
>
新增
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"success"
plain
icon=
"el-icon-edit"
size=
"mini"
:disabled=
"single"
@
click=
"handleUpdate"
v-hasPermi=
"['inventory:inbound:edit']"
>
修改
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"danger"
plain
icon=
"el-icon-delete"
size=
"mini"
:disabled=
"multiple"
@
click=
"handleDelete"
v-hasPermi=
"['inventory:inbound:remove']"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-download"
size=
"mini"
@
click=
"handleExport"
v-hasPermi=
"['inventory:inbound:export']"
>
导出
</el-button>
</el-col>
<right-toolbar
:showSearch
.
sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<!-- 表格保持不变 -->
<el-table
v-loading=
"loading"
:data=
"inboundList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"入库单号"
align=
"center"
prop=
"orderId"
/>
<el-table-column
label=
"系统编号"
align=
"center"
prop=
"systemNo"
/>
<el-table-column
label=
"入库类型"
align=
"center"
prop=
"orderTypeId"
/>
<el-table-column
label=
"批次ID"
align=
"center"
prop=
"batchCode"
/>
<el-table-column
label=
"入库单状态"
align=
"center"
prop=
"orderStatus"
/>
<el-table-column
label=
"排序"
align=
"center"
prop=
"sortNo"
/>
<el-table-column
label=
"创建时间"
align=
"center"
prop=
"createTime"
width=
"180"
>
<template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
createTime
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"更新时间"
align
=
"center"
prop
=
"updateTime"
width
=
"180"
>
<
template
slot
-
scope
=
"scope"
>
<
span
>
{{
parseTime
(
scope
.
row
.
updateTime
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"操作"
align
=
"center"
class
-
name
=
"small-padding fixed-width"
width
=
"300"
>
<
template
slot
-
scope
=
"scope"
>
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-success"
@
click
=
"handleConfirm(scope.row)"
v
-
hasPermi
=
"['inventory:inbound:confirm']"
>
确认入库
<
/el-button
>
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-more"
@
click
=
"handleDetail(scope.row)"
v
-
hasPermi
=
"['inventory:inbound:view']"
>
详情
<
/el-button
>
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-edit"
@
click
=
"handleUpdate(scope.row)"
v
-
hasPermi
=
"['inventory:inbound:edit']"
>
修改
<
/el-button
>
<
el
-
button
size
=
"mini"
type
=
"text"
icon
=
"el-icon-delete"
@
click
=
"handleDelete(scope.row)"
v
-
hasPermi
=
"['inventory:inbound:remove']"
>
删除
<
/el-button
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"queryParams.pageNum"
:
limit
.
sync
=
"queryParams.pageSize"
@
pagination
=
"getList"
/>
<!--
添加或修改入库对话框
-->
<
el
-
dialog
:
title
=
"title"
:
visible
.
sync
=
"open"
width
=
"1200px"
append
-
to
-
body
>
<
el
-
form
ref
=
"form"
:
model
=
"form"
:
rules
=
"rules"
label
-
width
=
"80px"
>
<!--
表单内容保持不变
-->
<
el
-
divider
content
-
position
=
"center"
>
入库单基础信息
<
/el-divider
>
<
el
-
row
:
gutter
=
"24"
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"入库单号"
prop
=
"orderId"
>
<
el
-
input
v
-
model
=
"form.orderId"
placeholder
=
"请输入入库单号"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"入库类型"
prop
=
"orderTypeId"
>
<
el
-
input
v
-
model
=
"form.orderTypeId"
placeholder
=
"请输入入库类型"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"货主ID"
prop
=
"ownerId"
>
<
el
-
input
v
-
model
=
"form.ownerId"
placeholder
=
"请输入货主ID"
/>
<
/el-form-item
>
<
/el-col
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"系统编号"
prop
=
"systemNo"
>
<
el
-
input
v
-
model
=
"form.systemNo"
placeholder
=
"请输入系统编号"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"批次ID"
prop
=
"batchCode"
>
<
el
-
input
v
-
model
=
"form.batchCode"
placeholder
=
"请输入批次ID"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"入库日期"
prop
=
"inboundDate"
lebel
-
width
=
"100"
>
<
el
-
date
-
picker
clearable
v
-
model
=
"form.inboundDate"
type
=
"date"
value
-
format
=
"yyyy-MM-dd"
placeholder
=
"请选择入库日期"
>
<
/el-date-picker
>
<
/el-form-item
>
<
/el-col
>
<
/el-row
>
<
el
-
divider
content
-
position
=
"center"
>
入库其他信息
<
/el-divider
>
<
el
-
row
:
gutter
=
"24"
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"计划量"
prop
=
"totalPlannedQuantity"
>
<
el
-
input
v
-
model
=
"form.totalPlannedQuantity"
placeholder
=
"请输入计划量"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"总件数"
prop
=
"totalPackages"
>
<
el
-
input
v
-
model
=
"form.totalPackages"
placeholder
=
"请输入总件数"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"仓库ID"
prop
=
"warehouseId"
>
<
el
-
input
v
-
model
=
"form.warehouseId"
placeholder
=
"请输入仓库ID"
/>
<
/el-form-item
>
<
/el-col
>
<
el
-
col
:
span
=
"12"
>
<
el
-
form
-
item
label
=
"实际量"
prop
=
"totalActualQuantity"
>
<
el
-
input
v
-
model
=
"form.totalActualQuantity"
placeholder
=
"请输入实际量"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"负责人"
prop
=
"opUserName"
>
<
el
-
input
v
-
model
=
"form.opUserName"
placeholder
=
"请输入负责人"
/>
<
/el-form-item
>
<
el
-
form
-
item
label
=
"排序"
prop
=
"sortNo"
>
<
el
-
input
v
-
model
=
"form.sortNo"
placeholder
=
"请输入排序"
/>
<
/el-form-item
>
<
/el-col
>
<
el
-
form
-
item
label
=
"备注"
prop
=
"remark"
>
<
el
-
input
v
-
model
=
"form.remark"
type
=
"textarea"
placeholder
=
"请输入内容"
/>
<
/el-form-item
>
<
/el-row
>
<
el
-
divider
content
-
position
=
"center"
>
入库单明细信息
<
/el-divider
>
<!--
<
el
-
row
:
gutter
=
"10"
class
=
"mb8"
>
<
el
-
col
:
span
=
"1.5"
>
<
el
-
button
type
=
"primary"
icon
=
"el-icon-plus"
size
=
"mini"
@
click
=
"handleAddInboundItem"
>
添加明细
<
/el-button
>
<
/el-col
>
<
el
-
col
:
span
=
"1.5"
>
<
el
-
button
type
=
"danger"
icon
=
"el-icon-delete"
size
=
"mini"
@
click
=
"handleDeleteSelectedItems"
>
删除选中
<
/el-button
>
<
/el-col
>
<
/el-row> --
>
<!--
入库明细组件
-->
<
InboundItems
ref
=
"inboundItemsRef"
v
-
model
=
"form.inboundOrderItemsList"
:
embedded
=
"true"
:
order
-
id
=
"form.orderId"
:
show
-
search
-
form
=
"false"
:
show
-
pagination
=
"false"
:
show
-
toolbar
=
"true"
:
show
-
action
-
column
=
"true"
:
show
-
selection
=
"true"
:
show
-
add
-
button
=
"true"
:
show
-
edit
-
button
=
"true"
:
show
-
delete
-
button
=
"true"
@
selection
-
change
=
"handleItemsSelectionChange"
@
data
-
change
=
"handleItemsDataChange"
@
totals
-
change
=
"handleTotalsChange"
@
item
-
added
=
"handleItemAdded"
@
row
-
saved
=
"handleRowSaved"
@
row
-
deleted
=
"handleRowDeleted"
@
batch
-
delete
=
"handleBatchDelete"
@
cell
-
change
=
"handleCellChange"
/>
<
/el-form
>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
type
=
"primary"
@
click
=
"submitForm"
>
确
定
<
/el-button
>
<
el
-
button
@
click
=
"cancel"
>
取
消
<
/el-button
>
<
/div
>
<
/el-dialog
>
<
/div
>
<
/template
>
<
script
>
import
{
listInbound
,
getInbound
,
delInbound
,
addInbound
,
updateInbound
}
from
"@/api/inventory/inbound"
import
InboundItems
from
"@/views/inventory/inbound_items/index.vue"
export
default
{
name
:
"Inbound"
,
components
:
{
InboundItems
}
,
data
()
{
return
{
inBoundTypeOptions
:[
{
orderTypeId
:
'1'
,
orderTypeName
:
'入库类型1'
}
,
{
orderTypeId
:
'2'
,
orderTypeName
:
'入库类型2'
}
],
inBoundStatusOptions
:
[
{
orderStatus
:
'1'
,
orderStatusName
:
'草稿'
}
,
{
orderStatus
:
'2'
,
orderStatusName
:
'已完成'
}
,
{
orderStatus
:
'3'
,
orderStatusName
:
'已取消'
}
],
orderTypeOptions
:[
{
orderType
:
'1'
,
orderTypeName
:
'订单类型1'
}
,
{
orderType
:
'2'
,
orderTypeName
:
'订单类型2'
}
],
// 选中的明细项
selectedItems
:
[],
// 遮罩层
loading
:
true
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 入库表格数据
inboundList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
orderId
:
null
,
orderTypeId
:
null
,
systemNo
:
null
,
batchCode
:
null
,
warehouseId
:
null
,
ownerId
:
null
,
orderStatus
:
null
,
orderType
:
null
}
,
// 表单参数
form
:
{
id
:
null
,
orderId
:
null
,
orderTypeId
:
null
,
batchCode
:
null
,
warehouseId
:
null
,
ownerId
:
null
,
orderStatus
:
null
,
referenceNo
:
null
,
plannedArrivalDate
:
undefined
,
actualArrivalDate
:
undefined
,
totalPlannedQuantity
:
null
,
totalActualQuantity
:
null
,
totalPackages
:
null
,
remark
:
null
,
opUserName
:
null
,
isUsed
:
null
,
sortNo
:
null
,
createTime
:
null
,
createUserCode
:
null
,
updateTime
:
null
,
updateUserCode
:
null
,
// 明细列表
inboundOrderItemsList
:
[]
}
,
// 表单校验
rules
:
{
orderId
:
[
{
required
:
true
,
message
:
"入库单号不能为空"
,
trigger
:
"blur"
}
],
orderTypeId
:
[
{
required
:
true
,
message
:
"入库类型不能为空"
,
trigger
:
"blur"
}
],
systemNo
:
[
{
required
:
true
,
message
:
"系统编号不能为空"
,
trigger
:
"blur"
}
],
batchCode
:
[
{
required
:
true
,
message
:
"批次ID不能为空"
,
trigger
:
"blur"
}
]
}
}
}
,
created
()
{
this
.
getList
()
}
,
methods
:
{
/** 查询入库列表 */
getList
()
{
this
.
loading
=
true
listInbound
(
this
.
queryParams
).
then
(
response
=>
{
this
.
inboundList
=
response
.
rows
this
.
total
=
response
.
total
this
.
loading
=
false
}
)
}
,
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
this
.
getList
()
}
,
/** 重置按钮操作 */
resetQuery
()
{
this
.
resetForm
(
"queryForm"
)
this
.
handleQuery
()
}
,
/** 多选框选中数据 */
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
}
,
/** 新增按钮操作 */
handleAdd
()
{
this
.
reset
()
this
.
open
=
true
this
.
title
=
"添加入库"
}
,
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
()
const
id
=
row
.
id
||
this
.
ids
getInbound
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
console
.
log
(
this
.
form
)
// 加载明细数据
if
(
response
.
data
.
inboundOrderItemsList
)
{
this
.
form
.
inboundOrderItemsList
=
response
.
data
.
inboundOrderItemsList
}
this
.
open
=
true
this
.
title
=
"修改入库"
}
)
}
,
/** 确认入库操作 */
handleConfirm
(
row
)
{
this
.
$confirm
(
'确认要入库吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}
).
then
(()
=>
{
// 调用确认入库API
// confirmInbound(row.id).then(() =>
{
// this.$modal.msgSuccess("确认成功")
// this.getList()
//
}
)
}
)
}
,
/** 查看详情 */
handleDetail
(
row
)
{
// 可以打开一个新的详情页面或者弹窗
console
.
log
(
'查看详情:'
,
row
)
}
,
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
ids
=
row
.
id
||
this
.
ids
this
.
$modal
.
confirm
(
'是否确认删除入库编号为"'
+
ids
+
'"的数据项?'
).
then
(
function
()
{
return
delInbound
(
ids
)
}
).
then
(()
=>
{
this
.
getList
()
this
.
$modal
.
msgSuccess
(
"删除成功"
)
}
).
catch
(()
=>
{
}
)
}
,
/** 提交按钮 */
submitForm
()
{
this
.
$refs
[
"form"
].
validate
(
valid
=>
{
if
(
!
valid
)
return
// 验证明细表
const
errors
=
this
.
$refs
.
inboundItemsRef
?
this
.
$refs
.
inboundItemsRef
.
validate
()
:
[]
if
(
errors
.
length
>
0
)
{
this
.
$message
.
error
(
errors
.
join
(
';'
))
return
}
// 确保明细项数量大于0
if
(
!
this
.
form
.
inboundOrderItemsList
||
this
.
form
.
inboundOrderItemsList
.
length
===
0
)
{
this
.
$message
.
warning
(
'请至少添加一条入库明细'
)
return
}
// 自动计算总数
this
.
calculateTotals
()
// 提交数据
const
submitData
=
{
...
this
.
form
,
inboundOrderItemsList
:
this
.
form
.
inboundOrderItemsList
.
map
(
item
=>
({
...
item
,
orderId
:
this
.
form
.
orderId
// 确保明细项有主表ID
}
))
}
if
(
this
.
form
.
id
!=
null
)
{
updateInbound
(
submitData
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"修改成功"
)
this
.
open
=
false
this
.
getList
()
}
)
}
else
{
addInbound
(
submitData
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"新增成功"
)
this
.
open
=
false
this
.
getList
()
}
)
}
}
)
}
,
/** 取消按钮 */
cancel
()
{
this
.
open
=
false
this
.
reset
()
}
,
/** 表单重置 */
reset
()
{
this
.
form
=
{
id
:
null
,
orderId
:
null
,
orderTypeId
:
null
,
batchCode
:
null
,
warehouseId
:
null
,
ownerId
:
null
,
orderStatus
:
null
,
referenceNo
:
null
,
plannedArrivalDate
:
null
,
actualArrivalDate
:
null
,
totalPlannedQuantity
:
0
,
totalActualQuantity
:
0
,
totalPackages
:
0
,
remark
:
null
,
opUserName
:
null
,
isUsed
:
null
,
sortNo
:
null
,
createTime
:
null
,
createUserCode
:
null
,
updateTime
:
null
,
updateUserCode
:
null
,
inboundOrderItemsList
:
[]
}
if
(
this
.
$refs
.
inboundItemsRef
)
{
this
.
$refs
.
inboundItemsRef
.
resetEmbeddedData
()
}
this
.
resetForm
(
"form"
)
}
,
/** 处理明细项选择变化 */
handleItemsSelectionChange
(
selection
)
{
this
.
selectedItems
=
selection
}
,
/** 处理明细数据变化 */
handleItemsDataChange
(
items
)
{
this
.
form
.
inboundOrderItemsList
=
items
this
.
calculateTotals
()
}
,
/** 处理总数变化 */
handleTotalsChange
(
totals
)
{
this
.
form
.
totalPlannedQuantity
=
totals
.
plannedQuantity
this
.
form
.
totalActualQuantity
=
totals
.
actualQuantity
this
.
form
.
totalPackages
=
totals
.
packages
}
,
/** 添加明细项回调 */
handleItemAdded
(
item
)
{
// 为新项设置orderId
item
.
orderId
=
this
.
form
.
orderId
}
,
/** 行保存回调 */
handleRowSaved
(
row
)
{
// 可以在这里添加保存后的逻辑
}
,
/** 行删除回调 */
handleRowDeleted
(
row
)
{
this
.
$message
.
success
(
'删除成功'
)
}
,
/** 批量删除回调 */
handleBatchDelete
(
ids
)
{
this
.
$message
.
success
(
`成功删除 ${ids.length
}
项`
)
}
,
/** 单元格变化回调 */
handleCellChange
({
row
,
prop
,
value
}
)
{
// 可以在这里处理特定字段的变化
if
(
prop
===
'plannedQuantity'
||
prop
===
'actualQuantity'
)
{
this
.
calculateTotals
()
}
}
,
/** 计算总数 */
calculateTotals
()
{
if
(
!
this
.
form
.
inboundOrderItemsList
||
this
.
form
.
inboundOrderItemsList
.
length
===
0
)
{
this
.
form
.
totalPlannedQuantity
=
0
this
.
form
.
totalActualQuantity
=
0
this
.
form
.
totalPackages
=
0
return
}
const
totals
=
this
.
form
.
inboundOrderItemsList
.
reduce
(
(
acc
,
item
)
=>
{
acc
.
plannedQuantity
+=
parseFloat
(
item
.
plannedQuantity
)
||
0
acc
.
actualQuantity
+=
parseFloat
(
item
.
actualQuantity
)
||
0
acc
.
packages
+=
parseFloat
(
item
.
plannedPackages
)
||
0
return
acc
}
,
{
plannedQuantity
:
0
,
actualQuantity
:
0
,
packages
:
0
}
)
this
.
form
.
totalPlannedQuantity
=
totals
.
plannedQuantity
this
.
form
.
totalActualQuantity
=
totals
.
actualQuantity
this
.
form
.
totalPackages
=
totals
.
packages
}
,
/** 导出按钮操作 */
handleExport
()
{
this
.
download
(
'inventory/inbound/export'
,
{
...
this
.
queryParams
}
,
`inbound_${new Date().getTime()
}
.xlsx`
)
}
}
}
<
/script
>
<
style
scoped
>
/* 强制允许点击输入框 */
.
el
-
form
-
item
.
el
-
input__inner
{
pointer
-
events
:
all
!
important
;
cursor
:
auto
!
important
;
}
/* 确保没有遮罩层 */
.
el
-
dialog__wrapper
{
overflow
:
visible
!
important
;
}
.
el
-
dialog__body
{
overflow
:
visible
!
important
;
}
<
/style>
\ No newline at end of file
ruoyi-admin-vue/src/views/inventory/inbound_items/index.vue
0 → 100644
View file @
6d104f90
<
template
>
<div
class=
"inbound-items-container"
>
<!-- 保留查询表单,但可以通过props控制显示 -->
<el-form
v-if=
"showSearchForm"
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
label-width=
"100px"
class=
"mb8"
>
<el-form-item
label=
"货物ID"
prop=
"materialId"
>
<el-input
v-model=
"queryParams.materialId"
placeholder=
"请输入货物ID"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"批次ID"
prop=
"batchId"
>
<el-input
v-model=
"queryParams.batchId"
placeholder=
"请输入批次ID"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"仓库ID"
prop=
"warehouseId"
>
<el-input
v-model=
"queryParams.warehouseId"
placeholder=
"请输入仓库ID"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"库位ID"
prop=
"locationId"
>
<el-input
v-model=
"queryParams.locationId"
placeholder=
"请输入库位ID"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
<!-- 添加关联查询按钮 -->
<el-button
v-if=
"embedded"
type=
"info"
icon=
"el-icon-connection"
size=
"mini"
@
click=
"handleLoadRelated"
>
加载关联
</el-button>
</el-form-item>
</el-form>
<!-- 操作按钮区域 -->
<div
v-if=
"showToolbar"
class=
"toolbar-container mb8"
>
<el-row
:gutter=
"10"
>
<el-col
:span=
"1.5"
>
<el-button
v-if=
"showAddButton"
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAddItem"
>
新增明细
</el-button>
</el-col>
<!--
<el-col
:span=
"1.5"
>
<el-button
v-if=
"showEditButton"
type=
"success"
plain
icon=
"el-icon-edit"
size=
"mini"
:disabled=
"single"
@
click=
"handleEditItem"
>
修改
</el-button>
</el-col>
-->
<el-col
:span=
"1.5"
>
<el-button
v-if=
"showDeleteButton"
type=
"danger"
plain
icon=
"el-icon-delete"
size=
"mini"
:disabled=
"multiple"
@
click=
"handleBatchDelete"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
v-if=
"showExportButton"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-download"
size=
"mini"
@
click=
"handleImport"
v-hasPermi=
"['inventory:inbound_items:import']"
>
导入
</el-button>
</el-col>
<el-col
:span=
"1.5"
v-if=
"showExportButton"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-upload"
size=
"mini"
@
click=
"handleExport"
>
导出
</el-button>
</el-col>
</el-row>
</div>
<!-- 表格区域 -->
<div
class=
"table-container"
>
<el-table
v-loading=
"loading"
:data=
"displayData"
@
selection-change=
"handleSelectionChange"
:row-key=
"getRowKey"
ref=
"dataTable"
border
stripe
size=
"medium"
v-bind=
"$attrs"
v-on=
"$listeners"
>
<!-- 选择列 -->
<el-table-column
v-if=
"showSelection"
type=
"selection"
width=
"55"
align=
"center"
:reserve-selection=
"true"
/>
<!-- 序号列 -->
<el-table-column
label=
"序号"
align=
"center"
width=
"60"
type=
"index"
/>
<!-- 数据列 -->
<el-table-column
v-for=
"column in columns"
:key=
"column.prop"
:label=
"column.label"
:prop=
"column.prop"
:align=
"column.align || 'center'"
:width=
"column.width"
:min-width=
"column.minWidth"
:fixed=
"column.fixed"
>
<template
slot-scope=
"scope"
>
<!-- 可编辑模式 -->
<template
v-if=
"scope.row.editable && column.editable !== false"
>
<template
v-if=
"column.type === 'select'"
>
<el-select
v-model=
"scope.row[column.prop]"
size=
"small"
style=
"width: 100%"
@
change=
"handleColumnChange(scope.row, column.prop)"
>
<el-option
v-for=
"option in column.options"
:key=
"option.value"
:label=
"option.label"
:value=
"option.value"
/>
</el-select>
</
template
>
<
template
v-else-if=
"column.type === 'number'"
>
<el-input-number
v-model=
"scope.row[column.prop]"
:min=
"column.min || 0"
:max=
"column.max"
:step=
"column.step || 1"
size=
"small"
style=
"width: 100%"
controls-position=
"right"
@
change=
"handleNumberChange(scope.row, column.prop)"
/>
</
template
>
<
template
v-else
>
<el-input
v-model=
"scope.row[column.prop]"
size=
"small"
:placeholder=
"column.placeholder || '请输入'"
@
blur=
"handleInputBlur(scope.row, column.prop)"
@
change=
"handleInputChange(scope.row, column.prop)"
/>
</
template
>
</template>
<!-- 只读模式 -->
<
template
v-else
>
<!-- 状态显示 -->
<template
v-if=
"column.prop === 'itemStatus'"
>
<el-tag
:type=
"getStatusType(scope.row[column.prop])"
size=
"small"
>
{{
getStatusText
(
scope
.
row
[
column
.
prop
])
}}
</el-tag>
</
template
>
<!-- 数字格式化 -->
<
template
v-else-if=
"column.type === 'number'"
>
{{
formatNumber
(
scope
.
row
[
column
.
prop
])
}}
</
template
>
<!-- 默认显示 -->
<
template
v-else
>
{{
scope
.
row
[
column
.
prop
]
}}
</
template
>
</template>
</template>
</el-table-column>
<!-- 操作列 -->
<el-table-column
v-if=
"showActionColumn"
label=
"操作"
align=
"center"
width=
"150"
fixed=
"right"
>
<
template
slot-scope=
"scope"
>
<template
v-if=
"embedded"
>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"handleRowEdit(scope.row)"
v-if=
"!scope.row.editable"
>
编辑
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-check"
@
click=
"handleRowSave(scope.row)"
v-else
>
保存
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleRowDelete(scope.row, scope.$index)"
>
删除
</el-button>
</
template
>
<
template
v-else
>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"() =>
{ this.$refs.dataTable.toggleRowSelection(scope.row); handleEditItem(); }"
>编辑
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleRowDelete(scope.row)"
>
删除
</el-button>
</
template
>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
v-if=
"showPagination && !embedded"
v-show=
"total>0"
:total=
"total"
:page
.
sync=
"queryParams.pageNum"
:limit
.
sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<import-excel
ref=
"import"
title=
"导入"
import-url=
"/inventory/inbound_items/import"
template-url=
"/inventory/inbound_items/exportTemplate"
template-name=
"入库明细模板"
@
success=
"getList"
/>
</div>
<!-- 非嵌入式模式下的添加/编辑对话框 -->
<el-dialog
v-if=
"!embedded"
:title=
"dialogTitle"
:visible
.
sync=
"dialogVisible"
width=
"800px"
append-to-body
@
closed=
"handleDialogClosed"
>
<el-form
ref=
"dialogForm"
:model=
"form"
:rules=
"rules"
label-width=
"120px"
size=
"small"
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"货物ID"
prop=
"materialId"
>
<el-input
v-model=
"form.materialId"
placeholder=
"请输入货物ID"
/>
</el-form-item>
<el-form-item
label=
"批次ID"
prop=
"batchId"
>
<el-input
v-model=
"form.batchId"
placeholder=
"请输入批次ID"
/>
</el-form-item>
<el-form-item
label=
"仓库ID"
prop=
"warehouseId"
>
<el-input
v-model=
"form.warehouseId"
placeholder=
"请输入仓库ID"
/>
</el-form-item>
<el-form-item
label=
"库位ID"
prop=
"locationId"
>
<el-input
v-model=
"form.locationId"
placeholder=
"请输入库位ID"
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
label=
"计划数量"
prop=
"plannedQuantity"
>
<el-input-number
v-model=
"form.plannedQuantity"
:min=
"0"
:step=
"1"
style=
"width: 100%"
/>
</el-form-item>
<el-form-item
label=
"实际数量"
prop=
"actualQuantity"
>
<el-input-number
v-model=
"form.actualQuantity"
:min=
"0"
:step=
"1"
style=
"width: 100%"
/>
</el-form-item>
<el-form-item
label=
"单价"
prop=
"unitPrice"
>
<el-input-number
v-model=
"form.unitPrice"
:min=
"0"
:precision=
"2"
style=
"width: 100%"
/>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"itemStatus"
>
<el-select
v-model=
"form.itemStatus"
placeholder=
"请选择状态"
style=
"width: 100%"
>
<el-option
label=
"待入库"
value=
"1"
/>
<el-option
label=
"已入库"
value=
"2"
/>
<el-option
label=
"已取消"
value=
"3"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model=
"form.remark"
type=
"textarea"
:rows=
"2"
placeholder=
"请输入备注"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"dialogVisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"submitDialogForm"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</template>
<
script
>
import
{
listInbound_items
,
getInbound_items
,
delInbound_items
,
addInbound_items
,
updateInbound_items
}
from
"@/api/inventory/inbound_items"
import
ImportExcel
from
"@/components/ImportExcel/index"
export
default
{
name
:
"InboundItems"
,
inheritAttrs
:
false
,
components
:
{
ImportExcel
},
props
:
{
// 数据源(用于嵌入式模式)
value
:
{
type
:
Array
,
default
:
()
=>
[]
},
// 是否为嵌入式模式(在表单中)
embedded
:
{
type
:
Boolean
,
default
:
false
},
// 主表ID(入库单号)
orderId
:
{
type
:
[
String
,
Number
],
default
:
null
},
// 是否显示查询表单
showSearchForm
:
{
type
:
Boolean
,
default
:
true
},
// 是否显示工具栏
showToolbar
:
{
type
:
Boolean
,
default
:
true
},
// 是否显示操作列
showActionColumn
:
{
type
:
Boolean
,
default
:
true
},
// 是否显示选择框
showSelection
:
{
type
:
Boolean
,
default
:
false
},
// 是否显示分页
showPagination
:
{
type
:
Boolean
,
default
:
true
},
// 是否显示新增按钮
showAddButton
:
{
type
:
Boolean
,
default
:
true
},
// 是否显示编辑按钮
showEditButton
:
{
type
:
Boolean
,
default
:
true
},
// 是否显示删除按钮
showDeleteButton
:
{
type
:
Boolean
,
default
:
true
},
// 是否显示导出按钮
showExportButton
:
{
type
:
Boolean
,
default
:
true
},
// 权限控制
permissions
:
{
type
:
Array
,
default
:
()
=>
[]
},
// 初始查询参数
initQuery
:
{
type
:
Object
,
default
:
()
=>
({})
},
// 表格列配置
columns
:
{
type
:
Array
,
default
:
()
=>
[
{
prop
:
'materialId'
,
label
:
'货物ID'
,
width
:
'120'
,
editable
:
true
},
{
prop
:
'batchId'
,
label
:
'批次ID'
,
width
:
'120'
,
editable
:
true
},
{
prop
:
'warehouseId'
,
label
:
'仓库ID'
,
width
:
'120'
,
editable
:
true
},
{
prop
:
'locationId'
,
label
:
'库位ID'
,
width
:
'120'
,
editable
:
true
},
{
prop
:
'plannedQuantity'
,
label
:
'计划数量'
,
width
:
'100'
,
type
:
'number'
,
editable
:
true
},
{
prop
:
'actualQuantity'
,
label
:
'实际数量'
,
width
:
'100'
,
type
:
'number'
,
editable
:
true
},
{
prop
:
'plannedPackages'
,
label
:
'计划件数'
,
width
:
'100'
,
type
:
'number'
,
editable
:
true
},
{
prop
:
'actualPackages'
,
label
:
'实际件数'
,
width
:
'100'
,
type
:
'number'
,
editable
:
true
},
{
prop
:
'unitPrice'
,
label
:
'单价'
,
width
:
'100'
,
type
:
'number'
,
editable
:
true
},
{
prop
:
'itemStatus'
,
label
:
'状态'
,
width
:
'100'
,
editable
:
true
,
type
:
'select'
},
{
prop
:
'remark'
,
label
:
'备注'
,
minWidth
:
'150'
,
editable
:
true
},
]
}
},
data
()
{
return
{
// 遮罩层
loading
:
false
,
// 选中数组
selectedRows
:
[],
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 总条数
total
:
0
,
// 显示数据
displayData
:
[],
// 对话框相关
dialogVisible
:
false
,
dialogTitle
:
""
,
dialogMode
:
'add'
,
// 'add' or 'edit'
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
orderId
:
this
.
orderId
,
materialId
:
null
,
batchId
:
null
,
warehouseId
:
null
,
locationId
:
null
,
labelColor
:
null
,
...
this
.
initQuery
},
// 表单参数
form
:
this
.
getDefaultForm
(),
// 表单校验
rules
:
{
materialId
:
[
{
required
:
true
,
message
:
"货物ID不能为空"
,
trigger
:
"blur"
}
],
plannedQuantity
:
[
{
required
:
true
,
message
:
"计划数量不能为空"
,
trigger
:
"blur"
},
{
type
:
'number'
,
min
:
0
,
message
:
"计划数量不能小于0"
,
trigger
:
"blur"
}
],
actualQuantity
:
[
{
type
:
'number'
,
min
:
0
,
message
:
"实际数量不能小于0"
,
trigger
:
"blur"
}
]
},
// 缓存原始数据(用于嵌入式模式)
cachedData
:
[]
}
},
watch
:
{
// 监听value变化(嵌入式模式)
value
:
{
immediate
:
true
,
handler
(
newVal
)
{
if
(
this
.
embedded
)
{
// 只有当数据真正变化时才更新
const
stringifiedNewVal
=
JSON
.
stringify
(
newVal
||
[])
const
stringifiedDisplayData
=
JSON
.
stringify
(
this
.
displayData
.
map
(
item
=>
{
const
{
editable
,
tempId
,
...
rest
}
=
item
return
rest
}))
if
(
stringifiedNewVal
!==
stringifiedDisplayData
)
{
this
.
cachedData
=
JSON
.
parse
(
JSON
.
stringify
(
newVal
||
[]))
this
.
displayData
=
(
newVal
||
[]).
map
(
item
=>
({
...
item
,
editable
:
false
,
tempId
:
item
.
id
||
Date
.
now
()
+
Math
.
random
()
}))
this
.
calculateTotals
()
}
}
}
},
// 监听嵌入式数据变化,通知父组件
displayData
:
{
deep
:
true
,
handler
(
newVal
)
{
if
(
this
.
embedded
)
{
const
dataToEmit
=
newVal
.
map
(
item
=>
{
const
{
editable
,
tempId
,
...
rest
}
=
item
// 确保新添加的行有orderId
if
(
this
.
orderId
&&
!
rest
.
orderId
)
{
rest
.
orderId
=
this
.
orderId
}
return
rest
})
// 避免不必要的更新循环
const
shouldEmit
=
JSON
.
stringify
(
dataToEmit
)
!==
JSON
.
stringify
(
this
.
value
||
[])
if
(
shouldEmit
)
{
this
.
$emit
(
'input'
,
dataToEmit
)
this
.
$emit
(
'data-change'
,
dataToEmit
)
}
this
.
calculateTotals
()
}
}
},
// 监听orderId变化
orderId
:
{
immediate
:
true
,
handler
(
newVal
)
{
if
(
newVal
)
{
if
(
!
this
.
embedded
)
{
this
.
queryParams
.
orderId
=
newVal
this
.
getList
()
}
else
{
// 在嵌入式模式下,更新所有没有orderId的项
this
.
displayData
=
this
.
displayData
.
map
(
item
=>
({
...
item
,
orderId
:
item
.
orderId
||
newVal
}))
}
}
}
}
},
computed
:
{
// 计算总数量和金额
totals
()
{
if
(
!
this
.
displayData
.
length
)
return
{
plannedQuantity
:
0
,
actualQuantity
:
0
,
totalAmount
:
0
}
return
this
.
displayData
.
reduce
((
acc
,
item
)
=>
{
acc
.
plannedQuantity
+=
parseFloat
(
item
.
plannedQuantity
)
||
0
acc
.
actualQuantity
+=
parseFloat
(
item
.
actualQuantity
)
||
0
acc
.
totalAmount
+=
(
parseFloat
(
item
.
plannedQuantity
)
||
0
)
*
(
parseFloat
(
item
.
unitPrice
)
||
0
)
return
acc
},
{
plannedQuantity
:
0
,
actualQuantity
:
0
,
totalAmount
:
0
})
}
},
created
()
{
if
(
!
this
.
embedded
)
{
this
.
getList
()
}
},
methods
:
{
/** 获取默认表单数据 */
getDefaultForm
()
{
return
{
id
:
null
,
orderId
:
this
.
orderId
,
materialId
:
null
,
batchId
:
null
,
warehouseId
:
null
,
locationId
:
null
,
plannedQuantity
:
0
,
actualQuantity
:
0
,
plannedPackages
:
0
,
actualPackages
:
0
,
unitPrice
:
0
,
itemStatus
:
'1'
,
remark
:
null
}
},
/** 查询数据列表 */
getList
()
{
this
.
loading
=
true
listInbound_items
(
this
.
queryParams
).
then
(
response
=>
{
this
.
displayData
=
response
.
rows
this
.
total
=
response
.
total
this
.
loading
=
false
this
.
$emit
(
'load-success'
,
response
)
}).
catch
(()
=>
{
this
.
loading
=
false
})
},
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
this
.
getList
()
},
/** 重置按钮操作 */
resetQuery
()
{
this
.
resetForm
(
"queryForm"
)
this
.
queryParams
=
{
pageNum
:
1
,
pageSize
:
10
,
orderId
:
this
.
orderId
,
...
this
.
initQuery
}
this
.
handleQuery
()
},
/** 加载关联数据 */
handleLoadRelated
()
{
if
(
!
this
.
orderId
)
{
this
.
$message
.
warning
(
'请先保存主表信息'
)
return
}
this
.
queryParams
.
orderId
=
this
.
orderId
this
.
getList
()
},
/** 处理选择变化 */
handleSelectionChange
(
selection
)
{
this
.
selectedRows
=
selection
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
this
.
$emit
(
'selection-change'
,
selection
)
},
/** 获取行key */
getRowKey
(
row
)
{
return
row
.
id
||
row
.
tempId
},
/** 新增明细项 */
handleAddItem
()
{
if
(
this
.
embedded
)
{
// 嵌入式模式:直接添加行
const
newItem
=
{
...
this
.
getDefaultForm
(),
editable
:
true
,
tempId
:
Date
.
now
()
+
Math
.
random
()
}
this
.
displayData
.
push
(
newItem
)
this
.
$emit
(
'item-added'
,
newItem
)
}
else
{
// 独立模式:打开对话框
this
.
dialogMode
=
'add'
this
.
dialogTitle
=
"添加入库明细"
this
.
form
=
this
.
getDefaultForm
()
this
.
dialogVisible
=
true
}
},
/** 编辑明细项 */
handleEditItem
()
{
if
(
this
.
single
)
return
const
row
=
this
.
selectedRows
[
0
]
if
(
this
.
embedded
)
{
// 嵌入式模式:直接设置为可编辑
const
index
=
this
.
displayData
.
findIndex
(
item
=>
(
item
.
id
||
item
.
tempId
)
===
(
row
.
id
||
row
.
tempId
))
if
(
index
>
-
1
)
{
this
.
$set
(
this
.
displayData
[
index
],
'editable'
,
true
)
}
}
else
{
// 独立模式:打开对话框
this
.
dialogMode
=
'edit'
this
.
dialogTitle
=
"修改入库明细"
this
.
form
=
JSON
.
parse
(
JSON
.
stringify
(
row
))
this
.
dialogVisible
=
true
}
},
/** 行编辑 */
handleRowEdit
(
row
)
{
const
index
=
this
.
displayData
.
findIndex
(
item
=>
(
item
.
id
||
item
.
tempId
)
===
(
row
.
id
||
row
.
tempId
))
if
(
index
>
-
1
)
{
this
.
$set
(
this
.
displayData
[
index
],
'editable'
,
true
)
}
},
/** 行保存 */
handleRowSave
(
row
)
{
const
index
=
this
.
displayData
.
findIndex
(
item
=>
(
item
.
id
||
item
.
tempId
)
===
(
row
.
id
||
row
.
tempId
))
if
(
index
>
-
1
)
{
this
.
$set
(
this
.
displayData
[
index
],
'editable'
,
false
)
this
.
$emit
(
'row-saved'
,
row
)
}
},
/** 批量删除 */
handleBatchDelete
()
{
if
(
this
.
selectedRows
.
length
===
0
)
{
this
.
$message
.
warning
(
'请先选择要删除的项'
)
return
}
this
.
$confirm
(
'确定要删除选中的明细项吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
if
(
this
.
embedded
)
{
// 嵌入式模式:从displayData中删除
const
idsToDelete
=
this
.
selectedRows
.
map
(
row
=>
row
.
id
||
row
.
tempId
)
this
.
displayData
=
this
.
displayData
.
filter
(
item
=>
!
idsToDelete
.
includes
(
item
.
id
||
item
.
tempId
)
)
this
.
selectedRows
=
[]
this
.
$emit
(
'batch-delete'
,
idsToDelete
)
}
else
{
// 独立模式:调用API删除
const
ids
=
this
.
selectedRows
.
map
(
row
=>
row
.
id
).
join
(
','
)
delInbound_items
(
ids
).
then
(()
=>
{
this
.
$modal
.
msgSuccess
(
"删除成功"
)
this
.
getList
()
this
.
selectedRows
=
[]
})
}
})
},
/** 行删除 */
handleRowDelete
(
row
,
index
)
{
this
.
$confirm
(
'确定要删除该明细项吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
if
(
this
.
embedded
)
{
this
.
displayData
.
splice
(
index
,
1
)
this
.
$emit
(
'row-deleted'
,
row
)
}
else
{
delInbound_items
(
row
.
id
).
then
(()
=>
{
this
.
$modal
.
msgSuccess
(
"删除成功"
)
this
.
getList
()
})
}
})
},
/** 导出 */
handleExport
()
{
this
.
download
(
'inventory/inbound_items/export'
,
{
...
this
.
queryParams
},
`inbound_items_
${
new
Date
().
getTime
()}
.xlsx`
)
},
/** 处理输入框变化 */
handleInputChange
(
row
,
prop
)
{
this
.
$emit
(
'cell-change'
,
{
row
,
prop
,
value
:
row
[
prop
]
})
},
/** 处理数字变化 */
handleNumberChange
(
row
,
prop
)
{
row
[
prop
]
=
parseFloat
(
row
[
prop
])
||
0
this
.
$emit
(
'cell-change'
,
{
row
,
prop
,
value
:
row
[
prop
]
})
},
/** 处理列变化 */
handleColumnChange
(
row
,
prop
)
{
this
.
$emit
(
'cell-change'
,
{
row
,
prop
,
value
:
row
[
prop
]
})
},
/** 处理输入框失去焦点 */
handleInputBlur
(
row
,
prop
)
{
// 可以在这里添加验证逻辑
this
.
$emit
(
'cell-blur'
,
{
row
,
prop
,
value
:
row
[
prop
]
})
},
/** 提交对话框表单 */
submitDialogForm
()
{
this
.
$refs
[
"dialogForm"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
dialogMode
===
'add'
)
{
addInbound_items
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"新增成功"
)
this
.
dialogVisible
=
false
this
.
getList
()
})
}
else
{
updateInbound_items
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"修改成功"
)
this
.
dialogVisible
=
false
this
.
getList
()
})
}
}
})
},
/** 对话框关闭 */
handleDialogClosed
()
{
this
.
$refs
[
"dialogForm"
].
resetFields
()
},
/** 获取状态类型 */
getStatusType
(
status
)
{
const
map
=
{
'1'
:
'info'
,
'2'
:
'success'
,
'3'
:
'danger'
}
return
map
[
status
]
||
'info'
},
/** 获取状态文本 */
getStatusText
(
status
)
{
const
map
=
{
'1'
:
'待入库'
,
'2'
:
'已入库'
,
'3'
:
'已取消'
}
return
map
[
status
]
||
status
},
/** 格式化数字 */
formatNumber
(
num
)
{
if
(
num
==
null
)
return
''
return
parseFloat
(
num
).
toLocaleString
()
},
/** 计算总数并通知父组件 */
calculateTotals
()
{
if
(
this
.
embedded
)
{
const
totals
=
this
.
totals
this
.
$emit
(
'totals-change'
,
totals
)
}
},
/** 验证数据 */
validate
()
{
const
errors
=
[]
this
.
displayData
.
forEach
((
item
,
index
)
=>
{
if
(
!
item
.
materialId
)
{
errors
.
push
(
`第
${
index
+
1
}
行:货物ID不能为空`
)
}
if
(
parseFloat
(
item
.
plannedQuantity
)
<=
0
)
{
errors
.
push
(
`第
${
index
+
1
}
行:计划数量必须大于0`
)
}
})
return
errors
},
/** 获取所有数据 */
getItems
()
{
return
this
.
displayData
.
map
(
item
=>
{
const
{
editable
,
tempId
,
...
rest
}
=
item
return
rest
})
},
/** 重置数据(嵌入式模式) */
resetEmbeddedData
()
{
this
.
displayData
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
cachedData
)).
map
(
item
=>
({
...
item
,
editable
:
false
,
tempId
:
item
.
id
||
Date
.
now
()
+
Math
.
random
()
}))
},
/** 导入按钮操作 */
handleImport
()
{
this
.
$refs
.
import
.
show
()
},
/** 新增明细项(供父组件调用) */
addItem
(
options
=
{})
{
const
newItem
=
{
...
this
.
getDefaultForm
(),
...
options
,
orderId
:
this
.
orderId
||
options
.
orderId
,
editable
:
true
,
tempId
:
Date
.
now
()
+
Math
.
random
()
}
this
.
displayData
.
push
(
newItem
)
return
newItem
},
/** 新增空行(嵌入式模式) */
addEmptyRow
()
{
return
this
.
addItem
()
},
/** 删除选中项(供父组件调用) */
deleteSelected
()
{
if
(
this
.
selectedRows
.
length
>
0
)
{
const
idsToDelete
=
this
.
selectedRows
.
map
(
row
=>
row
.
id
||
row
.
tempId
)
this
.
displayData
=
this
.
displayData
.
filter
(
item
=>
!
idsToDelete
.
includes
(
item
.
id
||
item
.
tempId
)
)
this
.
selectedRows
=
[]
this
.
$emit
(
'batch-delete'
,
idsToDelete
)
return
true
}
return
false
}
}
}
</
script
>
<
style
scoped
>
.inbound-items-container
{
width
:
100%
;
}
.toolbar-container
{
background
:
#f8f9fa
;
padding
:
10px
;
border-radius
:
4px
;
border
:
1px
solid
#ebeef5
;
}
.table-container
{
margin-top
:
10px
;
}
/* 行内编辑样式 */
.el-table
.cell
.el-input
,
.el-table
.cell
.el-input-number
,
.el-table
.cell
.el-select
{
width
:
100%
;
}
.el-table
.cell
.el-input-number
{
line-height
:
32px
;
}
/* 调整表格内边距 */
.el-table--medium
td
{
padding
:
6px
0
;
}
</
style
>
\ No newline at end of file
ruoyi-admin-vue/src/views/inventory/materials_category/index.vue
View file @
6d104f90
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
v-hasPermi=
"['inventory:materials_category:add']"
v-hasPermi=
"['inventory:materials_category:add']"
>
新增
</el-button>
>
新增
</el-button>
</el-col>
</el-col>
<el-col
:span=
"1.5"
>
<
!--
<
el-col
:span=
"1.5"
>
<el-button
<el-button
type=
"success"
type=
"success"
plain
plain
...
@@ -81,7 +81,7 @@
...
@@ -81,7 +81,7 @@
@
click=
"handleDelete"
@
click=
"handleDelete"
v-hasPermi=
"['inventory:materials_category:remove']"
v-hasPermi=
"['inventory:materials_category:remove']"
>
删除
</el-button>
>
删除
</el-button>
</el-col>
</el-col>
-->
<el-col
:span=
"1.5"
>
<el-col
:span=
"1.5"
>
<el-button
<el-button
type=
"info"
type=
"info"
...
@@ -102,20 +102,18 @@
...
@@ -102,20 +102,18 @@
<right-toolbar
v-model=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
<right-toolbar
v-model=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
</el-row>
<!-- 树形数据表格
(移除分页)
-->
<!-- 树形数据表格 -->
<div
style=
"flex: 1; overflow: auto;"
>
<div
style=
"flex: 1; overflow: auto;"
>
<el-table
<el-table
ref=
"treeTable"
ref=
"treeTable"
v-if=
"refreshTable"
v-loading=
"loading"
v-loading=
"loading"
:data=
"currentTreeNodeData"
:data=
"currentTreeNodeData"
@
selection-change=
"handleSelectionChange"
style=
"width: 100%;"
row-key=
"id"
row-key=
"id"
:default-expand-all=
"isExpandAll"
:default-expand-all=
"isExpandAll"
:tree-props=
"
{children: 'children', hasChildren: 'hasChildren'}"
:tree-props=
"
{children: 'children', hasChildren: 'hasChildren'}"
>
>
<
el-table-column
type=
"selection"
width=
"55"
align=
"center"
/
>
<
!--
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
--
>
<el-table-column
<el-table-column
label=
"物料分类名称"
label=
"物料分类名称"
align=
"center"
align=
"center"
...
@@ -200,22 +198,12 @@
...
@@ -200,22 +198,12 @@
<
el
-
form
-
item
label
=
"排序"
prop
=
"sortNo"
>
<
el
-
form
-
item
label
=
"排序"
prop
=
"sortNo"
>
<
el
-
input
v
-
model
=
"form.sortNo"
placeholder
=
"请输入排序"
/>
<
el
-
input
v
-
model
=
"form.sortNo"
placeholder
=
"请输入排序"
/>
<
/el-form-item
>
<
/el-form-item
>
<!--
<
el
-
form
-
item
label
=
"状态"
prop
=
"isUsed"
>
<
el
-
radio
-
group
v
-
model
=
"form.isUsed"
>
<
el
-
radio
v
-
for
=
"dict in dict.type.sys_normal_disable"
:
key
=
"dict.value"
:
label
=
"dict.value"
>
{{
dict
.
label
}}
<
/el-radio
>
<
/el-radio-group
>
<
/el-form-item> --
>
<
/el-form
>
<
/el-form
>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
type
=
"primary"
@
click
=
"submitForm"
>
确
定
<
/el-button
>
<
el
-
button
type
=
"primary"
@
click
=
"submitForm"
>
确
定
<
/el-button
>
<
el
-
button
@
click
=
"handleDialogClose"
>
取
消
<
/el-button
>
<
el
-
button
@
click
=
"handleDialogClose"
>
取
消
<
/el-button
>
<
/div
>
<
/div
>
<
/el-dialog
>
<
/el-dialog
>
<
/div
>
<
/div
>
<
/template
>
<
/template
>
...
@@ -276,7 +264,6 @@ export default {
...
@@ -276,7 +264,6 @@ export default {
nodeKey
:
'sid'
,
nodeKey
:
'sid'
,
currentNodeId
:
null
,
currentNodeId
:
null
,
isExpandAll
:
true
,
isExpandAll
:
true
,
refreshTable
:
true
,
form
:
{
form
:
{
id
:
null
,
id
:
null
,
categoryCode
:
null
,
categoryCode
:
null
,
...
@@ -289,12 +276,9 @@ export default {
...
@@ -289,12 +276,9 @@ export default {
}
,
}
,
queryParams
:
{
queryParams
:
{
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
1000
,
// 设置为较大的值,一次性获取所有数据
pageSize
:
1000
,
categoryCode
:
null
,
categoryCode
:
null
,
categoryName
:
null
,
categoryName
:
null
,
sortNo
:
null
,
createTime
:
null
,
updateTime
:
null
,
parentId
:
null
,
parentId
:
null
,
isUsed
:
1
isUsed
:
1
}
,
}
,
...
@@ -330,6 +314,11 @@ export default {
...
@@ -330,6 +314,11 @@ export default {
this
.
getCategoryOptions
()
this
.
getCategoryOptions
()
}
,
}
,
methods
:
{
methods
:
{
startTimer
()
{
setTimeout
(()
=>
{
this
.
message
=
"更新内容"
;
}
,
800
);
}
,
/** 查询分类树结构 */
/** 查询分类树结构 */
getCategoryOptions
()
{
getCategoryOptions
()
{
this
.
loadingTree
=
true
this
.
loadingTree
=
true
...
@@ -342,354 +331,207 @@ export default {
...
@@ -342,354 +331,207 @@ export default {
}
,
}
,
/** 处理树节点点击 */
/** 处理树节点点击 */
/** 处理树节点点击 */
handleTreeClick
(
data
)
{
handleTreeClick
(
data
)
{
console
.
log
(
'点击树节点:'
,
data
)
if
(
!
data
||
!
data
.
sid
)
return
;
// 确保数据存在且有sid属性
this
.
currentNodeId
=
String
(
data
.
sid
);
if
(
!
data
||
!
data
.
sid
)
{
// 查找根节点并筛选分支数据
console
.
warn
(
'无效的节点数据,缺少sid属性'
);
const
rootNode
=
this
.
findRootNode
(
data
.
sid
,
this
.
categoryOptions
);
return
;
}
// 确保使用字符串类型的id进行操作,避免类型转换问题
this
.
currentNodeId
=
String
(
data
.
sid
)
console
.
log
(
this
.
categoryOptions
)
// 1. 找到当前节点的根节点
const
rootNode
=
this
.
findRootNode
(
this
.
currentNodeId
,
this
.
categoryOptions
);
if
(
rootNode
)
{
if
(
rootNode
)
{
// 2. 筛选根节点的完整分支数据
const
rootNodeIdStr
=
String
(
rootNode
.
sid
);
this
.
filterRootBranchData
(
this
.
materials_categoryList
,
rootNodeIdStr
);
// 3. 自动展开到当前节点
this
.
filterRootBranchData
(
rootNode
.
sid
);
this
.
$nextTick
(()
=>
{
// 自动展开到当前节点
// 尝试展开节点,即使数据可能尚未完全准备好
this
.
expandToNode
(
data
.
sid
);
// expandToNode方法内部已经有适当的错误处理
this
.
expandToNode
(
this
.
currentNodeId
);
}
);
}
}
}
,
}
,
/** 查找表格数据中的节点ID */
/** 查找根节点 */
findTableNodeId
(
treeNode
)
{
findRootNode
(
nodeId
,
treeData
)
{
if
(
!
treeNode
)
return
null
const
findNode
=
(
nodes
,
id
)
=>
{
for
(
const
node
of
nodes
)
{
// 首先在materials_categoryList中查找对应的节点
if
(
String
(
node
.
sid
)
===
String
(
id
))
{
const
tableNode
=
this
.
materials_categoryList
.
find
(
item
=>
if
(
!
node
.
parentId
||
node
.
parentId
===
0
)
return
node
;
item
.
categoryCode
===
treeNode
.
categoryCode
||
return
findNode
(
treeData
,
node
.
parentId
);
item
.
categoryName
===
treeNode
.
label
||
item
.
id
===
treeNode
.
id
)
return
tableNode
?
tableNode
.
id
:
null
}
,
/** 筛选根节点的完整分支数据 */
filterRootBranchData
(
allData
,
rootNodeId
)
{
// 确保rootNodeId为字符串类型
const
rootNodeIdStr
=
String
(
rootNodeId
);
// 获取根节点分支的所有节点ID(包含根节点和所有子节点)
const
branchNodeIds
=
this
.
getAllChildNodeIds
(
allData
,
rootNodeIdStr
);
// 筛选出根分支的所有数据
// 使用字符串比较避免类型转换问题
const
filteredData
=
allData
.
filter
(
item
=>
branchNodeIds
.
some
(
branchId
=>
String
(
branchId
)
===
String
(
item
.
id
))
);
// 构建树形结构并赋值给表格
this
.
currentTreeNodeData
=
this
.
handleTree
(
filteredData
,
"id"
);
}
,
/** 展开到指定节点 */
expandToNode
(
nodeId
)
{
const
treeTable
=
this
.
$refs
.
treeTable
;
// 增加对treeTable.store.nodesMap的检查
if
(
!
treeTable
||
!
treeTable
.
store
||
!
treeTable
.
store
.
nodesMap
)
{
console
.
log
(
treeTable
)
console
.
warn
(
'树表格组件未完全初始化或nodesMap不存在'
);
return
;
}
// 确保nodeId为字符串类型
const
nodeIdStr
=
String
(
nodeId
);
// 找到节点路径
const
nodePath
=
this
.
findNodePath
(
this
.
currentTreeNodeData
,
nodeIdStr
);
// 逐级展开
if
(
nodePath
&&
nodePath
.
length
>
0
)
{
nodePath
.
forEach
(
id
=>
{
const
idStr
=
String
(
id
);
try
{
// 安全地查找节点,避免访问不存在的属性
const
node
=
treeTable
.
store
.
nodesMap
[
idStr
]
||
treeTable
.
store
.
nodesMap
[
id
];
if
(
node
&&
typeof
node
===
'object'
&&
node
.
expanded
===
false
&&
node
.
expandable
)
{
node
.
expanded
=
true
;
}
}
catch
(
error
)
{
console
.
warn
(
`展开节点时出错: ${error.message
}
, 节点ID: ${idStr
}
`
);
}
}
);
}
}
,
/** 查找节点路径 */
findNodePath
(
treeData
,
targetId
,
path
=
[])
{
// 确保targetId为字符串类型
const
targetIdStr
=
String
(
targetId
);
for
(
const
item
of
treeData
)
{
if
(
String
(
item
.
id
)
===
targetIdStr
)
{
return
[...
path
,
item
.
id
];
}
}
if
(
node
.
children
&&
node
.
children
.
length
)
{
if
(
item
.
children
&&
item
.
children
.
length
)
{
const
found
=
findNode
(
node
.
children
,
id
);
const
found
=
this
.
findNodePath
(
item
.
children
,
targetIdStr
,
[...
path
,
item
.
id
]);
if
(
found
)
return
found
;
if
(
found
)
return
found
;
}
}
}
}
return
null
;
return
null
;
}
;
return
findNode
(
treeData
,
nodeId
);
}
,
}
,
/** 转换部门数据结构 */
/** 筛选根节点分支数据 */
normalizer
(
node
)
{
filterRootBranchData
(
rootNodeId
)
{
if
(
node
.
children
&&
!
node
.
children
.
length
)
{
// 获取根分支所有节点ID
delete
node
.
children
const
branchIds
=
this
.
getBranchNodeIds
(
this
.
categoryOptions
,
rootNodeId
);
}
return
{
id
:
node
.
sid
,
label
:
node
.
label
,
children
:
node
.
children
}
}
,
/** 查询物料分类列表 */
/** 查询物料分类列表 */
getList
()
{
this
.
loading
=
true
listMaterials_category
(
this
.
queryParams
).
then
(
response
=>
{
this
.
materials_categoryList
=
response
.
rows
.
filter
(
item
=>
item
.
isUsed
!==
0
&&
item
.
isUsed
!==
'0'
);
// 如果没有选中树节点,显示所有数据
// 筛选数据并构建树形
if
(
!
this
.
currentNodeId
)
{
const
filteredData
=
this
.
materials_categoryList
.
filter
(
item
=>
this
.
currentTreeNodeData
=
this
.
handleTree
(
this
.
materials_categoryList
,
"id"
);
branchIds
.
includes
(
String
(
item
.
id
))
}
else
{
);
// 如果有选中的树节点,保持当前显示
this
.
currentTreeNodeData
=
this
.
buildTree
(
filteredData
);
// 直接使用 currentNodeId(sid)作为表格数据的 id
const
rootNode
=
this
.
findRootNode
(
this
.
currentNodeId
,
this
.
categoryOptions
);
if
(
rootNode
)
{
// rootNode.sid 就是表格中的 id
this
.
filterRootBranchData
(
this
.
materials_categoryList
,
rootNode
.
sid
);
}
}
this
.
loading
=
false
this
.
$emit
(
"list-loaded"
,
{
list
:
response
.
rows
,
total
:
response
.
rows
.
length
}
)
}
)
}
,
}
,
/** 选择指定的树节点 */
/** 获取分支所有节点ID */
selectTreeNode
(
nodeId
)
{
getBranchNodeIds
(
treeData
,
nodeId
)
{
if
(
!
nodeId
)
return
;
const
ids
=
[];
const
collectIds
=
(
nodes
,
targetId
)
=>
{
// 确保nodeId为字符串类型
const
nodeIdStr
=
String
(
nodeId
);
// 查找对应的树节点
const
findTreeNode
=
(
nodes
)
=>
{
for
(
const
node
of
nodes
)
{
for
(
const
node
of
nodes
)
{
if
(
String
(
node
.
sid
)
===
nodeIdStr
)
{
if
(
String
(
node
.
sid
)
===
String
(
targetId
))
{
return
node
;
ids
.
push
(
String
(
node
.
sid
));
if
(
node
.
children
)
this
.
collectChildIds
(
node
.
children
,
ids
);
return
true
;
}
}
if
(
node
.
children
&&
node
.
children
.
length
>
0
)
{
if
(
node
.
children
&&
collectIds
(
node
.
children
,
targetId
)
)
{
const
found
=
findTreeNode
(
node
.
children
);
ids
.
push
(
String
(
node
.
sid
)
);
if
(
found
)
return
found
;
return
true
;
}
}
}
}
return
null
;
return
false
;
}
;
}
;
collectIds
(
treeData
,
nodeId
);
return
ids
;
}
,
// 在categoryOptions中查找节点
/** 收集子节点ID */
const
treeNode
=
findTreeNode
(
this
.
categoryOptions
);
collectChildIds
(
children
,
ids
)
{
children
.
forEach
(
child
=>
{
if
(
treeNode
)
{
ids
.
push
(
String
(
child
.
sid
));
// 如果找到节点,触发点击事件
if
(
child
.
children
)
this
.
collectChildIds
(
child
.
children
,
ids
);
this
.
handleTreeClick
(
treeNode
);
}
);
}
else
{
console
.
warn
(
`未找到ID为${nodeIdStr
}
的树节点`
);
// 如果未找到节点,可能是根节点已变更,尝试找到新的根节点
const
rootNode
=
this
.
findRootNode
(
nodeIdStr
,
this
.
materials_categoryList
);
if
(
rootNode
)
{
this
.
filterRootBranchData
(
this
.
materials_categoryList
,
rootNode
.
id
);
}
}
}
,
}
,
/** 获取节点及其所有子节点的ID(基于表格数据) */
/** 构建树形结构 */
getAllChildNodeIds
(
tableData
,
nodeId
)
{
buildTree
(
data
)
{
const
result
=
[];
const
map
=
{
}
;
// 确保nodeId为字符串类型
const
roots
=
[];
const
nodeIdStr
=
String
(
nodeId
);
// 递归查找所有子节点
// 创建节点映射
const
findChildren
=
(
parentId
)
=>
{
data
.
forEach
(
item
=>
{
const
parentIdStr
=
String
(
parentId
);
map
[
item
.
id
]
=
{
...
item
,
children
:
[]
}
;
// 使用字符串比较确保兼容性
const
children
=
tableData
.
filter
(
item
=>
item
.
parentId
&&
String
(
item
.
parentId
)
===
parentIdStr
);
children
.
forEach
(
child
=>
{
result
.
push
(
child
.
id
);
findChildren
(
child
.
id
);
}
);
}
);
}
;
//
添加当前节点
//
构建父子关系
// 使用字符串比较查找当前节点
data
.
forEach
(
item
=>
{
const
currentNode
=
tableData
.
find
(
item
=>
String
(
item
.
id
)
===
nodeIdStr
);
if
(
item
.
parentId
&&
map
[
item
.
parentId
])
{
if
(
currentNode
)
{
map
[
item
.
parentId
].
children
.
push
(
map
[
item
.
id
]);
result
.
push
(
currentNode
.
id
);
}
else
{
findChildren
(
currentNode
.
id
);
roots
.
push
(
map
[
item
.
id
]
);
}
}
}
);
return
r
esult
;
return
r
oots
;
}
,
}
,
/** 查找当前节点的根节点 */
/** 展开到指定节点 */
findRootNode
(
nodeId
,
treeData
)
{
expandToNode
(
targetId
)
{
// 确保nodeId为字符串类型
const
treeTable
=
this
.
$refs
.
treeTable
;
const
nodeIdStr
=
String
(
nodeId
);
if
(
!
treeTable
||
!
this
.
currentTreeNodeData
.
length
)
return
;
// 首先找到当前节点
const
findNodeById
=
(
nodes
,
id
)
=>
{
// 检查nodes是否有效
if
(
!
nodes
||
!
Array
.
isArray
(
nodes
))
return
null
;
for
(
const
node
of
nodes
)
{
const
expandRecursive
=
(
data
,
targetId
,
parents
=
[])
=>
{
// 确保比较时使用字符串类型,处理表格数据和树数据的不同字段名
for
(
const
item
of
data
)
{
if
(
String
(
node
.
sid
||
node
.
id
)
===
id
)
{
if
(
String
(
item
.
id
)
===
String
(
targetId
))
{
return
node
;
parents
.
forEach
(
p
=>
treeTable
.
toggleRowExpansion
(
p
,
true
));
treeTable
.
toggleRowExpansion
(
item
,
true
);
return
true
;
}
}
if
(
node
.
children
&&
node
.
children
.
length
>
0
)
{
if
(
item
.
children
&&
expandRecursive
(
item
.
children
,
targetId
,
[...
parents
,
item
]))
{
const
found
=
findNodeById
(
node
.
children
,
id
);
return
true
;
if
(
found
)
return
found
;
}
}
}
}
return
null
;
return
false
;
}
;
}
;
const
currentNode
=
findNodeById
(
treeData
,
nodeIdStr
);
this
.
$nextTick
(()
=>
{
expandRecursive
(
this
.
currentTreeNodeData
,
targetId
);
if
(
!
currentNode
)
return
null
;
}
);
}
,
// 查找根节点(parentId为null或空或0)
const
findRoot
=
(
node
)
=>
{
if
(
!
node
)
return
null
;
// 检查多种可能的根节点条件
const
parentId
=
String
(
node
.
parentId
||
''
);
if
(
!
parentId
||
parentId
===
'0'
||
parentId
===
'null'
||
parentId
===
'undefined'
)
{
return
node
;
}
const
parentNode
=
findNodeById
(
treeData
,
parentId
);
/** 转换treeselect数据结构 */
// 如果找不到父节点,当前节点就是根节点
normalizer
(
node
)
{
console
.
log
(
parentNode
)
return
{
return
parentNode
?
findRoot
(
parentNode
)
:
node
;
id
:
node
.
sid
,
label
:
node
.
label
,
children
:
node
.
children
}
;
}
;
return
findRoot
(
currentNode
);
}
,
}
,
/** 处理树形数据 */
/** 查询物料分类列表 */
handleTree
(
data
,
id
,
parentId
,
children
)
{
getList
()
{
id
=
id
||
'id'
this
.
loading
=
true
;
parentId
=
parentId
||
'parentId'
listMaterials_category
(
this
.
queryParams
).
then
(
response
=>
{
children
=
children
||
'children'
this
.
materials_categoryList
=
response
.
rows
.
filter
(
item
=>
item
.
isUsed
!==
0
);
// 确保根节点筛选逻辑正确,处理各种可能的parentId值
const
rootNodes
=
data
.
filter
(
item
=>
{
const
pId
=
item
[
parentId
];
return
!
pId
||
pId
===
null
||
pId
===
0
||
String
(
pId
)
===
'0'
||
String
(
pId
)
===
''
;
}
)
const
addChildren
=
(
parent
)
=>
{
// 使用字符串比较查找子节点,确保类型一致性
const
childNodes
=
data
.
filter
(
item
=>
{
return
String
(
item
[
parentId
])
===
String
(
parent
[
id
]);
}
)
if
(
childNodes
.
length
>
0
)
{
// 初始化显示全部数据或当前节点数据
parent
[
children
]
=
childNodes
if
(
!
this
.
currentNodeId
)
{
childNodes
.
forEach
(
child
=>
addChildren
(
child
))
this
.
currentTreeNodeData
=
this
.
buildTree
(
this
.
materials_categoryList
);
}
}
else
{
const
rootNode
=
this
.
findRootNode
(
this
.
currentNodeId
,
this
.
categoryOptions
);
if
(
rootNode
)
this
.
filterRootBranchData
(
rootNode
.
sid
);
}
}
rootNodes
.
forEach
(
root
=>
addChildren
(
root
))
this
.
loading
=
false
;
return
rootNodes
this
.
$emit
(
"list-loaded"
,
{
list
:
response
.
rows
,
total
:
response
.
rows
.
length
}
);
}
);
}
,
}
,
/** 搜索按钮操作 */
/** 搜索按钮操作 */
handleQuery
()
{
handleQuery
()
{
this
.
currentNodeId
=
null
// 搜索时清除当前选中的节点
this
.
currentNodeId
=
null
;
this
.
getList
()
this
.
getList
()
;
}
,
}
,
/** 重置搜索条件 */
/** 重置搜索条件 */
resetQuery
()
{
resetQuery
()
{
this
.
$refs
[
"queryRef"
].
resetFields
()
this
.
$refs
[
"queryRef"
].
resetFields
()
;
this
.
queryParams
=
{
this
.
queryParams
=
{
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
1000
,
pageSize
:
1000
,
categoryCode
:
null
,
categoryCode
:
null
,
categoryName
:
null
,
categoryName
:
null
,
sortNo
:
null
,
createTime
:
null
,
updateTime
:
null
,
parentId
:
null
,
parentId
:
null
,
isUsed
:
1
,
...
this
.
initQuery
...
this
.
initQuery
}
}
;
// 重置时清除当前选中的节点
this
.
currentNodeId
=
null
;
this
.
currentNodeId
=
null
if
(
this
.
$refs
.
treeComponent
?.
resetTree
)
{
// 重置左侧树的选择状态
if
(
this
.
$refs
.
treeComponent
&&
this
.
$refs
.
treeComponent
.
resetTree
)
{
this
.
$refs
.
treeComponent
.
resetTree
();
this
.
$refs
.
treeComponent
.
resetTree
();
}
}
this
.
getList
()
this
.
getList
()
;
}
,
}
,
/** 展开/折叠操作 */
/** 展开/折叠操作 */
/** 展开/折叠操作 */
toggleExpandAll
()
{
toggleExpandAll
()
{
this
.
refreshTable
=
false
this
.
isExpandAll
=
!
this
.
isExpandAll
;
this
.
isExpandAll
=
!
this
.
isExpandAll
this
.
$nextTick
(()
=>
{
this
.
refreshTable
=
true
// 手动设置展开/折叠
const
treeTable
=
this
.
$refs
.
treeTable
;
const
treeTable
=
this
.
$refs
.
treeTable
;
if
(
treeTable
&&
treeTable
.
store
)
{
if
(
!
treeTable
)
return
;
Object
.
keys
(
treeTable
.
store
.
nodesMap
).
forEach
(
key
=>
{
const
node
=
treeTable
.
store
.
nodesMap
[
key
];
// 递归处理所有节点的展开/折叠
if
(
node
&&
node
.
expandable
)
{
const
toggleNodes
=
(
data
,
expand
)
=>
{
node
.
expanded
=
this
.
isExpandAll
;
data
.
forEach
(
item
=>
{
// 切换当前节点展开状态
treeTable
.
toggleRowExpansion
(
item
,
expand
);
// 递归处理子节点
if
(
item
.
children
&&
item
.
children
.
length
)
{
toggleNodes
(
item
.
children
,
expand
);
}
}
}
);
}
);
}
}
;
}
)
// 从根节点开始处理
this
.
$nextTick
(()
=>
{
toggleNodes
(
this
.
currentTreeNodeData
,
this
.
isExpandAll
);
}
);
}
,
}
,
/** 多选框选中事件 */
/** 多选框选中事件 */
handleSelectionChange
(
selection
)
{
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
);
this
.
single
=
selection
.
length
!==
1
this
.
single
=
selection
.
length
!==
1
;
this
.
multiple
=
!
selection
.
length
this
.
multiple
=
!
selection
.
length
;
this
.
$emit
(
"selection-change"
,
selection
)
}
,
}
,
/** 新增按钮操作 */
/** 新增按钮操作 */
...
@@ -699,23 +541,23 @@ export default {
...
@@ -699,23 +541,23 @@ export default {
categoryCode
:
null
,
categoryCode
:
null
,
categoryName
:
null
,
categoryName
:
null
,
sortNo
:
null
,
sortNo
:
null
,
createUserCode
:
null
,
updateUserCode
:
null
,
parentId
:
parentId
||
null
,
parentId
:
parentId
||
null
,
isUsed
:
1
isUsed
:
1
}
}
;
this
.
dialogOpen
=
true
this
.
dialogOpen
=
true
;
this
.
$emit
(
"dialog-open"
,
{
type
:
"add"
,
form
:
this
.
form
}
)
this
.
$emit
(
"dialog-open"
,
{
type
:
"add"
,
form
:
this
.
form
}
)
;
}
,
}
,
/** 修改按钮操作 */
/** 修改按钮操作 */
handleUpdate
(
row
)
{
handleUpdate
(
row
)
{
const
_id
=
row
?
row
.
id
:
this
.
ids
console
.
log
(
row
)
const
_id
=
row
?
row
.
id
:
this
.
ids
;
console
.
log
(
_id
)
getMaterials_category
(
_id
).
then
(
response
=>
{
getMaterials_category
(
_id
).
then
(
response
=>
{
this
.
form
=
response
.
data
this
.
form
=
response
.
data
;
this
.
dialogOpen
=
true
this
.
dialogOpen
=
true
;
this
.
$emit
(
"dialog-open"
,
{
type
:
"edit"
,
form
:
this
.
form
}
)
this
.
$emit
(
"dialog-open"
,
{
type
:
"edit"
,
form
:
this
.
form
}
)
;
}
)
}
)
;
}
,
}
,
/** 提交表单 */
/** 提交表单 */
...
@@ -724,95 +566,76 @@ export default {
...
@@ -724,95 +566,76 @@ export default {
if
(
valid
)
{
if
(
valid
)
{
const
submitPromise
=
this
.
form
.
id
const
submitPromise
=
this
.
form
.
id
?
updateMaterials_category
(
this
.
form
)
?
updateMaterials_category
(
this
.
form
)
:
addMaterials_category
(
this
.
form
)
:
addMaterials_category
(
this
.
form
);
submitPromise
.
then
(
response
=>
{
const
type
=
this
.
form
.
id
?
"update"
:
"add"
this
.
$modal
.
msgSuccess
(
`${type === "add" ? "新增" : "修改"
}
成功`
)
this
.
dialogOpen
=
false
// 保存当前节点ID,用于数据重新加载后恢复选择
submitPromise
.
then
(()
=>
{
const
currentNodeIdBeforeReload
=
this
.
currentNodeId
;
const
type
=
this
.
form
.
id
?
"update"
:
"add"
;
const
isAddChild
=
type
===
"add"
&&
this
.
form
.
parentId
;
this
.
$modal
.
msgSuccess
(
`${type === "add" ? "新增" : "修改"
}
成功`
);
this
.
dialogOpen
=
false
;
// 重新加载数据
// 重新加载数据
Promise
.
all
([
Promise
.
all
([
// 先重新加载树数据
this
.
getCategoryOptions
(),
new
Promise
(
resolve
=>
{
this
.
getCategoryOptions
();
// 延迟一下确保树数据加载完成
setTimeout
(()
=>
resolve
(),
100
);
}
),
// 再重新加载列表数据
new
Promise
(
resolve
=>
{
new
Promise
(
resolve
=>
{
this
.
getList
();
this
.
getList
();
// 延迟一下确保列表数据加载完成
setTimeout
(
resolve
,
100
);
setTimeout
(()
=>
resolve
(),
100
);
}
)
}
)
]).
then
(()
=>
{
]).
then
(()
=>
{
// 数据加载完成后,恢复或更新选择
if
(
type
===
"add"
&&
this
.
form
.
parentId
)
{
this
.
$nextTick
(()
=>
{
if
(
isAddChild
)
{
// 新增下级后,选择父节点
this
.
selectTreeNode
(
this
.
form
.
parentId
);
this
.
selectTreeNode
(
this
.
form
.
parentId
);
}
else
if
(
currentNodeIdBeforeReload
)
{
}
else
if
(
this
.
currentNodeId
)
{
// 修改后,保持当前选择
this
.
selectTreeNode
(
this
.
currentNodeId
);
this
.
selectTreeNode
(
currentNodeIdBeforeReload
);
}
}
}
);
}
);
}
);
this
.
$emit
(
"form-submit"
,
{
this
.
$emit
(
"form-submit"
,
{
type
,
data
:
this
.
form
}
);
type
,
}
);
data
:
this
.
form
,
response
}
)
}
)
}
}
}
)
}
)
;
}
,
}
,
/** 删除操作 */
/** 删除操作 */
handleDelete
(
row
)
{
handleDelete
(
row
)
{
const
_ids
=
row
?
row
.
id
:
this
.
ids
const
_code
=
row
?
row
.
categoryCode
:
this
.
ids
;
this
.
$modal
.
confirm
(
`是否确认删除物料分类编号为"${_ids
}
"的数据项?`
).
then
(()
=>
{
this
.
$modal
.
confirm
(
`是否确认删除物料分类编码为"${_code
}
"的数据项?`
).
then
(()
=>
{
return
delMaterials_category
(
_ids
)
delMaterials_category
(
_ids
).
then
(()
=>
{
}
).
then
(()
=>
{
this
.
getList
();
// 重新加载数据
this
.
getCategoryOptions
();
this
.
getList
()
this
.
$modal
.
msgSuccess
(
"删除成功"
);
this
.
getCategoryOptions
()
this
.
$emit
(
"item-delete"
,
{
ids
:
_ids
}
);
this
.
$modal
.
msgSuccess
(
"删除成功"
)
}
);
this
.
$emit
(
"item-delete"
,
{
ids
:
_ids
}
)
}
);
}
).
catch
(()
=>
{
}
)
}
,
}
,
/** 导出操作 */
/** 导出操作 */
handleExport
()
{
handleExport
()
{
this
.
download
(
'inventory/materials_category/export'
,
{
this
.
download
(
'inventory/materials_category/export'
,
{
...
this
.
queryParams
...
this
.
queryParams
}
,
`materials_category_${new Date().getTime()
}
.xlsx`
)
}
,
`materials_category_${new Date().getTime()
}
.xlsx`
)
;
this
.
$emit
(
"export-data"
,
this
.
queryParams
)
this
.
$emit
(
"export-data"
,
this
.
queryParams
)
;
}
,
}
,
/** 对话框关闭事件 */
/** 对话框关闭事件 */
handleDialogClose
()
{
handleDialogClose
()
{
this
.
$refs
[
"materials_categoryRef"
]?.
resetFields
()
this
.
dialogOpen
=
false
this
.
$emit
(
"dialog-close"
)
this
.
$emit
(
"dialog-close"
)
;
}
,
}
,
/** 表单重置 */
/** 选择指定树节点 */
resetForm
()
{
selectTreeNode
(
nodeId
)
{
this
.
form
=
{
const
findNode
=
(
nodes
)
=>
{
id
:
null
,
for
(
const
node
of
nodes
)
{
categoryCode
:
null
,
if
(
String
(
node
.
sid
)
===
String
(
nodeId
))
return
node
;
categoryName
:
null
,
if
(
node
.
children
)
{
sortNo
:
null
,
const
found
=
findNode
(
node
.
children
);
createUserCode
:
null
,
if
(
found
)
return
found
;
updateUserCode
:
null
,
}
parentId
:
null
,
isUsed
:
1
}
}
this
.
$refs
[
"materials_categoryRef"
]?.
resetFields
()
return
null
;
}
;
const
treeNode
=
findNode
(
this
.
categoryOptions
);
if
(
treeNode
)
this
.
handleTreeClick
(
treeNode
);
}
}
}
}
}
}
...
@@ -827,7 +650,6 @@ export default {
...
@@ -827,7 +650,6 @@ export default {
margin
-
bottom
:
8
px
;
margin
-
bottom
:
8
px
;
}
}
/* 添加滚动条样式 */
.
el
-
table
{
.
el
-
table
{
max
-
height
:
100
%
;
max
-
height
:
100
%
;
overflow
-
y
:
auto
;
overflow
-
y
:
auto
;
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/InboundOrderItemsController.java
0 → 100644
View file @
6d104f90
package
com
.
ruoyi
.
web
.
controller
.
inventory
;
import
java.util.List
;
import
java.util.UUID
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.inventory.domain.InboundOrderItems
;
import
com.ruoyi.inventory.service.IInboundOrderItemsService
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.common.core.page.TableDataInfo
;
/**
* 入库单明细Controller
*
* @author ruoyi
* @date 2025-12-02
*/
@RestController
@RequestMapping
(
"/inventory/inbound_items"
)
public
class
InboundOrderItemsController
extends
BaseController
{
@Autowired
private
IInboundOrderItemsService
inboundOrderItemsService
;
/**
* 查询入库单明细列表
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound_items:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
InboundOrderItems
inboundOrderItems
)
{
startPage
();
List
<
InboundOrderItems
>
list
=
inboundOrderItemsService
.
selectInboundOrderItemsList
(
inboundOrderItems
);
return
getDataTable
(
list
);
}
/**
* 导出入库单明细列表
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound_items:export')"
)
@Log
(
title
=
"入库单明细"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
InboundOrderItems
inboundOrderItems
)
{
List
<
InboundOrderItems
>
list
=
inboundOrderItemsService
.
selectInboundOrderItemsList
(
inboundOrderItems
);
ExcelUtil
<
InboundOrderItems
>
util
=
new
ExcelUtil
<
InboundOrderItems
>(
InboundOrderItems
.
class
);
util
.
exportExcel
(
response
,
list
,
"入库单明细数据"
);
}
/**
* 获取入库单明细详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound_items:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
{
return
success
(
inboundOrderItemsService
.
selectInboundOrderItemsById
(
id
));
}
/**
* 新增入库单明细
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound_items:add')"
)
@Log
(
title
=
"入库单明细"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
InboundOrderItems
inboundOrderItems
)
{
inboundOrderItems
.
setId
(
UUID
.
randomUUID
().
toString
());
System
.
out
.
println
(
inboundOrderItems
.
toString
());
return
toAjax
(
inboundOrderItemsService
.
insertInboundOrderItems
(
inboundOrderItems
));
}
/**
* 修改入库单明细
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound_items:edit')"
)
@Log
(
title
=
"入库单明细"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
InboundOrderItems
inboundOrderItems
)
{
return
toAjax
(
inboundOrderItemsService
.
updateInboundOrderItems
(
inboundOrderItems
));
}
/**
* 删除入库单明细
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound_items:remove')"
)
@Log
(
title
=
"入库单明细"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
String
[]
ids
)
{
return
toAjax
(
inboundOrderItemsService
.
deleteInboundOrderItemsByIds
(
ids
));
}
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/InboundOrdersController.java
0 → 100644
View file @
6d104f90
package
com
.
ruoyi
.
web
.
controller
.
inventory
;
import
java.util.List
;
import
com.ruoyi.common.utils.uuid.UUID
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.inventory.domain.InboundOrders
;
import
com.ruoyi.inventory.service.IInboundOrdersService
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.common.core.page.TableDataInfo
;
/**
* 入库单主Controller
*
* @author ruoyi
* @date 2025-12-02
*/
@RestController
@RequestMapping
(
"/inventory/inbound"
)
public
class
InboundOrdersController
extends
BaseController
{
@Autowired
private
IInboundOrdersService
inboundOrdersService
;
/**
* 查询入库单主列表
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
InboundOrders
inboundOrders
)
{
startPage
();
List
<
InboundOrders
>
list
=
inboundOrdersService
.
selectInboundOrdersList
(
inboundOrders
);
return
getDataTable
(
list
);
}
/**
* 导出入库单主列表
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound:export')"
)
@Log
(
title
=
"入库单主"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
InboundOrders
inboundOrders
)
{
List
<
InboundOrders
>
list
=
inboundOrdersService
.
selectInboundOrdersList
(
inboundOrders
);
ExcelUtil
<
InboundOrders
>
util
=
new
ExcelUtil
<
InboundOrders
>(
InboundOrders
.
class
);
util
.
exportExcel
(
response
,
list
,
"入库单主数据"
);
}
/**
* 获取入库单主详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
{
return
success
(
inboundOrdersService
.
selectInboundOrdersById
(
id
));
}
/**
* 新增入库单主
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound:add')"
)
@Log
(
title
=
"入库单主"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
InboundOrders
inboundOrders
)
{
inboundOrders
.
setId
(
UUID
.
randomUUID
().
toString
());
return
toAjax
(
inboundOrdersService
.
insertInboundOrders
(
inboundOrders
));
}
/**
* 修改入库单主
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound:edit')"
)
@Log
(
title
=
"入库单主"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
InboundOrders
inboundOrders
)
{
return
toAjax
(
inboundOrdersService
.
updateInboundOrders
(
inboundOrders
));
}
/**
* 删除入库单主
*/
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound:remove')"
)
@Log
(
title
=
"入库单主"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
String
[]
ids
)
{
return
toAjax
(
inboundOrdersService
.
deleteInboundOrdersByIds
(
ids
));
}
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/InboundOrderItems.java
0 → 100644
View file @
6d104f90
package
com
.
ruoyi
.
inventory
.
domain
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.ruoyi.common.annotation.Excel
;
import
com.ruoyi.common.core.domain.BaseEntity
;
/**
* 入库单明细对象 inbound_order_items
*
* @author ruoyi
* @date 2025-12-02
*/
public
class
InboundOrderItems
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 编号 */
private
String
id
;
/** 入库单号 检索条件 */
@Excel
(
name
=
"入库单号"
)
private
String
orderId
;
/** 货物ID 字典,检索条件 */
@Excel
(
name
=
"货物ID"
)
private
String
materialId
;
/** 批次ID 检索条件 */
@Excel
(
name
=
"批次ID"
)
private
String
batchId
;
/** 仓库ID 检索条件 */
@Excel
(
name
=
"仓库ID"
)
private
String
warehouseId
;
/** 库位ID 检索条件 */
@Excel
(
name
=
"库位ID"
)
private
String
locationId
;
/** 计划数量 */
@Excel
(
name
=
"计划数量"
)
private
Long
plannedQuantity
;
/** 实际数量 */
@Excel
(
name
=
"实际数量"
)
private
Long
actualQuantity
;
/** 计划件数 暂无用 */
@Excel
(
name
=
"计划件数"
)
private
Long
plannedPackages
;
/** 实际件数 */
@Excel
(
name
=
"实际件数"
)
private
Long
actualPackages
;
/** 约数 */
@Excel
(
name
=
"约数"
)
private
Long
divisor
;
/** 标签颜色 字典,检索条件 */
@Excel
(
name
=
"标签颜色"
)
private
Long
labelColor
;
/** 凭证号 检索条件 */
@Excel
(
name
=
"凭证号"
)
private
String
voucherNumber
;
/** 单价 */
@Excel
(
name
=
"单价"
)
private
Long
unitPrice
;
/** 状态1-待收货 2-部分收货 3-已完成 暂无用 */
@Excel
(
name
=
"状态"
)
private
Long
itemStatus
;
/** 收货时间 暂无用 */
@Excel
(
name
=
"收货时间"
)
private
Long
receivedAt
;
/** 收货人 */
@Excel
(
name
=
"收货人"
)
private
String
receivedBy
;
/** 应用数据1使用0删除 删除用 */
@Excel
(
name
=
"应用数据"
)
private
Long
isUsed
;
/** 排序 */
@Excel
(
name
=
"排序"
)
private
Long
sortNo
;
/** 创建日期 */
@Excel
(
name
=
"创建日期"
)
private
String
createUserCode
;
/** 排序号 */
@Excel
(
name
=
"排序号"
)
private
String
updateUserCode
;
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getId
()
{
return
id
;
}
public
void
setOrderId
(
String
orderId
)
{
this
.
orderId
=
orderId
;
}
public
String
getOrderId
()
{
return
orderId
;
}
public
void
setMaterialId
(
String
materialId
)
{
this
.
materialId
=
materialId
;
}
public
String
getMaterialId
()
{
return
materialId
;
}
public
void
setBatchId
(
String
batchId
)
{
this
.
batchId
=
batchId
;
}
public
String
getBatchId
()
{
return
batchId
;
}
public
void
setWarehouseId
(
String
warehouseId
)
{
this
.
warehouseId
=
warehouseId
;
}
public
String
getWarehouseId
()
{
return
warehouseId
;
}
public
void
setLocationId
(
String
locationId
)
{
this
.
locationId
=
locationId
;
}
public
String
getLocationId
()
{
return
locationId
;
}
public
void
setPlannedQuantity
(
Long
plannedQuantity
)
{
this
.
plannedQuantity
=
plannedQuantity
;
}
public
Long
getPlannedQuantity
()
{
return
plannedQuantity
;
}
public
void
setActualQuantity
(
Long
actualQuantity
)
{
this
.
actualQuantity
=
actualQuantity
;
}
public
Long
getActualQuantity
()
{
return
actualQuantity
;
}
public
void
setPlannedPackages
(
Long
plannedPackages
)
{
this
.
plannedPackages
=
plannedPackages
;
}
public
Long
getPlannedPackages
()
{
return
plannedPackages
;
}
public
void
setActualPackages
(
Long
actualPackages
)
{
this
.
actualPackages
=
actualPackages
;
}
public
Long
getActualPackages
()
{
return
actualPackages
;
}
public
void
setDivisor
(
Long
divisor
)
{
this
.
divisor
=
divisor
;
}
public
Long
getDivisor
()
{
return
divisor
;
}
public
void
setLabelColor
(
Long
labelColor
)
{
this
.
labelColor
=
labelColor
;
}
public
Long
getLabelColor
()
{
return
labelColor
;
}
public
void
setVoucherNumber
(
String
voucherNumber
)
{
this
.
voucherNumber
=
voucherNumber
;
}
public
String
getVoucherNumber
()
{
return
voucherNumber
;
}
public
void
setUnitPrice
(
Long
unitPrice
)
{
this
.
unitPrice
=
unitPrice
;
}
public
Long
getUnitPrice
()
{
return
unitPrice
;
}
public
void
setItemStatus
(
Long
itemStatus
)
{
this
.
itemStatus
=
itemStatus
;
}
public
Long
getItemStatus
()
{
return
itemStatus
;
}
public
void
setReceivedAt
(
Long
receivedAt
)
{
this
.
receivedAt
=
receivedAt
;
}
public
Long
getReceivedAt
()
{
return
receivedAt
;
}
public
void
setReceivedBy
(
String
receivedBy
)
{
this
.
receivedBy
=
receivedBy
;
}
public
String
getReceivedBy
()
{
return
receivedBy
;
}
public
void
setIsUsed
(
Long
isUsed
)
{
this
.
isUsed
=
isUsed
;
}
public
Long
getIsUsed
()
{
return
isUsed
;
}
public
void
setSortNo
(
Long
sortNo
)
{
this
.
sortNo
=
sortNo
;
}
public
Long
getSortNo
()
{
return
sortNo
;
}
public
void
setCreateUserCode
(
String
createUserCode
)
{
this
.
createUserCode
=
createUserCode
;
}
public
String
getCreateUserCode
()
{
return
createUserCode
;
}
public
void
setUpdateUserCode
(
String
updateUserCode
)
{
this
.
updateUserCode
=
updateUserCode
;
}
public
String
getUpdateUserCode
()
{
return
updateUserCode
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"orderId"
,
getOrderId
())
.
append
(
"materialId"
,
getMaterialId
())
.
append
(
"batchId"
,
getBatchId
())
.
append
(
"warehouseId"
,
getWarehouseId
())
.
append
(
"locationId"
,
getLocationId
())
.
append
(
"plannedQuantity"
,
getPlannedQuantity
())
.
append
(
"actualQuantity"
,
getActualQuantity
())
.
append
(
"plannedPackages"
,
getPlannedPackages
())
.
append
(
"actualPackages"
,
getActualPackages
())
.
append
(
"divisor"
,
getDivisor
())
.
append
(
"labelColor"
,
getLabelColor
())
.
append
(
"voucherNumber"
,
getVoucherNumber
())
.
append
(
"unitPrice"
,
getUnitPrice
())
.
append
(
"itemStatus"
,
getItemStatus
())
.
append
(
"receivedAt"
,
getReceivedAt
())
.
append
(
"receivedBy"
,
getReceivedBy
())
.
append
(
"remark"
,
getRemark
())
.
append
(
"isUsed"
,
getIsUsed
())
.
append
(
"sortNo"
,
getSortNo
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"createUserCode"
,
getCreateUserCode
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"updateUserCode"
,
getUpdateUserCode
())
.
toString
();
}
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/InboundOrders.java
0 → 100644
View file @
6d104f90
package
com
.
ruoyi
.
inventory
.
domain
;
import
java.util.List
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.ruoyi.common.annotation.Excel
;
import
com.ruoyi.common.core.domain.BaseEntity
;
/**
* 入库单主对象 inbound_orders
*
* @author ruoyi
* @date 2025-12-02
*/
public
class
InboundOrders
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 编号 */
private
String
id
;
/** 入库单号 检索条件 */
@Excel
(
name
=
"入库单号 检索条件"
)
private
String
orderId
;
/** 系统编号 检索条件 */
@Excel
(
name
=
"系统编号 检索条件"
)
private
String
systemNo
;
/** 入库类型 字典,检索条件 */
@Excel
(
name
=
"入库类型 字典,检索条件"
)
private
String
orderTypeId
;
/** 批次ID 检索条件 */
@Excel
(
name
=
"批次ID 检索条件"
)
private
String
batchCode
;
/** 仓库ID 暂无用 */
@Excel
(
name
=
"仓库ID 暂无用"
)
private
String
warehouseId
;
/** 货主ID */
@Excel
(
name
=
"货主ID"
)
private
String
ownerId
;
/** 入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件 */
@Excel
(
name
=
"入库单状态1-草稿 2-已完成 3-已取消 字典,检索条件"
)
private
Long
orderStatus
;
/** 入库日期 日期无时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"入库日期 日期无时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
inboundDate
;
/** 订单类型 字典,检索条件 */
@Excel
(
name
=
"订单类型 字典,检索条件"
)
private
String
orderType
;
/** 计划量 暂无用 */
@Excel
(
name
=
"计划量 暂无用"
)
private
Long
totalPlannedQuantity
;
/** 实际量 暂无用 */
@Excel
(
name
=
"实际量 暂无用"
)
private
Long
totalActualQuantity
;
/** 总件数 暂无用 */
@Excel
(
name
=
"总件数 暂无用"
)
private
Long
totalPackages
;
/** 负责人 暂无用 */
@Excel
(
name
=
"负责人 暂无用"
)
private
String
opUserName
;
/** 应用数据1使用0删除 删除用 */
@Excel
(
name
=
"应用数据1使用0删除 删除用"
)
private
Long
isUsed
;
/** 排序 */
@Excel
(
name
=
"排序"
)
private
Long
sortNo
;
/** 创建日期 */
@Excel
(
name
=
"创建日期"
)
private
String
createUserCode
;
/** 排序号 */
@Excel
(
name
=
"排序号"
)
private
String
updateUserCode
;
/** 入库单明细信息 */
private
List
<
InboundOrderItems
>
inboundOrderItemsList
;
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getId
()
{
return
id
;
}
public
void
setOrderId
(
String
orderId
)
{
this
.
orderId
=
orderId
;
}
public
String
getOrderId
()
{
return
orderId
;
}
public
void
setSystemNo
(
String
systemNo
)
{
this
.
systemNo
=
systemNo
;
}
public
String
getSystemNo
()
{
return
systemNo
;
}
public
void
setOrderTypeId
(
String
orderTypeId
)
{
this
.
orderTypeId
=
orderTypeId
;
}
public
String
getOrderTypeId
()
{
return
orderTypeId
;
}
public
void
setBatchCode
(
String
batchCode
)
{
this
.
batchCode
=
batchCode
;
}
public
String
getBatchCode
()
{
return
batchCode
;
}
public
void
setWarehouseId
(
String
warehouseId
)
{
this
.
warehouseId
=
warehouseId
;
}
public
String
getWarehouseId
()
{
return
warehouseId
;
}
public
void
setOwnerId
(
String
ownerId
)
{
this
.
ownerId
=
ownerId
;
}
public
String
getOwnerId
()
{
return
ownerId
;
}
public
void
setOrderStatus
(
Long
orderStatus
)
{
this
.
orderStatus
=
orderStatus
;
}
public
Long
getOrderStatus
()
{
return
orderStatus
;
}
public
void
setInboundDate
(
Date
inboundDate
)
{
this
.
inboundDate
=
inboundDate
;
}
public
Date
getInboundDate
()
{
return
inboundDate
;
}
public
void
setOrderType
(
String
orderType
)
{
this
.
orderType
=
orderType
;
}
public
String
getOrderType
()
{
return
orderType
;
}
public
void
setTotalPlannedQuantity
(
Long
totalPlannedQuantity
)
{
this
.
totalPlannedQuantity
=
totalPlannedQuantity
;
}
public
Long
getTotalPlannedQuantity
()
{
return
totalPlannedQuantity
;
}
public
void
setTotalActualQuantity
(
Long
totalActualQuantity
)
{
this
.
totalActualQuantity
=
totalActualQuantity
;
}
public
Long
getTotalActualQuantity
()
{
return
totalActualQuantity
;
}
public
void
setTotalPackages
(
Long
totalPackages
)
{
this
.
totalPackages
=
totalPackages
;
}
public
Long
getTotalPackages
()
{
return
totalPackages
;
}
public
void
setOpUserName
(
String
opUserName
)
{
this
.
opUserName
=
opUserName
;
}
public
String
getOpUserName
()
{
return
opUserName
;
}
public
void
setIsUsed
(
Long
isUsed
)
{
this
.
isUsed
=
isUsed
;
}
public
Long
getIsUsed
()
{
return
isUsed
;
}
public
void
setSortNo
(
Long
sortNo
)
{
this
.
sortNo
=
sortNo
;
}
public
Long
getSortNo
()
{
return
sortNo
;
}
public
void
setCreateUserCode
(
String
createUserCode
)
{
this
.
createUserCode
=
createUserCode
;
}
public
String
getCreateUserCode
()
{
return
createUserCode
;
}
public
void
setUpdateUserCode
(
String
updateUserCode
)
{
this
.
updateUserCode
=
updateUserCode
;
}
public
String
getUpdateUserCode
()
{
return
updateUserCode
;
}
public
List
<
InboundOrderItems
>
getInboundOrderItemsList
()
{
return
inboundOrderItemsList
;
}
public
void
setInboundOrderItemsList
(
List
<
InboundOrderItems
>
inboundOrderItemsList
)
{
this
.
inboundOrderItemsList
=
inboundOrderItemsList
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"orderId"
,
getOrderId
())
.
append
(
"systemNo"
,
getSystemNo
())
.
append
(
"orderTypeId"
,
getOrderTypeId
())
.
append
(
"batchCode"
,
getBatchCode
())
.
append
(
"warehouseId"
,
getWarehouseId
())
.
append
(
"ownerId"
,
getOwnerId
())
.
append
(
"orderStatus"
,
getOrderStatus
())
.
append
(
"inboundDate"
,
getInboundDate
())
.
append
(
"orderType"
,
getOrderType
())
.
append
(
"totalPlannedQuantity"
,
getTotalPlannedQuantity
())
.
append
(
"totalActualQuantity"
,
getTotalActualQuantity
())
.
append
(
"totalPackages"
,
getTotalPackages
())
.
append
(
"remark"
,
getRemark
())
.
append
(
"opUserName"
,
getOpUserName
())
.
append
(
"isUsed"
,
getIsUsed
())
.
append
(
"sortNo"
,
getSortNo
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"createUserCode"
,
getCreateUserCode
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"updateUserCode"
,
getUpdateUserCode
())
.
append
(
"inboundOrderItemsList"
,
getInboundOrderItemsList
())
.
toString
();
}
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/InboundOrderItemsMapper.java
0 → 100644
View file @
6d104f90
package
com
.
ruoyi
.
inventory
.
mapper
;
import
java.util.List
;
import
com.ruoyi.inventory.domain.InboundOrderItems
;
/**
* 入库单明细Mapper接口
*
* @author ruoyi
* @date 2025-12-02
*/
public
interface
InboundOrderItemsMapper
{
/**
* 查询入库单明细
*
* @param id 入库单明细主键
* @return 入库单明细
*/
public
InboundOrderItems
selectInboundOrderItemsById
(
String
id
);
/**
* 查询入库单明细列表
*
* @param inboundOrderItems 入库单明细
* @return 入库单明细集合
*/
public
List
<
InboundOrderItems
>
selectInboundOrderItemsList
(
InboundOrderItems
inboundOrderItems
);
/**
* 新增入库单明细
*
* @param inboundOrderItems 入库单明细
* @return 结果
*/
public
int
insertInboundOrderItems
(
InboundOrderItems
inboundOrderItems
);
/**
* 修改入库单明细
*
* @param inboundOrderItems 入库单明细
* @return 结果
*/
public
int
updateInboundOrderItems
(
InboundOrderItems
inboundOrderItems
);
/**
* 删除入库单明细
*
* @param id 入库单明细主键
* @return 结果
*/
public
int
deleteInboundOrderItemsById
(
String
id
);
/**
* 批量删除入库单明细
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteInboundOrderItemsByIds
(
String
[]
ids
);
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/InboundOrdersMapper.java
0 → 100644
View file @
6d104f90
package
com
.
ruoyi
.
inventory
.
mapper
;
import
java.util.List
;
import
com.ruoyi.inventory.domain.InboundOrders
;
import
com.ruoyi.inventory.domain.InboundOrderItems
;
/**
* 入库单主Mapper接口
*
* @author ruoyi
* @date 2025-12-02
*/
public
interface
InboundOrdersMapper
{
/**
* 查询入库单主
*
* @param id 入库单主主键
* @return 入库单主
*/
public
InboundOrders
selectInboundOrdersById
(
String
id
);
/**
* 查询入库单主列表
*
* @param inboundOrders 入库单主
* @return 入库单主集合
*/
public
List
<
InboundOrders
>
selectInboundOrdersList
(
InboundOrders
inboundOrders
);
/**
* 新增入库单主
*
* @param inboundOrders 入库单主
* @return 结果
*/
public
int
insertInboundOrders
(
InboundOrders
inboundOrders
);
/**
* 修改入库单主
*
* @param inboundOrders 入库单主
* @return 结果
*/
public
int
updateInboundOrders
(
InboundOrders
inboundOrders
);
/**
* 删除入库单主
*
* @param id 入库单主主键
* @return 结果
*/
public
int
deleteInboundOrdersById
(
String
id
);
/**
* 批量删除入库单主
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteInboundOrdersByIds
(
String
[]
ids
);
/**
* 批量删除入库单明细
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteInboundOrderItemsByOrderIds
(
String
[]
ids
);
/**
* 批量新增入库单明细
*
* @param inboundOrderItemsList 入库单明细列表
* @return 结果
*/
public
int
batchInboundOrderItems
(
List
<
InboundOrderItems
>
inboundOrderItemsList
);
/**
* 通过入库单主主键删除入库单明细信息
*
* @param id 入库单主ID
* @return 结果
*/
public
int
deleteInboundOrderItemsByOrderId
(
String
id
);
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IInboundOrderItemsService.java
0 → 100644
View file @
6d104f90
package
com
.
ruoyi
.
inventory
.
service
;
import
java.util.List
;
import
com.ruoyi.inventory.domain.InboundOrderItems
;
/**
* 入库单明细Service接口
*
* @author ruoyi
* @date 2025-12-02
*/
public
interface
IInboundOrderItemsService
{
/**
* 查询入库单明细
*
* @param id 入库单明细主键
* @return 入库单明细
*/
public
InboundOrderItems
selectInboundOrderItemsById
(
String
id
);
/**
* 查询入库单明细列表
*
* @param inboundOrderItems 入库单明细
* @return 入库单明细集合
*/
public
List
<
InboundOrderItems
>
selectInboundOrderItemsList
(
InboundOrderItems
inboundOrderItems
);
/**
* 新增入库单明细
*
* @param inboundOrderItems 入库单明细
* @return 结果
*/
public
int
insertInboundOrderItems
(
InboundOrderItems
inboundOrderItems
);
/**
* 修改入库单明细
*
* @param inboundOrderItems 入库单明细
* @return 结果
*/
public
int
updateInboundOrderItems
(
InboundOrderItems
inboundOrderItems
);
/**
* 批量删除入库单明细
*
* @param ids 需要删除的入库单明细主键集合
* @return 结果
*/
public
int
deleteInboundOrderItemsByIds
(
String
[]
ids
);
/**
* 删除入库单明细信息
*
* @param id 入库单明细主键
* @return 结果
*/
public
int
deleteInboundOrderItemsById
(
String
id
);
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IInboundOrdersService.java
0 → 100644
View file @
6d104f90
package
com
.
ruoyi
.
inventory
.
service
;
import
java.util.List
;
import
com.ruoyi.inventory.domain.InboundOrders
;
/**
* 入库单主Service接口
*
* @author ruoyi
* @date 2025-12-02
*/
public
interface
IInboundOrdersService
{
/**
* 查询入库单主
*
* @param id 入库单主主键
* @return 入库单主
*/
public
InboundOrders
selectInboundOrdersById
(
String
id
);
/**
* 查询入库单主列表
*
* @param inboundOrders 入库单主
* @return 入库单主集合
*/
public
List
<
InboundOrders
>
selectInboundOrdersList
(
InboundOrders
inboundOrders
);
/**
* 新增入库单主
*
* @param inboundOrders 入库单主
* @return 结果
*/
public
int
insertInboundOrders
(
InboundOrders
inboundOrders
);
/**
* 修改入库单主
*
* @param inboundOrders 入库单主
* @return 结果
*/
public
int
updateInboundOrders
(
InboundOrders
inboundOrders
);
/**
* 批量删除入库单主
*
* @param ids 需要删除的入库单主主键集合
* @return 结果
*/
public
int
deleteInboundOrdersByIds
(
String
[]
ids
);
/**
* 删除入库单主信息
*
* @param id 入库单主主键
* @return 结果
*/
public
int
deleteInboundOrdersById
(
String
id
);
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/InboundOrderItemsServiceImpl.java
0 → 100644
View file @
6d104f90
package
com
.
ruoyi
.
inventory
.
service
.
impl
;
import
java.util.List
;
import
com.ruoyi.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.ruoyi.inventory.mapper.InboundOrderItemsMapper
;
import
com.ruoyi.inventory.domain.InboundOrderItems
;
import
com.ruoyi.inventory.service.IInboundOrderItemsService
;
/**
* 入库单明细Service业务层处理
*
* @author ruoyi
* @date 2025-12-02
*/
@Service
public
class
InboundOrderItemsServiceImpl
implements
IInboundOrderItemsService
{
@Autowired
private
InboundOrderItemsMapper
inboundOrderItemsMapper
;
/**
* 查询入库单明细
*
* @param id 入库单明细主键
* @return 入库单明细
*/
@Override
public
InboundOrderItems
selectInboundOrderItemsById
(
String
id
)
{
return
inboundOrderItemsMapper
.
selectInboundOrderItemsById
(
id
);
}
/**
* 查询入库单明细列表
*
* @param inboundOrderItems 入库单明细
* @return 入库单明细
*/
@Override
public
List
<
InboundOrderItems
>
selectInboundOrderItemsList
(
InboundOrderItems
inboundOrderItems
)
{
return
inboundOrderItemsMapper
.
selectInboundOrderItemsList
(
inboundOrderItems
);
}
/**
* 新增入库单明细
*
* @param inboundOrderItems 入库单明细
* @return 结果
*/
@Override
public
int
insertInboundOrderItems
(
InboundOrderItems
inboundOrderItems
)
{
inboundOrderItems
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
inboundOrderItemsMapper
.
insertInboundOrderItems
(
inboundOrderItems
);
}
/**
* 修改入库单明细
*
* @param inboundOrderItems 入库单明细
* @return 结果
*/
@Override
public
int
updateInboundOrderItems
(
InboundOrderItems
inboundOrderItems
)
{
inboundOrderItems
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
inboundOrderItemsMapper
.
updateInboundOrderItems
(
inboundOrderItems
);
}
/**
* 批量删除入库单明细
*
* @param ids 需要删除的入库单明细主键
* @return 结果
*/
@Override
public
int
deleteInboundOrderItemsByIds
(
String
[]
ids
)
{
return
inboundOrderItemsMapper
.
deleteInboundOrderItemsByIds
(
ids
);
}
/**
* 删除入库单明细信息
*
* @param id 入库单明细主键
* @return 结果
*/
@Override
public
int
deleteInboundOrderItemsById
(
String
id
)
{
return
inboundOrderItemsMapper
.
deleteInboundOrderItemsById
(
id
);
}
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/InboundOrdersServiceImpl.java
0 → 100644
View file @
6d104f90
package
com
.
ruoyi
.
inventory
.
service
.
impl
;
import
java.util.List
;
import
com.ruoyi.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.UUID
;
import
com.ruoyi.common.utils.StringUtils
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.ruoyi.inventory.domain.InboundOrderItems
;
import
com.ruoyi.inventory.mapper.InboundOrdersMapper
;
import
com.ruoyi.inventory.domain.InboundOrders
;
import
com.ruoyi.inventory.service.IInboundOrdersService
;
/**
* 入库单主Service业务层处理
*
* @author ruoyi
* @date 2025-12-02
*/
@Service
public
class
InboundOrdersServiceImpl
implements
IInboundOrdersService
{
@Autowired
private
InboundOrdersMapper
inboundOrdersMapper
;
/**
* 查询入库单主
*
* @param id 入库单主主键
* @return 入库单主
*/
@Override
public
InboundOrders
selectInboundOrdersById
(
String
id
)
{
return
inboundOrdersMapper
.
selectInboundOrdersById
(
id
);
}
/**
* 查询入库单主列表
*
* @param inboundOrders 入库单主
* @return 入库单主
*/
@Override
public
List
<
InboundOrders
>
selectInboundOrdersList
(
InboundOrders
inboundOrders
)
{
return
inboundOrdersMapper
.
selectInboundOrdersList
(
inboundOrders
);
}
/**
* 新增入库单主
*
* @param inboundOrders 入库单主
* @return 结果
*/
@Transactional
@Override
public
int
insertInboundOrders
(
InboundOrders
inboundOrders
)
{
inboundOrders
.
setCreateTime
(
DateUtils
.
getNowDate
());
int
rows
=
inboundOrdersMapper
.
insertInboundOrders
(
inboundOrders
);
insertInboundOrderItems
(
inboundOrders
);
return
rows
;
}
/**
* 修改入库单主
*
* @param inboundOrders 入库单主
* @return 结果
*/
@Transactional
@Override
public
int
updateInboundOrders
(
InboundOrders
inboundOrders
)
{
inboundOrders
.
setUpdateTime
(
DateUtils
.
getNowDate
());
inboundOrdersMapper
.
deleteInboundOrderItemsByOrderId
(
inboundOrders
.
getId
());
insertInboundOrderItems
(
inboundOrders
);
return
inboundOrdersMapper
.
updateInboundOrders
(
inboundOrders
);
}
/**
* 批量删除入库单主
*
* @param ids 需要删除的入库单主主键
* @return 结果
*/
@Transactional
@Override
public
int
deleteInboundOrdersByIds
(
String
[]
ids
)
{
inboundOrdersMapper
.
deleteInboundOrderItemsByOrderIds
(
ids
);
return
inboundOrdersMapper
.
deleteInboundOrdersByIds
(
ids
);
}
/**
* 删除入库单主信息
*
* @param id 入库单主主键
* @return 结果
*/
@Transactional
@Override
public
int
deleteInboundOrdersById
(
String
id
)
{
inboundOrdersMapper
.
deleteInboundOrderItemsByOrderId
(
id
);
return
inboundOrdersMapper
.
deleteInboundOrdersById
(
id
);
}
/**
* 新增入库单明细信息
*
* @param inboundOrders 入库单主对象
*/
public
void
insertInboundOrderItems
(
InboundOrders
inboundOrders
)
{
List
<
InboundOrderItems
>
inboundOrderItemsList
=
inboundOrders
.
getInboundOrderItemsList
();
String
orderId
=
inboundOrders
.
getOrderId
();
if
(
StringUtils
.
isNotNull
(
inboundOrderItemsList
))
{
List
<
InboundOrderItems
>
list
=
new
ArrayList
<
InboundOrderItems
>();
for
(
InboundOrderItems
inboundOrderItems
:
inboundOrderItemsList
)
{
inboundOrderItems
.
setId
(
UUID
.
randomUUID
().
toString
());
inboundOrderItems
.
setOrderId
(
orderId
);
list
.
add
(
inboundOrderItems
);
}
if
(
list
.
size
()
>
0
)
{
inboundOrdersMapper
.
batchInboundOrderItems
(
list
);
}
}
}
}
ruoyi-inventory/src/main/resources/mapper/inventory/InboundOrderItemsMapper.xml
0 → 100644
View file @
6d104f90
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.inventory.mapper.InboundOrderItemsMapper"
>
<resultMap
type=
"InboundOrderItems"
id=
"InboundOrderItemsResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"orderId"
column=
"order_id"
/>
<result
property=
"materialId"
column=
"material_id"
/>
<result
property=
"batchId"
column=
"batch_id"
/>
<result
property=
"warehouseId"
column=
"warehouse_id"
/>
<result
property=
"locationId"
column=
"location_id"
/>
<result
property=
"plannedQuantity"
column=
"planned_quantity"
/>
<result
property=
"actualQuantity"
column=
"actual_quantity"
/>
<result
property=
"plannedPackages"
column=
"planned_packages"
/>
<result
property=
"actualPackages"
column=
"actual_packages"
/>
<result
property=
"divisor"
column=
"divisor"
/>
<result
property=
"labelColor"
column=
"label_color"
/>
<result
property=
"voucherNumber"
column=
"voucher_number"
/>
<result
property=
"unitPrice"
column=
"unit_price"
/>
<result
property=
"itemStatus"
column=
"item_status"
/>
<result
property=
"receivedAt"
column=
"received_at"
/>
<result
property=
"receivedBy"
column=
"received_by"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"isUsed"
column=
"is_used"
/>
<result
property=
"sortNo"
column=
"sort_no"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createUserCode"
column=
"create_user_code"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateUserCode"
column=
"update_user_code"
/>
</resultMap>
<sql
id=
"selectInboundOrderItemsVo"
>
select id, order_id, material_id, batch_id, warehouse_id, location_id, planned_quantity, actual_quantity, planned_packages, actual_packages, divisor, label_color, voucher_number, unit_price, item_status, received_at, received_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from inbound_order_items
</sql>
<select
id=
"selectInboundOrderItemsList"
parameterType=
"InboundOrderItems"
resultMap=
"InboundOrderItemsResult"
>
<include
refid=
"selectInboundOrderItemsVo"
/>
<where>
<if
test=
"orderId != null and orderId != ''"
>
and order_id = #{orderId}
</if>
<if
test=
"materialId != null and materialId != ''"
>
and material_id = #{materialId}
</if>
<if
test=
"batchId != null and batchId != ''"
>
and batch_id = #{batchId}
</if>
<if
test=
"warehouseId != null and warehouseId != ''"
>
and warehouse_id = #{warehouseId}
</if>
<if
test=
"locationId != null and locationId != ''"
>
and location_id = #{locationId}
</if>
<if
test=
"plannedQuantity != null "
>
and planned_quantity = #{plannedQuantity}
</if>
<if
test=
"actualQuantity != null "
>
and actual_quantity = #{actualQuantity}
</if>
<if
test=
"plannedPackages != null "
>
and planned_packages = #{plannedPackages}
</if>
<if
test=
"actualPackages != null "
>
and actual_packages = #{actualPackages}
</if>
<if
test=
"divisor != null "
>
and divisor = #{divisor}
</if>
<if
test=
"labelColor != null "
>
and label_color = #{labelColor}
</if>
<if
test=
"voucherNumber != null and voucherNumber != ''"
>
and voucher_number = #{voucherNumber}
</if>
<if
test=
"unitPrice != null "
>
and unit_price = #{unitPrice}
</if>
<if
test=
"itemStatus != null "
>
and item_status = #{itemStatus}
</if>
<if
test=
"receivedAt != null "
>
and received_at = #{receivedAt}
</if>
<if
test=
"receivedBy != null and receivedBy != ''"
>
and received_by = #{receivedBy}
</if>
<if
test=
"isUsed != null "
>
and is_used = #{isUsed}
</if>
<if
test=
"sortNo != null "
>
and sort_no = #{sortNo}
</if>
<if
test=
"createUserCode != null and createUserCode != ''"
>
and create_user_code = #{createUserCode}
</if>
<if
test=
"updateUserCode != null and updateUserCode != ''"
>
and update_user_code = #{updateUserCode}
</if>
</where>
</select>
<select
id=
"selectInboundOrderItemsById"
parameterType=
"String"
resultMap=
"InboundOrderItemsResult"
>
<include
refid=
"selectInboundOrderItemsVo"
/>
where id = #{id}
</select>
<insert
id=
"insertInboundOrderItems"
parameterType=
"InboundOrderItems"
>
insert into inbound_order_items
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"orderId != null"
>
order_id,
</if>
<if
test=
"materialId != null"
>
material_id,
</if>
<if
test=
"batchId != null"
>
batch_id,
</if>
<if
test=
"warehouseId != null"
>
warehouse_id,
</if>
<if
test=
"locationId != null"
>
location_id,
</if>
<if
test=
"plannedQuantity != null"
>
planned_quantity,
</if>
<if
test=
"actualQuantity != null"
>
actual_quantity,
</if>
<if
test=
"plannedPackages != null"
>
planned_packages,
</if>
<if
test=
"actualPackages != null"
>
actual_packages,
</if>
<if
test=
"divisor != null"
>
divisor,
</if>
<if
test=
"labelColor != null"
>
label_color,
</if>
<if
test=
"voucherNumber != null"
>
voucher_number,
</if>
<if
test=
"unitPrice != null"
>
unit_price,
</if>
<if
test=
"itemStatus != null"
>
item_status,
</if>
<if
test=
"receivedAt != null"
>
received_at,
</if>
<if
test=
"receivedBy != null"
>
received_by,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"isUsed != null"
>
is_used,
</if>
<if
test=
"sortNo != null"
>
sort_no,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"createUserCode != null"
>
create_user_code,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"updateUserCode != null"
>
update_user_code,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"orderId != null"
>
#{orderId},
</if>
<if
test=
"materialId != null"
>
#{materialId},
</if>
<if
test=
"batchId != null"
>
#{batchId},
</if>
<if
test=
"warehouseId != null"
>
#{warehouseId},
</if>
<if
test=
"locationId != null"
>
#{locationId},
</if>
<if
test=
"plannedQuantity != null"
>
#{plannedQuantity},
</if>
<if
test=
"actualQuantity != null"
>
#{actualQuantity},
</if>
<if
test=
"plannedPackages != null"
>
#{plannedPackages},
</if>
<if
test=
"actualPackages != null"
>
#{actualPackages},
</if>
<if
test=
"divisor != null"
>
#{divisor},
</if>
<if
test=
"labelColor != null"
>
#{labelColor},
</if>
<if
test=
"voucherNumber != null"
>
#{voucherNumber},
</if>
<if
test=
"unitPrice != null"
>
#{unitPrice},
</if>
<if
test=
"itemStatus != null"
>
#{itemStatus},
</if>
<if
test=
"receivedAt != null"
>
#{receivedAt},
</if>
<if
test=
"receivedBy != null"
>
#{receivedBy},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"isUsed != null"
>
#{isUsed},
</if>
<if
test=
"sortNo != null"
>
#{sortNo},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"createUserCode != null"
>
#{createUserCode},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"updateUserCode != null"
>
#{updateUserCode},
</if>
</trim>
</insert>
<update
id=
"updateInboundOrderItems"
parameterType=
"InboundOrderItems"
>
update inbound_order_items
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"orderId != null"
>
order_id = #{orderId},
</if>
<if
test=
"materialId != null"
>
material_id = #{materialId},
</if>
<if
test=
"batchId != null"
>
batch_id = #{batchId},
</if>
<if
test=
"warehouseId != null"
>
warehouse_id = #{warehouseId},
</if>
<if
test=
"locationId != null"
>
location_id = #{locationId},
</if>
<if
test=
"plannedQuantity != null"
>
planned_quantity = #{plannedQuantity},
</if>
<if
test=
"actualQuantity != null"
>
actual_quantity = #{actualQuantity},
</if>
<if
test=
"plannedPackages != null"
>
planned_packages = #{plannedPackages},
</if>
<if
test=
"actualPackages != null"
>
actual_packages = #{actualPackages},
</if>
<if
test=
"divisor != null"
>
divisor = #{divisor},
</if>
<if
test=
"labelColor != null"
>
label_color = #{labelColor},
</if>
<if
test=
"voucherNumber != null"
>
voucher_number = #{voucherNumber},
</if>
<if
test=
"unitPrice != null"
>
unit_price = #{unitPrice},
</if>
<if
test=
"itemStatus != null"
>
item_status = #{itemStatus},
</if>
<if
test=
"receivedAt != null"
>
received_at = #{receivedAt},
</if>
<if
test=
"receivedBy != null"
>
received_by = #{receivedBy},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"isUsed != null"
>
is_used = #{isUsed},
</if>
<if
test=
"sortNo != null"
>
sort_no = #{sortNo},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"createUserCode != null"
>
create_user_code = #{createUserCode},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"updateUserCode != null"
>
update_user_code = #{updateUserCode},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteInboundOrderItemsById"
parameterType=
"String"
>
delete from inbound_order_items where id = #{id}
</delete>
<delete
id=
"deleteInboundOrderItemsByIds"
parameterType=
"String"
>
delete from inbound_order_items where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
ruoyi-inventory/src/main/resources/mapper/inventory/InboundOrdersMapper.xml
0 → 100644
View file @
6d104f90
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.inventory.mapper.InboundOrdersMapper"
>
<resultMap
type=
"InboundOrders"
id=
"InboundOrdersResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"orderId"
column=
"order_id"
/>
<result
property=
"systemNo"
column=
"system_no"
/>
<result
property=
"orderTypeId"
column=
"order_type_id"
/>
<result
property=
"batchCode"
column=
"batch_code"
/>
<result
property=
"warehouseId"
column=
"warehouse_id"
/>
<result
property=
"ownerId"
column=
"owner_id"
/>
<result
property=
"orderStatus"
column=
"order_status"
/>
<result
property=
"inboundDate"
column=
"inbound_date"
/>
<result
property=
"orderType"
column=
"order_type"
/>
<result
property=
"totalPlannedQuantity"
column=
"total_planned_quantity"
/>
<result
property=
"totalActualQuantity"
column=
"total_actual_quantity"
/>
<result
property=
"totalPackages"
column=
"total_packages"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"opUserName"
column=
"op_user_name"
/>
<result
property=
"isUsed"
column=
"is_used"
/>
<result
property=
"sortNo"
column=
"sort_no"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createUserCode"
column=
"create_user_code"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateUserCode"
column=
"update_user_code"
/>
</resultMap>
<resultMap
id=
"InboundOrdersInboundOrderItemsResult"
type=
"InboundOrders"
extends=
"InboundOrdersResult"
>
<collection
property=
"inboundOrderItemsList"
ofType=
"InboundOrderItems"
column=
"id"
select=
"selectInboundOrderItemsList"
/>
</resultMap>
<resultMap
type=
"InboundOrderItems"
id=
"InboundOrderItemsResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"orderId"
column=
"order_id"
/>
<result
property=
"materialId"
column=
"material_id"
/>
<result
property=
"batchId"
column=
"batch_id"
/>
<result
property=
"warehouseId"
column=
"warehouse_id"
/>
<result
property=
"locationId"
column=
"location_id"
/>
<result
property=
"plannedQuantity"
column=
"planned_quantity"
/>
<result
property=
"actualQuantity"
column=
"actual_quantity"
/>
<result
property=
"plannedPackages"
column=
"planned_packages"
/>
<result
property=
"actualPackages"
column=
"actual_packages"
/>
<result
property=
"divisor"
column=
"divisor"
/>
<result
property=
"labelColor"
column=
"label_color"
/>
<result
property=
"voucherNumber"
column=
"voucher_number"
/>
<result
property=
"unitPrice"
column=
"unit_price"
/>
<result
property=
"itemStatus"
column=
"item_status"
/>
<result
property=
"receivedAt"
column=
"received_at"
/>
<result
property=
"receivedBy"
column=
"received_by"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"isUsed"
column=
"is_used"
/>
<result
property=
"sortNo"
column=
"sort_no"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createUserCode"
column=
"create_user_code"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateUserCode"
column=
"update_user_code"
/>
</resultMap>
<sql
id=
"selectInboundOrdersVo"
>
select id, order_id, system_no, order_type_id, batch_code, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from inbound_orders
</sql>
<select
id=
"selectInboundOrdersList"
parameterType=
"InboundOrders"
resultMap=
"InboundOrdersResult"
>
<include
refid=
"selectInboundOrdersVo"
/>
<where>
<if
test=
"orderId != null and orderId != ''"
>
and order_id = #{orderId}
</if>
<if
test=
"systemNo != null and systemNo != ''"
>
and system_no = #{systemNo}
</if>
<if
test=
"orderTypeId != null and orderTypeId != ''"
>
and order_type_id = #{orderTypeId}
</if>
<if
test=
"batchCode != null and batchCode != ''"
>
and batch_code = #{batchCode}
</if>
<if
test=
"warehouseId != null and warehouseId != ''"
>
and warehouse_id = #{warehouseId}
</if>
<if
test=
"ownerId != null and ownerId != ''"
>
and owner_id = #{ownerId}
</if>
<if
test=
"orderStatus != null "
>
and order_status = #{orderStatus}
</if>
<if
test=
"inboundDate != null "
>
and inbound_date = #{inboundDate}
</if>
<if
test=
"orderType != null and orderType != ''"
>
and order_type = #{orderType}
</if>
<if
test=
"totalPlannedQuantity != null "
>
and total_planned_quantity = #{totalPlannedQuantity}
</if>
<if
test=
"totalActualQuantity != null "
>
and total_actual_quantity = #{totalActualQuantity}
</if>
<if
test=
"totalPackages != null "
>
and total_packages = #{totalPackages}
</if>
<if
test=
"opUserName != null and opUserName != ''"
>
and op_user_name like concat('%', #{opUserName}, '%')
</if>
<if
test=
"isUsed != null "
>
and is_used = #{isUsed}
</if>
<if
test=
"sortNo != null "
>
and sort_no = #{sortNo}
</if>
<if
test=
"createUserCode != null and createUserCode != ''"
>
and create_user_code = #{createUserCode}
</if>
<if
test=
"updateUserCode != null and updateUserCode != ''"
>
and update_user_code = #{updateUserCode}
</if>
</where>
</select>
<select
id=
"selectInboundOrdersById"
parameterType=
"String"
resultMap=
"InboundOrdersInboundOrderItemsResult"
>
select id, order_id, system_no, order_type_id, batch_code, warehouse_id, owner_id, order_status, inbound_date, order_type, total_planned_quantity, total_actual_quantity, total_packages, remark, op_user_name, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from inbound_orders
where id = #{id}
</select>
<select
id=
"selectInboundOrderItemsList"
resultMap=
"InboundOrderItemsResult"
>
select id, order_id, material_id, batch_id, warehouse_id, location_id, planned_quantity, actual_quantity, planned_packages, actual_packages, divisor, label_color, voucher_number, unit_price, item_status, received_at, received_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from inbound_order_items
where order_id = #{order_id}
</select>
<insert
id=
"insertInboundOrders"
parameterType=
"InboundOrders"
>
insert into inbound_orders
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"orderId != null"
>
order_id,
</if>
<if
test=
"systemNo != null"
>
system_no,
</if>
<if
test=
"orderTypeId != null"
>
order_type_id,
</if>
<if
test=
"batchCode != null"
>
batch_code,
</if>
<if
test=
"warehouseId != null"
>
warehouse_id,
</if>
<if
test=
"ownerId != null"
>
owner_id,
</if>
<if
test=
"orderStatus != null"
>
order_status,
</if>
<if
test=
"inboundDate != null"
>
inbound_date,
</if>
<if
test=
"orderType != null"
>
order_type,
</if>
<if
test=
"totalPlannedQuantity != null"
>
total_planned_quantity,
</if>
<if
test=
"totalActualQuantity != null"
>
total_actual_quantity,
</if>
<if
test=
"totalPackages != null"
>
total_packages,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"opUserName != null"
>
op_user_name,
</if>
<if
test=
"isUsed != null"
>
is_used,
</if>
<if
test=
"sortNo != null"
>
sort_no,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"createUserCode != null"
>
create_user_code,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"updateUserCode != null"
>
update_user_code,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"orderId != null"
>
#{orderId},
</if>
<if
test=
"systemNo != null"
>
#{systemNo},
</if>
<if
test=
"orderTypeId != null"
>
#{orderTypeId},
</if>
<if
test=
"batchCode != null"
>
#{batchCode},
</if>
<if
test=
"warehouseId != null"
>
#{warehouseId},
</if>
<if
test=
"ownerId != null"
>
#{ownerId},
</if>
<if
test=
"orderStatus != null"
>
#{orderStatus},
</if>
<if
test=
"inboundDate != null"
>
#{inboundDate},
</if>
<if
test=
"orderType != null"
>
#{orderType},
</if>
<if
test=
"totalPlannedQuantity != null"
>
#{totalPlannedQuantity},
</if>
<if
test=
"totalActualQuantity != null"
>
#{totalActualQuantity},
</if>
<if
test=
"totalPackages != null"
>
#{totalPackages},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"opUserName != null"
>
#{opUserName},
</if>
<if
test=
"isUsed != null"
>
#{isUsed},
</if>
<if
test=
"sortNo != null"
>
#{sortNo},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"createUserCode != null"
>
#{createUserCode},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"updateUserCode != null"
>
#{updateUserCode},
</if>
</trim>
</insert>
<update
id=
"updateInboundOrders"
parameterType=
"InboundOrders"
>
update inbound_orders
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"orderId != null"
>
order_id = #{orderId},
</if>
<if
test=
"systemNo != null"
>
system_no = #{systemNo},
</if>
<if
test=
"orderTypeId != null"
>
order_type_id = #{orderTypeId},
</if>
<if
test=
"batchCode != null"
>
batch_code = #{batchCode},
</if>
<if
test=
"warehouseId != null"
>
warehouse_id = #{warehouseId},
</if>
<if
test=
"ownerId != null"
>
owner_id = #{ownerId},
</if>
<if
test=
"orderStatus != null"
>
order_status = #{orderStatus},
</if>
<if
test=
"inboundDate != null"
>
inbound_date = #{inboundDate},
</if>
<if
test=
"orderType != null"
>
order_type = #{orderType},
</if>
<if
test=
"totalPlannedQuantity != null"
>
total_planned_quantity = #{totalPlannedQuantity},
</if>
<if
test=
"totalActualQuantity != null"
>
total_actual_quantity = #{totalActualQuantity},
</if>
<if
test=
"totalPackages != null"
>
total_packages = #{totalPackages},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</if>
<if
test=
"opUserName != null"
>
op_user_name = #{opUserName},
</if>
<if
test=
"isUsed != null"
>
is_used = #{isUsed},
</if>
<if
test=
"sortNo != null"
>
sort_no = #{sortNo},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"createUserCode != null"
>
create_user_code = #{createUserCode},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"updateUserCode != null"
>
update_user_code = #{updateUserCode},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteInboundOrdersById"
parameterType=
"String"
>
delete from inbound_orders where id = #{id}
</delete>
<delete
id=
"deleteInboundOrdersByIds"
parameterType=
"String"
>
delete from inbound_orders where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
<delete
id=
"deleteInboundOrderItemsByOrderIds"
parameterType=
"String"
>
delete from inbound_order_items where order_id in
<foreach
item=
"orderId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{orderId}
</foreach>
</delete>
<delete
id=
"deleteInboundOrderItemsByOrderId"
parameterType=
"String"
>
delete from inbound_order_items where order_id = #{orderId}
</delete>
<insert
id=
"batchInboundOrderItems"
>
insert into inbound_order_items( id, order_id, material_id, batch_id, warehouse_id, location_id, planned_quantity, actual_quantity, planned_packages, actual_packages, divisor, label_color, voucher_number, unit_price, item_status, received_at, received_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code) values
<foreach
item=
"item"
index=
"index"
collection=
"list"
separator=
","
>
( #{item.id}, #{item.orderId}, #{item.materialId}, #{item.batchId}, #{item.warehouseId}, #{item.locationId}, #{item.plannedQuantity}, #{item.actualQuantity}, #{item.plannedPackages}, #{item.actualPackages}, #{item.divisor}, #{item.labelColor}, #{item.voucherNumber}, #{item.unitPrice}, #{item.itemStatus}, #{item.receivedAt}, #{item.receivedBy}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode})
</foreach>
</insert>
</mapper>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论