コード例 #1
0
ファイル: db_query.py プロジェクト: POISON-B/Study-Notes
def create_project(k, value):
    """
    创建项目

    :param value: 项目信息
    :param k: 项目名
    :return: None
    """
    uuid = gen_uuid_for_db()
    uuid = judge_uuid(uuid, projectInfo_domain_query)
    project = db_projectInfo(uuid=uuid,
                             name=k,
                             address=value['project_address'],
                             latitude=value['ln_la']['lat'],
                             longitude=value['ln_la']['lng'],
                             province=value['project_province'],
                             city=value['project_city'],
                             country=value['project_country'],
                             createBy=CREATE_BY,
                             createAt=datetime.now().date())

    db_session.add(project)
    db_session.commit()

    return {k: uuid}
コード例 #2
0
ファイル: db_query.py プロジェクト: POISON-B/Study-Notes
def create_yertime(evid, value, wbid):
    """
    电梯年检时间查询 添加 更新

    :param evid: 电梯uuid
    :param value: 电梯信息
    :param wbid: 维保单位uuid
    :return:
    """
    year_time = db_year_time_query.filter_by(evId=evid, companyId=wbid).first()
    if year_time:
        year_time.evId = evid,
        year_time.fileId = CREATE_BY,
        year_time.companyId = wbid,
        year_time.date = value['lastAnnualDate']

    else:
        uuid = gen_uuid_for_db()
        uuid = judge_uuid(uuid, db_ev_records_query)
        time = db_Time(uuid=uuid,
                       evId=evid,
                       fileId=CREATE_BY,
                       companyId=wbid,
                       date=value['lastAnnualDate'])
        db_session.add(time)
    db_session.commit()
コード例 #3
0
ファイル: db_query.py プロジェクト: POISON-B/Study-Notes
def create_lift_fu_conf(evid, value):
    """
    扶梯参数信息

    :param evid: 电梯uuid
    :param value: 扶梯参数
    :return:
    """
    info = db_es_conf_query.filter_by(evId=evid).first()
    if info:
        info.nominalSpeed = value['lift_parameter']['nominalSpeed'] or None
        info.nominalWidth = value['lift_parameter']['nominalWidth'] or None
        info.inclinationAngle = value['lift_parameter'][
            'inclinationAngle'] or None
        info.transforAbility = value['lift_parameter'][
            'transforAbility'] or None
        info.liftingHeight = value['lift_parameter']['liftingHeight'] or None
        info.length = value['lift_parameter']['length'] or None
        info.power = value['lift_parameter']['power'] or None
    else:
        uuid = gen_uuid_for_db()
        uuid = judge_uuid(uuid, db_ev_conf_query)
        confi_fu = db_EsConf(
            uuid=uuid,
            evId=evid,
            nominalSpeed=value['lift_parameter']['nominalSpeed'],
            nominalWidth=value['lift_parameter']['nominalWidth'],
            inclinationAngle=value['lift_parameter']['inclinationAngle'],
            transforAbility=value['lift_parameter']['transforAbility'],
            liftingHeight=value['lift_parameter']['liftingHeight'],
            length=value['lift_parameter']['length'],
            power=value['lift_parameter']['power'],
        )
        db_session.add(confi_fu)
    db_session.commit()
コード例 #4
0
ファイル: db_query.py プロジェクト: POISON-B/Study-Notes
def create_lift_zhi_conf(evid, value):
    """
    直梯参数信息

    :param evid: 电梯uuid
    :param value:  直梯参数
    :return:
    """
    info = db_ev_conf_query.filter_by(evId=evid).first()
    if info:
        info.floors = value['lift_parameter']['floors'] or None
        info.station = value['lift_parameter']['station'] or None
        info.door = value['lift_parameter']['door'] or None
        info.maxLoad = value['lift_parameter']['maxLoad'] or None
        info.speed = value['lift_parameter']['speed'] or None
    else:
        uuid = gen_uuid_for_db()
        uuid = judge_uuid(uuid, db_ev_conf_query)
        confi_zhi = db_EvConf(
            uuid=uuid,
            evId=evid,
            actuationForm=value['lift_parameter']['actuationForm'],
            floors=value['lift_parameter']['floors'],
            station=value['lift_parameter']['station'],
            door=value['lift_parameter']['door'],
            maxLoad=value['lift_parameter']['maxLoad'],
            speed=value['lift_parameter']['speed'])
        db_session.add(confi_zhi)
    db_session.commit()
コード例 #5
0
ファイル: db_query.py プロジェクト: POISON-B/Study-Notes
def create_lift(k, value, project):
    """
    创建电梯信息基本
    :param k: 项目名
    :param value: 电梯信息
    :param project: 项目uuid信息
    :return:
    """
    uuid = gen_uuid_for_db()
    uuid = judge_uuid(uuid, db_ev_query)
    lift = db_Ev(
        uuid=uuid,
        projectId=project[k][k],
        brandId=value['brandId'],
        regCode=value['regCode'],
        useFor=value['useFor'],
        type=value['useFor'],
        deviceNumber=value['deviceNumber'],
        manufacturer=value['manufacturer'],
        productionDate=value['productionDate'],
        productionNumber=value['productionNumber'],
        modelNumber=value['modelNumber'],
        evOrder=value['evOrder'],
        createAt=datetime.now().date(),
        createBy=CREATE_BY,
        status=0,
        userLock=2,
    )

    db_session.add(lift)
    db_session.commit()

    return uuid
コード例 #6
0
ファイル: db_query.py プロジェクト: POISON-B/Study-Notes
def create_time_remind(evid, temid):
    """
    保养提醒

    :param evid: 电梯uuid
    :param temid: 默认班组uuid
    :return:
    """
    remind_info = db_remind_query.filter_by(evId=evid, teamid=temid).first()
    if remind_info:
        remind_info.evId = evid
        remind_info.teamid = temid
        remind_info.remind = 0

    else:
        uuid = gen_uuid_for_db()
        uuid = judge_uuid(uuid, db_remind_query)
        ev_remind = db_ev_remind(uuid=uuid, evId=evid, teamid=temid, remind=0)
        db_session.add(ev_remind)
        db_session.commit()
コード例 #7
0
ファイル: db_query.py プロジェクト: POISON-B/Study-Notes
def create_lift_yei_conf(evid, value):
    """
    液压梯参数信息

    :param evid: 电梯uuid
    :param value: 液压梯参数
    :return:
    """
    info = db_eh_conf_query.filter_by(evId=evid).first()
    if info:
        info.floors = value['lift_parameter']['floors'] or None
        info.station = value['lift_parameter']['station'] or None
        info.door = value['lift_parameter']['door'] or None
        info.maxLoad = value['lift_parameter']['maxLoad'] or None
        info.speedUp = value['lift_parameter']['speed'] or None
        info.speedDown = value['lift_parameter']['speedDown'] or None
        info.hydraulicCylinder = value['lift_parameter'][
            'hydraulicCylinder'] or None
        info.jackingType = value['lift_parameter']['jackingType'] or None
    else:
        uuid = gen_uuid_for_db()
        uuid = judge_uuid(uuid, db_ev_conf_query)
        confi_yei = db_EhConf(
            uuid=uuid,
            evId=evid,
            actuationForm=value['lift_parameter']['actuationForm'],
            floors=value['lift_parameter']['floors'],
            station=value['lift_parameter']['station'],
            door=value['lift_parameter']['door'],
            maxLoad=value['lift_parameter']['maxLoad'],
            speedUp=value['lift_parameter']['speed'],
            speedDown=value['lift_parameter']['speedDown'],
            hydraulicCylinder=value['lift_parameter']['hydraulicCylinder'],
            jackingType=value['lift_parameter']['jackingType'],
        )
        db_session.add(confi_yei)
    db_session.commit()
コード例 #8
0
ファイル: db_query.py プロジェクト: POISON-B/Study-Notes
def create_wb(evid, value, wbid):
    """
    添加维保单位

    :param evid: 电梯uuid
    :param value: 电梯信息
    :param wbid: 维保单位uuid
    :return:
    """
    info = db_ev_records_query.fiert_by(evId=evid, companyId=wbid,
                                        status=0).first()
    if not info:
        uuid = gen_uuid_for_db()
        uuid = judge_uuid(uuid, db_ev_records_query)
        we_bao = db_ev_records(uuid=uuid,
                               fileNumber=CREATE_BY,
                               companyId=wbid,
                               evId=evid,
                               startTime=datetime.now().date(),
                               status=0,
                               lastAnnualDate=value['lastAnnualDate'])

        db_session.add(we_bao)
        db_session.commit()