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
8d1b21c2
Commit
8d1b21c2
authored
Dec 12, 2025
by
wangchunyang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://code.palacesun.com/zhouhaifeng/mini-wms
parents
358760de
cab7a9fc
全部展开
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
97 行增加
和
16 行删除
+97
-16
ruoyi-admin-vue/src/views/inventory/inbound/index.vue
+5
-4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/InboundOrdersController.java
+54
-1
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
+32
-10
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/Inventory.java
+2
-0
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/InboundOrdersServiceImpl.java
+0
-0
ruoyi-inventory/src/main/resources/mapper/inventory/InboundOrdersMapper.xml
+1
-0
ruoyi-inventory/src/main/resources/mapper/inventory/InventoryMapper.xml
+3
-1
没有找到文件。
ruoyi-admin-vue/src/views/inventory/inbound/index.vue
View file @
8d1b21c2
...
...
@@ -177,9 +177,9 @@
</el-tag>
</
template
>
</el-table-column>
<el-table-column
label=
"
创建时间"
align=
"center"
prop=
"createTim
e"
width=
"200"
>
<el-table-column
label=
"
入库时间"
align=
"center"
prop=
"inboundDat
e"
width=
"200"
>
<
template
slot-scope=
"scope"
>
<span>
{{
parseTime
(
scope
.
row
.
createTime
)
}}
</span>
<span>
{{
parseTime
(
scope
.
row
.
createTime
,
'{y
}
-{m
}
-{d
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
...
...
@@ -903,7 +903,7 @@ export default {
const queryForm = {
pageNum: 1,
pageSize: 9999,
orderId
:
row
.
orderI
d
inboundOrderId: row.i
d
}
const response = await listInbound_itemsAndMname(queryForm)
row.inboundOrderItemsList = response.rows.map(item => {
...
...
@@ -915,7 +915,8 @@ export default {
ownerId: row.ownerId,
quantity: item.actualQuantity,
unitWeight: item.unitWeight,
isUsed
:
1
isUsed: 1,
unitPrice: item.unitPrice
}
;
}
)
// 第三步:确保数据存在后调用入库接口
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/InboundOrdersController.java
View file @
8d1b21c2
package
com
.
ruoyi
.
web
.
controller
.
inventory
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.ruoyi.common.core.domain.entity.Materials
;
import
com.ruoyi.common.utils.uuid.UUID
;
...
...
@@ -11,6 +13,7 @@ import com.ruoyi.inventory.domain.vo.InboundMaterialTotalVO;
import
com.ruoyi.inventory.domain.vo.InboundTemplateVO
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
...
...
@@ -127,13 +130,63 @@ public class InboundOrdersController extends BaseController
@RequestParam
(
"updateSupport"
)
Integer
updateSupport
,
@RequestParam
(
value
=
"orderType"
,
required
=
false
)
Integer
orderType
)
throws
Exception
{
// 防护1:校验文件非空
if
(
file
==
null
||
file
.
isEmpty
())
{
return
error
(
"导入文件不能为空!"
);
}
// 防护2:校验文件格式
String
fileName
=
file
.
getOriginalFilename
();
if
(!
fileName
.
endsWith
(
".xlsx"
)
&&
!
fileName
.
endsWith
(
".xls"
))
{
return
error
(
"仅支持Excel格式文件(.xlsx/.xls)!"
);
}
// 第二步:校验Excel列名是否匹配模板(核心!拦截非模板数据)
List
<
String
>
templateColumns
=
Arrays
.
asList
(
"入库日期"
,
"SAP No"
,
"物料名称"
,
"TS Code"
,
"货主"
,
"批号"
,
"计划数量"
,
"单号"
,
"系统编号"
,
"件重"
,
"约数"
,
"实际件数"
,
"实发数量"
,
"仓库"
,
"库位"
,
"标签颜色"
,
"凭证号"
,
"单价"
,
"备注"
,
"订单类型"
,
"收货人"
,
"物料备注"
);
List
<
String
>
excelColumns
=
ExcelUtil
.
getExcelHeader
(
file
.
getInputStream
());
// 自定义方法读取表头
if
(
CollectionUtils
.
isEmpty
(
excelColumns
)
||
!
excelColumns
.
containsAll
(
templateColumns
))
{
return
AjaxResult
.
error
(
"导入文件不是标准模板!请下载官方模板后填写(缺失列:"
+
getMissingColumns
(
templateColumns
,
excelColumns
)
+
")"
);
}
ExcelUtil
<
InboundTemplateVO
>
util
=
new
ExcelUtil
<
InboundTemplateVO
>(
InboundTemplateVO
.
class
);
List
<
InboundTemplateVO
>
inboundOrders
=
util
.
importExcel
(
file
.
getInputStream
());
// 防护3:拦截空列表,避免 Service 层处理空数据
if
(
CollectionUtils
.
isEmpty
(
inboundOrders
))
{
return
error
(
"Excel中未解析到有效数据,请检查模板是否正确!"
);
}
String
operName
=
getUsername
();
String
message
=
inboundOrdersService
.
importInboundOrders
(
inboundOrders
,
updateSupport
,
operName
,
orderType
);
return
success
(
message
);
}
// 辅助方法:获取缺失的列名
private
String
getMissingColumns
(
List
<
String
>
template
,
List
<
String
>
excel
)
{
return
template
.
stream
()
.
filter
(
col
->
!
excel
.
contains
(
col
))
.
collect
(
Collectors
.
joining
(
"、"
));
}
/**
* 首页入库次数统计api
...
...
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
View file @
8d1b21c2
...
...
@@ -12,17 +12,9 @@ import java.math.BigDecimal;
import
java.text.DecimalFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.RegExUtils
;
...
...
@@ -1909,4 +1901,34 @@ public class ExcelUtil<T>
}
return
method
;
}
/**
* 读取Excel表头(第一行)
*/
public
static
List
<
String
>
getExcelHeader
(
InputStream
inputStream
)
{
try
(
Workbook
workbook
=
WorkbookFactory
.
create
(
inputStream
))
{
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
Row
headerRow
=
sheet
.
getRow
(
0
);
// 第一行是表头
if
(
headerRow
==
null
)
{
return
Collections
.
emptyList
();
}
return
IntStream
.
range
(
0
,
headerRow
.
getLastCellNum
())
.
mapToObj
(
headerRow:
:
getCell
)
.
map
(
cell
->
{
// 单元格类型容错(数字/字符串统一转字符串)
if
(
cell
==
null
)
{
return
""
;
}
cell
.
setCellType
(
CellType
.
STRING
);
return
StringUtils
.
trim
(
cell
.
getStringCellValue
());
})
.
filter
(
StringUtils:
:
isNotBlank
)
.
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
log
.
error
(
"读取Excel表头失败"
,
e
);
return
Collections
.
emptyList
();
}
}
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/domain/Inventory.java
View file @
8d1b21c2
...
...
@@ -178,4 +178,6 @@ public class Inventory extends BaseEntity
/** 特殊存储要求 */
// @Excel(name = "特殊存储要求")
private
String
specialRequirements
;
private
Double
unitPrice
;
}
ruoyi-inventory/src/main/java/com/ruoyi/inventory/service/impl/InboundOrdersServiceImpl.java
View file @
8d1b21c2
差异被折叠。
点击展开。
ruoyi-inventory/src/main/resources/mapper/inventory/InboundOrdersMapper.xml
View file @
8d1b21c2
...
...
@@ -93,6 +93,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 inbound_date desc,create_time desc
</select>
<select
id=
"selectInboundOrdersById"
parameterType=
"String"
resultMap=
"InboundOrdersInboundOrderItemsResult"
>
...
...
ruoyi-inventory/src/main/resources/mapper/inventory/InventoryMapper.xml
View file @
8d1b21c2
...
...
@@ -459,7 +459,8 @@ and inventory_status = '1'
<if
test=
"createUserCode != null"
>
create_user_code,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"updateUserCode != null"
>
update_user_code,
</if>
<if
test=
"warehousesId != null"
>
warehouses_id,
</if>
<if
test=
"warehousesId != null"
>
warehouses_id,
</if>
<if
test=
"unitPrice != null"
>
unit_price,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
...
...
@@ -486,6 +487,7 @@ and inventory_status = '1'
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"updateUserCode != null"
>
#{updateUserCode},
</if>
<if
test=
"warehousesId != null"
>
#{warehousesId},
</if>
<if
test=
"unitPrice != null"
>
#{unitPrice},
</if>
</trim>
</insert>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论