def taskLWares(self, tid, wid, barcode=None, mes=None, view='diff'): params = {'mes': mes, 'view': view} if barcode: params['mes'] = _('Неверный ШК') bcInfo = self.kBarCodeInfo(barcode) if bcInfo and bcInfo['result'] == 0: if bcInfo['usercode'] == 'PALLET': raise HTTPRedirect('taskLPallet?tid=%s&pid=%s&wid=%s' % (tid, bcInfo['recordid'], wid)) if bcInfo['usercode'] == 'SITE': # проброс на вирт паллет data = self.dbExec( 'select * from pallet p where p.siteid = ? and p.pallettype = ?', [self.kId(bcInfo['recordid']), '1'], 'one') if data['PALLETID']: raise HTTPRedirect('taskLPallet?tid=%s&pid=%s&wid=%s' % (tid, data['PALLETID'], wid)) self.qTaskLCheckJoinedWares(tid, wid=wid) self.qTaskLJoinWares(tid, wid) self.qTaskLCheckJoinedPallet(tid) t = self.taskInfo(tid) w = self.waresInfo(wid) tr = self.qTrashRest(tid, wid) d = self.dbExec('select * from WH_TERM_INVENT_TASKLWARES(?,?)', [tid, wid], 'all') return self.drawTemplate(templ=self.tmplTaskLWares, data=[t, w, d, tr, params])
def taskAScanPallet(self, tid, barcode): bcInfo = self.kBarCodeInfo(barcode) if bcInfo and bcInfo['result'] == 0: if bcInfo['usercode'] == 'PALLET': raise HTTPRedirect('taskAPallet?tid=%s&pid=%s' % (tid, bcInfo['recordid'])) raise HTTPRedirect('main?mes=%s' % (_('ШК не обрабатывается')))
def taskASite(self, tid, sid, mes=None): ts = self.qTaskAJoinSite(tid, sid) if ts and ts['SPCODE'] == 'STACK': raise HTTPRedirect('taskAStackCnt?tid=%s&sid=%s' % (tid, sid)) self.qTaskACheckJoinedPallet(tid, mes) try: s = self.dbExec('select * from WH_TERM_INVENT_LISTPALLET(?,?,?)', [tid, sid, self.getIfaceVar('wmsid')], 'all') except FBExc, exc: raise HTTPRedirect('main?mes=%s' % self.fbExcText(exc[1]))
def qTaskAGetHigherSite(self, tid, sid): ''' Стеллаж текущего МП или само МП Проверка на принадлежноть МП к объекту задания ''' try: data = self.dbExec('select * from WH_TERM_INVENT_HSITE(?,?)', [tid, sid], 'one') if not data['SITEID']: raise HTTPRedirect('main?mes=%s' % (_('Неверное МП!'))) except FBExc, exc: raise HTTPRedirect('main?mes=%s' % (self.fbExcText(exc[1])))
def qTaskACheckJoinedSite(self, tid, mes=None): if not mes: mes = '' d = self.dbExec('select * from WH_TERM_INVENT_CHECKTASKSITE(?,?)', [tid, self.getIfaceVar('wmsid')], 'one') if d and d['SITEID']: raise HTTPRedirect('taskASite?tid=%s&sid=%s&mes=%s' % (tid, d['SITEID'], mes))
def taskLPalletWaresAdd(self, pid, wid, tid, wuid=None, productdate=None, amount=None, mes=None): wid = self.kId(wid) pid = self.kId(pid) #self.sessionPalletChk(palletid=palletid,flags='') backurl = 'taskLPalletWares?pid=%s&wid=%s&tid=%s' % (pid, wid, tid) if productdate and amount: try: self.dbExec( sql= "execute procedure WH_TERM_INVENT_PALWARESADD(?,?,?,?,?,?)", fetch="none", params=[ self.getIfaceVar('wmsid'), pid, wuid, productdate, amount, tid ]) except FBExc, exc: backurl += '&mes=%s' % (self.fbExcText(exc[1])) raise HTTPRedirect(backurl)
def taskAEndSite(self, tid, sid): 'Завершение работы с МП' try: self.dbExec('execute procedure WH_TERM_INVENT_ENDSITE(?,?,?)', [tid, sid, self.getIfaceVar('wmsid')], 'none') except FBExc, exc: raise HTTPRedirect('main?mes=%s' % (self.fbExcText(exc[1])))
def taskLPalletDelete(self, tid, wid, pid): try: self.dbExec('execute procedure WH_TERM_INVENT_NOPALLET(?,?,?)', [tid, pid, self.getIfaceVar('wmsid')], 'none') except FBExc, exc: raise HTTPRedirect('taskLPallet?tid=%s&pid=%s&wid=%s&mes=%s' % (tid, pid, wid, self.fbExcText(exc[1])))
def qTaskLJoinPallet(self, tid, pid): ' Привязка пользователя к паллету ' try: self.dbExec('execute procedure WH_TERM_INVENT_L_JOINPAL(?,?,?)', [tid, pid, self.getIfaceVar('wmsid')], 'none') except FBExc, exc: raise HTTPRedirect('taskL?tid=%s&mes=%s' % (tid, self.fbExcText(exc[1])))
def taskL(self, tid, barcode=None, mes=None, view='diff'): self.qTaskLCheckJoinedWares(tid, mes=mes) if barcode: bcInfo = self.kBarCodeInfo(barcode) if bcInfo and bcInfo['result'] == 0: if bcInfo['usercode'] == 'WARES': raise HTTPRedirect('taskLWares?tid=%s&waresid=%s' % (tid, bcInfo['recordid'])) else: mes = _('Не верный ШК') params = {'mes': mes, 'view': view} t = self.taskInfo(tid) try: data = self.dbExec('select * from K_WH_INVENT_GETWARES(?)', [tid], 'all') # отдельную процедуру! except FBExc, exc: raise HTTPRedirect('main?mes=%s' % (self.fbExcText(exc[1])))
def qTaskLJoinWares(self, tid, wid): ' Привязка пользователя к товару ' try: self.dbExec('execute procedure WH_TERM_INVENT_JOINWARES(?,?,?)', [tid, wid, self.getIfaceVar('wmsid')], 'none') except FBExc, exc: raise HTTPRedirect('taskL?tid=%s&mes=%s' % (tid, self.fbExcText(exc[1])))
def taskLEndWares(self, tid, wid): ' Завершение работы с товаром ' try: self.dbExec('execute procedure WH_TERM_INVENT_ENDWARES(?,?,?)', [tid, wid, self.getIfaceVar('wmsid')], 'none') except FBExc, exc: raise HTTPRedirect('taskL?tid=%s&mes=%s' % (tid, self.fbExcText(exc[1])))
def qTaskLCheckJoinedWares(self, tid, wid=None, mes=None): if not mes: mes = '' d = self.dbExec('select * from WH_TERM_INVENT_CHECKTASKWARES(?,?)', [tid, self.getIfaceVar('wmsid')], 'one') if d and d['WARESID']: if d['WARESID'] != self.kId(wid): raise HTTPRedirect('taskLWares?tid=%s&wid=%s&mes=%s' % (tid, d['WARESID'], mes))
def qTaskACheckJoinedPallet(self, tid, pid=None, mes=None): if not mes: mes = '' d = self.dbExec('select * from WH_TERM_INVENT_CHECKTASKPALLET(?,?)', [tid, self.getIfaceVar('wmsid')], 'one') if d and d['PID']: if d['PID'] != self.kId(pid): raise HTTPRedirect( 'taskAPallet?tid=%s&pid=%s&mes=%s' % (tid, d['PID'], _('Завершите паллет!')))
def taskAScanPalletWares(self, tid, pid, barcode): bcInfo = self.kBarCodeInfo(barcode) if bcInfo and bcInfo['result'] == 0: if bcInfo['usercode'] == 'WARES': raise HTTPRedirect('taskAPalletWares?tid=%s&pid=%s&wid=%s' % (tid, pid, bcInfo['recordid'])) elif bcInfo['usercode'] == 'SITE': raise HTTPRedirect('taskAPalletSite?tid=%s&pid=%s&sid=%s' % (tid, pid, bcInfo['recordid'])) #return self.site(siteid=bcInfo['recordid']) #elif bcInfo['usercode']=='PALLET' and taskid is None: # return self.pallet(palletid=bcInfo['recordid']) #if waresid: return self.palletWares(palletid=palletid,waresid=waresid,mes=_('Ничего не найдено или ШК не обрабатывается!'),taskid=taskid) else: raise HTTPRedirect('taskAPallet?tid=%s&pid=%s&mes=%s' % ( tid, pid, _('Ничего не найдено или ШК не обрабатывается!' )))
def taskAPalletSiteSet(self, tid, pid, sid): self.sessionPalletChk(palletid=pid) try: self.dbExec( "execute procedure WH_TERM_INVENT_MOVEPAL(?,?,?,?)", [tid, pid, sid, self.getIfaceVar('wmsid')], 'none') except FBExc, exc: raise HTTPRedirect('taskAPalletSite?tid=%s&pid=%s&sid=%s&mes=%s' % (tid, pid, sid, self.fbExcText(exc[1])))
def taskLEndPallet( self, tid, pid): # объединить в 1 метод taskA taskL 'Завершение работы с поддоном' try: self.dbExec('execute procedure WH_TERM_INVENT_ENDPALLET(?,?,?)', [tid, pid, self.getIfaceVar('wmsid')], 'none') except FBExc, exc: raise HTTPRedirect('taskL?tid=%s&mes=%s' % (tid, self.fbExcText(exc[1])))
def taskA(self, tid, barcode=None, mes=None): if barcode: bcInfo = self.kBarCodeInfo(barcode) if bcInfo and bcInfo['result'] == 0: if bcInfo['usercode'] == 'SITE': sid = self.qTaskAGetHigherSite( tid, self.kId(bcInfo['recordid'])) raise HTTPRedirect('taskASite?tid=%s&sid=%s' % (tid, sid)) mes = _('Invalid barcode') self.qTaskACheckJoinedPallet(tid, mes) params = {'mes': mes} t = self.taskInfo(tid) return self.drawTemplate(templ=self.tmplTaskA, data=[t, params])
def main(self, mes=None): if not mes: mes = '' t = self.dbExec('select * from WH_TERM_INVENT_GETTASK(?)', [self.getIfaceVar('wmsid')], 'all') if t['datalist'] and t['datalist'][0]['ALGORITHM'] == 'A': tid = t['datalist'][0]['TASKID'] self.qTaskACheckJoinedSite(tid, mes) raise HTTPRedirect('taskA?tid=%s&mes=%s' % (tid, mes)) #if t['datalist'] and t['datalist'][0]['ALGORITHM'] == 'L': if len(t['datalist']) == 0: mes = _( 'Задания не найдены. Попробуйте изменить зону' ) params = {'mes': mes} return self.drawTemplate(templ=self.tmplIndex, data=[t, params])
def taskAPalletAdd(self, tid, sid, barcode=None, mes=None): if barcode: bcInfo = self.kBarCodeInfo(barcode) if bcInfo and bcInfo['result'] == 0: if bcInfo['usercode'] == 'PALLET': try: self.dbExec( 'execute procedure WH_TERM_INVENT_ADDPALLET(?,?,?,?)', [ tid, sid, self.kId(bcInfo['RECORDID']), self.getIfaceVar('wmsid') ], 'none') except FBExc, exc: mes = self.fbExcText(exc[1]) else: raise HTTPRedirect('main') else: mes = _('Не верный ШК')
def taskLPalletWaresSave(self, **args): wlots = '' amounts = '' for item in args: if item.find('WL_') != -1: wlots += item[3:] + ';' amounts += args[item] + ';' try: self.dbExec( sql= 'execute procedure WH_TERM_INVENT_CORRECTPALWARES(?,?,?,?,?,?)', fetch='none', params=[ self.getIfaceVar('wmsid'), args['pid'], args['wuid'], wlots, amounts, args['tid'] ]) except FBExc, exc: url = 'taskLPalletWares?pid=%s&wid=%s&tid=%s&mes=%s' % ( args['pid'], args['wid'], args['tid'], self.fbExcText(exc[1])) raise HTTPRedirect(url)
def taskAStackCnt(self, tid, sid, cnt1=None, cnt2=None, mes=None): s = self.siteStackInfo(siteid=sid) t = self.taskInfo(tid) params = {'mes': mes} if cnt1 is None: pass elif cnt2 is None: if int(cnt1) != int(s['S_PALCURCNT']): params['cnt1'] = cnt1 else: mes = self.taskAStackDo(tid=tid, sid=sid) elif cnt1 != cnt2: params['mes'] = _( 'Количества не совпадают пересчитайте еще раз' ) else: raise HTTPRedirect('taskAStackChk?tid=%s&sid=%s&cnt=%s' % (tid, sid, cnt1)) return self.drawTemplate(templ=self.tmplTaskAStackCnt, data=[s, t, params])
def taskLPallet(self, tid, pid, wid, barcode=None, mes=None): params = {'mes': mes} if barcode: params['mes'] = _('Invalid barcode') bcInfo = self.kBarCodeInfo(barcode) if bcInfo and bcInfo['result'] == 0: if bcInfo['usercode'] == 'SITE': raise HTTPRedirect( 'taskLPalletSite?tid=%s&pid=%s&wid=%s&sid=%s' % (tid, pid, wid, bcInfo['recordid'])) self.qTaskLCheckJoinedPallet(tid, pid) self.qTaskLJoinPallet(tid, pid) p = self.palletInfo(pid) t = self.taskInfo(tid) w = self.waresInfo(wid) d = self.dbExec( 'select * from WH_TERM_INVENT_PALLETWARES(?,?) pw where pw.wid = ? ', [pid, self.getIfaceVar('wmsid'), wid], 'all') return self.drawTemplate(templ=self.tmplTaskLPallet, data=[p, t, w, d, params])
def qTaskAJoinSite(self, tid, sid): try: s = self.dbExec('select * from WH_TERM_INVENT_JOINSITE(?,?,?)', [tid, sid, self.getIfaceVar('wmsid')], 'one') except FBExc, exc: raise HTTPRedirect('main?mes=%s' % (self.fbExcText(exc[1])))
def qTaskAJoinPallet(self, tid, pid): try: self.dbExec('execute procedure WH_TERM_INVENT_JOINPALLET(?,?,?)', [tid, pid, self.getIfaceVar('wmsid')], 'none') except FBExc, exc: raise HTTPRedirect('main?mes=%s' % (self.fbExcText(exc[1])))
return self.drawTemplate(templ=self.tmplTaskASite, data=[s, t, si, { 'hsid': sid, 'mes': mes }]) taskASite.exposed = True def taskAStackDo(self, tid, sid): try: self.dbExec('execute procedure WH_TERM_INVENT_STACKDO(?,?,?)', [tid, sid, self.getIfaceVar('wmsid')], 'none') except FBExc, exc: return self.fbExcText(exc[1]) else: raise HTTPRedirect('taskA?tid=%s' % tid) def taskAStackCnt(self, tid, sid, cnt1=None, cnt2=None, mes=None): s = self.siteStackInfo(siteid=sid) t = self.taskInfo(tid) params = {'mes': mes} if cnt1 is None: pass elif cnt2 is None: if int(cnt1) != int(s['S_PALCURCNT']): params['cnt1'] = cnt1 else: mes = self.taskAStackDo(tid=tid, sid=sid) elif cnt1 != cnt2: params['mes'] = _( 'Количества не совпадают пересчитайте еще раз'