08 2012 档案

摘要:1 //生成导入模板 2 void creatTemplate() 3 { 4 SysExcelApplication m_application; 5 SysExcelWorkbooks m_workbooks; 6 SysExcelWorkbook m_workbook; 7 SysExcelWorksheets m_worksheets; 8 SysExcelWorksheet m_worksheet; 9 SysExcelCells m_cells; 10 int ... 阅读全文
posted @ 2012-08-30 16:14 Sprite.z 阅读(357) 评论(0) 推荐(0)
摘要:比如,已知一个扩展类型是ProjCategoryId,下面的代码将为你找出所有使用过这个扩展类型的表。 1 static void findTableWithProjCategoryId(Args _args) 2 { 3 xInfo xInfo = new xInfo(); 4 5 treeNode t = xInfo.rootNode().AOTfindChild("DataDictionary").AOTfindChild("Tables"); 6 treeNode childNode; 7 treeNode fields; 8 treenod.. 阅读全文
posted @ 2012-08-30 16:10 Sprite.z 阅读(268) 评论(0) 推荐(0)
摘要:curuserId()当前用户IDcurext()当前公司IDappl.company().ext()当前公司IDfieldid2pname(tablenum(VendTable),fieldnum(VendTable,DlvTerm)))获取字段名setFocus()获得焦点infolog.activateWindow(form.hWnd())获取窗口焦点currency::curPrice2CurPrice(Price,CurrencyCode,"USD",CurrencyDate)价格汇率转换Currency::curAmount2CurAmount();金额汇率转换 阅读全文
posted @ 2012-08-30 16:10 Sprite.z 阅读(532) 评论(0) 推荐(0)
摘要:在某个class(比如可以加在winAPI中)中增加如下的方法,然后调用此方法即可。 1 client static str getPrivateProfileString(str section, str key, str value, str file) 2 { 3 #WinAPI 4 #define.sizeOfStringValue(1024) 5 Binary stringValue; 6 7 DLL DLL = new DLL(#KERNELDLL); 8 DLLFunction method = ... 阅读全文
posted @ 2012-08-30 16:09 Sprite.z 阅读(215) 评论(0) 推荐(0)
摘要:比如要在下拉框中显示ItemID,但是只显示ItemGroup='Group1' 且 ItemType='Bom'的物项,那么传统的使用扩展类型的方法就不使用了,因为扩展类型不能动态传递参数(Itemgroup和ITEMTYPE)。第一步,在InventTable里建立一个方法,lookupItemByItemTypeGroup。 1 client static void lookupItemByItemTypeGroup(FormStringControl lookupCtrl,ItemGroupId ItemGroupId,ItemType _ItemTYp 阅读全文
posted @ 2012-08-30 16:03 Sprite.z 阅读(517) 评论(0) 推荐(0)
摘要:有几个Ax开头的class值得我们研究一下,下面就是调用AxSalesTable和AxSalesLine来创建销售单的例子。 1 static void main(Args args) 2 { 3 AxSalesTable axSalesTable; 4 AxSalesLine axSalesLine; 5 ; 6 // 建立销售单头 7 axSalesTable = new AxSalesTable(); 8 axSalesTable.purchOrderFormNum('CUSTPONUM'); 9 axSalesTable.cust... 阅读全文
posted @ 2012-08-30 15:59 Sprite.z 阅读(265) 评论(0) 推荐(0)
摘要:1 static void Jinn_printter(Args _args) 2 { 3 Args m_args = new Args(); 4 SysReportRun m_reportRun; 5 printJobSettings m_printJobSettings = new printJobSettings(); 6 7 boolean isCorrect = true; 8 ; 9 try10 {11 if (winAPI::fileExists(... 阅读全文
posted @ 2012-08-30 15:56 Sprite.z 阅读(204) 评论(0) 推荐(0)
摘要:窗体分隔符是通过组(group)容器来实现的,将它添加到窗口后,将属性HideIfEmpty和AlignChild设置为No;FrameType设置为Raise 3D;设置好其它外观样式后,重写它的鼠标事件就可以实现了。 1 int mouseUp(int x, int y, int button, boolean ctrl, boolean shift) 2 { 3 int ret; 4 ret = super(x, y, button, ctrl, shift); 5 return _formSplitterVertical.mouseUp(x, y, button... 阅读全文
posted @ 2012-08-30 15:54 Sprite.z 阅读(275) 评论(0) 推荐(0)
摘要:1 if (infolog.language() == "zh-hans")2 infolog.language("en-us");3 else4 infolog.language("zh-hans");5 infolog.navPane().loadStartupButtons();6 Infolog.navPane().refreshFavorites(infolog.navPane().selectedFavoriteGroup(), xInfo::currentWorkspaceNum()); 阅读全文
posted @ 2012-08-30 15:54 Sprite.z 阅读(187) 评论(0) 推荐(0)
摘要:1 void resetUserData() 2 { 3 DialogButton button; 4 SysLastValue sysLastValue; 5 Dialog Dialog = new Dialog("@SYS70748"); 6 DialogField dlg = Dialog.addField(typeid(UserId)); 7 userId userId; 8 ; 9 dlg.value(curuserId());10 Dialog.doInit();... 阅读全文
posted @ 2012-08-30 15:53 Sprite.z 阅读(401) 评论(0) 推荐(0)
摘要:1 void clicked() 2 { 3 Dialog Dialog = new Dialog("Destroy Content Pane Window"); 4 DialogField dlgHide = Dialog.addField(typeid(Noyes),"Hide Content Pane Window"); 5 DialogField dlgShow = Dialog.addField(typeid(Noyes),"Show Content Pane Window"); 6 Dia... 阅读全文
posted @ 2012-08-30 15:52 Sprite.z 阅读(280) 评论(0) 推荐(0)
摘要:1 static void Job_ScheduleBatch2(Args _args) 2 { 3 BatchHeader batHeader; 4 BatchInfo batInfo; 5 RunBaseBatch rbbTask; 6 str sParmCaption = "My RunbaseBatch Report Run"; 7 ; 8 rbbTask = new AV_RunbaseBatchDemo(); 9 batInfo = rbbTask .batchInfo();10 batInfo .parmCapti... 阅读全文
posted @ 2012-08-30 15:51 Sprite.z 阅读(172) 评论(0) 推荐(0)
摘要:1 public int monthDiff(date _start, date _end) 2 { 3 int diff; 4 int startYear, startMonth; 5 int endYear, endMonth; 6 ; 7 startYear = year(_start); 8 startMonth = mthofyr(_start); 9 endYear = year(_end);10 endMonth = mthofyr(_end);11 //year12 //endYear... 阅读全文
posted @ 2012-08-30 15:50 Sprite.z 阅读(255) 评论(0) 推荐(0)
摘要:Job:1 static void testDialogJob(Args _args)2 {3 testDialogClass testDialogClass ;4 ;5 testDialogClass = new testDialogClass() ;6 info(testDialogClass.mystr()) ;7 }Class: 1 class testDialogClass 2 { 3 str mystr ; 4 } 5 void new() 6 { 7 Args args = new Args(); 8 FormRun fo... 阅读全文
posted @ 2012-08-30 13:55 Sprite.z 阅读(260) 评论(0) 推荐(0)
摘要:Here is a sample class which is called via Dialog framework to create & post free text invoice using X++ code. 1 public void xtest() 2 { 3 Dialog dialog; 4 DialogField dlgCustAcc; 5 DialogGroup dialogPeriodLengthGroup, dialogPeriodLengthGroup1; 6 DialogField dlgLedgerAcc... 阅读全文
posted @ 2012-08-30 13:47 Sprite.z 阅读(1292) 评论(0) 推荐(0)
摘要:今天我向大家介绍一种方法,用X++写一个方法就可以完成上述功能。1、在窗体下写下如下两个方法: 1 1、 2 3 public void gotoMainTable(Object ctrl, boolean isParmObject=false, container refFrom=connull()) 4 { 5 TableName tableName; 6 FormName formName; 7 int tableID; 8 int fieldID; 9 int ... 阅读全文
posted @ 2012-08-30 13:38 Sprite.z 阅读(253) 评论(0) 推荐(0)
摘要:1 UserGroupList UserGroupList;2 ;3 while select UserGroupList where UserGroupList.userId == curuserid()4 {5 info(UserGroupList.groupId);6 } 阅读全文
posted @ 2012-08-30 13:35 Sprite.z 阅读(301) 评论(0) 推荐(0)
摘要:1 Void click() 2 { 3 InventDim inventDim; 4 InventSum inventSum; 5 InventQty inventQty; 6 itemID YourItemID; 7 ; 8 YourItemID = 'YourItemID'; 9 while select sum(postedQty), sum(received), sum(deducted), sum(registered), sum(picked), sum(reservPhysical)10 from ... 阅读全文
posted @ 2012-08-30 11:46 Sprite.z 阅读(207) 评论(0) 推荐(0)
摘要:1 void saveimage()2 {3 image MyImage = new image();4 str 260 imgPath = EAMParameters::filePath();//从companyinfo表得到路径,页可以自定义你自己的路径5 ;6 MyImage.saveImage(imgPath + filename, ImageSaveType::BMP_UNCOMP);//filename是新的文件名7 } 阅读全文
posted @ 2012-08-30 11:43 Sprite.z 阅读(143) 评论(0) 推荐(0)
摘要:1 static void jobMain(Args _args) 2 { 3 treeNode treeNode; 4 xInfo xInfo = new xInfo(); 5 ; 6 treeNode = xInfo.rootNode(); 7 treeNode = treeNode::findNode("jobs").AOTfindChild("Job1"); 8 treeNode.AOTrun(); 9 treeNode = treeNode::findNode("jobs").AOTfindChild("Job2& 阅读全文
posted @ 2012-08-30 11:42 Sprite.z 阅读(270) 评论(0) 推荐(0)
摘要:1、找到 class EditorScripts。2、比如在右键增加AddDeveloperName菜单,当点击此菜单时,在当前行增加开发人员的名字。 1 void AddDeveloperName(Editor e) 2 { 3 int startLine = e.selectionStartLine(); 4 int startCol = e.selectionStartCol(); 5 ; 6 e.unmark(); 7 e.gotoLine(startLine); 8 e.gotoCol(startCol); 9 e.insertL... 阅读全文
posted @ 2012-08-30 11:41 Sprite.z 阅读(331) 评论(0) 推荐(0)
摘要:对于数组类型的字段,比如Dimension,假如你试图访问一个单独的数据,我们就不能直接使用Dimension[Index]的方式,否则我们将会的到类似"Query extended range failure: Right parenthesis expected near pos 0."的错误。下面的代码展示了怎样使用正确的方法访问数组类型Department。public void init(){ QueryBuildRange qbrDimension; ; super(); //Department's index is 1 ... 阅读全文
posted @ 2012-08-30 11:40 Sprite.z 阅读(278) 评论(0) 推荐(0)
摘要:假如你用过runbase类的话,你一定会对那里的pack/unpack机制印象深刻, 这种机制允许用户保存上一次输入的值,假如你也想让你的From拥有这种强大的功能的话,请参考加入以下6个方法。 1 public dataAreaId lastValueDataAreaId() 2 { 3 return curExt(); 4 } 5 6 private UserId lastValueUserId() 7 { 8 return curuserid(); 9 }10 11 private UtilElementType lastValueType()12 {13 ... 阅读全文
posted @ 2012-08-30 11:38 Sprite.z 阅读(277) 评论(0) 推荐(0)
摘要:1 Void click() 2 { 3 ResourceNode resourceNode; 4 FilePath imagename; 5 ; 6 resourceNode = SysResource::getResourceNode(resourcestr(ResourceName)); 7 if (resourceNode) 8 { 9 resourceNode. AOTload();10 imagename = SysResource::saveToTempFile(resourc... 阅读全文
posted @ 2012-08-30 11:36 Sprite.z 阅读(149) 评论(0) 推荐(0)
摘要:1 static void AccessAccess(Args _args) 2 { 3 LoginProperty LP = new LoginProperty(); 4 OdbcConnection myConnection; 5 Statement myStatement; 6 ResultSet myResult; 7 LP.setDSN("MSAccess2000"); 8 try { 9 myConnection = new OdbcConnection(LP);10 } 11 catch ... 阅读全文
posted @ 2012-08-30 11:35 Sprite.z 阅读(131) 评论(0) 推荐(0)
摘要:1 connection con=new connection(); 2 statement stm=con.createStatement(); 3 ResultSET R; 4 str 1024 strSql; 5 ; 6 7 strSql = 'select top 10 * from inventTable '; 8 R = stm.executeQuery(strSQL); 9 while(r.next())10 {11 print r.getString(1);12 }//调用存储过程://strsql='Execute SP \''+A+& 阅读全文
posted @ 2012-08-30 11:33 Sprite.z 阅读(176) 评论(0) 推荐(0)
摘要:1 Example 2 { 3 LoginProperty LP = new LoginProperty(); 4 OdbcConnection myConnection; 5 Statement myStatement; 6 ResultSet myResult; 7 ; 8 super(); 9 LP.setDSN("MSAccess2000");10 try 11 {12 //Do something 13 }14 catch 15 { 16 ... 阅读全文
posted @ 2012-08-30 11:32 Sprite.z 阅读(169) 评论(0) 推荐(0)
摘要:1 static void CreateFieldMethod(Args _args) 2 { 3 TreeNode tn1, tnAddr, methodsNode; 4 MemberFunction memberFunction; 5 str source; 6 ; 7 8 tn1 = infolog.findNode("\\Forms\\Address\\Data Sources\\Address\\Fields\\AddrRecId"); 9 tnAddr = infolo... 阅读全文
posted @ 2012-08-30 11:30 Sprite.z 阅读(157) 评论(0) 推荐(0)
摘要:1 int ret, j, i; 2 DictTable dictTable; 3 DictField DictField; 4 str curFieldName; 5 ; 6 dictTable = new DictTable(tableNum(yourTableName)); 7 i = dictTable.fieldCnt()-11;//这里系统会包括表的其他11个父类字段,所以减去11 8 for (j = 1; j <= i; j++) 9 {10 DictField=new DictField(dictTable.id(),dictTable.fi... 阅读全文
posted @ 2012-08-30 11:28 Sprite.z 阅读(145) 评论(0) 推荐(0)
摘要:1 Args ArgList = new Args(reportStr(My_Report));2 ReportRun My_Report = new ReportRun (ArgList);3 ;4 5 My_Report.design().caption('My Report');6 My_Report.query().interactive(false);7 My_Report.query().dataSourceNo(1).range(1).value('AA');//对报表里的数据源传递参数。若无,则可以不要。8 My_Report.run(); 阅读全文
posted @ 2012-08-30 11:26 Sprite.z 阅读(150) 评论(0) 推荐(0)
摘要:1 void sendMail() { 2 SysMailer mailer = new SysMailer(); 3 ; 4 mailer.body("This is the body of the mail"); 5 mailer.subject("The message subject"); 6 mailer.fromAddress("Axapta_header@navision.com"); 7 mailer.fromName("Sell Axapta contract"); 8 mailer.tos(). 阅读全文
posted @ 2012-08-30 11:26 Sprite.z 阅读(148) 评论(0) 推荐(0)
摘要:1 static void writeFile() 2 { 3 AsciiIo diskFile; 4 Filename diskFileName; 5 Str line; 6 Container c; 7 ; 8 c = [1, "MyText", 2, "HisText"]; 9 10 diskFileName = "c:\\test.txt";11 12 diskFile = new AsciiIo(diskFileName,'W');13 diskFile.outRecordDelimiter('\r\ 阅读全文
posted @ 2012-08-30 11:24 Sprite.z 阅读(150) 评论(0) 推荐(0)
摘要:1、在 Basic/setup/Number sequence/numberSequence 增加一个Sequence 编号:比如 'MySequence', from 1 to 9999999 format='######'。2、在form的数据源的Create方法添加以下代码。1 public void create(boolean _append = false)2 {3 NumberSeq _numberSeq;//declare a NumberSeq variable4 ;5 super(_append);6 _numberSeq = numberS 阅读全文
posted @ 2012-08-30 11:22 Sprite.z 阅读(179) 评论(0) 推荐(0)
摘要:本例中使用到很多Axapta高级技巧,比如函数的嵌套等,值得大家揣摩。例子中使用到的三个函数解释:fileExists(_name) 若存在文件,则返回 true。folderExists(_name) 若存在文件夹或文件,则返回true。pathExists(_name) 若存在文件夹,则返回true。 1 static void FindFile(Args _args) 2 { 3 #File 4 FileName fullFileName(FileName _path, FileName _fileName) 5 { 6 FileName p... 阅读全文
posted @ 2012-08-30 11:20 Sprite.z 阅读(174) 评论(0) 推荐(0)
摘要:1 str URL; 2 #DEFINE.MapURL('http://maps.google.com/maps?q=') 3 ; 4 if (!Address.QVS_Latitude || !Address.QVS_Longitude) 5 { 6 SmmUtility::GoogleMap(Address); 7 } 8 else 9 {10 URL = Address.QVS_Latitude;11 URL += "," + Address.QVS_Longitude;12 13 URL = #MapURL + URL;14 infolog.urlL 阅读全文
posted @ 2012-08-30 11:19 Sprite.z 阅读(325) 评论(0) 推荐(0)
摘要:1 ReportName.setTarget(printMedium::Printer);//直接打印到打印机2 this.suppressReportIsEmptyMessage(true);//空报表提示3 this.printJobSettings().suppressScalingMessage(true);//预览缩放提示 阅读全文
posted @ 2012-08-30 11:13 Sprite.z 阅读(159) 评论(0) 推荐(0)
摘要:AX的进度条比较简单,参考以下代码。 1 #avifiles 2 SysOperationProgress simpleProgress = SysOperationProgress::newGeneral(#aviUpdate, 'Posting', 100); 3 ; 4 simpleprogress.setCaption('Please wait...'); 5 simpleProgress.incCount(5); 6 simpleprogress.setText(strfmt("Percent: %1"+'%', 5 阅读全文
posted @ 2012-08-30 11:09 Sprite.z 阅读(258) 评论(0) 推荐(0)
摘要:1、先在form的声明的地方声明变量。1 public class FormRun extends ObjectRun2 {3 QueryBuildRange criteriaPosted;4 }2、数据源(datasource)对应的表的ini方法。1 public void init()2 {3 super();4 criteriaPosted=this.query().dataSourceName('YouTable').addRange(fieldNum(YouTable,FieldName));5 }3、数据源的ExecuteQuery方法下。1 public voi 阅读全文
posted @ 2012-08-30 11:07 Sprite.z 阅读(205) 评论(0) 推荐(0)
摘要:1 static void closeAxapta(Args _args)2 {3 infolog.shutDown(true);4 } 阅读全文
posted @ 2012-08-30 11:01 Sprite.z 阅读(147) 评论(0) 推荐(0)
摘要:1 public void init()2 {3 object obj;4 ;5 super();6 obj = element.design().sectionName("SalesLine_1").controlName("SalesLine_LineAmount");7 obj.SumAll(NoYes::Yes);8 } 阅读全文
posted @ 2012-08-30 11:00 Sprite.z 阅读(184) 评论(0) 推荐(0)
摘要:1 void modified()2 {3 object fieldNameRef;4 super();5 fieldNameRef = tableName_ds.object(fieldNum(tableName, fieldName));6 fieldNameRef.methodName();7 } 阅读全文
posted @ 2012-08-30 10:59 Sprite.z 阅读(148) 评论(0) 推荐(0)
摘要:1 static void loopFieldsInTable(Args _args) 2 { 3 dictTable dt; 4 int numberOfFields; 5 int fieldId; 6 int i; 7 ; 8 dt = new dictTable(tableNum(CustTable)); 9 //name of table10 info(dt.name()); 11 numberOfFields = dt.fieldCnt(); 12 info(int2str(numberOf... 阅读全文
posted @ 2012-08-30 10:58 Sprite.z 阅读(171) 评论(0) 推荐(0)
摘要:方法一,使用扩展类型 tableName。方法二,使用函数 PickTable(),参考下面的job(可以直接运行)。 1 static void GetSelectedTable(Args _args) 2 { 3 tableid a; 4 ; 5 6 a = pickTable(); 7 print 'Table ID is:'+int2str(a); 8 print 'Table Name is:'+tableID2Name(a); 9 pause;10 } 阅读全文
posted @ 2012-08-30 10:57 Sprite.z 阅读(164) 评论(0) 推荐(0)
摘要:1 static void ExportImageToExcel(Args _args) 2 { 3 container ImaPos; 4 COM comWorksheet; 5 COM comShapes; 6 COM comCells; 7 COM comFont; 8 COM comPageSetup; 9 SysExcelWorksheet sheet;10 SysExcelApplication excel;11 SysExcelWorkbooks boo... 阅读全文
posted @ 2012-08-30 10:56 Sprite.z 阅读(346) 评论(0) 推荐(0)
摘要:1 static void FindPrimaryIdx(Args _args) 2 { 3 DictTable dt; 4 DictIndex di; 5 Common cm; 6 IndexID idx; 7 int i, iCnt; 8 FieldID fid; 9 FieldID fids[,10];10 int fidsCnt = 0;11 str ... 阅读全文
posted @ 2012-08-30 10:55 Sprite.z 阅读(246) 评论(0) 推荐(0)
摘要:1 void startupPost() 2 { 3 int counter; 4 int num = 0; 5 int maxSessions = Info::licensedUsersTotal(); 6 xSession session; 7 UserInfo userInfo; 8 UserId currentUserId; 9 ;10 11 currentUserId = curuserid();12 13 for(counter = 1; ... 阅读全文
posted @ 2012-08-30 10:52 Sprite.z 阅读(209) 评论(0) 推荐(0)
摘要:1 static str Num2ChnStr(real realNum) 2 { 3 real y; 4 int b, a; 5 str je, x, hz1, hz2, e, h, f, m; 6 boolean IsNegative=false; 7 ; 8 if (realNum == 0) 9 return '零圆';10 if (realNum < 0)11 {12 realNum =... 阅读全文
posted @ 2012-08-30 10:49 Sprite.z 阅读(429) 评论(0) 推荐(0)
摘要:As we talk before, AX has no support with sigleton instance modle, but we can use the global cache insteaded.1、Create the global cache.1 SysGlobalCache globalCache;2 ;3 4 globalCache = ClassFactory.globalCache(); //全局缓存,客户端和服务端都可以用,但依赖调用方5 globalCache = Appl.globalCache(); //全局缓存,客户端和服务端都可以用,... 阅读全文
posted @ 2012-08-30 10:38 Sprite.z 阅读(235) 评论(0) 推荐(0)
摘要:1 static void dialog(Args _args) 2 { 3 Dialog dialog = new Dialog("Test dialog!"); //标题 4 DialogField dialogField1 = dialog.addField(typeid(ItemId),"Item Name"); //设置字段 5 DialogField dialogField2 = dialog.addField(typeid(noYes),"Update?"); 6 Dial... 阅读全文
posted @ 2012-08-30 10:02 Sprite.z 阅读(207) 评论(0) 推荐(0)
摘要:在AX中,我们很容易发现很多子窗口都通过一个“MenuItem”并绑定数据源,就可以完成数据的自动绑定了。其实细节是由“MenuItem”封装好了,我们也可以通过代码实现。 1 static void activateWindow(Args _args) 2 { 3 FormRun fr; 4 Args args = new Args(); 5 CustTable CustTable = CustTable::find("WIB-CHN"); //记录行,如果是母窗口数据源,则实现绑定 6 ; 7 args.name(formstr(Cu... 阅读全文
posted @ 2012-08-30 09:59 Sprite.z 阅读(210) 评论(0) 推荐(0)
摘要:1、系统自带储存过程。 1 exec sp_databases; --查看数据库 2 exec sp_tables; --查看表 3 exec sp_columns student;--查看列 4 exec sp_helpIndex student;--查看索引 5 exec sp_helpConstraint student;--约束 6 exec sp_stored_procedures; 7 exec sp_helptext 'sp_stored_procedures';--查看存储过程创建、定义语句 8 exec sp_rename student, stuInfo;- 阅读全文
posted @ 2012-08-28 14:49 Sprite.z 阅读(849) 评论(0) 推荐(0)
摘要:1 void ViewCrystalReport() 2 { 3 Com comapp; 4 Com reporting; 5 str paramwhole; 6 str paramfilename; 7 str paramCond; 8 str ViewYesNo; 9 int ret; 10 COMVariant variant; 11 12 ; 13 14 variant = new COMvariant(COMVariantInOut::OUT,COMVariantType::VT_BOOL) ; 15 paramwhole... 阅读全文
posted @ 2012-08-28 11:32 Sprite.z 阅读(253) 评论(0) 推荐(0)
摘要:1 void printSummary() 2 { 3 int i; 4 Dimensions m_Dimensions; 5 #avifiles 6 SysOperationProgress simpleProgress = SysOperationProgress::newGeneral(#aviUpdate, "Generating",100); 7 ; 8 9 excel = SysExcelApplication::construct(); ... 阅读全文
posted @ 2012-08-28 11:30 Sprite.z 阅读(394) 评论(0) 推荐(0)
摘要:1. Fomat 1. 1 SysExcelStyle style; 2 ; 3 4 ... 5 // Set orientation 6 style.comObject().orientation(90); 7 // distribute text 8 style.horizontalalignment(-4117); 9 // center text 10 style.horizontalalignment(-4108); 11 // right align text 12 style.horizontalalignment(-4152); 13 /... 阅读全文
posted @ 2012-08-28 11:28 Sprite.z 阅读(1092) 评论(0) 推荐(0)
摘要:Well while working on a current project an associate of mine, partner in crime on the current project named Ed (from Stream Line), shared with me a very nice little trick.You see we had two AOSes that we needed to flush the cache, but could not stop and start the AOSes. The only way I have ever know 阅读全文
posted @ 2012-08-28 11:23 Sprite.z 阅读(207) 评论(0) 推荐(0)
摘要:最初的要求是修改ItemId长度变成30,后来运行了一段时间,发现如果不修改ItemRelation和KeyValue的长度,到运行BOM/Route Calculation的时候还是会出问题(上面两个EDT和ItemId没有直接关系)。但终究不能碰到问题才去找哪些EDT遗漏了,于是想到系统自带的修改EDT的form(系统管理==》设置==》系统==》修改数据类型)。其实这个form并不是简单的只修改一个EDT,而是把它的父EDT揪出来,并且找到它整棵EDT树的所有EDT。拿ItemId为例,它整棵EDT树包括ItemIdBase,ItemIdAlternative,ItemIdProduct 阅读全文
posted @ 2012-08-28 11:21 Sprite.z 阅读(253) 评论(0) 推荐(0)
摘要:1、生成文件。 1 Args args; 2 ReportRun reportRun; 3 System.Exception ex; 4 str reportname = reportstr(PriceDiscTable_Purch_Expiration); 5 str AttachmentPath = "\\\\xxxx004\\MailAttachment\\PriceDiscTable_Purch_Expiration.PDF"; 6 //通过Batch生成文件要用相对路径的共享文件夹 7 ; 8 9 args = ... 阅读全文
posted @ 2012-08-28 11:13 Sprite.z 阅读(396) 评论(0) 推荐(0)
摘要:1 fileName getTempfileName(QVS_VendAttachment _QVS_VendAttachment) 2 { 3 BinData binData; 4 Filename filename; 5 FilePath filePath; 6 #WINAPI 7 str endSlash(str _str) 8 { 9 return (strscan(_str, '\\',strlen(_str),-1)) ? _str : _str + '\\';10 }11 ;1... 阅读全文
posted @ 2012-08-28 09:52 Sprite.z 阅读(171) 评论(0) 推荐(0)
摘要:This method must be based on a form, and using in the system enviroment 'windows 2008' may facecompatibility error.void clicked(){ SysExcelApplication Excel; SysExcelWorkbooks Books; SysExcelWorkbook Book; SysExcelWorksheets Sheets; ... 阅读全文
posted @ 2012-08-28 09:49 Sprite.z 阅读(677) 评论(0) 推荐(0)
摘要:Way 1: Use 'TextBuffer' to Export CSV from AX. 1 static void ExportToCSVFile01(Args _args) 2 { 3 TextBuffer textBuffer = new TextBuffer(); 4 InventTable inventTable; 5 FileIoPermission perm; 6 counter Lines; 7 8 ... 阅读全文
posted @ 2012-08-28 09:40 Sprite.z 阅读(595) 评论(0) 推荐(0)
摘要:1 void showBOMItemImage(ItemId _ItemId, ConfigId _ConfigId) 2 { 3 Image CacheImage; 4 container CacheContainer; 5 real ImageRatio; 6 int AdjustHW; 7 FilePath filePath; 8 BinData BinData; 9 Inve... 阅读全文
posted @ 2012-08-28 09:34 Sprite.z 阅读(195) 评论(0) 推荐(0)
摘要:Had a case then I needed to do a modification to a report with a custom dialog where the user could make some changes to the information that teh report would show.I needed the same behavioure as you get from a RunBase class but I needed to use it in a report. Tha solution was to use the xSysLastVal 阅读全文
posted @ 2012-08-28 09:30 Sprite.z 阅读(227) 评论(0) 推荐(0)
摘要:Way 1:static void CustAccountRename(Args _args){ CustTable custTable; ; select firstOnly custTable where custTable.AccountNum == '1103'; if (custTable.RecId) { custTable.AccountNum = '1103_'; custTable.renamePrimaryKey(); }}Way 2: 1 void renamePrimaryKey(Common _common) 2 { 3 Comm... 阅读全文
posted @ 2012-08-28 09:17 Sprite.z 阅读(280) 评论(0) 推荐(0)
摘要:1 static void LedgerReasonMerge(Args _args) 2 { 3 ReasonTable reasonTableDelete; 4 ReasonTable reasonTable; 5 ; 6 7 ttsBegin; 8 select firstOnly forUpdate reasonTableDelete 9 where reasonTableDelete.Reason == 'COUNTER';10 select firstOnly forUpdate reasonTable11 where reasonTab... 阅读全文
posted @ 2012-08-28 09:11 Sprite.z 阅读(161) 评论(0) 推荐(0)
摘要:1 SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(QVS_PriceDiscVendName), _lookupCtrl); 2 Query QE; 3 QueryBuildDataSource DS; 4 ; 5 6 QE = new Query(); 7 DS = QE.addDataSource(tablenum(QVS_PriceDiscVendName)); 8 DS.addRange(fieldnum(QVS_PriceDi... 阅读全文
posted @ 2012-08-28 09:08 Sprite.z 阅读(189) 评论(0) 推荐(0)
摘要:有人也许发现AX安装成功后,重新启动系统发现AX的AOS并没成功启动,虽然已设置为“Auto”。这是由于AX依赖MSSQL服务,如果AOS和数据库安装在同一服务器,由于MSSQL服务启动较慢,造成AOS启动失败。我们可以按以下图示进行设置,重复执行,问题解决。 阅读全文
posted @ 2012-08-28 09:03 Sprite.z 阅读(282) 评论(0) 推荐(0)
摘要:这个例子来自Google,有点绕,通过类SalesAutoCreate和中间表实现销售订单导入,中间表主要储存销售订单行关键信息。Many projects use an interface to import their sales orders, because of this a SalesAutoCreate class was created. This class is easily extendable and customizable.The first thing to do is designing a buffer table, like this one for.Aft 阅读全文
posted @ 2012-08-28 08:56 Sprite.z 阅读(434) 评论(0) 推荐(0)
摘要:在Axapta内通过使用COM 类来构建Excel表,并控制相关单元格的属性设置:如字体的颜色,使用的字体名称,字体大小;以及单元格的边框设置,对齐方式。使用了Axapta系统当中的SysExcel 以及继承自SysExcel的相关子类。COM 类是Axapta封装的一个系统类。对于Excel当中控制单元格对齐,边框等等的具体代码你可以参考VBA的实现。在AX当中用COM对象来实现这些属性设置时的语句与VBA实现基本一致。你比如简单的字体名称,大小设置。Font.name(); Font.size(); 但也有些不太一致。比如在VBA里,添加边框时,你可以控制到单元格的上下左右边框(range 阅读全文
posted @ 2012-08-28 08:36 Sprite.z 阅读(1196) 评论(0) 推荐(0)
摘要:有MVC开发经历的童鞋,可能发现X++由于不支持静态变量是不支持单例模式,Form之间传值只能通过Args类传递。这样程序开发的灵活性就大大受到限制。有人发现,通过系统全局缓存机制来实现单例模式。 1 public static SingletonClass getInstance() 2 { 3 SingletonClass instance; 4 SysGlobalCache globalCache = infolog.objectOnServer() ? appl.globalCache() : infolog.globalCache(); 5 ; 6 7 ... 阅读全文
posted @ 2012-08-28 08:29 Sprite.z 阅读(318) 评论(0) 推荐(0)
摘要:1 static void findStr(Args _args) 2 { 3 Dictionary dictionary = new Dictionary(); 4 SysDictTable dictTable; 5 SysDictField dictField; 6 Common common; 7 int i, j, _tableId, _fieldId; 8 ; 9 for (i = 1; i <= dictionary.tableCnt(); i++)10 {11 ... 阅读全文
posted @ 2012-08-27 17:16 Sprite.z 阅读(253) 评论(0) 推荐(0)
摘要:AX的键盘事件比较简单,通过侦听task()事件的taskID。 1 public int task(int _taskId) 2 { 3 int ret; 4 ; 5 6 ret = super(_taskId); 7 8 if (_taskId == 288) //288是Enter键,其它键值可自测获取 9 {10 //Do something11 }12 13 return ret;14 } 阅读全文
posted @ 2012-08-27 17:09 Sprite.z 阅读(251) 评论(0) 推荐(0)
摘要:AX的事物管理通过关键字ttsbegin/ttscommit/ttsabort来处理。用一个事务,要不全做,要不全不做。常用的写法有: 1 try 2 { 3 ttsbegin; 4 //do something1 5 //do something2 6 ttscommit; 7 } 8 catch 9 {10 ttsabort;11 }这里do something1和do something2,要不全做,其中有一个出现问题,则两个都不做。另外,使用tts,还有下面一些小细节:(1)ttsabort不会马上终止程序,而是继续运行后面与transaction无关的statem... 阅读全文
posted @ 2012-08-27 17:04 Sprite.z 阅读(824) 评论(0) 推荐(0)
摘要:Following Job creates the Purchase order from code and post the invoice by making use of PurchFormLetter class.If you don't have demo data , please test with your input values. 1 static void Dev_CreatePO_and_Invoice(Args _args) 2 { 3 NumberSeq numberSeq; 4 Purchtable Purchtable; 5 PurchLine Pu.. 阅读全文
posted @ 2012-08-27 16:30 Sprite.z 阅读(885) 评论(0) 推荐(0)
摘要:1 static void Job_Testing(Args _args) 2 { 3 Query query = new Query(); 4 QueryBuildDataSource qbds; 5 QueryRun qr; 6 TableID tableId; 7 int icount = 0; 8 ; 9 tableid = tablename2id('CustTable');10 qbds = query.addDataSource... 阅读全文
posted @ 2012-08-27 16:25 Sprite.z 阅读(423) 评论(0) 推荐(0)
摘要:不要把barCode 想的有多么高深。 它其实只是模拟键盘的操作而已,当光标定位在某个控件,在该位置输入字符串。有些细节需要注意的:在报表中打印条形码时,有时会发现打出乱码,即使是标准系统。在设置打印条形码时,对应的StringEdit有两个属性需要注意:Font和DataMethod。以BC开头的字体是条形码,如果将Font设置为:“BC C128 HD Wide” 则需要将DataMethod设置为对应的“BarcodeEAN128”。学习如何使用BarCode,可以参考“Report :AssertBarcode”,在确定了我们要使用的BarCode字体后。1 BarcodeCode39 阅读全文
posted @ 2012-08-27 16:21 Sprite.z 阅读(417) 评论(0) 推荐(0)
摘要:1、控制行的颜色,重写Grid的displayOption()。 1 public void displayOption(Common _record, FormRowDisplayOption _options) 2 { 3 PushTbBOMConfiguration config; 4 ; 5 6 config = _record; 7 if (config.Color == 'Red') 8 { 9 _options.textColor(WinAPI::RGB2int(255,0,0));10 }11 supe... 阅读全文
posted @ 2012-08-27 16:13 Sprite.z 阅读(289) 评论(0) 推荐(0)
摘要:1、通过数据源获取记录,以EmplTable为例。1 EMPlTable emp;2 ;3 4 for (emp = EmplTable_ds.getFirst(1); emp; emp = EmplTable_ds.getNext())5 {6 //do something7 } 1 voidclicked() 2 { 3 CustTablecustTable; 4 ; 5 for (custTable = CustTable_ds.getFirst(true)?CustTable_ds.getFirst(true):CustTable_ds.cursor(); //从当前... 阅读全文
posted @ 2012-08-27 15:59 Sprite.z 阅读(322) 评论(0) 推荐(0)
摘要:1、从本地读取图片文件,并判断格式是否附合要求。 1 FilenameFilter filter = ['Image Files','*.bmp;*.jpg;*.gif;*.jpeg']; 2 BinData binData = new BinData(); 3 str extention, path, nameOfFile; 4 Container imageContainer ; 5 imageFilePathName = WinAPI::getOpenFileName(element.hWnd(),filter,'', "@SYS 阅读全文
posted @ 2012-08-27 15:50 Sprite.z 阅读(390) 评论(0) 推荐(0)
摘要:在AX有两个非常有用的方法,Display() 和 Edit()。它们都可以用于显示数据,但Eidt()还有一个功能,编辑保存数据。1、Display()非常简单和理解,它就是一个带返回值的函数,不带任何参数,不过前面多了一个关键字“Display”。1 Display ItemName itemName()2 {3 ;4 5 return InventTable::find("ItemId").ItemName;6 }2、Edit()方法,它和Display()相似,唯一不同的是,它带有参数,也有自己的关键字“Edit”。 1 Edit noYes editMark(.. 阅读全文
posted @ 2012-08-27 11:43 Sprite.z 阅读(379) 评论(0) 推荐(0)
摘要:一个表有三个字段id,dt,d分别存放id,时间,数值id dt d12004-08-11 12:12:00.00092 2005-09-11 12:08:00.00023 2005-08-11 12:12:00.00064 2005-09-11 12:12:00.000105 2005-08-11 12:12:00.0000要求按照时间里的月份分组求d字段和 1 if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[abc]') and OBJECTPROPERTY(id, N'Is 阅读全文
posted @ 2012-08-27 11:19 Sprite.z 阅读(9701) 评论(0) 推荐(0)
摘要:在很多ERP中进行表循环,是非常简单的。如QAD中用For each table就可以循环表,AX中用While select table。 在MSSQL中,可以通过两种方式进行表循环。1、通过游标。 1 declare @result table 2 ( 3 custid int, 4 ordermonth datetime, 5 qty int, 6 runqty int, 7 primary key(custid,ordermonth) 8 ); 9 10 declare 11 @custid as int,12 @prvcustid as int,13 @or... 阅读全文
posted @ 2012-08-27 10:59 Sprite.z 阅读(2554) 评论(2) 推荐(0)
摘要:也许很多人有写QQ空间的习惯,写博客嘛看心情了。作为一个IT技术人员,我认为写写博客是很有必要,一来可以记录一下自己的学习和成长历程,二来可以对自己知识体系有一个良好的总结。从事开发工作也有三年多了,最近没事在翻阅以前乱哄哄笔记、积累,竟然有点不知所衷,看来是应该找个地方把这些东西作个归档了。 直接选择了博客园,因为以前的很多疑问是从这里找到答案的。饮水思源,我也应该把自己的一些经验知识分享出来,以供有需要的人学习参考一下。 为什么叫Sprite(精灵),Sprite是Flex中的UI组件的基类,业内人叫它精灵类。这是一个非常有趣、有用和强大的类,通过它可以派生出自己想要UI组件,由于... 阅读全文
posted @ 2012-08-27 10:26 Sprite.z 阅读(186) 评论(0) 推荐(0)
摘要:在现在看来,大学当初选修C语言是非常正确的选择,即使到现在也没真正用过C进行任何程序的开发。 很多人在学习完C后,都不知道C能做什么,我当初也有这样的疑惑,因为在学习完之后,并不能利用C开发一个像样的系统,当然C高手并不以为然,但对于初学者来说是非常困难的。考试的机试也是非常简单的,写算法。给出一定的问题,要求写出能输出结果算法,不管你内部如何实现,只要是正确的黑盒子,都是可以得分的。 到目前为止,已从事三年多的开发工作,常用语言有ActionScript、C#和X++,但是仔细回想一样,程序本质是一直没变的,那就是基础算法 + 数据结构(面向对象只是代码的一种组织方式),而这些正是从... 阅读全文
posted @ 2012-08-27 10:07 Sprite.z 阅读(245) 评论(0) 推荐(0)