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
08949142
Commit
08949142
authored
Apr 28, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-04-26 新增采购申请
parent
0a79818e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
721 additions
and
0 deletions
+721
-0
ServiceHPCG001.java
.../java/com/baosight/hpjx/hp/cg/service/ServiceHPCG001.java
+266
-0
HPCG001.js
src/main/webapp/HP/CG/HPCG001.js
+361
-0
HPCG001.jsp
src/main/webapp/HP/CG/HPCG001.jsp
+94
-0
No files found.
src/main/java/com/baosight/hpjx/hp/cg/service/ServiceHPCG001.java
0 → 100644
View file @
08949142
package
com
.
baosight
.
hpjx
.
hp
.
cg
.
service
;
import
com.baosight.hpjx.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.InventTypeEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.hp.cg.domain.HPCG001
;
import
com.baosight.hpjx.hp.cg.domain.HPCG002
;
import
com.baosight.hpjx.hp.cg.domain.HPCG002A
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.kc.domain.HPKC001
;
import
com.baosight.hpjx.hp.kc.domain.HPKC010
;
import
com.baosight.hpjx.hp.kc.tools.HPKCTools
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ006
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ019
;
import
com.baosight.hpjx.hp.pz.domain.HPPZ020
;
import
com.baosight.hpjx.hp.pz.tools.HPPZTools
;
import
com.baosight.hpjx.hp.sb.domain.HPSB003
;
import
com.baosight.hpjx.util.*
;
import
com.baosight.hpjx.util.contants.ACConstants
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
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.resource.I18nMessages
;
import
com.baosight.iplat4j.core.service.impl.ServiceEPBase
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.MapUtils
;
import
java.math.BigDecimal
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author LiuYang
* @version 1.0 2024/4/26
*/
public
class
ServiceHPCG001
extends
ServiceEPBase
{
// 指定存货类型
private
static
final
Integer
[]
DEFAULT_INVENT_CODE
=
{
InventTypeEnum
.
RAW
.
getCode
(),
InventTypeEnum
.
CONSUMABLE
.
getCode
()};
@Override
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
try
{
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
.
SPEC_NAME_BLOCK_ID
),
queryMap
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
INVENT_ALL_BLOCK_ID
),
queryMap
,
false
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
FACTORY_RECORD_BLOCK_ID
),
null
,
false
);
inInfo
.
addBlock
(
EiConstant
.
resultBlock
).
addBlockMeta
(
new
HPCG001
().
eiMetadata
);
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"初始化失败"
);
}
return
inInfo
;
}
@Override
public
EiInfo
query
(
EiInfo
inInfo
)
{
try
{
/*Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String proApplyNo = MapUtils.getString(queryRow, HPCG001.FIELD_PRO_APPLY_NO);
queryRow.put(HPCG001.FIELD_PRO_APPLY_NO, StringUtil.removeSpecifiedCharacter(proApplyNo,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
queryRow.put("inventTypes", DEFAULT_INVENT_CODE);*/
inInfo
.
setCell
(
EiConstant
.
queryBlock
,
ACConstants
.
ROW_CODE_0
,
HPSB003
.
FIELD_DELETE_FLAG
,
CommonConstant
.
YesNo
.
NO_0
);
inInfo
=
super
.
query
(
inInfo
,
HPCG001
.
QUERY
,
new
HPCG001
());
// List sum = dao.query(HPSqlConstant.HPKC001.QUERY_SUM, queryRow);
// inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
// 设置规格信息
HPPZTools
.
HpPz006
.
setSpecInfo
(
inInfo
,
HPCG001
.
FIELD_INVENT_RECORD_ID
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
}
return
inInfo
;
}
@OperationLogAnnotation
(
operModul
=
"采购申请"
,
operType
=
"删除"
,
operDesc
=
"删除操作"
)
@Override
public
EiInfo
delete
(
EiInfo
inInfo
)
{
int
i
=
0
;
try
{
HPCG001
hpcg001
=
new
HPCG001
();
EiBlock
eiBlock
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
);
for
(
i
=
0
;
i
<
eiBlock
.
getRowCount
();
i
++)
{
Map
<?,
?>
map
=
eiBlock
.
getRow
(
i
);
hpcg001
.
fromMap
(
map
);
hpcg001
.
setDeleteFlag
(
CommonConstant
.
YesNo
.
YES_1
);
DaoUtils
.
update
(
HPCG001
.
DELETE_FLAG
,
hpcg001
);
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsgByKey
(
"ep.1000"
,
new
String
[]{
String
.
valueOf
(
i
),
I18nMessages
.
getText
(
"label.delete"
,
"删除"
)});
}
catch
(
PlatException
e
)
{
e
.
printStackTrace
();
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
ErrorCodeUtils
.
handleDeleteException
(
inInfo
,
i
,
e
);
logError
(
"删除失败"
,
e
.
getMessage
());
return
inInfo
;
}
return
inInfo
;
}
@OperationLogAnnotation
(
operModul
=
"采购申请"
,
operType
=
"保存"
,
operDesc
=
"操作"
)
public
EiInfo
save
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 写入数据
for
(
Map
resultRow
:
resultRows
)
{
HPCG001
hpcg001
=
new
HPCG001
();
hpcg001
.
fromMap
(
resultRow
);
HPPZ006
fPz006
=
new
HPPZ006
();
fPz006
.
fromMap
(
resultRow
);
if
(
hpcg001
.
getId
()
==
null
||
hpcg001
.
getId
()
==
0
)
{
this
.
add
(
hpcg001
,
fPz006
);
}
else
{
this
.
modify
(
hpcg001
);
}
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据保存成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"保存失败"
);
}
return
inInfo
;
}
/**
* 新增操作
*/
public
void
add
(
HPCG001
hpcg001
,
HPPZ006
fPz006
)
{
// 设置基础信息
this
.
setBaseInfo
(
hpcg001
);
// 检查存货名称是新增还是已存在
if
(
StringUtils
.
isBlank
(
hpcg001
.
getInventCode
()))
{
String
inventCode
=
HPPZTools
.
HpPz004
.
checkAndSave
(
hpcg001
.
getInventType
(),
hpcg001
.
getInventName
());
hpcg001
.
setInventCode
(
inventCode
);
fPz006
.
setInventCode
(
inventCode
);
}
// 检查规格是否已存在,不存在就新增
HPPZ006
dbPz006
=
HPPZTools
.
HpPz006
.
checkAndSave
(
fPz006
);
hpcg001
.
setInventRecordId
(
dbPz006
.
getId
());
// 计算重量
this
.
calcWeight
(
hpcg001
);
//生成采购申请单号
hpcg001
.
setProApplyNo
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
PRO_APPLY_NO
));
DaoUtils
.
insert
(
HPCG001
.
INSERT
,
hpcg001
);
}
/**
* 修改操作
*/
public
void
modify
(
HPCG001
hpcg001
)
{
DaoUtils
.
update
(
HPCG001
.
UPDATE
,
hpcg001
);
}
@OperationLogAnnotation
(
operModul
=
"采购申请"
,
operType
=
"提交"
,
operDesc
=
"提交审批操作"
)
public
EiInfo
approve
(
EiInfo
inInfo
){
int
i
=
0
;
try
{
EiBlock
eiBlock
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
);
List
<
Map
<
Object
,
Object
>>
list
=
eiBlock
.
getRows
();
Map
<
Object
,
List
<
Map
>>
listMap
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
map
->
map
.
get
(
HPCG001
.
FIELD_INVENT_TYPE
)));
for
(
Object
str:
listMap
.
keySet
())
{
HPCG002
hpcg002
=
new
HPCG002
();
hpcg002
.
toMap
();
hpcg002
.
setProPlanDate
(
StringUtil
.
removeHorizontalLine
(
DateUtils
.
date
()));
hpcg002
.
setInventType
(
str
.
toString
());
//生成采购计划单号
hpcg002
.
setProPlanNo
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
PRO_APPLY_NO
));
//添加采购计划
DaoUtils
.
insert
(
HPCG002
.
INSERT
,
hpcg002
);
List
<
HPCG002
>
list1
=
this
.
dao
.
query
(
HPCG002
.
QUERY
,
new
HashMap
<
String
,
Object
>(){{
put
(
HPCG002
.
FIELD_INVENT_TYPE
,
hpcg002
.
getInventType
());
put
(
HPCG002
.
FIELD_PRO_PLAN_DATE
,
hpcg002
.
getProPlanDate
());
put
(
HPCG002
.
FIELD_PRO_PLAN_NO
,
hpcg002
.
getProPlanNo
());
put
(
HPCG002
.
FIELD_PRO_PLAN_STATUS
,
hpcg002
.
getProPlanStatus
());
}});
List
<
Map
>
hpcg001List
=
listMap
.
get
(
str
);
for
(
Map
value
:
hpcg001List
)
{
HPCG001
hpcg001
=
new
HPCG001
();
hpcg001
.
fromMap
(
value
);
//添加采购计划详情
HPCG002A
hpcg002a
=
new
HPCG002A
();
hpcg002a
.
fromMap
(
value
);
hpcg002a
.
setParentId
(
list1
.
get
(
0
).
getId
());
hpcg002a
.
setApplyUnitWeight
(
hpcg001
.
getUnitWeight
());
hpcg002a
.
setApplyWeight
(
hpcg001
.
getWeight
());
hpcg002a
.
setId
(
0L
);
//计算采购计划重量
this
.
calcPurchaseWeight
(
hpcg002a
);
DaoUtils
.
insert
(
HPCG002A
.
INSERT
,
hpcg002a
);
//修改提交状态
hpcg001
.
setProApplyStatus
(
CommonConstant
.
YesNo
.
YES_1
);
DaoUtils
.
update
(
HPCG001
.
UPDATE_PRO_APPLY_STATUS
,
hpcg001
);
}
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsgByKey
(
"ep.1000"
,
new
String
[]{
String
.
valueOf
(
i
),
I18nMessages
.
getText
(
"label.approve"
,
"提交"
)});
}
catch
(
PlatException
e
)
{
e
.
printStackTrace
();
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
ErrorCodeUtils
.
handleDeleteException
(
inInfo
,
i
,
e
);
logError
(
"提交失败"
,
e
.
getMessage
());
return
inInfo
;
}
return
inInfo
;
}
/**
* 计算重量
*
* @param hpcg001
*/
private
void
calcWeight
(
HPCG001
hpcg001
)
{
// 根据规格计算单重
hpcg001
.
setUnitWeight
(
HPPZTools
.
HpPz006
.
calcUnitWeight
(
hpcg001
.
getInventRecordId
()));
// 计算总重
hpcg001
.
setWeight
(
hpcg001
.
getApplyAmount
().
multiply
(
hpcg001
.
getUnitWeight
()).
divide
(
new
BigDecimal
(
"1000"
)));
}
/**
* 设置基础信息
*
* @param hpcg001
*/
private
void
setBaseInfo
(
HPCG001
hpcg001
)
{
// 去除日期字符串中的-
hpcg001
.
setProApplyDate
(
StringUtil
.
removeHorizontalLine
(
hpcg001
.
getProApplyDate
()));
// 仓库名称
hpcg001
.
setWhName
(
HPPZTools
.
HpPz007
.
getByCode
(
hpcg001
.
getWhCode
()).
getWhName
());
// 存货名称
// fKc001.setInventName(HPPZTools.HpPz004.getByCode(fKc001.getInventCode()).getInventName());
}
/**
* 计算采购计划重量
* @param hpcg002a
*/
private
void
calcPurchaseWeight
(
HPCG002A
hpcg002a
){
BigDecimal
applyAmount
=
new
BigDecimal
(
0
);
List
<
HPKC010
>
hpkc010s
=
this
.
dao
.
query
(
HPKC010
.
QUERY
,
new
HashMap
<
String
,
Object
>(){{
put
(
HPCG002A
.
FIELD_INVENT_RECORD_ID
,
hpcg002a
.
getInventRecordId
());
put
(
HPCG002A
.
FIELD_INVENT_CODE
,
hpcg002a
.
getInventCode
());
put
(
HPCG002A
.
FIELD_INVENT_TYPE
,
hpcg002a
.
getInventType
());
put
(
HPCG002A
.
FIELD_WH_CODE
,
hpcg002a
.
getWhCode
());
put
(
HPCG002A
.
FIELD_FACTORY_CODE
,
hpcg002a
.
getFactoryCode
());
put
(
HPCG002A
.
FIELD_DELETE_FLAG
,
CommonConstant
.
YesNo
.
NO_0
);
}});
for
(
HPKC010
hpkc010
:
hpkc010s
)
{
applyAmount
=
applyAmount
.
add
(
hpkc010
.
getAmount
());
}
hpcg002a
.
setPlanAmount
(
hpcg002a
.
getApplyAmount
().
subtract
(
applyAmount
));
BigDecimal
planWeight
=
hpcg002a
.
getApplyAmount
().
subtract
(
applyAmount
).
multiply
(
hpcg002a
.
getApplyUnitWeight
()).
divide
(
new
BigDecimal
(
"1000"
),
3
,
BigDecimal
.
ROUND_UP
);
hpcg002a
.
setPlanWeight
(
planWeight
);
}
}
src/main/webapp/HP/CG/HPCG001.js
0 → 100644
View file @
08949142
let
whNameGlobalData
=
[];
let
inventNameGlobalData
=
[];
let
inventAllGlobalData
=
[];
$
(
function
()
{
$
(
".row"
).
children
().
attr
(
"class"
,
"col-md-3"
);
$
(
"#QUERY"
).
on
(
"click"
,
query
);
/* 页面查询框的尺寸设置 */
$
.
extend
(
true
,
IPLATUI
.
Config
,
{
EFGrid
:
{
height
:
$
(
document
).
height
()
-
$
(
"#inqu"
).
height
()
-
$
(
"#ef_form_head"
).
height
()
-
100
,
/*pageable: {
input: true,
numeric: false,
pageSizes: [10, 50 , 100 , 200]
}*/
}
});
IPLATUI
.
EFGrid
=
{
"result"
:
{
columns
:
[{
field
:
"proApplyDate"
,
attributes
:
{
class
:
"i-input-readonly"
},
defaultValue
:
function
()
{
return
currShortDate
();
}
},
{
field
:
"whCode"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
whNameGlobalData
.
length
;
i
++
)
{
if
(
whNameGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'whCode'
])
{
return
whNameGlobalData
[
i
][
'textField'
];
}
}
return
""
;
},
editor
:
function
(
container
,
options
)
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
]);
inInfo
.
set
(
"inqu_status-0-whType"
,
options
.
model
[
"inventType"
]);
inInfo
.
set
(
"inqu_status-0-factoryCode"
,
options
.
model
[
"factoryCode"
]);
inInfo
.
set
(
"inqu_status-0-isSplicingSymbol"
,
false
);
inInfo
.
set
(
"serviceName"
,
"HPPZ007"
);
inInfo
.
set
(
"methodName"
,
"queryComboBox"
);
inInfo
.
set
(
"blockId"
,
"wh_record_block_id"
);
inInfo
.
set
(
"field"
,
options
.
field
);
refreshSelect
(
container
,
inInfo
);
}
},
{
field
:
"inventName"
,
title
:
"存货名称"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
inventNameGlobalData
.
length
;
i
++
)
{
if
(
dataItem
[
'inventCode'
].
length
==
0
){
if
(
inventNameGlobalData
[
i
][
'param1Field'
]
===
dataItem
[
'inventName'
])
{
dataItem
[
'inventCode'
]
=
inventNameGlobalData
[
i
][
'valueField'
];
dataItem
[
'inventRecordId'
]
=
inventNameGlobalData
[
i
][
'param9Field'
]
return
inventNameGlobalData
[
i
][
'param1Field'
];
}
}
else
{
if
(
inventNameGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'inventCode'
])
{
//dataItem['inventCode'] = inventNameGlobalData[i]['valueField'];
dataItem
[
'inventRecordId'
]
=
inventNameGlobalData
[
i
][
'param9Field'
]
return
inventNameGlobalData
[
i
][
'param1Field'
];
}
}
}
return
dataItem
[
'inventName'
];
},
editor
:
function
(
container
,
options
)
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材,5.废料
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
]);
inInfo
.
set
(
"inqu_status-0-inventType"
,
options
.
model
[
"inventType"
]);
inInfo
.
set
(
"inqu_status-0-isSplicingSymbol"
,
false
);
inInfo
.
set
(
"serviceName"
,
"HPPZ006"
);
inInfo
.
set
(
"methodName"
,
"queryComboBox"
);
inInfo
.
set
(
"blockId"
,
"invent_spec_all_block_id"
);
inInfo
.
set
(
"field"
,
options
.
field
);
refreshInputSelect
(
container
,
inInfo
);
}
},
{
field
:
"spec"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
inventAllGlobalData
.
length
;
i
++
)
{
if
(
inventAllGlobalData
[
i
][
'textField'
]
===
dataItem
[
'spec'
])
{
dataItem
[
'inventRecordId'
]
=
inventAllGlobalData
[
i
][
'valueField'
]
return
inventAllGlobalData
[
i
][
'textField'
];
}
else
{
dataItem
[
'inventRecordId'
]
=
''
;
}
}
return
dataItem
[
'spec'
]
==
null
?
""
:
dataItem
[
'spec'
];
},
editor
:
function
(
container
,
options
)
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
]);
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
);
refreshInputSelect
(
container
,
inInfo
);
}
},
{
field
:
"unitWeight"
,
template
:
function
(
options
)
{
return
options
.
unitWeight
==
0
?
"-"
:
options
.
unitWeight
;
}
},
{
field
:
"weight"
,
template
:
function
(
options
)
{
return
options
.
weight
==
0
?
"-"
:
options
.
weight
;
}
},
{
field
:
"length"
,
template
:
function
(
options
)
{
return
options
.
length
==
0
?
"-"
:
options
.
length
;
}
},
{
field
:
"width"
,
template
:
function
(
options
)
{
return
options
.
width
==
0
?
"-"
:
options
.
width
;
}
},
{
field
:
"thick"
,
template
:
function
(
options
)
{
return
options
.
thick
==
0
?
"-"
:
options
.
thick
;
}
}],
loadComplete
:
function
(
grid
)
{
// 此grid对象
grid
.
dataSource
.
bind
(
"change"
,
function
(
e
)
{
if
(
e
.
field
==
"inventName"
)
{
console
.
log
();
var
tr
,
index
;
// 获取此model元素信息
var
item
=
e
.
items
[
0
];
for
(
let
k
=
0
;
k
<
resultGrid
.
getCheckedRowsIndex
()
+
1
;
k
++
)
{
for
(
let
i
=
0
;
i
<
inventNameGlobalData
.
length
;
i
++
)
{
if
(
inventNameGlobalData
[
i
][
'textField'
]
===
item
.
inventName
)
{
//dataItem['spec'] = inventNameGlobalData[i]['param2Field'];
/* dataItem['material'] = inventNameGlobalData[i]['param3Field'];
dataItem['unit'] = inventNameGlobalData[i]['param4Field'];
dataItem['length'] = inventNameGlobalData[i]['param5Field'];
dataItem['width'] = inventNameGlobalData[i]['param6Field'];
dataItem['thick'] = inventNameGlobalData[i]['param7Field'];
dataItem['coefficient'] = inventNameGlobalData[i]['param8Field'];
dataItem['inventRecordId'] = inventNameGlobalData[i]['param9Field'];*/
resultGrid
.
setCellValue
(
item
,
'inventName'
,
inventNameGlobalData
[
i
][
'param1Field'
]);
resultGrid
.
setCellValue
(
item
,
'spec'
,
inventNameGlobalData
[
i
][
'param2Field'
]);
resultGrid
.
setCellValue
(
item
,
'material'
,
inventNameGlobalData
[
i
][
'param3Field'
]);
resultGrid
.
setCellValue
(
item
,
'unit'
,
inventNameGlobalData
[
i
][
'param4Field'
]);
resultGrid
.
setCellValue
(
item
,
'length'
,
inventNameGlobalData
[
i
][
'param5Field'
]);
resultGrid
.
setCellValue
(
item
,
'width'
,
inventNameGlobalData
[
i
][
'param6Field'
]);
resultGrid
.
setCellValue
(
item
,
'thick'
,
inventNameGlobalData
[
i
][
'param7Field'
]);
resultGrid
.
setCellValue
(
item
,
'coefficient'
,
inventNameGlobalData
[
i
][
'param8Field'
]);
//resultGrid.refresh();
$
(
"#locked_datacell_0_"
+
k
+
" input"
).
attr
(
"checked"
,
true
);
break
;
}
}
}
}
if
(
e
.
field
==
"spec"
)
{
var
tr
,
index
;
// 获取此model元素信息
var
item
=
e
.
items
[
0
];
for
(
let
k
=
0
;
k
<
resultGrid
.
getCheckedRowsIndex
()
+
1
;
k
++
)
{
for
(
let
i
=
0
;
i
<
inventAllGlobalData
.
length
;
i
++
)
{
if
(
inventAllGlobalData
[
i
][
'textField'
]
===
item
.
spec
)
{
resultGrid
.
setCellValue
(
item
,
'material'
,
inventAllGlobalData
[
i
][
'param1Field'
]);
resultGrid
.
setCellValue
(
item
,
'unit'
,
inventAllGlobalData
[
i
][
'param2Field'
]);
resultGrid
.
setCellValue
(
item
,
'length'
,
inventAllGlobalData
[
i
][
'param3Field'
]);
resultGrid
.
setCellValue
(
item
,
'width'
,
inventAllGlobalData
[
i
][
'param4Field'
]);
resultGrid
.
setCellValue
(
item
,
'thick'
,
inventAllGlobalData
[
i
][
'param5Field'
]);
resultGrid
.
setCellValue
(
item
,
'coefficient'
,
inventAllGlobalData
[
i
][
'param6Field'
]);
$
(
"#locked_datacell_0_"
+
k
+
" input"
).
attr
(
"checked"
,
true
);
//resultGrid.refresh();
break
;
}
}
}
}
});
},
onSave
:
function
(
e
)
{
// 阻止后台保存请求,使用自定义保存
e
.
preventDefault
();
let
btnNode
=
$
(
this
);
//禁用按钮
btnNode
.
attr
(
"disabled"
,
true
);
save
(
btnNode
);
},
onSuccess
:
function
(
e
)
{
if
(
e
.
eiInfo
.
extAttr
.
methodName
==
'save'
||
e
.
eiInfo
.
extAttr
.
methodName
==
'delete'
||
e
.
eiInfo
.
extAttr
.
methodName
==
'approve'
){
query
();
}
}
}
}
$
(
"#APPROVE"
).
on
(
"click"
,
function
()
{
approveFunc
();
})
downKeyUp
();
})
/**
* 页面加载时执行
*/
$
(
window
).
load
(
function
()
{
// 仓库名称
initWh
()
// 存货名称
initInvent
()
// 规格
initSpec
()
// 查询
query
();
});
/**
* 初始化仓库
*/
let
initWh
=
function
()
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
]);
inInfo
.
set
(
"inqu_status-0-isSplicingSymbol"
,
false
);
EiCommunicator
.
send
(
"HPPZ007"
,
"queryComboBox"
,
inInfo
,
{
onSuccess
:
function
(
ei
)
{
whNameGlobalData
=
ei
.
getBlock
(
"wh_record_block_id"
).
getMappedRows
();
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
}
/**
* 初始化存货
*/
let
initInvent
=
function
()
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
]);
EiCommunicator
.
send
(
"HPPZ006"
,
"queryComboBox"
,
inInfo
,
{
onSuccess
:
function
(
ei
)
{
inventNameGlobalData
=
ei
.
getBlock
(
"invent_spec_all_block_id"
).
getMappedRows
();
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
}
/**
* 初始化规格
*/
let
initSpec
=
function
()
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
]);
inInfo
.
set
(
"inqu_status-0-isSplicingSymbol"
,
false
);
EiCommunicator
.
send
(
"HPPZ006"
,
"queryComboBoxAll"
,
inInfo
,
{
onSuccess
:
function
(
ei
)
{
inventAllGlobalData
=
ei
.
getBlock
(
"invent_all_block_id"
).
getMappedRows
();
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
}
let
query
=
function
()
{
resultGrid
.
dataSource
.
page
(
1
);
}
/**
* 保存
*/
let
save
=
function
(
btnNode
)
{
let
rows
=
resultGrid
.
getCheckedRows
();
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
);
return
;
}
let
flag
=
true
;
$
.
each
(
rows
,
function
(
index
,
item
)
{
let
factoryCode
=
item
.
get
(
"factoryCode"
);
if
(
isBlank
(
factoryCode
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
工厂
\"
,不能为空!"
);
flag
=
false
;
return
false
;
}
});
if
(
flag
)
{
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
保存
\"
操作? "
,
{
ok
:
function
()
{
JSUtils
.
submitGridsData
(
"result"
,
"HPCG001"
,
"save"
,
true
);
btnNode
.
attr
(
"disabled"
,
false
);
}
});
}
}
/**
* 提交
*/
function
approveFunc
()
{
let
rows
=
resultGrid
.
getCheckedRows
();
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
);
return
;
}
let
flag
=
true
;
$
.
each
(
rows
,
function
(
index
,
item
)
{
let
proApplyStatus
=
item
.
get
(
"proApplyStatus"
);
if
(
isBlank
(
proApplyStatus
)){
message
(
"选中的第"
+
(
index
+
1
)
+
"行
\"
数据已提交
\"
,不能再次选中提交!"
);
flag
=
false
;
return
false
;
}
});
if
(
flag
)
{
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
提交
\"
操作? "
,
{
ok
:
function
()
{
JSUtils
.
submitGridsData
(
"result"
,
"HPCG001"
,
"approve"
,
true
);
}
});
}
}
function
updateStatus
(
id
)
{
let
inEiInfo
=
new
EiInfo
();
inEiInfo
.
set
(
"result-0-id"
,
id
);
inEiInfo
.
set
(
"result-0-status"
,
1
);
EiCommunicator
.
send
(
'HPPZ018'
,
'updateStatus'
,
inEiInfo
,
{
onSuccess
(
response
)
{
NotificationUtil
(
response
.
msg
);
query
();
},
onFail
(
errorMessage
,
status
,
e
)
{
NotificationUtil
(
"执行失败!"
,
"error"
);
}
},
{
async
:
false
}
);
}
\ No newline at end of file
src/main/webapp/HP/CG/HPCG001.jsp
0 → 100644
View file @
08949142
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/4/26
Time: 17:09
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ 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:EFDateSpan startCname="采购申请日期(从)" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8">
</EF:EFDateSpan>
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2')"/>
</EF:EFSelect>
<EF:EFSelect cname="提交状态" ename="inqu_status-0-proApplyStatus" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOption label="未提交" value="0"/>
<EF:EFOption label="已提交" value="1"/>
</EF:EFSelect>
</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>
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>--%>
<%--<div class="row">
<EF:EFInput cname="采购单号" ename="inqu_status-0-proApplyNo" colWidth="3"/>
<EF:EFSelect ename="inqu_status-0-factoryCode" cname="厂区" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="是否删除" ename="inqu_status-0-deleteFlag" colWidth="3" defaultValue="0">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/>
</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="proApplyDate" cname="采购申请日期" width="110" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" readonly="true"/>
<EF:EFColumn ename="proApplyNo" cname="采购申请单号" enable="false" width="130" align="center"/>
<EF:EFComboColumn ename="factoryCode" required="true" cname="厂区" width="110" align="center" defaultValue=""
filter="contains" readonly="true">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="80" align="center" required="true" readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="150" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" width="120" align="center" readonly="true" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" readonly="true"/>
<EF:EFColumn ename="applyAmount" cname="申请数量" format="{0:N0}" maxLength="20" width="100" align="right" required="true" readonly="true"/>
<EF:EFColumn ename="unitWeight" cname="单重(KG)" enable="false" width="100" align="right" format="{0:N6}"/>
<EF:EFColumn ename="weight" cname="总重(T)" enable="false" width="100" align="right" format="{0:N6}"/>
<EF:EFColumn ename="length" cname="长(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="material" cname="材质" width="80" align="center" readonly="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center" readonly="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150" readonly="true"/>
<EF:EFComboColumn ename="proApplyStatus" cname="提交状态" width="80" align="center" enable="false" defaultValue="0">
<EF:EFOption label="未提交" value="0"/>
<EF:EFOption label="已提交" value="1"/>
</EF:EFComboColumn>
<EF:EFColumn ename="oldPurchaseNo" cname="原采购单号" enable="false" width="140" align="center" hidden="true"/>
</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