Дипломная работа: Автоматизация учета предоставленных услуг в комплексном центре социального обслуживания населения и анализа данных на примере СПБ ГБУСОН "КЦСОН Адмиралтейского района Санкт-Петербурга"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
141
INSERT INTO `kcson`.`category` (`id`, `category`, `archive`, `prim`, `total`, `subof`) VALUES (14, ' ', NULL, NULL,
NULL, 1);
INSERT INTO `kcson`.`category` (`id`, `category`, `archive`, `prim`, `total`, `subof`) VALUES (1, '', 0, '
 (,,,, )', NULL, NULL);
INSERT INTO `kcson`.`category` (`id`, `category`, `archive`, `prim`, `total`, `subof`) VALUES (2, '', 0, '
 (,,)', NULL, 1);
INSERT INTO `kcson`.`category` (`id`, `category`, `archive`, `prim`, `total`, `subof`) VALUES (11, '', NULL, NULL, NULL, 2);
INSERT INTO `kcson`.`category` (`id`, `category`, `archive`, `prim`, `total`, `subof`) VALUES (12, '', NULL, NULL, NULL, 2);
COMMIT;
-- -----------------------------------------------------
-- Data for table `kcson`.`job`
-- -----------------------------------------------------
START TRANSACTION;
USE `kcson`;
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (DEFAULT, '  ', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (2, ' ', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (3, ' ', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (4, '', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (5, '', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (6, '', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (7, '', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (8, '', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (9, '  ', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (10, ' ', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (11, ' ', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (12, '   ', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (13, '', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (14, '  ', '');
INSERT INTO `kcson`.`job` (`id`, `job`, `prim`) VALUES (15, ' ', NULL);
COMMIT;
-- -----------------------------------------------------
-- Data for table `kcson`.`dep_has_worker`
-- -----------------------------------------------------
START TRANSACTION;
USE `kcson`;
INSERT INTO `kcson`.`dep_has_worker` (`id`, `worker_id`, `dep_id`, `job_id`, `name`, `prim`, `archive`, `from`, `till`) VALUES
(1, 1, 1, 1, ' ', NULL, 0, NULL, NULL);
COMMIT;
-- -----------------------------------------------------
-- Data for table `kcson`.`setting`
-- -----------------------------------------------------
START TRANSACTION;
USE `kcson`;
INSERT INTO `kcson`.`setting` (`id`, `archive`, `setting`, `value`, `prim`, `sdate`) VALUES (DEFAULT, 0, '', '
 \"   -\"', NULL, DEFAULT);
COMMIT;
-- -----------------------------------------------------
-- Data for table `kcson`.`jobGroup`
-- -----------------------------------------------------
START TRANSACTION;
USE `kcson`;
INSERT INTO `kcson`.`jobGroup` (`id`, `jobGroup`, `prim`) VALUES (1, '   ', NULL);
COMMIT;
-- -----------------------------------------------------
-- Data for table `kcson`.`dep_has_ripso`
-- -----------------------------------------------------
START TRANSACTION;
USE `kcson`;
INSERT INTO `kcson`.`dep_has_ripso` (`dep_id`, `ripso_id`) VALUES (1, 1);
COMMIT;
-- -----------------------------------------------------
-- Data for table `kcson`.`live_min`
-- -----------------------------------------------------
START TRANSACTION;
USE `kcson`;
142
INSERT INTO `kcson`.`live_min` (`id`, `lmdate`, `live_min_p`, `live_min_w`, `live_min_c`, `post`, `post_date`) VALUES (1,
'18.06.2019', 11074.1, 12472.1, 9221.7, NULL, NULL);
COMMIT;
ПРИЛОЖЕНИЕ Б ТЕКСТ ОСНОВНОГО ПРОГРАММНОГО
МОДУЛЕЙ КЛИЕНТА АИС ТРИУСОН
#!/usr/bin/python3
# -------------------------------------------------------------------------------
# -*- coding: utf-8 -*-
# Name: AIS 3USON Main QT Frontend
# Purpose:
#
# Author: Alex Savin
# Created: 2019
# Copyright: Alex Savin
# Licence: LGPL 3
# This software is licensed under the "LGPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/lgpl-3.0.html
# -------------------------------------------------------------------------------
SQL_DATE_FORMAT = "yyyy-MM-dd"
VERSION = 1
import configparser
import sys
from typing import NoReturn
from logging import handlers
#############################
# For money
# ---------------------------
import decimal
decimal.getcontext().prec = 2
#############################
# switch QT binding
# ---------------------------
# import os
# os.environ['QT_API'] = "pyside2"
# os.environ['QT_API'] = "pyqt5"
#############################
# QT Libraries
# ---------------------------
from qtpy import QtGui, uic
from qtpy.QtCore import *
from custumQWidgets import *
# from mainWindow_pysides2 import *
# from login_dialog_pyside2 import *
modules = list(sys.modules.keys()) # TODO: filter
if "PyQt5" in modules:
debug("loading PyQt5")
from mainWindow_pyqt5 import Ui_MainWindow
elif "PySide2" in modules:
143
debug("loading PySides2")
from mainWindow_pyside2 import Ui_MainWindow
else:
debug("really? Qt not found: %s ", modules)
try:
# if Q_OS_LINUX:
import subprocess
subprocess.run('uic.sh', shell=True)
# vcredist_x86.exe /q:a /c:"VCREDI~1.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "
# msiexec /i c:\path\to\package.msi /quiet /qn /norestart /log c:\path\to\install.log PROPERTY1=value1
PROPERTY2=value2
except:
pass
#############################
# setup logger
# ---------------------------
def LoggerSet():
"""Return: debug, info, warning, error, critical - functions of new logger"""
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# create file handler
fh = logging.FileHandler('3uson.log')
fh.setLevel(logging.INFO)
# create console handler
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
# create formatter and add it to the handlers
formatter = logging.Formatter('%(asctime)s - %(name)s - %(lineno)-4s - %(levelname)s - %(message)s')
formatter1 = logging.Formatter('%(lineno)-4s-%(levelname).1s-%(message)s')
fh.setFormatter(formatter)
ch.setFormatter(formatter1)
# rotate logs
logrotate = handlers.RotatingFileHandler(
fh.baseFilename, maxBytes=500000, backupCount=5)
# add the handlers to logger
logger.addHandler(logrotate)
logger.addHandler(fh)
logger.addHandler(ch)
logger.info("logget set")
# make logger static var
LoggerSet.l = logger
l = logger
return l.debug, l.info, l.warning, l.error, l.critical
debug, info, warning, error, critical = LoggerSet()
class allEventFilter(QObject):
def __init__(self, parent):
self.parent = parent
super().__init__(parent)
def eventFilter(self, qobj, event):
ui = self.parent.ui
parent = self.parent
if event.type() == QEvent.MouseButtonRelease:
144
if qobj is ui.menu_settings:
if isinstance(qobj, QtWidgets.QMenu):
if qobj.activeAction():
aName = qobj.activeAction().objectName()
if aName == "qaFontSmaller" or aName == "qaFontBigger":
qobj.activeAction().trigger()
return True
return super().eventFilter(qobj, event)
class MyApp(QtWidgets.QMainWindow): # , Ui_MainWindow
parent: QWidget
def __init__(self, parent=None):
# QtWidgets.QMainWindow.__init__(self)
super(MyApp, self).__init__(parent)
self._dirty = False
self.data = TsonData()
self.qsettings = QSettings("AIS 3USON", "MyApp")
# self.config = self.data.config
self.login_done = False
data = self.data
self.tablesRTModel = {}
self.tableList = {}
#############################
# load QSettins
# ---------------------------
self.font_size = self.font().pointSize()
self.readQSetting()
#############################
# loading UI files
# ---------------------------
self.ui: Ui_MainWindow = uic.loadUi("MainWindow.ui", self)
self.dlg = uic.loadUi("login_dialog.ui")
ui = self.ui
dlg = self.dlg
dlg.user.setText(data.user)
dlg.password.setText(data.password)
#############################
# ui setups
# ---------------------------
# self.FontG = QtWidgets.QActionGroup(self)
# fg = self.FontG
ui = self.ui
#############################
# setup Icons TODO: add resources
# ---------------------------
ui.action_undo.setIcon(
QtGui.QIcon.fromTheme("edit-undo",
self.style().standardIcon(QtWidgets.QStyle.SP_ArrowBack)))
ui.action_redo.setIcon(
QtGui.QIcon.fromTheme("edit-redo",
self.style().standardIcon(QtWidgets.QStyle.SP_ArrowRight)))
ui.action_discard.setIcon(
QtGui.QIcon.fromTheme("document-revert",
self.style().standardIcon(QtWidgets.QStyle.SP_DialogDiscardButton)))
ui.action_save.setIcon(
QtGui.QIcon.fromTheme("document-save",
self.style().standardIcon(QtWidgets.QStyle.SP_DialogSaveButton)))
145
#############################
# action default state
# ---------------------------
ui.action_undo.setEnabled(False)
ui.action_redo.setEnabled(False)
ui.action_discard.setEnabled(False)
ui.action_save.setEnabled(False)
#############################
# connect signals and slots
# ---------------------------
self.make_connections()
# QMetaObject.connectSlotsByName(self)
ef = allEventFilter(self)
ui.menu_settings.installEventFilter(ef)
#############################
# Inner state
# ---------------------------
def isDirty(self):
return self._dirty
def setDirty(self, dirty=True):
self._dirty = dirty
ui = self.ui
ui.action_discard.setEnabled(dirty)
ui.action_save.setEnabled(dirty)
# TODO:activate edit options here
@Slot(str)
def on_qle_fio_filter_textChanged(self, text: str):
ui = self.ui
tr = self.tr
if text:
ui.label_fio_filter.setText(tr(" :"))
mdl = self.data.setFilterCol(ui.table_dep_has_ufio, "ufio")
mdl.setFilterFixedString(text)
else:
ui.label_fio_filter.setText(tr(" :"))
try:
ui.table_dep_has_ufio.model().setFilterFixedString("")
except:
warning("not filtered model for table_dep_has_ufio")
#############################
# toolBar and menu
# ---------------------------
@Slot()
def on_action_QT_triggered(self):
debug("TEST CODE")
try:
# self.ui.table_serv.
r = self.data.models['serv'].record()
for fi in range(0, r.count()):
debug(" %s %s", r.fieldName(fi), r.field(fi).type())
except:
pass
QMessageBox.aboutQt(self)
Источник: https://baza.diplomsite.ru/previewfile/2412