mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-21 15:27:15 +00:00
Stock SKU transaction reconciliation
This commit is contained in:
25
src/bnhtrade.Core/Model/Stock/JournalEntry.cs
Normal file
25
src/bnhtrade.Core/Model/Stock/JournalEntry.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Model.Stock
|
||||
{
|
||||
public class JournalEntry
|
||||
{
|
||||
public string TypeTitle { get; set; }
|
||||
|
||||
public int StockId { get; set; }
|
||||
|
||||
public int StockNumber { get; set; }
|
||||
|
||||
public DateTime EntryDate { get; set; }
|
||||
|
||||
public DateTime PostDate { get; set; }
|
||||
|
||||
public DateTime LastModified { get; set; }
|
||||
|
||||
public bool IsLocked { get; set; }
|
||||
}
|
||||
}
|
||||
34
src/bnhtrade.Core/Model/Stock/JournalEntryPost.cs
Normal file
34
src/bnhtrade.Core/Model/Stock/JournalEntryPost.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Model.Stock
|
||||
{
|
||||
public class JournalEntryPost : IValidatableObject
|
||||
{
|
||||
public int JournalPostId { get; set; }
|
||||
|
||||
public int StockStatusId { get; set; }
|
||||
|
||||
[Required()]
|
||||
public string StockStatus { get; set; }
|
||||
|
||||
[Required()]
|
||||
public int Quantity { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
var resultList = new List<ValidationResult>();
|
||||
|
||||
if (Quantity == 0)
|
||||
{
|
||||
resultList.Add(new ValidationResult("Quantity must be greater than, or less than, zero"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ namespace bnhtrade.Core.Model.Stock
|
||||
private int? skuTransactionId = null;
|
||||
private int? skuTransactionTypeId = null;
|
||||
private int? foreignKey = null;
|
||||
private string skuTransactionTypeCode;
|
||||
private Model.Stock.SkuTransactionType skuTransactionType;
|
||||
|
||||
public int SkuTransactionId
|
||||
{
|
||||
@@ -41,22 +43,60 @@ namespace bnhtrade.Core.Model.Stock
|
||||
}
|
||||
|
||||
[Required()]
|
||||
public int SkuTransactionTypeId
|
||||
public string SkuTransactionTypeCode
|
||||
{
|
||||
get { return skuTransactionTypeId.GetValueOrDefault(); }
|
||||
private set { skuTransactionTypeId = value; }
|
||||
get
|
||||
{
|
||||
if (IsSetSkuTransactionType)
|
||||
{
|
||||
return SkuTransactionType.TypeCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
return skuTransactionTypeCode;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if (IsSetSkuTransactionType)
|
||||
{
|
||||
if (SkuTransactionType.TypeCode != value)
|
||||
{
|
||||
SkuTransactionType = null;
|
||||
skuTransactionTypeCode = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
skuTransactionTypeCode = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSetSkuTransactionTypeId
|
||||
public bool IsSetSkuTransactionTypeCode
|
||||
{
|
||||
get { return skuTransactionTypeId != null; }
|
||||
get { return SkuTransactionTypeCode != null; }
|
||||
}
|
||||
|
||||
public string SkuTransactionTypeName { get; private set; }
|
||||
|
||||
public bool IsSetReconcileSkuTypeName
|
||||
public Model.Stock.SkuTransactionType SkuTransactionType
|
||||
{
|
||||
get { return SkuTransactionTypeName != null; }
|
||||
get
|
||||
{
|
||||
return skuTransactionType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (IsSetSkuTransactionTypeCode)
|
||||
{
|
||||
skuTransactionTypeCode = null;
|
||||
}
|
||||
skuTransactionType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSetSkuTransactionType
|
||||
{
|
||||
get { return SkuTransactionType != null; }
|
||||
}
|
||||
|
||||
public int ForeignKey
|
||||
@@ -126,15 +166,6 @@ namespace bnhtrade.Core.Model.Stock
|
||||
get { return stockjournalId != null; }
|
||||
}
|
||||
|
||||
public void SetReconcileSkuType(int reconcileSkuTypeId, string reconcileSkuTypeName)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(reconcileSkuTypeName) || reconcileSkuTypeId == 0)
|
||||
{
|
||||
SkuTransactionTypeId = reconcileSkuTypeId;
|
||||
SkuTransactionTypeName = reconcileSkuTypeName;
|
||||
}
|
||||
}
|
||||
|
||||
public SkuTransaction Clone()
|
||||
{
|
||||
var clone = new SkuTransaction();
|
||||
@@ -145,11 +176,11 @@ namespace bnhtrade.Core.Model.Stock
|
||||
if (IsSetQuantity) { clone.Quantity = this.Quantity; }
|
||||
if (IsSetReference) { clone.Reference = string.Copy(this.Reference); }
|
||||
if (IsSetSkuNumber) { clone.SkuNumber = string.Copy(this.SkuNumber); }
|
||||
if (IsSetReconcileSkuTypeName) { clone.SkuTransactionTypeName = string.Copy(this.SkuTransactionTypeName); }
|
||||
if (IsSetStockJournalId) { clone.StockJournalId = this.StockJournalId; }
|
||||
if (IsSetSkuTransactionId) { clone.SkuTransactionId = this.SkuTransactionId; }
|
||||
if (IsSetSkuTransactionTypeId) { clone.SkuTransactionTypeId = this.SkuTransactionTypeId; }
|
||||
if (IsSetTransactionDate) { clone.TransactionDate = this.TransactionDate; }
|
||||
if (IsSetSkuTransactionType) { clone.SkuTransactionType = this.SkuTransactionType; }
|
||||
else if (IsSetSkuTransactionTypeCode) { clone.SkuTransactionTypeCode = string.Copy(this.SkuTransactionTypeCode); }
|
||||
|
||||
return clone;
|
||||
}
|
||||
@@ -174,10 +205,6 @@ namespace bnhtrade.Core.Model.Stock
|
||||
{
|
||||
result.Add(new ValidationResult("Stock Transaction Id is not set"));
|
||||
}
|
||||
if (!IsSetSkuTransactionTypeId)
|
||||
{
|
||||
result.Add(new ValidationResult("Stock Transaction TypeId is not set"));
|
||||
}
|
||||
if (IsSetStockJournalId && (!IsSetIsProcessed || IsProcessed == false))
|
||||
{
|
||||
result.Add(new ValidationResult("Stock Journal Id is set, IsProcessed must be set to true"));
|
||||
|
||||
@@ -46,11 +46,11 @@ namespace bnhtrade.Core.Model.Stock
|
||||
|
||||
public bool StockJournalEntryEnabled { get; set; }
|
||||
|
||||
public int DebitStockStatusId { get; set; }
|
||||
public int? DebitStockStatusId { get; set; }
|
||||
|
||||
public string DebitStockStatus { get; set; }
|
||||
|
||||
public int CreditStockStatusId { get; set; }
|
||||
public int? CreditStockStatusId { get; set; }
|
||||
|
||||
public string CreditStockStatus { get; set; }
|
||||
|
||||
@@ -58,6 +58,6 @@ namespace bnhtrade.Core.Model.Stock
|
||||
|
||||
public bool FilterStockOnDateTime { get; set; }
|
||||
|
||||
public bool FirstInFirstOut { get; set; }
|
||||
public bool FirstInFirstOut { get; set; } // TODO: move FIFO rule to 'Stock Status'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user