| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> |
| <!-- ProductAssoc --> |
| <simple-method method-name="createBOMAssoc" short-description="Create Product to Product Association"> |
| <if-empty field="parameters.fromDate"> |
| <now-timestamp field="parameters.fromDate"/> |
| </if-empty> |
| |
| <set field="searchDuplicatedAncestorContext.productId" from-field="parameters.productId"/> |
| <set field="searchDuplicatedAncestorContext.productIdTo" from-field="parameters.productIdTo"/> |
| <if-not-empty field="parameters.fromDate"> |
| <set field="searchDuplicatedAncestorContext.fromDate" from-field="parameters.fromDate" type="Timestamp"/> |
| </if-not-empty> |
| <set field="searchDuplicatedAncestorContext.productAssocTypeId" from-field="parameters.productAssocTypeId"/> |
| <call-service service-name="searchDuplicatedAncestor" in-map-name="searchDuplicatedAncestorContext"> |
| <result-to-field result-name="duplicatedProductAssoc" field="duplicatedProductAssoc"/> |
| </call-service> |
| <if-not-empty field="duplicatedProductAssoc"> |
| <set field="productToProduct[]" from-field="duplicatedProductAssoc.productId"/> |
| <set field="productToProduct[]" from-field="duplicatedProductAssoc.productIdTo"/> |
| <property-to-field property="ManufacturingDuplicatedComponentInBOM" resource="ManufacturingUiLabels" field="errorMessage" arg-list-name="productToProduct"/> |
| <field-to-result field="errorMessage" result-name="errorMessage"/> |
| <return/> |
| </if-not-empty> |
| <set-service-fields service-name="createProductAssoc" map="parameters" to-map="context"/> |
| <call-service service-name="createProductAssoc" in-map-name="context"/> |
| </simple-method> |
| |
| <simple-method method-name="copyBOMAssocs" short-description="Copy BOM associations from one product to another"> |
| <make-value value-field="lookupMap" entity-name="ProductAssoc"/> |
| <set-pk-fields map="parameters" value-field="lookupMap"/> |
| <find-by-and entity-name="ProductAssoc" map="lookupMap" list="assocs"/> |
| <filter-list-by-date list="assocs"/> |
| <iterate list="assocs" entry="assoc"> |
| <set-service-fields service-name="createBOMAssoc" map="assoc" to-map="context"/> |
| <set field="context.productId" from-field="parameters.copyToProductId"/> |
| <call-service service-name="createBOMAssoc" in-map-name="context" break-on-error="false"/> |
| </iterate> |
| </simple-method> |
| |
| <simple-method method-name="eventEditBOM" short-description="Add, update, delete components in BOM"> |
| <if-compare field="parameters.UPDATE_MODE" operator="equals" value="UPDATE"> |
| <set-service-fields service-name="updateProductAssoc" map="parameters" to-map="context"/> |
| <call-map-processor xml-resource="component://manufacturing/minilang/bom/BomMapProcs.xml" |
| processor-name="prepareUpdateBOMAssoc" |
| in-map-name="parameters" out-map-name="context"/> |
| <check-errors/> |
| <call-service service-name="updateProductAssoc" in-map-name="context"/> |
| <check-errors/> |
| </if-compare> |
| <if-compare field="parameters.UPDATE_MODE" operator="equals" value="CREATE"> |
| <set-service-fields service-name="createBOMAssoc" map="parameters" to-map="context"/> |
| <call-map-processor xml-resource="component://manufacturing/minilang/bom/BomMapProcs.xml" |
| processor-name="prepareUpdateBOMAssoc" |
| in-map-name="parameters" out-map-name="context"/> |
| <check-errors/> |
| <call-service service-name="createBOMAssoc" in-map-name="context"> |
| <result-to-field result-name="errorMessage" field="errorMessage"/> |
| </call-service> |
| <if-not-empty field="errorMessage"> |
| <add-error> |
| <fail-message message="${errorMessage}"/> |
| </add-error> |
| </if-not-empty> |
| <!--<check-errors/>--> |
| </if-compare> |
| <if-compare field="parameters.UPDATE_MODE" operator="equals" value="DELETE"> |
| <set-service-fields service-name="deleteProductAssoc" map="parameters" to-map="context"/> |
| <call-map-processor xml-resource="component://manufacturing/minilang/bom/BomMapProcs.xml" |
| processor-name="prepareDeleteProductAssoc" |
| in-map-name="parameters" out-map-name="context"/> |
| <check-errors/> |
| <call-service service-name="deleteProductAssoc" in-map-name="context"/> |
| <check-errors/> |
| </if-compare> |
| <if-compare field="parameters.UPDATE_MODE" operator="equals" value="COPY"> |
| <set-service-fields service-name="copyBOMAssocs" map="parameters" to-map="context"/> |
| <call-service service-name="copyBOMAssocs" in-map-name="context"/> |
| <check-errors/> |
| </if-compare> |
| </simple-method> |
| |
| <simple-method method-name="updateProductManufacturingRule" short-description="Update Manufacturing Rule"> |
| <check-permission permission="MANUFACTURING" action="_UPDATE"> |
| <fail-property resource="ManufacturingUiLabels" property="ManufacturingMachineGroupPermissionError"/> |
| </check-permission> |
| <check-errors/> |
| <make-value value-field="lookupPKMap" entity-name="ProductManufacturingRule"/> |
| <set-pk-fields map="parameters" value-field="lookupPKMap"/> |
| <find-by-primary-key entity-name="ProductManufacturingRule" map="lookupPKMap" value-field="lookedUpValue"/> |
| <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> |
| <store-value value-field="lookedUpValue"/> |
| </simple-method> |
| |
| <simple-method method-name="addProductManufacturingRule" short-description="Create Product Manufacturing Rule"> |
| <check-permission permission="MANUFACTURING" action="_CREATE"> |
| <fail-property resource="ManufacturingUiLabels" property="ManufacturingMachineGroupPermissionError"/> |
| </check-permission> |
| <check-errors/> |
| <make-value value-field="lookupPKMap" entity-name="ProductManufacturingRule"/> |
| <set-pk-fields map="parameters" value-field="lookupPKMap"/> |
| <find-by-primary-key entity-name="ProductManufacturingRule" map="lookupPKMap" value-field="newEntity"/> |
| <if-not-empty field="newEntity.ruleId"> |
| <add-error> |
| <fail-property resource="ManufacturingUiLabels" property="ManufacturingMachineGroupIdAlreadyExist"/> |
| </add-error> |
| <check-errors/> |
| <else> |
| <make-value value-field="newEntity" entity-name="ProductManufacturingRule"/> |
| <if-empty field="parameters.ruleId"> |
| <sequenced-id sequence-name="ProductManufacturingRule" field="parameters.ruleId"/> |
| </if-empty> |
| <set-pk-fields map="parameters" value-field="newEntity"/> |
| <set-nonpk-fields map="parameters" value-field="newEntity"/> |
| <create-value value-field="newEntity"/> |
| </else> |
| </if-not-empty> |
| </simple-method> |
| |
| <simple-method method-name="deleteProductManufacturingRule" short-description="Remove a Product Manufacturing Rule"> |
| <check-permission permission="MANUFACTURING" action="_DELETE"> |
| <fail-property resource="ManufacturingUiLabels" property="ManufacturingCalendarPermissionError"/> |
| </check-permission> |
| <check-errors/> |
| <make-value value-field="lookupPKMap" entity-name="ProductManufacturingRule"/> |
| <set-pk-fields map="parameters" value-field="lookupPKMap"/> |
| <find-by-primary-key entity-name="ProductManufacturingRule" map="lookupPKMap" value-field="lookedUpValue"/> |
| <if-not-empty field="lookedUpValue.ruleId"> |
| <remove-value value-field="lookedUpValue"/> |
| </if-not-empty> |
| </simple-method> |
| |
| </simple-methods> |