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
80620a6b
Commit
80620a6b
authored
Jan 25, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采购订单;
parent
55d67351
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
336 additions
and
711 deletions
+336
-711
HPSqlConstant.java
...ain/java/com/baosight/hpjx/hp/constant/HPSqlConstant.java
+2
-0
HPKC001.java
src/main/java/com/baosight/hpjx/hp/kc/domain/HPKC001.java
+26
-1
ServiceHPKC001.java
.../java/com/baosight/hpjx/hp/kc/service/ServiceHPKC001.java
+135
-267
HPKC001.xml
src/main/java/com/baosight/hpjx/hp/kc/sql/HPKC001.xml
+3
-1
HPKCTools.java
src/main/java/com/baosight/hpjx/hp/kc/tools/HPKCTools.java
+45
-4
HPKC001.js
src/main/webapp/HP/KC/HPKC001.js
+92
-406
HPKC001.jsp
src/main/webapp/HP/KC/HPKC001.jsp
+33
-32
No files found.
src/main/java/com/baosight/hpjx/hp/constant/HPSqlConstant.java
View file @
80620a6b
...
...
@@ -16,6 +16,8 @@ public class HPSqlConstant {
// 统计
public
static
final
String
STAT_DATE
=
"HPKC001.statDate"
;
// 锁
public
static
final
String
LOCK
=
"HPKC001.lock"
;
}
/**
...
...
src/main/java/com/baosight/hpjx/hp/kc/domain/HPKC001.java
View file @
80620a6b
...
...
@@ -34,6 +34,7 @@ public class HPKC001 extends DaoEPBase {
public
static
final
String
FIELD_UPDATED_NAME
=
"updatedName"
;
/* 更新人名称*/
public
static
final
String
FIELD_UPDATED_TIME
=
"updatedTime"
;
/* 更新时间*/
public
static
final
String
FIELD_PURCHASE_CODE
=
"purchaseCode"
;
/* 采购单号*/
public
static
final
String
FIELD_OLD_PURCHASE_CODE
=
"oldPurchaseCode"
;
/* 原采购单号*/
public
static
final
String
FIELD_RECEIPT_DATE
=
"receiptDate"
;
/* 单据日期*/
public
static
final
String
FIELD_WH_CODE
=
"whCode"
;
/* 仓库编码*/
public
static
final
String
FIELD_WH_NAME
=
"whName"
;
/* 仓库名称*/
...
...
@@ -55,7 +56,7 @@ public class HPKC001 extends DaoEPBase {
public
static
final
String
COL_UPDATED_BY
=
"UPDATED_BY"
;
/* 更新人*/
public
static
final
String
COL_UPDATED_NAME
=
"UPDATED_NAME"
;
/* 更新人名称*/
public
static
final
String
COL_UPDATED_TIME
=
"UPDATED_TIME"
;
/* 更新时间*/
public
static
final
String
COL_
PURCHASE_CODE
=
"PURCHASE_CODE"
;
/*
采购单号*/
public
static
final
String
COL_
OLD_PURCHASE_CODE
=
"OLD_PURCHASE_CODE"
;
/* 原
采购单号*/
public
static
final
String
COL_RECEIPT_DATE
=
"RECEIPT_DATE"
;
/* 单据日期*/
public
static
final
String
COL_WH_CODE
=
"WH_CODE"
;
/* 仓库编码*/
public
static
final
String
COL_WH_NAME
=
"WH_NAME"
;
/* 仓库名称*/
...
...
@@ -84,6 +85,7 @@ public class HPKC001 extends DaoEPBase {
private
String
updatedName
=
" "
;
/* 更新人名称*/
private
String
updatedTime
;
/* 更新时间*/
private
String
purchaseCode
=
" "
;
/* 采购单号*/
private
String
oldPurchaseCode
=
" "
;
/* 原采购单号*/
private
String
receiptDate
;
/* 单据日期*/
private
String
whCode
=
" "
;
/* 仓库编码*/
private
String
whName
=
" "
;
/* 仓库名称*/
...
...
@@ -143,6 +145,10 @@ public class HPKC001 extends DaoEPBase {
eiColumn
.
setDescName
(
"采购单号"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_OLD_PURCHASE_CODE
);
eiColumn
.
setDescName
(
"原采购单号"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_RECEIPT_DATE
);
eiColumn
.
setDescName
(
"单据日期"
);
eiMetadata
.
addMeta
(
eiColumn
);
...
...
@@ -363,6 +369,23 @@ public class HPKC001 extends DaoEPBase {
public
void
setPurchaseCode
(
String
purchaseCode
)
{
this
.
purchaseCode
=
purchaseCode
;
}
/**
* set the oldPurchaseCode - 原采购单号.
*
* @param oldPurchaseCode - 原采购单号
*/
public
void
setOldPurchaseCode
(
String
oldPurchaseCode
)
{
this
.
oldPurchaseCode
=
oldPurchaseCode
;
}
/**
* get the oldPurchaseCode - 原采购单号.
* @return the oldPurchaseCode
*/
public
String
getOldPurchaseCode
()
{
return
this
.
oldPurchaseCode
;
}
/**
* get the receiptDate - 单据日期.
* @return the receiptDate
...
...
@@ -557,6 +580,7 @@ public class HPKC001 extends DaoEPBase {
setUpdatedName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UPDATED_NAME
)),
updatedName
));
setUpdatedTime
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_UPDATED_TIME
)),
updatedTime
));
setPurchaseCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_PURCHASE_CODE
)),
purchaseCode
));
setOldPurchaseCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_OLD_PURCHASE_CODE
)),
oldPurchaseCode
));
setReceiptDate
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_RECEIPT_DATE
)),
receiptDate
));
setWhCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_WH_CODE
)),
whCode
));
setWhName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_WH_NAME
)),
whName
));
...
...
@@ -587,6 +611,7 @@ public class HPKC001 extends DaoEPBase {
map
.
put
(
FIELD_UPDATED_NAME
,
StringUtils
.
toString
(
updatedName
,
eiMetadata
.
getMeta
(
FIELD_UPDATED_NAME
)));
map
.
put
(
FIELD_UPDATED_TIME
,
StringUtils
.
toString
(
updatedTime
,
eiMetadata
.
getMeta
(
FIELD_UPDATED_TIME
)));
map
.
put
(
FIELD_PURCHASE_CODE
,
StringUtils
.
toString
(
purchaseCode
,
eiMetadata
.
getMeta
(
FIELD_PURCHASE_CODE
)));
map
.
put
(
FIELD_OLD_PURCHASE_CODE
,
StringUtils
.
toString
(
oldPurchaseCode
,
eiMetadata
.
getMeta
(
FIELD_OLD_PURCHASE_CODE
)));
map
.
put
(
FIELD_RECEIPT_DATE
,
StringUtils
.
toString
(
receiptDate
,
eiMetadata
.
getMeta
(
FIELD_RECEIPT_DATE
)));
map
.
put
(
FIELD_WH_CODE
,
StringUtils
.
toString
(
whCode
,
eiMetadata
.
getMeta
(
FIELD_WH_CODE
)));
map
.
put
(
FIELD_WH_NAME
,
StringUtils
.
toString
(
whName
,
eiMetadata
.
getMeta
(
FIELD_WH_NAME
)));
...
...
src/main/java/com/baosight/hpjx/hp/kc/service/ServiceHPKC001.java
View file @
80620a6b
package
com
.
baosight
.
hpjx
.
hp
.
kc
.
service
;
import
com.baosight.hpjx.common.ApprovalStatusEnum
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.InventTypeEnun
;
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.HPKC001
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ007
;
import
com.baosight.hpjx.util.AssertUtils
;
import
com.baosight.hpjx.util.CommonMethod
;
import
com.baosight.hpjx.util.LogUtils
;
import
com.baosight.hpjx.util.StringUtil
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.hpjx.hp.kc.tools.HPKCTools
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.util.*
;
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.
lang3.String
Utils
;
import
org.apache.commons.
collections.Map
Utils
;
import
java.math.BigDecimal
;
import
java.util.*
;
/**
...
...
@@ -26,18 +25,25 @@ import java.util.*;
*/
public
class
ServiceHPKC001
extends
ServiceBase
{
// 指定存货类型
private
static
final
Integer
[]
DEFAULT_INVENT_CODE
=
{
InventTypeEnun
.
MATERIAL
.
getCode
(),
InventTypeEnun
.
CONSUMABLE
.
getCode
()};
/**
* 画面初始化.
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
try
{
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
WH_RECORD_BLOCK_ID
),
null
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
WH_RECORD_BLOCK_ID
),
null
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
INVENT_NAME_BLOCK_ID
),
null
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
INVENT_SPEC_BLOCK_ID
),
null
);
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"inventTypes"
,
DEFAULT_INVENT_CODE
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
WH_RECORD_BLOCK_ID
),
queryMap
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
INVENT_NAME_BLOCK_ID
),
queryMap
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
INVENT_ALL_BLOCK_ID
),
queryMap
,
false
);
inInfo
.
addBlock
(
EiConstant
.
resultBlock
).
addBlockMeta
(
new
HPKC001
().
eiMetadata
);
inInfo
.
setBlock
(
InventTypeEnun
.
generatorEiBlock
());
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"初始化失败"
);
}
...
...
@@ -45,309 +51,171 @@ public class ServiceHPKC001 extends ServiceBase {
}
/**
* 查询操作.
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public
EiInfo
query
(
EiInfo
inInfo
)
{
String
documentTime
=
inInfo
.
getCellStr
(
EiConstant
.
queryBlock
,
0
,
"documentTime"
);
if
(
StringUtils
.
isNotBlank
(
documentTime
)){
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
0
,
"documentTime"
,
StringUtil
.
removeHorizontalLine
(
documentTime
));
try
{
Map
queryRow
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
receiptDate
=
MapUtils
.
getString
(
queryRow
,
"receiptDate"
);
queryRow
.
put
(
"receiptDate"
,
StringUtil
.
removeSpecifiedCharacter
(
receiptDate
,
StringUtil
.
DEFAULT_CHARACTER_TO_BE_REMOVED
));
queryRow
.
put
(
"inventTypes"
,
DEFAULT_INVENT_CODE
);
inInfo
=
super
.
query
(
inInfo
,
HPKC001
.
QUERY
,
new
HPKC001
());
// List sum = dao.query(HPSqlConstant.HPKC001.QUERY_SUM, queryRow);
// inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
}
/* 调用EI查询方法.*/
return
super
.
query
(
inInfo
,
"HPKC001.query"
,
new
HPKC001
());
return
inInfo
;
}
/**
* 新增操作.
* 新增操作
*
* @param inInfo
* @return
*/
@Override
public
EiInfo
insert
(
EiInfo
inInfo
)
{
try
{
CommonMethod
.
creatorInfo
(
inInfo
,
EiConstant
.
resultBlock
);
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 数据校验
this
.
checkSaveData
(
resultRows
);
//
写入数据
//
数据写入
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPKC001
insertEntity
=
new
HPKC001
();
insertEntity
.
fromMap
(
resultRows
.
get
(
i
));
// 仓库名称
Map
params
=
new
HashMap
<>();
params
.
put
(
"whCode"
,
insertEntity
.
getWhCode
());
List
query
=
dao
.
query
(
"HPPZ007.queryByWhCode"
,
params
);
insertEntity
.
setWhName
(((
HPPZ007
)
query
.
get
(
0
)).
getWhName
());
//存货类型
insertEntity
.
setMaterialTypeName
(
InventTypeEnun
.
getNameByCode
(
insertEntity
.
getMaterialType
()));
// 生成单据号
insertEntity
.
setDocumentCode
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
HPKC001_NUMBER
));
insertEntity
.
setStatus
(
1
);
insertEntity
.
setApprovalStatus
(
ApprovalStatusEnum
.
SAVED
.
getCode
());
dao
.
insert
(
"HPKC001.insert"
,
insertEntity
);
HPKC001
fKc001
=
new
HPKC001
();
fKc001
.
fromMap
(
resultRows
.
get
(
i
));
// 设置基础信息
this
.
setBaseInfo
(
fKc001
);
// 生成入库单号
fKc001
.
setPurchaseCode
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
OTHER_ENTER_NO
));
DaoUtils
.
insert
(
HPKC001
.
INSERT
,
fKc001
);
// 修改库存
HPKCTools
.
updateStock
(
fKc001
.
getWhCode
(),
fKc001
.
getInventRecordId
(),
fKc001
.
getAmount
(),
fKc001
.
getWeight
());
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据保存成功!"
);
}
catch
(
PlatException
e
)
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setMsg
(
"操作失败!原因参见详细错误描述!"
);
inInfo
.
setDetailMsg
(
e
.
getMessage
());
logError
(
"新增失败"
,
e
.
getMessage
());
return
inInfo
;
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据新增成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"新增失败"
);
}
return
inInfo
;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private
void
checkSaveData
(
List
<
Map
>
resultRows
)
{
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPKC001
entity
=
new
HPKC001
();
entity
.
fromMap
(
resultRows
.
get
(
i
));
AssertUtils
.
isEmpty
(
entity
.
getMaterialType
(),
"存货类型不能为空"
);
AssertUtils
.
isEmpty
(
entity
.
getMaterialCode
(),
"物料不能为空"
);
AssertUtils
.
isEmpty
(
entity
.
getWhCode
(),
"仓库不能为空"
);
}
}
/**
* 校验提交的数据
* 修改操作
*
* @param resultRows
*/
private
void
checkSubmitData
(
List
<
Map
>
resultRows
)
{
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPKC001
entity
=
new
HPKC001
();
entity
.
fromMap
(
resultRows
.
get
(
i
));
AssertUtils
.
isNull
(
entity
.
getId
(),
"请先保存再提交"
);
if
(
entity
.
getApprovalStatus
()
==
ApprovalStatusEnum
.
SUBMIT
.
getCode
()){
throw
new
PlatException
(
"单据已提交,不能重复提交"
);
}
if
(
entity
.
getApprovalStatus
()
==
ApprovalStatusEnum
.
APPROVED
.
getCode
()){
throw
new
PlatException
(
"单据审批通过,不能再次提交"
);
}
}
}
/**
* 校验审批的数据
*
* @param resultRows
* @param approvalFlag
*
*/
private
void
checkApproveData
(
List
<
Map
>
resultRows
,
int
approvalFlag
)
{
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPKC001
entity
=
new
HPKC001
();
entity
.
fromMap
(
resultRows
.
get
(
i
));
AssertUtils
.
isNull
(
entity
.
getId
(),
"请先保存数据"
);
//审批通过操作
if
(
approvalFlag
==
ApprovalStatusEnum
.
APPROVED
.
getCode
()){
if
(
entity
.
getApprovalStatus
()
==
ApprovalStatusEnum
.
SAVED
.
getCode
()){
throw
new
PlatException
(
"已保存的数据,请先提交"
);
}
if
(
entity
.
getApprovalStatus
()
==
ApprovalStatusEnum
.
REJECTION
.
getCode
()){
throw
new
PlatException
(
"审批拒绝的数据,请先提交"
);
}
if
(
entity
.
getApprovalStatus
()
==
ApprovalStatusEnum
.
APPROVED
.
getCode
()){
throw
new
PlatException
(
"数据已经审批通过,不能重复审批"
);
}
}
//审批拒绝操作
if
(
approvalFlag
==
ApprovalStatusEnum
.
REJECTION
.
getCode
()){
if
(
entity
.
getApprovalStatus
()
==
ApprovalStatusEnum
.
SAVED
.
getCode
()){
throw
new
PlatException
(
"已保存的数据,请先提交"
);
}
if
(
entity
.
getApprovalStatus
()
==
ApprovalStatusEnum
.
REJECTION
.
getCode
()){
throw
new
PlatException
(
"审批拒绝的数据,请先提交"
);
}
if
(
entity
.
getApprovalStatus
()
==
ApprovalStatusEnum
.
APPROVED
.
getCode
()){
throw
new
PlatException
(
"数据已经审批通过,不能重复审批"
);
}
}
}
}
/**
* 修改操作.
* @param inInfo
* @return
*/
@Override
public
EiInfo
update
(
EiInfo
inInfo
)
{
try
{
CommonMethod
.
udpateInfo
(
inInfo
,
EiConstant
.
resultBlock
);
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 数据校验
this
.
checkSaveData
(
resultRows
);
// 写入数据
// 入库单号
List
<
String
>
otherEnterNos
=
ObjectUtils
.
listKey
(
resultRows
,
"otherEnterNo"
);
// 锁记录
HPKCTools
.
lockKc001
(
otherEnterNos
);
// 查询数据库记录
Map
<
String
,
HPKC001
>
mapKc001
=
HPKCTools
.
mapKc001
(
otherEnterNos
);
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPKC001
updateEntity
=
new
HPKC001
();
updateEntity
.
fromMap
(
resultRows
.
get
(
i
));
// 仓库名称
Map
params
=
new
HashMap
<>();
params
.
put
(
"whCode"
,
updateEntity
.
getWhCode
());
List
query
=
dao
.
query
(
"HPPZ007.queryByWhCode"
,
params
);
updateEntity
.
setWhName
(((
HPPZ007
)
query
.
get
(
0
)).
getWhName
());
//存货类型
updateEntity
.
setMaterialTypeName
(
InventTypeEnun
.
getNameByCode
(
updateEntity
.
getMaterialType
()));
dao
.
insert
(
"HPKC001.update"
,
updateEntity
);
HPKC001
fKc001
=
new
HPKC001
();
fKc001
.
fromMap
(
resultRows
.
get
(
i
));
// 设置基础信息
this
.
setBaseInfo
(
fKc001
);
DaoUtils
.
update
(
HPKC001
.
UPDATE
,
fKc001
);
// 计算差异数量与重量
HPKC001
dbKc001
=
mapKc001
.
get
(
fKc001
.
getPurchaseCode
());
BigDecimal
diffAmount
=
fKc001
.
getAmount
().
subtract
(
dbKc001
.
getAmount
());
BigDecimal
diffWeight
=
fKc001
.
getWeight
().
subtract
(
dbKc001
.
getWeight
());
// 修改库存
HPKCTools
.
updateStock
(
fKc001
.
getWhCode
(),
fKc001
.
getInventRecordId
(),
diffAmount
,
diffWeight
);
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据保存成功!"
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据修改成功!"
);
}
catch
(
PlatException
e
)
{
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setMsg
(
"操作失败!原因参见详细错误描述!"
);
inInfo
.
setDetailMsg
(
e
.
getMessage
());
logError
(
"修改失败"
,
e
.
getMessage
());
return
inInfo
;
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"修改失败"
);
}
return
inInfo
;
}
/**
* 提交操作.
*/
public
EiInfo
submit
(
EiInfo
eiInfo
)
{
try
{
List
<
Map
>
resultRows
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
this
.
checkSubmitData
(
resultRows
);
HPKC001
HPKC001
=
new
HPKC001
();
EiBlock
eiBlock
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
);
List
<
HPKC001
>
entityList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
eiBlock
.
getRowCount
();
i
++)
{
Map
<?,
?>
map
=
eiBlock
.
getRow
(
i
);
HPKC001
.
fromMap
(
map
);
HPKC001
.
setApprovalStatus
(
ApprovalStatusEnum
.
SUBMIT
.
getCode
());
entityList
.
add
(
HPKC001
);
}
this
.
dao
.
updateBatch
(
"HPKC001.approvalStatusUpdate"
,
entityList
);
}
catch
(
PlatException
e
)
{
eiInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
eiInfo
.
setMsg
(
"提交失败!"
+
e
.
getMessage
());
eiInfo
.
setDetailMsg
(
e
.
getMessage
());
logError
(
"提交失败!"
,
e
.
getMessage
());
return
eiInfo
;
}
eiInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
eiInfo
.
setMsg
(
"删除成功!"
);
return
eiInfo
;
}
/**
* 审批通过操作.
*/
public
EiInfo
approved
(
EiInfo
eiInfo
)
{
try
{
List
<
Map
>
resultRows
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
this
.
checkApproveData
(
resultRows
,
ApprovalStatusEnum
.
APPROVED
.
getCode
());
HPKC001
HPKC001
=
new
HPKC001
();
EiBlock
eiBlock
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
);
List
<
HPKC001
>
entityList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
eiBlock
.
getRowCount
();
i
++)
{
Map
<?,
?>
map
=
eiBlock
.
getRow
(
i
);
HPKC001
.
fromMap
(
map
);
HPKC001
.
setApprovalStatus
(
ApprovalStatusEnum
.
APPROVED
.
getCode
());
entityList
.
add
(
HPKC001
);
}
this
.
dao
.
updateBatch
(
"HPKC001.approvalStatusUpdate"
,
entityList
);
}
catch
(
PlatException
e
)
{
eiInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
eiInfo
.
setMsg
(
"审批失败!"
+
e
.
getMessage
());
eiInfo
.
setDetailMsg
(
e
.
getMessage
());
logError
(
"审批失败!"
,
e
.
getMessage
());
return
eiInfo
;
}
eiInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
eiInfo
.
setMsg
(
"审批成功!"
);
return
eiInfo
;
}
/**
* 审批拒绝操作.
* 校验保存的数据
*
* @param resultRows
*/
public
EiInfo
rejection
(
EiInfo
eiInfo
)
{
try
{
List
<
Map
>
resultRows
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
this
.
checkApproveData
(
resultRows
,
ApprovalStatusEnum
.
REJECTION
.
getCode
());
HPKC001
HPKC001
=
new
HPKC001
();
EiBlock
eiBlock
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
);
List
<
HPKC001
>
entityList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
eiBlock
.
getRowCount
();
i
++)
{
Map
<?,
?>
map
=
eiBlock
.
getRow
(
i
);
HPKC001
.
fromMap
(
map
);
HPKC001
.
setApprovalStatus
(
ApprovalStatusEnum
.
REJECTION
.
getCode
());
entityList
.
add
(
HPKC001
);
}
this
.
dao
.
updateBatch
(
"HPKC001.approvalStatusUpdate"
,
entityList
);
}
catch
(
PlatException
e
)
{
eiInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
eiInfo
.
setMsg
(
"审批失败!"
+
e
.
getMessage
());
eiInfo
.
setDetailMsg
(
e
.
getMessage
());
logError
(
"审批失败!"
,
e
.
getMessage
());
return
eiInfo
;
private
void
checkSaveData
(
List
<
Map
>
resultRows
)
{
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPKC001
fKc001
=
new
HPKC001
();
fKc001
.
fromMap
(
resultRows
.
get
(
i
));
AssertUtils
.
isEmpty
(
fKc001
.
getWhCode
(),
"仓库名称不能为空"
);
AssertUtils
.
isNull
(
fKc001
.
getInventCode
(),
"存货名称不能为空"
);
AssertUtils
.
isNull
(
fKc001
.
getInventRecordId
(),
"规格不能为空"
);
AssertUtils
.
isGt
(
BigDecimal
.
ZERO
,
fKc001
.
getAmount
(),
"数量必须大于0"
);
AssertUtils
.
isGt
(
BigDecimal
.
ZERO
,
fKc001
.
getWeight
(),
"重量必须大于0"
);
}
eiInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
eiInfo
.
setMsg
(
"审批成功!"
);
return
eiInfo
;
}
/**
* 删除操作.
* 设置基础信息
*
* @param fKc001
*/
@Override
public
EiInfo
delete
(
EiInfo
eiInfo
)
{
HPKC001
HPKC001
=
new
HPKC001
();
EiBlock
eiBlock
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
);
try
{
List
<
Map
>
resultRows
=
eiInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
this
.
checkDeleteData
(
resultRows
);
for
(
int
i
=
0
;
i
<
eiBlock
.
getRowCount
();
i
++)
{
Map
<?,
?>
map
=
eiBlock
.
getRow
(
i
);
HPKC001
.
fromMap
(
map
);
this
.
dao
.
delete
(
"HPKC001.delete"
,
HPKC001
.
toMap
());
}
}
catch
(
PlatException
e
)
{
eiInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
eiInfo
.
setMsg
(
"删除失败,原因参见详细错误描述!"
);
eiInfo
.
setDetailMsg
(
e
.
getMessage
());
logError
(
"删除失败!"
,
e
.
getMessage
());
return
eiInfo
;
}
eiInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
eiInfo
.
setMsg
(
"删除成功!"
);
return
eiInfo
;
private
void
setBaseInfo
(
HPKC001
fKc001
)
{
// 去除日期字符串中的-
fKc001
.
setReceiptDate
(
StringUtil
.
removeHorizontalLine
(
fKc001
.
getReceiptDate
()));
// 仓库名称
fKc001
.
setWhName
(
HPPZTools
.
getPz007ByCode
(
fKc001
.
getWhCode
()).
getWhName
());
// 存货名称
fKc001
.
setInventName
(
HPPZTools
.
getPz004ByCode
(
fKc001
.
getInventCode
()).
getInventName
());
}
/**
* 校验审批的数据
*
* @param resultRows
* 删除操作
*
* @param inInfo
* @return
*/
private
void
checkDeleteData
(
List
<
Map
>
resultRows
)
{
public
EiInfo
delete
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 入库单号
List
<
String
>
otherEnterNos
=
ObjectUtils
.
listKey
(
resultRows
,
"otherEnterNo"
);
// 锁记录
HPKCTools
.
lockKc001
(
otherEnterNos
);
// 查询数据库记录
Map
<
String
,
HPKC001
>
mapKc001
=
HPKCTools
.
mapKc001
(
otherEnterNos
);
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++)
{
HPKC001
entity
=
new
HPKC001
();
entity
.
fromMap
(
resultRows
.
get
(
i
));
if
(
entity
.
getApprovalStatus
()
==
ApprovalStatusEnum
.
SUBMIT
.
getCode
()){
throw
new
PlatException
(
"已提交采购入库单不能删除"
);
}
if
(
entity
.
getApprovalStatus
()
==
ApprovalStatusEnum
.
APPROVED
.
getCode
()){
throw
new
PlatException
(
"已审批通过采购入库单不能删除"
);
HPKC001
fKc001
=
new
HPKC001
();
fKc001
.
fromMap
(
resultRows
.
get
(
i
));
DaoUtils
.
update
(
HPKC001
.
DELETE
,
fKc001
);
// 生成红冲记录
HPKC001
dbKc001
=
mapKc001
.
get
(
fKc001
.
getPurchaseCode
());
HPKC001
newKc006
=
BeanUtils
.
copy
(
dbKc001
,
HPKC001
.
class
);
newKc006
.
setPurchaseCode
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
OTHER_ENTER_NO
));
newKc006
.
setAmount
(
newKc006
.
getAmount
().
negate
());
newKc006
.
setWeight
(
newKc006
.
getWeight
().
negate
());
newKc006
.
setOldPurchaseCode
(
newKc006
.
getPurchaseCode
());
newKc006
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
YES_1
);
DaoUtils
.
insert
(
HPKC001
.
INSERT
,
newKc006
);
// 修改库存
HPKCTools
.
updateStock
(
dbKc001
.
getWhCode
(),
dbKc001
.
getInventRecordId
(),
dbKc001
.
getAmount
().
negate
(),
dbKc001
.
getWeight
().
negate
());
}
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据删除成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"删除失败"
);
}
return
inInfo
;
}
}
src/main/java/com/baosight/hpjx/hp/kc/sql/HPKC001.xml
View file @
80620a6b
...
...
@@ -13,6 +13,7 @@
UPDATED_NAME as "updatedName",
<!-- 更新人名称 -->
UPDATED_TIME as "updatedTime",
<!-- 更新时间 -->
PURCHASE_CODE as "purchaseCode",
<!-- 采购单号 -->
OLD_PURCHASE_CODE as "oldPurchaseCode",
<!-- 原采购单号 -->
RECEIPT_DATE as "receiptDate",
<!-- 单据日期 -->
WH_CODE as "whCode",
<!-- 仓库编码 -->
WH_NAME as "whName",
<!-- 仓库名称 -->
...
...
@@ -123,6 +124,7 @@
CREATED_NAME,
<!-- 创建人名称 -->
CREATED_TIME,
<!-- 创建时间 -->
PURCHASE_CODE,
<!-- 采购单号 -->
OLD_PURCHASE_CODE,
<!-- 原采购单号 -->
RECEIPT_DATE,
<!-- 单据日期 -->
WH_CODE,
<!-- 仓库编码 -->
WH_NAME,
<!-- 仓库名称 -->
...
...
@@ -136,7 +138,7 @@
DELETE_FLAG
<!-- 是否删除0.否1.是 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#purchaseCode#, #receiptDate#, #whCode#, #whName#, #inventType#,
#
oldPurchaseCode#,#
purchaseCode#, #receiptDate#, #whCode#, #whName#, #inventType#,
#inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#,
#remarks#, #deleteFlag#
)
...
...
src/main/java/com/baosight/hpjx/hp/kc/tools/HPKCTools.java
View file @
80620a6b
...
...
@@ -2,10 +2,7 @@ package com.baosight.hpjx.hp.kc.tools;
import
com.baosight.hpjx.core.dao.DaoBase
;
import
com.baosight.hpjx.hp.constant.HPSqlConstant
;
import
com.baosight.hpjx.hp.kc.domain.HPKC005
;
import
com.baosight.hpjx.hp.kc.domain.HPKC006
;
import
com.baosight.hpjx.hp.kc.domain.HPKC007
;
import
com.baosight.hpjx.hp.kc.domain.HPKC010
;
import
com.baosight.hpjx.hp.kc.domain.*
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
...
...
@@ -74,6 +71,50 @@ public class HPKCTools {
* @param otherEnterNos
* @return
*/
public
static
void
lockKc001
(
List
<
String
>
otherEnterNos
)
{
if
(
CollectionUtils
.
isEmpty
(
otherEnterNos
))
{
return
;
}
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"otherEnterNos"
,
otherEnterNos
);
DaoBase
.
getInstance
().
update
(
HPSqlConstant
.
HPKC001
.
LOCK
,
queryMap
);
}
/**
* 查询其他入库信息
*
* @param otherEnterNos
* @return
*/
public
static
List
<
HPKC001
>
listKc001
(
List
<
String
>
otherEnterNos
)
{
if
(
CollectionUtils
.
isEmpty
(
otherEnterNos
))
{
return
null
;
}
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"otherEnterNos"
,
otherEnterNos
);
return
DaoBase
.
getInstance
().
query
(
HPKC001
.
QUERY
,
queryMap
);
}
/**
* 查询其他入库信息
*
* @param otherEnterNos
* @return
*/
public
static
Map
<
String
,
HPKC001
>
mapKc001
(
List
<
String
>
otherEnterNos
)
{
List
<
HPKC001
>
results
=
listKc001
(
otherEnterNos
);
if
(
CollectionUtils
.
isEmpty
(
results
))
{
return
null
;
}
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HPKC001:
:
getPurchaseCode
,
item
->
item
));
}
/**
* 锁
*
* @param otherEnterNos
* @return
*/
public
static
void
lockKc006
(
List
<
String
>
otherEnterNos
)
{
if
(
CollectionUtils
.
isEmpty
(
otherEnterNos
))
{
return
;
...
...
src/main/webapp/HP/KC/HPKC001.js
View file @
80620a6b
let
materialCod
eGlobalData
=
[];
let
whCod
eGlobalData
=
[];
let
spec
GlobalData
=
[];
let
whNam
eGlobalData
=
[];
let
inventNam
eGlobalData
=
[];
let
inventAll
GlobalData
=
[];
$
(
function
()
{
var
editorModel0
=
''
;
var
eiInfo
=
new
EiInfo
();
// 查询
$
(
"#QUERY"
).
on
(
"click"
,
function
()
{
resultGrid
.
dataSource
.
page
(
1
);
// 点击查询按钮,从第1页开始查询
});
IPLATUI
.
EFGrid
.
result
=
{
IPLATUI
.
EFGrid
=
{
pageable
:
{
pageSize
:
20
,
pageSizes
:
[
10
,
20
,
30
,
50
,
100
,
2
00
],
pageSizes
:
[
10
,
20
,
50
,
70
,
1
00
],
},
columns
:
[
{
field
:
"
material
Code"
,
template
:
function
(
dataItem
)
{
for
(
var
i
=
0
;
i
<
materialCodeGlobalData
.
length
;
i
++
)
{
if
(
materialCodeGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'material
Code'
])
{
return
materialCod
eGlobalData
[
i
][
'textField'
];
"result"
:
{
columns
:
[
{
field
:
"
wh
Code"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
whNameGlobalData
.
length
;
i
++
)
{
if
(
whNameGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'wh
Code'
])
{
return
whNam
eGlobalData
[
i
][
'textField'
];
}
}
return
""
;
},
editor
:
function
(
container
,
options
)
{
var
grid
=
container
.
closest
(
".k-grid"
).
data
(
"kendoGrid"
);
var
cellIndex
=
grid
.
cellIndex
(
container
);
var
input
=
$
(
'<input />'
);
input
.
attr
(
"name"
,
options
.
field
);
input
.
attr
(
"id"
,
options
.
field
);
input
.
appendTo
(
container
);
eiInfo
.
set
(
"inventType"
,
options
.
model
[
"materialType"
]);
var
dataSource
;
EiCommunicator
.
send
(
"HPPZ004"
,
"queryComboBox"
,
eiInfo
,
{
onSuccess
:
function
(
ei
)
{
dataSource
=
ei
.
getBlock
(
"invent_name_block_id"
).
getMappedRows
();
materialCodeGlobalData
=
dataSource
;
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
input
.
kendoDropDownList
({
valuePrimitive
:
true
,
dataTextField
:
"textField"
,
dataValueField
:
"valueField"
,
dataSource
:
dataSource
,
template
:
"#=textField#"
});
},
},
{
field
:
"whCode"
,
template
:
function
(
dataItem
)
{
for
(
var
i
=
0
;
i
<
whCodeGlobalData
.
length
;
i
++
)
{
if
(
whCodeGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'whCode'
])
{
return
whCodeGlobalData
[
i
][
'textField'
];
let
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
,
5
]);
inInfo
.
set
(
"inqu_status-0-whType"
,
options
.
model
[
"inventType"
]);
inInfo
.
set
(
"serviceName"
,
"HPPZ007"
);
inInfo
.
set
(
"methodName"
,
"queryComboBox"
);
inInfo
.
set
(
"blockId"
,
"wh_record_block_id"
);
inInfo
.
set
(
"field"
,
options
.
field
);
refreshSelect
(
container
,
inInfo
);
}
},
{
field
:
"inventCode"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
inventNameGlobalData
.
length
;
i
++
)
{
if
(
inventNameGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'inventCode'
])
{
return
inventNameGlobalData
[
i
][
'textField'
];
}
}
return
""
;
},
editor
:
function
(
container
,
options
)
{
var
input
=
$
(
'<input />'
);
input
.
attr
(
"name"
,
options
.
field
);
input
.
attr
(
"id"
,
options
.
field
);
input
.
appendTo
(
container
);
var
whEiInfo
=
new
EiInfo
();
whEiInfo
.
set
(
"whType"
,
options
.
model
[
"materialType"
]);
var
dataSource
;
EiCommunicator
.
send
(
"HPPZ007"
,
"queryComboBox"
,
whEiInfo
,
{
onSuccess
:
function
(
ei
)
{
dataSource
=
ei
.
getBlock
(
"wh_record_block_id"
).
getMappedRows
();
whCodeGlobalData
=
dataSource
;
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
input
.
kendoDropDownList
({
valuePrimitive
:
true
,
dataTextField
:
"textField"
,
dataValueField
:
"valueField"
,
dataSource
:
dataSource
,
template
:
"#=textField#"
});
},
},
{
field
:
"spec"
,
template
:
function
(
dataItem
)
{
for
(
var
i
=
0
;
i
<
specGlobalData
.
length
;
i
++
)
{
if
(
specGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'spec'
])
{
return
specGlobalData
[
i
][
'textField'
];
let
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
,
5
]);
inInfo
.
set
(
"inqu_status-0-inventType"
,
options
.
model
[
"inventType"
]);
inInfo
.
set
(
"serviceName"
,
"HPPZ006"
);
inInfo
.
set
(
"methodName"
,
"queryMaterialComboBox"
);
inInfo
.
set
(
"blockId"
,
"material_record_block_id"
);
inInfo
.
set
(
"field"
,
options
.
field
);
refreshSelect
(
container
,
inInfo
);
}
},
{
field
:
"spe"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
inventAllGlobalData
.
length
;
i
++
)
{
if
(
inventAllGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'inventRecordId'
])
{
return
inventAllGlobalData
[
i
][
'textField'
];
}
}
return
""
;
},
editor
:
function
(
container
,
options
)
{
var
input
=
$
(
'<input />'
);
input
.
attr
(
"name"
,
options
.
field
);
input
.
attr
(
"id"
,
options
.
field
);
input
.
appendTo
(
container
);
var
specEiInfo
=
new
EiInfo
();
specEiInfo
.
set
(
"inqu_status-0-inventCode"
,
options
.
model
[
"materialCode"
]);
specEiInfo
.
set
(
"inqu_status-0-inventType"
,
options
.
model
[
"materialType"
]);
var
dataSource
;
EiCommunicator
.
send
(
"HPPZ006"
,
"queryComboBoxSpec"
,
specEiInfo
,
{
onSuccess
:
function
(
ei
)
{
dataSource
=
ei
.
getBlock
(
"invent_spec_block_id"
).
getMappedRows
();
specGlobalData
=
dataSource
;
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
input
.
kendoDropDownList
({
valuePrimitive
:
true
,
dataTextField
:
"textField"
,
dataValueField
:
"valueField"
,
dataSource
:
dataSource
,
template
:
"#=textField#"
});
},
}
],
onRowClick
:
function
(
e
)
{
editorModel0
=
e
.
row
;
$
(
"input[name='materialType']"
).
on
(
'change'
,
function
(
me
)
{
//清空物料信息
resultGrid
.
setCellValue
(
editorModel0
,
"materialName"
,
""
);
resultGrid
.
setCellValue
(
editorModel0
,
"materialCode"
,
""
);
resultGrid
.
setCellValue
(
editorModel0
,
"whCode"
,
""
);
resultGrid
.
setCellValue
(
editorModel0
,
"whName"
,
""
);
resultGrid
.
setCellValue
(
editorModel0
,
"spec"
,
""
);
resultGrid
.
setCellValue
(
editorModel0
,
"unit"
,
""
);
});
$
(
"input[name='materialCode']"
).
on
(
'change'
,
function
(
me
)
{
var
materialCode
=
$
(
"input[name='materialCode']"
).
val
();
var
queryEiInfo
=
new
EiInfo
();
queryEiInfo
.
set
(
"inventCode"
,
materialCode
);
EiCommunicator
.
send
(
"HPPZ004"
,
"query"
,
eiInfo
,
{
onSuccess
:
function
(
eiInfo
)
{
var
status
=
eiInfo
.
getStatus
();
if
(
status
!=
"-1"
)
{
console
.
log
(
eiInfo
)
var
materialName
=
eiInfo
.
blocks
.
result
.
rows
[
0
][
14
];
resultGrid
.
setCellValue
(
e
.
row
,
"materialName"
,
materialName
);
//清空物料信息
resultGrid
.
setCellValue
(
editorModel0
,
"spec"
,
""
);
resultGrid
.
setCellValue
(
editorModel0
,
"unit"
,
""
);
}
},
onFail
:
function
(
ei
)
{
let
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
,
5
]);
inInfo
.
set
(
"inqu_status-0-inventCode"
,
options
.
model
[
"inventCode"
]);
inInfo
.
set
(
"serviceName"
,
"HPPZ006"
);
inInfo
.
set
(
"methodName"
,
"queryComboBoxSpec"
);
inInfo
.
set
(
"blockId"
,
"invent_spec_block_id"
);
inInfo
.
set
(
"field"
,
options
.
field
);
refreshSelect
(
container
,
inInfo
);
}
},
{
field
:
"unit"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
inventAllGlobalData
.
length
;
i
++
)
{
if
(
inventAllGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'inventRecordId'
])
{
return
inventAllGlobalData
[
i
][
'param2Field'
];
}
},
{
async
:
false
});
});
$
(
"input[name='spec']"
).
on
(
'change'
,
function
(
me
)
{
var
spec
=
$
(
"input[name='spec']"
).
val
();
var
materialCode
=
$
(
"input[name='materialCode']"
).
val
();
var
queryEiInfo
=
new
EiInfo
();
queryEiInfo
.
set
(
"inventCode"
,
materialCode
);
queryEiInfo
.
set
(
"spec"
,
spec
);
EiCommunicator
.
send
(
"HPPZ006"
,
"query"
,
eiInfo
,
{
onSuccess
:
function
(
eiInfo
)
{
var
status
=
eiInfo
.
getStatus
();
if
(
status
!=
"-1"
)
{
console
.
log
(
eiInfo
)
var
unit
=
eiInfo
.
blocks
.
result
.
rows
[
0
][
23
];
resultGrid
.
setCellValue
(
editorModel0
,
"unit"
,
unit
);
}
},
onFail
:
function
(
ei
)
{
return
""
;
}
},
{
async
:
false
});
});
},
}],
loadComplete
:
function
(
grid
)
{
//删除
$
(
"#DELETE"
).
on
(
"click"
,
function
()
{
var
btnNode
=
$
(
this
);
//禁用按钮
btnNode
.
attr
(
"disabled"
,
true
);
var
dataItems
=
resultGrid
.
getCheckedRows
();
if
(
dataItems
==
null
||
dataItems
==
""
)
{
NotificationUtil
({
msg
:
'选择要删除的数据'
},
"warning"
);
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
return
false
;
}
IPLAT
.
submitNode
(
$
(
"#HPKC001"
),
"HPKC001"
,
"delete"
,
{
onSuccess
:
function
(
ei
)
{
if
(
ei
[
"status"
]
==
-
1
)
{
NotificationUtil
(
ei
,
"error"
);
}
else
{
NotificationUtil
({
msg
:
'删除成功'
});
// 绑定grid
resultGrid
.
setEiInfo
(
ei
);
}
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
resultGrid
.
dataSource
.
page
(
1
);
},
onFail
:
function
(
ei
)
{
// onFail
// 表示失败回调函数
// 发生异常
console
.
log
(
ei
);
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
}
});
});
//提交
$
(
"#SUBMIT"
).
on
(
"click"
,
function
()
{
var
btnNode
=
$
(
this
);
//禁用按钮
btnNode
.
attr
(
"disabled"
,
true
);
var
dataItems
=
resultGrid
.
getCheckedRows
();
if
(
dataItems
==
null
||
dataItems
==
""
)
{
NotificationUtil
({
msg
:
'选择要提交的数据'
},
"warning"
);
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
return
false
;
}
IPLAT
.
confirm
({
title
:
"提交"
,
message
:
"确认提交这些数据么?"
,
okFn
:
function
()
{
IPLAT
.
submitNode
(
$
(
"#HPKC001"
),
"HPKC001"
,
"submit"
,
{
onSuccess
:
function
(
ei
)
{
if
(
ei
[
"status"
]
===
-
1
)
{
IPLAT
.
alert
({
message
:
'<b>'
+
ei
.
msg
+
'</b>'
,
okFn
:
function
(
e
)
{
},
title
:
'提示'
});
}
else
{
IPLAT
.
alert
({
message
:
'<b>提交成功!</b>'
,
okFn
:
function
(
e
)
{
},
title
:
'提示'
});
// 绑定grid
resultGrid
.
setEiInfo
(
ei
);
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
resultGrid
.
dataSource
.
page
(
1
);
}
},
onFail
:
function
(
eMsg
)
{
IPLAT
.
alert
({
message
:
'<b>'
+
eMsg
+
'</b>'
,
okFn
:
function
(
e
)
{
},
title
:
'提示'
});
}
});
},
cancelFn
:
function
()
{
IPLAT
.
NotificationUtil
(
"提交已取消!"
,
"warning"
);
},
minWidth
:
250
})
});
//审批通过
$
(
"#APPROVED"
).
on
(
"click"
,
function
()
{
var
btnNode
=
$
(
this
);
//禁用按钮
btnNode
.
attr
(
"disabled"
,
true
);
var
dataItems
=
resultGrid
.
getCheckedRows
();
if
(
dataItems
==
null
||
dataItems
==
""
)
{
NotificationUtil
({
msg
:
'选择要审批通过的数据'
},
"warning"
);
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
return
false
;
}
IPLAT
.
confirm
({
title
:
"审批通过"
,
message
:
"确认通过审批么?"
,
okFn
:
function
()
{
IPLAT
.
submitNode
(
$
(
"#HPKC001"
),
"HPKC001"
,
"approved"
,
{
onSuccess
:
function
(
ei
)
{
if
(
ei
[
"status"
]
===
-
1
)
{
IPLAT
.
alert
({
message
:
'<b>'
+
ei
.
msg
+
'</b>'
,
okFn
:
function
(
e
)
{
},
title
:
'提示'
});
}
else
{
IPLAT
.
alert
({
message
:
'<b>审批完成!</b>'
,
okFn
:
function
(
e
)
{
},
title
:
'提示'
});
// 绑定grid
resultGrid
.
setEiInfo
(
ei
);
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
resultGrid
.
dataSource
.
page
(
1
);
}
},
onFail
:
function
(
eMsg
)
{
IPLAT
.
alert
({
message
:
'<b>'
+
eMsg
+
'</b>'
,
okFn
:
function
(
e
)
{
},
title
:
'提示'
});
}
});
},
cancelFn
:
function
()
{
IPLAT
.
NotificationUtil
(
"提交已取消!"
,
"warning"
);
},
minWidth
:
250
})
});
//审批拒绝
$
(
"#REJECTION"
).
on
(
"click"
,
function
()
{
var
btnNode
=
$
(
this
);
//禁用按钮
btnNode
.
attr
(
"disabled"
,
true
);
var
dataItems
=
resultGrid
.
getCheckedRows
();
if
(
dataItems
==
null
||
dataItems
==
""
)
{
NotificationUtil
({
msg
:
'选择要审批拒绝的数据'
},
"warning"
);
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
return
false
;
}
IPLAT
.
confirm
({
title
:
"审批拒绝"
,
message
:
"确认通过拒绝么?"
,
okFn
:
function
()
{
IPLAT
.
submitNode
(
$
(
"#HPKC001"
),
"HPKC001"
,
"rejection"
,
{
onSuccess
:
function
(
ei
)
{
if
(
ei
[
"status"
]
===
-
1
)
{
IPLAT
.
alert
({
message
:
'<b>'
+
ei
.
msg
+
'</b>'
,
okFn
:
function
(
e
)
{
},
title
:
'提示'
});
}
else
{
IPLAT
.
alert
({
message
:
'<b>审批完成!</b>'
,
okFn
:
function
(
e
)
{
},
title
:
'提示'
});
// 绑定grid
resultGrid
.
setEiInfo
(
ei
);
//释放禁用按钮
btnNode
.
attr
(
"disabled"
,
false
);
resultGrid
.
dataSource
.
page
(
1
);
}
},
onFail
:
function
(
eMsg
)
{
IPLAT
.
alert
({
message
:
'<b>'
+
eMsg
+
'</b>'
,
okFn
:
function
(
e
)
{
},
title
:
'提示'
});
}
});
},
cancelFn
:
function
()
{
IPLAT
.
NotificationUtil
(
"提交已取消!"
,
"warning"
);
},
minWidth
:
250
})
});
},
onSuccess
:
function
(
e
)
{
if
(
e
.
type
!=
'read'
)
{
// 不显示notifications
e
.
preventDefault
();
// 重新查询Grid前,把新增、修改、删除操作成功的信息先弹出。
// 弹窗关闭后重新查询Grid
//resultGrid.dataSource.page(1);
IPLAT
.
alert
({
// e.eiInfo 是EiInfo对象,可从浏览器F12的Console中查看。
message
:
e
.
eiInfo
.
getMsg
(),
okFn
:
function
(
e
)
{
parent
.
window
.
location
.
href
=
IPLATUI
.
CONTEXT_PATH
+
'/web/HPKC001'
;
},
title
:
'成功'
});
}
}
};
// 查询
$
(
"#QUERY"
).
on
(
"click"
,
query
);
// 保存
$
(
"#BTN_SAVE"
).
on
(
"click"
,
save
);
});
/**
* 页面加载时执行
*/
$
(
window
).
load
(
function
()
{
// 存货名称
let
eiInfo
=
new
EiInfo
();
EiCommunicator
.
send
(
"HPPZ004"
,
"queryComboBox"
,
eiInfo
,
{
// 仓库名称
let
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
,
5
]);
EiCommunicator
.
send
(
"HPPZ007"
,
"queryComboBox"
,
inInfo
,
{
onSuccess
:
function
(
ei
)
{
materialCodeGlobalData
=
ei
.
getBlock
(
"invent_name
_block_id"
).
getMappedRows
();
whNameGlobalData
=
ei
.
getBlock
(
"wh_record
_block_id"
).
getMappedRows
();
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
let
speceiInfo
=
new
EiInfo
();
EiCommunicator
.
send
(
"HPPZ00
6"
,
"queryComboBoxSpec"
,
specei
Info
,
{
// 存货名称
EiCommunicator
.
send
(
"HPPZ00
4"
,
"queryComboBox"
,
in
Info
,
{
onSuccess
:
function
(
ei
)
{
specGlobalData
=
ei
.
getBlock
(
"invent_spec
_block_id"
).
getMappedRows
();
inventNameGlobalData
=
ei
.
getBlock
(
"invent_name
_block_id"
).
getMappedRows
();
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
let
wheiInfo
=
new
EiInfo
();
EiCommunicator
.
send
(
"HPPZ007"
,
"queryComboBox"
,
wheiInfo
,
{
// 规格
EiCommunicator
.
send
(
"HPPZ006"
,
"queryComboBoxAll"
,
inInfo
,
{
onSuccess
:
function
(
ei
)
{
whCodeGlobalData
=
ei
.
getBlock
(
"wh_record
_block_id"
).
getMappedRows
();
inventAllGlobalData
=
ei
.
getBlock
(
"invent_all
_block_id"
).
getMappedRows
();
},
onFail
:
function
(
ei
)
{
}
...
...
@@ -460,6 +130,22 @@ $(window).load(function () {
* 查询
*/
let
query
=
function
()
{
resultGrid
.
dataSource
.
page
(
1
);
resultGrid
.
dataSource
.
page
(
1
);
// 点击查询按钮,从第1页开始查询
}
/**
* 保存
*/
let
save
=
function
()
{
let
rows
=
resultGrid
.
getCheckedRows
();
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
);
return
;
}
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
保存
\"
操作? "
,
{
ok
:
function
()
{
JSUtils
.
submitGridsData
(
"result"
,
"HPKC006"
,
"save"
,
true
);
}
});
}
src/main/webapp/HP/KC/HPKC001.jsp
View file @
80620a6b
...
...
@@ -9,49 +9,50 @@
<EF:EFRegion
id=
"inqu"
title=
"查询条件"
>
<div
class=
"row"
>
<EF:EFDatePicker
ename=
"inqu_status-0-documentTime"
cname=
"单据日期"
format=
"yyyy-MM-dd"
required=
"true"
/>
<EF:EFInput
ename=
"inqu_status-0-documentCode"
cname=
"采购入库单号"
colWidth=
"4"
readonly=
"false"
/>
<EF:EFSelect
cname=
"存货类型"
blockId=
"inqu_status"
ename=
"materialType"
row=
"0"
colWidth=
"3"
>
<EF:EFDatePicker
cname=
"单据日期"
ename=
"inqu_status-0-receiptDate"
colWidth=
"3"
role=
"date"
format=
"yyyy-MM-dd"
readonly=
"true"
/>
<EF:EFInput
cname=
"采购单号"
ename=
"inqu_status-0-chpurchaseCodeeckNo"
colWidth=
"3"
/>
<EF:EFSelect
cname=
"存货类型"
ename=
"inqu_status-0-inventType"
colWidth=
"3"
filter=
"contains"
>
<EF:EFOption
label=
"全部"
value=
""
/>
<EF:EFCodeOption
codeName=
"hpjx.hpkc.inventType"
/>
<EF:EFCodeOption
codeName=
"hpjx.hpkc.inventType"
/>
</EF:EFSelect>
<EF:EFSelect
ename=
"inqu_status-0-whCode"
cname=
"仓库名称"
valueTemplate=
"#=textField#"
filter=
"contains"
required=
"false"
defultValue=
"ALL"
template=
"#=textField#"
>
<EF:EFOption
label=
"请选择"
value=
""
></EF:EFOption>
<EF:EFSelect
cname=
"仓库名称"
ename=
"inqu_status-0-whCode"
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-materialCode"
cname=
"存货名称"
valueTemplate=
"#=textField#"
filter=
"contains"
required=
"false"
defultValue=
"ALL"
template=
"#=textField#"
>
<EF:EFOption
label=
"请选择"
value=
""
></EF:EFOption>
</div>
<div
class=
"row"
>
<EF:EFSelect
cname=
"存货名称"
ename=
"inqu_status-0-inventCode"
colWidth=
"3"
filter=
"contains"
defultValue=
""
>
<EF:EFOption
label=
"全部"
value=
""
/>
<EF:EFOptions
blockId=
"invent_name_block_id"
textField=
"textField"
valueField=
"valueField"
/>
</EF:EFSelect>
<EF:EFSelect
cname=
"规格"
ename=
"inqu_status-0-spec"
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=
"false"
isFloat=
"true"
autoFit=
"true"
>
<EF:EFColumn
ename=
"id"
cname=
"主键id"
hidden=
"true"
/>
<EF:EFColumn
ename=
"documentTime"
cname=
"单据日期"
editType=
"date"
dateFormat=
"yyyy-MM-dd"
parseFormats=
"['yyyy-MM-dd']"
width=
"100"
required=
"true"
/>
<EF:EFColumn
ename=
"documentCode"
cname=
"采购入库单号"
width=
"100"
readonly=
"false"
align=
"center"
required=
"false"
enable=
"false"
/>
<EF:EFComboColumn
ename=
"materialType"
cname=
"存货类型"
width=
"90"
align=
"center"
>
<EF:EFCodeOption
codeName=
"hpjx.hpkc.inventType"
/>
</EF:EFComboColumn>
<EF:EFColumn
ename=
"whCode"
cname=
"仓库名称"
width=
"100"
readonly=
"false"
required=
"true"
/>
<EF:EFColumn
ename=
"whName"
cname=
"仓库名称"
width=
"100"
readonly=
"false"
hidden=
"true"
/>
<EF:EFColumn
ename=
"materialCode"
cname=
"存货名称"
width=
"100"
readonly=
"false"
required=
"true"
/>
<EF:EFColumn
ename=
"materialName"
cname=
"存货名称"
width=
"100"
readonly=
"false"
hidden=
"true"
/>
<EF:EFColumn
ename=
"spec"
cname=
"规格"
width=
"120"
readonly=
"false"
align=
"center"
required=
"true"
/>
<EF:EFColumn
ename=
"unit"
cname=
"单位"
width=
"80"
readonly=
"false"
align=
"center"
enable=
"false"
required=
"true"
/>
<EF:EFColumn
ename=
"quantity"
cname=
"数量"
width=
"80"
defaultValue=
"0"
data-regex=
"/^[0-9]\\\d*$/"
data-errorprompt=
"请输入正整数"
readonly=
"false"
align=
"right"
required=
"true"
/>
<EF:EFColumn
ename=
"weight"
cname=
"重量"
defaultValue=
"0"
data-rules=
"number"
maxLength=
"20"
width=
"100"
align=
"right"
readonly=
"false"
/>
<EF:EFComboColumn
ename=
"approvalStatus"
cname=
"审批状态"
width=
"90"
align=
"center"
>
<EF:EFCodeOption
codeName=
"hpjx.hpjx.approvalStatus"
/>
<EF:EFGrid
blockId=
"result"
autoDraw=
"override"
isFloat=
"true"
checkMode=
"row"
>
<EF:EFColumn
ename=
"id"
cname=
"内码"
hidden=
"true"
/>
<EF:EFColumn
ename=
"purchaseCode"
cname=
"采购单号"
enable=
"false"
width=
"140"
align=
"center"
/>
<EF:EFColumn
ename=
"receiptDate"
cname=
"单据日期"
width=
"90"
align=
"center"
editType=
"date"
dateFormat=
"yyyy-MM-dd"
parseFormats=
"['yyyyMMdd']"
required=
"true"
/>
<EF:EFComboColumn
ename=
"inventType"
cname=
"存货类型"
width=
"100"
align=
"center"
required=
"true"
>
<EF:EFCodeOption
codeName=
"hpjx.hpkc.inventType"
/>
</EF:EFComboColumn>
<EF:EFColumn
ename=
"remarks"
cname=
"备注"
width=
"100"
readonly=
"false"
/>
<EF:EFColumn
ename=
"whCode"
cname=
"仓库名称"
width=
"120"
align=
"center"
required=
"true"
readonly=
"true"
/>
<EF:EFColumn
ename=
"inventCode"
cname=
"存货名称"
width=
"120"
align=
"center"
required=
"true"
readonly=
"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=
"remark"
cname=
"备注"
width=
"150"
readonly=
"true"
/>
<EF:EFColumn
ename=
"createdName"
cname=
"创建人"
enable=
"false"
width=
"100"
align=
"center"
/>
<EF:EFColumn
ename=
"createdTime"
cname=
"创建时刻"
enable=
"false"
width=
"140"
align=
"center"
editType=
"datetime"
parseFormats=
"['yyyyMMddHHmmss']"
/>
</EF:EFGrid>
</EF:EFRegion>
...
...
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