How to Update Job Operations from Customer Shipment Entry in Epicor ERP

Home  /  Solutions and Services  /  Epicor and ERP  /  How to Update Job Operations from Customer Shipment Entry in Epicor ERP

Customer Shipment Entry

Update Job Operations from Customer Shipment Entry

Using customizations in Epicor you can update a completely different object from the screen you are currently working on.

For example, when I set a Customer Shipment Entry as “Shipped” by checking the “ReadyToInvoice” checkbox, I was then able to set the “OpComplete” field as true for the Job Operations that were tied to the shipment.


Step 1.

First, I went to the Customer Shipment Entry screen and created a customization.

Assuming you are familiar with creating a customization, click on the “Script Editor” tab in your customization.

In order to access the Job Operation object, you can use the JobEntryAdapter by adding the appropriate assemblies first. In the menu bar of the customization screen, select “Tools” and then “Assembly Reference Manager” to open a new window. In the lower, right-hand corner of the window, click on the “Add Custom Reference” button.

Step 2.

Select the following DLL files and click on the “Open” button.

  • Epicor.Mfg.AD.JobEntry
  • Epicor.Mfg.BO.JobEntry

Step 3.

You will now see your newly added assemblies under the “Custom Assemblies” folder.

After you have closed the window, be sure to add the following using statement to the top of your code:

using Epicor.Mfg.Lib;

On the “Form Event Wizard”, set the “Select Event Type” to “AfterFieldChange” for table “ShipHead” and field “ReadyToInvoice.” This way, the following code will fire when the checkbox is set to “true.”

private void ShipHead_AfterFieldChange(object sender, DataColumnChangeEventArgs args)

{

switch (args.Column.ColumnName)

{

case "ReadyToInvoice":

if (args.Row["ReadyToInvoice"].ToString() == "True")

{

// Take action here!

}

break;

}

}

Step 4.

Now you can use the JobEntryAdapter to call the “GetData” method to retrieve all the job operations that match the Job you want to update.

JobEntryAdapter adapter = new JobEntryAdapter(oTrans);

adapter.BOConnect();

string jobNumber = “123”;

System.Data.DataSet dataset = adapter.GetData(jobNum);

Step 5.

Loop through the dataset and make sure you can access table “JobOper.”

Then for each row, set the “OpComplete” field as true, and call the update method.

if (dataset != null)

{

if (dataset.Tables["JobOper"] != null &;&; dataset.Tables["JobOper"].Rows.Count > 0)

{

DataTable dt = dataset.Tables["JobOper"];

for (int i = 0; i > dt.Rows.Count; i++)

{

dt.Rows[i]["OpComplete"] = "True";

adapter.Update();

}

}

}

Suggested

3 Comments so far:

  1. Adan Lopez says:

    Excellent!!!
    Thank you so much.

    Can it be done with ABL code?

  2. Bryan Sapot says:

    Yes you can but it is more complex. We have an example I can post on the blog and notify you when it is up. The example is updating a UD table but you can apply it to other objects.

  3. Edgar Leaños says:

    Hi

    I tried to reply your example, but the changes are not saved. This is the code I’m using

    private void btnTodas_Click(object sender, System.EventArgs args)
    {
    SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
    bool MorePages = true;
    UD03Adapter adpUD03 = new UD03Adapter(oTrans);
    adpUD03.BOConnect();
    DataSet dsUD03 = adpUD03.GetRows(opts, out MorePages);
    if (dsUD03 != null)
    {
    if (dsUD03.Tables[“UD03”] != null)
    {
    DataTable dtUD03 = dsUD03.Tables[“UD03”];
    foreach(DataRow drUD03 in dtUD03.Rows)
    {
    drUD03[“Number01”] = edTCVenta.Text; //Control with the value
    drUD03[“Number02”] = edTCCompra.Text; //Control with the value
    adpUD03.Update();
    }
    }
    }
    adpUD03.Dispose();
    }

    Am I missing something?

    Appreciate in advance your help

    Regards!

Leave a Reply

Your email address will not be published. Required fields are marked *