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
c5b99dea
Commit
c5b99dea
authored
Jun 12, 2024
by
江和松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
汉光自动任务逻辑编写
1.每日统计收发库存 2.每月收发库存统计 3.备份实时库存
parent
0364fded
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
316 additions
and
175 deletions
+316
-175
HGSqlConstant.java
...ain/java/com/baosight/hggp/hg/constant/HGSqlConstant.java
+29
-9
HGKC010A.java
src/main/java/com/baosight/hggp/hg/kc/domain/HGKC010A.java
+23
-6
ServiceHGKC009.java
.../java/com/baosight/hggp/hg/kc/service/ServiceHGKC009.java
+23
-5
ServiceHGKC010A.java
...java/com/baosight/hggp/hg/kc/service/ServiceHGKC010A.java
+43
-0
HGKC003.xml
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC003.xml
+18
-0
HGKC004.xml
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC004.xml
+2
-46
HGKC004A.xml
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC004A.xml
+20
-108
HGKC010A.xml
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC010A.xml
+157
-0
HGKCTools.java
src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
+1
-1
No files found.
src/main/java/com/baosight/hggp/hg/constant/HGSqlConstant.java
View file @
c5b99dea
...
...
@@ -106,12 +106,29 @@ public class HGSqlConstant {
* @author:songx
* @date:2024/1/20,16:45
*/
public
class
H
gKc
003
{
public
class
H
GKC
003
{
// 模块名称
private
static
final
String
MODULE_NAME
=
"HGKC003."
;
// 锁
public
static
final
String
LOCK
=
MODULE_NAME
+
"lock"
;
// 统计
public
static
final
String
STAT_DATE
=
"HGKC003.statDate"
;
}
/**
* HPKC003 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public
class
HgKc003A
{
// 统计
public
static
final
String
STAT_DATE
=
"HGKC003A.statDate"
;
// 锁
public
static
final
String
LOCK
=
"HGKC003A.lock"
;
}
/**
...
...
@@ -181,18 +198,21 @@ public class HGSqlConstant {
public
static
final
String
LOCK
=
"HGKC008A.lock"
;
}
/**
* HGKC00
3
SQL 定义
* HGKC00
4
SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public
class
HGKC00
3
{
public
class
HGKC00
4
{
// 统计
public
static
final
String
STAT_DATE
=
"HGKC00
3
.statDate"
;
public
static
final
String
STAT_DATE
=
"HGKC00
4
.statDate"
;
// 锁
public
static
final
String
LOCK
=
"HGKC003.lock"
;
public
static
final
String
LOCK
=
"HGKC004.lock"
;
// 修改打印状态
public
static
final
String
UPDATE_PRINT
=
"HGKC004.updatePrint"
;
}
/**
...
...
@@ -201,14 +221,14 @@ public class HGSqlConstant {
* @author:songx
* @date:2024/1/20,16:45
*/
public
class
HGKC004
{
public
class
HGKC004
A
{
// 统计
public
static
final
String
STAT_DATE
=
"HGKC004.statDate"
;
public
static
final
String
STAT_DATE
=
"HGKC004
A
.statDate"
;
// 锁
public
static
final
String
LOCK
=
"HGKC004.lock"
;
public
static
final
String
LOCK
=
"HGKC004
A
.lock"
;
// 修改打印状态
public
static
final
String
UPDATE_PRINT
=
"HGKC004.updatePrint"
;
public
static
final
String
UPDATE_PRINT
=
"HGKC004
A
.updatePrint"
;
}
/**
...
...
src/main/java/com/baosight/hggp/hg/kc/domain/HGKC010A.java
View file @
c5b99dea
...
...
@@ -22,12 +22,15 @@ public class HGKC010A extends HGKC010 {
public
static
final
String
FIELD_APPLY_QTY
=
"applyQty"
;
/* 申请数量*/
public
static
final
String
FIELD_APPLY_REMARK
=
"applyRemark"
;
/* 申请说明*/
public
static
final
String
FIELD_DATE_PROC
=
"dateProc"
;
/* 日期*/
public
static
final
String
COL_APPLY_QTY
=
"APPLY_QTY"
;
/* 申请数量*/
public
static
final
String
COL_APPLY_REMARK
=
"APPLY_REMARK"
;
/* 申请说明*/
public
static
final
String
COL_DATE_PROC
=
"DATE_PROC"
;
/* 日期*/
private
BigDecimal
applyQty
=
new
BigDecimal
(
0.000
);
/* 申请数量*/
private
String
applyRemark
=
" "
;
/* 申请说明*/
private
String
dateProc
=
" "
;
/* 日期*/
/**
* initialize the metadata.
...
...
@@ -46,6 +49,10 @@ public class HGKC010A extends HGKC010 {
eiColumn
.
setDescName
(
"申请说明"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_DATE_PROC
);
eiColumn
.
setDescName
(
"日期"
);
eiMetadata
.
addMeta
(
eiColumn
);
}
...
...
@@ -56,23 +63,31 @@ public class HGKC010A extends HGKC010 {
super
.
initMetaData
();
initMetaData
();
}
public
BigDecimal
getApplyQty
()
{
return
applyQty
;
}
public
void
setApplyQty
(
BigDecimal
applyQty
)
{
this
.
applyQty
=
applyQty
;
}
public
String
getApplyRemark
()
{
return
applyRemark
;
}
public
void
setApplyRemark
(
String
applyRemark
)
{
this
.
applyRemark
=
applyRemark
;
}
public
String
getDateProc
()
{
return
dateProc
;
}
public
void
setDateProc
(
String
dateProc
)
{
this
.
dateProc
=
dateProc
;
}
/**
* get the value from Map.
*
...
...
@@ -83,8 +98,9 @@ public class HGKC010A extends HGKC010 {
super
.
fromMap
(
map
);
setApplyQty
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
FIELD_APPLY_QTY
)),
applyQty
));
setApplyRemark
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_APPLY_REMARK
)),
applyRemark
));
setDateProc
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_DATE_PROC
)),
dateProc
));
}
/**
* set the value to Map.
*/
...
...
@@ -94,6 +110,7 @@ public class HGKC010A extends HGKC010 {
Map
map
=
super
.
toMap
();
map
.
put
(
FIELD_APPLY_QTY
,
StringUtils
.
toString
(
applyQty
,
eiMetadata
.
getMeta
(
FIELD_APPLY_QTY
)));
map
.
put
(
FIELD_APPLY_REMARK
,
StringUtils
.
toString
(
applyRemark
,
eiMetadata
.
getMeta
(
FIELD_APPLY_REMARK
)));
map
.
put
(
FIELD_DATE_PROC
,
StringUtils
.
toString
(
dateProc
,
eiMetadata
.
getMeta
(
FIELD_DATE_PROC
)));
return
map
;
}
...
...
src/main/java/com/baosight/hggp/hg/kc/service/ServiceHGKC009.java
View file @
c5b99dea
...
...
@@ -5,7 +5,6 @@ import com.baosight.hggp.common.DdynamicEnum;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.hg.constant.HGSqlConstant
;
import
com.baosight.hggp.hg.kc.domain.*
;
import
com.baosight.hggp.hg.pz.domain.HGPZ004
;
import
com.baosight.hggp.hg.pz.domain.HGPZ005
;
import
com.baosight.hggp.hg.pz.domain.HGPZ007
;
import
com.baosight.hggp.hg.pz.tools.HGPZTools
;
...
...
@@ -170,14 +169,18 @@ public class ServiceHGKC009 extends ServiceBase {
Map
<
String
,
HGKC006A
>
qtRkMap
=
this
.
listInvData
(
queryMap
,
HGSqlConstant
.
HGKC006A
.
STAT_DATE
);
// 1.5、生产领料
Map
<
String
,
HGKC008A
>
scCkMap
=
this
.
listInvData
(
queryMap
,
HGSqlConstant
.
HGKC008A
.
STAT_DATE
);
// 1.6、生产入库
Map
<
String
,
HGKC003
>
scRkMap
=
this
.
listInvData
(
queryMap
,
HGSqlConstant
.
HGKC003
.
STAT_DATE
);
// 1.7、其它出库
Map
<
String
,
HGKC007A
>
qtCkMap
=
this
.
listInvData
(
queryMap
,
HGSqlConstant
.
HGKC007A
.
STAT_DATE
);
// 1.8、盘点差异数量
Map
<
String
,
HGKC005
>
pdDiffMap
=
this
.
listInvData
(
queryMap
,
HGSqlConstant
.
HGKC005
.
STAT_DATE
);
// 1.9、期初库存
Map
<
String
,
HGKC009
>
initKcMap
=
this
.
listInvData
(
queryMap
,
HGKC009
.
QUERY
);
// 2.0 销售出库
Map
<
String
,
HGKC004A
>
xsCkMap
=
this
.
listInvData
(
queryMap
,
HGSqlConstant
.
HGKC004A
.
STAT_DATE
);
// 根据期末库存生成收发存对象
return
buildKcBean
(
queryMap
,
endKcs
,
cgRkMap
,
qtRkMap
,
scCkMap
,
qtCkMap
,
pdDiffMap
,
initKcMap
);
return
buildKcBean
(
queryMap
,
endKcs
,
cgRkMap
,
qtRkMap
,
scCkMap
,
qtCkMap
,
pdDiffMap
,
initKcMap
,
scRkMap
,
xsCkMap
);
}
/**
...
...
@@ -186,16 +189,19 @@ public class ServiceHGKC009 extends ServiceBase {
* @param queryMap
* @param endKcs
* @param cgRkMap
* @param qtCkMap
* @param scCkMap
* @param qtRkMap
* @param scCkMap
* @param qtCkMap
* @param pdDiffMap
* @param initKcMap
* @param scRkMap
* @param xsCkMap
* @return
*/
private
List
<
HGKC009
>
buildKcBean
(
Map
queryMap
,
Map
<
String
,
HGKC010A
>
endKcs
,
Map
<
String
,
HGKC001
>
cgRkMap
,
Map
<
String
,
HGKC006A
>
qtRkMap
,
Map
<
String
,
HGKC008A
>
scCkMap
,
Map
<
String
,
HGKC007A
>
qtCkMap
,
Map
<
String
,
HGKC005
>
pdDiffMap
,
Map
<
String
,
HGKC009
>
initKcMap
)
{
Map
<
String
,
HGKC005
>
pdDiffMap
,
Map
<
String
,
HGKC009
>
initKcMap
,
Map
<
String
,
HGKC003
>
scRkMap
,
Map
<
String
,
HGKC004A
>
xsCkMap
)
{
List
<
HGKC009
>
newKc009s
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
HGKC010A
>
entry
:
endKcs
.
entrySet
())
{
String
key
=
entry
.
getKey
();
...
...
@@ -223,10 +229,22 @@ public class ServiceHGKC009 extends ServiceBase {
HGKC008A
scCk
=
scCkMap
.
get
(
key
);
kc009
.
setScOuterAmount
(
scCk
==
null
?
BigDecimal
.
ZERO
:
scCk
.
getInvQty
());
kc009
.
setScOuterWeight
(
scCk
==
null
?
BigDecimal
.
ZERO
:
scCk
.
getInvWeight
());
// 1.6、生产入库
HGKC003
scRk
=
scRkMap
.
get
(
key
);
kc009
.
setScEnterAmount
(
scRk
==
null
?
BigDecimal
.
ZERO
:
scRk
.
getInvQty
());
kc009
.
setScEnterWeight
(
scRk
==
null
?
BigDecimal
.
ZERO
:
scRk
.
getInvWeight
());
// 1.7、其他出库
HGKC007A
qtCk
=
qtCkMap
.
get
(
key
);
kc009
.
setQtOuterAmount
(
qtCk
==
null
?
BigDecimal
.
ZERO
:
qtCk
.
getInvQty
());
kc009
.
setQtOuterWeight
(
qtCk
==
null
?
BigDecimal
.
ZERO
:
qtCk
.
getInvWeight
());
// 2.0、销售出库
HGKC004A
xsCk
=
xsCkMap
.
get
(
key
);
kc009
.
setXsOuterAmount
(
xsCk
==
null
?
BigDecimal
.
ZERO
:
xsCk
.
getQuantity
());
kc009
.
setXsOuterWeight
(
xsCk
==
null
?
BigDecimal
.
ZERO
:
xsCk
.
getWeight
());
// 1.8、出库
kc009
.
setOuterAmount
(
kc009
.
getScOuterAmount
().
add
(
kc009
.
getXsOuterAmount
())
.
add
(
kc009
.
getQtOuterAmount
()));
...
...
src/main/java/com/baosight/hggp/hg/kc/service/ServiceHGKC010A.java
0 → 100644
View file @
c5b99dea
package
com
.
baosight
.
hggp
.
hg
.
kc
.
service
;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.hg.constant.HGSqlConstant
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.LogUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
java.time.LocalDate
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author:songx
* @date:2024/1/25,18:49
*/
public
class
ServiceHGKC010A
extends
ServiceBase
{
/**
* 备份数据
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"库存管理"
,
operType
=
"插入"
,
operDesc
=
"实时库存管理-备份数据"
)
public
EiInfo
backup
(
EiInfo
inInfo
)
{
try
{
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"dateProc"
,
LocalDate
.
now
().
minusDays
(
1
).
format
(
DateUtils
.
SHORT_DATE
));
// 清除数据
dao
.
delete
(
HGSqlConstant
.
HGKC010A
.
DELETE_BY_TIME
,
queryMap
);
// 备份数据
dao
.
insert
(
HGSqlConstant
.
HGKC010A
.
BACKUP
,
queryMap
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
"备份数据成功"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"新增失败"
);
}
return
inInfo
;
}
}
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC003.xml
View file @
c5b99dea
...
...
@@ -358,4 +358,22 @@
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGKC003
</select>
<!-- 统计库存 -->
<select
id=
"statDate"
resultClass=
"com.baosight.hggp.hg.kc.domain.HGKC003"
>
SELECT
COMPANY_CODE AS "companyCode",
DEP_CODE AS "depCode",
WH_CODE AS "whCode",
PROJ_CODE AS "projCode",
PART_CODE AS "partCode",
COALESCE(SUM(INV_QTY), 0) AS "invQty",
COALESCE(SUM(INV_WEIGHT), 0) AS "invWeight"
FROM ${hggpSchema}.HGKC003
WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"createdTimeFrom"
>
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, PROJ_CODE, PART_CODE
</select>
</sqlMap>
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC004.xml
View file @
c5b99dea
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-05-28 10:42:29
Version : 1.0
schema : hggp
tableName : HGKC004
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
PARENT_ID BIGINT NOT NULL,
RECEIPT_DATE VARCHAR,
SALE_OUT_CODE VARCHAR,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
STATUS TINYINT
-->
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap
namespace=
"HGKC004"
>
<typeAlias
alias=
"HGKC004"
type=
"com.baosight.hggp.hg.kc.domain.HGKC004"
/>
...
...
@@ -119,7 +96,7 @@
<select
id=
"query"
parameterClass=
"HashMap"
resultClass=
"HGKC004"
>
SELECT
<include
refid=
"column"
/>
<include
refid=
"column"
/>
FROM ${hggpSchema}.HGKC004 WHERE 1=1
<include
refid=
"condition"
/>
<dynamic
prepend=
"ORDER BY"
>
...
...
@@ -236,27 +213,6 @@
WHERE ID IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"ids"
>
#ids[]#
</iterate>
</update>
<!-- 统计库存 -->
<select
id=
"statDate"
resultClass=
"HGKC004"
>
SELECT
ACCOUNT_CODE AS "accountCode",
COMPANY_CODE as "companyCode",
COMPANY_NAME as "companyName",
DEP_CODE AS "depCode",
WH_CODE AS "whCode",
PROJ_CODE AS "projCode",
INVENT_CODE AS "inventCode",
SUB_INVENT_CODE AS "subInventCode",
COALESCE(SUM(AMOUNT), 0) AS "amount",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hggpSchema}.HGKC004
WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"createdTimeFrom"
>
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, PROJ_CODE, INVENT_CODE, SUB_INVENT_CODE,FACTORY_CODE,FACTORY_NAME
</select>
<select
id=
"queryList"
parameterClass=
"HashMap"
resultClass=
"HGKC004"
>
SELECT
<include
refid=
"column"
/>
...
...
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC004A.xml
View file @
c5b99dea
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-05-28 10:42:29
Version : 1.0
schema : hggp
tableName : HGKC004A
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
INVENT_RECORD_ID BIGINT,
INVENT_TYPE VARCHAR,
INVENT_CODE VARCHAR NOT NULL,
INVENT_NAME VARCHAR NOT NULL,
INV_QTY DECIMAL,
INV_UNIT_WEIGHT DECIMAL,
INV_WEIGHT DECIMAL,
PARENT_ID BIGINT,
PRICE DECIMAL,
AMOUNT DECIMAL
-->
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap
namespace=
"HGKC004A"
>
<typeAlias
alias=
"HGKC004A"
type=
"com.baosight.hggp.hg.kc.domain.HGKC004A"
/>
...
...
@@ -242,85 +215,24 @@
ID = #id#
</update>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="length">
LENGTH = #length#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="width">
WIDTH = #width#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="thick">
THICK = #thick#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="quantity">
QUANTITY = #quantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unitWeight">
UNIT_WEIGHT = #unitWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="weight">
WEIGHT = #weight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="price">
PRICE = #price#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
</isNotEmpty>
-->
<!-- 统计库存 -->
<select
id=
"statDate"
resultClass=
"HGKC004"
>
SELECT
a.ACCOUNT_CODE AS "accountCode",
a.COMPANY_CODE as "companyCode",
a.COMPANY_NAME as "companyName",
a.DEP_CODE AS "depCode",
b.WH_CODE AS "whCode",
b.PROJ_CODE AS "projCode",
a.INVENT_CODE AS "inventCode",
COALESCE(SUM(QUANTITY), 0) AS "quantity",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hggpSchema}.HGKC004A a LEFT JOIN ${hggpSchema}.HGKC004 b on a.PARENT_ID = b.ID
WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"createdTimeFrom"
>
a.CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY a.ACCOUNT_CODE,a.COMPANY_CODE,a.COMPANY_NAME, a.DEP_CODE, b.WH_CODE, b.PROJ_CODE, a.INVENT_CODE
</select>
</sqlMap>
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC010A.xml
0 → 100644
View file @
c5b99dea
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap
namespace=
"HGKC010A"
>
<sql
id=
"column"
>
ID as "id",
ACCOUNT_CODE as "accountCode",
<!-- 企业编码 -->
DEP_CODE as "depCode",
<!-- 部门编码 -->
CREATED_BY as "createdBy",
<!-- 记录创建者 -->
CREATED_NAME as "createdName",
<!-- 记录创建名称 -->
CREATED_TIME as "createdTime",
<!-- 记录创建时间 -->
UPDATED_BY as "updatedBy",
<!-- 记录修改者 -->
UPDATED_NAME as "updatedName",
<!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime",
<!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag",
<!-- 0-未删除,1-已删除 -->
COMPANY_CODE as "companyCode",
<!-- 公司编码 -->
COMPANY_NAME as "companyName",
<!-- 公司名称 -->
WH_CODE as "whCode",
<!-- 仓库编码 -->
WH_NAME as "whName",
<!-- 仓库名称 -->
INVENT_TYPE as "inventType",
<!-- 存货类型 -->
INVENT_CODE as "inventCode",
<!-- 存货编码 -->
INVENT_NAME as "inventName",
<!-- 存货名称 -->
SPEC_ID as "specId",
<!-- 规格ID -->
SPEC as "spec",
<!-- 规格 -->
MATERIAL as "material",
<!-- 材质 -->
UNIT as "unit",
<!-- 单位 -->
LENGTH as "length",
<!-- 长度 -->
WIDTH as "width",
<!-- 宽度 -->
THICK as "thick",
<!-- 厚度 -->
INV_QTY as "invQty",
<!-- 库存数量 -->
INV_UNIT_WEIGHT as "invUnitWeight",
<!-- 库存单重 -->
INV_WEIGHT as "invWeight",
<!-- 库存重量 -->
FACTORY_CODE as "factoryCode",
<!-- 厂区编码 -->
FACTORY_NAME as "factoryName"
<!-- 厂区名称 -->
</sql>
<sql
id=
"condition"
>
<include
refid=
"HGXSDataAuth.authCondition"
/>
<include
refid=
"idCondition"
/>
<include
refid=
"customCondition"
/>
<isNotEmpty
prepend=
" AND "
property=
"accountCode"
>
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"depCode"
>
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"dateProc"
>
DATE_PROC = #dateProc#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"deleteFlag"
>
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyName"
>
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"whCode"
>
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"whName"
>
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventType"
>
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventCode"
>
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventName"
>
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"specId"
>
SPEC_ID = #specId#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"spec"
>
SPEC = #spec#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"material"
>
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"unit"
>
UNIT = #unit#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryCode"
>
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"factoryName"
>
FACTORY_NAME = #factoryName#
</isNotEmpty>
</sql>
<sql
id=
"idCondition"
>
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"ids"
>
ID IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"ids"
>
#ids[]#
</iterate>
</isNotEmpty>
</sql>
<sql
id=
"customCondition"
>
<include
refid=
"BaseCondition.specCondition"
/>
<include
refid=
"BaseCondition.createdTimeCondition"
/>
</sql>
<sql
id=
"orderBy"
>
<dynamic
prepend=
"ORDER BY"
>
<isNotEmpty
property=
"orderBy"
>
$orderBy$
</isNotEmpty>
<isEmpty
property=
"orderBy"
>
ID DESC
</isEmpty>
</dynamic>
</sql>
<select
id=
"query"
resultClass=
"com.baosight.hggp.hg.kc.domain.HGKC010A"
>
SELECT
<include
refid=
"column"
/>
FROM ${hggpSchema}.HGKC010A
WHERE 1=1
<include
refid=
"condition"
/>
<include
refid=
"orderBy"
/>
</select>
<select
id=
"count"
resultClass=
"int"
>
SELECT COUNT(*) FROM ${hggpSchema}.HGKC010A WHERE 1=1
<include
refid=
"condition"
/>
</select>
<delete
id=
"delete"
>
DELETE FROM ${hggpSchema}.HGKC010A WHERE ID = #id#
</delete>
<!-- 按时间删除数据 -->
<delete
id=
"deleteByTime"
>
DELETE FROM ${hggpSchema}.HGKC010A WHERE DATE_PROC = #dateProc#
</delete>
<!-- 备份数据 -->
<insert
id=
"backup"
>
INSERT INTO ${hggpSchema}.HGKC010A (
ACCOUNT_CODE,COMPANY_CODE,COMPANY_NAME, DEP_CODE, DATE_PROC, WH_CODE, WH_NAME, INVENT_TYPE,
INVENT_CODE, INVENT_NAME, SPEC_ID,SPEC, MATERIAL, UNIT,LENGTH,WIDTH,THICK, INV_QTY, INV_UNIT_WEIGHT, INV_WEIGHT,
FACTORY_CODE, FACTORY_NAME,
CREATED_BY, CREATED_NAME, CREATED_TIME, UPDATED_BY, UPDATED_NAME,UPDATED_TIME
)
SELECT
ACCOUNT_CODE,COMPANY_CODE,COMPANY_NAME, DEP_CODE, #dateProc#, WH_CODE, WH_NAME, INVENT_TYPE,
INVENT_CODE, INVENT_NAME, SPEC_ID,SPEC, MATERIAL, UNIT,LENGTH,WIDTH,THICK, INV_QTY, INV_UNIT_WEIGHT, INV_WEIGHT,
FACTORY_CODE, FACTORY_NAME,
CREATED_BY, CREATED_NAME, CREATED_TIME, UPDATED_BY, UPDATED_NAME, UPDATED_TIME
FROM ${hggpSchema}.HGKC010
</insert>
</sqlMap>
src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
View file @
c5b99dea
...
...
@@ -287,7 +287,7 @@ public class HGKCTools {
}
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"depositNos"
,
depositNos
);
DaoBase
.
getInstance
().
update
(
HGSqlConstant
.
H
gKc
003
.
LOCK
,
paramMap
);
DaoBase
.
getInstance
().
update
(
HGSqlConstant
.
H
GKC
003
.
LOCK
,
paramMap
);
}
/**
...
...
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