Accept Merge Request #2028: (feature/制造功能优化 -> develop)
Merge Request: 调整适配零件图号为数字 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2028?initial=true
This commit is contained in:
@@ -169,7 +169,12 @@ class ImportComplexModelWizard(models.TransientModel):
|
|||||||
|
|
||||||
if row[2] == '':
|
if row[2] == '':
|
||||||
continue
|
continue
|
||||||
if row[1] != quality_check.part_number:
|
logging.info('================%s, %s==' % (row[1], type(row[1])))
|
||||||
|
|
||||||
|
compare_value = row[1]
|
||||||
|
if type(compare_value) == float:
|
||||||
|
compare_value = str(int(compare_value))
|
||||||
|
if compare_value != quality_check.part_number:
|
||||||
print(sheet.row_values(row_index))
|
print(sheet.row_values(row_index))
|
||||||
raise UserError(_('上传内容图号错误,请修改'))
|
raise UserError(_('上传内容图号错误,请修改'))
|
||||||
for row_index in range(1, sheet.nrows):
|
for row_index in range(1, sheet.nrows):
|
||||||
@@ -435,7 +440,8 @@ class ImportComplexModelWizard(models.TransientModel):
|
|||||||
# )
|
# )
|
||||||
|
|
||||||
def download_excel_template(self):
|
def download_excel_template(self):
|
||||||
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + '/quality_control/static/src/binary/出厂检验报告上传模版.xlsx'
|
base_url = self.env['ir.config_parameter'].sudo().get_param(
|
||||||
|
'web.base.url') + '/quality_control/static/src/binary/出厂检验报告上传模版.xlsx'
|
||||||
|
|
||||||
# 只有当原始 URL 使用 http 时才替换为 https
|
# 只有当原始 URL 使用 http 时才替换为 https
|
||||||
if base_url.startswith("http://"):
|
if base_url.startswith("http://"):
|
||||||
|
|||||||
@@ -1688,12 +1688,14 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
FROM device_data
|
FROM device_data
|
||||||
WHERE device_name = %s
|
WHERE device_name = %s
|
||||||
AND power_on_time IS NOT NULL
|
AND power_on_time IS NOT NULL
|
||||||
AND time::date = CURRENT_DATE -- ✅ 更高效的写法
|
AND time >= CURRENT_DATE
|
||||||
|
AND time < CURRENT_DATE + INTERVAL '1 day'
|
||||||
ORDER BY time ASC
|
ORDER BY time ASC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
);
|
);
|
||||||
""", (item, item, item))
|
""", (item, item, item))
|
||||||
results = cur.fetchall()
|
results = cur.fetchall()
|
||||||
|
logging.info('====================%s' % results)
|
||||||
if len(results) >= 1:
|
if len(results) >= 1:
|
||||||
total_power_on_time += convert_to_seconds(results[0][0])
|
total_power_on_time += convert_to_seconds(results[0][0])
|
||||||
else:
|
else:
|
||||||
@@ -1704,10 +1706,16 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
month_power_on_time += 0
|
month_power_on_time += 0
|
||||||
if len(results) >= 3:
|
if len(results) >= 3:
|
||||||
today_power_on_time += convert_to_seconds(results[2][0])
|
today_power_on_time += convert_to_seconds(results[2][0])
|
||||||
today_power_on_dict[item] = today_power_on_time
|
# today_power_on_dict[item] = today_power_on_time
|
||||||
else:
|
else:
|
||||||
today_power_on_time += 0
|
today_power_on_time += convert_to_seconds(results[0][0])
|
||||||
today_power_on_dict[item] = 0
|
# today_power_on_dict[item] = 0
|
||||||
|
|
||||||
|
if results[0][0] == '0H0M':
|
||||||
|
logging.info('=woshide=%s' % results[0][0])
|
||||||
|
logging.info(type(results[0][0]))
|
||||||
|
total_power_on_time += convert_to_seconds(results[1][0])
|
||||||
|
today_power_on_time += convert_to_seconds(results[1][0])
|
||||||
|
|
||||||
with conn.cursor() as cur:
|
with conn.cursor() as cur:
|
||||||
cur.execute("""
|
cur.execute("""
|
||||||
@@ -1722,9 +1730,9 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
|
|
||||||
for record in results:
|
for record in results:
|
||||||
if record[0]:
|
if record[0]:
|
||||||
if float(record[0]) >= 28800:
|
if float(record[0]) >= 86400:
|
||||||
continue
|
continue
|
||||||
total_alarm_time += float(record[0])
|
total_alarm_time += abs(float(record[0]))
|
||||||
else:
|
else:
|
||||||
total_alarm_time += 0.0
|
total_alarm_time += 0.0
|
||||||
alarm_start = datetime.strptime(record[1], "%Y-%m-%d %H:%M:%S")
|
alarm_start = datetime.strptime(record[1], "%Y-%m-%d %H:%M:%S")
|
||||||
@@ -1737,7 +1745,7 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
if today[0]:
|
if today[0]:
|
||||||
if float(today[0]) >= 28800:
|
if float(today[0]) >= 28800:
|
||||||
continue
|
continue
|
||||||
today_alarm_time += float(today[0])
|
today_alarm_time += abs(float(today[0]))
|
||||||
today_alarm_dict[item] = today_alarm_time
|
today_alarm_dict[item] = today_alarm_time
|
||||||
else:
|
else:
|
||||||
today_alarm_time += 0.0
|
today_alarm_time += 0.0
|
||||||
@@ -1748,12 +1756,14 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
if month[0]:
|
if month[0]:
|
||||||
if float(month[0]) >= 28800:
|
if float(month[0]) >= 28800:
|
||||||
continue
|
continue
|
||||||
month_alarm_time += float(month[0])
|
month_alarm_time += abs(float(month[0]))
|
||||||
else:
|
else:
|
||||||
month_alarm_time += 0.0
|
month_alarm_time += 0.0
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
logging.info('在线时间总月日=============%s, %s, %s' % (total_power_on_time, month_power_on_time, today_power_on_time))
|
||||||
|
|
||||||
logging.info('报警时间总月日=============%s, %s, %s' % (total_alarm_time, month_alarm_time, today_alarm_time))
|
logging.info('报警时间总月日=============%s, %s, %s' % (total_alarm_time, month_alarm_time, today_alarm_time))
|
||||||
# 计算时间开动率(累计、月、日)
|
# 计算时间开动率(累计、月、日)
|
||||||
if total_power_on_time:
|
if total_power_on_time:
|
||||||
|
|||||||
Reference in New Issue
Block a user