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
714ae25c
Commit
714ae25c
authored
Jul 17, 2023
by
胡懿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
货品代码修改、品名代码模块修改
parent
d84ac9c2
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
262 additions
and
172 deletions
+262
-172
GoodsInfo.java
...com/jeeplus/modules/warehouse/goods/entity/GoodsInfo.java
+5
-5
GoodsService.java
...jeeplus/modules/warehouse/goods/service/GoodsService.java
+19
-30
LedgerController.java
...eeplus/modules/warehouse/ledger/web/LedgerController.java
+1
-0
MaterialLoss.java
...s/modules/warehouse/materialloss/entity/MaterialLoss.java
+5
-0
MaterialType.java
...s/modules/warehouse/materialtype/entity/MaterialType.java
+21
-0
MaterialTypeMapper.xml
.../warehouse/materialtype/mapper/xml/MaterialTypeMapper.xml
+3
-1
MaterialTypeController.java
...es/warehouse/materialtype/web/MaterialTypeController.java
+1
-0
QrCodeMapper.java
...jeeplus/modules/warehouse/qrcode/mapper/QrCodeMapper.java
+1
-1
QrCodeMapper.xml
...plus/modules/warehouse/qrcode/mapper/xml/QrCodeMapper.xml
+1
-0
DrawQrcodeUtil.java
...jeeplus/modules/warehouse/qrcode/util/DrawQrcodeUtil.java
+13
-22
ShelvesUtil.java
.../jeeplus/modules/warehouse/shelves/utils/ShelvesUtil.java
+73
-0
StorageInfo.java
...jeeplus/modules/warehouse/storage/entity/StorageInfo.java
+48
-16
StorageInfoMapper.xml
...odules/warehouse/storage/mapper/xml/StorageInfoMapper.xml
+7
-11
StorageService.java
...lus/modules/warehouse/storage/service/StorageService.java
+54
-70
StorageController.java
...plus/modules/warehouse/storage/web/StorageController.java
+10
-16
No files found.
src/main/java/com/jeeplus/modules/warehouse/goods/entity/GoodsInfo.java
View file @
714ae25c
...
...
@@ -29,7 +29,7 @@ public class GoodsInfo extends DataEntity<GoodsInfo> {
private
String
qrInterval
;
// 物资编码区间
private
BigDecimal
amount
;
// 单价
private
List
<
QrCode
>
qrCodeList
;
// 二维码集合
(xml中无关联查询)
private
QrCode
qrCode
;
// 二维码
(xml中无关联查询)
private
List
<
String
>
modelList
;
// 查询时使用的属性
public
GoodsInfo
()
{
...
...
@@ -104,12 +104,12 @@ public class GoodsInfo extends DataEntity<GoodsInfo> {
this
.
qrInterval
=
qrInterval
;
}
public
List
<
QrCode
>
getQrCodeList
()
{
return
qrCode
List
;
public
QrCode
getQrCode
()
{
return
qrCode
;
}
public
void
setQrCode
List
(
List
<
QrCode
>
qrCodeList
)
{
this
.
qrCode
List
=
qrCodeList
;
public
void
setQrCode
(
QrCode
qrCode
)
{
this
.
qrCode
=
qrCode
;
}
public
List
<
String
>
getModelList
()
{
...
...
src/main/java/com/jeeplus/modules/warehouse/goods/service/GoodsService.java
View file @
714ae25c
...
...
@@ -22,6 +22,8 @@ import com.jeeplus.modules.warehouse.qrcode.service.QrCodeService;
import
com.jeeplus.modules.warehouse.qrcode.util.BuildQcUtil
;
import
com.jeeplus.modules.warehouse.qrcode.util.DrawQrcodeUtil
;
import
com.jeeplus.modules.warehouse.qrcode.util.TwoDimensionCode
;
import
com.jeeplus.modules.warehouse.storage.entity.StorageInfo
;
import
com.jeeplus.modules.warehouse.storage.service.StorageService
;
import
com.jeeplus.modules.warehouse.wzcode.entity.Wzcode
;
import
com.jeeplus.modules.warehouse.wzcode.service.WzcodeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -51,6 +53,8 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
private
QrCodeMapper
qrCodeMapper
;
@Autowired
private
WzcodeService
wzcodeService
;
@Autowired
private
StorageService
storageService
;
public
Goods
get
(
String
id
)
{
Goods
goods
=
super
.
get
(
id
);
...
...
@@ -113,30 +117,18 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
temQr
.
setGoodsInfo
(
temGi
);
temQr
.
setState
(
"0"
);
List
<
QrCode
>
qrCodeListAll
=
qrCodeMapper
.
findByGoodsInfoId
(
temQr
);
if
(
null
!=
q
rCodeListAll
&&
qrCodeListAll
.
size
()
>
0
&&
goodsInfo
.
getNum
()
==
qrCodeListAll
.
size
(
))
{
// 二维码已经生成过
goodsInfo
.
setQrCode
List
(
qrCodeListAll
);
QrCode
qc
=
qrCodeMapper
.
findByGoodsInfoId
(
temQr
);
if
(
null
!=
q
c
&&
StringUtils
.
isNotBlank
(
qc
.
getId
()
))
{
// 二维码已经生成过
goodsInfo
.
setQrCode
(
qc
);
return
goodsInfo
;
}
else
{
int
haveSize
=
0
;
List
<
QrCode
>
qrCodeList
=
new
ArrayList
<>();
if
(
null
!=
qrCodeListAll
)
{
haveSize
=
qrCodeListAll
.
size
();
}
// 查询物资编码
Wzcode
wzcode
=
wzcodeService
.
findByCode
(
goodsInfo
.
getType
().
getCode
());
int
wzNum
=
wzcode
.
getIntNum
();
int
num
=
goodsInfo
.
getNum
()
-
haveSize
;
String
beginNumSeq
=
""
;
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
wzNum
++;
wzcode
.
setIntNum
(
wzNum
);
if
(
0
==
i
)
{
beginNumSeq
=
wzcode
.
getCodeAndNum
();
}
QrCode
qrCode
=
new
QrCode
();
qrCode
.
setCode
(
wzcode
.
getCodeAndNum
());
qrCode
.
setGoodsInfo
(
goodsInfo
);
...
...
@@ -144,23 +136,20 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
qrCode
.
setComeFlag
(
"0"
);
qrCode
.
preInsert
();
try
{
BuildQcUtil
.
buildQr
(
qrCode
,
qrImgPath
+
"/"
+
wzcode
.
getCodeAndNum
()
+
".png"
,
qrImgPath
+
"/"
+
wzcode
.
getCodeAndNum
()
+
"_"
+
i
+
".png"
);
// 生成图片
BuildQcUtil
.
buildQr
(
qrCode
,
qrImgPath
+
"/"
+
wzcode
.
getCodeAndNum
()
+
"_tem_"
+
".png"
,
qrImgPath
+
"/"
+
wzcode
.
getCodeAndNum
()
+
".png"
);
// 生成图片
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
qrCode
.
setUrl
(
Global
.
getAttachmentUrl
()
+
"image/"
+
wzcode
.
getCodeAndNum
()
+
"_"
+
i
+
".png"
);
qrCode
.
setUrl
(
Global
.
getAttachmentUrl
()
+
"image/"
+
wzcode
.
getCodeAndNum
()
+
".png"
);
qrCodeMapper
.
insert
(
qrCode
);
qrCode
=
qrCodeMapper
.
get
(
qrCode
.
getId
());
qrCodeList
.
add
(
qrCode
);
}
String
qrInterval
=
beginNumSeq
+
"_"
+
wzcode
.
getNum
();
goodsInfo
.
setQrInterval
(
qrInterval
);
// 设置编码区间
goodsInfo
.
setQrInterval
(
wzcode
.
getNum
()
);
// 设置编码区间
// goodsInfo.preUpdate();
goodsInfoMapper
.
update
(
goodsInfo
);
qrCodeListAll
.
addAll
(
qrCodeList
);
goodsInfo
.
setQrCodeList
(
qrCodeListAll
);
goodsInfo
.
setQrCode
(
qrCode
);
// 更新物资编码表
wzcodeService
.
save
(
wzcode
);
...
...
@@ -180,10 +169,8 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
temGi
.
setId
(
infoId
);
temQr
.
setGoodsInfo
(
temGi
);
temQr
.
setState
(
"0"
);
List
<
QrCode
>
qrCodeList
=
qrCodeMapper
.
findByGoodsInfoId
(
temQr
);
if
(
null
!=
qrCodeList
&&
qrCodeList
.
size
()
>
0
)
{
for
(
QrCode
qrCode
:
qrCodeList
)
{
if
(
StringUtils
.
isNotBlank
(
qrCode
.
getUrl
()))
{
QrCode
qrCode
=
qrCodeMapper
.
findByGoodsInfoId
(
temQr
);
if
(
null
!=
qrCode
&&
StringUtils
.
isNotBlank
(
qrCode
.
getId
()))
{
try
{
String
url
=
qrCode
.
getUrl
();
if
(
null
!=
url
&&
url
.
contains
(
"image"
))
{
...
...
@@ -198,8 +185,6 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
qrCodeMapper
.
deleteByGoodInfoId
(
infoId
,
"0"
);
// 删除未入库的二维码
goodsInfo
.
setQrInterval
(
""
);
goodsInfo
.
preUpdate
();
...
...
@@ -225,6 +210,10 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
public
QrCode
getGIAndQCByTwoId
(
String
goodsInfoId
,
String
qrCodeId
)
{
GoodsInfo
goodsInfo
=
goodsInfoMapper
.
get
(
new
GoodsInfo
(
goodsInfoId
));
List
<
StorageInfo
>
list
=
storageService
.
findInfoByGoodsInfoId
(
goodsInfo
);
if
(
null
!=
list
&&
list
.
size
()
>
0
)
{
return
null
;
}
QrCode
qrCode
=
qrCodeMapper
.
get
(
new
QrCode
(
qrCodeId
));
if
(
null
!=
qrCode
)
{
qrCode
.
setGoodsInfo
(
goodsInfo
);
...
...
src/main/java/com/jeeplus/modules/warehouse/ledger/web/LedgerController.java
View file @
714ae25c
...
...
@@ -253,6 +253,7 @@ public class LedgerController extends BaseController {
* 根据二维码id或者物资编码返货台账明细信息
* @param qrId
* @param code
* 7A002868781771A006265/A0053515
* @return
*/
@ResponseBody
...
...
src/main/java/com/jeeplus/modules/warehouse/materialloss/entity/MaterialLoss.java
View file @
714ae25c
...
...
@@ -4,12 +4,15 @@
package
com
.
jeeplus
.
modules
.
warehouse
.
materialloss
.
entity
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.google.common.collect.Lists
;
import
com.jeeplus.core.persistence.DataEntity
;
import
com.jeeplus.common.utils.excel.annotation.ExcelField
;
import
com.jeeplus.modules.sys.entity.User
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
/**
...
...
@@ -53,6 +56,8 @@ public class MaterialLoss extends DataEntity<MaterialLoss> {
this
.
operator
=
operator
;
}
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@NotNull
(
message
=
"时间不能为空"
)
@ExcelField
(
title
=
"盘亏时间"
,
align
=
2
,
sort
=
3
)
public
Date
getTime
()
{
return
time
;
...
...
src/main/java/com/jeeplus/modules/warehouse/materialtype/entity/MaterialType.java
View file @
714ae25c
...
...
@@ -8,6 +8,8 @@ import javax.validation.constraints.NotNull;
import
com.jeeplus.core.persistence.TreeEntity
;
import
java.math.BigDecimal
;
/**
* 物资类型Entity
* @author zhnaglt
...
...
@@ -17,6 +19,8 @@ public class MaterialType extends TreeEntity<MaterialType> {
private
static
final
long
serialVersionUID
=
1L
;
private
String
code
;
// 物资类型编码
private
BigDecimal
amount
;
// 单价
private
String
unit
;
// 单位
private
int
last
;
...
...
@@ -57,4 +61,20 @@ public class MaterialType extends TreeEntity<MaterialType> {
public
void
setLast
(
int
last
)
{
this
.
last
=
last
;
}
public
BigDecimal
getAmount
()
{
return
amount
;
}
public
void
setAmount
(
BigDecimal
amount
)
{
this
.
amount
=
amount
;
}
public
String
getUnit
()
{
return
unit
;
}
public
void
setUnit
(
String
unit
)
{
this
.
unit
=
unit
;
}
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/materialtype/mapper/xml/MaterialTypeMapper.xml
View file @
714ae25c
...
...
@@ -24,7 +24,9 @@
a.name AS "name",
a.sort AS "sort",
a.code AS "code",
a.last AS "last"
a.last AS "last",
a.amount AS "amount",
a.unit AS "unit"
</sql>
...
...
src/main/java/com/jeeplus/modules/warehouse/materialtype/web/MaterialTypeController.java
View file @
714ae25c
...
...
@@ -160,6 +160,7 @@ public class MaterialTypeController extends BaseController {
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
map
.
put
(
"id"
,
e
.
getId
());
map
.
put
(
"text"
,
e
.
getName
());
map
.
put
(
"code"
,
e
.
getCode
());
if
(
StringUtils
.
isBlank
(
e
.
getParentId
())
||
"0"
.
equals
(
e
.
getParentId
())){
map
.
put
(
"parent"
,
"#"
);
Map
<
String
,
Object
>
state
=
Maps
.
newHashMap
();
...
...
src/main/java/com/jeeplus/modules/warehouse/qrcode/mapper/QrCodeMapper.java
View file @
714ae25c
...
...
@@ -29,7 +29,7 @@ public interface QrCodeMapper extends BaseMapper<QrCode> {
* @param qrCode
* @return
*/
public
List
<
QrCode
>
findByGoodsInfoId
(
QrCode
qrCode
);
public
QrCode
findByGoodsInfoId
(
QrCode
qrCode
);
/**
* 根据货品批次号,货品明细类型,货品明细型号,查询二维码信息
...
...
src/main/java/com/jeeplus/modules/warehouse/qrcode/mapper/xml/QrCodeMapper.xml
View file @
714ae25c
...
...
@@ -226,6 +226,7 @@
gi.NAME AS "goodsInfo.name",
gi.model AS "goodsInfo.model",
gi.amount AS "goodsInfo.amount",
gi.num AS "goodsInfo.num",
gi.goods_id AS "goodsInfo.goods.id"
FROM t_wh_qr a
LEFT JOIN t_wh_goods_info gi ON a.goods_info_id = gi.id
...
...
src/main/java/com/jeeplus/modules/warehouse/qrcode/util/DrawQrcodeUtil.java
View file @
714ae25c
...
...
@@ -239,8 +239,9 @@ public class DrawQrcodeUtil {
public
static
BufferedImage
createAssetImageNew
(
File
qrcodeFile
,
QrCode
qrCode
)
throws
IOException
{
GoodsInfo
goodsInfo
=
qrCode
.
getGoodsInfo
();
QRcodeSize
qRcodeSize
=
null
;
qRcodeSize
=
new
QRcodeSize
(
8
,
200
,
1400
,
78
,
200
,
200
,
1200
,
1200
,
new
Color
(
34
,
25
,
21
));
BufferedImage
bgImage
=
new
BufferedImage
(
1600
,
2400
,
BufferedImage
.
TYPE_4BYTE_ABGR
);
qRcodeSize
=
new
QRcodeSize
(
8
,
800
,
1800
,
78
,
800
,
200
,
1600
,
1600
,
new
Color
(
34
,
25
,
21
));
// BufferedImage bgImage = new BufferedImage(1600, 2400, BufferedImage.TYPE_4BYTE_ABGR);
BufferedImage
bgImage
=
new
BufferedImage
(
3200
,
2400
,
BufferedImage
.
TYPE_4BYTE_ABGR
);
Graphics2D
g2
=
bgImage
.
createGraphics
();
BufferedImage
qrcodeImage
=
ImageIO
.
read
(
qrcodeFile
);
...
...
@@ -252,7 +253,7 @@ public class DrawQrcodeUtil {
,
RenderingHints
.
VALUE_ALPHA_INTERPOLATION_QUALITY
);
g2
.
setRenderingHints
(
rh
);
Font
font
=
new
Font
(
"黑体"
,
Font
.
BOLD
,
1
1
*
qRcodeSize
.
getInitfontSize
());
Font
font
=
new
Font
(
"黑体"
,
Font
.
BOLD
,
1
4
*
qRcodeSize
.
getInitfontSize
());
g2
.
setFont
(
font
);
//设置字体:字体、字号、大小
g2
.
setColor
(
qRcodeSize
.
color
);
//设置背景颜色
// g2.setBackground(c);
...
...
@@ -271,18 +272,18 @@ public class DrawQrcodeUtil {
as
.
addAttribute
(
TextAttribute
.
UNDERLINE
,
TextAttribute
.
UNDERLINE_LOW_DASHED
,
0
,
name
.
length
());
g2
.
drawString
(
as
.
getIterator
(),
contentX
+
contentTitle1Width
,
contentY
);
//写入货品类型
String
contentTitle2
=
"货品类型:"
;
/*
String contentTitle2 = "货品类型:";
int contentTitle2Width = g2.getFontMetrics().stringWidth(contentTitle2);
g2.drawString(contentTitle2,contentX,contentY+150);
String typeName = goodsInfo.getType().getName();
if
(
typeName
.
length
()
>
15
)
{
String
str1
=
typeName
.
substring
(
0
,
9
);
if (typeName.length() >
8
) {
String str1 = typeName.substring(0,
8
);
str1 = formatContent(str1,9);
as = new AttributedString(str1);
as.addAttribute(TextAttribute.FONT, font);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, str1.length());
g2.drawString(as.getIterator(),contentX+contentTitle2Width,contentY+150);
String
str2
=
typeName
.
substring
(
9
,
typeName
.
length
());
String str2 = typeName.substring(
8
, typeName.length());
str2 = formatContent(str2,9);
as = new AttributedString(str2);
as.addAttribute(TextAttribute.FONT, font);
...
...
@@ -296,7 +297,7 @@ public class DrawQrcodeUtil {
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_DASHED, 0, typeName.length());
g2.drawString(as.getIterator(),contentX+contentTitle2Width,contentY+150);
}
}
*/
...
...
@@ -304,22 +305,12 @@ public class DrawQrcodeUtil {
//写入物资编码
String
contentTitle4
=
"物资编码:"
;
int
contentTitle4Width
=
g2
.
getFontMetrics
().
stringWidth
(
contentTitle4
);
g2
.
drawString
(
contentTitle4
,
contentX
,
contentY
+
4
50
);
g2
.
drawString
(
contentTitle4
,
contentX
,
contentY
+
1
50
);
String
code
=
qrCode
.
getCode
();
if
(
code
.
length
()
>
15
)
{
String
str1
=
code
.
substring
(
0
,
14
);
str1
=
formatContent
(
str1
,
15
);
as
=
new
AttributedString
(
str1
);
as
=
new
AttributedString
(
code
);
as
.
addAttribute
(
TextAttribute
.
FONT
,
font
);
as
.
addAttribute
(
TextAttribute
.
UNDERLINE
,
TextAttribute
.
UNDERLINE_LOW_DASHED
,
0
,
str1
.
length
());
g2
.
drawString
(
as
.
getIterator
(),
contentX
+
contentTitle4Width
,
contentY
+
450
);
String
str2
=
code
.
substring
(
14
,
code
.
length
());
str2
=
formatContent
(
str2
,
15
);
as
=
new
AttributedString
(
str2
);
as
.
addAttribute
(
TextAttribute
.
FONT
,
font
);
as
.
addAttribute
(
TextAttribute
.
UNDERLINE
,
TextAttribute
.
UNDERLINE_LOW_DASHED
,
0
,
str2
.
length
());
g2
.
drawString
(
as
.
getIterator
(),
contentX
+
contentTitle4Width
,
contentY
+
600
);
}
as
.
addAttribute
(
TextAttribute
.
UNDERLINE
,
TextAttribute
.
UNDERLINE_LOW_DASHED
,
0
,
code
.
length
());
g2
.
drawString
(
as
.
getIterator
(),
contentX
+
contentTitle4Width
,
contentY
+
150
);
return
bgImage
;
...
...
src/main/java/com/jeeplus/modules/warehouse/shelves/utils/ShelvesUtil.java
View file @
714ae25c
package
com
.
jeeplus
.
modules
.
warehouse
.
shelves
.
utils
;
import
com.jeeplus.common.utils.CacheUtils
;
import
com.jeeplus.common.utils.SpringContextHolder
;
import
com.jeeplus.common.utils.StringUtils
;
import
com.jeeplus.modules.warehouse.shelves.entity.Shelves
;
import
com.jeeplus.modules.warehouse.shelves.mapper.ShelvesMapper
;
import
com.jeeplus.modules.warehouse.warehouse.entity.Warehouse
;
import
com.jeeplus.modules.warehouse.warehouse.mapper.WarehouseMapper
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -9,6 +14,14 @@ import java.util.Set;
public
class
ShelvesUtil
{
private
static
ShelvesMapper
shelvesMapper
=
SpringContextHolder
.
getBean
(
ShelvesMapper
.
class
);
private
static
WarehouseMapper
warehouseMapper
=
SpringContextHolder
.
getBean
(
WarehouseMapper
.
class
);
public
static
final
String
SHELCES_CACHE
=
"shelvesCache"
;
public
static
final
String
SHELCES_ID
=
"shelvesId_"
;
public
static
final
String
WAREHOUSE_CACHE
=
"warehouseCache"
;
public
static
final
String
WAREHOUSE_ID
=
"warehouseId_"
;
public
static
String
mergeShevlesName
(
Set
<
Shelves
>
set
)
{
return
""
;
...
...
@@ -38,4 +51,64 @@ public class ShelvesUtil {
}
return
sb
.
toString
();
}
/**
* 从缓存中获取货架信息
* @param ids
* @return
*/
public
static
List
<
Shelves
>
getShelvesListByIds
(
String
ids
)
{
List
<
Shelves
>
resultList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
ids
))
{
String
[]
idsArr
=
ids
.
split
(
","
);
for
(
String
id
:
idsArr
)
{
if
(
StringUtils
.
isNotBlank
(
id
))
{
Shelves
shelves
=
(
Shelves
)
CacheUtils
.
get
(
SHELCES_CACHE
,
SHELCES_ID
+
id
);
if
(
null
==
shelves
||
StringUtils
.
isBlank
(
shelves
.
getId
()))
{
Shelves
tem
=
new
Shelves
();
tem
.
setDelFlag
(
"0"
);
List
<
Shelves
>
list
=
shelvesMapper
.
findList
(
tem
);
for
(
Shelves
s
:
list
)
{
CacheUtils
.
put
(
SHELCES_CACHE
,
SHELCES_ID
+
s
.
getId
());
}
shelves
=
(
Shelves
)
CacheUtils
.
get
(
SHELCES_CACHE
,
SHELCES_ID
+
id
);
resultList
.
add
(
shelves
);
}
else
{
resultList
.
add
(
shelves
);
}
}
}
}
return
resultList
;
}
/**
* 从缓冲中获取仓库id
* @param ids
* @return
*/
public
static
List
<
Warehouse
>
getWarehouseListByIds
(
String
ids
)
{
List
<
Warehouse
>
resultList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
ids
))
{
String
[]
idsArr
=
ids
.
split
(
","
);
for
(
String
id
:
idsArr
)
{
if
(
StringUtils
.
isNotBlank
(
id
))
{
Warehouse
warehouse
=
(
Warehouse
)
CacheUtils
.
get
(
WAREHOUSE_CACHE
,
WAREHOUSE_ID
+
id
);
if
(
null
==
warehouse
||
StringUtils
.
isBlank
(
warehouse
.
getId
()))
{
Warehouse
tem
=
new
Warehouse
();
tem
.
setDelFlag
(
"0"
);
List
<
Warehouse
>
list
=
warehouseMapper
.
findList
(
tem
);
for
(
Warehouse
w
:
list
)
{
CacheUtils
.
put
(
WAREHOUSE_CACHE
,
WAREHOUSE_ID
+
w
.
getId
());
}
warehouse
=
(
Warehouse
)
CacheUtils
.
get
(
WAREHOUSE_CACHE
,
WAREHOUSE_ID
+
id
);
resultList
.
add
(
warehouse
);
}
else
{
resultList
.
add
(
warehouse
);
}
}
}
}
return
resultList
;
}
}
src/main/java/com/jeeplus/modules/warehouse/storage/entity/StorageInfo.java
View file @
714ae25c
...
...
@@ -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.List
;
/**
* 入库明细Entity
...
...
@@ -27,9 +28,13 @@ public class StorageInfo extends DataEntity<StorageInfo> {
private
MaterialType
type
;
// 类型
private
String
model
;
// 型号
private
GoodsInfo
goodsInfo
;
// 货品明细id
private
S
helves
shelves
;
// 货架id
private
Warehouse
warehouse
;
// 仓库外键
private
S
tring
shelvesIds
;
// 货架id集合
private
String
warehouseIds
;
// 仓库id集合
private
BigDecimal
amount
;
// 单价
private
int
num
;
// 数量
private
List
<
Shelves
>
shelvesList
;
// 货架id
private
List
<
Warehouse
>
warehouseList
;
// 仓库外键
private
QrCode
qrCode
;
// 前端保存入库单时使用的临时二维码对象
public
StorageInfo
()
{
...
...
@@ -88,13 +93,6 @@ public class StorageInfo extends DataEntity<StorageInfo> {
this
.
goodsInfo
=
goodsInfo
;
}
public
Shelves
getShelves
()
{
return
shelves
;
}
public
void
setShelves
(
Shelves
shelves
)
{
this
.
shelves
=
shelves
;
}
public
QrCode
getQrCode
()
{
return
qrCode
;
...
...
@@ -104,13 +102,6 @@ public class StorageInfo extends DataEntity<StorageInfo> {
this
.
qrCode
=
qrCode
;
}
public
Warehouse
getWarehouse
()
{
return
warehouse
;
}
public
void
setWarehouse
(
Warehouse
warehouse
)
{
this
.
warehouse
=
warehouse
;
}
public
BigDecimal
getAmount
()
{
return
amount
;
...
...
@@ -119,4 +110,44 @@ public class StorageInfo extends DataEntity<StorageInfo> {
public
void
setAmount
(
BigDecimal
amount
)
{
this
.
amount
=
amount
;
}
public
int
getNum
()
{
return
num
;
}
public
void
setNum
(
int
num
)
{
this
.
num
=
num
;
}
public
String
getShelvesIds
()
{
return
shelvesIds
;
}
public
void
setShelvesIds
(
String
shelvesIds
)
{
this
.
shelvesIds
=
shelvesIds
;
}
public
String
getWarehouseIds
()
{
return
warehouseIds
;
}
public
void
setWarehouseIds
(
String
warehouseIds
)
{
this
.
warehouseIds
=
warehouseIds
;
}
public
List
<
Shelves
>
getShelvesList
()
{
return
shelvesList
;
}
public
void
setShelvesList
(
List
<
Shelves
>
shelvesList
)
{
this
.
shelvesList
=
shelvesList
;
}
public
List
<
Warehouse
>
getWarehouseList
()
{
return
warehouseList
;
}
public
void
setWarehouseList
(
List
<
Warehouse
>
warehouseList
)
{
this
.
warehouseList
=
warehouseList
;
}
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/storage/mapper/xml/StorageInfoMapper.xml
View file @
714ae25c
...
...
@@ -9,8 +9,8 @@
a.type_id AS "type.id",
a.model AS "model",
a.goods_info_id AS "goodsInfo.id",
a.shelves_id AS "shelves
.id
",
a.warehouse_id AS "warehouse
.id
",
a.shelves_id AS "shelves
Ids
",
a.warehouse_id AS "warehouse
Ids
",
a.qr_id AS "qrCode.id",
a.remarks AS "remarks",
a.create_by AS "createBy.id",
...
...
@@ -19,21 +19,17 @@
a.update_date AS "updateDate",
a.del_flag AS "delFlag",
a.amount AS "amount",
a.num AS "num",
type.name AS "type.name",
type.code AS "type.code",
s.name AS "shelves.name",
warehouse.name AS "warehouse.name",
qr.code AS "qrCode.code",
qr.state AS "qrCode.state"
</sql>
<sql
id=
"storageInfoJoins"
>
LEFT JOIN t_wh_material_type type ON type.id = a.type_id
LEFT JOIN t_wh_warehouse warehouse ON warehouse.id = a.warehouse_id
LEFT JOIN t_wh_shelves s on s.id = a.shelves_id
LEFT JOIN t_wh_qr qr on qr.id = a.qr_id
</sql>
...
...
@@ -136,8 +132,8 @@
#{type.id},
#{model},
#{goodsInfo.id},
#{shelves
.id
},
#{warehouse
.id
},
#{shelves
Ids
},
#{warehouse
Ids
},
#{qrCode.id},
#{amount},
#{remarks},
...
...
@@ -156,8 +152,8 @@
type_id = #{type.id},
model = #{model},
goods_info_id = #{goodsInfo.id},
shelves_id = #{shelves
.id
},
warehouse_id = #{warehouse
.id
},
shelves_id = #{shelves
Ids
},
warehouse_id = #{warehouse
Ids
},
amount = #{amount},
remarks = #{remarks},
update_by = #{updateBy.id},
...
...
src/main/java/com/jeeplus/modules/warehouse/storage/service/StorageService.java
View file @
714ae25c
...
...
@@ -6,6 +6,8 @@ package com.jeeplus.modules.warehouse.storage.service;
import
java.math.BigDecimal
;
import
java.util.*
;
import
com.jeeplus.common.utils.CacheUtils
;
import
com.jeeplus.modules.sys.utils.UserUtils
;
import
com.jeeplus.modules.warehouse.goods.entity.Goods
;
import
com.jeeplus.modules.warehouse.goods.entity.GoodsInfo
;
import
com.jeeplus.modules.warehouse.goods.mapper.GoodsInfoMapper
;
...
...
@@ -18,6 +20,7 @@ import com.jeeplus.modules.warehouse.shelves.entity.Shelves;
import
com.jeeplus.modules.warehouse.shelves.mapper.ShelvesMapper
;
import
com.jeeplus.modules.warehouse.shelves.utils.ShelvesUtil
;
import
com.jeeplus.modules.warehouse.storage.dto.CountStorageInfo
;
import
com.jeeplus.modules.warehouse.warehouse.entity.Warehouse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -55,80 +58,15 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
Storage
storage
=
super
.
get
(
id
);
List
<
StorageInfo
>
storageInfoList
=
storageInfoMapper
.
findList
(
new
StorageInfo
(
storage
));
storage
.
setStorageInfoList
(
storageInfoList
);
return
storage
;
}
public
Storage
countStorage
(
String
id
)
{
Storage
storage
=
super
.
get
(
id
);
List
<
CountStorageInfo
>
countStorageInfoList
=
storageInfoMapper
.
findCsiList
(
new
StorageInfo
(
storage
));
Map
<
String
,
List
<
CountStorageInfo
>>
map
=
new
HashMap
<>();
for
(
CountStorageInfo
countStorageInfo
:
countStorageInfoList
)
{
String
goodsInfoId
=
countStorageInfo
.
getGoodsInfo
().
getId
();
List
<
CountStorageInfo
>
list
=
map
.
get
(
goodsInfoId
);
if
(
null
==
list
)
{
list
=
new
ArrayList
<>();
list
.
add
(
countStorageInfo
);
map
.
put
(
countStorageInfo
.
getGoodsInfo
().
getId
(),
list
);
}
else
{
list
.
add
(
countStorageInfo
);
}
}
List
<
CountStorageInfo
>
csiList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
List
<
CountStorageInfo
>>
entry
:
map
.
entrySet
())
{
List
<
CountStorageInfo
>
list
=
entry
.
getValue
();
CountStorageInfo
csi
=
new
CountStorageInfo
();
Set
<
String
>
wNameSet
=
new
HashSet
<>();
Set
<
String
>
sNameSet
=
new
HashSet
<>();
String
shelvesNames
=
""
;
int
num
=
0
;
BigDecimal
sum
=
new
BigDecimal
(
0
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
CountStorageInfo
c
=
list
.
get
(
i
);
if
(
i
==
0
)
{
csi
.
setGoodsInfo
(
c
.
getGoodsInfo
());
csi
.
setModel
(
c
.
getModel
());
csi
.
setName
(
c
.
getName
());
csi
.
setType
(
c
.
getType
());
csi
.
setState
(
c
.
getState
());
csi
.
setAmount
(
c
.
getAmount
());
for
(
StorageInfo
si
:
storageInfoList
)
{
List
<
Shelves
>
shelvesList
=
ShelvesUtil
.
getShelvesListByIds
(
si
.
getShelvesIds
());
si
.
setShelvesList
(
shelvesList
);
List
<
Warehouse
>
warehouseList
=
ShelvesUtil
.
getWarehouseListByIds
(
si
.
getWarehouseIds
());
si
.
setWarehouseList
(
warehouseList
);
}
sNameSet
.
add
(
c
.
getShelves
().
getName
());
/*if (i != list.size() - 1) {
shelvesNames = shelvesNames + c.getShelves().getName() + ",";
} else {
shelvesNames = shelvesNames + c.getShelves().getName();
}*/
wNameSet
.
add
(
c
.
getWarehouse
().
getName
());
num
+=
c
.
getNum
();
sum
=
sum
.
add
(
c
.
getSum
());
}
String
wNames
=
ShelvesUtil
.
mergerWarehouseName
(
wNameSet
);
String
sNames
=
ShelvesUtil
.
mergerWarehouseName
(
sNameSet
);
csi
.
setShelvesNames
(
sNames
);
csi
.
setWarehouseNames
(
wNames
);
csi
.
setNum
(
num
);
csi
.
setSum
(
sum
);
csiList
.
add
(
csi
);
}
storage
.
setCountStorageInfoList
(
csiList
);
return
storage
;
}
/**
* 根据统计信息查询入库明细
* @param countStorageInfo
* @return
*/
public
List
<
StorageInfo
>
findInfoBycountStorage
(
CountStorageInfo
countStorageInfo
)
{
StorageInfo
storageInfo
=
new
StorageInfo
();
storageInfo
.
setStorage
(
countStorageInfo
.
getStorage
());
storageInfo
.
setShelves
(
countStorageInfo
.
getShelves
());
storageInfo
.
setGoodsInfo
(
countStorageInfo
.
getGoodsInfo
());
storageInfo
.
setPage
(
countStorageInfo
.
getPage
());
return
storageInfoMapper
.
findList
(
storageInfo
);
}
public
List
<
Storage
>
findList
(
Storage
storage
)
{
return
super
.
findList
(
storage
);
...
...
@@ -217,9 +155,45 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
@Transactional
(
readOnly
=
false
)
public
void
delete
(
Storage
storage
)
{
StorageInfo
tem
=
new
StorageInfo
();
tem
.
setStorage
(
storage
);
List
<
StorageInfo
>
list
=
storageInfoMapper
.
findList
(
tem
);
boolean
b
=
false
;
for
(
StorageInfo
si
:
list
)
{
QrCode
qrCode
=
si
.
getQrCode
();
if
(
"2"
.
equals
(
qrCode
.
getState
()))
{
b
=
true
;
}
}
if
(!
b
)
{
for
(
StorageInfo
si
:
list
)
{
QrCode
qrCode
=
si
.
getQrCode
();
QrCode
qr
=
qrCodeMapper
.
get
(
qrCode
.
getId
());
qr
.
setState
(
"0"
);
qrCodeMapper
.
update
(
qr
);
}
super
.
delete
(
storage
);
storageInfoMapper
.
delete
(
new
StorageInfo
(
storage
));
}
}
@Transactional
(
readOnly
=
false
)
public
boolean
deleteInfo
(
StorageInfo
storageInfo
)
{
StorageInfo
si
=
storageInfoMapper
.
get
(
storageInfo
.
getId
());
QrCode
qrCode
=
si
.
getQrCode
();
if
(
"2"
.
equals
(
qrCode
.
getState
()))
{
return
false
;
}
else
{
QrCode
qr
=
qrCodeMapper
.
get
(
qrCode
.
getId
());
qr
.
setState
(
"0"
);
qrCodeMapper
.
update
(
qr
);
storageInfoMapper
.
delete
(
storageInfo
);
return
true
;
}
}
/**
* 根据批次号,货品类型,货品型号查询二维码
...
...
@@ -253,6 +227,7 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
storageInfo
.
setName
(
gi
.
getName
());
storageInfo
.
setType
(
gi
.
getType
());
storageInfo
.
setModel
(
gi
.
getModel
());
storageInfo
.
setNum
(
gi
.
getNum
());
storageInfo
.
setGoodsInfo
(
gi
);
storageInfo
.
setAmount
(
gi
.
getAmount
());
storageInfo
.
setQrCode
(
qrCode
);
...
...
@@ -268,4 +243,12 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
storageInfoPage
.
setFuncParam
(
page
.
getFuncParam
());
return
storageInfoPage
;
}
@Transactional
(
readOnly
=
false
)
public
List
<
StorageInfo
>
findInfoByGoodsInfoId
(
GoodsInfo
goodsInfo
)
{
StorageInfo
tem
=
new
StorageInfo
();
tem
.
setGoodsInfo
(
goodsInfo
);
List
<
StorageInfo
>
storageInfoList
=
storageInfoMapper
.
findList
(
tem
);
return
storageInfoList
;
}
}
\ No newline at end of file
src/main/java/com/jeeplus/modules/warehouse/storage/web/StorageController.java
View file @
714ae25c
...
...
@@ -146,6 +146,16 @@ public class StorageController extends BaseController {
return
j
;
}
@ResponseBody
@RequestMapping
(
value
=
"deleteInfo"
)
public
AjaxJson
deleteInfo
(
StorageInfo
storageInfo
)
{
AjaxJson
j
=
new
AjaxJson
();
storageService
.
deleteInfo
(
storageInfo
);
j
.
setMsg
(
"删除入库信息成功"
);
return
j
;
}
/**
* 批量删除入库信息
*/
...
...
@@ -190,22 +200,6 @@ public class StorageController extends BaseController {
return
storageService
.
get
(
id
);
}
@ResponseBody
@RequestMapping
(
value
=
"countStorage"
)
public
Storage
countStorage
(
String
id
)
{
return
storageService
.
countStorage
(
id
);
}
@ResponseBody
@RequestMapping
(
value
=
"findInfoBycountStorage"
)
public
AjaxJson
findInfoBycountStorage
(
CountStorageInfo
countStorageInfo
)
{
AjaxJson
j
=
new
AjaxJson
();
List
<
StorageInfo
>
storageInfoList
=
storageService
.
findInfoBycountStorage
(
countStorageInfo
);
j
.
put
(
"storageInfoList"
,
storageInfoList
);
j
.
setSuccess
(
true
);
j
.
setMsg
(
"查询成功"
);
return
j
;
}
/**
* 导入Excel数据
...
...
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