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
5b393644
Commit
5b393644
authored
Feb 29, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.优化代码,存货新增时校验逻辑
parent
fca2f656
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
214 additions
and
235 deletions
+214
-235
ServiceHPKC006.java
.../java/com/baosight/hpjx/hp/kc/service/ServiceHPKC006.java
+7
-5
ServiceHPPZ004.java
.../java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ004.java
+0
-33
ServiceHPPZ006.java
.../java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ006.java
+2
-47
HPPZ004.xml
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ004.xml
+18
-3
HPPZ006.xml
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ006.xml
+22
-0
HPPZTools.java
src/main/java/com/baosight/hpjx/hp/pz/tools/HPPZTools.java
+149
-131
ServiceHPSC002.java
.../java/com/baosight/hpjx/hp/sc/service/ServiceHPSC002.java
+7
-7
ServiceHPSC006.java
.../java/com/baosight/hpjx/hp/sc/service/ServiceHPSC006.java
+4
-4
ExcelUtils.java
src/main/java/com/baosight/hpjx/util/ExcelUtils.java
+4
-4
HPKC006.jsp
src/main/webapp/HP/KC/HPKC006.jsp
+1
-1
No files found.
src/main/java/com/baosight/hpjx/hp/kc/service/ServiceHPKC006.java
View file @
5b393644
...
...
@@ -131,15 +131,17 @@ public class ServiceHPKC006 extends ServiceBase {
this
.
setBaseInfo
(
fKc006
);
// 生成入库单号
fKc006
.
setOtherEnterNo
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
OTHER_ENTER_NO
));
HPPZ006
hppz006
=
HPPZTools
.
checkAndSavePZ06
(
fKc006
.
getInventType
(),
fKc006
.
getInventName
(),
fKc006
.
getLength
(),
fKc006
.
getWidth
(),
fKc006
.
getThick
(),
fKc006
.
getCoefficient
(),
fKc006
.
getMaterial
(),
fKc006
.
getUnit
()
// 检查规格,如果不存在就新增
HPPZ006
dbPz006
=
HPPZTools
.
HpPz006
.
checkAndSave
(
fKc006
.
getInventType
(),
fKc006
.
getInventName
(),
fKc006
.
getLength
(),
fKc006
.
getWidth
(),
fKc006
.
getThick
(),
fKc006
.
getCoefficient
(),
fKc006
.
getMaterial
(),
fKc006
.
getUnit
()
);
// 根据规格计算单重
fKc006
.
setUnitWeight
(
HPPZTools
.
HpPz006
.
calcUnitWeight
(
hppz006
.
getId
()
));
fKc006
.
setUnitWeight
(
HPPZTools
.
HpPz006
.
calcUnitWeight
(
dbPz006
));
// 计算总重
fKc006
.
setWeight
(
fKc006
.
getAmount
().
multiply
(
fKc006
.
getUnitWeight
()));
fKc006
.
setInventRecordId
(
hpp
z006
.
getId
());
fKc006
.
setInventCode
(
hpp
z006
.
getInventCode
());
fKc006
.
setInventRecordId
(
dbP
z006
.
getId
());
fKc006
.
setInventCode
(
dbP
z006
.
getInventCode
());
fKc006
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
DaoUtils
.
insert
(
HPKC006
.
INSERT
,
fKc006
);
// 修改库存
...
...
src/main/java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ004.java
View file @
5b393644
...
...
@@ -116,39 +116,6 @@ public class ServiceHPPZ004 extends ServiceBase {
}
return
inInfo
;
}
/**
* 判断存货名称是否存在,如果存在返回编码,否则新增并返回编码
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"存货类型"
,
operType
=
"查询"
,
operDesc
=
"判断存货名称是否存在,如果存在返回编码,否则新增并返回编码"
)
public
EiInfo
checkAndSave
(
EiInfo
inInfo
){
String
inventType
=
inInfo
.
getString
(
"inventType"
);
String
inventName
=
inInfo
.
getString
(
"inventName"
);
List
<
Map
>
list
=
dao
.
query
(
"HPPZ004.queryByCondition"
,
new
HashMap
<
String
,
Object
>(){{
put
(
"inventType"
,
inventType
);
put
(
"inventName"
,
inventName
);
}});
HPPZ004
hppz004
=
new
HPPZ004
();
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
hppz004
.
fromMap
(
list
.
get
(
0
));
if
(
hppz004
.
getDeleteFlag
()==
CommonConstant
.
YesNo
.
YES_1
)
{
hppz004
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
DaoUtils
.
update
(
HPPZ004
.
DELETE_BACK
,
hppz004
);
}
}
else
{
// 生成编码
hppz004
.
setInventCode
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
INVENT_CODE
));
hppz004
.
setInventType
(
Integer
.
parseInt
(
inventType
));
hppz004
.
setInventName
(
inventName
);
hppz004
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
.
intValue
());
DaoUtils
.
insert
(
HPPZ004
.
INSERT
,
hppz004
);
}
inInfo
.
setAttr
(
new
HashMap
(){{
put
(
"inventCode"
,
hppz004
.
getInventCode
());}});
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
return
inInfo
;
}
/**
* 删除操作
...
...
src/main/java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ006.java
View file @
5b393644
...
...
@@ -5,7 +5,6 @@ import com.baosight.hpjx.common.DdynamicEnum;
import
com.baosight.hpjx.common.InitiateModeEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.kc.domain.HPKC010
;
import
com.baosight.hpjx.hp.kc.tools.HPKCTools
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ006
;
...
...
@@ -20,11 +19,9 @@ 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.impl.ServiceBase
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
...
...
@@ -88,7 +85,7 @@ public class ServiceHPPZ006 extends ServiceBase {
fPz006
.
fromMap
(
resultRows
.
get
(
i
));
// 存货名称
fPz006
.
setInventName
(
HPPZTools
.
HpPz004
.
getByCode
(
fPz006
.
getInventCode
()).
getInventName
());
fPz006
.
setSpec
(
HPPZTools
.
jointSpec
(
fPz006
.
getLength
(),
fPz006
.
getWidth
(),
fPz006
.
getThick
()));
fPz006
.
setSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
fPz006
.
getLength
(),
fPz006
.
getWidth
(),
fPz006
.
getThick
()));
DaoUtils
.
insert
(
HPPZ006
.
INSERT
,
fPz006
);
}
inInfo
=
this
.
query
(
inInfo
);
...
...
@@ -141,7 +138,7 @@ public class ServiceHPPZ006 extends ServiceBase {
fPz006
.
fromMap
(
resultRows
.
get
(
i
));
// 存货名称
fPz006
.
setInventName
(
HPPZTools
.
HpPz004
.
getByCode
(
fPz006
.
getInventCode
()).
getInventName
());
fPz006
.
setSpec
(
HPPZTools
.
jointSpec
(
fPz006
.
getLength
(),
fPz006
.
getWidth
(),
fPz006
.
getThick
()));
fPz006
.
setSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
fPz006
.
getLength
(),
fPz006
.
getWidth
(),
fPz006
.
getThick
()));
DaoUtils
.
update
(
HPPZ006
.
UPDATE
,
fPz006
);
}
inInfo
=
this
.
query
(
inInfo
);
...
...
@@ -190,48 +187,6 @@ public class ServiceHPPZ006 extends ServiceBase {
return
inInfo
;
}
/**
* 判断存货档案是否存在,如果存在返回ID,否则新增并返回ID
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"存货档案"
,
operType
=
"查询"
,
operDesc
=
"判断存货档案是否存在,如果存在返回ID,否则新增并返回ID"
)
public
EiInfo
checkAndSave
(
EiInfo
inInfo
){
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
HPPZ006
.
FIELD_INVENT_TYPE
,
inInfo
.
getString
(
"inventType"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
HPPZ006
.
FIELD_INVENT_CODE
,
inInfo
.
getString
(
"inventCode"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
HPPZ006
.
FIELD_INVENT_NAME
,
inInfo
.
getString
(
"inventName"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
HPPZ006
.
FIELD_LENGTH
,
inInfo
.
getString
(
"length"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
HPPZ006
.
FIELD_WIDTH
,
inInfo
.
getString
(
"width"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
HPPZ006
.
FIELD_THICK
,
inInfo
.
getString
(
"thick"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
HPPZ006
.
FIELD_MATERIAL
,
inInfo
.
getString
(
"material"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
HPPZ006
.
FIELD_COEFFICIENT
,
inInfo
.
getString
(
"coefficient"
));
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
HPPZ006
.
FIELD_UNIT
,
inInfo
.
getString
(
"unit"
));
EiInfo
eiInfo
=
super
.
query
(
inInfo
,
"HPPZ006.queryByCondition"
,
new
HPPZ006
());
HPPZ006
hppz006
=
new
HPPZ006
();
if
(
CollectionUtils
.
isNotEmpty
(
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
())){
Map
map
=
(
Map
)
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
().
get
(
0
);
hppz006
.
fromMap
(
map
);
}
else
{
// 生成编码
hppz006
.
setInventType
(
Integer
.
parseInt
(
inInfo
.
getString
(
"inventType"
)));
hppz006
.
setInventCode
(
inInfo
.
getString
(
"inventCode"
));
hppz006
.
setInventName
(
inInfo
.
getString
(
"inventName"
));
hppz006
.
setLength
(
new
BigDecimal
(
inInfo
.
getString
(
"length"
)));
hppz006
.
setWidth
(
new
BigDecimal
(
inInfo
.
getString
(
"width"
)));
hppz006
.
setThick
(
new
BigDecimal
(
inInfo
.
getString
(
"thick"
)));
hppz006
.
setMaterial
(
inInfo
.
getString
(
"material"
));
hppz006
.
setCoefficient
(
new
BigDecimal
(
inInfo
.
getString
(
"coefficient"
)));
hppz006
.
setUnit
(
inInfo
.
getString
(
"unit"
));
hppz006
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
.
intValue
());
hppz006
.
setSpec
(
HPPZTools
.
jointSpec
(
hppz006
.
getLength
(),
hppz006
.
getWidth
(),
hppz006
.
getThick
()));
DaoUtils
.
insert
(
HPPZ006
.
INSERT
,
hppz006
);
}
inInfo
.
setAttr
(
new
HashMap
(){{
put
(
"obj"
,
hppz006
);}});
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
return
inInfo
;
}
/**
* 规格下拉框
*
...
...
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ004.xml
View file @
5b393644
...
...
@@ -36,15 +36,21 @@
<isNotEmpty
prepend=
" AND "
property=
"inventCode"
>
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventName"
>
INVENT_NAME LIKE CONCAT('%', #inventName#, '%')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"status"
>
STATUS = #status#
</isNotEmpty>
</sql>
<sql
id=
"getCondition"
>
<isNotEmpty
prepend=
" AND "
property=
"inventName"
>
INVENT_NAME = #inventName#
</isNotEmpty>
</sql>
<sql
id=
"customCondition"
>
<isNotEmpty
prepend=
" AND "
property=
"inventName"
>
INVENT_NAME LIKE CONCAT('%', #inventName#, '%')
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventTypes"
>
INVENT_TYPE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"inventTypes"
>
#inventTypes[]#
</iterate>
</isNotEmpty>
...
...
@@ -73,6 +79,15 @@
<include
refid=
"order"
/>
</select>
<select
id=
"get"
resultClass=
"com.baosight.hpjx.hp.pz.domain.HPPZ004"
>
SELECT
<include
refid=
"column"
/>
FROM hpjx.t_hppz004 WHERE 1=1
<include
refid=
"condition"
/>
<include
refid=
"getCondition"
/>
<include
refid=
"order"
/>
</select>
<select
id=
"queryByCondition"
resultClass=
"java.util.HashMap"
>
SELECT
<include
refid=
"column"
/>
...
...
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ006.xml
View file @
5b393644
...
...
@@ -45,6 +45,24 @@
<isNotEmpty
prepend=
" AND "
property=
"inventName"
>
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotNull
prepend=
" AND "
property=
"length"
>
LENGTH = #length#
</isNotNull>
<isNotNull
prepend=
" AND "
property=
"width"
>
WIDTH = #width#
</isNotNull>
<isNotNull
prepend=
" AND "
property=
"thick"
>
THICK = #thick#
</isNotNull>
<isNotNull
prepend=
" AND "
property=
"material"
>
MATERIAL = #material#
</isNotNull>
<isNotNull
prepend=
" AND "
property=
"coefficient"
>
COEFFICIENT = #coefficient#
</isNotNull>
<isNotNull
prepend=
" AND "
property=
"unit"
>
UNIT = #unit#
</isNotNull>
<isNotEmpty
prepend=
" AND "
property=
"status"
>
STATUS = #status#
</isNotEmpty>
...
...
@@ -53,6 +71,10 @@
</isNotNull>
</sql>
<sql
id=
"getCondition"
>
</sql>
<sql
id=
"customCondition"
>
<isNotEmpty
prepend=
" AND "
property=
"inventTypes"
>
INVENT_TYPE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"inventTypes"
>
#inventTypes[]#
</iterate>
...
...
src/main/java/com/baosight/hpjx/hp/pz/tools/HPPZTools.java
View file @
5b393644
...
...
@@ -3,6 +3,8 @@ package com.baosight.hpjx.hp.pz.tools;
import
com.baosight.hpjx.common.InventTypeEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoBase
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.constant.HPSqlConstant
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ004
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ006
;
...
...
@@ -10,19 +12,14 @@ import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import
com.baosight.hpjx.hp.pz.domain.HPPZ009
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ011
;
import
com.baosight.hpjx.util.AssertUtils
;
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
org.apache.commons.lang.StringUtils
;
import
org.springframework.util.CollectionUtils
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -134,58 +131,38 @@ public class HPPZTools {
}
return
pz004s
.
stream
().
collect
(
Collectors
.
toMap
(
HPPZ004:
:
getInventCode
,
item
->
item
));
}
}
/**
* HPPZ006 公共DAO定义
*
* @author:songx
* @date:2024/2/6,13:37
*/
public
static
class
HpPz006
{
/**
*
查询
*
判断存货名称是否存在,如果存在返回编码,否则新增并返回编码
*
* @param i
d
* @
return
* @param i
nventType 存货类型
* @
param inventName 存货名称
*/
public
static
HPPZ006
get
(
Long
id
)
{
AssertUtils
.
isNull
(
id
,
"仓库编码不能为空"
);
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
(
"id"
,
id
);
List
<
HPPZ006
>
results
=
DaoBase
.
getInstance
().
query
(
HPPZ006
.
QUERY
,
queryMap
);
AssertUtils
.
isNull
(
results
,
String
.
format
(
"规格[%s]不存在"
,
id
));
return
results
.
get
(
0
);
}
/**
* 计算单重
*
* @param id
* @return
*/
public
static
BigDecimal
calcUnitWeight
(
Long
id
)
{
HPPZ006
dbPz006
=
get
(
id
);
if
((
dbPz006
.
getLength
()
==
null
&&
dbPz006
.
getWidth
()
==
null
&&
dbPz006
.
getThick
()
==
null
)
||
dbPz006
.
getCoefficient
()
==
null
)
{
return
BigDecimal
.
ZERO
;
}
BigDecimal
unitWeight
=
BigDecimal
.
ONE
;
// 长
if
(
dbPz006
.
getLength
()
!=
null
)
{
unitWeight
=
unitWeight
.
multiply
(
dbPz006
.
getLength
());
}
// 宽
if
(
dbPz006
.
getWidth
()
!=
null
)
{
unitWeight
=
unitWeight
.
multiply
(
dbPz006
.
getWidth
());
queryMap
.
put
(
"inventType"
,
inventType
);
queryMap
.
put
(
"inventName"
,
inventName
);
List
<
HPPZ004
>
dbPz004s
=
DaoBase
.
getInstance
().
query
(
"HPPZ004.get"
,
queryMap
);
if
(
CollectionUtils
.
isNotEmpty
(
dbPz004s
))
{
HPPZ004
dbPz004
=
dbPz004s
.
get
(
0
);
if
(
CommonConstant
.
YesNo
.
YES_1
.
equals
(
dbPz004
.
getDeleteFlag
()))
{
dbPz004
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
NO_0
);
DaoUtils
.
update
(
HPPZ004
.
DELETE_BACK
,
dbPz004
);
}
return
dbPz004
.
getInventCode
();
}
else
{
// 生成编码
HPPZ004
newPz004
=
new
HPPZ004
();
newPz004
.
setInventCode
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
INVENT_CODE
));
newPz004
.
setInventType
(
inventType
);
newPz004
.
setInventName
(
inventName
);
newPz004
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
);
DaoUtils
.
insert
(
HPPZ004
.
INSERT
,
newPz004
);
return
newPz004
.
getInventCode
();
}
// 厚
if
(
dbPz006
.
getThick
()
!=
null
)
{
unitWeight
=
unitWeight
.
multiply
(
dbPz006
.
getThick
());
}
// 乘以系数
return
unitWeight
.
multiply
(
dbPz006
.
getCoefficient
()).
setScale
(
3
,
RoundingMode
.
HALF_UP
);
}
}
...
...
@@ -282,89 +259,130 @@ public class HPPZTools {
}
/**
* 拼接规格
* @param length
* @param width
* @param thick
* @return
*/
public
static
String
jointSpec
(
BigDecimal
length
,
BigDecimal
width
,
BigDecimal
thick
)
{
StringBuffer
sb
=
new
StringBuffer
();
if
(
length
!=
null
&&
length
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
sb
.
append
(
length
.
toString
());
sb
.
append
(
"*"
);
}
if
(
width
!=
null
&&
width
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
sb
.
append
(
width
.
toString
());
sb
.
append
(
"*"
);
}
if
(
thick
!=
null
&&
thick
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
sb
.
append
(
thick
.
toString
());
}
return
sb
.
toString
();
}
/**
* 判断存货名称是否存在,如果存在返回编码,否则新增并返回编码
* @param inventType 存货类型
* @param inventName 存货名称
* HPPZ006 公共DAO定义
*
* @author:songx
* @date:2024/2/6,13:37
*/
public
static
String
checkAndSavePZ04
(
Integer
inventType
,
String
inventName
)
{
if
(
Objects
.
isNull
(
inventType
)){
throw
new
PlatException
(
"存货类型不能为空!"
);
}
if
(
Objects
.
isNull
(
InventTypeEnum
.
getEnumByCode
(
inventType
))){
throw
new
PlatException
(
"存货类型异常!"
);
public
static
class
HpPz006
{
/**
* 查询
*
* @param id
* @return
*/
public
static
HPPZ006
get
(
Long
id
)
{
AssertUtils
.
isNull
(
id
,
"仓库编码不能为空"
);
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"id"
,
id
);
List
<
HPPZ006
>
results
=
DaoBase
.
getInstance
().
query
(
HPPZ006
.
QUERY
,
queryMap
);
AssertUtils
.
isNull
(
results
,
String
.
format
(
"规格[%s]不存在"
,
id
));
return
results
.
get
(
0
);
}
if
(
StringUtils
.
isBlank
(
inventName
)){
throw
new
PlatException
(
"存货名称不能为空!"
);
/**
* 计算单重
*
* @param id
* @return
*/
public
static
BigDecimal
calcUnitWeight
(
Long
id
)
{
HPPZ006
dbPz006
=
get
(
id
);
return
calcUnitWeight
(
dbPz006
);
}
EiInfo
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inventType"
,
inventType
);
inInfo
.
set
(
"inventName"
,
inventName
);
inInfo
.
set
(
EiConstant
.
serviceName
,
"HPPZ004"
);
inInfo
.
set
(
EiConstant
.
methodName
,
"checkAndSave"
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
return
outInfo
.
getAttr
().
get
(
"inventCode"
).
toString
();
}
/**
* 判断存货档案是否存在,如果存在返回存货档案,否则新增并返回存货档案
* @param inventType 存货类型
* @param inventName 存货名称
* @param length 长
* @param width 宽
* @param thick 厚
* @param coefficient 系数
* @param material 材质
* @param unit 单位
*/
public
static
HPPZ006
checkAndSavePZ06
(
Integer
inventType
,
String
inventName
,
BigDecimal
length
,
BigDecimal
width
,
BigDecimal
thick
,
BigDecimal
coefficient
,
String
material
,
String
unit
)
{
if
(
Objects
.
isNull
(
inventType
)){
throw
new
PlatException
(
"存货类型不能为空!"
);
/**
* 计算单重
*
* @param dbPz006
* @return
*/
public
static
BigDecimal
calcUnitWeight
(
HPPZ006
dbPz006
)
{
if
((
dbPz006
.
getLength
()
==
null
&&
dbPz006
.
getWidth
()
==
null
&&
dbPz006
.
getThick
()
==
null
)
||
dbPz006
.
getCoefficient
()
==
null
)
{
return
BigDecimal
.
ZERO
;
}
BigDecimal
unitWeight
=
BigDecimal
.
ONE
;
// 长
if
(
dbPz006
.
getLength
()
!=
null
)
{
unitWeight
=
unitWeight
.
multiply
(
dbPz006
.
getLength
());
}
// 宽
if
(
dbPz006
.
getWidth
()
!=
null
)
{
unitWeight
=
unitWeight
.
multiply
(
dbPz006
.
getWidth
());
}
// 厚
if
(
dbPz006
.
getThick
()
!=
null
)
{
unitWeight
=
unitWeight
.
multiply
(
dbPz006
.
getThick
());
}
// 乘以系数
return
unitWeight
.
multiply
(
dbPz006
.
getCoefficient
()).
setScale
(
3
,
RoundingMode
.
HALF_UP
);
}
if
(
Objects
.
isNull
(
InventTypeEnum
.
getEnumByCode
(
inventType
))){
throw
new
PlatException
(
"存货类型异常!"
);
/**
* 拼接规格
* @param length
* @param width
* @param thick
* @return
*/
public
static
String
jointSpec
(
BigDecimal
length
,
BigDecimal
width
,
BigDecimal
thick
)
{
StringBuffer
sb
=
new
StringBuffer
();
if
(
length
!=
null
&&
length
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
sb
.
append
(
length
);
sb
.
append
(
"*"
);
}
if
(
width
!=
null
&&
width
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
sb
.
append
(
width
);
sb
.
append
(
"*"
);
}
if
(
thick
!=
null
&&
thick
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
sb
.
append
(
thick
);
}
return
sb
.
toString
();
}
if
(
StringUtils
.
isBlank
(
inventName
)){
throw
new
PlatException
(
"存货名称不能为空!"
);
/**
* 判断存货档案是否存在,如果存在返回存货档案,否则新增并返回存货档案
*
* @param inventType 存货类型
* @param inventName 存货名称
* @param length 长
* @param width 宽
* @param thick 厚
* @param coefficient 系数
* @param material 材质
* @param unit 单位
*/
public
static
HPPZ006
checkAndSave
(
Integer
inventType
,
String
inventName
,
BigDecimal
length
,
BigDecimal
width
,
BigDecimal
thick
,
BigDecimal
coefficient
,
String
material
,
String
unit
)
{
// 检查存货名称是否存在
String
inventCode
=
HPPZTools
.
HpPz004
.
checkAndSave
(
inventType
,
inventName
);
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"inventType"
,
inventType
);
queryMap
.
put
(
"inventCode"
,
inventCode
);
queryMap
.
put
(
"inventName"
,
inventName
);
queryMap
.
put
(
"length"
,
length
);
queryMap
.
put
(
"width"
,
width
);
queryMap
.
put
(
"thick"
,
thick
);
queryMap
.
put
(
"material"
,
material
);
queryMap
.
put
(
"coefficient"
,
coefficient
);
queryMap
.
put
(
"unit"
,
unit
);
List
<
HPPZ006
>
dbPz006s
=
DaoBase
.
getInstance
().
query
(
HPPZ006
.
QUERY
,
queryMap
);
if
(
CollectionUtils
.
isNotEmpty
(
dbPz006s
))
{
return
dbPz006s
.
get
(
0
);
}
else
{
// 生成编码
HPPZ006
newPz006
=
new
HPPZ006
();
newPz006
.
fromMap
(
queryMap
);
newPz006
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
.
intValue
());
newPz006
.
setSpec
(
jointSpec
(
newPz006
.
getLength
(),
newPz006
.
getWidth
(),
newPz006
.
getThick
()));
DaoUtils
.
insert
(
HPPZ006
.
INSERT
,
newPz006
);
return
newPz006
;
}
}
EiInfo
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inventType"
,
inventType
);
inInfo
.
set
(
"inventCode"
,
checkAndSavePZ04
(
inventType
,
inventName
));
inInfo
.
set
(
"inventName"
,
inventName
);
inInfo
.
set
(
"length"
,
length
);
inInfo
.
set
(
"width"
,
width
);
inInfo
.
set
(
"thick"
,
thick
);
inInfo
.
set
(
"material"
,
material
);
inInfo
.
set
(
"coefficient"
,
coefficient
);
inInfo
.
set
(
"unit"
,
unit
);
inInfo
.
set
(
EiConstant
.
serviceName
,
"HPPZ006"
);
inInfo
.
set
(
EiConstant
.
methodName
,
"checkAndSave"
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
return
(
HPPZ006
)
outInfo
.
getAttr
().
get
(
"obj"
);
}
}
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC002.java
View file @
5b393644
...
...
@@ -99,11 +99,11 @@ public class ServiceHPSC002 extends ServiceBase {
// if (StringUtils.isNotEmpty(hppz002.getPrdtCode()) && !hppz002.getParentId().equals("root")) {
// hppz002.setPrdtName(HPPZTools.getPz004ByCode(hppz002.getPrdtCode()).getInventName());
// }
hppz002
.
setSpec
(
HPPZTools
.
jointSpec
(
hppz002
.
getLength
(),
hppz002
.
getWidth
(),
hppz002
.
getThick
()));
hppz002
.
setSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
hppz002
.
getLength
(),
hppz002
.
getWidth
(),
hppz002
.
getThick
()));
if
(
hppz002
.
getParentId
().
equals
(
"root"
)){
hppz002
.
setLv
(
new
Integer
(
1
));
}
else
{
hppz002
.
setPrdtCode
(
HPPZTools
.
checkAndSavePZ04
(
hppz002
.
getPrdtType
(),
hppz002
.
getPrdtName
()));
hppz002
.
setPrdtCode
(
HPPZTools
.
HpPz004
.
checkAndSave
(
hppz002
.
getPrdtType
(),
hppz002
.
getPrdtName
()));
Integer
lv
=
(
Integer
)
this
.
dao
.
get
(
"HPSC002.queryLv"
,
"id"
,
hppz002
.
getParentId
());
hppz002
.
setLv
(
lv
.
intValue
()+
1
);
}
...
...
@@ -171,7 +171,7 @@ public class ServiceHPSC002 extends ServiceBase {
hpsc005
.
setPrdtLength
(
hppz002
.
getLength
());
hpsc005
.
setPrdtWidth
(
hppz002
.
getWidth
());
hpsc005
.
setPrdtThick
(
hppz002
.
getThick
());
hpsc005
.
setPrdtSpec
(
HPPZTools
.
jointSpec
(
hpsc005
.
getPrdtLength
(),
hpsc005
.
getPrdtWidth
(),
hpsc005
.
getPrdtThick
()));
hpsc005
.
setPrdtSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
hpsc005
.
getPrdtLength
(),
hpsc005
.
getPrdtWidth
(),
hpsc005
.
getPrdtThick
()));
DaoUtils
.
update
(
"HPSC005.update"
,
hpsc005
.
toMap
());
}
}
...
...
@@ -210,7 +210,7 @@ public class ServiceHPSC002 extends ServiceBase {
HPSC005
.
setNum
(
hppz002
.
getNum
());
HPSC005
.
setUnitWt
(
hppz002
.
getUnitWt
());
HPSC005
.
setTotalWt
(
hppz002
.
getTotalWt
());
HPSC005
.
setPartSpec
(
HPPZTools
.
jointSpec
(
HPSC005
.
getPartLength
(),
HPSC005
.
getPartWidth
(),
HPSC005
.
getPartThick
()));
HPSC005
.
setPartSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
HPSC005
.
getPartLength
(),
HPSC005
.
getPartWidth
(),
HPSC005
.
getPartThick
()));
DaoUtils
.
update
(
"HPSC005.update"
,
HPSC005
.
toMap
());
}
}
else
{
...
...
@@ -243,7 +243,7 @@ public class ServiceHPSC002 extends ServiceBase {
BigDecimal
totalWt
=
new
BigDecimal
(
decimalFormat
.
format
(
Math
.
round
(
num
.
multiply
(
unitWt
).
floatValue
())));
hppz002
.
setDelStatus
(
CommonConstant
.
YesNo
.
NO_0
.
intValue
());
hppz002
.
setTotalWt
(
totalWt
);
hppz002
.
setSpec
(
HPPZTools
.
jointSpec
(
hppz002
.
getLength
(),
hppz002
.
getWidth
(),
hppz002
.
getThick
()));
hppz002
.
setSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
hppz002
.
getLength
(),
hppz002
.
getWidth
(),
hppz002
.
getThick
()));
DaoUtils
.
update
(
"HPSC002.update"
,
hppz002
.
toMap
());
}
...
...
@@ -251,7 +251,7 @@ public class ServiceHPSC002 extends ServiceBase {
HPSC003
.
setLength
(
hppz002
.
getLength
());
HPSC003
.
setWidth
(
hppz002
.
getWidth
());
HPSC003
.
setThick
(
hppz002
.
getThick
());
HPSC003
.
setSpec
(
HPPZTools
.
jointSpec
(
HPSC003
.
getLength
(),
HPSC003
.
getWidth
(),
HPSC003
.
getThick
()));
HPSC003
.
setSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
HPSC003
.
getLength
(),
HPSC003
.
getWidth
(),
HPSC003
.
getThick
()));
DaoUtils
.
update
(
"HPSC003.update"
,
HPSC003
.
toMap
());
}
...
...
@@ -262,7 +262,7 @@ public class ServiceHPSC002 extends ServiceBase {
HPSC004
.
setNum
(
hppz002
.
getNum
());
HPSC004
.
setUnitWt
(
hppz002
.
getUnitWt
());
HPSC004
.
setTotalWt
(
hppz002
.
getTotalWt
());
HPSC004
.
setSpec
(
HPPZTools
.
jointSpec
(
HPSC004
.
getLength
(),
HPSC004
.
getWidth
(),
HPSC004
.
getThick
()));
HPSC004
.
setSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
HPSC004
.
getLength
(),
HPSC004
.
getWidth
(),
HPSC004
.
getThick
()));
DaoUtils
.
update
(
"HPSC004.update"
,
HPSC004
.
toMap
());
}
...
...
src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC006.java
View file @
5b393644
...
...
@@ -106,13 +106,13 @@ public class ServiceHPSC006 extends ServiceBase {
BigDecimal
unitWt
=
HPSC006
.
getUnitWt
();
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"#.000"
);
BigDecimal
totalWt
=
new
BigDecimal
(
decimalFormat
.
format
(
Math
.
round
(
num
.
multiply
(
unitWt
).
floatValue
())));
HPSC006
.
setInventSpec
(
HPPZTools
.
jointSpec
(
HPSC006
.
getInventLength
(),
HPSC006
.
getInventWidth
(),
HPSC006
.
getInventThick
()));
HPSC006
.
setInventSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
HPSC006
.
getInventLength
(),
HPSC006
.
getInventWidth
(),
HPSC006
.
getInventThick
()));
HPSC006
.
setProjCode
(
projCode
);
HPSC006
.
setProjName
(
projName
);
HPSC006
.
setProductionOrderNo
(
productionOrderNo
);
HPSC006
.
setStatus
(
CommonConstant
.
YesNo
.
NO_0
.
intValue
());
HPSC006
.
setTotalWt
(
totalWt
);
HPSC006
.
setInventCode
(
HPPZTools
.
checkAndSavePZ04
(
HPSC006
.
getInventType
(),
HPSC006
.
getInventName
()));
HPSC006
.
setInventCode
(
HPPZTools
.
HpPz004
.
checkAndSave
(
HPSC006
.
getInventType
(),
HPSC006
.
getInventName
()));
if
(
HPSC006
.
getFactoryCode
()!=
null
&&
!(
HPSC006
.
getFactoryCode
().
equals
(
" "
)))
{
AssertUtils
.
isEmpty
(
HPSC006
.
getOrgNo
(),
"已选择厂区,下料组不能为空"
);
HPSC006
.
setStatus
(
1
);
...
...
@@ -152,12 +152,12 @@ public class ServiceHPSC006 extends ServiceBase {
BigDecimal
unitWt
=
HPSC006
.
getUnitWt
();
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"#.000"
);
BigDecimal
totalWt
=
new
BigDecimal
(
decimalFormat
.
format
(
Math
.
round
(
num
.
multiply
(
unitWt
).
floatValue
())));
HPSC006
.
setInventSpec
(
HPPZTools
.
jointSpec
(
HPSC006
.
getInventLength
(),
HPSC006
.
getInventWidth
(),
HPSC006
.
getInventThick
()));
HPSC006
.
setInventSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
HPSC006
.
getInventLength
(),
HPSC006
.
getInventWidth
(),
HPSC006
.
getInventThick
()));
HPSC006
.
setProjCode
(
projCode
);
HPSC006
.
setProjName
(
projName
);
HPSC006
.
setProductionOrderNo
(
productionOrderNo
);
HPSC006
.
setTotalWt
(
totalWt
);
HPSC006
.
setInventCode
(
HPPZTools
.
checkAndSavePZ04
(
HPSC006
.
getInventType
(),
HPSC006
.
getInventName
()));
HPSC006
.
setInventCode
(
HPPZTools
.
HpPz004
.
checkAndSave
(
HPSC006
.
getInventType
(),
HPSC006
.
getInventName
()));
DaoUtils
.
update
(
"HPSC006.update"
,
HPSC006
);
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
...
...
src/main/java/com/baosight/hpjx/util/ExcelUtils.java
View file @
5b393644
...
...
@@ -282,8 +282,8 @@ public class ExcelUtils {
HPSC002
.
setDelStatus
(
CommonConstant
.
YesNo
.
NO_0
.
intValue
());
HPSC002
.
setStatus
(
CommonConstant
.
YesNo
.
NO_0
.
intValue
());
HPSC002
.
setTotalWt
(
totalWt
);
HPSC002
.
setSpec
(
HPPZTools
.
jointSpec
(
HPSC002
.
getLength
(),
HPSC002
.
getWidth
(),
HPSC002
.
getThick
()));
HPSC002
.
setPrdtCode
(
HPPZTools
.
checkAndSavePZ04
(
HPSC002
.
getPrdtType
(),
HPSC002
.
getPrdtName
()));
HPSC002
.
setSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
HPSC002
.
getLength
(),
HPSC002
.
getWidth
(),
HPSC002
.
getThick
()));
HPSC002
.
setPrdtCode
(
HPPZTools
.
HpPz004
.
checkAndSave
(
HPSC002
.
getPrdtType
(),
HPSC002
.
getPrdtName
()));
if
(!
checkStatus
)
{
checkOkBlock
.
addRow
(
HPSC002
.
toMap
());
}
...
...
@@ -317,10 +317,10 @@ public class ExcelUtils {
BigDecimal
unitWt
=
HPSC006
.
getUnitWt
();
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"#.000"
);
BigDecimal
totalWt
=
new
BigDecimal
(
decimalFormat
.
format
(
Math
.
round
(
num
.
multiply
(
unitWt
).
floatValue
())));
HPSC006
.
setInventSpec
(
HPPZTools
.
jointSpec
(
HPSC006
.
getInventLength
(),
HPSC006
.
getInventWidth
(),
HPSC006
.
getInventThick
()));
HPSC006
.
setInventSpec
(
HPPZTools
.
HpPz006
.
jointSpec
(
HPSC006
.
getInventLength
(),
HPSC006
.
getInventWidth
(),
HPSC006
.
getInventThick
()));
HPSC006
.
setStatus
(
CommonConstant
.
YesNo
.
NO_0
.
intValue
());
HPSC006
.
setTotalWt
(
totalWt
);
HPSC006
.
setInventCode
(
HPPZTools
.
checkAndSavePZ04
(
HPSC006
.
getInventType
(),
HPSC006
.
getInventName
()));
HPSC006
.
setInventCode
(
HPPZTools
.
HpPz004
.
checkAndSave
(
HPSC006
.
getInventType
(),
HPSC006
.
getInventName
()));
if
(!
checkStatus
)
{
checkOkBlock
.
addRow
(
HPSC006
.
toMap
());
}
...
...
src/main/webapp/HP/KC/HPKC006.jsp
View file @
5b393644
...
...
@@ -56,7 +56,7 @@
<EF:EFColumn
ename=
"inventCode"
cname=
"存货名称"
width=
"120"
align=
"center"
required=
"true"
readonly=
"true"
hidden=
"true"
/>
<EF:EFColumn
ename=
"inventName"
cname=
"存货名称"
width=
"120"
align=
"center"
required=
"true"
readonly=
"true"
/>
<EF:EFColumn
ename=
"inventRecordId"
cname=
"规格"
width=
"120"
align=
"center"
required=
"
fals
e"
readonly=
"true"
/>
<EF:EFColumn
ename=
"inventRecordId"
cname=
"规格"
width=
"120"
align=
"center"
required=
"
tru
e"
readonly=
"true"
/>
<EF:EFColumn
ename=
"amount"
cname=
"数量"
format=
"{0:N3}"
maxLength=
"20"
width=
"100"
align=
"right"
sumType=
"all"
required=
"true"
readonly=
"true"
/>
<EF:EFColumn
ename=
"unitWeight"
cname=
"单重"
enable=
"false"
width=
"100"
align=
"right"
format=
"{0:N3}"
/>
...
...
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