Показать сообщение отдельно
Старый 01.10.2009, 09:01   #5  
AXbeginer is offline
AXbeginer
Участник
 
20 / 10 (1) +
Регистрация: 01.10.2009
Цитата:
Когда пишите код на панели есть кнопочка X++
Извините не заметил
X++:
void method1()
{
   ProdTable ProdTabl;
     ProdBOM    ProdBom;
     LoginProperty           LP = new LoginProperty();
     OdbcConnection          myConnection;
     Statement               myStatement;
     ResultSet               myResult,myResultLine;
     Str    s;
     str 50 CRProdid,Item;
     real   LostQty,DifQty;

     prodTableChangeQtySched    PQS = new prodTableChangeQtySched();
     ProdTabl = ProdTable;
     ProdBom = ProdBOM;
     LP.setDSN("TransferConnection");
    info(ProdTabl.collectrefprodid);
    try
    {
        myConnection = new OdbcConnection(LP);
        myStatement = myConnection.createStatement();
        myResult = myStatement.executeQuery(
            strfmt("Select excontrolqty,primor,collectrefprodid from ShiftReportPourHeader " +
                   "Where DataAreaId = '%1' and collectrefprodid = '%2'",
                    curext(),ProdTable.collectrefprodid));
        while (myResult.next())
        {   s = int2str(myResult.getInt(2));
            CRProdid=myResult.getString(3);
        info(s);
            myResultLine = myStatement.executeQuery(strfmt("Select CAST(LostQty AS numeric(15, 8)) AS exp1,CAST(DiffectQty AS numeric(15, 8)) AS exp1,ItemId from ShiftReportPourLine " +
            "Where primor = '%1'",s));
            while (myResultLine.next())
            {
            Item=myResultLine.getString(3);
            LostQty=myResultLine.getReal(1);
            info(num2str(LostQty,6,3,1,1));
            ttsbegin;
            select forupdate * from Prodbom where Prodbom.ProdId==CRProdid && Prodbom.ItemId==Item;
                info('Go');

                Prodbom.ScrapConst =LostQty;
              ttscommit;
            ttsbegin;
            info('go2');
                Prodbom.update();
            ttscommit;
            }
        info('go2');
        ProdTabl.QtySched=myResult.getReal(1);
        PQS.parmProdTable(ProdTable);
        myStatement.executeUpdate(strfmt("Update ShiftReportPourHeader Set posted = 1 Where primor = %1 (1 = 0)", s));

        }
        if(!s)
         throw ('Нет данных для импорта');
    }
    catch
    {
        throw("Check DSN settings (username/password).");
    }


}