A new check that fires automatically when a Sales Order or Purchase Order has freight relevance. Reads the standard NS body fields bodyFields.shipmethod, bodyFields.shipcarrier, bodyFields.shippingcost, bodyFields.shipdate, bodyFields.shipaddress, plus per-line lineFields.shippingcost. Classifies into one of six freight types (LTL / FTL / parcel / dropship vendor freight / customer pickup / freight collect), assesses special handling (refrigerated / frozen / hazmat / oversize), estimates cost from prior freight_lane_history, and routes the record onto the dedicated logistics review queue. The freight status is written to the D1-side freight_status_mirror table keyed by (source_record_type, source_record_id). Custom NS body fields custbody_freight_status and custbody_freight_classification are TBD pending Mike's review.
shipmethod IS NOT NULL OR shipcarrier IS NOT NULL OR shippingcost > 0 OR any line_shippingcost > 0shipmethod = "Customer Pickup" → log + flag, skip carrier-select downstreamfreight_lane_history WHERE origin_zip = ? AND destination_zip = ?items.refrigerated · frozen · hazmat · oversizefreight_terms · preferred_carrierfreight_status_mirror.customer_po_number = SO.otherrefnum OR PO.memoestimated_cost · fallback flag for manual quoteproposed_actions, draft a notify email to logistics, write freight_status.proposed_actions (action_type='freight_logistics_review', status='pending')hitl_email_draft (template=logistics_review_inbound) — HITL approve before sendfreight_status_mirror.freight_status = 'pending_logistics_review'custbody_freight_status + custbody_freight_classification pending Mike reviewlogistics_review_workflow (risk 2)freight.routed_to_logistics (source_record_type, source_record_id, classification)| kind | name | purpose |
|---|---|---|
| D1 table | transactions | SO + PO source records · reads shipmethod, shipcarrier, shippingcost, shipdate, shipaddress, otherrefnum, memo |
| D1 table | transaction_lines | per-line shippingcost, items + qty for special handling lookup |
| D1 table | items | refrigerated / frozen / hazmat / oversize flags |
| D1 table | customers · vendors | freight_terms, preferred_carrier, billing/shipping addresses |
| D1 table | freight_status_mirror | NEW (migration 134) — freight_status keyed by (source_record_type, source_record_id) |
| D1 table | freight_lane_history | NEW (migration 134) — prior carrier + cost + on-time per origin→dest zip pair |
| D1 table | proposed_actions | HITL queue — action_type='freight_logistics_review' |
| D1 table | events | freight.routed_to_logistics + workflow.completed |
| Workflow contract | freight_routing_check | this check · risk 2 · contract_version 2 |
| Workflow contract | logistics_review_workflow | downstream · risk 2 · contract_version 2 |
| NS field (read) | bodyFields.shipmethod · shipcarrier · shippingcost · shipdate · shipaddress · otherrefnum · memo | standard NS freight fields on SO + PO |
| NS field (read) | lineFields.shippingcost | per-line freight when line-allocated |
| NS field (write, TBD) | custbody_freight_status · custbody_freight_classification | pending Mike review — expected names |
custbody_freight_status + custbody_freight_classification not yet confirmed in NS. Until then, freight status lives in D1 only. Mike review pending.estimate_freight_cost falls back to lane history + manual quote. Direct API integration (R+L Carriers, FedEx Freight, UPS, XPO) is a STUB.logistics@globalfoodsolutions.co expected but not yet provisioned. Confirm with Mike.transaction_lines.weight and line cube fields may or may not be populated — classification falls back to ship method if these are NULL. Audit pending.