This commit is contained in:
2021-08-13 18:24:14 +00:00
parent 5a155c11fd
commit 5ea07cd003
4 changed files with 151 additions and 146 deletions

View File

@@ -2546,6 +2546,7 @@ namespace AyaNova.PlugIn.V8
╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝
*/
#region Service Workorders
int _highestWorkOrderNumberExported = 0;
private async System.Threading.Tasks.Task ExportServiceWorkorders(ProgressForm progress)
{
if (!progress.KeepGoing) return;
@@ -2585,6 +2586,8 @@ namespace AyaNova.PlugIn.V8
progress.Op(ObjectTypeName + " " + c.WorkorderService.ServiceNumber);
d.serial = c.WorkorderService.ServiceNumber;
if (c.WorkorderService.ServiceNumber > _highestWorkOrderNumberExported)
_highestWorkOrderNumberExported = c.WorkorderService.ServiceNumber;
d.customerId = Getv7v8IdMap(c.ClientID, "Client for wo " + d.serial);
d.notes = c.Summary;
d.projectId = Getv7v8IdMapNullOk(c.ProjectID);
@@ -2975,6 +2978,12 @@ namespace AyaNova.PlugIn.V8
}//items loop
}//wo loop
//set new seed number for work orders
_highestWorkOrderNumberExported += 1;
{
await util.PutAsync("global-biz-settings/seeds/34/" + _highestWorkOrderNumberExported.ToString());
}
}
#endregion Workorders
@@ -4861,129 +4870,129 @@ and this one
#region Seeds
private class GZSeeds
{
public int InventoryAdjustmentStartSeed = 1;
public int PurchaseOrderStartSeed = 1;
public int QuoteNumberStartSeed = 1;
public int WorkorderNumberStartSeed = 1;
public int PreventiveMaintenanceNumberStartSeed = 1;
}
private void ExportSeedNumbers(ProgressForm progress)
{
// List<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
progress.Append("Dumping seeds");
//create a new object with the id numbers in it and then dump it
WorkorderPMList pml = WorkorderPMList.GetList("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?> \r\n" +
"<GRIDCRITERIA> \r\n" +
" <COLUMNITEM CM=\"aWorkorderPreventiveMaintenance.aPreventiveMaintenanceNumber\" UI=\"LT_O_WorkorderPreventiveMaintenance\" PIN=\"0\" WIDTH=\"150\" SORT=\"DESC\" /> \r\n" +
"</GRIDCRITERIA> ");
int PMStartSeed = 0;
if (pml.Count > 0)
{
PMStartSeed = int.Parse(pml[0].LT_O_WorkorderPreventiveMaintenance.Display);
}
var seeds = new GZSeeds();
seeds.InventoryAdjustmentStartSeed = AyaBizUtils.GlobalSettings.InventoryAdjustmentStartSeed + 1;
seeds.PurchaseOrderStartSeed = AyaBizUtils.GlobalSettings.PurchaseOrderStartSeed + 1;
seeds.QuoteNumberStartSeed = AyaBizUtils.GlobalSettings.QuoteNumberStartSeed + 1;
seeds.WorkorderNumberStartSeed = AyaBizUtils.GlobalSettings.WorkorderNumberStartSeed + 1;
seeds.PreventiveMaintenanceNumberStartSeed = PMStartSeed + 1;
//DumpObjectToFolder(tempArchiveFolder, seeds, "seeds", objectExcludeProperties, TypeAndID.Empty, "GZTW.AyaNova.BLL.Seed");
}
#endregion globalsettings
#region contract resolver
//public class ExcludeNamedPropertiesContractResolver : DefaultContractResolver
//#region Seeds
//private class GZSeeds
//{
// private readonly List<string> _excludeProperties;
// public ExcludeNamedPropertiesContractResolver(List<string> excludeProperties)
// {
// _excludeProperties = excludeProperties;
// }
// protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
// {
// IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);
// // only serializer properties that start with the specified character
// //properties = properties.Where(p => p.PropertyName.StartsWith(_startingWithChar.ToString())).ToList();
// properties = properties.Where(p => !_excludeProperties.Contains(p.PropertyName)).ToList();
// return properties;
// }
// public int InventoryAdjustmentStartSeed = 1;
// public int PurchaseOrderStartSeed = 1;
// public int QuoteNumberStartSeed = 1;
// public int WorkorderNumberStartSeed = 1;
// public int PreventiveMaintenanceNumberStartSeed = 1;
//}
#endregion contract resolver
//private static string EnsureValidFileName(string fileName)
//private void ExportSeedNumbers(ProgressForm progress)
//{
// //make lower and replace spaces with dashes
// fileName = fileName.ToLowerInvariant().Replace(" ", "-");
// // List<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
// progress.Append("Dumping seeds");
// //create a new object with the id numbers in it and then dump it
// WorkorderPMList pml = WorkorderPMList.GetList("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?> \r\n" +
// "<GRIDCRITERIA> \r\n" +
// " <COLUMNITEM CM=\"aWorkorderPreventiveMaintenance.aPreventiveMaintenanceNumber\" UI=\"LT_O_WorkorderPreventiveMaintenance\" PIN=\"0\" WIDTH=\"150\" SORT=\"DESC\" /> \r\n" +
// "</GRIDCRITERIA> ");
// //ensure each character is a valid path character
// foreach (char c in System.IO.Path.GetInvalidFileNameChars())
// int PMStartSeed = 0;
// if (pml.Count > 0)
// {
// fileName = fileName.Replace(c, '_');
// PMStartSeed = int.Parse(pml[0].LT_O_WorkorderPreventiveMaintenance.Display);
// }
// return fileName;
// var seeds = new GZSeeds();
// seeds.InventoryAdjustmentStartSeed = AyaBizUtils.GlobalSettings.InventoryAdjustmentStartSeed + 1;
// seeds.PurchaseOrderStartSeed = AyaBizUtils.GlobalSettings.PurchaseOrderStartSeed + 1;
// seeds.QuoteNumberStartSeed = AyaBizUtils.GlobalSettings.QuoteNumberStartSeed + 1;
// seeds.WorkorderNumberStartSeed = AyaBizUtils.GlobalSettings.WorkorderNumberStartSeed + 1;
// seeds.PreventiveMaintenanceNumberStartSeed = PMStartSeed + 1;
// //DumpObjectToFolder(tempArchiveFolder, seeds, "seeds", objectExcludeProperties, TypeAndID.Empty, "GZTW.AyaNova.BLL.Seed");
//}
//#endregion globalsettings
//private static void makeFolderIfNotExist(string fldr, bool shouldNotExist = false)
//{
// if (Directory.Exists(fldr))
// {
// if (shouldNotExist)
// throw new System.Exception("Error: path already exists and shouldn't:\r\n" + fldr);
// return;
// }
// Directory.CreateDirectory(fldr);
//}
//#region contract resolver
////public class ExcludeNamedPropertiesContractResolver : DefaultContractResolver
////{
//// private readonly List<string> _excludeProperties;
//private List<string> standardExcludePropertiesList
//{
// get
// {
// return new List<string>()
// {
// "CanWiki",
// "CanDuplicate",
// "IsValid",
// "IsDirty",
// "CurrentUserID",
// "IsEditing",
// "IsNew",
// "IsDeleted",
// "IsSavable",
// "Notify",
// "BrokenRulesText",
// "Docs",
// "MapQuestURL",
// "FullAddress"
// //"XXX",
// //"XXX",
// //"XXX",
// //"XXX",
// //"XXX",
// //"XXX",
// //"XXX",
// //"XXX",
// //"XXX",
// //"XXX",
// //"XXX"
// };
//// public ExcludeNamedPropertiesContractResolver(List<string> excludeProperties)
//// {
//// _excludeProperties = excludeProperties;
//// }
// }
//}
//// protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
//// {
//// IList<JsonProperty> properties = base.CreateProperties(type, memberSerialization);
//// // only serializer properties that start with the specified character
//// //properties = properties.Where(p => p.PropertyName.StartsWith(_startingWithChar.ToString())).ToList();
//// properties = properties.Where(p => !_excludeProperties.Contains(p.PropertyName)).ToList();
//// return properties;
//// }
////}
//#endregion contract resolver
////private static string EnsureValidFileName(string fileName)
////{
//// //make lower and replace spaces with dashes
//// fileName = fileName.ToLowerInvariant().Replace(" ", "-");
//// //ensure each character is a valid path character
//// foreach (char c in System.IO.Path.GetInvalidFileNameChars())
//// {
//// fileName = fileName.Replace(c, '_');
//// }
//// return fileName;
////}
////private static void makeFolderIfNotExist(string fldr, bool shouldNotExist = false)
////{
//// if (Directory.Exists(fldr))
//// {
//// if (shouldNotExist)
//// throw new System.Exception("Error: path already exists and shouldn't:\r\n" + fldr);
//// return;
//// }
//// Directory.CreateDirectory(fldr);
////}
////private List<string> standardExcludePropertiesList
////{
//// get
//// {
//// return new List<string>()
//// {
//// "CanWiki",
//// "CanDuplicate",
//// "IsValid",
//// "IsDirty",
//// "CurrentUserID",
//// "IsEditing",
//// "IsNew",
//// "IsDeleted",
//// "IsSavable",
//// "Notify",
//// "BrokenRulesText",
//// "Docs",
//// "MapQuestURL",
//// "FullAddress"
//// //"XXX",
//// //"XXX",
//// //"XXX",
//// //"XXX",
//// //"XXX",
//// //"XXX",
//// //"XXX",
//// //"XXX",
//// //"XXX",
//// //"XXX",
//// //"XXX"
//// };
//// }
////}
#endregion old
//eoc