From b6a56c745c02ad0823937c8825dd9b6603a9863a Mon Sep 17 00:00:00 2001 From: Dmitry Kinash Date: Thu, 9 Apr 2026 15:17:25 +0300 Subject: [PATCH] =?UTF-8?q?#IRP-636=20-=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1?= =?UTF-8?q?=D0=BE=D0=BA=20=D0=B1=D0=B8=D0=BB=D0=B4=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRP/src/CommonModules/BuilderAPI/Module.bsl | 10 +++++++- .../ControllerClientServer_V2/Module.bsl | 24 +++++++++++++++---- IRP/src/CommonModules/Localization/Module.bsl | 5 ++++ .../CommonModules/TransformObjects/Module.bsl | 5 ++-- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/IRP/src/CommonModules/BuilderAPI/Module.bsl b/IRP/src/CommonModules/BuilderAPI/Module.bsl index 5d7947ecbd..7a52d37dd7 100644 --- a/IRP/src/CommonModules/BuilderAPI/Module.bsl +++ b/IRP/src/CommonModules/BuilderAPI/Module.bsl @@ -449,10 +449,11 @@ EndFunction // TableName - String - Table name // ReturnRowKey - Boolean - // RowKey - String - +// LineNumber - Number - // // Returns: // ValueTableRow, String -Function AddRow(Wrapper, TableName = Undefined, ReturnRowKey = False, RowKey = "") Export +Function AddRow(Wrapper, TableName = Undefined, ReturnRowKey = False, RowKey = "", LineNumber = 0) Export If TableName = Undefined Then TableName = Wrapper.DefaultTable; EndIf; @@ -466,12 +467,19 @@ Function AddRow(Wrapper, TableName = Undefined, ReturnRowKey = False, RowKey = " NewRow.Key = RowKey; EndIf; EndIf; + If LineNumber > 0 Then + NewRow.LineNumber = LineNumber; + EndIf; ServerParameters = ControllerClientServer_V2.GetServerParameters(Wrapper.Object); ServerParameters.TableName = TableName; Rows = New Array(); // Array Of DocumentTabularSectionRow.SalesInvoice.ItemList Rows.Add(NewRow); ServerParameters.Rows = Rows; Parameters = ControllerClientServer_V2.GetParameters(ServerParameters); + If ControllerClientServer_V2.IsFullTransferTabularSection(Parameters, TableName) + OR ControllerClientServer_V2.IsFullLoadTabularSection(Parameters, TableName) Then + Raise StrTemplate(R().Error_TableNotSupportedInBuilder, TableName); + EndIf; ControllerClientServer_V2.AddNewRow(TableName, Parameters); If KeyFieldExists Then NewRow = WrapperTable.FindRows(New Structure("Key", NewRow.Key))[0]; diff --git a/IRP/src/CommonModules/ControllerClientServer_V2/Module.bsl b/IRP/src/CommonModules/ControllerClientServer_V2/Module.bsl index 448c9913a7..ff85bd7c00 100644 --- a/IRP/src/CommonModules/ControllerClientServer_V2/Module.bsl +++ b/IRP/src/CommonModules/ControllerClientServer_V2/Module.bsl @@ -221,6 +221,7 @@ Function CreateParameters(ServerParameters, FormParameters, LoadParameters) WrappedRows = WrapRows(Parameters, ServerParameters.Rows); If WrappedRows.Count() Then Parameters.Insert("Rows", WrappedRows); + Parameters.Insert("CurrentRow", WrappedRows[0].LineNumber); EndIf; Parameters.Insert("NextSteps" , New Array()); @@ -273,6 +274,9 @@ Function WrapRows(Parameters, Rows) Export NewRow.Insert("Key", RowLine); RowLine = RowLine + 1; EndIf; + If Not NewRow.Property("LineNumber") Then + NewRow.Insert("LineNumber", 0); + EndIf; ArrayOfRows.Add(NewRow); // SpecialOffers @@ -404,6 +408,7 @@ Function GetEventHandlerMap(Parameters, DataPath, IsBuilder) EventHandlerMap.Insert("ItemList.ExpCount" , "SetItemListExpCount"); EventHandlerMap.Insert("ItemList.SalesInvoice" , "SetItemListSalesDocument"); EventHandlerMap.Insert("ItemList.RetailSalesReceipt" , "SetItemListSalesDocument"); + EventHandlerMap.Insert("ItemList.OffersAmount" , "StepItemListCalculations_IsOffersChanged"); If Parameters.ObjectMetadataInfo.MetadataName = "SalesReportToConsignor" Then EventHandlerMap.Insert("ItemList.TotalAmount", @@ -499,7 +504,11 @@ Procedure API_SetProperty(Parameters, Property, Value, IsBuilder = False, Settin If ArrayOfEventHandlers = Undefined Then // no steps, no setter, no commands If IsColumn Then For Each Row In GetRows(Parameters, Parameters.TableName) Do - SetterObject("BindVoid", Property.DataPath, Parameters, ResultArray(Row.Key, Value)); + RowKey = Row.Key; + If RowKey = 0 And Row.Property("LineNumber") Then + RowKey = Row.LineNumber; + EndIf; + SetterObject("BindVoid", Property.DataPath, Parameters, ResultArray(RowKey, Value)); EndDo; Else SetterObject("BindVoid", Property.DataPath, Parameters, ResultArray(Undefined, Value)); @@ -872,7 +881,11 @@ Procedure AddNewRow(TableName, Parameters, ViewNotify = Undefined, LaunchSteps = If Default <> Undefined Then RegisterNextSteps(Parameters, True , Default.StepsEnabler, DataPath); - + + // service attribute + ElsIf ColumnName = "LineNumber" Then + Continue; + // if column is filled and has its own handler .OnChage call it ElsIf ValueIsFilled(NewRow[ColumnName]) Then SetPropertyObject(Parameters, DataPath, NewRow.Key, NewRow[ColumnName]); @@ -17912,7 +17925,7 @@ Procedure ExecuteViewNotify(Parameters, ViewNotify) EndProcedure #ENDIF -Function IsFullTransferTabularSection(Parameters, PropertyName) +Function IsFullTransferTabularSection(Parameters, PropertyName) Export _PropertyName = Upper(PropertyName); If _PropertyName = Upper("SerialLotNumbers") Or _PropertyName = Upper("SpecialOffers") @@ -17928,7 +17941,7 @@ Function IsFullTransferTabularSection(Parameters, PropertyName) Return False; EndFunction -Function IsFullLoadTabularSection(Parameters, PropertyName) +Function IsFullLoadTabularSection(Parameters, PropertyName) Export _PropertyName = Upper(PropertyName); If _PropertyName = Upper("SourceOfOrigins") Then Return True; @@ -17985,7 +17998,8 @@ Procedure _CommitChainChanges(Cache, Source, Parameters) If FoundedRowInMap <> Undefined Then FoundedRowInMap[KeyValue.Key] = KeyValue.Value; EndIf; - If Not TypeOf(Row.Key) = Type("Number") Then + // If Not TypeOf(Row.Key) = Type("Number") Then // ????? + If KeyValue.Key <> "Key" Then FoundedRow[KeyValue.Key] = KeyValue.Value; EndIf; EndDo; diff --git a/IRP/src/CommonModules/Localization/Module.bsl b/IRP/src/CommonModules/Localization/Module.bsl index f6282ef0af..350e085ed5 100644 --- a/IRP/src/CommonModules/Localization/Module.bsl +++ b/IRP/src/CommonModules/Localization/Module.bsl @@ -1005,6 +1005,10 @@ // * Error_UnknownRefType - String - // * Error_StepsEnablerNotDefined - String - // * Error_UnsupportedExternalLinkSC3 - String - +// * Error_CreatingPDF - String - +// * Error_ReadingPDF - String - +// * Error_ChromiumNotFound - String - +// * Error_TableNotSupportedInBuilder - String - // * Task_Result_Execution - String - // * Task_Result_Execution_Not - String - // * Task_Result_Verification - String - @@ -2855,6 +2859,7 @@ Strings.Insert("ExternalAccountingOperationExchangeReport", NStr("en = 'External Strings.Insert("Error_CreatingPDF", NStr("en = 'Error creating PDF'", Lang)); Strings.Insert("Error_ReadingPDF", NStr("en = 'Error reading PDF'", Lang)); Strings.Insert("Error_ChromiumNotFound", NStr("en = 'Chromium not found'", Lang)); + Strings.Insert("Error_TableNotSupportedInBuilder", NStr("en = 'Table [%1] is not supported in Builder API'", Lang)); #EndRegion #Region Tasks diff --git a/IRP/src/CommonModules/TransformObjects/Module.bsl b/IRP/src/CommonModules/TransformObjects/Module.bsl index b304913036..2e6e1d8f69 100644 --- a/IRP/src/CommonModules/TransformObjects/Module.bsl +++ b/IRP/src/CommonModules/TransformObjects/Module.bsl @@ -397,11 +397,10 @@ EndFunction Procedure FillTableRows(Source, Rule, Wrapper, TableName) TableRules = Rule.Mapping.Unload(New Structure("SortingIndex", TableName)); - //@skip-check variable-value-type + //@skip-check variable-value-type, property-return-type For Each SourceRow In Source[TableName] Do // ValueTableRow TableHasKey = CommonFunctionsClientServer.ObjectHasProperty(SourceRow, "Key"); - TargetRow = BuilderAPI.AddRow(Wrapper, TableName, False, ?(TableHasKey, SourceRow.Key, Undefined)); - + TargetRow = BuilderAPI.AddRow(Wrapper, TableName, False, ?(TableHasKey, SourceRow.Key, Undefined), SourceRow.LineNumber); // ValueTableRow FillTableRowAttributes(Source, SourceRow, Rule, Wrapper, TargetRow, TableName, TableRules); EndDo; EndProcedure