"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getExpressPrintInfo = exports.getMpShipState = void 0; const types_1 = require("oak-domain/lib/types"); const ship_1 = require("../utils/ship"); const shipClazz_1 = require("../utils/shipClazz"); /** * 获取小程序订单发货状态 * @param params * @param context */ async function getMpShipState(params, context) { const application = context.getApplication(); const { type, } = application; if (type === 'wechatMp') { const { shipId } = params; const shipState = await (0, ship_1.getOrderShipState)(context, shipId); return shipState; } } exports.getMpShipState = getMpShipState; /** * 获取打印面单 */ async function getExpressPrintInfo(params, context) { const { shipId } = params; const [ship] = await context.select('ship', { data: { id: 1, type: 1, entity: 1, entityId: 1, extraShipId: 1, }, filter: { id: shipId, } }, { forUpdate: true }); const { type, entity, entityId, extraShipId } = ship; if (!entity || !entityId || !extraShipId || type !== 'express') { throw new types_1.OakPreConditionUnsetException("error::ship.noClazz", "ship", undefined, "oak-pay-business"); } const clazz = await (0, shipClazz_1.getShipClazz)(entity, entityId, context); return await clazz.getPrintInfo(shipId, context); } exports.getExpressPrintInfo = getExpressPrintInfo;