Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jilinzhongdianrenqun
概览
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
吴超
jilinzhongdianrenqun
Commits
3ef0c218
Commit
3ef0c218
authored
Dec 25, 2025
by
zhangtw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
入库、申领
parent
dfbb9913
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
90 行增加
和
25 行删除
+90
-25
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmBorrowServiceImpl.java
+1
-10
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmInboundServiceImpl.java
+27
-9
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmBorrowApplicationDao.xml
+1
-0
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmInboundDetailDao.xml
+6
-1
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmInboundRecordDao.xml
+50
-3
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmMaterialLogDao.xml
+5
-2
没有找到文件。
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmBorrowServiceImpl.java
View file @
3ef0c218
...
...
@@ -65,12 +65,8 @@ public class KeyDmBorrowServiceImpl {
LocalDate
localDate
=
instant
.
atZone
(
ZoneId
.
systemDefault
()).
toLocalDate
();
Date
expected_return_date
=
java
.
sql
.
Date
.
valueOf
(
localDate
);
map
.
put
(
"expected_return_date"
,
expected_return_date
);
map
.
put
(
"approval_status"
,
0
);
map
.
put
(
"issue_status"
,
0
);
map
.
put
(
"is_used"
,
1
);
map
.
put
(
"create_by"
,
user
.
get
(
"id"
));
map
.
put
(
"create_time"
,
new
Date
());
map
.
put
(
"order_no"
,
0
);
System
.
out
.
println
(
map
);
// insert application
...
...
@@ -80,11 +76,6 @@ public class KeyDmBorrowServiceImpl {
for
(
Map
<
String
,
Object
>
d
:
details
)
{
d
.
put
(
"id"
,
UUID
.
randomUUID
().
toString
());
d
.
put
(
"application_id"
,
map
.
get
(
"id"
));
d
.
put
(
"material_id"
,
"测试"
);
d
.
put
(
"is_used"
,
1
);
d
.
put
(
"create_by"
,
user
.
get
(
"id"
));
d
.
put
(
"create_time"
,
new
Date
());
d
.
put
(
"order_no"
,
0
);
commonService
.
insert
(
detailNamespace
+
"insertDetail"
,
d
);
}
}
...
...
@@ -98,7 +89,7 @@ public class KeyDmBorrowServiceImpl {
if
(
details
!=
null
)
{
for
(
Map
<
String
,
Object
>
d
:
details
)
{
d
.
put
(
"application_id"
,
map
.
get
(
"id"
));
commonService
.
insert
(
n
amespace
+
"insertDetail"
,
d
);
commonService
.
insert
(
detailN
amespace
+
"insertDetail"
,
d
);
}
}
}
...
...
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmInboundServiceImpl.java
View file @
3ef0c218
...
...
@@ -8,9 +8,10 @@ import com.scpyun.base.db.service.CommonService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.time.Instant
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.util.*
;
@Api
(
"办公用品入库管理"
)
@Service
(
"keyDmInbound"
)
...
...
@@ -20,7 +21,8 @@ public class KeyDmInboundServiceImpl {
private
static
final
String
SUCCESS
=
"success"
;
private
final
String
namespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmInbound."
;
private
final
String
detailNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmInboundDetail."
;
private
final
String
materialNamespace
=
"com.scpyun.platform.standard.jilinsscgsdp.keyDmMaterialLog."
;
@ApiOperation
(
value
=
"入库记录列表"
,
desc
=
"分页查询"
)
public
Page
<
Map
<
String
,
Object
>>
selectList
(
Map
<
String
,
Object
>
map
)
{
if
(
map
==
null
)
map
=
new
HashMap
<>();
...
...
@@ -33,11 +35,22 @@ public class KeyDmInboundServiceImpl {
Object
id
=
map
.
get
(
"id"
);
List
<
Map
<
String
,
Object
>>
details
=
(
List
<
Map
<
String
,
Object
>>)
map
.
get
(
"details"
);
if
(
id
==
null
||
String
.
valueOf
(
id
).
trim
().
isEmpty
())
{
System
.
out
.
println
(
map
);
map
.
put
(
"id"
,
UUID
.
randomUUID
().
toString
());
map
.
put
(
"order_no"
,
0
);
Instant
instant
=
Instant
.
parse
((
String
)
map
.
get
(
"inbound_date"
));
LocalDate
localDate
=
instant
.
atZone
(
ZoneId
.
systemDefault
()).
toLocalDate
();
Date
inbound_date
=
java
.
sql
.
Date
.
valueOf
(
localDate
);
map
.
put
(
"inbound_date"
,
inbound_date
);
map
.
put
(
"inbound_status"
,
0
);
if
(
commonService
.
insert
(
namespace
+
"insert"
,
map
)
!=
1
)
throw
new
CustomException
(
"保存失败"
);
if
(
details
!=
null
)
{
for
(
Map
<
String
,
Object
>
d
:
details
)
{
d
.
put
(
"inbound_id"
,
map
.
get
(
"id"
));
commonService
.
insert
(
namespace
+
"insertDetail"
,
d
);
d
.
put
(
"inbound_type"
,
map
.
get
(
"inbound_type"
));
d
.
put
(
"id"
,
UUID
.
randomUUID
().
toString
());
commonService
.
insert
(
detailNamespace
+
"insertDetail"
,
d
);
}
}
}
else
{
...
...
@@ -46,8 +59,9 @@ public class KeyDmInboundServiceImpl {
commonService
.
delete
(
namespace
+
"deleteDetailsByInboundId"
,
map
);
if
(
details
!=
null
)
{
for
(
Map
<
String
,
Object
>
d
:
details
)
{
d
.
put
(
"id"
,
UUID
.
randomUUID
().
toString
());
d
.
put
(
"inbound_id"
,
map
.
get
(
"id"
));
commonService
.
insert
(
n
amespace
+
"insertDetail"
,
d
);
commonService
.
insert
(
detailN
amespace
+
"insertDetail"
,
d
);
}
}
}
...
...
@@ -68,9 +82,13 @@ public class KeyDmInboundServiceImpl {
// 设置入库状态
int
aff
=
commonService
.
update
(
namespace
+
"doInbound"
,
map
);
if
(
aff
<
0
)
throw
new
CustomException
(
"入库失败"
);
Map
<
String
,
Object
>
ret
=
getById
(
map
);
ret
.
put
(
"_user"
,
map
.
get
(
"_user"
));
// 更新库存明细:调用 mapper 更新库存和日志(mapper 内实现或逐条处理)
commonService
.
update
(
namespace
+
"updateInventoryByInbound"
,
map
);
commonService
.
insert
(
namespace
+
"insertMaterialLogByInbound"
,
map
);
commonService
.
update
(
namespace
+
"updateInventoryByInbound"
,
ret
);
commonService
.
insert
(
materialNamespace
+
"insertLog"
,
ret
);
return
SUCCESS
;
}
...
...
@@ -104,7 +122,7 @@ public class KeyDmInboundServiceImpl {
Map
<
String
,
Object
>
ret
=
new
HashMap
<>();
Map
<
String
,
Object
>
rec
=
commonService
.
getObject
(
namespace
+
"getById"
,
map
);
ret
.
putAll
(
rec
==
null
?
new
HashMap
<>()
:
rec
);
List
<
Map
<
String
,
Object
>>
details
=
commonService
.
findList
(
namespace
+
"selectDetailsByInboundId"
,
map
);
List
<
Map
<
String
,
Object
>>
details
=
commonService
.
findList
(
detailNamespace
+
"selectDetailsByInboundId"
,
map
);
ret
.
put
(
"details"
,
details
==
null
?
new
java
.
util
.
ArrayList
<>()
:
details
);
List
<
Map
<
String
,
Object
>>
logs
=
commonService
.
findList
(
namespace
+
"selectLogsByInboundId"
,
map
);
ret
.
put
(
"logs"
,
logs
==
null
?
new
java
.
util
.
ArrayList
<>()
:
logs
);
...
...
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmBorrowApplicationDao.xml
View file @
3ef0c218
...
...
@@ -98,6 +98,7 @@
<update
id=
"updateInventoryByApplication"
parameterType=
"map"
>
<!-- 简化:调用存储过程或在 mapper 中实现逐条更新 -->
<!-- 实际实现依赖于业务,留给 mapper/服务调用具体 SQL -->
update jl_key_dm_inventory set
</update>
<!-- 插入日志 -->
...
...
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmInboundDetailDao.xml
View file @
3ef0c218
...
...
@@ -11,7 +11,12 @@
</insert>
<select
id=
"selectDetailsByInboundId"
parameterType=
"map"
resultType=
"map"
>
SELECT * FROM jl_key_dm_inbound_detail WHERE inbound_id = #{id} AND is_used = 1 ORDER BY create_time ASC
SELECT i.*,
m.material_code, m.material_name, m.category_id
FROM jl_key_dm_inbound_detail as i
left join jl_key_dm_material as m
on i.material_id = m.id
WHERE i.inbound_id = #{id} AND i.is_used = 1 ORDER BY i.create_time ASC
</select>
<delete
id=
"deleteDetailsByInboundId"
parameterType=
"map"
>
...
...
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmInboundRecordDao.xml
View file @
3ef0c218
...
...
@@ -59,9 +59,56 @@
</insert>
<!-- update inventory by inbound (placeholder) -->
<update
id=
"updateInventoryByInbound"
parameterType=
"map"
>
<!-- mapper should iterate details and call KeyDmInventory.increaseAvailable -->
</update>
<insert
id=
"updateInventoryByInbound"
parameterType=
"map"
>
<!-- 库存UPSERT:material_id存在则更新可用量/总量,不存在则插入 -->
<!-- 批量库存UPSERT:支持多物料同时更新/插入 -->
INSERT INTO jl_key_dm_inventory (
id,
material_id,
material_code,
material_name,
total_quantity,
available_quantity,
borrowed_quantity,
damaged_quantity,
is_used,
create_by,
create_time,
update_by,
update_time,
order_no
)
VALUES
<foreach
collection=
"details"
item=
"item"
separator=
","
>
(
#{item.id},
#{item.material_id},
#{item.material_code},
#{item.material_name},
#{item.inbound_quantity},
#{item.available_quantity},
#{item.borrowed_quantity},
#{item.damaged_quantity},
#{item.is_used},
#{_user.id},
NOW(),
#{_user.id},
NOW(),
#{item.order_no}
)
</foreach>
ON DUPLICATE KEY UPDATE
material_code = VALUES(material_code),
material_name = VALUES(material_name),
total_quantity = VALUES(total_quantity),
available_quantity = VALUES(available_quantity),
borrowed_quantity = VALUES(borrowed_quantity),
damaged_quantity = VALUES(damaged_quantity),
is_used = VALUES(is_used),
update_by = VALUES(update_by),
update_time = NOW(),
order_no = VALUES(order_no);
</insert>
<select
id=
"selectLogsByInboundId"
parameterType=
"map"
resultType=
"map"
>
SELECT * FROM jl_key_dm_material_log WHERE relation_id = #{id} AND is_used = 1 ORDER BY create_time ASC
...
...
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmMaterialLogDao.xml
View file @
3ef0c218
...
...
@@ -5,9 +5,12 @@
<insert
id=
"insertLog"
parameterType=
"map"
>
INSERT INTO jl_key_dm_material_log(
id,category_id,material_id,op_type,relation_id,relation_item_id,quantity,unit_price,total_amount,is_used,create_by,create_time
) VALUES (
#{id},#{category_id},#{material_id},#{op_type},#{relation_id},#{relation_item_id},#{quantity},#{unit_price},#{total_amount},1,#{_user.id},NOW()
) VALUES
<foreach
collection=
"details"
item=
"item"
separator=
","
>
(
UUID(),#{item.category_id},#{item.id},1,#{item.inbound_id},#{item.id},#{item.inbound_quantity},#{item.unit_price},#{item.total_amount},1,#{_user.id},NOW()
)
</foreach>
</insert>
<select
id=
"selectLogsByApplicationId"
parameterType=
"map"
resultType=
"map"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论