From 0a98976bc0219e867c6eb2c876329ac2b2cdc043 Mon Sep 17 00:00:00 2001 From: Cory Kleinjan Date: Mon, 5 Aug 2024 15:27:27 +0000 Subject: [PATCH] Updating PrimeEstimatedWeight to equal NTSRecordedWeight for NTS-release shipments --- pkg/handlers/ghcapi/mto_shipment.go | 11 +++++++++++ pkg/services/mto_shipment/shipment_billable_weight.go | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/handlers/ghcapi/mto_shipment.go b/pkg/handlers/ghcapi/mto_shipment.go index 4d70929c752..d6b7e2d478d 100644 --- a/pkg/handlers/ghcapi/mto_shipment.go +++ b/pkg/handlers/ghcapi/mto_shipment.go @@ -187,6 +187,11 @@ func (h CreateMTOShipmentHandler) Handle(params mtoshipmentops.CreateMTOShipment mtoShipment := payloads.MTOShipmentModelFromCreate(payload) + if mtoShipment.ShipmentType == models.MTOShipmentTypeHHGOutOfNTSDom && mtoShipment.NTSRecordedWeight != nil { + previouslyRecordedWeight := *mtoShipment.NTSRecordedWeight + mtoShipment.PrimeEstimatedWeight = &previouslyRecordedWeight + } + var err error mtoShipment, err = h.shipmentCreator.CreateShipment(appCtx, mtoShipment) @@ -310,6 +315,12 @@ func (h UpdateShipmentHandler) Handle(params mtoshipmentops.UpdateMTOShipmentPar ), err } } + + if mtoShipment.ShipmentType == models.MTOShipmentTypeHHGOutOfNTSDom && mtoShipment.NTSRecordedWeight != nil { + previouslyRecordedWeight := *mtoShipment.NTSRecordedWeight + mtoShipment.PrimeEstimatedWeight = &previouslyRecordedWeight + } + updatedMtoShipment, err := h.ShipmentUpdater.UpdateShipment(appCtx, mtoShipment, params.IfMatch, "ghc") if err != nil { return handleError(err) diff --git a/pkg/services/mto_shipment/shipment_billable_weight.go b/pkg/services/mto_shipment/shipment_billable_weight.go index 4466ab38cc4..1b6046ed967 100644 --- a/pkg/services/mto_shipment/shipment_billable_weight.go +++ b/pkg/services/mto_shipment/shipment_billable_weight.go @@ -65,7 +65,7 @@ func (f *shipmentBillableWeightCalculator) CalculateShipmentBillableWeight(shipm if shipment.ShipmentType == models.MTOShipmentTypeHHGOutOfNTSDom && shipment.NTSRecordedWeight != nil { adjustedRecordedWeight := unit.Pound(shipment.NTSRecordedWeight.Float64() * float64(1.1)) if adjustedRecordedWeight < *shipment.PrimeActualWeight { - calculatedWeight = shipment.NTSRecordedWeight + calculatedWeight = &adjustedRecordedWeight } } }