From 4d5c92338e96109f31195159f41c8cc230a91a20 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 30 Jun 2022 22:10:59 +0000 Subject: [PATCH] --- AyaNovaQBI/AyaNovaQBI.csproj | 10 +++ AyaNovaQBI/QBIIntegrationData.cs | 12 +-- AyaNovaQBI/SetWOStatus.Designer.cs | 127 +++++++++++++++++++++++++++++ AyaNovaQBI/SetWOStatus.cs | 88 ++++++++++++++++++++ AyaNovaQBI/SetWOStatus.resx | 120 +++++++++++++++++++++++++++ AyaNovaQBI/WorkOrderStatus.cs | 31 +++++++ AyaNovaQBI/util.cs | 64 +++++++++++++-- 7 files changed, 440 insertions(+), 12 deletions(-) create mode 100644 AyaNovaQBI/SetWOStatus.Designer.cs create mode 100644 AyaNovaQBI/SetWOStatus.cs create mode 100644 AyaNovaQBI/SetWOStatus.resx create mode 100644 AyaNovaQBI/WorkOrderStatus.cs diff --git a/AyaNovaQBI/AyaNovaQBI.csproj b/AyaNovaQBI/AyaNovaQBI.csproj index 0aad182..22edf1b 100644 --- a/AyaNovaQBI/AyaNovaQBI.csproj +++ b/AyaNovaQBI/AyaNovaQBI.csproj @@ -105,6 +105,12 @@ + + Form + + + SetWOStatus.cs + Form @@ -120,6 +126,7 @@ Waiting.cs + ApproveCompanyFile.cs @@ -142,6 +149,9 @@ Resources.resx True + + SetWOStatus.cs + tfa.cs diff --git a/AyaNovaQBI/QBIIntegrationData.cs b/AyaNovaQBI/QBIIntegrationData.cs index b94310f..7bafb11 100644 --- a/AyaNovaQBI/QBIIntegrationData.cs +++ b/AyaNovaQBI/QBIIntegrationData.cs @@ -18,8 +18,8 @@ namespace AyaNovaQBI "InvoiceLoanItemTemplate":"","HasInvoiceHeaderTemplate":false,"HasAnyInvoiceFooterTemplateFields":false,"AutoClose":true,"NothingSet":true} */ #region fields - private Guid _PreWOStatus = Guid.Empty; - private Guid _PostWOStatus = Guid.Empty; + private long _PreWOStatus = 0; + private long _PostWOStatus = 0; private string _OutsideServiceChargeAs = ""; private string _WorkorderItemLoanChargeAs = ""; private string _MiscExpenseChargeAs = ""; @@ -85,7 +85,7 @@ namespace AyaNovaQBI #endregion #region Properties - public Guid PreWOStatus + public long PreWOStatus { get { return _PreWOStatus; } set @@ -98,7 +98,7 @@ namespace AyaNovaQBI } } - public Guid PostWOStatus + public long PostWOStatus { get { return _PostWOStatus; } set @@ -362,8 +362,8 @@ namespace AyaNovaQBI { get { - if (_PreWOStatus == Guid.Empty && - _PostWOStatus == Guid.Empty && + if (_PreWOStatus == 0 && + _PostWOStatus == 0 && _OutsideServiceChargeAs == "" && _WorkorderItemLoanChargeAs == "" && _MiscExpenseChargeAs == "" && diff --git a/AyaNovaQBI/SetWOStatus.Designer.cs b/AyaNovaQBI/SetWOStatus.Designer.cs new file mode 100644 index 0000000..657240c --- /dev/null +++ b/AyaNovaQBI/SetWOStatus.Designer.cs @@ -0,0 +1,127 @@ +namespace AyaNovaQBI +{ + partial class SetWOStatus + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnOK = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.lblTitle = new System.Windows.Forms.Label(); + this.lblDescription = new System.Windows.Forms.Label(); + this.lblStatus = new System.Windows.Forms.Label(); + this.cbStatus = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // btnOK + // + this.btnOK.Location = new System.Drawing.Point(550, 368); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 6; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(4, 368); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 5; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // lblTitle + // + this.lblTitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lblTitle.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblTitle.Location = new System.Drawing.Point(0, 0); + this.lblTitle.Name = "lblTitle"; + this.lblTitle.Size = new System.Drawing.Size(637, 30); + this.lblTitle.TabIndex = 7; + // + // lblDescription + // + this.lblDescription.Dock = System.Windows.Forms.DockStyle.Top; + this.lblDescription.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblDescription.Location = new System.Drawing.Point(0, 30); + this.lblDescription.Name = "lblDescription"; + this.lblDescription.Size = new System.Drawing.Size(637, 165); + this.lblDescription.TabIndex = 8; + // + // lblStatus + // + this.lblStatus.AutoSize = true; + this.lblStatus.Dock = System.Windows.Forms.DockStyle.Top; + this.lblStatus.Location = new System.Drawing.Point(0, 195); + this.lblStatus.Name = "lblStatus"; + this.lblStatus.Size = new System.Drawing.Size(0, 13); + this.lblStatus.TabIndex = 10; + // + // cbStatus + // + this.cbStatus.Dock = System.Windows.Forms.DockStyle.Top; + this.cbStatus.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbStatus.FormattingEnabled = true; + this.cbStatus.Location = new System.Drawing.Point(0, 208); + this.cbStatus.Name = "cbStatus"; + this.cbStatus.Size = new System.Drawing.Size(637, 21); + this.cbStatus.TabIndex = 11; + // + // SetWOStatus + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(637, 403); + this.Controls.Add(this.cbStatus); + this.Controls.Add(this.lblStatus); + this.Controls.Add(this.lblDescription); + this.Controls.Add(this.lblTitle); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.btnCancel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "SetWOStatus"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "SetWOStatus"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SetWOStatus_FormClosing); + this.Load += new System.EventHandler(this.SetWOStatus_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Label lblTitle; + private System.Windows.Forms.Label lblDescription; + private System.Windows.Forms.Label lblStatus; + private System.Windows.Forms.ComboBox cbStatus; + } +} \ No newline at end of file diff --git a/AyaNovaQBI/SetWOStatus.cs b/AyaNovaQBI/SetWOStatus.cs new file mode 100644 index 0000000..218a5ef --- /dev/null +++ b/AyaNovaQBI/SetWOStatus.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AyaNovaQBI +{ + public partial class SetWOStatus : Form + { + public SetWOStatus() + { + InitializeComponent(); + } + + private long _SelectedStatus = 0; + public long SelectedStatus + { + get + { + return (long)cbStatus.SelectedItem; + } + set + { + _SelectedStatus = value; + + } + } + + private bool _Pre = true; + /// + /// Used to indicate if dialog should display for post or pre + /// status + /// + public bool PreStatus + { + + set + { + _Pre = value; + + } + } + + private void SetWOStatus_Load(object sender, EventArgs e) + { + List items = util.AyaWOStatusList.OrderBy(z=>z.Name).Select(z => new NameIdItem { Id = z.Id, Name = z.Name }).ToList(); + items.Insert(0, new NameIdItem { Id = 0, Name = _Pre ? "< Any status >" : "< Do not change status >" }); + + this.cbStatus.DataSource = items; + this.cbStatus.DisplayMember = "Name"; + this.cbStatus.ValueMember = "Id"; + this.cbStatus.SelectedValue = _SelectedStatus; + + this.lblStatus.Text = util.AyaTranslations["WorkOrderStatus"]; + ////NVCHANGED + //GenericNVList ls = GenericNVList.GetList("aWorkorderStatus", "aID", "aName", true, false, false); + + //if (_Pre) + // this.cbStatus.SelectedItem = this.cbStatus.Items.Add(Guid.Empty, "< Any status >"); + //else + // this.cbStatus.SelectedItem = this.cbStatus.Items.Add(Guid.Empty, "< Do not change status >"); + + + //foreach (DictionaryEntry d in ls.BindableList) + //{ + // Guid gItem = new Guid(d.Key.ToString()); + // Infragistics.Win.ValueListItem v = this.cbStatus.Items.Add(gItem, d.Value.ToString()); + // if (_SelectedStatus == gItem) + // { + // this.cbStatus.SelectedItem = v; + + // } + //} + + + } + + private void SetWOStatus_FormClosing(object sender, FormClosingEventArgs e) + { + + } + } +} diff --git a/AyaNovaQBI/SetWOStatus.resx b/AyaNovaQBI/SetWOStatus.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AyaNovaQBI/SetWOStatus.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AyaNovaQBI/WorkOrderStatus.cs b/AyaNovaQBI/WorkOrderStatus.cs new file mode 100644 index 0000000..47d4b18 --- /dev/null +++ b/AyaNovaQBI/WorkOrderStatus.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AyaNovaQBI +{ + internal class WorkOrderStatus + { + public long Id { get; set; } + public uint Concurrency { get; set; } + + + public string Name { get; set; } + public bool Active { get; set; } + public string Notes { get; set; } + + /* + Hexadecimal notation: #RGB[A] + R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (0–9, A–F). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388. + */ + + public string Color { get; set; } + + public AuthorizationRoles SelectRoles { get; set; } + public AuthorizationRoles RemoveRoles { get; set; } + public bool Completed { get; set; } + public bool Locked { get; set; } + } +} diff --git a/AyaNovaQBI/util.cs b/AyaNovaQBI/util.cs index 7245546..573b190 100644 --- a/AyaNovaQBI/util.cs +++ b/AyaNovaQBI/util.cs @@ -776,7 +776,7 @@ namespace AyaNovaQBI if (s0.ShowDialog() == DialogResult.Cancel) { - await IntegrationLog( "PFC: User cancelled when shown company file currently open - " + QCompanyFile); + await IntegrationLog("PFC: User cancelled when shown company file currently open - " + QCompanyFile); return pfstat.Cancel; @@ -787,9 +787,9 @@ namespace AyaNovaQBI #region WO Pre status //Validate any existing status - if (SetEverything == false && QDat.PreWOStatus != Guid.Empty) + if (SetEverything == false && QDat.PreWOStatus != 0) { - if (WorkorderStatus.Exists(QDat.PreWOStatus)) + if (AyaWOStatusList.Any(z => z.Id == QDat.PreWOStatus)) goto PRESTATUSOK; } else @@ -832,9 +832,9 @@ namespace AyaNovaQBI #region WO POST status //Validate any existing status - if (SetEverything == false && QDat.PostWOStatus != Guid.Empty) + if (SetEverything == false && QDat.PostWOStatus != 0) { - if (WorkorderStatus.Exists(QDat.PostWOStatus)) + if (AyaWOStatusList.Any(z => z.Id == QDat.PostWOStatus)) goto POSTSTATUSOK; } else @@ -3152,6 +3152,9 @@ namespace AyaNovaQBI w.Step = "Parts"; await PopulateAyaPartList(); + w.Step = "WorkOrder status list"; + await PopulateAyaWOStatusList(); + w.Close(); } @@ -3261,7 +3264,56 @@ namespace AyaNovaQBI #endregion ayanova parts - #endregion + + #region AyaNova WorkOrder STATUS list + + private static List _woStatuslist = null; + /// + /// AyaNova part list + /// + public static List AyaWOStatusList + { + get + { + return _woStatuslist; + } + } + + public static async Task PopulateAyaWOStatusList() + { + var a = await GetAsync("work-order-status/list"); + _woStatuslist = a.ObjectResponse["data"].ToObject>(); + } + + #endregion ayanova WorkOrder STATUS list + + #region Translations + + private static Dictionary _translist = null; + /// + /// AyaNova part list + /// + public static Dictionary AyaTranslations + { + get + { + return _translist; + } + } + + public static async Task PopulateAyaTranslationList() + { + + var a = await PostAsync("translation/subset", Newtonsoft.Json.JsonConvert.SerializeObject(new List { + "WorkOrderStatus", "xxxxx" + })); + _translist = a.ObjectResponse["data"].ToObject>(); + } + + //await window.$gz.api.upsert("translation/subset", needIt); + #endregion translations + + #endregion ayanova cached lists #endregion qb specific non-api stuff