This commit is contained in:
2021-08-20 15:57:18 +00:00
parent 9d6836a5c2
commit a3af94e501

View File

@@ -174,7 +174,7 @@ namespace AyaNova.PlugIn.V8
{ {
if (V7ToV8IdMap.ContainsKey(v7id)) if (V7ToV8IdMap.ContainsKey(v7id))
{ {
//this is likely a coding issue so just throw
throw new Exception("Error: AddMap - v7id already mapped previously, id is " + v7id.ToString()); throw new Exception("Error: AddMap - v7id already mapped previously, id is " + v7id.ToString());
} }
else V7ToV8IdMap.Add(v7id, v8id); else V7ToV8IdMap.Add(v7id, v8id);
@@ -184,7 +184,7 @@ namespace AyaNova.PlugIn.V8
private void Addv7v8WorkOrderItemStatusIdMap(Guid v7id, long v8id) private void Addv7v8WorkOrderItemStatusIdMap(Guid v7id, long v8id)
{ {
if (V7ToV8WorkOrderItemStatusIdMap.ContainsKey(v7id)) if (V7ToV8WorkOrderItemStatusIdMap.ContainsKey(v7id))
throw new Exception("Error: V7ToV8WorkOrderItemStatusIdMap - v7id already mapped previously, id is " + v7id.ToString()); throw new Exception("Error: V7ToV8WorkOrderItemStatusIdMap - v7id already mapped previously, id is " + v7id.ToString());//would be a coding issue
else V7ToV8WorkOrderItemStatusIdMap.Add(v7id, v8id); else V7ToV8WorkOrderItemStatusIdMap.Add(v7id, v8id);
} }
private long? Getv7v8WorkOrderItemStatusIdNullOk(Guid id) private long? Getv7v8WorkOrderItemStatusIdNullOk(Guid id)
@@ -206,35 +206,34 @@ namespace AyaNova.PlugIn.V8
return false; return false;
} }
private long Getv7v8IdMap(Guid id, string details)
private async System.Threading.Tasks.Task<long> Getv7v8IdMap(Guid id, RootObjectTypes desiredType, bool allowPatch = true)
{ {
if (!V7ToV8IdMap.ContainsKey(id)) if (!V7ToV8IdMap.ContainsKey(id))
{ {
throw new Exception("Error: GetMap (source id: " + id.ToString() + ") [" + details + "] - v7 Id not previously exported, missing or corrupted source data, export can not complete until fixed"); if (!allowPatch)
throw new Exception("Error: Getv7v8IdMap (source id: " + id.ToString() + " for type: " + desiredType.ToString() + ") was not found in v7 database and can't be substituted export can not complete until fixed");
//not found, create a substitute record for it and put it in the map
await CreateSubstitute(id, desiredType);
} }
return V7ToV8IdMap[id]; return V7ToV8IdMap[id];
} }
private long? Getv7v8IdMapNullOk(Guid id) private async System.Threading.Tasks.Task<long?> Getv7v8IdMapNullOk(Guid id, RootObjectTypes desiredType, bool allowPatch = true)
{ {
if (id == Guid.Empty) return null; if (id == Guid.Empty) return null;
return await Getv7v8IdMap(id, desiredType, allowPatch);
if (!V7ToV8IdMap.ContainsKey(id)) return null;
return V7ToV8IdMap[id];
} }
private long SafeGetUserMap(Guid id) private long XXSafeGetUserMap(Guid id)
{ {
if (!V7ToV8IdMap.ContainsKey(id)) return 1;//1=raven administrator account if (!V7ToV8IdMap.ContainsKey(id)) return 1;//1=raven administrator account
return V7ToV8IdMap[id]; return V7ToV8IdMap[id];
} }
private enum RavenUserType : int private enum RavenUserType : int
{ {
Service = 1, Service = 1,
@@ -264,7 +263,28 @@ namespace AyaNova.PlugIn.V8
private List<long> Allv8WarehouseIds = new List<long>(); private List<long> Allv8WarehouseIds = new List<long>();
//UNKNOWN / MISSING RECORD OBJECT STAND INs //UNKNOWN / MISSING RECORD OBJECT STAND INs
private long UnknownV7PartId = 0;//used when there is no part id on a workorderitempart record private long XUnknownV7PartId = 0;//used when there is no part id on a workorderitempart record
private string MissingDataNamePrefix = "zV8migrate_substitute";//append guid to ensure uniqueness
private async System.Threading.Tasks.Task CreateSubstitute(Guid id, RootObjectTypes desiredType)
{
//create the simplest possible version of this object desired
switch (desiredType)
{
case RootObjectTypes.Client:
{
}
break;
default:
throw new Exception("Error: CreateSubstitute (source id: " + id.ToString() + " for type: " + desiredType.ToString() + ") THIS TYPE NOT CODED YET");
}
}
/// <summary> /// <summary>
@@ -384,7 +404,7 @@ namespace AyaNova.PlugIn.V8
if (progress.KeepGoing) if (progress.KeepGoing)
{ {
goto End; goto End;
} }