Displaying CAD drawings at the MES

  • 12 April 2021
  • 0 replies
  • 235 views

Userlevel 2

I suspect a number of people have come about this issue from different directions so I wanted to share what I am working on.

Our issue is that we have a work centre in our shop that might receive 20 different parts to make and with each part they need a drawing to guide their work.  This has created a huge pile of paper on the desk for the work centre.  There are also frequent issues with the drawing needing to be reprinted or the wrong one used.

We currently run CAD link for importing Methods from our Vault repository. This allows the drawing to be generated as a PDF and then imported as an attachment to ‘PartRev’ table. 

When the operator clocks into the job on the MES and then clicks on the ‘Documents’ button they see only the attachments to the ‘Job Operation’ table.   Rather than have our person creating jobs copy the drawing from the Part Rev, I thought I would investigate a more automatic solution.

Use the trace function I determined that Erp.BO.Drawings.GetRows method was used to determine the attachments to display. One of the parameters in a Where clause.  By adjusting this in a preprocessing directive I can bring in any attachments I like.  The nice thing about this is that special instructions on the JobHead or Part can also be available to the MES operator.

In my case, I found out the partNum and revision in the assembly and included this in the Where clause.

For example , the original: “RelatedToFile = 'JobOper' AND Key1 = '013007-3-1' AND Key2 = '0' AND Key3 = '10' BY Key1”  became “( RelatedToFile = 'JobOper' AND Key1 = '013007-3-1' AND Key2 = '0' AND Key3 = '10' )  OR ( RelatedToFile = 'PartRev' AND Key1 = '10001818' AND Key2 = '8' ) BY Key1 ”

Here is my code for this BPM. Hopefully this helps someone trying to get over this issue.

//Adjust Where clause to include Assembly PartNum
// 12 April 2021 GMR

//Reference the table and assembly
Erp.Tables.JobAsmbl JobAsmbl; 

//Split parameter by single quote
string[] words = whereClauseDrawings.Split('\'');

// parameter whereClauseDrawings example "RelatedToFile = 'JobOper' AND Key1 = '013007-3-1' AND Key2 = '0' AND Key3 = '10' BY Key1"

//Is this a JobOper where clause?
if ( words[1] == "JobOper" )
{
  //Select a single value for Job Assembly based on criteria defined elsewhere
  int AssemblySeq = Int32.Parse(words[5]);
  string JobNum = words[3];
  JobAsmbl = (from JobAsmbl_row in Db.JobAsmbl
          where JobAsmbl_row.Company == Session.CompanyID 
          && JobAsmbl_row.JobNum == JobNum
          && JobAsmbl_row.AssemblySeq == AssemblySeq
          select JobAsmbl_row).FirstOrDefault();
          
  //Found the assembly?
  if ( JobAsmbl != null )
  {
    
    whereClauseDrawings = "( " + whereClauseDrawings.Substring(0, whereClauseDrawings.Length - 8) + " )  OR ( RelatedToFile = \'PartRev\' AND Key1 = \'" + JobAsmbl.PartNum + "\' AND Key2 = \'" + JobAsmbl.RevisionNum + "\' ) BY Key1 ";
  
  }
}

Regards,

Graeme


0 replies

Be the first to reply!

Reply