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
e88c9986
Commit
e88c9986
authored
Jul 19, 2023
by
胡懿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改出库报错的问题,升级poi,
parent
d0f3c15b
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
299 additions
and
106 deletions
+299
-106
pom.xml
pom.xml
+24
-3
ExportExcel.java
...main/java/com/jeeplus/common/utils/excel/ExportExcel.java
+16
-23
ImportExcel.java
...main/java/com/jeeplus/common/utils/excel/ImportExcel.java
+8
-18
ExcelStyleUtils.java
...eplus/modules/warehouse/ledger/Utils/ExcelStyleUtils.java
+46
-0
LedgerInfo.java
...m/jeeplus/modules/warehouse/ledger/entity/LedgerInfo.java
+4
-0
LedgerInfoMapper.java
...lus/modules/warehouse/ledger/mapper/LedgerInfoMapper.java
+0
-1
LedgerInfoMapper.xml
.../modules/warehouse/ledger/mapper/xml/LedgerInfoMapper.xml
+0
-49
LedgerService.java
...eplus/modules/warehouse/ledger/service/LedgerService.java
+110
-0
LedgerController.java
...eeplus/modules/warehouse/ledger/web/LedgerController.java
+11
-1
POIUtil.java
...jeeplus/modules/warehouse/materialtype/utils/POIUtil.java
+10
-11
OutboundInfo.java
...eplus/modules/warehouse/outbound/entity/OutboundInfo.java
+30
-0
OutboundInfoMapper.xml
...ules/warehouse/outbound/mapper/xml/OutboundInfoMapper.xml
+6
-0
StorageInfo.java
...jeeplus/modules/warehouse/storage/entity/StorageInfo.java
+29
-0
StorageInfoMapper.java
...s/modules/warehouse/storage/mapper/StorageInfoMapper.java
+2
-0
StorageInfoMapper.xml
...odules/warehouse/storage/mapper/xml/StorageInfoMapper.xml
+3
-0
No files found.
pom.xml
View file @
e88c9986
...
...
@@ -27,7 +27,7 @@
<!-- tools version setting -->
<slf4j.version>
1.7.25
</slf4j.version>
<commons-io.version>
2.
4
</commons-io.version>
<commons-io.version>
2.
11.0
</commons-io.version>
<commons-codec.version>
1.9
</commons-codec.version>
<commons-fileupload.version>
1.3.1
</commons-fileupload.version>
<commons-beanutils.version>
1.9.1
</commons-beanutils.version>
...
...
@@ -106,7 +106,7 @@
<build>
<finalName>
jeeplus
</finalName>
<finalName>
warehouse
</finalName>
<resources>
<resource>
<directory>
src/main/java
</directory>
...
...
@@ -655,6 +655,21 @@
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
5.2.3
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
5.2.3
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml-schemas
</artifactId>
<version>
4.1.2
</version>
</dependency>
<!--<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
...
...
@@ -666,7 +681,7 @@
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>${poi.version}</version>
</dependency>
</dependency>
-->
<!-- image util -->
<dependency>
...
...
@@ -811,6 +826,12 @@
<version>
42.1.1
</version>
</dependency>
<!-- Ikanalyzer分词器 -->
<dependency>
<groupId>
com.janeluo
</groupId>
<artifactId>
ikanalyzer
</artifactId>
<version>
2012_u6
</version>
</dependency>
<!-- UTILS end -->
</dependencies>
...
...
src/main/java/com/jeeplus/common/utils/excel/ExportExcel.java
View file @
e88c9986
...
...
@@ -19,15 +19,7 @@ import java.util.Map;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.CellStyle
;
import
org.apache.poi.ss.usermodel.Comment
;
import
org.apache.poi.ss.usermodel.DataFormat
;
import
org.apache.poi.ss.usermodel.Font
;
import
org.apache.poi.ss.usermodel.IndexedColors
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFClientAnchor
;
...
...
@@ -40,6 +32,7 @@ import com.jeeplus.common.utils.Encodes;
import
com.jeeplus.common.utils.Reflections
;
import
com.jeeplus.common.utils.excel.annotation.ExcelField
;
import
com.jeeplus.modules.sys.utils.DictUtils
;
import
org.apache.poi.hssf.record.cf.BorderFormatting
;
/**
* 导出Excel文件(导出“XLSX”格式,支持大数据量导出 @see org.apache.poi.ss.SpreadsheetVersion)
...
...
@@ -237,24 +230,24 @@ public class ExportExcel {
Map
<
String
,
CellStyle
>
styles
=
new
HashMap
<
String
,
CellStyle
>();
CellStyle
style
=
wb
.
createCellStyle
();
style
.
setAlignment
(
CellStyle
.
ALIGN_
CENTER
);
style
.
setVerticalAlignment
(
CellStyle
.
VERTICAL_
CENTER
);
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
Font
titleFont
=
wb
.
createFont
();
titleFont
.
setFontName
(
"Arial"
);
titleFont
.
setFontHeightInPoints
((
short
)
16
);
titleFont
.
setBold
weight
(
Font
.
BOLDWEIGHT_BOLD
);
titleFont
.
setBold
(
true
);
style
.
setFont
(
titleFont
);
styles
.
put
(
"title"
,
style
);
style
=
wb
.
createCellStyle
();
style
.
setVerticalAlignment
(
CellStyle
.
VERTICAL_
CENTER
);
style
.
setBorderRight
(
CellStyle
.
BORDER_
THIN
);
style
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
style
.
setBorderRight
(
BorderStyle
.
THIN
);
style
.
setRightBorderColor
(
IndexedColors
.
GREY_50_PERCENT
.
getIndex
());
style
.
setBorderLeft
(
CellStyle
.
BORDER_
THIN
);
style
.
setBorderLeft
(
BorderStyle
.
THIN
);
style
.
setLeftBorderColor
(
IndexedColors
.
GREY_50_PERCENT
.
getIndex
());
style
.
setBorderTop
(
CellStyle
.
BORDER_
THIN
);
style
.
setBorderTop
(
BorderStyle
.
THIN
);
style
.
setTopBorderColor
(
IndexedColors
.
GREY_50_PERCENT
.
getIndex
());
style
.
setBorderBottom
(
CellStyle
.
BORDER_
THIN
);
style
.
setBorderBottom
(
BorderStyle
.
THIN
);
style
.
setBottomBorderColor
(
IndexedColors
.
GREY_50_PERCENT
.
getIndex
());
Font
dataFont
=
wb
.
createFont
();
dataFont
.
setFontName
(
"Arial"
);
...
...
@@ -264,29 +257,29 @@ public class ExportExcel {
style
=
wb
.
createCellStyle
();
style
.
cloneStyleFrom
(
styles
.
get
(
"data"
));
style
.
setAlignment
(
CellStyle
.
ALIGN_LEFT
);
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
styles
.
put
(
"data1"
,
style
);
style
=
wb
.
createCellStyle
();
style
.
cloneStyleFrom
(
styles
.
get
(
"data"
));
style
.
setAlignment
(
CellStyle
.
ALIGN_
CENTER
);
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
styles
.
put
(
"data2"
,
style
);
style
=
wb
.
createCellStyle
();
style
.
cloneStyleFrom
(
styles
.
get
(
"data"
));
style
.
setAlignment
(
CellStyle
.
ALIGN_
RIGHT
);
style
.
setAlignment
(
HorizontalAlignment
.
RIGHT
);
styles
.
put
(
"data3"
,
style
);
style
=
wb
.
createCellStyle
();
style
.
cloneStyleFrom
(
styles
.
get
(
"data"
));
// style.setWrapText(true);
style
.
setAlignment
(
CellStyle
.
ALIGN_
CENTER
);
style
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
style
.
setFillForegroundColor
(
IndexedColors
.
GREY_50_PERCENT
.
getIndex
());
style
.
setFillPattern
(
CellStyl
e
.
SOLID_FOREGROUND
);
style
.
setFillPattern
(
FillPatternTyp
e
.
SOLID_FOREGROUND
);
Font
headerFont
=
wb
.
createFont
();
headerFont
.
setFontName
(
"Arial"
);
headerFont
.
setFontHeightInPoints
((
short
)
10
);
headerFont
.
setBold
weight
(
Font
.
BOLDWEIGHT_BOLD
);
headerFont
.
setBold
(
true
);
headerFont
.
setColor
(
IndexedColors
.
WHITE
.
getIndex
());
style
.
setFont
(
headerFont
);
styles
.
put
(
"header"
,
style
);
...
...
src/main/java/com/jeeplus/common/utils/excel/ImportExcel.java
View file @
e88c9986
...
...
@@ -17,14 +17,9 @@ import java.util.Date;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.hssf.usermodel.HSSFDateUtil
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.openxml4j.exceptions.InvalidFormatException
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.DateUtil
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -65,7 +60,6 @@ public class ImportExcel {
/**
* 构造函数
* @param path 导入文件,读取第一个工作表
* @param headerNum 标题行号,数据行号=标题行号+1
* @throws InvalidFormatException
* @throws IOException
...
...
@@ -77,7 +71,6 @@ public class ImportExcel {
/**
* 构造函数
* @param path 导入文件对象,读取第一个工作表
* @param headerNum 标题行号,数据行号=标题行号+1
* @throws InvalidFormatException
* @throws IOException
...
...
@@ -89,7 +82,6 @@ public class ImportExcel {
/**
* 构造函数
* @param path 导入文件
* @param headerNum 标题行号,数据行号=标题行号+1
* @param sheetIndex 工作表编号
* @throws InvalidFormatException
...
...
@@ -102,7 +94,6 @@ public class ImportExcel {
/**
* 构造函数
* @param path 导入文件对象
* @param headerNum 标题行号,数据行号=标题行号+1
* @param sheetIndex 工作表编号
* @throws InvalidFormatException
...
...
@@ -128,7 +119,6 @@ public class ImportExcel {
/**
* 构造函数
* @param path 导入文件对象
* @param headerNum 标题行号,数据行号=标题行号+1
* @param sheetIndex 工作表编号
* @throws InvalidFormatException
...
...
@@ -197,12 +187,12 @@ public class ImportExcel {
try
{
Cell
cell
=
row
.
getCell
(
column
);
if
(
cell
!=
null
)
{
if
(
cell
.
getCellType
()
==
Cell
.
CELL_TYPE_
NUMERIC
)
{
if
(
cell
.
getCellType
()
==
Cell
Type
.
NUMERIC
)
{
// val = cell.getNumericCellValue();
// 当excel 中的数据为数值或日期是需要特殊处理
if
(
HSSF
DateUtil
.
isCellDateFormatted
(
cell
))
{
if
(
DateUtil
.
isCellDateFormatted
(
cell
))
{
double
d
=
cell
.
getNumericCellValue
();
Date
date
=
HSSF
DateUtil
.
getJavaDate
(
d
);
Date
date
=
DateUtil
.
getJavaDate
(
d
);
SimpleDateFormat
dformat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
val
=
dformat
.
format
(
date
);
...
...
@@ -211,13 +201,13 @@ public class ImportExcel {
nf
.
setGroupingUsed
(
false
);
// true时的格式:1,234,567,890
val
=
nf
.
format
(
cell
.
getNumericCellValue
());
// 数值类型的数据为double,所以需要转换一下
}
}
else
if
(
cell
.
getCellType
()
==
Cell
.
CELL_TYPE_
STRING
)
{
}
else
if
(
cell
.
getCellType
()
==
Cell
Type
.
STRING
)
{
val
=
cell
.
getStringCellValue
();
}
else
if
(
cell
.
getCellType
()
==
Cell
.
CELL_TYPE_
FORMULA
)
{
}
else
if
(
cell
.
getCellType
()
==
Cell
Type
.
FORMULA
)
{
val
=
cell
.
getCellFormula
();
}
else
if
(
cell
.
getCellType
()
==
Cell
.
CELL_TYPE_
BOOLEAN
)
{
}
else
if
(
cell
.
getCellType
()
==
Cell
Type
.
BOOLEAN
)
{
val
=
cell
.
getBooleanCellValue
();
}
else
if
(
cell
.
getCellType
()
==
Cell
.
CELL_TYPE_
ERROR
)
{
}
else
if
(
cell
.
getCellType
()
==
Cell
Type
.
ERROR
)
{
val
=
cell
.
getErrorCellValue
();
}
}
...
...
src/main/java/com/jeeplus/modules/warehouse/ledger/Utils/ExcelStyleUtils.java
0 → 100644
View file @
e88c9986
package
com
.
jeeplus
.
modules
.
warehouse
.
ledger
.
Utils
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.usermodel.XSSFCellStyle
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
public
class
ExcelStyleUtils
{
/**
* 第一行样式
* @return
*/
public
static
CellStyle
topOneCellStyle
(
XSSFWorkbook
workbook
)
{
// 样式设置
CellStyle
topStyle
=
workbook
.
createCellStyle
();
// 水平对齐方式
topStyle
.
setAlignment
(
HorizontalAlignment
.
CENTER
);
// 垂直居中
topStyle
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
Font
topFont
=
workbook
.
createFont
();
topFont
.
setFontHeight
((
short
)
500
);
topFont
.
setBold
(
true
);
topFont
.
setUnderline
(
Font
.
U_SINGLE
);
// 下划线
topFont
.
setFontName
(
"宋体"
);
topFont
.
setColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
topStyle
.
setFont
(
topFont
);
return
topStyle
;
}
public
static
CellStyle
topTwoCellStyle
(
XSSFWorkbook
workbook
)
{
// 样式设置
CellStyle
topStyle
=
workbook
.
createCellStyle
();
// 水平对齐方式
topStyle
.
setAlignment
(
HorizontalAlignment
.
LEFT
);
// 垂直居中
topStyle
.
setVerticalAlignment
(
VerticalAlignment
.
CENTER
);
Font
topFont
=
workbook
.
createFont
();
topFont
.
setFontHeight
((
short
)
220
);
topFont
.
setFontName
(
"宋体"
);
topFont
.
setColor
(
IndexedColors
.
BLUE_GREY
.
getIndex
());
topStyle
.
setFont
(
topFont
);
return
topStyle
;
}
}
src/main/java/com/jeeplus/modules/warehouse/ledger/entity/LedgerInfo.java
View file @
e88c9986
...
...
@@ -13,6 +13,7 @@ import com.jeeplus.common.utils.excel.annotation.ExcelField;
import
com.jeeplus.modules.warehouse.warehouse.entity.Warehouse
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -43,6 +44,7 @@ public class LedgerInfo extends DataEntity<LedgerInfo> {
private
Shelves
shelves
;
public
LedgerInfo
()
{
super
();
}
...
...
@@ -182,4 +184,5 @@ public class LedgerInfo extends DataEntity<LedgerInfo> {
public
void
setShelves
(
Shelves
shelves
)
{
this
.
shelves
=
shelves
;
}
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/ledger/mapper/LedgerInfoMapper.java
View file @
e88c9986
...
...
@@ -19,7 +19,6 @@ import java.util.List;
@MyBatisMapper
public
interface
LedgerInfoMapper
extends
BaseMapper
<
LedgerInfo
>
{
public
List
<
CountLedgerInfo
>
findCliList
(
LedgerInfo
ledgerInfo
);
void
deleteByLedgerInfo
(
@Param
(
"id"
)
String
id
);
public
List
<
LedgerInfo
>
findListByQrIdAndCode
(
LedgerInfo
ledgerInfo
);
void
updateByLedgerInfo
(
@Param
(
"id"
)
String
id
);
...
...
src/main/java/com/jeeplus/modules/warehouse/ledger/mapper/xml/LedgerInfoMapper.xml
View file @
e88c9986
...
...
@@ -237,52 +237,4 @@
select * FROM t_wh_ledger_info where ${propertyName} = '${value}'
</select>
<select
id=
"findCliList"
resultType=
"com.jeeplus.modules.warehouse.ledger.dto.CountLedgerInfo"
>
SELECT
a.ledger_id AS "ledger.id",
count(a.id) AS "num",
a.type_id AS "type.id",
a.model AS "model",
a.batch_num AS "batchNum",
a.shelves_id AS "shelves.id",
sum(a.amount) AS "sum",
type.name AS "type.name",
s.name AS "shelves.name",
w.id AS "shelves.warehouse.id",
w.name AS "shelves.warehouse.name"
FROM t_wh_ledger_info a
LEFT JOIN t_wh_material_type type on type.id = a.type_id
LEFT JOIN t_wh_shelves s on s.id = a.shelves_id
LEFT JOIN t_wh_warehouse w on w.id = s.warehouse_id
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
AND a.ledger_id = #{ledger.id}
</where>
GROUP BY a.ledger_id,a.batch_num,a.shelves_id
</select>
<select
id=
"findListByQrIdAndCode"
resultType=
"LedgerInfo"
>
SELECT
<include
refid=
"ledgerInfoColumns"
/>
FROM t_wh_ledger_info a
<include
refid=
"ledgerInfoJoins"
/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
<if
test=
"code != null and code != ''"
>
AND a.code = #{code}
</if>
<if
test=
"qr != null and qr.id != null and qr.id != ''"
>
AND a.qr_id = #{qr.id}
</if>
</where>
<choose>
<when
test=
"page !=null and page.orderBy != null and page.orderBy != ''"
>
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.create_date ASC
</otherwise>
</choose>
</select>
</mapper>
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/ledger/service/LedgerService.java
View file @
e88c9986
...
...
@@ -3,16 +3,33 @@
*/
package
com
.
jeeplus
.
modules
.
warehouse
.
ledger
.
service
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
com.jeeplus.common.utils.DateUtil
;
import
com.jeeplus.modules.warehouse.ledger.Utils.ExcelStyleUtils
;
import
com.jeeplus.modules.warehouse.ledger.dto.CountLedgerInfo
;
import
com.jeeplus.modules.warehouse.materialtype.entity.MaterialType
;
import
com.jeeplus.modules.warehouse.materialtype.mapper.MaterialTypeMapper
;
import
com.jeeplus.modules.warehouse.materialtype.service.MaterialTypeService
;
import
com.jeeplus.modules.warehouse.outbound.entity.OutboundInfo
;
import
com.jeeplus.modules.warehouse.outbound.mapper.OutboundInfoMapper
;
import
com.jeeplus.modules.warehouse.qrcode.entity.QrCode
;
import
com.jeeplus.modules.warehouse.qrcode.mapper.QrCodeMapper
;
import
com.jeeplus.modules.warehouse.shelves.entity.Shelves
;
import
com.jeeplus.modules.warehouse.shelves.utils.ShelvesUtil
;
import
com.jeeplus.modules.warehouse.storage.dto.CountStorageInfo
;
import
com.jeeplus.modules.warehouse.storage.entity.StorageInfo
;
import
com.jeeplus.modules.warehouse.storage.mapper.StorageInfoMapper
;
import
com.jeeplus.modules.warehouse.storage.mapper.StorageMapper
;
import
com.jeeplus.modules.warehouse.storage.service.StorageService
;
import
com.jeeplus.modules.warehouse.warehouse.entity.Warehouse
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.xssf.usermodel.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -25,6 +42,8 @@ import com.jeeplus.modules.warehouse.ledger.mapper.LedgerMapper;
import
com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo
;
import
com.jeeplus.modules.warehouse.ledger.mapper.LedgerInfoMapper
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 台账信息Service
* @author huyi
...
...
@@ -38,6 +57,15 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
private
LedgerInfoMapper
ledgerInfoMapper
;
@Autowired
private
QrCodeMapper
qrCodeMapper
;
@Autowired
private
MaterialTypeMapper
materialTypeMapper
;
@Autowired
private
StorageInfoMapper
storageInfoMapper
;
@Autowired
private
OutboundInfoMapper
outboundInfoMapper
;
public
Ledger
get
(
String
id
)
{
Ledger
ledger
=
super
.
get
(
id
);
...
...
@@ -145,4 +173,85 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
}
}
public
void
ledgerStreamWater
(
String
typeId
,
String
beginTime
,
String
endTime
,
HttpServletResponse
respons
)
{
typeId
=
"4657ffc36fcf4feb922eb571231234b0"
;
beginTime
=
"2023-01-01 00:00:00"
;
endTime
=
"2023-12-01 00:00:00"
;
MaterialType
materialType
=
materialTypeMapper
.
get
(
typeId
);
StorageInfo
temSi
=
new
StorageInfo
();
temSi
.
setType
(
materialType
);
temSi
.
setBeginTime
(
DateUtil
.
parseStrToDate
(
beginTime
,
"yyyy-MM-dd HH:mm:ss"
));
temSi
.
setEndTime
(
DateUtil
.
parseStrToDate
(
endTime
,
"yyyy-MM-dd HH:mm:ss"
));
List
<
StorageInfo
>
storageInfoList
=
storageInfoMapper
.
findList
(
temSi
);
LedgerInfo
temLi
=
new
LedgerInfo
();
temLi
.
setType
(
materialType
);
OutboundInfo
outboundInfo
=
new
OutboundInfo
();
outboundInfo
.
setLedgerInfo
(
temLi
);
outboundInfo
.
setBeginTime
(
DateUtil
.
parseStrToDate
(
beginTime
,
"yyyy-MM-dd HH:mm:ss"
));
outboundInfo
.
setEndTime
(
DateUtil
.
parseStrToDate
(
endTime
,
"yyyy-MM-dd HH:mm:ss"
));
List
<
OutboundInfo
>
outboundInfoList
=
outboundInfoMapper
.
findList
(
outboundInfo
);
int
sunRowNum
=
5
+
storageInfoList
.
size
()
+
outboundInfoList
.
size
();
// 创建工作薄
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
// 创建工作表
XSSFSheet
sheet
=
workbook
.
createSheet
(
"被装物资库房帐"
);
//设置数据
for
(
int
row
=
0
;
row
<
sunRowNum
;
row
++)
{
XSSFRow
sheetRow
=
sheet
.
createRow
(
row
);
if
(
0
==
row
)
{
sheetRow
.
setHeightInPoints
(
30
);
XSSFCell
cell
=
sheetRow
.
createCell
(
0
);
cell
.
setCellValue
(
"被 装 物 资 库 房 帐"
);
cell
.
setCellStyle
(
ExcelStyleUtils
.
topOneCellStyle
(
workbook
));
}
if
(
1
==
row
)
{
sheetRow
.
setHeightInPoints
(
20
);
XSSFCell
cell
=
sheetRow
.
createCell
(
0
);
cell
.
setCellValue
(
"品名代码:"
+
materialType
.
getCode
());
cell
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
XSSFCell
cell1
=
sheetRow
.
createCell
(
1
);
cell1
.
setCellValue
(
"品名:"
+
materialType
.
getName
());
cell1
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
XSSFCell
cell2
=
sheetRow
.
createCell
(
2
);
cell2
.
setCellValue
(
"计量单位:"
+
materialType
.
getUnit
());
cell2
.
setCellStyle
(
ExcelStyleUtils
.
topTwoCellStyle
(
workbook
));
}
// 设置列宽 sheet.setColumnWidth(0, 16 * 256); 第一个参数为第几个单元格,第二个为16个字符宽度
}
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
0
,
0
,
0
,
22
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
0
,
4
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
5
,
12
));
sheet
.
addMergedRegion
(
new
CellRangeAddress
(
1
,
1
,
13
,
22
));
FileOutputStream
out
=
null
;
try
{
out
=
new
FileOutputStream
(
new
File
(
"D:/excel.xlsx"
));
workbook
.
write
(
out
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
null
!=
out
)
{
out
.
flush
();
out
.
close
();
}
workbook
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/ledger/web/LedgerController.java
View file @
e88c9986
...
...
@@ -252,7 +252,7 @@ public class LedgerController extends BaseController {
*/
@ResponseBody
@RequestMapping
(
value
=
"findByQrOrCode"
)
public
Map
<
String
,
Object
>
findByQrOrCode
(
String
qrId
,
String
code
)
{
public
Map
<
String
,
Object
>
findByQrOrCode
(
String
qrId
,
String
code
)
{
boolean
b
=
false
;
if
(
StringUtils
.
isNotBlank
(
qrId
))
{
b
=
true
;
...
...
@@ -275,4 +275,13 @@ public class LedgerController extends BaseController {
}
return
map
;
}
@ResponseBody
@RequestMapping
(
value
=
"ledgerStreamWater"
)
public
AjaxJson
ledgerStreamWater
(
String
typeId
,
String
beginTime
,
String
endTime
,
HttpServletResponse
response
)
{
AjaxJson
j
=
new
AjaxJson
();
ledgerService
.
ledgerStreamWater
(
typeId
,
beginTime
,
endTime
,
response
);
return
j
;
}
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/materialtype/utils/POIUtil.java
View file @
e88c9986
...
...
@@ -5,8 +5,7 @@ import java.text.DecimalFormat;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
org.apache.poi.hssf.usermodel.HSSFCell
;
import
org.apache.poi.hssf.usermodel.HSSFDateUtil
;
import
org.apache.poi.ss.usermodel.DateUtil
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.FormulaEvaluator
;
...
...
@@ -23,9 +22,9 @@ public class POIUtil {
if
(
null
!=
cell
)
{
// 以下是判断数据的类型
switch
(
cell
.
getCellType
())
{
case
HSSFCell
.
CELL_TYPE_
NUMERIC
:
// 数字
if
(
0
==
cell
.
getCellType
())
{
// 判断单元格的类型是否则NUMERIC类型
if
(
HSSF
DateUtil
.
isCellDateFormatted
(
cell
))
{
// 判断是否为日期类型
case
NUMERIC:
// 数字
if
(
0
==
cell
.
getCellType
()
.
getCode
()
)
{
// 判断单元格的类型是否则NUMERIC类型
if
(
DateUtil
.
isCellDateFormatted
(
cell
))
{
// 判断是否为日期类型
Date
date
=
cell
.
getDateCellValue
();
// DateFormat formater = new SimpleDateFormat("yyyy/MM/dd HH:mm");
DateFormat
formater
=
new
SimpleDateFormat
(
"yyyy/MM/dd"
);
...
...
@@ -38,18 +37,18 @@ public class POIUtil {
}
}
break
;
case
HSSFCell
.
CELL_TYPE_
STRING
:
// 字符串
case
STRING:
// 字符串
cellValue
=
cell
.
getStringCellValue
();
break
;
case
HSSFCell
.
CELL_TYPE_
BOOLEAN
:
// Boolean
case
BOOLEAN:
// Boolean
cellValue
=
cell
.
getBooleanCellValue
()
+
""
;
break
;
case
HSSFCell
.
CELL_TYPE_
FORMULA
:
// 公式
case
FORMULA:
// 公式
try
{
// 如果公式结果为字符串
cellValue
=
String
.
valueOf
(
cell
.
getStringCellValue
());
}
catch
(
IllegalStateException
e
)
{
if
(
HSSF
DateUtil
.
isCellDateFormatted
(
cell
))
{
// 判断是否为日期类型
if
(
DateUtil
.
isCellDateFormatted
(
cell
))
{
// 判断是否为日期类型
Date
date
=
cell
.
getDateCellValue
();
// DateFormat formater = new SimpleDateFormat("yyyy/MM/dd HH:mm");
DateFormat
formater
=
new
SimpleDateFormat
(
"yyyy/MM/dd"
);
...
...
@@ -67,10 +66,10 @@ public class POIUtil {
// //直接获取公式
// cellValue = cell.getCellFormula() + "";
break
;
case
HSSFCell
.
CELL_TYPE_
BLANK
:
// 空值
case
BLANK:
// 空值
cellValue
=
""
;
break
;
case
HSSFCell
.
CELL_TYPE_
ERROR
:
// 故障
case
ERROR:
// 故障
cellValue
=
"非法字符"
;
break
;
default
:
...
...
src/main/java/com/jeeplus/modules/warehouse/outbound/entity/OutboundInfo.java
View file @
e88c9986
...
...
@@ -8,6 +8,8 @@ import com.jeeplus.core.persistence.DataEntity;
import
com.jeeplus.common.utils.excel.annotation.ExcelField
;
import
com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo
;
import
java.util.Date
;
/**
* 出库单明细表Entity
* @author zhanglt
...
...
@@ -19,6 +21,18 @@ public class OutboundInfo extends DataEntity<OutboundInfo> {
private
Outbound
outbound
;
// 出库单主表id
private
LedgerInfo
ledgerInfo
;
// 台账明细表id
/**
* 查询使用--------------------
*/
private
Date
beginTime
;
private
Date
endTime
;
/**
* -----------------
*/
public
OutboundInfo
()
{
super
();
}
...
...
@@ -60,4 +74,19 @@ public class OutboundInfo extends DataEntity<OutboundInfo> {
this
.
ledgerInfo
=
ledgerInfo
;
}
public
Date
getBeginTime
()
{
return
beginTime
;
}
public
void
setBeginTime
(
Date
beginTime
)
{
this
.
beginTime
=
beginTime
;
}
public
Date
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Date
endTime
)
{
this
.
endTime
=
endTime
;
}
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/outbound/mapper/xml/OutboundInfoMapper.xml
View file @
e88c9986
...
...
@@ -52,6 +52,12 @@
<if
test=
"ledgerInfo != null and ledgerInfo.id != null and ledgerInfo.id != ''"
>
AND a.ledger_info_id = #{ledgerInfo.id}
</if>
<if
test=
"ledgerInfo != null and ledgerInfo.type != null and ledgerInfo.type.id != null and ledgerInfo.type.id != ''"
>
AND tpye.id = #{ledgerInfo.type.id}
</if>
<if
test=
"beginTime != null and beginTime != '' and endTime != null and endTime != ''"
>
AND a.create_date
>
= #{beginTime} AND a.create_date
<
= #{endTime}
</if>
</where>
<choose>
<when
test=
"page !=null and page.orderBy != null and page.orderBy != ''"
>
...
...
src/main/java/com/jeeplus/modules/warehouse/storage/entity/StorageInfo.java
View file @
e88c9986
...
...
@@ -13,6 +13,7 @@ import com.jeeplus.common.utils.excel.annotation.ExcelField;
import
com.jeeplus.modules.warehouse.warehouse.entity.Warehouse
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -38,6 +39,17 @@ public class StorageInfo extends DataEntity<StorageInfo> {
private
List
<
Warehouse
>
warehouseList
;
// 仓库外键
private
QrCode
qrCode
;
// 前端保存入库单时使用的临时二维码对象
/**
* 查询使用的属性-------
*/
private
Date
beginTime
;
private
Date
endTime
;
/**
* ------------
*/
public
StorageInfo
()
{
super
();
}
...
...
@@ -159,4 +171,20 @@ public class StorageInfo extends DataEntity<StorageInfo> {
public
void
setInfoSum
(
BigDecimal
infoSum
)
{
this
.
infoSum
=
infoSum
;
}
public
Date
getBeginTime
()
{
return
beginTime
;
}
public
void
setBeginTime
(
Date
beginTime
)
{
this
.
beginTime
=
beginTime
;
}
public
Date
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Date
endTime
)
{
this
.
endTime
=
endTime
;
}
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/storage/mapper/StorageInfoMapper.java
View file @
e88c9986
...
...
@@ -17,4 +17,5 @@ import java.util.List;
*/
@MyBatisMapper
public
interface
StorageInfoMapper
extends
BaseMapper
<
StorageInfo
>
{
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/storage/mapper/xml/StorageInfoMapper.xml
View file @
e88c9986
...
...
@@ -82,6 +82,9 @@
<if
test=
"dbName == 'mssql'"
>
'%'+#{model}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
concat('%',#{model},'%')
</if>
</if>
<if
test=
"beginTime != null and beginTime != '' and endTime != null and endTime != ''"
>
AND a.create_date
>
= #{beginTime} AND a.create_date
<
= #{endTime} AND qr.state
<>
'1'
</if>
</where>
<choose>
<when
test=
"page !=null and page.orderBy != null and page.orderBy != ''"
>
...
...
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