Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
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
platform
hg-smart
Commits
0e73e9b1
Commit
0e73e9b1
authored
Jun 12, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-06-11 库存盘点单
parent
7f40fb81
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
272 additions
and
88 deletions
+272
-88
HGSqlConstant.java
...ain/java/com/baosight/hggp/hg/constant/HGSqlConstant.java
+16
-0
HGKCTools.java
src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
+99
-0
HGPZTools.java
src/main/java/com/baosight/hggp/hg/pz/tools/HGPZTools.java
+157
-88
No files found.
src/main/java/com/baosight/hggp/hg/constant/HGSqlConstant.java
View file @
0e73e9b1
...
@@ -112,6 +112,22 @@ public class HGSqlConstant {
...
@@ -112,6 +112,22 @@ public class HGSqlConstant {
}
}
/**
/**
* HPKC005 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public
class
HgKc005
{
// 查询
public
static
final
String
QUERY_SUM
=
"HGKC005.querySum"
;
// 锁
public
static
final
String
LOCK
=
"HGKC005.lock"
;
// 统计
public
static
final
String
STAT_DATE
=
"HGKC005.statDate"
;
}
/**
* HGKC010 SQL 定义
* HGKC010 SQL 定义
*
*
* @author:songx
* @author:songx
...
...
src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
View file @
0e73e9b1
...
@@ -15,6 +15,10 @@ import com.baosight.hggp.hg.zl.domain.HGZL004;
...
@@ -15,6 +15,10 @@ import com.baosight.hggp.hg.zl.domain.HGZL004;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.StringUtils
;
import
com.baosight.hggp.util.StringUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.soa.XLocalManager
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
...
@@ -455,6 +459,101 @@ public class HGKCTools {
...
@@ -455,6 +459,101 @@ public class HGKCTools {
}
}
}
}
/**
* HGKC005公共DAO方法定义
*
* @author:songx
* @date:2024/1/31,16:36
*/
public
static
class
HpKc005
{
/**
* 锁
*
* @param checkNos
* @return
*/
public
static
void
lock
(
List
<
String
>
checkNos
)
{
if
(
org
.
springframework
.
util
.
CollectionUtils
.
isEmpty
(
checkNos
))
{
return
;
}
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"checkNos"
,
checkNos
);
DaoBase
.
getInstance
().
update
(
HGSqlConstant
.
HgKc005
.
LOCK
,
queryMap
);
}
/**
* 查询盘点单信息
*
* @param checkNos
* @return
*/
public
static
List
<
HGKC005
>
list
(
List
<
String
>
checkNos
)
{
if
(
org
.
springframework
.
util
.
CollectionUtils
.
isEmpty
(
checkNos
))
{
return
null
;
}
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"checkNos"
,
checkNos
);
return
DaoBase
.
getInstance
().
query
(
HGKC005
.
QUERY
,
queryMap
);
}
/**
* 查询盘点单信息
*
* @param checkNos
* @return
*/
public
static
Map
<
String
,
HGKC005
>
map
(
List
<
String
>
checkNos
)
{
List
<
HGKC005
>
results
=
list
(
checkNos
);
if
(
org
.
springframework
.
util
.
CollectionUtils
.
isEmpty
(
results
))
{
return
null
;
}
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HGKC005:
:
getCheckNo
,
item
->
item
));
}
}
/**
* 更新库存
*
* @param whCode
* @param inventRecordId
* @param amount
* @param weight
*/
public
static
void
updateStock
(
String
whCode
,
Long
inventRecordId
,
BigDecimal
amount
,
BigDecimal
weight
,
String
factCode
)
{
updateStock
(
whCode
,
inventRecordId
,
amount
,
weight
,
weight
,
factCode
);
}
/**
* 更新库存
*
* @param whCode
* @param inventRecordId
* @param amount
* @param unitWeight
* @param weight
*/
public
static
void
updateStock
(
String
whCode
,
Long
inventRecordId
,
BigDecimal
amount
,
BigDecimal
unitWeight
,
BigDecimal
weight
,
String
factoryCode
)
{
if
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
throw
new
PlatException
(
"入库数量不能为空"
);
}
EiInfo
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"whCode"
,
whCode
);
inInfo
.
set
(
"inventRecordId"
,
inventRecordId
);
inInfo
.
set
(
"amount"
,
amount
);
inInfo
.
set
(
"unitWeight"
,
unitWeight
);
inInfo
.
set
(
"weight"
,
weight
);
inInfo
.
set
(
"factoryCode"
,
factoryCode
);
inInfo
.
set
(
EiConstant
.
serviceName
,
"HGKC010"
);
inInfo
.
set
(
EiConstant
.
methodName
,
"updateStock"
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
throw
new
PlatException
(
"跟新库存失败:"
+
outInfo
.
getMsg
());
}
}
public
static
class
HgKc006
{
public
static
class
HgKc006
{
public
static
HGKC006
getById
(
Long
id
)
{
public
static
HGKC006
getById
(
Long
id
)
{
AssertUtils
.
isEmpty
(
Collections
.
singleton
(
id
),
"ID为空!"
);
AssertUtils
.
isEmpty
(
Collections
.
singleton
(
id
),
"ID为空!"
);
...
...
src/main/java/com/baosight/hggp/hg/pz/tools/HGPZTools.java
View file @
0e73e9b1
package
com
.
baosight
.
hggp
.
hg
.
pz
.
tools
;
package
com
.
baosight
.
hggp
.
hg
.
pz
.
tools
;
import
com.baosight.hggp.common.
Ddynamic
Enum
;
import
com.baosight.hggp.common.
InventType
Enum
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.enums.ValidFlagEnum
;
import
com.baosight.hggp.core.enums.ValidFlagEnum
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.pz.domain.*
;
import
com.baosight.hggp.hg.pz.domain.*
;
import
com.baosight.hggp.hg.sc.domain.HGSC001A
;
import
com.baosight.hggp.hg.sc.domain.HGSC005A
;
import
com.baosight.hggp.hg.sj.domain.HGSJ003
;
import
com.baosight.hggp.util.*
;
import
com.baosight.iplat4j.common.ed.domain.TEDCM01
;
import
com.baosight.hggp.hg.pz.domain.HGPZ002
;
import
com.baosight.hggp.hg.pz.domain.HGPZ002
;
import
com.baosight.hggp.hg.pz.domain.HGPZ003
;
import
com.baosight.hggp.hg.pz.domain.HGPZ003
;
import
com.baosight.hggp.hg.pz.domain.HGPZ005
;
import
com.baosight.hggp.hg.pz.domain.HGPZ005
;
...
@@ -81,89 +76,63 @@ public class HGPZTools {
...
@@ -81,89 +76,63 @@ public class HGPZTools {
}
}
/**
/**
* 仓库管理
* HPPZ005 公共DAO定义
* HPPZ007 公共DAO定义
*
*
* @author:songx
* @author:songx
* @date:2024/2/6,13:37
* @date:2024/2/6,13:37
*/
*/
public
static
class
HgPz00
7
{
public
static
class
HgPz00
5
{
/**
public
static
HGPZ005
get
(
Long
id
)
{
* 查询
AssertUtils
.
isNull
(
id
,
"规格ID不能为空"
);
*
* @param whCode
* @return
*/
public
static
HGPZ007
get
(
String
whCode
)
{
AssertUtils
.
isEmpty
(
whCode
,
"仓库编码不能为空"
);
Map
queryMap
=
new
HashMap
();
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"
whCode"
,
whCode
);
queryMap
.
put
(
"
id"
,
id
);
List
<
HGPZ00
7
>
results
=
DaoBase
.
getInstance
().
query
(
HGPZ007
.
QUERY
,
queryMap
);
List
<
HGPZ00
5
>
results
=
DaoBase
.
getInstance
().
query
(
HGPZ005
.
QUERY
,
queryMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
.
get
(
0
);
AssertUtils
.
isEmpty
(
results
,
String
.
format
(
"规格[%s]不存在"
,
id
)
);
}
return
results
.
get
(
0
);
}
}
/**
/**
* HPPZ009 公共DAO定义
* 查询
*
* @author:songx
* @date:2024/2/6,13:37
*/
public
static
class
HgPz009
{
/**
* 查询企业信息
*
*
* @param
accountCode
* @param
ids
* @return
* @return
*/
*/
public
static
HGPZ009
getByCode
(
String
accountCode
)
{
public
static
List
<
HGPZ005
>
getIds
(
List
<
Long
>
ids
)
{
AssertUtils
.
isEmpty
(
accountCode
,
"企业编码不能为空"
);
if
(
CollectionUtils
.
isEmpty
(
ids
))
{
return
null
;
}
Map
queryMap
=
new
HashMap
();
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"accountCode"
,
accountCode
);
queryMap
.
put
(
"ids"
,
ids
);
List
<
HGPZ009
>
pz009s
=
DaoBase
.
getInstance
().
query
(
HGPZ009
.
QUERY
,
queryMap
);
return
DaoBase
.
getInstance
().
query
(
HGPZ005
.
QUERY
,
queryMap
);
return
CollectionUtils
.
isEmpty
(
pz009s
)
?
null
:
pz009s
.
get
(
0
);
}
}
/**
/**
*
企业是否启用
*
查询
*
*
* @param
accountCode
* @param
inventCodes
* @return
* @return
*/
*/
public
static
boolean
isValid
(
String
accountCode
)
{
public
static
List
<
HGPZ005
>
listByInventCodes
(
List
<
String
>
inventCodes
)
{
HGPZ009
pz009
=
getByCode
(
accountCode
);
AssertUtils
.
isEmpty
(
inventCodes
,
"存货档案编码不能为空!"
);
if
(
pz009
==
null
)
{
return
false
;
}
return
!
ValidFlagEnum
.
STOP
.
getCode
().
equals
(
pz009
.
getValidFlag
());
}
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"inventCodes"
,
inventCodes
);
return
DaoBase
.
getInstance
().
query
(
HGPZ005
.
QUERY
,
queryMap
);
}
}
/**
/**
* 存货管理
* HGPZ005 公共DAO定义
*
* @author:songx
* @date:2024/2/6,13:37
*/
public
static
class
HgPz005
{
/**
* 查询
* 查询
*
*
* @param id
* @param id
s
* @return
* @return
*/
*/
public
static
HGPZ005
get
(
Long
id
)
{
public
static
Map
<
Long
,
HGPZ005
>
maps
(
List
<
Long
>
ids
)
{
AssertUtils
.
isNull
(
id
,
"规格ID不能为空"
);
List
<
HGPZ005
>
results
=
getIds
(
ids
);
Map
queryMap
=
new
HashMap
();
if
(
CollectionUtils
.
isEmpty
(
results
))
{
queryMap
.
put
(
"id"
,
id
);
return
null
;
List
<
HGPZ005
>
results
=
DaoBase
.
getInstance
().
query
(
HGPZ005
.
QUERY
,
queryMap
);
}
AssertUtils
.
isEmpty
(
results
,
String
.
format
(
"规格[%s]不存在"
,
id
));
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HGPZ005:
:
getId
,
item
->
item
));
return
results
.
get
(
0
);
}
}
/**
/**
...
@@ -186,47 +155,85 @@ public class HGPZTools {
...
@@ -186,47 +155,85 @@ public class HGPZTools {
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
.
get
(
0
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
.
get
(
0
);
}
}
/**
/**
* 查询
* 查询
存货
*
*
* @param i
ds
* @param i
nventCode
* @return
* @return
*/
*/
public
static
List
<
HGPZ005
>
list
(
List
<
Long
>
ids
)
{
public
static
HGPZ005
getByCode
(
String
inventCode
)
{
if
(
CollectionUtils
.
isEmpty
(
ids
))
{
AssertUtils
.
isEmpty
(
inventCode
,
"存货编码不能为空"
);
return
null
;
}
Map
queryMap
=
new
HashMap
();
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"ids"
,
ids
);
queryMap
.
put
(
"inventCode"
,
inventCode
);
return
DaoBase
.
getInstance
().
query
(
HGPZ005
.
QUERY
,
queryMap
);
List
<
HGPZ005
>
pz005s
=
DaoBase
.
getInstance
().
query
(
HGPZ005
.
QUERY
,
queryMap
);
if
(
pz005s
!=
null
&&
pz005s
.
size
()==
0
){
pz005s
=
null
;
}
AssertUtils
.
isEmpty
(
pz005s
,
String
.
format
(
"存货编码[%s]不存在"
,
inventCode
));
return
pz005s
.
get
(
0
);
}
}
/**
/**
* 查询
* 查询
存货信息
*
*
* @param inventCodes
* @param inventCodes
* @return
* @return
*/
*/
public
static
List
<
HGPZ005
>
listByInventCodes
(
List
<
String
>
inventCodes
)
{
public
static
List
<
HGPZ005
>
list
(
List
<
String
>
inventCodes
)
{
AssertUtils
.
isEmpty
(
inventCodes
,
"存货档案编码不能为空!"
);
if
(
CollectionUtils
.
isEmpty
(
inventCodes
))
{
return
null
;
}
Map
queryMap
=
new
HashMap
();
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"inventCodes"
,
inventCodes
);
queryMap
.
put
(
"inventCodes"
,
inventCodes
);
return
DaoBase
.
getInstance
().
query
(
HGPZ005
.
QUERY
,
queryMap
);
return
DaoBase
.
getInstance
().
query
(
HGPZ005
.
QUERY
,
queryMap
);
}
}
/**
/**
* 查询
* 查询
存货信息
*
*
* @param i
d
s
* @param i
nventCode
s
* @return
* @return
*/
*/
public
static
Map
<
Long
,
HGPZ005
>
map
(
List
<
Long
>
id
s
)
{
public
static
Map
<
String
,
HGPZ005
>
map
(
List
<
String
>
inventCode
s
)
{
List
<
HGPZ005
>
results
=
list
(
id
s
);
List
<
HGPZ005
>
pz005s
=
list
(
inventCode
s
);
if
(
CollectionUtils
.
isEmpty
(
result
s
))
{
if
(
CollectionUtils
.
isEmpty
(
pz005
s
))
{
return
null
;
return
null
;
}
}
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HGPZ005:
:
getId
,
item
->
item
));
return
pz005s
.
stream
().
collect
(
Collectors
.
toMap
(
HGPZ005:
:
getInventCode
,
item
->
item
));
}
/**
* 判断存货名称是否存在,如果存在返回编码,否则新增并返回编码
*
* @param inventType 存货类型
* @param inventName 存货名称
*/
public
static
String
checkAndSave
(
Integer
inventType
,
String
inventName
)
{
AssertUtils
.
isNull
(
inventType
,
"存货类型不能为空"
);
AssertUtils
.
isNull
(
InventTypeEnum
.
getEnumByCode
(
inventType
),
"存货类型异常"
);
AssertUtils
.
isEmpty
(
inventName
,
"存货名称不能为空"
);
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"inventType"
,
inventType
);
queryMap
.
put
(
"inventName"
,
inventName
);
List
<
HGPZ005
>
dbPz005s
=
DaoBase
.
getInstance
().
query
(
HGPZ005
.
QUERY
,
queryMap
);
if
(
CollectionUtils
.
isNotEmpty
(
dbPz005s
))
{
HGPZ005
dbPz005
=
dbPz005s
.
get
(
0
);
if
(
CommonConstant
.
YesNo
.
YES_1
.
equals
(
dbPz005
.
getDeleteFlag
()))
{
dbPz005
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
DaoUtils
.
update
(
HGPZ005
.
DELETE
,
dbPz005
);
}
return
dbPz005
.
getInventCode
();
}
else
{
// 生成编码
HGPZ005
newPz005
=
new
HGPZ005
();
newPz005
.
setInventCode
(
SequenceGenerator
.
getNextSequence
(
HGConstant
.
SequenceId
.
INVENT_CODE
));
newPz005
.
setInventType
(
inventType
.
toString
());
newPz005
.
setInventName
(
inventName
);
newPz005
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
);
DaoUtils
.
insert
(
HGPZ005
.
INSERT
,
newPz005
);
return
newPz005
.
getInventCode
();
}
}
}
/**
/**
...
@@ -312,20 +319,20 @@ public class HGPZTools {
...
@@ -312,20 +319,20 @@ public class HGPZTools {
/**
/**
* 检查不存在就新增
* 检查不存在就新增
*
*
* @param newPz00
6
* @param newPz00
5
* @return
* @return
*/
*/
public
static
HGPZ005
checkAndSave
(
HGPZ005
newPz00
6
)
{
public
static
HGPZ005
checkAndSave
(
HGPZ005
newPz00
5
)
{
// 检查存货名称是否存在
// 检查存货名称是否存在
jointSpec
(
newPz00
6
);
jointSpec
(
newPz00
5
);
HGPZ005
specPz006
=
getBySpec
(
newPz00
6
.
getInventCode
(),
newPz006
.
getSpec
());
HGPZ005
specPz006
=
getBySpec
(
newPz00
5
.
getInventCode
(),
newPz005
.
getSpec
());
if
(
specPz006
!=
null
)
{
if
(
specPz006
!=
null
)
{
return
specPz006
;
return
specPz006
;
}
else
{
}
else
{
// 生成编码
// 生成编码
newPz00
6
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
.
intValue
());
newPz00
5
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
.
intValue
());
DaoUtils
.
insert
(
HGPZ005
.
INSERT
,
newPz00
6
);
DaoUtils
.
insert
(
HGPZ005
.
INSERT
,
newPz00
5
);
return
newPz00
6
;
return
newPz00
5
;
}
}
}
}
...
@@ -378,7 +385,7 @@ public class HGPZTools {
...
@@ -378,7 +385,7 @@ public class HGPZTools {
public
static
void
setSpecInfo
(
EiInfo
inInfo
,
String
idName
)
{
public
static
void
setSpecInfo
(
EiInfo
inInfo
,
String
idName
)
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
List
<
Long
>
ids
=
ObjectUtils
.
listKey
(
resultRows
,
idName
);
List
<
Long
>
ids
=
ObjectUtils
.
listKey
(
resultRows
,
idName
);
Map
<
Long
,
HGPZ005
>
resultMap
=
map
(
ids
);
Map
<
Long
,
HGPZ005
>
resultMap
=
map
s
(
ids
);
if
(
MapUtils
.
isEmpty
(
resultMap
))
{
if
(
MapUtils
.
isEmpty
(
resultMap
))
{
return
;
return
;
}
}
...
@@ -480,4 +487,66 @@ public class HGPZTools {
...
@@ -480,4 +487,66 @@ public class HGPZTools {
}
}
}
}
/**
* 仓库管理
* HPPZ007 公共DAO定义
*
* @author:songx
* @date:2024/2/6,13:37
*/
public
static
class
HgPz007
{
/**
* 查询
*
* @param whCode
* @return
*/
public
static
HGPZ007
get
(
String
whCode
)
{
AssertUtils
.
isEmpty
(
whCode
,
"仓库编码不能为空"
);
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"whCode"
,
whCode
);
List
<
HGPZ007
>
results
=
DaoBase
.
getInstance
().
query
(
HGPZ007
.
QUERY
,
queryMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
.
get
(
0
);
}
}
/**
* HPPZ009 公共DAO定义
*
* @author:songx
* @date:2024/2/6,13:37
*/
public
static
class
HgPz009
{
/**
* 查询企业信息
*
* @param accountCode
* @return
*/
public
static
HGPZ009
getByCode
(
String
accountCode
)
{
AssertUtils
.
isEmpty
(
accountCode
,
"企业编码不能为空"
);
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"accountCode"
,
accountCode
);
List
<
HGPZ009
>
pz009s
=
DaoBase
.
getInstance
().
query
(
HGPZ009
.
QUERY
,
queryMap
);
return
CollectionUtils
.
isEmpty
(
pz009s
)
?
null
:
pz009s
.
get
(
0
);
}
/**
* 企业是否启用
*
* @param accountCode
* @return
*/
public
static
boolean
isValid
(
String
accountCode
)
{
HGPZ009
pz009
=
getByCode
(
accountCode
);
if
(
pz009
==
null
)
{
return
false
;
}
return
!
ValidFlagEnum
.
STOP
.
getCode
().
equals
(
pz009
.
getValidFlag
());
}
}
}
}
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