def cargoDel(self, cargoid): 'Удаление товарной позиции из документа' try: cg = self.dbExec(sql="select * from cargo cg where cg.cargoid=?",params=(cargoid,),fetch='one') self.dbExec(sql="delete from cargo cg where cg.cargoid=?",params=(cargoid,),fetch='none') logWrite('cargoDel',ext_params={'docid':str(cg['DOCUMENT']),'waresid':str(cg['WARESID'])}) except Exception, exc: return self.pyDumps({'errMes':exc[1]}) return self.pyDumps(ext_data={'cargoid':cargoid})
def docAdd(self, doctid, docdate, realdocdate, docnum=None, descript=None, docsubtype=None, fromobj=None, toobj=None, throughobj=None): 'Создание документа' fromobj = self.cInt(fromobj) throughobj = self.cInt(throughobj) toobj = self.cInt(toobj) if docsubtype=='null': docsubtype = None if not docnum: docnum = None try: doc=self.dbExecC(sql="select * from K_DOCCREATE_DOCMAN(?,?,?,?,?,?,?,?,?,?,?,?)",fetch='one', params=(fromobj,throughobj,toobj,None,doctid,docdate,realdocdate,docnum,None,descript,None,docsubtype)) except Exception, exc: return self.pyDumps({'errMes':exc[1]}) logWrite(code='docAdd',ext_params={'docid':doc['docid'],'fromobj':fromobj,'toobj':toobj,'doctid':doctid,'docdate':docdate,'realdocdate':realdocdate,'docnum':docnum,'descript':descript,'docsubtype':docsubtype}) return self.listDocs(docid=doc['docid'],doctype=doctid)
def docBuyReturn(self, **args): 'Возврат документа' docid = self.cInt(args['docid']) fromobj = self.cInt(args['fromobj']) throughobj = self.cInt(args['throughobj']) toobj = self.cInt(args['toobj']) docnum = args['docnum'] docdate = args['docdate'] realdocdate = args['realdocdate'] descript = args['descript'] if not docnum: docnum = None try: doc=self.dbExecC(sql="select * from K_DOCMANAG_BUYRETURN(?,?,?,?,?,?,?,?,?)",fetch='one', params=(docid,fromobj,throughobj,toobj,docdate,realdocdate,docnum,None,descript)) except Exception, exc: return self.pyDumps({'errMes':exc[1]}) logWrite(code='docBuyReturn',ext_params={'fromdoc':docid,'docid':doc['docid'],'fromobj':fromobj,'toobj':toobj,'docdate':docdate,'realdocdate':realdocdate,'docnum':docnum,'descript':descript}) return self.pyDumps({'DOCID':doc['docid']})
def docCopy(self, **args): 'Клонирование документа' docid = self.cInt(args['docid']) fromobj = self.cInt(args['fromobj']) throughobj = self.cInt(args['throughobj']) toobj = self.cInt(args['toobj']) docnum = args['docnum'] docdate = args['docdate'] realdocdate = args['realdocdate'] descript = args['descript'] if not docnum: docnum = None try: doc=self.dbExecC(sql="select * from K_DOCMANAG_COPYDOC(?,?,?,?,?,?,?,?,?)",fetch='one', params=(docid,fromobj,throughobj,toobj,docdate,realdocdate,docnum,None,descript)) except Exception, exc: return self.pyDumps({'errMes':exc[1]}) logWrite(code='docCopy',ext_params={'fromdoc':docid,'docid':doc['docid'],'fromobj':fromobj,'toobj':toobj,'docdate':docdate,'realdocdate':realdocdate,'docnum':docnum,'descript':descript}) return self.listDocs(docid=doc['docid'],doctype=self.dbExecC(sql="select * from document where docid=?",fetch='one',params=[doc['docid']])['DOCTYPE'])
getPrintData.exposed = True def editAmountLot(self, wliid, amount, code, pdate, barcode): 'Редактирование количества на партии' try: self.dbExec(sql="execute procedure K_SITE_LOT_AMOUNT_EDIT(?,?)", params=(wliid, amount), fetch='none') except FBExc, exc: return self.pyDumps({'errMes': exc[1]}) else: logWrite(code='editAmountLot', ext_params={ 'code': code, 'pdate': pdate, 'palletbarcode': barcode, 'fio': self.getUserVar('userfio') }) return self.pyDumps(ext_data={'WLIID': wliid}) editAmountLot.exposed = True def deleteSite(self, siteid, barcode): 'Удаление местоположения' try: self.dbExec(sql="execute procedure K_SITE_DEL(?)", params=(siteid, ), fetch='none') except FBExc, exc: return self.pyDumps({'errMes': exc[1]})
set = settings.settingsRead() # ODCZYT NASTAW Z PLIKU temp_zad1_F = set[0] temp_zad2_F = set[1] histereza_F = set[2] time_sleep_F = set[3] run = set[4] temperatura = read_temp() # ODCZYT SENSORA local_time = loc_time() # ODCZYT DATY data = local_time[1] godzina = local_time[2] relayMesage = relay.relay(pin, temperatura, temp_zad1_F, histereza_F) # WYSTEROWANIE WYJSCIA # WYDRUK POMIARU if temperatura > temp_zad1_F and temperatura < temp_zad2_F: color = '\x1b[1;32;40m' message = ' ' + relayMesage else: color = '\x1b[1;31;40m' if temperatura < temp_zad1_F: message = '!!! Temp. poniżej dolnej granicy !!! ' + relayMesage elif temperatura > temp_zad2_F: message = '!!! Temp. powyzej górnej granicy !!! ' + relayMesage print(godzina + ' ' + color + str(temperatura) + '°C ' + message + '\x1b[0m') # ZAPIS POMIARU log_no = log.logWrite(data, godzina, temperatura, temp_zad1_F, relayMesage, log_no) time.sleep(time_sleep_F) GPIO.cleanup() print('\t!!! Koniec programu !!! \n')