Documentation
¶
Index ¶
- func AnalyzeDeliveriesPresenter(resp *pb.AnalyzeDeliveriesResponse) *apiresource.AnalyzeDeliveriesResponse
- func AnalyzeDemandForecastPresenter(resp *pb.AnalyzeDemandForecastResponse) *apiresource.AnalyzeDemandForecastResponse
- func AnalyzeInventoryReceiptsPresenter(resp *pb.AnalyzeInventoryReceiptsResponse) *apiresource.AnalyzeInventoryReceiptsResponse
- func AnalyzeManufacturingBatchPresenter(resp *pb.AnalyzeManufacturingBatchResponse) *apiresource.AnalyzeManufacturingBatchResponse
- func AnalyzeManufacturingPresenter(resp *pb.AnalyzeManufacturingResponse) *apiresource.AnalyzeManufacturingResponse
- func AnalyzeMaterialsPresenter(resp *pb.AnalyzeMaterialsResponse) *apiresource.AnalyzeMaterialsResponse
- func AnalyzeNewCustomersPresenter(resp *pb.AnalyzeNewCustomersResponse) *apiresource.AnalyzeNewCustomersResponse
- func AnalyzeOeePresenter(resp *pb.AnalyzeOeeResponse) *apiresource.AnalyzeOeeResponse
- func AnalyzeOeeTrendPresenter(resp *pb.AnalyzeOeeTrendResponse) *apiresource.AnalyzeOeeTrendResponse
- func AnalyzeOpenBatchesPresenter(resp *pb.AnalyzeOpenBatchesResponse) *apiresource.AnalyzeOpenBatchesResponse
- func AnalyzeOrdersPresenter(resp *pb.AnalyzeOrdersResponse) *apiresource.AnalyzeOrdersResponse
- func AnalyzeProductionCostsPresenter(resp *pb.AnalyzeProductionCostsResponse) *apiresource.AnalyzeProductionCostsResponse
- func AnalyzeQuarterlyOrdersPresenter(resp *pb.AnalyzeQuarterlyOrdersResponse) *apiresource.AnalyzeQuarterlyOrdersResponse
- func AnalyzeSalesPresenter(resp *pb.AnalyzeSalesResponse) *apiresource.AnalyzeSalesResponse
- func AnalyzeWeeksOfSalesPresenter(resp *pb.AnalyzeWeeksOfSalesResponse) *apiresource.AnalyzeWeeksOfSalesResponse
- type AnalyticsSvc
- type AnalyticsSvcConfig
- type AnalyzeCustomerPricingEndpoint
- type AnalyzeCustomerPricingRequest
- type AnalyzeDeliveriesEndpoint
- type AnalyzeDeliveriesRequest
- type AnalyzeDeliveryPerformanceEndpoint
- type AnalyzeDeliveryPerformanceRequest
- type AnalyzeDemandForecastEndpoint
- type AnalyzeDemandForecastRequest
- type AnalyzeInventoryReceiptsEndpoint
- type AnalyzeInventoryReceiptsRequest
- type AnalyzeManufacturingBatchEndpoint
- type AnalyzeManufacturingBatchRequest
- type AnalyzeManufacturingEndpoint
- type AnalyzeManufacturingRequest
- type AnalyzeMaterialsEndpoint
- type AnalyzeMaterialsRequest
- type AnalyzeNewCustomersEndpoint
- type AnalyzeNewCustomersRequest
- type AnalyzeOeeEndpoint
- type AnalyzeOeeRequest
- type AnalyzeOeeTrendEndpoint
- type AnalyzeOeeTrendRequest
- type AnalyzeOpenBatchesEndpoint
- type AnalyzeOpenBatchesRequest
- type AnalyzeOrdersEndpoint
- type AnalyzeOrdersRequest
- type AnalyzeProductionCostsEndpoint
- type AnalyzeProductionCostsRequest
- type AnalyzeQuarterlyOrdersEndpoint
- type AnalyzeQuarterlyOrdersRequest
- type AnalyzeRealizedMarginsEndpoint
- type AnalyzeRealizedMarginsRequest
- type AnalyzeSalesEndpoint
- type AnalyzeSalesRequest
- type AnalyzeScheduleAttainmentEndpoint
- type AnalyzeScheduleAttainmentRequest
- type AnalyzeWeeksOfSalesEndpoint
- type AnalyzeWeeksOfSalesRequest
- type OeeDepartmentPlannedTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnalyzeDeliveriesPresenter ¶
func AnalyzeDeliveriesPresenter(resp *pb.AnalyzeDeliveriesResponse) *apiresource.AnalyzeDeliveriesResponse
func AnalyzeDemandForecastPresenter ¶
func AnalyzeDemandForecastPresenter(resp *pb.AnalyzeDemandForecastResponse) *apiresource.AnalyzeDemandForecastResponse
func AnalyzeInventoryReceiptsPresenter ¶
func AnalyzeInventoryReceiptsPresenter(resp *pb.AnalyzeInventoryReceiptsResponse) *apiresource.AnalyzeInventoryReceiptsResponse
func AnalyzeManufacturingBatchPresenter ¶
func AnalyzeManufacturingBatchPresenter(resp *pb.AnalyzeManufacturingBatchResponse) *apiresource.AnalyzeManufacturingBatchResponse
func AnalyzeManufacturingPresenter ¶
func AnalyzeManufacturingPresenter(resp *pb.AnalyzeManufacturingResponse) *apiresource.AnalyzeManufacturingResponse
func AnalyzeMaterialsPresenter ¶
func AnalyzeMaterialsPresenter(resp *pb.AnalyzeMaterialsResponse) *apiresource.AnalyzeMaterialsResponse
func AnalyzeNewCustomersPresenter ¶
func AnalyzeNewCustomersPresenter(resp *pb.AnalyzeNewCustomersResponse) *apiresource.AnalyzeNewCustomersResponse
func AnalyzeOeePresenter ¶
func AnalyzeOeePresenter(resp *pb.AnalyzeOeeResponse) *apiresource.AnalyzeOeeResponse
func AnalyzeOeeTrendPresenter ¶
func AnalyzeOeeTrendPresenter(resp *pb.AnalyzeOeeTrendResponse) *apiresource.AnalyzeOeeTrendResponse
func AnalyzeOpenBatchesPresenter ¶
func AnalyzeOpenBatchesPresenter(resp *pb.AnalyzeOpenBatchesResponse) *apiresource.AnalyzeOpenBatchesResponse
func AnalyzeOrdersPresenter ¶
func AnalyzeOrdersPresenter(resp *pb.AnalyzeOrdersResponse) *apiresource.AnalyzeOrdersResponse
func AnalyzeProductionCostsPresenter ¶
func AnalyzeProductionCostsPresenter(resp *pb.AnalyzeProductionCostsResponse) *apiresource.AnalyzeProductionCostsResponse
func AnalyzeQuarterlyOrdersPresenter ¶
func AnalyzeQuarterlyOrdersPresenter(resp *pb.AnalyzeQuarterlyOrdersResponse) *apiresource.AnalyzeQuarterlyOrdersResponse
func AnalyzeSalesPresenter ¶
func AnalyzeSalesPresenter(resp *pb.AnalyzeSalesResponse) *apiresource.AnalyzeSalesResponse
func AnalyzeWeeksOfSalesPresenter ¶
func AnalyzeWeeksOfSalesPresenter(resp *pb.AnalyzeWeeksOfSalesResponse) *apiresource.AnalyzeWeeksOfSalesResponse
Types ¶
type AnalyticsSvc ¶
type AnalyticsSvc interface {
AnalyzeSales(ctx context.Context, req *AnalyzeSalesRequest) (*apiresource.AnalyzeSalesResponse, *apierror.APIError)
AnalyzeOpenBatches(ctx context.Context, req *AnalyzeOpenBatchesRequest) (*apiresource.AnalyzeOpenBatchesResponse, *apierror.APIError)
AnalyzeProductionCosts(ctx context.Context, req *AnalyzeProductionCostsRequest) (*apiresource.AnalyzeProductionCostsResponse, *apierror.APIError)
AnalyzeDeliveries(ctx context.Context, req *AnalyzeDeliveriesRequest) (*apiresource.AnalyzeDeliveriesResponse, *apierror.APIError)
AnalyzeManufacturing(ctx context.Context, req *AnalyzeManufacturingRequest) (*apiresource.AnalyzeManufacturingResponse, *apierror.APIError)
AnalyzeManufacturingBatch(ctx context.Context, req *AnalyzeManufacturingBatchRequest) (*apiresource.AnalyzeManufacturingBatchResponse, *apierror.APIError)
AnalyzeOrders(ctx context.Context, req *AnalyzeOrdersRequest) (*apiresource.AnalyzeOrdersResponse, *apierror.APIError)
AnalyzeQuarterlyOrders(ctx context.Context, req *AnalyzeQuarterlyOrdersRequest) (*apiresource.AnalyzeQuarterlyOrdersResponse, *apierror.APIError)
AnalyzeMaterials(ctx context.Context, req *AnalyzeMaterialsRequest) (*apiresource.AnalyzeMaterialsResponse, *apierror.APIError)
AnalyzeInventoryReceipts(ctx context.Context, req *AnalyzeInventoryReceiptsRequest) (*apiresource.AnalyzeInventoryReceiptsResponse, *apierror.APIError)
AnalyzeNewCustomers(ctx context.Context, req *AnalyzeNewCustomersRequest) (*apiresource.AnalyzeNewCustomersResponse, *apierror.APIError)
AnalyzeDemandForecast(ctx context.Context, req *AnalyzeDemandForecastRequest) (*apiresource.AnalyzeDemandForecastResponse, *apierror.APIError)
AnalyzeOee(ctx context.Context, req *AnalyzeOeeRequest) (*apiresource.AnalyzeOeeResponse, *apierror.APIError)
AnalyzeOeeTrend(ctx context.Context, req *AnalyzeOeeTrendRequest) (*apiresource.AnalyzeOeeTrendResponse, *apierror.APIError)
AnalyzeScheduleAttainment(ctx context.Context, req *AnalyzeScheduleAttainmentRequest) (*apiresource.AnalyzeScheduleAttainmentResponse, *apierror.APIError)
AnalyzeDeliveryPerformance(ctx context.Context, req *AnalyzeDeliveryPerformanceRequest) (*apiresource.AnalyzeDeliveryPerformanceResponse, *apierror.APIError)
AnalyzeWeeksOfSales(ctx context.Context, req *AnalyzeWeeksOfSalesRequest) (*apiresource.AnalyzeWeeksOfSalesResponse, *apierror.APIError)
AnalyzeCustomerPricing(ctx context.Context, req *AnalyzeCustomerPricingRequest) (*apiresource.AnalyzeCustomerPricingResponse, *apierror.APIError)
AnalyzeRealizedMargins(ctx context.Context, req *AnalyzeRealizedMarginsRequest) (*apiresource.AnalyzeRealizedMarginsResponse, *apierror.APIError)
}
func NewAnalyticsSvc ¶
func NewAnalyticsSvc(config *AnalyticsSvcConfig) AnalyticsSvc
type AnalyticsSvcConfig ¶
type AnalyticsSvcConfig struct {
// CoreClient (required) is the core-service gRPC client.
CoreClient pb.CoreServiceClient
}
type AnalyzeCustomerPricingEndpoint ¶
type AnalyzeCustomerPricingEndpoint struct{}
Flags contracted customer prices that are unusually low or unprofitable.
Two independent checks run over every account price. The first compares a price against the median price other customers pay for the same product line and attributes — the same pair the pricing engine matches on — so a price is only ever compared against prices that buy the same thing. The second computes gross margin from the cost of the products the price applies to. A price may be flagged by either or both.
Prices a customer receives through its parent account are included and marked, since they are easy to miss when auditing customer by customer. Manual price overrides entered on an individual order are not visible here: they bypass contracted pricing entirely and are only recorded on the order line.
func (*AnalyzeCustomerPricingEndpoint) Materialize ¶
func (e *AnalyzeCustomerPricingEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeCustomerPricingRequest, *apiresource.AnalyzeCustomerPricingResponse]
type AnalyzeCustomerPricingRequest ¶
type AnalyzeCustomerPricingRequest struct {
// Restrict the analysis to these customers. Omit to cover every customer with a contracted price.
//
// Peer medians are still computed across all customers, so narrowing the result does not change what a price is compared against.
CustomerIDs []string `json:"customer_ids,omitzero"`
// Restrict the analysis to customers in these customer groups.
CustomerGroupIDs []string `json:"customer_group_ids,omitzero"`
// The gross margin a price is expected to clear, as a fraction between 0 and 1.
TargetGrossMargin field.Optional[string] `json:"target_gross_margin,omitzero" format:"decimal"`
// How far below the peer median a price must sit to be flagged, as a fraction between 0 and 1.
OutlierTolerance field.Optional[string] `json:"outlier_tolerance,omitzero" format:"decimal"`
}
AnalyzeCustomerPricingRequest is the request to audit contracted customer prices.
func (*AnalyzeCustomerPricingRequest) SchemaExample ¶
func (*AnalyzeCustomerPricingRequest) SchemaExample() any
type AnalyzeDeliveriesEndpoint ¶
type AnalyzeDeliveriesEndpoint struct{}
Returns delivery performance statistics over a date range, including on-time rates, average delivery times, and time-to-first-shipment metrics.
func (*AnalyzeDeliveriesEndpoint) Materialize ¶
func (e *AnalyzeDeliveriesEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeDeliveriesRequest, *apiresource.AnalyzeDeliveriesResponse]
type AnalyzeDeliveriesRequest ¶
type AnalyzeDeliveriesRequest struct {
// The start date for the analysis period.
StartDate time.Time `json:"starts_at" validate:"required"`
// The end date for the analysis period.
EndDate time.Time `json:"ends_at" validate:"required"`
// Optional product line IDs to filter by.
ProductLineIDs []string `json:"product_line_ids,omitempty"`
// Optional customer IDs to filter by.
CustomerIDs []string `json:"customer_ids,omitempty"`
// Optional customer group IDs to filter by.
CustomerGroupIDs []string `json:"customer_group_ids,omitempty"`
// Optional sales rep IDs to filter by.
SalesRepIDs []string `json:"sales_rep_ids,omitempty"`
// Optional target delivery time in days.
TargetDeliveryTimeDays *int64 `json:"target_delivery_time_days,omitempty"`
// Whether to override promised dates with the target delivery time.
OverridePromisedDates *bool `json:"override_promised_dates,omitempty"`
}
AnalyzeDeliveriesRequest is the request to analyze delivery performance.
func (*AnalyzeDeliveriesRequest) SchemaExample ¶
func (*AnalyzeDeliveriesRequest) SchemaExample() any
type AnalyzeDeliveryPerformanceEndpoint ¶
type AnalyzeDeliveryPerformanceEndpoint struct{}
Returns how reliably promised delivery dates were met.
Orders are counted in the period their promise came due, not the period they shipped — an order promised in March and shipped in May is March's miss. On time means the first shipment left on or before the promised date, because the promise is that the order starts moving by then; judging on the last shipment would fail an order the customer received on time in two boxes. On time in full adds that the whole ordered quantity was packed.
The denominator is orders that were due, not orders that shipped, so an order past its date and still unshipped counts against the rate rather than being held back until it moves. Excluding open orders would let a plant with a growing late backlog report perfect delivery.
Only orders carrying a ship-by commitment participate. An order with no commitment cannot be late, and counting it as on time would inflate the rate with orders nobody promised anything about — `uncommitted_order_count` says how many were excluded, so the gap is visible rather than silent.
Every rate is null rather than zero when nothing was due, and average lateness is measured over late orders only.
The same window is also returned sliced by customer, customer group, product line, and the rule each ship-by date came from — each ordered worst-first, and each derived from the same set of orders as the headline so a drilldown always adds up to it. `by_product_line` is the one exception to that: an order spanning two lines is counted under both, because a late order is late for every line on it.
Every filter is empty-means-all and they combine with AND. They narrow `uncommitted_order_count` too, so the excluded count always describes the same slice of the order book the rates do.
func (*AnalyzeDeliveryPerformanceEndpoint) Materialize ¶
func (e *AnalyzeDeliveryPerformanceEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeDeliveryPerformanceRequest, *apiresource.AnalyzeDeliveryPerformanceResponse]
type AnalyzeDeliveryPerformanceRequest ¶
type AnalyzeDeliveryPerformanceRequest struct {
// The start date for the analysis period.
StartDate time.Time `json:"starts_at" validate:"required"`
// The end date for the analysis period.
EndDate time.Time `json:"ends_at" validate:"required"`
// The period to break the results down by. Defaults to `week`.
Granularity field.Optional[constants.DeliveryGranularity] `json:"granularity,omitzero"`
// Only measure orders bought by these customers. Their child accounts are included, matching how the sales analytics resolve a customer.
CustomerIDs []string `json:"customer_ids,omitempty"`
// Only measure orders whose customer sits in these groups.
CustomerGroupIDs []string `json:"customer_group_ids,omitempty"`
// Only measure orders containing at least one line in these product lines.
ProductLineIDs []string `json:"product_line_ids,omitempty"`
// Only measure orders owned by these sales reps.
SalesRepIDs []string `json:"sales_rep_ids,omitempty"`
}
AnalyzeDeliveryPerformanceRequest is the request to measure promises against shipments.
func (*AnalyzeDeliveryPerformanceRequest) SchemaExample ¶
func (*AnalyzeDeliveryPerformanceRequest) SchemaExample() any
type AnalyzeDemandForecastEndpoint ¶
type AnalyzeDemandForecastEndpoint struct{}
Returns demand forecasts for items, including historical data and projected demand with confidence bounds.
func (*AnalyzeDemandForecastEndpoint) Materialize ¶
func (e *AnalyzeDemandForecastEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeDemandForecastRequest, *apiresource.AnalyzeDemandForecastResponse]
type AnalyzeDemandForecastRequest ¶
type AnalyzeDemandForecastRequest struct {
// Optional product line IDs to filter by.
ProductLineIDs []string `json:"product_line_ids,omitempty"`
// Optional item IDs to filter by.
ItemIDs []string `json:"item_ids,omitempty"`
// Optional number of months of historical data to use.
HistoryMonths *int64 `json:"history_months,omitempty"`
// Optional number of months to forecast.
ForecastMonths *int64 `json:"forecast_months,omitempty"`
}
AnalyzeDemandForecastRequest is the request to generate a demand forecast.
func (*AnalyzeDemandForecastRequest) SchemaExample ¶
func (*AnalyzeDemandForecastRequest) SchemaExample() any
type AnalyzeInventoryReceiptsEndpoint ¶
type AnalyzeInventoryReceiptsEndpoint struct{}
Returns inventory receipt summaries including remaining quantities, costs, and values.
func (*AnalyzeInventoryReceiptsEndpoint) Materialize ¶
func (e *AnalyzeInventoryReceiptsEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeInventoryReceiptsRequest, *apiresource.AnalyzeInventoryReceiptsResponse]
type AnalyzeInventoryReceiptsRequest ¶
type AnalyzeInventoryReceiptsRequest struct {
// Optional item IDs to filter by.
ItemIDs []string `json:"item_ids,omitempty"`
// Optional location IDs to filter by.
LocationIDs []string `json:"location_ids,omitempty"`
// Optional lot IDs to filter by.
LotIDs []string `json:"lot_ids,omitempty"`
}
AnalyzeInventoryReceiptsRequest is the request to analyze inventory receipts.
func (*AnalyzeInventoryReceiptsRequest) SchemaExample ¶
func (*AnalyzeInventoryReceiptsRequest) SchemaExample() any
type AnalyzeManufacturingBatchEndpoint ¶
type AnalyzeManufacturingBatchEndpoint struct{}
Returns manufacturing metrics for a current period compared against a comparison period, including production, costs per unit, margin, quality, and labor efficiency.
func (*AnalyzeManufacturingBatchEndpoint) Materialize ¶
func (e *AnalyzeManufacturingBatchEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeManufacturingBatchRequest, *apiresource.AnalyzeManufacturingBatchResponse]
type AnalyzeManufacturingBatchRequest ¶
type AnalyzeManufacturingBatchRequest struct {
// The start date for the current analysis period.
StartDate time.Time `json:"starts_at" validate:"required"`
// The end date for the current analysis period.
EndDate time.Time `json:"ends_at" validate:"required"`
// The start date for the comparison period.
ComparisonStartDate time.Time `json:"comparison_starts_at" validate:"required"`
// The end date for the comparison period.
ComparisonEndDate time.Time `json:"comparison_ends_at" validate:"required"`
// Optional customer IDs to filter by.
CustomerIDs []string `json:"customer_ids,omitempty"`
// Optional product line IDs to filter by.
ProductLineIDs []string `json:"product_line_ids,omitempty"`
// Optional customer group IDs to filter by.
CustomerGroupIDs []string `json:"customer_group_ids,omitempty"`
// Optional item IDs to filter by.
ItemIDs []string `json:"item_ids,omitempty"`
}
AnalyzeManufacturingBatchRequest is the request to analyze manufacturing metrics with a comparison period.
func (*AnalyzeManufacturingBatchRequest) SchemaExample ¶
func (*AnalyzeManufacturingBatchRequest) SchemaExample() any
type AnalyzeManufacturingEndpoint ¶
type AnalyzeManufacturingEndpoint struct{}
Returns a single manufacturing analytics metric for a specified date range and type.
func (*AnalyzeManufacturingEndpoint) Materialize ¶
func (e *AnalyzeManufacturingEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeManufacturingRequest, *apiresource.AnalyzeManufacturingResponse]
type AnalyzeManufacturingRequest ¶
type AnalyzeManufacturingRequest struct {
// The start date for the analysis period.
StartDate time.Time `json:"starts_at" validate:"required"`
// The end date for the analysis period.
EndDate time.Time `json:"ends_at" validate:"required"`
// The type of manufacturing analytics to compute.
Type string `json:"type" validate:"required"`
}
AnalyzeManufacturingRequest is the request to analyze a single manufacturing metric.
func (*AnalyzeManufacturingRequest) SchemaExample ¶
func (*AnalyzeManufacturingRequest) SchemaExample() any
type AnalyzeMaterialsEndpoint ¶
type AnalyzeMaterialsEndpoint struct{}
Returns material inventory and demand analytics per material, including quantities, unit groups, and supplier information.
func (*AnalyzeMaterialsEndpoint) Materialize ¶
func (e *AnalyzeMaterialsEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeMaterialsRequest, *apiresource.AnalyzeMaterialsResponse]
type AnalyzeMaterialsRequest ¶
type AnalyzeMaterialsRequest struct {
// Optional sales order IDs to filter by.
SalesOrderIDs []string `json:"sales_order_ids,omitempty"`
// Optional supplier IDs to filter by.
SupplierIDs []string `json:"supplier_ids,omitempty"`
}
AnalyzeMaterialsRequest is the request to analyze material inventory and demand.
func (*AnalyzeMaterialsRequest) SchemaExample ¶
func (*AnalyzeMaterialsRequest) SchemaExample() any
type AnalyzeNewCustomersEndpoint ¶
type AnalyzeNewCustomersEndpoint struct{}
Returns time series data of new customer acquisitions over a specified date range.
func (*AnalyzeNewCustomersEndpoint) Materialize ¶
func (e *AnalyzeNewCustomersEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeNewCustomersRequest, *apiresource.AnalyzeNewCustomersResponse]
type AnalyzeNewCustomersRequest ¶
type AnalyzeNewCustomersRequest struct {
// The start date for the analysis period.
StartDate time.Time `json:"starts_at" validate:"required"`
// The end date for the analysis period.
EndDate time.Time `json:"ends_at" validate:"required"`
// Optional customer group IDs to filter by.
CustomerGroupIDs []string `json:"customer_group_ids,omitempty"`
// Optional sales rep IDs to filter by.
SalesRepIDs []string `json:"sales_rep_ids,omitempty"`
}
AnalyzeNewCustomersRequest is the request to analyze new customer acquisition.
func (*AnalyzeNewCustomersRequest) SchemaExample ¶
func (*AnalyzeNewCustomersRequest) SchemaExample() any
type AnalyzeOeeEndpoint ¶
type AnalyzeOeeEndpoint struct{}
Returns Overall Equipment Effectiveness (OEE) metrics by department.
Availability is measured from logged machine downtime rather than inferred, so it requires both `planned_time` for the department and downtime events in the period. Departments with `has_downtime_data` false have no availability measurement, and their ratios are returned as null rather than as 100%.
func (*AnalyzeOeeEndpoint) Materialize ¶
func (e *AnalyzeOeeEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeOeeRequest, *apiresource.AnalyzeOeeResponse]
type AnalyzeOeeRequest ¶
type AnalyzeOeeRequest struct {
// The start date for the analysis period.
StartDate time.Time `json:"starts_at" validate:"required"`
// The end date for the analysis period.
EndDate time.Time `json:"ends_at" validate:"required"`
// Optional department IDs to filter by.
DepartmentIDs []string `json:"department_ids,omitzero"`
// Scheduled production time per department for the period. Availability, performance and OEE are only returned for departments this covers.
PlannedTime []OeeDepartmentPlannedTime `json:"planned_time,omitzero"`
}
AnalyzeOeeRequest is the request to analyze Overall Equipment Effectiveness (OEE).
func (*AnalyzeOeeRequest) SchemaExample ¶
func (*AnalyzeOeeRequest) SchemaExample() any
type AnalyzeOeeTrendEndpoint ¶
type AnalyzeOeeTrendEndpoint struct{}
Returns Overall Equipment Effectiveness (OEE) by production week.
Each period carries the same four terms `/v1/core/analytics/oee` reports for a single window, rolled up across departments and weighted by seconds rather than averaged, so a department that ran for an hour does not weigh as heavily as one that ran all week. Weeks start on Monday, and the first and last period of a window are clipped to the window itself.
Only departments with scheduled time take part: a department with no machines has no availability, so counting its output in quality would leave the three terms describing different plants. Compare two windows by calling this twice.
func (*AnalyzeOeeTrendEndpoint) Materialize ¶
func (e *AnalyzeOeeTrendEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeOeeTrendRequest, *apiresource.AnalyzeOeeTrendResponse]
type AnalyzeOeeTrendRequest ¶
type AnalyzeOeeTrendRequest struct {
// The start date for the analysis period.
StartDate time.Time `json:"starts_at" validate:"required"`
// The end date for the analysis period.
EndDate time.Time `json:"ends_at" validate:"required"`
// Restrict the analysis to these departments.
DepartmentIDs []string `json:"department_ids,omitzero"`
}
AnalyzeOeeTrendRequest is the request to analyze Overall Equipment Effectiveness (OEE) over time.
func (*AnalyzeOeeTrendRequest) SchemaExample ¶
func (*AnalyzeOeeTrendRequest) SchemaExample() any
type AnalyzeOpenBatchesEndpoint ¶
type AnalyzeOpenBatchesEndpoint struct{}
Returns open batch summaries grouped by scanning station.
func (*AnalyzeOpenBatchesEndpoint) Materialize ¶
func (e *AnalyzeOpenBatchesEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeOpenBatchesRequest, *apiresource.AnalyzeOpenBatchesResponse]
type AnalyzeOpenBatchesRequest ¶
type AnalyzeOpenBatchesRequest struct {
// Optional item IDs to filter by.
ItemIDs []string `json:"item_ids,omitempty"`
// Optional product line IDs to filter by.
ProductLineIDs []string `json:"product_line_ids,omitempty"`
}
AnalyzeOpenBatchesRequest is the request to analyze open batches.
func (*AnalyzeOpenBatchesRequest) SchemaExample ¶
func (*AnalyzeOpenBatchesRequest) SchemaExample() any
type AnalyzeOrdersEndpoint ¶
type AnalyzeOrdersEndpoint struct{}
Returns detailed order entry records.
func (*AnalyzeOrdersEndpoint) Materialize ¶
func (e *AnalyzeOrdersEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeOrdersRequest, *apiresource.AnalyzeOrdersResponse]
type AnalyzeOrdersRequest ¶
type AnalyzeOrdersRequest struct {
// Optional product line IDs to filter by.
ProductLineIDs []string `json:"product_line_ids,omitempty"`
// Optional customer IDs to filter by.
CustomerIDs []string `json:"customer_ids,omitempty"`
// Optional sales rep IDs to filter by.
SalesRepIDs []string `json:"sales_rep_ids,omitempty"`
// Optional customer group IDs to filter by.
CustomerGroupIDs []string `json:"customer_group_ids,omitempty"`
}
AnalyzeOrdersRequest is the request to analyze order data.
func (*AnalyzeOrdersRequest) SchemaExample ¶
func (*AnalyzeOrdersRequest) SchemaExample() any
type AnalyzeProductionCostsEndpoint ¶
type AnalyzeProductionCostsEndpoint struct{}
Returns aggregated production cost breakdowns by department and category.
func (*AnalyzeProductionCostsEndpoint) Materialize ¶
func (e *AnalyzeProductionCostsEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeProductionCostsRequest, *apiresource.AnalyzeProductionCostsResponse]
type AnalyzeProductionCostsRequest ¶
type AnalyzeProductionCostsRequest struct {
// Optional start date for the analysis period.
StartDate *time.Time `json:"starts_at,omitempty"`
// Optional end date for the analysis period.
EndDate *time.Time `json:"ends_at,omitempty"`
// Optional item IDs to filter by.
ItemIDs []string `json:"item_ids,omitempty"`
// Optional product line IDs to filter by.
ProductLineIDs []string `json:"product_line_ids,omitempty"`
// Optional department IDs to filter by.
DepartmentIDs []string `json:"department_ids,omitempty"`
// Optional category IDs to filter by.
CategoryIDs []string `json:"category_ids,omitempty"`
}
AnalyzeProductionCostsRequest is the request to analyze production costs.
func (*AnalyzeProductionCostsRequest) SchemaExample ¶
func (*AnalyzeProductionCostsRequest) SchemaExample() any
type AnalyzeQuarterlyOrdersEndpoint ¶
type AnalyzeQuarterlyOrdersEndpoint struct{}
Returns yearly order totals broken down by quarter.
func (*AnalyzeQuarterlyOrdersEndpoint) Materialize ¶
func (e *AnalyzeQuarterlyOrdersEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeQuarterlyOrdersRequest, *apiresource.AnalyzeQuarterlyOrdersResponse]
type AnalyzeQuarterlyOrdersRequest ¶
type AnalyzeQuarterlyOrdersRequest struct {
// Optional sales rep IDs to filter by.
SalesRepIDs []string `json:"sales_rep_ids,omitempty"`
// Optional item IDs to filter by.
ItemIDs []string `json:"item_ids,omitempty"`
// Optional product line IDs to filter by.
ProductLineIDs []string `json:"product_line_ids,omitempty"`
// Optional customer IDs to filter by.
CustomerIDs []string `json:"customer_ids,omitempty"`
// Optional customer group IDs to filter by.
CustomerGroupIDs []string `json:"customer_group_ids,omitempty"`
}
AnalyzeQuarterlyOrdersRequest is the request to analyze quarterly order data.
func (*AnalyzeQuarterlyOrdersRequest) SchemaExample ¶
func (*AnalyzeQuarterlyOrdersRequest) SchemaExample() any
type AnalyzeRealizedMarginsEndpoint ¶
type AnalyzeRealizedMarginsEndpoint struct{}
Flags what customers were actually charged, as opposed to what they are contracted to be charged.
Invoiced lines over the window are rolled up to one row per customer and SKU, weighted by quantity, and each row is checked twice: against the median price other customers achieved on the same SKU, and against a target gross margin computed from the cost captured on the lines. Findings are ranked by money at stake rather than by percentage, so a thin margin on a large account outranks a worse percentage on a single small order.
This is the only view that sees a price typed onto an individual order. A manual line override bypasses contracted prices and volume discounts entirely, so it never appears in an audit of configured pricing.
func (*AnalyzeRealizedMarginsEndpoint) Materialize ¶
func (e *AnalyzeRealizedMarginsEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeRealizedMarginsRequest, *apiresource.AnalyzeRealizedMarginsResponse]
type AnalyzeRealizedMarginsRequest ¶
type AnalyzeRealizedMarginsRequest struct {
// Start of the invoiced window.
StartDate time.Time `json:"starts_at" validate:"required"`
// End of the invoiced window.
EndDate time.Time `json:"ends_at" validate:"required"`
// Restrict the result to these customers.
//
// Peer medians are still computed across every customer that bought the SKU, so narrowing the result does not change what a price is compared against.
CustomerIDs []string `json:"customer_ids,omitzero"`
// Restrict the result to customers in these customer groups.
CustomerGroupIDs []string `json:"customer_group_ids,omitzero"`
// Restrict the result to these product lines.
ProductLineIDs []string `json:"product_line_ids,omitzero"`
// The gross margin a sale is expected to clear, as a fraction between 0 and 1.
TargetGrossMargin field.Optional[string] `json:"target_gross_margin,omitzero" format:"decimal"`
// How far below the peer median an achieved price must sit to be flagged, as a fraction between 0 and 1.
OutlierTolerance field.Optional[string] `json:"outlier_tolerance,omitzero" format:"decimal"`
}
AnalyzeRealizedMarginsRequest is the request to audit what customers were actually charged.
func (*AnalyzeRealizedMarginsRequest) SchemaExample ¶
func (*AnalyzeRealizedMarginsRequest) SchemaExample() any
type AnalyzeSalesEndpoint ¶
type AnalyzeSalesEndpoint struct{}
Returns detailed sales entry records over a specified date range.
func (*AnalyzeSalesEndpoint) Materialize ¶
func (e *AnalyzeSalesEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeSalesRequest, *apiresource.AnalyzeSalesResponse]
type AnalyzeSalesRequest ¶
type AnalyzeSalesRequest struct {
// The start date for the analysis period.
StartDate time.Time `json:"starts_at" validate:"required"`
// The end date for the analysis period.
EndDate time.Time `json:"ends_at" validate:"required"`
// Optional product line IDs to filter by.
ProductLineIDs []string `json:"product_line_ids,omitempty"`
// Optional customer IDs to filter by.
CustomerIDs []string `json:"customer_ids,omitempty"`
// Optional sales rep IDs to filter by.
SalesRepIDs []string `json:"sales_rep_ids,omitempty"`
// Optional customer group IDs to filter by.
CustomerGroupIDs []string `json:"customer_group_ids,omitempty"`
// Optional search query.
Query *string `json:"query,omitempty"`
}
AnalyzeSalesRequest is the request to analyze sales data over a date range.
func (*AnalyzeSalesRequest) SchemaExample ¶
func (*AnalyzeSalesRequest) SchemaExample() any
type AnalyzeScheduleAttainmentEndpoint ¶
type AnalyzeScheduleAttainmentEndpoint struct{}
Returns actual production measured against the plan that was live at the time.
The baseline for each week is the schedule version published on or before that week began, so republishing mid-horizon cannot rewrite a week the floor has already worked. `baseline_schedules` names the versions used.
Two ratios are returned because either alone misleads: `attainment_pct` caps each campaign at what was asked for, so over-building one SKU cannot hide a miss on another, while `output_ratio_pct` is uncapped and is what reveals over-production. Production with no matching planned campaign is reported as `unplanned_quantity` rather than discarded — that number is the clearest signal a schedule is being worked around.
Every ratio is null rather than zero when nothing was planned, and `has_baseline` is false when nothing was ever published over the period.
func (*AnalyzeScheduleAttainmentEndpoint) Materialize ¶
func (e *AnalyzeScheduleAttainmentEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeScheduleAttainmentRequest, *apiresource.AnalyzeScheduleAttainmentResponse]
type AnalyzeScheduleAttainmentRequest ¶
type AnalyzeScheduleAttainmentRequest struct {
// The start date for the analysis period.
StartDate time.Time `json:"starts_at" validate:"required"`
// The end date for the analysis period.
EndDate time.Time `json:"ends_at" validate:"required"`
// The dimension to break the results down by. Defaults to `week`.
GroupBy field.Optional[constants.AttainmentGroupBy] `json:"group_by,omitzero"`
// Only measure production on these machines.
MachineIDs []string `json:"machine_ids,omitzero"`
// Only measure production in these departments.
DepartmentIDs []string `json:"department_ids,omitzero"`
}
AnalyzeScheduleAttainmentRequest is the request to measure production against plan.
func (*AnalyzeScheduleAttainmentRequest) SchemaExample ¶
func (*AnalyzeScheduleAttainmentRequest) SchemaExample() any
type AnalyzeWeeksOfSalesEndpoint ¶
type AnalyzeWeeksOfSalesEndpoint struct{}
Returns weeks-of-sales metrics per product line, including on-hand quantity, average weekly sales, and weeks of inventory remaining.
func (*AnalyzeWeeksOfSalesEndpoint) Materialize ¶
func (e *AnalyzeWeeksOfSalesEndpoint) Materialize() *apiendpoint.APIEndpoint[*AnalyzeWeeksOfSalesRequest, *apiresource.AnalyzeWeeksOfSalesResponse]
type AnalyzeWeeksOfSalesRequest ¶
type AnalyzeWeeksOfSalesRequest struct {
// The number of weeks to use for the sales period. Defaults to 4.
//
// A period is a divisor of demand, so zero and negative values are rejected rather than quietly substituted with the default — a caller who asked for an impossible period should be told, not handed the answer to a different question.
PeriodInWeeks *int32 `query:"period_in_weeks" validate:"omitempty,min=1,max=520"`
}
AnalyzeWeeksOfSalesRequest is the request to analyze weeks of sales.
func (*AnalyzeWeeksOfSalesRequest) SchemaExample ¶
func (*AnalyzeWeeksOfSalesRequest) SchemaExample() any
type OeeDepartmentPlannedTime ¶
type OeeDepartmentPlannedTime struct {
// The department ID.
DepartmentID string `json:"department_id" validate:"required"`
// Scheduled production hours for the period.
PlannedHours float64 `json:"planned_hours" validate:"required"`
}
OeeDepartmentPlannedTime supplies the scheduled production time for one department.
Source Files
¶
- computed_values.go
- endpoint_analyze_customer_pricing.go
- endpoint_analyze_deliveries.go
- endpoint_analyze_delivery_performance.go
- endpoint_analyze_demand_forecast.go
- endpoint_analyze_inventory_receipts.go
- endpoint_analyze_manufacturing.go
- endpoint_analyze_manufacturing_batch.go
- endpoint_analyze_materials.go
- endpoint_analyze_new_customers.go
- endpoint_analyze_oee.go
- endpoint_analyze_oee_trend.go
- endpoint_analyze_open_batches.go
- endpoint_analyze_orders.go
- endpoint_analyze_production_costs.go
- endpoint_analyze_quarterly_orders.go
- endpoint_analyze_realized_margins.go
- endpoint_analyze_sales.go
- endpoint_analyze_schedule_attainment.go
- endpoint_analyze_weeks_of_sales.go
- presenter.go
- schema_examples.go
- service.go
- service_customer_pricing.go
- service_realized_margins.go