Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dwsproject
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dws
dwsproject
Commits
8e1ad18f
Commit
8e1ad18f
authored
Sep 18, 2025
by
wangkangjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'master' of
https://git.rokedata.com/dws/dwsproject
parent
4da2c6b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
qdry_project/static/src/view/oee_analysis.html
+2
-2
roke_product_income_expense/models/product_income_expense.py
+24
-1
No files found.
qdry_project/static/src/view/oee_analysis.html
View file @
8e1ad18f
...
@@ -231,9 +231,9 @@
...
@@ -231,9 +231,9 @@
selectedWorkshop
:
null
,
selectedWorkshop
:
null
,
workshops
:
[],
// 将从接口获取
workshops
:
[],
// 将从接口获取
statusPieChart_content
:
'总数量统计设备总数,运行统计实时设备运行的总数,维护统计实时设备故障的总数,等待统计实时设备等待的总数,离线统计实时设备关机的总数。'
,
statusPieChart_content
:
'总数量统计设备总数,运行统计实时设备运行的总数,维护统计实时设备故障的总数,等待统计实时设备等待的总数,离线统计实时设备关机的总数。'
,
oeeRankChart_content
:
'实际
运行时间/计划运行时间
'
,
oeeRankChart_content
:
'实际
加工时间/(实际加工时间+等待时间)
'
,
waitingLossChart_content
:
'按日期统计设备在该期间黄灯(等待)所损失的效率,展示在该产线下所有设备因黄灯(等待)所损失的效率(分钟)。'
,
waitingLossChart_content
:
'按日期统计设备在该期间黄灯(等待)所损失的效率,展示在该产线下所有设备因黄灯(等待)所损失的效率(分钟)。'
,
oeeTrendChart_content
:
'展示选定周期内(如 2025/03/10 至 2025/03/14)设备 OEE 的日趋势(实际
运行时间/计划运行时间
)变化,体现效率波动。'
,
oeeTrendChart_content
:
'展示选定周期内(如 2025/03/10 至 2025/03/14)设备 OEE 的日趋势(实际
加工时间/(实际加工时间+等待时间)
)变化,体现效率波动。'
,
faultLossChart_content
:
'按日期统计设备在该期间红灯(等待)所损失的效率(故障时间/计划运行时间),展示在该产线下所有设备因红灯(故障)所损失的效率(分钟)。'
faultLossChart_content
:
'按日期统计设备在该期间红灯(等待)所损失的效率(故障时间/计划运行时间),展示在该产线下所有设备因红灯(故障)所损失的效率(分钟)。'
...
...
roke_product_income_expense/models/product_income_expense.py
View file @
8e1ad18f
import
calendar
import
calendar
import
requests
import
requests
import
logging
import
datetime
as
date_time
import
datetime
as
date_time
from
datetime
import
datetime
from
datetime
import
datetime
from
odoo
import
models
,
fields
,
api
,
_
from
odoo
import
models
,
fields
,
api
,
_
from
odoo.exceptions
import
ValidationError
from
odoo.exceptions
import
ValidationError
_logger
=
logging
.
getLogger
(
__name__
)
class
ProductIncomeExpense
(
models
.
Model
):
class
ProductIncomeExpense
(
models
.
Model
):
...
@@ -13,7 +15,7 @@ class ProductIncomeExpense(models.Model):
...
@@ -13,7 +15,7 @@ class ProductIncomeExpense(models.Model):
abstract
=
fields
.
Text
(
string
=
"摘要"
,
index
=
True
)
abstract
=
fields
.
Text
(
string
=
"摘要"
,
index
=
True
)
income
=
fields
.
Float
(
string
=
"收入"
)
income
=
fields
.
Float
(
string
=
"收入"
)
expenditure
=
fields
.
Float
(
string
=
"支出"
)
expenditure
=
fields
.
Float
(
string
=
"支出"
)
balance
=
fields
.
Float
(
string
=
"结余"
,
compute
=
"_compute_balance"
)
balance
=
fields
.
Float
(
string
=
"结余"
,
compute
=
"_compute_balance"
,
store
=
True
)
machinery_type
=
fields
.
Selection
([(
"烘干桶"
,
"烘干桶"
),
(
"钣金"
,
"钣金"
),
(
"颗粒机"
,
"颗粒机"
),
(
"其他"
,
"其他"
)],
machinery_type
=
fields
.
Selection
([(
"烘干桶"
,
"烘干桶"
),
(
"钣金"
,
"钣金"
),
(
"颗粒机"
,
"颗粒机"
),
(
"其他"
,
"其他"
)],
default
=
"其他"
,
string
=
"类型"
,
index
=
True
)
default
=
"其他"
,
string
=
"类型"
,
index
=
True
)
customer
=
fields
.
Char
(
string
=
"客户"
,
index
=
True
)
customer
=
fields
.
Char
(
string
=
"客户"
,
index
=
True
)
...
@@ -34,3 +36,24 @@ class ProductIncomeExpense(models.Model):
...
@@ -34,3 +36,24 @@ class ProductIncomeExpense(models.Model):
v
.
balance
=
round
(
0
+
v
.
income
-
v
.
expenditure
,
2
)
v
.
balance
=
round
(
0
+
v
.
income
-
v
.
expenditure
,
2
)
else
:
else
:
v
.
balance
=
round
(
last_data
.
balance
+
v
.
income
-
v
.
expenditure
,
2
)
v
.
balance
=
round
(
last_data
.
balance
+
v
.
income
-
v
.
expenditure
,
2
)
def
update_all_balances
(
self
):
"""定时任务手动批量更新所有记录的结余字段值"""
# 确保记录按正确顺序处理(与计算逻辑保持一致)
records
=
self
.
search
([],
order
=
"business_date asc, create_date asc"
)
# 关闭自动提交,提高批量处理性能
self
.
env
.
cr
.
autocommit
(
False
)
try
:
# 调用计算方法
records
.
_compute_balance
()
# 手动提交事务
self
.
env
.
cr
.
commit
()
return
True
except
Exception
as
e
:
# 发生错误时回滚
self
.
env
.
cr
.
rollback
()
_logger
.
error
(
f
"更新结余字段失败: {str(e)}"
)
return
False
finally
:
# 恢复自动提交设置
self
.
env
.
cr
.
autocommit
(
True
)
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