This commit is contained in:
70
server/AyaNova/models/WorkorderStatus.cs
Normal file
70
server/AyaNova/models/WorkorderStatus.cs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
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 WorkorderStatus
|
||||||
|
{
|
||||||
|
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; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
Hexadecimal notation: #RGB[A]
|
||||||
|
R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (0–9, A–F). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388.
|
||||||
|
*/
|
||||||
|
[MaxLength(12)]
|
||||||
|
public string Color { get; set; }
|
||||||
|
|
||||||
|
public AuthorizationRoles SelectRoles { get; set; }
|
||||||
|
public AuthorizationRoles RemoveRoles { get; set; }
|
||||||
|
public bool Completed { get; set; }
|
||||||
|
public bool Locked { get; set; }
|
||||||
|
|
||||||
|
public WorkorderStatus()
|
||||||
|
{
|
||||||
|
Color = "#ffffff";//white / no color is the default
|
||||||
|
}
|
||||||
|
|
||||||
|
}//eoc
|
||||||
|
|
||||||
|
}//eons
|
||||||
|
/*
|
||||||
|
[dbo].[AWORKORDERSTATUS](
|
||||||
|
[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,
|
||||||
|
[AARGB] [int] NOT NULL
|
||||||
|
|
||||||
|
|
||||||
|
V8: add the following properties:
|
||||||
|
SelectRoles - who can select the status (still shows if they can't select but that's the current status, like active does)
|
||||||
|
This is best handled at the client. It prefetches all the status out of the normal picklist process, more like how other things are separately handled now without a picklist
|
||||||
|
client then knows if a status is available or not and can process to only present available ones
|
||||||
|
Server can use a biz rule to ensure that it can't be circumvented
|
||||||
|
UI defaults to any role
|
||||||
|
DeselectRoles - who can unset this status (important for process control)
|
||||||
|
UI defaults to any role
|
||||||
|
CompletedStatus bool - this is a final status indicating all work on the workorder is completed, affects notification etc
|
||||||
|
UI defaults to false but when set to true auto sets lockworkorder to true (but user can just unset lockworkorder)
|
||||||
|
LockWorkorder - this status is considered read only and the workorder is locked
|
||||||
|
Just a read only thing, can just change status to "unlock" it
|
||||||
|
to support states where no one should work on a wo for whatever reason but it's not necessarily completed
|
||||||
|
e.g. "Hold for inspection", "On hold" generally etc
|
||||||
|
*/
|
||||||
@@ -826,6 +826,11 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
|||||||
|
|
||||||
|
|
||||||
//----------
|
//----------
|
||||||
|
//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)");
|
||||||
|
|
||||||
|
|
||||||
//WORKORDER
|
//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, "
|
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 )");
|
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY )");
|
||||||
@@ -856,7 +861,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
|||||||
//VPARTSONORDERCOMMITTED
|
//VPARTSONORDERCOMMITTED
|
||||||
await ExecQueryAsync("CREATE VIEW vpartsonordercommitted AS SELECT partid, partwarehouseid, SUM((COALESCE(apurchaseorderitem.quantityordered,0)-COALESCE(apurchaseorderitem.quantityreceived,0))) AS quantityonordercommitted "
|
await ExecQueryAsync("CREATE VIEW vpartsonordercommitted AS SELECT partid, partwarehouseid, SUM((COALESCE(apurchaseorderitem.quantityordered,0)-COALESCE(apurchaseorderitem.quantityreceived,0))) AS quantityonordercommitted "
|
||||||
+ "FROM apurchaseorderitem WHERE workorderitempartrequestid IS NOT NULL AND (COALESCE(apurchaseorderitem.quantityordered,0)-COALESCE(apurchaseorderitem.quantityreceived,0)) > 0 GROUP BY partid, partwarehouseid");
|
+ "FROM apurchaseorderitem WHERE workorderitempartrequestid IS NOT NULL AND (COALESCE(apurchaseorderitem.quantityordered,0)-COALESCE(apurchaseorderitem.quantityreceived,0)) > 0 GROUP BY partid, partwarehouseid");
|
||||||
|
|
||||||
//VPARTSONORDERUNCOMMITTED
|
//VPARTSONORDERUNCOMMITTED
|
||||||
await ExecQueryAsync("CREATE VIEW vpartsonorderuncommitted AS SELECT partid, partwarehouseid, SUM((COALESCE(apurchaseorderitem.quantityordered,0)-COALESCE(apurchaseorderitem.quantityreceived,0))) AS quantityonorder "
|
await ExecQueryAsync("CREATE VIEW vpartsonorderuncommitted AS SELECT partid, partwarehouseid, SUM((COALESCE(apurchaseorderitem.quantityordered,0)-COALESCE(apurchaseorderitem.quantityreceived,0))) AS quantityonorder "
|
||||||
+ "FROM apurchaseorderitem WHERE workorderitempartrequestid IS NULL AND (COALESCE(apurchaseorderitem.quantityordered,0)-COALESCE(apurchaseorderitem.quantityreceived,0)) > 0 GROUP BY partid, partwarehouseid");
|
+ "FROM apurchaseorderitem WHERE workorderitempartrequestid IS NULL AND (COALESCE(apurchaseorderitem.quantityordered,0)-COALESCE(apurchaseorderitem.quantityreceived,0)) > 0 GROUP BY partid, partwarehouseid");
|
||||||
|
|||||||
Reference in New Issue
Block a user