sanmar_sdk.ftp.orders ===================== .. py:module:: sanmar_sdk.ftp.orders .. autoapi-nested-parse:: 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: - ``CustInfo.txt`` ships each purchase order somewhere, - ``Details.txt`` lists what each purchase order is for, by inventory key and size index only, and - ``Release.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 ---------- .. autoapisummary:: sanmar_sdk.ftp.orders.LINE_ENDING sanmar_sdk.ftp.orders.MAX_INVENTORY_KEY sanmar_sdk.ftp.orders.HOLDING_COLUMNS sanmar_sdk.ftp.orders.SHIPMENT_STATUS_COLUMNS Classes ------- .. autoapisummary:: sanmar_sdk.ftp.orders.OrderFiles sanmar_sdk.ftp.orders.HoldingLine sanmar_sdk.ftp.orders.ShipmentStatus Functions --------- .. autoapisummary:: sanmar_sdk.ftp.orders.render_order_files sanmar_sdk.ftp.orders.render_release_file sanmar_sdk.ftp.orders.read_holding sanmar_sdk.ftp.orders.read_shipment_status Module Contents --------------- .. py:data:: LINE_ENDING :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ """ .. raw:: html
.. py:data:: MAX_INVENTORY_KEY :value: 999999 The order files allow six digits for an inventory key. .. py:data:: HOLDING_COLUMNS :value: ('ponum', 'style', 'color', 'size', 'qty', 'whse_no', 'availability') 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. .. py:data:: SHIPMENT_STATUS_COLUMNS :value: ('customer_po', 'salesorder#', 'ship_from', 'ship_date', 'ship_to_name', 'attention',... The daily shipment status file, per the FTP Integration Guide v23.6. .. py:class:: OrderFiles The two files that place a batch of orders: names and contents. .. py:attribute:: cust_info_name :type: str .. py:attribute:: cust_info :type: str .. py:attribute:: details_name :type: str .. py:attribute:: details :type: str .. py:function:: render_order_files(batch: str, orders: collections.abc.Sequence[sanmar_sdk.orders.PurchaseOrder]) -> OrderFiles Build the ``CustInfo.txt`` and ``Details.txt`` files for a batch of orders. :param 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``. :param orders: The purchase orders in the batch. Items must be named by :class:`~sanmar_sdk.common.SkuKey`, and each order needs a ship-to email. .. py:function:: render_release_file(batch: str, po_numbers: collections.abc.Sequence[str], release_number: int = 1) -> tuple[str, str] 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 :class:`~sanmar_sdk.orders.PurchaseOrder` checks its own. .. py:class:: HoldingLine(/, **data: Any) Bases: :py:obj:`sanmar_sdk.base.Record` One line of SanMar's acknowledgement of an SFTP order. .. py:attribute:: po_number :type: str :value: None .. py:attribute:: style :type: str .. py:attribute:: catalog_color :type: str :value: None .. py:attribute:: size :type: str .. py:attribute:: quantity :type: int :value: None .. py:attribute:: warehouse :type: sanmar_sdk.common.WarehouseNumber :value: None The warehouse SanMar will ship this line from. .. py:attribute:: available :type: bool :value: None Whether the stock is there. If not, SanMar's customer service calls about it. .. py:class:: ShipmentStatus(/, **data: Any) Bases: :py:obj:`sanmar_sdk.base.Record` One line of one box in SanMar's daily shipment status file. .. py:attribute:: po_number :type: str :value: None .. py:attribute:: sales_order_number :type: str :value: None .. py:attribute:: ship_date :type: sanmar_sdk.base.SanMarDate .. py:attribute:: style :type: str .. py:attribute:: catalog_color :type: str :value: None .. py:attribute:: size :type: str .. py:attribute:: quantity :type: int :value: None .. py:attribute:: ship_from :type: str | None :value: None .. py:attribute:: ship_to_name :type: str | None :value: None .. py:attribute:: attention :type: str | None :value: None .. py:attribute:: ship_to_address1 :type: str | None :value: None .. py:attribute:: ship_to_address2 :type: str | None :value: None .. py:attribute:: ship_to_city :type: str | None :value: None .. py:attribute:: ship_to_state :type: str | None :value: None .. py:attribute:: ship_to_zip :type: str | None :value: None .. py:attribute:: ship_to_country :type: str | None :value: None .. py:attribute:: sub_total :type: sanmar_sdk.base.Price :value: None .. py:attribute:: freight :type: sanmar_sdk.base.Price :value: None .. py:attribute:: handling_fee :type: sanmar_sdk.base.Price :value: None .. py:attribute:: invoice_total :type: sanmar_sdk.base.Price :value: None .. py:attribute:: tracking_number :type: str | None :value: None .. py:attribute:: total_cases :type: int | None :value: None .. py:attribute:: box_number :type: int | None :value: None .. py:attribute:: description :type: str | None :value: None .. py:attribute:: inventory_key :type: int | None :value: None .. py:attribute:: size_index :type: int | None :value: None .. py:attribute:: invoice_attention :type: str | None :value: None .. py:attribute:: license_plate :type: str | None :value: None The license plate number on the box's label, for the packing slip service. .. py:function:: read_holding(source: sanmar_sdk.ftp.readers.Source, *, encoding: str = 'utf-8-sig') -> collections.abc.Iterator[HoldingLine] Stream a Holding file, one order line at a time. .. py:function:: read_shipment_status(source: sanmar_sdk.ftp.readers.Source, *, encoding: str = 'utf-8-sig') -> collections.abc.Iterator[ShipmentStatus] Stream a daily shipment status file, one line of one box at a time.