Last active
September 7, 2022 21:36
-
-
Save lockworld/35ded850f078ba6fb77cde2d0df489cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In many Epicor10 foms,there are controls that cannot be accessd directly because they are not stanard control types. | |
For example, on the IssueReturn form, the From Warehouse dropdown is a control of type Erp.Adapters.Controls.IRWarehouseCombo. But I am unable to use this control type in the script section in the standard fashion: | |
IRWarehouseCombo cbo = (IRWarehouseCombo)csm.GetNativeControlReference("GUID"); | |
This makes it difficult to change the value of this field. However, you can do so by | |
1. Changing the value of the underlying form data | |
2. Creating a generic reference to the IRWarehouseCombo element | |
3. Updating the generic reference | |
In the following snippet, I am setting the FromWarehouse and the FromBin to the location identified in earlier code, identified as MyWarehouseCode, MyWarehouseCodeDescription, and MyBinNumber. | |
*/ | |
EpiDataView dvIM = (EpiDataView)oTrans.EpiDataViews["IM"]; // Gets the underlying IssueMaterial data for the form. | |
Erp.BO.IssueReturnDataSet.IssueReturnRow irr = (Erp.BO.IssueReturnDataSet.IssueReturnRow)dvIM.CurrentDataRow; // Gets the row data and casts it as an IssueRetunRow | |
irr.FromWarehouseCode = MyWarehouseCode; | |
irr.FromWarehouseCodeDescription = MyWarehouseCodeDescription; // Needed so the dropdown box shows the correct text for the warehouse | |
irr.FromBinNum = MyBinNumber; | |
var cmbWhse = csm.GetNativeControlReference("d8cbd6bd-beed-4ca7-803c-f5a1023e4bbd"); // Gets the IRWarehouseCombo control as a generic Control | |
cmbWhse.Update(); // Update Warehouse Display | |
Bin.Update(); // Update Bin Disply |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use this code to ask the user to confirm before continuing | |
DialogResult dialogResult = MessageBox.Show("You have selected " + countToRemove + " out of " + rowCount + " rows to unallocate.\r\nAre you sure you want to continue?", "Confirm unallocations", MessageBoxButtons.YesNo); | |
if (dialogResult == DialogResult.Yes) | |
{ | |
// Do whatever | |
} | |
else | |
{ | |
// Don't do whatever | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The OrderAllocAdapter in Epicor is not functional following the standard procedures. Trying to get a filtered list of lots allocated to a job (or order) is next to impossible. | |
Fortunately, there is a way to force the OrderAllocAdapter to behave properly. It just takes some extra coding. | |
Attribution: From post by user E2BLou on https://www.epiusers.help/t/orderalloc-adapter-getlistoforders-method-whereclause-not-working/61813/4 (Posted Aug 2020, retreived Sep 2021) | |
*/ | |
OrderAllocAdapter oa = new OrderAllocAdapter(oTrans); | |
oa.BOConnect(); | |
string where = "JobNum='" + job + "' AND PartNum='" + inpart + "'"; | |
SearchOptions opts = new SearchOptions(SearchMode.AutoSearch); | |
oa.DefaultSearchType = Erp.Adapters.OrderAllocAdapter.SearchType.SO; | |
oa.SearchForm = new Erp.UI.Searches.OrderSearchForm(); | |
opts.SearchMethod = new AlternateSearchMethod(oa.GetListOfJobs); | |
opts.SelectMode = SelectMode.MultiSelect; | |
opts.PreLoadSearchFilter = where; | |
oa.InvokeSearch(opts); | |
oa.OrderAllocationGetRows(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment