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
f97e11c7
Commit
f97e11c7
authored
Dec 22, 2025
by
yubin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
1ce3e891
1df3492a
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
952 行增加
和
751 行删除
+952
-751
ruoyi-admin-vue/package.json
+1
-0
ruoyi-admin-vue/src/main.js
+4
-0
ruoyi-admin-vue/src/utils/request.js
+1
-1
ruoyi-admin-vue/src/views/inventory/inbound/details.vue
+298
-200
ruoyi-admin-vue/src/views/inventory/inbound/index.vue
+556
-526
ruoyi-admin-vue/src/views/inventory/inbound_items/index.vue
+4
-3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/InboundOrdersController.java
+62
-14
ruoyi-admin/src/main/resources/application.yml
+1
-1
ruoyi-inventory/src/main/resources/mapper/inventory/InboundOrdersMapper.xml
+25
-6
没有找到文件。
ruoyi-admin-vue/package.json
View file @
f97e11c7
...
...
@@ -44,6 +44,7 @@
"vue"
:
"2.6.12"
,
"vue-count-to"
:
"1.0.13"
,
"vue-cropper"
:
"0.5.5"
,
"vue-print-nb"
:
"^1.7.5"
,
"vue-router"
:
"3.4.9"
,
"vuedraggable"
:
"2.24.3"
,
"vuex"
:
"3.6.0"
...
...
ruoyi-admin-vue/src/main.js
View file @
f97e11c7
...
...
@@ -39,6 +39,8 @@ import DictData from '@/components/DictData'
import
PageWrapperSearch
from
'@/components/Search/PageWrapperSearch.vue'
import
PageTitle
from
'@/components/PageTitle/index.vue'
// 打印组件
import
Print
from
'vue-print-nb'
// 全局方法挂载
Vue
.
prototype
.
getDicts
=
getDicts
...
...
@@ -61,9 +63,11 @@ Vue.component('ImageUpload', ImageUpload)
Vue
.
component
(
'ImagePreview'
,
ImagePreview
)
Vue
.
component
(
'PageWrapperSearch'
,
PageWrapperSearch
)
Vue
.
component
(
'PageTitle'
,
PageTitle
)
// Vue.component('Print', Print)
Vue
.
use
(
directive
)
Vue
.
use
(
plugins
)
Vue
.
use
(
Print
)
DictData
.
install
()
/**
...
...
ruoyi-admin-vue/src/utils/request.js
View file @
f97e11c7
...
...
@@ -17,7 +17,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL
:
process
.
env
.
VUE_APP_BASE_API
,
// 超时
timeout
:
1
0000
timeout
:
3
0000
})
// request拦截器
...
...
ruoyi-admin-vue/src/views/inventory/inbound/details.vue
View file @
f97e11c7
...
...
@@ -39,8 +39,6 @@
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"仓库"
prop=
"warehouseId"
>
<el-input
v-model=
"queryWarehouseName"
...
...
@@ -75,16 +73,6 @@
</
template
>
</el-input>
</el-form-item>
<!-- <el-form-item label="标签颜色" prop="labelColor">
<el-select v-model="queryParams.labelColor" placeholder="请选择标签颜色" clearable>
<el-option
v-for="dict in dict.type.label_color"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item> -->
</page-wrapper-search>
<!-- 表格区域 -->
...
...
@@ -104,9 +92,10 @@
<el-table-column
label=
"危险类别"
align=
"center"
prop=
"hazardId"
width=
"120"
>
<
template
slot-scope=
"scope"
>
<el-tag
:type=
"getDictListClass('danger_type',scope.row.hazardId)"
size=
"small"
>
{{
getDictLabel
(
'danger_type'
,
scope
.
row
.
hazardId
)
}}
:type=
"getDictTagType('danger_type', scope.row.hazardId)"
size=
"small"
>
{{
getDictLabel
(
'danger_type'
,
scope
.
row
.
hazardId
)
}}
</el-tag>
</
template
>
</el-table-column>
...
...
@@ -114,14 +103,14 @@
<el-table-column
label=
"计量单位"
align=
"center"
prop=
"materialUnit"
width=
"120"
/>
<el-table-column
label=
"单位重量"
align=
"center"
prop=
"unitWeight"
width=
"120"
>
<
template
slot-scope=
"scope"
>
{{
format
Amount
(
scope
.
row
.
unitWeight
||
0
)
}}
{{
format
Number
(
scope
.
row
.
unitWeight
)
}}
</
template
>
</el-table-column>
<el-table-column
label=
"计划数量"
align=
"center"
prop=
"plannedQuantity"
width=
"100"
/>
<el-table-column
label=
"实际数量"
align=
"center"
prop=
"actualQuantity"
width=
"100"
/>
<el-table-column
label=
"总额"
align=
"center"
prop=
"totalPrice"
width=
"100"
>
<
template
slot-scope=
"scope"
>
{{
format
Amount
(
scope
.
row
.
totalPrice
||
0
)
}}
{{
format
Number
(
scope
.
row
.
totalPrice
)
}}
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
width=
"100"
fixed=
"right"
>
...
...
@@ -136,19 +125,27 @@
</el-table-column>
</el-table>
</div>
<!-- 详情弹窗 -->
<el-dialog
title=
"出库物料详情"
v-model=
"detailDialogVisible"
:visible
.
sync=
"detailDialogVisible"
width=
"1400px"
append-to-body
:close-on-click-modal=
"false"
>
<el-form
:model=
"detailQueryParams"
ref=
"detailQueryForm"
size=
"small"
:inline=
"true"
label-width=
"100px"
style=
"margin-bottom: 15px;"
>
<el-form
:model=
"detailQueryParams"
ref=
"detailQueryForm"
size=
"small"
inline
label-width=
"100px"
class=
"detail-search-form"
>
<el-form-item
label=
"入库日期"
prop=
"inboundDateRange"
>
<el-date-picker
v-model=
"inbound
DateRange"
v-model=
"detail
DateRange"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期"
...
...
@@ -160,48 +157,48 @@
</el-form-item>
<el-form-item
label=
"关联入库单号"
prop=
"orderId"
>
<el-input
v-model=
"q
ueryParams.orderId"
v-model=
"detailQ
ueryParams.orderId"
placeholder=
"请输入入库单号"
clearable
/>
</el-form-item>
<el-form-item
label=
"批次"
prop=
"batchId"
>
<el-input
v-model=
"q
ueryParams.batchId"
v-model=
"detailQ
ueryParams.batchId"
placeholder=
"请输入批次"
clearable
/>
</el-form-item>
<el-form-item
label=
"仓库"
prop=
"warehouseId"
>
<el-input
v-model=
"query
WarehouseName"
v-model=
"detail
WarehouseName"
placeholder=
"请选择仓库"
readonly
@
focus=
"open
WarehouseSelector"
@
focus=
"openDetail
WarehouseSelector"
:suffix-icon=
"''"
>
<
template
v-if=
"query
WarehouseName"
#
suffix
>
<
template
v-if=
"detail
WarehouseName"
#
suffix
>
<i
class=
"el-icon-circle-close el-input__icon"
style=
"cursor: pointer;"
@
click
.
stop=
"clearQuery
Warehouse"
@
click
.
stop=
"clearDetail
Warehouse"
></i>
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"库位"
prop=
"locationId"
>
<el-input
v-model=
"query
LocationName"
v-model=
"detail
LocationName"
placeholder=
"请选择库位"
readonly
@
focus=
"open
LocationSelector"
@
focus=
"openDetail
LocationSelector"
:suffix-icon=
"''"
>
<
template
v-if=
"query
LocationName"
#
suffix
>
<
template
v-if=
"detail
LocationName"
#
suffix
>
<i
class=
"el-icon-circle-close el-input__icon"
style=
"cursor: pointer;"
@
click
.
stop=
"clearQuery
Location"
@
click
.
stop=
"clearDetail
Location"
></i>
</
template
>
</el-input>
...
...
@@ -211,7 +208,8 @@
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetDetailQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<div
style=
"max-height: 600px; overflow: auto;"
>
<div
class=
"detail-table-container"
>
<el-table
v-loading=
"detailLoading"
:data=
"detailList"
...
...
@@ -220,7 +218,7 @@
>
<el-table-column
type=
"index"
label=
"序号"
width=
"60"
align=
"center"
/>
<el-table-column
label=
"物料名称"
align=
"center"
prop=
"materialName"
min-width=
"150"
show-overflow-tooltip
/>
<el-table-column
label=
"关联订单号"
align=
"center"
prop=
"orderId"
width=
"15
0"
/>
<el-table-column
label=
"关联入库单号"
align=
"center"
prop=
"orderId"
width=
"18
0"
/>
<el-table-column
label=
"批次"
align=
"center"
prop=
"batchId"
width=
"120"
/>
<el-table-column
label=
"仓库"
align=
"center"
prop=
"warehousesName"
width=
"120"
/>
<el-table-column
label=
"库位"
align=
"center"
prop=
"locationName"
width=
"120"
/>
...
...
@@ -228,54 +226,63 @@
<el-table-column
label=
"实际数量"
align=
"center"
prop=
"actualQuantity"
width=
"100"
/>
<el-table-column
label=
"入库日期"
align=
"center"
prop=
"inboundDate"
width=
"120"
>
<
template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
inboundDate
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
{{
parseTime
(
scope
.
row
.
inboundDate
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"单价"
align
=
"center"
prop
=
"unitPrice"
width
=
"100"
>
<
template
slot
-
scope
=
"scope"
>
{{
formatAmount
(
scope
.
row
.
unitPrice
||
0
)
}}
{{
formatNumber
(
scope
.
row
.
unitPrice
)
}}
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"金额"
align
=
"center"
prop
=
"totalPrice"
width
=
"120"
>
<
template
slot
-
scope
=
"scope"
>
{{
formatAmount
(
scope
.
row
.
totalPrice
||
(
scope
.
row
.
actualQuantity
||
0
)
*
(
scope
.
row
.
unitPrice
||
0
))
}}
{{
formatNumber
(
(
scope
.
row
.
actualQuantity
||
0
)
*
(
scope
.
row
.
unitPrice
||
0
))
}}
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
label
=
"备注"
align
=
"center"
prop
=
"remark"
min
-
width
=
"150"
show
-
overflow
-
tooltip
/>
<
/el-table
>
<
/div
>
<
pagination
v
-
show
=
"detailTotal > 0"
:
total
=
"detailTotal"
:
page
.
sync
=
"detailQueryParams.pageNum"
:
limit
.
sync
=
"detailQueryParams.pageSize"
@
pagination
=
"getDetailList"
style
=
"margin-top: 15px;
"
class
=
"detail-pagination
"
/>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
@
click
=
"detailDialogVisible = false"
>
关
闭
<
/el-button
>
<
/div
>
<
/el-dialog
>
<!--
分页组件
-->
<
pagination
v
-
show
=
"total
>
0"
v
-
show
=
"total
>
0"
:
total
=
"total"
:
page
.
sync
=
"queryParams.pageNum"
:
limit
.
sync
=
"queryParams.pageSize"
@
pagination
=
"getList"
/>
<!--
仓库选择组件
-->
<!--
仓库
/
库位
选择组件
-->
<
WarehouseSelector
v
-
model
=
"warehouseSelectorVisible"
@
selected
=
"handleWarehouseSelected"
/>
<!--
库位选择组件
-->
<
LocationSelector
v
-
model
=
"locationSelectorVisible"
@
selected
=
"handleLocationSelected"
/>
<
WarehouseSelector
v
-
model
=
"detailWarehouseSelectorVisible"
@
selected
=
"handleDetailWarehouseSelected"
/>
<
LocationSelector
v
-
model
=
"detailLocationSelectorVisible"
@
selected
=
"handleDetailLocationSelected"
/>
<
/div
>
<
/div
>
<
/template
>
...
...
@@ -289,7 +296,7 @@ import LocationSelector from "@/views/compononents/LocationSelector.vue"
export
default
{
name
:
"InboundDetails"
,
dicts
:
[
'label_color'
,
'danger_type'
],
dicts
:
[
'label_color'
,
'danger_type'
],
components
:
{
PageTitle
,
PageWrapperSearch
,
...
...
@@ -298,246 +305,315 @@ export default {
}
,
data
()
{
return
{
// 入库日期选择数组
inboundDateRange
:
null
,
// 仓库选择相关
// 主页面状态
loading
:
true
,
total
:
0
,
inboundList
:
[],
warehouseSelectorVisible
:
false
,
queryWarehouseName
:
null
,
// 库位选择相关
locationSelectorVisible
:
false
,
queryLocationName
:
null
,
// 遮罩层
loading
:
true
,
queryWarehouseName
:
''
,
queryLocationName
:
''
,
// 详情弹窗状态
detailDialogVisible
:
false
,
detailLoading
:
true
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 总条数
total
:
0
,
detailTotal
:
0
,
// 入库表格数据
inboundList
:
[],
// 查询参数
detailList
:
[],
detailWarehouseSelectorVisible
:
false
,
detailLocationSelectorVisible
:
false
,
detailWarehouseName
:
''
,
detailLocationName
:
''
,
detailDateRange
:
null
,
// 独立的详情日期范围,避免和主页面冲突
// 查询参数(规范化命名 + 初始值统一)
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
sapNo
:
null
,
materialName
:
null
,
warehouseId
:
null
,
locationId
:
null
,
labelColor
:
null
,
sapNo
:
''
,
materialName
:
''
,
warehouseId
:
''
,
locationId
:
''
,
labelColor
:
''
,
inboundDateStart
:
''
,
inboundDateEnd
:
''
}
,
detailDialogVisible
:
false
,
detailList
:
[],
detailQueryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
orderId
:
null
,
materialId
:
null
,
warehouseId
:
null
,
locationId
:
null
,
batchId
:
null
,
inboundDateStart
:
null
,
inboundDateEnd
:
null
materialId
:
''
,
orderId
:
''
,
batchId
:
''
,
warehouseId
:
''
,
locationId
:
''
,
inboundDateStart
:
''
,
inboundDateEnd
:
''
}
,
// 多选相关(仅声明必要变量)
ids
:
[],
single
:
true
,
multiple
:
true
}
}
,
created
()
{
this
.
getList
()
}
,
methods
:
{
// 封装字典取值方法
/**
* 获取字典标签(通用方法)
* @param {string
}
dictType 字典类型
* @param {*
}
value 字典值
* @returns {string
}
字典标签
*/
getDictLabel
(
dictType
,
value
)
{
if
(
!
value
||
!
this
.
dict
?.
type
?.[
dictType
])
return
'-'
;
const
dictItem
=
this
.
dict
.
type
[
dictType
].
find
(
item
=>
item
.
value
===
value
);
return
dictItem
?.
label
||
'-'
;
}
,
getDictListClass
(
dictType
,
value
)
{
if
(
!
value
||
!
this
.
dict
?.
type
?.[
dictType
])
return
'-'
;
/**
* 获取字典标签样式(语义化命名)
* @param {string
}
dictType 字典类型
* @param {*
}
value 字典值
* @returns {string
}
样式类名
*/
getDictTagType
(
dictType
,
value
)
{
if
(
!
value
||
!
this
.
dict
?.
type
?.[
dictType
])
return
''
;
const
dictItem
=
this
.
dict
.
type
[
dictType
].
find
(
item
=>
item
.
value
===
value
);
return
dictItem
?.
raw
?.
listClass
||
''
;
}
,
/** 查询入库列表 */
getList
()
{
this
.
loading
=
true
inbound_details
(
this
.
queryParams
).
then
(
response
=>
{
this
.
inboundList
=
response
.
rows
this
.
total
=
response
.
total
this
.
loading
=
false
}
).
catch
(()
=>
{
this
.
loading
=
false
}
)
/**
* 数字格式化(通用方法,替代原formatAmount)
* @param {number
}
num 待格式化数字
* @returns {string
}
保留两位小数的字符串
*/
formatNumber
(
num
)
{
const
number
=
Number
(
num
);
return
isNaN
(
number
)
?
'0.00'
:
number
.
toFixed
(
2
);
}
,
/**
* 查询主列表数据
*/
async
getList
()
{
try
{
this
.
loading
=
true
;
const
response
=
await
inbound_details
(
this
.
queryParams
);
this
.
inboundList
=
response
.
rows
||
[];
this
.
total
=
response
.
total
||
0
;
}
catch
(
error
)
{
this
.
$message
.
error
(
'查询入库列表失败:'
+
error
.
message
);
}
finally
{
this
.
loading
=
false
;
}
}
,
/** 搜索按钮操作 */
/**
* 主页面搜索
*/
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
if
(
Array
.
isArray
(
this
.
inboundDateRange
)
&&
this
.
inboundDateRange
.
length
===
2
)
{
this
.
queryParams
.
inboundDateStart
=
this
.
inboundDateRange
[
0
];
this
.
queryParams
.
inboundDateEnd
=
this
.
inboundDateRange
[
1
];
this
.
queryParams
.
pageNum
=
1
;
// 处理日期范围(原代码错误绑定到全局inboundDateRange,已修正)
if
(
Array
.
isArray
(
this
.
detailDateRange
)
&&
this
.
detailDateRange
.
length
===
2
)
{
this
.
queryParams
.
inboundDateStart
=
this
.
detailDateRange
[
0
];
this
.
queryParams
.
inboundDateEnd
=
this
.
detailDateRange
[
1
];
}
else
{
// 清空开始/结束日期(避免残留旧值)
this
.
queryParams
.
inboundDateStart
=
""
;
this
.
queryParams
.
inboundDateEnd
=
""
;
this
.
queryParams
.
inboundDateStart
=
''
;
this
.
queryParams
.
inboundDateEnd
=
''
;
}
this
.
getList
()
this
.
getList
()
;
}
,
/** 重置按钮操作 */
/**
* 重置主页面查询条件
*/
resetQuery
()
{
this
.
queryParams
=
{
pageNum
:
1
,
pageSize
:
10
,
sapNo
:
null
,
materialName
:
null
,
orderId
:
null
,
batchId
:
null
,
warehouseId
:
null
,
locationId
:
null
,
labelColor
:
null
,
inboundDateStart
:
null
,
inboundDateStart
:
null
}
this
.
queryWarehouseName
=
null
this
.
queryLocationName
=
null
this
.
inboundDateRange
=
null
this
.
handleQuery
()
sapNo
:
''
,
materialName
:
''
,
warehouseId
:
''
,
locationId
:
''
,
labelColor
:
''
,
inboundDateStart
:
''
,
inboundDateEnd
:
''
}
;
this
.
queryWarehouseName
=
''
;
this
.
queryLocationName
=
''
;
this
.
detailDateRange
=
null
;
this
.
getList
();
}
,
/**
* 打开详情弹窗
* @param {object
}
row 选中的行数据
*/
handleViewDetail
(
row
)
{
this
.
currentDetailRow
=
row
this
.
detailDialogVisible
=
true
this
.
detailDialogVisible
=
true
;
// 初始化详情查询参数
this
.
detailQueryParams
=
{
pageNum
:
1
,
pageSize
:
10
,
orderId
:
null
,
materialId
:
row
.
materialId
,
warehouseId
:
null
,
warehousesCode
:
null
,
locationId
:
null
,
batchId
:
null
,
inboundDateStart
:
null
,
inboundDateStart
:
null
}
this
.
detailWarehouseName
=
null
this
.
detailLocationName
=
null
this
.
detailList
=
[]
this
.
detailTotal
=
0
this
.
getDetailList
()
orderId
:
''
,
batchId
:
''
,
warehouseId
:
this
.
queryParams
.
warehouseId
,
// 继承主页面仓库筛选
locationId
:
this
.
queryParams
.
locationId
,
// 继承主页面库位筛选
inboundDateStart
:
''
,
inboundDateEnd
:
''
}
;
this
.
detailWarehouseName
=
this
.
queryWarehouseName
;
this
.
detailLocationName
=
this
.
queryLocationName
;
this
.
detailDateRange
=
null
;
this
.
getDetailList
();
}
,
getDetailList
()
{
this
.
detailLoading
=
true
const
params
=
{
...
this
.
detailQueryParams
}
params
.
warehouseId
=
params
.
warehouseId
||
this
.
queryParams
.
warehouseId
params
.
locationId
=
params
.
locationId
||
this
.
queryParams
.
locationId
details_information
(
params
).
then
(
response
=>
{
this
.
detailList
=
response
.
rows
||
[]
this
.
detailTotal
=
response
.
total
||
0
this
.
detailLoading
=
false
}
).
catch
(()
=>
{
this
.
detailLoading
=
false
}
)
/**
* 查询详情列表数据
*/
async
getDetailList
()
{
try
{
this
.
detailLoading
=
true
;
// 处理详情日期范围
if
(
Array
.
isArray
(
this
.
detailDateRange
)
&&
this
.
detailDateRange
.
length
===
2
)
{
this
.
detailQueryParams
.
inboundDateStart
=
this
.
detailDateRange
[
0
];
this
.
detailQueryParams
.
inboundDateEnd
=
this
.
detailDateRange
[
1
];
}
const
response
=
await
details_information
(
this
.
detailQueryParams
);
this
.
detailList
=
response
.
rows
||
[];
this
.
detailTotal
=
response
.
total
||
0
;
}
catch
(
error
)
{
this
.
$message
.
error
(
'查询物料详情失败:'
+
error
.
message
);
}
finally
{
this
.
detailLoading
=
false
;
}
}
,
/**
* 详情弹窗搜索
*/
handleDetailQuery
()
{
this
.
detailQueryParams
.
pageNum
=
1
this
.
getDetailList
()
this
.
detailQueryParams
.
pageNum
=
1
;
this
.
getDetailList
()
;
}
,
/**
* 重置详情弹窗查询条件
*/
resetDetailQuery
()
{
const
materialId
=
this
.
detailQueryParams
.
materialId
;
// 保留物料ID
this
.
detailQueryParams
=
{
pageNum
:
1
,
pageSize
:
10
,
orderId
:
null
,
materialId
:
row
.
materialId
,
warehouseId
:
null
,
locationId
:
null
,
batchId
:
null
,
inboundDateStart
:
null
,
inboundDateStart
:
null
}
this
.
inboundDateRange
=
null
this
.
detailQueryParams
.
pageNum
=
1
this
.
getDetailList
()
}
,
formatAmount
(
amount
)
{
if
(
amount
===
null
||
amount
===
undefined
||
isNaN
(
amount
))
{
return
'0.00'
}
return
parseFloat
(
amount
).
toFixed
(
2
)
materialId
,
orderId
:
''
,
batchId
:
''
,
warehouseId
:
''
,
locationId
:
''
,
inboundDateStart
:
''
,
inboundDateEnd
:
''
}
;
this
.
detailDateRange
=
null
;
this
.
detailWarehouseName
=
''
;
this
.
detailLocationName
=
''
;
this
.
getDetailList
();
}
,
/** 多选框选中数据 */
/**
* 多选框选中事件
* @param {array
}
selection 选中的行
*/
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
;
this
.
single
=
selection
.
length
!==
1
;
this
.
multiple
=
!
selection
.
length
;
}
,
/
** 打开仓库选择器 */
/
/ ========== 仓库/库位选择器相关方法(通用封装) ==========
openWarehouseSelector
()
{
this
.
warehouseSelectorVisible
=
true
this
.
warehouseSelectorVisible
=
true
;
}
,
/** 仓库选择回调 */
handleWarehouseSelected
(
warehouse
)
{
if
(
!
warehouse
)
return
this
.
queryParams
.
warehouseId
=
warehouse
.
warehouseId
this
.
queryWarehouseName
=
warehouse
.
warehousesName
||
warehouse
.
warehousesCode
// 仓库选择后,清空库位信息
// this.queryLocationName = null
// this.queryParams.locationId = null
this
.
handleQuery
()
if
(
!
warehouse
)
return
;
this
.
queryParams
.
warehouseId
=
warehouse
.
warehouseId
;
this
.
queryWarehouseName
=
warehouse
.
warehousesName
||
warehouse
.
warehousesCode
;
this
.
handleQuery
();
}
,
/** 清空仓库选择 */
clearQueryWarehouse
()
{
this
.
queryWarehouseName
=
null
this
.
queryParams
.
warehouseId
=
null
// 清空仓库时,同时清空库位
// this.queryLocationName = null
// this.queryParams.locationId = null
this
.
handleQuery
()
this
.
queryWarehouseName
=
''
;
this
.
queryParams
.
warehouseId
=
''
;
this
.
handleQuery
();
}
,
/** 打开库位选择器 */
openLocationSelector
()
{
// if (!this.queryParams.warehouseId)
{
// this.$message.warning("请先选择仓库")
// return
//
}
this
.
locationSelectorVisible
=
true
this
.
locationSelectorVisible
=
true
;
}
,
/** 库位选择回调 */
handleLocationSelected
(
location
)
{
if
(
!
location
)
return
this
.
queryParams
.
locationId
=
location
.
locationId
||
location
.
id
this
.
queryLocationName
=
location
.
locationName
||
location
.
locationCode
this
.
handleQuery
()
if
(
!
location
)
return
;
this
.
queryParams
.
locationId
=
location
.
locationId
||
location
.
id
;
this
.
queryLocationName
=
location
.
locationName
||
location
.
locationCode
;
this
.
handleQuery
()
;
}
,
/** 清空库位选择 */
clearQueryLocation
()
{
this
.
queryLocationName
=
null
this
.
queryParams
.
locationId
=
null
this
.
handleQuery
()
this
.
queryLocationName
=
''
;
this
.
queryParams
.
locationId
=
''
;
this
.
handleQuery
();
}
,
openDetailWarehouseSelector
()
{
this
.
detailWarehouseSelectorVisible
=
true
;
}
,
handleDetailWarehouseSelected
(
warehouse
)
{
if
(
!
warehouse
)
return
;
this
.
detailQueryParams
.
warehouseId
=
warehouse
.
warehouseId
;
this
.
detailWarehouseName
=
warehouse
.
warehousesName
||
warehouse
.
warehousesCode
;
this
.
detailLocationName
=
''
;
this
.
detailQueryParams
.
locationId
=
''
;
}
,
clearDetailWarehouse
()
{
this
.
detailWarehouseName
=
''
;
this
.
detailQueryParams
.
warehouseId
=
''
;
this
.
detailLocationName
=
''
;
this
.
detailQueryParams
.
locationId
=
''
;
}
,
openDetailLocationSelector
()
{
this
.
detailLocationSelectorVisible
=
true
;
}
,
handleDetailLocationSelected
(
location
)
{
if
(
!
location
)
return
;
this
.
detailQueryParams
.
locationId
=
location
.
locationId
||
location
.
id
;
this
.
detailLocationName
=
location
.
locationName
||
location
.
locationCode
;
}
,
clearDetailLocation
()
{
this
.
detailLocationName
=
''
;
this
.
detailQueryParams
.
locationId
=
''
;
}
,
/** 导出按钮操作 */
/**
* 导出数据
*/
handleExport
()
{
this
.
download
(
'/inventory/inbound_items/exportDetails'
,
{
...
this
.
queryParams
}
,
`inbound_${new Date().getTime()
}
.xlsx`
)
this
.
download
(
'/inventory/inbound_items/exportDetails'
,
{
...
this
.
queryParams
}
,
`inbound_details_${new Date().getTime()
}
.xlsx`
);
}
}
}
<
/script
>
<
style
scoped
>
/* 核心样式保留,冗余样式删除 */
.
page
-
container
{
padding
:
16
px
;
background
:
#
fff
;
...
...
@@ -548,4 +624,25 @@ export default {
.
table
-
container
{
margin
-
top
:
16
px
;
}
/* 详情弹窗样式优化 */
.
detail
-
search
-
form
{
margin
-
bottom
:
16
px
;
}
.
detail
-
table
-
container
{
max
-
height
:
600
px
;
overflow
:
auto
;
margin
-
bottom
:
16
px
;
}
.
detail
-
pagination
{
margin
-
top
:
10
px
;
text
-
align
:
right
;
}
/* 修复弹窗内分页样式 */
:
deep
(.
el
-
pagination
)
{
margin
-
top
:
10
px
;
}
<
/style>
\ No newline at end of file
ruoyi-admin-vue/src/views/inventory/inbound/index.vue
View file @
f97e11c7
<
template
>
<div
class=
"app-container"
>
<!-- 标题栏 + 操作按钮
(对齐字典页面)
-->
<!-- 标题栏 + 操作按钮 -->
<PageTitle>
<template
#
buttons
>
<el-button
...
...
@@ -52,7 +52,7 @@
</
template
>
</PageTitle>
<!-- 搜索区域
(对齐字典页面的page-wrapper-search组件)
-->
<!-- 搜索区域 -->
<div
class=
"page-container"
>
<page-wrapper-search
:model=
"queryParams"
...
...
@@ -61,7 +61,6 @@
@
search=
"handleQuery"
@
reset=
"resetQuery"
>
<!-- ========== 新增:入库日期范围选择器 ========== -->
<el-form-item
label=
"入库日期"
prop=
"inboundDateRange"
>
<el-date-picker
v-model=
"inboundDateRange"
...
...
@@ -109,7 +108,6 @@
/>
</el-select>
</el-form-item>
<!-- 新增:搜索页货主选择 -->
<el-form-item
label=
"货主"
prop=
"ownerId"
>
<el-input
v-model=
"queryOwnerName"
...
...
@@ -150,7 +148,7 @@
</el-form-item>
</page-wrapper-search>
<!-- 表格区域
(对齐字典页面的样式)
-->
<!-- 表格区域 -->
<div
class=
"table-container"
>
<el-table
v-loading=
"loading"
...
...
@@ -162,38 +160,40 @@
<el-table-column
label=
"入库单号"
align=
"center"
prop=
"orderId"
min-width=
"200"
/>
<el-table-column
label=
"批次号"
align=
"center"
prop=
"batchId"
min-width=
"200"
/>
<el-table-column
label=
"系统编号"
align=
"center"
prop=
"systemNo"
min-width=
"200"
/>
<!-- 新增:表格显示货主名称 -->
<el-table-column
label=
"货主"
align=
"center"
prop=
"ownerName"
min-width=
"200"
/>
<el-table-column
label=
"入库类型"
align=
"center"
prop=
"orderTypeId"
:show-overflow-tooltip=
"true"
min-width=
"200"
>
<el-table-column
label=
"入库类型"
align=
"center"
prop=
"orderTypeId"
show-overflow-tooltip
min-width=
"200"
>
<
template
slot-scope=
"scope"
>
<el-tag
:type=
"getDictListClass('inbound_outbound_type',scope.row.orderTypeId)"
size=
"small"
>
{{
getDictLabel
(
'inbound_outbound_type'
,
scope
.
row
.
orderTypeId
)
}}
:type=
"getDictTagClass('inbound_outbound_type', scope.row.orderTypeId)"
size=
"small"
>
{{
getDictLabel
(
'inbound_outbound_type'
,
scope
.
row
.
orderTypeId
)
}}
</el-tag>
</
template
>
</el-table-column>
<el-table-column
label=
"订单类型"
align=
"center"
prop=
"orderType"
:show-overflow-tooltip=
"true"
min-width=
"200"
>
<el-table-column
label=
"订单类型"
align=
"center"
prop=
"orderType"
show-overflow-tooltip
min-width=
"200"
>
<
template
slot-scope=
"scope"
>
<el-tag
:type=
"getDictListClass('order_type',scope.row.orderType)"
size=
"small"
>
{{
getDictLabel
(
'order_type'
,
scope
.
row
.
orderType
)
}}
:type=
"getDictTagClass('order_type', scope.row.orderType)"
size=
"small"
>
{{
getDictLabel
(
'order_type'
,
scope
.
row
.
orderType
)
}}
</el-tag>
</
template
>
</el-table-column>
<el-table-column
label=
"入库单状态"
align=
"center"
prop=
"orderStatus"
min-width=
"200"
>
<!-- 状态显示 -->
<
template
slot-scope=
"scope"
>
<el-tag
:type=
"getDictListClass('inbound_status',scope.row.orderStatus+'')"
size=
"small"
min-width=
"200"
>
{{
getDictLabel
(
'inbound_status'
,
scope
.
row
.
orderStatus
+
""
)
}}
<el-tag
:type=
"getDictTagClass('inbound_status', scope.row.orderStatus + '')"
size=
"small"
>
{{
getDictLabel
(
'inbound_status'
,
scope
.
row
.
orderStatus
+
""
)
}}
</el-tag>
</
template
>
</el-table-column>
<el-table-column
label=
"入库时间"
align=
"center"
prop=
"inboundDate"
min-width=
"200"
>
<
template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
inboundDate
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
{{
parseTime
(
scope
.
row
.
inboundDate
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
...
...
@@ -210,7 +210,7 @@
icon
=
"el-icon-success"
@
click
=
"handleConfirm(scope.row)"
v
-
hasPermi
=
"['inventory:inbound:confirm']"
v
-
show
=
"!(scope.row.orderStatus === 2)
"
v
-
if
=
"scope.row.orderStatus !== 2
"
>
确认入库
<
/el-button
>
<
el
-
button
size
=
"mini"
...
...
@@ -225,7 +225,7 @@
icon
=
"el-icon-edit"
@
click
=
"handleUpdate(scope.row)"
v
-
hasPermi
=
"['inventory:inbound:edit']"
v
-
show
=
"!(scope.row.orderStatus === 2)
"
v
-
if
=
"scope.row.orderStatus !== 2
"
>
修改
<
/el-button
>
<
el
-
button
size
=
"mini"
...
...
@@ -233,16 +233,16 @@
icon
=
"el-icon-delete"
@
click
=
"handleDelete(scope.row)"
v
-
hasPermi
=
"['inventory:inbound:remove']"
v
-
show
=
"!(scope.row.orderStatus === 2)
"
v
-
if
=
"scope.row.orderStatus !== 2
"
>
删除
<
/el-button
>
<
/template
>
<
/el-table-column
>
<
/el-table
>
<
/div
>
<!--
分页组件
(位置对齐)
-->
<!--
分页组件
-->
<
pagination
v
-
show
=
"total
>
0"
v
-
show
=
"total
>
0"
:
total
=
"total"
:
page
.
sync
=
"queryParams.pageNum"
:
limit
.
sync
=
"queryParams.pageSize"
...
...
@@ -250,10 +250,16 @@
/>
<
/div
>
<!--
添加或修改入库对话框(样式对齐)
-->
<
el
-
dialog
:
title
=
"title"
:
visible
.
sync
=
"open"
width
=
"1200px"
append
-
to
-
body
>
<
el
-
form
ref
=
"form"
:
model
=
"form"
:
rules
=
"rules"
label
-
width
=
"80px"
>
<!--
表单内容保持不变
-->
<!--
添加
/
修改入库对话框
-->
<
el
-
dialog
:
title
=
"title"
v
-
model
=
"open"
:
visible
.
sync
=
"open"
width
=
"1200px"
append
-
to
-
body
destroy
-
on
-
close
>
<
el
-
form
ref
=
"formRef"
:
model
=
"form"
:
rules
=
"rules"
label
-
width
=
"80px"
>
<
el
-
divider
content
-
position
=
"center"
>
入库单基础信息
<
/el-divider
>
<
el
-
row
:
gutter
=
"24"
>
<
el
-
col
:
span
=
"12"
>
...
...
@@ -280,8 +286,7 @@
type
=
"date"
value
-
format
=
"yyyy-MM-dd"
placeholder
=
"请选择入库日期"
>
<
/el-date-picker
>
/>
<
/el-form-item
>
<
/el-col
>
<
el
-
col
:
span
=
"12"
>
...
...
@@ -319,32 +324,6 @@
<
/el-col
>
<
/el-row
>
<!--
<
el
-
divider
content
-
position
=
"center"
>
入库其他信息
<
/el-divider> --
>
<!--
<
el
-
row
:
gutter
=
"24"
>
<
el
-
col
:
span
=
"12"
>
<
div
class
=
"form-col"
>
<
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
=
"仓库"
prop
=
"warehouseId"
>
<
el
-
input
v
-
model
=
"form.warehouseId"
placeholder
=
"请输入仓库ID"
/>
<
/el-form-item
>
<
/div
>
<
/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-col
>
<
/el-row> --
>
<
el
-
form
-
item
label
=
"备注"
prop
=
"remark"
>
<
el
-
input
v
-
model
=
"form.remark"
type
=
"textarea"
placeholder
=
"请输入内容"
/>
<
/el-form-item
>
...
...
@@ -385,43 +364,37 @@
<!--
入库单详情弹窗
-->
<
el
-
dialog
title
=
"入库单详细信息"
v
-
model
=
"detailOpen"
:
visible
.
sync
=
"detailOpen"
width
=
"1200px"
append
-
to
-
body
class
=
"scrollable-dialog"
>
<
div
class
=
"detail-container"
>
<!--
基础信息展示
-->
<
el
-
descriptions
:
column
=
"2"
border
class
=
"mb20"
>
<
el
-
descriptions
:
column
=
"2"
class
=
"mb20"
border
>
<
el
-
descriptions
-
item
label
=
"入库单号"
>
{{
detailForm
.
orderId
||
'-'
}}
<
/el-descriptions-item
>
<
el
-
descriptions
-
item
label
=
"系统编号"
>
{{
detailForm
.
systemNo
||
'-'
}}
<
/el-descriptions-item
>
<
el
-
descriptions
-
item
label
=
"批次号"
>
{{
detailForm
.
batchId
||
'-'
}}
<
/el-descriptions-item
>
<
el
-
descriptions
-
item
label
=
"货主"
>
{{
detailForm
.
ownerName
||
detailForm
.
ownerId
||
'-'
}}
<
/el-descriptions-item
>
<
el
-
descriptions
-
item
label
=
"入库类型"
>
{{
getDictLabel
(
'inbound_outbound_type'
,
detailForm
.
orderTypeId
)
}}
{{
getDictLabel
(
'inbound_outbound_type'
,
detailForm
.
orderTypeId
)
}}
<
/el-descriptions-item
>
<
el
-
descriptions
-
item
label
=
"订单类型"
>
{{
getDictLabel
(
'order_type'
,
detailForm
.
orderType
)
}}
{{
getDictLabel
(
'order_type'
,
detailForm
.
orderType
)
}}
<
/el-descriptions-item
>
<
el
-
descriptions
-
item
label
=
"入库日期"
>
{{
detailForm
.
inboundDate
||
'-'
}}
<
/el-descriptions-item
>
<!--
<
el
-
descriptions
-
item
label
=
"负责人"
>
{{
detailForm
.
opUserName
||
'-'
}}
<
/el-descriptions-item> --
>
<!--
<
el
-
descriptions
-
item
label
=
"计划量"
>
{{
detailForm
.
totalPlannedQuantity
||
'-'
}}
<
/el-descriptions-item
>
<
el
-
descriptions
-
item
label
=
"实际量"
>
{{
detailForm
.
totalActualQuantity
||
'-'
}}
<
/el-descriptions-item> --
>
<!--
<
el
-
descriptions
-
item
label
=
"总件数"
>
{{
detailForm
.
totalPackages
||
'-'
}}
<
/el-descriptions-item> --
>
<!--
<
el
-
descriptions
-
item
label
=
"仓库"
>
{{
detailForm
.
warehouseId
||
'-'
}}
<
/el-descriptions-item> --
>
<
el
-
descriptions
-
item
label
=
"备注"
:
span
=
"2"
>
<
div
class
=
"remark-text"
>
{{
detailForm
.
remark
||
'-'
}}
<
/div
>
<
/el-descriptions-item
>
<
/el-descriptions
>
<!--
明细信息展示
-->
<
el
-
divider
content
-
position
=
"center"
>
入库单明细信息
<
/el-divider
>
<
InboundItems
ref
=
"detailItemsRef"
v
-
model
=
"detailForm.inboundOrderItemsList"
:
embedded
=
"true"
:
inboundOrderId
=
"detailForm.inboundOrderId"
:
isEditable
=
"
isEditabl
e"
:
isEditable
=
"
fals
e"
:
show
-
search
-
form
=
"false"
:
show
-
pagination
=
"false"
:
show
-
toolbar
=
"false"
...
...
@@ -437,8 +410,16 @@
<
el
-
button
@
click
=
"detailOpen = false"
>
关闭
<
/el-button
>
<
/div
>
<
/el-dialog
>
<!--
物料选择弹窗
-->
<
el
-
dialog
title
=
"选择物料"
:
visible
.
sync
=
"materialSelectOpen"
width
=
"1200px"
append
-
to
-
body
>
<
el
-
dialog
title
=
"选择物料"
v
-
model
=
"materialSelectOpen"
:
visible
.
sync
=
"materialSelectOpen"
width
=
"1200px"
append
-
to
-
body
destroy
-
on
-
close
>
<
MaterialSelector
v
-
model
=
"selectedMaterialIds"
:
multiple
=
"true"
...
...
@@ -453,7 +434,7 @@
<!--
导入弹窗
-->
<
import
-
excel
ref
=
"import
"
ref
=
"importRef
"
title
=
"导入"
import
-
url
=
"/inventory/inbound/import"
template
-
url
=
"/inventory/inbound/importTemplate"
...
...
@@ -463,16 +444,16 @@
@
orderTypeChange
=
"handleOrderTypeChange"
:
orderTypeRequired
=
"true"
/>
<!--
选择器组件
-->
<
OwnerSelector
v
-
model
=
"ownerSelectorVisible"
@
selected
=
"handleOwnerSelected"
/>
<!--
仓库选择组件
-->
<
WarehouseSelector
v
-
model
=
"warehouseSelectorVisible"
@
selected
=
"handleWarehouseSelected"
/>
<!--
库位选择组件
-->
<
LocationSelector
v
-
model
=
"locationSelectorVisible"
@
selected
=
"handleLocationSelected"
...
...
@@ -481,13 +462,19 @@
<
/template
>
<
script
>
import
{
listInbound
,
getInbound
,
delInbound
,
addInbound
,
updateInbound
}
from
"@/api/inventory/inbound"
import
{
listInbound
,
getInbound
,
delInbound
,
addInbound
,
updateInbound
}
from
"@/api/inventory/inbound"
import
{
listInbound_itemsAndMname
}
from
"@/api/inventory/inbound_items"
import
{
batchAddInventory
}
from
"@/api/inventory/inventory"
import
InboundItems
from
"@/views/inventory/inbound_items/index.vue"
import
PageTitle
from
"@/components/PageTitle"
// 引入字典页面的标题组件
import
PageWrapperSearch
from
"@/components/Search/PageWrapperSearch"
// 引入搜索包装组件
import
MaterialSelector
from
"@/views/inventory/materials/materialsSeletor.vue"
;
import
PageTitle
from
"@/components/PageTitle"
import
PageWrapperSearch
from
"@/components/Search/PageWrapperSearch"
import
MaterialSelector
from
"@/views/inventory/materials/materialsSeletor.vue"
import
ImportExcel
from
"@/components/ImportExcel/index"
import
OwnerSelector
from
"@/views/compononents/OwnerSelector.vue"
import
WarehouseSelector
from
"@/views/compononents/WarehouseSelector.vue"
...
...
@@ -495,7 +482,7 @@ import LocationSelector from "@/views/compononents/LocationSelector.vue"
export
default
{
name
:
"Inbound"
,
dicts
:
[
'inbound_outbound_type'
,
'order_type'
,
'inbound_status'
],
dicts
:
[
'inbound_outbound_type'
,
'order_type'
,
'inbound_status'
],
components
:
{
InboundItems
,
PageTitle
,
...
...
@@ -508,447 +495,463 @@ export default {
}
,
data
()
{
return
{
// 日期
组件返回数组
// 日期
范围
inboundDateRange
:
null
,
// 货主选择
相关(对齐退库组件)
queryOwnerName
:
null
,
// 货主选择
queryOwnerName
:
''
,
ownerSelectorVisible
:
false
,
ownerSelectTarget
:
'form'
,
// 标记当前货主选择的目标:query-搜索页,form-表单页
// 仓库
和库位选择相关
ownerSelectTarget
:
'form'
,
// 仓库
/库位选择
warehouseSelectorVisible
:
false
,
locationSelectorVisible
:
false
,
currentEditRow
:
null
,
currentEditRowWarehousesId
:
null
,
// 可编辑状态
isEditable
:
true
,
// 物料组件显示
// 物料选择
materialSelectOpen
:
false
,
selectedMaterialIds
:
[],
inboundItemsUpdateStatus
:
false
,
// 组件带来的选中的物料详情(code、name)
selectedMaterials
:
[],
// 详情弹窗
detailOpen
:
false
,
detailForm
:
{
}
,
// 新增详情表单数据
// 组件监听修改时的orderId变化
inboundOrderId
:
null
,
// 选中的明细项
selectedItems
:
[],
// 遮罩层
detailForm
:
{
}
,
// 基础状态
loading
:
true
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 入库表格数据
inboundList
:
[],
//
弹出层标题
//
编辑弹窗
title
:
""
,
// 是否显示弹出层
open
:
false
,
// 查询参数
inboundOrderId
:
null
,
// 查询参数(规范化初始值)
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
orderId
:
null
,
orderTypeId
:
null
,
systemNo
:
null
,
batchId
:
null
,
warehouseId
:
null
,
ownerId
:
null
,
// 货主ID(搜索用)
ownerName
:
null
,
// 货主名称(搜索用)
ownerCode
:
null
,
// 货主编码(搜索用)
orderStatus
:
null
,
orderType
:
null
,
inboundDateStart
:
null
,
// 开始日期(搜索用)
inboundDateEnd
:
null
// 结束日期(搜索用)
orderId
:
''
,
orderTypeId
:
''
,
systemNo
:
''
,
batchId
:
''
,
warehouseId
:
''
,
ownerId
:
''
,
ownerName
:
''
,
ownerCode
:
''
,
orderStatus
:
''
,
orderType
:
''
,
inboundDateStart
:
''
,
inboundDateEnd
:
''
}
,
// 表单参数(
对齐退库组件的货主字段
)
// 表单参数(
规范化初始值 + 合理默认
)
form
:
{
id
:
null
,
orderId
:
null
,
orderTypeId
:
null
,
batchId
:
null
,
warehouseId
:
null
,
warehousesName
:
null
,
ownerId
:
null
,
// 货主ID
ownerName
:
null
,
// 货主名称
ownerCode
:
null
,
// 货主编码
id
:
''
,
orderId
:
''
,
orderTypeId
:
''
,
batchId
:
''
,
warehouseId
:
''
,
warehousesName
:
''
,
ownerId
:
''
,
ownerName
:
''
,
ownerCode
:
''
,
orderStatus
:
1
,
referenceNo
:
null
,
plannedArrivalDate
:
undefined
,
actualArrivalDate
:
undefined
,
inboundDate
:
this
.
formatDate
(
new
Date
()),
// 入库日期
totalPlannedQuantity
:
null
,
totalActualQuantity
:
null
,
totalPackages
:
null
,
remark
:
null
,
opUserName
:
null
,
isUsed
:
null
,
sortNo
:
null
,
createTime
:
null
,
createUserCode
:
null
,
updateTime
:
null
,
updateUserCode
:
null
,
// 明细列表
referenceNo
:
''
,
plannedArrivalDate
:
''
,
actualArrivalDate
:
''
,
inboundDate
:
this
.
formatDate
(
new
Date
()),
totalPlannedQuantity
:
0
,
totalActualQuantity
:
0
,
totalPackages
:
0
,
remark
:
''
,
opUserName
:
''
,
isUsed
:
''
,
sortNo
:
''
,
createTime
:
''
,
createUserCode
:
''
,
updateTime
:
''
,
updateUserCode
:
''
,
inboundOrderItemsList
:
[]
}
,
// 表单校验
// 表单校验
规则
rules
:
{
orderId
:
[
{
required
:
true
,
message
:
"入库单号不能为空"
,
trigger
:
"blur"
}
],
orderTypeId
:
[
{
required
:
true
,
message
:
"入库类型不能为空"
,
trigger
:
"blur"
}
],
systemNo
:
[
{
required
:
true
,
message
:
"系统编号不能为空"
,
trigger
:
"blur"
}
],
batchId
:
[
{
required
:
true
,
message
:
"批次号不能为空"
,
trigger
:
"blur"
}
],
ownerId
:
[
// 新增货主必填校验
{
required
:
true
,
message
:
"货主不能为空"
,
trigger
:
"change"
}
]
orderId
:
[{
required
:
true
,
message
:
"入库单号不能为空"
,
trigger
:
"blur"
}
],
orderTypeId
:
[{
required
:
true
,
message
:
"入库类型不能为空"
,
trigger
:
"blur"
}
],
systemNo
:
[{
required
:
true
,
message
:
"系统编号不能为空"
,
trigger
:
"blur"
}
],
batchId
:
[{
required
:
true
,
message
:
"批次号不能为空"
,
trigger
:
"blur"
}
],
ownerId
:
[{
required
:
true
,
message
:
"货主不能为空"
,
trigger
:
"change"
}
]
}
}
}
,
mounted
()
{
}
,
created
()
{
this
.
getList
()
}
,
methods
:
{
// 日期格式化方法(兼容不同浏览器的日期格式)
/**
* 日期格式化(补零处理)
* @param {Date
}
date 日期对象
* @returns {string
}
格式化后的日期字符串
*/
formatDate
(
date
)
{
const
year
=
date
.
getFullYear
();
const
month
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
);
// 月份从0开始,补0
const
day
=
String
(
date
.
getDate
()).
padStart
(
2
,
'0'
);
// 日期补0
const
month
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
);
const
day
=
String
(
date
.
getDate
()).
padStart
(
2
,
'0'
);
return
`${year
}
-${month
}
-${day
}
`
;
}
,
/** 查询入库列表 */
getList
()
{
this
.
loading
=
true
listInbound
(
this
.
queryParams
).
then
(
response
=>
{
this
.
inboundList
=
response
.
rows
this
.
total
=
response
.
total
this
.
loading
=
false
}
).
catch
(()
=>
{
this
.
loading
=
false
}
)
}
,
handleOrderTypeChange
(
selection
)
{
this
.
form
.
orderTypeId
=
selection
}
,
/** 获取状态样式类型 */
getStatusType
(
status
)
{
const
item
=
this
.
inBoundStatusOptions
.
find
(
item
=>
item
.
orderStatus
===
status
)
return
item
?
item
.
type
:
'info'
}
,
/** 获取状态类型名称 */
getStatusName
(
status
)
{
const
item
=
this
.
inBoundStatusOptions
.
find
(
item
=>
item
.
orderStatus
===
status
)
return
item
?
item
.
orderStatusName
:
status
/**
* 查询入库列表(异步优化 + 错误捕获)
*/
async
getList
()
{
try
{
this
.
loading
=
true
;
const
res
=
await
listInbound
(
this
.
queryParams
);
this
.
inboundList
=
res
.
rows
||
[];
this
.
total
=
res
.
total
||
0
;
}
catch
(
error
)
{
this
.
$message
.
error
(
'查询入库列表失败:'
+
(
error
.
message
||
'网络异常'
));
console
.
error
(
'入库列表查询失败:'
,
error
);
}
finally
{
this
.
loading
=
false
;
}
}
,
/**
* 获取字典标签(通用方法)
* @param {string
}
dictType 字典类型
* @param {*
}
value 字典值
* @returns {string
}
字典标签
*/
getDictLabel
(
dictType
,
value
)
{
// 1. 空值/字典不存在时返回默认值
if
(
!
value
||
!
this
.
dict
?.
type
?.[
dictType
])
return
'-'
;
// 2. 从字典数组中匹配 value 对应的 label
const
dictItem
=
this
.
dict
.
type
[
dictType
].
find
(
item
=>
item
.
value
===
value
);
return
dictItem
?.
label
||
'-'
;
}
,
getDictListClass
(
dictType
,
value
){
// 1. 空值/字典不存在时返回默认值
if
(
!
value
||
!
this
.
dict
?.
type
?.[
dictType
])
return
'-'
;
// 2. 从字典数组中匹配 value 对应的 label
/**
* 获取字典标签样式类(语义化命名)
* @param {string
}
dictType 字典类型
* @param {*
}
value 字典值
* @returns {string
}
样式类名
*/
getDictTagClass
(
dictType
,
value
)
{
if
(
!
value
||
!
this
.
dict
?.
type
?.[
dictType
])
return
''
;
const
dictItem
=
this
.
dict
.
type
[
dictType
].
find
(
item
=>
item
.
value
===
value
);
return
dictItem
?.
raw
?.
listClass
||
''
;
}
,
getOrderTypeName
(
type
)
{
if
(
!
type
)
return
'未知类型'
const
item
=
this
.
orderTypeOptions
.
find
(
item
=>
item
.
orderType
===
type
)
return
item
?
item
.
orderTypeName
:
'未知类型'
}
,
/** 搜索按钮操作 */
/**
* 搜索按钮操作(日期范围处理优化)
*/
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
this
.
queryParams
.
pageNum
=
1
;
// 处理日期范围
if
(
Array
.
isArray
(
this
.
inboundDateRange
)
&&
this
.
inboundDateRange
.
length
===
2
)
{
this
.
queryParams
.
inboundDateStart
=
this
.
inboundDateRange
[
0
];
this
.
queryParams
.
inboundDateEnd
=
this
.
inboundDateRange
[
1
];
}
else
{
// 清空开始/结束日期(避免残留旧值)
this
.
queryParams
.
inboundDateStart
=
""
;
this
.
queryParams
.
inboundDateEnd
=
""
;
this
.
queryParams
.
inboundDateStart
=
''
;
this
.
queryParams
.
inboundDateEnd
=
''
;
}
this
.
getList
()
this
.
getList
()
;
}
,
/** 重置按钮操作 */
/**
* 重置查询条件(精简逻辑 + 响应式优化)
*/
resetQuery
()
{
// this.$refs.queryForm?.resetFields()
this
.
queryOwnerName
=
null
this
.
queryOwnerName
=
''
;
this
.
inboundDateRange
=
null
;
this
.
queryParams
=
{
pageNum
:
1
,
pageSize
:
10
,
orderId
:
null
,
orderTypeId
:
null
,
systemNo
:
null
,
batchId
:
null
,
warehouseId
:
null
,
ownerId
:
null
,
ownerName
:
null
,
ownerCode
:
null
,
orderStatus
:
null
,
orderType
:
null
,
inboundDateStart
:
null
,
inboundDateEnd
:
null
}
this
.
inboundDateRange
=
null
;
this
.
$nextTick
(()
=>
{
// 重新触发查询,加载默认数据
this
.
handleQuery
()
}
)
orderId
:
''
,
orderTypeId
:
''
,
systemNo
:
''
,
batchId
:
''
,
warehouseId
:
''
,
ownerId
:
''
,
ownerName
:
''
,
ownerCode
:
''
,
orderStatus
:
''
,
orderType
:
''
,
inboundDateStart
:
''
,
inboundDateEnd
:
''
}
;
this
.
$nextTick
(()
=>
this
.
getList
());
}
,
/** 多选框选中数据 */
/**
* 多选框选中事件
* @param {Array
}
selection 选中行
*/
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
;
this
.
single
=
selection
.
length
!==
1
;
this
.
multiple
=
!
selection
.
length
;
}
,
/** 新增按钮操作 */
/**
* 新增入库单
*/
handleAdd
()
{
this
.
reset
()
this
.
open
=
true
this
.
title
=
"添加入库"
this
.
reset
Form
();
this
.
open
=
true
;
this
.
title
=
"添加入库"
;
}
,
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
();
/**
* 修改入库单
* @param {Object
}
row 选中行数据
*/
async
handleUpdate
(
row
)
{
try
{
this
.
resetForm
();
const
id
=
row
?.
id
||
this
.
ids
[
0
];
if
(
!
id
)
return
this
.
$message
.
warning
(
'请选择要修改的入库单'
);
let
id
=
row
.
id
;
if
(
id
===
undefined
){
id
=
this
.
ids
[
0
]
}
getInbound
(
id
).
then
(
response
=>
{
if
(
response
.
data
.
orderStatus
===
2
){
this
.
$modal
.
msgWarning
(
"该入库单已提交,不能修改"
);
return
;
const
res
=
await
getInbound
(
id
);
const
data
=
res
.
data
||
{
}
;
// 禁用已提交的入库单修改
if
(
data
.
orderStatus
===
2
)
{
return
this
.
$modal
.
msgWarning
(
"该入库单已提交,不能修改"
);
}
this
.
form
=
response
.
data
||
{
}
;
// 货主回显
this
.
form
.
ownerName
=
response
.
data
.
ownerName
||
response
.
data
.
ownerCode
||
response
.
data
.
ownerId
;
// // 仓库回显
// this.form.warehousesName = response.data.warehousesName || response.data.warehouseId || '-';
// 明细行回显(核心:同步仓库/库位名称)
if
(
this
.
form
.
inboundOrderItemsList
&&
this
.
form
.
inboundOrderItemsList
.
length
)
{
this
.
form
.
inboundOrderItemsList
=
this
.
form
.
inboundOrderItemsList
.
map
(
item
=>
({
// 表单赋值 + 回显优化
this
.
form
=
{
...
data
,
ownerName
:
data
.
ownerName
||
data
.
ownerCode
||
data
.
ownerId
,
inboundOrderItemsList
:
(
data
.
inboundOrderItemsList
||
[]).
map
(
item
=>
({
...
item
,
// 仓库名称兜底
warehousesName
:
item
.
warehousesName
||
item
.
warehouseId
||
'-'
,
// 库位名称/编码兜底
locationName
:
item
.
locationName
||
item
.
locationCode
||
item
.
locationId
||
'-'
,
locationCode
:
item
.
locationCode
||
item
.
locationId
||
'-'
,
orderTypeId
:
item
.
orderTypeId
||
1
}
))
;
}
console
.
log
(
this
.
form
.
inboundOrderItemsList
)
}
))
}
;
this
.
inboundOrderId
=
id
;
// 强制触发子组件的 value 监听(关键)
this
.
$nextTick
(()
=>
{
this
.
$refs
.
inboundItemsRef
?.
handlePagination
();
this
.
$refs
.
inboundItemsRef
?.
calculateTotals
();
}
);
this
.
open
=
true
;
this
.
title
=
"修改入库单"
;
}
);
}
catch
(
error
)
{
this
.
$message
.
error
(
'获取入库单详情失败:'
+
(
error
.
message
||
'网络异常'
));
console
.
error
(
'修改入库单失败:'
,
error
);
}
}
,
/** 查看详情 */
handleDetail
(
row
)
{
this
.
reset
()
const
id
=
row
.
id
this
.
isEditable
=
false
getInbound
(
id
).
then
(
response
=>
{
// 加载明细数据到详情
this
.
detailForm
=
response
.
data
;
if
(
this
.
detailForm
.
inboundOrderItemsList
&&
this
.
detailForm
.
inboundOrderItemsList
.
length
){
this
.
detailForm
.
inboundOrderItemsList
=
this
.
detailForm
.
inboundOrderItemsList
.
map
(
item
=>
({
/**
* 查看入库单详情
* @param {Object
}
row 选中行数据
*/
async
handleDetail
(
row
)
{
try
{
const
id
=
row
?.
id
;
if
(
!
id
)
return
this
.
$message
.
warning
(
'请选择要查看的入库单'
);
const
res
=
await
getInbound
(
id
);
this
.
detailForm
=
{
...
res
.
data
,
ownerName
:
res
.
data
.
ownerName
||
res
.
data
.
ownerCode
||
res
.
data
.
ownerId
,
inboundOrderItemsList
:
(
res
.
data
.
inboundOrderItemsList
||
[]).
map
(
item
=>
({
...
item
,
orderTypeId
:
this
.
detailForm
.
orderTypeId
}
));
orderTypeId
:
res
.
data
.
orderTypeId
}
)),
inboundOrderId
:
id
}
;
this
.
detailOpen
=
true
;
}
catch
(
error
)
{
this
.
$message
.
error
(
'获取入库单详情失败:'
+
(
error
.
message
||
'网络异常'
));
console
.
error
(
'查看入库单详情失败:'
,
error
);
}
// 适配货主回显
this
.
detailForm
.
ownerName
=
response
.
data
.
ownerName
||
response
.
data
.
ownerCode
||
response
.
data
.
ownerId
this
.
detailForm
.
inboundOrderId
=
id
this
.
detailOpen
=
true
}
)
}
,
// 打开货主选择器(区分搜索/表单场景)
/**
* 打开货主选择器
* @param {string
}
target 目标场景:query/form
*/
openOwnerSelector
(
target
=
'form'
)
{
this
.
ownerSelectTarget
=
target
this
.
ownerSelectorVisible
=
true
this
.
ownerSelectTarget
=
target
;
this
.
ownerSelectorVisible
=
true
;
}
,
// 货主选择回调(对齐退库组件逻辑)
/**
* 货主选择回调
* @param {Object
}
owner 选中的货主
*/
handleOwnerSelected
(
owner
)
{
if
(
!
owner
)
return
// 搜索页选择货主
if
(
!
owner
)
return
;
if
(
this
.
ownerSelectTarget
===
'query'
)
{
this
.
queryParams
.
ownerId
=
owner
.
ownerId
this
.
queryParams
.
ownerCode
=
owner
.
ownerCode
this
.
queryOwnerName
=
owner
.
ownerName
||
owner
.
ownerCode
this
.
handleQuery
()
// 选择后立即搜索
// 搜索页货主选择
this
.
queryParams
.
ownerId
=
owner
.
ownerId
;
this
.
queryParams
.
ownerCode
=
owner
.
ownerCode
;
this
.
queryOwnerName
=
owner
.
ownerName
||
owner
.
ownerCode
;
this
.
getList
();
}
else
{
// 表单页
选择货主
this
.
form
.
ownerId
=
owner
.
ownerId
this
.
form
.
ownerCode
=
owner
.
ownerCode
this
.
form
.
ownerName
=
owner
.
ownerName
// 表单页
货主选择
this
.
form
.
ownerId
=
owner
.
ownerId
;
this
.
form
.
ownerCode
=
owner
.
ownerCode
;
this
.
form
.
ownerName
=
owner
.
ownerName
;
}
this
.
ownerSelectorVisible
=
false
this
.
ownerSelectorVisible
=
false
;
}
,
// 清空搜索页货主
/**
* 清空搜索页货主
*/
clearQueryOwner
()
{
this
.
queryOwnerName
=
null
this
.
queryParams
.
ownerId
=
null
this
.
queryParams
.
ownerCode
=
null
this
.
queryParams
.
ownerName
=
null
this
.
handleQuery
()
// 清空后重新搜索
this
.
queryOwnerName
=
''
;
this
.
queryParams
.
ownerId
=
''
;
this
.
queryParams
.
ownerCode
=
''
;
this
.
getList
();
}
,
// 清空表单页货主
/**
* 清空表单页货主
*/
clearFormOwner
()
{
this
.
form
.
ownerId
=
null
this
.
form
.
ownerCode
=
null
this
.
form
.
ownerName
=
null
// 清除货主字段校验
this
.
$refs
.
form
?.
clearValidate
(
'ownerId'
)
this
.
form
.
ownerId
=
''
;
this
.
form
.
ownerCode
=
''
;
this
.
form
.
ownerName
=
''
;
this
.
$refs
.
formRef
?.
clearValidate
(
'ownerId'
);
}
,
// 打开仓库选择器
/**
* 打开仓库选择器
* @param {Object
}
row 编辑行
*/
openWarehouseSelector
(
row
)
{
this
.
currentEditRow
=
row
this
.
warehouseSelectorVisible
=
true
this
.
currentEditRow
=
row
;
this
.
warehouseSelectorVisible
=
true
;
}
,
// 仓库选择回调
/**
* 仓库选择回调
* @param {Object
}
warehouse 选中的仓库
*/
handleWarehouseSelected
(
warehouse
)
{
if
(
this
.
currentEditRow
)
{
// 1. 用 $set 赋值,确保响应式
if
(
!
warehouse
||
!
this
.
currentEditRow
)
return
;
this
.
$set
(
this
.
currentEditRow
,
'warehouseId'
,
warehouse
.
warehouseId
);
this
.
$set
(
this
.
currentEditRow
,
'warehousesName'
,
warehouse
.
warehousesName
);
// 2. 通知子组件刷新(关键:触发 displayData 的响应式更新)
this
.
$refs
.
inboundItemsRef
?.
syncDataToParent
();
this
.
$refs
.
inboundItemsRef
?.
calculateTotals
();
}
else
{
this
.
form
.
warehouseId
=
warehouse
.
warehouseId
;
this
.
form
.
warehousesName
=
warehouse
.
warehousesName
;
}
this
.
warehouseSelectorVisible
=
false
;
}
,
// 打开库位选择器
/**
* 打开库位选择器
* @param {Object
}
row 编辑行
*/
openLocationSelector
(
row
)
{
this
.
currentEditRow
=
row
// this.currentEditRowWarehousesId = row.warehouseId // 传递仓库ID给库位选择器
this
.
locationSelectorVisible
=
true
this
.
currentEditRow
=
row
;
this
.
locationSelectorVisible
=
true
;
}
,
// 库位选择回调
/**
* 库位选择回调
* @param {Object
}
location 选中的库位
*/
handleLocationSelected
(
location
)
{
if
(
this
.
currentEditRow
)
{
// 1. 用 $set 赋值,确保响应式
if
(
!
location
||
!
this
.
currentEditRow
)
return
;
this
.
$set
(
this
.
currentEditRow
,
'locationId'
,
location
.
locationId
);
this
.
$set
(
this
.
currentEditRow
,
'locationCode'
,
location
.
locationCode
);
this
.
$set
(
this
.
currentEditRow
,
'locationName'
,
location
.
locationName
);
// 2. 通知子组件刷新
this
.
$refs
.
inboundItemsRef
?.
syncDataToParent
();
this
.
$refs
.
inboundItemsRef
?.
calculateTotals
();
}
this
.
locationSelectorVisible
=
false
;
}
,
// 打开物料选择弹窗
/**
* 打开物料选择弹窗
* @param {boolean
}
status 是否显示
*/
showMaterials
(
status
)
{
this
.
materialSelectOpen
=
status
if
(
status
)
{
// 只有打开弹窗时才清空选择
this
.
selectedMaterialIds
=
[]
// 先清空父组件数据
this
.
selectedMaterials
=
[]
this
.
$nextTick
(()
=>
{
// 确保弹窗渲染完成后再调用子组件方法
this
.
$refs
.
materialSelector
?.
clearSelection
()
}
)
this
.
materialSelectOpen
=
status
;
if
(
status
)
{
this
.
selectedMaterialIds
=
[];
this
.
selectedMaterials
=
[];
this
.
$nextTick
(()
=>
this
.
$refs
.
materialSelector
?.
clearSelection
());
}
}
,
// 物料选择变化回调
/**
* 物料选择变化回调
* @param {Array
}
selectedRows 选中的物料行
*/
handleMaterialChange
(
selectedRows
)
{
this
.
selectedMaterials
=
selectedRows
this
.
selectedMaterials
=
selectedRows
||
[];
}
,
// 确认选择物料并添加到明细
/**
* 确认选择物料并添加到明细
*/
confirmMaterialSelect
()
{
if
(
this
.
selectedMaterials
.
length
===
0
)
{
this
.
$message
.
warning
(
"请选择物料"
)
return
return
this
.
$message
.
warning
(
"请选择物料"
);
}
// 过滤重复物料
const
newMaterials
=
this
.
selectedMaterials
.
filter
(
material
=>
!
this
.
form
.
inboundOrderItemsList
.
some
(
item
=>
item
.
materialId
===
material
.
id
)
);
if
(
newMaterials
.
length
===
0
)
{
return
this
.
$message
.
warning
(
"所选物料已全部添加,无需重复添加"
);
}
// 将选中的物料添加到入库明细
this
.
selectedMaterials
.
forEach
(
material
=>
{
// 检查是否已存在该物料,避免重复添加
// const exists = this.form.inboundOrderItemsList.some(
// item => item.materialId === material.materialId
// )
const
exists
=
false
if
(
!
exists
)
{
// 添加新物料到明细
newMaterials
.
forEach
(
material
=>
{
this
.
form
.
inboundOrderItemsList
.
push
({
materialId
:
material
.
id
,
sapNo
:
material
.
sapNo
,
materialName
:
material
.
materialName
,
// 仅用于展示
batchCode
:
null
,
warehouseId
:
null
,
warehousesName
:
null
,
locationId
:
null
,
locationName
:
null
,
materialName
:
material
.
materialName
,
batchCode
:
''
,
warehouseId
:
''
,
warehousesName
:
''
,
locationId
:
''
,
locationName
:
''
,
plannedQuantity
:
0
,
actualQuantity
:
0
,
unitPrice
:
0
,
totalAmount
:
0
,
actualPackages
:
0
,
divisor
:
0
}
)
}
else
{
// this.$message.warning(`物料 $
{
material
.
materialName
}
已存在,跳过添加
`)
}
}
)
this.materialSelectOpen = false
this.$refs.inboundItemsRef.handleAddItem(this.selectedMaterials)
this.$message.success(`
成功添加
$
{
this
.
selectedMaterials
.
length
}
个物料
`)
}
);
}
);
this
.
$refs
.
inboundItemsRef
?.
handleAddItem
(
newMaterials
);
this
.
materialSelectOpen
=
false
;
this
.
$message
.
success
(
`成功添加 ${newMaterials.length
}
个物料`
);
}
,
/** 确认入库操作 */
async handleConfirm(row) { // 标记为 async 函数
/**
* 确认入库操作
* @param {Object
}
row 选中行数据
*/
async
handleConfirm
(
row
)
{
try
{
// 第一步:确认弹窗
await
this
.
$confirm
(
'确认要入库吗?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}
)
}
)
;
// 第二步:等待 listInbound_items 执行完成
const queryForm = {
pageNum: 1,
pageSize: 9999,
inboundOrderId: row.id
// 查询入库明细
const
queryForm
=
{
pageNum
:
1
,
pageSize
:
9999
,
inboundOrderId
:
row
.
id
}
;
const
res
=
await
listInbound_itemsAndMname
(
queryForm
);
const
items
=
res
.
rows
||
[];
if
(
items
.
length
===
0
)
{
return
this
.
$message
.
warning
(
'暂无入库明细数据,无法确认入库'
);
}
const response = await listInbound_itemsAndMname(queryForm)
row.inboundOrderItemsList = response.rows.map(item => {
return
{
// 组装库存数据
const
inventoryItems
=
items
.
map
(
item
=>
(
{
...
item
,
inventoryType
:
row
.
orderTypeId
,
warehousesId
:
item
.
warehouseId
,
...
...
@@ -958,233 +961,250 @@ export default {
unitWeight
:
item
.
unitWeight
,
isUsed
:
1
,
unitPrice
:
item
.
unitPrice
}
;
}
)
// 第三步:确保数据存在后调用入库接口
if (!row.inboundOrderItemsList || row.inboundOrderItemsList.length === 0) {
this.$message.warning('暂无入库明细数据,无法确认入库')
return
}
}
));
await batchAddInventory(row.inboundOrderItemsList)
// 批量添加库存
await
batchAddInventory
(
inventoryItems
);
// 第四步:操作成功提示
// this.$modal.msgSuccess("确认成功")
this.$message.success('确认入库成功')
row.orderStatus = 2
updateInbound(row).then(() => {
this.getList()
}
)
// 更新入库单状态
row
.
orderStatus
=
2
;
await
updateInbound
(
row
);
this
.
$message
.
success
(
'确认入库成功'
);
this
.
getList
();
}
catch
(
error
)
{
// 捕获取消确认/接口失败的异常
if
(
error
!==
'cancel'
)
{
this.$message.error('确认入库失败:' + (error.msg ||
'网络异常'))
console.
log(error)
this
.
$message
.
error
(
'确认入库失败:'
+
(
error
.
msg
||
error
.
message
||
'网络异常'
));
console
.
error
(
'确认入库失败:'
,
error
);
}
}
}
,
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$confirm((row.orderId ? '是否确认删除入库单编号为"' + row.orderId + '"的数据项?' : '是否确认删除选中的' + ids.length + '条入库单'), '提示', {
type: 'warning'
}
).then(() => {
return delInbound(ids)
}
).then(() => {
this.getList()
this.$message.success("删除成功")
}
).catch(() => {
}
)
/**
* 删除入库单
* @param {Object
}
row 选中行数据
*/
async
handleDelete
(
row
)
{
try
{
const
ids
=
row
?.
id
||
this
.
ids
;
if
(
!
ids
||
ids
.
length
===
0
)
{
return
this
.
$message
.
warning
(
'请选择要删除的入库单'
);
}
const
confirmText
=
row
?.
orderId
?
`是否确认删除入库单编号为"${row.orderId
}
"的数据项?`
:
`是否确认删除选中的${ids.length
}
条入库单`
;
await
this
.
$confirm
(
confirmText
,
'提示'
,
{
type
:
'warning'
}
);
await
delInbound
(
ids
);
this
.
$message
.
success
(
"删除成功"
);
this
.
getList
();
}
catch
(
error
)
{
if
(
error
!==
'cancel'
)
{
this
.
$message
.
error
(
'删除失败:'
+
(
error
.
message
||
'网络异常'
));
console
.
error
(
'删除入库单失败:'
,
error
);
}
}
}
,
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) return
/**
* 提交表单(新增/修改)
*/
async
submitForm
()
{
try
{
// 表单校验
const
valid
=
await
this
.
$refs
.
formRef
.
validate
();
if
(
!
valid
)
return
;
//
验证明细表
const errors = this.$refs.inboundItemsRef
? this.$refs.inboundItemsRef.validate() : []
//
明细校验
const
errors
=
this
.
$refs
.
inboundItemsRef
?.
validate
()
||
[];
if
(
errors
.
length
>
0
)
{
this.$message.error(errors.join(';'))
return
return
this
.
$message
.
error
(
errors
.
join
(
';'
));
}
// 确保明细项数量大于0
if (!this.form.inboundOrderItemsList || this.form.inboundOrderItemsList.length === 0) {
this.$message.warning('请至少添加一条入库明细')
return
// 验证明细数量
if
(
this
.
form
.
inboundOrderItemsList
.
length
===
0
)
{
return
this
.
$message
.
warning
(
'请至少添加一条入库明细'
);
}
//
自动
计算总数
this.calculateTotals()
// 计算总数
this
.
calculateTotals
()
;
// 提交数据
//
组装
提交数据
const
submitData
=
{
...
this
.
form
,
inboundOrderItemsList
:
this
.
form
.
inboundOrderItemsList
.
map
(
item
=>
({
...
item
,
orderId: this.form.orderId,
// 确保明细项有主表ID
orderId
:
this
.
form
.
orderId
,
batchId
:
this
.
form
.
batchId
,
inboundOrderId: this.form.id ||
null,
inboundOrderId
:
this
.
form
.
id
||
''
}
))
}
if (this.form.id != null) {
updateInbound(submitData).then(response => {
this.$message.success("修改成功")
this.open = false
this.getList()
}
)
}
;
// 提交数据
if
(
this
.
form
.
id
)
{
await
updateInbound
(
submitData
);
this
.
$message
.
success
(
"修改成功"
);
}
else
{
addInbound(submitData).then(response => {
this.$message.success("新增成功")
this.open = false
this.getList()
}
)
await
addInbound
(
submitData
);
this
.
$message
.
success
(
"新增成功"
);
}
this
.
open
=
false
;
this
.
getList
();
}
catch
(
error
)
{
this
.
$message
.
error
(
'提交失败:'
+
(
error
.
message
||
'网络异常'
));
console
.
error
(
'表单提交失败:'
,
error
);
}
}
)
}
,
/** 取消按钮 */
/**
* 取消弹窗
*/
cancel
()
{
this.open = false
this.inboundOrderId =
null
this.reset
()
this
.
open
=
false
;
this
.
inboundOrderId
=
''
;
this
.
reset
Form
();
}
,
/** 表单重置 */
reset() {
/**
* 重置表单
*/
resetForm
()
{
this
.
form
=
{
id:
null
,
orderId:
null
,
orderTypeId:
null
,
batchId:
null
,
warehouseId:
null
,
warehousesName:
null
,
ownerId:
null
,
ownerName:
null
,
ownerCode:
null
,
id
:
''
,
orderId
:
''
,
orderTypeId
:
''
,
batchId
:
''
,
warehouseId
:
''
,
warehousesName
:
''
,
ownerId
:
''
,
ownerName
:
''
,
ownerCode
:
''
,
orderStatus
:
1
,
referenceNo:
null
,
plannedArrivalDate:
null
,
actualArrivalDate:
null
,
referenceNo
:
''
,
plannedArrivalDate
:
''
,
actualArrivalDate
:
''
,
inboundDate
:
this
.
formatDate
(
new
Date
()),
totalPlannedQuantity
:
0
,
totalActualQuantity
:
0
,
totalPackages
:
0
,
remark:
null
,
opUserName:
null
,
isUsed:
null
,
sortNo:
null
,
createTime:
null
,
createUserCode:
null
,
updateTime:
null
,
updateUserCode:
null
,
remark
:
''
,
opUserName
:
''
,
isUsed
:
''
,
sortNo
:
''
,
createTime
:
''
,
createUserCode
:
''
,
updateTime
:
''
,
updateUserCode
:
''
,
inboundOrderItemsList
:
[]
}
if (this.$refs.inboundItemsRef) {
this.$refs.inboundItemsRef.resetEmbeddedData()
}
if (this.$refs.form) {
this.$refs.form.resetFields()
}
}
;
this
.
$refs
.
inboundItemsRef
?.
resetEmbeddedData
();
this
.
$refs
.
formRef
?.
resetFields
();
}
,
/** 导入按钮操作 */
/**
* 导入按钮操作
*/
handleImport
()
{
this.$refs.import
.show()
this
.
$refs
.
import
Ref
?.
show
();
}
,
getTemplateName(){
if(this.form.orderTypeId === '1'){
return "入库单导入模板"
}
else if(this.form.orderTypeId === '2'){
return "成品入库单导入模板"
}
else if(this.form.orderTypeId === '3'){
return "退料TRDC入库单导入模板"
}
/**
* 获取导入模板名称
* @returns {string
}
模板名称
*/
getTemplateName
()
{
const
typeMap
=
{
'1'
:
"入库单导入模板"
,
'2'
:
"成品入库单导入模板"
,
'3'
:
"退料TRDC入库单导入模板"
}
;
return
typeMap
[
this
.
form
.
orderTypeId
]
||
"入库单导入模板"
;
}
,
/** 处理明细项选择变化 */
/**
* 处理订单类型变化
* @param {*
}
selection 选中值
*/
handleOrderTypeChange
(
selection
)
{
this
.
form
.
orderTypeId
=
selection
;
}
,
// ========== 明细项相关方法 ==========
handleItemsSelectionChange
(
selection
)
{
this.selectedItems = selection
this
.
selectedItems
=
selection
;
}
,
/** 处理明细数据变化 */
handleItemsDataChange
(
items
)
{
this.form.inboundOrderItemsList = items
this.calculateTotals()
this
.
form
.
inboundOrderItemsList
=
items
;
this
.
calculateTotals
()
;
}
,
/** 处理总数变化 */
handleTotalsChange
(
totals
)
{
this.form.totalPlannedQuantity = totals.plannedQuantity
this.form.totalActualQuantity = totals.actualQuantity
this.form.totalPackages = totals.packages
this
.
form
.
totalPlannedQuantity
=
totals
.
plannedQuantity
;
this
.
form
.
totalActualQuantity
=
totals
.
actualQuantity
;
this
.
form
.
totalPackages
=
totals
.
packages
;
}
,
/** 添加明细项回调 */
handleItemAdded
(
item
)
{
// 为新项设置orderId
item.orderId = this.form.orderId
item
.
orderId
=
this
.
form
.
orderId
;
}
,
/** 行保存回调 */
handleRowSaved(row) {
// 可以在这里添加保存后的逻辑
}
,
handleRowSaved
()
{
}
,
/** 行删除回调 */
handleRowDeleted(row) {
this.$message.success('删除成功')
handleRowDeleted
()
{
this
.
$message
.
success
(
'删除成功'
);
}
,
/** 批量删除回调 */
handleBatchDelete
(
ids
)
{
this.$message.success(`
成功删除
$
{
ids
.
length
}
项
`)
this
.
$message
.
success
(
`成功删除 ${ids.length
}
项`
)
;
}
,
/** 单元格变化回调 */
handleCellChange({ row, prop, value
}
) {
// 可以在这里处理特定字段的变化
if (prop === 'plannedQuantity' || prop === 'actualQuantity') {
this.calculateTotals()
handleCellChange
({
prop
}
)
{
if
([
'plannedQuantity'
,
'actualQuantity'
].
includes
(
prop
))
{
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
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
}
)
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
this
.
form
.
totalPlannedQuantity
=
totals
.
plannedQuantity
;
this
.
form
.
totalActualQuantity
=
totals
.
actualQuantity
;
this
.
form
.
totalPackages
=
totals
.
packages
;
}
,
/** 导出按钮操作 */
/**
* 导出按钮操作
*/
handleExport
()
{
const params = { ...this.queryParams
}
delete params.pageNum
delete params.pageSize
this.download('inventory/inbound/export', params, `
inbound_$
{
new
Date
().
getTime
()
}
.
xlsx
`)
const
params
=
{
...
this
.
queryParams
}
;
delete
params
.
pageNum
;
delete
params
.
pageSize
;
this
.
download
(
'inventory/inbound/export'
,
params
,
`inbound_${new Date().getTime()
}
.xlsx`
)
;
}
}
}
<
/script
>
<
style
scoped
>
/* 对齐字典页面的样式类名和布局 */
.
page
-
container
{
padding
:
16
px
;
background
:
#
fff
;
...
...
@@ -1197,8 +1217,8 @@ export default {
}
.
scrollable
-
dialog
.
el
-
dialog__body
{
max-height: 80vh;
/* 最大高度80%视口高度 */
overflow-y: auto;
/* 超出滚动 */
max
-
height
:
80
vh
;
overflow
-
y
:
auto
;
padding
:
20
px
;
}
...
...
@@ -1216,8 +1236,17 @@ export default {
margin
-
bottom
:
20
px
;
}
/* 统一对话框底部按钮样式 */
.
dialog
-
footer
{
text
-
align
:
right
;
}
/* 优化表格边框和交互 */
:
deep
(.
el
-
table
)
{
--
el
-
table
-
row
-
hover
-
bg
-
color
:
#
f8f9fa
;
}
/* 优化弹窗内描述列表样式 */
:
deep
(.
el
-
descriptions
)
{
--
el
-
descriptions
-
item
-
label
-
color
:
#
606266
;
}
<
/style>
\ No newline at end of file
ruoyi-admin-vue/src/views/inventory/inbound_items/index.vue
View file @
f97e11c7
...
...
@@ -96,7 +96,7 @@
<el-button
type=
"warning"
plain
icon=
"el-icon-
up
load"
icon=
"el-icon-
down
load"
size=
"mini"
@
click=
"handleExport"
>
导出
</el-button>
...
...
@@ -738,8 +738,9 @@ export default {
// 导出
handleExport
()
{
this
.
download
(
'inventory/inbound_items/export'
,
{
...
this
.
queryParams
this
.
download
(
'inventory/inbound/export'
,
{
...
this
.
queryParams
,
id
:
this
.
inboundOrderId
},
`inbound_items_
${
new
Date
().
getTime
()}
.xlsx`
)
},
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/InboundOrdersController.java
View file @
f97e11c7
...
...
@@ -14,6 +14,7 @@ import com.alibaba.excel.exception.ExcelAnalysisException;
import
com.ruoyi.common.annotation.Excel
;
import
com.ruoyi.common.core.domain.entity.SysDictData
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.uuid.UUID
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -24,6 +25,7 @@ import com.ruoyi.inventory.domain.vo.inboundVO.InboundTRDCTemplateVO;
import
com.ruoyi.inventory.domain.vo.inboundVO.InboundTemplateVO
;
import
com.ruoyi.inventory.service.impl.InboundOrdersServiceImpl
;
import
com.ruoyi.system.service.ISysDictDataService
;
import
org.apache.commons.collections4.MapUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -66,6 +68,10 @@ public class InboundOrdersController extends BaseController
List
<
InboundOrders
>
list
=
inboundOrdersService
.
selectInboundOrdersList
(
inboundOrders
);
return
getDataTable
(
list
);
}
/**
* 获取字典映射表
*/
private
Map
<
Object
,
Object
>
getDictMap
(
String
dictType
)
{
List
<
SysDictData
>
dictList
=
iSysDictDataService
.
selectDictDataByType
(
dictType
);
Map
<
Object
,
Object
>
dictMap
=
new
HashMap
<>();
...
...
@@ -80,32 +86,74 @@ public class InboundOrdersController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('inventory:inbound:export')"
)
@Log
(
title
=
"入库单主"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
InboundOrders
inboundOrders
)
{
public
void
export
(
HttpServletResponse
response
,
InboundOrders
inboundOrders
)
{
// 1. 基础空值校验:查询结果为空时直接导出空表格,避免后续循环NPE
List
<
InboundItemsTO
>
list
=
inboundOrdersService
.
selectInboundOrdersAndItems
(
inboundOrders
);
if
(
list
==
null
||
list
.
isEmpty
())
{
ExcelUtil
<
InboundItemsTO
>
util
=
new
ExcelUtil
<>(
InboundItemsTO
.
class
);
// 替换 List.of() 为 Java 8 兼容的空列表创建方式
util
.
exportExcel
(
response
,
new
ArrayList
<>(),
"入库单导出数据"
);
return
;
}
// 2. 字典映射表空值校验:避免字典表为空导致的NPE
Map
<
Object
,
Object
>
colorDictMap
=
getDictMap
(
"label_color"
);
colorDictMap
=
MapUtils
.
emptyIfNull
(
colorDictMap
);
// 空Map转为空集合,避免后续get操作NPE
// 3. 循环处理每条数据,增加全字段空值保护
for
(
InboundItemsTO
inboundItem
:
list
)
{
if
(
inboundItem
!=
null
)
{
inboundItem
.
setPackageWeight
(
inboundItem
.
getWeight
()
*
(
inboundItem
.
getActualQuantity
()
/
inboundItem
.
getActualPackages
()));
inboundItem
.
setUnitWeight
(
inboundItem
.
getWeight
()
*
(
inboundItem
.
getActualQuantity
()
/
inboundItem
.
getActualPackages
()));
inboundItem
.
setLabelColorName
((
String
)
colorDictMap
.
get
(
inboundItem
.
getLabelColor
()+
""
));
switch
(
inboundItem
.
getOrderTypeId
())
{
// 跳过空对象
if
(
inboundItem
==
null
)
{
continue
;
}
// ========== 3.1 数学运算安全处理(避免除零/空值运算NPE) ==========
// 初始化默认值,避免空值运算
Double
weight
=
inboundItem
.
getWeight
()
==
null
?
0.0
:
inboundItem
.
getWeight
();
Double
actualQuantity
=
inboundItem
.
getActualQuantity
()
==
null
?
0.0
:
inboundItem
.
getActualQuantity
();
Double
actualPackages
=
inboundItem
.
getActualPackages
()
==
null
?
1.0
:
inboundItem
.
getActualPackages
();
// 安全除法:避免除零异常
double
quantityPerPackage
=
actualPackages
==
0
?
0
:
actualQuantity
/
actualPackages
;
// 计算重量(空值保护)
double
packageWeight
=
weight
*
quantityPerPackage
;
// 赋值(避免setter传入null)
inboundItem
.
setPackageWeight
(
packageWeight
);
inboundItem
.
setUnitWeight
(
packageWeight
);
// 与packageWeight值相同
// ========== 3.2 标签颜色名称映射(空值保护) ==========
String
labelColor
=
inboundItem
.
getLabelColor
()
==
null
?
""
:
inboundItem
.
getLabelColor
().
toString
();
String
labelColorName
=
(
String
)
colorDictMap
.
get
(
labelColor
);
inboundItem
.
setLabelColorName
(
StringUtils
.
defaultIfBlank
(
labelColorName
,
""
));
// 空值转为空字符串
// ========== 3.3 订单类型分支处理(空值保护) ==========
String
orderTypeId
=
StringUtils
.
defaultIfBlank
(
inboundItem
.
getOrderTypeId
(),
"-"
);
String
remark
=
StringUtils
.
defaultIfBlank
(
inboundItem
.
getRemark
(),
"-"
);
String
systemNo
=
StringUtils
.
defaultIfBlank
(
inboundItem
.
getSystemNo
(),
"-"
);
String
orderId
=
StringUtils
.
defaultIfBlank
(
inboundItem
.
getOrderId
(),
"-"
);
switch
(
orderTypeId
)
{
case
"1"
:
inboundItem
.
setRelocation
(
inboundItem
.
getRemark
()
);
inboundItem
.
setRelocation
(
remark
);
break
;
case
"2"
:
inboundItem
.
setFinishedLocation
(
inboundItem
.
getRemark
()
);
inboundItem
.
setFinishedLocation
(
remark
);
break
;
case
"3"
:
inboundItem
.
setRemarkTrdc
(
inboundItem
.
getRemark
());
inboundItem
.
setFinishedSystemNo
(
inboundItem
.
getSystemNo
());
inboundItem
.
setFinishedOrderId
(
inboundItem
.
getOrderId
());
inboundItem
.
setRemarkTrdc
(
remark
);
inboundItem
.
setFinishedSystemNo
(
systemNo
);
inboundItem
.
setFinishedOrderId
(
orderId
);
break
;
// 增加默认分支,避免未匹配的情况
default
:
// 可选:记录日志或设置默认值
break
;
}
}
}
ExcelUtil
<
InboundItemsTO
>
util
=
new
ExcelUtil
<
InboundItemsTO
>(
InboundItemsTO
.
class
);
// 4. 导出Excel(最终兜底:确保传入非null列表)
ExcelUtil
<
InboundItemsTO
>
util
=
new
ExcelUtil
<>(
InboundItemsTO
.
class
);
util
.
exportExcel
(
response
,
list
,
"入库单导出数据"
);
}
...
...
ruoyi-admin/src/main/resources/application.yml
View file @
f97e11c7
...
...
@@ -127,7 +127,7 @@ referer:
# 防盗链开关
enabled
:
false
# 允许的域名列表
allowed-domains
:
localhost,127.0.0.1
allowed-domains
:
localhost,127.0.0.1
,172.19.1.150,http://wms.docmis.cn/
# 防止XSS攻击
xss
:
...
...
ruoyi-inventory/src/main/resources/mapper/inventory/InboundOrdersMapper.xml
View file @
f97e11c7
...
...
@@ -75,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectInboundOrdersList"
parameterType=
"InboundOrders"
resultMap=
"InboundOrdersResult"
>
<include
refid=
"selectInboundOrdersVo"
/>
<where>
<if
test=
"id != null and
Id != ''"
>
and id = #{I
d}
</if>
<if
test=
"id != null and
id != ''"
>
and id = #{i
d}
</if>
<if
test=
"orderId != null and orderId != ''"
>
and order_id like concat('%', #{orderId}, '%')
</if>
<if
test=
"systemNo != null and systemNo != ''"
>
and system_no like concat('%', #{systemNo}, '%')
</if>
<if
test=
"orderTypeId != null and orderTypeId != ''"
>
and order_type_id = #{orderTypeId}
</if>
...
...
@@ -100,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>
order by date(inbound_date) desc,create_time desc
order by
order_status asc,
date(inbound_date) desc,create_time desc
</select>
<select
id=
"selectInboundOrdersById"
parameterType=
"String"
resultMap=
"InboundOrdersInboundOrderItemsResult"
>
...
...
@@ -334,11 +334,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ioi.label_color, ioi.voucher_number, m.storage_temperature,
m.hazard_id, io.order_id, io.system_no, io.owner_id,
ioi.label_quantity, io.order_type, io.order_type_id, ioi.remark
from materials as m
inner join inbound_order_items as ioi on ioi.material_id = m.id
inner join inbound_orders as io on ioi.inbound_order_id = io.id
inner join storage_locations as sl on ioi.location_id = sl.id
from inbound_order_items as ioi
left join materials as m on ioi.material_id = m.id
left join inbound_orders as io on ioi.inbound_order_id = io.id
left join storage_locations as sl on ioi.location_id = sl.id
<where>
<if
test=
"id != null and id != ''"
>
and io.id = #{id}
</if>
<if
test=
"orderId != null and orderId != ''"
>
and io.order_id like concat('%', #{orderId}, '%')
</if>
<if
test=
"systemNo != null and systemNo != ''"
>
and io.system_no like concat('%', #{systemNo}, '%')
</if>
<if
test=
"orderTypeId != null and orderTypeId != ''"
>
and io.order_type_id = #{orderTypeId}
</if>
<if
test=
"batchId != null and batchId != ''"
>
and ioi.batch_id like concat('%', #{batchId}, '%')
</if>
<if
test=
"ownerId != null and ownerId != ''"
>
and io.owner_id = #{ownerId}
</if>
<if
test=
"orderStatus != null "
>
and io.order_status = #{orderStatus}
</if>
<!-- 新增按照日期范围查询-->
<if
test=
"inboundDateStart != null"
>
AND date(inbound_date)
>
= #{inboundDateStart}
</if>
<if
test=
"inboundDateEnd != null"
>
AND date(inbound_date)
<
= #{inboundDateEnd}
</if>
<if
test=
"orderType != null and orderType != ''"
>
and order_type = #{orderType}
</if>
</where>
order by order_status asc, date(io.inbound_date) desc, io.create_time desc
</select>
<resultMap
id=
"InboundOrderAndItemsMap"
type=
"com.ruoyi.inventory.domain.TO.InboundItemsTO"
>
<!-- 基础字段映射:SQL字段名 -> Java实体类字段名 -->
<result
column=
"inbound_date"
property=
"inboundDate"
/>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论