This commit is contained in:
2021-03-26 20:29:05 +00:00
parent 6a0ee52dab
commit c3523d4d6f
2 changed files with 44 additions and 11 deletions

View File

@@ -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<string>();
}
public long Id { get; set; }
public uint Concurrency { get; set; }
public string Notes { get; set; }
public string CustomFields { get; set; }
public List<string> 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
*/

View File

@@ -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)");