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
bfec1bf4
Commit
bfec1bf4
authored
Dec 31, 2025
by
yubin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
d1b4d4ab
69a8a9fc
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
216 行增加
和
3 行删除
+216
-3
src/main/java/com/scpyun/platform/jilinsscgsdp/bean/entity/InboundImp.java
+30
-0
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmBorrowServiceImpl.java
+0
-1
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmInboundServiceImpl.java
+45
-0
src/main/java/com/scpyun/platform/jilinsscgsdp/utils/InboundFileListener.java
+0
-0
src/main/resources/KeyInboundImp.xlsx
+0
-0
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmBorrowDetailDao.xml
+1
-1
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmInboundRecordDao.xml
+137
-0
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmMaterialLogDao.xml
+3
-1
没有找到文件。
src/main/java/com/scpyun/platform/jilinsscgsdp/bean/entity/InboundImp.java
0 → 100644
View file @
bfec1bf4
package
com
.
scpyun
.
platform
.
jilinsscgsdp
.
bean
.
entity
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.Data
;
@Data
public
class
InboundImp
{
@ExcelProperty
(
value
=
"入库单号"
,
index
=
0
)
private
String
inbound_no
;
@ExcelProperty
(
value
=
"批次号"
,
index
=
1
)
private
String
batch_no
;
@ExcelProperty
(
value
=
"入库日期"
,
index
=
2
)
private
String
inbound_date
;
@ExcelProperty
(
value
=
"存放位置"
,
index
=
3
)
private
String
storage_location
;
@ExcelProperty
(
value
=
"备注"
,
index
=
4
)
private
String
remark
;
@ExcelProperty
(
value
=
"物料编号"
,
index
=
5
)
private
String
material_code
;
@ExcelProperty
(
value
=
"物料名称"
,
index
=
6
)
private
String
material_name
;
@ExcelProperty
(
value
=
"入库数量"
,
index
=
7
)
private
String
inbound_quantity
;
@ExcelProperty
(
value
=
"单价"
,
index
=
8
)
private
String
unit_price
;
@ExcelProperty
(
value
=
"生产日期"
,
index
=
9
)
private
String
production_date
;
@ExcelProperty
(
value
=
"有效期至"
,
index
=
10
)
private
String
expiry_date
;
}
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmBorrowServiceImpl.java
View file @
bfec1bf4
...
...
@@ -84,7 +84,6 @@ public class KeyDmBorrowServiceImpl {
}
map
.
put
(
"expected_return_date"
,
expected_return_date
);
if
(
id
==
null
||
String
.
valueOf
(
id
).
trim
().
isEmpty
())
{
map
.
put
(
"id"
,
UUID
.
randomUUID
().
toString
());
map
.
put
(
"application_no"
,
"borrow"
);
map
.
put
(
"applicant_id"
,
user
.
get
(
"id"
));
map
.
put
(
"applicant_name"
,
user
.
get
(
"name"
));
...
...
src/main/java/com/scpyun/platform/jilinsscgsdp/service/impl/KeyDmInboundServiceImpl.java
View file @
bfec1bf4
package
com
.
scpyun
.
platform
.
jilinsscgsdp
.
service
.
impl
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.ExcelWriter
;
import
com.alibaba.excel.support.ExcelTypeEnum
;
import
com.scpyun.base.bean.Page
;
import
com.scpyun.base.core.annotation.Api
;
import
com.scpyun.base.core.annotation.ApiOperation
;
import
com.scpyun.base.core.exception.CustomException
;
import
com.scpyun.base.db.service.CommonService
;
import
com.scpyun.platform.jilinsscgsdp.utils.InboundFileListener
;
import
com.scpyun.platform.jilinsscgsdp.utils.MaterialFileListener
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URLEncoder
;
import
java.time.Instant
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
...
...
@@ -293,6 +305,39 @@ public class KeyDmInboundServiceImpl {
return
ret
;
}
@ApiOperation
(
value
=
"导入入库单"
,
desc
=
"解析 Excel 导入入库信息"
)
public
Map
<
String
,
Object
>
importInbound
(
Map
<
String
,
Object
>
map
,
MultipartFile
file
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
try
{
InboundFileListener
listener
=
new
InboundFileListener
(
commonService
,
namespace
,
map
);
EasyExcel
.
read
(
file
.
getInputStream
(),
com
.
scpyun
.
platform
.
jilinsscgsdp
.
bean
.
entity
.
InboundImp
.
class
,
listener
).
sheet
().
headRowNumber
(
1
).
doRead
();
result
=
listener
.
getResult
();
}
catch
(
IOException
e
)
{
throw
new
CustomException
(
"导入失败"
);
}
return
result
;
}
@ApiOperation
(
value
=
"导入模板下载"
,
desc
=
"下载入库导入模板"
)
public
void
templateDownload
(
Map
<
String
,
Object
>
map
,
HttpServletResponse
response
)
{
response
.
setContentType
(
"application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
try
{
String
fileName
=
URLEncoder
.
encode
(
"入库导入模板"
,
"UTF-8"
).
replaceAll
(
"\\+"
,
"%20"
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
+
".xlsx"
);
response
.
setHeader
(
"filename"
,
fileName
+
".xlsx"
);
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"filename,Content-Disposition"
);
String
tpl
=
"keyInboundImp.xlsx"
;
Resource
resource
=
new
ClassPathResource
(
tpl
);
InputStream
is
=
resource
.
getInputStream
();
ExcelWriter
excelWriter
=
EasyExcel
.
write
(
response
.
getOutputStream
()).
withTemplate
(
is
).
excelType
(
ExcelTypeEnum
.
XLSX
).
build
();
excelWriter
.
finish
();
}
catch
(
Exception
e
)
{
throw
new
CustomException
(
"模板下载失败"
);
}
}
}
src/main/java/com/scpyun/platform/jilinsscgsdp/utils/InboundFileListener.java
0 → 100644
View file @
bfec1bf4
差异被折叠。
点击展开。
src/main/resources/KeyInboundImp.xlsx
0 → 100644
View file @
bfec1bf4
File added
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmBorrowDetailDao.xml
View file @
bfec1bf4
...
...
@@ -6,7 +6,7 @@
INSERT INTO jl_key_dm_borrow_application_detail(
id,application_id,material_id,material_code,material_name,apply_quantity,unit,issue_remark,returned_quantity,damaged_quantity,is_used,create_by,create_time
) VALUES (
#{id}
,#{application_id},#{material_id},#{material_code},#{material_name},#{apply_quantity},#{unit},#{issue_remark},COALESCE(#{returned_quantity},0),COALESCE(#{damaged_quantity},0),1,#{_user.id},NOW()
UUID()
,#{application_id},#{material_id},#{material_code},#{material_name},#{apply_quantity},#{unit},#{issue_remark},COALESCE(#{returned_quantity},0),COALESCE(#{damaged_quantity},0),1,#{_user.id},NOW()
)
</insert>
...
...
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmInboundRecordDao.xml
View file @
bfec1bf4
...
...
@@ -185,6 +185,143 @@
left join jl_key_dm_borrow_application as ba on bad.application_id = ba.id
where ba.id = #{id}
</select>
<!-- 将物料code为键做成字典-->
<select
id=
"getMaterialMap"
resultType=
"map"
>
select *
from jl_key_dm_material
where is_used = 1
</select>
<insert
id=
"batchInsertInboundMasters"
parameterType=
"map"
>
INSERT INTO jl_key_dm_inbound_record (
id,
inbound_no,
batch_no,
inbound_type,
inbound_status,
inbound_date,
is_used,
storage_location,
remark,
create_by,
create_time
) VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(
#{item.id},
#{item.inbound_no},
#{item.batch_no},
#{item.inbound_type},
#{item.inbound_status},
#{item.inbound_date},
#{item.is_used},
#{item.storage_location},
#{item.remark},
#{item.create_by},
#{item.create_time}
)
</foreach>
</insert>
<insert
id=
"batchInsertInboundDetails"
parameterType=
"map"
>
INSERT INTO jl_key_dm_inbound_detail (
id,
inbound_id,
material_id,
inbound_type,
inbound_quantity,
unit_price,
total_amount,
production_date,
expiry_date,
is_used,
create_by,
create_time
) VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(
#{item.id},
#{item.inbound_id},
#{item.material_id},
#{item.inbound_type},
#{item.inbound_quantity},
#{item.unit_price},
#{item.total_amount},
#{item.production_date},
#{item.expiry_date},
#{item.is_used},
#{item.create_by},
#{item.create_time}
)
</foreach>
</insert>
<update
id=
"batchUpdateMaterialStock"
parameterType=
"map"
>
UPDATE jl_key_dm_inventory
SET total_quantity = total_quantity + CASE id
<foreach
collection=
"list"
item=
"item"
>
WHEN #{item.material_id} THEN #{item.quantity}
</foreach>
ELSE 0
END,
update_time = NOW()
WHERE id IN
<foreach
collection=
"list"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item.material_id}
</foreach>
</update>
<insert
id=
"insertInboundMaster"
parameterType=
"map"
>
INSERT INTO jl_key_dm_inbound_record (
id,
inbound_no,
batch_no,
inbound_type,
inbound_status,
inbound_date,
is_used,
storage_location,
remark,
create_by,
create_time
) VALUES (
#{id},
#{inbound_no},
#{batch_no},
#{inbound_type},
#{inbound_status},
#{inbound_date},
#{is_used},
#{storage_location},
#{remark},
#{create_by},
#{create_time}
)
</insert>
<insert
id=
"insertInboundDetail"
parameterType=
"map"
>
INSERT INTO jl_key_dm_inbound_detail (
id,
inbound_id,
material_id,
inbound_type,
inbound_quantity,
unit_price,
total_amount,
production_date,
expiry_date,
create_by,
create_time
) VALUES (
#{id},
#{inbound_id},
#{material_id},
#{inbound_type},
#{inbound_quantity},
#{unit_price},
#{total_amount},
#{production_date},
#{expiry_date},
#{create_by},
#{create_time}
)
</insert>
</mapper>
src/main/resources/mybatis/mappers/standard/jilinsscgsdp/KeyDmMaterialLogDao.xml
View file @
bfec1bf4
...
...
@@ -33,10 +33,12 @@
</foreach>
</insert>
<select
id=
"selectLogsByApplicationId"
parameterType=
"map"
resultType=
"map"
>
SELECT ml.*,m.material_name
SELECT ml.*,m.material_name
,u.name
FROM jl_key_dm_material_log as ml
left join jl_key_dm_material as m
on ml.material_id = m.id
left join jl_key_dm_user as u
on u.id = ml.create_by
WHERE relation_id = #{id}
AND ml.is_used = 1 ORDER BY ml.create_time ASC
</select>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论