from sipro.api.client import get_client client = get_client() router = '/orders' def get_orders_by_product_id(supplier_product_id: str) -> list[dict]: method = f'{router}/getByProductId?productId={supplier_product_id}' response = client.method('GET', method) return response def get_order_by_id(order_id) -> dict: method = f'{router}/getOrderById?orderId={order_id}' response = client.method('GET', method) return response def ship_order(order_id: int) -> dict: method = f'{router}/shipOrder' data = {'orderId': order_id} response = client.method('POST', method, data=data) return response def close_order(order_id: int) -> dict: method = f'{router}/closeOrder' data = {'orderId': order_id} response = client.method('POST', method, data=data) return response def get_orders(order_by: str, desc: int, page: int, shipment_date: str, status: str, shipment_warehouse_id: int): method = f'{router}/getOrders?orderBy={order_by}&desc={desc}&page={page}&shipmentDate={shipment_date}&status={status}&shipmentWarehouseId={shipment_warehouse_id}' response = client.method('GET', method) return response def get_orders_from_barcode(params: dict): method = f'{router}/getByProductId' response = client.method('GET', method, params=params) return response def need_crpt(order_product_id): method = f'{router}/needCrpt?orderProductId={order_product_id}' response = client.method('GET', method) return response def attach_crpt(order_product_id, crpt): method = f'{router}/attachCrpt' data = {'orderProductId': order_product_id, 'crpt': crpt} response = client.method('POST', method, data=data) return response def need_crpt_by_order_id(order_id): method = f'{router}/needCrptByOrder?orderId={order_id}' response = client.method('GET', method) return response def cancel_order_assembly(order_id): method = f'{router}/cancelOrderAssembly' data = {'orderId': order_id} response = client.method('POST', method, data=data) return response