' Il seguente snippet mostra come sia possibile generare movimenti di magazzino tramite un task ' L'esempio specifico preleva i dati da una tabella di frontiera alimentata dal sistema WMS Modula ' dim QWSess as QWSession QWSess=DB.QWSession MovMag_Apertura_Archivi(QWSess) dim q as new QWTable q.database=DB q.sql=" select STO_ID as ID,convert(varchar(18),STO_ARTICOLO) as CODICE,STO_GIAC as QTA,STO_TIME as DATA from EXP_STORICO join ARTIC on STO_ARTICOLO=CODICE collate Latin1_General_CI_AS where " q.sql+="STO_ORDINE='_IMM.VERSAMENTO_' and not exists (select * from MOVMAG where CODART=convert(varchar(18),STO_ARTICOLO) collate Latin1_General_CI_AS and CANC=0 and CAUSALE='MOV' and TIPODOC='**' and NUMDOC='MODULA'+right('000000'+ltrim(str(STO_ID)),6)) " q.sql+="order by STO_ID" q.requestlive=false q.active=true dim ok as boolean dim errmsg as string while not q.rowset.endofset() ok=MovMag_Crea_Nuovo(QWSess, q.rowset.fields("CODICE").value,"MOV", "", "MAGAZ", "**", "MODULA"+right("000000"+ltrim(str(q.rowset.fields("ID").value)),6), q.rowset.fields("QTA").value,0,nothing,dttod(q.rowset.fields("DATA").value),errmsg) if not ok errmsg="Errore nella generazione del movimento di magazzino da movimento modula ID "+ltrim(str(q.rowset.fields("ID").value))+": "+errmsg Write_LogDoc(QWSess,"**","QDAEMON",100,errmsg) end if q.rowset.next() end while q.active=false