Fixed logic to handle a user (sub) format as the procedure set default format
added more robust logic to handle outside transitions supporting logic to add an additional annotation when multiple possibilities for an outside transition is possible
This commit is contained in:
parent
9c98f8bb48
commit
1cc722cb67
@ -107,6 +107,8 @@ namespace Utils
|
||||
cfg.Print_UserFormat = ReadTheString(br, 10);
|
||||
//tmpsbyte = br.ReadSByte();
|
||||
//cfg.Print_Duplex = tmpsbyte == 0 ? true : false;
|
||||
if (cfg.Print_UserFormat.Trim() != string.Empty)
|
||||
DefaultPlantFmt += " " + cfg.Print_UserFormat;
|
||||
br.Close();
|
||||
}
|
||||
catch(Exception e)
|
||||
|
@ -30,8 +30,10 @@ namespace DataLoader
|
||||
_TranLookup = new Dictionary<string, ItemInfo>();
|
||||
}
|
||||
|
||||
public ItemInfo GetItem(string key)
|
||||
private List<string> _MigrationErrors;
|
||||
public ItemInfo GetItem(string key, List<string> migrationErrors)
|
||||
{
|
||||
_MigrationErrors = migrationErrors;
|
||||
if (!_TranLookup.ContainsKey(key))
|
||||
_TranLookup.Add(key, Find(key));
|
||||
return _TranLookup[key];
|
||||
@ -48,7 +50,7 @@ namespace DataLoader
|
||||
|
||||
private ItemInfo Find(string path, string proc)
|
||||
{
|
||||
return OTLookup.Find(path, proc);
|
||||
return OTLookup.Find(path, proc,_MigrationErrors);
|
||||
}
|
||||
|
||||
private string GetProc(string setid, string procid)
|
||||
@ -86,6 +88,14 @@ namespace DataLoader
|
||||
DataTable dt = ds.Tables[0];
|
||||
dt.CaseSensitive = true;
|
||||
DataRow dr = dt.Rows[0]; // there should be only one entry!
|
||||
// if there are more than one entry use the first legitimate entry
|
||||
// for NSP we found multiple "FIRST RECORD"s in numerious XTSETID.DBF files
|
||||
if (dt.Rows.Count > 1)
|
||||
{
|
||||
int irow = 0;
|
||||
while (irow < dt.Rows.Count-1 && dt.Rows[irow]["PLANTTITLE"].ToString() == "FIRST RECORD") irow++;
|
||||
dr = dt.Rows[irow];
|
||||
}
|
||||
string retval = dr["Path"].ToString();
|
||||
da.Dispose();
|
||||
ds.Dispose();
|
||||
@ -214,9 +224,12 @@ namespace DataLoader
|
||||
|
||||
internal static class OTLookup
|
||||
{
|
||||
public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static Dictionary<string, ItemInfo> _Lookup = null;
|
||||
public static ItemInfo Find(string path, string procnum)
|
||||
static List<string> _MigrationErrors;
|
||||
public static ItemInfo Find(string path, string procnum, List<string> migrationErrors)
|
||||
{
|
||||
_MigrationErrors = migrationErrors;
|
||||
string key = string.Format(@"{0}\{1}",path,procnum);
|
||||
if (_Lookup == null)
|
||||
_Lookup = new Dictionary<string, ItemInfo>();
|
||||
@ -257,6 +270,26 @@ namespace DataLoader
|
||||
if (path.ToUpper().EndsWith("ABBYPROC"))
|
||||
return PartialMatch(path + ".prc");
|
||||
}
|
||||
// if we cannot find a match using two folders, simple use one
|
||||
partial = GetPartial2(path);
|
||||
if (partial != null)
|
||||
{
|
||||
DocVersionInfo match = null;
|
||||
foreach (DocVersionInfo dvi in _DocVersions)
|
||||
{
|
||||
if (dvi.MyFolder.Title.ToUpper().EndsWith(partial.ToUpper()))
|
||||
{
|
||||
if (match == null)
|
||||
match = dvi;
|
||||
else
|
||||
{
|
||||
_MyLog.WarnFormat("Duplicate external paths found for path '{0}'", path);
|
||||
_MigrationErrors.Add(string.Format("Duplicate external paths found for path '{0}'", path));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private static string GetPartial(string path)
|
||||
@ -270,6 +303,17 @@ namespace DataLoader
|
||||
else
|
||||
return null;
|
||||
}
|
||||
private static string GetPartial2(string path)
|
||||
{
|
||||
//Console.WriteLine(string.Format("GetPartial path = {0}",path));
|
||||
if (path.Contains("\\"))
|
||||
{
|
||||
string[] parts = path.Split("\\".ToCharArray());
|
||||
return "\\" + parts[parts.Length - 1];
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
private static DocVersionInfo ExactMatch(string path)
|
||||
{
|
||||
foreach (DocVersionInfo dvi in _DocVersions)
|
||||
|
@ -84,7 +84,7 @@ namespace DataLoader
|
||||
Item toItem2 = null;
|
||||
if (itype == 6) // Outside Transition
|
||||
{
|
||||
ItemInfo tmp = _OutTran.GetItem(thekey);
|
||||
ItemInfo tmp = _OutTran.GetItem(thekey, migrationErrors);
|
||||
if (tmp != null)
|
||||
toItem = tmp.Get();
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user