From 66873d8d435151f2af364e5d665bfb62343928a8 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 13 Jan 2021 00:56:40 +0000 Subject: [PATCH] --- server/AyaNova/models/Part.cs | 63 ++++++++++++++++++++++++++++++++- server/AyaNova/util/AySchema.cs | 10 +++--- 2 files changed, 66 insertions(+), 7 deletions(-) diff --git a/server/AyaNova/models/Part.cs b/server/AyaNova/models/Part.cs index 3f3b644e..871f33f9 100644 --- a/server/AyaNova/models/Part.cs +++ b/server/AyaNova/models/Part.cs @@ -15,18 +15,41 @@ namespace AyaNova.Models public long Id { get; set; } public uint Concurrency { get; set; } - [Required] + public string Name { get; set; } + [Required] public bool Active { get; set; } public string Notes { get; set; } public string Wiki { get; set; } public string CustomFields { get; set; } public List Tags { get; set; } + [Required] + public string PartNumber { get; set; } + public string PopUpNotes { get; set; } + public long? ManufacturerId { get; set; } + public string ManufacturerNumber { get; set; } + public long? WholeSalerId { get; set; } + public string WholeSalerNumber { get; set; } + public long? AlternativeWholeSalerId { get; set; } + public string AlternativeWholeSalerNumber { get; set; } + [Required] + public decimal Cost { get; set; } + [Required] + public decimal Retail { get; set; } + public long? UnitOfMeasureId { get; set; } + public string UPC { get; set; } + [Required] + public bool TrackSerialNumber { get; set; } + public Part() { Tags = new List(); + Active = true; + TrackSerialNumber = false; + Cost = 0m; + Retail = 0m; } [NotMapped, JsonIgnore] @@ -35,3 +58,41 @@ namespace AyaNova.Models }//eoc }//eons + + +/* +CREATE TABLE [dbo].[APART]( + [AID] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NULL, + [AMODIFIED] [datetime] NULL, + [AACTIVE] [bit] NOT NULL, + [ACREATOR] [uniqueidentifier] NULL, + [AMODIFIER] [uniqueidentifier] NULL, + [ANAME] [nvarchar](255) NULL, + [AALERT] [ntext] NULL,//DROP was deprecated and unusued in v7 + [ANOTES] [ntext] NULL, + [APARTNUMBER] [nvarchar](255) NOT NULL, + [APARTCATEGORYID] [uniqueidentifier] NULL,//DROP now a tag + [AMANUFACTURERID] [uniqueidentifier] NULL, + [AWHOLESALERID] [uniqueidentifier] NULL, + [AMANUFACTURERNUMBER] [nvarchar](255) NULL, + [AWHOLESALERNUMBER] [nvarchar](255) NULL, + [AALTERNATIVEWHOLESALERID] [uniqueidentifier] NULL, + [AALTERNATIVEWHOLESALERNUMBER] [nvarchar](255) NULL, + [ACOST] [decimal](19, 5) NULL, + [ARETAIL] [decimal](19, 5) NULL, + [AUNITOFMEASUREID] [uniqueidentifier] NULL, + [APARTASSEMBLYID] [uniqueidentifier] NULL,//DROP, Migrate into new partassemblyitem + [AUPC] [nvarchar](255) NULL, + [ATRACKSERIALNUMBER] [bit] NOT NULL, + [ACUSTOM1] [ntext] NULL, + [ACUSTOM2] [ntext] NULL, + [ACUSTOM3] [ntext] NULL, + [ACUSTOM4] [ntext] NULL, + [ACUSTOM5] [ntext] NULL, + [ACUSTOM6] [ntext] NULL, + [ACUSTOM7] [ntext] NULL, + [ACUSTOM8] [ntext] NULL, + [ACUSTOM9] [ntext] NULL, + [ACUSTOM0] [ntext] NULL, +*/ \ No newline at end of file diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 33a4b8cd..268cd479 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -686,16 +686,14 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE INDEX apart_tags ON apart using GIN(tags)"); //PARTASSEMBLY - await ExecQueryAsync("CREATE TABLE apart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool not null, " + + await ExecQueryAsync("CREATE TABLE apartassembly (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool not null, " + "notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); - await ExecQueryAsync("CREATE UNIQUE INDEX apart_name_id_idx ON apart (id, name);"); - await ExecQueryAsync("CREATE INDEX apart_tags ON apart using GIN(tags)"); + await ExecQueryAsync("CREATE UNIQUE INDEX apart_name_id_idx ON apartassembly (id, name);"); + await ExecQueryAsync("CREATE INDEX apart_tags ON apartassembly using GIN(tags)"); //PARTASSEMBLYITEM await ExecQueryAsync("CREATE TABLE apartassemblyitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, partassemblyid bigint not null REFERENCES apartassembly, " + - "key text not null, display text not null)"); - - + "partid bigint not null REFERENCES apart)"); //PROJECT await ExecQueryAsync("CREATE TABLE aproject (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool not null, " +