(OFBIZ-8744) (OFBIZ-8745) (OFBIZ-8746) (OFBIZ-8748) (OFBIZ-8829) (OFBIZ-8830) (OFBIZ-8907) (OFBIZ-8908) (OFBIZ-8924) (OFBIZ-8925) Thanks: Ankush Upadhyay , Sega patidar , Abhijeet Ashapure for your patches. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1768219 13f79535-47bb-0310-9956-ffa450edef68
1029 lines
62 KiB
XML
1029 lines
62 KiB
XML
<?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">
|
|
<!-- Prerequisite data (available in demo data):
|
|
* PROD_MANUF and related manufacturing setup
|
|
* inventory for MAT_A_COST and MAT_B_COST
|
|
-->
|
|
<simple-method method-name="testProductionRunCreation" short-description="Test the creation of a production run" login-required="false">
|
|
<set field="productId" value="PROD_MANUF"/>
|
|
<set field="facilityId" value="WebStoreWarehouse"/>
|
|
<set field="quantity" value="5.0" type="BigDecimal"/>
|
|
<now-timestamp field="nowTimestamp"/>
|
|
<set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
|
|
|
|
<entity-one entity-name="UserLogin" value-field="userLogin">
|
|
<field-map field-name="userLoginId" value="TestManufAdmin"/>
|
|
</entity-one>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<set field="serviceCtx.pRQuantity" from-field="quantity"/>
|
|
<set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
|
|
<set field="serviceCtx.facilityId" from-field="facilityId"/>
|
|
|
|
<!-- the service that we are going to test -->
|
|
<call-service service-name="createProductionRun" in-map-name="serviceCtx">
|
|
<result-to-field result-name="productionRunId"/>
|
|
</call-service>
|
|
|
|
<!-- the tests -->
|
|
<assert><not><if-empty field="productionRunId"/></not></assert>
|
|
<check-errors/>
|
|
|
|
<entity-one entity-name="WorkEffort" value-field="productionRunHeader">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-one>
|
|
|
|
<assert>
|
|
<if-compare field="productionRunHeader.workEffortTypeId" operator="equals" value="PROD_ORDER_HEADER"/>
|
|
<if-compare-field field="productionRunHeader.facilityId" operator="equals" to-field="facilityId"/>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CREATED"/>
|
|
<if-compare-field field="productionRunHeader.quantityToProduce" operator="equals" to-field="quantity"/>
|
|
<if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunStartDate" type="Timestamp"/>
|
|
<if-compare-field field="productionRunHeader.estimatedStartDate" operator="less" to-field="productionRunHeader.estimatedCompletionDate" type="Timestamp"/>
|
|
</assert>
|
|
|
|
<entity-and entity-name="WorkEffortGoodStandard" list="productionRunProducts">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunProducts" entry="productionRunProduct"/>
|
|
|
|
<assert>
|
|
<not><if-empty field="productionRunProduct"/></not>
|
|
<if-compare-field field="productionRunProduct.productId" operator="equals" to-field="productId"/>
|
|
<if-compare field="productionRunProduct.workEffortGoodStdTypeId" operator="equals" value="PRUN_PROD_DELIV"/>
|
|
<if-compare-field field="productionRunProduct.estimatedQuantity" operator="equals" to-field="quantity"/>
|
|
</assert>
|
|
|
|
<entity-and entity-name="WorkEffort" list="productionRunTasks">
|
|
<field-map field-name="workEffortParentId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunTasks" entry="productionRunTask"/>
|
|
|
|
<assert>
|
|
<not><if-empty field="productionRunTask"/></not>
|
|
<if-compare field="productionRunTask.workEffortTypeId" operator="equals" value="PROD_ORDER_TASK"/>
|
|
<if-compare-field field="productionRunTask.facilityId" operator="equals" to-field="facilityId"/>
|
|
<if-compare field="productionRunTask.fixedAssetId" operator="equals" value="WORKCENTER_COST"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CREATED"/>
|
|
<if-compare-field field="productionRunTask.quantityToProduce" operator="equals" to-field="quantity"/>
|
|
<if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunTask.estimatedStartDate" type="Timestamp"/>
|
|
<if-compare-field field="productionRunHeader.estimatedCompletionDate" operator="equals" to-field="productionRunTask.estimatedCompletionDate" type="Timestamp"/>
|
|
<if-compare field="productionRunTask.estimatedSetupMillis" operator="equals" value="600000.00" type="BigDecimal"/>
|
|
<if-compare field="productionRunTask.estimatedMilliSeconds" operator="equals" value="300000.00" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<!-- Verify that the cost calcs were copied from the routing task to the production run task -->
|
|
<entity-and entity-name="WorkEffortCostCalc" list="costCalcs">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId" />
|
|
</entity-and>
|
|
<first-from-list list="costCalcs" entry="costCalc"/>
|
|
|
|
<assert>
|
|
<not><if-empty field="costCalc" /></not>
|
|
<if-compare field="costCalc.costComponentTypeId" operator="equals" value="OTHER_COST" />
|
|
<if-compare field="costCalc.costComponentCalcId" operator="equals" value="TASK_COST_CALC" />
|
|
</assert>
|
|
|
|
<!-- Verify that the BOM was properly copied to the production run task -->
|
|
<entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
<field-map field-name="productId" value="MAT_A_COST"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunMaterials" entry="productionRunMaterialA"/>
|
|
<assert>
|
|
<not><if-empty field="productionRunMaterialA"/></not>
|
|
<if-compare field="productionRunMaterialA.workEffortGoodStdTypeId" operator="equals" value="PRUNT_PROD_NEEDED"/>
|
|
<if-compare field="productionRunMaterialA.estimatedQuantity" operator="equals" value="${quantity * 2}" type="BigDecimal"/>
|
|
</assert>
|
|
<entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
<field-map field-name="productId" value="MAT_B_COST"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunMaterials" entry="productionRunMaterialB"/>
|
|
<assert>
|
|
<not><if-empty field="productionRunMaterialB"/></not>
|
|
<if-compare field="productionRunMaterialB.workEffortGoodStdTypeId" operator="equals" value="PRUNT_PROD_NEEDED"/>
|
|
<if-compare field="productionRunMaterialB.estimatedQuantity" operator="equals" value="${quantity * 3}" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<check-errors/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="testProductionRunScheduleConfirm" short-description="Test the production run status change to scheduled and confirmed" login-required="false">
|
|
<set field="productId" value="PROD_MANUF"/>
|
|
<set field="facilityId" value="WebStoreWarehouse"/>
|
|
<set field="quantity" value="5.0" type="BigDecimal"/>
|
|
<now-timestamp field="nowTimestamp"/>
|
|
<set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
|
|
|
|
<entity-one entity-name="UserLogin" value-field="userLogin">
|
|
<field-map field-name="userLoginId" value="TestManufAdmin"/>
|
|
</entity-one>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<set field="serviceCtx.pRQuantity" from-field="quantity"/>
|
|
<set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
|
|
<set field="serviceCtx.facilityId" from-field="facilityId"/>
|
|
|
|
<!-- production run #1 -->
|
|
<call-service service-name="createProductionRun" in-map-name="serviceCtx">
|
|
<result-to-field result-name="productionRunId"/>
|
|
</call-service>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_SCHEDULED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
|
|
<!-- the tests -->
|
|
<entity-one entity-name="WorkEffort" value-field="productionRunHeader">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-one>
|
|
<entity-and entity-name="WorkEffort" list="productionRunTasks">
|
|
<field-map field-name="workEffortParentId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunTasks" entry="productionRunTask"/>
|
|
|
|
<assert>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_SCHEDULED"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_SCHEDULED"/>
|
|
</assert>
|
|
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
|
|
<refresh-value value-field="productionRunHeader"/>
|
|
<refresh-value value-field="productionRunTask"/>
|
|
<assert>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_DOC_PRINTED"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_DOC_PRINTED"/>
|
|
</assert>
|
|
|
|
<!-- production run #2 -->
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<set field="serviceCtx.pRQuantity" from-field="quantity"/>
|
|
<set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
|
|
<set field="serviceCtx.facilityId" from-field="facilityId"/>
|
|
|
|
<call-service service-name="createProductionRun" in-map-name="serviceCtx">
|
|
<result-to-field result-name="productionRunId"/>
|
|
</call-service>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
<entity-one entity-name="WorkEffort" value-field="productionRunHeader">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-one>
|
|
<entity-and entity-name="WorkEffort" list="productionRunTasks">
|
|
<field-map field-name="workEffortParentId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunTasks" entry="productionRunTask"/>
|
|
|
|
<assert>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_DOC_PRINTED"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_DOC_PRINTED"/>
|
|
</assert>
|
|
|
|
<check-errors/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="testProductionRunDateChange" short-description="Test the production run start date change" login-required="false">
|
|
<set field="productId" value="PROD_MANUF"/>
|
|
<set field="facilityId" value="WebStoreWarehouse"/>
|
|
<set field="quantity" value="5.0" type="BigDecimal"/>
|
|
<now-timestamp field="nowTimestamp"/>
|
|
<set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
|
|
|
|
<entity-one entity-name="UserLogin" value-field="userLogin">
|
|
<field-map field-name="userLoginId" value="TestManufAdmin"/>
|
|
</entity-one>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<set field="serviceCtx.pRQuantity" from-field="quantity"/>
|
|
<set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
|
|
<set field="serviceCtx.facilityId" from-field="facilityId"/>
|
|
|
|
<call-service service-name="createProductionRun" in-map-name="serviceCtx">
|
|
<result-to-field result-name="productionRunId"/>
|
|
</call-service>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_SCHEDULED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
|
|
<!-- the tests -->
|
|
<entity-one entity-name="WorkEffort" value-field="productionRunHeader">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-one>
|
|
<entity-and entity-name="WorkEffort" list="productionRunTasks">
|
|
<field-map field-name="workEffortParentId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunTasks" entry="productionRunTask"/>
|
|
|
|
<call-class-method class-name="org.apache.ofbiz.base.util.UtilDateTime" method-name="getInterval" ret-field="originalProductionRunEstimatedTime">
|
|
<field field="productionRunHeader.estimatedStartDate" type="Timestamp"/>
|
|
<field field="productionRunHeader.estimatedCompletionDate" type="Timestamp"/>
|
|
</call-class-method>
|
|
|
|
<set-calendar field="productionRunNewStartDate" from-field="nowTimestamp" days="8"/>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.estimatedStartDate" from-field="productionRunNewStartDate"/>
|
|
<call-service service-name="updateProductionRun" in-map-name="serviceCtx"/>
|
|
|
|
<refresh-value value-field="productionRunHeader"/>
|
|
<refresh-value value-field="productionRunTask"/>
|
|
<call-class-method class-name="org.apache.ofbiz.base.util.UtilDateTime" method-name="getInterval" ret-field="newProductionRunEstimatedTime">
|
|
<field field="productionRunHeader.estimatedStartDate" type="Timestamp"/>
|
|
<field field="productionRunHeader.estimatedCompletionDate" type="Timestamp"/>
|
|
</call-class-method>
|
|
<set field="taskTimeDifference" value="${originalProductionRunEstimatedTime - newProductionRunEstimatedTime}" type="Double"/>
|
|
<assert>
|
|
<if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunNewStartDate" type="Timestamp"/>
|
|
<if-compare-field field="productionRunTask.estimatedStartDate" operator="equals" to-field="productionRunNewStartDate" type="Timestamp"/>
|
|
<or>
|
|
<if-compare field="taskTimeDifference" operator="equals" value="0.0" type="Double"/>
|
|
<!-- a difference of +/- 1 or 2 hours is accepted because it could be caused by DST change happening in one of the two time periods -->
|
|
<if-compare field="taskTimeDifference" operator="equals" value="3600000.0" type="Double"/>
|
|
<if-compare field="taskTimeDifference" operator="equals" value="-3600000.0" type="Double"/>
|
|
<if-compare field="taskTimeDifference" operator="equals" value="7200000.0" type="Double"/>
|
|
<if-compare field="taskTimeDifference" operator="equals" value="-7200000.0" type="Double"/>
|
|
</or>
|
|
</assert>
|
|
<check-errors/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="testProductionRunCancelled" short-description="Test the process of cancelling a production run" login-required="false">
|
|
<set field="productId" value="PROD_MANUF"/>
|
|
<set field="facilityId" value="WebStoreWarehouse"/>
|
|
<set field="quantity" value="5.0" type="BigDecimal"/>
|
|
<now-timestamp field="nowTimestamp"/>
|
|
<set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
|
|
|
|
<entity-one entity-name="UserLogin" value-field="userLogin">
|
|
<field-map field-name="userLoginId" value="TestManufAdmin"/>
|
|
</entity-one>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<set field="serviceCtx.pRQuantity" from-field="quantity"/>
|
|
<set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
|
|
<set field="serviceCtx.facilityId" from-field="facilityId"/>
|
|
|
|
<call-service service-name="createProductionRun" in-map-name="serviceCtx">
|
|
<result-to-field result-name="productionRunId"/>
|
|
</call-service>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_SCHEDULED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<call-service service-name="cancelProductionRun" in-map-name="serviceCtx"/>
|
|
|
|
<!-- the tests -->
|
|
<entity-one entity-name="WorkEffort" value-field="productionRunHeader">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-one>
|
|
<entity-and entity-name="WorkEffort" list="productionRunTasks">
|
|
<field-map field-name="workEffortParentId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunTasks" entry="productionRunTask"/>
|
|
|
|
<assert>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CANCELLED"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CANCELLED"/>
|
|
</assert>
|
|
|
|
<entity-and entity-name="WorkEffortGoodStandard" list="productionRunProducts">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunProducts" entry="productionRunProduct"/>
|
|
|
|
<assert>
|
|
<not><if-empty field="productionRunProduct"/></not>
|
|
<if-compare field="productionRunProduct.workEffortGoodStdTypeId" operator="equals" value="PRUN_PROD_DELIV"/>
|
|
<if-compare field="productionRunProduct.statusId" operator="equals" value="WEGS_CANCELLED"/>
|
|
</assert>
|
|
|
|
<entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
<field-map field-name="productId" value="MAT_A_COST"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunMaterials" entry="productionRunMaterialA"/>
|
|
<assert>
|
|
<not><if-empty field="productionRunMaterialA"/></not>
|
|
<if-compare field="productionRunMaterialA.workEffortGoodStdTypeId" operator="equals" value="PRUNT_PROD_NEEDED"/>
|
|
<if-compare field="productionRunMaterialA.statusId" operator="equals" value="WEGS_CANCELLED"/>
|
|
</assert>
|
|
<entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
<field-map field-name="productId" value="MAT_B_COST"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunMaterials" entry="productionRunMaterialB"/>
|
|
<assert>
|
|
<not><if-empty field="productionRunMaterialB"/></not>
|
|
<if-compare field="productionRunMaterialB.workEffortGoodStdTypeId" operator="equals" value="PRUNT_PROD_NEEDED"/>
|
|
<if-compare field="productionRunMaterialB.statusId" operator="equals" value="WEGS_CANCELLED"/>
|
|
</assert>
|
|
|
|
<check-errors/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="testProductionRunQuickIssueAndProduce" short-description="Test the production run quick issuance of materials and production of finished product" login-required="false">
|
|
<set field="productId" value="PROD_MANUF"/>
|
|
<set field="facilityId" value="WebStoreWarehouse"/>
|
|
<set field="quantity" value="2.0" type="BigDecimal"/>
|
|
<now-timestamp field="nowTimestamp"/>
|
|
<set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
|
|
|
|
<entity-one entity-name="UserLogin" value-field="userLogin">
|
|
<field-map field-name="userLoginId" value="TestManufAdmin"/>
|
|
</entity-one>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<set field="serviceCtx.pRQuantity" from-field="quantity"/>
|
|
<set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
|
|
<set field="serviceCtx.facilityId" from-field="facilityId"/>
|
|
|
|
<!-- production run -->
|
|
<call-service service-name="createProductionRun" in-map-name="serviceCtx">
|
|
<result-to-field result-name="productionRunId"/>
|
|
</call-service>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<call-service service-name="quickStartAllProductionRunTasks" in-map-name="serviceCtx"/>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<set field="serviceCtx.currencyUomId" value="USD"/>
|
|
<set field="serviceCtx.costComponentTypePrefix" value="EST_STD"/>
|
|
<call-service service-name="calculateProductCosts" in-map-name="serviceCtx"/>
|
|
|
|
<!-- the tests -->
|
|
<entity-one entity-name="WorkEffort" value-field="productionRunHeader">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-one>
|
|
<entity-and entity-name="WorkEffort" list="productionRunTasks">
|
|
<field-map field-name="workEffortParentId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list entry="productionRunTask" list="productionRunTasks"/>
|
|
<entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
<field-map field-name="productId" value="MAT_A_COST"/>
|
|
</entity-and>
|
|
<first-from-list entry="productionRunMaterialA" list="productionRunMaterials"/>
|
|
<entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
<field-map field-name="productId" value="MAT_B_COST"/>
|
|
</entity-and>
|
|
<first-from-list entry="productionRunMaterialB" list="productionRunMaterials"/>
|
|
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.workEffortId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.inventoryItemTypeId" value="NON_SERIAL_INV_ITEM"/>
|
|
<set field="serviceCtx.lotId" value="LOT12345"/>
|
|
<set field="componentLocationMap.failIfItemsAreNotAvailable" from-field="Y"/>
|
|
<set field="componentLocationMap.locationSeqId" value=""/>
|
|
<set field="componentLocationMap.secondaryLocationSeqId" value=""/>
|
|
<set field="componentsLocationMap.${productionRunMaterialA}" from-field="componentLocationMap"/>
|
|
<set field="componentsLocationMap.${productionRunMaterialB}" from-field="componentLocationMap"/>
|
|
<set field="serviceCtx.componentsLocationMap" from-field="componentsLocationMap"/>
|
|
<set field="serviceCtx.quantity" value="1.0" type="BigDecimal"/>
|
|
<call-service service-name="productionRunDeclareAndProduce" in-map-name="serviceCtx"/>
|
|
<refresh-value value-field="productionRunHeader"/>
|
|
<refresh-value value-field="productionRunTask"/>
|
|
|
|
<entity-and entity-name="WorkEffortAndInventoryAssign" list="consumedMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
<field-map field-name="productId" value="MAT_A_COST"/>
|
|
</entity-and>
|
|
<set field="materialAConsumedTotal" value="0.0" type="BigDecimal"/>
|
|
<iterate list="consumedMaterials" entry="consumedMaterial">
|
|
<set field="materialAConsumedTotal" value="${materialAConsumedTotal + consumedMaterial.quantity}" type="BigDecimal"/>
|
|
</iterate>
|
|
<entity-and entity-name="WorkEffortAndInventoryAssign" list="consumedMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
<field-map field-name="productId" value="MAT_B_COST"/>
|
|
</entity-and>
|
|
<set field="materialBConsumedTotal" value="0.0" type="BigDecimal"/>
|
|
<iterate list="consumedMaterials" entry="consumedMaterial">
|
|
<set field="materialBConsumedTotal" value="${materialBConsumedTotal + consumedMaterial.quantity}" type="BigDecimal"/>
|
|
</iterate>
|
|
<entity-and entity-name="WorkEffortAndInventoryProduced" list="producedMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
|
|
</entity-and>
|
|
<set field="materialProducedTotal" value="0.0" type="BigDecimal"/>
|
|
<iterate list="producedMaterials" entry="producedMaterial">
|
|
<set field="materialProducedTotal" value="${materialProducedTotal + producedMaterial.quantityOnHandTotal}" type="BigDecimal"/>
|
|
<assert>
|
|
<if-compare field="producedMaterial.lotId" operator="equals" value="LOT12345"/>
|
|
<if-compare field="producedMaterial.unitCost" operator="equals" value="84.00" type="BigDecimal"/>
|
|
<if-compare field="producedMaterial.currencyUomId" operator="equals" value="USD"/>
|
|
</assert>
|
|
</iterate>
|
|
|
|
<assert>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_RUNNING"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_RUNNING"/>
|
|
<if-compare field="materialAConsumedTotal" operator="equals" value="2.0" type="BigDecimal"/>
|
|
<if-compare field="materialBConsumedTotal" operator="equals" value="3.0" type="BigDecimal"/>
|
|
<if-compare field="materialProducedTotal" operator="equals" value="1.0" type="BigDecimal"/>
|
|
<if-compare field="productionRunHeader.quantityProduced" operator="equals" value="1.0" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.workEffortId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.inventoryItemTypeId" value="NON_SERIAL_INV_ITEM"/>
|
|
<set field="serviceCtx.lotId" value="LOT12345"/>
|
|
<set field="componentLocationMap.failIfItemsAreNotAvailable" from-field="Y"/>
|
|
<set field="componentLocationMap.locationSeqId" value=""/>
|
|
<set field="componentLocationMap.secondaryLocationSeqId" value=""/>
|
|
<set field="componentsLocationMap.${productionRunMaterialA}" from-field="componentLocationMap"/>
|
|
<set field="componentsLocationMap.${productionRunMaterialB}" from-field="componentLocationMap"/>
|
|
<set field="serviceCtx.componentsLocationMap" from-field="componentsLocationMap"/>
|
|
<set field="serviceCtx.quantity" value="1.0" type="BigDecimal"/>
|
|
<call-service service-name="productionRunDeclareAndProduce" in-map-name="serviceCtx"/>
|
|
|
|
<refresh-value value-field="productionRunHeader"/>
|
|
<refresh-value value-field="productionRunTask"/>
|
|
<entity-and entity-name="WorkEffortAndInventoryAssign" list="consumedMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
<field-map field-name="productId" value="MAT_A_COST"/>
|
|
</entity-and>
|
|
<set field="totalMaterialCost" value="0.0" type="BigDecimal"/>
|
|
<set field="materialAConsumedTotal" value="0.0" type="BigDecimal"/>
|
|
<iterate list="consumedMaterials" entry="consumedMaterial">
|
|
<set field="materialAConsumedTotal" value="${materialAConsumedTotal + consumedMaterial.quantity}" type="BigDecimal"/>
|
|
<set field="totalMaterialCost" value="${totalMaterialCost + consumedMaterial.unitCost * consumedMaterial.quantity}" type="BigDecimal"/>
|
|
</iterate>
|
|
<entity-and entity-name="WorkEffortAndInventoryAssign" list="consumedMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
<field-map field-name="productId" value="MAT_B_COST"/>
|
|
</entity-and>
|
|
<set field="materialBConsumedTotal" value="0.0" type="BigDecimal"/>
|
|
<iterate list="consumedMaterials" entry="consumedMaterial">
|
|
<set field="materialBConsumedTotal" value="${materialBConsumedTotal + consumedMaterial.quantity}" type="BigDecimal"/>
|
|
<set field="totalMaterialCost" value="${totalMaterialCost + consumedMaterial.unitCost * consumedMaterial.quantity}" type="BigDecimal"/>
|
|
</iterate>
|
|
<entity-and entity-name="WorkEffortAndInventoryProduced" list="producedMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
|
|
</entity-and>
|
|
<set field="materialProducedTotal" value="0.0" type="BigDecimal"/>
|
|
<iterate list="producedMaterials" entry="producedMaterial">
|
|
<set field="materialProducedTotal" value="${materialProducedTotal + producedMaterial.quantityOnHandTotal}" type="BigDecimal"/>
|
|
<assert>
|
|
<if-compare field="producedMaterial.lotId" operator="equals" value="LOT12345"/>
|
|
<if-compare field="producedMaterial.unitCost" operator="equals" value="84.00" type="BigDecimal"/>
|
|
<if-compare field="producedMaterial.currencyUomId" operator="equals" value="USD"/>
|
|
</assert>
|
|
</iterate>
|
|
|
|
<assert>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_RUNNING"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_RUNNING"/>
|
|
<if-compare field="materialAConsumedTotal" operator="equals" value="4.0" type="BigDecimal"/>
|
|
<if-compare field="materialBConsumedTotal" operator="equals" value="6.0" type="BigDecimal"/>
|
|
<if-compare field="materialProducedTotal" operator="equals" value="2.0" type="BigDecimal"/>
|
|
<if-compare field="productionRunHeader.quantityProduced" operator="equals" value="2.0" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_COMPLETED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
<refresh-value value-field="productionRunHeader"/>
|
|
<refresh-value value-field="productionRunTask"/>
|
|
<assert>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_COMPLETED"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_COMPLETED"/>
|
|
</assert>
|
|
|
|
<entity-and entity-name="CostComponent" list="costComponents">
|
|
<field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
|
|
</entity-and>
|
|
<iterate list="costComponents" entry="costComponent">
|
|
<if-compare field="costComponent.costComponentTypeId" operator="equals" value="ACTUAL_GEN_COST">
|
|
<assert>
|
|
<if-compare field="costComponent.costUomId" operator="equals" value="USD"/>
|
|
<if-compare field="costComponent.costComponentCalcId" operator="equals" value="GEN_COST_CALC"/>
|
|
<if-compare field="costComponent.cost" operator="equals" value="6.7835" type="BigDecimal"/>
|
|
</assert>
|
|
</if-compare>
|
|
</iterate>
|
|
|
|
<entity-and entity-name="CostComponent" list="costComponents">
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
</entity-and>
|
|
<iterate list="costComponents" entry="costComponent">
|
|
<if-compare field="costComponent.costComponentTypeId" operator="equals" value="ACTUAL_MAT_COST">
|
|
<assert>
|
|
<if-compare field="costComponent.costUomId" operator="equals" value="USD"/>
|
|
<if-compare field="costComponent.cost" operator="equals" value="78.00" type="BigDecimal"/>
|
|
</assert>
|
|
</if-compare>
|
|
<if-compare field="costComponent.costComponentTypeId" operator="equals" value="ACTUAL_ROUTE_COST">
|
|
<assert>
|
|
<if-compare field="costComponent.costUomId" operator="equals" value="USD"/>
|
|
<if-compare field="costComponent.fixedAssetId" operator="equals" value="WORKCENTER_COST"/>
|
|
<if-compare field="costComponent.cost" operator="equals" value="16.67" type="BigDecimal"/>
|
|
</assert>
|
|
</if-compare>
|
|
<if-compare field="costComponent.costComponentTypeId" operator="equals" value="ACTUAL_OTHER_COST">
|
|
<assert>
|
|
<if-compare field="costComponent.costUomId" operator="equals" value="USD"/>
|
|
<if-compare field="costComponent.costComponentCalcId" operator="equals" value="TASK_COST_CALC"/>
|
|
<if-compare field="costComponent.cost" operator="equals" value="41.00" type="BigDecimal"/>
|
|
</assert>
|
|
</if-compare>
|
|
</iterate>
|
|
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.workEffortId" from-field="productionRunId"/>
|
|
<call-service service-name="getProductionRunCost" in-map-name="serviceCtx">
|
|
<result-to-field result-name="totalCost"/>
|
|
</call-service>
|
|
<assert>
|
|
<if-compare field="totalCost" operator="equals" value="142.4535" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<set field="postedTotalAmount" value="0.0" type="BigDecimal"/>
|
|
<entity-and entity-name="AcctgTrans" list="acctgTransList">
|
|
<field-map field-name="acctgTransTypeId" value="INVENTORY"/>
|
|
<field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
|
|
</entity-and>
|
|
<iterate list="acctgTransList" entry="acctgTrans">
|
|
<assert><if-compare field="acctgTrans.isPosted" operator="equals" value="Y"/></assert>
|
|
<get-related value-field="acctgTrans" relation-name="AcctgTransEntry" list="acctgTransEntryList"/>
|
|
<iterate list="acctgTransEntryList" entry="acctgTransEntry">
|
|
<if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
|
|
<assert>
|
|
<if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="WIP_INVENTORY"/>
|
|
<if-compare field="acctgTransEntry.glAccountId" operator="equals" value="142000"/>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="84.00" type="BigDecimal"/>
|
|
</assert>
|
|
<set field="postedTotalAmount" value="${postedTotalAmount + acctgTransEntry.amount}" type="BigDecimal"/>
|
|
<else>
|
|
<assert>
|
|
<if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="INVENTORY_ACCOUNT"/>
|
|
<if-compare field="acctgTransEntry.glAccountId" operator="equals" value="140000"/>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="84.00" type="BigDecimal"/>
|
|
</assert>
|
|
</else>
|
|
</if-compare>
|
|
</iterate>
|
|
</iterate>
|
|
<assert>
|
|
<if-compare field="postedTotalAmount" operator="equals" value="168.00" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<set field="postedTotalAmount" value="0.0" type="BigDecimal"/>
|
|
<entity-and entity-name="AcctgTrans" list="acctgTransList">
|
|
<field-map field-name="acctgTransTypeId" value="MANUFACTURING"/>
|
|
<field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
|
|
</entity-and>
|
|
<iterate list="acctgTransList" entry="acctgTrans">
|
|
<assert><if-compare field="acctgTrans.isPosted" operator="equals" value="Y"/></assert>
|
|
<get-related value-field="acctgTrans" relation-name="AcctgTransEntry" list="acctgTransEntryList"/>
|
|
<iterate list="acctgTransEntryList" entry="acctgTransEntry">
|
|
<if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
|
|
<assert>
|
|
<if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="OPERATING_EXPENSE"/>
|
|
<if-compare field="acctgTransEntry.glAccountId" operator="equals" value="600000"/>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="6.78" type="BigDecimal"/>
|
|
</assert>
|
|
<set field="postedTotalAmount" value="${postedTotalAmount + acctgTransEntry.amount}" type="BigDecimal"/>
|
|
<else>
|
|
<assert>
|
|
<if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="WIP_INVENTORY"/>
|
|
<if-compare field="acctgTransEntry.glAccountId" operator="equals" value="142000"/>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="6.78" type="BigDecimal"/>
|
|
<if-compare-field field="acctgTransEntry.productId" operator="equals" to-field="productId"/>
|
|
</assert>
|
|
</else>
|
|
</if-compare>
|
|
</iterate>
|
|
</iterate>
|
|
<assert>
|
|
<if-compare field="postedTotalAmount" operator="equals" value="6.78" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<set field="postedTotalAmount" value="0.0" type="BigDecimal"/>
|
|
<entity-and entity-name="AcctgTrans" list="acctgTransList">
|
|
<field-map field-name="acctgTransTypeId" value="INVENTORY"/>
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
</entity-and>
|
|
<iterate list="acctgTransList" entry="acctgTrans">
|
|
<assert><if-compare field="acctgTrans.isPosted" operator="equals" value="Y"/></assert>
|
|
<get-related value-field="acctgTrans" relation-name="AcctgTransEntry" list="acctgTransEntryList"/>
|
|
<iterate list="acctgTransEntryList" entry="acctgTransEntry">
|
|
<if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="D">
|
|
<assert>
|
|
<if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="WIP_INVENTORY"/>
|
|
<if-compare field="acctgTransEntry.glAccountId" operator="equals" value="142000"/>
|
|
<if-compare-field field="acctgTransEntry.productId" operator="equals" to-field="productId"/>
|
|
<or>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="18.00" type="BigDecimal"/>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="21.00" type="BigDecimal"/>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="36.00" type="BigDecimal"/>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="42.00" type="BigDecimal"/>
|
|
</or>
|
|
</assert>
|
|
<set field="postedTotalAmount" value="${postedTotalAmount + acctgTransEntry.amount}" type="BigDecimal"/>
|
|
<else>
|
|
<assert>
|
|
<if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="RAWMAT_INVENTORY"/>
|
|
<if-compare field="acctgTransEntry.glAccountId" operator="equals" value="141000"/>
|
|
<or>
|
|
<and>
|
|
<or>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="18.00" type="BigDecimal"/>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="36.00" type="BigDecimal"/>
|
|
</or>
|
|
<if-compare field="acctgTransEntry.productId" operator="equals" value="MAT_A_COST"/>
|
|
</and>
|
|
<and>
|
|
<or>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="21.00" type="BigDecimal"/>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="42.00" type="BigDecimal"/>
|
|
</or>
|
|
<if-compare field="acctgTransEntry.productId" operator="equals" value="MAT_B_COST"/>
|
|
</and>
|
|
</or>
|
|
</assert>
|
|
</else>
|
|
</if-compare>
|
|
</iterate>
|
|
</iterate>
|
|
<assert>
|
|
<if-compare field="postedTotalAmount" operator="equals" value="117.00" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<set field="postedTotalAmount" value="0.0" type="BigDecimal"/>
|
|
<entity-and entity-name="AcctgTrans" list="acctgTransList">
|
|
<field-map field-name="acctgTransTypeId" value="MANUFACTURING"/>
|
|
<field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
|
|
</entity-and>
|
|
<iterate list="acctgTransList" entry="acctgTrans">
|
|
<assert><if-compare field="acctgTrans.isPosted" operator="equals" value="Y"/></assert>
|
|
<get-related value-field="acctgTrans" relation-name="AcctgTransEntry" list="acctgTransEntryList"/>
|
|
<iterate list="acctgTransEntryList" entry="acctgTransEntry">
|
|
<assert>
|
|
<if-compare-field field="acctgTransEntry.productId" operator="equals" to-field="productId"/>
|
|
<or>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="41.00" type="BigDecimal"/>
|
|
<if-compare field="acctgTransEntry.amount" operator="equals" value="16.67" type="BigDecimal"/>
|
|
</or>
|
|
</assert>
|
|
<if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
|
|
<assert>
|
|
<if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="OPERATING_EXPENSE"/>
|
|
<if-compare field="acctgTransEntry.glAccountId" operator="equals" value="600000"/>
|
|
</assert>
|
|
<set field="postedTotalAmount" value="${postedTotalAmount + acctgTransEntry.amount}" type="BigDecimal"/>
|
|
<else>
|
|
<assert>
|
|
<if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="WIP_INVENTORY"/>
|
|
<if-compare field="acctgTransEntry.glAccountId" operator="equals" value="142000"/>
|
|
</assert>
|
|
</else>
|
|
</if-compare>
|
|
</iterate>
|
|
</iterate>
|
|
<assert>
|
|
<if-compare field="postedTotalAmount" operator="equals" value="57.67" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<check-errors/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="testQuickRunProductionRun" short-description="Test the quick execution of a production run" login-required="false">
|
|
<set field="productId" value="PROD_MANUF"/>
|
|
<set field="facilityId" value="WebStoreWarehouse"/>
|
|
<set field="quantity" value="1.0" type="BigDecimal"/>
|
|
<now-timestamp field="nowTimestamp"/>
|
|
<set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
|
|
|
|
<entity-one entity-name="UserLogin" value-field="userLogin">
|
|
<field-map field-name="userLoginId" value="TestManufAdmin"/>
|
|
</entity-one>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<set field="serviceCtx.pRQuantity" from-field="quantity"/>
|
|
<set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
|
|
<set field="serviceCtx.facilityId" from-field="facilityId"/>
|
|
|
|
<!-- production run -->
|
|
<call-service service-name="createProductionRun" in-map-name="serviceCtx">
|
|
<result-to-field result-name="productionRunId"/>
|
|
</call-service>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<call-service service-name="quickRunAllProductionRunTasks" in-map-name="serviceCtx"/>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.workEffortId" from-field="productionRunId"/>
|
|
<call-service service-name="getProductionRunCost" in-map-name="serviceCtx">
|
|
<result-to-field result-name="totalCost"/>
|
|
</call-service>
|
|
<assert>
|
|
<if-compare field="totalCost" operator="equals" value="84.00" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<entity-one entity-name="WorkEffort" value-field="productionRunHeader">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-one>
|
|
<entity-and entity-name="WorkEffort" list="productionRunTasks">
|
|
<field-map field-name="workEffortParentId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunTasks" entry="productionRunTask"/>
|
|
|
|
<assert>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_COMPLETED"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_COMPLETED"/>
|
|
</assert>
|
|
<check-errors/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="testQuickCloseProductionRun" short-description="Test the quick finalization of a production run" login-required="false">
|
|
<set field="productId" value="PROD_MANUF"/>
|
|
<set field="facilityId" value="WebStoreWarehouse"/>
|
|
<set field="quantity" value="1.0" type="BigDecimal"/>
|
|
<now-timestamp field="nowTimestamp"/>
|
|
<set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
|
|
|
|
<entity-one entity-name="UserLogin" value-field="userLogin">
|
|
<field-map field-name="userLoginId" value="TestManufAdmin"/>
|
|
</entity-one>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<set field="serviceCtx.pRQuantity" from-field="quantity"/>
|
|
<set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
|
|
<set field="serviceCtx.facilityId" from-field="facilityId"/>
|
|
|
|
<!-- production run -->
|
|
<call-service service-name="createProductionRun" in-map-name="serviceCtx">
|
|
<result-to-field result-name="productionRunId"/>
|
|
</call-service>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_CLOSED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.workEffortId" from-field="productionRunId"/>
|
|
<call-service service-name="getProductionRunCost" in-map-name="serviceCtx">
|
|
<result-to-field result-name="totalCost"/>
|
|
</call-service>
|
|
<assert>
|
|
<if-compare field="totalCost" operator="equals" value="84.00" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<entity-one entity-name="WorkEffort" value-field="productionRunHeader">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-one>
|
|
<entity-and entity-name="WorkEffort" list="productionRunTasks">
|
|
<field-map field-name="workEffortParentId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunTasks" entry="productionRunTask"/>
|
|
|
|
<assert>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CLOSED"/>
|
|
<if-compare-field field="productionRunHeader.quantityProduced" operator="equals" to-field="quantity"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CLOSED"/>
|
|
<if-compare-field field="productionRunTask.quantityProduced" operator="equals" to-field="quantity"/>
|
|
</assert>
|
|
|
|
<check-errors/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="testCreateProductionRunForOrder" short-description="Test the creation of a production run for a specified sales order" login-required="false">
|
|
<set field="productId" value="PROD_MANUF"/>
|
|
|
|
<entity-one entity-name="UserLogin" value-field="userLogin">
|
|
<field-map field-name="userLoginId" value="admin"/>
|
|
</entity-one>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<call-service service-name="createTestSalesOrderSingle" in-map-name="serviceCtx">
|
|
<result-to-field result-name="orderId"/>
|
|
</call-service>
|
|
<assert><not><if-empty field="orderId"/></not></assert>
|
|
<check-errors/>
|
|
|
|
<entity-one entity-name="UserLogin" value-field="userLogin">
|
|
<field-map field-name="userLoginId" value="TestManufAdmin"/>
|
|
</entity-one>
|
|
|
|
<entity-and entity-name="OrderItem" list="orderItems">
|
|
<field-map field-name="orderId" from-field="orderId"/>
|
|
<field-map field-name="productId" from-field="productId"/>
|
|
</entity-and>
|
|
<first-from-list list="orderItems" entry="orderItem"/>
|
|
<assert>
|
|
<not><if-empty field="orderItem"/></not>
|
|
</assert>
|
|
<check-errors/>
|
|
<entity-and entity-name="OrderItemShipGrpInvRes" list="orderItemShipGrpInvRess">
|
|
<field-map field-name="orderId" from-field="orderId"/>
|
|
<field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
|
|
</entity-and>
|
|
<first-from-list list="orderItemShipGrpInvRess" entry="originalOrderItemShipGrpInvRes"/>
|
|
<assert>
|
|
<not><if-empty field="originalOrderItemShipGrpInvRes"/></not>
|
|
</assert>
|
|
<check-errors/>
|
|
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.orderId" from-field="orderId"/>
|
|
<call-service service-name="createProductionRunsForOrder" in-map-name="serviceCtx">
|
|
<result-to-field result-name="productionRuns"/>
|
|
</call-service>
|
|
<first-from-list list="productionRuns" entry="productionRunId"/>
|
|
<assert><not><if-empty field="productionRunId"/></not></assert>
|
|
<check-errors/>
|
|
|
|
<entity-one entity-name="WorkEffort" value-field="productionRunHeader">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-one>
|
|
<entity-and entity-name="WorkEffort" list="productionRunTasks">
|
|
<field-map field-name="workEffortParentId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunTasks" entry="productionRunTask"/>
|
|
|
|
<assert>
|
|
<if-compare field="productionRunHeader.workEffortTypeId" operator="equals" value="PROD_ORDER_HEADER"/>
|
|
<if-compare field="productionRunHeader.facilityId" operator="equals" value="WebStoreWarehouse"/>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CREATED"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CREATED"/>
|
|
<if-compare field="productionRunHeader.quantityToProduce" operator="equals" value="1.0" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<entity-and entity-name="WorkEffortGoodStandard" list="productionRunProducts">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunProducts" entry="productionRunProduct"/>
|
|
|
|
<assert>
|
|
<not><if-empty field="productionRunProduct"/></not>
|
|
<if-compare-field field="productionRunProduct.productId" operator="equals" to-field="productId"/>
|
|
<if-compare field="productionRunProduct.workEffortGoodStdTypeId" operator="equals" value="PRUN_PROD_DELIV"/>
|
|
<if-compare field="productionRunProduct.estimatedQuantity" operator="equals" value="1.0" type="BigDecimal"/>
|
|
</assert>
|
|
|
|
<entity-and entity-name="WorkOrderItemFulfillment" list="workOrderItemFulfillments">
|
|
<field-map field-name="workEffortId" from-field="productionRunId"/>
|
|
<field-map field-name="orderId" from-field="orderId"/>
|
|
</entity-and>
|
|
<first-from-list list="workOrderItemFulfillments" entry="workOrderItemFulfillment"/>
|
|
<assert>
|
|
<not><if-empty field="workOrderItemFulfillment"/></not>
|
|
<not><if-empty field="workOrderItemFulfillment.orderItemSeqId"/></not>
|
|
</assert>
|
|
<check-errors/>
|
|
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
<clear-field field="serviceCtx"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productionRunId" from-field="productionRunId"/>
|
|
<set field="serviceCtx.statusId" value="PRUN_CLOSED"/>
|
|
<call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
|
|
|
|
<entity-and entity-name="WorkEffortAndInventoryProduced" list="producedMaterials">
|
|
<field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
|
|
</entity-and>
|
|
<first-from-list entry="producedMaterial" list="producedMaterials"/>
|
|
|
|
<entity-and entity-name="OrderItemShipGrpInvRes" list="orderItemShipGrpInvRess">
|
|
<field-map field-name="orderId" from-field="orderId"/>
|
|
<field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
|
|
</entity-and>
|
|
<first-from-list entry="newOrderItemShipGrpInvRes" list="orderItemShipGrpInvRess"/>
|
|
<assert>
|
|
<not><if-empty field="newOrderItemShipGrpInvRes"/></not>
|
|
<not><if-compare-field field="newOrderItemShipGrpInvRes.inventoryItemId" operator="equals" to-field="originalOrderItemShipGrpInvRes.inventoryItemId"/></not>
|
|
<if-compare-field field="producedMaterial.inventoryItemId" operator="equals" to-field="newOrderItemShipGrpInvRes.inventoryItemId"/>
|
|
<not><if-compare-field field="producedMaterial.inventoryItemId" operator="equals" to-field="newOrderItemShipGrpInvRes.inventoryItemId"/></not>
|
|
</assert>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="testCreateProductionRunForRequirement" short-description="Test the creation of a production run for a specified requirement" login-required="false">
|
|
<set field="productId" value="PROD_MANUF"/>
|
|
<now-timestamp field="nowTimestamp"/>
|
|
<set-calendar field="startDate" from-field="nowTimestamp" days="1"/>
|
|
|
|
<entity-one entity-name="UserLogin" value-field="userLogin">
|
|
<field-map field-name="userLoginId" value="TestSupplyAdmin"/>
|
|
</entity-one>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.productId" from-field="productId"/>
|
|
<set field="serviceCtx.requirementTypeId" value="INTERNAL_REQUIREMENT"/>
|
|
<set field="serviceCtx.facilityId" value="WebStoreWarehouse"/>
|
|
<set field="serviceCtx.requirementStartDate" from-field="startDate"/>
|
|
|
|
<call-service service-name="createRequirement" in-map-name="serviceCtx">
|
|
<result-to-field result-name="requirementId"/>
|
|
</call-service>
|
|
|
|
<set field="nowTime" value="${date:nowTimestamp()}" type="Timestamp"/>
|
|
<set field="serviceCtx.userLogin" from-field="userLogin"/>
|
|
<set field="serviceCtx.requirementId" from-field="requirementId"/>
|
|
<set field="serviceCtx.statusId" value="REQ_APPROVED"/>
|
|
<call-service service-name="updateRequirement" in-map-name="serviceCtx"/>
|
|
|
|
<entity-condition entity-name="WorkEffort" list="workEfforts">
|
|
<condition-list>
|
|
<condition-expr field-name="lastUpdatedStamp" operator="greater-equals" from-field="nowTime"/>
|
|
<condition-expr field-name="workEffortTypeId" value="PROD_ORDER_HEADER"/>
|
|
</condition-list>
|
|
</entity-condition>
|
|
<first-from-list entry="productionRunHeader" list="workEfforts"/>
|
|
<entity-and entity-name="WorkEffort" list="productionRunTasks">
|
|
<field-map field-name="workEffortParentId" from-field="productionRunHeader.workEffortId"/>
|
|
</entity-and>
|
|
<first-from-list entry="productionRunTask" list="productionRunTasks"/>
|
|
|
|
<assert>
|
|
<if-compare field="productionRunHeader.workEffortTypeId" operator="equals" value="PROD_ORDER_HEADER"/>
|
|
<if-compare field="productionRunHeader.facilityId" operator="equals" value="WebStoreWarehouse"/>
|
|
<if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CREATED"/>
|
|
<if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CREATED"/>
|
|
<if-compare field="productionRunHeader.quantityToProduce" operator="equals" value="1.0" type="BigDecimal"/>
|
|
<if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="startDate" type="Timestamp"/>
|
|
<if-compare-field field="productionRunTask.estimatedStartDate" operator="equals" to-field="startDate" type="Timestamp"/>
|
|
</assert>
|
|
|
|
<entity-and entity-name="WorkEffortGoodStandard" list="productionRunProducts">
|
|
<field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
|
|
</entity-and>
|
|
<first-from-list list="productionRunProducts" entry="productionRunProduct"/>
|
|
|
|
<assert>
|
|
<not><if-empty field="productionRunProduct"/></not>
|
|
<if-compare-field field="productionRunProduct.productId" operator="equals" to-field="productId"/>
|
|
<if-compare field="productionRunProduct.workEffortGoodStdTypeId" operator="equals" value="PRUN_PROD_DELIV"/>
|
|
<if-compare field="productionRunProduct.estimatedQuantity" operator="equals" value="1.0" type="BigDecimal"/>
|
|
</assert>
|
|
</simple-method>
|
|
|
|
</simple-methods>
|