20210605:前期使用pyqt5做的操作流程界面化,涉及mysql代码写的太差,可以用函数复用减少代码

20210605:前期使用pyqt5做的操作流程界面化,涉及mysql代码写的太差,可以用函数复用减少代码
20210605:前期使用pyqt5做的操作流程界面化,涉及mysql代码写的太差,可以用函数复用减少代码
20210605:前期使用pyqt5做的操作流程界面化,涉及mysql代码写的太差,可以用函数复用减少代码
20210605:前期使用pyqt5做的操作流程界面化,涉及mysql代码写的太差,可以用函数复用减少代码
20210605:前期使用pyqt5做的操作流程界面化,涉及mysql代码写的太差,可以用函数复用减少代码

20210605:前期使用pyqt5做的操作流程界面化,涉及mysql代码写的太差,可以用函数复用减少代码

-- coding: utf-8 --

import sys
import os
if hasattr(sys, ‘frozen’):
os.environ[‘PATH’] = sys._MEIPASS + “;” + os.environ[‘PATH’]

import random

from PyQt5.QtWidgets import QWidget,QApplication,QMessageBox,QFileDialog,QGridLayout,QPushButton,QLabel,QLineEdit,QTabWidget,QComboBox,QStyleFactory,QVBoxLayout,QHBoxLayout,QSpinBox,QTableWidgetItem,QTreeWidget,QTreeWidgetItem,QTableWidget,QDialog,QTextEdit,QHeaderView,QAbstractItemView,QFrame
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import socket
import tqdm
import time

class CommonHelper:
@staticmethod
def readQSS(style):
with open(style,‘r’) as f:
return f.read()

class AbnormityWindow(QWidget):

sjm='1'
ran_char = []
ran_chars = []
for i in range(48, 58):
    ran_char.append(chr(i))
for i in range(65, 91):
    ran_char.append(chr(i))
for i in range(97, 123):
    ran_char.append(chr(i))

def __init__(self):
    super().__init__()
    self.ip_num = '127.0.0.1'
    self.port_num = 7528
    self.setWindowTitle("异形窗口")
    self.pix = QBitmap('./images/mask.png')

    self.resize(self.pix.size())
    self.setMask(self.pix)
    main_gbos=QGridLayout()

    hbox =QGridLayout()

    label_wzbj = 'border-width:1px;font-size:13px;border-color:rgb(0,0,0,0.7);' \
                 'background-color:rgb(255,255,255,0.8);'

    Forget_password = QPushButton(self)
    Forget_password.setText('忘记密码')
    Forget_password.resize(65,24)
    Forget_password.move(308, 182)
    Forget_password.clicked.connect(self.Forget_Password)

    name_label =QLabel('员工编码')
    name_label.setFixedSize(60,22)
    name_label.setStyleSheet(label_wzbj)
    hbox.addWidget(name_label, 0, 0)
    self.name_edit = QLineEdit()
    self.name_edit.setPlaceholderText('员工编码')
    self.name_edit.setFixedSize(120,22)
    hbox.addWidget(self.name_edit, 0, 1)

    pass_label = QLabel('用户密码')
    pass_label.setStyleSheet(label_wzbj)
    pass_label.setFixedSize(60, 22)
    hbox.addWidget(pass_label, 1, 0)
    self.pass_edit = QLineEdit()
    self.pass_edit.setPlaceholderText('密码输入')
    self.pass_edit.setEchoMode(QLineEdit.PasswordEchoOnEdit)
    self.pass_edit.setFixedSize(120, 22)
    hbox.addWidget(self.pass_edit, 1, 1)

    sign_btn = QPushButton('登录')
    sign_btn.clicked.connect(self.sign_btn_click)
    sign_btn.setFixedSize(60, 22)
    hbox.addWidget(sign_btn, 2, 0)


    self.sjm_edit = QLineEdit()
    self.sjm_edit.setPlaceholderText('随机码输入')
    self.sjm_edit.setFixedSize(120, 22)
    hbox.addWidget(self.sjm_edit, 2, 1)

    bt_label =QLabel('耗材管理平台')
    bt_label.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
    bt_label.setStyleSheet("font-size:30px;font-weight:bold;font-family:宋体;")

    bt_label.setObjectName('bt_label')

    main_gbos.addWidget(bt_label, 0, 1)


    styLabel=QLabel('设置窗口风格')
    self.styComboBox=QComboBox()
    self.styComboBox.addItems(QStyleFactory.keys())
    self.styIndex=self.styComboBox.findText(QApplication.style().objectName(),Qt.MatchFixedString)
    self.styComboBox.setCurrentIndex(self.styIndex)

    self.styComboBox.activated[str].connect(self.HandleStyleChanged)
    #hbox.addWidget(styLabel, 3, 0)
    #hbox.addWidget(self.styComboBox, 3, 1)

    main_gbos.addLayout(hbox, 2, 1)

    qss_btn =QPushButton('装载样式')
    qss_btn.clicked.connect(self.onClick)
    qss_btn.resize(20,20)

    sxsjm_btn = QPushButton('刷新随机码')
    sxsjm_btn.clicked.connect(self.sxStyleChanged)
    main_gbos.addWidget(sxsjm_btn, 3, 0)

    close_btn = QPushButton('关闭界面')
    close_btn.clicked.connect(self.chuangkou_close)
    main_gbos.addWidget(close_btn, 3, 2)

    self.setLayout(main_gbos)

def sign_btn_click(self):


    #######特殊留
    # self.fym = SecondUi(self.name_edit.text(), '1111','11111111','1111',['申请发起','审批确认','订单生成'])
    # self.fym.show()
    # self.hide()
    #######特殊留
    if 1 ==1:
        try:
            dlgc_fk = self.socket_dlgc('1', self.name_edit.text(), self.pass_edit.text(),
                                   time.strftime("%Y%m%d%H%M%S", time.localtime()))
        except:
            QMessageBox.information(None, '服务器异常', '服务器错误,暂时无响应!', QMessageBox.Yes)

        if dlgc_fk['ZIDUAN3'] not in (None, '用户名密码正确'):
            # print(dlgc_fk['ZIDUAN3'])
            QMessageBox.information(None, dlgc_fk['ZIDUAN3'], dlgc_fk['ZIDUAN3'], QMessageBox.Yes)
        elif self.sjm_edit.text() not in (None, self.sjm):
            # print('随机码错误')
            QMessageBox.information(None, '随机码错误', '随机码错误', QMessageBox.Yes)

        else:
            QMessageBox.information(None, '登录成功', '登录成功', QMessageBox.Yes)
            # print(dlgc_fk['ZIDUAN4'], dlgc_fk['ZIDUAN5'], dlgc_fk['ZIDUAN6'])
            yh_name = dlgc_fk['ZIDUAN4']
            yh_sjhm = dlgc_fk['ZIDUAN5']
            yh_danw = dlgc_fk['ZIDUAN6']
            yh_yhjs = dlgc_fk['ZIDUAN7'].split("|")
            print(yh_yhjs)

            self.fym = SecondUi(self.name_edit.text(),  yh_name, yh_sjhm, yh_danw,yh_yhjs)
            self.fym.show()
            self.hide()

def socket_dlgc(self,leixing,name_text,pass_text,in_time):
    import socket
    import json
    tcp_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    tcp_client.connect((self.ip_num, self.port_num))

    msg_ziduan1 = str(name_text)
    msg_ziduan2 = str(pass_text)
    msg_ziduan3 = str(in_time)

    msg_leixing = str(leixing)
    if None == name_text:
        print('与服务器断开连接')
    msg = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
        msg_leixing, msg_ziduan1, msg_ziduan2, msg_ziduan3)
    #print(msg)

    tcp_client.send(msg.encode("utf-8"))  # 说话    #
    data = tcp_client.recv(102400)  # 听话
    print('服务器反馈:', data.decode('utf-8'))
    js_data = json.loads(data.decode('utf-8'))
    tcp_client.close()
    return js_data

def Forget_Password(self):
    self.fp = ForgetPassword(self.name_edit.text(), self.pass_edit.text())
    self.fp.show()
    #self.hide()

def rndChar(self):
    return self.ran_char[random.randint(0, len(self.ran_char))]

def HandleStyleChanged(self,style):
    QApplication.setStyle(style)

def sxStyleChanged(self):
    self.ran_chars = []
    self.styIndex = self.styComboBox.findText(QApplication.style().objectName(), Qt.MatchFixedString)
    style = self.styComboBox.itemText(self.styIndex)
    QApplication.setStyle(style)




def onClick(self):
    styleFile='./style.qss'
    qssStyle=CommonHelper.readQSS(styleFile)
    form.setStyleSheet(qssStyle)


def mousePressEvent(self, event):
    if event.button() == Qt.LeftButton:
        self.m_drag = True
        self.m_DragPosition = event.globalPos() - self.pos()
        self.setCursor(QCursor(Qt.OpenHandCursor))

def mouseMoveEvent(self, QMouseEvent):
    if Qt.LeftButton and self.m_drag:
        # 当左键移动窗体修改偏移值,实时计算窗口左上角坐标
        self.move(QMouseEvent.globalPos() - self.m_DragPosition)

def mouseReleaseEvent(self, QMouseEvent):
    self.m_drag = False
    self.setCursor(QCursor(Qt.ArrowCursor))
def paintEvent(self, event):

    painter = QPainter(self)
    painter.drawPixmap(0,0,self.pix.width(),self.pix.height(),QPixmap('./images/screen1.jpg'))
    # 随机码显示
    painter_sjm = QPainter(self)
    brush = QBrush()
    brush.setColor(Qt.yellow)
    brush.setStyle(Qt.SolidPattern)
    painter_sjm.setBrush(brush)
    painter_sjm.drawRect(310, 213, 60, 19)

    painter_sjm.setPen(Qt.red)
    for i in range(30):
        painter_sjm.drawLine(
            random.randint(310, 370), random.randint(213, 232),
            random.randint(310, 370), random.randint(213, 232)
        )

    font = QFont()
    font.setPointSize(15)
    font.setBold(True)
    painter_sjm.setFont(font)
    painter_sjm.setPen(Qt.black)


    for i in range(4):
        if len(self.ran_chars)<4:
            self.ran_chars.append(str(self.rndChar()))
        painter_sjm.drawText(15 * i + 311, 230, self.ran_chars[i])
    self.sjm = (self.ran_chars[0] + self.ran_chars[1] + self.ran_chars[2] + self.ran_chars[3])

def chuangkou_close(self):
    self.close()

#忘记密码界面
class ForgetPassword(QWidget):
sjm = ‘1’
ran_char = []
ran_chars = []
for i in range(48, 58):
ran_char.append(chr(i))
for i in range(65, 91):
ran_char.append(chr(i))
for i in range(97, 123):
ran_char.append(chr(i))

def __init__(self,name_cd,pass_cd,parent = None):
    super().__init__(parent)
    self.ip_num = '127.0.0.1'
    self.port_num = 7528
    self.setWindowTitle("异形窗口")
    self.pix = QBitmap('./images/mask.png')
    self.ran_chars = []



    self.resize(self.pix.size())
    self.setMask(self.pix)

    label_wzbj = 'border-width:1px;font-size:13px;border-color:rgb(0,0,0,0.5);' \
                 'background-color:rgb(255,255,255,0.6);'

    self.label_zh = QLabel(self)
    self.label_zh.setText("用户账户")
    self.label_zh.move(100, 140)
    self.label_zh.setFixedSize(60, 22)
    self.label_zh.setStyleSheet(label_wzbj)

    self.sr_zh = QLineEdit(self)
    self.sr_zh.setPlaceholderText("请输入账号")
    self.sr_zh.move(170, 140)
    self.sr_zh.setFixedSize(120, 22)
    self.sr_zh.setStyleSheet(label_wzbj)

    self.label_xm = QLabel(self)
    self.label_xm.setText("手机号码")
    self.label_xm.move(100, 170)
    self.label_xm.setFixedSize(60, 22)
    self.label_xm.setStyleSheet(label_wzbj)

    self.sr_hm = QLineEdit(self)
    self.sr_hm.setPlaceholderText("请输入号码")
    self.sr_hm.move(170, 170)
    self.sr_hm.setFixedSize(120, 22)
    self.sr_hm.setStyleSheet(label_wzbj)

    self.xsjm_btn = QPushButton(self)
    self.xsjm_btn.setText('找回密码')
    self.xsjm_btn.move(100, 200)
    self.xsjm_btn.setFixedSize(60, 22)
    self.xsjm_btn.setStyleSheet(label_wzbj)
    self.xsjm_btn.clicked.connect(self.zhaohui_pass)


    self.sr_sjm = QLineEdit(self)
    self.sr_sjm.setPlaceholderText("随机码")
    self.sr_sjm.move(230, 200)
    self.sr_sjm.setFixedSize(60, 22)
    self.sr_sjm.setStyleSheet(label_wzbj)

    self.gb_an = QPushButton(self)
    self.gb_an.setText('X')
    self.gb_an.move(380, 5)
    self.gb_an.setFixedSize(15, 15)
    self.gb_an.setStyleSheet(label_wzbj)
    self.gb_an.clicked.connect(self.close)


def zhaohui_pass(self):
    try:
        dlgc_fk = self.socket_zhmm('3', self.sr_zh.text(), self.sr_hm.text(),
                               time.strftime("%Y%m%d%H%M%S", time.localtime()))
    except:
        QMessageBox.information(None, '服务器异常', '服务器错误,暂时无响应!', QMessageBox.Yes)

    print(dlgc_fk)

    if dlgc_fk['ZIDUAN3'] not in (None, '密码找回'):
        # print(dlgc_fk['ZIDUAN3'])
        QMessageBox.information(None, dlgc_fk['ZIDUAN3'], dlgc_fk['ZIDUAN3'], QMessageBox.Yes)
    elif self.sr_sjm.text() not in (None, self.sjm):
        # print('随机码错误')
        QMessageBox.information(None, '随机码错误', '随机码错误', QMessageBox.Yes)

    else:
        QMessageBox.information(None, '密码找回成功', '您的密码是:'+dlgc_fk['ZIDUAN2'], QMessageBox.Yes)

def socket_zhmm(self, leixing, name_text, hm_text, in_time):
    import socket
    import json
    tcp_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    tcp_client.connect((self.ip_num, self.port_num))

    msg_leixing = str(leixing)
    msg_ziduan1 = str(name_text)
    msg_ziduan2 = str(hm_text)
    msg_ziduan3 = str(in_time)


    if None == name_text:
        print('与服务器断开连接')
    msg = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
        msg_leixing, msg_ziduan1, msg_ziduan2, msg_ziduan3)
    # print(msg)

    tcp_client.send(msg.encode("utf-8"))  # 说话    #
    data = tcp_client.recv(102400)  # 听话
    print('服务器反馈:', data.decode('utf-8'))
    js_data = json.loads(data.decode('utf-8'))
    tcp_client.close()
    return js_data

def mousePressEvent(self, event):
    if event.button() == Qt.LeftButton:
        self.m_drag = True
        self.m_DragPosition = event.globalPos() - self.pos()
        self.setCursor(QCursor(Qt.OpenHandCursor))

def mouseMoveEvent(self, QMouseEvent):
    if Qt.LeftButton and self.m_drag:
        # 当左键移动窗体修改偏移值,实时计算窗口左上角坐标
        self.move(QMouseEvent.globalPos() - self.m_DragPosition)
def rndChar(self):
    return self.ran_char[random.randint(0, len(self.ran_char))]

def mouseReleaseEvent(self, QMouseEvent):
    self.m_drag = False
    self.setCursor(QCursor(Qt.ArrowCursor))
def paintEvent(self, event):

    painter = QPainter(self)
    painter.drawPixmap(0,0,self.pix.width(),self.pix.height(),QPixmap('./images/screen3.jpeg'))
    # 随机码显示
    painter_sjm = QPainter(self)
    brush = QBrush()
    brush.setColor(Qt.yellow)
    brush.setStyle(Qt.SolidPattern)
    painter_sjm.setBrush(brush)
    painter_sjm.drawRect(170, 200, 55, 22)

    font = QFont()
    font.setPointSize(15)
    font.setBold(True)
    painter_sjm.setFont(font)
    painter_sjm.setPen(Qt.black)

    for i in range(4):
        if len(self.ran_chars) < 4:
            self.ran_chars.append(str(self.rndChar()))
        painter_sjm.drawText(13 * i + 171, 218, self.ran_chars[i])
    self.sjm = (self.ran_chars[0] + self.ran_chars[1] + self.ran_chars[2] + self.ran_chars[3])

#副页面
class SecondUi(QTabWidget):
def init(self,name_cd,yh_name,yh_sjhm,yh_danw,yh_yhjs,parent = None):
super(SecondUi,self).init(parent)
self.ip_num = ‘127.0.0.1’
self.port_num = 7528

    self.in_time = self.get_current_time()
    self.setWindowTitle('欢迎登录耗材管理平台 ' + yh_name)
    self.setStyleSheet("background-color:rgb(135,206,235,0.3)")
    self.dl_name=name_cd
    self.dlyh_name=yh_name
    self.dlyh_sjhm=yh_sjhm
    self.dlyh_danw=yh_danw
    self.dlyh_yhjs = yh_yhjs
    self.desktop = QApplication.desktop()
    self.screenRect = self.desktop.screenGeometry()
    self.height = self.screenRect.height()
    self.width = self.screenRect.width()
    self.resize(self.width-40,self.height-80)

    gg_vbox=QVBoxLayout()
    gg_label =QLabel('广告图')
    gg_label.setPixmap(QPixmap('./images/科技风.bmp').scaled(self.width-30,50))
    gg_vbox.addWidget(gg_label)



    #副页面总布局
    second_hbox=QHBoxLayout()
    gg_vbox.addLayout(second_hbox)

    #树状结构
    self.tree = QTreeWidget()
    self.tree.setHeaderLabel('名称')
    self.tree.setFixedSize(180,self.height-190)

    main_root = QTreeWidgetItem(self.tree)
    main_root.setText(0, '登录首页')


    hc_root=QTreeWidgetItem(self.tree)
    hc_root.setText(0, '耗材工单管理')

    #根据工号角色控制可以看到的内容控制
    dict = ['耗材申请界面']
    for i in self.dlyh_yhjs:
        if i in ('审批确认'):
            dict.extend(['耗材审批界面','耗材业支确认'])
        if i in ('订单生成'):
            dict.append('耗材订单生成')
    dict.extend(['耗材区县领取','耗材工单查询','耗材工单汇总'])

    for i in dict:
        hcf_root = QTreeWidgetItem(hc_root)
        hcf_root.setText(0,i)

    tc_root = QTreeWidgetItem(self.tree)
    tc_root.setText(0, '退出账号')
    close_root = QTreeWidgetItem(self.tree)
    close_root.setText(0, '关闭界面')

    self.tree.addTopLevelItem(hc_root)
    #点击树状结构触发界面变动
    self.tree.clicked.connect(self.gettreetext)
    #界面主布局加载树状结构
    second_hbox.addWidget(self.tree)


    #right右边布局占位
    self.right_gbox = QVBoxLayout()
    zw_label = QLabel('占位')
    zw_label.setPixmap(QPixmap('./images/科技风.bmp').scaled(self.width-220, 10))
    self.right_gbox.addWidget(zw_label)

    self.tab_win =QTabWidget()
    self.tab_win.setFixedSize(self.width-210,self.height-200)
    self.tabjm =QWidget()
    self.tab_win.addTab(self.tabjm,'')

    self.right_gbox.addWidget(self.tab_win)

    second_hbox.addLayout(self.right_gbox)

    dc_label = QLabel('底层')
    dc_label.setPixmap(QPixmap('./images/科技风.bmp').scaled(self.width-40, 20))
    gg_vbox.addWidget(dc_label)
    self.setLayout(gg_vbox)

def gettreetext(self,index):
    item =self.tree.currentItem()
    print(item.text(0))

    if item.text(0)=='登录首页':
        print(self.dlyh_yhjs)
        hcgd_Table_fk = self.socket_zhmm('耗材管理', '数据汇总', 0,'全市')
        self.hcgd_Table_gds = int(hcgd_Table_fk['ZIDUAN2'])
        print(self.hcgd_Table_gds)



        but_sty = 'border-width:1px;border-style:solid;font-size:13px;' \
                  'border-color:rgb(255,255,255,0.5);background-color:rgb(255,255,255,0.3);'

        self.tab_win.removeTab(self.tab_win.currentIndex())
        self.tabjm_0 = QWidget()
        self.tab_win.addTab(self.tabjm_0, item.text(0))
        process_ah_lay = QHBoxLayout()
        process_av_lay = QVBoxLayout()
        process_a_lay = QGridLayout()
        process_av_lay.addLayout(process_a_lay)
        process_ah_lay.addLayout(process_av_lay)

        #zwa_label = QLabel('占位')
        #zwa_label.setPixmap(QPixmap('./images/screen2.jpg').scaled(100, 600))
        #process_ah_lay.addWidget(zwa_label)

        denglu_dwm = QLabel(self.dlyh_danw)
        denglu_dwm.setFixedSize(260, 30)
        denglu_dwm.setStyleSheet(but_sty)
        process_a_lay.addWidget(denglu_dwm, 1, 0)

        denglu_ida = QLabel(self.dlyh_name)
        denglu_ida.setFixedSize(260, 30)
        denglu_ida.setStyleSheet(but_sty)
        process_a_lay.addWidget(denglu_ida, 2, 0)

        denglu_jsa = QLabel(str(self.dlyh_yhjs))
        denglu_jsa.setFixedSize(260, 30)
        denglu_jsa.setStyleSheet(but_sty)
        process_a_lay.addWidget(denglu_jsa, 3, 0)

        self.hcgd_Table = QTableWidget()
        # 表格显示行,列
        self.hcgd_Table.setRowCount(self.hcgd_Table_gds)
        self.hcgd_Table.setColumnCount(10)
        hcgd_list_item = ['耗材大类', '耗材中类', '耗材小类', '耗材具体类', '申请工单数', '申请数量', '审批数量', '订单数量', '确认数量', '领取数量']
        self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)
        self.hcgd_Table.setFixedSize(self.width - 500, 120)
        print(self.width - 350)
        self.hcgd_Table.resizeColumnsToContents()
        self.hcgd_Table.setAlternatingRowColors(True)

        self.hcgd_Table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        # 表格不能被编辑
        self.hcgd_Table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        # 选中整行
        self.hcgd_Table.setSelectionBehavior(QAbstractItemView.SelectRows)
        # 加载一下数据,获取行数
        self.hcgdhz_Table_add(0, '有效')

        process_a_lay.addWidget(self.hcgd_Table, 1, 1,3,1)

        zxt1_label = QLabel('占位')
        zxt1_label.setFixedSize(560,400)
        zxt1_label.setPixmap(QPixmap('./images/趋势图1.png').scaled(560, 400))
        process_a_lay.addWidget(zxt1_label, 4, 0, 1, 2)



        zxt2_label = QLabel('占位')
        zxt2_label.setFixedSize(560,400)
        zxt2_label.setPixmap(QPixmap('./images/趋势图2.png').scaled(560, 400))
        process_a_lay.addWidget(zxt2_label, 4, 2, 1, 2)


        self.tabjm_0.setLayout(process_ah_lay)
        self.tabjm_0.show()
        print('登录首页')

    elif item.text(0)=='耗材申请界面':

        but_sty = 'border-width:2px;border-style:solid;font-size:15px;' \
                  'border-color:rgb(255,255,255,0.5);background-color:rgb(255,255,255,0.3);'

        self.tab_win.removeTab(self.tab_win.currentIndex())
        self.tabjm_1 = QWidget()
        self.tab_win.addTab(self.tabjm_1,item.text(0))
        process_ah_lay=QHBoxLayout()
        process_av_lay=QVBoxLayout()
        process_a_lay = QGridLayout()
        process_av_lay.addLayout(process_a_lay)
        process_ah_lay.addLayout(process_av_lay)

        #右侧占位
        zwa_label = QLabel('占位')
        zwa_label.setPixmap(QPixmap('./images/screen2.jpg').scaled(self.width - 1270, self.height - 280))
        process_ah_lay.addWidget(zwa_label)

        #gd_biaoti = QLabel('淄博移动公司耗材申请单')
        #process_a_lay.addWidget(gd_biaoti, 0, 0,0,5,Qt.AlignCenter)
        shenqing_dw = QLabel('申请单位')
        shenqing_dw.setFixedSize(120, 30)
        shenqing_dw.setStyleSheet(but_sty)
        process_a_lay.addWidget(shenqing_dw,1,0)
        shenqing_dwm= QLabel(self.dlyh_danw)
        shenqing_dwm.setFixedSize(160, 30)
        shenqing_dwm.setStyleSheet(but_sty)
        process_a_lay.addWidget(shenqing_dwm, 1, 1)

        shenqing_xm = QLabel('申请人姓名')
        shenqing_xm.setFixedSize(235, 30)
        shenqing_xm.setStyleSheet(but_sty)
        process_a_lay.addWidget(shenqing_xm, 1, 2)
        shenqing_xmn = QLabel(self.dlyh_name)
        shenqing_xmn.setFixedSize(160, 30)
        shenqing_xmn.setStyleSheet(but_sty)
        process_a_lay.addWidget(shenqing_xmn, 1, 3)

        shenqing_time = QLabel('申请时间')
        shenqing_time.setFixedSize(160, 30)
        shenqing_time.setStyleSheet(but_sty)
        process_a_lay.addWidget(shenqing_time, 1, 4)
        self.shenqing_day = QLabel(self.in_time)
        self.shenqing_day.setFixedSize(160, 30)
        self.shenqing_day.setStyleSheet(but_sty)
        process_a_lay.addWidget(self.shenqing_day, 1, 5)

        xuanze_dl = QLabel('选择申请型号')
        xuanze_dl.setStyleSheet(but_sty)
        process_a_lay.addWidget(xuanze_dl, 2, 0)
        dl_fh = self.socket_zhmm('耗材管理','大类','0',time.strftime("%Y%m%d%H%M%S", time.localtime()))
        dl_fh_zfc = dl_fh['ZIDUAN2'].replace('[','').replace(']','').replace("'","").replace(" ","").split(",")

        self.combo_dl =QComboBox()

        self.combo_dl.addItems(dl_fh_zfc)
        self.combo_dl.setFixedSize(160, 30)
        self.combo_dl.setStyleSheet(but_sty)
        process_a_lay.addWidget(self.combo_dl, 2, 1)
        self.combo_dl.activated.connect(self.zl_addItem)

        self.combo_zl = QComboBox()
        self.combo_zl.setFixedSize(235, 30)
        self.combo_zl.setStyleSheet(but_sty)
        process_a_lay.addWidget(self.combo_zl, 2, 2)
        self.combo_zl.currentIndexChanged.connect(self.xl_addItem)

        self.combo_xl = QComboBox()
        self.combo_xl.setFixedSize(160, 30)
        self.combo_xl.setStyleSheet(but_sty)
        process_a_lay.addWidget(self.combo_xl, 2, 3)
        self.combo_xl.currentIndexChanged.connect(self.jtl_addItem)

        self.combo_jtl = QComboBox()
        self.combo_jtl.setFixedSize(320, 30)
        self.combo_jtl.setStyleSheet(but_sty)
        process_a_lay.addWidget(self.combo_jtl, 2, 4,1,2)

        sqnum_Label = QLabel('输入申请数量')
        sqnum_Label.setStyleSheet(but_sty)
        process_a_lay.addWidget(sqnum_Label, 3, 0)

        self.sqnum_Edit = QSpinBox()
        self.sqnum_Edit.setFixedSize(160, 30)
        self.sqnum_Edit.setValue(1)
        self.sqnum_Edit.setRange(1,999)
        self.sqnum_Edit.setStyleSheet(but_sty)

        process_a_lay.addWidget(self.sqnum_Edit, 3, 1)

        sqren_Label = QLabel('申请人账号')
        sqren_Label.setStyleSheet(but_sty)
        sqren_Label.setFixedSize(235, 30)
        process_a_lay.addWidget(sqren_Label, 3, 2)

        sqrenxs_Label = QLabel(self.dl_name)
        sqrenxs_Label.setStyleSheet(but_sty)
        process_a_lay.addWidget(sqrenxs_Label, 3, 3)

        sqMobile_Label = QLabel('申请人号码')
        sqMobile_Label.setStyleSheet(but_sty)
        process_a_lay.addWidget(sqMobile_Label, 3, 4)

        sqMobilexs_Label = QLabel(self.dlyh_sjhm)
        sqMobilexs_Label.setStyleSheet(but_sty)
        process_a_lay.addWidget(sqMobilexs_Label, 3, 5)

        fujian_but = QPushButton('添加附件')
        fujian_but.setFixedSize(120, 30)
        fujian_but.clicked.connect(self.openimage)
        process_a_lay.addWidget(fujian_but, 4, 0)

        self.fujian_label = QLabel()

        self.fujian_label.setFixedSize(733, 30)
        self.fujian_label.setStyleSheet(but_sty)
        process_a_lay.addWidget(self.fujian_label, 4, 1, 1, 4)

        fujian_del = QPushButton('清除附件')
        fujian_del.setFixedSize(160, 30)
        fujian_del.clicked.connect(self.fujiandel)
        process_a_lay.addWidget(fujian_del, 4, 5)

        note_Label = QLabel('描述信息')
        note_Label.setFixedSize(120, 200)
        note_Label.setStyleSheet(but_sty)
        process_a_lay.addWidget(note_Label, 5, 0, 1, 1)

        self.note_Text_Edit=QTextEdit()
        self.note_Text_Edit.setFixedSize(888, 200)
        self.note_Text_Edit.setStyleSheet(but_sty)
        process_a_lay.addWidget(self.note_Text_Edit, 5,1,1,5)

        self.ok_but = QPushButton('工单提交')
        self.ok_but.setFixedSize(320, 60)
        self.ok_but.clicked.connect(self.haocai_oktj)
        process_a_lay.addWidget(self.ok_but, 6, 2,1,2)


        # 设定时间
        self.count = 10
        self.ok_but.clicked.connect(self.Action)
        from PyQt5 import QtCore
        self.time = QtCore.QTimer(self)
        # 每秒1000毫秒
        self.time.setInterval(1000)
        # 时间到触发 Refresh
        self.time.timeout.connect(self.Refresh)

        self.tabjm_1.setLayout(process_ah_lay)


    elif item.text(0)=='耗材审批界面':
        self.ym_num = 0
        self.tab_win.removeTab(self.tab_win.currentIndex())
        self.tabjm_2 = QWidget()
        self.tab_win.addTab(self.tabjm_2, item.text(0))

        process_b_lay = QGridLayout()
        self.hcgd_Table = QTableWidget()

        # 表格显示行,列
        self.hcgd_Table.setRowCount(20)
        self.hcgd_Table.setColumnCount(9)
        hcgd_list_item = ['工单编号', '申请单位', '大类', '中类', '小类', '具体名称', '申请数量','备注','附件']
        self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)
        self.hcgd_Table.setFixedSize(self.width - 240, self.height - 280)
        self.hcgd_Table.resizeColumnsToContents()
        self.hcgd_Table.setAlternatingRowColors(True)
        self.hcgd_Table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        # 表格不能被编辑
        self.hcgd_Table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        # 选中整行
        self.hcgd_Table.setSelectionBehavior(QAbstractItemView.SelectRows)
        # 鼠标双击触发信号槽,
        self.hcgd_Table.doubleClicked.connect(self.synb_table_double_clicked)

        # 加载一下数据,获取行数
        try:
            sp_list = self.hcgdsp_Table_add(self.ym_num,'有效')
            print(sp_list)
        except:
            sp_list = ['无','无','无','无','无','无','无','无','无','无','无',
                       '无','无','无','无','无','无','无','无','无','无','无']

        process_b_lay.addWidget(self.hcgd_Table)

        self.hcgd_Table_ym = QLabel('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
        self.hcgd_Table_ym.setFixedSize(200, 25)
        process_b_lay.addWidget(self.hcgd_Table_ym, 1, 0)

        shang_but = QPushButton('<')
        shang_but.clicked.connect(self.sp_shangye_click)
        process_b_lay.addWidget(shang_but, 1, 1)

        xia_but = QPushButton('>')
        xia_but.clicked.connect(self.sp_xiaye_click)
        process_b_lay.addWidget(xia_but, 1, 2)

        piliang_but = QPushButton('批量处理')
        piliang_but.setFixedSize(70, 25)
        piliang_but.clicked.connect(self.piliang_order)
        process_b_lay.addWidget(piliang_but, 1, 3)


        self.tabjm_2.setLayout(process_b_lay)


    elif item.text(0)=='耗材工单查询':
        self.ym_num=0
        self.tab_win.removeTab(self.tab_win.currentIndex())
        self.tabjm_3 = QWidget()
        self.tab_win.addTab(self.tabjm_3, item.text(0))

        process_c_lay = QGridLayout()
        self.hcgd_Table =QTableWidget()
        print('耗材工单查询1')
        #表格显示行,列
        self.hcgd_Table.setRowCount(20)
        self.hcgd_Table.setColumnCount(9)
        hcgd_list_item =['工单编号','申请时间','申请单位','申请人姓名','大类','中类','小类','具体名称','申请数量']
        self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)
        self.hcgd_Table.setFixedSize(self.width-240,self.height-280)
        self.hcgd_Table.resizeColumnsToContents()
        self.hcgd_Table.setAlternatingRowColors(True)
        self.hcgd_Table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        #self.hcgd_Table.verticalHeader().setVisible(False)
        #self.hcgd_Table.verticalHeader().setHidden(False)
        #表格不能被编辑
        self.hcgd_Table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        #选中整行
        self.hcgd_Table.setSelectionBehavior(QAbstractItemView.SelectRows)
        #鼠标双击触发信号槽,
        self.hcgd_Table.doubleClicked.connect(self.sync_table_double_clicked)
        print('耗材工单查询2')
        # 加载一下数据,获取行数

        for i in self.dlyh_yhjs:
            if i in ('审批确认','订单生成'):#角色判断,管理员可以看全市,否则看自己区县
                self.hcgd_Table_add(self.ym_num,'全市')
            else:
                self.hcgd_Table_add(self.ym_num, self.dlyh_danw)


        print('耗材工单查询3')
        process_c_lay.addWidget(self.hcgd_Table)

        self.hcgd_Table_ym = QLabel('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
        self.hcgd_Table_ym.setFixedSize(200, 25)
        process_c_lay.addWidget(self.hcgd_Table_ym,1,0)

        shang_but=QPushButton('<')
        shang_but.clicked.connect(self.shangye_click)
        process_c_lay.addWidget(shang_but, 1, 1)

        xia_but = QPushButton('>')
        xia_but.clicked.connect(self.xiaye_click)
        process_c_lay.addWidget(xia_but, 1, 2)

        self.tabjm_3.setLayout(process_c_lay)

    elif item.text(0) == '耗材订单生成':
        self.ym_num = 0
        self.tab_win.removeTab(self.tab_win.currentIndex())
        self.tabjm_4 = QWidget()
        self.tab_win.addTab(self.tabjm_4, item.text(0))

        process_d_lay = QGridLayout()
        self.hcgd_Table = QTableWidget()

        # 表格显示行,列
        self.hcgd_Table.setRowCount(20)
        self.hcgd_Table.setColumnCount(7)
        hcgd_list_item = ['大类', '中类', '小类', '具体名称','涉及工单数量', '申请数量','审批数量']
        self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)
        self.hcgd_Table.setFixedSize(self.width - 240, self.height - 280)
        self.hcgd_Table.resizeColumnsToContents()
        self.hcgd_Table.setAlternatingRowColors(True)
        self.hcgd_Table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        # 表格不能被编辑
        self.hcgd_Table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        # 选中整行
        self.hcgd_Table.setSelectionBehavior(QAbstractItemView.SelectRows)
        # 鼠标双击触发信号槽,
        self.hcgd_Table.doubleClicked.connect(self.synd_table_double_clicked)
        # 加载一下数据,获取行数
        self.hcgddd_Table_add(self.ym_num,'有效')

        process_d_lay.addWidget(self.hcgd_Table)
        self.hcgd_Table_ym = QLabel(
            '当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
        self.hcgd_Table_ym.setFixedSize(200, 25)
        process_d_lay.addWidget(self.hcgd_Table_ym, 1, 0)
        shang_but = QPushButton('<')
        shang_but.clicked.connect(self.dd_shangye_click)
        process_d_lay.addWidget(shang_but, 1, 1)

        xia_but = QPushButton('>')
        xia_but.clicked.connect(self.dd_xiaye_click)
        process_d_lay.addWidget(xia_but, 1, 2)

        self.tabjm_4.setLayout(process_d_lay)

    #耗材业支确认
    elif item.text(0) == '耗材业支确认':
        self.ym_num = 0
        self.tab_win.removeTab(self.tab_win.currentIndex())
        self.tabjm_5 = QWidget()
        self.tab_win.addTab(self.tabjm_5, item.text(0))

        process_e_lay = QGridLayout()
        self.hcgd_Table = QTableWidget()

        # 表格显示行,列
        self.hcgd_Table.setRowCount(20)
        self.hcgd_Table.setColumnCount(10)
        hcgd_list_item = ['工单编号', '大类', '中类', '小类', '具体名称', '申请数量', '审批数量', '商品编码','厂商名称','商品名称']
        self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)
        self.hcgd_Table.setFixedSize(self.width - 240, self.height - 280)
        self.hcgd_Table.resizeColumnsToContents()
        self.hcgd_Table.setAlternatingRowColors(True)
        self.hcgd_Table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        # self.hcgd_Table.verticalHeader().setVisible(False)
        # self.hcgd_Table.verticalHeader().setHidden(False)
        # 表格不能被编辑
        self.hcgd_Table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        # 选中整行
        self.hcgd_Table.setSelectionBehavior(QAbstractItemView.SelectRows)
        # 鼠标双击触发信号槽,
        self.hcgd_Table.doubleClicked.connect(self.syne_table_double_clicked)

        # 加载一下数据,获取行数
        self.hcgdqr_Table_add(self.ym_num, '有效')

        process_e_lay.addWidget(self.hcgd_Table)

        self.hcgd_Table_ym = QLabel(
            '当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
        self.hcgd_Table_ym.setFixedSize(200, 25)
        process_e_lay.addWidget(self.hcgd_Table_ym, 1, 0)

        shang_but = QPushButton('<')
        shang_but.clicked.connect(self.qr_shangye_click)
        process_e_lay.addWidget(shang_but, 1, 1)

        xia_but = QPushButton('>')
        xia_but.clicked.connect(self.qr_xiaye_click)
        process_e_lay.addWidget(xia_but, 1, 2)

        piliang_but = QPushButton('批量处理')
        piliang_but.setFixedSize(70, 25)
        piliang_but.clicked.connect(self.piliang_order)
        process_e_lay.addWidget(piliang_but, 1, 3)


        self.tabjm_5.setLayout(process_e_lay)

    # 耗材区县领取
    elif item.text(0) == '耗材区县领取':
        self.ym_num = 0
        self.tab_win.removeTab(self.tab_win.currentIndex())
        self.tabjm_6 = QWidget()
        self.tab_win.addTab(self.tabjm_6, item.text(0))

        process_f_lay = QGridLayout()
        self.hcgd_Table = QTableWidget()

        # 表格显示行,列
        self.hcgd_Table.setRowCount(20)
        self.hcgd_Table.setColumnCount(15)
        hcgd_list_item = ['工单编号', '申请时间', '申请单位','申请人','申请人姓名', '大类', '中类', '小类', '具体名称','商品编码','商品名称','商品厂商','商品价格', '订单批次', '申请数量', '审批数量','确认时间','确认意见']
        self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)
        self.hcgd_Table.setFixedSize(self.width - 240, self.height - 280)
        self.hcgd_Table.resizeColumnsToContents()
        self.hcgd_Table.setAlternatingRowColors(True)
        self.hcgd_Table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        # self.hcgd_Table.verticalHeader().setVisible(False)
        # self.hcgd_Table.verticalHeader().setHidden(False)
        # 表格不能被编辑
        self.hcgd_Table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        # 选中整行
        self.hcgd_Table.setSelectionBehavior(QAbstractItemView.SelectRows)
        # 鼠标双击触发信号槽,
        self.hcgd_Table.doubleClicked.connect(self.synf_table_double_clicked)

        # 加载一下数据,获取行数
        self.hcgdlq_Table_add(self.ym_num, '有效')

        process_f_lay.addWidget(self.hcgd_Table)

        self.hcgd_Table_ym = QLabel(
            '当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
        self.hcgd_Table_ym.setFixedSize(200, 25)
        process_f_lay.addWidget(self.hcgd_Table_ym, 1, 0)

        shang_but = QPushButton('<')
        shang_but.clicked.connect(self.lq_shangye_click)
        process_f_lay.addWidget(shang_but, 1, 1)

        xia_but = QPushButton('>')
        xia_but.clicked.connect(self.lq_xiaye_click)
        process_f_lay.addWidget(xia_but, 1, 2)

        self.tabjm_6.setLayout(process_f_lay)

    #耗材工单汇总查询
    elif item.text(0) == '耗材工单汇总':
        self.ym_num = 0
        self.tab_win.removeTab(self.tab_win.currentIndex())
        self.tabjm_7 = QWidget()
        self.tab_win.addTab(self.tabjm_7, item.text(0))

        process_g_lay = QGridLayout()
        self.hcgd_Table = QTableWidget()

        # 表格显示行,列
        self.hcgd_Table.setRowCount(100)
        self.hcgd_Table.setColumnCount(10)
        hcgd_list_item = ['耗材大类', '耗材中类', '耗材小类','耗材具体类','申请工单数','申请数量', '审批数量', '订单数量', '确认数量','领取数量']
        self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)
        self.hcgd_Table.setFixedSize(self.width - 240, self.height - 280)
        self.hcgd_Table.resizeColumnsToContents()
        self.hcgd_Table.setAlternatingRowColors(True)
        self.hcgd_Table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        # self.hcgd_Table.verticalHeader().setVisible(False)
        # self.hcgd_Table.verticalHeader().setHidden(False)
        # 表格不能被编辑
        self.hcgd_Table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        # 选中整行
        self.hcgd_Table.setSelectionBehavior(QAbstractItemView.SelectRows)
        # 加载一下数据,获取行数
        self.hcgdhz_Table_add(self.ym_num, '有效')

        process_g_lay.addWidget(self.hcgd_Table)


        self.tabjm_7.setLayout(process_g_lay)

    elif item.text(0) == '退出账号':
        self.fy_close()
    elif item.text(0) == '关闭界面':
        self.close()

def synf_table_double_clicked(self, index):
    print('f界面')
    table_column = index.column()
    self.table_row = index.row()
    self.lq_showDialog()

def lq_showDialog(self):
    dialog =QDialog()
    dialog.setStyleSheet("background-color:rgb(23,127,214,0.6)")
    dialog.setWindowTitle('耗材区县领取')
    print('耗材区县领取')
    dialog.setFixedSize(500,600)
    dialog_hlay = QVBoxLayout(self)
    dialog_lay = QGridLayout(self)
    dialog_hlay.addLayout(dialog_lay)

    dialog_wzbj = 'border-width:1px;font-size:13px;border-color:rgb(0,0,0,0.5);' \
                 'background-color:rgb(255,255,255,0.6);'
    try:
        gongdan_neirong=self.hcgd_Table_fkitem[self.table_row].replace('(', '').replace(')', '').split("!")
        print(gongdan_neirong)
    except:
        gongdan_neirong=['无','无','无','无','无','无','无','无','无','无',
                         '无','无','无','无','无','无','无','无']

    gongdan_id_label=QLabel('工单ID:')
    gongdan_id_label.setFixedSize(60, 27)
    gongdan_id_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_id_label,0,0)
    self.gongdan_idzs_label=QLabel(gongdan_neirong[0])
    self.gongdan_idzs_label.setFixedSize(140, 27)
    self.gongdan_idzs_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_idzs_label, 0, 1)

    gongdan_time_label=QLabel('工单时间:')
    gongdan_time_label.setFixedSize(60, 27)
    gongdan_time_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_time_label,0,2)
    gongdan_intime_label = QLabel(gongdan_neirong[1])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_intime_label, 0, 3)

    gongdan_dep_label = QLabel('申请单位:')
    gongdan_dep_label.setFixedSize(60, 27)
    gongdan_dep_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dep_label, 1, 0)
    gongdan_depa_label = QLabel(gongdan_neirong[2])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_depa_label, 1, 1)

    gongdan_name_label = QLabel('派单人:')
    gongdan_name_label.setFixedSize(60, 27)
    gongdan_name_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_name_label, 1, 2)
    gongdan_inname_label = QLabel(gongdan_neirong[4])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_inname_label, 1, 3)

    gongdan_dalei_label = QLabel('申请大类:')
    gongdan_dalei_label.setFixedSize(60, 27)
    gongdan_dalei_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dalei_label, 2, 0)
    self.gongdan_daleia_label = QLabel(gongdan_neirong[5])
    self.gongdan_daleia_label.setFixedSize(140, 27)
    self.gongdan_daleia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_daleia_label, 2, 1)

    gongdan_zhong_label = QLabel('申请中类:')
    gongdan_zhong_label.setFixedSize(60, 27)
    gongdan_zhong_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_zhong_label, 2, 2)
    self.gongdan_zhonga_label = QLabel(gongdan_neirong[6])
    self.gongdan_zhonga_label.setFixedSize(140, 27)
    self.gongdan_zhonga_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_zhonga_label, 2, 3)

    gongdan_xiaolei_label = QLabel('申请小类:')
    gongdan_xiaolei_label.setFixedSize(60, 27)
    gongdan_xiaolei_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_xiaolei_label, 3, 0)
    self.gongdan_xiaoleia_label = QLabel(gongdan_neirong[7])
    self.gongdan_xiaoleia_label.setFixedSize(140, 27)
    self.gongdan_xiaoleia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_xiaoleia_label, 3, 1)

    gongdan_juti_label = QLabel('具体耗材:')
    gongdan_juti_label.setFixedSize(60, 27)
    gongdan_juti_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_juti_label, 3, 2)
    self.gongdan_jutia_label = QLabel(gongdan_neirong[8])
    self.gongdan_jutia_label.setFixedSize(140, 27)
    self.gongdan_jutia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_jutia_label, 3, 3)

    gongdan_ddspid_label = QLabel('商品编号:')
    gongdan_ddspid_label.setFixedSize(60, 27)
    gongdan_ddspid_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddspid_label, 4, 0)
    self.gongdan_ddspida_label = QLabel(gongdan_neirong[9])
    self.gongdan_ddspida_label.setFixedSize(140, 27)
    self.gongdan_ddspida_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddspida_label, 4, 1)

    gongdan_ddspname_label = QLabel('商品名称:')
    gongdan_ddspname_label.setFixedSize(60, 54)
    gongdan_ddspname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddspname_label, 5, 0)
    self.gongdan_ddspnamea_label = QLabel(gongdan_neirong[10])
    self.gongdan_ddspnamea_label.setFixedSize(386, 54)
    self.gongdan_ddspnamea_label.setWordWrap(True)
    self.gongdan_ddspnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddspnamea_label, 5, 1, 1, 3)

    gongdan_ddcs_label = QLabel('选择厂商:')
    gongdan_ddcs_label.setFixedSize(60, 27)
    gongdan_ddcs_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddcs_label, 6, 0)
    self.gongdan_ddcsa_label = QLabel(gongdan_neirong[11])
    self.gongdan_ddcsa_label.setFixedSize(140, 27)
    self.gongdan_ddcsa_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddcsa_label, 6, 1)

    gongdan_ddjg_label = QLabel('选择单价:')
    gongdan_ddjg_label.setFixedSize(60, 27)
    gongdan_ddjg_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddjg_label, 6, 2)
    self.gongdan_ddjga_label = QLabel(gongdan_neirong[12])
    self.gongdan_ddjga_label.setFixedSize(140, 27)
    self.gongdan_ddjga_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddjga_label, 6, 3)

    gongdan_num_label = QLabel('申请数量:')
    gongdan_num_label.setFixedSize(60, 27)
    gongdan_num_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_num_label, 7, 0)
    self.gongdan_numa_label = QLabel(gongdan_neirong[14])
    self.gongdan_numa_label.setFixedSize(140, 27)
    self.gongdan_numa_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_numa_label, 7, 1)

    gongdan_spnum_label = QLabel('审批数量:')
    gongdan_spnum_label.setFixedSize(60, 27)
    gongdan_spnum_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnum_label, 7, 2)
    self.gongdan_spnuma_label = QLabel(gongdan_neirong[15])
    self.gongdan_spnuma_label.setFixedSize(140, 27)
    self.gongdan_spnuma_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_spnuma_label, 7, 3)

    #审批环节界面
    sp_line = QFrame(dialog)
    sp_line.setFrameShadow(QFrame.Plain)
    sp_line.setFrameShape (QFrame.HLine)
    sp_line.setLineWidth(4)
    sp_line.setMidLineWidth(4)
    dialog_lay.addWidget(sp_line, 8, 0,1,4)

    self.in_time = self.get_current_time()

    gongdan_qruser_label = QLabel('区县领取:')
    gongdan_qruser_label.setFixedSize(60, 27)
    gongdan_qruser_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qruser_label, 9, 0)

    gongdan_qrusera_label = QLabel(self.dl_name)
    gongdan_qrusera_label.setFixedSize(140, 27)
    gongdan_qrusera_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrusera_label, 9, 1)

    gongdan_qrname_label = QLabel('区县领取:')
    gongdan_qrname_label.setFixedSize(60, 27)
    gongdan_qrname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrname_label, 9, 2)

    gongdan_qrnamea_label = QLabel(self.dlyh_name)
    gongdan_qrnamea_label.setFixedSize(140, 27)
    gongdan_qrnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrnamea_label, 9, 3)

    gongdan_qrtime_label = QLabel('领取时间:')
    gongdan_qrtime_label.setFixedSize(60, 27)
    gongdan_qrtime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrtime_label, 10, 0)
    self.shenqing_day = QLabel(self.in_time)
    self.shenqing_day.setFixedSize(140, 27)
    self.shenqing_day.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.shenqing_day, 10, 1)

    #领取时需要上传领取附件

    gongdan_lqfujian_but = QPushButton('上传附件')
    gongdan_lqfujian_but.setFixedSize(60, 27)
    gongdan_lqfujian_but.clicked.connect(self.openimage)
    dialog_lay.addWidget(gongdan_lqfujian_but, 12, 0)

    self.fujian_label = QLabel()
    self.fujian_label.setFixedSize(350, 27)
    self.fujian_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.fujian_label, 12, 1, 1, 3)

    self.gongdan_lqfujiana_but = QPushButton(dialog)
    self.gongdan_lqfujiana_but.setText('清空')
    self.gongdan_lqfujiana_but.setFixedSize(30, 27)
    self.gongdan_lqfujiana_but.move(445,377)
    self.gongdan_lqfujiana_but.clicked.connect(self.fujiandel)

    gongdan_qrok_but = QPushButton('领取确认')
    gongdan_qrok_but.setFixedSize(140, 27)
    #gongdan_qrok_but.setStyleSheet(dialog_wzbj)
    gongdan_qrok_but.clicked.connect(self.gongdan_lqok_tj)
    gongdan_qrok_but.clicked.connect(dialog.hide)
    dialog_lay.addWidget(gongdan_qrok_but, 13, 1)

    dialog_hlay.addStretch(1)
    dialog.setLayout(dialog_hlay)
    dialog.exec()

def syne_table_double_clicked(self, index):
    print('e界面')
    table_column = index.column()
    self.table_row = index.row()
    self.qr_showDialog()

def qr_showDialog(self):
    dialog =QDialog()
    dialog.setStyleSheet("background-color:rgb(23,127,214,0.6)")
    dialog.setWindowTitle('工单业支确认')
    print('工单业支确认')
    dialog.setFixedSize(500,600)
    dialog_hlay = QVBoxLayout(self)
    dialog_lay = QGridLayout(self)
    dialog_hlay.addLayout(dialog_lay)

    dialog_wzbj = 'border-width:1px;font-size:13px;border-color:rgb(0,0,0,0.5);' \
                 'background-color:rgb(255,255,255,0.6);'
    try:
        gongdan_neirong=self.hcgd_Table_fkitem[self.table_row].replace('(', '').replace(')', '').split("!")
        print(gongdan_neirong)
    except:
        gongdan_neirong=['无','无','无','无','无','无','无','无','无','无',
                         '无','无','无','无','无','无','无','无','无','无',
                         '无','无','无','无','无','无','无','无']

    gongdan_id_label=QLabel('工单ID:')
    gongdan_id_label.setFixedSize(60, 27)
    gongdan_id_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_id_label,0,0)
    self.gongdan_idzs_label=QLabel(gongdan_neirong[0])
    self.gongdan_idzs_label.setFixedSize(140, 27)
    self.gongdan_idzs_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_idzs_label, 0, 1)

    gongdan_time_label=QLabel('工单时间:')
    gongdan_time_label.setFixedSize(60, 27)
    gongdan_time_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_time_label,0,2)
    gongdan_intime_label = QLabel(gongdan_neirong[1])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_intime_label, 0, 3)

    gongdan_dep_label = QLabel('申请单位:')
    gongdan_dep_label.setFixedSize(60, 27)
    gongdan_dep_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dep_label, 1, 0)
    gongdan_depa_label = QLabel(gongdan_neirong[2])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_depa_label, 1, 1)

    gongdan_name_label = QLabel('派单人:')
    gongdan_name_label.setFixedSize(60, 27)
    gongdan_name_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_name_label, 1, 2)
    gongdan_inname_label = QLabel(gongdan_neirong[4])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_inname_label, 1, 3)

    gongdan_dalei_label = QLabel('申请大类:')
    gongdan_dalei_label.setFixedSize(60, 27)
    gongdan_dalei_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dalei_label, 2, 0)
    self.gongdan_daleia_label = QLabel(gongdan_neirong[6])
    self.gongdan_daleia_label.setFixedSize(140, 27)
    self.gongdan_daleia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_daleia_label, 2, 1)

    gongdan_zhong_label = QLabel('申请中类:')
    gongdan_zhong_label.setFixedSize(60, 27)
    gongdan_zhong_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_zhong_label, 2, 2)
    self.gongdan_zhonga_label = QLabel(gongdan_neirong[7])
    self.gongdan_zhonga_label.setFixedSize(140, 27)
    self.gongdan_zhonga_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_zhonga_label, 2, 3)

    gongdan_xiaolei_label = QLabel('申请小类:')
    gongdan_xiaolei_label.setFixedSize(60, 27)
    gongdan_xiaolei_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_xiaolei_label, 3, 0)
    self.gongdan_xiaoleia_label = QLabel(gongdan_neirong[8])
    self.gongdan_xiaoleia_label.setFixedSize(140, 27)
    self.gongdan_xiaoleia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_xiaoleia_label, 3, 1)

    gongdan_juti_label = QLabel('具体耗材:')
    gongdan_juti_label.setFixedSize(60, 27)
    gongdan_juti_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_juti_label, 3, 2)
    self.gongdan_jutia_label = QLabel(gongdan_neirong[9])
    self.gongdan_jutia_label.setFixedSize(140, 27)
    self.gongdan_jutia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_jutia_label, 3, 3)

    gongdan_num_label = QLabel('申请数量:')
    gongdan_num_label.setFixedSize(60, 27)
    gongdan_num_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_num_label, 4, 0)
    self.gongdan_numa_label = QLabel(gongdan_neirong[10])
    self.gongdan_numa_label.setFixedSize(140, 27)
    self.gongdan_numa_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_numa_label, 4, 1)

    gongdan_spnum_label = QLabel('审批数量:')
    gongdan_spnum_label.setFixedSize(60, 27)
    gongdan_spnum_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnum_label, 4, 2)
    self.gongdan_spnuma_label = QLabel(gongdan_neirong[16])
    self.gongdan_spnuma_label.setFixedSize(140, 27)
    self.gongdan_spnuma_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_spnuma_label, 4, 3)

    #审批环节界面
    sp_line = QFrame(dialog)
    sp_line.setFrameShadow(QFrame.Plain)
    sp_line.setFrameShape (QFrame.HLine)
    sp_line.setLineWidth(4)
    sp_line.setMidLineWidth(4)
    dialog_lay.addWidget(sp_line, 5, 0,1,4)

    gongdan_spuser_label = QLabel('审批人:')
    gongdan_spuser_label.setFixedSize(60, 27)
    gongdan_spuser_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spuser_label, 6, 0)

    gongdan_spusera_label = QLabel(gongdan_neirong[13])
    gongdan_spusera_label.setFixedSize(140, 27)
    gongdan_spusera_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spusera_label, 6, 1)

    gongdan_spname_label = QLabel('审批人:')
    gongdan_spname_label.setFixedSize(60, 27)
    gongdan_spname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spname_label, 6, 2)

    gongdan_spnamea_label = QLabel(gongdan_neirong[14])
    gongdan_spnamea_label.setFixedSize(140, 27)
    gongdan_spnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnamea_label, 6, 3)


    gongdan_sptime_label = QLabel('审批时间:')
    gongdan_sptime_label.setFixedSize(60, 27)
    gongdan_sptime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_sptime_label, 7, 0)
    self.gongdan_sptimea_label = QLabel(gongdan_neirong[11])
    self.gongdan_sptimea_label.setFixedSize(140, 27)
    self.gongdan_sptimea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_sptimea_label, 7, 1)

    gongdan_ddpch_label = QLabel('订单批次号:')
    gongdan_ddpch_label.setFixedSize(60, 27)
    gongdan_ddpch_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddpch_label, 7, 2)

    self.gongdan_ddpcha_label = QLabel(gongdan_neirong[17])
    self.gongdan_ddpcha_label.setFixedSize(140, 27)
    self.gongdan_ddpcha_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddpcha_label, 7, 3)

    #订单生成环节
    sp_line = QFrame(dialog)
    sp_line.setFrameShadow(QFrame.Plain)
    sp_line.setFrameShape(QFrame.HLine)
    sp_line.setLineWidth(4)
    sp_line.setMidLineWidth(4)
    dialog_lay.addWidget(sp_line, 8, 0, 1, 4)

    gongdan_dduser_label = QLabel('订单环节:')
    gongdan_dduser_label.setFixedSize(60, 27)
    gongdan_dduser_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dduser_label, 9, 0)

    gongdan_ddusera_label = QLabel(gongdan_neirong[20])
    gongdan_ddusera_label.setFixedSize(140, 27)
    gongdan_ddusera_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddusera_label, 9, 1)

    gongdan_ddname_label = QLabel('订单环节:')
    gongdan_ddname_label.setFixedSize(60, 27)
    gongdan_ddname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddname_label, 9, 2)

    gongdan_ddnamea_label = QLabel(gongdan_neirong[21])
    gongdan_ddnamea_label.setFixedSize(140, 27)
    gongdan_ddnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddnamea_label, 9, 3)

    gongdan_ddtime_label = QLabel('订单时间:')
    gongdan_ddtime_label.setFixedSize(60, 27)
    gongdan_ddtime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddtime_label, 10, 0)
    self.gongdan_ddtimea_label = QLabel(gongdan_neirong[18])
    self.gongdan_ddtimea_label.setFixedSize(140, 27)
    self.gongdan_ddtimea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddtimea_label, 10, 1)

    gongdan_ddspid_label = QLabel('商品编号:')
    gongdan_ddspid_label.setFixedSize(60, 27)
    gongdan_ddspid_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddspid_label, 10, 2)
    self.gongdan_ddspida_label = QLabel(gongdan_neirong[23])
    self.gongdan_ddspida_label.setFixedSize(140, 27)
    self.gongdan_ddspida_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddspida_label, 10, 3)

    gongdan_ddspname_label = QLabel('商品名称:')
    gongdan_ddspname_label.setFixedSize(60, 54)
    gongdan_ddspname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddspname_label, 11, 0)
    self.gongdan_ddspnamea_label = QLabel(gongdan_neirong[24])
    self.gongdan_ddspnamea_label.setFixedSize(386, 54)
    self.gongdan_ddspnamea_label.setWordWrap(True)
    self.gongdan_ddspnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddspnamea_label, 11, 1, 1, 3)

    gongdan_ddcs_label = QLabel('选择厂商:')
    gongdan_ddcs_label.setFixedSize(60, 27)
    gongdan_ddcs_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddcs_label, 12, 0)
    self.gongdan_ddcsa_label = QLabel(gongdan_neirong[25])
    self.gongdan_ddcsa_label.setFixedSize(140, 27)
    self.gongdan_ddcsa_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddcsa_label, 12, 1)

    gongdan_ddjg_label = QLabel('选择单价:')
    gongdan_ddjg_label.setFixedSize(60, 27)
    gongdan_ddjg_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddjg_label, 12, 2)
    self.gongdan_ddjga_label = QLabel(gongdan_neirong[26])
    self.gongdan_ddjga_label.setFixedSize(140, 27)
    self.gongdan_ddjga_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddjga_label, 12, 3)

    # 业支确认环节界面
    sp_line = QFrame(dialog)
    sp_line.setFrameShadow(QFrame.Plain)
    sp_line.setFrameShape(QFrame.HLine)
    sp_line.setLineWidth(4)
    sp_line.setMidLineWidth(4)
    dialog_lay.addWidget(sp_line, 13, 0, 1, 4)

    sp_time = self.get_current_time()

    gongdan_qruser_label = QLabel('业支确认:')
    gongdan_qruser_label.setFixedSize(60, 27)
    gongdan_qruser_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qruser_label, 14, 0)

    gongdan_qrusera_label = QLabel(self.dl_name)
    gongdan_qrusera_label.setFixedSize(140, 27)
    gongdan_qrusera_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrusera_label, 14, 1)

    gongdan_qrname_label = QLabel('业支确认:')
    gongdan_qrname_label.setFixedSize(60, 27)
    gongdan_qrname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrname_label, 14, 2)

    gongdan_qrnamea_label = QLabel(self.dlyh_name)
    gongdan_qrnamea_label.setFixedSize(140, 27)
    gongdan_qrnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrnamea_label, 14, 3)

    gongdan_qrtime_label = QLabel('确认时间:')
    gongdan_qrtime_label.setFixedSize(60, 27)
    gongdan_qrtime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrtime_label, 15, 0)
    self.gongdan_qrtimea_label = QLabel(sp_time)
    self.gongdan_qrtimea_label.setFixedSize(140, 27)
    self.gongdan_qrtimea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_qrtimea_label, 15, 1)

    gongdan_qrnote_label = QLabel('审批意见:')
    gongdan_qrnote_label.setFixedSize(60, 54)
    gongdan_qrnote_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrnote_label, 16, 0)

    self.gongdan_qrnotea_label = QTextEdit('')
    self.gongdan_qrnotea_label.setFixedSize(386, 54)
    self.gongdan_qrnotea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_qrnotea_label, 16, 1, 1, 3)

    gongdan_qrok_but = QPushButton('确认完成')
    gongdan_qrok_but.setFixedSize(140, 27)
    gongdan_qrok_but.setStyleSheet(dialog_wzbj)
    gongdan_qrok_but.clicked.connect(self.gongdan_qrok_tj)
    gongdan_qrok_but.clicked.connect(dialog.hide)
    dialog_lay.addWidget(gongdan_qrok_but, 17, 1)

    dialog_hlay.addStretch(1)
    dialog.setLayout(dialog_hlay)
    dialog.exec()


def synd_table_double_clicked(self, index):
    print('d界面')
    table_column = index.column()
    self.table_row = index.row()
    self.dd_showDialog()

def dd_showDialog(self):
    dialog =QDialog()
    dialog.setStyleSheet("background-color:rgb(23,127,214,0.6)")
    dialog.setWindowTitle('订单生成界面')
    dialog.setFixedSize(500,500)
    dialog_hlay = QVBoxLayout(self)
    dialog_lay = QGridLayout(self)
    dialog_hlay.addLayout(dialog_lay)

    try:
        gongdan_neirong = self.hcgd_Table_fkitem[self.table_row].replace('(', '').replace(')', '').split("!")
    except:
        gongdan_neirong=['无','无','无','无','无','无','无']
    if gongdan_neirong==['']:
        gongdan_neirong = ['无', '无', '无', '无', '无', '无', '无']

    print('订单生成',gongdan_neirong)
    dialog_wzbj = 'border-width:1px;font-size:13px;border-color:rgb(0,0,0,0.5);' \
                 'background-color:rgb(255,255,255,0.6);'

    gongdan_dalei_label = QLabel('申请大类:')
    gongdan_dalei_label.setFixedSize(60, 27)
    gongdan_dalei_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dalei_label, 0, 0)
    self.gongdan_daleia_label = QLabel(gongdan_neirong[0])
    self.gongdan_daleia_label.setFixedSize(140, 27)
    self.gongdan_daleia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_daleia_label, 0, 1)

    gongdan_zhong_label = QLabel('申请中类:')
    gongdan_zhong_label.setFixedSize(60, 27)
    gongdan_zhong_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_zhong_label, 0, 2)
    self.gongdan_zhonga_label = QLabel(gongdan_neirong[1])
    self.gongdan_zhonga_label.setFixedSize(140, 27)
    self.gongdan_zhonga_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_zhonga_label, 0, 3)

    gongdan_xiaolei_label = QLabel('申请小类:')
    gongdan_xiaolei_label.setFixedSize(60, 27)
    gongdan_xiaolei_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_xiaolei_label, 1, 0)
    self.gongdan_xiaoleia_label = QLabel(gongdan_neirong[2])
    self.gongdan_xiaoleia_label.setFixedSize(140, 27)
    self.gongdan_xiaoleia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_xiaoleia_label, 1, 1)

    gongdan_juti_label = QLabel('具体耗材:')
    gongdan_juti_label.setFixedSize(60, 27)
    gongdan_juti_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_juti_label, 1, 2)
    self.gongdan_jutia_label = QLabel(gongdan_neirong[3])
    self.gongdan_jutia_label.setFixedSize(140, 27)
    self.gongdan_jutia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_jutia_label, 1, 3)

    gongdan_num_label = QLabel('申请数量:')
    gongdan_num_label.setFixedSize(60, 27)
    gongdan_num_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_num_label, 2, 0)
    self.gongdan_numa_label = QLabel(gongdan_neirong[4])
    self.gongdan_numa_label.setFixedSize(140, 27)
    self.gongdan_numa_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_numa_label, 2, 1)

    gongdan_spnum_label = QLabel('审批数量:')
    gongdan_spnum_label.setFixedSize(60, 27)
    gongdan_spnum_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnum_label, 2, 2)
    self.gongdan_spnuma_label = QLabel(gongdan_neirong[5])
    self.gongdan_spnuma_label.setFixedSize(140, 27)
    self.gongdan_spnuma_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_spnuma_label, 2, 3)

    gongdan_spids_label = QLabel('涉及工单:')
    gongdan_spids_label.setFixedSize(60, 27)
    gongdan_spids_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spids_label, 3, 0)
    self.gongdan_spidsa_label = QLabel(gongdan_neirong[6])
    self.gongdan_spidsa_label.setFixedSize(385, 27)
    self.gongdan_spidsa_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_spidsa_label, 3, 1,1,3)

    # 审批环节界面
    sp_line = QFrame(dialog)
    sp_line.setFrameShadow(QFrame.Plain)
    sp_line.setFrameShape(QFrame.HLine)
    sp_line.setLineWidth(4)
    sp_line.setMidLineWidth(4)
    dialog_lay.addWidget(sp_line, 4, 0, 1, 4)

    gongdan_spuser_label = QLabel('审批人:')
    gongdan_spuser_label.setFixedSize(60, 27)
    gongdan_spuser_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spuser_label, 5, 0)

    gongdan_spusera_label = QLabel(self.dl_name)
    gongdan_spusera_label.setFixedSize(140, 27)
    gongdan_spusera_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spusera_label, 5, 1)

    gongdan_spname_label = QLabel('审批人:')
    gongdan_spname_label.setFixedSize(60, 27)
    gongdan_spname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spname_label, 5, 2)

    gongdan_spnamea_label = QLabel(self.dlyh_name)
    gongdan_spnamea_label.setFixedSize(140, 27)
    gongdan_spnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnamea_label, 5, 3)


    #孙志超审批维护厂商和价格,输入商品编码,关联出商品名称

    gongdan_ddspid_label = QLabel('输入商品编码:')
    gongdan_ddspid_label.setFixedSize(60, 27)
    gongdan_ddspid_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddspid_label, 6, 0)
    self.gongdan_ddspida_label = QLineEdit()
    self.gongdan_ddspida_label.editingFinished.connect(self.dd_spid_genggai)
    self.gongdan_ddspida_label.setFixedSize(140, 27)
    #self.gongdan_ddspida_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddspida_label, 6, 1)

    sp_time = self.get_current_time()
    gongdan_sptime_label = QLabel('审批时间:')
    gongdan_sptime_label.setFixedSize(60, 27)
    gongdan_sptime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_sptime_label, 6, 2)
    self.gongdan_sptimea_label = QLabel(sp_time)
    self.gongdan_sptimea_label.setFixedSize(140, 27)
    self.gongdan_sptimea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_sptimea_label, 6, 3)

    gongdan_ddspname_label = QLabel('商品名称:')
    gongdan_ddspname_label.setFixedSize(60, 79)
    gongdan_ddspname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddspname_label, 7, 0)
    self.gongdan_ddspnamea_label = QLabel('商品名称')
    self.gongdan_ddspnamea_label.setFixedSize(386, 79)
    self.gongdan_ddspnamea_label.setWordWrap(True)
    self.gongdan_ddspnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddspnamea_label, 7, 1,1,3)

    gongdan_ddcs_label = QLabel('选择厂商:')
    gongdan_ddcs_label.setFixedSize(60, 27)
    gongdan_ddcs_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddcs_label, 8, 0)
    self.gongdan_ddcsa_label = QLabel('选择厂商预留')
    self.gongdan_ddcsa_label.setFixedSize(140, 27)
    self.gongdan_ddcsa_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddcsa_label, 8, 1)

    gongdan_ddjg_label = QLabel('选择单价:')
    gongdan_ddjg_label.setFixedSize(60, 27)
    gongdan_ddjg_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddjg_label, 8, 2)
    self.gongdan_ddjga_label = QLabel('0.00')
    self.gongdan_ddjga_label.setFixedSize(140, 27)
    self.gongdan_ddjga_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddjga_label, 8, 3)



    gongdan_spnote_label = QLabel('审批意见:')
    gongdan_spnote_label.setFixedSize(60, 80)
    gongdan_spnote_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnote_label, 9, 0)

    self.gongdan_spnotea_label = QTextEdit('')
    self.gongdan_spnotea_label.setFixedSize(386, 80)
    self.gongdan_spnotea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_spnotea_label, 9, 1, 1, 3)

    gongdan_spok_but = QPushButton('审批同意')
    gongdan_spok_but.setFixedSize(60, 27)
    gongdan_spok_but.setStyleSheet(dialog_wzbj)
    gongdan_spok_but.clicked.connect(self.gongdan_ddok_tj)
    gongdan_spok_but.clicked.connect(dialog.hide)
    dialog_lay.addWidget(gongdan_spok_but, 10, 1)
    print('777')
    gongdan_spno_but = QPushButton('审批驳回')
    gongdan_spno_but.setFixedSize(60, 27)
    gongdan_spno_but.setStyleSheet(dialog_wzbj)
    gongdan_spno_but.clicked.connect(self.gongdan_ddbh_tj)
    dialog_lay.addWidget(gongdan_spno_but, 10, 2)

    dialog_hlay.addStretch(1)
    dialog.setLayout(dialog_hlay)
    dialog.exec()

def dd_spid_genggai(self):
    dd_spid_text = self.gongdan_ddspida_label.text()
    dd_spid_fk = self.socket_zhmm('耗材管理', '工单提交', '订单号', dd_spid_text)
    dd_spid_fksj = dd_spid_fk['ZIDUAN3'].replace('[', '').replace(']', '').replace("'", "").replace(" ", "").split(",")
    print(dd_spid_fksj)
    self.gongdan_ddspida_label.setText(dd_spid_fksj[0])
    self.gongdan_ddspnamea_label.setText(dd_spid_fksj[1])
    self.gongdan_ddcsa_label.setText(dd_spid_fksj[3])
    self.gongdan_ddjga_label.setText(dd_spid_fksj[2])



def synb_table_double_clicked(self, index):

    table_column = index.column()
    self.table_row = index.row()
    self.sp_showDialog()

def sp_showDialog(self):
    dialog =QDialog()
    dialog.setStyleSheet("background-color:rgb(23,127,214,0.6)")
    dialog.setWindowTitle('工单内容审批')
    print('工单内容审批')
    dialog.setFixedSize(500,500)
    dialog_hlay = QVBoxLayout(self)
    dialog_lay = QGridLayout(self)
    dialog_hlay.addLayout(dialog_lay)

    dialog_wzbj = 'border-width:1px;font-size:13px;border-color:rgb(0,0,0,0.5);' \
                 'background-color:rgb(255,255,255,0.6);'
    try:
        gongdan_neirong=self.hcgd_Table_fkitem[self.table_row].replace('(', '').replace(')', '').split("!")
        print(gongdan_neirong)
    except:
        gongdan_neirong=['无','无','无','无','无','无','无','无','1','无','无','无','无']

    if gongdan_neirong ==['']:
        gongdan_neirong =['无','无','无','无','无','无','无','无','1','无','无','无','无']

    gongdan_id_label=QLabel('工单ID:')
    gongdan_id_label.setFixedSize(60, 27)
    gongdan_id_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_id_label,0,0)
    self.gongdan_idzs_label=QLabel(gongdan_neirong[0])
    self.gongdan_idzs_label.setFixedSize(140, 27)
    self.gongdan_idzs_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_idzs_label, 0, 1)

    gongdan_time_label=QLabel('工单时间:')
    gongdan_time_label.setFixedSize(60, 27)
    gongdan_time_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_time_label,0,2)
    gongdan_intime_label = QLabel(gongdan_neirong[1])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_intime_label, 0, 3)

    gongdan_dep_label = QLabel('申请单位:')
    gongdan_dep_label.setFixedSize(60, 27)
    gongdan_dep_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dep_label, 1, 0)
    gongdan_depa_label = QLabel(gongdan_neirong[2])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_depa_label, 1, 1)

    gongdan_name_label = QLabel('派单人:')
    gongdan_name_label.setFixedSize(60, 27)
    gongdan_name_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_name_label, 1, 2)
    gongdan_inname_label = QLabel(gongdan_neirong[3])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_inname_label, 1, 3)

    gongdan_dalei_label = QLabel('申请大类:')
    gongdan_dalei_label.setFixedSize(60, 27)
    gongdan_dalei_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dalei_label, 2, 0)
    self.gongdan_daleia_label = QLabel(gongdan_neirong[4])
    self.gongdan_daleia_label.setFixedSize(140, 27)
    self.gongdan_daleia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_daleia_label, 2, 1)

    gongdan_zhong_label = QLabel('申请中类:')
    gongdan_zhong_label.setFixedSize(60, 27)
    gongdan_zhong_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_zhong_label, 2, 2)
    self.gongdan_zhonga_label = QLabel(gongdan_neirong[5])
    self.gongdan_zhonga_label.setFixedSize(140, 27)
    self.gongdan_zhonga_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_zhonga_label, 2, 3)

    gongdan_xiaolei_label = QLabel('申请小类:')
    gongdan_xiaolei_label.setFixedSize(60, 27)
    gongdan_xiaolei_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_xiaolei_label, 3, 0)
    self.gongdan_xiaoleia_label = QLabel(gongdan_neirong[6])
    self.gongdan_xiaoleia_label.setFixedSize(140, 27)
    self.gongdan_xiaoleia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_xiaoleia_label, 3, 1)

    gongdan_juti_label = QLabel('具体耗材:')
    gongdan_juti_label.setFixedSize(60, 27)
    gongdan_juti_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_juti_label, 3, 2)
    self.gongdan_jutia_label = QLabel(gongdan_neirong[7])
    self.gongdan_jutia_label.setFixedSize(140, 27)
    self.gongdan_jutia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_jutia_label, 3, 3)

    gongdan_num_label = QLabel('申请数量:')
    gongdan_num_label.setFixedSize(60, 27)
    gongdan_num_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_num_label, 4, 0)
    self.gongdan_numa_label = QLabel(gongdan_neirong[8])
    self.gongdan_numa_label.setFixedSize(140, 27)
    self.gongdan_numa_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_numa_label, 4, 1)

    gongdan_fujian_label = QPushButton('查看附件')
    gongdan_fujian_label.setFixedSize(60, 27)
    gongdan_fujian_label.clicked.connect(self.gongdan_fujian_tiqu)
    dialog_lay.addWidget(gongdan_fujian_label, 4, 2)
    self.gongdan_fujiana_label = QLabel(gongdan_neirong[10].split('/')[len(gongdan_neirong[10].split('/'))-1])
    self.gongdan_fujiana_label.setFixedSize(140, 27)
    self.gongdan_fujiana_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_fujiana_label, 4, 3)

    gongdan_sqnote_label = QLabel('申请备注:')
    gongdan_sqnote_label.setFixedSize(60, 80)
    gongdan_sqnote_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_sqnote_label, 5, 0)

    gongdan_sqnotea_label = QLabel(gongdan_neirong[9])
    gongdan_sqnotea_label.setWordWrap(True)
    gongdan_sqnotea_label.setFixedSize(386, 80)
    gongdan_sqnotea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_sqnotea_label, 5, 1,1,3)

    #审批环节界面
    sp_line = QFrame(dialog)
    sp_line.setFrameShadow(QFrame.Plain)
    sp_line.setFrameShape (QFrame.HLine)
    sp_line.setLineWidth(4)
    sp_line.setMidLineWidth(4)
    dialog_lay.addWidget(sp_line, 7, 0,1,4)

    gongdan_spuser_label = QLabel('审批人:')
    gongdan_spuser_label.setFixedSize(60, 27)
    gongdan_spuser_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spuser_label, 8, 0)

    gongdan_spusera_label = QLabel(self.dl_name)
    gongdan_spusera_label.setFixedSize(140, 27)
    gongdan_spusera_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spusera_label, 8, 1)

    gongdan_spname_label = QLabel('审批人:')
    gongdan_spname_label.setFixedSize(60, 27)
    gongdan_spname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spname_label, 8, 2)

    gongdan_spnamea_label = QLabel(self.dlyh_name)
    gongdan_spnamea_label.setFixedSize(140, 27)
    gongdan_spnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnamea_label, 8, 3)

    gongdan_spnum_label = QLabel('审批数量:')
    gongdan_spnum_label.setFixedSize(60, 27)
    gongdan_spnum_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnum_label, 10, 0)

    self.gongdan_spnuma_label = QSpinBox()
    self.gongdan_spnuma_label.setValue(int(gongdan_neirong[8]))
    self.gongdan_spnuma_label.setRange(0, 999)
    self.gongdan_spnuma_label.setFixedSize(140, 27)
    self.gongdan_spnuma_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_spnuma_label, 10, 1)

    sp_time = self.get_current_time()
    gongdan_sptime_label = QLabel('审批时间:')
    gongdan_sptime_label.setFixedSize(60, 27)
    gongdan_sptime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_sptime_label, 10, 2)
    self.gongdan_sptimea_label = QLabel(sp_time)
    self.gongdan_sptimea_label.setFixedSize(140, 27)
    self.gongdan_sptimea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_sptimea_label, 10, 3)

    gongdan_spnote_label = QLabel('审批意见:')
    gongdan_spnote_label.setFixedSize(60, 80)
    gongdan_spnote_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnote_label, 11, 0)

    self.gongdan_spnotea_label = QTextEdit('')
    self.gongdan_spnotea_label.setFixedSize(386, 80)
    self.gongdan_spnotea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_spnotea_label, 11, 1, 1, 3)

    gongdan_spok_but = QPushButton('审批同意')
    gongdan_spok_but.setFixedSize(60, 27)
    gongdan_spok_but.setStyleSheet(dialog_wzbj)
    gongdan_spok_but.clicked.connect(self.gongdan_spok_tj)
    gongdan_spok_but.clicked.connect(dialog.hide)
    dialog_lay.addWidget(gongdan_spok_but, 12, 1)

    gongdan_spno_but = QPushButton('审批驳回')
    gongdan_spno_but.setFixedSize(60, 27)
    gongdan_spno_but.setStyleSheet(dialog_wzbj)
    gongdan_spno_but.clicked.connect(self.gongdan_spbh_tj)
    dialog_lay.addWidget(gongdan_spno_but, 12, 2)

    dialog_hlay.addStretch(1)
    dialog.setLayout(dialog_hlay)
    dialog.exec()

def sync_table_double_clicked(self, index):

    table_column = index.column()
    self.table_row = index.row()
    #页,行,列
    #print(self.ym_num,self.table_row,table_column)
    #获取工单号
    #print(self.hcgd_Table_fkitem[self.table_row])
    self.cx_showDialog()


def cx_showDialog(self):
    print('工单内容展示1')
    dialog =QDialog()
    dialog.setStyleSheet("background-color:rgb(23,252,237,0.6)")
    dialog.setWindowTitle('工单内容展示')
    dialog.setFixedSize(500,500)
    dialog_hlay = QVBoxLayout(self)
    dialog_lay = QGridLayout(self)
    dialog_hlay.addLayout(dialog_lay)
    print('工单内容展示2')
    dialog_wzbj = 'border-width:1px;font-size:13px;border-color:rgb(0,0,0,0.5);' \
                 'background-color:rgb(255,255,255,0.6);'
    try:
        gongdan_neirong=self.hcgd_Table_fkitem[self.table_row].replace('(', '').replace(')', '').split("!")
        print(gongdan_neirong)
    except:
        gongdan_neirong=['无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无',
                         '无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无','无']

    print('工单内容展示1858')

    gongdan_id_label = QLabel('工单ID:')
    gongdan_id_label.setFixedSize(60, 27)
    gongdan_id_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_id_label, 0, 0)
    self.gongdan_idzs_label = QLabel(gongdan_neirong[0])
    self.gongdan_idzs_label.setFixedSize(140, 27)
    self.gongdan_idzs_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_idzs_label, 0, 1)

    gongdan_time_label = QLabel('工单时间:')
    gongdan_time_label.setFixedSize(60, 27)
    gongdan_time_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_time_label, 0, 2)
    gongdan_intime_label = QLabel(gongdan_neirong[0])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_intime_label, 0, 3)

    gongdan_dep_label = QLabel('申请单位:')
    gongdan_dep_label.setFixedSize(60, 27)
    gongdan_dep_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dep_label, 1, 0)
    gongdan_depa_label = QLabel(gongdan_neirong[1])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_depa_label, 1, 1)

    gongdan_name_label = QLabel('派单人:')
    gongdan_name_label.setFixedSize(60, 27)
    gongdan_name_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_name_label, 1, 2)
    gongdan_inname_label = QLabel(gongdan_neirong[10])
    gongdan_intime_label.setFixedSize(140, 27)
    gongdan_intime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_inname_label, 1, 3)

    gongdan_dalei_label = QLabel('申请大类:')
    gongdan_dalei_label.setFixedSize(60, 27)
    gongdan_dalei_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dalei_label, 2, 0)
    self.gongdan_daleia_label = QLabel(gongdan_neirong[2])
    self.gongdan_daleia_label.setFixedSize(140, 27)
    self.gongdan_daleia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_daleia_label, 2, 1)

    gongdan_zhong_label = QLabel('申请中类:')
    gongdan_zhong_label.setFixedSize(60, 27)
    gongdan_zhong_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_zhong_label, 2, 2)
    self.gongdan_zhonga_label = QLabel(gongdan_neirong[3])
    self.gongdan_zhonga_label.setFixedSize(140, 27)
    self.gongdan_zhonga_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_zhonga_label, 2, 3)

    gongdan_xiaolei_label = QLabel('申请小类:')
    gongdan_xiaolei_label.setFixedSize(60, 27)
    gongdan_xiaolei_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_xiaolei_label, 3, 0)
    self.gongdan_xiaoleia_label = QLabel(gongdan_neirong[4])
    self.gongdan_xiaoleia_label.setFixedSize(140, 27)
    self.gongdan_xiaoleia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_xiaoleia_label, 3, 1)

    gongdan_juti_label = QLabel('具体耗材:')
    gongdan_juti_label.setFixedSize(60, 27)
    gongdan_juti_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_juti_label, 3, 2)
    self.gongdan_jutia_label = QLabel(gongdan_neirong[5])
    self.gongdan_jutia_label.setFixedSize(140, 27)
    self.gongdan_jutia_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_jutia_label, 3, 3)

    gongdan_num_label = QLabel('申请数量:')
    gongdan_num_label.setFixedSize(60, 27)
    gongdan_num_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_num_label, 4, 0)
    self.gongdan_numa_label = QLabel(gongdan_neirong[6])
    self.gongdan_numa_label.setFixedSize(140, 27)
    self.gongdan_numa_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_numa_label, 4, 1)

    gongdan_spnum_label = QLabel('审批数量:')
    gongdan_spnum_label.setFixedSize(60, 27)
    gongdan_spnum_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnum_label, 4, 2)
    self.gongdan_spnuma_label = QLabel(gongdan_neirong[7])
    self.gongdan_spnuma_label.setFixedSize(140, 27)
    self.gongdan_spnuma_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_spnuma_label, 4, 3)

    # 审批环节界面
    sp_line = QFrame(dialog)
    sp_line.setFrameShadow(QFrame.Plain)
    sp_line.setFrameShape(QFrame.HLine)
    sp_line.setLineWidth(4)
    sp_line.setMidLineWidth(4)
    dialog_lay.addWidget(sp_line, 5, 0, 1, 4)

    gongdan_spuser_label = QLabel('审批人:')
    gongdan_spuser_label.setFixedSize(60, 27)
    gongdan_spuser_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spuser_label, 6, 0)

    gongdan_spusera_label = QLabel(gongdan_neirong[14])
    gongdan_spusera_label.setFixedSize(140, 27)
    gongdan_spusera_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spusera_label, 6, 1)

    gongdan_spname_label = QLabel('审批人:')
    gongdan_spname_label.setFixedSize(60, 27)
    gongdan_spname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spname_label, 6, 2)

    gongdan_spnamea_label = QLabel(gongdan_neirong[15])
    gongdan_spnamea_label.setFixedSize(140, 27)
    gongdan_spnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_spnamea_label, 6, 3)

    gongdan_sptime_label = QLabel('审批时间:')
    gongdan_sptime_label.setFixedSize(60, 27)
    gongdan_sptime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_sptime_label, 7, 0)
    self.gongdan_sptimea_label = QLabel(gongdan_neirong[12])
    self.gongdan_sptimea_label.setFixedSize(140, 27)
    self.gongdan_sptimea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_sptimea_label, 7, 1)

    gongdan_ddpch_label = QLabel('订单批次号:')
    gongdan_ddpch_label.setFixedSize(60, 27)
    gongdan_ddpch_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddpch_label, 7, 2)

    self.gongdan_ddpcha_label = QLabel(gongdan_neirong[18])
    self.gongdan_ddpcha_label.setFixedSize(140, 27)
    self.gongdan_ddpcha_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddpcha_label, 7, 3)

    # 订单生成环节
    sp_line = QFrame(dialog)
    sp_line.setFrameShadow(QFrame.Plain)
    sp_line.setFrameShape(QFrame.HLine)
    sp_line.setLineWidth(4)
    sp_line.setMidLineWidth(4)
    dialog_lay.addWidget(sp_line, 8, 0, 1, 4)

    gongdan_dduser_label = QLabel('订单环节:')
    gongdan_dduser_label.setFixedSize(60, 27)
    gongdan_dduser_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_dduser_label, 9, 0)

    gongdan_ddusera_label = QLabel(gongdan_neirong[20])
    gongdan_ddusera_label.setFixedSize(140, 27)
    gongdan_ddusera_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddusera_label, 9, 1)

    gongdan_ddname_label = QLabel('订单环节:')
    gongdan_ddname_label.setFixedSize(60, 27)
    gongdan_ddname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddname_label, 9, 2)

    gongdan_ddnamea_label = QLabel(gongdan_neirong[21])
    gongdan_ddnamea_label.setFixedSize(140, 27)
    gongdan_ddnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddnamea_label, 9, 3)

    gongdan_ddtime_label = QLabel('订单时间:')
    gongdan_ddtime_label.setFixedSize(60, 27)
    gongdan_ddtime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddtime_label, 10, 0)
    self.gongdan_ddtimea_label = QLabel(gongdan_neirong[18])
    self.gongdan_ddtimea_label.setFixedSize(140, 27)
    self.gongdan_ddtimea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddtimea_label, 10, 1)

    gongdan_ddspid_label = QLabel('商品编号:')
    gongdan_ddspid_label.setFixedSize(60, 27)
    gongdan_ddspid_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddspid_label, 10, 2)
    self.gongdan_ddspida_label = QLabel(gongdan_neirong[23])
    self.gongdan_ddspida_label.setFixedSize(140, 27)
    self.gongdan_ddspida_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddspida_label, 10, 3)

    gongdan_ddspname_label = QLabel('商品名称:')
    gongdan_ddspname_label.setFixedSize(60, 27)
    gongdan_ddspname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddspname_label, 11, 0)
    self.gongdan_ddspnamea_label = QLabel(gongdan_neirong[24])
    self.gongdan_ddspnamea_label.setFixedSize(386, 27)
    self.gongdan_ddspnamea_label.setWordWrap(True)
    self.gongdan_ddspnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddspnamea_label, 11, 1, 1, 3)

    gongdan_ddcs_label = QLabel('选择厂商:')
    gongdan_ddcs_label.setFixedSize(60, 27)
    gongdan_ddcs_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddcs_label, 12, 0)
    self.gongdan_ddcsa_label = QLabel(gongdan_neirong[25])
    self.gongdan_ddcsa_label.setFixedSize(140, 27)
    self.gongdan_ddcsa_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddcsa_label, 12, 1)

    gongdan_ddjg_label = QLabel('选择单价:')
    gongdan_ddjg_label.setFixedSize(60, 27)
    gongdan_ddjg_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_ddjg_label, 12, 2)
    self.gongdan_ddjga_label = QLabel(gongdan_neirong[26])
    self.gongdan_ddjga_label.setFixedSize(140, 27)
    self.gongdan_ddjga_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_ddjga_label, 12, 3)

    # 业支确认环节界面
    sp_line = QFrame(dialog)
    sp_line.setFrameShadow(QFrame.Plain)
    sp_line.setFrameShape(QFrame.HLine)
    sp_line.setLineWidth(4)
    sp_line.setMidLineWidth(4)
    dialog_lay.addWidget(sp_line, 13, 0, 1, 4)

    sp_time = self.get_current_time()

    gongdan_qruser_label = QLabel('业支确认:')
    gongdan_qruser_label.setFixedSize(60, 27)
    gongdan_qruser_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qruser_label, 14, 0)

    gongdan_qrusera_label = QLabel(gongdan_neirong[30])
    gongdan_qrusera_label.setFixedSize(140, 27)
    gongdan_qrusera_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrusera_label, 14, 1)

    gongdan_qrname_label = QLabel('业支确认:')
    gongdan_qrname_label.setFixedSize(60, 27)
    gongdan_qrname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrname_label, 14, 2)

    gongdan_qrnamea_label = QLabel(gongdan_neirong[31])
    gongdan_qrnamea_label.setFixedSize(140, 27)
    gongdan_qrnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrnamea_label, 14, 3)

    gongdan_qrtime_label = QLabel('确认时间:')
    gongdan_qrtime_label.setFixedSize(60, 27)
    gongdan_qrtime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_qrtime_label, 15, 0)
    self.gongdan_qrtimea_label = QLabel(gongdan_neirong[28])
    self.gongdan_qrtimea_label.setFixedSize(140, 27)
    self.gongdan_qrtimea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_qrtimea_label, 15, 1)

    # 业支确认环节界面
    sp_line = QFrame(dialog)
    sp_line.setFrameShadow(QFrame.Plain)
    sp_line.setFrameShape(QFrame.HLine)
    sp_line.setLineWidth(4)
    sp_line.setMidLineWidth(4)
    dialog_lay.addWidget(sp_line, 16, 0, 1, 4)

    gongdan_lquser_label = QLabel('区县领取:')
    gongdan_lquser_label.setFixedSize(60, 27)
    gongdan_lquser_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_lquser_label, 17, 0)

    gongdan_lqusera_label = QLabel(gongdan_neirong[36])
    gongdan_lqusera_label.setFixedSize(140, 27)
    gongdan_lqusera_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_lqusera_label, 17, 1)

    gongdan_lqname_label = QLabel('区县领取:')
    gongdan_lqname_label.setFixedSize(60, 27)
    gongdan_lqname_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_lqname_label, 17, 2)

    gongdan_lqnamea_label = QLabel(gongdan_neirong[37])
    gongdan_lqnamea_label.setFixedSize(140, 27)
    gongdan_lqnamea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_lqnamea_label, 17, 3)

    gongdan_lqtime_label = QLabel('领取时间:')
    gongdan_lqtime_label.setFixedSize(60, 27)
    gongdan_lqtime_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_lqtime_label, 18, 0)
    self.gongdan_lqtimea_label = QLabel(gongdan_neirong[34])
    self.gongdan_lqtimea_label.setFixedSize(140, 27)
    self.gongdan_lqtimea_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_lqtimea_label, 18, 1)

    gongdan_lqfujian_label = QPushButton('领取附件')
    gongdan_lqfujian_label.setFixedSize(60, 27)
    gongdan_lqfujian_label.clicked.connect(self.gongdan_fujian_tiqu)
    gongdan_lqfujian_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(gongdan_lqfujian_label, 18, 2)
    self.gongdan_fujiana_label = QLabel(gongdan_neirong[41].split('/')[len(gongdan_neirong[41].split('/')) - 1])
    self.gongdan_fujiana_label.setFixedSize(140, 27)
    self.gongdan_fujiana_label.setStyleSheet(dialog_wzbj)
    dialog_lay.addWidget(self.gongdan_fujiana_label, 18, 3)

    dialog_hlay.addStretch(1)
    dialog.setLayout(dialog_hlay)
    dialog.exec()



# 区县领取环节
def gongdan_lqok_tj(self):

    print('领取11111',self.fujian_label.text())
    # 具体类为空报错
    if self.fujian_label.text() is None or self.fujian_label.text() == '':
        QMessageBox.information(None, '服务器反馈', '您的工单:' + self.gongdan_idzs_label.text() + ' 没有提供领取附件,请核实', QMessageBox.Yes)
    elif self.gongdan_idzs_label.text() in ('无','',None):
        QMessageBox.information(None,self.gongdan_idzs_label.text(), self.gongdan_idzs_label.text() + ' 工单号为空,请检查数据',QMessageBox.Yes)
    else:
        oktj_zidian = '[%s,%s,%s,%s,%s,%s,%s,%s,%s,%s]' \
                      % (self.gongdan_idzs_label.text(),
                         self.shenqing_day.text(),
                         self.dlyh_danw,
                         self.dl_name,
                         self.dlyh_name,
                         self.dlyh_sjhm,
                         self.gongdan_spnuma_label.text(),
                         self.fujian_label.text(),
                         '1',self.shenqing_day.text())
        print('领取111112')
        haocai_oktj_fh = self.socket_zhmm('耗材管理', '工单提交', '领取', oktj_zidian)
        print('3333',haocai_oktj_fh['ZIDUAN3'])
        if haocai_oktj_fh['ZIDUAN3'] not in (None, '工单审批成功'):
            # print(dlgc_fk['ZIDUAN3'])
            QMessageBox.information(None, haocai_oktj_fh['ZIDUAN3'], haocai_oktj_fh['ZIDUAN3'], QMessageBox.Yes)
        else:
            QMessageBox.information(None, '服务器反馈', '您的工单:' + self.in_time + ' ' + haocai_oktj_fh['ZIDUAN3'],
                                    QMessageBox.Yes)
            # 判断如果上传了附件,会将名字替换成工单id号
            print(self.fujian_label.text())
            if self.fujian_label.text() not in ('附件路径', '', None):
                # 服务器信息
                host = self.ip_num
                port = self.port_num
                # 文件传输的缓冲区
                BUFFER_SIZE = 4096
                # 创建连接
                s = socket.socket()
                s.connect((host, port))
                # 传递文件到指定目录下
                filename = self.fujian_label.text().replace('/', '//')
                # 文件大小
                file_size = os.path.getsize(filename)
                chuandi_tup = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%d","ziduan3":"%s" }' % (
                '文件传递', filename, file_size,self.shenqing_day.text())
                s.send(chuandi_tup.encode())


                # 文件传输
                progress = tqdm.tqdm(range(file_size), f"发送{filename}", unit="B", unit_divisor=1024)

                with open(filename, "rb") as f:
                    for _ in progress:
                        # 读取文件
                        bytes_read = f.read(BUFFER_SIZE)
                        if not bytes_read:
                            break
                        # sendall确保及时网络忙碌的时候,数据仍然可以传输
                        s.sendall(bytes_read)
                        progress.update(len(bytes_read))
                # 关闭资源
                s.close()

            self.gongdan_idzs_label.setText('无')

        self.in_time = self.get_current_time()
        self.hcgdlq_Table_add(self.ym_num, '有效')
        self.lq_shangye_click()

#业支确认环节
def gongdan_qrok_tj(self):
    if self.gongdan_idzs_label.text() in ('无','',None):
        QMessageBox.information(None,self.gongdan_idzs_label.text(), self.gongdan_idzs_label.text() + ' 工单号为空,请检查数据',QMessageBox.Yes)
    else:
        qrtj_zidian = '[%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s]' \
                      % (self.gongdan_idzs_label.text(),
                         self.gongdan_qrtimea_label.text(),
                         self.dlyh_danw,
                         self.dl_name,
                         self.dlyh_name,
                         self.dlyh_sjhm,
                         self.gongdan_daleia_label.text(),
                         self.gongdan_zhonga_label.text(),
                         self.gongdan_xiaoleia_label.text(),
                         self.gongdan_jutia_label.text(),
                         self.gongdan_ddspida_label.text(),
                         self.gongdan_ddspnamea_label.text(),
                         self.gongdan_ddcsa_label.text(),
                         self.gongdan_ddjga_label.text(),
                         self.gongdan_ddpcha_label.text(),
                         self.gongdan_numa_label.text(),
                         self.gongdan_spnuma_label.text(),
                         self.gongdan_idzs_label.text(),
                         self.gongdan_sptimea_label.text(),
                         self.gongdan_ddpcha_label.text(),
                         self.gongdan_qrnotea_label.toPlainText(),
                         '1', self.gongdan_qrtimea_label.text())
        haocai_qrtj_fh = self.socket_zhmm('耗材管理', '工单提交', '确认', qrtj_zidian)

        if haocai_qrtj_fh['ZIDUAN3'] in ('工单审批成功'):
            QMessageBox.information(None, haocai_qrtj_fh['ZIDUAN3'], self.gongdan_sptimea_label.text()+' 工单审批通过', QMessageBox.Yes)
            # 加载一下数据,获取行数
            self.hcgdqr_Table_add(self.ym_num, '有效')
            self.qr_shangye_click()
            self.gongdan_idzs_label.setText('无')


#订单生成环节 审批通过
def gongdan_ddok_tj(self):
    if self.gongdan_ddspida_label.text() in ('无','',None):
        QMessageBox.information(None, '订单生成环节','商品编码没有输入,请您核实',QMessageBox.Yes)
    elif self.gongdan_sptimea_label.text() in ('无', '', None):
        QMessageBox.information(None, self.gongdan_sptimea_label.text(),
                                self.gongdan_sptimea_label.text() + ' 工单号为空,请检查数据', QMessageBox.Yes)
    else:
        ddtj_zidian = '[%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s]' \
                      % (self.gongdan_sptimea_label.text(),
                         self.gongdan_sptimea_label.text(),
                         self.dlyh_danw,
                         self.dl_name,
                         self.dlyh_name,
                         self.dlyh_sjhm,
                         self.gongdan_daleia_label.text(),
                         self.gongdan_zhonga_label.text(),
                         self.gongdan_xiaoleia_label.text(),
                         self.gongdan_jutia_label.text(),
                         self.gongdan_ddspida_label.text(),
                         self.gongdan_ddspnamea_label.text(),
                         self.gongdan_ddcsa_label.text(),
                         self.gongdan_ddjga_label.text(),
                         self.gongdan_spidsa_label.text(),
                         self.gongdan_numa_label.text(),
                         self.gongdan_spnuma_label.text(),
                         self.gongdan_spnotea_label.toPlainText(),
                         '1', self.gongdan_sptimea_label.text())
        haocai_ddtj_fh = self.socket_zhmm('耗材管理', '工单提交', '订单', ddtj_zidian)

        if haocai_ddtj_fh['ZIDUAN3'] in ('工单审批成功'):
            QMessageBox.information(None, haocai_ddtj_fh['ZIDUAN3'], self.gongdan_sptimea_label.text()+' 工单审批通过', QMessageBox.Yes)
            # 加载一下数据,获取行数
            self.hcgddd_Table_add(self.ym_num, '有效')
            self.dd_shangye_click()
            self.gongdan_sptimea_label.setText('无')


def gongdan_ddbh_tj(self):
    if  self.gongdan_sptimea_label.text() in ('无', '', None):
        QMessageBox.information(None, self.gongdan_sptimea_label.text(),
                                self.gongdan_sptimea_label.text() + ' 工单号为空,请检查数据', QMessageBox.Yes)
    else:
        ddtj_zidian = '[%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s]' \
                      % (self.gongdan_sptimea_label.text(),
                         self.gongdan_sptimea_label.text(),
                         self.dlyh_danw,
                         self.dl_name,
                         self.dlyh_name,
                         self.dlyh_sjhm,
                         self.gongdan_daleia_label.text(),
                         self.gongdan_zhonga_label.text(),
                         self.gongdan_xiaoleia_label.text(),
                         self.gongdan_jutia_label.text(),
                         self.gongdan_ddspida_label.text(),
                         self.gongdan_ddspnamea_label.text(),
                         self.gongdan_ddcsa_label.text(),
                         self.gongdan_ddjga_label.text(),
                         self.gongdan_spidsa_label.text(),
                         self.gongdan_numa_label.text(),
                         self.gongdan_spnuma_label.text(),
                         self.gongdan_spnotea_label.toPlainText(),
                         '0', self.gongdan_sptimea_label.text())
        haocai_ddtj_fh = self.socket_zhmm('耗材管理', '工单提交', '订单', ddtj_zidian)

        if haocai_ddtj_fh['ZIDUAN3'] in ('工单审批成功'):
            QMessageBox.information(None, '工单审批驳回', self.gongdan_sptimea_label.text()+' 工单审批驳回', QMessageBox.Yes)
            # 加载一下数据,获取行数
            self.hcgddd_Table_add(self.ym_num, '有效')
            self.sp_shangye_click()
            self.gongdan_sptimea_label.setText('无')



def gongdan_spok_tj(self):
    if self.gongdan_idzs_label.text() in ('无','',None):
        QMessageBox.information(None,self.gongdan_idzs_label.text(), self.gongdan_idzs_label.text() + ' 工单号为空,请检查数据',QMessageBox.Yes)
    else:

        sptj_zidian = '[%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s]' \
                      % (self.gongdan_idzs_label.text(),
                         self.gongdan_sptimea_label.text(),
                         self.dlyh_danw, self.dl_name,
                         self.dlyh_name, self.dlyh_sjhm,
                         self.gongdan_daleia_label.text(),
                         self.gongdan_zhonga_label.text(),
                         self.gongdan_xiaoleia_label.text(),
                         self.gongdan_jutia_label.text(),
                         self.gongdan_numa_label.text(),
                         self.gongdan_spnuma_label.text(),
                         self.gongdan_spnotea_label.toPlainText(),
                         '1',self.gongdan_sptimea_label.text())
        haocai_sptj_fh = self.socket_zhmm('耗材管理', '工单提交', '审批', sptj_zidian)

        if haocai_sptj_fh['ZIDUAN3'] in ('工单审批成功'):
            QMessageBox.information(None, haocai_sptj_fh['ZIDUAN3'], self.gongdan_idzs_label.text()+' 工单审批通过', QMessageBox.Yes)
            # 加载一下数据,获取行数
            self.hcgdsp_Table_add(self.ym_num, '有效')
            self.sp_shangye_click()
            self.gongdan_idzs_label.setText('无')

def gongdan_spbh_tj(self):
    if self.gongdan_idzs_label.text() in ('无','',None):
        QMessageBox.information(None,self.gongdan_idzs_label.text(), self.gongdan_idzs_label.text() + ' 工单号为空,请检查数据',QMessageBox.Yes)
    else:
        sptj_zidian = '[%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s]' \
                      % (self.gongdan_idzs_label.text(),
                         self.gongdan_sptimea_label.text(),
                         self.dlyh_danw, self.dl_name,
                         self.dlyh_name, self.dlyh_sjhm,
                         self.gongdan_daleia_label.text(),
                         self.gongdan_zhonga_label.text(),
                         self.gongdan_xiaoleia_label.text(),
                         self.gongdan_jutia_label.text(),
                         self.gongdan_numa_label.text(),
                         self.gongdan_spnuma_label.text(),
                         self.gongdan_spnotea_label.toPlainText(),
                         '0',self.gongdan_sptimea_label.text())
        haocai_sptj_fh = self.socket_zhmm('耗材管理', '工单提交', '审批', sptj_zidian)

        if haocai_sptj_fh['ZIDUAN3'] in ('工单审批成功'):
            QMessageBox.information(None, '工单审批驳回', self.gongdan_idzs_label.text()+' 工单审批驳回', QMessageBox.Yes)
            # 加载一下数据,获取行数
            self.hcgdsp_Table_add(self.ym_num, '有效')
            self.sp_shangye_click()
            self.gongdan_idzs_label.setText('无')

def lq_shangye_click(self): #确认界面
    if self.ym_num ==0:
        self.hcgdlq_Table_add(self.ym_num)
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
    else:
        self.hcgdlq_Table_add(self.ym_num-1)
        self.ym_num -= 1
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
def lq_xiaye_click(self): #订单界面
    if self.ym_num >=int(self.hcgd_Table_gdsz-1):
        self.hcgdlq_Table_add(self.ym_num)
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
    else:
        self.hcgdlq_Table_add(self.ym_num+1)
        self.ym_num += 1
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))


def qr_shangye_click(self): #确认界面
    if self.ym_num ==0:
        self.hcgdqr_Table_add(self.ym_num)
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
    else:
        self.hcgdqr_Table_add(self.ym_num-1)
        self.ym_num -= 1
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
def qr_xiaye_click(self): #订单界面
    if self.ym_num >=int(self.hcgd_Table_gdsz-1):
        self.hcgdqr_Table_add(self.ym_num)
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
    else:
        self.hcgdqr_Table_add(self.ym_num+1)
        self.ym_num += 1
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))


def dd_shangye_click(self): #订单界面
    if self.ym_num ==0:
        self.hcgddd_Table_add(self.ym_num)
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
    else:
        self.hcgddd_Table_add(self.ym_num-1)
        self.ym_num -= 1
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
def dd_xiaye_click(self): #订单界面
    if self.ym_num >=int(self.hcgd_Table_gdsz-1):
        self.hcgddd_Table_add(self.ym_num)
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
    else:
        self.hcgddd_Table_add(self.ym_num+1)
        self.ym_num += 1
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))


def sp_shangye_click(self): #审批界面
    if self.ym_num ==0:
        self.hcgdsp_Table_add(self.ym_num)
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
    else:
        self.hcgdsp_Table_add(self.ym_num-1)
        self.ym_num -= 1
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
def sp_xiaye_click(self): #审批界面
    if self.ym_num >=int(self.hcgd_Table_gdsz-1):
        self.hcgdsp_Table_add(self.ym_num)
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
    else:
        self.hcgdsp_Table_add(self.ym_num+1)
        self.ym_num += 1
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))



def shangye_click(self):

    if self.ym_num ==0:
        self.hcgd_Table_add(self.ym_num)
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
    else:
        self.hcgd_Table_add(self.ym_num-1)
        self.ym_num -= 1
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
def xiaye_click(self):
    if self.ym_num >=int(self.hcgd_Table_gdsz-1):
        self.hcgd_Table_add(self.ym_num)
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))
    else:
        self.hcgd_Table_add(self.ym_num+1)
        self.ym_num += 1
        self.hcgd_Table_ym.setText('当前页:%s 最大页:%s 工单数:%s' % (str(self.ym_num + 1), str(self.hcgd_Table_gdsz), str(self.hcgd_Table_gds)))

def hcgdhz_Table_add(self,num=0,num_2='有效'):
    hcgd_Table_fk = self.socket_zhmm('耗材管理', '数据汇总', num, num_2)
    self.hcgd_Table_gds =int(hcgd_Table_fk['ZIDUAN2'])
    self.hcgd_Table.setRowCount(self.hcgd_Table_gds)
    #先清理表格数据,然后加载
    self.hcgd_Table.clear()
    hcgd_list_item = ['耗材大类', '耗材中类', '耗材小类', '耗材具体类', '申请工单数', '申请数量', '审批数量', '订单数量', '确认数量', '领取数量']
    self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)

    self.hcgd_Table_fkitem = hcgd_Table_fk['ZIDUAN3'].replace('[', '').replace(']', '').replace("'", "").replace(" ", "").split(",")
    newItem_hs = 0
    for i in self.hcgd_Table_fkitem:
        hcgd_Table_fkitemf=i.replace('(', '').replace(')', '').split("!")
        #print(hcgd_Table_fkitemf)

        if hcgd_Table_fkitemf == ['']:
            hcgd_Table_fkitemf = ['无','无','无','无','无','无','无','无','无','无']

        lie=0
        for a in range(10):
            newItem=QTableWidgetItem(hcgd_Table_fkitemf[a])
            self.hcgd_Table.setItem(newItem_hs,lie,newItem)
            lie += 1
        newItem_hs += 1

def hcgdlq_Table_add(self,num=0,num_2='有效'):
    hcgd_Table_fk = self.socket_zhmm('耗材管理', '区县领取', num, num_2)
    self.hcgd_Table_gds =int(hcgd_Table_fk['ZIDUAN2'])
    #先清理表格数据,然后加载
    self.hcgd_Table.clear()

    hcgd_list_item = ['工单编号', '申请单位', '申请人姓名', '大类', '中类', '小类', '具体名称', '商品编码', '商品名称', '商品厂商',
                      '商品价格','申请数量', '审批数量', '确认时间', '确认意见']
    self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)

    if self.hcgd_Table_gds % 20>=1:
        self.hcgd_Table_gdsz = self.hcgd_Table_gds//20 +1
    else:
        self.hcgd_Table_gdsz = self.hcgd_Table_gds // 20
        #print(hcgd_Table_fk['ZIDUAN3'])
    self.hcgd_Table_fkitem = hcgd_Table_fk['ZIDUAN3'].replace('[', '').replace(']', '').replace("'", "").replace(" ", "").split(",")
    newItem_hs = 0
    for i in self.hcgd_Table_fkitem:
        hcgd_Table_fkitemf=i.replace('(', '').replace(')', '').split("!")
        print(hcgd_Table_fkitemf)

        if hcgd_Table_fkitemf == ['']:
            hcgd_Table_fkitemf = ['无','无','无','无','无','无','无','无','无',
                                '无','无','无','无','无','无','无','无','无']

        lie=0
        for a in [0,2,4,5,6,7,8,9,10,11,12,14,15,16,17]:
            newItem=QTableWidgetItem(hcgd_Table_fkitemf[a])
            self.hcgd_Table.setItem(newItem_hs,lie,newItem)
            lie += 1
        newItem_hs += 1

def hcgdqr_Table_add(self,num=0,num_2='有效'):
    hcgd_Table_fk = self.socket_zhmm('耗材管理', '订单确认', num, num_2)
    self.hcgd_Table_gds =int(hcgd_Table_fk['ZIDUAN2'])
    #先清理表格数据,然后加载
    self.hcgd_Table.clear()
    hcgd_list_item = ['工单编号', '大类', '中类', '小类', '具体名称', '申请数量', '审批数量', '商品编码', '厂商名称', '商品名称']
    self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)

    if self.hcgd_Table_gds % 20>=1:
        self.hcgd_Table_gdsz = self.hcgd_Table_gds//20 +1
    else:
        self.hcgd_Table_gdsz = self.hcgd_Table_gds // 20
        #print(hcgd_Table_fk['ZIDUAN3'])
    self.hcgd_Table_fkitem = hcgd_Table_fk['ZIDUAN3'].replace('[', '').replace(']', '').replace("'", "").replace(" ", "").split(",")
    newItem_hs = 0
    for i in self.hcgd_Table_fkitem:
        hcgd_Table_fkitemf=i.replace('(', '').replace(')', '').split("!")
        print(hcgd_Table_fkitemf)

        if hcgd_Table_fkitemf == ['']:
            hcgd_Table_fkitemf = ['无','无','无','无','无','无','无','无','无',
                                '无','无','无','无','无','无','无','无','无',
                                '无','无','无','无','无','无','无','无','无','无']

        lie=0
        for a in [0,6,7,8,9,10,16,23,25,24]:
            newItem=QTableWidgetItem(hcgd_Table_fkitemf[a])
            self.hcgd_Table.setItem(newItem_hs,lie,newItem)
            lie += 1
        newItem_hs += 1


def hcgddd_Table_add(self,num=0,num_2='有效'):
    hcgd_Table_fk = self.socket_zhmm('耗材管理', '订单生成', num, num_2)
    self.hcgd_Table_gds =int(hcgd_Table_fk['ZIDUAN2'])
    #先清理表格数据,然后加载
    self.hcgd_Table.clear()

    hcgd_list_item = ['大类', '中类', '小类', '具体名称', '涉及工单数量', '申请数量', '审批数量']
    self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)

    if self.hcgd_Table_gds % 20>=1:
        self.hcgd_Table_gdsz = self.hcgd_Table_gds//20 +1
    else:
        self.hcgd_Table_gdsz = self.hcgd_Table_gds // 20
        print(hcgd_Table_fk['ZIDUAN3'])
    self.hcgd_Table_fkitem = hcgd_Table_fk['ZIDUAN3'].replace('[', '').replace(']', '').replace("'", "").replace(" ", "").split(",")

    newItem_hs = 0
    for i in self.hcgd_Table_fkitem:
        hcgd_Table_fkitemf=i.replace('(', '').replace(')', '').split("!")
        print('hcgddd_Table_add',hcgd_Table_fkitemf)
        if hcgd_Table_fkitemf == ['']:
            hcgd_Table_fkitemf = ['无', '无', '无', '无', '无', '无', '无', '无', '无', '无', '无', '无']

        for a in range(7):
            newItem=QTableWidgetItem(hcgd_Table_fkitemf[a])
            self.hcgd_Table.setItem(newItem_hs,a,newItem)
        newItem_hs += 1

def hcgdsp_Table_add(self,num=0,num_2='有效'):
    hcgd_Table_fk = self.socket_zhmm('耗材管理', '工单审批', num, num_2)
    self.hcgd_Table_gds =int(hcgd_Table_fk['ZIDUAN2'])
    #先清理表格数据,然后加载
    self.hcgd_Table.clear()
    #审批 加载表头
    hcgd_list_item = ['工单编号', '申请单位', '大类', '中类', '小类', '具体名称', '申请数量', '备注', '附件']
    self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)

    if self.hcgd_Table_gds % 20>=1:
        self.hcgd_Table_gdsz = self.hcgd_Table_gds//20 +1
    else:
        self.hcgd_Table_gdsz = self.hcgd_Table_gds // 20
    self.hcgd_Table_fkitem = hcgd_Table_fk['ZIDUAN3'].replace('[', '').replace(']', '').replace("'", "").replace(" ", "").split(",")
    newItem_hs = 0
    for i in self.hcgd_Table_fkitem:
        hcgd_Table_fkitemf=i.replace('(', '').replace(')', '').split("!")

        if hcgd_Table_fkitemf == ['']:
            hcgd_Table_fkitemf = ['无','无','无','无','无','无','无','无','无',
                                '无','无','无','无','无','无','无','无','无',
                                '无','无','无','无','无','无','无','无','无','无']
        newItem_ls = 0
        for a in (0,2,4,5,6,7,8,9,10):
            newItem=QTableWidgetItem(hcgd_Table_fkitemf[a])
            self.hcgd_Table.setItem(newItem_hs,newItem_ls,newItem)
            newItem_ls += 1
        newItem_hs += 1

def hcgd_Table_add(self,num=0,num_2='全市'):
    hcgd_Table_fk = self.socket_zhmm('耗材管理', '工单查询', num, num_2)
    self.hcgd_Table_gds =int(hcgd_Table_fk['ZIDUAN2'])
    #先清理表格数据,然后加载
    self.hcgd_Table.clear()
    hcgd_list_item = ['工单编号','申请单位','大类','中类','小类','具体名称','申请数量','审批数量','当前环节']
    self.hcgd_Table.setHorizontalHeaderLabels(hcgd_list_item)
    if self.hcgd_Table_gds % 20>=1:
        self.hcgd_Table_gdsz = self.hcgd_Table_gds//20 +1
    else:
        self.hcgd_Table_gdsz = self.hcgd_Table_gds // 20
    self.hcgd_Table_fkitem = hcgd_Table_fk['ZIDUAN3'].replace('[', '').replace(']', '').replace("'", "").replace(" ", "").split(",")
    newItem_hs = 0
    for i in self.hcgd_Table_fkitem:
        hcgd_Table_fkitemf=i.replace('(', '').replace(')', '').split("!")
        if hcgd_Table_fkitemf ==['']:
            hcgd_Table_fkitemf = ['无','无','无','无','无','无','无','无','无','无']

        for a in range(9):
            newItem=QTableWidgetItem(hcgd_Table_fkitemf[a])
            self.hcgd_Table.setItem(newItem_hs,a,newItem)
        newItem_hs += 1



def piliang_order(self):
    print('批量打开',self.tree.currentItem().text(0))
    if self.tree.currentItem().text(0)=='耗材审批界面':
        print('1111',self.hcgd_Table_fkitem)
        self.sp_plcl_showDialog()

    elif self.tree.currentItem().text(0)=='耗材业支确认':
        print('2222', self.hcgd_Table_fkitem)
        self.qr_plcl_showDialog()

def sp_plcl_showDialog(self):
    dialog = QDialog()
    dialog.setStyleSheet("background-color:rgb(23,252,237,0.6)")
    dialog.setWindowTitle('耗材审批界面')
    dialog.setFixedSize(1000, 600)
    dialog_hlay = QVBoxLayout(self)
    dialog_lay = QGridLayout(self)
    dialog_hlay.addLayout(dialog_lay)

    print('耗材审批界面',len(self.hcgd_Table_fkitem))

    self.hcgl_z_Table = QTableWidget()
    # 表格显示行,列
    self.hcgl_z_Table.setRowCount(len(self.hcgd_Table_fkitem))
    self.hcgl_z_Table.setColumnCount(8)
    hcgd_list_item = ['工单编号', '申请单位', '大类', '中类', '小类', '具体名称', '申请数量','审批数量']
    self.hcgl_z_Table.setHorizontalHeaderLabels(hcgd_list_item)
    self.hcgl_z_Table.resizeColumnsToContents()
    self.hcgl_z_Table.setAlternatingRowColors(True)
    self.hcgl_z_Table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
    # self.hcgd_Table.verticalHeader().setVisible(False)
    # self.hcgd_Table.verticalHeader().setHidden(False)
    # 表格不能被编辑
    self.hcgl_z_Table.setEditTriggers(QAbstractItemView.NoEditTriggers)
    # 选中整行
    self.hcgl_z_Table.setSelectionBehavior(QAbstractItemView.SelectRows)

    dialog_lay.addWidget(self.hcgl_z_Table,0,0)

    newItem_hs = 0
    for item in self.hcgd_Table_fkitem:
        item_list = item.replace('(', '').replace(')', '').split("!")
        if item_list == [] or item_list == ['']:
            item_list = ['','','','','','','','','','','']

        newItem_ls = 0
        for a in (0,2,4,5,6,7,8):
            newItem = QTableWidgetItem(item_list[a])
            self.hcgl_z_Table.setItem(newItem_hs, newItem_ls, newItem)
            newItem_ls += 1

        newItem = QTableWidgetItem(item_list[8])
        self.hcgl_z_Table.setItem(newItem_hs, 7, newItem)

        newItem_hs += 1

    sp_piliang_but = QPushButton('同意')
    sp_piliang_but.setFixedSize(60,30)
    sp_piliang_but.clicked.connect(self.sp_plcl_jincheng)
    sp_piliang_but.clicked.connect(dialog.hide)
    dialog_lay.addWidget(sp_piliang_but, 1, 0)

    dialog.setLayout(dialog_hlay)
    dialog.exec()

def sp_plcl_jincheng(self):
    sp_time = self.get_current_time()

    for item in self.hcgd_Table_fkitem:
        item_list = item.replace('(', '').replace(')', '').split("!")
        print(item_list)

        sptj_zidian = '[%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s]' \
                  % (item_list[0],sp_time,self.dlyh_danw, self.dl_name,
                     self.dlyh_name, self.dlyh_sjhm,
                     item_list[4],item_list[5],item_list[6],item_list[7],
                     item_list[8],item_list[8],'批量处理',
                     '1',sp_time )
        haocai_sptj_fh = self.socket_zhmm('耗材管理', '工单提交', '审批', sptj_zidian)

    # 加载一下数据,获取行数
    self.hcgdsp_Table_add(self.ym_num, '有效')
    self.sp_shangye_click()
    QMessageBox.information(None, haocai_sptj_fh['ZIDUAN3'], sp_time + ' 工单批量审批通过',
                            QMessageBox.Yes)


def qr_plcl_showDialog(self):
    dialog = QDialog()
    dialog.setStyleSheet("background-color:rgb(23,252,237,0.6)")
    dialog.setWindowTitle('耗材业支确认')
    dialog.setFixedSize(1000, 600)
    dialog_hlay = QVBoxLayout(self)
    dialog_lay = QGridLayout(self)
    dialog_hlay.addLayout(dialog_lay)

    print('耗材业支确认',len(self.hcgd_Table_fkitem))
    self.hcgl_z_Table = QTableWidget()
    # 表格显示行,列
    self.hcgl_z_Table.setRowCount(len(self.hcgd_Table_fkitem))
    self.hcgl_z_Table.setColumnCount(8)
    hcgd_list_item = ['工单编号', '申请单位', '大类', '中类', '小类', '具体名称', '申请数量', '审批数量']
    self.hcgl_z_Table.setHorizontalHeaderLabels(hcgd_list_item)
    self.hcgl_z_Table.resizeColumnsToContents()
    self.hcgl_z_Table.setAlternatingRowColors(True)
    self.hcgl_z_Table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
    # self.hcgd_Table.verticalHeader().setVisible(False)
    # self.hcgd_Table.verticalHeader().setHidden(False)
    # 表格不能被编辑
    self.hcgl_z_Table.setEditTriggers(QAbstractItemView.NoEditTriggers)
    # 选中整行
    self.hcgl_z_Table.setSelectionBehavior(QAbstractItemView.SelectRows)

    dialog_lay.addWidget(self.hcgl_z_Table, 0, 0)

    newItem_hs = 0
    for item in self.hcgd_Table_fkitem:
        item_list = item.replace('(', '').replace(')', '').split("!")
        if item_list == [] or item_list == ['']:
            item_list = ['', '', '', '', '', '', '', '', '', '', '']

        newItem_ls = 0
        for a in (0, 2, 6, 7, 8,9,10,16):
            newItem = QTableWidgetItem(item_list[a])
            self.hcgl_z_Table.setItem(newItem_hs, newItem_ls, newItem)
            newItem_ls += 1

        newItem_hs += 1

    sp_piliang_but = QPushButton('同意')
    sp_piliang_but.setFixedSize(60, 30)
    sp_piliang_but.clicked.connect(self.qr_plcl_jincheng)
    sp_piliang_but.clicked.connect(dialog.hide)
    dialog_lay.addWidget(sp_piliang_but, 1, 0)

    dialog.setLayout(dialog_hlay)
    dialog.exec()

def qr_plcl_jincheng(self):
    sp_time = self.get_current_time()

    for item in self.hcgd_Table_fkitem:
        item_list = item.replace('(', '').replace(')', '').split("!")
        print(item_list)

        qrtj_zidian = '[%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s]' \
                      % (item_list[0],sp_time,self.dlyh_danw,self.dl_name,self.dlyh_name,self.dlyh_sjhm,
                         item_list[6],item_list[7],item_list[8],item_list[9],item_list[23],
                         item_list[24],item_list[25],item_list[26],item_list[17],item_list[10],item_list[16],
                         item_list[0],item_list[11],item_list[17],'批量处理','1',sp_time)
        haocai_qrtj_fh = self.socket_zhmm('耗材管理', '工单提交', '确认', qrtj_zidian)

    # 加载一下数据,获取行数
    self.hcgdqr_Table_add(self.ym_num, '有效')
    self.qr_shangye_click()
    QMessageBox.information(None, haocai_qrtj_fh['ZIDUAN3'], sp_time + ' 工单批量确认通过',
                                QMessageBox.Yes)

def Action(self):
    if self.ok_but.isEnabled():
        self.time.start()
        self.ok_but.setEnabled(False)

def Refresh(self):
    if self.count > 0:
        self.ok_but.setText(str(self.count) + '秒后重发')
        self.count -= 1
    else:
        self.time.stop()
        self.ok_but.setText('工单提交')
        self.ok_but.setEnabled(True)
        # 点击发送后 count 重置为30
        self.count = 10

def get_current_time(self):

    ct = time.time()
    local_time = time.localtime(ct)
    data_head = time.strftime("%Y%m%d%H%M%S", local_time)
    data_secs = abs(ct - round(ct)) * 1000
    time_stamp = "%s%03d" % (data_head, data_secs)
    return time_stamp

def openimage(self):
    """图片打开窗体"""
    # "*.jpg;;*.png;;All Files(*)" 是在打开窗体下显示的类型
    #"Excel2003文件,*.xls,Word文件,*.doc,文本文件,*.txt"
    imgName, imgType = QFileDialog.getOpenFileName(self, "打开文件","", "*.xls;*.doc;*.ppt;*.txt;;All Files(*)")
    # 打开文件路径 并被拉伸到窗体显示大小
    self.fujian_label.setText(imgName)
    self.shenqing_day.setText(self.in_time)

def haocai_oktj(self):
    print(self.combo_jtl.currentText())
    #具体类为空报错
    if self.combo_jtl.currentText() is None or self.combo_jtl.currentText()=='':
        QMessageBox.information(None, '服务器反馈', '您的工单:' + self.in_time + ' 申请耗材具体类型未选择,请核实',QMessageBox.Yes)
    else:
        oktj_zidian='[%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%d,%s,%s]' \
                % (self.in_time,self.in_time,self.dlyh_danw,self.dl_name,
                    self.dlyh_name,self.dlyh_sjhm,self.combo_dl.currentText(),
                    self.combo_zl.currentText(),self.combo_xl.currentText(),
                    self.combo_jtl.currentText(),self.sqnum_Edit.value(),
                    self.note_Text_Edit.toPlainText(),self.fujian_label.text())
        haocai_oktj_fh = self.socket_zhmm('耗材管理','工单提交','申请',oktj_zidian)

        if haocai_oktj_fh['ZIDUAN3'] not in (None, '工单创建成功'):
            # print(dlgc_fk['ZIDUAN3'])
            QMessageBox.information(None, haocai_oktj_fh['ZIDUAN3'], haocai_oktj_fh['ZIDUAN3'], QMessageBox.Yes)

        else:
            QMessageBox.information(None, '服务器反馈', '您的工单:'+self.in_time+' '+haocai_oktj_fh['ZIDUAN3'], QMessageBox.Yes)

            #判断如果上传了附件,会将名字替换成工单id号
            if self.fujian_label.text() not in ('附件路径','',None):
                # 服务器信息
                host = self.ip_num
                port = self.port_num
                # 文件传输的缓冲区
                BUFFER_SIZE = 4096
                # 创建连接
                s = socket.socket()
                s.connect((host, port))
                #传递文件到指定目录下
                filename =self.fujian_label.text().replace('/','//')
                # 文件大小
                file_size = os.path.getsize(filename)
                chuandi_tup ='{"leixing":"%s","ziduan1":"%s","ziduan2":"%d","ziduan3":"%s" }' % ('文件传递',filename,file_size,self.in_time)
                s.send(chuandi_tup.encode())
                # 文件传输
                progress = tqdm.tqdm(range(file_size), f"发送{filename}", unit="B", unit_divisor=1024)

                with open(filename, "rb") as f:
                    for _ in progress:
                        # 读取文件
                        bytes_read = f.read(BUFFER_SIZE)
                        if not bytes_read:
                            break
                        # sendall确保及时网络忙碌的时候,数据仍然可以传输
                        s.sendall(bytes_read)
                        progress.update(len(bytes_read))
                # 关闭资源
                s.close()

        self.in_time = self.get_current_time()

def gongdan_fujian_tiqu(self):
    print('文件提取',self.gongdan_idzs_label.text(),self.gongdan_fujiana_label.text())
    if self.gongdan_fujiana_label.text() in ('',None):
        QMessageBox.information(None, self.gongdan_idzs_label.text(), self.gongdan_idzs_label.text()+' 工单没有提交附件', QMessageBox.Yes)
    else:
        import json
        #套接字是对访问的ip地址和端口反馈,需要从开始定好
        tcp_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        tcp_client.connect((self.ip_num, self.port_num))
        gdtq_id=self.gongdan_idzs_label.text()
        gdtq_fjm=self.gongdan_fujiana_label.text()

        msg = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
            '文件提取', gdtq_id, gdtq_fjm, '0')
        tcp_client.send(msg.encode("utf-8"))  # 说话    #
        data = tcp_client.recv(102400)  # 听话
        js_data = json.loads(data.decode('utf-8'))
        print(js_data,type(js_data))

        if js_data['ZIDUAN1'] not in ('',None):
            file_size = int(js_data['ZIDUAN2'])
            print(file_size)
            filename = js_data['ZIDUAN3']
            rece_size = 0
            recv_data = tcp_client.recv(4096)
            if recv_data:#如果获取数据不为空
                with open('./'+ gdtq_id + '_附件_' + filename, "wb")as f:
                    f.write(recv_data)
                    while rece_size < file_size:
                        recv_data = tcp_client.recv(4096)
                        f.write(recv_data)
                        rece_size += len(data)
            # 关闭套接字
            tcp_client.close()
            QMessageBox.information(None, self.gongdan_idzs_label.text(),
                                    self.gongdan_idzs_label.text() + ' 附件已提取到当前文档:'+ gdtq_id + '_附件_' + filename, QMessageBox.Yes)


def fujiandel(self):
    self.fujian_label.setText('')

def zl_addItem(self):
    print(self.combo_dl.currentText())
    zl_fh = self.socket_zhmm('耗材管理', '中类', self.combo_dl.currentText(), time.strftime("%Y%m%d%H%M%S", time.localtime()))
    zl_fh_zfc = zl_fh['ZIDUAN2'].replace('[', '').replace(']', '').replace("'", "").replace(" ", "").split(",")
    self.combo_zl.clear()
    self.combo_zl.addItems(zl_fh_zfc)

def xl_addItem(self):
    print(self.combo_zl.currentText())
    xl_fh = self.socket_zhmm('耗材管理', '小类', self.combo_zl.currentText(), time.strftime("%Y%m%d%H%M%S", time.localtime()))
    xl_fh_zfc = xl_fh['ZIDUAN2'].replace('[', '').replace(']', '').replace("'", "").replace(" ", "").split(",")
    self.combo_xl.clear()
    self.combo_xl.addItems(xl_fh_zfc)

def jtl_addItem(self):
    print(self.combo_xl.currentText())
    jtl_fh = self.socket_zhmm('耗材管理', '具体类型', self.combo_xl.currentText(), time.strftime("%Y%m%d%H%M%S", time.localtime()))
    jtl_fh_zfc = jtl_fh['ZIDUAN2'].replace('[', '').replace(']', '').replace("'", "").replace(" ", "").split(",")
    self.combo_jtl.clear()
    self.combo_jtl.addItems(jtl_fh_zfc)

def tqdm_file(self,file_route):

    SEPARATOR = "<SEPARATOR>"
    # 服务器信息
    host = self.ip_num
    port = self.port_num
    # 文件传输的缓冲区
    BUFFER_SIZE = 4096
    #上传文件名需要转换 replace('/','//') 到 D://szc//PycharmProjects//项目2021//images//数据存储表.xls
    filename =file_route.replace('/','//')
    # 文件大小
    file_size = os.path.getsize(filename)
    # 创建连接
    s = socket.socket()
    # 连接服务器
    s.connect((host,port))
    # 发送文件名与文件大小,必须进行编码处理ENCODE()
    s.send(f"{filename}{SEPARATOR}{file_size}".encode())
    # 文件传输
    progress = tqdm.tqdm(range(file_size), f"发送{filename}", unit="B", unit_divisor=1024)
    with open(filename, "rb") as f:
        for _ in progress:
            # 读取文件
            bytes_read = f.read(BUFFER_SIZE)
            if not bytes_read:
                break
            # sendall确保及时网络忙碌的时候,数据仍然可以传输
            s.sendall(bytes_read)
            progress.update(len(bytes_read))
    # 关闭资源
    s.close()


def socket_zhmm(self, leixing, name_text, hm_text, in_time):
    import socket
    import json
    tcp_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    tcp_client.connect((self.ip_num, self.port_num))

    msg_leixing = str(leixing)
    msg_ziduan1 = str(name_text)
    msg_ziduan2 = str(hm_text)
    msg_ziduan3 = str(in_time)


    if None == name_text:
        print('与服务器断开连接')
    msg = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
        msg_leixing, msg_ziduan1, msg_ziduan2, msg_ziduan3)
    # print(msg)

    tcp_client.send(msg.encode("utf-8"))  # 说话    #
    data = tcp_client.recv(102400)  # 听话
    print('服务器反馈:', data.decode('utf-8'))
    js_data = json.loads(data.decode('utf-8'))
    tcp_client.close()
    return js_data

def socket_zjcd(self, note):
    import socket
    import json
    tcp_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    tcp_client.connect((self.ip_num,self.port_num))

    msg_leixing = str(note)

    msg = msg_leixing
    print(msg)

    tcp_client.send(msg.encode("utf-8"))  # 说话    #
    data = tcp_client.recv(102400)  # 听话
    print('服务器反馈:', data.decode('utf-8'))
    js_data = json.loads(data.decode('utf-8'))
    tcp_client.close()
    return js_data


def fy_close(self):
    self.zym = AbnormityWindow()
    self.zym.show()
    self.hide()

if name == “main”:
app = QApplication(sys.argv)
form = AbnormityWindow()
form.show()
sys.exit(app.exec_())

-------服务端

-- coding: utf-8 --

import socketserver
import json
import pymysql
import socket
import os
import tqdm

class MyServer(socketserver.BaseRequestHandler):
def handle(self):
print(‘conn is:’,self.request)
print(‘addr is:’,self.client_address)
while True:
try:
data = self.request.recv(102400)

            if not data:break
            data = data.decode('utf-8')

            print('收到客户端的消息是:',data,self.client_address)
            js_data = json.loads(data)

            #类型1登录
            if str(js_data['leixing'])=='1':
                #关联Excel表里 用户名密码 是否存在
                sql='SELECT a.STAFF_ID,a.PASS,a.STAFF_NAME,a.SERVNUMBER,a.DEP,group_concat(c.user_js_type separator "|") ids FROM hcgl_staff_user a,hcgl_staff_work_group b,hcgl_staff_group_type c where a.STAFF_ID=b.STAFF_ID and b.ROLEID=c.user_js and a.STAFF_ID="%s" and a.PASS="%s" group by a.STAFF_ID,a.PASS,a.STAFF_NAME,a.SERVNUMBER,a.DEP' % (js_data['ziduan1'],js_data['ziduan2'])
                num = self.mysql_execute(sql,'多条')
                try:
                    num_len=len(num)
                except:
                    num_len=0
                print(num_len)
                if num_len >= 1:
                    try:
                        num_new = str(num).replace('(','').replace(')','').replace("'","").replace(" ","").split(",")
                    except:
                        num_new = ['','','','','','','']

                    data='{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s","ziduan4":"%s","ziduan5":"%s","ziduan6":"%s","ziduan7":"%s"  }' %(
                            '类型1',js_data['ziduan1'],js_data['ziduan2'],'用户名密码正确',num_new[2],num_new[3],num_new[4],num_new[5])

                    #break
                elif num_len == 0:
                    sql = 'SELECT * FROM HCGL_STAFF_USER where STAFF_ID="%s"' % (js_data['ziduan1'])
                    numa = self.mysql_execute(sql, '数量')
                    try:
                        num_lena = len(numa)
                    except:
                        num_lena = 0

                    if num_lena >= 1 or numa >= 1 :
                        data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                        '类型1', js_data['ziduan1'], js_data['ziduan2'], '用户名密码错误')


                    else:
                        data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                            '类型1', js_data['ziduan1'], js_data['ziduan2'], '用户名不存在')

            #类型2 注册新用户
            elif str(js_data['leixing'])=='2':
                sql = 'SELECT * FROM HCGL_STAFF_USER where STAFF_ID="%s"' % (js_data['ziduan1'])
                num = self.mysql_execute(sql, '数量')

                if num >=1:
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                            '类型1', js_data['ziduan1'], js_data['ziduan2'], '用户名已存在')
                    break
                else:
                    sql = "insert into HCGL_STAFF_USER (STAFF_ID,STAFF_NAME,PASS,DEP) values('%s','%s','%s','%s') " % (
                        self.STAFF_ID, self.STAFF_NAME, self.PASS, self.DEP)

                    data ='{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                            '类型1', js_data['ziduan1'], js_data['ziduan2'], '用户名新建成功')

            # 类型3 忘记密码
            elif str(js_data['leixing']) == '3':
                sql = 'SELECT * FROM HCGL_STAFF_USER where STAFF_ID="%s"' % js_data['ziduan1']
                num = self.mysql_execute(sql, '数量')

                if num < 1 or num == None:
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                        '密码找回', js_data['ziduan1'], js_data['ziduan2'], '用户名不存在')
                else:
                    sql = 'SELECT pass FROM HCGL_STAFF_USER where STAFF_ID="%s" and SERVNUMBER="%s"' % (
                    js_data['ziduan1'], js_data['ziduan2'])
                    try:
                        num = self.mysql_execute(sql, '单条')
                    except:
                        num = '手机号码错误'
                    print(num)
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                        '密码找回', js_data['ziduan1'], num, '密码找回')


            elif str(js_data['leixing']) == '耗材管理':

                if js_data['ziduan1'] in('大类') :
                    sql = 'SELECT haocai_fenlei FROM haocai_type where haocai_type="%s"' % (js_data['ziduan1'])
                    num = self.mysql_execute(sql, '多条')
                    num_list=[]
                    for i in num:
                        num_new = str(i).replace('(', '').replace(')', '').replace("'", "").replace(" ", "").split(
                        ",")
                        num_new.pop()
                        num_list.append(num_new)
                    print(num_list)
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s" }' % (
                        '耗材管理', js_data['ziduan1'], num_list)
                elif js_data['ziduan1'] in('中类','小类','具体类型'):

                    sql = 'SELECT haocai_fenlei FROM haocai_type where haocai_type="%s" and haocai_dalei="%s"' % (js_data['ziduan1'],js_data['ziduan2'])
                    num = self.mysql_execute(sql, '多条')
                    num_list = []
                    for i in num:
                        num_new = str(i).replace('(', '').replace(')', '').replace("'", "").replace(" ", "").split(
                            ",")
                        num_new.pop()
                        num_list.append(num_new)
                    print(num_list)
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s" }' % (
                        '耗材管理', js_data['ziduan1'], num_list)

                elif js_data['ziduan1'] == '工单提交':
                    if js_data['ziduan2'] == '申请':
                        gdtj_sq = js_data['ziduan3'].replace('[', '').replace(']', '').split(",")

                        sql = "insert into hcgl_work_order (id,in_time,DEP,STAFF_ID,STAFF_NAME,SERVNUMBER,haocai_dalei,haocai_zhonglei,haocai_xiaolei,haocai_jutilei,num,note,fujian_lujing,state,state_time) values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','1','%s') " % (
                        gdtj_sq[0],gdtj_sq[1],gdtj_sq[2],gdtj_sq[3],gdtj_sq[4],gdtj_sq[5],gdtj_sq[6],gdtj_sq[7],gdtj_sq[8],gdtj_sq[9],gdtj_sq[10],gdtj_sq[11],gdtj_sq[12],gdtj_sq[0])
                        num = self.mysql_execute(sql, '编辑')

                        data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                            '耗材管理', js_data['ziduan1'], js_data['ziduan2'], '工单创建成功')

                    elif js_data['ziduan2'] == '审批':
                        gdtj_sq = js_data['ziduan3'].replace('[', '').replace(']', '').split(",")

                        sql = "insert into hcgl_work_order_approval (sqgd_id,sp_time,DEP,STAFF_ID,STAFF_NAME,SERVNUMBER,haocai_dalei,haocai_zhonglei,haocai_xiaolei,haocai_jutilei,sq_num,sp_num,sp_note,state,state_time) values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s') " % (
                            gdtj_sq[0], gdtj_sq[1], gdtj_sq[2], gdtj_sq[3], gdtj_sq[4], gdtj_sq[5], gdtj_sq[6],
                            gdtj_sq[7], gdtj_sq[8], gdtj_sq[9], gdtj_sq[10], gdtj_sq[11], gdtj_sq[12], gdtj_sq[13], gdtj_sq[14])
                        num = self.mysql_execute(sql, '编辑')

                        data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                            '耗材管理', js_data['ziduan1'], js_data['ziduan2'], '工单审批成功')

                    #订单生成界面
                    elif js_data['ziduan2'] == '订单':
                        gdtj_sq = js_data['ziduan3'].replace('[', '').replace(']', '').split(",")
                        print(gdtj_sq[14].split("|"))
                        for i in range(len(gdtj_sq[14].split("|"))):
                            print(i,gdtj_sq[14].split("|")[i])
                            sql = "insert into hcgl_work_order_generate (generate_id,dd_time,DEP,STAFF_ID,STAFF_NAME,SERVNUMBER,haocai_dalei,haocai_zhonglei,haocai_xiaolei,haocai_jutilei,haocai_id,haocai_name,haocai_changshang,haocai_jiage,spgd_ids,sq_num,sp_num,dd_note,state,state_time) values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s') " % (
                            gdtj_sq[0], gdtj_sq[1], gdtj_sq[2], gdtj_sq[3], gdtj_sq[4], gdtj_sq[5], gdtj_sq[6],
                            gdtj_sq[7], gdtj_sq[8], gdtj_sq[9], gdtj_sq[10], gdtj_sq[11], gdtj_sq[12], gdtj_sq[13],
                            gdtj_sq[14].split("|")[i],gdtj_sq[15],gdtj_sq[16],gdtj_sq[17],gdtj_sq[18],gdtj_sq[19])
                            num = self.mysql_execute(sql, '编辑')

                        data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                            '耗材管理', js_data['ziduan1'], js_data['ziduan2'], '工单审批成功')

                    # 业支确认界面
                    elif js_data['ziduan2'] == '确认':
                        gdtj_sq = js_data['ziduan3'].replace('[', '').replace(']', '').split(",")
                        print(gdtj_sq)
                        print('业支确认界面')

                        sql = "insert into hcgl_work_order_confirm (id,confirm_time,DEP,STAFF_ID,STAFF_NAME,SERVNUMBER,haocai_dalei,haocai_zhonglei,haocai_xiaolei,haocai_jutilei,haocai_id,haocai_name,haocai_changshang,haocai_jiage,dd_pcid,sq_num,sp_num,first_time,approval_time,generate_time,confirm_note,state,state_time) values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s') " % (
                            gdtj_sq[0], gdtj_sq[1], gdtj_sq[2], gdtj_sq[3], gdtj_sq[4], gdtj_sq[5], gdtj_sq[6],
                            gdtj_sq[7], gdtj_sq[8], gdtj_sq[9], gdtj_sq[10], gdtj_sq[11], gdtj_sq[12],
                            gdtj_sq[13],gdtj_sq[14], gdtj_sq[15], gdtj_sq[16], gdtj_sq[17], gdtj_sq[18],
                            gdtj_sq[19],gdtj_sq[20], gdtj_sq[21], gdtj_sq[22])
                        num = self.mysql_execute(sql, '编辑')

                        data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                            '耗材管理', js_data['ziduan1'], js_data['ziduan2'], '工单审批成功')

                    # 业支确认界面
                    elif js_data['ziduan2'] == '领取':
                        gdtj_sq = js_data['ziduan3'].replace('[', '').replace(']', '').split(",")
                        print(gdtj_sq)
                        print('区县领取界面')

                        sql = "insert into hcgl_work_order_receive (id,receive_time,DEP,STAFF_ID,STAFF_NAME,SERVNUMBER,note,fujian_lujing,state,state_time) values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')" % (
                            gdtj_sq[0], gdtj_sq[1], gdtj_sq[2], gdtj_sq[3], gdtj_sq[4], gdtj_sq[5], gdtj_sq[6],
                            gdtj_sq[7], gdtj_sq[8], gdtj_sq[9])
                        num = self.mysql_execute(sql, '编辑')

                        data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                            '耗材管理', js_data['ziduan1'], js_data['ziduan2'], '工单审批成功')


                    # 订单号查询内容
                    elif js_data['ziduan2'] == '订单号':
                        gdtj_sq = js_data['ziduan3']
                        gdtj_sqnum =len(gdtj_sq)
                        sql = 'SELECT a.hczy_id,a.hczy_name,a.hczy_fee,a.hczy_supplier from haocai_commodity a where substr(a.hczy_id,1,%d) = "%s"' % (gdtj_sqnum, gdtj_sq)
                        num_tuple = self.mysql_execute(sql, '多条')
                        try:
                            num_list =list(num_tuple[0])
                        except:
                            num_list = ['无', '无', '0.00', '无']
                            print('aaaaa')

                        data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%s","ziduan3":"%s" }' % (
                            '耗材管理', js_data['ziduan1'], js_data['ziduan2'], num_list)

                # 数据汇总
                elif js_data['ziduan1'] == '数据汇总':
                    yema = int(js_data['ziduan2'])  # 获取选择第几页 0页显示0-19
                    sql = 'SELECT a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,count(DISTINCT a.id) ids,sum(a.num) nums,sum(IFNULL(case when IFNULL(a.sp_zt,0)=1 then a.sp_num end,0)) spnum,sum(IFNULL(case when IFNULL(a.dd_zt,0)=1 then a.sp_num end,0)) ddnum,sum(IFNULL(case when IFNULL(a.qr_zt,0)=1 then a.sp_num end,0)) qrnum,sum(IFNULL(case when IFNULL(a.lq_zt,0)=1 then a.sp_num end,0)) lqnum from (SELECT a.id,a.in_time,a.DEP sq_DEP,a.STAFF_ID sq_STAFF_ID,a.STAFF_NAME sq_STAFF_NAME,a.SERVNUMBER sq_SERVNUMBER,a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,a.num,b.sp_time,b.DEP sp_DEP,b.STAFF_ID sp_STAFF_ID,b.STAFF_NAME sp_STAFF_NAME,b.SERVNUMBER sp_SERVNUMBER,b.sp_num,b.state sp_zt,c.generate_id,c.dd_time,c.DEP dd_DEP,c.STAFF_ID dd_STAFF_ID,c.STAFF_NAME dd_STAFF_NAME,c.SERVNUMBER dd_SERVNUMBER,c.haocai_id,c.haocai_name,c.haocai_changshang,c.haocai_jiage,c.dd_note,c.state dd_zt,d.confirm_time,d.dep qr_dep,d.STAFF_ID qr_STAFF_ID,d.STAFF_NAME qr_STAFF_NAME,d.SERVNUMBER qr_SERVNUMBER,d.confirm_note,d.state qr_zt,e.receive_time,e.DEP lq_DEP,e.STAFF_ID lq_STAFF_ID,e.STAFF_NAME lq_STAFF_NAME,e.SERVNUMBER lq_SERVNUMBER,e.fujian_lujing,e.state lq_zt,ifnull(case when ifnull(b.state,0)=0 then "审批未结束" when ifnull(c.state,0)=0 then "订单未结束" when ifnull(d.state,0)=0 then "确认未结束" when ifnull(e.state,0)=0 then "领取未结束" end,"领取完成") dq_zt,row_number() OVER(order by a.id desc) as row_num from hcgl_work_order a left join hcgl_work_order_approval b on a.id=b.sqgd_id left join hcgl_work_order_generate c on a.id=c.spgd_ids left join hcgl_work_order_confirm d on a.id=d.id left join hcgl_work_order_receive e on a.id=e.id where a.state=1 ) a group by a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei'
                    num = self.mysql_execute(sql, '数量')
                    print(num)
                    hcgd_Table_fk = []  # 反馈列表集合


                    sql = 'SELECT a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,count(DISTINCT a.id) ids,sum(a.num) nums,sum(IFNULL(case when IFNULL(a.sp_zt,0)=1 then a.sp_num end,0)) spnum,sum(IFNULL(case when IFNULL(a.dd_zt,0)=1 then a.sp_num end,0)) ddnum,sum(IFNULL(case when IFNULL(a.qr_zt,0)=1 then a.sp_num end,0)) qrnum,sum(IFNULL(case when IFNULL(a.lq_zt,0)=1 then a.sp_num end,0)) lqnum from (SELECT a.id,a.in_time,a.DEP sq_DEP,a.STAFF_ID sq_STAFF_ID,a.STAFF_NAME sq_STAFF_NAME,a.SERVNUMBER sq_SERVNUMBER,a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,a.num,b.sp_time,b.DEP sp_DEP,b.STAFF_ID sp_STAFF_ID,b.STAFF_NAME sp_STAFF_NAME,b.SERVNUMBER sp_SERVNUMBER,b.sp_num,b.state sp_zt,c.generate_id,c.dd_time,c.DEP dd_DEP,c.STAFF_ID dd_STAFF_ID,c.STAFF_NAME dd_STAFF_NAME,c.SERVNUMBER dd_SERVNUMBER,c.haocai_id,c.haocai_name,c.haocai_changshang,c.haocai_jiage,c.dd_note,c.state dd_zt,d.confirm_time,d.dep qr_dep,d.STAFF_ID qr_STAFF_ID,d.STAFF_NAME qr_STAFF_NAME,d.SERVNUMBER qr_SERVNUMBER,d.confirm_note,d.state qr_zt,e.receive_time,e.DEP lq_DEP,e.STAFF_ID lq_STAFF_ID,e.STAFF_NAME lq_STAFF_NAME,e.SERVNUMBER lq_SERVNUMBER,e.fujian_lujing,e.state lq_zt,ifnull(case when ifnull(b.state,0)=0 then "审批未结束" when ifnull(c.state,0)=0 then "订单未结束" when ifnull(d.state,0)=0 then "确认未结束" when ifnull(e.state,0)=0 then "领取未结束" end,"领取完成") dq_zt,row_number() OVER(order by a.id desc) as row_num from hcgl_work_order a left join hcgl_work_order_approval b on a.id=b.sqgd_id left join hcgl_work_order_generate c on a.id=c.spgd_ids left join hcgl_work_order_confirm d on a.id=d.id left join hcgl_work_order_receive e on a.id=e.id where a.state=1 ) a group by a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei'
                    num_list = self.mysql_execute(sql, '多条')
                    print('11', num_list)
                    for i in range(len(num_list)):
                        try:
                            num_new = str(num_list[i]).replace('(', '').replace(')', '').replace("'",
                                                                                                 "").replace(
                                " ", "").split(",")
                        except:
                            num_new = ['', '', '', '', '', '', '', '', '', '']
                        Table_item = '(%s!%s!%s!%s!%s!%s!%s!%s!%s!%s)' % (
                            num_new[0], num_new[1], num_new[2], num_new[3], str(num_new[4]), str(num_new[5]),
                            str(num_new[6]), str(num_new[7]), str(num_new[8]), str(num_new[9]))
                        print(Table_item)
                        hcgd_Table_fk.append(Table_item)
                    print(hcgd_Table_fk)
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%d","ziduan3":"%s" }' % (
                        '耗材管理', js_data['ziduan1'], num, hcgd_Table_fk)

                # 区县领取
                elif js_data['ziduan1'] == '区县领取':
                    yema = int(js_data['ziduan2']) #获取选择第几页 0页显示0-19
                    sql = 'SELECT a.id FROM hcgl_work_order as a where a.state=1 and EXISTS (SELECT t.id from hcgl_work_order_confirm t where t.id = a.id) and not EXISTS (SELECT t.id from hcgl_work_order_receive t where t.id = a.id)'
                    num = self.mysql_execute(sql, '数量')
                    print(num)
                    hcgd_Table_fk = []  # 反馈列表集合

                    #如果总工单数大于选择页起点加20,只显示20
                    if num - yema * 20 >= 20:
                        ids = 20
                    #否则显示可以显示的数量
                    else:
                        ids = num - yema * 20

                    sql = 'SELECT * from (SELECT a.id,a.in_time,a.DEP,a.STAFF_ID,a.STAFF_name,a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,b.haocai_id,b.haocai_name,b.haocai_changshang,b.haocai_jiage,b.dd_pcid,a.num,b.sp_num,b.confirm_time,b.confirm_note,row_number() OVER(order by a.id desc) as row_num FROM hcgl_work_order a left join hcgl_work_order_confirm b On a.id=b.id where a.state=1 and b.state=1 and EXISTS (SELECT t.id from hcgl_work_order_confirm t where t.id = a.id) and not EXISTS (SELECT t.id from hcgl_work_order_receive t where t.id = a.id)) a where row_num>%d and row_num<=%d order by id desc' % (yema * 20,ids +yema * 20)
                    print('num')
                    num_list = self.mysql_execute(sql, '多条')
                    print('11',num_list)
                    for i in range(len(num_list)):
                        try:
                            num_new = str(num_list[i]).replace('(', '').replace(')', '').replace("'", "").replace(" ","").split(",")
                        except:
                            num_new =['','','','','','','','','','','','','','','','','','','','']
                        Table_item = '(%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s)' % (
                            num_new[0], num_new[1], num_new[2], num_new[3], num_new[4], num_new[5],
                            num_new[6], num_new[7], num_new[8], num_new[9], num_new[10],
                            num_new[11], num_new[12], num_new[13], num_new[14], num_new[15],
                            num_new[16], num_new[17])
                        print(Table_item)
                        hcgd_Table_fk.append(Table_item)
                    print(hcgd_Table_fk)
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%d","ziduan3":"%s" }' % (
                        '耗材管理', js_data['ziduan1'], num, hcgd_Table_fk)

                elif js_data['ziduan1'] == '订单确认':
                    yema = int(js_data['ziduan2']) #获取选择第几页 0页显示0-19
                    sql = 'SELECT a.id FROM hcgl_work_order as a where a.state=1 and EXISTS (SELECT t.spgd_ids from hcgl_work_order_generate t where t.spgd_ids = a.id) and not EXISTS (SELECT t.id from hcgl_work_order_confirm t where t.id = a.id)'
                    num = self.mysql_execute(sql, '数量')
                    print(num)
                    hcgd_Table_fk = []  # 反馈列表集合

                    #如果总工单数大于选择页起点加20,只显示20
                    if num - yema * 20 >= 20:
                        ids = 20
                    #否则显示可以显示的数量
                    else:
                        ids = num - yema * 20
                    sql = 'SELECT * from (SELECT a.id,a.in_time,a.DEP sq_DEP,a.STAFF_ID sq_STAFF_ID,a.STAFF_NAME sq_STAFF_NAME,a.SERVNUMBER sq_SERVNUMBER,a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,a.num,b.sp_time,b.DEP sp_DEP,b.STAFF_ID sp_STAFF_ID,b.STAFF_NAME sp_STAFF_NAME,b.SERVNUMBER sp_SERVNUMBER,b.sp_num,c.generate_id,c.dd_time,c.DEP,c.STAFF_ID,c.STAFF_NAME,c.SERVNUMBER,c.haocai_id,c.haocai_name,c.haocai_changshang,c.haocai_jiage,c.dd_note,row_number() OVER(order by a.id desc) as row_num FROM hcgl_work_order a left join hcgl_work_order_approval b on a.id=b.sqgd_id left join hcgl_work_order_generate c on a.id=c.spgd_ids where a.state=1 and b.state=1 and c.state=1 and not exists (select 1 from hcgl_work_order_confirm t where t.id=a.id)) a where row_num>%d and row_num<=%d order by id desc' % (yema * 20,ids +yema * 20)
                    print(js_data['ziduan3'])
                    num_list = self.mysql_execute(sql, '多条')
                    print('11',num_list)
                    for i in range(len(num_list)):
                        try:
                            num_new = str(num_list[i]).replace('(', '').replace(')', '').replace("'", "").replace(" ","").split(",")
                        except:
                            num_new = ['','','','','','','','','','','','','','','','','','','','','','','','','','','','','','']

                        Table_item = '(%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s)' % (
                            num_new[0], num_new[1], num_new[2], num_new[3], num_new[4], num_new[5],
                            num_new[6], num_new[7], num_new[8], num_new[9], num_new[10],
                            num_new[11], num_new[12], num_new[13], num_new[14], num_new[15],
                            num_new[16], num_new[17], num_new[18], num_new[19], num_new[20],
                            num_new[21], num_new[22], num_new[23], num_new[24], num_new[25],
                            num_new[26], num_new[27])
                        # print(Table_item)
                        hcgd_Table_fk.append(Table_item)
                    print(hcgd_Table_fk)
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%d","ziduan3":"%s" }' % (
                        '耗材管理', js_data['ziduan1'], num, hcgd_Table_fk)


                elif js_data['ziduan1'] == '订单生成':
                    yema = int(js_data['ziduan2']) #获取选择第几页 0页显示0-19
                    sql = 'SELECT haocai_jutilei from (SELECT a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,sum(a.num) num,sum(b.sp_num) sp_num,group_concat(a.id separator ",") ids from hcgl_work_order a,hcgl_work_order_approval b where a.id=b.sqgd_id and b.state=1 and a.state=1 and not exists (select 1 from hcgl_work_order_generate t where t.spgd_ids=a.id) group by a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei) a'
                    num = self.mysql_execute(sql, '数量')
                    print(num)
                    hcgd_Table_fk = []  # 反馈列表集合

                    #如果总工单数大于选择页起点加20,只显示20
                    if num - yema * 20 >= 20:
                        ids = 20
                    #否则显示可以显示的数量
                    else:
                        ids = num - yema * 20

                    sql = 'SELECT a.* from(SELECT a.*,row_number() OVER(order by haocai_jutilei desc) as row_num from (SELECT a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,sum(a.num) num,sum(b.sp_num) sp_num,group_concat(a.id separator "|") ids from hcgl_work_order a,hcgl_work_order_approval b where a.id=b.sqgd_id and b.state=1 and a.state=1 and not exists (select 1 from hcgl_work_order_generate t where t.spgd_ids=a.id) group by a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei)a ) a where row_num>%d and row_num<=%d order by haocai_jutilei desc' % (yema * 20,ids +yema * 20)

                    num_list = self.mysql_execute(sql, '多条')
                    print('11',num_list)
                    for i in range(len(num_list)):
                        try:
                            num_new = str(num_list[i]).replace('(', '').replace(')', '').replace("'", "").replace(" ","").split(",")
                        except:
                            num_new = ['','','','','','','','','']
                        Table_item = '(%s!%s!%s!%s!%s!%s!%s)' % (
                            num_new[0],num_new[1],num_new[2],num_new[3],str(num_new[4]),str(num_new[5]),num_new[6])
                        print('22',Table_item)
                        hcgd_Table_fk.append(Table_item)
                    print(hcgd_Table_fk)
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%d","ziduan3":"%s" }' % (
                        '耗材管理', js_data['ziduan1'], num, hcgd_Table_fk)

                elif js_data['ziduan1'] == '工单审批':
                    yema = int(js_data['ziduan2']) #获取选择第几页 0页显示0-19
                    sql = 'SELECT a.id FROM hcgl_work_order as a where a.state=1 and NOT EXISTS (SELECT id FROM hcgl_work_order_approval as b where b.sqgd_id = a.id)'

                    num = self.mysql_execute(sql, '数量')
                    hcgd_Table_fk = []  # 反馈列表集合

                    #如果总工单数大于选择页起点加20,只显示20
                    if num - yema * 20 >= 20:
                        ids = 20
                    #否则显示可以显示的数量
                    else:
                        ids = num - yema * 20

                    sql = 'SELECT a.id,substr(a.in_time,1,14) in_time,a.DEP,a.STAFF_NAME,a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,a.num,a.note,a.fujian_lujing,a.row_num from(SELECT a.id,a.in_time,a.DEP,a.STAFF_NAME,a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,a.num,a.note,a.fujian_lujing,row_number() OVER(order by a.id desc) as row_num FROM hcgl_work_order a where a.state=1 and NOT EXISTS (SELECT id FROM hcgl_work_order_approval as b where b.sqgd_id = a.id)) a where row_num>%d and row_num<=%d order by id desc' % (yema * 20,ids +yema * 20)

                    num_list = self.mysql_execute(sql, '多条')

                    for i in range(len(num_list)):
                        try:
                            num_new = str(num_list[i]).replace('(', '').replace(')', '').replace("'", "").replace(" ","").split(",")
                        except:
                            num_new = ['','','','','','','','','','','','','']
                        Table_item = '(%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s)' % (
                            num_new[0],num_new[1],num_new[2],num_new[3],num_new[4],num_new[5],
                            num_new[6], num_new[7], num_new[8], num_new[9], num_new[10])
                        # print(Table_item)
                        hcgd_Table_fk.append(Table_item)
                    print(22222)
                    print(hcgd_Table_fk)
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%d","ziduan3":"%s" }' % (
                        '耗材管理', js_data['ziduan1'], num, hcgd_Table_fk)

                elif js_data['ziduan1'] == '工单查询':
                    yema = int(js_data['ziduan2']) #获取选择第几页 0页显示0-19
                    if js_data['ziduan3']=='全市':
                        sql = 'SELECT id FROM hcgl_work_order where state=1'
                    else:
                        sql = 'SELECT id FROM hcgl_work_order where dep="%s"' % js_data['ziduan3']
                    num = self.mysql_execute(sql, '数量')
                    hcgd_Table_fk = []  # 反馈列表集合

                    #如果总工单数大于选择页起点加20,只显示20
                    if num - yema * 20 >= 20:
                        ids = 20
                    #否则显示可以显示的数量
                    else:
                        ids = num - yema * 20

                    if js_data['ziduan3'] == '全市':
                        sql = 'SELECT * from (SELECT a.id,a.in_time,a.DEP sq_DEP,a.STAFF_ID sq_STAFF_ID,a.STAFF_NAME sq_STAFF_NAME,a.SERVNUMBER sq_SERVNUMBER,a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,a.num,b.sp_time,b.DEP sp_DEP,b.STAFF_ID sp_STAFF_ID,b.STAFF_NAME sp_STAFF_NAME,b.SERVNUMBER sp_SERVNUMBER,b.sp_num,b.state sp_zt,c.generate_id,c.dd_time,c.DEP dd_DEP,c.STAFF_ID dd_STAFF_ID,c.STAFF_NAME dd_STAFF_NAME,c.SERVNUMBER dd_SERVNUMBER,c.haocai_id,c.haocai_name,c.haocai_changshang,c.haocai_jiage,c.dd_note,c.state dd_zt,d.confirm_time,d.dep qr_dep,d.STAFF_ID qr_STAFF_ID,d.STAFF_NAME qr_STAFF_NAME,d.SERVNUMBER qr_SERVNUMBER,d.confirm_note,d.state qr_zt,e.receive_time,e.DEP lq_DEP,e.STAFF_ID lq_STAFF_ID,e.STAFF_NAME lq_STAFF_NAME,e.SERVNUMBER lq_SERVNUMBER,e.fujian_lujing,e.state lq_zt,ifnull(case when ifnull(b.state,0)=0 then "审批未结束" when ifnull(c.state,0)=0 then "订单未结束" when ifnull(d.state,0)=0 then "确认未结束" when ifnull(e.state,0)=0 then "领取未结束" end,"领取完成") dq_zt,row_number() OVER(order by a.id desc) as row_num from hcgl_work_order a left join hcgl_work_order_approval b on a.id=b.sqgd_id left join hcgl_work_order_generate c on a.id=c.spgd_ids left join hcgl_work_order_confirm d on a.id=d.id left join hcgl_work_order_receive e on a.id=e.id where a.state=1) a where row_num>%d and row_num<=%d order by id desc' % (
                        yema * 20, ids + yema * 20)
                    else:
                        sql = 'SELECT * from (SELECT a.id,a.in_time,a.DEP sq_DEP,a.STAFF_ID sq_STAFF_ID,a.STAFF_NAME sq_STAFF_NAME,a.SERVNUMBER sq_SERVNUMBER,a.haocai_dalei,a.haocai_zhonglei,a.haocai_xiaolei,a.haocai_jutilei,a.num,b.sp_time,b.DEP sp_DEP,b.STAFF_ID sp_STAFF_ID,b.STAFF_NAME sp_STAFF_NAME,b.SERVNUMBER sp_SERVNUMBER,b.sp_num,b.state sp_zt,c.generate_id,c.dd_time,c.DEP dd_DEP,c.STAFF_ID dd_STAFF_ID,c.STAFF_NAME dd_STAFF_NAME,c.SERVNUMBER dd_SERVNUMBER,c.haocai_id,c.haocai_name,c.haocai_changshang,c.haocai_jiage,c.dd_note,c.state dd_zt,d.confirm_time,d.dep qr_dep,d.STAFF_ID qr_STAFF_ID,d.STAFF_NAME qr_STAFF_NAME,d.SERVNUMBER qr_SERVNUMBER,d.confirm_note,d.state qr_zt,e.receive_time,e.DEP lq_DEP,e.STAFF_ID lq_STAFF_ID,e.STAFF_NAME lq_STAFF_NAME,e.SERVNUMBER lq_SERVNUMBER,e.fujian_lujing,e.state lq_zt,ifnull(case when ifnull(b.state,0)=0 then "审批未结束" when ifnull(c.state,0)=0 then "订单未结束" when ifnull(d.state,0)=0 then "确认未结束" when ifnull(e.state,0)=0 then "领取未结束" end,"领取完成") dq_zt,row_number() OVER(order by a.id desc) as row_num from hcgl_work_order a left join hcgl_work_order_approval b on a.id=b.sqgd_id left join hcgl_work_order_generate c on a.id=c.spgd_ids left join hcgl_work_order_confirm d on a.id=d.id left join hcgl_work_order_receive e on a.id=e.id where a.state=1 and a.DEP="%s") a where row_num>%d and row_num<=%d order by id desc' % (
                        js_data['ziduan3'], yema * 20, ids + yema * 20)
                    print(js_data['ziduan3'])
                    num_list = self.mysql_execute(sql, '多条')

                    for i in range(len(num_list)):
                        print(num_list[i])
                        try:
                            num_new = str(num_list[i]).replace('(', '').replace(')', '').replace("'", "").replace(" ","").split(",")
                        except:
                            num_new =['','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',
                                      '','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',
                                      '','','','','','','','','','','','','','','','','','','','','','','','','','']
                        Table_item = '(%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s!%s)' % (
                            num_new[0],num_new[2],num_new[6],num_new[7],num_new[8],num_new[9],
                            num_new[10], num_new[16], num_new[44],#基础数据
                            num_new[3],num_new[4],num_new[5],num_new[11],num_new[12],num_new[13],
                            num_new[14],num_new[15],num_new[17],num_new[18],num_new[20],num_new[21],num_new[22],
                            num_new[23],num_new[24],num_new[25],num_new[26],num_new[27],num_new[29],
                            num_new[30],num_new[31],num_new[32],num_new[33],num_new[34],num_new[36],
                            num_new[37],num_new[38],num_new[39],num_new[40],num_new[41],num_new[43],num_new[44],num_new[42])
                        # print(Table_item)
                        hcgd_Table_fk.append(Table_item)
                    print(222)
                    print(hcgd_Table_fk)
                    data = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%d","ziduan3":"%s" }' % (
                        '耗材管理', js_data['ziduan1'], num, hcgd_Table_fk)




            elif str(js_data['leixing'])=='文件传递':

                # 传输数据分割符
                SEPARATOR = "<SEPARATOR>"
                # 文件传输的缓冲区
                BUFFER_SIZE = 4096
                # 接受客户端信息
                #received = self.client_address.recv(BUFFER_SIZE).decode()
                # 接受客户端信息
                filename, file_size,new_filename = js_data['ziduan1'],js_data['ziduan2'],js_data['ziduan3']
                # 获取文件的名字
                filename = os.path.basename(filename)
                file_size = int(file_size)

                if os.path.isfile(filename):
                    f = open('./file_server/file_work_order/'+new_filename, "wb")
                else:
                    f = open('./file_server/file_work_order/'+new_filename, "wb")
                rece_size = 0
                while rece_size < file_size:
                    data = self.request.recv(1024)
                    f.write(data)
                    rece_size += len(data)
                else:
                    data = '{"leixing":"%s","ziduan1":"%s" }' % ('文件传递', '传递完成')



            elif str(js_data['leixing']) == '文件提取':
                filename ='.//file_server//file_work_order//'+js_data['ziduan1']
                print('mingzi',filename)
                file_size = os.path.getsize(filename)
                print('daxiao',file_size)
                # 文件传输的缓冲区
                BUFFER_SIZE = 4096
                # 创建连接
                chuandi_tup = '{"leixing":"%s","ziduan1":"%s","ziduan2":"%d","ziduan3":"%s" }' % (
                '文件提取', js_data['ziduan1'], file_size, js_data['ziduan2'])
                self.request.sendall(chuandi_tup.upper().encode('utf-8'))

                # 文件传输
                progress = tqdm.tqdm(range(file_size), f"发送{filename}", unit="B", unit_divisor=1024)

                with open(filename, "rb") as f:
                    for _ in progress:
                        # 读取文件
                        bytes_read = f.read(BUFFER_SIZE)
                        if not bytes_read:
                            break
                        # sendall确保及时网络忙碌的时候,数据仍然可以传输
                        self.request.sendall(bytes_read)
                        progress.update(len(bytes_read))

                # 关闭资源
                self.request.close()
                data = '{"leixing":"%s","ziduan1":"%s" }' % ('文件提取', '传递完成')

            self.request.sendall(data.upper().encode('utf-8'))
        except Ellipsis as e:
            print(e)
            break

def mysql_execute(self,in_sql,leixing):
    # 登录数据库
    conn = pymysql.connect(host='127.0.0.1', port=3306, user='szc', password='szcNSP850219', database='szc_sql',charset='utf8')
    # 得到一个可以执行SQL语句的光标对象
    cursor = conn.cursor()
    #数据库执行导入的语句
    if leixing == '数量':
        # 反馈数量
        count = cursor.execute(in_sql)
    elif leixing == '单条':
        # 反馈单条
        cursor.execute(in_sql)
        count = cursor.fetchone()[0]
    elif leixing == '多条':
        # 反馈多条
        cursor.execute(in_sql)
        count = cursor.fetchall()
    elif leixing == '编辑':
        count = cursor.execute(in_sql)
        conn.commit()

    # 关闭光标对象
    cursor.close()
    # 关闭数据库连接
    conn.close()
    # 反馈
    return count

if name == ‘main’:
s=socketserver.ThreadingTCPServer((‘127.0.0.1’,7528),MyServer)
s.serve_forever()#类似实现连接循环

上一篇:Element dialog实现拖拽功能


下一篇:Element ui Dialog 对话框 组件