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
fc8c3f08
Commit
fc8c3f08
authored
Jul 19, 2023
by
胡懿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改出库报错的问题,升级poi,
parent
44111b1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
48 deletions
+97
-48
LedgerService.java
...eplus/modules/warehouse/ledger/service/LedgerService.java
+97
-48
No files found.
src/main/java/com/jeeplus/modules/warehouse/ledger/service/LedgerService.java
View file @
fc8c3f08
...
...
@@ -154,13 +154,13 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
* */
@Transactional
(
readOnly
=
false
)
public
void
lowerLedger
(
Ledger
ledger
)
{
List
<
String
>
shelvesListByLedgerId
=
mapper
.
findShelvesListByLedgerId
(
ledger
.
getId
());
/*
List<String> shelvesListByLedgerId = mapper.findShelvesListByLedgerId(ledger.getId());
if(shelvesListByLedgerId == null || shelvesListByLedgerId.size() == 0){
ledger.setShelvesIds(null);
}else {
String shelvesIds = String.join(",", shelvesListByLedgerId);
ledger.setShelvesIds(shelvesIds);
}
}
*/
mapper
.
update
(
ledger
);
}
@Transactional
(
readOnly
=
false
)
...
...
@@ -205,7 +205,9 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
// 创建工作表
XSSFSheet
sheet
=
workbook
.
createSheet
(
"被装物资库房帐"
);
CellStyle
oneStyle
=
ExcelStyleUtils
.
topOneCellStyle
(
workbook
);
CellStyle
twoStyle
=
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
);
CellStyle
threeStyle
=
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
);
...
...
@@ -214,60 +216,104 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
XSSFRow
sheetRow
=
sheet
.
createRow
(
row
);
if
(
0
==
row
)
{
sheetRow
.
setHeightInPoints
(
30
);
XSSFCell
cell
=
sheetRow
.
createCell
(
0
);
cell
.
setCellValue
(
"被 装 物 资 库 房 帐"
);
cell
.
setCellStyle
(
ExcelStyleUtils
.
topOneCellStyle
(
workbook
));
for
(
int
i
=
0
;
i
<
22
;
i
++)
{
if
(
0
==
i
)
{
XSSFCell
cell
=
sheetRow
.
createCell
(
i
);
cell
.
setCellValue
(
"被 装 物 资 库 房 帐"
);
cell
.
setCellStyle
(
oneStyle
);
}
else
{
XSSFCell
cell
=
sheetRow
.
createCell
(
i
);
cell
.
setCellStyle
(
oneStyle
);
}
}
}
if
(
1
==
row
)
{
sheetRow
.
setHeightInPoints
(
20
);
XSSFCell
cell
=
sheetRow
.
createCell
(
0
);
cell
.
setCellValue
(
"品名代码:"
+
materialType
.
getCode
());
cell
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
XSSFCell
cell1
=
sheetRow
.
createCell
(
4
);
cell1
.
setCellValue
(
"品名:"
+
materialType
.
getName
());
cell1
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
for
(
int
i
=
0
;
i
<
22
;
i
++)
{
if
(
0
==
i
)
{
XSSFCell
cell
=
sheetRow
.
createCell
(
i
);
cell
.
setCellValue
(
"品名代码:"
+
materialType
.
getCode
());
cell
.
setCellStyle
(
twoStyle
);
}
else
if
(
4
==
i
)
{
XSSFCell
cell1
=
sheetRow
.
createCell
(
i
);
cell1
.
setCellValue
(
"品名:"
+
materialType
.
getName
());
cell1
.
setCellStyle
(
twoStyle
);
}
else
if
(
12
==
i
)
{
XSSFCell
cell2
=
sheetRow
.
createCell
(
i
);
cell2
.
setCellValue
(
"计量单位:"
+
materialType
.
getUnit
());
cell2
.
setCellStyle
(
twoStyle
);
}
else
{
XSSFCell
cell2
=
sheetRow
.
createCell
(
i
);
cell2
.
setCellStyle
(
twoStyle
);
}
}
XSSFCell
cell2
=
sheetRow
.
createCell
(
12
);
cell2
.
setCellValue
(
"计量单位:"
+
materialType
.
getUnit
());
cell2
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
}
if
(
2
==
row
)
{
sheetRow
.
setHeightInPoints
(
20
);
XSSFCell
cell
=
sheetRow
.
createCell
(
0
);
cell
.
setCellValue
(
DateUtil
.
getYear
(
eTime
)
+
" 年"
);
cell
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
sheetRow
.
setHeightInPoints
(
20
);
XSSFCell
cell1
=
sheetRow
.
createCell
(
2
);
cell1
.
setCellValue
(
"凭证批号"
);
cell1
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
sheetRow
.
setHeightInPoints
(
20
);
XSSFCell
cell2
=
sheetRow
.
createCell
(
3
);
cell2
.
setCellValue
(
"摘要"
);
cell2
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
sheetRow
.
setHeightInPoints
(
20
);
XSSFCell
cell3
=
sheetRow
.
createCell
(
4
);
cell3
.
setCellValue
(
"收入"
);
cell3
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
sheetRow
.
setHeightInPoints
(
20
);
XSSFCell
cell4
=
sheetRow
.
createCell
(
5
);
cell4
.
setCellValue
(
"支出"
);
cell4
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
sheetRow
.
setHeightInPoints
(
15
);
for
(
int
i
=
0
;
i
<
22
;
i
++)
{
if
(
0
==
i
)
{
XSSFCell
cell
=
sheetRow
.
createCell
(
i
);
cell
.
setCellValue
(
DateUtil
.
getYear
(
eTime
)
+
" 年"
);
cell
.
setCellStyle
(
threeStyle
);
}
else
if
(
2
==
i
)
{
XSSFCell
cell1
=
sheetRow
.
createCell
(
i
);
cell1
.
setCellValue
(
"凭证批号"
);
cell1
.
setCellStyle
(
threeStyle
);
}
else
if
(
3
==
i
)
{
XSSFCell
cell2
=
sheetRow
.
createCell
(
i
);
cell2
.
setCellValue
(
"摘要"
);
cell2
.
setCellStyle
(
threeStyle
);
}
else
if
(
4
==
i
)
{
XSSFCell
cell3
=
sheetRow
.
createCell
(
i
);
cell3
.
setCellValue
(
"收入"
);
cell3
.
setCellStyle
(
threeStyle
);
}
else
if
(
5
==
i
)
{
XSSFCell
cell4
=
sheetRow
.
createCell
(
i
);
cell4
.
setCellValue
(
"支出"
);
cell4
.
setCellStyle
(
threeStyle
);
}
else
if
(
6
==
i
)
{
XSSFCell
cell5
=
sheetRow
.
createCell
(
i
);
cell5
.
setCellValue
(
"结存"
);
cell5
.
setCellStyle
(
threeStyle
);
}
else
if
(
21
==
i
)
{
XSSFCell
cell6
=
sheetRow
.
createCell
(
i
);
cell6
.
setCellValue
(
"摘要"
);
cell6
.
setCellStyle
(
threeStyle
);
}
else
{
XSSFCell
cell6
=
sheetRow
.
createCell
(
i
);
cell6
.
setCellStyle
(
threeStyle
);
}
}
}
if
(
3
==
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
if
(
6
==
i
)
{
XSSFCell
cell2
=
sheetRow
.
createCell
(
i
);
cell2
.
setCellValue
(
"数量"
);
cell2
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
}
else
if
(
7
==
i
)
{
XSSFCell
cell3
=
sheetRow
.
createCell
(
i
);
cell3
.
setCellValue
(
"号型"
);
cell3
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
}
else
{
XSSFCell
cell3
=
sheetRow
.
createCell
(
i
);
cell3
.
setCellStyle
(
ExcelStyleUtils
.
topThreeCellStyle
(
workbook
));
}
}
sheetRow
.
setHeightInPoints
(
20
);
XSSFCell
cell5
=
sheetRow
.
createCell
(
6
);
cell5
.
setCellValue
(
"结存"
);
cell5
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
sheetRow
.
setHeightInPoints
(
20
);
XSSFCell
cell6
=
sheetRow
.
createCell
(
21
);
cell6
.
setCellValue
(
"摘要"
);
cell6
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
}
// 设置列宽 sheet.setColumnWidth(0, 16 * 256); 第一个参数为第几个单元格,第二个为16个字符宽度
}
...
...
@@ -283,6 +329,9 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
2
,
4
,
5
,
5
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
2
,
2
,
6
,
20
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
2
,
4
,
21
,
21
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
3
,
4
,
6
,
6
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
3
,
3
,
7
,
20
));
FileOutputStream
out
=
null
;
try
{
out
=
new
FileOutputStream
(
new
File
(
"D:/excel.xlsx"
));
...
...
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