Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TF-MOM-WEB
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
TFMOM
TF-MOM-WEB
Commits
3c449556
Commit
3c449556
authored
Aug 10, 2023
by
arvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4561150d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
135 additions
and
123 deletions
+135
-123
config.js
...mes/src/privateComponents/components/MBOMConfig/config.js
+132
-0
unit.vue
...-mes/src/privateComponents/components/MBOMConfig/unit.vue
+2
-119
view.vue
...-mes/src/privateComponents/components/MBOMConfig/view.vue
+1
-4
No files found.
applications/dee-mes/src/privateComponents/components/MBOMConfig/config.js
View file @
3c449556
...
...
@@ -21,6 +21,138 @@ export default {
critical_path
:
true
,
auto_scheduling
:
true
})
},
calcCriticalPath
(
link
)
{
// 找出当前link 同级 task link
const
peerTasks
=
this
.
getPeerTasks
(
link
)
const
peerLinks
=
this
.
getPeerLinks
(
peerTasks
)
if
(
peerLinks
.
length
===
0
)
{
return
}
const
peerGroups
=
this
.
getPeerGroups
(
peerLinks
)
// 获取关键路径上的link
const
isCriticalLinks
=
this
.
getIsCriticalLinks
(
peerGroups
,
peerTasks
)
// 取消原有 关键字
peerLinks
.
filter
(
l
=>
!
isCriticalLinks
.
includes
(
l
.
id
+
''
))
.
forEach
(
l
=>
{
if
(
l
.
isCritical
)
{
l
.
isCritical
=
false
this
.
gantt
.
refreshLink
(
l
.
id
)
this
.
modifyLink
(
l
,
'MODIFY'
)
}
})
// 设置新的 关键字
peerLinks
.
filter
(
l
=>
isCriticalLinks
.
includes
(
l
.
id
+
''
))
.
forEach
(
l
=>
{
if
(
!
l
.
isCritical
)
{
l
.
isCritical
=
true
this
.
gantt
.
refreshLink
(
l
.
id
)
this
.
modifyLink
(
l
,
'MODIFY'
)
}
})
},
modifyTask
(
task
,
operator
)
{
const
_task
=
{
id
:
task
.
id
,
duration
:
task
.
duration
,
operator
}
const
item
=
this
.
modifyData
.
tasks
.
find
(
t
=>
t
.
id
===
_task
.
id
)
if
(
item
)
{
item
.
duration
=
_task
.
duration
}
else
{
this
.
modifyData
.
tasks
.
push
(
_task
)
}
},
modifyLink
(
link
,
operator
)
{
const
_link
=
{
sourceId
:
Number
(
link
.
source
),
targetId
:
Number
(
link
.
target
),
isCritical
:
link
.
isCritical
,
id
:
link
.
cid
,
operator
}
if
(
operator
===
'ADD'
)
{
// 判断是否为恢复旧数据
const
item
=
this
.
modifyData
.
links
.
find
(
l
=>
l
.
sourceId
===
_link
.
sourceId
&&
l
.
targetId
===
_link
.
targetId
)
if
(
item
)
{
if
(
item
.
id
)
{
item
.
operator
=
''
}
else
{
item
.
operator
=
'ADD'
}
}
else
{
this
.
modifyData
.
links
.
push
(
_link
)
}
}
else
if
(
operator
===
'REMOVE'
)
{
// 判断是为删除新数据
const
itemIdx
=
this
.
modifyData
.
links
.
findIndex
(
l
=>
!
l
.
id
&&
l
.
sourceId
===
_link
.
sourceId
&&
l
.
targetId
===
_link
.
targetId
)
if
(
itemIdx
>
-
1
)
{
const
item
=
this
.
modifyData
.
links
[
itemIdx
]
if
(
item
.
id
)
{
item
.
operator
=
'REMOVE'
}
else
{
this
.
modifyData
.
links
.
splice
(
itemIdx
,
1
)
}
}
else
{
this
.
modifyData
.
links
.
push
(
_link
)
}
}
else
{
// 判断是为删除新数据
const
item
=
this
.
modifyData
.
links
.
find
(
l
=>
!
l
.
id
&&
l
.
sourceId
===
_link
.
sourceId
&&
l
.
targetId
===
_link
.
targetId
)
if
(
item
)
{
item
.
isCritical
=
_link
.
isCritical
}
else
{
this
.
modifyData
.
links
.
push
(
_link
)
}
}
},
getMaxWorkHour
(
peerTasks
)
{
let
maxWorkHour
=
0
peerTasks
.
forEach
(
t
=>
{
if
(
t
.
duration
>
maxWorkHour
)
{
maxWorkHour
=
t
.
duration
}
})
return
maxWorkHour
},
getIsCriticalLinks
(
peerGroups
,
peerTasks
)
{
let
maxWorkHour
=
this
.
getMaxWorkHour
(
peerTasks
)
let
isCriticalLinks
=
[]
peerGroups
.
forEach
(
g
=>
{
let
_max
=
0
g
.
tasks
.
forEach
(
id
=>
{
const
task
=
peerTasks
.
find
(
t
=>
t
.
id
===
id
)
if
(
task
)
{
_max
=
_max
+
task
.
duration
}
})
if
(
_max
>
maxWorkHour
)
{
maxWorkHour
=
_max
isCriticalLinks
=
g
.
links
}
})
console
.
log
(
peerGroups
,
isCriticalLinks
)
return
isCriticalLinks
},
getPeerGroups
(
links
)
{
const
str
=
links
.
map
(
l
=>
l
.
id
).
join
()
const
allGroups
=
this
.
gantt
.
getConnectedGroup
()
return
allGroups
.
filter
(
g
=>
g
.
links
.
find
(
id
=>
str
.
includes
(
id
+
''
)))
},
getPeerTasks
(
link
)
{
const
allTasks
=
this
.
gantt
.
getTableData
().
data
.
data
const
target
=
Number
(
link
.
target
)
const
targetTask
=
allTasks
.
find
(
t
=>
t
.
id
===
target
)
if
(
!
targetTask
)
{
return
[]
}
return
allTasks
.
filter
(
t
=>
t
.
parenId
===
targetTask
.
parenId
)
},
getPeerLinks
(
tasks
)
{
const
allLinks
=
this
.
gantt
.
getTableData
().
data
.
links
return
allLinks
.
filter
(
l
=>
tasks
.
find
(
t
=>
t
.
id
===
Number
(
l
.
target
)))
}
}
...
...
applications/dee-mes/src/privateComponents/components/MBOMConfig/unit.vue
View file @
3c449556
...
...
@@ -142,121 +142,7 @@ export default {
duration
:
this
.
toDuration
(
n
.
workHour
)
}
},
calcCriticalPath
(
link
)
{
// 找出当前link 同级 task link
const
peerTasks
=
this
.
getPeerTasks
(
link
)
const
peerLinks
=
this
.
getPeerLinks
(
peerTasks
)
if
(
peerLinks
.
length
===
0
)
{
return
}
const
peerGroups
=
this
.
getPeerGroups
(
peerLinks
)
// 获取关键路径上的link
const
isCriticalLinks
=
this
.
getIsCriticalLinks
(
peerGroups
,
peerTasks
)
// 取消原有 关键字
peerLinks
.
filter
(
l
=>
!
isCriticalLinks
.
includes
(
l
.
id
+
''
))
.
forEach
(
l
=>
{
if
(
l
.
isCritical
)
{
l
.
isCritical
=
false
this
.
modifyLink
(
l
,
'MODIFY'
)
}
})
// 设置新的 关键字
peerLinks
.
filter
(
l
=>
isCriticalLinks
.
includes
(
l
.
id
+
''
))
.
forEach
(
l
=>
{
if
(
!
l
.
isCritical
)
{
l
.
isCritical
=
true
this
.
modifyLink
(
l
,
'MODIFY'
)
}
})
},
modifyLink
(
link
,
operator
)
{
const
_link
=
{
sourceId
:
Number
(
link
.
source
),
targetId
:
Number
(
link
.
target
),
isCritical
:
link
.
isCritical
,
id
:
link
.
cid
,
operator
}
if
(
operator
===
'ADD'
)
{
// 判断是否为恢复旧数据
const
item
=
this
.
modifyData
.
links
.
find
(
l
=>
l
.
sourceId
===
_link
.
sourceId
&&
l
.
targetId
===
_link
.
targetId
)
if
(
item
)
{
if
(
item
.
id
)
{
item
.
operator
=
''
}
else
{
item
.
operator
=
'ADD'
}
}
else
{
this
.
modifyData
.
links
.
push
(
_link
)
}
}
else
if
(
operator
===
'REMOVE'
)
{
// 判断是为删除新数据
const
itemIdx
=
this
.
modifyData
.
links
.
findIndex
(
l
=>
!
l
.
id
&&
l
.
sourceId
===
_link
.
sourceId
&&
l
.
targetId
===
_link
.
targetId
)
if
(
itemIdx
>
-
1
)
{
const
item
=
this
.
modifyData
.
links
[
itemIdx
]
if
(
item
.
id
)
{
item
.
operator
=
'REMOVE'
}
else
{
this
.
modifyData
.
links
.
splice
(
itemIdx
,
1
)
}
}
else
{
this
.
modifyData
.
links
.
push
(
_link
)
}
}
else
{
// 判断是为删除新数据
const
itemIdx
=
this
.
modifyData
.
links
.
findIndex
(
l
=>
!
l
.
id
&&
l
.
sourceId
===
_link
.
sourceId
&&
l
.
targetId
===
_link
.
targetId
)
if
(
itemIdx
>
-
1
)
{
this
.
modifyData
.
links
[
itemIdx
]
=
{
...
_link
}
}
else
{
this
.
modifyData
.
links
.
push
(
_link
)
}
}
},
getMaxWorkHour
(
peerTasks
)
{
let
maxWorkHour
=
0
peerTasks
.
forEach
(
t
=>
{
if
(
t
.
duration
>
maxWorkHour
)
{
maxWorkHour
=
t
.
duration
}
})
return
maxWorkHour
},
getIsCriticalLinks
(
peerGroups
,
peerTasks
)
{
let
maxWorkHour
=
this
.
getMaxWorkHour
(
peerTasks
)
let
isCriticalLinks
=
[]
peerGroups
.
forEach
(
g
=>
{
let
_max
=
0
g
.
tasks
.
forEach
(
id
=>
{
const
task
=
peerTasks
.
find
(
t
=>
t
.
id
===
id
)
if
(
task
)
{
_max
=
_max
+
task
.
duration
}
})
if
(
_max
>
maxWorkHour
)
{
maxWorkHour
=
_max
isCriticalLinks
=
g
.
links
}
})
return
isCriticalLinks
},
getPeerGroups
(
links
)
{
const
str
=
links
.
map
(
l
=>
l
.
id
).
join
()
const
allGroups
=
this
.
gantt
.
getConnectedGroup
()
return
allGroups
.
filter
(
g
=>
g
.
links
.
find
(
id
=>
str
.
includes
(
id
+
''
)))
},
getPeerTasks
(
link
)
{
const
allTasks
=
this
.
gantt
.
getTableData
().
data
.
data
const
target
=
Number
(
link
.
target
)
const
targetTask
=
allTasks
.
find
(
t
=>
t
.
id
===
target
)
if
(
!
targetTask
)
{
return
[]
}
return
allTasks
.
filter
(
t
=>
t
.
parenId
===
targetTask
.
parenId
)
},
getPeerLinks
(
tasks
)
{
const
allLinks
=
this
.
gantt
.
getTableData
().
data
.
links
return
allLinks
.
filter
(
l
=>
tasks
.
find
(
t
=>
t
.
id
===
Number
(
l
.
target
)))
},
getData
(
flag
)
{
if
(
!
flag
&&
this
.
loading
&&
(
this
.
currentId
===
this
.
node
.
id
))
{
return
...
...
@@ -660,10 +546,7 @@ export default {
CsvExportor
.
downloadCsv
(
tableData
,
{
header
},
'装配单元路线.csv'
)
},
search
()
{
if
(
!
this
.
AOname
)
{
return
}
const
tasks
=
this
.
params
.
data
.
filter
(
task
=>
task
.
$level
===
2
&&
(
task
.
right_text
.
includes
(
this
.
AOname
)
||
task
.
text
.
includes
(
this
.
AOname
)))
const
tasks
=
this
.
params
.
data
.
filter
(
task
=>
task
.
$level
===
1
&&
(
!
this
.
AOname
||
task
.
right_text
.
includes
(
this
.
AOname
)
||
task
.
text
.
includes
(
this
.
AOname
)))
const
parentTasks
=
[]
if
(
tasks
.
length
)
{
tasks
.
forEach
(
task
=>
{
...
...
applications/dee-mes/src/privateComponents/components/MBOMConfig/view.vue
View file @
3c449556
...
...
@@ -402,10 +402,7 @@ export default {
CsvExportor
.
downloadCsv
(
tableData
,
{
header
},
'架次视图路线.csv'
)
},
search
()
{
if
(
!
this
.
AOname
)
{
return
}
const
tasks
=
this
.
params
.
data
.
filter
(
task
=>
task
.
$level
===
2
&&
(
task
.
right_text
.
includes
(
this
.
AOname
)
||
task
.
text
.
includes
(
this
.
AOname
)))
const
tasks
=
this
.
params
.
data
.
filter
(
task
=>
task
.
$level
===
2
&&
(
!
this
.
AOname
||
task
.
right_text
.
includes
(
this
.
AOname
)
||
task
.
text
.
includes
(
this
.
AOname
)))
const
parentTasks
=
[]
if
(
tasks
.
length
)
{
tasks
.
forEach
(
task
=>
{
...
...
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