Epicor系统二次开发_epiultragrid-程序员宅基地

技术标签: 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);
}

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/lin240052472/article/details/104899868

智能推荐

用 Vue3 手撕了个企业级项目,真香!-程序员宅基地

文章浏览阅读1.9k次。最近几年,随着短视频、小程序、直播带货的火爆,前端开发工程师越来越热门,薪资待遇也快接近后端开发工程师了,前端领域进化为内卷重灾区。然而伴随着 Vue 3.0 的发布,前端技术也迎来了一次大革新,像是字节跳动、腾讯等开始重点考察,前端程序员对 Vue 3 框架的理解和实际应用能力。不再是当年懂个生命周期、虚拟 DOM,就可以轻松进大厂的时代了。同时网上也掀起了一股学习 Vue 3 的热潮,面对着网..._手撕vue3 双向

ITRON系统_itron操作系统-程序员宅基地

文章浏览阅读5.5k次。ITRON系统使用方法目录1引言 42ITRON系统介绍 52.1概要 52.2构成 52.2.1ITRON系统构成 52.2.2ITRON体系结构 52.3应用领域 62.4如何使用ITRON系统 63ITRON的基本机能 83.1Task管理机能 83.1.1Task 83.1.2任务调_itron操作系统

C-index/C-statistic 计算的5种不同方法及比较_模型之间c statistics的比较方法-程序员宅基地

文章浏览阅读3.4w次,点赞24次,收藏147次。前言声明: 所有计算基于R软件,如果有人问其他软件如何实现,请自行Google。评价一个预测模型的表现可以从三方面来度量:区分能力(discrimination): 指的是模型区分有病/没病,死亡/活着等结局的预测能力。简单举个例子,比如说,现有100个人,50个有病,50个健康;你用预测模型预测出46个有病,54个没病。那么这46个覆盖到50个真正有病的人的多少就直接决定了你模型_模型之间c statistics的比较方法

System.BadImageFormatException: 未能加载文件或程序集“Oracle.DataAccess”或它的某一个依赖项。试图加载格式不正确的程序。-程序员宅基地

文章浏览阅读2.2w次。今天更新webservices的时候,如下图: 报出了下面的错误: 在服务端打开asmx文件时,错误信息如下:“/”应用程序中的服务器错误。未能加载文件或程序集“Oracle.DataAccess”或它的某一个依赖项。试图加载格式不正确的程序。说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈_system.badimageformatexception: 未能加载文件或程序集“oracle.dataaccess”或

docker进程相关命令_docker 进程查看命令-程序员宅基地

文章浏览阅读259次。docker进程相关命令1、启动docker服务:systemctl start docker2、停止docker服务:systemctl stop docker3、重启docker服务:systemctl restart docker4、查看docker服务状态:systemctl status docker5、设置开机启动docker服务:systemctl enable docker..._docker 进程查看命令

【Java】【网络编程】解决http请求的url中不能包含特殊字符的问题_java请求路径无法添加.符号-程序员宅基地

文章浏览阅读1w次。根据RFC规范,URL中只允许包含以下特殊字符! # $ & ' ( ) * + , - . / : ; = ? @ _ ~ 0-9 a-z A-Z如果需要使用其它字符,则需要在客户端对URL进行编码,再在服务端进行解码 URLEncoder.encode("https://www.baidu.com/?data={..._java请求路径无法添加.符号

随便推点

SolidWorks生成URDF文件,并配置_solidworks 并联机构urdf设置-程序员宅基地

文章浏览阅读6.1k次。SolidWorks生成URDF文件,并配置本文主要讲解如何生成URDF,然后通过MoveIt Setup Assistant配置urdf文件。主要有以下几点: 1:sw_urdf_exporter插件。 2:配置生成可执行的包。(插件生成的是ros包,不是简单的文件_solidworks 并联机构urdf设置

关于farpoint设置自动列宽行高及单元格内容自动换行举例_farpoint 自动换行-程序员宅基地

文章浏览阅读8.2k次,点赞2次,收藏4次。关于farpoint如何设置 单元格换行 及自动调整行高 行宽。FarPoint.Win.Spread.CellType.TextCellType text = newFarPoint.Win.Spread.CellType.TextCellType(); text.Multiline = true; _farpoint 自动换行

Eclipse安装ADT插件错误-程序员宅基地

文章浏览阅读724次。今天重新搭建一套Android开发环境,按照步骤在eclipse中install ADT的时候出错接下来点之后出现以下错误Cannot complete the install because one or more required itemscould not be found.Software being installed: Android Development T

架构思维成长系列教程(十二)- 云平台架构设计_云平台架构图设计-程序员宅基地

文章浏览阅读3.3k次,点赞2次,收藏9次。背景云平台是个非常宽泛的领域,一般分成:IaaS 基础设施即服务、PaaS 平台即服务、SaaS 软件即服务,本文侧重介绍企业私有云平台架构。内容云平台技术架构云平台技术架构如图所示,这是一个完整的企业级应用平台,由三个部分组成:底层的存储资源、计算资源、网络资源, 中间层的容器服务、缓存服务、健康检查服务等, 最上层的业务应用、接口应用等这是用云的架构思想构建的企业级应用。IaaS重点介绍一下 IaaS 部分,可以通过打造 Iaas 来构建企业级的私有云平台。_云平台架构图设计

java统计字符出现次数_java计算字符串中某个字符出现的次数-程序员宅基地

文章浏览阅读1.2k次,点赞3次,收藏7次。方法一:public static void main(String[] args) { String str="我的祖国,我爱你伟大的国度!"; Map map=getCount(str); System.out.println(map); } public static Map getCount(String str){ Map map=new Hash..._java计算字符串中某个字符出现的次数

mdns_mdns java 域名注册-程序员宅基地

文章浏览阅读2.7k次,点赞2次,收藏3次。文章目录DNSmDNSmDNS工作原理DNSDNS又称为域名服务系统:Domain Name System简单来说,我们一般记忆的都是域名,比如www.baidu.com,我们将域名输入浏览器,浏览器就要解析域名,这时候就要使用到DNS服务了,DNS服务中存储了域名与IP的映射对,可以通过这个域名找到对应的 IPmDNS百科中称为多播DNS参考允许系统在局域网中广播查..._mdns java 域名注册

推荐文章

热门文章

相关标签