Имя: Пароль:
1C
1С v8
Фабрика XDTO теряет значения во время записи
0 SiMBa_R38
 
07.03.24
09:17
Столкнулся с проблемой корни которой для меня загадка.
Есть XSD который был загружен в расширение и в отладчике прекрасно разворачивается, все данные вставляются корректно, поля верифицируются тоже. Но при записи, половина того что выгружается теряется.
xs:schema
<xs:schema xmlns:tns="http://www.crystals.ru xmlns:xs="http://www.w3.org/2001/XMLSchema targetNamespace="http://www.crystals.ru attributeFormDefault="unqualified" elementFormDefault="unqualified">
    <xs:complexType name="bar-codeType">
        <xs:sequence>
            <xs:element name="name" type="xs:string" minOccurs="0"/>
            <xs:element name="price-entry" type="tns:priceType" minOccurs="0"/>
            <xs:element name="count" minOccurs="0">
                <xs:simpleType>
                    <xs:restriction base="xs:decimal">
                        <xs:minInclusive value="0.0"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="default-code" type="xs:boolean" minOccurs="0"/>
            <xs:element name="discount-forbidden" type="xs:boolean" minOccurs="0"/>
            <xs:element name="plugin-property" type="tns:plugin-propertyType" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="shop-indices" minOccurs="0">
                <xs:simpleType>
                    <xs:list itemType="xs:positiveInteger"/>
                </xs:simpleType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="code" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="255"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="marked" type="xs:boolean"/>
        <xs:attribute name="do-not-send-to-scales">
            <xs:simpleType>
                <xs:restriction base="xs:boolean"/>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="deleted" type="xs:boolean"/>
        <xs:attribute name="barcode-type" type="xs:string"/>
        <xs:attribute name="deny-sale-juristic-person" type="xs:boolean"/>
    </xs:complexType>
    <xs:complexType name="bar-codeTypeExt">
        <xs:complexContent>
            <xs:extension base="tns:bar-codeType">
                <xs:attribute name="marking-of-the-good" type="xs:string" use="required"/>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="departmentType">
        <xs:sequence>
            <xs:element name="name" type="xs:string" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="number" type="xs:long" use="required"/>
    </xs:complexType>
    <xs:simpleType name="packType">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="1"/>
            <xs:maxInclusive value="9999"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="price-typeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="PRICE"/>
            <xs:enumeration value="DISCOUNT_PERCENT"/>
            <xs:enumeration value="DISCOUNT_VALUE"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="goods-catalog">
        <xs:sequence>
            <xs:element name="bar-code" type="tns:bar-codeTypeExt" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="plugin-propertyType">
        <xs:sequence>
            <xs:element name="plugin-property" type="tns:plugin-propertyType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="key" type="xs:string" use="required"/>
        <xs:attribute name="value" type="xs:string"/>
    </xs:complexType>
    <xs:complexType name="priceTagPreset">
        <xs:attribute name="count">
            <xs:simpleType>
                <xs:restriction base="xs:int"/>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="templateCode" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="255"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="priceType">
        <xs:sequence>
            <xs:element name="begin-date" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="end-date" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="number" type="xs:long" default="1" minOccurs="0"/>
            <xs:element name="department" type="tns:departmentType"/>
            <xs:element name="identifier" type="xs:string" minOccurs="0"/>
            <xs:element name="pack" type="tns:packType" default="1" minOccurs="0"/>
            <xs:element name="print" type="tns:priceTagPreset" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="template-format" type="xs:string" minOccurs="0"/>
            <xs:element name="old-price" type="xs:decimal" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="price" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:decimal">
                    <xs:minInclusive value="0.0"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="currency">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:maxLength value="3"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="deleted" type="xs:boolean"/>
        <xs:attribute name="approve-without-delay" type="xs:boolean"/>
        <xs:attribute name="price-type" type="tns:price-typeType" default="PRICE"/>
    </xs:complexType>
</xs:schema>


При выгрузке получается следующее
<?xml version="1.0" encoding="UTF-8"?>
<goods-catalog xmlns="http://www.crystals.ru xmlns:xs="http://www.w3.org/2001/XMLSchema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
	<bar-code xmlns="" xmlns:d2p1="http://www.crystals.ru code="2000092220018" marked="true" marking-of-the-good="00-00001767">
		<price-entry price="250">
			<begin-date>2024-03-07T00:00:00</begin-date>
			<end-date>2026-03-07T00:00:00</end-date>
			<number>1</number>
		</price-entry>
		<count>0.5</count>
	</bar-code>
</goods-catalog>

Во первых что-то с xmlns... почему-то targetNamespace не отрабатывает, возможно, поэтому по пути goods-catalog/bar-code/price-entry нет записи department а только "простые" типы, а в отладчике видно все поля.

ЧЯДНТ?
1 SiMBa_R38
 
07.03.24
11:06
на инфостарте ответили.
Я в коде повторно использовал ОбъектXDTO, а так нельзя.
Программист всегда исправляет последнюю ошибку.