Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-bpm
Project
Project
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
鲁鑫
topsun-bpm
Commits
d21d46d9
Commit
d21d46d9
authored
Mar 19, 2025
by
1650842865
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采购信息记录删除功能
parent
66d81ce0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
162 additions
and
23 deletions
+162
-23
purchaseInfoRecordList.js
...z/topsun/sap/purchaseInfoRecord/purchaseInfoRecordList.js
+23
-0
SapPurchaseInfoRecordApplication.java
...oRecord/application/SapPurchaseInfoRecordApplication.java
+3
-0
SapPurchaseInfoRecordApplicationImpl.java
...pplication/impl/SapPurchaseInfoRecordApplicationImpl.java
+41
-0
SapPurchaseInfoRecordController.java
...nfoRecord/controller/SapPurchaseInfoRecordController.java
+8
-0
SapPurchaseInfoRecordCancelVo.java
...seInfoRecord/domain/vo/SapPurchaseInfoRecordCancelVo.java
+40
-0
SapPurchaseInfoRecordItemRepository.java
...ecord/repository/SapPurchaseInfoRecordItemRepository.java
+2
-0
SapDictionaryApplicationImpl.java
...cation/application/impl/SapDictionaryApplicationImpl.java
+45
-23
No files found.
topsun-xt/src/main/webapp/biz/topsun/sap/purchaseInfoRecord/purchaseInfoRecordList.js
View file @
d21d46d9
...
...
@@ -41,6 +41,11 @@ function initPurchaseListGrid() {
id
:
'copyHandler'
,
text
:
"复制"
,
img
:
'fa-clipboard'
,
click
:
function
(){
copyQualityInfoRecord
();
}
},
cancelHandler
:{
id
:
'cancelHandler'
,
text
:
"作废"
,
img
:
'fa-trash-o'
,
click
:
function
(){
cancelHandlerInfoRecord
();
}
}
});
purchaseInfoRecordGridManager
=
UICtrl
.
grid
(
'#purchaseInfoRecordGrid'
,
{
...
...
@@ -233,3 +238,21 @@ function copyQualityInfoRecord(){
});
}
function
cancelHandlerInfoRecord
(){
var
row
=
purchaseInfoRecordGridManager
.
getSelectedRow
();
if
(
!
row
)
{
return
;
}
if
(
Public
.
isBlank
(
row
.
infnr
))
{
Public
.
errorTip
(
'只能作废有采购信息记录号的数据!'
);
return
false
;
}
UICtrl
.
confirm
(
'您确定要作废该条采购信息记录吗,作废后无法恢复?'
,
function
()
{
Public
.
ajax
(
web_app
.
name
+
'/sapPurchaseInfoRecord/cancelPurchaseRecord.ajax'
,
{
id
:
row
.
id
},
function
()
{
reloadPurchaseGrid
();
});
});
}
topsun/src/main/java/com/huigou/topsun/sap/purchaseInfoRecord/application/SapPurchaseInfoRecordApplication.java
View file @
d21d46d9
...
...
@@ -3,6 +3,7 @@ package com.huigou.topsun.sap.purchaseInfoRecord.application;
import
com.huigou.topsun.sap.purchaseInfoRecord.domain.SapPurchaseInfoRecord
;
import
com.huigou.topsun.sap.purchaseInfoRecord.domain.query.SapPurchaseInfoRecordQueryRequest
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -18,4 +19,6 @@ public interface SapPurchaseInfoRecordApplication {
Map
<
String
,
Object
>
slicedSapPurchaseInfoRecordList
(
SapPurchaseInfoRecordQueryRequest
queryRequest
);
SapPurchaseInfoRecord
loadSapPurchaseInfoRecord
(
String
id
);
void
cancelPurchaseRecord
(
String
id
);
}
topsun/src/main/java/com/huigou/topsun/sap/purchaseInfoRecord/application/impl/SapPurchaseInfoRecordApplicationImpl.java
View file @
d21d46d9
...
...
@@ -20,7 +20,9 @@ import com.huigou.topsun.sap.purchaseInfoRecord.domain.SapPurchaseInfoRecord;
import
com.huigou.topsun.sap.purchaseInfoRecord.domain.SapPurchaseInfoRecordItem
;
import
com.huigou.topsun.sap.common.domain.SapResult
;
import
com.huigou.topsun.sap.purchaseInfoRecord.domain.query.SapPurchaseInfoRecordQueryRequest
;
import
com.huigou.topsun.sap.purchaseInfoRecord.domain.vo.SapPurchaseInfoRecordCancelVo
;
import
com.huigou.topsun.sap.purchaseInfoRecord.domain.vo.SapPurchaseInfoRecordItemVo
;
import
com.huigou.topsun.sap.purchaseInfoRecord.repository.SapPurchaseInfoRecordItemRepository
;
import
com.huigou.topsun.sap.purchaseInfoRecord.repository.SapPurchaseInfoRecordRepository
;
import
com.huigou.uasp.bmp.common.BizBillStatus
;
import
com.huigou.uasp.bpm.FlowBroker
;
...
...
@@ -38,6 +40,7 @@ import org.springframework.util.Assert;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -62,6 +65,8 @@ public class SapPurchaseInfoRecordApplicationImpl extends FlowBroker implements
SapMutualEpLogApplication
sapMutualEpLogApplication
;
@Autowired
private
CodeRuleRepository
codeRuleRepository
;
@Autowired
private
SapPurchaseInfoRecordItemRepository
sapPurchaseInfoRecordItemRepository
;
@Transactional
@Override
...
...
@@ -311,4 +316,40 @@ public class SapPurchaseInfoRecordApplicationImpl extends FlowBroker implements
return
sapPurchaseInfoRecordRepository
.
findOne
(
id
);
}
@Override
public
void
cancelPurchaseRecord
(
String
id
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"businessType"
,
"作废采购信息记录"
);
resultMap
.
put
(
"businessId"
,
id
);
resultMap
.
put
(
"parameter"
,
JSON
.
toJSONString
(
id
));
SapPurchaseInfoRecordItem
recordItem
=
this
.
sapPurchaseInfoRecordItemRepository
.
findOne
(
id
);
SapPurchaseInfoRecordCancelVo
cancelVo
=
new
SapPurchaseInfoRecordCancelVo
();
BeanUtil
.
copyProperties
(
recordItem
,
cancelVo
);
cancelVo
.
setZzf
(
"X"
);
//删除标识
try
{
String
url
=
SystemCache
.
getParameter
(
"sap.PurchaseInfoRecord.url"
,
String
.
class
);
String
execute
=
httpClient
.
execute
(
cancelVo
,
url
);
List
<
SapResult
>
resultList
=
JSONObject
.
parseArray
(
execute
,
SapResult
.
class
);
SapResult
sapResult
=
resultList
.
get
(
0
);
if
(!
"S"
.
equals
(
sapResult
.
getTYPE
())){
resultMap
.
put
(
"TYPE"
,
sapResult
.
getTYPE
());
resultMap
.
put
(
"MESSAGE"
,
"数据传输失败,"
+
sapResult
.
getMESSAGE
());
throw
new
RuntimeException
(
"数据传输失败,"
+
sapResult
.
getMESSAGE
());
}
else
{
resultMap
.
put
(
"TYPE"
,
sapResult
.
getTYPE
());
resultMap
.
put
(
"MESSAGE"
,
sapResult
.
getMESSAGE
());
}
//recordItem.setInfnr(sapResult.getMESSAGE_V1());
recordItem
.
setTYPE
(
sapResult
.
getTYPE
());
recordItem
.
setMESSAGE
(
sapResult
.
getMESSAGE
());
sapPurchaseInfoRecordItemApplication
.
save
(
recordItem
);
}
catch
(
IOException
e
)
{
resultMap
.
put
(
"TYPE"
,
"E"
);
resultMap
.
put
(
"MESSAGE"
,
e
.
getMessage
());
throw
new
RuntimeException
(
e
);
}
finally
{
sapMutualEpLogApplication
.
saveSapMutualEpLog
(
resultMap
);
}
}
}
topsun/src/main/java/com/huigou/topsun/sap/purchaseInfoRecord/controller/SapPurchaseInfoRecordController.java
View file @
d21d46d9
...
...
@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Controller
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -125,4 +126,11 @@ public class SapPurchaseInfoRecordController extends CommonController {
return
forward
(
"purchaseInfoRecordDetail"
,
sapPurchaseInfoRecord
);
}
public
String
cancelPurchaseRecord
(){
SDO
sdo
=
this
.
getSDO
();
String
id
=
sdo
.
getId
();
sapPurchaseInfoRecordApplication
.
cancelPurchaseRecord
(
id
);
return
success
();
}
}
topsun/src/main/java/com/huigou/topsun/sap/purchaseInfoRecord/domain/vo/SapPurchaseInfoRecordCancelVo.java
0 → 100644
View file @
d21d46d9
package
com
.
huigou
.
topsun
.
sap
.
purchaseInfoRecord
.
domain
.
vo
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author xin.lu
* @Description:
* @date 2025/3/189:40
*/
@Data
public
class
SapPurchaseInfoRecordCancelVo
implements
Serializable
{
/**
* 供应商
*/
@JsonProperty
(
"LIFNR"
)
private
String
lifnr
;
/**
* 物料编码
*/
@JsonProperty
(
"MATNR"
)
private
String
matnr
;
/**
* 采购信息记录号
*/
@JsonProperty
(
"INFNR"
)
private
String
infnr
;
/**
* 删除标志
*/
@JsonProperty
(
"ZZF"
)
private
String
zzf
;
}
topsun/src/main/java/com/huigou/topsun/sap/purchaseInfoRecord/repository/SapPurchaseInfoRecordItemRepository.java
View file @
d21d46d9
...
...
@@ -14,6 +14,8 @@ public interface SapPurchaseInfoRecordItemRepository extends JpaRepository<SapPu
List
<
SapPurchaseInfoRecordItem
>
findBySapPurchaseInfoRecordId
(
String
sapPurchaseInfoRecordId
);
SapPurchaseInfoRecordItem
findByInfnr
(
String
infnr
);
}
topsun/src/main/java/com/huigou/topsun/sap/sapApplication/application/impl/SapDictionaryApplicationImpl.java
View file @
d21d46d9
...
...
@@ -114,32 +114,54 @@ public class SapDictionaryApplicationImpl implements SapDictionaryApplication {
@Override
public
String
[]
getWidths
(
List
<
Map
<
String
,
String
>>
mapList
){
Map
<
String
,
String
>
map
=
mapList
.
get
(
0
);
// 找到 value 值长度最长的 Map
Map
<
String
,
String
>
map
=
findLongestMap
(
mapList
);
String
[]
widths
=
new
String
[
map
.
size
()];
for
(
int
i
=
0
;
i
<
mapList
.
size
();
i
++){
Map
<
String
,
String
>
mapp
=
mapList
.
get
(
i
);
int
u
=
0
;
for
(
String
key
:
mapp
.
keySet
())
{
if
(
widths
[
u
]==
null
){
widths
[
u
]
=
"40"
;
}
String
tmpWidth
=
widths
[
u
];
String
value
=(
String
)
mapp
.
get
(
key
);
if
(
value
.
trim
().
length
()>
10
){
if
(
Integer
.
parseInt
(
tmpWidth
)<
130
){
widths
[
u
]=
"130"
;
}
}
else
{
if
(
value
.
trim
().
length
()>
6
){
if
(
Integer
.
parseInt
(
tmpWidth
)<
80
){
widths
[
u
]=
String
.
valueOf
(
value
.
trim
().
length
()*
10
);
}
}
}
u
++;
int
u
=
0
;
for
(
String
key
:
map
.
keySet
())
{
if
(
widths
[
u
]==
null
){
widths
[
u
]
=
"40"
;
}
String
value
=(
String
)
map
.
get
(
key
);
int
length
=
value
.
trim
().
length
();
if
(
length
>=
1
){
widths
[
u
]=
"100"
;
}
if
(
length
>=
20
)
{
widths
[
u
]=
"200"
;
}
if
(
length
>=
30
)
{
widths
[
u
]=
"250"
;
}
u
++;
}
return
widths
;
}
/**
* 计算 Map 中所有 value 的总长度
*/
public
int
calculateValueLength
(
Map
<
String
,
String
>
map
)
{
int
totalLength
=
0
;
for
(
String
value
:
map
.
values
())
{
totalLength
+=
value
.
length
();
}
return
totalLength
;
}
/**
* 找到 value 值长度最长的 Map
*/
public
Map
<
String
,
String
>
findLongestMap
(
List
<
Map
<
String
,
String
>>
mapList
)
{
Map
<
String
,
String
>
longestMap
=
null
;
int
maxLength
=
-
1
;
for
(
Map
<
String
,
String
>
map
:
mapList
)
{
int
currentLength
=
calculateValueLength
(
map
);
if
(
currentLength
>
maxLength
)
{
maxLength
=
currentLength
;
longestMap
=
map
;
}
}
return
longestMap
;
}
}
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