Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
warehouse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
胡懿
warehouse
Commits
b75fb4fa
Commit
b75fb4fa
authored
Jul 19, 2023
by
胡懿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改出库报错的问题,升级poi,
parent
fc8c3f08
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
234 additions
and
35 deletions
+234
-35
ExcelStyleUtils.java
...eplus/modules/warehouse/ledger/Utils/ExcelStyleUtils.java
+87
-22
ExcelExportInfo.java
...jeeplus/modules/warehouse/ledger/dto/ExcelExportInfo.java
+94
-0
LedgerService.java
...eplus/modules/warehouse/ledger/service/LedgerService.java
+50
-13
StorageInfoMapper.xml
...odules/warehouse/storage/mapper/xml/StorageInfoMapper.xml
+3
-0
No files found.
src/main/java/com/jeeplus/modules/warehouse/ledger/Utils/ExcelStyleUtils.java
View file @
b75fb4fa
...
@@ -12,35 +12,100 @@ public class ExcelStyleUtils {
...
@@ -12,35 +12,100 @@ public class ExcelStyleUtils {
*/
*/
public
static
CellStyle
topOneCellStyle
(
XSSFWorkbook
workbook
)
{
public
static
CellStyle
topOneCellStyle
(
XSSFWorkbook
workbook
)
{
// 样式设置
// 样式设置
CellStyle
topS
tyle
=
workbook
.
createCellStyle
();
CellStyle
s
tyle
=
workbook
.
createCellStyle
();
// 水平对齐方式
// 水平对齐方式
topS
tyle
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
s
tyle
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
// 垂直居中
// 垂直居中
topStyle
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
Font
topFont
=
workbook
.
createFont
();
style
.
setBorderTop
(
BorderStyle
.
THIN
);
topFont
.
setFontHeight
((
short
)
500
);
//设置右边框线条类型
topFont
.
setBold
(
true
);
style
.
setBorderRight
(
BorderStyle
.
THIN
);
topFont
.
setUnderline
(
Font
.
U_SINGLE
);
// 下划线
//设置下边框线条类型
topFont
.
setFontName
(
"宋体"
);
style
.
setBorderBottom
(
BorderStyle
.
THIN
);
topFont
.
setColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置左边框线条类型
topStyle
.
setFont
(
topFont
);
style
.
setBorderLeft
(
BorderStyle
.
THIN
);
return
topStyle
;
//设置上边框线条颜色
style
.
setTopBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置右边框线条颜色
style
.
setRightBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置下边框线条颜色
style
.
setBottomBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置左边框线条颜色
style
.
setLeftBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
Font
font
=
workbook
.
createFont
();
font
.
setFontHeight
((
short
)
500
);
font
.
setBold
(
true
);
font
.
setUnderline
(
Font
.
U_SINGLE
);
// 下划线
font
.
setFontName
(
"宋体"
);
font
.
setColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
style
.
setFont
(
font
);
return
style
;
}
}
public
static
CellStyle
topTwoCellStyle
(
XSSFWorkbook
workbook
)
{
public
static
CellStyle
topTwoCellStyle
(
XSSFWorkbook
workbook
)
{
// 样式设置
// 样式设置
CellStyle
topStyle
=
workbook
.
createCellStyle
();
CellStyle
style
=
workbook
.
createCellStyle
();
// 水平对齐方式
style
.
setAlignment
(
HorizontalAlignment
.
LEFT
);
// 垂直居中
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
style
.
setBorderTop
(
BorderStyle
.
THIN
);
//设置右边框线条类型
style
.
setBorderRight
(
BorderStyle
.
THIN
);
//设置下边框线条类型
style
.
setBorderBottom
(
BorderStyle
.
THIN
);
//设置左边框线条类型
style
.
setBorderLeft
(
BorderStyle
.
THIN
);
//设置上边框线条颜色
style
.
setTopBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置右边框线条颜色
style
.
setRightBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置下边框线条颜色
style
.
setBottomBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置左边框线条颜色
style
.
setLeftBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
Font
font
=
workbook
.
createFont
();
font
.
setFontHeight
((
short
)
220
);
font
.
setFontName
(
"宋体"
);
font
.
setColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
style
.
setFont
(
font
);
return
style
;
}
public
static
CellStyle
topThreeCellStyle
(
XSSFWorkbook
workbook
)
{
// 样式设置
CellStyle
style
=
workbook
.
createCellStyle
();
// 水平对齐方式
// 水平对齐方式
topStyle
.
setAlignment
(
HorizontalAlignment
.
LEFT
);
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
// 垂直居中
// 垂直居中
topStyle
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
Font
topFont
=
workbook
.
createFont
();
style
.
setBorderTop
(
BorderStyle
.
THIN
);
topFont
.
setFontHeight
((
short
)
220
);
//设置右边框线条类型
topFont
.
setFontName
(
"宋体"
);
style
.
setBorderRight
(
BorderStyle
.
THIN
);
topFont
.
setColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置下边框线条类型
topStyle
.
setFont
(
topFont
);
style
.
setBorderBottom
(
BorderStyle
.
THIN
);
return
topStyle
;
//设置左边框线条类型
style
.
setBorderLeft
(
BorderStyle
.
THIN
);
//设置上边框线条颜色
style
.
setTopBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置右边框线条颜色
style
.
setRightBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置下边框线条颜色
style
.
setBottomBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
//设置左边框线条颜色
style
.
setLeftBorderColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
Font
font
=
workbook
.
createFont
();
font
.
setFontHeight
((
short
)
220
);
font
.
setFontName
(
"宋体"
);
font
.
setColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
style
.
setFont
(
font
);
return
style
;
}
}
}
}
src/main/java/com/jeeplus/modules/warehouse/ledger/dto/ExcelExportInfo.java
0 → 100644
View file @
b75fb4fa
package
com
.
jeeplus
.
modules
.
warehouse
.
ledger
.
dto
;
public
class
ExcelExportInfo
{
private
String
month
;
private
String
day
;
private
String
batch
;
private
String
remarks
;
private
int
taskOrSend
;
// 0是收入,1是支出
private
String
task
;
private
String
mask
;
private
String
num
;
private
String
model
;
private
String
userName
;
public
String
getMonth
()
{
return
month
;
}
public
void
setMonth
(
String
month
)
{
this
.
month
=
month
;
}
public
String
getDay
()
{
return
day
;
}
public
void
setDay
(
String
day
)
{
this
.
day
=
day
;
}
public
String
getBatch
()
{
return
batch
;
}
public
void
setBatch
(
String
batch
)
{
this
.
batch
=
batch
;
}
public
String
getRemarks
()
{
return
remarks
;
}
public
void
setRemarks
(
String
remarks
)
{
this
.
remarks
=
remarks
;
}
public
int
getTaskOrSend
()
{
return
taskOrSend
;
}
public
void
setTaskOrSend
(
int
taskOrSend
)
{
this
.
taskOrSend
=
taskOrSend
;
}
public
String
getTask
()
{
return
task
;
}
public
void
setTask
(
String
task
)
{
this
.
task
=
task
;
}
public
String
getMask
()
{
return
mask
;
}
public
void
setMask
(
String
mask
)
{
this
.
mask
=
mask
;
}
public
String
getNum
()
{
return
num
;
}
public
void
setNum
(
String
num
)
{
this
.
num
=
num
;
}
public
String
getModel
()
{
return
model
;
}
public
void
setModel
(
String
model
)
{
this
.
model
=
model
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
}
src/main/java/com/jeeplus/modules/warehouse/ledger/service/LedgerService.java
View file @
b75fb4fa
...
@@ -10,8 +10,11 @@ import java.math.BigDecimal;
...
@@ -10,8 +10,11 @@ import java.math.BigDecimal;
import
java.util.*
;
import
java.util.*
;
import
com.jeeplus.common.utils.DateUtil
;
import
com.jeeplus.common.utils.DateUtil
;
import
com.jeeplus.modules.sys.entity.User
;
import
com.jeeplus.modules.sys.utils.UserUtils
;
import
com.jeeplus.modules.warehouse.ledger.Utils.ExcelStyleUtils
;
import
com.jeeplus.modules.warehouse.ledger.Utils.ExcelStyleUtils
;
import
com.jeeplus.modules.warehouse.ledger.dto.CountLedgerInfo
;
import
com.jeeplus.modules.warehouse.ledger.dto.CountLedgerInfo
;
import
com.jeeplus.modules.warehouse.ledger.dto.ExcelExportInfo
;
import
com.jeeplus.modules.warehouse.materialtype.entity.MaterialType
;
import
com.jeeplus.modules.warehouse.materialtype.entity.MaterialType
;
import
com.jeeplus.modules.warehouse.materialtype.mapper.MaterialTypeMapper
;
import
com.jeeplus.modules.warehouse.materialtype.mapper.MaterialTypeMapper
;
import
com.jeeplus.modules.warehouse.materialtype.service.MaterialTypeService
;
import
com.jeeplus.modules.warehouse.materialtype.service.MaterialTypeService
;
...
@@ -190,6 +193,7 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
...
@@ -190,6 +193,7 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
LedgerInfo
temLi
=
new
LedgerInfo
();
LedgerInfo
temLi
=
new
LedgerInfo
();
temLi
.
setType
(
materialType
);
temLi
.
setType
(
materialType
);
...
@@ -199,6 +203,32 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
...
@@ -199,6 +203,32 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
outboundInfo
.
setEndTime
(
eTime
);
outboundInfo
.
setEndTime
(
eTime
);
List
<
OutboundInfo
>
outboundInfoList
=
outboundInfoMapper
.
findList
(
outboundInfo
);
List
<
OutboundInfo
>
outboundInfoList
=
outboundInfoMapper
.
findList
(
outboundInfo
);
Map
<
String
,
Integer
>
modelMap
=
new
HashMap
<>();
List
<
ExcelExportInfo
>
excelExportInfoList
=
new
ArrayList
<>();
for
(
StorageInfo
si
:
storageInfoList
)
{
ExcelExportInfo
eei
=
new
ExcelExportInfo
();
eei
.
setMonth
(
DateUtil
.
getMonth
(
si
.
getCreateDate
())
+
""
);
eei
.
setDay
(
DateUtil
.
getDay
(
si
.
getCreateDate
())
+
""
);
eei
.
setBatch
(
si
.
getStorage
().
getBatchNum
());
eei
.
setRemarks
(
si
.
getRemarks
());
eei
.
setTaskOrSend
(
0
);
eei
.
setTask
(
si
.
getInfoSum
().
toString
());
eei
.
setMask
(
""
);
eei
.
setNum
(
si
.
getNum
()
+
""
);
eei
.
setModel
(
si
.
getModel
());
// modelMap
User
user
=
UserUtils
.
get
(
si
.
getCreateBy
().
getId
());
eei
.
setUserName
(
user
.
getLoginName
());
excelExportInfoList
.
add
(
eei
);
}
int
sunRowNum
=
5
+
storageInfoList
.
size
()
+
outboundInfoList
.
size
();
int
sunRowNum
=
5
+
storageInfoList
.
size
()
+
outboundInfoList
.
size
();
// 创建工作薄
// 创建工作薄
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
...
@@ -279,7 +309,7 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
...
@@ -279,7 +309,7 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
cell5
.
setCellStyle
(
threeStyle
);
cell5
.
setCellStyle
(
threeStyle
);
}
else
if
(
21
==
i
)
{
}
else
if
(
21
==
i
)
{
XSSFCell
cell6
=
sheetRow
.
createCell
(
i
);
XSSFCell
cell6
=
sheetRow
.
createCell
(
i
);
cell6
.
setCellValue
(
"
摘要
"
);
cell6
.
setCellValue
(
"
登记人
"
);
cell6
.
setCellStyle
(
threeStyle
);
cell6
.
setCellStyle
(
threeStyle
);
}
else
{
}
else
{
XSSFCell
cell6
=
sheetRow
.
createCell
(
i
);
XSSFCell
cell6
=
sheetRow
.
createCell
(
i
);
...
@@ -290,15 +320,7 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
...
@@ -290,15 +320,7 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
if
(
3
==
row
)
{
if
(
3
==
row
)
{
sheetRow
.
setHeightInPoints
(
15
);
sheetRow
.
setHeightInPoints
(
15
);
for
(
int
i
=
0
;
i
<
22
;
i
++)
{
for
(
int
i
=
0
;
i
<
22
;
i
++)
{
if
(
0
==
i
)
{
if
(
6
==
i
)
{
XSSFCell
cell
=
sheetRow
.
createCell
(
i
);
cell
.
setCellValue
(
"月"
);
cell
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
}
else
if
(
1
==
i
)
{
XSSFCell
cell1
=
sheetRow
.
createCell
(
i
);
cell1
.
setCellValue
(
"日"
);
cell1
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
}
else
if
(
6
==
i
)
{
XSSFCell
cell2
=
sheetRow
.
createCell
(
i
);
XSSFCell
cell2
=
sheetRow
.
createCell
(
i
);
cell2
.
setCellValue
(
"数量"
);
cell2
.
setCellValue
(
"数量"
);
cell2
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
cell2
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
...
@@ -311,13 +333,28 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
...
@@ -311,13 +333,28 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
cell3
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
cell3
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
}
}
}
}
}
if
(
4
==
row
)
{
sheetRow
.
setHeightInPoints
(
15
);
for
(
int
i
=
0
;
i
<
22
;
i
++)
{
if
(
0
==
i
)
{
XSSFCell
cell
=
sheetRow
.
createCell
(
i
);
cell
.
setCellValue
(
"月"
);
cell
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
}
else
if
(
1
==
i
)
{
XSSFCell
cell1
=
sheetRow
.
createCell
(
i
);
cell1
.
setCellValue
(
"日"
);
cell1
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
}
else
{
XSSFCell
cell
=
sheetRow
.
createCell
(
i
);
cell
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
}
}
}
}
// 设置列宽 sheet.setColumnWidth(0, 16 * 256); 第一个参数为第几个单元格,第二个为16个字符宽度
// 设置列宽 sheet.setColumnWidth(0, 16 * 256); 第一个参数为第几个单元格,第二个为16个字符宽度
}
}
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
0
,
0
,
0
,
21
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
0
,
0
,
0
,
21
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
0
,
3
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
0
,
3
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
4
,
11
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
4
,
11
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
12
,
21
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
12
,
21
));
...
...
src/main/java/com/jeeplus/modules/warehouse/storage/mapper/xml/StorageInfoMapper.xml
View file @
b75fb4fa
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
type.amount AS "type.amount",
type.amount AS "type.amount",
type.unit AS "type.unit",
type.unit AS "type.unit",
s.batch_num AS "storage.batchNum",
qr.code AS "qrCode.code",
qr.code AS "qrCode.code",
qr.state AS "qrCode.state"
qr.state AS "qrCode.state"
</sql>
</sql>
...
@@ -33,6 +35,7 @@
...
@@ -33,6 +35,7 @@
<sql
id=
"storageInfoJoins"
>
<sql
id=
"storageInfoJoins"
>
LEFT JOIN t_wh_material_type type ON type.id = a.type_id
LEFT JOIN t_wh_material_type type ON type.id = a.type_id
LEFT JOIN t_wh_qr qr on qr.id = a.qr_id
LEFT JOIN t_wh_qr qr on qr.id = a.qr_id
LEFT JOIN t_wh_storage s on s.id = a.storage_id
</sql>
</sql>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment