Service - Unit Standard: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
https://bitbucket.org/izara-supply-units/izara-supply-units-unit-standard
https://bitbucket.org/izara-supply-units/izara-supply-units-unit-standard


= DynamoDB tables =
= Units that contain quantity properties =
 
== [[Standard Config Table Per Service]] ==
 
=== Configuration tags ===
 
<syntaxhighlight lang="JavaScript">
{
configTag: "SupplyGraphServiceName"
configKey: "SupplyGraphServiceName"
configValue: xxx // eg: "SupplyGraph"
}
</syntaxhighlight>
 
<syntaxhighlight lang="JavaScript">
{
configTag: "UnitManagerServiceName"
configKey: "UnitManagerServiceName"
configValue: xxx // eg: "UnitManager"
}
</syntaxhighlight>
 
== LogicalResults ==
 
[[Standard LogicalResults Per Service]]
 
= Units that contain quantities =


* Izara Supply is not used for stock management, but used to follow units we want to track, which in some cases might themselves have a quantity inside them (example bag of 1000 buttons or 200 yard roll of fabric)
* Izara Supply is not used for stock management, but used to follow units we want to track, which in some cases might themselves have a quantity inside them (example bag of 1000 buttons or 200 yard roll of fabric)
* instead of tracking each button or each yard (or inch) we track the bag or roll only
* instead of tracking each button or each yard (or inch) we track the bag or roll only
* user can use a unitTrackedProperty to record the quantity inside the tracked Unit
* user can use a unitTrackedProperty to record the quantity inside the tracked Unit
* the unitTrackedProperty can then be used in [[Service - Transform Units]] to break down into individual units or multiple used to create other tracked Units
* the unitTrackedProperty can then be used in [[Service - Transform Units]] to break down any number of individual Units into any number of other Units. This allows for changing a roll with unitTrackedProperty of yards into multiple yard Units, or different raw material Units into a group of clothing Units
* eg if use 1 tracked back of 1000 buttons to make 10 shirts (100 buttons each shirt), the bag is one tracked Unit, and gets transformed into 10 tracked Unit shirts
* eg if have 1 tracked bag of 1000 buttons can transform into 10 shirts (100 buttons each shirt), the bag is one tracked Unit, and gets transformed into 10 tracked Unit shirts along with any other raw material


= Units that track costing =
= Units that track costing properties =


* The cost of Units passing through the supply chain can also be managed using unitTrackedProperty
* The cost of Units passing through the supply chain can also be handled using unitTrackedProperty
* each material has a unitTrackedProperty that is it's cost
* each raw material has a unitTrackedProperty that is it's cost
* example 1 tracked Unit of a bag of 1000 buttons would have a cost unitTrackedProperty for it's full cost
* example 1 tracked Unit of a bag of 1000 buttons would have a cost unitTrackedProperty for it's full cost
* calculatedProperties in transformUnits can spread that cost (and all other materials used) across the new tracked Units created, saving the total into a new property in the outputUnits
* calculatedProperties in transformUnits can spread that cost (and all other materials used) across the new tracked Units created, saving the total into a new property in the outputUnits


= Graph database =  
= objectSchemas =  


== [[Service - Supply Graph]]==
<syntaxhighlight lang="JavaScript">
{
objectType: "unitStandard",
extendObjType: {
serviceTag: "unitManager",
objectType: "unit",
},
storageResources:{
"xxx":{
storageType: "graph",
graphServerTag: "xx",
}
},
fieldNames: {
// from stage objectType
},
identifiers: [
// from stage objectType
]
},
</syntaxhighlight>


=== Nodes ===
<syntaxhighlight lang="JavaScript">
 
{
=== Versioned data ===
objectType: "unitTrackedProperty",
    belongTo: { // in future add RBAC to eg Units
serviceTag: "unitStandard",
objectType: "unitStandard"
},
storageResources:{
"xxx":{
storageType: "graph",
graphServerTag: "xx",
}
},
fieldNames: {
unitTrackedPropertyId: {
type: "string",
            randomOnCreate: true
},
propertyValue: {
type: "string", // so can adjust any type of property, will need cast type in logic
requiredOnCreate: true,
canUpdate: true,
},
},
identifiers: [
{
fieldName: "unitTrackedPropertyId"
},
]
},
</syntaxhighlight>


==== unitSettings ====
= relationshipSchemas =  


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
[
properties: {
  {
// some are controlled by unitType, others can be added as needed case by case, not controlled
    "hasUnitTrackedProperty": {
},
      storageResources:{
}
"xxx":{
storageType: "graph",
graphServerTag: "xx",
}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          canDelete: true,
          from: {
            objType: {
              serviceTag: "unitStandard",
              objectType: "unitStandard"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "unitStandard",
              objectType: "unitTrackedProperty"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
</syntaxhighlight>
</syntaxhighlight>


=== Relationships ===
* currently active unitTrackedProperty for each unitTypeTrackedProperty for a unitStandard


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
[
relationshipType: "{unitStandardLib.UNIT_IS_CURRENCY_GRAPH_REL_TYPE}", // "unitIs_currency"
  {
schema: {
    "oldUnitTrackedProperty": {
elementCanBeRemoved: true,
      storageResources:{
allPropertiesImmutable: true,
"xxx":{
restrictProperties: true,
storageType: "graph",
properties: {
graphServerTag: "xx",
originTimestamp: //timestamp the request to create/change this relationship was sent
}
},
      },
}
      fieldNames: {
}
"fromTimestamp": {
  type: "timestamp",
  requiredOnCreate: true,
},
"toTimestamp": {
  type: "timestamp",
  requiredOnCreate: true,
}
}, 
      links: [
        {
          storageResourceTags: ["xxx"],
          canDelete: true,
          from: {
            objType: {
              serviceTag: "unitStandard",
              objectType: "unitStandard"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "unitStandard",
              objectType: "unitTrackedProperty"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
</syntaxhighlight>
</syntaxhighlight>
* If UnitType has set isCurrency=true, all Units of that UnitType will have a link to a currency node
 
* old unitTrackedProperties for a unitStandard
* when a change is made to a unitTrackedProperty propertyValue a new unitTrackedProperty is created and hasUnitTrackedProperty links to unitStandard, while old hasUnitTrackedProperty relationship is removed and replaced with a oldUnitTrackedProperty


= Working documents =
= Working documents =

Revision as of 17:13, 15 February 2025

Overview

Handler service for the standard unit that tracks a single item.

Repository

https://bitbucket.org/izara-supply-units/izara-supply-units-unit-standard

Units that contain quantity properties

  • Izara Supply is not used for stock management, but used to follow units we want to track, which in some cases might themselves have a quantity inside them (example bag of 1000 buttons or 200 yard roll of fabric)
  • instead of tracking each button or each yard (or inch) we track the bag or roll only
  • user can use a unitTrackedProperty to record the quantity inside the tracked Unit
  • the unitTrackedProperty can then be used in Service - Transform Units to break down any number of individual Units into any number of other Units. This allows for changing a roll with unitTrackedProperty of yards into multiple yard Units, or different raw material Units into a group of clothing Units
  • eg if have 1 tracked bag of 1000 buttons can transform into 10 shirts (100 buttons each shirt), the bag is one tracked Unit, and gets transformed into 10 tracked Unit shirts along with any other raw material

Units that track costing properties

  • The cost of Units passing through the supply chain can also be handled using unitTrackedProperty
  • each raw material has a unitTrackedProperty that is it's cost
  • example 1 tracked Unit of a bag of 1000 buttons would have a cost unitTrackedProperty for it's full cost
  • calculatedProperties in transformUnits can spread that cost (and all other materials used) across the new tracked Units created, saving the total into a new property in the outputUnits

objectSchemas

{
	objectType: "unitStandard",
	extendObjType: {
		serviceTag: "unitManager",
		objectType: "unit",
	},
	storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
	},
	fieldNames: {
		// from stage objectType
	},
	identifiers: [
		// from stage objectType
	]
},
{
	objectType: "unitTrackedProperty",
    belongTo: { // in future add RBAC to eg Units
		serviceTag: "unitStandard",
		objectType: "unitStandard"
	},
	storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
	},
	fieldNames: {
		unitTrackedPropertyId: {
			type: "string",
            randomOnCreate: true
		},
		propertyValue: {
			type: "string", // so can adjust any type of property, will need cast type in logic
			requiredOnCreate: true,
			canUpdate: true,
		},
	},
	identifiers: [
		{
			fieldName: "unitTrackedPropertyId"
		},
	]
},

relationshipSchemas

[
  {
    "hasUnitTrackedProperty": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          canDelete: true,
          from: {
            objType: {
              serviceTag: "unitStandard",
              objectType: "unitStandard"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "unitStandard",
              objectType: "unitTrackedProperty"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
  • currently active unitTrackedProperty for each unitTypeTrackedProperty for a unitStandard
[
  {
    "oldUnitTrackedProperty": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      fieldNames: {
			"fromTimestamp": {
			  type: "timestamp",
			  requiredOnCreate: true,
			},
			"toTimestamp": {
			  type: "timestamp",
			  requiredOnCreate: true,
			}
		},   
      links: [
        {
          storageResourceTags: ["xxx"],
          canDelete: true,
          from: {
            objType: {
              serviceTag: "unitStandard",
              objectType: "unitStandard"
            },
            linkType: "one",
          },
          to: {
            objType: {
              serviceTag: "unitStandard",
              objectType: "unitTrackedProperty"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
  • old unitTrackedProperties for a unitStandard
  • when a change is made to a unitTrackedProperty propertyValue a new unitTrackedProperty is created and hasUnitTrackedProperty links to unitStandard, while old hasUnitTrackedProperty relationship is removed and replaced with a oldUnitTrackedProperty

Working documents

Unit Standard