当前位置: 代码迷 >> 综合 >> D365 批处理案例一:普通批处理
  详细解决方案

D365 批处理案例一:普通批处理

热度:10   发布时间:2023-10-25 09:14:35.0
class Test extends RunBaseBatch
{DialogField         startdateField,enddateField,branchCodeField;FormBuildStringControl   branchCodeControl;str branchSum;date startdate,enddate;//批处理用于存储数据#define.CurrentVersion(1)#localMacro.CurrentListbranchSum,startdate,enddate#endMacropublic boolean unpack(container packedClass){Integer          version         = conPeek(packedClass,1);switch (version){case #CurrentVersion:[version,#CurrentList] = packedClass;break;default:return false;}return true;}public container pack(){return [#CurrentVersion,#CurrentList];}/// <summary>////// </summary>/// <returns></returns>public Object dialog(){DialogRunbase dialog = super();dialog.caption("Test");this.getlast();startdateField      = dialog.addField(extendedTypeStr(TransDate),"@SYS5209");enddateField        = dialog.addField(extendedTypeStr(TransDate),"@SYS14656");branchCodeField     = dialog.addFieldValue(extendedTypeStr(name),branchSum);branchCodeControl   = branchCodeField.control();branchCodeControl.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(Test, lookupBranch), this);//用于lookup多选branchCodeControl.replaceOnLookup(false);startdateField.value(startdate);enddateField.value(enddate);branchCodeField.value(branchSum);return dialog;}public static void Main(Args _args){Testpr = new Test();if(pr.prompt()){pr.run();}}protected void lookupBranch(FormStringControl _control){Query query = new Query();QueryBuildDataSource  queryBuildDataSource;SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(Table), _control);sysTableLookup.addLookupField(fieldNum(Table, BranchCode));sysTableLookup.parmQuery(query);sysTableLookup.performFormLookup();}/// <summary>////// </summary>/// <returns></returns>public ClassDescription caption(){ClassDescription ret;ret = super();ret = '测试';return ret;/// <summary>////// </summary>/// <returns></returns>public boolean getFromDialog(){boolean ret;ret = super();startdate = startdateField.value();enddate   = enddateField.value();branchSum= branchCodeField.value();this.saveLast();return ret;}/// <summary>////// </summary>public void run(){}}