|
@@ -7,6 +7,17 @@ from utils.mysql_db import MysqlHelper
|
|
|
|
|
|
|
|
|
class sqlCollect:
|
|
|
+ @classmethod
|
|
|
+ def get_channel_count(cls, channel, name):
|
|
|
+ sql = """SELECT count(0) FROM machine_making_data where channel = %s and name = %s and DATE(data_time) = CURRENT_DATE AND HOUR(data_time) <= HOUR(NOW());"""
|
|
|
+ count = MysqlHelper.get_values(sql, (str(channel), name))
|
|
|
+ return count
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def get_ytd_channel_count(cls, channel, name):
|
|
|
+ sql = """SELECT count(0) FROM machine_making_data where channel = %s and name = %s and data_time >= CURRENT_DATE - INTERVAL 1 DAY AND data_time <= CURRENT_DATE - INTERVAL 1 DAY + INTERVAL HOUR(NOW()) HOUR;"""
|
|
|
+ count = MysqlHelper.get_values(sql, (str(channel), name))
|
|
|
+ return count
|
|
|
|
|
|
@classmethod
|
|
|
def get_name_count(cls, name):
|