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
1253b76a
Commit
1253b76a
authored
Oct 16, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.fixBug:生产领料增加库存数据校验
parent
d4921a11
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
28 deletions
+104
-28
HGKC008A.java
src/main/java/com/baosight/hggp/hg/kc/domain/HGKC008A.java
+17
-0
ServiceHGKC008B.java
...java/com/baosight/hggp/hg/kc/service/ServiceHGKC008B.java
+18
-0
HGKC008A.xml
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC008A.xml
+42
-28
HGKC010.xml
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC010.xml
+3
-0
HGKCTools.java
src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
+19
-0
HGKC008B.js
src/main/webapp/HG/KC/HGKC008B.js
+5
-0
No files found.
src/main/java/com/baosight/hggp/hg/kc/domain/HGKC008A.java
View file @
1253b76a
...
...
@@ -58,6 +58,7 @@ public class HGKC008A extends DaoEPBase {
public
static
final
String
FIELD_AMOUNT
=
"amount"
;
/* 金额*/
public
static
final
String
FIELD_INVENT_TYPE_DETAIL
=
"inventTypeDetail"
;
/* 存货类型大类*/
public
static
final
String
FIELD_QUALITY_NO
=
"qualityNo"
;
/* 质检单号*/
public
static
final
String
FIELD_INV_ID
=
"invId"
;
/* 库存ID*/
public
static
final
String
COL_ID
=
"ID"
;
/* 主键id*/
public
static
final
String
COL_ACCOUNT_CODE
=
"ACCOUNT_CODE"
;
/* 账套*/
...
...
@@ -95,6 +96,7 @@ public class HGKC008A extends DaoEPBase {
public
static
final
String
COL_AMOUNT
=
"AMOUNT"
;
/* 金额*/
public
static
final
String
COL_INVENT_TYPE_DETAIL
=
"INVENT_TYPE_DETAIL"
;
/* 存货类型大类*/
public
static
final
String
COL_QUALITY_NO
=
"QUALITY_NO"
;
/* 质检单号*/
public
static
final
String
COL_INV_ID
=
"INV_ID"
;
/* 库存ID*/
public
static
final
String
QUERY
=
"HGKC008A.query"
;
public
static
final
String
COUNT
=
"HGKC008A.count"
;
...
...
@@ -138,6 +140,7 @@ public class HGKC008A extends DaoEPBase {
private
BigDecimal
amount
=
new
BigDecimal
(
"0"
);
/* 金额*/
private
Integer
inventTypeDetail
;
/* 存货类型大类*/
private
String
qualityNo
=
" "
;
/* 质检单号*/
private
Long
invId
=
new
Long
(
0
);
/* 库存ID*/
/**
* initialize the metadata.
...
...
@@ -314,6 +317,10 @@ public class HGKC008A extends DaoEPBase {
eiColumn
.
setDescName
(
"质检单号"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_INV_ID
);
eiColumn
.
setDescName
(
"库存ID"
);
eiMetadata
.
addMeta
(
eiColumn
);
}
/**
...
...
@@ -892,6 +899,14 @@ public class HGKC008A extends DaoEPBase {
this
.
qualityNo
=
qualityNo
;
}
public
Long
getInvId
()
{
return
invId
;
}
public
void
setInvId
(
Long
invId
)
{
this
.
invId
=
invId
;
}
/**
* get the value from Map.
*
...
...
@@ -936,6 +951,7 @@ public class HGKC008A extends DaoEPBase {
setAmount
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
FIELD_AMOUNT
)),
amount
));
setInventTypeDetail
(
NumberUtils
.
toInteger
(
StringUtils
.
toString
(
map
.
get
(
FIELD_INVENT_TYPE_DETAIL
)),
inventTypeDetail
));
setQualityNo
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_QUALITY_NO
)),
qualityNo
));
setInvId
(
NumberUtils
.
toLong
(
StringUtils
.
toString
(
map
.
get
(
FIELD_INV_ID
)),
invId
));
}
/**
...
...
@@ -981,6 +997,7 @@ public class HGKC008A extends DaoEPBase {
map
.
put
(
FIELD_AMOUNT
,
StringUtils
.
toString
(
amount
,
eiMetadata
.
getMeta
(
FIELD_AMOUNT
)));
map
.
put
(
FIELD_INVENT_TYPE_DETAIL
,
StringUtils
.
toString
(
inventTypeDetail
,
eiMetadata
.
getMeta
(
FIELD_INVENT_TYPE_DETAIL
)));
map
.
put
(
FIELD_QUALITY_NO
,
StringUtils
.
toString
(
qualityNo
,
eiMetadata
.
getMeta
(
FIELD_QUALITY_NO
)));
map
.
put
(
FIELD_INV_ID
,
StringUtils
.
toString
(
invId
,
eiMetadata
.
getMeta
(
FIELD_INV_ID
)));
return
map
;
}
...
...
src/main/java/com/baosight/hggp/hg/kc/service/ServiceHGKC008B.java
View file @
1253b76a
...
...
@@ -3,15 +3,18 @@ package com.baosight.hggp.hg.kc.service;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.common.InventTypeDetailEnum
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.enums.DeleteFlagEnum
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.constant.HGSqlConstant
;
import
com.baosight.hggp.hg.kc.constant.HgKcConst
;
import
com.baosight.hggp.hg.kc.domain.HGKC008
;
import
com.baosight.hggp.hg.kc.domain.HGKC008A
;
import
com.baosight.hggp.hg.kc.domain.HGKC010
;
import
com.baosight.hggp.hg.kc.domain.HGKC010B
;
import
com.baosight.hggp.hg.kc.tools.HGKCTools
;
import
com.baosight.hggp.hg.kc.utils.HGKCUtils
;
import
com.baosight.hggp.hg.xs.domain.Company
;
import
com.baosight.hggp.util.AssertUtils
;
...
...
@@ -26,6 +29,8 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.util.Arrays
;
import
java.util.HashMap
;
...
...
@@ -74,6 +79,7 @@ public class ServiceHGKC008B extends ServiceBase {
try
{
Map
queryRow
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
// inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "inventTypeDetails", InventTypeDetailEnum.getInentTypeTwo());
queryRow
.
put
(
"isInvQty"
,
CommonConstant
.
YesNo
.
YES_1
);
inInfo
=
super
.
query
(
inInfo
,
HGSqlConstant
.
HgKc010
.
QUERY_LY
,
new
HGKC010
());
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
...
...
@@ -132,6 +138,7 @@ public class ServiceHGKC008B extends ServiceBase {
newKc008A
.
setCompanyCode
(
dbKc008
.
getCompanyCode
());
newKc008A
.
setCompanyName
(
dbKc008
.
getCompanyName
());
newKc008A
.
setReceiveId
(
dbKc008
.
getId
());
newKc008A
.
setInvId
(
dbKc010
.
getId
());
newKc008A
.
setInvQty
(
fKc010B
.
getApplyQty
());
newKc008A
.
setInvWeight
(
fKc010B
.
getApplyQty
().
multiply
(
dbKc010
.
getInvUnitWeight
()));
newKc008A
.
setInvWidth
(
dbKc010
.
getWidth
());
...
...
@@ -160,6 +167,17 @@ public class ServiceHGKC008B extends ServiceBase {
for
(
HGKC010B
fKc010B
:
fKc010Bs
)
{
AssertUtils
.
isGe
(
BigDecimal
.
ZERO
,
fKc010B
.
getApplyQty
(),
String
.
format
(
"库存【%s】申请数量必须大于0"
,
fKc010B
.
getInventCode
()));
// 查询已申请未提交的领料数量
List
<
HGKC008A
>
qtyKc008As
=
HGKCTools
.
HgKc008A
.
listByInv
(
fKc010B
.
getCompanyCode
(),
fKc010B
.
getWhCode
(),
fKc010B
.
getInventCode
());
BigDecimal
applyQtySum
=
CollectionUtils
.
isEmpty
(
qtyKc008As
)
?
BigDecimal
.
ZERO
:
qtyKc008As
.
stream
().
filter
(
item
->
HgKcConst
.
HgKc008
.
Status
.
S0
.
equals
(
item
.
getStatus
()))
.
map
(
HGKC008A:
:
getInvQty
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalApplyQty
=
applyQtySum
.
add
(
fKc010B
.
getApplyQty
());
HGKC010
dbKc010
=
dbKc010Map
.
get
(
fKc010B
.
getId
());
AssertUtils
.
isGt
(
totalApplyQty
,
dbKc010
.
getInvQty
(),
String
.
format
(
"存货【%s(%s)】累计申请数量【%s】超过库存数量【%s】"
,
fKc010B
.
getInventCode
(),
fKc010B
.
getInventName
(),
totalApplyQty
.
stripTrailingZeros
().
toPlainString
(),
dbKc010
.
getInvQty
()));
}
for
(
HGKC008A
dbKc008A
:
dbKc008As
)
{
for
(
Map
.
Entry
<
Long
,
HGKC010
>
dbKc010MapEntry
:
dbKc010Map
.
entrySet
())
{
...
...
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC008A.xml
View file @
1253b76a
...
...
@@ -38,38 +38,26 @@
PRICE as "price",
<!-- 单价 -->
AMOUNT as "amount",
<!-- 金额 -->
INVENT_TYPE_DETAIL as "inventTypeDetail",
<!-- 存货类型大类 -->
QUALITY_NO as "qualityNo"
<!-- 质检单号 -->
QUALITY_NO as "qualityNo",
<!-- 质检单号 -->
INV_ID as "invId"
<!-- 库存ID -->
</sql>
<sql
id=
"condition"
>
AND DELETE_FLAG = 0
<include
refid=
"idCondition"
/>
<include
refid=
"customCondition"
/>
<include
refid=
"HGXSDataAuth.authCondition"
/>
<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=
"receiveId"
>
RECEIVE_ID = #receiveId#
</isNotEmpty>
...
...
@@ -91,11 +79,8 @@
<isNotEmpty
prepend=
" AND "
property=
"inventType"
>
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventCode"
>
INVENT_CODE like CONCAT('%',#inventCode#,'%')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventName"
>
INVENT_NAME
like
CONCAT('%',#inventName#,'%')
INVENT_NAME
LIKE
CONCAT('%',#inventName#,'%')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"invSpecId"
>
INV_SPEC_ID = #invSpecId#
...
...
@@ -136,18 +121,15 @@
<isNotEmpty
prepend=
" AND "
property=
"notIds"
>
id NOT IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"notIds"
>
#notIds[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventTypeDetail"
>
INVENT_TYPE_DETAIL = #inventTypeDetail#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventTypeDetails"
>
INVENT_TYPE_DETAIL IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"inventTypeDetails"
>
#inventTypeDetails[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"status"
>
STATUS = #status#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"applyCode"
>
APPLY_CODE = #applyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"invId"
>
INV_ID = #invId#
</isNotEmpty>
</sql>
<sql
id=
"idCondition"
>
...
...
@@ -166,17 +148,48 @@
</sql>
<sql
id=
"customCondition"
>
<include
refid=
"condition"
/>
<isNotEmpty
prepend=
" AND "
property=
"inventCode"
>
INVENT_CODE LIKE CONCAT('%', #inventCode#, '%')
</isNotEmpty>
<isEqual
prepend=
" AND "
property=
"isInvQty"
compareValue=
"1"
>
INV_QTY > 0
</isEqual>
<isNotEmpty
prepend=
" AND "
property=
"inventTypeDetail"
>
INVENT_TYPE_DETAIL = #inventTypeDetail#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventTypeDetails"
>
INVENT_TYPE_DETAIL IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"inventTypeDetails"
>
#inventTypeDetails[]#
</iterate>
</isNotEmpty>
</sql>
<sql
id=
"getCondition"
>
<include
refid=
"condition"
/>
<isNotEmpty
prepend=
" AND "
property=
"inventCode"
>
INVENT_CODE = #inventCode#
</isNotEmpty>
</sql>
<!-- 查询 -->
<select
id=
"get"
resultClass=
"com.baosight.hggp.hg.kc.domain.HGKC008A"
>
SELECT
<include
refid=
"column"
/>
FROM ${hggpSchema}.HGKC008A
WHERE 1=1
<include
refid=
"getCondition"
/>
<dynamic
prepend=
"ORDER BY"
>
<isNotEmpty
property=
"orderBy"
>
$orderBy$
</isNotEmpty>
</dynamic>
</select>
<!-- 查询 -->
<select
id=
"query"
resultClass=
"com.baosight.hggp.hg.kc.domain.HGKC008A"
>
SELECT
<include
refid=
"column"
/>
FROM ${hggpSchema}.HGKC008A WHERE 1=1
<include
refid=
"condition"
/>
<include
refid=
"c
ustomC
ondition"
/>
<dynamic
prepend=
"ORDER BY"
>
<isNotEmpty
property=
"orderBy"
>
$orderBy$
...
...
@@ -186,7 +199,7 @@
<select
id=
"count"
resultClass=
"int"
>
SELECT COUNT(*) FROM ${hggpSchema}.HGKC008A WHERE 1=1
<include
refid=
"condition"
/>
<include
refid=
"c
ustomC
ondition"
/>
</select>
<insert
id=
"insert"
>
...
...
@@ -222,12 +235,13 @@
PRICE,
<!-- 单价 -->
AMOUNT,
<!-- 金额 -->
INVENT_TYPE_DETAIL,
QUALITY_NO
QUALITY_NO,
INV_ID
) VALUES (#accountCode#,#projCode#, #projName#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #status#, #applyLineCode#, #applyCode#, #receiveId#, #companyCode#, #companyName#, #whCode#,
#whName#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #invSpecId#,#invSpec#, #invLength#,
#invWidth#, #invThick#, #invQty#, #invUnitWeight#, #invWeight#, #price#, #amount#, #inventTypeDetail#,
#qualityNo#)
#qualityNo#
, #invId#
)
</insert>
<delete
id=
"delete"
>
...
...
src/main/java/com/baosight/hggp/hg/kc/sql/HGKC010.xml
View file @
1253b76a
...
...
@@ -150,6 +150,9 @@
<isNotEmpty
prepend=
" AND "
property=
"inventName"
>
INVENT_NAME LIKE CONCAT('%', #inventName#, '%')
</isNotEmpty>
<isEqual
prepend=
" AND "
property=
"isInvQty"
compareValue=
"1"
>
INV_QTY > 0
</isEqual>
</sql>
<sql
id=
"orderBy"
>
...
...
src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
View file @
1253b76a
...
...
@@ -1211,6 +1211,25 @@ public class HGKCTools {
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HGKC008A:
:
getApplyLineCode
,
item
->
item
));
}
/**
* 查询
*
* @param companyCode
* @param whCode
* @param inventCode
* @return
*/
public
static
List
<
HGKC008A
>
listByInv
(
String
companyCode
,
String
whCode
,
String
inventCode
)
{
if
(
StringUtils
.
isBlank
(
companyCode
)
||
StringUtils
.
isBlank
(
whCode
)
||
StringUtils
.
isBlank
(
inventCode
))
{
return
null
;
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
HGKC008A
.
FIELD_COMPANY_CODE
,
companyCode
);
paramMap
.
put
(
HGKC008A
.
FIELD_WH_CODE
,
whCode
);
paramMap
.
put
(
HGKC008A
.
FIELD_INVENT_CODE
,
inventCode
);
return
DaoBase
.
getInstance
().
query
(
HGKC008A
.
QUERY
,
paramMap
);
}
public
static
List
<
HGKC008A
>
getHgkc008aList
(
Long
receiveId
)
{
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"receiveId"
,
receiveId
);
...
...
src/main/webapp/HG/KC/HGKC008B.js
View file @
1253b76a
...
...
@@ -41,10 +41,15 @@ let confirm = function () {
}
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
let
applyQty
=
rows
[
i
][
'applyQty'
];
let
invQty
=
rows
[
i
][
'invQty'
];
if
(
!
isPositiveNumber
(
applyQty
))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行申请数量必须大于0"
);
return
;
}
if
(
parseFloat
(
invQty
)
<
parseFloat
(
applyQty
))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行申请数量不能大于库存数量"
);
return
;
}
}
JSUtils
.
confirm
(
"确定对勾选的["
+
rows
.
length
+
"]条数据进行
\"
生产领料
\"
操作吗? "
,
{
ok
:
function
()
{
...
...
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