Casting OrderAllocDataSet to SlimOrderAllocDataSet

Hello All,

First, I am very appreciative to all who post to this forum. I have learned immensely from reading posts here, and hope to be able to contribute in my own time.

I am attempting to automate Order Reservation in Fulfillment Workbench. I have executed a trace log and seem to have the methods down, I just cannot seem to mirror the following two methods in OrderAllocImpl:

CheckDates() and AutoReserve()

I cannot seem to cast, or find the method or properties needed, to create a SlimOrderAllocDataSet from a OrderAllocDataSet. The method before the above two methods, OrderAllocationGetRows() returns an OrderAllocDataSet, and then the very next method is CheckDates, which accepts a SlimOrderAllocDataSet.

I noticed the OrderAllocAdapter returns a SlimOrderAllocDataSet, but I do not know if that is what I am looking for. I did look at the Methods and properties available in OrderAlloc.dll, but to no avail.

Thanks!

You can declare a new SlimOrderAllocDataSet as follows:
SlimOrderAllocDataSet dsSlim = new SlimOrderAllocDataSet();
and copy only the columns needed for the SlimOrderAllocDataSet from OrderAllocDataSet.

2 Likes

Thank you Prabin. Here is my initial code for Automating the reservation process. There is a lot of testing yet to go, but seems to work in that it returns the same message I get when I use Epicor’s function. With the help of Prabin’s suggestion, I looped through the OrderAllocDataSet and inserted each row into a SlimOrderAllocDataSet.

	string waveWhereClause = String.Empty;
	string orderHedWhereClause = "OrderHed.OrderHeld = false";
	string orderDtlWhereClause = String.Empty;
 	string orderRelWhereClause = String.Empty;
	string customerWhereClause = String.Empty;
	string partAllocWhereClause = "NoFilter,NoFilter,NoFilter,NoFilter";
	string countryWhereClause = String.Empty;
		string shipToWhereClause = String.Empty;
	string creditHoldClause = "NoFilter";
	string i_SortByOrder = String.Empty;
	string i_SortByWarehouse = String.Empty;
	string i_SortByAllocation = String.Empty;
	//return 1 entry for testing purposes
	int	pageSize = 1;
	int    absolutePage = 0;
	bool   morePages = false;
	string NO_Company = String.Empty;
	DataSet CallContextDataSet = CallContextDataView.dataView.Table.DataSet;

	
	try{

			Erp.Proxy.BO.OrderAllocImpl oa = WCFServiceSupport.CreateImpl<Erp.Proxy.BO.OrderAllocImpl>(((Ice.Core.Session)oTrans.Session), Epicor.ServiceModel.Channels.ImplBase<Erp.Contracts.OrderAllocSvcContract>.UriPath);
			Erp.BO.OrderAllocListDataSet OrderAllocDS = oa.GetListOfOrders(waveWhereClause, 
							orderHedWhereClause, orderDtlWhereClause, orderRelWhereClause, customerWhereClause, partAllocWhereClause,
							countryWhereClause, shipToWhereClause, creditHoldClause, i_SortByOrder, i_SortByWarehouse, i_SortByAllocation, pageSize, 
							absolutePage, out morePages, NO_Company);
			

			OrderList.DataSource = OrderAllocDS;

			Erp.BO.OrderAllocDataSet oaDataSet = oa.OrderAllocationGetRows(OrderAllocDS, 0);
			Erp.BO.OrderAllocDataSet.OrderAllocDataTable test = oaDataSet.OrderAlloc;


	
			
			
		


			Erp.BO.SlimOrderAllocDataSet testSet = new Erp.BO.SlimOrderAllocDataSet();
			Erp.BO.SlimOrderAllocDataSet.SlimOrderAllocDataTable testTable = new Erp.BO.SlimOrderAllocDataSet.SlimOrderAllocDataTable();
			
			



			for (int i = 0; i < test.Rows.Count; i++){
				//MessageBox.Show(i.ToString());
				DataRow oar = test.Rows[i];
				testSet.SlimOrderAlloc.ImportRow(test.Rows[i]);

			}
			

			string cMessageText = String.Empty;
			oa.CheckDates(testSet, out cMessageText);
			string cIPWhseList = String.Empty;
			string CWhseType = "primaryonly";
			oa.AutoReserve(testSet, cIPWhseList, CWhseType, out cMessageText);
			MessageBox.Show(cMessageText);
	}

	catch(Exception ex){
	
		MessageBox.Show(ex.ToString());
	}