-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #10325 Add New label for manufacturing order * #10325 Minor * #10235 Fix process name * #10235 Improve process * #10235 Fix report name * #10325 Add a general label
- Loading branch information
1 parent
23a1eb4
commit 7562108
Showing
4 changed files
with
312 additions
and
1 deletion.
There are no files selected for viewing
157 changes: 157 additions & 0 deletions
157
...h/de.metas.fresh.base/src/main/jasperreports/de/metas/docs/manufacturingorder/label.jrxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Created with Jaspersoft Studio version 6.2.2.final using JasperReports Library version 6.2.2 --> | ||
<!-- 2017-09-13T13:30:35 --> | ||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="label" pageWidth="156" pageHeight="284" columnWidth="156" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" resourceBundle="de/metas/docs/label/cu_manufacturing/report" uuid="76f10556-26bf-42e7-b375-0391b4cedd84"> | ||
<property name="com.jaspersoft.studio.unit." value="pixel"/> | ||
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="metasfresh"/> | ||
<property name="com.jaspersoft.studio.data.sql.tables" value=""/> | ||
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> | ||
<defaultValueExpression><![CDATA[".\\"]]></defaultValueExpression> | ||
</parameter> | ||
<parameter name="m_hu_id" class="java.math.BigDecimal"> | ||
<parameterDescription><![CDATA[]]></parameterDescription> | ||
</parameter> | ||
<parameter name="pp_order_id" class="java.math.BigDecimal"/> | ||
<queryString> | ||
<![CDATA[SELECT * FROM report.cu_label( $P{m_hu_id}, $P{pp_order_id})]]> | ||
</queryString> | ||
<field name="p_name" class="java.lang.String"/> | ||
<field name="p_name_trl" class="java.lang.String"/> | ||
<field name="qty" class="java.math.BigDecimal"/> | ||
<field name="p_value" class="java.lang.String"/> | ||
<field name="p_description" class="java.lang.String"/> | ||
<field name="ingredient" class="java.lang.String"/> | ||
<field name="ingredient_trl" class="java.lang.String"/> | ||
<field name="best_before" class="java.lang.String"/> | ||
<field name="temperature" class="java.lang.String"/> | ||
<field name="org_address" class="java.lang.String"/> | ||
<field name="lot_nr" class="java.lang.String"/> | ||
<field name="isbio" class="java.lang.String"/> | ||
<field name="upc" class="java.lang.String"/> | ||
<background> | ||
<band splitType="Stretch"/> | ||
</background> | ||
<detail> | ||
<band height="284" splitType="Stretch"> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="70" width="140" height="12" uuid="e66e65da-d363-4774-a4bd-bfdd3a8fc1f1"/> | ||
<textElement> | ||
<font size="9" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$R{p_value} + $F{p_value}]]></textFieldExpression> | ||
</textField> | ||
<textField isStretchWithOverflow="true" isBlankWhenNull="true"> | ||
<reportElement x="8" y="5" width="140" height="34" uuid="b6519ef1-11d8-4327-8dc4-4df64a2edc60"> | ||
<property name="com.jaspersoft.studio.unit.height" value="pixel"/> | ||
</reportElement> | ||
<textElement verticalAlignment="Bottom"> | ||
<font size="13" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$F{p_name}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="58" width="140" height="12" uuid="7e2b7596-5cb4-4564-b08d-e42b987b7f32"/> | ||
<textElement> | ||
<font size="9" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$F{qty} + " Kg"]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="82" width="140" height="7" uuid="40f7a3f9-5a8a-4afb-9a63-735a4ec66a5a"/> | ||
<textElement> | ||
<font size="5" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$F{p_description}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="93" width="140" height="46" uuid="efb42090-528b-4071-81c2-0441bf21a2cf"/> | ||
<textElement> | ||
<font size="8" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$R{ingredient} +" " + $F{ingredient}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="143" width="140" height="46" uuid="353017bb-a37b-4354-a848-c3eb81a145e3"> | ||
<property name="com.jaspersoft.studio.unit.height" value="pixel"/> | ||
</reportElement> | ||
<textElement> | ||
<font size="8" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$R{ingredient_fr} +" " + $F{ingredient_trl}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="192" width="80" height="8" uuid="da6df427-aa40-450a-b8b4-f361b9006336"/> | ||
<textElement> | ||
<font size="6" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$R{best_before}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="201" width="80" height="8" uuid="cd17e7bc-5d1e-4503-bba5-fcce8c945b5a"/> | ||
<textElement> | ||
<font size="6" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$R{best_before_fr}]]></textFieldExpression> | ||
</textField> | ||
<textField> | ||
<reportElement x="88" y="192" width="60" height="17" uuid="8e331d2b-0aa7-4aa3-b080-0267de138dc6"/> | ||
<textElement verticalAlignment="Bottom"> | ||
<font size="9" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$F{best_before}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="210" width="100" height="8" uuid="9656f03b-a678-44db-a8e1-f5ea4e56d072"/> | ||
<textElement> | ||
<font size="6" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$R{temperature} +" / "+ "conserver à: " + $F{temperature}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="219" width="100" height="8" uuid="805585ae-8622-4337-90ac-02981ddf845c"/> | ||
<textElement> | ||
<font size="6" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$R{manufacturer} + " / " + $R{manufacturer_fr} + " / " + $R{manufacturer_it}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="228" width="100" height="8" uuid="4126d0cd-d110-4420-84ec-4afe4fcd8e6c"/> | ||
<textElement> | ||
<font size="6" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$F{org_address}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="115" y="192" width="10" height="71" isPrintWhenDetailOverflows="true" uuid="91ebce25-a8dd-4be8-805a-617a8684eb9e"> | ||
<property name="com.jaspersoft.studio.unit.width" value="pixel"/> | ||
</reportElement> | ||
<textElement rotation="Left"> | ||
<font size="6" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$F{lot_nr}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="50" width="140" height="8" uuid="37b9c391-4a48-4aba-b062-58011ae3cdbe"/> | ||
<textElement> | ||
<font size="6" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$F{isbio}.equals("N") ? "" : $R{bio}]]></textFieldExpression> | ||
</textField> | ||
<textField isBlankWhenNull="true"> | ||
<reportElement x="8" y="40" width="140" height="10" uuid="fa7e671c-1e54-47d7-b5c6-db7b7621261b"/> | ||
<textElement> | ||
<font size="7" fontName="Arial" isBold="true"/> | ||
</textElement> | ||
<textFieldExpression><![CDATA[$F{p_name_trl}]]></textFieldExpression> | ||
</textField> | ||
<componentElement> | ||
<reportElement x="8" y="243" width="92" height="27" uuid="79c7b69b-f78d-4c95-bd44-070092e0bf73"> | ||
<printWhenExpression><![CDATA[Boolean.valueOf($F{upc}.length()>0)]]></printWhenExpression> | ||
</reportElement> | ||
<jr:EAN13 xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" checksumMode="ignore"> | ||
<jr:codeExpression><![CDATA[$F{upc}]]></jr:codeExpression> | ||
</jr:EAN13> | ||
</componentElement> | ||
</band> | ||
</detail> | ||
</jasperReport> |
20 changes: 20 additions & 0 deletions
20
...l/system/75-de.metas.fresh.reports/5573460_sys_gh10325_AddLableReportForManufacturing.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- 2020-11-26T15:57:20.693Z | ||
-- 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,Description,EntityType,IsActive,IsApplySecuritySettings,IsBetaFunctionality,IsDirectPrint,IsNotifyUserAfterExecution,IsOneInstanceOnly,IsReport,IsServerProcess,IsTranslateExcelHeaders,IsUseBPartnerLanguage,LockWaitTimeout,Name,PostgrestResponseFormat,RefreshAllAfterExecution,ShowHelp,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,584767,'N','de.metas.ui.web.pporder.process.WEBUI_PP_Order_PrintLabel','N',TO_TIMESTAMP('2020-11-26 17:57:20','YYYY-MM-DD HH24:MI:SS'),100,'','U','Y','N','N','N','N','N','N','N','Y','Y',0,'Print label','json','N','Y','Java',TO_TIMESTAMP('2020-11-26 17:57:20','YYYY-MM-DD HH24:MI:SS'),100,'WEBUI_PP_Order_PrintLabel') | ||
; | ||
|
||
-- 2020-11-26T15:57:20.714Z | ||
-- 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 t.AD_Process_ID=584767 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-11-26T16:03:54.884Z | ||
-- 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,Description,EntityType,IsActive,IsApplySecuritySettings,IsBetaFunctionality,IsDirectPrint,IsNotifyUserAfterExecution,IsOneInstanceOnly,IsReport,IsServerProcess,IsTranslateExcelHeaders,IsUseBPartnerLanguage,JasperReport,LockWaitTimeout,Name,PostgrestResponseFormat,RefreshAllAfterExecution,ShowHelp,Type,Updated,UpdatedBy,Value) VALUES ('3',0,0,584768,'N','de.metas.report.jasper.client.process.JasperReportStarter','N',TO_TIMESTAMP('2020-11-26 18:03:54','YYYY-MM-DD HH24:MI:SS'),100,'Manufacturing order label 3 segments(jasper)','U','Y','N','Y','Y','N','N','Y','N','Y','Y','@PREFIX@de/metas/docs/manufacturingorder/label.jasper',0,'Manufacturing order label 3 segments','json','N','N','JasperReportsSQL',TO_TIMESTAMP('2020-11-26 18:03:54','YYYY-MM-DD HH24:MI:SS'),100,'label_3_segment') | ||
; | ||
|
||
-- 2020-11-26T16:03:54.889Z | ||
-- 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 t.AD_Process_ID=584768 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) | ||
; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
...sh-webui-api/src/main/java/de/metas/ui/web/pporder/process/WEBUI_PP_Order_PrintLabel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* #%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 | ||
* <http://www.gnu.org/licenses/gpl-2.0.html>. | ||
* #L% | ||
*/ | ||
|
||
package de.metas.ui.web.pporder.process; | ||
|
||
import java.util.List; | ||
|
||
import com.google.common.base.Joiner; | ||
import com.google.common.collect.ImmutableList; | ||
|
||
import de.metas.material.planning.pporder.PPOrderId; | ||
import de.metas.process.AdProcessId; | ||
import de.metas.process.IADPInstanceDAO; | ||
import de.metas.process.IProcessPrecondition; | ||
import de.metas.process.PInstanceId; | ||
import de.metas.process.PInstanceRequest; | ||
import de.metas.process.ProcessInfo; | ||
import de.metas.process.ProcessInfoParameter; | ||
import de.metas.process.ProcessPreconditionsResolution; | ||
import de.metas.process.RunOutOfTrx; | ||
import de.metas.report.client.ReportsClient; | ||
import de.metas.report.server.OutputType; | ||
import de.metas.report.server.ReportResult; | ||
import de.metas.ui.web.pporder.PPOrderLineRow; | ||
import de.metas.util.Services; | ||
import lombok.NonNull; | ||
|
||
public class WEBUI_PP_Order_PrintLabel | ||
extends WEBUI_PP_Order_Template | ||
implements IProcessPrecondition | ||
{ | ||
final private static AdProcessId LabelPdf_AD_Process_ID = AdProcessId.ofRepoId(584768); | ||
final private IADPInstanceDAO adPInstanceDAO = Services.get(IADPInstanceDAO.class); | ||
|
||
@Override | ||
protected ProcessPreconditionsResolution checkPreconditionsApplicable() | ||
{ | ||
if (!getSelectedRowIds().isSingleDocumentId()) | ||
{ | ||
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection(); | ||
} | ||
|
||
return ProcessPreconditionsResolution.accept(); | ||
} | ||
|
||
@Override | ||
@RunOutOfTrx | ||
protected String doIt() throws Exception | ||
{ | ||
|
||
final PPOrderLineRow row = getSingleSelectedRow(); | ||
final ReportResult label = printLabel(row); | ||
|
||
|
||
// preview | ||
getResult().setReportData( | ||
label.getReportContent(), | ||
buildFilename(row), | ||
OutputType.PDF.getContentType()); | ||
|
||
return MSG_OK; | ||
|
||
} | ||
|
||
private ReportResult printLabel(@NonNull final PPOrderLineRow row) | ||
{ | ||
final PInstanceRequest pinstanceRequest = createPInstanceRequest(row); | ||
final PInstanceId pinstanceId = adPInstanceDAO.createADPinstanceAndADPInstancePara(pinstanceRequest); | ||
|
||
final ProcessInfo jasperProcessInfo = ProcessInfo.builder() | ||
.setCtx(getCtx()) | ||
.setAD_Process_ID(LabelPdf_AD_Process_ID) | ||
.setAD_PInstance(adPInstanceDAO.getById(pinstanceId)) | ||
.setReportLanguage(getProcessInfo().getReportLanguage()) | ||
.setJRDesiredOutputType(OutputType.PDF) | ||
.build(); | ||
|
||
final ReportsClient reportsClient = ReportsClient.get(); | ||
return reportsClient.report(jasperProcessInfo); | ||
} | ||
|
||
private PInstanceRequest createPInstanceRequest(@NonNull final PPOrderLineRow row) | ||
{ | ||
final List<ProcessInfoParameter> piParams = ImmutableList.of(ProcessInfoParameter.of("RECORD_ID", getPPOrderID(row))); | ||
|
||
final PInstanceRequest pinstanceRequest = PInstanceRequest.builder() | ||
.processId(LabelPdf_AD_Process_ID) | ||
.processParams(piParams) | ||
.build(); | ||
return pinstanceRequest; | ||
} | ||
|
||
|
||
private int getPPOrderID(@NonNull final PPOrderLineRow row) | ||
{ | ||
return row.getOrderId().getRepoId(); | ||
} | ||
|
||
private String buildFilename(@NonNull final PPOrderLineRow row) | ||
{ | ||
|
||
final String huValue = row.getIssueMethod(); | ||
final String product =row.getPackingInfo(); | ||
|
||
return Joiner.on("_") | ||
.skipNulls() | ||
.join(huValue, product) | ||
+ ".pdf"; | ||
} | ||
|
||
|
||
} |