import {FilterBuilder, SortOrder} from "abstract-query-builder" import Waybill, {WaybillPosition, WaybillPositionMark} from '../model/document/Waybill' import {WaybillType, UnitType, WaybillStatus, WaybillResolution, Version, Direction} from "../model/types" import {ProductInfoFilter, ProductInfoInnerSortOrder} from "./inner/ProductInfo" import {quantityConverter, priceConverter} from "./converters" import executor from './executor' /** * @class module:waybill.WaybillSortOrder * @classdesc Класс для сортировки элементов в результе запроса. * @property {FieldSorter} uuid UUID накладной * @property {FieldSorter} docOwner Отправитель накладной * @property {FieldSorter} identity дентификатор накладной (клиентский, к заполнению необязательный) * @property {FieldSorter} type Тип накладной * @property {FieldSorter} unitType Тип упаковки * @property {FieldSorter} number Номер документа * @property {FieldSorter} date Дата составления * @property {FieldSorter} shippingDate Дата отгрузки продукции * @property {FieldSorter} shipperId Грузоотправитель * @property {FieldSorter} consigneeId Грузополучатель * @property {FieldSorter} supplierId Поставщик * @property {FieldSorter} base Основание * @property {FieldSorter} note Заметки * @property {FieldSorter} status Текущий статус накладной * @property {FieldSorter} resolution Резолюция накладной * @property {FieldSorter} ttnInformF2RegUuid Uuid справки 2 для накладной * @property {FieldSorter} wbRegId ИД накладной в системе ЕГАИС * @property {FieldSorter} direction Направление документа в представлении УТМ (входящий/исходящий) * @property {FieldSorter} version Версия протокола ЕГАИС, по которому отправлена накладная */ export class WaybillSortOrder extends SortOrder { uuid = this.addFieldSorter("UUID"); docOwner = this.addFieldSorter("OWNER"); identity = this.addFieldSorter("IDENTITY"); type = this.addFieldSorter("TYPE"); unitType = this.addFieldSorter("UNIT_TYPE"); number = this.addFieldSorter("NUMBER"); date = this.addFieldSorter("DATE"); shippingDate = this.addFieldSorter("SHIPPING_DATE"); shipperId = this.addFieldSorter("SHIPPER_ID"); consigneeId = this.addFieldSorter("CONSIGNEE_ID"); supplierId = this.addFieldSorter("SUPPLIER_ID"); base = this.addFieldSorter("BASE"); note = this.addFieldSorter("NOTE"); status = this.addFieldSorter("STATUS"); resolution = this.addFieldSorter("RESOLUTION"); ttnInformF2RegUuid = this.addFieldSorter("TTN_INFORM_F2_REG_UUID"); wbRegId = this.addFieldSorter("WB_REG_ID"); direction = this.addFieldSorter("DIRECTION"); version = this.addFieldSorter("VERSION"); constructor() { super(() => this); } } /** * @class module:waybill.WaybillQuery * @classdesc Класс для формирования запроса на получение товарно-транспортных накладных. * @property {FieldFilter} uuid UUID накладной * @property {FieldFilter} docOwner Отправитель накладной * @property {FieldFilter} identity дентификатор накладной (клиентский, к заполнению необязательный) * @property {FieldFilter} type Тип накладной * @property {FieldFilter} unitType Тип упаковки * @property {FieldFilter} number Номер документа * @property {FieldFilter} date Дата составления * @property {FieldFilter} shippingDate Дата отгрузки продукции * @property {FieldFilter} shipperId Грузоотправитель * @property {FieldFilter} consigneeId Грузополучатель * @property {FieldFilter} supplierId Поставщик * @property {FieldFilter} base Основание * @property {FieldFilter} note Заметки * @property {FieldFilter} status Текущий статус накладной * @property {FieldFilter} resolution Резолюция накладной * @property {FieldFilter} ttnInformF2RegUuid Uuid справки 2 для накладной * @property {FieldFilter} wbRegId ИД накладной в системе ЕГАИС * @property {FieldFilter} direction Направление документа в представлении УТМ (входящий/исходящий) * @property {FieldFilter} version Версия протокола ЕГАИС, по которому отправлена накладная */ export default class WaybillQuery extends FilterBuilder { uuid = this.addFieldFilter("UUID"); docOwner = this.addFieldFilter("OWNER"); identity = this.addFieldFilter<(string | null)>("IDENTITY"); type = this.addFieldFilter("TYPE"); unitType = this.addFieldFilter("UNIT_TYPE"); number = this.addFieldFilter("NUMBER"); date = this.addFieldFilter("DATE"); shippingDate = this.addFieldFilter("SHIPPING_DATE"); shipperId = this.addFieldFilter("SHIPPER_ID"); consigneeId = this.addFieldFilter("CONSIGNEE_ID"); supplierId = this.addFieldFilter<(string | null)>("SUPPLIER_ID"); base = this.addFieldFilter<(string | null)>("BASE"); note = this.addFieldFilter<(string | null)>("NOTE"); status = this.addFieldFilter("STATUS"); resolution = this.addFieldFilter("RESOLUTION"); ttnInformF2RegUuid = this.addFieldFilter<(string | null)>("TTN_INFORM_F2_REG_UUID"); wbRegId = this.addFieldFilter<(string | null)>("WB_REG_ID"); direction = this.addFieldFilter("DIRECTION"); version = this.addFieldFilter("VERSION"); constructor() { super(() => this, executor('WayBill', Waybill.prototype)); } } /** * @class module:waybill.WaybillPositionSortOrder * @classdesc Класс для сортировки элементов в результе запроса. * @property {FieldSorter} uuid UUID позиции накладной * @property {FieldSorter} waybillUuid UUID накладной * @property {FieldSorter} productIdentity Идентификатор внутри файла * @property {module:productInfo.ProductInfoInnerSortOrder} productInfo Информация о продукции * @property {FieldSorter} packId Идентификатор упаковки * @property {FieldSorter} quantity Количество * @property {FieldSorter} price Цена за единицу товара * @property {FieldSorter} party Номер партии * @property {FieldSorter} identity Идентификатор позиции внутри накладной * @property {FieldSorter} informF1RegId Справка 1. Не может быть null * @property {FieldSorter} informF2RegId Регистрационный номер раздела справки 2, по которому продукция была получена отправителем */ export class WaybillPositionSortOrder extends SortOrder { uuid = this.addFieldSorter("UUID"); waybillUuid = this.addFieldSorter("WAY_BILL_UUID"); productIdentity = this.addFieldSorter("PRODUCT_INFO_IDENTITY"); productInfo = this.addInnerSortOrder(new ProductInfoInnerSortOrder()); packId = this.addFieldSorter("PACK_ID"); quantity = this.addFieldSorter("QUANTITY"); price = this.addFieldSorter("PRICE"); party = this.addFieldSorter("PARTY"); identity = this.addFieldSorter("IDENTITY"); informF1RegId = this.addFieldSorter("INFORM_F1_REG_ID"); informF2RegId = this.addFieldSorter("INFORM_F2_REG_ID"); constructor() { super(() => this); } } /** * @class module:waybill.WaybillPositionQuery * @classdesc Класс для формирования запроса на получение позиций ТТН. * @property {FieldFilter} uuid UUID позиции накладной * @property {FieldFilter} waybillUuid UUID накладной * @property {FieldFilter} productIdentity Идентификатор внутри файла * @property {module:productInfo.ProductInfoFilter} productInfo Информация о продукции * @property {FieldFilter} packId Идентификатор упаковки * @property {FieldFilter} quantity Количество * @property {FieldFilter} price Цена за единицу товара * @property {FieldFilter} party Номер партии * @property {FieldFilter} identity Идентификатор позиции внутри накладной * @property {FieldFilter} informF1RegId Справка 1. Не может быть null * @property {FieldFilter} informF2RegId Регистрационный номер раздела справки 2, по которому продукция была получена отправителем */ export class WaybillPositionQuery extends FilterBuilder { uuid = this.addFieldFilter("UUID"); waybillUuid = this.addFieldFilter("WAY_BILL_UUID"); productIdentity = this.addFieldFilter<(string | null)>("PRODUCT_INFO_IDENTITY"); productInfo = this.addInnerFilterBuilder(new ProductInfoFilter()); packId = this.addFieldFilter<(string | null)>("PACK_ID"); quantity = this.addFieldFilter("QUANTITY", quantityConverter); price = this.addFieldFilter("PRICE", priceConverter); party = this.addFieldFilter<(string | null)>("PARTY"); identity = this.addFieldFilter<(string | null)>("IDENTITY"); informF1RegId = this.addFieldFilter<(string | null)>("INFORM_F1_REG_ID"); informF2RegId = this.addFieldFilter<(string | null)>("INFORM_F2_REG_ID"); constructor() { super(() => this, executor('WayBillPosition', WaybillPosition.prototype)); } } /** * @class module:waybill.WaybillPositionMarkSortOrder * @classdesc Класс для сортировки элементов в результе запроса. * @property {FieldSorter} waybillPositionUuid Уникальный идентификатор позиции в ТТН * @property {FieldSorter} boxNumber Номер короба * @property {FieldSorter} mark Марка */ export class WaybillPositionMarkSortOrder extends SortOrder { waybillPositionUuid = this.addFieldSorter("WAY_BILL_POSITION_UUID"); boxNumber = this.addFieldSorter("BOX_NUMBER"); mark = this.addFieldSorter("MARK"); constructor() { super(() => this); } } /** * @class module:waybill.WaybillPositionMarkQuery * @classdesc Класс для формирования запроса на получение марок позиций ТТН. * @property {FieldFilter} waybillPositionUuid Уникальный идентификатор позиции в ТТН * @property {FieldFilter} boxNumber Номер короба * @property {FieldFilter} mark Марка */ export class WaybillPositionMarkQuery extends FilterBuilder { waybillPositionUuid = this.addFieldFilter<(string | null)>("WAY_BILL_POSITION_UUID"); boxNumber = this.addFieldFilter<(string | null)>("BOX_NUMBER"); mark = this.addFieldFilter("MARK"); constructor() { super(() => this, executor('WayBillPositionMark', WaybillPositionMark.prototype)); } }