We attach .PDFs of part drawings to Sales Orders. Then when the order is processed by engineering, they have to open the Sales Order, open the PDF, save the PDF, then re-attach it to the matching Part Rev so that is there for all future jobs.
This mostly works but we are having issues with Epicor changing the file name, which is causing the engineers to have to manually re-name several PDFs before they can re-attach them. It is unnecessarily cumbersome and easy to make a mistake. Does anyone know how to make it PRESERVE the file name?
Just to rule out PDF reader issues, we tried several. The issue persists regardless of what the default PDF reader is. It is definitely an Epicor thing.
More specifically:
you double-click on an attachment in Epicor
it creates a copy in your TEMP folder with that same file name
you can save the file from the PDF reader and it will preserve the name
But the next time you open the same file, this happens instead:
you double-click on an attachment in Epicor
it detects a previous file with that file name (A-PT-1354 Rev. 3.pdf) already in your TEMP folder and so instead creates a 2nd file in your TEMP folder with the random TMP file names
I am open to any alternate process that might work. They are requesting a drag-and-drop ability but I see no way to do that. I don’t know if it is related but we are using DocStar as the attachment back-end. The end users never see DocStar, but the attachments are being stored in DocStar.
Drag/Drop needs a drop target. I chose a group box, but you can use what you want.
Wire up the relevant events, set AllowDrop for the drop target to true, and then do your
actions.
You could do the whole form, or a group of controls, but it’s not real simple.
Drag/Drop operates by what control it is over, so you would have to enumerate all
the controls in the form, or group etc, and add the AllowDrop to all, as well as wire
and unwire all the events.
Much easier to choose one spot for them to drop files
public void InitializeCustomCode()
{
//Can be added by wizard
this.epiGroupBoxC1.DragOver += new System.Windows.Forms.DragEventHandler(this.epiGroupBoxC1_DragOver);
this.epiGroupBoxC1.DragDrop += new System.Windows.Forms.DragEventHandler(this.epiGroupBoxC1_DragDrop);
}
public void DestroyCustomCode()
{
//Can be added by wizard
this.epiGroupBoxC1.DragOver -= new System.Windows.Forms.DragEventHandler(this.epiGroupBoxC1_DragOver);
this.epiGroupBoxC1.DragDrop -= new System.Windows.Forms.DragEventHandler(this.epiGroupBoxC1_DragDrop);
}
private void UD01Form_Load(object sender, EventArgs args)
{
//The magic happens here
epiGroupBoxC1.AllowDrop = true;
}
private void epiGroupBoxC1_DragOver(object sender, System.Windows.Forms.DragEventArgs args)
{
//Show proper drag/drop icons
if (args.Data.GetDataPresent(DataFormats.FileDrop))
{
args.Effect = DragDropEffects.Copy;
}
else
{
args.Effect = DragDropEffects.None;
}
}
private void epiGroupBoxC1_DragDrop(object sender, System.Windows.Forms.DragEventArgs args)
{
//Do your stuff here
if (args.Effect == DragDropEffects.Copy)
{
try
{
string[] fileList = (string[])args.Data.GetData(DataFormats.FileDrop, false);
string msg = String.Join(Environment.NewLine, fileList);
MessageBox.Show(msg);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
Ah ok, thank you for that info but sounds like drag-and-drop is WAY over my head.
For now I have created a .BAT file which clears his TEMP folder of any PDF files every 1 minute (via Windows Task Scheduler) and he seems happy with that for now.
Suggestion: stop caring about what they name the files. People will always fudge up free-form text fields, file names included. Use DocTypes to categorize them instead. Then it’s just a matter of people dropping the right file into the right folder on the order. You can then also use BPM’s to copy the relevant items from sales order to part automatically because you’ve, basically, “taught” the system what each file represents and how it should treat them.
@klincecum Kevin, in this discussion posting, how did you get your code formatted as Courier or Courier New with gray background? I’m embarrassed to ask, but I can’t figure out how to format my postings on EpiUsers besides bold and italics.