Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BasicAPI
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
杜科
BasicAPI
Commits
b8388ccd
Commit
b8388ccd
authored
Mar 04, 2023
by
shyWang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "转视图"
This reverts commit
387d63d7
parent
170a8d1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
224 deletions
+7
-224
PartUtil.java
src/com/yonde/common/PartUtil.java
+7
-140
DxPartController.java
src/com/yonde/part/controller/DxPartController.java
+0
-11
DxPartService.java
src/com/yonde/part/service/DxPartService.java
+0
-73
No files found.
src/com/yonde/common/PartUtil.java
View file @
b8388ccd
...
@@ -14,21 +14,20 @@ import wt.inf.container.WTContainerRef;
...
@@ -14,21 +14,20 @@ import wt.inf.container.WTContainerRef;
import
wt.log4j.LogR
;
import
wt.log4j.LogR
;
import
wt.method.RemoteAccess
;
import
wt.method.RemoteAccess
;
import
wt.method.RemoteMethodServer
;
import
wt.method.RemoteMethodServer
;
import
wt.org.WTUser
;
import
wt.part.PartType
;
import
wt.part.*
;
import
wt.part.QuantityUnit
;
import
wt.part.Source
;
import
wt.part.WTPart
;
import
wt.pds.StatementSpec
;
import
wt.pds.StatementSpec
;
import
wt.query.ArrayExpression
;
import
wt.query.ArrayExpression
;
import
wt.query.ClassAttribute
;
import
wt.query.ClassAttribute
;
import
wt.query.QuerySpec
;
import
wt.query.QuerySpec
;
import
wt.query.SearchCondition
;
import
wt.query.SearchCondition
;
import
wt.session.SessionHelper
;
import
wt.session.SessionServerHelper
;
import
wt.session.SessionServerHelper
;
import
wt.type.TypedUtility
;
import
wt.type.TypedUtility
;
import
wt.util.WTException
;
import
wt.util.WTException
;
import
wt.vc.VersionControlHelper
;
import
wt.vc.VersionControlHelper
;
import
wt.vc.config.ConfigSpec
;
import
wt.vc.config.IteratedOrderByPrimitive
;
import
wt.vc.config.IteratedOrderByPrimitive
;
import
wt.vc.config.LatestConfigSpec
;
import
wt.vc.config.VersionedOrderByPrimitive
;
import
wt.vc.config.VersionedOrderByPrimitive
;
import
wt.vc.views.View
;
import
wt.vc.views.View
;
import
wt.vc.views.ViewHelper
;
import
wt.vc.views.ViewHelper
;
...
@@ -37,7 +36,9 @@ import wt.vc.views.ViewReference;
...
@@ -37,7 +36,9 @@ import wt.vc.views.ViewReference;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.rmi.RemoteException
;
import
java.rmi.RemoteException
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.Hashtable
;
import
java.util.List
;
public
class
PartUtil
implements
RemoteAccess
{
public
class
PartUtil
implements
RemoteAccess
{
private
static
Logger
logger
=
LogR
.
getLogger
(
PartUtil
.
class
.
getName
());
private
static
Logger
logger
=
LogR
.
getLogger
(
PartUtil
.
class
.
getName
());
...
@@ -411,138 +412,4 @@ public class PartUtil implements RemoteAccess {
...
@@ -411,138 +412,4 @@ public class PartUtil implements RemoteAccess {
}
}
return
latestPart
;
return
latestPart
;
}
}
/**
* @描述 获得所有的子件,不包括根节点
* @作者 Pengfei,Li
* @时间 2015-9-11上午11:13:19
*/
public
static
void
getAllChildByView
(
WTPart
parent
,
ConfigSpec
configSpec
,
List
<
WTPart
>
childSet
)
throws
Exception
{
List
<
WTPart
>
childs
=
getChildByView
(
parent
,
configSpec
);
childSet
.
addAll
(
childs
);
for
(
WTPart
wtPart
:
childs
)
{
getAllChildByView
(
wtPart
,
configSpec
,
childSet
);
}
}
/**
* @描述 获取指定视图的子件,若子件无该视图则返回上游Design视图
* @作者 Pengfei,Li
* @时间 2015-9-11上午10:47:16
*/
@SuppressWarnings
(
"unchecked"
)
public
static
List
<
WTPart
>
getChildByView
(
WTPart
parent
,
String
viewStr
)
throws
WTException
{
List
<
WTPart
>
childs
=
new
ArrayList
<
WTPart
>();
if
(!
RemoteMethodServer
.
ServerFlag
)
{
try
{
childs
=
(
List
<
WTPart
>)
RemoteMethodServer
.
getDefault
().
invoke
(
"getChildByView"
,
PartUtil
.
class
.
getName
(),
null
,
new
Class
[]
{
WTPart
.
class
,
String
.
class
},
new
Object
[]
{
parent
,
viewStr
});
}
catch
(
Exception
e
)
{
throw
new
WTException
(
e
);
}
}
else
{
SessionServerHelper
.
manager
.
setAccessEnforced
(
false
);
try
{
WTPartConfigSpec
partConfigSpec
=
WTPartConfigSpec
.
newWTPartConfigSpec
(
WTPartStandardConfigSpec
.
newWTPartStandardConfigSpec
(
ViewHelper
.
service
.
getView
(
viewStr
),
null
));
for
(
QueryResult
subNodes
=
WTPartHelper
.
service
.
getUsesWTParts
(
parent
,
partConfigSpec
);
subNodes
.
hasMoreElements
();)
{
wt
.
fc
.
Persistable
aSubNodePair
[]
=
(
wt
.
fc
.
Persistable
[])
subNodes
.
nextElement
();
if
(
aSubNodePair
[
1
]
instanceof
WTPart
)
{
WTPart
tempPart
=
(
WTPart
)
aSubNodePair
[
1
];
if
(
tempPart
!=
null
)
{
childs
.
add
(
tempPart
);
}
}
else
if
(
aSubNodePair
[
1
]
instanceof
WTPartMaster
)
{
String
partNo
=
((
WTPartMaster
)
aSubNodePair
[
1
]).
getNumber
();
WTPart
tempPart
=
null
;
try
{
tempPart
=
getLatestViewPart
(
partNo
,
viewStr
);
if
(
tempPart
==
null
)
{
tempPart
=
getLatestViewPart
(
partNo
,
"Design"
);
}
if
(
tempPart
!=
null
)
{
childs
.
add
(
tempPart
);
}
}
catch
(
Exception
e
)
{
throw
new
WTException
(
e
);
}
}
}
}
finally
{
SessionServerHelper
.
manager
.
setAccessEnforced
(
true
);
}
}
return
childs
;
}
/**
* @描述 获取指定视图的最新版
*/
public
static
WTPart
getLatestViewPart
(
String
number
,
String
viewName
)
throws
WTException
{
try
{
if
(!
RemoteMethodServer
.
ServerFlag
)
{
return
(
WTPart
)
RemoteMethodServer
.
getDefault
().
invoke
(
"getLatestViewPart"
,
PartUtil
.
class
.
getName
(),
null
,
new
Class
[]
{
String
.
class
,
String
.
class
},
new
Object
[]
{
number
,
viewName
});
}
else
{
WTPart
part
=
null
;
if
(!
StringUtils
.
isEmpty
(
number
)
&&
!
StringUtils
.
isEmpty
(
viewName
))
{
QuerySpec
qs
=
new
QuerySpec
(
WTPart
.
class
);
qs
.
setAdvancedQueryEnabled
(
true
);
qs
.
appendWhere
(
new
SearchCondition
(
WTPart
.
class
,
WTPart
.
LATEST_ITERATION
,
SearchCondition
.
IS_TRUE
),
new
int
[]
{
0
});
number
=
number
==
null
?
null
:
number
.
toUpperCase
();
qs
.
appendAnd
();
qs
.
appendWhere
(
new
SearchCondition
(
WTPart
.
class
,
WTPart
.
NUMBER
,
SearchCondition
.
EQUAL
,
number
),
new
int
[]
{
0
});
View
view
=
ViewHelper
.
service
.
getView
(
viewName
);
qs
.
appendAnd
();
qs
.
appendWhere
(
new
SearchCondition
(
WTPart
.
class
,
WTPart
.
VIEW
+
"."
+
ObjectReference
.
KEY
,
SearchCondition
.
EQUAL
,
PersistenceHelper
.
getObjectIdentifier
(
view
)),
new
int
[]
{
0
});
QueryResult
queryResult
=
PersistenceHelper
.
manager
.
find
((
StatementSpec
)
qs
);
queryResult
=
new
LatestConfigSpec
().
process
(
queryResult
);
if
(
queryResult
.
hasMoreElements
())
{
part
=
(
WTPart
)
queryResult
.
nextElement
();
}
}
return
part
;
}
}
catch
(
RemoteException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvocationTargetException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* @描述 返回指定配置的子件
*/
@SuppressWarnings
(
"unchecked"
)
public
static
List
<
WTPart
>
getChildByView
(
WTPart
parent
,
ConfigSpec
configSpec
)
throws
Exception
{
List
<
WTPart
>
childs
=
new
ArrayList
<
WTPart
>();
if
(!
RemoteMethodServer
.
ServerFlag
)
{
childs
=
(
List
<
WTPart
>)
RemoteMethodServer
.
getDefault
().
invoke
(
"getChildByView"
,
PartUtil
.
class
.
getName
(),
null
,
new
Class
[]
{
WTPart
.
class
,
WTPartConfigSpec
.
class
},
new
Object
[]
{
parent
,
configSpec
});
}
else
{
WTUser
currentUser
=
(
WTUser
)
SessionHelper
.
manager
.
getPrincipal
();
try
{
SessionHelper
.
manager
.
setAdministrator
();
for
(
QueryResult
subNodes
=
WTPartHelper
.
service
.
getUsesWTParts
(
parent
,
configSpec
);
subNodes
.
hasMoreElements
();)
{
//for (QueryResult subNodes = StructHelper.service.navigateUsesToIteration(parent, false, configSpec); subNodes.hasMoreElements();) {
Object
result
=
subNodes
.
nextElement
();
if
(!(
result
instanceof
Persistable
[]))
continue
;
wt
.
fc
.
Persistable
aSubNodePair
[]
=
(
wt
.
fc
.
Persistable
[])
result
;
if
(
aSubNodePair
[
1
]
instanceof
WTPart
)
{
WTPartUsageLink
link
=
(
WTPartUsageLink
)
aSubNodePair
[
0
];
WTPart
tempPart
=
(
WTPart
)
aSubNodePair
[
1
];
if
(
tempPart
!=
null
)
{
childs
.
add
(
tempPart
);
}
}
}
}
catch
(
Exception
e
)
{
throw
new
WTException
(
e
);
}
finally
{
SessionHelper
.
manager
.
setPrincipal
(
currentUser
.
getName
());
}
}
return
childs
;
}
}
}
src/com/yonde/part/controller/DxPartController.java
View file @
b8388ccd
...
@@ -92,17 +92,6 @@ public class DxPartController extends AbstractBaseController {
...
@@ -92,17 +92,6 @@ public class DxPartController extends AbstractBaseController {
return
dxPartVO
;
return
dxPartVO
;
}
}
@PostMapping
({
"/version/{id}/convertView"
})
//@ApiOperation("转视图")
public
ApiResult
convertView
(
@PathVariable
Long
id
)
{
try
{
DxPartService
.
convertViewAll
(
id
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
ApiResult
.
ok
(
"转视图成功"
);
}
//@ApiOperation("配置规范查询")
//@ApiOperation("配置规范查询")
@PostMapping
({
"findBySpecPage"
})
@PostMapping
({
"findBySpecPage"
})
...
...
src/com/yonde/part/service/DxPartService.java
View file @
b8388ccd
...
@@ -511,78 +511,5 @@ public class DxPartService implements RemoteAccess, Serializable {
...
@@ -511,78 +511,5 @@ public class DxPartService implements RemoteAccess, Serializable {
}
}
return
resultList
;
return
resultList
;
}
/**
* 转视图
* @param id
* @return
* @throws Exception
*/
public
static
DxPartVO
convertView
(
Long
id
)
throws
Exception
{
if
(!
RemoteMethodServer
.
ServerFlag
)
{
return
(
DxPartVO
)
RemoteMethodServer
.
getDefault
().
invoke
(
"convertView"
,
DxPartService
.
class
.
getName
(),
null
,
new
Class
[]
{
Long
.
class
},
new
Object
[]
{
id
});
}
WTPart
partById
=
DxPartUtil
.
getPartById
(
id
);
String
viewName
=
partById
.
getViewName
();
if
(!
viewName
.
equalsIgnoreCase
(
"Planning"
)){
WTPart
tmpPart
=
(
WTPart
)
ViewHelper
.
service
.
newBranchForView
(
partById
,
"Planning"
);
tmpPart
.
setContainer
(
partById
.
getContainer
());
CommonUtil
.
setFolder
(
"/Default/PBOM/PBOM零部件"
,
partById
.
getContainerReference
(),
tmpPart
);
tmpPart
=
(
WTPart
)
PersistenceHelper
.
manager
.
save
(
tmpPart
);
return
new
DxPartVO
(
tmpPart
);
}
else
{
return
new
DxPartVO
(
partById
);
}
}
/**
* 批量转视图
* @param id
* @return
* @throws Exception
*/
public
static
void
convertViewAll
(
Long
id
)
throws
Exception
{
if
(!
RemoteMethodServer
.
ServerFlag
)
{
RemoteMethodServer
.
getDefault
().
invoke
(
"convertViewAll"
,
DxPartService
.
class
.
getName
(),
null
,
new
Class
[]
{
Long
.
class
},
new
Object
[]
{
id
});
}
WTPart
partById
=
DxPartUtil
.
getPartById
(
id
);
String
viewName
=
partById
.
getViewName
();
if
(!
viewName
.
equalsIgnoreCase
(
"Planning"
)){
WTPart
ppart
=
PartUtil
.
getLatestViewPart
(
partById
.
getNumber
(),
"Planning"
);
ArrayList
<
WTPart
>
list
=
new
ArrayList
<
WTPart
>();
if
(
ppart
==
null
){
WTPartConfigSpec
partConfigSpec
=
WTPartConfigSpec
.
newWTPartConfigSpec
(
WTPartStandardConfigSpec
.
newWTPartStandardConfigSpec
(
ViewHelper
.
service
.
getView
(
"Design"
),
null
));
PartUtil
.
getAllChildByView
(
partById
,
partConfigSpec
,
list
);
ppart
=
(
WTPart
)
ViewHelper
.
service
.
newBranchForView
(
partById
,
"Planning"
);
ppart
.
setContainer
(
partById
.
getContainer
());
CommonUtil
.
setFolder
(
"/Default/PBOM/PBOM零部件"
,
partById
.
getContainerReference
(),
ppart
);
PersistenceHelper
.
manager
.
save
(
ppart
);
}
for
(
WTPart
tempPart
:
list
){
tempPart
=
(
WTPart
)
ViewHelper
.
service
.
newBranchForView
(
partById
,
"Planning"
);
tempPart
.
setContainer
(
partById
.
getContainer
());
CommonUtil
.
setFolder
(
"/Default/PBOM/PBOM零部件"
,
partById
.
getContainerReference
(),
tempPart
);
PersistenceHelper
.
manager
.
save
(
tempPart
);
}
}
else
{
throw
new
Exception
(
"无需转视图"
);
}
}
}
}
}
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