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 个修改的文件
包含
104 行增加
和
31 行删除
+104
-31
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
+0
-0
ruoyi-admin-vue/src/views/inventory/inbound/index.vue
+0
-0
ruoyi-admin-vue/src/views/inventory/inbound_items/index.vue
+4
-3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/inventory/InboundOrdersController.java
+68
-20
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
差异被折叠。
点击展开。
ruoyi-admin-vue/src/views/inventory/inbound/index.vue
View file @
f97e11c7
差异被折叠。
点击展开。
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
())
{
case
"1"
:
inboundItem
.
setRelocation
(
inboundItem
.
getRemark
());
break
;
case
"2"
:
inboundItem
.
setFinishedLocation
(
inboundItem
.
getRemark
());
break
;
case
"3"
:
inboundItem
.
setRemarkTrdc
(
inboundItem
.
getRemark
());
inboundItem
.
setFinishedSystemNo
(
inboundItem
.
getSystemNo
());
inboundItem
.
setFinishedOrderId
(
inboundItem
.
getOrderId
());
break
;
}
// 跳过空对象
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
(
remark
);
break
;
case
"2"
:
inboundItem
.
setFinishedLocation
(
remark
);
break
;
case
"3"
:
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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论