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
f1faf702
Commit
f1faf702
authored
Jan 30, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
判断存货档案是否存在,如果存在返回存货档案,否则新增并返回存货档案
parent
39e7a7cd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
137 additions
and
6 deletions
+137
-6
ServiceHPPZ006.java
.../java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ006.java
+63
-5
HPPZ004.xml
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ004.xml
+3
-0
HPPZ006.xml
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ006.xml
+39
-0
HPPZTools.java
src/main/java/com/baosight/hpjx/hp/pz/tools/HPPZTools.java
+32
-1
No files found.
src/main/java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ006.java
View file @
f1faf702
...
@@ -2,7 +2,10 @@ package com.baosight.hpjx.hp.pz.service;
...
@@ -2,7 +2,10 @@ package com.baosight.hpjx.hp.pz.service;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.InitiateModeEnum
;
import
com.baosight.hpjx.common.InitiateModeEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ004
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ006
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ006
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.util.AssertUtils
;
import
com.baosight.hpjx.util.AssertUtils
;
...
@@ -14,13 +17,12 @@ import com.baosight.iplat4j.core.ei.EiConstant;
...
@@ -14,13 +17,12 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
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
org.apache.commons.lang.StringUtils
;
import
java.util.ArrayList
;
import
java.math.BigDecimal
;
import
java.util.Arrays
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author:songx
* @author:songx
...
@@ -156,6 +158,62 @@ public class ServiceHPPZ006 extends ServiceBase {
...
@@ -156,6 +158,62 @@ public class ServiceHPPZ006 extends ServiceBase {
return
inInfo
;
return
inInfo
;
}
}
/**
* 判断存货档案是否存在,如果存在返回ID,否则新增并返回ID
* @param inInfo
* @return
*/
public
EiInfo
checkAndSave
(
EiInfo
inInfo
){
String
inventType
=
inInfo
.
getString
(
"inventType"
);
String
inventCode
=
inInfo
.
getString
(
"inventCode"
);
String
inventName
=
inInfo
.
getString
(
"inventName"
);
String
length
=
inInfo
.
getString
(
"length"
);
String
width
=
inInfo
.
getString
(
"width"
);
String
thick
=
inInfo
.
getString
(
"thick"
);
String
material
=
inInfo
.
getString
(
"material"
);
String
coefficient
=
inInfo
.
getString
(
"coefficient"
);
String
unit
=
inInfo
.
getString
(
"unit"
);
List
<
Map
>
list
=
dao
.
query
(
"HPPZ006.queryByCondition"
,
new
HashMap
<
String
,
Object
>(){{
put
(
"inventType"
,
inventType
);
put
(
"inventCode"
,
inventCode
);
put
(
"inventName"
,
inventName
);
put
(
"length"
,
Objects
.
nonNull
(
length
)?
length:
""
);
put
(
"width"
,
Objects
.
nonNull
(
width
)?
width:
""
);
put
(
"thick"
,
Objects
.
nonNull
(
thick
)?
thick:
""
);
put
(
"material"
,
Objects
.
nonNull
(
material
)?
material:
""
);
put
(
"coefficient"
,
Objects
.
nonNull
(
coefficient
)?
coefficient:
""
);
put
(
"unit"
,
Objects
.
nonNull
(
unit
)?
unit:
""
);
}});
HPPZ006
hppz006
=
new
HPPZ006
();
if
(
CollectionUtils
.
isEmpty
(
list
)){
hppz006
.
fromMap
(
list
.
get
(
0
));
}
else
{
// 生成编码
hppz006
.
setInventType
(
Integer
.
parseInt
(
inventType
));
hppz006
.
setInventCode
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
INVENT_CODE
));
hppz006
.
setInventName
(
inventName
);
hppz006
.
setLength
(
new
BigDecimal
(
length
));
hppz006
.
setWidth
(
new
BigDecimal
(
width
));
hppz006
.
setThick
(
new
BigDecimal
(
thick
));
hppz006
.
setMaterial
(
material
);
hppz006
.
setCoefficient
(
new
BigDecimal
(
coefficient
));
hppz006
.
setUnit
(
unit
);
hppz006
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
.
intValue
());
StringBuffer
sepbuf
=
new
StringBuffer
();
if
(
Objects
.
nonNull
(
length
)){
sepbuf
.
append
(
length
).
append
(
"*"
);}
if
(
Objects
.
nonNull
(
width
)){
sepbuf
.
append
(
width
).
append
(
"*"
);}
if
(
Objects
.
nonNull
(
thick
)){
sepbuf
.
append
(
thick
);}
if
(
StringUtils
.
isNotEmpty
(
sepbuf
.
toString
())){
hppz006
.
setSpec
(
sepbuf
.
toString
());
}
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 @
f1faf702
...
@@ -76,6 +76,9 @@
...
@@ -76,6 +76,9 @@
SELECT
SELECT
<include
refid=
"column"
/>
<include
refid=
"column"
/>
FROM hpjx.t_hppz004 WHERE 1=1
FROM hpjx.t_hppz004 WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventType"
>
<isNotEmpty
prepend=
" AND "
property=
"inventType"
>
INVENT_TYPE = #inventType#
INVENT_TYPE = #inventType#
</isNotEmpty>
</isNotEmpty>
...
...
src/main/java/com/baosight/hpjx/hp/pz/sql/HPPZ006.xml
View file @
f1faf702
...
@@ -79,6 +79,45 @@
...
@@ -79,6 +79,45 @@
<include
refid=
"order"
/>
<include
refid=
"order"
/>
</select>
</select>
<select
id=
"queryByCondition"
resultClass=
"java.util.HashMap"
>
SELECT
<include
refid=
"column"
/>
FROM hpjx.t_hppz006 WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
</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>
<isNotNull
prepend=
" AND "
property=
"length"
>
IFNULL(LENGTH,'') = #length#
</isNotNull>
<isNotNull
prepend=
" AND "
property=
"width"
>
IFNULL(WIDTH,'') = #width#
</isNotNull>
<isNotNull
prepend=
" AND "
property=
"thick"
>
IFNULL(THICK,'') = #thick#
</isNotNull>
<isNotNull
prepend=
" AND "
property=
"material"
>
IFNULL(MATERIAL,'') = #material#
</isNotNull>
<isNotNull
prepend=
" AND "
property=
"coefficient"
>
IFNULL(COEFFICIENT,'') = #coefficient#
</isNotNull>
<isNotNull
prepend=
" AND "
property=
"unit"
>
IFNULL(UNIT,'') = #unit#
</isNotNull>
<isNotEmpty
prepend=
" AND "
property=
"status"
>
STATUS = #status#
</isNotEmpty>
</select>
<select
id=
"count"
resultClass=
"int"
>
<select
id=
"count"
resultClass=
"int"
>
SELECT COUNT(*) FROM hpjx.t_hppz006 WHERE 1=1
SELECT COUNT(*) FROM hpjx.t_hppz006 WHERE 1=1
<include
refid=
"condition"
/>
<include
refid=
"condition"
/>
...
...
src/main/java/com/baosight/hpjx/hp/pz/tools/HPPZTools.java
View file @
f1faf702
...
@@ -3,6 +3,7 @@ package com.baosight.hpjx.hp.pz.tools;
...
@@ -3,6 +3,7 @@ package com.baosight.hpjx.hp.pz.tools;
import
com.baosight.hpjx.common.InventTypeEnum
;
import
com.baosight.hpjx.common.InventTypeEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoBase
;
import
com.baosight.hpjx.core.dao.DaoBase
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ006
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ007
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ007
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ009
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ009
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ004
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ004
;
...
@@ -167,5 +168,35 @@ public class HPPZTools {
...
@@ -167,5 +168,35 @@ public class HPPZTools {
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
return
outInfo
.
getAttr
().
get
(
"inventCode"
).
toString
();
return
outInfo
.
getAttr
().
get
(
"inventCode"
).
toString
();
}
}
/**
* 判断存货档案是否存在,如果存在返回存货档案,否则新增并返回存货档案
* @param inventType
* @param inventName
*/
public
static
HPPZ006
checkAndSavePZ06
(
Integer
inventType
,
String
inventCode
,
String
inventName
,
BigDecimal
length
,
BigDecimal
width
,
BigDecimal
thick
,
BigDecimal
coefficient
,
String
unit
)
{
if
(
Objects
.
isNull
(
inventType
)){
throw
new
PlatException
(
"存货类型不能为空!"
);
}
if
(
Objects
.
isNull
(
InventTypeEnum
.
getEnumByCode
(
inventType
))){
throw
new
PlatException
(
"存货类型异常!"
);
}
if
(
StringUtils
.
isBlank
(
inventName
)){
throw
new
PlatException
(
"存货名称不能为空!"
);
}
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
(
"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"
);
}
}
}
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