diff --git a/backend/de.metas.adempiere.adempiere/migration/src/main/sql/postgresql/system/10-de.metas.adempiere/5562900_sys_gh6949_UpdatesForPickingV2AndAddColumn_M_HU_PI.IsdDefaultForPicking.sql b/backend/de.metas.adempiere.adempiere/migration/src/main/sql/postgresql/system/10-de.metas.adempiere/5562900_sys_gh6949_UpdatesForPickingV2AndAddColumn_M_HU_PI.IsdDefaultForPicking.sql new file mode 100644 index 00000000000..ab5aec30d83 --- /dev/null +++ b/backend/de.metas.adempiere.adempiere/migration/src/main/sql/postgresql/system/10-de.metas.adempiere/5562900_sys_gh6949_UpdatesForPickingV2AndAddColumn_M_HU_PI.IsdDefaultForPicking.sql @@ -0,0 +1,320 @@ +-- 2020-07-06T07:28:21.314Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process SET Name='Kommissionieren',Updated=TO_TIMESTAMP('2020-07-06 10:28:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541007 +; + +-- 2020-07-06T07:28:25.922Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Kommissionieren',Updated=TO_TIMESTAMP('2020-07-06 10:28:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=541007 +; + +-- 2020-07-06T07:28:30.217Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Kommissionieren',Updated=TO_TIMESTAMP('2020-07-06 10:28:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_ID=541007 +; + +-- 2020-07-06T07:28:32.707Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-07-06 10:28:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=541007 +; + +-- 2020-07-06T07:29:06.167Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process SET Name='Verpacken',Updated=TO_TIMESTAMP('2020-07-06 10:29:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541024 +; + +-- 2020-07-06T07:29:11.090Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Verpacken',Updated=TO_TIMESTAMP('2020-07-06 10:29:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=541024 +; + +-- 2020-07-06T07:29:14.101Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Verpacken',Updated=TO_TIMESTAMP('2020-07-06 10:29:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_ID=541024 +; + +-- 2020-07-06T07:29:16.464Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-07-06 10:29:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=541024 +; + +-- 2020-07-06T07:29:31.148Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process SET Name='Kommissionieren',Updated=TO_TIMESTAMP('2020-07-06 10:29:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=541009 +; + +-- 2020-07-06T07:29:36.197Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Kommissionieren',Updated=TO_TIMESTAMP('2020-07-06 10:29:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=541009 +; + +-- 2020-07-06T07:29:38.523Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Kommissionieren',Updated=TO_TIMESTAMP('2020-07-06 10:29:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_DE' AND AD_Process_ID=541009 +; + +-- 2020-07-06T07:29:40.543Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-07-06 10:29:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=541009 +; + +-- 2020-07-06T07:32:15.116Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Process (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Process_ID,AllowProcessReRun,Classname,CopyFromProcess,Created,CreatedBy,EntityType,IsActive,IsApplySecuritySettings,IsBetaFunctionality,IsDirectPrint,IsNotifyUserAfterExecution,IsOneInstanceOnly,IsReport,IsServerProcess,IsTranslateExcelHeaders,IsUseBPartnerLanguage,LockWaitTimeout,Name,RefreshAllAfterExecution,ShowHelp,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,584722,'N','de.metas.ui.web.pickingV2.productsToPick.process.ProductsToPick_PickAndPackSelected','N',TO_TIMESTAMP('2020-07-06 10:32:14','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','N','N','N','N','N','N','N','Y','Y',0,'Kommissionieren & Verpacken','N','N','Java',TO_TIMESTAMP('2020-07-06 10:32:14','YYYY-MM-DD HH24:MI:SS'),100,'ProductsToPick_PickAndPackSelected') +; + +-- 2020-07-06T07:32:15.119Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Process_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Process_ID=584722 AND NOT EXISTS (SELECT 1 FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) +; + +-- 2020-07-06T07:32:19.622Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-07-06 10:32:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Process_ID=584722 +; + +-- 2020-07-06T07:32:27.878Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET IsTranslated='Y', Name='Pick ',Updated=TO_TIMESTAMP('2020-07-06 10:32:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584722 +; + +-- 2020-07-06T07:32:34.594Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Trl SET Name='Pick & Pack',Updated=TO_TIMESTAMP('2020-07-06 10:32:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Process_ID=584722 +; + +-- 2020-07-06T07:48:30.129Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,577785,0,'IsDefaultForPicking',TO_TIMESTAMP('2020-07-06 10:48:30','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Default For Picking','Default For Picking',TO_TIMESTAMP('2020-07-06 10:48:30','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- 2020-07-06T07:48:30.133Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, CommitWarning,Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName,WEBUI_NameBrowse,WEBUI_NameNew,WEBUI_NameNewBreadcrumb, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Element_ID, t.CommitWarning,t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName,t.WEBUI_NameBrowse,t.WEBUI_NameNew,t.WEBUI_NameNewBreadcrumb, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' OR l.IsBaseLanguage='Y') AND t.AD_Element_ID=577785 AND NOT EXISTS (SELECT 1 FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- 2020-07-06T07:49:15.650Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DDL_NoForeignKey,DefaultValue,EntityType,FacetFilterSeqNo,FieldLength,IsActive,IsAdvancedText,IsAllowLogging,IsAlwaysUpdateable,IsAutoApplyValidationRule,IsAutocomplete,IsCalculated,IsDimension,IsDLMPartitionBoundary,IsEncrypted,IsFacetFilter,IsForceIncludeInGeneratedModel,IsGenericZoomKeyColumn,IsGenericZoomOrigin,IsIdentifier,IsKey,IsLazyLoading,IsMandatory,IsParent,IsRangeFilter,IsSelectionColumn,IsShowFilterIncrementButtons,IsStaleable,IsSyncDatabase,IsTranslated,IsUpdateable,IsUseDocSequence,MaxFacetsToFetch,Name,SelectionColumnSeqNo,SeqNo,Updated,UpdatedBy,Version) VALUES (0,570908,577785,0,20,540511,'IsDefaultForPicking',TO_TIMESTAMP('2020-07-06 10:49:15','YYYY-MM-DD HH24:MI:SS'),100,'N','N','de.metas.handlingunits',0,1,'Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N',0,'Default For Picking',0,0,TO_TIMESTAMP('2020-07-06 10:49:15','YYYY-MM-DD HH24:MI:SS'),100,0) +; + +-- 2020-07-06T07:49:15.653Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Column_ID=570908 AND NOT EXISTS (SELECT 1 FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- 2020-07-06T07:49:15.901Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +/* DDL */ select update_Column_Translation_From_AD_Element(577785) +; + +-- 2020-07-06T07:49:20.956Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +/* DDL */ SELECT public.db_alter_table('M_HU_PI','ALTER TABLE public.M_HU_PI ADD COLUMN IsDefaultForPicking CHAR(1) DEFAULT ''N'' CHECK (IsDefaultForPicking IN (''Y'',''N''))') +; + +-- 2020-07-06T08:25:23.590Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Standard für Kommissionierung', PrintName='Standard für Kommissionierung',Updated=TO_TIMESTAMP('2020-07-06 11:25:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577785 AND AD_Language='de_CH' +; + +-- 2020-07-06T08:25:23.599Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577785,'de_CH') +; + +-- 2020-07-06T08:25:27.005Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Element_Trl SET IsTranslated='Y', Name='Standard für Kommissionierung', PrintName='Standard für Kommissionierung',Updated=TO_TIMESTAMP('2020-07-06 11:25:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577785 AND AD_Language='de_DE' +; + +-- 2020-07-06T08:25:27.006Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577785,'de_DE') +; + +-- 2020-07-06T08:25:27.018Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +/* DDL */ select update_ad_element_on_ad_element_trl_update(577785,'de_DE') +; + +-- 2020-07-06T08:25:27.021Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Column SET ColumnName='IsDefaultForPicking', Name='Standard für Kommissionierung', Description=NULL, Help=NULL WHERE AD_Element_ID=577785 +; + +-- 2020-07-06T08:25:27.023Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Para SET ColumnName='IsDefaultForPicking', Name='Standard für Kommissionierung', Description=NULL, Help=NULL, AD_Element_ID=577785 WHERE UPPER(ColumnName)='ISDEFAULTFORPICKING' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL +; + +-- 2020-07-06T08:25:27.025Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Process_Para SET ColumnName='IsDefaultForPicking', Name='Standard für Kommissionierung', Description=NULL, Help=NULL WHERE AD_Element_ID=577785 AND IsCentrallyMaintained='Y' +; + +-- 2020-07-06T08:25:27.026Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET Name='Standard für Kommissionierung', Description=NULL, Help=NULL WHERE (AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=577785) AND AD_Name_ID IS NULL ) OR (AD_Name_ID = 577785) +; + +-- 2020-07-06T08:25:27.041Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_PrintFormatItem pi SET PrintName='Standard für Kommissionierung', Name='Standard für Kommissionierung' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=577785) +; + +-- 2020-07-06T08:25:27.044Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Tab SET Name='Standard für Kommissionierung', Description=NULL, Help=NULL, CommitWarning = NULL WHERE AD_Element_ID = 577785 +; + +-- 2020-07-06T08:25:27.046Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_WINDOW SET Name='Standard für Kommissionierung', Description=NULL, Help=NULL WHERE AD_Element_ID = 577785 +; + +-- 2020-07-06T08:25:27.048Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Menu SET Name = 'Standard für Kommissionierung', Description = NULL, WEBUI_NameBrowse = NULL, WEBUI_NameNew = NULL, WEBUI_NameNewBreadcrumb = NULL WHERE AD_Element_ID = 577785 +; + +-- 2020-07-06T08:25:30.484Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Element_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-07-06 11:25:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=577785 AND AD_Language='en_US' +; + +-- 2020-07-06T08:25:30.487Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +/* DDL */ select update_TRL_Tables_On_AD_Element_TRL_Update(577785,'en_US') +; + +-- 2020-07-06T08:34:35.298Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,570908,614982,0,540504,0,TO_TIMESTAMP('2020-07-06 11:34:35','YYYY-MM-DD HH24:MI:SS'),100,0,'D',0,'Y','Y','Y','N','N','N','N','N','Standard für Kommissionierung',60,50,0,1,1,TO_TIMESTAMP('2020-07-06 11:34:35','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- 2020-07-06T08:34:35.300Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=614982 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- 2020-07-06T08:34:35.303Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +/* DDL */ select update_FieldTranslation_From_AD_Name_Element(577785) +; + +-- 2020-07-06T08:34:35.314Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +DELETE FROM AD_Element_Link WHERE AD_Field_ID=614982 +; + +-- 2020-07-06T08:34:35.317Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +/* DDL */ select AD_Element_Link_Create_Missing_Field(614982) +; + +-- 2020-07-06T08:36:09.554Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +DELETE FROM AD_Element_Link WHERE AD_Field_ID=614982 +; + +-- 2020-07-06T08:36:09.555Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +DELETE FROM AD_Field_Trl WHERE AD_Field_ID=614982 +; + +-- 2020-07-06T08:36:09.563Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +DELETE FROM AD_Field WHERE AD_Field_ID=614982 +; + +-- 2020-07-06T08:36:37.653Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,ColumnDisplayLength,Created,CreatedBy,DisplayLength,EntityType,IncludedTabHeight,IsActive,IsDisplayed,IsDisplayedGrid,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SeqNoGrid,SortNo,SpanX,SpanY,Updated,UpdatedBy) VALUES (0,570908,614983,0,540822,0,TO_TIMESTAMP('2020-07-06 11:36:37','YYYY-MM-DD HH24:MI:SS'),100,0,'D',0,'Y','Y','Y','N','N','N','N','N','Standard für Kommissionierung',60,50,0,1,1,TO_TIMESTAMP('2020-07-06 11:36:37','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- 2020-07-06T08:36:37.655Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Field_ID=614983 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- 2020-07-06T08:36:37.657Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +/* DDL */ select update_FieldTranslation_From_AD_Name_Element(577785) +; + +-- 2020-07-06T08:36:37.659Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +DELETE FROM AD_Element_Link WHERE AD_Field_ID=614983 +; + +-- 2020-07-06T08:36:37.660Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +/* DDL */ select AD_Element_Link_Create_Missing_Field(614983) +; + +-- 2020-07-06T08:37:09.166Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_UI_Element (AD_Client_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,AD_UI_ElementGroup_ID,AD_UI_Element_ID,AD_UI_ElementType,Created,CreatedBy,IsActive,IsAdvancedField,IsAllowFiltering,IsDisplayed,IsDisplayedGrid,IsDisplayed_SideList,IsMultiLine,MultiLine_LinesCount,Name,SeqNo,SeqNoGrid,SeqNo_SideList,Updated,UpdatedBy) VALUES (0,614983,0,540822,540433,570170,'F',TO_TIMESTAMP('2020-07-06 11:37:09','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','N','Y','N','N','N',0,'Standard für Kommissionierung',30,0,0,TO_TIMESTAMP('2020-07-06 11:37:09','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- 2020-07-06T08:43:17.275Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_UI_Element SET IsAdvancedField='N',Updated=TO_TIMESTAMP('2020-07-06 11:43:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=570170 +; + +-- 2020-07-06T09:19:59.299Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Index_Table (AD_Client_ID,AD_Index_Table_ID,AD_Org_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsUnique,Name,Processing,Updated,UpdatedBy,WhereClause) VALUES (0,540545,0,540511,TO_TIMESTAMP('2020-07-06 12:19:59','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Y','M_HU_PI.IsDefaultForPicking_UQ','N',TO_TIMESTAMP('2020-07-06 12:19:59','YYYY-MM-DD HH24:MI:SS'),100,'') +; + +-- 2020-07-06T09:19:59.306Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Index_Table_Trl (AD_Language,AD_Index_Table_ID, ErrorMsg, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Index_Table_ID, t.ErrorMsg, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Index_Table t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Index_Table_ID=540545 AND NOT EXISTS (SELECT 1 FROM AD_Index_Table_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Index_Table_ID=t.AD_Index_Table_ID) +; + +-- 2020-07-06T09:20:26.913Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Index_Column (AD_Client_ID,AD_Column_ID,AD_Index_Column_ID,AD_Index_Table_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,SeqNo,Updated,UpdatedBy) VALUES (0,570908,541032,540545,0,TO_TIMESTAMP('2020-07-06 12:20:26','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',10,TO_TIMESTAMP('2020-07-06 12:20:26','YYYY-MM-DD HH24:MI:SS'),100) +; + +-- 2020-07-06T09:21:06.849Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Index_Table SET Name='M_HU_PI_IsDefaultForPicking_UQ',Updated=TO_TIMESTAMP('2020-07-06 12:21:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Index_Table_ID=540545 +; + +-- 2020-07-06T09:22:14.406Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Index_Table SET WhereClause='IsDefaultForPicking = ''Y''',Updated=TO_TIMESTAMP('2020-07-06 12:22:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Index_Table_ID=540545 +; + +-- 2020-07-06T09:22:51.199Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +CREATE UNIQUE INDEX M_HU_PI_IsDefaultForPicking_UQ ON M_HU_PI (IsDefaultForPicking) WHERE IsDefaultForPicking = 'Y' +; + +-- 2020-07-06T09:43:00.094Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,544986,0,TO_TIMESTAMP('2020-07-06 12:42:59','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Please set a default Packing Instruction for automated Pick and Pack.','I',TO_TIMESTAMP('2020-07-06 12:42:59','YYYY-MM-DD HH24:MI:SS'),100,'de.metas.ui.web.pickingV2.productsToPick.process.ProductsToPick_PickAndPackSelected.SetDefaultPackingInstruction') +; + +-- 2020-07-06T09:43:00.098Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N') AND t.AD_Message_ID=544986 AND NOT EXISTS (SELECT 1 FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID) +; + +-- 2020-07-06T09:43:04.911Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Message SET MsgText='Standard-Packvorschrift für automatisches Kommissionieren und Verpacken festlegen.',Updated=TO_TIMESTAMP('2020-07-06 12:43:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=544986 +; + +-- 2020-07-06T09:43:08.752Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Message_Trl SET IsTranslated='Y', MsgText='Standard-Packvorschrift für automatisches Kommissionieren und Verpacken festlegen.',Updated=TO_TIMESTAMP('2020-07-06 12:43:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='de_CH' AND AD_Message_ID=544986 +; + +-- 2020-07-06T09:43:13.629Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Message_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2020-07-06 12:43:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Language='en_US' AND AD_Message_ID=544986 +; + diff --git a/backend/de.metas.adempiere.adempiere/migration/src/main/sql/postgresql/system/10-de.metas.adempiere/5562930_sys_gh6949_M_HU_PI_IsDefaultForPicking_IgnoreInactiveRecords.sql b/backend/de.metas.adempiere.adempiere/migration/src/main/sql/postgresql/system/10-de.metas.adempiere/5562930_sys_gh6949_M_HU_PI_IsDefaultForPicking_IgnoreInactiveRecords.sql new file mode 100644 index 00000000000..bf32503abfa --- /dev/null +++ b/backend/de.metas.adempiere.adempiere/migration/src/main/sql/postgresql/system/10-de.metas.adempiere/5562930_sys_gh6949_M_HU_PI_IsDefaultForPicking_IgnoreInactiveRecords.sql @@ -0,0 +1,15 @@ +-- 2020-07-07T04:17:05.628Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Index_Table SET WhereClause='IsDefaultForPicking = ''Y'' AND IsActive = ''Y''',Updated=TO_TIMESTAMP('2020-07-07 07:17:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Index_Table_ID=540545 +; + +-- 2020-07-07T04:17:08.239Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +DROP INDEX IF EXISTS m_hu_pi_isdefaultforpicking_uq +; + +-- 2020-07-07T04:17:08.248Z +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +CREATE UNIQUE INDEX M_HU_PI_IsDefaultForPicking_UQ ON M_HU_PI (IsDefaultForPicking) WHERE IsDefaultForPicking = 'Y' AND IsActive = 'Y' +; + diff --git a/backend/de.metas.handlingunits.base/src/main/java-gen/de/metas/handlingunits/model/I_M_HU_PI.java b/backend/de.metas.handlingunits.base/src/main/java-gen/de/metas/handlingunits/model/I_M_HU_PI.java index 5b002be394d..44ecacf46f3 100644 --- a/backend/de.metas.handlingunits.base/src/main/java-gen/de/metas/handlingunits/model/I_M_HU_PI.java +++ b/backend/de.metas.handlingunits.base/src/main/java-gen/de/metas/handlingunits/model/I_M_HU_PI.java @@ -2,7 +2,7 @@ /** Generated Interface for M_HU_PI - * @author Adempiere (generated) + * @author metasfresh (generated) */ @SuppressWarnings("javadoc") public interface I_M_HU_PI @@ -14,17 +14,10 @@ public interface I_M_HU_PI /** AD_Table_ID=540511 */ // public static final int Table_ID = org.compiere.model.MTable.getTable_ID(Table_Name); -// org.compiere.util.KeyNamePair Model = new org.compiere.util.KeyNamePair(Table_ID, Table_Name); - - /** AccessLevel = 7 - System - Client - Org - */ -// java.math.BigDecimal accessLevel = java.math.BigDecimal.valueOf(7); - - /** Load Meta Data */ /** - * Get Mandant. - * Mandant für diese Installation. + * Get Client. + * Client/Tenant for this installation. * *
Type: TableDir *
Mandatory: true @@ -36,8 +29,8 @@ public interface I_M_HU_PI public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; /** - * Set Sektion. - * Organisatorische Einheit des Mandanten + * Set Organisation. + * Organisational entity within client * *
Type: Search *
Mandatory: true @@ -46,8 +39,8 @@ public interface I_M_HU_PI public void setAD_Org_ID (int AD_Org_ID); /** - * Get Sektion. - * Organisatorische Einheit des Mandanten + * Get Organisation. + * Organisational entity within client * *
Type: Search *
Mandatory: true @@ -59,8 +52,8 @@ public interface I_M_HU_PI public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; /** - * Get Erstellt. - * Datum, an dem dieser Eintrag erstellt wurde + * Get Created. + * Date this record was created * *
Type: DateTime *
Mandatory: true @@ -74,8 +67,8 @@ public interface I_M_HU_PI public static final String COLUMNNAME_Created = "Created"; /** - * Get Erstellt durch. - * Nutzer, der diesen Eintrag erstellt hat + * Get Created By. + * User who created this records * *
Type: Table *
Mandatory: true @@ -87,7 +80,7 @@ public interface I_M_HU_PI public static final String COLUMNNAME_CreatedBy = "CreatedBy"; /** - * Set Beschreibung. + * Set Description. * *
Type: String *
Mandatory: false @@ -96,7 +89,7 @@ public interface I_M_HU_PI public void setDescription (java.lang.String Description); /** - * Get Beschreibung. + * Get Description. * *
Type: String *
Mandatory: false @@ -110,8 +103,8 @@ public interface I_M_HU_PI public static final String COLUMNNAME_Description = "Description"; /** - * Set Aktiv. - * Der Eintrag ist im System aktiv + * Set Active. + * The record is active in the system * *
Type: YesNo *
Mandatory: true @@ -120,8 +113,8 @@ public interface I_M_HU_PI public void setIsActive (boolean IsActive); /** - * Get Aktiv. - * Der Eintrag ist im System aktiv + * Get Active. + * The record is active in the system * *
Type: YesNo *
Mandatory: true @@ -134,6 +127,29 @@ public interface I_M_HU_PI /** Column name IsActive */ public static final String COLUMNNAME_IsActive = "IsActive"; + /** + * Set Default For Picking. + * + *
Type: YesNo + *
Mandatory: false + *
Virtual Column: false + */ + public void setIsDefaultForPicking (boolean IsDefaultForPicking); + + /** + * Get Default For Picking. + * + *
Type: YesNo + *
Mandatory: false + *
Virtual Column: false + */ + public boolean isDefaultForPicking(); + + /** Column definition for IsDefaultForPicking */ + public static final org.adempiere.model.ModelColumn COLUMN_IsDefaultForPicking = new org.adempiere.model.ModelColumn(I_M_HU_PI.class, "IsDefaultForPicking", null); + /** Column name IsDefaultForPicking */ + public static final String COLUMNNAME_IsDefaultForPicking = "IsDefaultForPicking"; + /** * Set Standard-LU. * @@ -204,8 +220,8 @@ public interface I_M_HU_PI public static final String COLUMNNAME_Name = "Name"; /** - * Get Aktualisiert. - * Datum, an dem dieser Eintrag aktualisiert wurde + * Get Updated. + * Date this record was updated * *
Type: DateTime *
Mandatory: true @@ -219,8 +235,8 @@ public interface I_M_HU_PI public static final String COLUMNNAME_Updated = "Updated"; /** - * Get Aktualisiert durch. - * Nutzer, der diesen Eintrag aktualisiert hat + * Get Updated By. + * User who updated this records * *
Type: Table *
Mandatory: true diff --git a/backend/de.metas.handlingunits.base/src/main/java-gen/de/metas/handlingunits/model/X_M_HU_PI.java b/backend/de.metas.handlingunits.base/src/main/java-gen/de/metas/handlingunits/model/X_M_HU_PI.java index 8860e90dcc1..55c7f3ec4cc 100644 --- a/backend/de.metas.handlingunits.base/src/main/java-gen/de/metas/handlingunits/model/X_M_HU_PI.java +++ b/backend/de.metas.handlingunits.base/src/main/java-gen/de/metas/handlingunits/model/X_M_HU_PI.java @@ -5,27 +5,18 @@ import java.util.Properties; /** Generated Model for M_HU_PI - * @author Adempiere (generated) + * @author metasfresh (generated) */ @SuppressWarnings("javadoc") public class X_M_HU_PI extends org.compiere.model.PO implements I_M_HU_PI, org.compiere.model.I_Persistent { - /** - * - */ - private static final long serialVersionUID = 1146893183L; + private static final long serialVersionUID = -601360170L; /** Standard Constructor */ public X_M_HU_PI (Properties ctx, int M_HU_PI_ID, String trxName) { super (ctx, M_HU_PI_ID, trxName); - /** if (M_HU_PI_ID == 0) - { - setIsDefaultLU (false); // N - setM_HU_PI_ID (0); - setName (null); - } */ } /** Load Constructor */ @@ -35,55 +26,49 @@ public X_M_HU_PI (Properties ctx, ResultSet rs, String trxName) } - /** Load Meta Data */ - @Override - protected org.compiere.model.POInfo initPO (Properties ctx) - { - org.compiere.model.POInfo poi = org.compiere.model.POInfo.getPOInfo (ctx, Table_Name, get_TrxName()); - return poi; - } + /** Load Meta Data */ + @Override + protected org.compiere.model.POInfo initPO(Properties ctx) + { + return org.compiere.model.POInfo.getPOInfo(Table_Name); + } - /** Set Beschreibung. - @param Description Beschreibung */ @Override public void setDescription (java.lang.String Description) { set_Value (COLUMNNAME_Description, Description); } - /** Get Beschreibung. - @return Beschreibung */ @Override - public java.lang.String getDescription () + public java.lang.String getDescription() { return (java.lang.String)get_Value(COLUMNNAME_Description); } - /** Set Standard-LU. - @param IsDefaultLU Standard-LU */ + @Override + public void setIsDefaultForPicking (boolean IsDefaultForPicking) + { + set_Value (COLUMNNAME_IsDefaultForPicking, Boolean.valueOf(IsDefaultForPicking)); + } + + @Override + public boolean isDefaultForPicking() + { + return get_ValueAsBoolean(COLUMNNAME_IsDefaultForPicking); + } + @Override public void setIsDefaultLU (boolean IsDefaultLU) { set_Value (COLUMNNAME_IsDefaultLU, Boolean.valueOf(IsDefaultLU)); } - /** Get Standard-LU. - @return Standard-LU */ @Override - public boolean isDefaultLU () + public boolean isDefaultLU() { - Object oo = get_Value(COLUMNNAME_IsDefaultLU); - if (oo != null) - { - if (oo instanceof Boolean) - return ((Boolean)oo).booleanValue(); - return "Y".equals(oo); - } - return false; + return get_ValueAsBoolean(COLUMNNAME_IsDefaultLU); } - /** Set Packvorschrift. - @param M_HU_PI_ID Packvorschrift */ @Override public void setM_HU_PI_ID (int M_HU_PI_ID) { @@ -93,29 +78,20 @@ public void setM_HU_PI_ID (int M_HU_PI_ID) set_ValueNoCheck (COLUMNNAME_M_HU_PI_ID, Integer.valueOf(M_HU_PI_ID)); } - /** Get Packvorschrift. - @return Packvorschrift */ @Override - public int getM_HU_PI_ID () + public int getM_HU_PI_ID() { - Integer ii = (Integer)get_Value(COLUMNNAME_M_HU_PI_ID); - if (ii == null) - return 0; - return ii.intValue(); + return get_ValueAsInt(COLUMNNAME_M_HU_PI_ID); } - /** Set Name. - @param Name Name */ @Override public void setName (java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } - /** Get Name. - @return Name */ @Override - public java.lang.String getName () + public java.lang.String getName() { return (java.lang.String)get_Value(COLUMNNAME_Name); } diff --git a/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/IHandlingUnitsDAO.java b/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/IHandlingUnitsDAO.java index 0f382b74d53..3eb9bc9db7c 100644 --- a/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/IHandlingUnitsDAO.java +++ b/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/IHandlingUnitsDAO.java @@ -22,28 +22,7 @@ package de.metas.handlingunits; -import java.util.Collection; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import javax.annotation.Nullable; - -import org.adempiere.ad.dao.IQueryBL; -import org.adempiere.ad.dao.IQueryOrderBy; -import org.adempiere.ad.dao.IQueryOrderBy.Direction; -import org.adempiere.ad.dao.IQueryOrderBy.Nulls; -import org.adempiere.util.lang.IContextAware; -import org.adempiere.util.lang.IPair; -import org.adempiere.warehouse.WarehouseId; -import org.compiere.model.I_M_Locator; -import org.compiere.model.I_M_Product; -import org.compiere.model.I_M_Warehouse; - import com.google.common.collect.ImmutableMap; - import de.metas.bpartner.BPartnerId; import de.metas.handlingunits.model.I_DD_NetworkDistribution; import de.metas.handlingunits.model.I_M_HU; @@ -57,6 +36,24 @@ import de.metas.util.ISingletonService; import de.metas.util.Services; import lombok.NonNull; +import org.adempiere.ad.dao.IQueryBL; +import org.adempiere.ad.dao.IQueryOrderBy; +import org.adempiere.ad.dao.IQueryOrderBy.Direction; +import org.adempiere.ad.dao.IQueryOrderBy.Nulls; +import org.adempiere.util.lang.IContextAware; +import org.adempiere.util.lang.IPair; +import org.adempiere.warehouse.WarehouseId; +import org.compiere.model.I_M_Locator; +import org.compiere.model.I_M_Product; +import org.compiere.model.I_M_Warehouse; + +import javax.annotation.Nullable; +import java.util.Collection; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; public interface IHandlingUnitsDAO extends ISingletonService { @@ -76,7 +73,7 @@ public interface IHandlingUnitsDAO extends ISingletonService * The ordering of HU-items before HU-aggregate-items is important when we deallocate from HUs, because we only want to "touch" the aggregate VHU if we need to. */ Comparator HU_ITEMS_COMPARATOR = Comparator - . comparing( + .comparing( item -> ITEM_TYPE_ORDERING.get(Services.get(IHandlingUnitsBL.class).getItemType(item))) .thenComparing( queryOrderBy.getComparator(I_M_HU_Item.class)); @@ -106,7 +103,6 @@ public interface IHandlingUnitsDAO extends ISingletonService /** * Gets Virtual PI * - * @param ctx * @return virtual PI; never return null */ I_M_HU_PI retrieveVirtualPI(Properties ctx); @@ -115,9 +111,6 @@ public interface IHandlingUnitsDAO extends ISingletonService /** * Create a new HU builder using the given {@code huContext}. Set the builder's {@code date} to the {@code huContext}'s date. - * - * @param huContext - * @return */ IHUBuilder createHUBuilder(IHUContext huContext); @@ -139,9 +132,6 @@ public interface IHandlingUnitsDAO extends ISingletonService /** * Actually returns {@link I_M_HU#getM_HU_Item_Parent()}, but in a potentially DB decoupled fashion. - * - * @param hu - * @return */ I_M_HU_Item retrieveParentItem(I_M_HU hu); @@ -150,8 +140,6 @@ public interface IHandlingUnitsDAO extends ISingletonService /** * Creates and saves a {@link I_M_HU_Item} for the given {@code hu}, using the given {@code piItem} as its template. * - * @param hu - * @param piItem * @return created HU item */ I_M_HU_Item createHUItem(I_M_HU hu, I_M_HU_PI_Item piItem); @@ -168,9 +156,6 @@ public interface IHandlingUnitsDAO extends ISingletonService /** * Retrieve items that reference the given {@code hu}, ordered by {@link #HU_ITEMS_COMPARATOR}. - * - * @param hu - * @return */ List retrieveItems(final I_M_HU hu); @@ -187,7 +172,7 @@ public interface IHandlingUnitsDAO extends ISingletonService /** * Retrieve (active) {@link I_M_HU_PI_Item}s for the given parameters. * - * @param version mandatory. Only return items that reference this version. + * @param version mandatory. Only return items that reference this version. * @param bpartnerId optional. If not {@code null}, then exclude items with {@link X_M_HU_Item#ITEMTYPE_HandlingUnit} that have a different {@link I_M_HU_PI_Item#COLUMNNAME_C_BPartner_ID}. */ List retrievePIItems(final I_M_HU_PI_Version version, final BPartnerId bpartnerId); @@ -217,6 +202,9 @@ public interface IHandlingUnitsDAO extends ISingletonService List retrievePIItemsForPackingMaterial(final I_M_HU_PackingMaterial pm); + @Nullable + I_M_HU_PI retrievePIDefaultForPicking(); + /** * Retrieve ALL PI Versions (active, not-active, current, not-current). */ @@ -334,4 +322,6 @@ public interface IHandlingUnitsDAO extends ISingletonService @NonNull I_M_HU_PI getIncludedPI(@NonNull I_M_HU_PI_Item piItem); + + void save(@NonNull I_M_HU_PI huPi); } diff --git a/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/impl/HandlingUnitsDAO.java b/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/impl/HandlingUnitsDAO.java index f730c1e6b4f..9344767e947 100644 --- a/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/impl/HandlingUnitsDAO.java +++ b/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/impl/HandlingUnitsDAO.java @@ -22,53 +22,9 @@ package de.metas.handlingunits.impl; -import static org.adempiere.model.InterfaceWrapperHelper.load; -import static org.adempiere.model.InterfaceWrapperHelper.loadByRepoIdAwares; -import static org.adempiere.model.InterfaceWrapperHelper.loadByRepoIdAwaresOutOfTrx; -import static org.adempiere.model.InterfaceWrapperHelper.loadOutOfTrx; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Objects; -import java.util.Properties; -import java.util.Set; -import java.util.stream.Collectors; - -import javax.annotation.Nullable; - -import org.adempiere.ad.dao.ICompositeQueryFilter; -import org.adempiere.ad.dao.IQueryBL; -import org.adempiere.ad.dao.IQueryBuilder; -import org.adempiere.ad.dao.IQueryOrderBy.Direction; -import org.adempiere.ad.dao.IQueryOrderBy.Nulls; -import org.adempiere.ad.dao.impl.EqualsQueryFilter; -import org.adempiere.ad.trx.api.ITrx; -import org.adempiere.exceptions.AdempiereException; -import org.adempiere.model.InterfaceWrapperHelper; -import org.adempiere.util.lang.IContextAware; -import org.adempiere.util.lang.IPair; -import org.adempiere.util.lang.ImmutablePair; -import org.adempiere.util.proxy.Cached; -import org.adempiere.warehouse.WarehouseId; -import org.adempiere.warehouse.api.IWarehouseDAO; -import org.compiere.Adempiere; -import org.compiere.SpringContextHolder; -import org.compiere.model.I_M_Locator; -import org.compiere.model.I_M_Product; -import org.compiere.util.Env; -import org.compiere.util.Util; -import org.compiere.util.Util.ArrayKey; -import org.slf4j.Logger; - import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; - import de.metas.bpartner.BPartnerId; import de.metas.cache.annotation.CacheCtx; import de.metas.cache.annotation.CacheTrx; @@ -101,6 +57,47 @@ import de.metas.util.Services; import de.metas.util.collections.IteratorUtils; import lombok.NonNull; +import org.adempiere.ad.dao.ICompositeQueryFilter; +import org.adempiere.ad.dao.IQueryBL; +import org.adempiere.ad.dao.IQueryBuilder; +import org.adempiere.ad.dao.IQueryOrderBy.Direction; +import org.adempiere.ad.dao.IQueryOrderBy.Nulls; +import org.adempiere.ad.dao.impl.EqualsQueryFilter; +import org.adempiere.ad.trx.api.ITrx; +import org.adempiere.exceptions.AdempiereException; +import org.adempiere.model.InterfaceWrapperHelper; +import org.adempiere.util.lang.IContextAware; +import org.adempiere.util.lang.IPair; +import org.adempiere.util.lang.ImmutablePair; +import org.adempiere.util.proxy.Cached; +import org.adempiere.warehouse.WarehouseId; +import org.adempiere.warehouse.api.IWarehouseDAO; +import org.compiere.Adempiere; +import org.compiere.SpringContextHolder; +import org.compiere.model.I_M_Locator; +import org.compiere.model.I_M_Product; +import org.compiere.util.Env; +import org.compiere.util.Util; +import org.compiere.util.Util.ArrayKey; +import org.slf4j.Logger; + +import javax.annotation.Nullable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Objects; +import java.util.Properties; +import java.util.Set; +import java.util.stream.Collectors; + +import static org.adempiere.model.InterfaceWrapperHelper.load; +import static org.adempiere.model.InterfaceWrapperHelper.loadByRepoIdAwares; +import static org.adempiere.model.InterfaceWrapperHelper.loadByRepoIdAwaresOutOfTrx; +import static org.adempiere.model.InterfaceWrapperHelper.loadOutOfTrx; public class HandlingUnitsDAO implements IHandlingUnitsDAO { @@ -188,8 +185,8 @@ public I_M_HU_PI getPackingInstructionById(@NonNull final HuPackingInstructionsI } @Cached(cacheName = I_M_HU_PI.Table_Name + "#by#" + I_M_HU_PI.COLUMNNAME_M_HU_PI_ID) - // NOTE: for caching to work, don't make it final - /* package */I_M_HU_PI retrievePI(final @CacheCtx Properties ctx, @NonNull final HuPackingInstructionsId piId) + // NOTE: for caching to work, don't make it final + /* package */I_M_HU_PI retrievePI(final @CacheCtx Properties ctx, @NonNull final HuPackingInstructionsId piId) { final I_M_HU_PI pi = Services.get(IQueryBL.class).createQueryBuilder(I_M_HU_PI.class, ctx, ITrx.TRXNAME_None) .addEqualsFilter(I_M_HU_PI.COLUMNNAME_M_HU_PI_ID, piId) @@ -487,6 +484,17 @@ public List retrieveAllPIItems(final I_M_HU_PI_Version piVersion return Collections.unmodifiableList(piItems); } + @Override + @Nullable + public I_M_HU_PI retrievePIDefaultForPicking() + { + return Services.get(IQueryBL.class).createQueryBuilder(I_M_HU_PI.class) + .addOnlyActiveRecordsFilter() + .addEqualsFilter(I_M_HU_PI.COLUMNNAME_IsDefaultForPicking, true) + .create() + .first(); + } + @Override public List retrieveAllPIVersions(final I_M_HU_PI pi) { @@ -561,7 +569,7 @@ public I_M_HU_PI_Version retrievePIVersionById(@NonNull final HuPackingInstructi + "#by" + "#" + I_M_HU_PI_Version.COLUMNNAME_M_HU_PI_ID + "#" + I_M_HU_PI_Version.COLUMNNAME_IsCurrent) - /* package */I_M_HU_PI_Version retrievePICurrentVersionOrNull( + /* package */I_M_HU_PI_Version retrievePICurrentVersionOrNull( final @CacheCtx Properties ctx, final HuPackingInstructionsId piId, final @CacheTrx String trxName) @@ -783,6 +791,12 @@ public I_M_HU_PI getIncludedPI(@NonNull final I_M_HU_PI_Item piItem) return getPackingInstructionById(includedPIId); } + @Override + public void save(@NonNull final I_M_HU_PI huPi) + { + InterfaceWrapperHelper.save(huPi); + } + @Override public I_M_HU_PackingMaterial retrievePackingMaterial(final I_M_HU_PI pi, final BPartnerId bpartnerId) { @@ -932,11 +946,11 @@ else if (parentPIItems.size() == 1) } logger.warn("More then one parent PI Item found. Returing the first one." - + "\n huPI={}" - + "\n huUnitType={}" - + "\n bpartner={}" - + "\n HU PI Items with DefaultLU={}" - + "\n => parent HU PI Items={}", + + "\n huPI={}" + + "\n huUnitType={}" + + "\n bpartner={}" + + "\n HU PI Items with DefaultLU={}" + + "\n => parent HU PI Items={}", new Object[] { huPI, huUnitType, bpartnerId, defaultLUPIItems, parentPIItems }); return parentPIItems.get(0); diff --git a/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/model/validator/M_HU_PI.java b/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/model/validator/M_HU_PI.java index 4469ba1c9d7..ff8380eb51b 100644 --- a/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/model/validator/M_HU_PI.java +++ b/backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/model/validator/M_HU_PI.java @@ -10,41 +10,71 @@ * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * . * #L% */ - -import java.util.List; - +import de.metas.handlingunits.IHandlingUnitsDAO; +import de.metas.handlingunits.model.I_M_HU_PI; +import de.metas.handlingunits.model.I_M_HU_PI_Version; +import de.metas.logging.LogManager; +import de.metas.logging.TableRecordMDC; +import de.metas.util.Services; +import lombok.NonNull; import org.adempiere.ad.modelvalidator.annotations.ModelChange; import org.adempiere.ad.modelvalidator.annotations.Validator; import org.adempiere.model.InterfaceWrapperHelper; import org.compiere.model.ModelValidator; +import org.slf4j.Logger; +import org.slf4j.MDC; -import de.metas.handlingunits.IHandlingUnitsDAO; -import de.metas.handlingunits.model.I_M_HU_PI; -import de.metas.handlingunits.model.I_M_HU_PI_Version; -import de.metas.util.Services; +import java.util.List; @Validator(I_M_HU_PI.class) public class M_HU_PI { + private transient static final Logger logger = LogManager.getLogger(M_HU_PI.class); + + private final IHandlingUnitsDAO handlingUnitsDAO = Services.get(IHandlingUnitsDAO.class); + @ModelChange(timings = ModelValidator.TYPE_BEFORE_DELETE) public void onDeleteMHUPI(final I_M_HU_PI pi) { - final List piVersions = Services.get(IHandlingUnitsDAO.class).retrieveAllPIVersions(pi); + final List piVersions = handlingUnitsDAO.retrieveAllPIVersions(pi); for (final I_M_HU_PI_Version version : piVersions) { InterfaceWrapperHelper.delete(version); } } + + @ModelChange(timings = { ModelValidator.TYPE_BEFORE_NEW, ModelValidator.TYPE_BEFORE_CHANGE }, + ifColumnsChanged = I_M_HU_PI.COLUMNNAME_IsDefaultForPicking + ) + public void ensureOnlyOneDefaultForPicking(@NonNull final I_M_HU_PI newDefault) + { + try (final MDC.MDCCloseable ignored = TableRecordMDC.putTableRecordReference(newDefault)) + { + if (!newDefault.isDefaultForPicking()) + { + return; + } + + final I_M_HU_PI previousDefault = handlingUnitsDAO.retrievePIDefaultForPicking(); + if (previousDefault != null) + { + logger.debug("M_HU_PI={} is now IsDefaultForPicking; -> Change previousDefault M_HU_PI={} to IsDefaultForPicking='N'", + newDefault.getM_HU_PI_ID(), previousDefault.getM_HU_PI_ID()); + previousDefault.setIsDefaultForPicking(false); + handlingUnitsDAO.save(previousDefault); + } + } + } } diff --git a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/ProductsToPickViewFactory.java b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/ProductsToPickViewFactory.java index 23876a9f1e3..0262913cada 100644 --- a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/ProductsToPickViewFactory.java +++ b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/ProductsToPickViewFactory.java @@ -31,6 +31,7 @@ import de.metas.ui.web.pickingV2.packageable.PackageableRow; import de.metas.ui.web.pickingV2.productsToPick.process.ProductsToPick_4EyesReview_ProcessAll; import de.metas.ui.web.pickingV2.productsToPick.process.ProductsToPick_MarkWillNotPickSelected; +import de.metas.ui.web.pickingV2.productsToPick.process.ProductsToPick_PickAndPackSelected; import de.metas.ui.web.pickingV2.productsToPick.process.ProductsToPick_PickSelected; import de.metas.ui.web.pickingV2.productsToPick.process.ProductsToPick_Request4EyesReview; import de.metas.ui.web.pickingV2.productsToPick.process.ProductsToPick_SetPackingInstructions; @@ -204,6 +205,7 @@ public ProductsToPickView createView(@NonNull final PackageableRow packageableRo .relatedProcessDescriptor(createProcessDescriptor(ProductsToPick_MarkWillNotPickSelected.class)) .relatedProcessDescriptor(createProcessDescriptor(ProductsToPick_SetPackingInstructions.class)) .relatedProcessDescriptor(createProcessDescriptor(ProductsToPick_Request4EyesReview.class)) + .relatedProcessDescriptor(createProcessDescriptor(ProductsToPick_PickAndPackSelected.class)) // // Reviewer processes: .relatedProcessDescriptor(createProcessDescriptor(ProductsToPick_4EyesReview_ProcessAll.class)) diff --git a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPickViewBasedProcess.java b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPickViewBasedProcess.java index 0deabe4157f..5b7c85fde56 100644 --- a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPickViewBasedProcess.java +++ b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPickViewBasedProcess.java @@ -1,30 +1,8 @@ -package de.metas.ui.web.pickingV2.productsToPick.process; - -import java.util.List; -import java.util.stream.Stream; - -import org.springframework.beans.factory.annotation.Autowired; - -import com.google.common.collect.ImmutableList; - -import de.metas.handlingunits.picking.PickingCandidate; -import de.metas.process.IProcessPrecondition; -import de.metas.process.ProcessPreconditionsResolution; -import de.metas.ui.web.pickingV2.PickingConstantsV2; -import de.metas.ui.web.pickingV2.config.PickingConfigRepositoryV2; -import de.metas.ui.web.pickingV2.config.PickingConfigV2; -import de.metas.ui.web.pickingV2.productsToPick.ProductsToPickView; -import de.metas.ui.web.pickingV2.productsToPick.rows.ProductsToPickRow; -import de.metas.ui.web.process.adprocess.ViewBasedProcessTemplate; -import de.metas.ui.web.window.datatypes.DocumentId; -import de.metas.ui.web.window.datatypes.DocumentIdsSelection; -import lombok.NonNull; - /* * #%L * metasfresh-webui-api * %% - * Copyright (C) 2018 metas GmbH + * Copyright (C) 2020 metas GmbH * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -42,25 +20,29 @@ * #L% */ +package de.metas.ui.web.pickingV2.productsToPick.process; + +import com.google.common.collect.ImmutableList; +import de.metas.handlingunits.picking.PickingCandidate; +import de.metas.process.IProcessPrecondition; +import de.metas.process.ProcessPreconditionsResolution; +import de.metas.ui.web.pickingV2.PickingConstantsV2; +import de.metas.ui.web.pickingV2.productsToPick.ProductsToPickView; +import de.metas.ui.web.pickingV2.productsToPick.rows.ProductsToPickRow; +import de.metas.ui.web.pickingV2.productsToPick.rows.WebuiPickHUResult; +import de.metas.ui.web.process.adprocess.ViewBasedProcessTemplate; +import de.metas.ui.web.window.datatypes.DocumentId; +import de.metas.ui.web.window.datatypes.DocumentIdsSelection; +import lombok.NonNull; + +import java.util.List; +import java.util.stream.Stream; + public abstract class ProductsToPickViewBasedProcess extends ViewBasedProcessTemplate implements IProcessPrecondition { - @Autowired - private PickingConfigRepositoryV2 pickingConfigRepo; - private PickingConfigV2 _pickingConfig; // lazy - @Override protected abstract ProcessPreconditionsResolution checkPreconditionsApplicable(); - protected final PickingConfigV2 getPickingConfig() - { - PickingConfigV2 pickingConfig = _pickingConfig; - if (pickingConfig == null) - { - pickingConfig = _pickingConfig = pickingConfigRepo.getPickingConfig(); - } - return pickingConfig; - } - protected final boolean isPickerProfile() { return getViewProfileId() == null; @@ -102,4 +84,8 @@ protected void updateViewRowFromPickingCandidate(@NonNull final DocumentId rowId getView().updateViewRowFromPickingCandidate(rowId, pickingCandidate); } + protected void updateViewRowFromPickingCandidate(@NonNull final ImmutableList pickHUResults) + { + pickHUResults.forEach(r -> updateViewRowFromPickingCandidate(r.getDocumentId(), r.getPickingCandidate())); + } } diff --git a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_PickAndPackSelected.java b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_PickAndPackSelected.java new file mode 100644 index 00000000000..bee8bc96503 --- /dev/null +++ b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_PickAndPackSelected.java @@ -0,0 +1,106 @@ +/* + * #%L + * metasfresh-webui-api + * %% + * Copyright (C) 2020 metas GmbH + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * . + * #L% + */ + +package de.metas.ui.web.pickingV2.productsToPick.process; + +import com.google.common.collect.ImmutableList; +import de.metas.handlingunits.HuPackingInstructionsId; +import de.metas.handlingunits.IHandlingUnitsDAO; +import de.metas.handlingunits.model.I_M_HU_PI; +import de.metas.i18n.AdMessageKey; +import de.metas.process.ProcessPreconditionsResolution; +import de.metas.process.RunOutOfTrx; +import de.metas.ui.web.pickingV2.productsToPick.rows.ProductsToPickRowsService; +import de.metas.ui.web.pickingV2.productsToPick.rows.WebuiPickHUResult; +import de.metas.util.Services; +import lombok.NonNull; +import org.adempiere.exceptions.AdempiereException; +import org.compiere.SpringContextHolder; + +public class ProductsToPick_PickAndPackSelected extends ProductsToPickViewBasedProcess +{ + private final ProductsToPickRowsService rowsService = SpringContextHolder.instance.getBean(ProductsToPickRowsService.class); + + private final AdMessageKey MSG_SET_DEFAULT_PACKING_INSTRUCTION = AdMessageKey.of("de.metas.ui.web.pickingV2.productsToPick.process.ProductsToPick_PickAndPackSelected.SetDefaultPackingInstruction"); + private final IHandlingUnitsDAO handlingUnitsDAO = Services.get(IHandlingUnitsDAO.class); + + @Override + protected ProcessPreconditionsResolution checkPreconditionsApplicable() + { + if (!isPickerProfile()) + { + return ProcessPreconditionsResolution.rejectWithInternalReason("only picker shall pick"); + } + + if (!rowsService.anyRowsEligibleForPicking(getSelectedRows())) + { + return ProcessPreconditionsResolution.rejectWithInternalReason("select only rows that can be picked"); + } + + return ProcessPreconditionsResolution.accept(); + } + + @Override + @RunOutOfTrx + protected String doIt() + { + ensureDefaultPackingInstructionExists(); + pick(); + pack(); + + invalidateView(); + + return MSG_OK; + } + + private void pick() + { + final ImmutableList result = rowsService.pick(getSelectedRows()); + + updateViewRowFromPickingCandidate(result); + } + + private void pack() + { + final ImmutableList result = rowsService.setPackingInstruction(getSelectedRows(), getHuPackingInstructionsId()); + + updateViewRowFromPickingCandidate(result); + } + + @NonNull + private HuPackingInstructionsId getHuPackingInstructionsId() + { + final I_M_HU_PI defaultPIForPicking = handlingUnitsDAO.retrievePIDefaultForPicking(); + if (defaultPIForPicking == null) + { + throw new AdempiereException(MSG_SET_DEFAULT_PACKING_INSTRUCTION); + } + + return HuPackingInstructionsId.ofRepoId(defaultPIForPicking.getM_HU_PI_ID()); + } + + private void ensureDefaultPackingInstructionExists() + { + getHuPackingInstructionsId(); + } + +} diff --git a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_PickSelected.java b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_PickSelected.java index 5744ce2efb0..c073b31669a 100644 --- a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_PickSelected.java +++ b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_PickSelected.java @@ -1,23 +1,8 @@ -package de.metas.ui.web.pickingV2.productsToPick.process; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; - -import de.metas.handlingunits.picking.PickingCandidateService; -import de.metas.handlingunits.picking.candidate.commands.PickHUResult; -import de.metas.handlingunits.picking.requests.PickRequest; -import de.metas.process.ProcessPreconditionsResolution; -import de.metas.process.RunOutOfTrx; -import de.metas.ui.web.pickingV2.config.PickingConfigV2; -import de.metas.ui.web.pickingV2.productsToPick.rows.ProductsToPickRow; -import de.metas.ui.web.pickingV2.productsToPick.rows.ProductsToPickRowsService; - /* * #%L * metasfresh-webui-api * %% - * Copyright (C) 2018 metas GmbH + * Copyright (C) 2020 metas GmbH * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -35,13 +20,18 @@ * #L% */ +package de.metas.ui.web.pickingV2.productsToPick.process; + +import com.google.common.collect.ImmutableList; +import de.metas.process.ProcessPreconditionsResolution; +import de.metas.process.RunOutOfTrx; +import de.metas.ui.web.pickingV2.productsToPick.rows.ProductsToPickRowsService; +import de.metas.ui.web.pickingV2.productsToPick.rows.WebuiPickHUResult; +import org.compiere.SpringContextHolder; + public class ProductsToPick_PickSelected extends ProductsToPickViewBasedProcess { - @Autowired - private PickingCandidateService pickingCandidatesService; - - @Autowired - private ProductsToPickRowsService productsToPickRowsService; + private final ProductsToPickRowsService rowsService = SpringContextHolder.instance.getBean(ProductsToPickRowsService.class); @Override protected ProcessPreconditionsResolution checkPreconditionsApplicable() @@ -51,13 +41,7 @@ protected ProcessPreconditionsResolution checkPreconditionsApplicable() return ProcessPreconditionsResolution.rejectWithInternalReason("only picker shall pick"); } - final List selectedRows = getSelectedRows(); - if (selectedRows.isEmpty()) - { - return ProcessPreconditionsResolution.rejectBecauseNoSelection(); - } - - if (!selectedRows.stream().allMatch(ProductsToPickRow::isEligibleForPicking)) + if (!rowsService.anyRowsEligibleForPicking(getSelectedRows())) { return ProcessPreconditionsResolution.rejectWithInternalReason("select only rows that can be picked"); } @@ -69,27 +53,12 @@ protected ProcessPreconditionsResolution checkPreconditionsApplicable() @RunOutOfTrx protected String doIt() { - getSelectedRows() - .stream() - .filter(ProductsToPickRow::isEligibleForPicking) - .forEach(this::pickRow); + final ImmutableList result = rowsService.pick(getSelectedRows()); + + updateViewRowFromPickingCandidate(result); invalidateView(); return MSG_OK; } - - private void pickRow(final ProductsToPickRow row) - { - final PickHUResult result = pickingCandidatesService.pickHU(createPickRequest(row)); - - updateViewRowFromPickingCandidate(row.getId(), result.getPickingCandidate()); - } - - private PickRequest createPickRequest(final ProductsToPickRow row) - { - final PickingConfigV2 pickingConfig = getPickingConfig(); - return productsToPickRowsService.createPickRequest(row, pickingConfig.isPickingReviewRequired()); - } - } diff --git a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_SetPackingInstructions.java b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_SetPackingInstructions.java index ec1830eb2ae..dded082f317 100644 --- a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_SetPackingInstructions.java +++ b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/process/ProductsToPick_SetPackingInstructions.java @@ -1,50 +1,39 @@ -package de.metas.ui.web.pickingV2.productsToPick.process; - -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Stream; - -import org.springframework.beans.factory.annotation.Autowired; - -import com.google.common.collect.ImmutableMap; - -import de.metas.handlingunits.HuPackingInstructionsId; -import de.metas.handlingunits.picking.PickingCandidate; -import de.metas.handlingunits.picking.PickingCandidateId; -import de.metas.handlingunits.picking.PickingCandidateService; -import de.metas.process.Param; -import de.metas.process.ProcessPreconditionsResolution; -import de.metas.process.RunOutOfTrx; -import de.metas.ui.web.pickingV2.productsToPick.rows.ProductsToPickRow; -import de.metas.ui.web.window.datatypes.DocumentId; - /* * #%L * metasfresh-webui-api * %% - * Copyright (C) 2018 metas GmbH + * Copyright (C) 2020 metas GmbH * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * . * #L% */ +package de.metas.ui.web.pickingV2.productsToPick.process; + +import com.google.common.collect.ImmutableList; +import de.metas.handlingunits.HuPackingInstructionsId; +import de.metas.process.Param; +import de.metas.process.ProcessPreconditionsResolution; +import de.metas.process.RunOutOfTrx; +import de.metas.ui.web.pickingV2.productsToPick.rows.ProductsToPickRowsService; +import de.metas.ui.web.pickingV2.productsToPick.rows.WebuiPickHUResult; +import org.compiere.SpringContextHolder; + public class ProductsToPick_SetPackingInstructions extends ProductsToPickViewBasedProcess { - @Autowired - private PickingCandidateService pickingCandidateService; + private final ProductsToPickRowsService rowsService = SpringContextHolder.instance.getBean(ProductsToPickRowsService.class); @Param(parameterName = "M_HU_PI_ID", mandatory = true) private int p_M_HU_PI_ID; @@ -56,8 +45,8 @@ protected ProcessPreconditionsResolution checkPreconditionsApplicable() { return ProcessPreconditionsResolution.rejectWithInternalReason("only picker shall pack"); } - - if (!streamRowsEligibleForPacking().findAny().isPresent()) + + if (!rowsService.anyRowsEligibleForPacking(getSelectedRows())) { return ProcessPreconditionsResolution.rejectWithInternalReason("no eligible rows were selected"); } @@ -69,30 +58,15 @@ protected ProcessPreconditionsResolution checkPreconditionsApplicable() @RunOutOfTrx protected String doIt() { - final Map rowIdsByPickingCandidateId = streamRowsEligibleForPacking() - .collect(ImmutableMap.toImmutableMap(ProductsToPickRow::getPickingCandidateId, ProductsToPickRow::getId)); - - final Set pickingCandidateIds = rowIdsByPickingCandidateId.keySet(); - final HuPackingInstructionsId huPackingInstructionsId = getHuPackingInstructionsId(); - final List pickingCandidates = pickingCandidateService.setHuPackingInstructionId(pickingCandidateIds, huPackingInstructionsId); + final ImmutableList result = rowsService.setPackingInstruction(getSelectedRows(), getHuPackingInstructionsId()); - pickingCandidates.forEach(pickingCandidate -> { - final DocumentId rowId = rowIdsByPickingCandidateId.get(pickingCandidate.getId()); - updateViewRowFromPickingCandidate(rowId, pickingCandidate); - }); + updateViewRowFromPickingCandidate(result); invalidateView(); return MSG_OK; } - private Stream streamRowsEligibleForPacking() - { - return getSelectedRows() - .stream() - .filter(ProductsToPickRow::isEligibleForPacking); - } - private HuPackingInstructionsId getHuPackingInstructionsId() { return HuPackingInstructionsId.ofRepoId(p_M_HU_PI_ID); diff --git a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/rows/ProductsToPickRowsService.java b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/rows/ProductsToPickRowsService.java index e53e9bbafad..99c472908bd 100644 --- a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/rows/ProductsToPickRowsService.java +++ b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/rows/ProductsToPickRowsService.java @@ -1,18 +1,15 @@ package de.metas.ui.web.pickingV2.productsToPick.rows; -import java.util.List; - -import org.adempiere.exceptions.AdempiereException; -import org.compiere.model.I_M_Locator; -import org.springframework.stereotype.Service; - import com.google.common.collect.ImmutableList; - +import com.google.common.collect.ImmutableMap; import de.metas.bpartner.service.IBPartnerBL; import de.metas.handlingunits.HuId; +import de.metas.handlingunits.HuPackingInstructionsId; import de.metas.handlingunits.picking.PickFrom; import de.metas.handlingunits.picking.PickingCandidate; +import de.metas.handlingunits.picking.PickingCandidateId; import de.metas.handlingunits.picking.PickingCandidateService; +import de.metas.handlingunits.picking.candidate.commands.PickHUResult; import de.metas.handlingunits.picking.requests.PickRequest; import de.metas.handlingunits.picking.requests.PickRequest.IssueToPickingOrderRequest; import de.metas.handlingunits.reservation.HUReservationService; @@ -23,9 +20,18 @@ import de.metas.ui.web.pickingV2.config.PickingConfigV2; import de.metas.ui.web.pickingV2.packageable.PackageableRow; import de.metas.ui.web.pickingV2.productsToPick.rows.factory.ProductsToPickRowsDataFactory; +import de.metas.ui.web.window.datatypes.DocumentId; import de.metas.ui.web.window.model.lookup.LookupDataSourceFactory; import de.metas.util.Services; import lombok.NonNull; +import org.adempiere.exceptions.AdempiereException; +import org.compiere.model.I_M_Locator; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; /* * #%L @@ -56,7 +62,7 @@ public class ProductsToPickRowsService private final IBPartnerBL bpartnersService; private final HUReservationService huReservationService; private final PickingCandidateService pickingCandidateService; - + private static final AdMessageKey MSG_TYPE_UNALLOCATED = AdMessageKey.of("de.metas.ui.web.pickingV2.productsToPick.rows.ProductsToPickRowsService.UnAllocated_Type_Error"); private static final AdMessageKey MSG_TYPE_NOT_SUPPORTED = AdMessageKey.of("de.metas.ui.web.pickingV2.productsToPick.rows.ProductsToPickRowsService.TypeRow_NotSupported"); @@ -124,13 +130,13 @@ else if (ProductsToPickRowType.UNALLOCABLE.equals(rowType)) { final ITranslatableString message = Services.get(IMsgBL.class) .getTranslatableMsgText(MSG_TYPE_UNALLOCATED); - throw new AdempiereException(message); + throw new AdempiereException(message); } else { final ITranslatableString message = Services.get(IMsgBL.class) .getTranslatableMsgText(MSG_TYPE_NOT_SUPPORTED); - throw new AdempiereException(message); + throw new AdempiereException(message); } } @@ -159,4 +165,64 @@ public List createPickingCandidates(@NonNull final Packageable .collect(ImmutableList.toImmutableList()); } + @NonNull + public ImmutableList pick(final List selectedRows) + { + return streamRowsEligibleForPicking(selectedRows) + .map(row -> { + final PickHUResult result = pickingCandidateService.pickHU(createPickRequest(row)); + return WebuiPickHUResult.of(row.getId(), result.getPickingCandidate()); + }) + .collect(ImmutableList.toImmutableList()); + } + + public ImmutableList setPackingInstruction(final List selectedRows, final HuPackingInstructionsId huPackingInstructionsId) + { + final Map rowIdsByPickingCandidateId = streamRowsEligibleForPacking(selectedRows) + .collect(ImmutableMap.toImmutableMap(ProductsToPickRow::getPickingCandidateId, ProductsToPickRow::getId)); + + final Set pickingCandidateIds = rowIdsByPickingCandidateId.keySet(); + final List pickingCandidates = pickingCandidateService.setHuPackingInstructionId(pickingCandidateIds, huPackingInstructionsId); + + return pickingCandidates.stream() + .map(cand -> WebuiPickHUResult.of(rowIdsByPickingCandidateId.get(cand.getId()), cand)) + .collect(ImmutableList.toImmutableList()); + + } + + public boolean anyRowsEligibleForPacking(final List selectedRows) + { + return streamRowsEligibleForPacking(selectedRows).findAny().isPresent(); + } + + private Stream streamRowsEligibleForPacking(final List selectedRows) + { + return selectedRows + .stream() + .filter(ProductsToPickRow::isEligibleForPacking); + } + + public boolean anyRowsEligibleForPicking(final List selectedRows) + { + return streamRowsEligibleForPicking(selectedRows).findAny().isPresent(); + } + + @NonNull + private Stream streamRowsEligibleForPicking(final List selectedRows) + { + return selectedRows + .stream() + .filter(ProductsToPickRow::isEligibleForPicking); + } + + private PickRequest createPickRequest(final ProductsToPickRow row) + { + final PickingConfigV2 pickingConfig = getPickingConfig(); + return createPickRequest(row, pickingConfig.isPickingReviewRequired()); + } + + protected final PickingConfigV2 getPickingConfig() + { + return pickingConfigRepo.getPickingConfig(); + } } diff --git a/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/rows/WebuiPickHUResult.java b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/rows/WebuiPickHUResult.java new file mode 100644 index 00000000000..a3e09cd444e --- /dev/null +++ b/backend/metasfresh-webui-api/src/main/java/de/metas/ui/web/pickingV2/productsToPick/rows/WebuiPickHUResult.java @@ -0,0 +1,35 @@ +/* + * #%L + * metasfresh-webui-api + * %% + * Copyright (C) 2020 metas GmbH + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * . + * #L% + */ + +package de.metas.ui.web.pickingV2.productsToPick.rows; + +import de.metas.handlingunits.picking.PickingCandidate; +import de.metas.ui.web.window.datatypes.DocumentId; +import lombok.NonNull; +import lombok.Value; + +@Value(staticConstructor = "of") +public class WebuiPickHUResult +{ + @NonNull DocumentId documentId; + @NonNull PickingCandidate pickingCandidate; +}