Полноценно редактируются черновики

Добавляются фасовки как в черновике, так и в обучении
Исправил внешний вид
This commit is contained in:
2025-12-17 22:00:21 +03:00
parent e2df2350f7
commit c8aab42e8e
24 changed files with 1313 additions and 433 deletions

View File

@@ -74,6 +74,66 @@ type AssemblyItemDTO struct {
AmountOut float64 `json:"amountOut"`
}
// ProductFullDTO используется для получения (list?ids=...) и обновления (update) товара целиком.
type ProductFullDTO struct {
ID string `json:"id"`
Deleted bool `json:"deleted"`
Name string `json:"name"`
Description string `json:"description"`
Num string `json:"num"`
Code string `json:"code"`
Parent *string `json:"parent"` // null или UUID
Modifiers []interface{} `json:"modifiers"` // Оставляем interface{}, чтобы не мапить сложную структуру, если не меняем её
TaxCategory *string `json:"taxCategory"`
Category *string `json:"category"`
AccountingCategory *string `json:"accountingCategory"`
Color map[string]int `json:"color"`
FontColor map[string]int `json:"fontColor"`
FrontImageID *string `json:"frontImageId"`
Position *int `json:"position"`
ModifierSchemaID *string `json:"modifierSchemaId"`
MainUnit string `json:"mainUnit"` // Обязательное поле
ExcludedSections []string `json:"excludedSections"` // Set<UUID>
DefaultSalePrice float64 `json:"defaultSalePrice"`
PlaceType *string `json:"placeType"`
DefaultIncInMenu bool `json:"defaultIncludedInMenu"`
Type string `json:"type"` // GOODS, DISH...
UnitWeight float64 `json:"unitWeight"`
UnitCapacity float64 `json:"unitCapacity"`
StoreBalanceLevels []StoreBalanceLevel `json:"storeBalanceLevels"`
UseBalanceForSell bool `json:"useBalanceForSell"`
Containers []ContainerFullDTO `json:"containers"`
ProductScaleID *string `json:"productScaleId"`
Barcodes []interface{} `json:"barcodes"`
ColdLossPercent float64 `json:"coldLossPercent"`
HotLossPercent float64 `json:"hotLossPercent"`
OuterCode *string `json:"outerEconomicActivityNomenclatureCode"`
AllergenGroups *string `json:"allergenGroups"`
EstPurchasePrice float64 `json:"estimatedPurchasePrice"`
CanSetOpenPrice bool `json:"canSetOpenPrice"`
NotInStoreMovement bool `json:"notInStoreMovement"`
}
type StoreBalanceLevel struct {
StoreID string `json:"storeId"`
MinBalanceLevel *float64 `json:"minBalanceLevel"`
MaxBalanceLevel *float64 `json:"maxBalanceLevel"`
}
type ContainerFullDTO struct {
ID *string `json:"id,omitempty"` // При создании новой фасовки ID пустой/null
Num string `json:"num"` // Порядковый номер? Обычно строка.
Name string `json:"name"`
Count float64 `json:"count"`
MinContainerWeight float64 `json:"minContainerWeight"`
MaxContainerWeight float64 `json:"maxContainerWeight"`
ContainerWeight float64 `json:"containerWeight"`
FullContainerWeight float64 `json:"fullContainerWeight"`
BackwardRecalculation bool `json:"backwardRecalculation"`
Deleted bool `json:"deleted"`
UseInFront bool `json:"useInFront"`
}
// --- XML DTOs (Legacy API) ---
type IncomingInvoiceListXML struct {
@@ -149,15 +209,14 @@ type IncomingInvoiceImportXML struct {
}
type IncomingInvoiceImportItemXML struct {
ProductID string `xml:"product"` // GUID товара
Amount float64 `xml:"amount"` // Кол-во в базовых единицах
Price float64 `xml:"price"` // Цена за единицу
Sum float64 `xml:"sum,omitempty"`
Store string `xml:"store"` // GUID склада
// Поля ниже можно опустить, если iiko должна сама подтянуть их из карточки товара
// или если мы работаем в базовых единицах.
AmountUnit string `xml:"amountUnit,omitempty"` // GUID единицы измерения
Num int `xml:"num,omitempty"` // Номер строки
ProductID string `xml:"product"` // GUID товара
Amount float64 `xml:"amount"` // Кол-во (в фасовках, если указан containerId)
Price float64 `xml:"price"` // Цена за единицу (за фасовку, если указан containerId)
Sum float64 `xml:"sum,omitempty"` // Сумма
Store string `xml:"store"` // GUID склада
ContainerId string `xml:"containerId,omitempty"` // ID фасовки
AmountUnit string `xml:"amountUnit,omitempty"` // GUID единицы измерения (можно опустить, если фасовка)
Num int `xml:"num,omitempty"`
}
// DocumentValidationResult описывает ответ сервера при импорте
@@ -170,3 +229,17 @@ type DocumentValidationResult struct {
ErrorMessage string `xml:"errorMessage"`
AdditionalInfo string `xml:"additionalInfo"`
}
// --- Вспомогательные DTO для ответов (REST) ---
// UpdateEntityResponse - ответ на /save или /update
type UpdateEntityResponse struct {
Result string `json:"result"` // "SUCCESS" or "ERROR"
Response *ProductFullDTO `json:"response"`
Errors []ErrorDTO `json:"errors"`
}
type ErrorDTO struct {
Code string `json:"code"`
Value string `json:"value"`
}