Job to Import Vendor/Customer Postal Address in Dynamics Ax2012
2015-06-30 13:35
381 查看
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(1\1\2012, DateTimeUtil::getUserPreferredTimeZone()) ;
PostalAddress.ValidTo = datetobeginUtcDateTime(1\1\2154, DateTimeUtil::getUserPreferredTimeZone()) ;
PostalAddress.Party = vendTable.Party;
if (!dirParty.createOrUpdatePostalAddress(PostalAddress).RecId)
{
info(VendTable.AccountNum);
}
}
catch(Exception::Error)
{
info(VendTable.AccountNum);
}
}
}
}
{
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(1\1\2012, DateTimeUtil::getUserPreferredTimeZone()) ;
PostalAddress.ValidTo = datetobeginUtcDateTime(1\1\2154, DateTimeUtil::getUserPreferredTimeZone()) ;
PostalAddress.Party = vendTable.Party;
if (!dirParty.createOrUpdatePostalAddress(PostalAddress).RecId)
{
info(VendTable.AccountNum);
}
}
catch(Exception::Error)
{
info(VendTable.AccountNum);
}
}
}
}
相关文章推荐
- HYSPLIT模式简介及单机版使用图文教程
- Java用freemarker导出word
- css3模拟微信摇一摇
- 08 基本元素 数组和指针
- Webservice讲解
- 第一天
- Android深入浅出之Audio 第二部分 AudioFlinger分析
- QuartZ Cron表达式
- 字符串排序
- 从NN到RNN再到LSTM(附模型描述及详细推导)——(一)NN
- eclipse插件genymotion运行提示Initialize Engine: failed和Virtualbox运行提示创建com对象失败
- PHP 魔术变量
- android 在使用ViewAnimationUtils.createCircularReveal()无法兼容低版本的情况下,另行实现圆形scale动画
- android 的MVVM模型--Data Binding
- linux切换系统jdk方式
- Eclipse4.4 安装java反编译插件Eclipse Class Decompiler
- 07 基本元素 语句
- 有关气象类资料数据下载网址
- iOS后台持续上传定位数据(系统自带的方法)
- Android音频系统之AudioFlinger(一)