This commit is contained in:
2021-03-26 23:48:26 +00:00
parent 6c166de5b5
commit 883d1821e2
9 changed files with 171 additions and 23 deletions

View File

@@ -137,7 +137,8 @@ namespace AyaNova.Biz
DataListColumnView = 68,
PartInventoryRestock = 69,//for list only, synthetic object
PartInventoryRequest = 70,//for list only not, synthetic object
WorkOrderStatus = 71
WorkOrderStatus = 71,
TaskGroup = 72

View File

@@ -0,0 +1,22 @@
namespace AyaNova.Biz
{
/// <summary>
/// Indicates status of task
/// </summary>
public enum WorkorderItemTaskCompletionType : int
{
/// <summary>
/// Not finished
/// </summary>
Incomplete = 1,
/// <summary>
/// Finished
/// </summary>
Complete = 2,
/// <summary>
/// Not relevant
/// </summary>
NotApplicable = 3
}
}//eons

View File

@@ -70,7 +70,8 @@ namespace AyaNova.Models
public virtual DbSet<ServiceRate> ServiceRate { get; set; }
public virtual DbSet<TravelRate> TravelRate { get; set; }
public virtual DbSet<CustomerServiceRequest> CustomerServiceRequest { get; set; }
public virtual DbSet<TaskGroup> TaskGroup { get; set; }
public virtual DbSet<TaskGroupItem> TaskGroupItem { get; set; }
//WorkOrder

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace AyaNova.Models
{
//https://stackoverflow.com/questions/46517584/how-to-add-a-parent-record-with-its-children-records-in-ef-core#46615455
public class TaskGroup
{
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 List<TaskGroupItem> Items { get; set; } = new List<TaskGroupItem>();
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.TaskGroup; }
}//eoc
}//eons

View File

@@ -0,0 +1,27 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace AyaNova.Models
{
//https://stackoverflow.com/questions/46517584/how-to-add-a-parent-record-with-its-children-records-in-ef-core#46615455
public class TaskGroupItem
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public long TaskGroupId { get; set; }
public int DisplayOrder { get; set; } = 0;
[Required]
public string Task { get; set; }
[JsonIgnore]
public TaskGroup TaskGroup { get; set; }
}//eoc
}//eons

View File

@@ -21,7 +21,9 @@ namespace AyaNova.Models
public decimal NoChargeQuantity { get; set; }
public long? ServiceBankId { get; set; }
public long? TaxCodeSaleId { get; set; }
public decimal BasePrice { get; set; }//Rate price per unit at time of entry
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
[Required]

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,20 @@ namespace AyaNova.Models
{
public class WorkOrderItemTask : ICoreBizObjectModel
{
public WorkOrderItemTask()
{
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 int DisplayOrder { get; set; } = 0;
[Required]
public string Task { get; set; }
[Required]
public WorkorderItemTaskCompletionType Status { get; set; } = WorkorderItemTaskCompletionType.Incomplete;
public long? CompletedByUserId { get; set; }
public DateTime? CompletedDate { get; set; }
[Required]
public long WorkOrderItemId { get; set; }
[JsonIgnore]
@@ -27,3 +32,15 @@ namespace AyaNova.Models
}//eoc
}//eons
/*
CREATE TABLE [dbo].[AWORKORDERITEMTASK](
[AID] [uniqueidentifier] NOT NULL,
[AWORKORDERITEMID] [uniqueidentifier] NOT NULL,
[ATASKID] [uniqueidentifier] NOT NULL,//drop, feeds now, Task it linked to is literally just a single string "Name" so this is an easy decision
[ATASKGROUPID] [uniqueidentifier] NOT NULL,//drop feeds now
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[AWORKORDERITEMTASKCMPLTNTYPE] [smallint] NOT NULL//rename to Status
*/

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,26 @@ namespace AyaNova.Models
{
public class WorkOrderItemTravel : ICoreBizObjectModel
{
public WorkOrderItemTravel()
{
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 long? UserId { get; set; }
public DateTime? TravelStartDate { get; set; }
public DateTime? TravelStopDate { get; set; }
public long? TravelRateId { get; set; }
public string TravelDetails { get; set; }
public decimal TravelRateQuantity { get; set; }
public decimal NoChargeQuantity { get; set; }
public long? ServiceBankId { get; set; }
public long? TaxCodeSaleId { get; set; }
public decimal Distance { get; set; }
public decimal BasePrice { get; set; }//Rate price per unit at time of entry
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
[Required]
public long WorkOrderItemId { get; set; }
[JsonIgnore]
@@ -27,3 +38,23 @@ namespace AyaNova.Models
}//eoc
}//eons
/*
CREATE TABLE [dbo].[AWORKORDERITEMTRAVEL](
[AID] [uniqueidentifier] NOT NULL,
[AWORKORDERITEMID] [uniqueidentifier] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[ANOTES] [ntext] NULL,
[AUSERID] [uniqueidentifier] NULL,
[ATRAVELSTARTDATE] [datetime] NULL,
[ATRAVELSTOPDATE] [datetime] NULL,
[ATRAVELRATEID] [uniqueidentifier] NULL,
[ATRAVELDETAILS] [nvarchar](255) NULL,
[ATRAVELRATEQUANTITY] [decimal](19, 5) NULL,
[ANOCHARGEQUANTITY] [decimal](19, 5) NULL,
[ADISTANCE] [decimal](19, 5) NULL,
[ATAXRATESALEID] [uniqueidentifier] NULL,
[ASERVICEBANKID] [uniqueidentifier] NULL
*/

View File

@@ -736,6 +736,14 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗ ╚██████╔╝██║ ██║██████╔╝███████╗██║ ██║
╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝
*/
//TASKGROUP
await ExecQueryAsync("CREATE TABLE ataskgroup (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, notes TEXT)");
//TASK
await ExecQueryAsync("CREATE TABLE ataskgroupitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, taskgroupid BIGINT NOT NULL REFERENCES ataskgroup ON DELETE CASCADE, "
+ "displayorder INTEGER NOT NULL DEFAULT 0, name TEXT NOT NULL)");
//WORKORDER STATUS
await ExecQueryAsync("CREATE TABLE aworkorderstatus (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, "
+ "notes TEXT, color VARCHAR(12) NOT NULL default '#000000', selectroles INTEGER NOT NULL, removeroles INTEGER NOT NULL, completed BOOL NOT NULL, locked BOOL NOT NULL)");
@@ -775,7 +783,9 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//WORKORDERITEM LABOR
await ExecQueryAsync("CREATE TABLE aworkorderitemlabor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), "
+ "userid BIGINT REFERENCES auser, servicestartdate TIMESTAMP, servicestopdate TIMESTAMP, servicerateid BIGINT REFERENCES aservicerate, servicedetails text, "
+ "serviceratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, servicebankid BIGINT REFERENCES aservicebank, taxcodesaleid BIGINT REFERENCES ataxcode"
+ "serviceratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, servicebankid BIGINT REFERENCES aservicebank, "
+ "taxcodesaleid BIGINT REFERENCES ataxcode, baseprice DECIMAL(38,18) NOT NULL default 0, price DECIMAL(38,18) NOT NULL default 0, "
+ "manualdiscountpct DECIMAL(8,5) NOT NULL default 0 "
+ ")");
//WORKORDERITEM LOAN
@@ -804,17 +814,24 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
+ "estimatedquantity DECIMAL(19,5) NOT NULL default 0"
+ ")");
//WORKORDERITEM TASK
await ExecQueryAsync("CREATE TABLE aworkorderitemtask (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), "
+ "notes TEXT, customfields TEXT, tags VARCHAR(255) ARRAY)");
+ "displayorder INTEGER NOT NULL DEFAULT 0, task text NOT NULL, status INTEGER NOT NULL DEFAULT 1, completedbyuserid BIGINT REFERENCES auser, completeddate TIMESTAMP"
+ ")");
//WORKORDERITEM TRAVEL
await ExecQueryAsync("CREATE TABLE aworkorderitemtravel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), "
+ "notes TEXT, customfields TEXT, tags VARCHAR(255) ARRAY)");
+ "userid BIGINT REFERENCES auser, travelstartdate TIMESTAMP, travelstopdate TIMESTAMP, travelrateid BIGINT REFERENCES atravelrate, traveldetails text, "
+ "travelratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, servicebankid BIGINT REFERENCES atravelbank, "
+ "taxcodesaleid BIGINT REFERENCES ataxcode, distance DECIMAL(19,5) 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 "
+ ")");
await ExecQueryAsync("CREATE TABLE aworkorderitemunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), "
+ "notes TEXT, customfields TEXT, tags VARCHAR(255) ARRAY)");
//POITEM LINK
await ExecQueryAsync("ALTER TABLE apurchaseorderitem ADD column workorderitempartrequestid BIGINT REFERENCES aworkorderitempartrequest");