static private Dictionary <string, decimal> Init_List_AccantonamentiRigheORV(string libreria)
        {
            Dictionary <string, decimal> ret = new Dictionary <string, decimal>(1500);

            string __libreriaAs400 = libreria;
            string _tabORR         = __libreriaAs400 + ".ORR00PF";
            string _tabORV         = __libreriaAs400 + ".ORV00PF";

            //recupero totali accantonamenti per ogni articolo presente in ORR
            string query = "SELECT "
                           + _tabORR + ".ORRCART, Sum( " + _tabORR + ".ORRQACA) AS QTAALLOC "
                           + " FROM " + _tabORR
                           + " WHERE " + _tabORR + ".ORRSTAT ='RI' "
                           //+ " and " + _tabORR + ".ORRTORD<>'ORC' "
                           + " and " + _tabORR + ".ORRCART not like 'WU%'    \n"
                           + " GROUP BY ORRCART "
                           + " HAVING Sum(" + _tabORR + ".ORRQACA)<>0 "
                           + " order by  ORRCART ";

            DBHelper2    db  = DBHelper2.getAs400DBHelper(libreria);
            DbDataReader dtr = db.GetReaderSelectCommand(query);

            object[] row = new object[dtr.FieldCount];

            while (dtr.Read())
            {
                dtr.GetValues(row);
                ret.Add(Item.GetDBV <string>(row[0], "ORRCART"), Item.GetDBV <decimal>(row[1], "Sum(ORRQACA)"));
            }
            return(ret);
        }
Exemplo n.º 2
0
        static public void GetFileImport_YMFG_Sage()
        {
            string    libreriaAs400 = "MBM41LIB_M";
            DBHelper2 sage          = DBHelper2.getAs400DBHelper(libreriaAs400);

            _logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " start...");

            string       qry = GetSelectQuery_opr_CON_ODV(libreriaAs400);
            DbDataReader dtr = sage.GetReaderSelectCommand(qry);

            object[] row = new object[dtr.FieldCount];
            OrdiniAcq_OPR_As400_FIRSTIMPORT opr = null;

            string pathfile = @"\\srvx3app1\S$\Sage\SAGEX3\folders\SAURO\YSAURO\IMPEXP\Import_Iniziale_OPR_Da_As400_CON_ODV.txt";

            pathfile = @"Import_Iniziale_OPR_Da_As400_CON_ODV.txt";
            using (System.IO.StreamWriter fs = new System.IO.StreamWriter(pathfile, false))
            {
                while (dtr.Read())
                {
                    opr = new OrdiniAcq_OPR_As400_FIRSTIMPORT();
                    dtr.GetValues(row);
                    opr.Init(row);
                    fs.Write(opr.getSageImportString());
                }
            }
            dtr.Close();


            qry = GetSelectQuery_opr_SENZA_ODV(libreriaAs400);
            dtr = sage.GetReaderSelectCommand(qry);
            row = new object[dtr.FieldCount];
            opr = null;

            pathfile = @"\\srvx3app1\S$\Sage\SAGEX3\folders\SAURO\YSAURO\IMPEXP\Import_Iniziale_OPR_Da_As400_SENZA_ODV.txt";
            pathfile = @"Import_Iniziale_OPR_Da_As400_SENZA_ODV.txt";
            using (System.IO.StreamWriter fs = new System.IO.StreamWriter(pathfile, false))
            {
                while (dtr.Read())
                {
                    opr = new OrdiniAcq_OPR_As400_FIRSTIMPORT();
                    dtr.GetValues(row);
                    opr.Init(row);
                    fs.Write(opr.getSageImportString());
                }
            }
            dtr.Close();

            _logger.Debug(System.Reflection.MethodBase.GetCurrentMethod().Name + " end");
            return;
        }