3.0.1.2 Requirements & tidy

This commit is contained in:
Andy Howard
2025-02-26 18:42:52 +00:00
parent d7dc5f8fbc
commit 80b085cf29
79 changed files with 2472 additions and 594 deletions
+26 -22
View File
@@ -21,10 +21,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
Unknown,
Pos,
Id,
//Requirement.
TransId,
Owner_Name,
// Requirement code
// Association.
Assoc_Code,
Assoc_AccountManagerCode, Assoc_AccountManagerDesc,
Assoc_AccountHandlerCode, Assoc_AccountHandlerDesc,
@@ -32,7 +30,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
Assoc_Target_PhoneMain,
Assoc_Target_PhoneAlt,
// Transaction details
Trans_TypeDesc, Trans_Ref, Trans_RefExt, Trans_DescBrief,
TransId,
Trans_Type, Trans_TypeDesc, Trans_Ref, Trans_RefExt, Trans_DescBrief,
Trans_ContactName,
Trans_Likelihood,
Trans_Raised,
@@ -89,9 +88,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
Trans_DeliveryAddress_Line1, Trans_DeliveryAddress_Line2, Trans_DeliveryAddress_Line3,
Trans_DeliveryAddress_City, Trans_DeliveryAddress_Province, Trans_DeliveryAddress_Postcode,
Trans_DeliveryAddress_Phone, Trans_DeliveryAddress_Email,
Trans_SourceTrans_Ref, // Source transaction reference.
//Relation to items
Seq,
Trans_SourceTrans_Ref, /* Source transaction reference. */
// Requirement.
Type,
Sequence,
Started, StartedTime, Started_Day,
Required, RequiredTime, Required_Fmt, // Formatted 'Required' date (eg. square brackets around defaulted date).
Completed, CompletedTime,
@@ -1147,7 +1147,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
{
case Column.Id:
return new DataValue((long)SysId.ToInt(data.Id));
case Column.Seq:
case Column.Sequence:
return new DataValue(data.Seq);
case Column.Required:
return new DataValue(data.Required);
@@ -1235,22 +1235,22 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public SysId CommodityId { get; set; }
public SysId AssetId { get; set; }
// Requirement.
public HashSet<SysId> RequirementIdsIncluded { get; } = new HashSet<SysId>();
public HashSet<SysId> RequirementIdsExcluded { get; } = new HashSet<SysId>();
public HashSet<SysId> IdsIncluded { get; } = new HashSet<SysId>();
public HashSet<SysId> IdsExcluded { get; } = new HashSet<SysId>();
public HashSet<SysId> RequirementIdsSource { get; } = new HashSet<SysId>();
public String RequirementProductCodeFull { get; set; }
public String RequirementProductCodePartial { get; set; }
public String Search { get; set; }
public String ProductCodeFull { get; set; }
public String ProductCodePartial { get; set; }
// Stored as product code for 'Project' transactions (populating this value will force the transaction type).
public String RequirementProjectTaskCodeFull { get; set; }
public String RequirementProjectTaskCodePartial { get; set; }
public String RequirementJobNumberFull { get; set; }
public String RequirementJobNumberPartial { get; set; }
public String RequirementAssetSerialFull { get; set; }
public String RequirementAssetSerialPartial { get; set; }
public String RequirementDescBrief { get; set; }
public String RequirementPromotionCode { get; set; }
public String ProjectTaskCodeFull { get; set; }
public String ProjectTaskCodePartial { get; set; }
public String JobNumberFull { get; set; }
public String JobNumberPartial { get; set; }
public String AssetSerialFull { get; set; }
public String AssetSerialPartial { get; set; }
public String DescBrief { get; set; }
public String PromotionCode { get; set; }
// Transaction.
public String AliasTransaction { get; set; }
public HashSet<SysId> TransactionIdsIncluded { get; } = new HashSet<SysId>();
public HashSet<SysId> TransactionIdsExcluded { get; } = new HashSet<SysId>();
public SysId TransactionRequirementSourceId { get; set; } // Identifies the transaction to which the source requirement belongs.
@@ -1283,7 +1283,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
// Stock by Sales Locations.
public SysId SalesLocationIdStock01 { get; set; }
public SysId SalesLocationIdStock02 { get; set; }
public SysId SalesLocationIdStock03;
public SysId SalesLocationIdStock03 { get; set; }
// Required date.
public DateTime RequirementRequiredFrom { get; set; }
public DateTime RequirementRequiredTo { get; set; }
@@ -1293,6 +1293,10 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
public String NotesPartial { get; set; }
/// <summary>Requirement status.</summary>
public StatusCat StatusCat { get; set; } = StatusCat.Default;
// Table aliases joined in query.
public String AliasTransaction { get; set; }
public String AliasCommodity { get; set; }
public String AliasAsset { get; set; }
}
//-------------------------------------------------------------------
@@ -1001,54 +1001,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
return false;
}
//-------------------------------------------------------------------
public bool RefreshTotals(List<SbmRequirement> requirements)
{
return RefreshTotals(requirements.ToDataList());
}
public bool RefreshTotals(List<SbmRequirement.Data> requirements)
{
// Recalculate the amounts stored against the transaction in line with the list of requirements.
ClearErrorState();
if (this == null) return SetErrorState("transaction not specified");
if (!HasErrorState())
{
// Total weight.
decimal totalWeight = requirements.GetTotalWeight(UomIdWeight);
Weight = totalWeight;
// Set the allocation status.
ClearAllocationStatus();
if (requirements.Count > 0)
{
if (requirements.IsFullAllocation()) FullAllocation = true;
else if (requirements.IsPartialAllocation()) PartialAllocation = true;
}
// Calculate the totals from the list of requirements.;
decimal newAmountNet = 0.0m;
decimal newAmountTax = 0.0m;
decimal newAmountTot = 0.0m;
decimal newTimeEst = 0.0m;
decimal newTimeAct = 0.0m;
if (requirements.Count > 0)
requirements.CalculateTotals(ref newAmountNet, ref newAmountTax, ref newAmountTot, ref newTimeEst, ref newTimeAct);
// Include delivery amounts.
newAmountNet += DeliveryAmountNet;
newAmountTax += DeliveryAmountTax;
newAmountTot += DeliveryAmountTot;
// Store amounts:
AmountNet = newAmountNet;
AmountTax = newAmountTax;
AmountTot = newAmountTot;
TimeEst = newTimeEst;
TimeAct = newTimeAct;
}
return OK;
}
//-------------------------------------------------------------------
public bool RefreshRequiredDate(List<SbmRequirement> requirements, ISacsMessageConsole messageConsole)
{