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
e79af03d
Commit
e79af03d
authored
Jan 17, 2024
by
覃振观
👶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工作中心 模拟SAP调用 与 详情页面
parent
c67bae47
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
325 additions
and
11 deletions
+325
-11
sapWorkCenter.js
...rc/main/webapp/biz/topsun/sap/workCenter/sapWorkCenter.js
+13
-1
sapWorkCenter.jsp
...c/main/webapp/biz/topsun/sap/workCenter/sapWorkCenter.jsp
+1
-1
sapWorkCenterDetail.js
...n/webapp/biz/topsun/sap/workCenter/sapWorkCenterDetail.js
+0
-0
sapWorkCenterDetail.jsp
.../webapp/biz/topsun/sap/workCenter/sapWorkCenterDetail.jsp
+163
-0
SapWorkCenterApplication.java
.../sap/workcenter/application/SapWorkCenterApplication.java
+7
-1
SapWorkCenterApplicationImpl.java
...center/application/impl/SapWorkCenterApplicationImpl.java
+105
-6
SapWorkCenterLogController.java
...sap/workcenter/controller/SapWorkCenterLogController.java
+36
-2
No files found.
topsun-xt/src/main/webapp/biz/topsun/sap/workCenter/sapWorkCenter.js
View file @
e79af03d
...
...
@@ -11,7 +11,7 @@ function loadSapWorkCenterGrid() {
updateHandler
();
}
});
gridManager
=
UICtrl
.
grid
(
"#
productList
Grid"
,
{
gridManager
=
UICtrl
.
grid
(
"#
sapWorkCenter
Grid"
,
{
columns
:
[
{
display
:
"填写说明"
,
name
:
"productName"
,
width
:
140
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
{
display
:
"维护标识"
,
name
:
"productCategoryId"
,
width
:
120
,
minWidth
:
60
,
type
:
"string"
,
align
:
"left"
},
...
...
@@ -49,3 +49,15 @@ function loadSapWorkCenterGrid() {
});
UICtrl
.
setSearchAreaToggle
(
gridManager
);
}
function
updateHandler
(
data
)
{
let
id
=
data
.
id
;
if
(
!
id
)
{
id
=
DataUtil
.
getUpdateRowId
(
gridManager
);
if
(
!
id
)
{
return
;
}
}
let
url
=
DataUtil
.
composeURLByParam
(
'/sapWorkCenter/goWorkCenterDetail.do'
,
data
);
UICtrl
.
addTabItem
({
tabid
:
'workCenterEdit'
+
new
Date
().
getTime
(),
text
:
"AAAA"
,
url
:
url
});
}
\ No newline at end of file
topsun-xt/src/main/webapp/biz/topsun/sap/workCenter/sapWorkCenter.jsp
View file @
e79af03d
...
...
@@ -14,7 +14,7 @@
<x:base
include=
"layout,dialog,grid,tree,combox,commonTree"
/>
<x:script
src=
'/system/opm/js/OpmUtil.js'
/>
<x:script
src=
'/biz/topsun/common/purchaseCommon.js'
/>
<x:script
src=
'/biz/topsun/
product/product
.js'
/>
<x:script
src=
'/biz/topsun/
sap/workCenter/sapWorkCenter
.js'
/>
</head>
<body>
<div
position=
"center"
title=
"工作中心"
>
...
...
topsun-xt/src/main/webapp/biz/topsun/sap/workCenter/sapWorkCenterDetail.js
0 → 100644
View file @
e79af03d
topsun-xt/src/main/webapp/biz/topsun/sap/workCenter/sapWorkCenterDetail.jsp
0 → 100644
View file @
e79af03d
<%--
Created by IntelliJ IDEA.
User: qinzhenguan
Date: 2024/1/17
Time: 16:33
To change this template use File | Settings | File Templates.
--%>
<%@ page
language=
"java"
contentType=
"text/html; charset=utf-8"
%>
<%@taglib
uri=
"/WEB-INF/taglib.tld"
prefix=
"x"
%>
<%@ taglib
uri=
"http://java.sun.com/jsp/jstl/core"
prefix=
"c"
%>
<html>
<head>
<title>
Title
</title>
<x:base
include=
"layout,dialog,grid,tree,combox,commonTree,date"
/>
<x:script
src=
'/javaScript/common.js'
/>
<x:script
src=
'/lib/jquery/jquery.contextmenu.js'
/>
<x:script
src=
'/system/bpm/BpmUtil.js'
/>
<x:script
src=
'/biz/topsun/common/listeningFromData.js'
/>
<x:script
src=
'/biz/topsun/sap/workCenter/sapWorkCenterDetail.js'
/>
<%-- <x:script src='/biz/topsun/product/product.js'/>--%>
<style>
.panelX
{
height
:
98%
;
width
:
100%
;
padding
:
5px
;
position
:
relative
;
display
:
inline-flex
;
flex-direction
:
column
;
/*background-color: #f3f3f4 !important;*/
}
.panelX
>
div
:first-child
{
margin-bottom
:
38px
;
}
.panelX
>
form
{
margin-bottom
:
38px
;
}
.panel-footerX
{
width
:
100%
;
left
:
-1px
;
bottom
:
0
;
padding
:
1px
99px
;
position
:
fixed
;
display
:
flex
;
justify-content
:
center
;
background
:
none
repeat
scroll
0
0
#fff0
;
/*border-top: 1px solid #e7eaec;*/
/*background: none repeat scroll 0 0 #fff;*/
}
.panel-footerX
>
div
{
margin
:
2px
;
}
.ui-layout-content
{
height
:
319px
;
}
.checkBoxDiv
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
padding-top
:
5px
;
}
</style>
</head>
<body>
<div
class=
"panelX"
id=
"panelContainer"
>
<%-- <div class="hg-form-cols">--%>
<%-- <div labelCol="15"> </div>--%>
<%-- </div>--%>
<form
class=
"hg-form"
method=
"post"
action=
""
id=
"submitForm"
>
<x:hidden
name=
"id"
/>
<x:title
title=
"基本属性"
name=
"group"
hideTable=
"#info"
/>
<div
class=
"hg-form-cols"
>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"werks"
required=
"true"
label=
"工厂"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"64"
/>
<x:inputC
name=
"apbpl"
required=
"true"
label=
"工作中心"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"64"
/>
<x:inputC
name=
"verwe"
wrapper=
"select"
label=
"工作中心类型"
id=
"selectedCategory"
labelCol=
"1"
fieldCol=
"3"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"stext"
label=
"工作中心描述"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
wrapper=
"date"
/>
<x:inputC
name=
"planv"
label=
"任务清单使用码"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"veran"
label=
"工作中心负责人"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"rgekz"
label=
"标志:倒冲"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"vorgschl"
label=
"标准值码"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"steus"
label=
"控制码"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"ktext"
label=
"产能短文本"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"kapart"
label=
"能力类别"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"planr"
label=
"产能负责计划员组"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"kalid"
label=
"工厂日历标识"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"meins"
label=
"产能基本计量单位"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"begzt"
label=
"开始时间"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"endzt"
label=
"结束时间"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"ngrad"
label=
"产能利用率"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"aznor"
label=
"单个产能数"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"kapeh"
label=
"产能计量单位"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"kapter"
label=
"标识"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"ueberlast"
label=
"过载"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"fork2"
label=
"产能需求公式"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"kapartJh"
label=
"计划能力类别"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"fort2"
label=
"加工时间的时间期限公式"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"begda"
label=
"开始日期"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"endda"
label=
"结束日期"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"kostl"
label=
"成本中心"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar1"
label=
"活动类型1"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh1"
label=
"作业单位1"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml1"
label=
"公式码1"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar2"
label=
"活动类型2"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh2"
label=
"作业单位2"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml2"
label=
"公式码2"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar3"
label=
"活动类型3"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh3"
label=
"作业单位3"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml3"
label=
"公式码3"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar4"
label=
"活动类型4"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh4"
label=
"作业单位4"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml4"
label=
"公式码4"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar5"
label=
"活动类型5"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh5"
label=
"作业单位5"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml5"
label=
"公式码5"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<x:inputC
name=
"lstar6"
label=
"活动类型6"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
<x:inputC
name=
"leinh6"
label=
"作业单位6"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
required=
"false"
/>
<x:inputC
name=
"forml6"
label=
"公式码6"
labelCol=
"1"
fieldCol=
"3"
maxLength=
"32"
/>
</div>
<div
class=
"hg-form-row"
>
<div
class=
"col-xs-12 col-sm-2 checkBoxDiv"
>
<%-- 白色 col-white-bg--%>
<div><x:checkbox
name=
"isFreeInspection"
label=
"是否免检"
/></div>
</div>
</div>
</div>
</form>
</div>
</body>
</html>
topsun/src/main/java/com/huigou/topsun/sap/workcenter/application/SapWorkCenterApplication.java
View file @
e79af03d
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
application
;
import
com.huigou.topsun.sap.workcenter.domain.SapWorkCenter
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
java.util.ArrayList
;
import
java.util.Map
;
/**
...
...
@@ -8,4 +11,7 @@ import com.huigou.topsun.sap.workcenter.domain.SapWorkCenter;
*/
public
interface
SapWorkCenterApplication
{
ArrayList
<
Map
<
String
,
Object
>>
findWorkCenter
();
String
queryWorkCenter
()
throws
JsonProcessingException
;
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/application/impl/SapWorkCenterApplicationImpl.java
View file @
e79af03d
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
application
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.topsun.common.CloseableClientHttpRequest
;
import
com.huigou.topsun.sap.workcenter.domain.SapWorkCenterLog
;
import
com.huigou.topsun.sap.workcenter.repository.SapWorkCenterRepository
;
import
com.huigou.topsun.sap.workcenter.application.SapWorkCenterApplication
;
import
com.huigou.topsun.sap.workcenter.domain.SapWorkCenter
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.http.client.SimpleClientHttpRequestFactory
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.io.*
;
import
java.net.URI
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
@author YourUserName
*/
*
@author YourUserName
*/
@Service
@RequiredArgsConstructor
public
class
SapWorkCenterApplicationImpl
implements
SapWorkCenterApplication
{
@Resource
private
SapWorkCenterRepository
rep
;
private
final
ObjectMapper
objectMapper
;
private
final
SapWorkCenterRepository
rep
;
/***
* description 发送请求到 SAP 系统,获取工作中心数据
* @return java.util.ArrayList<java.util.Map < java.lang.String, java.lang.Object>>
* @author qinzhenguan
* @createDate 2024/1/17 15:44
*/
@Override
public
ArrayList
<
Map
<
String
,
Object
>>
findWorkCenter
()
{
String
execute
;
HashMap
<
String
,
Object
>
param
=
new
HashMap
<>(
12
);
List
<
SapWorkCenter
>
workCenters
;
try
{
execute
=
execute
(
param
,
"http://127.0.0.1:8080/topsun_xt_war/sapWorkCenter/queryWorkCenter.ajax"
);
String
resultStr
=
JSONObject
.
parseObject
(
execute
).
get
(
"data"
).
toString
();
workCenters
=
objectMapper
.
readValue
(
resultStr
,
new
TypeReference
<
List
<
SapWorkCenter
>>()
{});
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
workCenters
.
size
()
==
0
)
{
return
null
;
}
return
objectMapper
.
convertValue
(
workCenters
,
new
TypeReference
<
ArrayList
<
Map
<
String
,
Object
>>>()
{
});
}
/**
* description 模拟 SAP 接口 (临时)
* @return java.lang.String
* @author qinzhenguan
* @createDate 2024/1/17 14:57
*/
@Override
public
String
queryWorkCenter
()
throws
JsonProcessingException
{
List
<
SapWorkCenter
>
list
=
rep
.
findAll
();
return
list
.
size
()
>
0
?
objectMapper
.
writeValueAsString
(
list
)
:
""
;
}
/***
* description 模拟发送请求到 SAP
* @param param 请求体 body
* @param url 请求地址
* @return java.lang.String
* @author qinzhenguan
* @createDate 2024/1/17 17:01
*/
public
String
execute
(
Object
param
,
String
url
)
throws
IOException
{
String
str
=
""
;
try
{
SimpleClientHttpRequestFactory
requestFactory
=
new
SimpleClientHttpRequestFactory
();
requestFactory
.
setConnectTimeout
(
5000
);
requestFactory
.
setReadTimeout
(
5000
);
URI
uri
=
URI
.
create
(
url
);
HttpMethod
method
=
HttpMethod
.
POST
;
// ------------------------ header ------------------------
try
(
CloseableClientHttpRequest
request
=
new
CloseableClientHttpRequest
(
requestFactory
.
createRequest
(
uri
,
method
)))
{
request
.
addHeader
(
"Content-type"
,
"application/json;charset=utf-8"
);
// ------------------------ body ------------------------
JSONObject
body
=
new
JSONObject
();
try
(
OutputStream
requestBody
=
request
.
getBody
())
{
requestBody
.
write
(
body
.
toString
().
getBytes
());
}
// ------------------------ response ------------------------
try
(
ClientHttpResponse
response
=
request
.
execute
();
InputStream
ist
=
response
.
getBody
();
InputStreamReader
istr
=
new
InputStreamReader
(
ist
,
StandardCharsets
.
UTF_8
);
BufferedReader
bfreader
=
new
BufferedReader
(
istr
))
{
str
=
bfreader
.
readLine
();
System
.
out
.
println
(
str
);
}
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
str
;
}
}
topsun/src/main/java/com/huigou/topsun/sap/workcenter/controller/SapWorkCenterLogController.java
View file @
e79af03d
package
com
.
huigou
.
topsun
.
sap
.
workcenter
.
controller
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.huigou.topsun.sap.workcenter.application.SapWorkCenterApplication
;
import
com.huigou.uasp.annotation.ControllerMapping
;
import
com.huigou.uasp.annotation.SkipAuth
;
import
com.huigou.uasp.client.CommonController
;
import
com.huigou.util.SDO
;
import
com.huigou.util.StringUtil
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Controller
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* SapWorkCenterLogController SAP工作中心控制类
*
...
...
@@ -21,11 +31,35 @@ public class SapWorkCenterLogController extends CommonController {
@Override
protected
String
getPagePath
()
{
return
"/biz/topsun/sap/workCenter"
;
return
"/biz/topsun/sap/workCenter/"
;
}
public
String
goWorkCenter
()
{
return
forward
(
"sapWorkCenter"
);
}
public
String
findWorkCenter
()
{
return
null
;
ArrayList
<
Map
<
String
,
Object
>>
list
=
centerServer
.
findWorkCenter
();
HashMap
<
Object
,
Object
>
map
=
new
HashMap
<>(
3
);
map
.
put
(
"Rows"
,
list
);
return
toResult
(
map
);
}
public
String
goWorkCenterDetail
()
{
SDO
sdo
=
this
.
getSDO
();
return
forward
(
"sapWorkCenterDetail"
);
}
/**
* description 模拟 SAP 接口 (临时) 能否提供条件查询及分页?
* @return java.lang.String
* @author qinzhenguan
* @createDate 2024/1/17 14:57
*/
@SkipAuth
public
String
queryWorkCenter
()
throws
JsonProcessingException
{
String
workCenter
=
centerServer
.
queryWorkCenter
();
return
success
(
workCenter
);
}
...
...
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