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
122ca764
Commit
122ca764
authored
Feb 29, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.其他入库选择规格逻辑错误问题修复
parent
568fe980
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
177 deletions
+138
-177
ServiceHPKC001.java
.../java/com/baosight/hpjx/hp/kc/service/ServiceHPKC001.java
+27
-66
HPKC001.js
src/main/webapp/HP/KC/HPKC001.js
+25
-2
HPKC006.js
src/main/webapp/HP/KC/HPKC006.js
+86
-109
No files found.
src/main/java/com/baosight/hpjx/hp/kc/service/ServiceHPKC001.java
View file @
122ca764
...
...
@@ -45,6 +45,7 @@ public class ServiceHPKC001 extends ServiceBase {
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation
(
operModul
=
"采购入库单"
,
operType
=
"查询"
,
operDesc
=
"初始化"
)
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
try
{
...
...
@@ -67,8 +68,8 @@ public class ServiceHPKC001 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"采购入库单"
,
operType
=
"查询"
,
operDesc
=
"查询"
)
@Override
@OperationLogAnnotation
(
operModul
=
"采购入库单"
,
operType
=
"查询"
,
operDesc
=
"查询"
)
public
EiInfo
query
(
EiInfo
inInfo
)
{
try
{
Map
queryRow
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
...
...
@@ -86,38 +87,51 @@ public class ServiceHPKC001 extends ServiceBase {
}
/**
*
新增操作
*
保存操作.
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation
(
operModul
=
"采购入库单"
,
operType
=
"插入"
,
operDesc
=
"插入"
)
public
EiInfo
insert
(
EiInfo
inInfo
)
{
@OperationLogAnnotation
(
operModul
=
"采购入库单"
,
operType
=
"插入"
,
operDesc
=
"保存"
)
public
EiInfo
save
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 数据校验
this
.
checkSaveData
(
resultRows
);
//
数据写入
this
.
insert
Data
(
resultRows
);
//
写入数据
this
.
save
Data
(
resultRows
);
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据
新增
成功!"
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据
保存
成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"
新增
失败"
);
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"
保存
失败"
);
}
return
inInfo
;
}
/**
*
写入
数据
*
保存
数据
*
* @param resultRows
*/
private
void
insert
Data
(
List
<
Map
>
resultRows
)
{
private
void
save
Data
(
List
<
Map
>
resultRows
)
{
for
(
Map
resultRow
:
resultRows
)
{
HPKC001
fKc001
=
new
HPKC001
();
fKc001
.
fromMap
(
resultRow
);
if
(
fKc001
.
getId
()
==
null
||
fKc001
.
getId
()
==
0
)
{
this
.
addData
(
fKc001
);
}
else
{
// TODO 采购入库不支持修改
}
}
}
/**
* 写入数据
*
* @param fKc001
*/
private
void
addData
(
HPKC001
fKc001
)
{
// 设置基础信息
this
.
setBaseInfo
(
fKc001
);
// 生成入库单号
...
...
@@ -127,36 +141,6 @@ public class ServiceHPKC001 extends ServiceBase {
HPKCTools
.
updateStock
(
fKc001
.
getWhCode
(),
fKc001
.
getInventRecordId
(),
fKc001
.
getAmount
(),
fKc001
.
getUnitWeight
(),
fKc001
.
getWeight
());
}
}
/**
* 修改操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation
(
operModul
=
"采购入库单"
,
operType
=
"修改"
,
operDesc
=
"修改"
)
public
EiInfo
update
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 数据校验
this
.
checkSaveData
(
resultRows
);
// 入库单号
List
<
String
>
otherEnterNos
=
ObjectUtils
.
listKey
(
resultRows
,
"otherEnterNo"
);
// 锁记录
HPKCTools
.
HpKc001
.
lock
(
otherEnterNos
);
// 查询数据库记录
Map
<
String
,
HPKC001
>
mapKc001
=
HPKCTools
.
HpKc001
.
map
(
otherEnterNos
);
// 保存数据
this
.
saveData
(
resultRows
,
mapKc001
);
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_SUCCESS
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据修改成功!"
);
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"修改失败"
);
}
return
inInfo
;
}
/**
* 校验保存的数据
...
...
@@ -164,9 +148,9 @@ public class ServiceHPKC001 extends ServiceBase {
* @param resultRows
*/
private
void
checkSaveData
(
List
<
Map
>
resultRows
)
{
for
(
int
i
=
0
;
i
<
resultRows
.
size
();
i
++
)
{
for
(
Map
resultRow
:
resultRows
)
{
HPKC001
fKc001
=
new
HPKC001
();
fKc001
.
fromMap
(
resultRow
s
.
get
(
i
)
);
fKc001
.
fromMap
(
resultRow
);
AssertUtils
.
isEmpty
(
fKc001
.
getWhCode
(),
"仓库名称不能为空"
);
AssertUtils
.
isEmpty
(
fKc001
.
getInventCode
(),
"存货名称不能为空"
);
AssertUtils
.
isNull
(
fKc001
.
getInventRecordId
(),
"规格不能为空"
);
...
...
@@ -176,29 +160,6 @@ public class ServiceHPKC001 extends ServiceBase {
}
/**
* 保存数据
*
* @param resultRows
* @param mapKc001
*/
private
void
saveData
(
List
<
Map
>
resultRows
,
Map
<
String
,
HPKC001
>
mapKc001
)
{
for
(
Map
resultRow
:
resultRows
)
{
HPKC001
fKc001
=
new
HPKC001
();
fKc001
.
fromMap
(
resultRow
);
// 设置基础信息
this
.
setBaseInfo
(
fKc001
);
DaoUtils
.
update
(
HPKC001
.
UPDATE
,
fKc001
);
// 计算差异数量与重量
HPKC001
dbKc001
=
mapKc001
.
get
(
fKc001
.
getPurchaseNo
());
BigDecimal
diffAmount
=
fKc001
.
getAmount
().
subtract
(
dbKc001
.
getAmount
());
BigDecimal
diffWeight
=
fKc001
.
getWeight
().
subtract
(
dbKc001
.
getWeight
());
// 修改库存
HPKCTools
.
updateStock
(
fKc001
.
getWhCode
(),
fKc001
.
getInventRecordId
(),
diffAmount
,
fKc001
.
getUnitWeight
(),
diffWeight
);
}
}
/**
* 设置基础信息
*
* @param fKc001
...
...
src/main/webapp/HP/KC/HPKC001.js
View file @
122ca764
...
...
@@ -11,6 +11,9 @@ $(function() {
"result"
:
{
columns
:
[{
field
:
"receiptDate"
,
attributes
:
{
class
:
"i-input-readonly"
},
defaultValue
:
function
()
{
return
currShortDate
();
}
...
...
@@ -116,6 +119,11 @@ $(function() {
}
});
},
onSave
:
function
(
e
)
{
// 阻止后台保存请求,使用自定义保存
e
.
preventDefault
();
save
();
},
onSuccess
:
function
(
e
)
{
if
(
e
.
eiInfo
.
extAttr
.
methodName
==
'update'
||
e
.
eiInfo
.
extAttr
.
methodName
==
'insert'
...
...
@@ -214,8 +222,23 @@ let save = function () {
return
;
}
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
let
amount
=
rows
[
i
][
'amount'
];
if
(
!
isPositiveInteger
(
amount
))
{
if
(
isBlank
(
rows
[
i
][
'inventType'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行存货类型不能为空"
);
return
;
}
if
(
isBlank
(
rows
[
i
][
'whCode'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行仓库名称不能为空"
);
return
;
}
if
(
isBlank
(
rows
[
i
][
'inventCode'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行存货名称不能为空"
);
return
;
}
if
(
isBlank
(
rows
[
i
][
'inventRecordId'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行规格不能为空"
);
return
;
}
if
(
!
isPositiveInteger
(
rows
[
i
][
'amount'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行数量必须是大于0的整数"
);
return
;
}
...
...
src/main/webapp/HP/KC/HPKC006.js
View file @
122ca764
let
whNameGlobalData
=
[];
let
inventNameGlobalData
=
[];
let
spec
GlobalData
=
[];
let
inventAll
GlobalData
=
[];
let
firstLoad
=
0
;
$
(
function
()
{
IPLATUI
.
EFGrid
=
{
...
...
@@ -12,6 +13,9 @@ $(function() {
"result"
:
{
columns
:
[{
field
:
"receiptDate"
,
attributes
:
{
class
:
"i-input-readonly"
},
defaultValue
:
function
()
{
return
currShortDate
();
}
...
...
@@ -28,6 +32,7 @@ $(function() {
},
editor
:
function
(
container
,
options
)
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材,5.废料
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
,
5
]);
inInfo
.
set
(
"inqu_status-0-whType"
,
options
.
model
[
"inventType"
]);
inInfo
.
set
(
"inqu_status-0-isSplicingSymbol"
,
false
);
...
...
@@ -41,98 +46,41 @@ $(function() {
field
:
"inventName"
,
title
:
"存货名称"
,
template
:
function
(
dataItem
)
{
//let flag = false;
for
(
let
i
=
0
;
i
<
inventNameGlobalData
.
length
;
i
++
)
{
if
(
inventNameGlobalData
[
i
][
'textField'
]
===
dataItem
[
'inventName'
])
{
dataItem
.
inventCode
=
inventNameGlobalData
[
i
][
'valueField'
]
//flag= true;
dataItem
[
'inventCode'
]
=
inventNameGlobalData
[
i
][
'valueField'
]
return
inventNameGlobalData
[
i
][
'textField'
];
}
else
{
dataItem
[
'inventCode'
]
=
''
;
}
}
return
dataItem
.
inventName
;
return
dataItem
[
'inventName'
]
;
},
editor
:
function
(
container
,
options
)
{
var
grid
=
container
.
closest
(
".k-grid"
).
data
(
"kendoGrid"
);
var
input
=
$
(
'<input />'
);
var
dataSource
;
input
.
attr
(
"name"
,
options
.
field
);
input
.
attr
(
"id"
,
options
.
field
);
input
.
appendTo
(
container
);
var
eiInfo
=
new
EiInfo
();
eiInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
,
5
]);
eiInfo
.
set
(
"inventType"
,
options
.
model
[
"inventType"
]);
eiInfo
.
set
(
"isSplicingSymbol"
,
false
);
//eiInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
//eiInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
//eiInfo.set("inqu_status-0-company_name", options.model["company_name"]);
EiCommunicator
.
send
(
"HPPZ004"
,
"queryComboBox"
,
eiInfo
,
{
onSuccess
:
function
(
ei
)
{
dataSource
=
ei
.
getBlock
(
"invent_name_block_id"
).
getMappedRows
();
inventNameGlobalData
=
dataSource
;
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
input
.
kendoAutoComplete
({
valuePrimitive
:
true
,
dataSource
:
dataSource
,
dataTextField
:
"textField"
,
dataValueField
:
"valueField"
,
required
:
"true"
,
optionLabelTemplate
:
"#:textField#"
,
valueTemplate
:
"#:valueField#"
,
template
:
"#:textField#"
,
filter
:
"contains"
});
}
/*editor: function (container, options) {
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材,5.废料
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
(
"inqu_status-0-isSplicingSymbol"
,
false
);
inInfo
.
set
(
"serviceName"
,
"HPPZ004"
);
inInfo
.
set
(
"methodName"
,
"queryComboBox"
);
inInfo
.
set
(
"blockId"
,
"invent_name_block_id"
);
inInfo
.
set
(
"field"
,
options
.
field
);
refreshSelect(container, inInfo);
}
*/
refresh
Input
Select
(
container
,
inInfo
);
}
},
{
field
:
"inventRecordId"
,
title
:
"规格"
,
template
:
function
(
dataItem
)
{
for
(
let
i
=
0
;
i
<
specGlobalData
.
length
;
i
++
)
{
if
(
specGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'inventRecordId'
])
{
let
inventRecordId
=
specGlobalData
[
i
][
'textField'
];
/*if (firstLoad === 1){
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-id", dataItem['inventRecordId']);
EiCommunicator.send("HPPZ006", "query", inInfo, {
onSuccess: function (ei) {
let data = ei.blocks.result.rows;
var id = "#datacell__5";
$(id).text(e.model.inventCode)
dataItem["length"] = data[0][8]
dataItem["width"] = data[0][9]
dataItem["thick"] = data[0][10]
dataItem["material"] = data[0][11]
dataItem["coefficient"] = data[0][12]
dataItem["unit"] = data[0][13]
firstLoad = 0;
},
onFail: function (ei) {
}
}, {async: false});
//queryHPPZ006(inInfo,dataItem)
}*/
return
inventRecordId
;
for
(
let
i
=
0
;
i
<
inventAllGlobalData
.
length
;
i
++
)
{
if
(
inventAllGlobalData
[
i
][
'valueField'
]
===
dataItem
[
'inventRecordId'
])
{
return
inventAllGlobalData
[
i
][
'textField'
];
}
}
return
""
;
},
editor
:
function
(
container
,
options
)
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材,5.废料
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
,
5
]);
inInfo
.
set
(
"inqu_status-0-inventCode"
,
options
.
model
[
"inventCode"
]);
inInfo
.
set
(
"serviceName"
,
"HPPZ006"
);
...
...
@@ -144,7 +92,6 @@ $(function() {
}],
loadComplete
:
function
(
grid
)
{
},
//beforeAdd:function(){firstLoad = 1},
onSave
:
function
(
e
)
{
// 阻止后台保存请求,使用自定义保存
e
.
preventDefault
();
...
...
@@ -152,41 +99,29 @@ $(function() {
},
afterEdit
:
function
(
e
)
{
if
(
e
.
field
===
"inventRecordId"
)
{
let
inventRecordId
=
e
.
model
.
inventRecordId
;
if
(
isBlank
(
inventRecordId
))
{
return
;
}
let
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inqu_status-0-id"
,
e
.
model
.
inventRecordId
);
// ID为空的情况下需要返回一条空数据
inInfo
.
set
(
"inqu_status-0-id"
,
inventRecordId
);
EiCommunicator
.
send
(
"HPPZ006"
,
"query"
,
inInfo
,
{
onSuccess
:
function
(
ei
)
{
let
data
=
ei
.
blocks
.
result
.
rows
;
//var id = "#datacell__5";
//$(id).text(e.model.inventCode)
resultGrid
.
setCellValue
(
e
.
model
,
"length"
,
data
[
0
][
8
])
resultGrid
.
setCellValue
(
e
.
model
,
"width"
,
data
[
0
][
9
])
resultGrid
.
setCellValue
(
e
.
model
,
"thick"
,
data
[
0
][
10
])
resultGrid
.
setCellValue
(
e
.
model
,
"material"
,
data
[
0
][
11
])
resultGrid
.
setCellValue
(
e
.
model
,
"coefficient"
,
data
[
0
][
12
])
resultGrid
.
setCellValue
(
e
.
model
,
"unit"
,
data
[
0
][
13
])
//dataItem["length"] = data[0][8]
//dataItem["width"] = data[0][9]
//dataItem["thick"] = data[0][10]
//dataItem["material"] = data[0][11]
//dataItem["coefficient"] = data[0][12]
//dataItem["unit"] = data[0][13]
if
(
data
.
length
>
0
)
{
resultGrid
.
setCellValue
(
e
.
model
,
"length"
,
data
[
0
][
8
])
resultGrid
.
setCellValue
(
e
.
model
,
"width"
,
data
[
0
][
9
])
resultGrid
.
setCellValue
(
e
.
model
,
"thick"
,
data
[
0
][
10
])
resultGrid
.
setCellValue
(
e
.
model
,
"material"
,
data
[
0
][
11
])
resultGrid
.
setCellValue
(
e
.
model
,
"coefficient"
,
data
[
0
][
12
])
resultGrid
.
setCellValue
(
e
.
model
,
"unit"
,
data
[
0
][
13
])
}
firstLoad
=
0
;
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
//firstLoad = 1;
/*var id = "#datacell_"+e.row+"_5";
$(id).text(e.model.inventCode)
resultGrid.setCellValue({
list:7,
field:"inventRecordId",
cellValue:e.model.inventCode
})
console.log(e.model.inventCode);*/
//e.preventDefault(); // 不关闭单元格
}
},
onSuccess
:
function
(
e
)
{
...
...
@@ -211,7 +146,22 @@ $(function() {
*/
$
(
window
).
load
(
function
()
{
// 仓库名称
initWh
()
// 存货名称
initInvent
()
// 规格
initSpec
()
// 查询
query
();
});
/**
* 初始化仓库
*/
let
initWh
=
function
()
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材,5.废料
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
,
5
]);
inInfo
.
set
(
"inqu_status-0-isSplicingSymbol"
,
false
);
EiCommunicator
.
send
(
"HPPZ007"
,
"queryComboBox"
,
inInfo
,
{
...
...
@@ -221,7 +171,16 @@ $(window).load(function () {
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
// 存货名称
}
/**
* 初始化存货
*/
let
initInvent
=
function
()
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材,5.废料
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
,
5
]);
inInfo
.
set
(
"inqu_status-0-isSplicingSymbol"
,
false
);
EiCommunicator
.
send
(
"HPPZ004"
,
"queryComboBox"
,
inInfo
,
{
onSuccess
:
function
(
ei
)
{
inventNameGlobalData
=
ei
.
getBlock
(
"invent_name_block_id"
).
getMappedRows
();
...
...
@@ -229,17 +188,24 @@ $(window).load(function () {
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
// 规格
EiCommunicator
.
send
(
"HPPZ006"
,
"queryComboBoxSpec"
,
inInfo
,
{
}
/**
* 初始化规格
*/
let
initSpec
=
function
()
{
let
inInfo
=
new
EiInfo
();
// 1.原料,2.耗材,5.废料
inInfo
.
set
(
"inqu_status-0-inventTypes"
,
[
1
,
2
,
5
]);
inInfo
.
set
(
"inqu_status-0-isSplicingSymbol"
,
false
);
EiCommunicator
.
send
(
"HPPZ006"
,
"queryComboBoxAll"
,
inInfo
,
{
onSuccess
:
function
(
ei
)
{
specGlobalData
=
ei
.
getBlock
(
"invent_spec
_block_id"
).
getMappedRows
();
inventAllGlobalData
=
ei
.
getBlock
(
"invent_all
_block_id"
).
getMappedRows
();
},
onFail
:
function
(
ei
)
{
}
},
{
async
:
false
});
// 查询
query
();
});
}
/**
* 查询
...
...
@@ -259,8 +225,19 @@ let save = function () {
return
;
}
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
let
amount
=
rows
[
i
][
'amount'
];
if
(
!
isPositiveInteger
(
amount
))
{
if
(
isBlank
(
rows
[
i
][
'inventType'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行存货类型不能为空"
);
return
;
}
if
(
isBlank
(
rows
[
i
][
'whCode'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行仓库名称不能为空"
);
return
;
}
if
(
isBlank
(
rows
[
i
][
'inventCode'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行存货名称不能为空"
);
return
;
}
if
(
!
isPositiveInteger
(
rows
[
i
][
'amount'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行数量必须是大于0的整数"
);
return
;
}
...
...
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