饮酒买醉

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  11 随笔 :: 15 文章 :: 9 评论 :: 1 Trackbacks

2008年6月2日 #

一个新环境,在生成移位单过账时,提示“由于只知道存货   的成本价,无法更新 1.00 的物料消耗量”(Item consumption for %1 cannot be updated because the cost price is known only for %2 in stock)。找了半天没找到原因,后来在微软AX NewGroup中找到了答案

When posting the financial consumption of a BOM-Component, Axapta needs to know the cost price. If the cost price is not known, the described message appears. The cost price is not known, when a purchase for a new item (no postings on it) is not invoice updated

One way of solving this is to allow negative financial inventory. The other way is to first update the purchase invoices of the related components.

先记下来,备忘。

posted @ 2008-09-05 11:04 饮酒买醉 阅读(6) | 评论 (0)编辑

AX的AOT中建立菜单,但是关闭AX,重新打开还是不能显示在左边的主菜单中。原因:需要在AOT->Menus->MainMenu中添加对新Menu的引用。(只要将新Menu拖进即可!)备忘!
posted @ 2008-08-26 15:22 饮酒买醉 阅读(14) | 评论 (0)编辑

将数据库从Win平台下的Oracle转到unix下后,突然某张表的查询操作报错。“cannot select a record  The SQL database has issued an error”。编译该表,对应的Form和Class都不起作用。最后终于在微软AX网站上找到了原因:

“Axapta normaly not synchronize the AOD to the Database directly, Axapta uses the Table 'SQLDictionary' to recognize
differences between AOD and Database. Only the "check/synchronize" prozedure from Admin menu does check the real
SQL Dictionary in the database.”

posted @ 2008-07-19 11:52 饮酒买醉 阅读(12) | 评论 (0)编辑

server static void Job1(Args _args)
{
      CLRObject rdm;
      CLRObject num;
      int value;
      rdm = new CLRObject(\'System.Random\');
      num = rdm.Next();
        value = CLRInterop::getAnyTypeForObject(num);
      box::info(int2str(value));

static void Job1(Args _args)
{
    DLL dll ;
    DLLFunction interFaceLibrary;
    ;

    dll = new DLL(\'Net_DLL_Ax.dll\');
    interFaceLibrary  = new DLLFunction(dll,\'FirstClass.GetInformation\');

    interFaceLibrary.returns(ExtTypes::String);
   info(interFaceLibrary.call());

}

DLL文件C#代码:

using System;

namespace Net_DLL_Ax
{
    public class FirstClass
    {
        public FirstClass()
        {
        }

        public static string GetInformation()
        {
            return "HelloWorld";
        }
    }
}

 

 

总结了一下AX中调用NET中的DLL时要注意的一些方面(服务器端的部署):

1.在服务器上注册DLL程序集文件到GAC(全局程序集缓存)中,可以使用.Net的工具gacutil -i assemblyname.dll。

2.在ax中添加对NET的DLL文件的引用。

3.在代码中调用DLL之前要开启权限:

    Set                                     _assertSet;
    InteropPermission                       _ipCLR;    ;

    _assertSet = new Set(Types::Class);
    _ipCLR = new InteropPermission(InteropKind::ClrInterop);

    _assertSet.add(_ipCLR);

    CodeAccessPermission::assertMultiple(_assertSet);

部署好了以后就可以直接在客户端直接运行服务器端调用NET中DLL的项目了。

最郁闷的是按照步骤也不成功:( ,经验告诉我们“重启AX”!!!

posted @ 2008-07-02 09:03 饮酒买醉 阅读(62) | 评论 (2)编辑

备忘:Excel导出大数据量时使用了会报此错误。

调查原因:

progress.setText(strfmt("Exporting Records %1", i));

progress.incCount(1);

最简单的解决方法:注释掉此句。时间紧,暂时不调查更明确的原因。

posted @ 2008-06-18 10:06 饮酒买醉 阅读(14) | 评论 (0)编辑

 

1:直接调用函数

       str 24 ComName;

       ;

       ComName=appl.company().ext();//当前公司ID

       curUserid();//当前用户iD

       systemDateget();//当前时间

       Time2Str(timenow(),1,2);//时间转换函数

       curuserid()//当前用户

 

2,使用Session对象

       session xSession;

       ;

       xSession=new session();

       print xsession.userId();pause;

       print xsession.interfaceLanguage();pause;

 

3,使用XInfo对象

static void currentConfiguartion(Args _args)

{

       AOSSessionInfo info = new AOSSessionInfo();

       SqlSystem SqlSystem = new SqlSystem();

       ;

       print xinfo::componentName();

       print xinfo::configuration();

       print xinfo::dbName();

       print xinfo::licenseName();

       print xinfo::releaseVersion();

       print info.clientMode();

       print SqlSystem.loginConnectString();

       print xinfo::directory(directorytype::Appl);

       print xinfo::directory(directorytype::DB);//....

 

       pause;

 

}

4,得到数据库信息: 我们可以使用类SqlSystem得到数据库的信息,

static void Job52(Args _args)

{

    sqlsystem sql;

    ;

    sql=new sqlsystem();

    print sql.databaseName();

    print sql.databaseId();

    print sql.loginServer();

    print sql.loginDatabase();

    print sql.loginName();

    pause;

}

 

5,取余,取整,取小数

static void job1 (Args   args)
{

real i,j;

  ;

  i=10;

  j=3;

  print trunc(i/j);              //取整

  print frac(i/j);                //小数

  print i-j*trunc(i/j);        //取余

  pause;

}

 

6, 判断文件访问权限

 

private void checkFileAccess(Filename _filename)

{

    #WinAPI

 

    FilePath            filePath = conpeek(fileNameSplit(_filename), 1);

    Filename            filename = 'AxaptaTestFile';

    str                 fileExt  = '.Axapta';

 

    Filename            testFilename;

    int                 handle;

 

    Counter             counter;

 

    Filename getFileName()

    {

        ;

        counter ++;

        return filePath + filename + strRFix(int2str(counter), 3, '0') + fileExt;

    }

 

    do

    {

        testFilename = getFileName();

    }

    while (WinAPI::fileExists(testFilename));

 

    handle = WinAPI::createFile(testFilename, #CREATE_NEW, #CREATE_ALWAYS);

 

    if (handle == -1)

    {

        throw error("@SYS97423");

    }

 

    WinAPI::closeHandle(handle);

    WinAPI::deleteFile(testFilename);

}

posted @ 2008-06-02 17:09 饮酒买醉 阅读(11) | 评论 (0)编辑