|
@@ -292,9 +292,47 @@ class work_server(threading.Thread):
|
|
|
self.user_var.number_count = self.user_var.order_ok + 1
|
|
|
self.product_number_pro()
|
|
|
self.user_var.serial_num_working = self.user_var.serial_num_value
|
|
|
+ elif (airng_r == True and airng_w == True) or (airok_r == True and airok_w == True):
|
|
|
+ print("no start to working")
|
|
|
+ self.user_var.airdata_work_stat = 'working'
|
|
|
+ self.user_var.serial_num = self.user_var.order_ok + self.user_var.order_ng + 1
|
|
|
+ self.user_var.number_count = self.user_var.order_ok + 1
|
|
|
+ self.product_number_pro()
|
|
|
+ self.user_var.serial_num_working = self.user_var.serial_num_value
|
|
|
|
|
|
# def database_pro(self):
|
|
|
|
|
|
+ def update_batch_tbl(self):
|
|
|
+ sqlstr = "UPDATE batch_tbl SET end_time={0}, stat={1} WHERE stat = {2}".format(
|
|
|
+ int(time.time()), True, False)
|
|
|
+ self.sqlclient.sql_action_all(sqlstr)
|
|
|
+
|
|
|
+ def insert_batch_tbl(self):
|
|
|
+ sqlstr = "INSERT INTO batch_tbl "
|
|
|
+ sqlstr = sqlstr + "(year, begin_time, end_time, stat)"
|
|
|
+ sqlstr = sqlstr + " VALUES ('{0}', '{1}', '{2}', {3})".format(
|
|
|
+ self.user_var.batch_y,
|
|
|
+ int(time.time()),
|
|
|
+ int(time.time()),
|
|
|
+ False
|
|
|
+ )
|
|
|
+ self.sqlclient.sql_action_all(sqlstr)
|
|
|
+
|
|
|
+ def batch_tbl_check(self):
|
|
|
+ sqlstr = 'SELECT year FROM batch_tbl WHERE stat=False ORDER by begin_time DESC'
|
|
|
+ results = self.sqlclient.sql_inquire_all(sqlstr)
|
|
|
+ if results != None and len(results) > 0:
|
|
|
+ idx = 0
|
|
|
+ for row in results:
|
|
|
+ if idx == 0:
|
|
|
+ if row[0] >= 'A' and row[0] <= 'Z':
|
|
|
+ self.user_var.batch_y = row[0]
|
|
|
+ self.user_var.order_year_str.set(self.user_var.batch_y)
|
|
|
+ self.user_var.batch_str.set(
|
|
|
+ self.user_var.batch_y + self.user_var.batch_m + self.user_var.batch_d)
|
|
|
+ else:
|
|
|
+ self.insert_batch_tbl()
|
|
|
+
|
|
|
def update_data_tbl(self, status):
|
|
|
sqlstr = 'UPDATE product_data_tbl SET '
|
|
|
if status == True:
|
|
@@ -596,6 +634,7 @@ class work_server(threading.Thread):
|
|
|
time.sleep(1)
|
|
|
|
|
|
if self.exit_stat == False:
|
|
|
+ self.batch_tbl_check()
|
|
|
self.batch_pro()
|
|
|
self.order_tbl_check()
|
|
|
# self.param_tbl_check()
|
|
@@ -604,6 +643,10 @@ class work_server(threading.Thread):
|
|
|
with main.threadlock:
|
|
|
if self.user_var.product_load == True:
|
|
|
self.product_name_set()
|
|
|
+ if self.user_var.batch_update_stat == True:
|
|
|
+ self.user_var.batch_update_stat = False
|
|
|
+ self.update_batch_tbl()
|
|
|
+ self.insert_batch_tbl()
|
|
|
self.product_name_check()
|
|
|
self.plc_conn_check()
|
|
|
self.opc_data_pro()
|