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
75adcaf2
Commit
75adcaf2
authored
Aug 19, 2023
by
arvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
costhour 参数设置
parent
d2c9db7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
19 deletions
+105
-19
config.js
...mes/src/privateComponents/components/MBOMConfig/config.js
+98
-16
unit.vue
...-mes/src/privateComponents/components/MBOMConfig/unit.vue
+7
-3
No files found.
applications/dee-mes/src/privateComponents/components/MBOMConfig/config.js
View file @
75adcaf2
import
moment
from
'moment'
export
default
{
data
()
{
return
{
...
...
@@ -30,10 +31,32 @@ export default {
return
}
const
peerGroups
=
this
.
getPeerGroups
(
peerLinks
)
let
lastDay
=
new
Date
(
'2007/01/01'
)
let
lastTaskId
=
''
peerTasks
.
forEach
(
task
=>
{
if
(
new
Date
(
task
.
end_date
).
getTime
()
>
lastDay
.
getTime
())
{
lastDay
=
new
Date
(
task
.
end_date
)
lastTaskId
=
task
.
id
}
})
let
idx
=
-
1
peerGroups
.
forEach
((
g
,
i
)
=>
{
g
.
tasks
&&
g
.
tasks
.
forEach
(
taskId
=>
{
const
_task
=
this
.
gantt
.
getTask
(
taskId
)
if
(
new
Date
(
_task
.
end_date
).
getTime
()
>=
lastDay
.
getTime
())
{
idx
=
i
lastDay
=
new
Date
(
_task
.
end_date
)
lastTaskId
=
_task
.
id
}
})
})
let
isCriticalLinks
=
[]
// 获取关键路径上的link
const
isCriticalLinks
=
this
.
getIsCriticalLinks
(
peerGroups
,
peerTasks
)
if
(
idx
!==
-
1
)
{
isCriticalLinks
=
this
.
getIsCriticalLinks
(
peerGroups
[
idx
],
peerLinks
,
peerTasks
,
lastTaskId
)
}
// 取消原有 关键字
peerLinks
.
filter
(
l
=>
!
isCriticalLinks
.
includes
(
l
.
id
+
''
))
peerLinks
.
filter
(
l
=>
!
isCriticalLinks
.
includes
(
l
.
id
))
.
forEach
(
l
=>
{
if
(
l
.
isCritical
)
{
l
.
isCritical
=
false
...
...
@@ -41,13 +64,14 @@ export default {
}
})
// 设置新的 关键字
peerLinks
.
filter
(
l
=>
isCriticalLinks
.
includes
(
l
.
id
+
''
))
peerLinks
.
filter
(
l
=>
isCriticalLinks
.
includes
(
l
.
id
))
.
forEach
(
l
=>
{
if
(
!
l
.
isCritical
)
{
l
.
isCritical
=
true
this
.
modifyLink
(
l
,
'MODIFY'
)
}
})
this
.
calcLinkSlack
(
peerLinks
,
peerTasks
)
this
.
gantt
.
parse
(
this
.
params
)
},
modifyTask
(
task
,
operator
)
{
...
...
@@ -69,6 +93,7 @@ export default {
targetId
:
Number
(
link
.
target
),
isCritical
:
link
.
isCritical
,
id
:
link
.
cid
,
costHours
:
link
.
costHours
,
operator
}
if
(
operator
===
'ADD'
)
{
...
...
@@ -101,6 +126,7 @@ export default {
const
item
=
this
.
modifyData
.
links
.
find
(
l
=>
!
l
.
id
&&
l
.
sourceId
===
_link
.
sourceId
&&
l
.
targetId
===
_link
.
targetId
)
if
(
item
)
{
item
.
isCritical
=
_link
.
isCritical
item
.
costHours
=
_link
.
costHours
,
}
else
{
this
.
modifyData
.
links
.
push
(
_link
)
}
...
...
@@ -115,26 +141,57 @@ export default {
})
return
maxWorkHour
},
getIsCriticalLinks
(
peerGroups
,
peerTasks
)
{
getIsCriticalLinks
(
group
,
peerLinks
,
peerTasks
,
lastTaskId
)
{
const
paths
=
[[
lastTaskId
]]
const
perpath
=
paths
[
0
]
const
links
=
peerLinks
.
filter
(
l
=>
group
.
links
.
includes
(
l
.
id
+
''
))
this
.
group2line
(
lastTaskId
,
links
,
perpath
,
paths
)
let
maxWorkHour
=
this
.
getMaxWorkHour
(
peerTasks
)
let
i
sCriticalLinks
=
[]
p
eerGroups
.
forEach
(
g
=>
{
let
_max
=
0
g
.
tasks
.
forEach
(
id
=>
{
const
task
=
peerTasks
.
find
(
t
=>
t
.
id
===
id
)
if
(
task
)
{
_max
=
_max
+
task
.
duration
let
i
dx
=
-
1
p
aths
.
forEach
((
line
,
i
)
=>
{
let
workHour
=
0
line
.
forEach
(
id
=>
{
const
task
=
this
.
gantt
.
getTask
(
id
)
if
(
task
&&
task
.
duration
)
{
workHour
=
workHour
+
task
.
duration
}
})
if
(
_max
>
maxWorkHour
)
{
maxWorkHour
=
_max
i
sCriticalLinks
=
g
.
links
if
(
workHour
>
maxWorkHour
)
{
maxWorkHour
=
workHour
i
dx
=
i
}
})
console
.
log
(
peerGroups
,
isCriticalLinks
)
if
(
idx
===
-
1
)
{
return
[]
}
const
len
=
paths
[
idx
].
length
const
isCriticalLinks
=
[]
for
(
let
i
=
0
;
i
<
len
-
1
;
i
++
)
{
const
target
=
paths
[
idx
][
i
]
const
source
=
paths
[
idx
][
i
+
1
]
const
links
=
peerLinks
.
find
(
l
=>
Number
(
l
.
target
)
===
target
&&
Number
(
l
.
source
)
===
source
)
links
&&
(
isCriticalLinks
.
push
(
links
.
id
))
}
return
isCriticalLinks
},
group2line
(
taskId
,
links
,
perpath
,
paths
)
{
const
routes
=
links
.
filter
(
l
=>
Number
(
l
.
target
)
===
taskId
)
const
_pervPath
=
[...
perpath
]
routes
.
forEach
((
l
,
i
)
=>
{
if
(
i
===
0
)
{
const
sourceId
=
Number
(
l
.
source
)
perpath
.
push
(
sourceId
)
this
.
group2line
(
sourceId
,
links
,
perpath
,
paths
)
}
else
{
const
newPath
=
[...
_pervPath
]
const
sourceId
=
Number
(
l
.
source
)
newPath
.
push
(
sourceId
)
paths
.
push
(
newPath
)
this
.
group2line
(
sourceId
,
links
,
newPath
,
paths
)
}
})
},
getPeerGroups
(
links
)
{
const
str
=
links
.
map
(
l
=>
l
.
id
).
join
()
const
allGroups
=
this
.
gantt
.
getConnectedGroup
()
...
...
@@ -153,6 +210,31 @@ export default {
getPeerLinks
(
tasks
)
{
const
allLinks
=
this
.
params
.
links
return
allLinks
.
filter
(
l
=>
tasks
.
find
(
t
=>
t
.
id
===
Number
(
l
.
target
)))
},
calcLinkSlack
(
links
,
tasks
)
{
links
.
forEach
(
link
=>
{
const
cosLinks
=
links
.
filter
(
l
=>
Number
(
l
.
target
)
===
Number
(
link
.
target
))
if
(
cosLinks
.
length
===
1
)
{
return
true
}
const
peerTask
=
cosLinks
.
map
(
l
=>
{
const
task
=
tasks
.
find
(
t
=>
t
.
id
===
Number
(
l
.
source
))
return
{
linkId
:
l
.
id
,
end_date
:
task
&&
task
.
end_date
}
}).
sort
((
a
,
b
)
=>
a
.
end_date
-
b
.
end_date
)
const
lastDay
=
moment
(
peerTask
[
0
].
end_date
)
peerTask
.
forEach
(
l
=>
{
let
costHours
=
lastDay
.
diff
(
moment
(
l
.
end_date
),
'day'
)
costHours
=
Number
(
costHours
)
*
8
const
link
=
links
.
find
(
r
=>
r
.
id
===
l
.
linkId
)
if
(
link
)
{
link
.
costHours
=
costHours
this
.
modifyLink
(
link
,
'MODIFY'
)
}
})
})
}
}
...
...
applications/dee-mes/src/privateComponents/components/MBOMConfig/unit.vue
View file @
75adcaf2
...
...
@@ -115,6 +115,7 @@ export default {
tid
:
l
.
currNodeId
,
source
:
l
.
prevNodeId
,
target
:
l
.
currNodeId
,
costHours
:
l
.
costHours
,
type
:
'0'
,
isCritical
:
l
.
isCritical
}
...
...
@@ -447,9 +448,11 @@ export default {
return
text
}
ganttAss
.
attachEvent
(
'onAfterLinkAdd'
,
function
(
id
,
item
)
{
that
.
calcCriticalPath
(
item
)
that
.
modifyLink
(
item
,
'ADD'
)
ganttAss
.
render
()
setTimeout
(()
=>
{
that
.
calcCriticalPath
(
item
)
that
.
modifyLink
(
item
,
'ADD'
)
ganttAss
.
render
()
},
500
)
})
// 删除连接后触发
ganttAss
.
attachEvent
(
'onAfterLinkDelete'
,
function
(
id
,
item
)
{
...
...
@@ -576,6 +579,7 @@ export default {
subTypeName
:
'ExtProcessExecutorRoute'
,
isCritical
:
link
.
isCritical
,
currNodeId
:
link
.
targetId
,
costHours
:
link
.
costHours
||
0
,
currNodeIdType
:
'ExtProcessPlan'
,
id
:
link
.
id
,
operator
:
link
.
operator
...
...
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