Files
raven/server/AyaNova/models/PartInventory.cs
2022-07-04 23:38:49 +00:00

118 lines
3.3 KiB
C#

using System;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace AyaNova.Models
{
//PARTINVENTORY LEDGER
//NOTE: following pattern outlined here:
//https://dba.stackexchange.com/a/19368
//MIRRORED IN QBI
public class PartInventory
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]//this is only affordance to open in UI so always needs a value
public string Description { get; set; }
[Required]
public DateTime EntryDate { get; set; }
public DateTime? LastEntryDate { get; set; }
[Required]
public long PartId { get; set; }
[NotMapped]
public string PartNameViz { get; set; }
[NotMapped]
public string PartDescriptionViz { get; set; }
[NotMapped]
public string PartUpcViz { get; set; }
[Required]
public long PartWarehouseId { get; set; }
[NotMapped]
public string PartWarehouseViz { get; set; }
public long? SourceId { get; set; }
[NotMapped]
public string SourceViz { get; set; }
public AyaType? SourceType { get; set; }
[NotMapped]
public string SourceTypeViz { get; set; }
[Required]
public decimal Quantity { get; set; }
[Required]
public decimal Balance { get; set; }
public decimal? LastBalance { get; set; }
public PartInventory()
{
EntryDate = DateTime.UtcNow;
}
}//eoc
//public facing class for manual adjustment via ui
public class dtPartInventory
{
public long Id { get; set; }
public uint Concurrency { get; set; }//wtf? This is never an update, shouldn't this be not here?
[Required]
public string Description { get; set; }
[Required]
public long PartId { get; set; }
[Required]
public long PartWarehouseId { get; set; }
[Required]
public decimal Quantity { get; set; }
}//eoc
//internal purchase order version
public class dtInternalPartInventory
{
public long Id { get; set; }
[Required]
public string Description { get; set; }
[Required]
public long PartId { get; set; }
[Required]
public long PartWarehouseId { get; set; }
[Required]
public decimal Quantity { get; set; }
public long? SourceId { get; set; }
public AyaType? SourceType { get; set; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[APARTBYWAREHOUSEINVENTORY](
[AID] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[APARTID] [uniqueidentifier] NOT NULL,
[APARTWAREHOUSEID] [uniqueidentifier] NOT NULL,
[AQUANTITYONHAND] [decimal](19, 5) NOT NULL,
[AQUANTITYONORDER] [decimal](19, 5) NOT NULL,//calculated on the fly from active PO's
[AMINSTOCKLEVEL] [decimal](19, 5) NOT NULL,//New table / feature PartRestock (partid/warhouseid/stocklevel)
[AQTYONORDERCOMMITTED] [decimal](19, 5) NOT NULL, //Calculated on the fly from po and partrequests
*/