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
e9e044a2
Commit
e9e044a2
authored
Dec 09, 2025
by
chuishuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面调优,库位,仓库字典调整
parent
883b7c52
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
165 行增加
和
87 行删除
+165
-87
ruoyi-admin-vue/src/views/inventory/stocktakes/index.vue
+1
-0
ruoyi-admin-vue/src/views/inventory/stocktakes/stocktakeCountTable.vue
+3
-6
ruoyi-admin-vue/src/views/inventory/stocktakes/stocktakeItemsTable.vue
+50
-59
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/Stocktakes.java
+4
-3
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/TO/StocktakeItemsTo.java
+40
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/InventoryMapper.java
+2
-1
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/StocktakeItemsMapper.java
+2
-1
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IInventoryService.java
+2
-1
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IStocktakeItemsService.java
+2
-1
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/InventoryServiceImpl.java
+2
-1
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/StocktakeItemsServiceImpl.java
+2
-1
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/StocktakesServiceImpl.java
+9
-7
ruoyi-inventory/src/main/resources/mapper/inventory/InventoryMapper.xml
+14
-2
ruoyi-inventory/src/main/resources/mapper/inventory/StocktakeItemsMapper.xml
+29
-3
ruoyi-inventory/src/main/resources/mapper/inventory/StocktakesMapper.xml
+3
-1
没有找到文件。
ruoyi-admin-vue/src/views/inventory/stocktakes/index.vue
View file @
e9e044a2
...
...
@@ -387,6 +387,7 @@ export default {
handleConfirm
(
row
)
{
this
.
reset
();
const
id
=
row
.
id
||
this
.
ids
this
.
buttonShow
=
true
this
.
confirmTitle
=
'盘点确认'
getStocktakes
(
id
,
'confirm'
).
then
(
response
=>
{
this
.
form
=
response
.
data
...
...
ruoyi-admin-vue/src/views/inventory/stocktakes/stocktakeCountTable.vue
View file @
e9e044a2
...
...
@@ -63,9 +63,9 @@
<div
class=
"table-container"
>
<el-table
v-loading=
"loading"
:data=
"stocktakesList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
label=
"计划日期"
align=
"center"
prop=
"plannedDates"
width=
"180"
fixed
/>
<el-table-column
label=
"计划日期"
align=
"center"
prop=
"plannedDates"
width=
"180"
/>
<el-table-column
label=
"物料"
prop=
"materialId"
>
<el-table-column
label=
"物料"
prop=
"materialId"
fixed
>
<
template
slot-scope=
"scope"
>
{{
getDictLabel
(
materialDict
,
scope
.
row
.
materialId
,
'sap_no'
,
'material_name'
)
}}
</
template
>
...
...
@@ -137,7 +137,7 @@
<el-dialog
title=
"统计详情查看"
:visible
.
sync=
"viewOpen"
width=
"800px"
append-to-body
>
<el-table
:data=
"detailList"
border
stripe
size=
"small"
style=
"width: 100%;"
>
<el-table-column
label=
"计划日期"
prop=
"plannedDates"
/>
<el-table-column
label=
"物料"
prop=
"materialId"
>
<el-table-column
label=
"物料"
prop=
"materialId"
fixed
>
<
template
slot-scope=
"scope"
>
{{
getDictLabel
(
materialDict
,
scope
.
row
.
materialId
,
'sap_no'
,
'material_name'
)
||
'无'
}}
</
template
>
...
...
@@ -238,13 +238,10 @@ export default {
this
.
detailList
=
[];
// 清空旧数据
// 接口请求添加try/catch和空值判断
getCountInfo
(
row
).
then
(
response
=>
{
console
.
log
(
'接口返回完整数据:'
,
response
);
// 打印1
console
.
log
(
'接口返回的rows数组:'
,
response
.
rows
);
// 打印2
if
(
response
&&
response
.
rows
)
{
this
.
detailList
=
response
.
rows
;
// 直接赋值数组给detailList
console
.
log
(
'赋值后的detailList:'
,
this
.
detailList
);
// 打印3
}
else
{
this
.
$message
.
warning
(
'暂无详情数据'
);
}
this
.
viewOpen
=
true
;
}).
catch
(
error
=>
{
...
...
ruoyi-admin-vue/src/views/inventory/stocktakes/stocktakeItemsTable.vue
View file @
e9e044a2
<
template
>
<div
class=
"app-container"
>
<!-- 子表搜索栏
(按需求添加搜索字段)
-->
<!-- 子表搜索栏 -->
<div
class=
"page-container"
>
<page-wrapper-search
v-model=
"searchParams"
...
...
@@ -55,29 +55,6 @@
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"仓库"
prop=
"warehouseId"
style=
"display: none;"
>
<common-dict-select
v-model=
"searchParams.warehouseId"
dict-url=
"/inventory/warehouses/getMapList"
value-key=
"warehouses_code"
label-key=
"warehouses_name"
placeholder=
"请选择仓库"
@
loaded=
"handleDictLoaded('warehouse', $event)"
/>
</el-form-item>
<el-form-item
label=
"库位"
prop=
"locationId"
style=
"display: none;"
>
<common-dict-select
ref=
"locationSelect"
v-model=
"searchParams.locationId"
dict-url=
"/inventory/locations/getMapList"
:dictParams=
"{ warehousesCode: searchParams.warehouseId }"
value-key=
"location_code"
label-key=
"location_name"
placeholder=
"请选择库位"
@
loaded=
"handleDictLoaded('location', $event)"
/>
</el-form-item>
</page-wrapper-search>
<!-- 仓库选择组件 -->
...
...
@@ -92,47 +69,48 @@
@
selected=
"handleLocationSelected"
/>
<!-- 表格 -->
<div
class=
"table-container"
>
<el-table
:data=
"filteredItemsList"
:row-class-name=
"setRowIndex"
@
selection-change=
"handleSelectionChange"
border
size=
"small"
>
<el-table-column
label=
"子表ID"
align=
"center"
prop=
"id"
v-if=
"false"
/>
<el-table-column
label=
"物料"
prop=
"materialId"
fixed
>
<el-table-column
label=
"子表ID"
align=
"center"
width=
"150px"
prop=
"id"
v-if=
"false"
/>
<el-table-column
label=
"物料"
prop=
"materialId"
width=
"150px"
fixed
>
<
template
slot-scope=
"scope"
>
<!--
{{
getDictLabel
(
materialDict
,
scope
.
row
.
materialId
,
'sap_no'
,
'material_name'
)
}}
-->
<div
class=
"el-input__inner disabled-input"
style=
"padding: 0 15px; height: 32px; line-height: 32px;"
>
{{
getDictLabel
(
materialDict
,
scope
.
row
.
materialId
,
'sap_no'
,
'material_name'
)
}}
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"批次编号"
prop=
"batchCode"
>
<el-table-column
label=
"批次编号"
prop=
"batchCode"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<el-input
v-model=
"scope.row.batchCode"
placeholder=
"请输入批次编号"
disabled
/>
</
template
>
</el-table-column>
<el-table-column
label=
"仓库"
prop=
"warehouse
Id"
>
<el-table-column
label=
"仓库"
prop=
"warehouse
Name"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<!--
<el-input
v-model=
"scope.row.warehouseId"
placeholder=
"请输入仓库ID"
disabled
/>
--
>
<div
class=
"el-input__inner disabled-input"
style=
"padding: 0 15px; height: 32px; line-height: 32px;"
>
{{
getDictLabel
(
warehouseDict
,
scope
.
row
.
warehouseId
,
'warehouses_code'
,
'warehouses_name'
)
}}
</div
>
<el-input
v-model=
"scope.row.warehouseName"
placeholder=
"请输入仓库"
disabled
/
>
<!--
<div
class=
"el-input__inner disabled-input"
style=
"padding: 0 15px; height: 32px; line-height: 32px;"
>
--
>
<!--
{{
scope
.
row
.
warehouse_name
||
scope
.
row
.
warehouseId
||
'未知仓库'
}}
-->
<!--
</div>
--
>
</
template
>
</el-table-column>
<el-table-column
label=
"库位"
prop=
"location
Id"
>
<el-table-column
label=
"库位"
prop=
"location
Name"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<div
class=
"el-input__inner disabled-input"
style=
"padding: 0 15px; height: 32px; line-height: 32px;"
>
{{
getDictLabel
(
locationDict
,
scope
.
row
.
locationId
,
'location_code'
,
'location_name'
)
}}
</div>
<!--
<div
class=
"el-input__inner disabled-input"
style=
"padding: 0 15px; height: 32px; line-height: 32px;"
>
-->
<!--
{{
scope
.
row
.
location_name
||
scope
.
row
.
locationId
||
'未知库位'
}}
-->
<!--
</div>
-->
<el-input
v-model=
"scope.row.locationName"
placeholder=
"请输入库位"
disabled
/>
</
template
>
</el-table-column>
<el-table-column
label=
"系统数量"
prop=
"systemQuantity"
>
<el-table-column
label=
"系统数量"
prop=
"systemQuantity"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<el-input
v-model=
"scope.row.systemQuantity"
placeholder=
"请输入系统数量"
disabled
/>
</
template
>
</el-table-column>
<el-table-column
label=
"实际数量"
prop=
"actualQuantity"
>
<el-table-column
label=
"实际数量"
prop=
"actualQuantity"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<el-input
v-model=
"scope.row.actualQuantity"
placeholder=
"请输入实际数量"
...
...
@@ -142,33 +120,31 @@
/>
</
template
>
</el-table-column>
<el-table-column
label=
"差异数量"
prop=
"varianceQuantity"
>
<el-table-column
label=
"差异数量"
prop=
"varianceQuantity"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<el-input
type=
"number"
v-model=
"scope.row.varianceQuantity"
placeholder=
"请输入差异数量"
disabled
/>
</
template
>
</el-table-column>
<el-table-column
label=
"单价"
prop=
"unitPrice"
>
<el-table-column
label=
"单价"
prop=
"unitPrice"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<!--
<el-input
v-model=
"scope.row.unitPrice"
placeholder=
"请输入单价"
disabled
/>
-->
<div
class=
"el-input__inner disabled-input"
style=
"padding: 0 15px; height: 32px; line-height: 32px;"
>
{{
formatAmount
(
scope
.
row
.
unitPrice
)
}}
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"差异金额"
prop=
"variance
Quantity"
>
<el-table-column
label=
"差异金额"
prop=
"variance
Amount"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<!--
<el-input
v-model=
"scope.row.varianceAmount"
placeholder=
"请输入差异金额"
disabled
/>
-->
<div
class=
"el-input__inner disabled-input"
style=
"padding: 0 15px; height: 32px; line-height: 32px;"
>
{{
formatAmount
(
scope
.
row
.
variance
Quantity
)
}}
{{
formatAmount
(
scope
.
row
.
variance
Amount
)
}}
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"是否已调整"
prop=
"adjusted"
v-if=
"isConfirm"
>
<el-table-column
label=
"是否已调整"
prop=
"adjusted"
v-if=
"isConfirm"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<el-input
v-model=
"scope.row.adjusted"
placeholder=
"请输入是否已调整0否1是"
disabled
/>
</
template
>
</el-table-column>
<el-table-column
label=
"调整原因"
prop=
"adjustmentReason"
>
<el-table-column
label=
"调整原因"
prop=
"adjustmentReason"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<el-input
v-model=
"scope.row.adjustmentReason"
...
...
@@ -180,12 +156,12 @@
/>
</
template
>
</el-table-column>
<el-table-column
label=
"调整人"
prop=
"adjustedBy"
v-if=
"isConfirm"
>
<el-table-column
label=
"调整人"
prop=
"adjustedBy"
v-if=
"isConfirm"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<el-input
v-model=
"scope.row.adjustedBy"
placeholder=
"请输入调整人"
disabled
/>
</
template
>
</el-table-column>
<el-table-column
label=
"调整时间"
prop=
"adjustedAt"
v-if=
"isConfirm"
>
<el-table-column
label=
"调整时间"
prop=
"adjustedAt"
v-if=
"isConfirm"
width=
"150px"
>
<
template
slot-scope=
"scope"
>
<el-date-picker
clearable
v-model=
"scope.row.adjustedAt"
type=
"date"
value-format=
"yyyy-MM-dd"
placeholder=
"请选择调整时间"
disabled
/>
</
template
>
...
...
@@ -251,7 +227,6 @@ export default {
tableLoading
:
false
}
},
computed
:
{
// 筛选+分页后的表格数据
filteredItemsList
()
{
...
...
@@ -264,8 +239,8 @@ export default {
const
normalizedItems
=
this
.
itemsList
.
map
(
item
=>
({
...
item
,
materialId
:
String
(
item
.
materialId
||
''
).
trim
(),
warehouseId
:
String
(
item
.
warehouseId
||
''
).
trim
(),
locationId
:
String
(
item
.
locationId
||
''
).
trim
()
warehouseId
:
String
(
item
.
warehouseId
||
item
.
warehouses_code
||
''
).
trim
(),
locationId
:
String
(
item
.
locationId
||
item
.
location_code
||
''
).
trim
()
}))
// 精准筛选
...
...
@@ -292,6 +267,22 @@ export default {
methods
:
{
// 挂载全局字典工具方法(模板中可直接调用)
getDictLabel
,
// 手动加载字典(按你的字典接口规则来)
loadDict
(
type
)
{
// 字典接口地址(和你注释里的common-dict-select一致)
const
dictConfig
=
{
// material: { url: '/inventory/materials/getMapList' },
warehouse
:
{
url
:
'/inventory/warehouses/getMapList'
},
// 库位字典需要传仓库编码(warehousesCode),
location
:
{
url
:
'/inventory/locations/getMapList'
,
params
:
{
warehousesCode
:
this
.
searchParams
.
warehousesCode
}
}
}
const
config
=
dictConfig
[
type
]
if
(
!
config
)
return
this
.
$http
.
get
(
config
.
url
,
{
params
:
config
.
params
}).
then
(
res
=>
{
this
.
handleDictLoaded
(
type
,
res
.
data
||
[])
})
},
// 仓库选择变化时触发
handleWarehouseChange
(
warehouseId
)
{
// 1. 清空库位选择
...
...
@@ -358,7 +349,6 @@ export default {
},
/** 打开库位选择器 */
openLocationSelector
()
{
// console.log('this.currentWarehouseId========',this.currentWarehouseId)
if
(
!
this
.
currentWarehouseId
)
{
this
.
$message
.
warning
(
"请先选择仓库"
)
return
...
...
@@ -446,7 +436,9 @@ export default {
// 子表字段编辑时,同步给父组件(确保数据一致)
handleItemChange
(
row
)
{
if
(
!
row
.
actualQuantity
||
row
.
actualQuantity
===
''
)
{
row
.
varianceAmount
=
null
;
row
.
varianceQuantity
=
null
;
row
.
adjustmentReason
=
null
;
}
else
{
// 处理空值/非数字情况,默认0
const
actualQty
=
Number
(
row
.
actualQuantity
)
||
0
...
...
@@ -454,7 +446,7 @@ export default {
// 计算差异:实际数量 - 系统数量
row
.
varianceQuantity
=
actualQty
-
systemQty
// 计算差异金额:差异数量*单价
row
.
varianceAmount
=
row
.
varianceQuantity
*
row
.
unitPrice
row
.
varianceAmount
=
(
row
.
varianceQuantity
*
row
.
unitPrice
).
toFixed
(
2
)
*
1
}
// 实时校验调整原因,触发样式更新
this
.
$nextTick
(()
=>
{
...
...
@@ -481,16 +473,15 @@ export default {
.mb8
{
margin-bottom
:
8px
;
}
/* 表格样式优化 */
:deep
(
.el-table
)
{
--el-table-header-text-color
:
#606266
;
--el-table-row-hover-bg-color
:
#f5f7fa
;
}
.disabled-input
{
background-color
:
#f5f7fa
!important
;
/* ElementUI disabled 背景色 */
border
:
1px
solid
#e5e6eb
!important
;
/* ElementUI disabled 边框色 */
color
:
#909399
!important
;
/* ElementUI disabled 文字色 */
background-color
:
#f5f7fa
!important
;
border
:
1px
solid
#e5e6eb
!important
;
color
:
#909399
!important
;
cursor
:
not-allowed
!important
;
border-radius
:
4px
!important
;
/* 和输入框圆角一致 */
border-radius
:
4px
!important
;
}
</
style
>
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/Stocktakes.java
View file @
e9e044a2
...
...
@@ -3,6 +3,7 @@ package com.ruoyi.inventory.domain;
import
java.util.List
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.ruoyi.inventory.domain.TO.StocktakeItemsTo
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.ruoyi.common.annotation.Excel
;
...
...
@@ -71,7 +72,7 @@ public class Stocktakes extends BaseEntity
private
String
updateUserCode
;
/** 盘点单明细信息 */
private
List
<
StocktakeItems
>
stocktakeItemsList
;
private
List
<
StocktakeItems
To
>
stocktakeItemsList
;
public
void
setId
(
String
id
)
{
...
...
@@ -203,12 +204,12 @@ public class Stocktakes extends BaseEntity
return
updateUserCode
;
}
public
List
<
StocktakeItems
>
getStocktakeItemsList
()
public
List
<
StocktakeItems
To
>
getStocktakeItemsList
()
{
return
stocktakeItemsList
;
}
public
void
setStocktakeItemsList
(
List
<
StocktakeItems
>
stocktakeItemsList
)
public
void
setStocktakeItemsList
(
List
<
StocktakeItems
To
>
stocktakeItemsList
)
{
this
.
stocktakeItemsList
=
stocktakeItemsList
;
}
...
...
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/TO/StocktakeItemsTo.java
0 → 100644
View file @
e9e044a2
package
com
.
ruoyi
.
inventory
.
domain
.
TO
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.ruoyi.common.annotation.Excel
;
import
com.ruoyi.common.core.domain.BaseEntity
;
import
com.ruoyi.inventory.domain.StocktakeItems
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.util.Date
;
/**
* 盘点单明细对象 stocktake_items
*
* @author ruoyi
* @date 2025-12-02
*/
public
class
StocktakeItemsTo
extends
StocktakeItems
{
private
String
warehouseName
;
private
String
locationName
;
public
String
getWarehouseName
()
{
return
warehouseName
;
}
public
void
setWarehouseName
(
String
warehouseName
)
{
this
.
warehouseName
=
warehouseName
;
}
public
String
getLocationName
()
{
return
locationName
;
}
public
void
setLocationName
(
String
locationName
)
{
this
.
locationName
=
locationName
;
}
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/InventoryMapper.java
View file @
e9e044a2
...
...
@@ -5,6 +5,7 @@ import java.util.List;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.inventory.domain.Inventory
;
import
com.ruoyi.inventory.domain.StocktakeItems
;
import
com.ruoyi.inventory.domain.TO.StocktakeItemsTo
;
/**
* 库存Mapper接口
...
...
@@ -79,7 +80,7 @@ public interface InventoryMapper
* @date 2025/12/3
* @version 1.0
*/
List
<
StocktakeItems
>
selectstocktakeItemsList
();
List
<
StocktakeItems
To
>
selectstocktakeItemsList
();
/**
* 按物料汇总统计库存
...
...
ruoyi-inventory/src/main/java/com/ruoyi/inventory/mapper/StocktakeItemsMapper.java
View file @
e9e044a2
...
...
@@ -4,6 +4,7 @@ import java.util.List;
import
java.util.Map
;
import
com.ruoyi.inventory.domain.StocktakeItems
;
import
com.ruoyi.inventory.domain.TO.StocktakeItemsTo
;
import
com.ruoyi.inventory.domain.TO.StocktakesVo
;
/**
...
...
@@ -63,7 +64,7 @@ public interface StocktakeItemsMapper
public
int
deleteStocktakeItemsByIds
(
String
[]
ids
);
// 主表调用获取子表信息
public
List
<
StocktakeItems
>
selectStocktakeItemsByMain
(
Map
<
String
,
Object
>
query
);
public
List
<
StocktakeItems
To
>
selectStocktakeItemsByMain
(
Map
<
String
,
Object
>
query
);
// 查询处理统计-详情
public
List
<
StocktakesVo
>
selectStocktakesCountInfo
(
StocktakesVo
stocktakes
);
...
...
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IInventoryService.java
View file @
e9e044a2
...
...
@@ -7,6 +7,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import
com.ruoyi.inventory.domain.Inventory
;
import
com.ruoyi.inventory.domain.OutboundOrderItems
;
import
com.ruoyi.inventory.domain.StocktakeItems
;
import
com.ruoyi.inventory.domain.TO.StocktakeItemsTo
;
/**
* 库存Service接口
...
...
@@ -88,7 +89,7 @@ public interface IInventoryService
* @date 2025/12/3
* @version 1.0
*/
public
List
<
StocktakeItems
>
selectstocktakeItemsList
();
public
List
<
StocktakeItems
To
>
selectstocktakeItemsList
();
/**
* 按物料汇总统计库存
...
...
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/IStocktakeItemsService.java
View file @
e9e044a2
...
...
@@ -4,6 +4,7 @@ import java.util.List;
import
java.util.Map
;
import
com.ruoyi.inventory.domain.StocktakeItems
;
import
com.ruoyi.inventory.domain.TO.StocktakeItemsTo
;
import
com.ruoyi.inventory.domain.TO.StocktakesVo
;
/**
...
...
@@ -23,7 +24,7 @@ public interface IStocktakeItemsService
public
StocktakeItems
selectStocktakeItemsById
(
String
id
);
// 主表调用
public
List
<
StocktakeItems
>
selectStocktakeItemsByMain
(
Map
<
String
,
Object
>
query
);
public
List
<
StocktakeItems
To
>
selectStocktakeItemsByMain
(
Map
<
String
,
Object
>
query
);
/**
* 查询盘点单明细列表
...
...
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/InventoryServiceImpl.java
View file @
e9e044a2
...
...
@@ -10,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils;
import
com.ruoyi.inventory.domain.OutboundOrderItems
;
import
com.ruoyi.inventory.domain.OutboundOrderLog
;
import
com.ruoyi.inventory.domain.StocktakeItems
;
import
com.ruoyi.inventory.domain.TO.StocktakeItemsTo
;
import
com.ruoyi.inventory.mapper.OutboundOrderLogMapper
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.SystemUtils
;
...
...
@@ -202,7 +203,7 @@ public class InventoryServiceImpl implements IInventoryService
* @date 2025/12/3
* @version 1.0
*/
public
List
<
StocktakeItems
>
selectstocktakeItemsList
(){
public
List
<
StocktakeItems
To
>
selectstocktakeItemsList
(){
return
inventoryMapper
.
selectstocktakeItemsList
();
}
...
...
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/StocktakeItemsServiceImpl.java
View file @
e9e044a2
...
...
@@ -4,6 +4,7 @@ import java.util.List;
import
java.util.Map
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.inventory.domain.TO.StocktakeItemsTo
;
import
com.ruoyi.inventory.domain.TO.StocktakesVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -41,7 +42,7 @@ public class StocktakeItemsServiceImpl implements IStocktakeItemsService
* @date 2025/12/5
* @version 1.0
*/
public
List
<
StocktakeItems
>
selectStocktakeItemsByMain
(
Map
<
String
,
Object
>
query
){
public
List
<
StocktakeItems
To
>
selectStocktakeItemsByMain
(
Map
<
String
,
Object
>
query
){
return
stocktakeItemsMapper
.
selectStocktakeItemsByMain
(
query
);
}
/**
...
...
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/StocktakesServiceImpl.java
View file @
e9e044a2
...
...
@@ -9,6 +9,7 @@ import com.ruoyi.common.utils.SecurityUtils;
import
com.ruoyi.common.utils.uuid.IdUtils
;
import
com.ruoyi.inventory.domain.Inventory
;
import
com.ruoyi.inventory.domain.InventoryTransactions
;
import
com.ruoyi.inventory.domain.TO.StocktakeItemsTo
;
import
com.ruoyi.inventory.domain.TO.StocktakesTO
;
import
com.ruoyi.inventory.domain.TO.StocktakesVo
;
import
com.ruoyi.inventory.mapper.StocktakeItemsMapper
;
...
...
@@ -64,7 +65,7 @@ public class StocktakesServiceImpl implements IStocktakesService
// 盘点确认时只查看 变更的
query
.
put
(
"adjusted"
,
1
);
}
List
<
StocktakeItems
>
stocktakeItems
=
stocktakeItemsService
.
selectStocktakeItemsByMain
(
query
);
List
<
StocktakeItems
To
>
stocktakeItems
=
stocktakeItemsService
.
selectStocktakeItemsByMain
(
query
);
stocktakes
.
setStocktakeItemsList
(
stocktakeItems
);
return
stocktakes
;
...
...
@@ -107,7 +108,7 @@ public class StocktakesServiceImpl implements IStocktakesService
Inventory
inventory
=
new
Inventory
();
inventory
.
setInventoryStatus
(
1L
);
inventory
.
setIsUsed
(
1L
);
List
<
StocktakeItems
>
stocktakeItemsList
=
inventoryService
.
selectstocktakeItemsList
();
List
<
StocktakeItems
To
>
stocktakeItemsList
=
inventoryService
.
selectstocktakeItemsList
();
stocktakes
.
setStocktakeItemsList
(
stocktakeItemsList
);
insertStocktakeItems
(
stocktakes
);
return
rows
;
...
...
@@ -136,8 +137,8 @@ public class StocktakesServiceImpl implements IStocktakesService
Date
nowDate
=
DateUtils
.
getNowDate
();
//统一调整时间
if
(
"check"
.
equals
(
operationType
)){
// 盘点提交
List
<
StocktakeItems
>
stocktakeItemsList
=
stocktakes
.
getStocktakeItemsList
();
for
(
StocktakeItems
stocktakeItems
:
stocktakeItemsList
)
{
List
<
StocktakeItems
To
>
stocktakeItemsList
=
stocktakes
.
getStocktakeItemsList
();
for
(
StocktakeItems
To
stocktakeItems
:
stocktakeItemsList
)
{
stocktakeItems
.
setAdjustedBy
(
loginUserId
);
//调整人
stocktakeItems
.
setAdjustedAt
(
nowDate
);
//调整时间
stocktakeItems
.
setUpdateUserCode
(
loginUserId
);
//更新人
...
...
@@ -164,8 +165,8 @@ public class StocktakesServiceImpl implements IStocktakesService
if
(
"confirm"
.
equals
(
operationType
)){
// 确认盘点 提交
// 库存表根据子表数据更新库存量 --因为盘点确认时查询的就是有调整的子表数据,又因为库存操作表需要的货主id子表中没有,所以需要根据id查询库存表
List
<
StocktakeItems
>
stocktakeItemsList
=
stocktakes
.
getStocktakeItemsList
();
for
(
StocktakeItems
stocktakeItems
:
stocktakeItemsList
)
{
List
<
StocktakeItems
To
>
stocktakeItemsList
=
stocktakes
.
getStocktakeItemsList
();
for
(
StocktakeItems
To
stocktakeItems
:
stocktakeItemsList
)
{
// 获取实际数量
Long
actualQuantity
=
stocktakeItems
.
getActualQuantity
();
// 库存表id
...
...
@@ -251,7 +252,7 @@ public class StocktakesServiceImpl implements IStocktakesService
*/
public
void
insertStocktakeItems
(
Stocktakes
stocktakes
)
{
List
<
StocktakeItems
>
stocktakeItemsList
=
stocktakes
.
getStocktakeItemsList
();
List
<
StocktakeItems
To
>
stocktakeItemsList
=
stocktakes
.
getStocktakeItemsList
();
String
stocktakeid
=
stocktakes
.
getId
();
// 盘点单号
String
createUserCode
=
stocktakes
.
getCreateUserCode
();
// 创建人
Date
createTime
=
stocktakes
.
getCreateTime
();
// 创建日期
...
...
@@ -268,6 +269,7 @@ public class StocktakesServiceImpl implements IStocktakesService
stocktakeItems
.
setCreateUserCode
(
createUserCode
);
stocktakeItems
.
setCreateTime
(
createTime
);
list
.
add
(
stocktakeItems
);
}
if
(
list
.
size
()
>
0
)
{
...
...
ruoyi-inventory/src/main/resources/mapper/inventory/InventoryMapper.xml
View file @
e9e044a2
...
...
@@ -32,13 +32,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"warehousesId"
column=
"warehouses_id"
/>
</resultMap>
<resultMap
type=
"
StocktakeItems
"
id=
"StocktakeItemsResult"
>
<resultMap
type=
"
com.ruoyi.inventory.domain.TO.StocktakeItemsTo
"
id=
"StocktakeItemsResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"stocktakeId"
column=
"stocktake_id"
/>
<result
property=
"materialId"
column=
"material_id"
/>
<result
property=
"batchCode"
column=
"batch_code"
/>
<result
property=
"warehouseId"
column=
"warehouse_id"
/>
<result
property=
"locationId"
column=
"location_id"
/>
<result
property=
"warehouseName"
column=
"warehouse_name"
/>
<result
property=
"locationName"
column=
"location_name"
/>
<result
property=
"systemQuantity"
column=
"system_quantity"
/>
<result
property=
"actualQuantity"
column=
"actual_quantity"
/>
<result
property=
"varianceQuantity"
column=
"variance_quantity"
/>
...
...
@@ -52,7 +54,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"adjustedAt"
column=
"adjusted_at"
/>
<result
property=
"startTime"
column=
"start_time"
/>
<result
property=
"endTime"
column=
"end_time"
/>
<result
property=
"materialRange"
column=
"material_range"
/>
<result
property=
"locationRange"
column=
"location_range"
/>
<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"
/>
<result
property=
"inventoryId"
column=
"inventory_id"
/>
<result
property=
"unitPrice"
column=
"unit_price"
/>
</resultMap>
<resultMap
type=
"com.ruoyi.inventory.domain.vo.InventorySummaryVO"
id=
"InventorySummaryResult"
>
...
...
@@ -189,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select
id=
"selectstocktakeItemsList"
resultMap=
"StocktakeItemsResult"
>
select id as inventory_id,material_id, batch_id, location_id, warehouse_id, quantity as system_quantity
select id as inventory_id,material_id, batch_id, location_id, warehouse
s_id as warehouse
_id, quantity as system_quantity
from inventory
where is_used = 1 and inventory_status = 1
order by warehouse_id,location_id,material_id
...
...
ruoyi-inventory/src/main/resources/mapper/inventory/StocktakeItemsMapper.xml
View file @
e9e044a2
...
...
@@ -4,13 +4,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ruoyi.inventory.mapper.StocktakeItemsMapper"
>
<resultMap
type=
"
StocktakeItems
"
id=
"StocktakeItemsResult"
>
<resultMap
type=
"
com.ruoyi.inventory.domain.TO.StocktakeItemsTo
"
id=
"StocktakeItemsResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"stocktakeId"
column=
"stocktake_id"
/>
<result
property=
"materialId"
column=
"material_id"
/>
<result
property=
"batchCode"
column=
"batch_code"
/>
<result
property=
"warehouseId"
column=
"warehouse_id"
/>
<result
property=
"locationId"
column=
"location_id"
/>
<result
property=
"warehouseName"
column=
"warehouse_name"
/>
<result
property=
"locationName"
column=
"location_name"
/>
<result
property=
"systemQuantity"
column=
"system_quantity"
/>
<result
property=
"actualQuantity"
column=
"actual_quantity"
/>
<result
property=
"varianceQuantity"
column=
"variance_quantity"
/>
...
...
@@ -78,8 +80,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select
id=
"selectStocktakeItemsByMain"
parameterType=
"java.util.Map"
resultMap=
"StocktakeItemsResult"
>
select id, inventory_id,unit_price, stocktake_id, material_id, batch_code, warehouse_id, location_id, system_quantity, actual_quantity, variance_quantity, variance_amount, stocktake_status, counted_by, counted_at, adjusted, adjustment_reason, adjusted_by, adjusted_at, start_time, end_time, material_range, location_range, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from stocktake_items
select st_it.id
, st_it.inventory_id
,st_it.unit_price
, st_it.stocktake_id
, st_it.material_id
, st_it.batch_code
, st_it.warehouse_id
, st_it.location_id
, st_it.system_quantity
, st_it.actual_quantity
, st_it.variance_quantity
, st_it.variance_amount
, st_it.stocktake_status
, st_it.counted_by
, st_it.counted_at
, st_it.adjusted
, st_it.adjustment_reason
, st_it.adjusted_by
, st_it.adjusted_at
, st_it.start_time
, st_it.end_time
, st_it.material_range
, st_it.location_range
,(select w.warehouses_name from warehouses w where st_it.warehouse_id = w.warehouses_code and w.is_used = 1) as warehouse_name
,(select sl.location_name from storage_locations sl where st_it.location_id = sl.location_code and sl.is_used = 1) as location_name
from stocktake_items st_it
where stocktake_id = #{stocktake_id} and is_used = 1
<if
test=
"adjusted != null and adjusted != ''"
>
and adjusted = #{adjusted}
</if>
</select>
...
...
ruoyi-inventory/src/main/resources/mapper/inventory/StocktakesMapper.xml
View file @
e9e044a2
...
...
@@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>
order by create_time,planned_date,update_time desc
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
...
...
@@ -186,7 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert
id=
"batchStocktakeItems"
>
insert into stocktake_items( id, stocktake_id, inventory_id, material_id, batch_code, warehouse_id, location_id, system_quantity, actual_quantity, variance_quantity, variance_amount, stocktake_status, counted_by, counted_at, adjusted, adjustment_reason, adjusted_by, adjusted_at, start_time, end_time, material_range, location_range, 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.stocktakeId}, #{inventoryId}, #{item.materialId}, #{item.batchCode}, #{item.warehouseId}, #{item.locationId}, #{item.systemQuantity}, #{item.actualQuantity}, #{item.varianceQuantity}, #{item.varianceAmount}, #{item.stocktakeStatus}, #{item.countedBy}, #{item.countedAt}, #{item.adjusted}, #{item.adjustmentReason}, #{item.adjustedBy}, #{item.adjustedAt}, #{item.startTime}, #{item.endTime}, #{item.materialRange}, #{item.locationRange}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode})
( #{item.id}, #{item.stocktakeId}, #{i
tem.i
nventoryId}, #{item.materialId}, #{item.batchCode}, #{item.warehouseId}, #{item.locationId}, #{item.systemQuantity}, #{item.actualQuantity}, #{item.varianceQuantity}, #{item.varianceAmount}, #{item.stocktakeStatus}, #{item.countedBy}, #{item.countedAt}, #{item.adjusted}, #{item.adjustmentReason}, #{item.adjustedBy}, #{item.adjustedAt}, #{item.startTime}, #{item.endTime}, #{item.materialRange}, #{item.locationRange}, #{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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论