def Open(self, SQLStr): if isinstance(SQLStr, str): sSQLStr = [] sSQLStr.append(SQLStr) SQLStr = sSQLStr self._split_stringSQL(SQLStr) N_str = len(SQLStr) isPROC = SQLStr[0].split(' ') is_proc = isPROC[0] == 'CREATE' and isPROC[1] == 'PROC' if self.IdCon > 0 and N_str > 0: aTEMP = k3.VarArray(N_str) for i in range(N_str): aTEMP[i].value = SQLStr[i] if is_proc: k3.adbdiagnoz(0) self.idRS= k3.adbopen(self.IdCon,aTEMP,N_str) if is_proc: k3.adbdiagnoz(1) if is_proc: self.Close() self.idRS= k3.adbopen(self.IdCon,'SELECT * FROM '+isPROC[2]) f1 = k3.adbmovefirst(self.idRS) if k3.adbiseof(self.idRS) < 1: l1 = k3.adbmovelast(self.idRS) f2 = k3.adbmovefirst(self.idRS) self.count = self.getRecCount() self.fldcount = self.getFldCount() self.getFldStructure()
def get_nomenclature_property(self): """Определяем список доступных имен (идентификаторов) свойств номенклатуры""" NGuides = DataBase_ACCESS() NGuides.adbCon(2) sqlstr = ["""SELECT NProperties.Ident FROM NProperties;"""] rs = NGuides.RecordSetOpen(sqlstr) lrs = [] if rs.count > 0: k3.adbmovefirst(rs.idRS) while k3.adbiseof(rs.idRS) == 0: lrs.append(k3.adbgetvalue(rs.idRS, 'Ident', '0')) k3.adbmovenext(rs.idRS) rs.Close() NGuides.adbDisCon() return lrs
def get_proto_property(con, id_proto): """Определяем список свойств прототипа""" sqlstr = [ """SELECT TProtoPar.ParName, TProtoPar.ParPrompt, TProtoCategory.Category, TProtoCategory.ID AS IDCategory FROM TProtoCategory INNER JOIN TProtoPar ON TProtoCategory.ID = TProtoPar.CategoryID WHERE (((TProtoPar.ProtoID)=""" + str(int(id_proto)) + """)) ORDER BY TProtoPar.ParName;""" ] rs = con.RecordSetOpen(sqlstr) lrs = [] if rs.count > 0: k3.adbmovefirst(rs.idRS) while k3.adbiseof(rs.idRS) == 0: lrs.append([ k3.adbgetvalue(rs.idRS, 'ParName', '0'), k3.adbgetvalue(rs.idRS, 'ParPrompt', '0'), k3.adbgetvalue(rs.idRS, 'Category', '0'), k3.adbgetvalue(rs.idRS, 'IDCategory', 0) ]) k3.adbmovenext(rs.idRS) rs.Close() return lrs
}, } } for gr in dGroup: IDGr = 0 try: # Проверка на наличие группы умолчания SQLStr = "SELECT ID, Name FROM udCategory WHERE Query=\"{}\"".format( gr) RS = base.RecordSetOpen(SQLStr) if round(RS.count) != 1: # Максимальный ID группы RS1 = base.RecordSetOpen( "SELECT max(b.ID) AS maxID FROM udCategory b") k3.adbmovefirst(RS1.idRS) IDGr = int(k3.adbgetvalue(RS1.idRS, "maxID")) IDGr += 1 SQL = '''INSERT into udCategory (ID, Name, Query, ParentID, Sort) SELECT top 1 {0}, '{1}', '{2}', NULL, (SELECT max(c.Sort) from udCategory c WHERE c.ParentID is Null)+1 FROM udCategory a WHERE ParentID is Null'''.format(IDGr, dGroupName.get(gr, "None"), gr) base.RecordSetModify(SQL) print("Создали") KeyReLoad = True RS1.Close() else: k3.adbmovefirst(RS.idRS) IDGr = int(k3.adbgetvalue(RS.idRS, "ID"))
if side == 5: checkDecor('A', IDGroup) if side == 6: checkDecor('F', IDGroup) if side == -1: checkDecor('A', IDGroup) checkDecor('F', IDGroup) if IDGroup not in nGroups: zp1 = "SELECT Name FROM TProtoParType WHERE ID={}".format( IDGroup) indrs = k3.adbopen(k3.adbcon(2), zp1) total_s1 = k3.adbreccount(indrs) if total_s1 > 0: err = k3.adbmovefirst(indrs) nGroups[IDGroup] = k3.adbgetvalue( indrs, "Name", 0) else: nGroups[IDGroup] = "" i += 1 dPans['A'] = lGDecA dPans['F'] = lGDecF Shpon = False isMDF = False isDSP = False priceid = k3.getattr(obj, 'priceid', 0) parentid = k3.priceinfo(priceid, 'ParentID', 0, 1) pid = parentid if parentid > 0 else priceid