Gov Cloud - Is there a way to have a dashboard write a file to the network share used for Bartender files?

Hello,

I am in the process of converting an Epicor Client dashboard that uses a customization to create a bartender file and sends it to the local monitored share that the local bartender install uses.

We also have a network share from Epicor that the browser uses to share a bartender file, which my local Bartender install monitors also (It is mapped to Z: drive).

I am trying to wrap my head around how to get a Kinetic dashboard in the browser to create a file in the Bartender cloud share.

Any ideas out there?

Any help is appreciated!

Conceptually, the dashboard could call an Epicor Function, and the Function could generate the Bartender data file to your Azure File Share UNC path.

I was thinking along those lines but have no idea how to see if I can write to that share from a function…

you should be able to use sandbox.io to write to the particular redirect folder for the file share,

something like this (example from writing a bartender file to file share):

var sb = (ISandbox)Sandbox;
  sb.IO.File.WriteAllText(new FilePath(ServerFolder.FileShare, outFolder + LabelName + DateTime.Now.ToString("yyyyMMddHHmmssffff") + @".btxml"), btxmltxt, System.Text.Encoding.Unicode);

That’s almost exactly what I do, a few hundred times a day.

Or you can have a webapp (REST endpoint) at your Bartender machine and have it accept a POST from your Epicor Function and write locally to the drop folder.

Later, you could convert the Function to the Bartender REST library and you wouldn’t have to change anything on the Kinetic side.

Hello,

I tried your code after plugging in the variables and it didn’t seem to write.

It completed but no file showing in the share I have.

How do I know if the ServerFolder.FileShare is the Azure File Share UNC path support gave me?

BTW, if you feel feisty, you can vibe-code the web app to create a screen for a format and then have the ability to reprint a label by hand entering the lable.

This is why cloud programmers are afraid of file systems…

Sometimes the redirect is not set up correctly, if you open a ticket you can ask Epicor to validate that it is pointing at the UNC/Azure File Share as expected.

I opened a ticket with support.

Let’s see what they say…

Curious how you make out with Support and Sandbox, last we were told Fileshare access isn’t available to Gov Cloud through Sandbox but that was a few months ago – we’re still having to use System.IO.

Below is an example of one of ours – Fileshare and Bartender details stored in user codes. Not pretty but it works :party_parrot:

// Print 4x2 Label Price Ticket
var thisCompany = Session.CompanyID;

// Bartender Filepaths
string btPath = "";
string btwPath = "";
string defaultPtr = "";

var udCodes = Db.UDCodes
    .Where(r =>
		r.Company == thisCompany
		&& r.CodeTypeID == "FILEPATHS"
	)
    .ToList();

if (udCodes.Count == 0)
    throw new BLException("Cannot select FILEPATHS user code");

foreach (var row in udCodes)
{
    switch (row.CodeID)
    {
        case "BTPath": btPath = row.LongDesc; break; // File Path for Bartender BT Output files
        case "BTWPath": btwPath = row.LongDesc; break; // BTW File Path
        case "PricePrint": defaultPtr = row.LongDesc; break;
    }
}

// Determine price ticket printer
string sessionPtr = string.IsNullOrEmpty(Session.WorkstationID)
    ? defaultPtr
    : Session.WorkstationID + "_barz";

// Build bartender file header
var sbH = new StringBuilder();
sbH.AppendLine(@"%BTW% /AF=""" + Path.Combine(btwPath, "PriceTkt42.btw") + @""" /D=""<Trigger File Name>"" /PRN=""" + sessionPtr + @""" /DBTEXTHEADER=3 /R=3 /P");
sbH.AppendLine(@"%END%");
sbH.AppendLine("Gender~Description~Width~WidthCode~EU~JPN~UK~Color~UPCCode~ItemID~PictureID~Country~NumLabels");

// Build row
var sbR = new StringBuilder();
sbR.AppendFormat(
    "{0}~{1}~{2}~{3}~{4}~{5}~{6}~{7}~{8}~{9}~{10}~{11}~{12}",
    gender,
    styleDesc,
    width,
    widthCode,
    sizeEu,
    sizeJpn,
    sizeUk,
    colorDesc,
    upcCode1,
    itemId,
    pictureId,
    country,
    numLabels
);

sbR.AppendLine();

string fileName = Sandbox.Compatibility.ConvertPath(
    btPath + $@"\PriceTkt42_{DateTime.Now:ssffff}.bt"
);

// Send to Bartender Fileshare
using (var printFile = new System.IO.StreamWriter(new System.IO.FileStream(fileName, System.IO.FileMode.Create)))
{
    printFile.WriteLine(sbH.ToString() + sbR.ToString());
}