I have a great (classic) custom dashboard using UD09 to store temporary information about parts in stock for open jobs. The form is pretty simple with a handful of textboxes/combo boxes used as inputs, along with a grid view to show the table contents.
The classic form uses some code to help populated the drop-down boxes, as well as to validate the data before submitting it to the database with a BPM inside my BAQ. Here is the customization code:
// **************************************************
// Custom code for MainController Open Job Inventory (Shipping Excel File)
// Created: 1/14/2021 10:45:51 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using System.Reflection;
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;
using Ice.Core;
using Erp.Adapters;
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
public EpiUltraCombo cmbBins;
public EpiUltraCombo cmbRevs;
public EpiUltraCombo cmbJobs;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
this.epiButtonDelRow.Click += new System.EventHandler(this.epiButtonDelRow_Click);
this.epiButtonAddRow.Click += new System.EventHandler(this.epiButtonAddRow_Click);
this.MyPartNum.Leave += new System.EventHandler(this.MyPartNum_Leave);
this.epiRevs.Leave += new System.EventHandler(this.epiRevs_Leave);
this.baqComboC1.Leave += new System.EventHandler(this.baqComboC1_Leave);
this.epiButtonC1.Click += new System.EventHandler(this.epiButtonC1_Click);
this.epiJobs.Leave += new System.EventHandler(this.epiJobs_Leave);
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.epiButtonDelRow.Click -= new System.EventHandler(this.epiButtonDelRow_Click);
this.epiButtonAddRow.Click -= new System.EventHandler(this.epiButtonAddRow_Click);
this.MyPartNum.Leave -= new System.EventHandler(this.MyPartNum_Leave);
this.epiRevs.Leave -= new System.EventHandler(this.epiRevs_Leave);
this.baqComboC1.Leave -= new System.EventHandler(this.baqComboC1_Leave);
this.epiButtonC1.Click -= new System.EventHandler(this.epiButtonC1_Click);
this.epiJobs.Leave -= new System.EventHandler(this.epiJobs_Leave);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void BAQRunCustomAction(EpiDataView iEdv, string iActionID)
{
BAQDataView BAQView = (BAQDataView)iEdv;
Assembly assembly = Assembly.LoadFrom("Ice.Lib.EpiClientLib.dll");
Type t = assembly.GetType("Ice.Lib.Framework.BAQUpdater");
BindingFlags bf = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
MethodInfo mi = t.GetMethod("BAQRunCustomAction", bf);
object[] param = new object[] { BAQView, iActionID};
mi.Invoke("Ice.Lib.Framework.BAQUpdater", param);
}
private void epiButtonDelRow_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
// Run custom code in BPM
string message = "These parts must be added to the inventory through Inventory Transfer before deleting them here. Are you sure you want to delete the selected records?";
string caption = "Are you sure?";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(message, caption, buttons);
if(result == DialogResult.Yes)
{
var edvV = oTrans.Factory("V_UD_OpenJobInventory_1View");
BAQRunCustomAction(edvV, "DeleteRows");
RefreshPage();
}
}
private void RefreshPage()
{
MainController.AppControlPanel.HandleToolClick("RefreshTool", new
Infragistics.Win.UltraWinToolbars.ToolClickEventArgs(MainController.MainToolManager.Tools["RefreshTool"], null));
MyPartNum.Text="";
epiRevs.Value="";
MyQuantity.Text="";
epiStatus.Value="";
epiUltraComboC1.Value="";
baqComboC1.Value="";
epiJobs.Value="";
MyNotes.Text="";
MyDate.Text="";
}
private void MainController_Load(object sender, EventArgs args)
{
// Add Event Handler Code
}
private void epiButtonAddRow_Click(object sender, System.EventArgs args)
{
//Verify text values before adding record
if (MyPartNum.Text == "")
{
MessageBox.Show("Part Number Missing!");
return;
}
if (epiJobs.Value.ToString() == "")
{
MessageBox.Show("Job Lot Number Missing!");
return;
}
if (epiRevs.Value.ToString() == "")
{
MessageBox.Show("Revision Number Missing!");
return;
}
if (baqComboC1.Value.ToString() == "")
{
MessageBox.Show("Warehouse Missing!");
return;
}
if (epiUltraComboC1.Value.ToString() == "")
{
MessageBox.Show("Bin Number Missing!");
return;
}
if (epiStatus.Value.ToString() == "")
{
MessageBox.Show("Status Missing!");
return;
}
// if (MyNotes.Text == "")
// {
// MessageBox.Show("Notes Missing!");
// return;
// }
if (MyQuantity.Text == "")
{
MessageBox.Show("Quantity Number Missing!");
return;
}
if (MyDate.Text == "")
{
MessageBox.Show("Date Missing!");
return;
}
EpiDataView edvCallContextBpmData = ((EpiDataView)(this.oTrans.EpiDataViews["CallContextBpmData"]));
System.Data.DataRow edvCallContextBpmDataRow = edvCallContextBpmData.CurrentDataRow;
edvCallContextBpmDataRow["Character01"] = MyPartNum.Text;
edvCallContextBpmDataRow["Character03"] = epiRevs.Value.ToString();
edvCallContextBpmDataRow["Character07"] = epiStatus.Value.ToString();
edvCallContextBpmDataRow["Character02"] = epiJobs.Value.ToString();
edvCallContextBpmDataRow["Character05"] = baqComboC1.Value.ToString(); //warehouse
edvCallContextBpmDataRow["Character04"] = epiUltraComboC1.Value.ToString(); //bin
edvCallContextBpmDataRow["Character06"] = MyNotes.Text;
edvCallContextBpmDataRow["Number01"] = MyQuantity.Text;
edvCallContextBpmDataRow["Date01"] = MyDate.Text;
var edvV = oTrans.Factory("V_UD_OpenJobInventory_1View");
BAQRunCustomAction(edvV, "AddRow");
RefreshPage();
}
private void getJobs()
{
cmbJobs = (Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("ab3e6a13-bcc2-45bb-8f27-e93f11951026");
DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
dqa.BOConnect();
QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("Jobs");
qeds.ExecutionParameter.Clear();
qeds.ExecutionParameter.AddExecutionParameterRow("part", MyPartNum.Text, "nvarchar", false, Guid.NewGuid(), "A");
qeds.ExecutionParameter.AddExecutionParameterRow("rev", epiRevs.Value.ToString(), "nvarchar", false, Guid.NewGuid(), "A");
dqa.ExecuteByID("Jobs", qeds);
if (dqa.QueryResults.Tables["Results"].Rows.Count > 0)
{
cmbJobs.DataSource = dqa.QueryResults.Tables["Results"];
cmbJobs.DisplayMember = "JobHead_JobNum";
cmbJobs.ValueMember = "JobHead_JobNum";
cmbJobs.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList;
oTrans.NotifyAll();
}
else
{
MessageBox.Show("No Open Jobs!");
}
}
private void getBins()
{
cmbBins = (Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("886dc91a-429b-4b5b-b900-9e87438facfc");
DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
dqa.BOConnect();
QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("Bins");
qeds.ExecutionParameter.Clear();
qeds.ExecutionParameter.AddExecutionParameterRow("Ware", baqComboC1.Value.ToString(), "nvarchar", false, Guid.NewGuid(), "A");
dqa.ExecuteByID("Bins", qeds);
if (dqa.QueryResults.Tables["Results"].Rows.Count > 0)
{
cmbBins.DataSource = dqa.QueryResults.Tables["Results"];
cmbBins.DisplayMember = "WhseBin_BinNum";
cmbBins.ValueMember = "WhseBin_BinNum";
cmbBins.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList;
oTrans.NotifyAll();
}
else
{
MessageBox.Show("No Bins in Warehouse!");
}
}
private void getRevs()
{
cmbRevs = (Ice.Lib.Framework.EpiUltraCombo)csm.GetNativeControlReference("a03dd350-74a0-4382-b1cb-251c5e41ed9a");
DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
dqa.BOConnect();
QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("getPartRev");
qeds.ExecutionParameter.Clear();
qeds.ExecutionParameter.AddExecutionParameterRow("part", MyPartNum.Text, "nvarchar", false, Guid.NewGuid(), "A");
dqa.ExecuteByID("getPartRev", qeds);
if (dqa.QueryResults.Tables["Results"].Rows.Count > 0)
{
cmbRevs.DataSource = dqa.QueryResults.Tables["Results"];
cmbRevs.DisplayMember = "PartRev_RevShortDesc";
cmbRevs.ValueMember = "PartRev_RevShortDesc";
cmbRevs.DropDownStyle = Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList;
oTrans.NotifyAll();
}
else
{
cmbRevs.DataSource = "";
cmbRevs.DisplayMember = "";
cmbRevs.ValueMember = "";
oTrans.NotifyAll();
MessageBox.Show("Part Not Found in Any Open Jobs!");
}
}
private void MyPartNum_Leave(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if (MyPartNum.Text!="")
{
getRevs();
cmbRevs.ForceRefreshList();
}
}
private void epiRevs_Leave(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if (epiRevs.Value.ToString()!="")
{
getJobs();
cmbJobs.ForceRefreshList();
MessageBox.Show("If the revision is not listed below, please enter the correct revision in the Notes section.");
//MessageBox.Show("Getting Jobs for part: " + MyPartNum.Text + " rev: " + epiRevs.Value.ToString());
}
}
private void baqComboC1_Leave(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if (baqComboC1.Value.ToString()!="")
{
//MessageBox.Show("Trying to Bet Bins...");
getBins();
epiUltraComboC1.ForceRefreshList();
}
}
private void epiButtonC1_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
RefreshPage();
}
private void epiJobs_Leave(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
if (epiJobs.Value.ToString()!="")
{
MessageBox.Show("The system does not track split lots. If this job has been split, please document the split lot information in the Notes section.");
}
}
}
I have deployed this dashboard to kinetic and I am looking at it in Application Studio. I want to add all the same data entry fields I used in classic. I am not sure about how to add the customization code that allows the drop-down boxes to show relevant data. I also use that custom code to validate the field contents before populating the next field. For example, the function getJobs() looks at the part number and tries to find jobs for that part. If jobs are found, then the combo is populated with the list of jobs to choose from. If jobs are not found, an error message notifies the user to check the data. I am also not sure how to use my “Add” button to trigger my uBAQs BPM.
I also pass values to BPM call context. How do I do that from Application Studio?
I am guessing none of this is possible in Kinetic, but I may be a bit cynical.