Epicor系統(tǒng)二次開(kāi)發(fā)-創(chuàng)新互聯(lián)


一、獲取或修改界面EpiDataView的字段數(shù)據(jù)(Get EpiDataView data)
  C#
  EpiDataView edv = (EpiDataView)oTrans.EpiDataViews["ViewName"];

七星網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,七星網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為七星上千多家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)要多少錢(qián),請(qǐng)找那個(gè)售后服務(wù)好的七星做網(wǎng)站的公司定做!

  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中有多行數(shù)據(jù),例如incoming po suggestion或purchase suggestion,可以通過(guò)以下格式指定行號(hào)取得值
  統(tǒng)計(jì)行數(shù):edv.DataView.Count
  取第100行的值:[edv].dataView(99)("FieldName")


二、獲取Session字段數(shù)據(jù)(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 調(diào)用adapter的GetByID方法,獲取adapter中的數(shù)據(jù)或更新數(shù)據(jù),使用前必須先引用相應(yīng)Adapter
  C#
  注意E10加Adapter需要在開(kāi)始增加 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查詢(xún)數(shù)據(jù),使用前必須先引用相應(yīng)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需要在開(kāi)始增加 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 使用界面查詢(xún)功能查詢(xún)數(shù)據(jù)并返回值到當(dāng)前界面EpiDataView,但數(shù)據(jù)列只有部分,類(lèi)似于標(biāo)準(zhǔn)界面上的查詢(xún)功能,適用于快速查詢(xún)基本數(shù)據(jù)。
  --使用Simple Search向?qū)Мa(chǎn)生以下代碼
  C#
  bool recSelected;
  string whereClause = string.Empty;
  //"StartDate <= '" + ApplyDate.ToString("MM/dd/yyyy") + "'"; 如果是日期值轉(zhuǎn)換月日年格式后,兩邊要加單引號(hào)
  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
  發(fā)現(xiàn)這種方法不能取得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 查詢(xún)數(shù)據(jù),類(lèi)似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 窗體事件,例如不允許訪(fǎng)問(wèn)某供應(yīng)商的PO
  --選擇窗體事件向?qū)Мa(chǎn)生以下代碼
  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)) //選擇記錄的時(shí)候
    {
      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("不能訪(fǎng)問(wèn)此供應(yīng)商");
          throw new Exception("不能訪(fǎng)問(wèn)此供應(yīng)商");
          //MessageBox.Show("不能訪(fǎng)問(wèn)此供應(yīng)商");
        }

      }
    }

    if ((args.NotifyType == EpiTransaction.NotifyType.AddRow)) //新加記錄的時(shí)候
    {
      if ((args.Row > -1))
      {
        //MessageBox.Show("EpiTransaction.NotifyType.AddRow");
      }
    }
  }


八、Before Form change FormEvent args.ProposedValue及args.Row["UOMCode"]的區(qū)別,args.ProposedValue是操作時(shí)選擇的內(nèi)容但args.Row["UOMCode"]是沒(méi)有值的。
  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列顯示名稱(chēng)
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;
將鼠標(biāo)選中當(dāng)前行
epiUltraGridShipInfo.ActiveRow.Selected = true

VB
epiUltraGridShipInfo.ActiveRow = epiUltraGridOnhandLotInfo.Rows(3)
epiUltraGridShipInfo.ActiveRow.Cells("ShipQty").Value = 999
將鼠標(biāo)選中當(dāng)前行
epiUltraGridShipInfo.ActiveRow.Selected = true

-----epiUltraGrid ActiveCell epiUltraGrid某單元格值發(fā)生改變之后
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;


----設(shè)置epiUltraCombo下拉顯示列寬

this.epiUltraComboLOB.DropDownWidth = 200;


----時(shí)間選擇
在系統(tǒng)中一般日期與時(shí)間是分開(kāi)存儲(chǔ),時(shí)間部分是使用數(shù)值字段存儲(chǔ),例如自訂義字段Number01,例如客制化加入epiTimeEditor控件,綁定Number01,選擇時(shí)間是 10:15 AM,在系統(tǒng)保存此數(shù)據(jù)時(shí),Number01的值自動(dòng)是36900,計(jì)算方法:epiTimeEditor 10:15 AM = 10*3600 + 15*60 = store Database Integer 36900

----關(guān)閉窗體 窗體名.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);
}

網(wǎng)頁(yè)題目:Epicor系統(tǒng)二次開(kāi)發(fā)-創(chuàng)新互聯(lián)
文章源于:http://www.muchs.cn/article6/dsssog.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作網(wǎng)站制作、服務(wù)器托管、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)、面包屑導(dǎo)航網(wǎng)站導(dǎo)航

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

綿陽(yáng)服務(wù)器托管