This commit is contained in:
2021-01-19 22:15:32 +00:00
parent 8a52b60f2a
commit 26ca0872a1
4 changed files with 61 additions and 4 deletions

View File

@@ -130,7 +130,9 @@ namespace AyaNova.Biz
[CoreBizObject]
TaxCode = 64,
[CoreBizObject]
PartAssembly = 65
PartAssembly = 65,
[CoreBizObject]
PartWarehouse = 66

View File

@@ -40,6 +40,7 @@ namespace AyaNova.Models
public virtual DbSet<Notification> Notification { get; set; }
public virtual DbSet<NotifyDeliveryLog> NotifyDeliveryLog { get; set; }
public virtual DbSet<Part> Part { get; set; }
public virtual DbSet<PartWarehouse> PartWarehouse { get; set; }
public virtual DbSet<PartSerial> PartSerial { get; set; }
public virtual DbSet<PartAssembly> PartAssembly { get; set; }
public virtual DbSet<PartAssemblyItem> PartAssemblyItem { get; set; }

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace AyaNova.Models
{
//NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal,
//otherwise the server will call it an invalid record if the field isn't sent from client
public class PartWarehouse : ICoreBizObjectModel
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
public PartWarehouse()
{
Tags = new List<string>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.PartWarehouse; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[APARTWAREHOUSE](
[AID] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[AACTIVE] [bit] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ANAME] [nvarchar](255) NOT NULL,
[ADESCRIPTION] [nvarchar](255) NULL,
[AREGIONID] [uniqueidentifier] NULL,//tagify
*/

View File

@@ -22,8 +22,8 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 15;
internal const long EXPECTED_COLUMN_COUNT = 669;
internal const long EXPECTED_INDEX_COUNT = 117;
internal const long EXPECTED_COLUMN_COUNT = 676;
internal const long EXPECTED_INDEX_COUNT = 119;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
@@ -665,8 +665,13 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
"cost decimal(19,4) not null, retail decimal(19,4) not null, unitofmeasure text, upc text " +
" )");
//PARTWAREHOUSE
await ExecQueryAsync("CREATE TABLE apartwarehouse (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("INSERT INTO apartwarehouse(name, active) VALUES ('#1', true);");
//PARTSERIAL
await ExecQueryAsync("CREATE TABLE apartserial (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial text not null, "+
await ExecQueryAsync("CREATE TABLE apartserial (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial text not null, " +
"partid bigint not null REFERENCES apart on delete cascade, CONSTRAINT UNQ_PartSerialPart UNIQUE (partid, serial) )");//ensure not duplicate partid/serial combo
//PARTASSEMBLY