加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
admin.py 46.41 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
import numpy as np
import wx
from sqlconnection import SqlCon
from user import User
import wx.lib.intctrl # 限制输入为整数
from material import MatClass
from material import Material
from location import Location
class AdminFrame(wx.Frame):
"""
搭建管理员界面和按键
"""
def __init__(self, parent):
self.sql_con = SqlCon()
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"胶料管理系统", pos=wx.DefaultPosition, size=wx.Size(1024, 768),
style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
adm_bSizer6 = wx.BoxSizer(wx.VERTICAL)
self.admin_staticText6 = wx.StaticText(self, wx.ID_ANY, u"胶 料 管 理 系 统 (管理员)", wx.DefaultPosition,
wx.DefaultSize, wx.ALIGN_CENTER_HORIZONTAL)
self.admin_staticText6.Wrap(-1)
self.admin_staticText6.SetFont(
wx.Font(30, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "黑体"))
adm_bSizer6.Add(self.admin_staticText6, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 20)
self.admin_bSizer7 = wx.BoxSizer(wx.HORIZONTAL)
admin_sbSizer2 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"选择操作"), wx.VERTICAL)
self.admin_button2 = wx.Button(admin_sbSizer2.GetStaticBox(), 1, u"新增人员", wx.DefaultPosition,
wx.Size(150, 40), 0)
self.admin_button2.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
admin_sbSizer2.Add(self.admin_button2, 0,
wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.EXPAND | wx.FIXED_MINSIZE | wx.TOP, 40)
self.admin_button3 = wx.Button(admin_sbSizer2.GetStaticBox(), 2, u"更改人员", wx.DefaultPosition,
wx.Size(-1, 40), 0)
self.admin_button3.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
admin_sbSizer2.Add(self.admin_button3, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.FIXED_MINSIZE | wx.EXPAND,
40)
self.admin_button4 = wx.Button(admin_sbSizer2.GetStaticBox(), 3, u"新增胶料类", wx.DefaultPosition,
wx.Size(-1, 40), 0)
self.admin_button4.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
admin_sbSizer2.Add(self.admin_button4, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.FIXED_MINSIZE | wx.EXPAND,
40)
self.admin_button5 = wx.Button(admin_sbSizer2.GetStaticBox(), 4, u"更改胶料类", wx.DefaultPosition,
wx.Size(-1, 40), 0)
self.admin_button5.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
admin_sbSizer2.Add(self.admin_button5, 0, wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 40)
self.admin_button6 = wx.Button(admin_sbSizer2.GetStaticBox(), 5, u"地点和设备", wx.DefaultPosition,
wx.Size(-1, 40), 0)
self.admin_button6.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
admin_sbSizer2.Add(self.admin_button6, 0, wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, 40)
self.admin_button7 = wx.Button(admin_sbSizer2.GetStaticBox(), 6, u"质量信息", wx.DefaultPosition,
wx.Size(-1, 40), 0)
self.admin_button7.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
admin_sbSizer2.Add(self.admin_button7, 0, wx.BOTTOM | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 40)
self.admin_button8 = wx.Button(admin_sbSizer2.GetStaticBox(), 7, u"退出", wx.DefaultPosition,
wx.Size(-1, 40), 0)
self.admin_button8.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
admin_sbSizer2.Add(self.admin_button8, 0, wx.BOTTOM | wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 40)
self.Bind(wx.EVT_BUTTON, self.click_button, id=1, id2=7)
self.admin_bSizer7.Add(admin_sbSizer2, 0,
wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.FIXED_MINSIZE | wx.RIGHT, 10)
adm_bSizer6.Add(self.admin_bSizer7, 1, wx.ALL | wx.EXPAND | wx.FIXED_MINSIZE, 5)
self.SetSizer(adm_bSizer6)
self.Layout()
self.Centre(wx.BOTH)
def __del__(self):
self.sql_con.db_cursor.close()
def click_button(self, event):
"""
监控用户界面左侧按键的动作并切换界面的函数
"""
source_id = event.GetId()
if source_id == 1:
user_add_button = UserAdd(None)
user_add_button.Show()
self.Close(True)
elif source_id == 2:
user_update_button = UserUpdate(None)
user_update_button.Show()
self.Close(True)
elif source_id == 3:
cls_add_button = ClsAdd(None)
cls_add_button.Show()
self.Close(True)
elif source_id == 4:
cls_update_button = ClsUpdate(None)
cls_update_button.Show()
self.Close(True)
elif source_id == 5:
stocktaking_button = LocAddUpdate(None)
stocktaking_button.Show()
self.Close(True)
elif source_id == 6:
stocktaking_button = QualityUpdate(None)
stocktaking_button.Show()
self.Close(True)
elif source_id == 7:
from login import LoginMain
login_button = LoginMain(None)
login_button.Show()
self.Close(True)
event.Skip()
class UserAdd(AdminFrame):
"""
新增用户
"""
def __init__(self, parent):
super().__init__(parent)
user_add = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"新增人员"), wx.VERTICAL)
ua_bSizer13 = wx.BoxSizer(wx.HORIZONTAL)
ua_staticText12 = wx.StaticText(user_add.GetStaticBox(), wx.ID_ANY, u"姓名(不为空):", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
ua_staticText12.Wrap(-1)
ua_staticText12.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ua_bSizer13.Add(ua_staticText12, 0, wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE | wx.ALL, 20)
self.ua_textCtrl2 = wx.TextCtrl(user_add.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(200, -1), 0)
self.ua_textCtrl2.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.ua_textCtrl2.SetFocus()
ua_bSizer13.Add(self.ua_textCtrl2, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 5)
user_add.Add(ua_bSizer13, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.FIXED_MINSIZE | wx.TOP, 20)
ua_bSizer10 = wx.BoxSizer(wx.HORIZONTAL)
ua_staticText13 = wx.StaticText(user_add.GetStaticBox(), wx.ID_ANY, u"工号:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
ua_staticText13.Wrap(-1)
ua_staticText13.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ua_bSizer10.Add(ua_staticText13, 0, wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE | wx.ALL, 20)
self.ua_textCtrl3 = wx.TextCtrl(user_add.GetStaticBox(), wx.ID_ANY, u"52300", wx.DefaultPosition,
wx.Size(200, -1), 0)
self.ua_textCtrl3.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.ua_textCtrl3.SetMaxLength(8)
ua_bSizer10.Add(self.ua_textCtrl3, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 5)
user_add.Add(ua_bSizer10, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 20)
ua_bSizer12 = wx.BoxSizer(wx.HORIZONTAL)
self.ua_button5 = wx.Button(user_add.GetStaticBox(), wx.ID_ANY, u"录入", wx.DefaultPosition, wx.DefaultSize, 0)
self.ua_button5.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.ua_button5.Bind(wx.EVT_BUTTON, self.ua_button5OnClick)
ua_bSizer12.Add(self.ua_button5, 0, wx.ALL, 5)
self.ua_button6 = wx.Button(user_add.GetStaticBox(), wx.ID_ANY, u"清空", wx.DefaultPosition, wx.DefaultSize, 0)
self.ua_button6.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.ua_button6.Bind(wx.EVT_BUTTON, self.ua_button6OnClick)
ua_bSizer12.Add(self.ua_button6, 0, wx.ALL, 5)
user_add.Add(ua_bSizer12, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 10)
self.ua_staticText11 = wx.StaticText(user_add.GetStaticBox(), wx.ID_ANY, u"", wx.DefaultPosition,
wx.DefaultSize, 0)
self.ua_staticText11.Wrap(-1)
self.ua_staticText11.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
user_add.Add(self.ua_staticText11, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
self.admin_bSizer7.Add(user_add, 1, wx.EXPAND | wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
def ua_button5OnClick(self, event):
"""
"确定",新增用户
"""
user = User(user_name=self.ua_textCtrl2.GetValue(), user_card=self.ua_textCtrl3.GetValue())
try:
user.user_register()
self.ua_staticText11.SetLabelText('新增用户成功!')
self.ua_staticText11.SetForegroundColour(wx.Colour('green'))
self.ua_textCtrl2.Clear()
self.ua_textCtrl3.SetValue(u'52300')
except Exception:
self.ua_staticText11.SetLabelText(u"人名或卡号为空或者指定了loc_id!")
self.ua_staticText11.SetForegroundColour(wx.Colour('red'))
self.ua_textCtrl2.Clear()
self.ua_textCtrl3.SetValue(u'52300')
event.Skip()
def ua_button6OnClick(self, event):
"""
"清空",清空所填的内容
"""
self.ua_staticText11.SetLabelText(u"")
self.ua_textCtrl2.Clear()
self.ua_textCtrl3.SetValue(u'52300')
event.Skip()
class UserUpdate(AdminFrame):
"""
更改人员信息
"""
def __init__(self, parent):
super().__init__(parent)
self.user_all = User.user_all()
self.ind = -1 # 数据库user表单中的user_id值
user_update = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"更改人员"), wx.VERTICAL)
up_bSizer13 = wx.BoxSizer(wx.HORIZONTAL)
up_staticText12 = wx.StaticText(user_update.GetStaticBox(), wx.ID_ANY, u"姓名:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
up_staticText12.Wrap(-1)
up_staticText12.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
up_bSizer13.Add(up_staticText12, 0, wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE | wx.ALL, 20)
up_comboBox2Choices = self.user_all[:, 1]
self.up_comboBox2 = wx.ComboBox(user_update.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(200, -1), up_comboBox2Choices, 0)
self.up_comboBox2.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.up_comboBox2.SetFocus()
self.up_comboBox2.Bind(wx.EVT_COMBOBOX, self.up_comboBox2OnChoice)
up_bSizer13.Add(self.up_comboBox2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
user_update.Add(up_bSizer13, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.FIXED_MINSIZE | wx.TOP, 20)
up_bSizer10 = wx.BoxSizer(wx.HORIZONTAL)
up_staticText13 = wx.StaticText(user_update.GetStaticBox(), wx.ID_ANY, u"工号:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
up_staticText13.Wrap(-1)
up_staticText13.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
up_bSizer10.Add(up_staticText13, 0, wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE | wx.ALL, 20)
self.up_textCtrl2 = wx.TextCtrl(user_update.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(200, -1), 0)
self.up_textCtrl2.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
up_bSizer10.Add(self.up_textCtrl2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
user_update.Add(up_bSizer10, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 20)
up_bSizer14 = wx.BoxSizer(wx.HORIZONTAL)
up_staticText14 = wx.StaticText(user_update.GetStaticBox(), wx.ID_ANY, u"状态:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
up_staticText14.Wrap(-1)
up_staticText14.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
up_bSizer14.Add(up_staticText14, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 20)
up_choice8Choices = [u"有效", u"无效"]
self.up_choice8 = wx.Choice(user_update.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size(200, -1),
up_choice8Choices, 0)
self.up_choice8.SetSelection(0)
self.up_choice8.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
up_bSizer14.Add(self.up_choice8, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 5)
user_update.Add(up_bSizer14, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 20)
up_bSizer12 = wx.BoxSizer(wx.VERTICAL)
self.up_button5 = wx.Button(user_update.GetStaticBox(), wx.ID_ANY, u"更改", wx.DefaultPosition, wx.DefaultSize, 0)
self.up_button5.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.up_button5.Bind(wx.EVT_BUTTON, self.up_button5OnClick)
up_bSizer12.Add(self.up_button5, 0, wx.ALL, 5)
self.up_staticText11 = wx.StaticText(user_update.GetStaticBox(), wx.ID_ANY, u"", wx.DefaultPosition,
wx.DefaultSize, 0)
self.up_staticText11.Wrap(-1)
self.up_staticText11.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
up_bSizer12.Add(self.up_staticText11, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
user_update.Add(up_bSizer12, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 10)
self.admin_bSizer7.Add(user_update, 1, wx.EXPAND | wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
def up_comboBox2OnChoice(self, event):
"""
通过选择用户名自动填充工号和状态
"""
self.up_staticText11.SetLabelText(u'')
self.ind = self.up_comboBox2.GetSelection()
self.up_textCtrl2.SetValue(self.user_all[self.ind, 2] if self.user_all[self.ind, 2] else '')
if self.user_all[self.ind, 3] == '有效':
self.up_choice8.SetSelection(0)
else:
self.up_choice8.SetSelection(1)
event.Skip()
def up_button5OnClick(self, event):
"""
修改用户信息确认键
:param event:
:return:
"""
if self.ind == -1:
self.up_staticText11.SetLabelText(u'请重新选择用户名!')
self.up_staticText11.SetForegroundColour(wx.Colour('red'))
else:
arg = (self.up_comboBox2.GetValue(), self.up_textCtrl2.GetValue(), self.up_choice8.GetStringSelection(),
self.ind+1) # ind+1是因为user_id自动递增编号是从1开始,而python默认的index是从0开始
User.user_update(arg)
self.up_staticText11.SetLabelText(u'修改成功')
self.up_staticText11.SetForegroundColour(wx.Colour('green'))
self.user_all = User.user_all()
event.Skip()
class ClsAdd(AdminFrame):
"""
增加物料类
"""
def __init__(self, parent):
super().__init__(parent)
cls_add = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"新增胶料类"), wx.VERTICAL)
ca_bSizer13 = wx.BoxSizer(wx.HORIZONTAL)
ca_staticText12 = wx.StaticText(cls_add.GetStaticBox(), wx.ID_ANY, u"ERP编码:", wx.DefaultPosition,
wx.Size(150, -1), wx.ALIGN_RIGHT)
ca_staticText12.Wrap(-1)
ca_staticText12.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ca_bSizer13.Add(ca_staticText12, 0, wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE | wx.ALL, 20)
self.ca_textCtrl2 = wx.TextCtrl(cls_add.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(300, -1), 0)
self.ca_textCtrl2.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.ca_textCtrl2.SetFocus()
ca_bSizer13.Add(self.ca_textCtrl2, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 5)
cls_add.Add(ca_bSizer13, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.FIXED_MINSIZE | wx.TOP, 10)
ca_bSizer10 = wx.BoxSizer(wx.HORIZONTAL)
ca_staticText13 = wx.StaticText(cls_add.GetStaticBox(), wx.ID_ANY, u"胶料名称(不为空):", wx.DefaultPosition,
wx.Size(150, -1), wx.ALIGN_RIGHT)
ca_staticText13.Wrap(-1)
ca_staticText13.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ca_bSizer10.Add(ca_staticText13, 0, wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE | wx.ALL, 20)
self.ca_textCtrl3 = wx.TextCtrl(cls_add.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(300, -1), 0)
self.ca_textCtrl3.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ca_bSizer10.Add(self.ca_textCtrl3, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 5)
cls_add.Add(ca_bSizer10, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
ca_bSizer11 = wx.BoxSizer(wx.HORIZONTAL)
ca_staticText10 = wx.StaticText(cls_add.GetStaticBox(), wx.ID_ANY, u"规格型号:", wx.DefaultPosition,
wx.Size(150, -1), wx.ALIGN_RIGHT)
ca_staticText10.Wrap(-1)
ca_staticText10.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ca_bSizer11.Add(ca_staticText10, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 20)
self.ca_textCtrl4 = wx.TextCtrl(cls_add.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(300, -1), 0)
self.ca_textCtrl4.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ca_bSizer11.Add(self.ca_textCtrl4, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
cls_add.Add(ca_bSizer11, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
ca_bSizer12 = wx.BoxSizer(wx.HORIZONTAL)
ca_staticText101 = wx.StaticText(cls_add.GetStaticBox(), wx.ID_ANY, u"规格重量(kg/桶):", wx.DefaultPosition,
wx.Size(150, -1), wx.ALIGN_RIGHT)
ca_staticText101.Wrap(-1)
ca_staticText101.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ca_bSizer12.Add(ca_staticText101, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 20)
self.ca_textCtrl42 = wx.lib.intctrl.IntCtrl(cls_add.GetStaticBox(), wx.ID_ANY, 0, wx.DefaultPosition,
wx.Size(300, -1), 0)
self.ca_textCtrl42.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ca_bSizer12.Add(self.ca_textCtrl42, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
cls_add.Add(ca_bSizer12, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
ca_bSizer14 = wx.BoxSizer(wx.HORIZONTAL)
ca_staticText102 = wx.StaticText(cls_add.GetStaticBox(), wx.ID_ANY, u"最大安全库存(kg, 没有填0):", wx.DefaultPosition,
wx.Size(150, -1), wx.ALIGN_RIGHT)
ca_staticText102.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ca_bSizer14.Add(ca_staticText102, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 20)
self.ca_textCtrl41 = wx.lib.intctrl.IntCtrl(cls_add.GetStaticBox(), wx.ID_ANY, 0, wx.DefaultPosition,
wx.Size(300, -1), 0)
self.ca_textCtrl41.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
ca_bSizer14.Add(self.ca_textCtrl41, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
cls_add.Add(ca_bSizer14, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 5)
ca_bSizer12 = wx.BoxSizer(wx.HORIZONTAL)
self.ca_button5 = wx.Button(cls_add.GetStaticBox(), wx.ID_ANY, u"录入", wx.DefaultPosition, wx.DefaultSize, 0)
self.ca_button5.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.ca_button5.Bind(wx.EVT_BUTTON, self.ca_button5OnClick)
ca_bSizer12.Add(self.ca_button5, 0, wx.ALL, 5)
self.ca_button6 = wx.Button(cls_add.GetStaticBox(), wx.ID_ANY, u"清空", wx.DefaultPosition, wx.DefaultSize, 0)
self.ca_button6.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.ca_button6.Bind(wx.EVT_BUTTON, self.ca_button6OnClick)
ca_bSizer12.Add(self.ca_button6, 0, wx.ALL, 5)
cls_add.Add(ca_bSizer12, 0, wx.ALIGN_CENTER_HORIZONTAL, 5)
self.ca_staticText10 = wx.StaticText(cls_add.GetStaticBox(), wx.ID_ANY, u"", wx.DefaultPosition,
wx.DefaultSize, 0)
self.ca_staticText10.Wrap(-1)
cls_add.Add(self.ca_staticText10, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
self.admin_bSizer7.Add(cls_add, 1, wx.EXPAND | wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
def ca_button5OnClick(self, event):
"""
录入系统
:param event:
:return:
"""
erp_code = self.ca_textCtrl2.GetValue()
cls_name = self.ca_textCtrl3.GetValue()
cls_spec = self.ca_textCtrl4.GetValue()
cls_spec_int = self.ca_textCtrl42.GetValue()
max_quantity = self.ca_textCtrl41.GetValue()
cls_ = MatClass(erp_code=erp_code, cls_name=cls_name, cls_spec=cls_spec, cls_spec_int=cls_spec_int,
max_quantity=max_quantity)
try:
cls_.class_register()
self.ca_staticText10.SetLabelText('录入成功!')
self.ca_staticText10.SetForegroundColour(wx.Colour('green'))
self.ca_textCtrl2.Clear()
self.ca_textCtrl3.Clear()
self.ca_textCtrl4.Clear()
self.ca_textCtrl42.SetValue(0)
self.ca_textCtrl41.SetValue(0)
except Exception:
self.ca_staticText10.SetLabelText('没有输入物料类名或者规格重量、最大安全库存不为数字!')
self.ca_staticText10.SetForegroundColour(wx.Colour('red'))
event.Skip()
def ca_button6OnClick(self, event):
"""
清空
:param event:
:return:
"""
self.ca_textCtrl2.Clear()
self.ca_textCtrl3.Clear()
self.ca_textCtrl4.Clear()
self.ca_textCtrl42.SetValue(0)
self.ca_textCtrl41.SetValue(0)
event.Skip()
class ClsUpdate(AdminFrame):
"""
更新物料类
"""
def __init__(self, parent):
super().__init__(parent)
self.cls_all = MatClass.cls_all()
self.ind = -1
cls_update = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"更改胶料类"), wx.VERTICAL)
cu_bSizer13 = wx.BoxSizer(wx.HORIZONTAL)
cu_staticText12 = wx.StaticText(cls_update.GetStaticBox(), wx.ID_ANY, u"ERP编码:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
cu_staticText12.Wrap(-1)
cu_staticText12.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer13.Add(cu_staticText12, 0, wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE | wx.ALL, 10)
self.cu_textCtrl5 = wx.TextCtrl(cls_update.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(200, -1), 0)
self.cu_textCtrl5.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer13.Add(self.cu_textCtrl5, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
cls_update.Add(cu_bSizer13, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.FIXED_MINSIZE | wx.TOP, 10)
cu_bSizer10 = wx.BoxSizer(wx.HORIZONTAL)
cu_staticText13 = wx.StaticText(cls_update.GetStaticBox(), wx.ID_ANY, u"胶料名称(不为空):", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
cu_staticText13.Wrap(-1)
cu_staticText13.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer10.Add(cu_staticText13, 0, wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE | wx.ALL, 10)
cu_comboBox3Choices = self.cls_all[:, 2]
self.cu_comboBox3 = wx.ComboBox(cls_update.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(200, -1), cu_comboBox3Choices, 0)
self.cu_comboBox3.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.cu_comboBox3.Bind(wx.EVT_COMBOBOX, self.cu_comboBox3OnChoice)
cu_bSizer10.Add(self.cu_comboBox3, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
cls_update.Add(cu_bSizer10, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
cu_bSizer11 = wx.BoxSizer(wx.HORIZONTAL)
cu_staticText10 = wx.StaticText(cls_update.GetStaticBox(), wx.ID_ANY, u"规格型号:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
cu_staticText10.Wrap(-1)
cu_staticText10.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer11.Add(cu_staticText10, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 10)
self.cu_textCtrl2 = wx.TextCtrl(cls_update.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(200, -1), 0)
self.cu_textCtrl2.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer11.Add(self.cu_textCtrl2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
cls_update.Add(cu_bSizer11, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
cu_bSizer1111 = wx.BoxSizer(wx.HORIZONTAL)
cu_staticText1011 = wx.StaticText(cls_update.GetStaticBox(), wx.ID_ANY, u"规格重量(kg/桶):", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
cu_staticText1011.Wrap(-1)
cu_staticText1011.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer1111.Add(cu_staticText1011, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 10)
self.cu_textCtrl211 = wx.lib.intctrl.IntCtrl(cls_update.GetStaticBox(), wx.ID_ANY, 0, wx.DefaultPosition,
wx.Size(200, -1), 0)
self.cu_textCtrl211.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer1111.Add(self.cu_textCtrl211, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
cls_update.Add(cu_bSizer1111, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
cu_bSizer111 = wx.BoxSizer(wx.HORIZONTAL)
cu_staticText101 = wx.StaticText(cls_update.GetStaticBox(), wx.ID_ANY, u"最大安全库存(kg, 没有填0):",
wx.DefaultPosition, wx.Size(80, -1), wx.ALIGN_RIGHT)
cu_staticText101.Wrap(-1)
cu_staticText101.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer111.Add(cu_staticText101, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 10)
self.cu_textCtrl21 = wx.lib.intctrl.IntCtrl(cls_update.GetStaticBox(), wx.ID_ANY, 0, wx.DefaultPosition,
wx.Size(200, -1), 0)
self.cu_textCtrl21.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer111.Add(self.cu_textCtrl21, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
cls_update.Add(cu_bSizer111, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
cu_bSizer14 = wx.BoxSizer(wx.HORIZONTAL)
up_staticText14 = wx.StaticText(cls_update.GetStaticBox(), wx.ID_ANY, u"状态:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
up_staticText14.Wrap(-1)
up_staticText14.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer14.Add(up_staticText14, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 20)
cu_choice8Choices = [u"有效", u"无效"]
self.cu_choice8 = wx.Choice(cls_update.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size(200, -1),
cu_choice8Choices, 0)
self.cu_choice8.SetSelection(0)
self.cu_choice8.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cu_bSizer14.Add(self.cu_choice8, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 5)
cls_update.Add(cu_bSizer14, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
cu_bSizer12 = wx.BoxSizer(wx.HORIZONTAL)
self.cu_button5 = wx.Button(cls_update.GetStaticBox(), wx.ID_ANY, u"更改", wx.DefaultPosition, wx.DefaultSize, 0)
self.cu_button5.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.cu_button5.Bind(wx.EVT_BUTTON, self.cu_button5OnClick)
cu_bSizer12.Add(self.cu_button5, 0, wx.ALL, 5)
cls_update.Add(cu_bSizer12, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 10)
self.cu_staticText12 = wx.StaticText(cls_update.GetStaticBox(), wx.ID_ANY, u"", wx.DefaultPosition,
wx.DefaultSize, 0)
self.cu_staticText12.Wrap(-1)
self.cu_staticText12.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
cls_update.Add(self.cu_staticText12, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
self.admin_bSizer7.Add(cls_update, 1, wx.EXPAND | wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
def cu_comboBox3OnChoice(self, event):
"""
选择胶料类名后更新所有信息
:param event:
:return:
"""
self.ind = self.cu_comboBox3.GetSelection()
self.cu_textCtrl5.SetValue(self.cls_all[self.ind, 1] if self.cls_all[self.ind, 1] else '')
self.cu_textCtrl2.SetValue(self.cls_all[self.ind, 3] if self.cls_all[self.ind, 3] else '')
self.cu_textCtrl211.SetValue(self.cls_all[self.ind, 4] if self.cls_all[self.ind, 4] else 0)
self.cu_textCtrl21.SetValue(self.cls_all[self.ind, 5] if self.cls_all[self.ind, 5] else 0)
if self.cls_all[self.ind, 6] == '有效':
self.cu_choice8.SetSelection(0)
else:
self.cu_choice8.SetSelection(1)
event.Skip()
def cu_button5OnClick(self, event):
"""
更新录入
:param event:
:return:
"""
if self.ind == -1:
self.cu_staticText12.SetLabelText(u'请重新选择胶料类名!')
self.cu_staticText12.SetForegroundColour(wx.Colour('red'))
else:
args = (self.cu_textCtrl5.GetValue(), self.cu_comboBox3.GetValue(), self.cu_textCtrl2.GetValue(),
self.cu_textCtrl211.GetValue(), self.cu_textCtrl21.GetValue(), self.cu_choice8.GetStringSelection(),
self.ind+1)
MatClass.class_update(args)
self.cu_staticText12.SetLabelText(u'更改成功!')
self.cu_staticText12.SetForegroundColour(wx.Colour('green'))
self.cls_all = MatClass.cls_all()
event.Skip()
class LocAddUpdate(AdminFrame):
"""
新增和更改地点或者设备
"""
def __init__(self, parent):
super().__init__(parent)
self.loc_all = Location.loc_all()
self.ind = -1
loc_update = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"新增或更改地点和设备"), wx.VERTICAL)
lu_bSizer13 = wx.BoxSizer(wx.HORIZONTAL)
lu_staticText12 = wx.StaticText(loc_update.GetStaticBox(), wx.ID_ANY, u"地点名称:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
lu_staticText12.Wrap(-1)
lu_staticText12.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
lu_bSizer13.Add(lu_staticText12, 0, wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE | wx.ALL, 10)
lu_comboBox2Choices = self.loc_all[:, 1]
self.lu_comboBox2 = wx.ComboBox(loc_update.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(200, -1), lu_comboBox2Choices, 0)
self.lu_comboBox2.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.lu_comboBox2.Bind(wx.EVT_COMBOBOX, self.lu_comboBox2OnChoice)
lu_bSizer13.Add(self.lu_comboBox2, 0, wx.ALL, 5)
loc_update.Add(lu_bSizer13, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM | wx.FIXED_MINSIZE | wx.TOP, 10)
lu_bSizer14 = wx.BoxSizer(wx.HORIZONTAL)
lu_staticText14 = wx.StaticText(loc_update.GetStaticBox(), wx.ID_ANY, u"状态:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
lu_staticText14.Wrap(-1)
lu_staticText14.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
lu_bSizer14.Add(lu_staticText14, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 20)
lu_choice8Choices = [u"有效", u"无效"]
self.lu_choice8 = wx.Choice(loc_update.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size(200, -1),
lu_choice8Choices, 0)
self.lu_choice8.SetSelection(0)
self.lu_choice8.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
lu_bSizer14.Add(self.lu_choice8, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 5)
loc_update.Add(lu_bSizer14, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
lu_bSizer12 = wx.BoxSizer(wx.HORIZONTAL)
self.lu_button5 = wx.Button(loc_update.GetStaticBox(), wx.ID_ANY, u"新增", wx.DefaultPosition, wx.DefaultSize, 0)
self.lu_button5.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.lu_button5.Bind(wx.EVT_BUTTON, self.lu_button5OnClick)
lu_bSizer12.Add(self.lu_button5, 0, wx.ALL, 5)
self.lu_button6 = wx.Button(loc_update.GetStaticBox(), wx.ID_ANY, u"更改", wx.DefaultPosition, wx.DefaultSize, 0)
self.lu_button6.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
self.lu_button6.Bind(wx.EVT_BUTTON, self.lu_button6OnClick)
lu_bSizer12.Add(self.lu_button6, 0, wx.ALL, 5)
loc_update.Add(lu_bSizer12, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 10)
self.lu_staticText12 = wx.StaticText(loc_update.GetStaticBox(), wx.ID_ANY, u"", wx.DefaultPosition,
wx.DefaultSize, 0)
self.lu_staticText12.Wrap(-1)
self.lu_staticText12.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
loc_update.Add(self.lu_staticText12, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
self.admin_bSizer7.Add(loc_update, 1, wx.EXPAND | wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
def lu_comboBox2OnChoice(self, event):
"""
选择名称后更新信息
:param event:
:return:
"""
self.ind = self.lu_comboBox2.GetSelection()
if self.loc_all[self.ind, 2] == '有效':
self.lu_choice8.SetSelection(0)
else:
self.lu_choice8.SetSelection(1)
event.Skip()
def lu_button5OnClick(self, event):
"""
新增键的功能
:param event:
:return:
"""
if self.ind == -1: # ind==-1表明没有选择过,而是直接填写,可以新增
loc = Location(loc_name=self.lu_comboBox2.GetValue())
try:
loc.loc_register()
self.loc_all = Location.loc_all()
self.lu_staticText12.SetLabelText('新增成功!')
self.lu_staticText12.SetForegroundColour('green')
except Exception:
self.lu_staticText12.SetLabelText('填写有效地址或设备名,不能为空!')
self.lu_staticText12.SetForegroundColour('red')
else:
self.lu_comboBox2.SetValue('')
self.ind = -1
self.lu_staticText12.SetLabelText('新增地址或设备名直接填写不能选择!')
self.lu_staticText12.SetForegroundColour('red')
event.Skip()
def lu_button6OnClick(self, event):
"""
更新
:param event:
:return:
"""
if self.lu_comboBox2.GetValue():
loc = Location(loc_id=self.ind+1, loc_name=self.lu_comboBox2.GetValue(),
loc_status=self.lu_choice8.GetStringSelection())
try:
loc.loc_update()
self.loc_all = Location.loc_all()
self.lu_comboBox2.SetSelection(-1)
self.ind = -1
self.lu_staticText12.SetLabelText('修改成功!')
self.lu_staticText12.SetForegroundColour('green')
except Exception:
self.lu_staticText12.SetLabelText('地点或设备名重复!')
self.lu_staticText12.SetForegroundColour('red')
else:
self.lu_comboBox2.SetValue('')
self.ind = -1
self.lu_staticText12.SetLabelText('地点或者设备名不能为空!')
self.lu_staticText12.SetForegroundColour('red')
event.Skip()
class QualityUpdate(AdminFrame):
"""
质量信息更新
"""
def __init__(self, parent):
super().__init__(parent)
mat_in_stock = Material.mat_in_stock()
mat_ids_np = np.unique(mat_in_stock[:, 0])
results = []
for i in mat_ids_np:
mat = Material(mat_id=i)
mat.mat_search()
results.append([mat.cls_name, mat.batch_num, mat.mat_quality_status, mat.mat_quality_status, i])
self.results_np = np.array(results)
qc = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"质量信息"), wx.VERTICAL)
qc_bSizer10 = wx.BoxSizer(wx.HORIZONTAL)
qc_staticText13 = wx.StaticText(qc.GetStaticBox(), wx.ID_ANY, u"胶料名称:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
qc_staticText13.Wrap(-1)
qc_staticText13.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
qc_bSizer10.Add(qc_staticText13, 0, wx.ALIGN_CENTER_VERTICAL | wx.FIXED_MINSIZE | wx.ALL, 10)
qc_choice3Choices = np.unique(self.results_np[:, 0])
self.qc_choice3 = wx.Choice(qc.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size(200, -1),
qc_choice3Choices, 0)
self.qc_choice3.SetSelection(0)
self.qc_choice3.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
qc_bSizer10.Add(self.qc_choice3, 0, wx.ALL, 5)
qc.Add(qc_bSizer10, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
qc_bSizer11 = wx.BoxSizer(wx.HORIZONTAL)
qc_staticText10 = wx.StaticText(qc.GetStaticBox(), wx.ID_ANY, u"批号:", wx.DefaultPosition, wx.Size(80, -1),
wx.ALIGN_RIGHT)
qc_staticText10.Wrap(-1)
qc_staticText10.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
qc_bSizer11.Add(qc_staticText10, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 10)
qc_choice4Choices = \
self.results_np[np.where(self.results_np[:, 0] == self.qc_choice3.GetStringSelection())][:, 1]
self.qc_choice4 = wx.Choice(qc.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size(200, -1),
qc_choice4Choices, 0)
self.qc_choice4.SetSelection(0)
self.qc_choice4.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
qc_bSizer11.Add(self.qc_choice4, 0, wx.ALL, 5)
qc.Add(qc_bSizer11, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
qc_bSizer14 = wx.BoxSizer(wx.HORIZONTAL)
qc_staticText14 = wx.StaticText(qc.GetStaticBox(), wx.ID_ANY, u"质量状态:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
qc_staticText14.Wrap(-1)
qc_staticText14.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
qc_bSizer14.Add(qc_staticText14, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 20)
qc_choice8Choices = [u"正常", u"异常"]
self.qc_choice8 = wx.Choice(qc.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size(200, -1),
qc_choice8Choices, 0)
self.qc_choice8.SetSelection(0)
self.qc_choice8.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
qc_bSizer14.Add(self.qc_choice8, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 5)
qc.Add(qc_bSizer14, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
qc_bSizer1111 = wx.BoxSizer(wx.HORIZONTAL)
qc_staticText1011 = wx.StaticText(qc.GetStaticBox(), wx.ID_ANY, u"质量描述:", wx.DefaultPosition,
wx.Size(80, -1), wx.ALIGN_RIGHT)
qc_staticText1011.Wrap(-1)
qc_staticText1011.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
qc_bSizer1111.Add(qc_staticText1011, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.FIXED_MINSIZE, 10)
self.qc_textCtrl211 = wx.TextCtrl(qc.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
wx.Size(300, -1), 0)
self.qc_textCtrl211.SetFont(
wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
qc_bSizer1111.Add(self.qc_textCtrl211, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
qc.Add(qc_bSizer1111, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP | wx.BOTTOM, 10)
qc_bSizer12 = wx.BoxSizer(wx.HORIZONTAL)
self.qc_button5 = wx.Button(qc.GetStaticBox(), wx.ID_ANY, u"更改", wx.DefaultPosition, wx.DefaultSize, 0)
self.qc_button5.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
qc_bSizer12.Add(self.qc_button5, 0, wx.ALL, 5)
qc.Add(qc_bSizer12, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 10)
self.qc_staticText12 = wx.StaticText(qc.GetStaticBox(), wx.ID_ANY, u"MyLabel", wx.DefaultPosition,
wx.DefaultSize, 0)
self.qc_staticText12.Wrap(-1)
self.qc_staticText12.SetFont(
wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, wx.EmptyString))
qc.Add(self.qc_staticText12, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5)
self.admin_bSizer7.Add(qc, 1, wx.EXPAND | wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
if __name__ == '__main__':
app = wx.App(False)
frm = AdminFrame(None)
frm.Show()
app.MainLoop()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化