Epicor系统二次开发

一、获取或修改界面EpiDataView的字段数据(Get EpiDataView data)
  C#
  EpiDataView edv = (EpiDataView)oTrans.EpiDataViews["ViewName"];

  if(edv.dataView.Count > 0)
  {
    string someValue = (string)edv.dataView[edv.Row]["FieldName"];
    edv.dataView[edv.Row]["FieldName"] = someValue;
  }

  ------------------------------------------------------------------------------------------------------------------------------------------------------

  VB
  Dim edv As EpiDataView = CType(oTrans.EpiDataViews("ViewName"), EpiDataView)
  if edv.DataView.Count>0 then
    dim someValue as string = [edv].dataView([edv].Row)("FieldName")
    [edv].dataView([edv].Row)("FieldName") = someValue
  end if

  如果EpiDataView中有多行数据,例如incoming po suggestion或purchase suggestion,可以通过以下格式指定行号取得值
  统计行数:edv.DataView.Count
  取第100行的值:[edv].dataView(99)("FieldName")

二、获取Session字段数据(Get Session data )
  C#
  add reference Epicor.Mfg.Core.Session.dll
  using Epicor.Mfg.Core;
  string UserID = ((Epicor.Mfg.Core.Session)this.oTrans.Session).UserID;
  string CompanyID = ((Epicor.Mfg.Core.Session)this.oTrans.Session).CompanyID;

  E10
  Ice.Core.Session.dll
  using Ice.Core;
  string UserID = ((Ice.Core.Session)this.oTrans.Session).UserID;

三、call adapter 调用adapter的GetByID方法,获取adapter中的数据或更新数据,使用前必须先引用相应Adapter
  C#
  注意E10加Adapter需要在开始增加 using Erp.Adapters;

  PartAdapter adpPart = new PartAdapter(this.oTrans);
  adpPart.BOConnect();
  adpPart.GetByID("PART0001");

  string PartDescription = adpPart.PartData.Tables["Part"].Rows[0]["PartDescription"];

  adpPart.PartData.Tables["Part"].Rows[0]["PartDescription"]="PART0001 xxxxxx";
  adpPart.Update();

  adpPart.Dispose();

  
  VB
  Dim adpPart As PartAdapter = New PartAdapter(oTrans)
  adpPart.BOConnect()
  adpPart.GetByID("PART0001")

  string PartDescription = adpPart.PartData.Tables("Part").Rows(0)("PartDescription")

  adpPart.PartData.Tables("Part").Rows(0)("PartDescription")="PART0001 xxxxxx"
  adpPart.Update()

  adpPart.Dispose()

  
四、Search Data by Adapter 使用adapter查询数据,使用前必须先引用相应Adapter
  C#
  PartAdapter adpPart = new PartAdapter(this.oTrans);
  adpPart.BOConnect();
  bool MorePages;
  String whereClause = "PartNum='PART0001'";
  SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
  opts.NamedSearch.WhereClauses.Add("Part", whereClause);
  DataSet dsPart = adpPart.GetRows(opts, out MorePages);

  
  注意E10加Adapter需要在开始增加 using Erp.Adapters;

  VB
  Dim adpPart As PartAdapter = New PartAdapter(oTrans)
  adpPart.BOConnect()
  Dim MorePages As Boolean
  Dim whereClause As String = "PartNum='PART0001'"
  Dim opts As SearchOptions = New SearchOptions(SearchMode.AutoSearch)
  opts.NamedSearch.WhereClauses.Add("Part", whereClause)
  Dim dsPart As Data.DataSet = adpPart.GetRows(opts, MorePages)

  
五、Search Data by Epicor.Mfg.UI.FormFunctions.SearchFunctions 使用界面查询功能查询数据并返回值到当前界面EpiDataView,但数据列只有部分,类似于标准界面上的查询功能,适用于快速查询基本数据。
  --使用Simple Search向导产生以下代码
  C#
  bool recSelected;
  string whereClause = string.Empty;
  //"StartDate <= '" + ApplyDate.ToString("MM/dd/yyyy") + "'"; 如果是日期值转换月日年格式后,两边要加单引号
  System.Data.DataSet dsCurrencyAdapter = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "CurrencyAdapter", out recSelected, true, whereClause);
  if (recSelected)
  {
    // Map Search Fields to Application Fields
    System.Data.DataRow adapterRow = dsCurrencyAdapter.Tables[0].Rows[0];

    EpiDataView edvPODetail = ((EpiDataView)(this.oTrans.EpiDataViews["PODetail"]));
    System.Data.DataRow edvPODetailRow = edvPODetail.CurrentDataRow;
    if ((edvPODetailRow != null))
    {
      edvPODetailRow.BeginEdit();
      edvPODetailRow["ShortChar10"] = Convert.ToString(adapterRow["CurrencyCode"]);
      edvPODetailRow.EndEdit();  
    }
  }

  E10: Ice.UI.FormFunctions.SearchFunctions
  发现这种方法不能取得ud field的值。

  VB
  Dim recSelected As Boolean
  Dim whereClause As String = String.Empty
  Dim dsResourceGroupAdapter As System.Data.DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(Me.oTrans, "ResourceGroupAdapter", recSelected, False, whereClause)
  If recSelected Then
    Dim adapterRow As System.Data.DataRow = dsResourceGroupAdapter.Tables(0).Rows(0)

    ' Map Search Fields to Application Fields
    Dim edvJobOpDtl As EpiDataView = CType(Script.oTrans.EpiDataViews("JobOpDtl"),EpiDataView)
    Dim edvJobOpDtlRow As System.Data.DataRow = edvJobOpDtl.CurrentDataRow
    If (Not (edvJobOpDtlRow) Is Nothing) Then
      edvJobOpDtlRow.BeginEdit
      edvJobOpDtlRow("Character01") = adapterRow("ResourceGrpID")
      edvJobOpDtlRow.EndEdit
    End If
  End If

六、InvokeSearch 查詢數據,類似GetRows()
  System.Collections.Hashtable myHash = new System.Collections.Hashtable();
  string wClause = “Key1 = ‘“ + key1 + “‘“;
  myHash.Add(“UD100A”, wClause);
  SearchOptions opts = Epicor.Mfg.UI.Searches.SearchOptions.CreateRuntimeSearch(myHash,DataSetMode.RowsDataSet);
  ud100Adapter.InvokeSearch(opts);
  ucbCarrierSize.DataSource = ud100Adapter.UD100Data.UD100A;
  
  
七、 EpiViewNotification 窗体事件,例如不允许访问某供应商的PO
  --选择窗体事件向导产生以下代码
  C#
  private void edvPOHeader_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
  {
    // ** Argument Properties and Uses **
    // view.dataView[args.Row]["FieldName"]
    // args.Row, args.Column, args.Sender, args.NotifyType
    // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
    
    if ((args.NotifyType == EpiTransaction.NotifyType.Initialize)) //选择记录的时候
    {
      if ((args.Row > -1))
      {
        //MessageBox.Show((string)view.dataView[args.Row]["VendorVendorID"]);
        if((string)view.dataView[args.Row]["VendorVendorID"]=="S0000022")
        {
          oTrans.ClearDataSets();
          //throw new UIException("不能访问此供应商");
          throw new Exception("不能访问此供应商");
          //MessageBox.Show("不能访问此供应商");
        }

      }
    }

    if ((args.NotifyType == EpiTransaction.NotifyType.AddRow)) //新加记录的时候
    {
      if ((args.Row > -1))
      {
        //MessageBox.Show("EpiTransaction.NotifyType.AddRow");
      }
    }
  }

八、Before Form change FormEvent args.ProposedValue及args.Row["UOMCode"]的区别,args.ProposedValue是操作时选择的内容但args.Row["UOMCode"]是没有值的。
  private void PriceLstParts_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)
  {
    switch (args.Column.ColumnName)
    {
      case "PartNum":

      break;
      case "UOMCode":
        //MessageBox.Show(args.Row["UOMCode"].ToString().Length.ToString()+"/" + args.ProposedValue.ToString());
        if(args.ProposedValue.ToString().Length>0)
        {
          bool ChkDupPart = CheckDupPartByListCode(args.Row["ListCode"].ToString(),args.Row["PartNum"].ToString());
          if(ChkDupPart)
          {
            //MessageBox.Show("Duplicate Part: " + args.Row["PartNum"].ToString());
            throw new Exception("Duplicate Part Not Allow. PartNum: " + args.Row["PartNum"].ToString());
          }
        }

      break;
    }

  }

    throw new EpiUIException(); which library?

    [Table/ViewName]_BeforeFieldChange() Handles DataTable.ColumnChanging event
    This event handler is called before users can shift focus away from a field with changed data bound to a DataSource
    and DataField. It performs the following events:
    ? This event handler can validate the entered value of a field.
    ? If the value is not valid, then you can prevent the user from leaving the field until a correct value is entered.
    To prevent users from leaving a field that is not validated, you can use this C# code:
    throw new EpiUIException();

epiUltraGrid 控件:

----Hidden UltraGrid Column 隐藏epiUltraGrid某列
C#
epiUltraGridC1.DisplayLayout.Bands[0].Columns[0].Hidden = true;

VB
epiUltraGridC1.DisplayLayout.Bands(0).Columns(0).Hidden = true

----Edit UltraGrid display ColumnName 修改epiUltraGrid列显示名称
C#
epiUltraGridReqSummary.DisplayLayout.Bands[0].Columns["Net_Req_Lots"].Header.Caption = "Net Req Shot [D/E]";

VB
epiUltraGridReqSummary.DisplayLayout.Bands(0).Columns("Net_Req_Lots").Header.Caption = "Net Req Shot [D/E]"

----select epiUltraGrid row 代码选择epiUltraGrid某一行并赋值
C#
epiUltraGridShipInfo.ActiveRow = epiUltraGridOnhandLotInfo.Rows[3];
epiUltraGridShipInfo.ActiveRow.Cells["ShipQty"].Value = 999;
将鼠标选中当前行
epiUltraGridShipInfo.ActiveRow.Selected = true

VB
epiUltraGridShipInfo.ActiveRow = epiUltraGridOnhandLotInfo.Rows(3)
epiUltraGridShipInfo.ActiveRow.Cells("ShipQty").Value = 999
将鼠标选中当前行
epiUltraGridShipInfo.ActiveRow.Selected = true

-----epiUltraGrid ActiveCell epiUltraGrid某单元格值发生改变之后
VB
Private Sub epiUltraGridC1_AfterCellUpdate(ByVal sender As Object, ByVal args As Infragistics.Win.UltraWinGrid.CellEventArgs)
Select Case args.Cell.Column.Key
Case "Character01"
......
End Select
End Sub

----Format epiUltraGrid Amount Column
C#
epiUltraGridC1.DataSource=adapterDynamicQuery.QueryResults;
epiUltraGridC1.DisplayLayout.Bands[0].Columns["EmpExpense.DocTotalExpenseAmt"].Format = "#,##0.00";
epiUltraGridC1.DisplayLayout.Bands[0].Columns["EmpExpense.DocTotalExpenseAmt"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;

----设置epiUltraCombo下拉显示列宽

this.epiUltraComboLOB.DropDownWidth = 200;

----时间选择
在系统中一般日期与时间是分开存储,时间部分是使用数值字段存储,例如自订义字段Number01,例如客制化加入epiTimeEditor控件,绑定Number01,选择时间是 10:15 AM,在系统保存此数据时,Number01的值自动是36900,计算方法:epiTimeEditor 10:15 AM = 10*3600 + 15*60 = store Database Integer 36900

----关闭窗体 窗体名.Close()
PartForm.Close()

----You can also create code that casts to a specific control type:
VB Code:
Dim eucSales As EpiUltraCombo = CType(csm.GetNativeControlReference("5483cdef-3049-4705-b597-28ae93bc7fdf"), EpiUltraCombo)
C# Code:
EpiUltraCombo eucSales = (EpiUltraCombo )csm.GetNativeControlReference("5483cdef-3049-4705-b597-28ae93bc7fdf");

Control.Combos is EpiCombo

---隐藏下拉菜单功能

private static void baseToolbarsManager_BeforeToolDropdown(object sender, Infragistics.Win.UltraWinToolbars.BeforeToolDropdownEventArgs args)
{
baseToolbarsManager.Tools["RemovePOLinkTool"].SharedProps.Visible = false;
baseToolbarsManager.Tools["IncomingICPOSugTool"].SharedProps.Visible = false;
baseToolbarsManager.Tools["SendICPOSugTool"].SharedProps.Visible = false;

}

---Set EpiUltraCombo Properties

this.epiUltraComboShipTo.ValueMember = "CustNum";
this.epiUltraComboShipTo.DataSource = dsCustomerAdapter;
this.epiUltraComboShipTo.DisplayMember = "Name";
string[] fields = new string[] {
"Name"};
this.epiUltraComboShipTo.SetColumnFilter(fields);

--fill epiUltraCombo

private void FillepiUltraComboFamily()
{
DataTable TB = new DataTable();
DataRow DR;

TB.Columns.Add("Family", typeof(String));

DR = TB.NewRow();
DR["Family"] = "FG";
TB.Rows.Add(DR);
DR = TB.NewRow();
DR["Family"] = "RM";
TB.Rows.Add(DR);

// Set EpiUltraCombo Properties
this.epiUltraComboFamily.ValueMember = "Family";
this.epiUltraComboFamily.DataSource = TB;
this.epiUltraComboFamily.DisplayMember = "Family";
string[] fields = new string[] {
"Family"};
this.epiUltraComboFamily.SetColumnFilter(fields);
}

Epicor系统二次开发的更多相关文章

  1. (dede)织梦系统二次开发笔记

    (dede)织梦系统二次开发记录 --soulsjie 一.模板常用文件说明 模板文件都在文件夹templets下,我们以默认模板(default)为例,对模板文件结构进行分析: 首页模板文件目录 \ ...

  2. IBOS云办公系统二次开发之功能介绍(PHP技术)

    IBOS自动化办公系统是我见到的功能.架构最好的开源自动化办公系统,功能与企业需求吻合度之高.架构之灵活,让我不得不将之介绍给大家,让跟多需要学习PHP开发的朋友来了解她,拥抱她! 如果您还没有很好的 ...

  3. Ecshop系统二次开发教程及流程演示

      来源:互联网 作者:佚名 时间:03-01 16:05:31 [大 中 小] Ecshop想必大家不会觉得陌生吧,大部分的B2C独立网店系统都用的是Ecshop系统,很受用户的喜爱,但是由于Ecs ...

  4. python-Django监控系统二次开发Nagios

    1.Nagios安装 yum install -y nagios.i686 yum install -y nagios-plugins-all.i686 安装完后会在apache的配置文件目录下/et ...

  5. shopnc二次开发(一)

    ---恢复内容开始--- 以前没有怎么接触过shopnc,感觉界面挺漂亮的,不过后来自己需要开发一个电商系统,就顺便参考了下,感觉构架垃圾的一塌糊涂.不过平时做这个系统二次开发的业务比较多,所以简单的 ...

  6. 解析大型.NET ERP系统 窗体、查询、报表二次开发

    详细介绍Enterprise Solution 二次开发的流程步骤,主要包括数据输入窗体(Entry Form),查询(Query/Enquiry),报表(Report)三个重要的二次开发项目. 数据 ...

  7. 美客分销商城-接力购源码系统,全开源代码可进行二次开发,微信小程序分销商城

    1. 准备服务器.域名(SSL证书).认证的微信小程序.微信支付商户号 2. 系统功能简介 三.演示案例,微信扫码查看 四.后台管理系统 五. 全套开源源码,进行二次开发 六.本系统完美运营,全套代码 ...

  8. jeecms系统使用介绍——通过二次开发实现对word、pdf、txt等上传附件的全文检索

    转载请注明出处:http://blog.csdn.net/dongdong9223/article/details/76912307 本文出自[我是干勾鱼的博客] 之前在文章<基于Java的门户 ...

  9. 分享泛微公司OA系统用于二次开发的sql脚本

    本单位用的oa系统就是泛微公司的oa协同办公平台,下面是我对他进行二次开发统计用到的写数据库脚本,只做开发参考使用,对于该系统的二次开发技术交流可以加我q:2050372586 [仪表盘]格式sql编 ...

随机推荐

  1. Light OJ 1316 A Wedding Party 最短路+状态压缩DP

    题目来源:Light OJ 1316 1316 - A Wedding Party 题意:和HDU 4284 差点儿相同 有一些商店 从起点到终点在走过尽量多商店的情况下求最短路 思路:首先预处理每两 ...

  2. SQL点滴9—SQL Server中的事务处理以及SSIS中的内建事务

    原文:SQL点滴9-SQL Server中的事务处理以及SSIS中的内建事务 我们可以把SSIS中的整个package包含在一个事务中,但是如果在package的执行过程中有一个表需要锁定应该怎么处理 ...

  3. jQuery EasyUI API - Base - Draggable [原创汉化官方API]

    最近在学习jQuery EasyUI,发现中文的文档好少,部分文档不错但它是鸟语的,为了大家也为了自己学习吧,汉化做一下笔记. 有没有说清楚的,或者翻译不正确的地方还请大家谅解指出.. 由于工作时间原 ...

  4. 在OpenWrt上编写自己的硬件操作程序

    上一篇文章中有写到如何使用OPENWRT的SDK,这里继续,写怎么在上面开发自己的应用程序. 我欲在OpenWrt上编写一个软件,它能够去读取某个AD芯片的多通道采样值. 在看这篇文章之前请看这官方的 ...

  5. Linux内核头文件与内核与库的关系

    看上一篇文章中对buildroot的介绍,里面的文档第 3.1.1.1 Internal toolchain backend 节内容 C库会去访问Linux kernel headers(*.h)文件 ...

  6. 打开VMware的系统出错

    打开VMware系统时,出现错误 “Invalid configuration file. File "I:/My Virtual Machines/Windows XP english P ...

  7. 百度Web App在线生成平台Site App体验

    最近收到百度开发者中心邮件,告知之前的百度移动建站服务已经升级为Site App了,Site  App顾名思义是可以创建APP的站点,之前想建立一个APP要么是自己制作,要么是选用国外的在线Web A ...

  8. NHProfiler使用方法

    NHProfiler使用方法 NHProfiler是一个针对Nhibernate运行分析的工具. 使用如下: (1)在创建ISessionFactory的项目中引用NHProfiler安装目录下的Hi ...

  9. ASP.NET MVC + 百度富文本编辑器 + EasyUi + EntityFrameWork 制作一个添加新闻功能

    本文将交大伙怎么集成ASP.NET MVC + 百度富文本编辑器 + EasyUi + EntityFrameWork来制作一个新闻系统 先上截图: 添加页面如下: 下面来看代码部分 列表页如下: @ ...

  10. 真与假与c#,java中的不同之处

    /************真与假************/ /*C语言中:真(非0).假(0) * Java.C#中:真(true).假(false) * JavaScript中:真(非0.true. ...