{"id":26245,"date":"2020-09-03T16:52:23","date_gmt":"2020-09-03T14:52:23","guid":{"rendered":"http:\/\/help.qualiware.it\/qw-help\/?p=26245"},"modified":"2020-09-03T16:52:23","modified_gmt":"2020-09-03T14:52:23","slug":"generazione-movimenti-di-magazzino-da-task","status":"publish","type":"post","link":"https:\/\/help.qualiware.it\/qw-help\/generazione-movimenti-di-magazzino-da-task\/","title":{"rendered":"Generazione movimenti di magazzino da task"},"content":{"rendered":"<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">' Il seguente snippet mostra come sia possibile generare movimenti di magazzino tramite un task\r\n' L'esempio specifico preleva i dati da una tabella di frontiera alimentata dal sistema WMS Modula\r\n' \r\n\r\ndim QWSess as QWSession\r\nQWSess=DB.QWSession\r\n\r\nMovMag_Apertura_Archivi(QWSess)\r\n\r\n\r\ndim q as new QWTable\r\nq.database=DB\r\nq.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 \" \r\nq.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)) \"\r\nq.sql+=\"order by STO_ID\"\r\nq.requestlive=false\r\nq.active=true\r\n\r\ndim ok as boolean\r\ndim errmsg as string\r\n\r\nwhile not q.rowset.endofset()\r\n   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)\r\n   \r\n   if not ok\r\n      errmsg=\"Errore nella generazione del movimento di magazzino da movimento modula ID \"+ltrim(str(q.rowset.fields(\"ID\").value))+\": \"+errmsg   \r\n\r\n      Write_LogDoc(QWSess,\"**\",\"QDAEMON\",100,errmsg)\r\n   end if   \r\n      \r\n   q.rowset.next()\r\nend while\r\n\r\nq.active=false<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8216; Il seguente snippet mostra come sia possibile generare movimenti di magazzino tramite un task &#8216; L&#8217;esempio specifico preleva i dati da una tabella di frontiera alimentata dal sistema WMS Modula &#8216; dim QWSess as QWSession QWSess=DB.QWSession MovMag_Apertura_Archivi(QWSess) dim q as new QWTable q.database=DB q.sql=&#8221; select STO_ID as ID,convert(varchar(18),STO_ARTICOLO) as CODICE,STO_GIAC as QTA,STO_TIME as DATA&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"ngg_post_thumbnail":0,"footnotes":""},"categories":[65],"tags":[82],"acf":[],"_links":{"self":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/26245"}],"collection":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/comments?post=26245"}],"version-history":[{"count":0,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/26245\/revisions"}],"wp:attachment":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/media?parent=26245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/categories?post=26245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/tags?post=26245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}