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
15b4e566
Commit
15b4e566
authored
Jan 31, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
产品库存接口
parent
b711bbf5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
656 additions
and
13 deletions
+656
-13
InventTypeEnum.java
src/main/java/com/baosight/hpjx/common/InventTypeEnum.java
+4
-0
HPSqlConstant.java
...ain/java/com/baosight/hpjx/hp/constant/HPSqlConstant.java
+12
-0
HPKC011.java
src/main/java/com/baosight/hpjx/hp/kc/domain/HPKC011.java
+0
-0
ServiceHPKC011.java
.../java/com/baosight/hpjx/hp/kc/service/ServiceHPKC011.java
+238
-0
HPKC011.xml
src/main/java/com/baosight/hpjx/hp/kc/sql/HPKC011.xml
+183
-0
HPKCTools.java
src/main/java/com/baosight/hpjx/hp/kc/tools/HPKCTools.java
+70
-0
ServiceHPPZ006.java
.../java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ006.java
+1
-7
HPPZTools.java
src/main/java/com/baosight/hpjx/hp/pz/tools/HPPZTools.java
+4
-4
CommonMethod.java
src/main/java/com/baosight/hpjx/util/CommonMethod.java
+2
-2
HPKC011.js
src/main/webapp/HP/KC/HPKC011.js
+85
-0
HPKC011.jsp
src/main/webapp/HP/KC/HPKC011.jsp
+57
-0
No files found.
src/main/java/com/baosight/hpjx/common/InventTypeEnum.java
View file @
15b4e566
...
@@ -58,6 +58,10 @@ public enum InventTypeEnum {
...
@@ -58,6 +58,10 @@ public enum InventTypeEnum {
this
.
value
=
value
;
this
.
value
=
value
;
}
}
public
static
Integer
[]
getProdTypes
(){
return
new
Integer
[]{
SEMI_FINISHED_PRODUCT
.
code
,
FINISHED_PRODUCT
.
code
};
}
public
static
EiBlock
generatorEiBlock
()
{
public
static
EiBlock
generatorEiBlock
()
{
EiBlock
block
=
new
EiBlock
(
"customer_type_block_id"
);
EiBlock
block
=
new
EiBlock
(
"customer_type_block_id"
);
List
<
Map
<
String
,
Object
>>
rows
=
new
ArrayList
<
Map
<
String
,
Object
>>()
{{
List
<
Map
<
String
,
Object
>>
rows
=
new
ArrayList
<
Map
<
String
,
Object
>>()
{{
...
...
src/main/java/com/baosight/hpjx/hp/constant/HPSqlConstant.java
View file @
15b4e566
...
@@ -161,6 +161,18 @@ public class HPSqlConstant {
...
@@ -161,6 +161,18 @@ public class HPSqlConstant {
// 备份数量
// 备份数量
public
static
final
String
BACKUP
=
"HPKC010A.backup"
;
public
static
final
String
BACKUP
=
"HPKC010A.backup"
;
}
}
/**
* HPKC011 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public
class
HPKC011
{
// 锁
public
static
final
String
LOCK
=
"HPKC011.lock"
;
}
/**
/**
* HPPZ010 SQL 定义
* HPPZ010 SQL 定义
...
...
src/main/java/com/baosight/hpjx/hp/kc/domain/HPKC011.java
0 → 100644
View file @
15b4e566
This diff is collapsed.
Click to expand it.
src/main/java/com/baosight/hpjx/hp/kc/service/ServiceHPKC011.java
0 → 100644
View file @
15b4e566
package
com
.
baosight
.
hpjx
.
hp
.
kc
.
service
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.InventTypeEnum
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.kc.domain.HPKC011
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ006
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ007
;
import
com.baosight.hpjx.hp.sc.domain.HPSC005
;
import
com.baosight.hpjx.util.CommonMethod
;
import
com.baosight.hpjx.util.LogUtils
;
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.core.service.soa.XLocalManager
;
import
com.baosight.iplat4j.core.util.DateUtils
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
java.math.BigDecimal
;
import
java.util.*
;
/**
*
* @author:wwl
* @date:2024/1/23,10:51
*/
public
class
ServiceHPKC011
extends
ServiceBase
{
/**
* 画面初始化
*
* @param inInfo
* @return
*/
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
HPKC011
HPKC011
=
new
HPKC011
();
EiInfo
outInfo
=
super
.
initLoad
(
inInfo
,
HPKC011
);
outInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
().
clear
();
Map
paramMap
=
new
HashMap
<
String
,
Object
>(){{
put
(
"inventTypes"
,
InventTypeEnum
.
getProdTypes
());
}};
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
WH_RECORD_BLOCK_ID
),
paramMap
);
CommonMethod
.
initBlock
(
outInfo
,
Arrays
.
asList
(
DdynamicEnum
.
MATERIAL_RECORD_BLOCK_ID
),
paramMap
);
return
outInfo
;
}
/**
* 查询操作.
*/
@Override
public
EiInfo
query
(
EiInfo
inInfo
)
{
try
{
inInfo
=
super
.
query
(
inInfo
,
"HPKC011.query"
,
new
HPKC011
());
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
}
return
inInfo
;
}
/**
* 新增操作.
*/
@Override
public
EiInfo
insert
(
EiInfo
inInfo
)
{
try
{
CommonMethod
.
creatorInfo
(
inInfo
,
EiConstant
.
resultBlock
);
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPKC011
fKc010
=
new
HPKC011
();
fKc010
.
fromMap
(
resultRows
.
get
(
i
));
// 设置基础信息
DaoUtils
.
insert
(
HPKC011
.
INSERT
,
fKc010
);
}
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据新增成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"新增失败"
);
}
return
inInfo
;
}
/**
* 更新库存
*
* @param inInfo
* @return
*/
public
EiInfo
updateStock
(
EiInfo
inInfo
){
String
whCode
=
inInfo
.
getString
(
"whCode"
);
String
prodNo
=
inInfo
.
getString
(
"prodNo"
);
BigDecimal
amount
=
new
BigDecimal
(
inInfo
.
getString
(
"amount"
));
BigDecimal
weight
=
new
BigDecimal
(
inInfo
.
getString
(
"weight"
));
String
companyCode
=
UserSessionUtils
.
getCompanyCode
();
try
{
checkUpdateStockParam
(
companyCode
,
whCode
,
prodNo
,
amount
,
weight
);
HPKC011
newObj
=
generatorBaseInfo
(
companyCode
,
whCode
,
prodNo
,
amount
,
weight
);
List
<
Map
>
list
=
dao
.
query
(
"HPKC011.queryByCondition"
,
new
HashMap
<
String
,
Object
>(){{
put
(
"companyCode"
,
companyCode
);
put
(
"whCode"
,
whCode
);
put
(
"prodNo"
,
prodNo
);
}});
if
(
CollectionUtils
.
isEmpty
(
list
)){
//新增
if
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)<
0
||
weight
.
compareTo
(
BigDecimal
.
ZERO
)<
0
){
throw
new
PlatException
(
"当前库存为空,库存变更数量与重量不能小于等于0!"
);
}
generatorBaseInfo
(
newObj
);
DaoUtils
.
insert
(
"HPKC011.insert"
,
newObj
);
}
else
{
//修改
HPKC011
oldObj
=
new
HPKC011
();
oldObj
.
fromMap
(
list
.
get
(
0
));
BigDecimal
afterAmout
=
oldObj
.
getAmount
().
add
(
amount
);
BigDecimal
afterWeight
=
oldObj
.
getWeight
().
add
(
weight
);
if
(
afterAmout
.
compareTo
(
BigDecimal
.
ZERO
)<
0
||
afterWeight
.
compareTo
(
BigDecimal
.
ZERO
)<
0
){
throw
new
PlatException
(
"库存更新失败,出库数量与重量不能大于当前库存!"
);
}
oldObj
.
setAmount
(
afterAmout
);
oldObj
.
setWeight
(
afterWeight
);
oldObj
.
setUpdatedBy
(
newObj
.
getUpdatedBy
());
oldObj
.
setUpdatedName
(
newObj
.
getUpdatedName
());
oldObj
.
setUpdatedTime
(
newObj
.
getUpdatedTime
());
int
result
=
DaoUtils
.
update
(
"HPKC011.updateStock"
,
oldObj
);
if
(
result
!=
1
){
throw
new
PlatException
(
"库存更新失败,库存已发生变更或系统异常,请重试!"
);
}
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
"库存更新成功!"
);
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"库存更新失败!"
);
}
return
inInfo
;
}
/**
* 生成库存对象
* @param companyCode
* @param whCode
* @param prodNo
* @param amout
* @param weight
* @reutrn HPKC011
*/
private
HPKC011
generatorBaseInfo
(
String
companyCode
,
String
whCode
,
String
prodNo
,
BigDecimal
amout
,
BigDecimal
weight
)
{
HPKC011
hpkc011
=
new
HPKC011
();
hpkc011
.
setCompanyCode
(
companyCode
);
hpkc011
.
setWhCode
(
whCode
);
hpkc011
.
setProdNo
(
prodNo
);
hpkc011
.
setAmount
(
amout
);
hpkc011
.
setWeight
(
weight
);
String
userId
=
UserSession
.
getLoginName
();
String
userName
=
UserSession
.
getLoginCName
();
String
time
=
DateUtils
.
curDateTimeStr14
();
hpkc011
.
setCreatedBy
(
userId
);
hpkc011
.
setCreatedName
(
userName
);
hpkc011
.
setCreatedTime
(
time
);
hpkc011
.
setUpdatedBy
(
userId
);
hpkc011
.
setUpdatedName
(
userName
);
hpkc011
.
setUpdatedTime
(
time
);
return
hpkc011
;
}
private
void
generatorBaseInfo
(
HPKC011
hpkc011
)
{
EiInfo
inInfo
=
new
EiInfo
();
try
{
inInfo
.
set
(
"whCode"
,
hpkc011
.
getWhCode
());
inInfo
.
set
(
EiConstant
.
serviceName
,
"HPPZ007"
);
inInfo
.
set
(
EiConstant
.
methodName
,
"queryByWhCode"
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
List
<
HPPZ007
>
whNameList
=
(
List
)
outInfo
.
get
(
"list"
);
hpkc011
.
setWhName
(
whNameList
.
get
(
0
).
getWhName
());
}
catch
(
Exception
e
){
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"库存更新失败!"
);
throw
new
PlatException
(
"仓库编码异常,找不到对应的仓库档案!"
);
}
try
{
inInfo
.
setRows
(
EiConstant
.
queryBlock
,
new
ArrayList
(){{
add
(
new
HashMap
<
String
,
Object
>(){{
put
(
"prodNo"
,
hpkc011
.
getProdNo
());}});}});
inInfo
.
set
(
EiConstant
.
serviceName
,
"HPSC005"
);
inInfo
.
set
(
EiConstant
.
methodName
,
"query"
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
HPSC005
hpsc005
=
new
HPSC005
();
List
<
Map
>
inventList
=
outInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
hpsc005
.
fromMap
(
inventList
.
get
(
0
));
hpkc011
.
setProjCode
(
hpsc005
.
getProjCode
());
hpkc011
.
setProjName
(
hpsc005
.
getProjName
());
hpkc011
.
setInventCode
(
hpsc005
.
getPrdtCode
());
hpkc011
.
setInventName
(
hpsc005
.
getPrdtName
());
hpkc011
.
setSubInventCode
(
hpsc005
.
getPartCode
());
hpkc011
.
setSubInventName
(
hpsc005
.
getPartName
());
hpkc011
.
setLength
(
hpsc005
.
getPartLength
());
hpkc011
.
setWidth
(
hpsc005
.
getPartWidth
());
hpkc011
.
setThick
(
hpsc005
.
getPartThick
());
hpkc011
.
setUnitWeight
(
hpsc005
.
getUnitWt
());
hpkc011
.
setRemark
(
hpsc005
.
getRemark1
());
}
catch
(
Exception
e
){
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"库存更新失败!"
);
throw
new
PlatException
(
"生产单号异常,找不到对应的生产订单!"
);
}
hpkc011
.
setVersion
(
new
Integer
(
1
));
}
/**
* 校验库存变更请求参数
* @param companyCode
* @param whCode
* @param prodNo
* @param amout
* @param weight
*/
private
void
checkUpdateStockParam
(
String
companyCode
,
String
whCode
,
String
prodNo
,
BigDecimal
amout
,
BigDecimal
weight
){
if
(
StringUtils
.
isBlank
(
companyCode
)){
throw
new
PlatException
(
"企业编码不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
whCode
)){
throw
new
PlatException
(
"仓库编码不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
prodNo
)){
throw
new
PlatException
(
"生产单号不能为空!"
);
}
if
(
Objects
.
isNull
(
amout
)||
Objects
.
isNull
(
amout
)){
throw
new
PlatException
(
"库存变更数量或重量不能为空!"
);
}
if
(
amout
.
compareTo
(
BigDecimal
.
ZERO
)==
0
&&
weight
.
compareTo
(
BigDecimal
.
ZERO
)==
0
){
throw
new
PlatException
(
"库存变更数量或重量不能为0)!"
);
}
}
}
src/main/java/com/baosight/hpjx/hp/kc/sql/HPKC011.xml
0 → 100644
View file @
15b4e566
<?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=
"HPKC011"
>
<sql
id=
"column"
>
ID as "id",
COMPANY_CODE as "companyCode",
<!-- 企业编码 -->
DEP_CODE as "depCode",
<!-- 部门编码 -->
WH_CODE as "whCode",
<!-- 仓库编码 -->
WH_NAME as "whName",
<!-- 仓库名称 -->
PROD_NO as "prodNo",
<!-- 生产单号 -->
PROJ_CODE as "projCode",
<!-- 生产单号 -->
PROJ_NAME as "projName",
<!-- 生产单号 -->
INVENT_CODE as "inventCode",
<!-- 部件编码 -->
INVENT_NAME as "inventName",
<!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode",
<!-- 零部件编码 -->
SUB_INVENT_NAME as "subInventName",
<!-- 零部件名称 -->
LENGTH as "length",
<!-- 长 -->
WIDTH as "width",
<!-- 宽 -->
THICK as "thick",
<!-- 厚 -->
AMOUNT as "amount",
<!-- 数量 -->
UNIT_WEIGHT as "unitWeight",
<!-- 单重 -->
WEIGHT as "weight",
<!-- 重量 -->
REMARK as "remark",
<!-- 备注 -->
CREATED_BY as "createdBy",
<!-- 创建人 -->
CREATED_NAME as "createdName",
<!-- 创建人名称 -->
CREATED_TIME as "createdTime",
<!-- 创建时间 -->
UPDATED_BY as "updatedBy",
<!-- 更新人 -->
UPDATED_NAME as "updatedName",
<!-- 更新人名称 -->
UPDATED_TIME as "updatedTime",
<!-- 更新时间 -->
VERSION as "version"
<!-- 版本号 -->
</sql>
<sql
id=
"condition"
>
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"whCode"
>
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"whName"
>
WH_NAME LIKE '%' || #whName# || '%'
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"prodNo"
>
PROD_NO = #prodNo#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"projCode"
>
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"projName"
>
PROJ_NAME LIKE '%' || #projName# || '%'
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventCode"
>
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"inventName"
>
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"subInventCode"
>
SUB_INVENT_CODE = #subInventCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"subInventName"
>
SUB_INVENT_NAME = #subInventName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"createdBy"
>
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"createdTime"
>
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"updatedBy"
>
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"updatedTime"
>
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"version"
>
VERSION = #version#
</isNotEmpty>
</sql>
<sql
id=
"customCondition"
>
<isNotEmpty
prepend=
" AND "
property=
"ids"
>
ID IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"ids"
>
#ids[]#
</iterate>
</isNotEmpty>
</sql>
<select
id=
"query"
resultClass=
"com.baosight.hpjx.hp.kc.domain.HPKC011"
>
SELECT
<include
refid=
"column"
/>
FROM hpjx.T_HPKC011
WHERE 1=1
<include
refid=
"condition"
/>
<include
refid=
"customCondition"
/>
<dynamic
prepend=
"ORDER BY"
>
<isNotEmpty
property=
"orderBy"
>
$orderBy$
</isNotEmpty>
<isEmpty
property=
"orderBy"
>
ID DESC
</isEmpty>
</dynamic>
</select>
<select
id=
"queryByCondition"
resultClass=
"java.util.HashMap"
>
SELECT
<include
refid=
"column"
/>
FROM hpjx.T_HPKC011
WHERE 1=1
<include
refid=
"condition"
/>
<include
refid=
"customCondition"
/>
</select>
<select
id=
"count"
resultClass=
"int"
>
SELECT COUNT(*) FROM hpjx.T_HPKC011
WHERE 1=1
<include
refid=
"condition"
/>
<include
refid=
"customCondition"
/>
</select>
<insert
id=
"insert"
>
INSERT INTO hpjx.T_HPKC011 (
COMPANY_CODE,
<!-- 企业编码 预留 -->
DEP_CODE,
<!-- 部门编码 -->
WH_CODE,
<!-- 仓库编码 -->
WH_NAME,
<!-- 仓库名称 -->
PROD_NO,
<!-- 生产单号 -->
PROJ_CODE,
<!-- 生产单号 -->
PROJ_NAME,
<!-- 生产单号 -->
INVENT_CODE,
<!-- 部件编码 -->
INVENT_NAME,
<!-- 部件名称 -->
SUB_INVENT_CODE,
<!-- 零部件编码 -->
SUB_INVENT_NAME,
<!-- 零部件名称 -->
LENGTH,
<!-- 长 -->
WIDTH,
<!-- 宽 -->
THICK,
<!-- 厚 -->
AMOUNT,
<!-- 数量 -->
UNIT_WEIGHT,
<!-- 单重 -->
WEIGHT,
<!-- 重量 -->
REMARK,
<!-- 备注 -->
CREATED_BY,
<!-- 创建人 -->
CREATED_TIME,
<!-- 创建时间 -->
UPDATED_BY,
<!-- 更新人 -->
UPDATED_TIME,
<!-- 更新时间 -->
VERSION
) VALUES (
#companyCode#, #depCode#, #whCode#, #whName#, #prodNo#, #projCode#, #projName#,
#inventCode#, #inventName#, #subInventCode#, #subInventName#, #length#, #width#, #thick#,
#amount#, #unitWeight#, #weight#, #remark#,
#createdBy#, #createdTime#, #updatedBy#,
#updatedTime#, #version#
)
</insert>
<update
id=
"updateStock"
>
UPDATE hpjx.T_HPKC011
SET
AMOUNT = #amount#,
<!-- 数量 -->
WEIGHT = #weight#,
<!-- 重量 -->
UPDATED_BY = #updatedBy#,
<!-- 更新人 -->
UPDATED_NAME = #updatedName#,
<!-- 更新人 -->
UPDATED_TIME = #updatedTime#,
<!-- 更新时间 -->
VERSION = VERSION+1
WHERE ID = #id#
AND VERSION = #version#
</update>
<!-- 行锁 -->
<update
id=
"lock"
>
UPDATE ${hpjxSchema}.T_HPKC011
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"ids"
>
ID IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"ids"
>
#ids[]#
</iterate>
</isNotEmpty>
</update>
</sqlMap>
src/main/java/com/baosight/hpjx/hp/kc/tools/HPKCTools.java
View file @
15b4e566
...
@@ -353,5 +353,75 @@ public class HPKCTools {
...
@@ -353,5 +353,75 @@ public class HPKCTools {
throw
new
PlatException
(
"跟新库存失败:"
+
outInfo
.
getMsg
());
throw
new
PlatException
(
"跟新库存失败:"
+
outInfo
.
getMsg
());
}
}
}
}
/**
* 查询产品库存信息
*
* @param ids
* @return
*/
public
static
List
<
HPKC011
>
listKc011
(
List
<
Long
>
ids
)
{
if
(
CollectionUtils
.
isEmpty
(
ids
))
{
return
null
;
}
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"ids"
,
ids
);
return
DaoBase
.
getInstance
().
query
(
HPKC011
.
QUERY
,
queryMap
);
}
/**
* 查询产品库存信息
*
* @param ids
* @return
*/
public
static
Map
<
Long
,
HPKC011
>
mapKc011
(
List
<
Long
>
ids
)
{
List
<
HPKC011
>
results
=
listKc011
(
ids
);
if
(
CollectionUtils
.
isEmpty
(
results
))
{
return
null
;
}
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HPKC011:
:
getId
,
item
->
item
));
}
/**
* 锁
*
* @param ids
* @return
*/
public
static
void
lockKc011
(
List
<
Long
>
ids
)
{
if
(
CollectionUtils
.
isEmpty
(
ids
))
{
return
;
}
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"ids"
,
ids
);
DaoBase
.
getInstance
().
update
(
HPSqlConstant
.
HPKC011
.
LOCK
,
queryMap
);
}
/**
* 更新产品库存
*
* @param whCode
* @param prodNo
* @param amount
* @param weight
*/
public
static
void
updateProdStock
(
String
whCode
,
String
prodNo
,
BigDecimal
amount
,
BigDecimal
weight
)
{
if
(
amount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
&&
weight
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
return
;
}
EiInfo
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"whCode"
,
whCode
);
inInfo
.
set
(
"prodNo"
,
prodNo
);
inInfo
.
set
(
"amount"
,
amount
);
inInfo
.
set
(
"weight"
,
weight
);
inInfo
.
set
(
EiConstant
.
serviceName
,
"HPKC011"
);
inInfo
.
set
(
EiConstant
.
methodName
,
"updateStock"
);
EiInfo
outInfo
=
XLocalManager
.
call
(
inInfo
);
if
(
outInfo
.
getStatus
()
<
0
)
{
throw
new
PlatException
(
"跟新库存失败:"
+
outInfo
.
getMsg
());
}
}
}
}
src/main/java/com/baosight/hpjx/hp/pz/service/ServiceHPPZ006.java
View file @
15b4e566
...
@@ -200,13 +200,7 @@ public class ServiceHPPZ006 extends ServiceBase {
...
@@ -200,13 +200,7 @@ public class ServiceHPPZ006 extends ServiceBase {
hppz006
.
setCoefficient
(
new
BigDecimal
(
coefficient
));
hppz006
.
setCoefficient
(
new
BigDecimal
(
coefficient
));
hppz006
.
setUnit
(
unit
);
hppz006
.
setUnit
(
unit
);
hppz006
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
.
intValue
());
hppz006
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
.
intValue
());
StringBuffer
sepbuf
=
new
StringBuffer
();
hppz006
.
setSpec
(
HPPZTools
.
jointSpec
(
hppz006
.
getLength
(),
hppz006
.
getWidth
(),
hppz006
.
getThick
()));
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
);
DaoUtils
.
insert
(
HPPZ006
.
INSERT
,
hppz006
);
}
}
inInfo
.
setAttr
(
new
HashMap
(){{
put
(
"obj"
,
hppz006
);}});
inInfo
.
setAttr
(
new
HashMap
(){{
put
(
"obj"
,
hppz006
);}});
...
...
src/main/java/com/baosight/hpjx/hp/pz/tools/HPPZTools.java
View file @
15b4e566
package
com
.
baosight
.
hpjx
.
hp
.
pz
.
tools
;
package
com
.
baosight
.
hpjx
.
hp
.
pz
.
tools
;
import
com.baosight.eplat.utils.StringUtils
;
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
;
...
@@ -15,6 +14,7 @@ import com.baosight.iplat4j.core.ei.EiConstant;
...
@@ -15,6 +14,7 @@ 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.soa.XLocalManager
;
import
com.baosight.iplat4j.core.service.soa.XLocalManager
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -170,15 +170,15 @@ public class HPPZTools {
...
@@ -170,15 +170,15 @@ public class HPPZTools {
public
static
String
jointSpec
(
BigDecimal
length
,
BigDecimal
width
,
BigDecimal
thick
)
{
public
static
String
jointSpec
(
BigDecimal
length
,
BigDecimal
width
,
BigDecimal
thick
)
{
StringBuffer
sb
=
new
StringBuffer
();
StringBuffer
sb
=
new
StringBuffer
();
if
(
length
!=
null
&&
length
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
if
(
length
!=
null
&&
length
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
sb
.
append
(
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
toString
(
length
));
sb
.
append
(
length
.
toString
(
));
sb
.
append
(
"*"
);
sb
.
append
(
"*"
);
}
}
if
(
width
!=
null
&&
width
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
if
(
width
!=
null
&&
width
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
sb
.
append
(
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
toString
(
width
));
sb
.
append
(
width
.
toString
(
));
sb
.
append
(
"*"
);
sb
.
append
(
"*"
);
}
}
if
(
thick
!=
null
&&
thick
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
if
(
thick
!=
null
&&
thick
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
sb
.
append
(
com
.
baosight
.
iplat4j
.
core
.
util
.
StringUtils
.
toString
(
thick
));
sb
.
append
(
thick
.
toString
(
));
}
}
return
sb
.
toString
();
return
sb
.
toString
();
}
}
...
...
src/main/java/com/baosight/hpjx/util/CommonMethod.java
View file @
15b4e566
...
@@ -31,7 +31,7 @@ public class CommonMethod {
...
@@ -31,7 +31,7 @@ public class CommonMethod {
* @param selectParams 筛选条件
* @param selectParams 筛选条件
* 公用下拉方法
* 公用下拉方法
*/
*/
public
static
void
initBlock
(
EiInfo
inInfo
,
List
<
DdynamicEnum
>
tableParams
,
Map
<
String
,
String
>
selectParams
){
public
static
void
initBlock
(
EiInfo
inInfo
,
List
<
DdynamicEnum
>
tableParams
,
Map
<
String
,
Object
>
selectParams
){
initBlock
(
inInfo
,
tableParams
,
selectParams
,
true
);
initBlock
(
inInfo
,
tableParams
,
selectParams
,
true
);
}
}
...
@@ -41,7 +41,7 @@ public class CommonMethod {
...
@@ -41,7 +41,7 @@ public class CommonMethod {
* @param selectParams 筛选条件
* @param selectParams 筛选条件
* 公用下拉方法
* 公用下拉方法
*/
*/
public
static
void
initBlock
(
EiInfo
inInfo
,
List
<
DdynamicEnum
>
tableParams
,
Map
<
String
,
String
>
selectParams
,
Boolean
isSplicingSymbol
){
public
static
void
initBlock
(
EiInfo
inInfo
,
List
<
DdynamicEnum
>
tableParams
,
Map
<
String
,
Object
>
selectParams
,
Boolean
isSplicingSymbol
){
/* 新建一个块 将每个表查询到的结果放入单独的块中 */
/* 新建一个块 将每个表查询到的结果放入单独的块中 */
EiBlock
eiBlock
;
EiBlock
eiBlock
;
/* 行数据 将每个数据源查询到的数据放到每个模块的行数据中 */
/* 行数据 将每个数据源查询到的数据放到每个模块的行数据中 */
...
...
src/main/webapp/HP/KC/HPKC011.js
0 → 100644
View file @
15b4e566
var
inventNameGlobalData
=
[];
var
specGlobalData
=
[];
$
(
function
()
{
// 查询
$
(
"#QUERY"
).
on
(
"click"
,
query
);
IPLATUI
.
EFGrid
=
{
"result"
:
{
columns
:
[{
field
:
"inventCode"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
inventNameGlobalData
.
length
;
i
++
)
{
if
(
inventNameGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'inventCode'
])
{
return
inventNameGlobalData
[
i
][
'textField'
];
}
}
return
""
;
}
},
{
field
:
"spec"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
specGlobalData
.
length
;
i
++
)
{
if
(
specGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'inventRecordId'
])
{
return
specGlobalData
[
i
][
'textField'
];
}
}
return
""
;
}
},
{
field
:
"material"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
specGlobalData
.
length
;
i
++
)
{
if
(
specGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'inventRecordId'
])
{
return
specGlobalData
[
i
][
'param1Field'
];
}
}
return
""
;
}
},
{
field
:
"unit"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
specGlobalData
.
length
;
i
++
)
{
if
(
specGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'inventRecordId'
])
{
return
specGlobalData
[
i
][
'param2Field'
];
}
}
return
""
;
}
}]
},
};
});
/**
* 页面加载时执行
*/
$
(
window
).
load
(
function
()
{
// 存货名称
let
eiInfo
=
new
EiInfo
();
EiCommunicator
.
send
(
"HPPZ004"
,
"queryComboBox"
,
eiInfo
,
{
onSuccess
:
function
(
ei
)
{
inventNameGlobalData
=
ei
.
getBlock
(
"invent_name_block_id"
).
getMappedRows
();
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
// 规格
EiCommunicator
.
send
(
"HPPZ006"
,
"queryComboBoxAll"
,
eiInfo
,
{
onSuccess
:
function
(
ei
)
{
specGlobalData
=
ei
.
getBlock
(
"invent_all_block_id"
).
getMappedRows
();
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
// 查询
query
();
});
/**
* 查询
*/
let
query
=
function
()
{
resultGrid
.
dataSource
.
page
(
1
);
// 点击查询按钮,从第1页开始查询
}
src/main/webapp/HP/KC/HPKC011.jsp
0 → 100644
View file @
15b4e566
<!DOCTYPE html>
<
%@
page
contentType=
"text/html; charset=UTF-8"
%
>
<
%@
taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%
>
<
%@
taglib
prefix=
"EF"
tagdir=
"/WEB-INF/tags/EF"
%
>
<c:set
var=
"ctx"
value=
"${pageContext.request.contextPath}"
/>
<EF:EFPage
title=
"实时库存管理"
>
<EF:EFRegion
id=
"inqu"
title=
"查询条件"
>
<div
class=
"row"
>
<EF:EFSelect
ename=
"inqu_status-0-whCode"
cname=
"仓库名称"
colWidth=
"3"
filter=
"contains"
defultValue=
""
>
<EF:EFOption
label=
"全部"
value=
""
/>
<EF:EFOptions
blockId=
"wh_record_block_id"
textField=
"textField"
valueField=
"valueField"
/>
</EF:EFSelect>
<EF:EFSelect
ename=
"inqu_status-0-inventType"
cname=
"存货类型"
colWidth=
"3"
filter=
"contains"
>
<EF:EFOption
label=
"全部"
value=
""
/>
<EF:EFCodeOption
codeName=
"hpjx.hpkc.inventType"
/>
</EF:EFSelect>
<EF:EFSelect
ename=
"inqu_status-0-inventCode"
cname=
"存货名称"
colWidth=
"3"
filter=
"contains"
defultValue=
""
>
<EF:EFOption
label=
"全部"
value=
""
/>
<EF:EFOptions
blockId=
"material_record_block_id"
textField=
"textField"
valueField=
"valueField"
/>
</EF:EFSelect>
<EF:EFSelect
ename=
"inqu_status-0-spec"
cname=
"规格"
colWidth=
"3"
filter=
"contains"
defultValue=
""
>
<EF:EFOption
label=
"全部"
value=
""
/>
<EF:EFOptions
blockId=
"spec_name_block_id"
textField=
"textField"
valueField=
"valueField"
/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion
id=
"result"
title=
"明细信息"
>
<EF:EFGrid
blockId=
"result"
autoDraw=
"override"
isFloat=
"true"
checkMode=
"row"
>
<EF:EFColumn
ename=
"id"
cname=
"内码"
hidden=
"true"
/>
<EF:EFColumn
ename=
"inventRecordId"
cname=
"存货档案ID"
hidden=
"true"
/>
<EF:EFComboColumn
ename=
"whCode"
cname=
"仓库编码"
width=
"120"
columnTemplate=
"#=textField#"
itemTemplate=
"#=textField#"
blockName=
"wh_record_block_id"
textField=
"textField"
valueField=
"valueField"
align=
"center"
filter=
"contains"
>
</EF:EFComboColumn>
<EF:EFComboColumn
ename=
"inventType"
cname=
"存货类型"
width=
"100"
align=
"center"
required=
"true"
>
<EF:EFCodeOption
codeName=
"hpjx.hpkc.inventType"
/>
</EF:EFComboColumn>
<EF:EFColumn
ename=
"inventCode"
cname=
"存货名称"
width=
"120"
align=
"center"
required=
"true"
/>
<EF:EFColumn
ename=
"spec"
cname=
"规格"
width=
"120"
align=
"center"
/>
<EF:EFColumn
ename=
"material"
cname=
"材质"
width=
"120"
align=
"center"
/>
<EF:EFColumn
ename=
"unit"
cname=
"单位"
width=
"120"
align=
"center"
/>
<EF:EFColumn
ename=
"amount"
cname=
"数量"
format=
"{0:N3}"
maxLength=
"20"
width=
"90"
align=
"right"
/>
<EF:EFColumn
ename=
"weight"
cname=
"重量"
format=
"{0:N3}"
maxLength=
"20"
width=
"90"
align=
"right"
/>
<EF:EFColumn
ename=
"createdBy"
cname=
"创建人"
enable=
"false"
width=
"100"
align=
"center"
/>
<EF:EFColumn
ename=
"createdTime"
cname=
"创建时刻"
enable=
"false"
width=
"140"
align=
"center"
editType=
"datetime"
parseFormats=
"['yyyyMMddHHmmss']"
/>
<EF:EFColumn
ename=
"updatedBy"
cname=
"更新人"
enable=
"false"
width=
"100"
align=
"center"
/>
<EF:EFColumn
ename=
"updatedTime"
cname=
"更新时刻"
enable=
"false"
width=
"140"
align=
"center"
editType=
"datetime"
parseFormats=
"['yyyyMMddHHmmss']"
/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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