Skip to content

Commit

Permalink
QCADOOCLS-5723
Browse files Browse the repository at this point in the history
  • Loading branch information
krna committed Sep 15, 2017
1 parent 25027d2 commit dfa9f71
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 1 deletion.
Expand Up @@ -1237,7 +1237,7 @@ productionCounting.productionBalance.report.xls.sheet.materialCosts = Koszty mat
productionCounting.productionBalance.report.xls.sheet.materialCosts.orderNumber = Numer zlecenia
productionCounting.productionBalance.report.xls.sheet.materialCosts.operationNumber = Numer operacji
productionCounting.productionBalance.report.xls.sheet.materialCosts.productNumber = Numer produktu
productionCounting.productionBalance.report.xls.sheet.materialCosts.productName = Nazwa produtku
productionCounting.productionBalance.report.xls.sheet.materialCosts.productName = Nazwa produktu
productionCounting.productionBalance.report.xls.sheet.materialCosts.plannedQuantity = Ilość planowana
productionCounting.productionBalance.report.xls.sheet.materialCosts.usedQuantity = Ilość zużyta
productionCounting.productionBalance.report.xls.sheet.materialCosts.quantitativeDeviation = Odchylenie ilościowe
Expand Down
Expand Up @@ -61,4 +61,5 @@ private OperationFields() {

public static final String PRODUCTION_LINE = "productionLine";

public static final String PRODUCT = "product";
}
Expand Up @@ -23,8 +23,10 @@
*/
package com.qcadoo.mes.technologies.hooks;

import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -60,6 +62,7 @@ public class TechnologyOperationComponentHooks {
public void onCreate(final DataDefinition technologyOperationComponentDD, final Entity technologyOperationComponent) {
copyCommentAndAttachmentFromOperation(technologyOperationComponent);
setParentIfRootNodeAlreadyExists(technologyOperationComponent);
setOperationOutProduct(technologyOperationComponent);
copyReferencedTechnology(technologyOperationComponentDD, technologyOperationComponent);
copyWorkstationsSettingsFromOperation(technologyOperationComponent);
}
Expand Down Expand Up @@ -110,6 +113,27 @@ private void setParentIfRootNodeAlreadyExists(final Entity technologyOperationCo
technologyOperationComponent.setField(TechnologyOperationComponentFields.PARENT, rootNode);
}

private void setOperationOutProduct(Entity technologyOperationComponent) {
Entity technology = technologyOperationComponent.getBelongsToField(TechnologyOperationComponentFields.TECHNOLOGY);
EntityTree tree = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS);
DataDefinition opocDD = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER,
TechnologiesConstants.MODEL_OPERATION_PRODUCT_OUT_COMPONENT);
Entity opoc = opocDD.create();
opoc.setField(OperationProductOutComponentFields.QUANTITY, 1);
opoc.setField(OperationProductOutComponentFields.SET, false);
if(tree == null || tree.isEmpty()){
opoc.setField(OperationProductOutComponentFields.PRODUCT, technology.getBelongsToField(TechnologyFields.PRODUCT));
technologyOperationComponent.setField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS, Collections.singletonList(opoc));
} else {
Entity operation = technologyOperationComponent.getBelongsToField(TechnologyOperationComponentFields.OPERATION);
Entity product = operation.getBelongsToField(OperationFields.PRODUCT);
if(!Objects.isNull(product)){
opoc.setField(OperationProductOutComponentFields.PRODUCT, product);
technologyOperationComponent.setField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS, Collections.singletonList(opoc));
}
}
}

private void copyReferencedTechnology(final DataDefinition technologyOperationComponentDD,
final Entity technologyOperationComponent) {
if (!TechnologyOperationComponentFields.REFERENCE_TECHNOLOGY
Expand Down
Expand Up @@ -55,6 +55,11 @@ technologies.technology.additionalActions.label =

technologies.operation.attachment.label = Anhang

technologies.operation.product.label = Produkt

technologies.operation.product.label.focus = die Nummer von einem Produkt einführen
technologies.operationDetails.window.mainTab.operation.product.description =

technologies.operation.operationGroup.label = Gruppe

technologies.operation.division.label = Abteilung
Expand Down
Expand Up @@ -44,6 +44,9 @@ technologies.operation.name.label = Name
technologies.operation.operationGroup.label.focus = Insert operation group number
technologies.operation.comment.label = Description
technologies.operation.attachment.label = Attachment
technologies.operation.product.label = Product
technologies.operation.product.label.focus = Insert product number
technologies.operationDetails.window.mainTab.operation.product.description = Specify the product that is the result of the operation. We will insert it when building a technology tree.
technologies.operation.operationGroup.label = Group
technologies.operation.division.label = Division
technologies.operation.productionLine.label = Production line
Expand Down
Expand Up @@ -44,6 +44,9 @@ technologies.operation.name.label = Nazwa
technologies.operation.operationGroup.label.focus = Wprowadź numer grupy operacji
technologies.operation.comment.label = Opis
technologies.operation.attachment.label = Załącznik
technologies.operation.product.label = Produkt
technologies.operation.product.label.focus = Wprowadź numer produktu
technologies.operationDetails.window.mainTab.operation.product.description = Podaj produkt będący efektem operacji. Podpowiemy go przy budowaniu drzewa technologii.
technologies.operation.operationGroup.label = Grupa
technologies.operation.division.label = Dział
technologies.operation.productionLine.label = Linia produkcyjna
Expand Down
Expand Up @@ -61,6 +61,7 @@
<enum name="assignedToOperation" values="01workstations,02workstationTypes"
default="01workstations" required="true"/>

<belongsTo name="product" plugin="basic" model="product"/>
<belongsTo name="workstationType" plugin="basic" model="workstationType"/>
<belongsTo name="division" plugin="basic" model="division"/>
<belongsTo name="productionLine" model="productionLine" plugin="productionLines"/>
Expand Down
Expand Up @@ -60,6 +60,21 @@
<layoutElement column="1" row="4">
<component type="file" name="attachment" field="attachment"/>
</layoutElement>
<layoutElement column="1" row="5">
<component type="lookup" name="product" field="product"
reference="product" hasDescription="true">
<option type="column" name="name" fields="name" link="true"
width="200"/>
<option type="column" name="ean" fields="ean"/>

<option type="searchable" value="name,ean"/>
<option type="orderable" value="name,ean"/>

<option type="expression"
value="'&lt;b&gt;' + #number + '&lt;/b&gt; - ' + #name"/>
<option type="fieldCode" value="number"/>
</component>
</layoutElement>
<layoutElement column="2" row="1" height="2">
<component type="textarea" name="comment" field="comment"/>
</layoutElement>
Expand Down

0 comments on commit dfa9f71

Please sign in to comment.