From c3523d4d6f62d18b06b176af65c86f22c4c5ed3f Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 26 Mar 2021 20:29:05 +0000 Subject: [PATCH] --- server/AyaNova/models/WorkOrderItemPart.cs | 47 ++++++++++++++++++---- server/AyaNova/util/AySchema.cs | 8 ++-- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/server/AyaNova/models/WorkOrderItemPart.cs b/server/AyaNova/models/WorkOrderItemPart.cs index e16c7d09..7eaa7cb9 100644 --- a/server/AyaNova/models/WorkOrderItemPart.cs +++ b/server/AyaNova/models/WorkOrderItemPart.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; @@ -8,15 +8,23 @@ namespace AyaNova.Models { public class WorkOrderItemPart : ICoreBizObjectModel { - public WorkOrderItemPart() - { - Tags = new List(); - } + public long Id { get; set; } public uint Concurrency { get; set; } - public string Notes { get; set; } - public string CustomFields { get; set; } - public List Tags { get; set; } + public string Description { get; set; } + public string Serials { get; set; } + [Required] + public long PartId { get; set; } + [Required] + public long PartWarehouseId { get; set; } + [Required] + public decimal Quantity { get; set; } + public decimal Cost { get; set; }//cost at time of entry from part table + public decimal BasePrice {get;set;}//part retail price at time of entry (V7 "Price") + public decimal Price {get;set;}//contract adjusted price or a copy of BasePrice if no contract + public decimal ManualDiscountPct { get; set; }// (V7 "Discount") ad-hoc / % off of the contractprice (which is always set regardless if contract or not) entered manually + public long? TaxPartSaleId { get; set; } + [Required] public long WorkOrderItemId { get; set; } [JsonIgnore] @@ -27,3 +35,26 @@ namespace AyaNova.Models }//eoc }//eons + +/* +CREATE TABLE [dbo].[AWORKORDERITEMPART]( + [AID] [uniqueidentifier] NOT NULL, + [AWORKORDERITEMID] [uniqueidentifier] NOT NULL, + [ACREATOR] [uniqueidentifier] NOT NULL, + [AMODIFIER] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NOT NULL, + [AMODIFIED] [datetime] NOT NULL, + [APARTSERIALID] [uniqueidentifier] NULL,//DROP REPLACE WITH SERIALS text field same as whatever is done with POITEM + [APARTID] [uniqueidentifier] NULL, + [AQUANTITY] [decimal](19, 5) NULL,//CHANGE TO NOT NULL DEFAULT 0 + [ACOST] [decimal](19, 5) NULL, + [APRICE] [decimal](19, 5) NULL, + [ADISCOUNT] [decimal](19, 5) NULL, + [ADISCOUNTTYPE] [smallint] NULL,//DROP WAS NEVER USED IN V7 + [APARTWAREHOUSEID] [uniqueidentifier] NULL, + [ADESCRIPTION] [nvarchar](255) NULL, + [AUSED] [bit] NOT NULL,//DROP True = Part has been consumed False = Part is only "suggested", not actually consumed yet (used with quantityreserved) + [AHASAFFECTEDINVENTORY] [bit] NOT NULL,//DROP, now every save will affect inventory immediately + [ATAXPARTSALEID] [uniqueidentifier] NULL, + [AQUANTITYRESERVED] [decimal](19, 5) NULL //DROP, case 3789 due to immediately affecting inventory changes before would reserve separately, now will remove from inventory immediately or generate a request if insufficient +*/ \ No newline at end of file diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index d93c6461..4c647f56 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -748,7 +748,6 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE aworkorderitempriority (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " + "color VARCHAR(12) NOT NULL default '#000000')"); - //WORKORDER await ExecQueryAsync("CREATE TABLE aworkorder (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, active BOOL NOT NULL, " + "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, customerid BIGINT NOT NULL REFERENCES acustomer (id), " @@ -784,11 +783,14 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + "notes TEXT, outdate TIMESTAMP, duedate TIMESTAMP, returndate TIMESTAMP, charges DECIMAL(38,18) NOT NULL default 0, taxcodeid BIGINT REFERENCES ataxcode, " + "loanitemid BIGINT NOT NULL REFERENCES aloanitem, quantity DECIMAL(19,5) NOT NULL default 0, rate INTEGER NOT NULL" + ")"); - await ExecQueryAsync("ALTER TABLE aloanunit ADD column workorderitemloanid BIGINT NULL REFERENCES aworkorderitemloan"); + //WORKORDERITEM PART await ExecQueryAsync("CREATE TABLE aworkorderitempart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), " - + "notes TEXT, customfields TEXT, tags VARCHAR(255) ARRAY)"); + + "description TEXT, serials TEXT, partid BIGINT NOT NULL REFERENCES apart, partwarehouseid BIGINT NOT NULL REFERENCES apartwarehouse, " + + "quantity DECIMAL(19,5) NOT NULL default 0, cost DECIMAL(38,18) NOT NULL default 0, baseprice DECIMAL(38,18) NOT NULL default 0, price DECIMAL(38,18) NOT NULL default 0, " + + "manualdiscountpct DECIMAL(8,5) NOT NULL default 0, taxpartsaleid BIGINT REFERENCES ataxcode " + + ")"); await ExecQueryAsync("CREATE TABLE aworkorderitempartrequest (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), " + "notes TEXT, customfields TEXT, tags VARCHAR(255) ARRAY)");