• Job to Import Vendor/Customer Postal Address in Dynamics Ax2012


    static void PostalAddressCreate(Args _args)
     
       {
     
         VendTable vendTable;
     
         DirParty dirParty;
     
         DirPartyPostalAddressView PostalAddress;
     
         CommaTextIo file;
     
         container record;
     
         str countyId, zipcode;
     
         ;
     
         file = new CommaTextIo("C:\VendorPostalAddress.csv",'r');
     
         file.inFieldDelimiter(',');
     
         while (file.status() == IO_Status::Ok)
     
         {
     
           record = file.read();
     
           vendTable = VendTable::find(conPeek(record,1));
     
           if (vendTable.RecId)
     
           {
     
             try{
     
             dirParty = DirParty::constructFromCommon(vendTable);
     
             PostalAddress.Street = conPeek(record,2);
     
             PostalAddress.BuildingCompliment = conPeek(record,3);
     
             PostalAddress.City = conPeek(record,4);
     
             PostalAddress.CountryCurrencyCode = conPeek(record,5);
     
             PostalAddress.CountryRegionId = conPeek(record,6);
     
             countyId = conPeek(record,7);
     
             if (Global::strStartsWith(countyId,'~'))
     
             {
     
               countyId = strDel(countyId,1,1);
     
             }
     
             PostalAddress.County = countyId;
     
             //PostalAddress.District = conPeek(record,8);
     
             //PostalAddress.DistrictName = conPeek(record,9);
     
             //PostalAddress.IsLocationOwner = conPeek(record,10);
     
             //PostalAddress.isocode = conPeek(record,11);
     
             PostalAddress.IsPrimary = conPeek(record,12);
     
             PostalAddress.LocationName = conPeek(record,16);
     
             PostalAddress.State = conPeek(record,24);
     
             zipcode = conPeek(record,30);
     
             if (Global::strStartsWith(zipcode,'~'))
     
             {
     
               zipcode = strDel(zipcode,1,1);
     
             }
     
             PostalAddress.ZipCode = zipcode;
     
             PostalAddress.ValidFrom = datetobeginUtcDateTime(112012, DateTimeUtil::getUserPreferredTimeZone()) ;
     
             PostalAddress.ValidTo = datetobeginUtcDateTime(112154, DateTimeUtil::getUserPreferredTimeZone()) ;
     
             PostalAddress.Party = vendTable.Party;
     
             if (!dirParty.createOrUpdatePostalAddress(PostalAddress).RecId)
     
               {
     
                 info(VendTable.AccountNum);
     
               }
     
             }
     
             catch(Exception::Error)
     
             {
     
               info(VendTable.AccountNum);
     
             }
     
           }
     
         }
     
       } 

  • 相关阅读:
    HttpClient入门三
    Centos常用命令之:压缩与解压缩
    Centos常用命令之:搜索
    Centos常用命令之:ln
    Centos常用命令之:VI
    HttpClient入门二
    NX二次开发-UFUN确定两个向量在指定的公差内是否相等(二维向量)UF_VEC2_is_equal
    NX二次开发-UFUN确定两个向量在指定的公差内是否相等(三维向量)UF_VEC3_is_equal
    NX二次开发-NXOPEN C#UF创建块theUfSession.Modl.CreateBlock1
    NX二次开发-NXOpen C# UF函数例子目录【更新日期2020.7.21】
  • 原文地址:https://www.cnblogs.com/xiangliqi/p/4610179.html
Copyright © 2020-2023  润新知