sanmar_sdk.ftp.orders

Ordering through order files on SanMar’s SFTP server, and the files SanMar writes back.

An SFTP order is three comma-delimited ASCII files that share a batch name:

  • <batch>CustInfo.txt ships each purchase order somewhere,

  • <batch>Details.txt lists what each purchase order is for, by inventory key and size index only, and

  • <batch>Release<n>.txt releases some or all of the batch’s purchase orders for processing, any time up to two weeks after the other two were uploaded.

Within about 15 minutes SanMar acknowledges an uploaded batch with a Holding file that says, line by line, which warehouse will ship it and whether the stock is there. Orders shipped each day are listed in a tab-delimited daily status file, where SanMar has set one up.

SFTP orders go straight to SanMar’s production system; there is no test environment.

Attributes

LINE_ENDING

MAX_INVENTORY_KEY

The order files allow six digits for an inventory key.

HOLDING_COLUMNS

A Holding file, per the example in the Purchase Order Integration Guide v24.5.

SHIPMENT_STATUS_COLUMNS

The daily shipment status file, per the FTP Integration Guide v23.6.

Classes

OrderFiles

The two files that place a batch of orders: names and contents.

HoldingLine

One line of SanMar's acknowledgement of an SFTP order.

ShipmentStatus

One line of one box in SanMar's daily shipment status file.

Functions

render_order_files(→ OrderFiles)

Build the CustInfo.txt and Details.txt files for a batch of orders.

render_release_file(→ tuple[str, str])

Build the file that releases some or all of a batch's orders, as (name, contents).

read_holding(→ collections.abc.Iterator[HoldingLine])

Stream a Holding file, one order line at a time.

read_shipment_status(...)

Stream a daily shipment status file, one line of one box at a time.

Module Contents

sanmar_sdk.ftp.orders.LINE_ENDING = Multiline-String[source]
Show Value
"""
"""
sanmar_sdk.ftp.orders.MAX_INVENTORY_KEY = 999999[source]

The order files allow six digits for an inventory key.

sanmar_sdk.ftp.orders.HOLDING_COLUMNS = ('ponum', 'style', 'color', 'size', 'qty', 'whse_no', 'availability')[source]

A Holding file, per the example in the Purchase Order Integration Guide v24.5.

The guide’s field table omits the size its example includes.

sanmar_sdk.ftp.orders.SHIPMENT_STATUS_COLUMNS = ('customer_po', 'salesorder#', 'ship_from', 'ship_date', 'ship_to_name', 'attention',...[source]

The daily shipment status file, per the FTP Integration Guide v23.6.

class sanmar_sdk.ftp.orders.OrderFiles[source]

The two files that place a batch of orders: names and contents.

cust_info_name: str[source]
cust_info: str[source]
details_name: str[source]
details: str[source]
sanmar_sdk.ftp.orders.render_order_files(batch: str, orders: collections.abc.Sequence[sanmar_sdk.orders.PurchaseOrder]) → OrderFiles[source]

Build the CustInfo.txt and Details.txt files for a batch of orders.

Parameters:
  • batch – The batch name, unique for every batch ever sent. SanMar suggests the date and a running number for the day, such as 06-07-2022-1.

  • orders – The purchase orders in the batch. Items must be named by SkuKey, and each order needs a ship-to email.

sanmar_sdk.ftp.orders.render_release_file(batch: str, po_numbers: collections.abc.Sequence[str], release_number: int = 1) → tuple[str, str][source]

Build the file that releases some or all of a batch’s orders, as (name, contents).

Each release of a batch gets the next release_number, starting at 1. PO numbers are checked as a PurchaseOrder checks its own.

class sanmar_sdk.ftp.orders.HoldingLine(/, **data: Any)[source]

Bases: sanmar_sdk.base.Record

One line of SanMar’s acknowledgement of an SFTP order.

po_number: str = None[source]
style: str[source]
catalog_color: str = None[source]
size: str[source]
quantity: int = None[source]
warehouse: sanmar_sdk.common.WarehouseNumber = None[source]

The warehouse SanMar will ship this line from.

available: bool = None[source]

Whether the stock is there. If not, SanMar’s customer service calls about it.

class sanmar_sdk.ftp.orders.ShipmentStatus(/, **data: Any)[source]

Bases: sanmar_sdk.base.Record

One line of one box in SanMar’s daily shipment status file.

po_number: str = None[source]
sales_order_number: str = None[source]
ship_date: sanmar_sdk.base.SanMarDate[source]
style: str[source]
catalog_color: str = None[source]
size: str[source]
quantity: int = None[source]
ship_from: str | None = None[source]
ship_to_name: str | None = None[source]
attention: str | None = None[source]
ship_to_address1: str | None = None[source]
ship_to_address2: str | None = None[source]
ship_to_city: str | None = None[source]
ship_to_state: str | None = None[source]
ship_to_zip: str | None = None[source]
ship_to_country: str | None = None[source]
sub_total: sanmar_sdk.base.Price = None[source]
freight: sanmar_sdk.base.Price = None[source]
handling_fee: sanmar_sdk.base.Price = None[source]
invoice_total: sanmar_sdk.base.Price = None[source]
tracking_number: str | None = None[source]
total_cases: int | None = None[source]
box_number: int | None = None[source]
description: str | None = None[source]
inventory_key: int | None = None[source]
size_index: int | None = None[source]
invoice_attention: str | None = None[source]
license_plate: str | None = None[source]

The license plate number on the box’s label, for the packing slip service.

sanmar_sdk.ftp.orders.read_holding(source: sanmar_sdk.ftp.readers.Source, *, encoding: str = 'utf-8-sig') → collections.abc.Iterator[HoldingLine][source]

Stream a Holding file, one order line at a time.

sanmar_sdk.ftp.orders.read_shipment_status(source: sanmar_sdk.ftp.readers.Source, *, encoding: str = 'utf-8-sig') → collections.abc.Iterator[ShipmentStatus][source]

Stream a daily shipment status file, one line of one box at a time.