Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-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
hp-smart
Commits
e16ecbcc
Commit
e16ecbcc
authored
Jan 26, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
94bed774
49bca2e0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
47 deletions
+59
-47
ServiceHPKC009.java
.../java/com/baosight/hpjx/hp/kc/service/ServiceHPKC009.java
+44
-29
HPKC004.xml
src/main/java/com/baosight/hpjx/hp/kc/sql/HPKC004.xml
+1
-1
LogUtils.java
src/main/java/com/baosight/hpjx/util/LogUtils.java
+3
-10
ObjectUtils.java
src/main/java/com/baosight/hpjx/util/ObjectUtils.java
+11
-7
No files found.
src/main/java/com/baosight/hpjx/hp/kc/service/ServiceHPKC009.java
View file @
e16ecbcc
...
...
@@ -24,6 +24,7 @@ import com.baosight.hpjx.util.CommonMethod;
import
com.baosight.hpjx.util.DateUtils
;
import
com.baosight.hpjx.util.EiInfoUtils
;
import
com.baosight.hpjx.util.LogUtils
;
import
com.baosight.hpjx.util.ObjectUtils
;
import
com.baosight.hpjx.util.StringUtil
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
...
...
@@ -32,6 +33,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.StringUtils
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
...
...
@@ -122,7 +124,7 @@ public class ServiceHPKC009 extends ServiceBase {
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
"按天统计成功"
);
}
catch
(
Exception
e
)
{
LogUtils
.
set
Detail
Msg
(
inInfo
,
e
,
"按天统计失败"
);
LogUtils
.
setMsg
(
inInfo
,
e
,
"按天统计失败"
);
}
return
inInfo
;
}
...
...
@@ -158,7 +160,7 @@ public class ServiceHPKC009 extends ServiceBase {
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
"按月统计成功"
);
}
catch
(
Exception
e
)
{
LogUtils
.
set
Detail
Msg
(
inInfo
,
e
,
"按月统计失败"
);
LogUtils
.
setMsg
(
inInfo
,
e
,
"按月统计失败"
);
}
return
inInfo
;
}
...
...
@@ -172,61 +174,54 @@ public class ServiceHPKC009 extends ServiceBase {
List
<
HPKC009
>
newKc009s
=
new
ArrayList
<>();
// 1.1、期末库存
queryMap
.
put
(
"dateProc"
,
queryMap
.
get
(
"yesterTo"
));
List
<
HPKC010
>
endKcs
=
dao
.
query
(
HPKC010A
.
QUERY
,
queryMap
);
List
<
HPKC010
A
>
endKcs
=
dao
.
query
(
HPKC010A
.
QUERY
,
queryMap
);
// 1.2、采购入库
queryMap
.
put
(
"createdTimeFrom"
,
queryMap
.
get
(
"yesterFrom"
)
+
"000000"
);
queryMap
.
put
(
"createdTimeTo"
,
queryMap
.
get
(
"yesterTo"
)
+
"235959"
);
List
<
HPKC001
>
cgRks
=
dao
.
query
(
HPSqlConstant
.
HPKC001
.
STAT_DATE
,
queryMap
);
Map
<
String
,
HPKC001
>
cgRkMap
=
cgRks
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getCompanyCode
()
+
"#"
+
item
.
getDepCode
()
+
"#"
+
item
.
getWhCode
()
+
"#"
+
item
.
getInventType
()
+
"#"
+
item
.
getInventCode
()
+
"#"
+
item
.
getInventRecordId
(),
item
->
item
));
buildKey
(
item
.
getCompanyCode
(),
item
.
getDepCode
(),
item
.
getInventType
(),
item
.
getInventCode
(),
item
.
getWhCode
(),
item
.
getInventRecordId
()),
item
->
item
));
// 1.3、生产入库
List
<
HPKC003
>
scRks
=
dao
.
query
(
HPSqlConstant
.
HPKC003
.
STAT_DATE
,
queryMap
);
Map
<
String
,
HPKC003
>
scRkMap
=
scRks
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getCompanyCode
()
+
"#"
+
item
.
getDepCode
()
+
"#"
+
item
.
getWhCode
()
+
"#"
+
item
.
getInventType
()
+
"#"
+
item
.
getInventCode
(
),
item
->
item
));
buildKey
(
item
.
getCompanyCode
(),
item
.
getDepCode
(),
item
.
getInventType
(),
item
.
getInventCode
(),
item
.
getWhCode
(),
item
.
getInventRecordId
()
),
item
->
item
));
// 1.4、其他入库
List
<
HPKC006
>
qtRks
=
dao
.
query
(
HPSqlConstant
.
HPKC006
.
STAT_DATE
,
queryMap
);
Map
<
String
,
HPKC006
>
qtRkMap
=
qtRks
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getCompanyCode
()
+
"#"
+
item
.
getDepCode
()
+
"#"
+
item
.
getWhCode
()
+
"#"
+
item
.
getInventType
()
+
"#"
+
item
.
getInventCode
()
+
"#"
+
item
.
getInventRecordId
(),
item
->
item
));
buildKey
(
item
.
getCompanyCode
(),
item
.
getDepCode
(),
item
.
getInventType
(),
item
.
getInventCode
(),
item
.
getWhCode
(),
item
.
getInventRecordId
()),
item
->
item
));
// 1.5、生产领料
List
<
HPKC002
>
scCks
=
dao
.
query
(
HPSqlConstant
.
HPKC002
.
STAT_DATE
,
queryMap
);
Map
<
String
,
HPKC002
>
scCkMap
=
scCks
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getCompanyCode
()
+
"#"
+
item
.
getDepCode
()
+
"#"
+
item
.
getWhCode
()
+
"#"
+
item
.
getInventType
()
+
"#"
+
item
.
getInventCode
()
+
"#"
+
item
.
getInventRecordId
(),
item
->
item
));
buildKey
(
item
.
getCompanyCode
(),
item
.
getDepCode
(),
item
.
getInventType
(),
item
.
getInventCode
(),
item
.
getWhCode
(),
item
.
getInventRecordId
()),
item
->
item
));
// 1.6、销售出库
List
<
HPKC004
>
xsCks
=
dao
.
query
(
HPSqlConstant
.
HPKC004
.
STAT_DATE
,
queryMap
);
Map
<
String
,
HPKC004
>
xsCkMap
=
xsCks
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getCompanyCode
()
+
"#"
+
item
.
getDepCode
()
+
"#"
+
item
.
getWhCode
()
+
"#"
+
item
.
getInventType
()
+
"#"
+
item
.
getInventCode
(
),
item
->
item
));
buildKey
(
item
.
getCompanyCode
(),
item
.
getDepCode
(),
item
.
getInventType
(),
item
.
getInventCode
(),
item
.
getWhCode
(),
item
.
getInventRecordId
()
),
item
->
item
));
// 1.7、其它出库
List
<
HPKC007
>
qtCks
=
dao
.
query
(
HPSqlConstant
.
HPKC007
.
STAT_DATE
,
queryMap
);
Map
<
String
,
HPKC007
>
qtCkMap
=
qtCks
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getCompanyCode
()
+
"#"
+
item
.
getDepCode
()
+
"#"
+
item
.
getWhCode
()
+
"#"
+
item
.
getInventType
()
+
"#"
+
item
.
getInventCode
()
+
"#"
+
item
.
getInventRecordId
(),
item
->
item
));
buildKey
(
item
.
getCompanyCode
(),
item
.
getDepCode
(),
item
.
getInventType
(),
item
.
getInventCode
(),
item
.
getWhCode
(),
item
.
getInventRecordId
()),
item
->
item
));
// 1.8、盘点差异数量
List
<
HPKC005
>
pdDiffs
=
dao
.
query
(
HPSqlConstant
.
HPKC005
.
STAT_DATE
,
queryMap
);
Map
<
String
,
HPKC005
>
pdDiffMap
=
pdDiffs
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getCompanyCode
()
+
"#"
+
item
.
getDepCode
()
+
"#"
+
item
.
getWhCode
()
+
"#"
+
item
.
getInventType
()
+
"#"
+
item
.
getInventCode
()
+
"#"
+
item
.
getInventRecordId
(),
item
->
item
));
buildKey
(
item
.
getCompanyCode
(),
item
.
getDepCode
(),
item
.
getInventType
(),
item
.
getInventCode
(),
item
.
getWhCode
(),
item
.
getInventRecordId
()),
item
->
item
));
// 1.9、期初库存
queryMap
.
put
(
"dateProc"
,
queryMap
.
get
(
"beforeDate"
));
List
<
HPKC009
>
initKcs
=
dao
.
query
(
HPKC009
.
QUERY
,
new
HashMap
<>());
Map
<
String
,
HPKC009
>
initKcMap
=
initKcs
.
stream
().
collect
(
Collectors
.
toMap
(
item
->
item
.
getCompanyCode
()
+
"#"
+
item
.
getDepCode
()
+
"#"
+
item
.
getWhCode
()
+
"#"
+
item
.
getInventType
()
+
"#"
+
item
.
getInventCode
()
+
"#"
+
item
.
getInventRecordId
(),
item
->
item
));
buildKey
(
item
.
getCompanyCode
(),
item
.
getDepCode
(),
item
.
getInventType
(),
item
.
getInventCode
(),
item
.
getWhCode
(),
item
.
getInventRecordId
()),
item
->
item
));
// 根据期末库存生成收发存对象
for
(
HPKC010
endKc
:
endKcs
)
{
String
key
=
endKc
.
getCompanyCode
()
+
"#"
+
endKc
.
getDepCode
()
+
"#"
+
endKc
.
getWhCode
()
+
"#"
+
endKc
.
getInventType
()
+
"#"
+
endKc
.
getInventCode
()
+
"#"
+
endKc
.
getInventRecordId
();
for
(
HPKC010A
endKc
:
endKcs
)
{
String
key
=
buildKey
(
endKc
.
getCompanyCode
(),
endKc
.
getDepCode
(),
endKc
.
getInventType
(),
endKc
.
getInventCode
(),
endKc
.
getWhCode
(),
endKc
.
getInventRecordId
());
HPKC009
kc009
=
BeanUtils
.
copy
(
endKc
,
HPKC009
.
class
);
kc009
.
setDateType
(
queryMap
.
get
(
"dateType"
).
toString
());
kc009
.
setDateProc
(
queryMap
.
get
(
"yesterDate"
).
toString
());
...
...
@@ -519,4 +514,24 @@ public class ServiceHPKC009 extends ServiceBase {
}
}
/**
* 构建KEY
*
* @param companyCode
* @param depCode
* @param inventType
* @param inventCode
* @param whCode
* @param inventRecordId
* @return
*/
private
String
buildKey
(
Object
companyCode
,
Object
depCode
,
Object
inventType
,
Object
inventCode
,
Object
whCode
,
Object
inventRecordId
)
{
return
ObjectUtils
.
trimToEmpty
(
companyCode
)
+
"#"
+
ObjectUtils
.
trimToEmpty
(
depCode
)
+
"#"
+
ObjectUtils
.
trimToEmpty
(
inventType
)
+
"#"
+
ObjectUtils
.
trimToEmpty
(
inventCode
)
+
"#"
+
ObjectUtils
.
trimToEmpty
(
whCode
)
+
"#"
+
ObjectUtils
.
trimToEmpty
(
inventRecordId
);
}
}
src/main/java/com/baosight/hpjx/hp/kc/sql/HPKC004.xml
View file @
e16ecbcc
...
...
@@ -191,7 +191,7 @@
WH_CODE AS "whCode",
INVENT_TYPE AS "inventType",
INVENT_CODE AS "inventCode",
INVENT_RECORD_ID AS "inventRecordId"
;
INVENT_RECORD_ID AS "inventRecordId"
,
COALESCE(SUM(AMOUNT), 0) AS "amount",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hpjxSchema}.T_HPKC004
...
...
src/main/java/com/baosight/hpjx/util/LogUtils.java
View file @
e16ecbcc
...
...
@@ -33,20 +33,18 @@ public class LogUtils {
if
(
inInfo
==
null
)
{
return
;
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setMsg
(
title
);
if
(
e
==
null
)
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setDetailMsg
(
"未知"
);
inInfo
.
setDetailMsg
(
""
);
return
;
}
// 由于平台调用链不支持查看detailMsg的消息内容,因此这里修改成往Msg中写错误信息
inInfo
.
setDetailMsg
(
e
.
getMessage
());
if
(
e
instanceof
PlatException
)
{
inInfo
.
setMsg
(
inInfo
.
getMsg
().
concat
(
",原因:"
).
concat
(
e
.
getMessage
()));
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
}
else
{
inInfo
.
setMsg
(
inInfo
.
getMsg
().
concat
(
",原因参见详细错误描述!"
));
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
}
}
...
...
@@ -66,18 +64,13 @@ public class LogUtils {
if
(
inInfo
==
null
)
{
return
;
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
String
msg
=
title
.
concat
(
",原因:"
);
if
(
e
==
null
)
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setMsg
(
msg
.
concat
(
"未知"
));
return
;
}
inInfo
.
setMsg
(
msg
.
concat
(
e
.
getMessage
()));
if
(
e
instanceof
PlatException
)
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
}
else
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
}
}
/**
...
...
src/main/java/com/baosight/hpjx/util/ObjectUtils.java
View file @
e16ecbcc
...
...
@@ -46,8 +46,8 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
/**
* Gets the toString of an Object returning an null if null input.
* ObjectUtils.toString(null) = "
"
* ObjectUtils.toString("") = "
"
* ObjectUtils.toString(null) = ""
* ObjectUtils.toString("") = ""
* ObjectUtils.toString("bat") = "bat"
* ObjectUtils.toString(Boolean.TRUE) = "true"
*
...
...
@@ -55,12 +55,16 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
* @return
*/
public
static
String
toEmptyString
(
Object
obj
)
{
if
(
obj
==
null
||
""
.
equals
(
obj
))
{
return
" "
;
}
else
{
return
obj
.
toString
();
return
obj
==
null
?
""
:
obj
.
toString
();
}
//return obj == null ? " " : obj.toString();
/**
*
* @param obj
* @return
*/
public
static
String
trimToEmpty
(
Object
obj
)
{
return
obj
==
null
?
""
:
obj
.
toString
().
trim
();
}
/**
...
...
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