production.py 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915
  1. from tkinter import *
  2. import app
  3. import time
  4. import sql
  5. import param
  6. import tkinter.messagebox
  7. class my_production(Frame):
  8. def __init__(self, init_window_name):
  9. self.init_window_name = init_window_name
  10. self.sqlclient = sql.sqlclient
  11. self.user_var = app.user_var
  12. self.opc_value = app.opc_value
  13. self.screen_width = self.user_var.screen_width
  14. self.screen_height = self.user_var.screen_height
  15. self.font_size_title = app.font_size_title
  16. self.font_size_text = app.font_size_text
  17. self.main_gui_init()
  18. self.title_canvas_init()
  19. self.button_canvas_init()
  20. self.user_frame_init()
  21. self.input_lock = False
  22. self.view_timeout = 180
  23. self.user_var.windows_idx = 'production'
  24. self.fun_timer()
  25. def return_button_event(self):
  26. if self.user_var.last_windows_idx == 'param':
  27. self.user_var.last_windows_idx = 'production'
  28. self.init_window_name.after_cancel(self.task_user)
  29. self.main_frame.destroy()
  30. param.my_param(self.init_window_name)
  31. else:
  32. self.user_var.last_windows_idx = 'production'
  33. self.init_window_name.after_cancel(self.task_user)
  34. self.main_frame.destroy()
  35. app.my_gui(self.init_window_name)
  36. def auth_exit(self):
  37. if self.user_var.auth_timeout > 0:
  38. self.user_var.auth_timeout = self.user_var.auth_timeout - 1
  39. else:
  40. self.user_var.auth_stat = False
  41. def view_exit(self):
  42. if self.view_timeout > 0:
  43. self.view_timeout = self.view_timeout - 1
  44. else:
  45. self.user_var.last_windows_idx = 'param'
  46. self.init_window_name.after_cancel(self.task_user)
  47. self.main_frame.destroy()
  48. app.my_gui(self.init_window_name)
  49. def windows_update(self):
  50. currentTime = time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(time.time()))
  51. self.timelabel.config(text=currentTime)
  52. self.auth_exit()
  53. self.init_window_name.update()
  54. self.fun_timer()
  55. self.view_exit()
  56. def fun_timer(self):
  57. self.task_user = self.init_window_name.after(1000, self.windows_update)
  58. def main_gui_init(self):
  59. self.main_frame = Frame(self.init_window_name, width=self.screen_width, height=self.screen_height)
  60. self.main_frame.pack()
  61. # 标题栏
  62. def title_canvas_init(self):
  63. self.title_canvas = Canvas(self.main_frame, width=self.screen_width - 20, height=35, bg='SeaGreen')
  64. self.mainlabel = Label(self.title_canvas, text="品番设定", fg='yellow', font=("宋体", self.font_size_title),
  65. bg='SeaGreen', anchor='w')
  66. self.mainlabel.place(x=20, y=5)
  67. self.timelabel = Label(self.title_canvas, text=time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(time.time())),
  68. fg='yellow', font=("宋体", self.font_size_title), bg='SeaGreen', anchor='e')
  69. self.timelabel.place(x=self.title_canvas.winfo_reqwidth() - self.timelabel.winfo_reqwidth() - 20, y=5)
  70. self.title_canvas.create_line(self.mainlabel.winfo_reqwidth() / 2 + 20, 32, self.title_canvas.winfo_reqwidth() -
  71. self.timelabel.winfo_reqwidth() / 2 - 20, 32, fill='white')
  72. self.title_canvas.place(x=10, y=10)
  73. # 控制栏
  74. def button_canvas_init(self):
  75. self.button_canvas = Canvas(self.main_frame, width=self.screen_width - 20, height=40)
  76. self.return_button = Button(self.button_canvas, text="返回", fg='white', bg='DeepSkyBlue', width=8,
  77. activebackground='white', activeforeground='DeepSkyBlue',
  78. font=("宋体", self.font_size_title, "bold"), command=self.return_button_event)
  79. self.return_button.place(x=1, y=0)
  80. self.button_canvas.place(x=10, y=self.screen_height - 60)
  81. def product_sel_button_event(self, idx):
  82. # tkinter.messagebox.showwarning(title='提示', message='品番切换为{}!'.format(self.user_var.product_list[idx]))
  83. # exec('self.product_sel_label_{0:02d}.config(fg="PaleGreen")'.format(self.user_var.product_idx+1))
  84. # exec('self.product_sel_label_{0:02d}.config(fg="purple")'.format(idx+1))
  85. # self.user_var.product_idx = idx
  86. # self.user_var.product_idx_str.set(idx+1)
  87. # self.user_var.product_str.set(self.user_var.product_list[idx])
  88. # self.opc_value.set_Product_idx(self.user_var.product_idx)
  89. # self.opc_value.set_Product_name(self.user_var.product_list[idx])
  90. if self.user_var.auth_stat == True:
  91. self.input_param(idx)
  92. else:
  93. self.input_frame.wm_attributes('-topmost', 0)
  94. tkinter.messagebox.showwarning(title='提示', message='请登录后操作!')
  95. self.input_frame.wm_attributes('-topmost', 1)
  96. def input_exit(self):
  97. self.input_lock = False
  98. self.input_frame.destroy()
  99. def input_on_closing(self):
  100. self.input_lock = False
  101. def get_sel_product_idx_value(self, idx):
  102. self.sel_idx = idx
  103. self.product_isset = False
  104. sqlstr = "SELECT product_name,17700_name,17720_name FROM product_tbl "
  105. sqlstr = sqlstr + "WHERE stat=True and product_idx={0}".format(idx)
  106. paramresult = self.sqlclient.sql_inquire_all(sqlstr)
  107. if paramresult != None and len(paramresult) > 0:
  108. for paramrow in paramresult:
  109. self.sel_product_name = paramrow[0]
  110. self.sel_name_17700 = paramrow[1]
  111. self.sel_name_17720 = paramrow[2]
  112. self.product_isset = True
  113. break
  114. else:
  115. self.sel_product_name = ''
  116. self.sel_name_17700 = ''
  117. self.sel_name_17720 = ''
  118. if self.product_isset == True:
  119. sqlstr = "SELECT startuptime,airtime,presstime, testtime, exhaust, maxpress, minpress, setpress, capacity, \
  120. posthreshold, pnegthreshold FROM product_param_tbl WHERE product_name='{0}' and \
  121. param_type = 17700".format(self.sel_product_name)
  122. paramresult = self.sqlclient.sql_inquire_all(sqlstr)
  123. if paramresult != None and len(paramresult) > 0:
  124. for paramrow in paramresult:
  125. self.sel_startuptime_17700 = paramrow[0]
  126. self.sel_airtime_17700 = paramrow[1]
  127. self.sel_presstime_17700 = paramrow[2]
  128. self.sel_testtime_17700 = paramrow[3]
  129. self.sel_exhaust_17700 = paramrow[4]
  130. self.sel_maxpress_17700 = paramrow[5]
  131. self.sel_minpress_17700 = paramrow[6]
  132. self.sel_setpress_17700 = paramrow[7]
  133. self.sel_capacity_17700 = paramrow[8]
  134. self.sel_posthreshold_17700 = paramrow[9]
  135. self.sel_pnegthreshold_17700 = paramrow[10]
  136. else:
  137. self.sel_startuptime_17700 = '0'
  138. self.sel_airtime_17700 = '0'
  139. self.sel_presstime_17700 = '0'
  140. self.sel_testtime_17700 = '0'
  141. self.sel_exhaust_17700 = '0'
  142. self.sel_maxpress_17700 = '0'
  143. self.sel_minpress_17700 = '0'
  144. self.sel_setpress_17700 = '0'
  145. self.sel_capacity_17700 = '0'
  146. self.sel_posthreshold_17700 = '0'
  147. self.sel_pnegthreshold_17700 = '0'
  148. sqlstr = "SELECT startuptime, airtime,presstime, testtime, exhaust, maxpress, minpress, setpress, capacity, \
  149. posthreshold, pnegthreshold FROM product_param_tbl WHERE product_name='{0}' and \
  150. param_type = 17720".format(self.sel_product_name)
  151. paramresult = self.sqlclient.sql_inquire_all(sqlstr)
  152. if paramresult != None and len(paramresult) > 0:
  153. for paramrow in paramresult:
  154. self.sel_startuptime_17720 = paramrow[0]
  155. self.sel_airtime_17720 = paramrow[1]
  156. self.sel_presstime_17720 = paramrow[2]
  157. self.sel_testtime_17720 = paramrow[3]
  158. self.sel_exhaust_17720 = paramrow[4]
  159. self.sel_maxpress_17720 = paramrow[5]
  160. self.sel_minpress_17720 = paramrow[6]
  161. self.sel_setpress_17720 = paramrow[7]
  162. self.sel_capacity_17720 = paramrow[8]
  163. self.sel_posthreshold_17720 = paramrow[9]
  164. self.sel_pnegthreshold_17720 = paramrow[10]
  165. else:
  166. self.sel_startuptime_17720 = '0'
  167. self.sel_airtime_17720 = '0'
  168. self.sel_presstime_17720 = '0'
  169. self.sel_testtime_17720 = '0'
  170. self.sel_exhaust_17720 = '0'
  171. self.sel_maxpress_17720 = '0'
  172. self.sel_minpress_17720 = '0'
  173. self.sel_setpress_17720 = '0'
  174. self.sel_capacity_17720 = '0'
  175. self.sel_posthreshold_17720 = '0'
  176. self.sel_pnegthreshold_17720 = '0'
  177. else:
  178. self.sel_startuptime_17700 = '0'
  179. self.sel_airtime_17700 = '0'
  180. self.sel_presstime_17700 = '0'
  181. self.sel_testtime_17700 = '0'
  182. self.sel_exhaust_17700 = '0'
  183. self.sel_maxpress_17700 = '0'
  184. self.sel_minpress_17700 = '0'
  185. self.sel_setpress_17700 = '0'
  186. self.sel_capacity_17700 = '0'
  187. self.sel_posthreshold_17700 = '0'
  188. self.sel_pnegthreshold_17700 = '0'
  189. self.sel_startuptime_17720 = '0'
  190. self.sel_airtime_17720 = '0'
  191. self.sel_presstime_17720 = '0'
  192. self.sel_testtime_17720 = '0'
  193. self.sel_exhaust_17720 = '0'
  194. self.sel_maxpress_17720 = '0'
  195. self.sel_minpress_17720 = '0'
  196. self.sel_setpress_17720 = '0'
  197. self.sel_capacity_17720 = '0'
  198. self.sel_posthreshold_17720 = '0'
  199. self.sel_pnegthreshold_17720 = '0'
  200. def insert_param_tbl(self, ttype):
  201. sqlstr = "INSERT INTO product_param_tbl "
  202. sqlstr = sqlstr + "(product_idx,product_name,param_type,startuptime,airtime,presstime, testtime, \
  203. exhaust, maxpress, minpress, setpress, capacity, \
  204. posthreshold, pnegthreshold)"
  205. if ttype == 17700:
  206. sqlstr = sqlstr + " VALUES ({0}, '{1}', {2}, '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}')".format(
  207. self.sel_idx,
  208. self.sel_product_name,
  209. 17700,
  210. self.sel_startuptime_17700,
  211. self.sel_airtime_17700,
  212. self.sel_presstime_17700,
  213. self.sel_testtime_17700,
  214. self.sel_exhaust_17700,
  215. self.sel_maxpress_17700,
  216. self.sel_minpress_17700,
  217. self.sel_setpress_17700,
  218. self.sel_capacity_17700,
  219. self.sel_posthreshold_17700,
  220. self.sel_pnegthreshold_17700
  221. )
  222. else:
  223. sqlstr = sqlstr + " VALUES ({0}, '{1}', {2}, '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}')".format(
  224. self.sel_idx,
  225. self.sel_product_name,
  226. 17720,
  227. self.sel_startuptime_17720,
  228. self.sel_airtime_17720,
  229. self.sel_presstime_17720,
  230. self.sel_testtime_17720,
  231. self.sel_exhaust_17720,
  232. self.sel_maxpress_17720,
  233. self.sel_minpress_17720,
  234. self.sel_setpress_17720,
  235. self.sel_capacity_17720,
  236. self.sel_posthreshold_17720,
  237. self.sel_pnegthreshold_17720
  238. )
  239. self.sqlclient.sql_action_all(sqlstr)
  240. def update_param_tbl(self, ttype):
  241. sqlstr = "UPDATE product_param_tbl SET "
  242. if ttype == 17700:
  243. sqlstr = sqlstr + "startuptime='{0}',".format(self.sel_startuptime_17700)
  244. sqlstr = sqlstr + "airtime='{0}',".format(self.sel_airtime_17700)
  245. sqlstr = sqlstr + "presstime='{0}',".format(self.sel_presstime_17700)
  246. sqlstr = sqlstr + "testtime='{0}',".format(self.sel_testtime_17700)
  247. sqlstr = sqlstr + "exhaust='{0}',".format(self.sel_exhaust_17700)
  248. sqlstr = sqlstr + "maxpress='{0}',".format(self.sel_maxpress_17700)
  249. sqlstr = sqlstr + "minpress='{0}',".format(self.sel_minpress_17700)
  250. sqlstr = sqlstr + "setpress='{0}',".format(self.sel_setpress_17700)
  251. sqlstr = sqlstr + "capacity='{0}',".format(self.sel_capacity_17700)
  252. sqlstr = sqlstr + "posthreshold='{0}',".format(self.sel_posthreshold_17700)
  253. sqlstr = sqlstr + "pnegthreshold='{0}'".format(self.sel_pnegthreshold_17700)
  254. sqlstr = sqlstr + "WHERE param_type=17700 and product_name='{0}'".format(self.sel_product_name)
  255. else:
  256. sqlstr = sqlstr + "startuptime='{0}',".format(self.sel_startuptime_17720)
  257. sqlstr = sqlstr + "airtime='{0}',".format(self.sel_airtime_17720)
  258. sqlstr = sqlstr + "presstime='{0}',".format(self.sel_presstime_17720)
  259. sqlstr = sqlstr + "testtime='{0}',".format(self.sel_testtime_17720)
  260. sqlstr = sqlstr + "exhaust='{0}',".format(self.sel_exhaust_17720)
  261. sqlstr = sqlstr + "maxpress='{0}',".format(self.sel_maxpress_17720)
  262. sqlstr = sqlstr + "minpress='{0}',".format(self.sel_minpress_17720)
  263. sqlstr = sqlstr + "setpress='{0}',".format(self.sel_setpress_17720)
  264. sqlstr = sqlstr + "capacity='{0}',".format(self.sel_capacity_17720)
  265. sqlstr = sqlstr + "posthreshold='{0}',".format(self.sel_posthreshold_17720)
  266. sqlstr = sqlstr + "pnegthreshold='{0}'".format(self.sel_pnegthreshold_17720)
  267. sqlstr = sqlstr + "WHERE param_type=17720 and product_name='{0}'".format(self.sel_product_name)
  268. self.sqlclient.sql_action_all(sqlstr)
  269. def input_enter(self):
  270. stat = False
  271. product_name = self.sel_product_name_entry.get()
  272. name_17700 = self.sel_name_17700_entry.get()
  273. name_17720 = self.sel_name_17720_entry.get()
  274. sel_startuptime_17700 = self.sel_startuptime_17700_entry.get()
  275. sel_airtime_17700 = self.sel_airtime_17700_entry.get()
  276. sel_presstime_17700 = self.sel_presstime_17700_entry.get()
  277. sel_testtime_17700 = self.sel_testtime_17700_entry.get()
  278. sel_exhaust_17700 = self.sel_exhaust_17700_entry.get()
  279. sel_maxpress_17700 = self.sel_maxpress_17700_entry.get()
  280. sel_minpress_17700 = self.sel_minpress_17700_entry.get()
  281. sel_setpress_17700 = self.sel_setpress_17700_entry.get()
  282. sel_capacity_17700 = self.sel_capacity_17700_entry.get()
  283. sel_posthreshold_17700 = self.sel_posthreshold_17700_entry.get()
  284. sel_pnegthreshold_17700 = self.sel_pnegthreshold_17700_entry.get()
  285. sel_startuptime_17720 = self.sel_startuptime_17720_entry.get()
  286. sel_airtime_17720 = self.sel_airtime_17720_entry.get()
  287. sel_presstime_17720 = self.sel_presstime_17720_entry.get()
  288. sel_testtime_17720 = self.sel_testtime_17720_entry.get()
  289. sel_exhaust_17720 = self.sel_exhaust_17720_entry.get()
  290. sel_maxpress_17720 = self.sel_maxpress_17720_entry.get()
  291. sel_minpress_17720 = self.sel_minpress_17720_entry.get()
  292. sel_setpress_17720 = self.sel_setpress_17720_entry.get()
  293. sel_capacity_17720 = self.sel_capacity_17720_entry.get()
  294. sel_posthreshold_17720 = self.sel_posthreshold_17720_entry.get()
  295. sel_pnegthreshold_17720 = self.sel_pnegthreshold_17720_entry.get()
  296. if len(product_name) == 0 or len(name_17700) == 0 or len(name_17720) == 0:
  297. self.input_frame.wm_attributes('-topmost', 0)
  298. tkinter.messagebox.showwarning(title='提示', message='品番未输入!')
  299. self.input_frame.wm_attributes('-topmost', 1)
  300. return
  301. if len(sel_startuptime_17700) == 0 or len(sel_airtime_17700) == 0 or len(sel_presstime_17700) == 0 or len(
  302. sel_testtime_17700) == 0 or len(sel_exhaust_17700) == 0 or len(sel_maxpress_17700) == 0 or len(
  303. sel_minpress_17700) == 0 or len(sel_setpress_17700) == 0 or len(sel_capacity_17700) == 0 or len(
  304. sel_posthreshold_17700) == 0 or len(sel_pnegthreshold_17700) == 0:
  305. self.input_frame.wm_attributes('-topmost', 0)
  306. tkinter.messagebox.showwarning(title='提示', message='17700参数输入为空!')
  307. self.input_frame.wm_attributes('-topmost', 1)
  308. return
  309. if len(sel_startuptime_17720) == 0 or len(sel_airtime_17720) == 0 or len(sel_presstime_17720) == 0 or len(
  310. sel_testtime_17720) == 0 or len(sel_exhaust_17720) == 0 or len(sel_maxpress_17720) == 0 or len(
  311. sel_minpress_17720) == 0 or len(sel_setpress_17720) == 0 or len(sel_capacity_17720) == 0 or len(
  312. sel_posthreshold_17720) == 0 or len(sel_pnegthreshold_17720) == 0:
  313. self.input_frame.wm_attributes('-topmost', 0)
  314. tkinter.messagebox.showwarning(title='提示', message='17720参数输入为空!')
  315. self.input_frame.wm_attributes('-topmost', 1)
  316. return
  317. if self.sel_product_name != '':
  318. if product_name != self.sel_product_name:
  319. self.input_frame.wm_attributes('-topmost', 0)
  320. message = tkinter.messagebox.askokcancel(title='提示',
  321. message='是否确定品番{0}修改为{1}'.format(
  322. self.sel_product_name, product_name))
  323. self.input_frame.wm_attributes('-topmost', 1)
  324. if (message == False):
  325. self.sel_product_name_entry.delete(0, "end")
  326. self.sel_product_name_entry.insert(0, self.sel_product_name)
  327. return
  328. else:
  329. sqlstr = "UPDATE product_tbl SET stat=False WHERE product_name='{0}' and stat=True".format(
  330. self.sel_product_name
  331. )
  332. self.sqlclient.sql_action_all(sqlstr)
  333. stat = True
  334. else:
  335. stat = True
  336. self.sel_name_17700 = name_17700
  337. self.sel_name_17720 = name_17720
  338. if stat == True:
  339. self.sel_product_name = product_name
  340. # self.user_var.product_list[self.sel_idx] = self.sel_product_name
  341. # self.user_var.product_list_str[self.sel_idx].set(self.sel_product_name)
  342. sqlstr = "INSERT INTO product_tbl "
  343. sqlstr = sqlstr + "(product_idx, product_name, 17700_name, 17720_name, stat)"
  344. sqlstr = sqlstr + " VALUES ('{0}', '{1}', '{2}', '{3}', True)".format(
  345. self.sel_idx,
  346. self.sel_product_name,
  347. self.sel_name_17700,
  348. self.sel_name_17720
  349. )
  350. else:
  351. sqlstr = "UPDATE product_tbl SET 17700_name='{0}',17720_name='{1}' WHERE product_name='{2}' and stat=True".format(
  352. self.sel_name_17700, self.sel_name_17720, self.sel_product_name
  353. )
  354. self.sqlclient.sql_action_all(sqlstr)
  355. # self.user_var.product_17700_list[self.sel_idx] = self.sel_name_17700
  356. # self.user_var.product_17720_list[self.sel_idx] = self.sel_name_17720
  357. self.sel_startuptime_17700 = sel_startuptime_17700
  358. self.sel_airtime_17700 = sel_airtime_17700
  359. self.sel_presstime_17700 = sel_presstime_17700
  360. self.sel_testtime_17700 = sel_testtime_17700
  361. self.sel_exhaust_17700 = sel_exhaust_17700
  362. self.sel_maxpress_17700 = sel_maxpress_17700
  363. self.sel_minpress_17700 = sel_minpress_17700
  364. self.sel_setpress_17700 = sel_setpress_17700
  365. self.sel_capacity_17700 = sel_capacity_17700
  366. self.sel_posthreshold_17700 = sel_posthreshold_17700
  367. self.sel_pnegthreshold_17700 = sel_pnegthreshold_17700
  368. if stat == True:
  369. self.insert_param_tbl(17700)
  370. else:
  371. self.update_param_tbl(17700)
  372. self.sel_startuptime_17720 = sel_startuptime_17720
  373. self.sel_airtime_17720 = sel_airtime_17720
  374. self.sel_presstime_17720 = sel_presstime_17720
  375. self.sel_testtime_17720 = sel_testtime_17720
  376. self.sel_exhaust_17720 = sel_exhaust_17720
  377. self.sel_maxpress_17720 = sel_maxpress_17720
  378. self.sel_minpress_17720 = sel_minpress_17720
  379. self.sel_setpress_17720 = sel_setpress_17720
  380. self.sel_capacity_17720 = sel_capacity_17720
  381. self.sel_posthreshold_17720 = sel_posthreshold_17720
  382. self.sel_pnegthreshold_17720 = sel_pnegthreshold_17720
  383. if stat == True:
  384. self.insert_param_tbl(17720)
  385. else:
  386. self.update_param_tbl(17720)
  387. self.user_var.product_load = True
  388. self.input_lock = False
  389. self.input_frame.destroy()
  390. def input_param(self, idx):
  391. if self.input_lock == False:
  392. self.get_sel_product_idx_value(idx)
  393. self.input_frame = tkinter.Tk(className='请输入值') # 弹出框框名
  394. self.input_frame.geometry('800x500+50+50') # 设置弹出框的大小 w x h
  395. self.sel_product_name_label = Label(self.input_frame, font=("宋体", self.font_size_text), text='总品番:',
  396. anchor='w')
  397. self.sel_product_name_label.place(x=20, y=20)
  398. self.sel_product_name_entry = tkinter.Entry(self.input_frame, width=30) # 设置"文本变量"为var
  399. self.sel_product_name_entry.place(x=150, y=20)
  400. self.sel_product_name_entry.insert(0, self.sel_product_name)
  401. self.sel_name_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text), text='17700品番:',
  402. anchor='w')
  403. self.sel_name_17700_label.place(x=20, y=50)
  404. self.sel_name_17700_entry = tkinter.Entry(self.input_frame, width=30) # 设置"文本变量"为var
  405. self.sel_name_17700_entry.place(x=150, y=50)
  406. self.sel_name_17700_entry.insert(0, self.sel_name_17700)
  407. self.sel_name_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text), text='17720品番:',
  408. anchor='w')
  409. self.sel_name_17720_label.place(x=400, y=50)
  410. self.sel_name_17720_entry = tkinter.Entry(self.input_frame, width=30) # 设置"文本变量"为var
  411. self.sel_name_17720_entry.place(x=530, y=50)
  412. self.sel_name_17720_entry.insert(0, self.sel_name_17720)
  413. self.sel_startuptime_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  414. text='17700启动延时:', anchor='w')
  415. self.sel_startuptime_17700_label.place(x=20, y=80)
  416. self.sel_startuptime_17700_entry = tkinter.Entry(self.input_frame, width=24) # 设置"文本变量"为var
  417. self.sel_startuptime_17700_entry.place(x=150, y=80)
  418. self.sel_startuptime_17700_entry.insert(0, self.sel_startuptime_17700)
  419. self.sel_startuptime_17700_unit = Label(self.input_frame, text="sec", font=("宋体", self.font_size_text),
  420. anchor='w')
  421. self.sel_startuptime_17700_unit.place(x=330, y=80)
  422. self.sel_startuptime_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  423. text='17720启动延时:', anchor='w')
  424. self.sel_startuptime_17720_label.place(x=400, y=80)
  425. self.sel_startuptime_17720_entry = tkinter.Entry(self.input_frame, width=24) # 设置"文本变量"为var
  426. self.sel_startuptime_17720_entry.place(x=530, y=80)
  427. self.sel_startuptime_17720_entry.insert(0, self.sel_startuptime_17720)
  428. self.sel_startuptime_17720_unit = Label(self.input_frame, text="sec", font=("宋体", self.font_size_text),
  429. anchor='w')
  430. self.sel_startuptime_17720_unit.place(x=710, y=80)
  431. self.sel_airtime_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  432. text='17700充气时间:', anchor='w')
  433. self.sel_airtime_17700_label.place(x=20, y=110)
  434. self.sel_airtime_17700_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  435. self.sel_airtime_17700_entry.place(x=150, y=110)
  436. self.sel_airtime_17700_entry.insert(0, self.sel_airtime_17700)
  437. self.sel_airtime_17700_unit = Label(self.input_frame, text="sec", font=("宋体", self.font_size_text),
  438. anchor='w')
  439. self.sel_airtime_17700_unit.place(x=330, y=110)
  440. self.sel_airtime_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  441. text='17720充气时间:', anchor='w')
  442. self.sel_airtime_17720_label.place(x=400, y=110)
  443. self.sel_airtime_17720_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  444. self.sel_airtime_17720_entry.place(x=530, y=110)
  445. self.sel_airtime_17720_entry.insert(0, self.sel_airtime_17720)
  446. self.sel_airtime_17720_unit = Label(self.input_frame, text="sec", font=("宋体", self.font_size_text),
  447. anchor='w')
  448. self.sel_airtime_17720_unit.place(x=710, y=110)
  449. self.sel_presstime_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  450. text='17700保压时间:', anchor='w')
  451. self.sel_presstime_17700_label.place(x=20, y=140)
  452. self.sel_presstime_17700_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  453. self.sel_presstime_17700_entry.place(x=150, y=140)
  454. self.sel_presstime_17700_entry.insert(0, self.sel_presstime_17700)
  455. self.sel_presstime_17700_unit = Label(self.input_frame, text="sec", font=("宋体", self.font_size_text),
  456. anchor='w')
  457. self.sel_presstime_17700_unit.place(x=330, y=140)
  458. self.sel_presstime_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  459. text='17720保压时间:', anchor='w')
  460. self.sel_presstime_17720_label.place(x=400, y=140)
  461. self.sel_presstime_17720_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  462. self.sel_presstime_17720_entry.place(x=530, y=140)
  463. self.sel_presstime_17720_entry.insert(0, self.sel_presstime_17720)
  464. self.sel_presstime_17720_unit = Label(self.input_frame, text="sec", font=("宋体", self.font_size_text),
  465. anchor='w')
  466. self.sel_presstime_17720_unit.place(x=710, y=140)
  467. self.sel_testtime_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  468. text='17700测试时间:', anchor='w')
  469. self.sel_testtime_17700_label.place(x=20, y=170)
  470. self.sel_testtime_17700_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  471. self.sel_testtime_17700_entry.place(x=150, y=170)
  472. self.sel_testtime_17700_entry.insert(0, self.sel_testtime_17700)
  473. self.sel_testtime_17700_unit = Label(self.input_frame, text="sec", font=("宋体", self.font_size_text),
  474. anchor='w')
  475. self.sel_testtime_17700_unit.place(x=330, y=170)
  476. self.sel_testtime_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  477. text='17720测试时间:', anchor='w')
  478. self.sel_testtime_17720_label.place(x=400, y=170)
  479. self.sel_testtime_17720_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  480. self.sel_testtime_17720_entry.place(x=530, y=170)
  481. self.sel_testtime_17720_entry.insert(0, self.sel_testtime_17720)
  482. self.sel_testtime_17720_unit = Label(self.input_frame, text="sec", font=("宋体", self.font_size_text),
  483. anchor='w')
  484. self.sel_testtime_17720_unit.place(x=710, y=170)
  485. self.sel_exhaust_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  486. text='17700排气时间:', anchor='w')
  487. self.sel_exhaust_17700_label.place(x=20, y=200)
  488. self.sel_exhaust_17700_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  489. self.sel_exhaust_17700_entry.place(x=150, y=200)
  490. self.sel_exhaust_17700_entry.insert(0, self.sel_exhaust_17700)
  491. self.sel_exhaust_17700_unit = Label(self.input_frame, text="sec", font=("宋体", self.font_size_text),
  492. anchor='w')
  493. self.sel_exhaust_17700_unit.place(x=330, y=200)
  494. self.sel_exhaust_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  495. text='17720排气时间:', anchor='w')
  496. self.sel_exhaust_17720_label.place(x=400, y=200)
  497. self.sel_exhaust_17720_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  498. self.sel_exhaust_17720_entry.place(x=530, y=200)
  499. self.sel_exhaust_17720_entry.insert(0, self.sel_exhaust_17720)
  500. self.sel_exhaust_17720_unit = Label(self.input_frame, text="sec", font=("宋体", self.font_size_text),
  501. anchor='w')
  502. self.sel_exhaust_17720_unit.place(x=710, y=200)
  503. self.sel_maxpress_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  504. text='17700最大压力:', anchor='w')
  505. self.sel_maxpress_17700_label.place(x=20, y=230)
  506. self.sel_maxpress_17700_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  507. self.sel_maxpress_17700_entry.place(x=150, y=230)
  508. self.sel_maxpress_17700_entry.insert(0, self.sel_maxpress_17700)
  509. self.sel_maxpress_17700_unit = Label(self.input_frame, text="Kpa", font=("宋体", self.font_size_text),
  510. anchor='w')
  511. self.sel_maxpress_17700_unit.place(x=330, y=230)
  512. self.sel_maxpress_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  513. text='17720最大压力:', anchor='w')
  514. self.sel_maxpress_17720_label.place(x=400, y=230)
  515. self.sel_maxpress_17720_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  516. self.sel_maxpress_17720_entry.place(x=530, y=230)
  517. self.sel_maxpress_17720_entry.insert(0, self.sel_maxpress_17720)
  518. self.sel_maxpress_17720_unit = Label(self.input_frame, text="Kpa", font=("宋体", self.font_size_text),
  519. anchor='w')
  520. self.sel_maxpress_17720_unit.place(x=710, y=230)
  521. self.sel_minpress_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  522. text='17700最小压力:', anchor='w')
  523. self.sel_minpress_17700_label.place(x=20, y=260)
  524. self.sel_minpress_17700_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  525. self.sel_minpress_17700_entry.place(x=150, y=260)
  526. self.sel_minpress_17700_entry.insert(0, self.sel_minpress_17700)
  527. self.sel_minpress_17700_unit = Label(self.input_frame, text="Kpa", font=("宋体", self.font_size_text),
  528. anchor='w')
  529. self.sel_minpress_17700_unit.place(x=330, y=260)
  530. self.sel_minpress_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  531. text='17720最小压力:', anchor='w')
  532. self.sel_minpress_17720_label.place(x=400, y=260)
  533. self.sel_minpress_17720_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  534. self.sel_minpress_17720_entry.place(x=530, y=260)
  535. self.sel_minpress_17720_entry.insert(0, self.sel_minpress_17720)
  536. self.sel_minpress_17720_unit = Label(self.input_frame, text="Kpa", font=("宋体", self.font_size_text),
  537. anchor='w')
  538. self.sel_minpress_17720_unit.place(x=710, y=260)
  539. self.sel_setpress_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  540. text='17700设定压力:', anchor='w')
  541. self.sel_setpress_17700_label.place(x=20, y=290)
  542. self.sel_setpress_17700_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  543. self.sel_setpress_17700_entry.place(x=150, y=290)
  544. self.sel_setpress_17700_entry.insert(0, self.sel_setpress_17700)
  545. self.sel_setpress_17700_unit = Label(self.input_frame, text="Kpa", font=("宋体", self.font_size_text),
  546. anchor='w')
  547. self.sel_setpress_17700_unit.place(x=330, y=290)
  548. self.sel_setpress_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  549. text='17720设定压力:', anchor='w')
  550. self.sel_setpress_17720_label.place(x=400, y=290)
  551. self.sel_setpress_17720_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  552. self.sel_setpress_17720_entry.place(x=530, y=290)
  553. self.sel_setpress_17720_entry.insert(0, self.sel_setpress_17720)
  554. self.sel_setpress_17720_unit = Label(self.input_frame, text="Kpa", font=("宋体", self.font_size_text),
  555. anchor='w')
  556. self.sel_setpress_17720_unit.place(x=710, y=290)
  557. self.sel_capacity_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  558. text='17700容积:', anchor='w')
  559. self.sel_capacity_17700_label.place(x=20, y=320)
  560. self.sel_capacity_17700_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  561. self.sel_capacity_17700_entry.place(x=150, y=320)
  562. self.sel_capacity_17700_entry.insert(0, self.sel_capacity_17700)
  563. self.sel_capacity_17700_unit = Label(self.input_frame, text="ml", font=("宋体", self.font_size_text),
  564. anchor='w')
  565. self.sel_capacity_17700_unit.place(x=330, y=320)
  566. self.sel_capacity_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  567. text='17720容积:', anchor='w')
  568. self.sel_capacity_17720_label.place(x=400, y=320)
  569. self.sel_capacity_17720_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  570. self.sel_capacity_17720_entry.place(x=530, y=320)
  571. self.sel_capacity_17720_entry.insert(0, self.sel_capacity_17720)
  572. self.sel_capacity_17720_unit = Label(self.input_frame, text="ml", font=("宋体", self.font_size_text),
  573. anchor='w')
  574. self.sel_capacity_17720_unit.place(x=710, y=320)
  575. self.sel_posthreshold_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  576. text='17700正阈值:', anchor='w')
  577. self.sel_posthreshold_17700_label.place(x=20, y=350)
  578. self.sel_posthreshold_17700_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  579. self.sel_posthreshold_17700_entry.place(x=150, y=350)
  580. self.sel_posthreshold_17700_entry.insert(0, self.sel_posthreshold_17700)
  581. self.sel_posthreshold_17700_unit = Label(self.input_frame, text="ml/min", font=("宋体", self.font_size_text),
  582. anchor='w')
  583. self.sel_posthreshold_17700_unit.place(x=330, y=350)
  584. self.sel_posthreshold_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  585. text='17720正阈值:', anchor='w')
  586. self.sel_posthreshold_17720_label.place(x=400, y=350)
  587. self.sel_posthreshold_17720_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  588. self.sel_posthreshold_17720_entry.place(x=530, y=350)
  589. self.sel_posthreshold_17720_entry.insert(0, self.sel_posthreshold_17720)
  590. self.sel_posthreshold_17720_unit = Label(self.input_frame, text="ml/min", font=("宋体", self.font_size_text),
  591. anchor='w')
  592. self.sel_posthreshold_17720_unit.place(x=710, y=350)
  593. self.sel_pnegthreshold_17700_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  594. text='17700负阈值:', anchor='w')
  595. self.sel_pnegthreshold_17700_label.place(x=20, y=380)
  596. self.sel_pnegthreshold_17700_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  597. self.sel_pnegthreshold_17700_entry.place(x=150, y=380)
  598. self.sel_pnegthreshold_17700_entry.insert(0, self.sel_pnegthreshold_17700)
  599. self.sel_pnegthreshold_17700_unit = Label(self.input_frame, text="ml/min", font=("宋体", self.font_size_text),
  600. anchor='w')
  601. self.sel_pnegthreshold_17700_unit.place(x=330, y=380)
  602. self.sel_pnegthreshold_17720_label = Label(self.input_frame, font=("宋体", self.font_size_text),
  603. text='17720负阈值:', anchor='w')
  604. self.sel_pnegthreshold_17720_label.place(x=400, y=380)
  605. self.sel_pnegthreshold_17720_entry = tkinter.Entry(self.input_frame, width=28) # 设置"文本变量"为var
  606. self.sel_pnegthreshold_17720_entry.place(x=530, y=380)
  607. self.sel_pnegthreshold_17720_entry.insert(0, self.sel_pnegthreshold_17720)
  608. self.sel_pnegthreshold_17720_unit = Label(self.input_frame, text="ml/min", font=("宋体", self.font_size_text),
  609. anchor='w')
  610. self.sel_pnegthreshold_17720_unit.place(x=710, y=380)
  611. self.input_enterbtn = tkinter.Button(self.input_frame, text='确定', width=10,
  612. command=self.input_enter) # 按下此按钮(Input), 触发inputint函数
  613. self.input_cancelbtn = tkinter.Button(self.input_frame, text='取消', width=10,
  614. command=self.input_exit) # 按下此按钮(Clear), 触发inputclear函数
  615. self.input_enterbtn.place(x=150, y=430)
  616. self.input_cancelbtn.place(x=500, y=430)
  617. self.sel_product_name_entry.focus()
  618. self.sel_product_name_entry.xview("end")
  619. self.input_frame.resizable(width=False, height=False)
  620. self.input_frame.wm_attributes('-topmost', 1)
  621. self.input_frame.attributes("-toolwindow", 2)
  622. self.input_frame.focus_force()
  623. self.input_frame.protocol("WM_DELETE_WINDOW",
  624. self.input_on_closing)
  625. self.input_lock = True
  626. self.input_frame.mainloop()
  627. def product_double_event(self, event, idx):
  628. print("Product Name Double Event!")
  629. # if self.user_var.auth_stat == True:
  630. # self.input_param(idx)
  631. # else:
  632. # tkinter.messagebox.showwarning(title='提示', message='请登录后操作!')
  633. # 输入栏
  634. def user_frame_init(self):
  635. self.order_frame = Frame(
  636. self.main_frame, width=self.screen_width - 20, relief=SUNKEN, borderwidth=2,
  637. height=self.screen_height - self.title_canvas.winfo_reqheight() - self.button_canvas.winfo_reqheight() - 35)
  638. # 工单栏展示
  639. self.order_frame.place(x=12, y=self.title_canvas.winfo_reqheight() + 15)
  640. self.product_sel_button_01 = Button(self.order_frame, text="{0:02d}".format(1), width=6,
  641. font=("宋体", self.font_size_title, "bold"),
  642. command=lambda: self.product_sel_button_event(0))
  643. self.product_sel_button_01.place(x=20, y=0*60 + 20)
  644. # if self.user_var.product_list[0] == '':
  645. # self.product_sel_button_01.configure(state="disabled")
  646. self.product_sel_label_01 = Label(self.order_frame, textvariable=self.user_var.product_list_str[0],
  647. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  648. width=35, height=2)
  649. # self.product_sel_label_01.bind("<Double-Button-1>",
  650. # lambda event: self.product_double_event(event, 0))
  651. self.product_sel_label_01.place(x=120, y=0*60 + 15)
  652. self.product_sel_button_02 = Button(self.order_frame, text="{0:02d}".format(2), width=6,
  653. font=("宋体", self.font_size_title, "bold"),
  654. command=lambda: self.product_sel_button_event(1))
  655. self.product_sel_button_02.place(x=20, y=1 * 60 + 20)
  656. # if self.user_var.product_list[1] == '':
  657. # self.product_sel_button_02.configure(state="disabled")
  658. self.product_sel_label_02 = Label(self.order_frame, textvariable=self.user_var.product_list_str[1],
  659. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  660. width=35, height=2)
  661. # self.product_sel_label_02.bind("<Double-Button-1>",
  662. # lambda event: self.product_double_event(event, 1))
  663. self.product_sel_label_02.place(x=120, y=1 * 60 + 15)
  664. self.product_sel_button_03 = Button(self.order_frame, text="{0:02d}".format(3), width=6,
  665. font=("宋体", self.font_size_title, "bold"),
  666. command=lambda: self.product_sel_button_event(2))
  667. self.product_sel_button_03.place(x=20, y=2 * 60 + 20)
  668. # if self.user_var.product_list[2] == '':
  669. # self.product_sel_button_03.configure(state="disabled")
  670. self.product_sel_label_03 = Label(self.order_frame, textvariable=self.user_var.product_list_str[2],
  671. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  672. width=35, height=2)
  673. # self.product_sel_label_03.bind("<Double-Button-1>",
  674. # lambda event: self.product_double_event(event, 2))
  675. self.product_sel_label_03.place(x=120, y=2 * 60 + 15)
  676. self.product_sel_button_04 = Button(self.order_frame, text="{0:02d}".format(4), width=6,
  677. font=("宋体", self.font_size_title, "bold"),
  678. command=lambda: self.product_sel_button_event(3))
  679. self.product_sel_button_04.place(x=20, y=3 * 60 + 20)
  680. # if self.user_var.product_list[3] == '':
  681. # self.product_sel_button_04.configure(state="disabled")
  682. self.product_sel_label_04 = Label(self.order_frame, textvariable=self.user_var.product_list_str[3],
  683. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  684. width=35, height=2)
  685. # self.product_sel_label_04.bind("<Double-Button-1>",
  686. # lambda event: self.product_double_event(event, 3))
  687. self.product_sel_label_04.place(x=120, y=3 * 60 + 15)
  688. self.product_sel_button_05 = Button(self.order_frame, text="{0:02d}".format(5), width=6,
  689. font=("宋体", self.font_size_title, "bold"),
  690. command=lambda: self.product_sel_button_event(4))
  691. self.product_sel_button_05.place(x=20, y=4 * 60 + 20)
  692. # if self.user_var.product_list[4] == '':
  693. # self.product_sel_button_05.configure(state="disabled")
  694. self.product_sel_label_05 = Label(self.order_frame, textvariable=self.user_var.product_list_str[4],
  695. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  696. width=35, height=2)
  697. # self.product_sel_label_05.bind("<Double-Button-1>",
  698. # lambda event: self.product_double_event(event, 4))
  699. self.product_sel_label_05.place(x=120, y=4 * 60 + 15)
  700. self.product_sel_button_06 = Button(self.order_frame, text="{0:02d}".format(6), width=6,
  701. font=("宋体", self.font_size_title, "bold"),
  702. command=lambda: self.product_sel_button_event(5))
  703. self.product_sel_button_06.place(x=20, y=5 * 60 + 20)
  704. # if self.user_var.product_list[5] == '':
  705. # self.product_sel_button_06.configure(state="disabled")
  706. self.product_sel_label_06 = Label(self.order_frame, textvariable=self.user_var.product_list_str[5],
  707. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  708. width=35, height=2)
  709. # self.product_sel_label_06.bind("<Double-Button-1>",
  710. # lambda event: self.product_double_event(event, 5))
  711. self.product_sel_label_06.place(x=120, y=5 * 60 + 15)
  712. self.product_sel_button_07 = Button(self.order_frame, text="{0:02d}".format(7), width=6,
  713. font=("宋体", self.font_size_title, "bold"),
  714. command=lambda: self.product_sel_button_event(6))
  715. self.product_sel_button_07.place(x=20, y=6 * 60 + 20)
  716. # if self.user_var.product_list[6] == '':
  717. # self.product_sel_button_07.configure(state="disabled")
  718. self.product_sel_label_07 = Label(self.order_frame, textvariable=self.user_var.product_list_str[6],
  719. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  720. width=35, height=2)
  721. # self.product_sel_label_07.bind("<Double-Button-1>",
  722. # lambda event: self.product_double_event(event, 6))
  723. self.product_sel_label_07.place(x=120, y=6 * 60 + 15)
  724. self.product_sel_button_08 = Button(self.order_frame, text="{0:02d}".format(8), width=6,
  725. font=("宋体", self.font_size_title, "bold"),
  726. command=lambda: self.product_sel_button_event(7))
  727. self.product_sel_button_08.place(x=520, y=0 * 60 + 20)
  728. # if self.user_var.product_list[7] == '':
  729. # self.product_sel_button_08.configure(state="disabled")
  730. self.product_sel_label_08 = Label(self.order_frame, textvariable=self.user_var.product_list_str[7],
  731. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  732. width=35, height=2)
  733. # self.product_sel_label_08.bind("<Double-Button-1>",
  734. # lambda event: self.product_double_event(event, 7))
  735. self.product_sel_label_08.place(x=620, y=0 * 60 + 15)
  736. self.product_sel_button_09 = Button(self.order_frame, text="{0:02d}".format(9), width=6,
  737. font=("宋体", self.font_size_title, "bold"),
  738. command=lambda: self.product_sel_button_event(8))
  739. self.product_sel_button_09.place(x=520, y=1 * 60 + 20)
  740. # if self.user_var.product_list[8] == '':
  741. # self.product_sel_button_09.configure(state="disabled")
  742. self.product_sel_label_09 = Label(self.order_frame, textvariable=self.user_var.product_list_str[8],
  743. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  744. width=35, height=2)
  745. # self.product_sel_label_09.bind("<Double-Button-1>",
  746. # lambda event: self.product_double_event(event, 8))
  747. self.product_sel_label_09.place(x=620, y=1 * 60 + 15)
  748. self.product_sel_button_10 = Button(self.order_frame, text="{0:02d}".format(10), width=6,
  749. font=("宋体", self.font_size_title, "bold"),
  750. command=lambda: self.product_sel_button_event(9))
  751. self.product_sel_button_10.place(x=520, y=2 * 60 + 20)
  752. # if self.user_var.product_list[9] == '':
  753. # self.product_sel_button_10.configure(state="disabled")
  754. self.product_sel_label_10 = Label(self.order_frame, textvariable=self.user_var.product_list_str[9],
  755. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  756. width=35, height=2)
  757. # self.product_sel_label_10.bind("<Double-Button-1>",
  758. # lambda event: self.product_double_event(event, 9))
  759. self.product_sel_label_10.place(x=620, y=2 * 60 + 15)
  760. self.product_sel_button_11 = Button(self.order_frame, text="{0:02d}".format(11), width=6,
  761. font=("宋体", self.font_size_title, "bold"),
  762. command=lambda: self.product_sel_button_event(10))
  763. self.product_sel_button_11.place(x=520, y=3 * 60 + 20)
  764. # if self.user_var.product_list[10] == '':
  765. # self.product_sel_button_11.configure(state="disabled")
  766. self.product_sel_label_11 = Label(self.order_frame, textvariable=self.user_var.product_list_str[10],
  767. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  768. width=35, height=2)
  769. # self.product_sel_label_11.bind("<Double-Button-1>",
  770. # lambda event: self.product_double_event(event, 10))
  771. self.product_sel_label_11.place(x=620, y=3 * 60 + 15)
  772. self.product_sel_button_12 = Button(self.order_frame, text="{0:02d}".format(12), width=6,
  773. font=("宋体", self.font_size_title, "bold"),
  774. command=lambda: self.product_sel_button_event(11))
  775. self.product_sel_button_12.place(x=520, y=4 * 60 + 20)
  776. # if self.user_var.product_list[11] == '':
  777. # self.product_sel_button_12.configure(state="disabled")
  778. self.product_sel_label_12 = Label(self.order_frame, textvariable=self.user_var.product_list_str[11],
  779. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  780. width=35, height=2)
  781. # self.product_sel_label_12.bind("<Double-Button-1>",
  782. # lambda event: self.product_double_event(event, 11))
  783. self.product_sel_label_12.place(x=620, y=4 * 60 + 15)
  784. self.product_sel_button_13 = Button(self.order_frame, text="{0:02d}".format(13), width=6,
  785. font=("宋体", self.font_size_title, "bold"),
  786. command=lambda: self.product_sel_button_event(12))
  787. self.product_sel_button_13.place(x=520, y=5 * 60 + 20)
  788. # if self.user_var.product_list[12] == '':
  789. # self.product_sel_button_13.configure(state="disabled")
  790. self.product_sel_label_13 = Label(self.order_frame, textvariable=self.user_var.product_list_str[12],
  791. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  792. width=35, height=2)
  793. # self.product_sel_label_13.bind("<Double-Button-1>",
  794. # lambda event: self.product_double_event(event, 12))
  795. self.product_sel_label_13.place(x=620, y=5 * 60 + 15)
  796. self.product_sel_button_14 = Button(self.order_frame, text="{0:02d}".format(14), width=6,
  797. font=("宋体", self.font_size_title, "bold"),
  798. command=lambda: self.product_sel_button_event(13))
  799. self.product_sel_button_14.place(x=520, y=6 * 60 + 20)
  800. # if self.user_var.product_list[13] == '':
  801. # self.product_sel_button_14.configure(state="disabled")
  802. self.product_sel_label_14 = Label(self.order_frame, textvariable=self.user_var.product_list_str[13],
  803. fg='PaleGreen', font=("宋体", self.font_size_title), bg="black", anchor='c',
  804. width=35, height=2)
  805. # self.product_sel_label_14.bind("<Double-Button-1>",
  806. # lambda event: self.product_double_event(event, 13))
  807. self.product_sel_label_14.place(x=620, y=6 * 60 + 15)
  808. # for i in range(14):
  809. # exec('self.product_sel_button_{0:02d} = Button(self.order_frame, text="{1:02d}", width=6,\
  810. # font=("宋体", self.font_size_title, "bold"),\
  811. # command=lambda:self.product_sel_button_event({2}))'.format(i, i+1, i))
  812. # exec('self.product_sel_button_{0:02d}.place(x=20, y={1} * 60 + 20)'.format(i, i))
  813. # exec('if self.user_var.product_list[{0}] == "":\
  814. # self.product_sel_button_{1:02d}.configure(state="disabled")'.format(i, i))
  815. # exec('self.product_sel_label_{0:02d} = Label(self.order_frame, textvariable=self.user_var.product_list_str[{1}],\
  816. # fg="PaleGreen", font=("宋体", self.font_size_title), bg="black", anchor="c",\
  817. # width=35, height=2)'.format(i, i))
  818. # exec('self.product_sel_label_{0:02d}.bind("<Double-Button-1>",\
  819. # lambda event:self.product_double_event(event, {1}))'.format(i, i))
  820. # exec('self.product_sel_label_{0:02d}.place(x=120, y={1} * 60 + 15)'.format(i, i))
  821. exec('self.product_sel_label_{0:02d}.config(fg="yellow")'.format(self.user_var.product_idx+1))