Author: pranayp
Date: Tue Jun 14 11:12:46 2016 New Revision: 1748387 URL: http://svn.apache.org/viewvc?rev=1748387&view=rev Log: [OFBIZ-6328] Improved check on existing production runs for order so that createProductionRunsForOrder service considers cancelled production runs. This service wasn't creating production runs whenever a WorkOrderItemFulfillment record exists even if workEffort.currentStatusId == "PRUN_CANCELLED". Thanks Christian Carlow for the contribution. Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=1748387&r1=1748386&r2=1748387&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Tue Jun 14 11:12:46 2016 @@ -2652,16 +2652,21 @@ public class ProductionRunServices { } try { List<GenericValue> existingProductionRuns = null; + if (UtilValidate.isNotEmpty(shipGroupSeqId)) { - existingProductionRuns = EntityQuery.use(delegator).from("WorkOrderItemFulfillment") - .where("orderId", orderItemOrShipGroupAssoc.get("orderId"), - "orderItemSeqId", orderItemOrShipGroupAssoc.get("orderItemSeqId"), - "shipGroupSeqId", shipGroupSeqId) + existingProductionRuns = EntityQuery.use(delegator).from("WorkAndOrderItemFulfillment") + .where( + EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderItemOrShipGroupAssoc.get("orderId")), + EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderItemOrShipGroupAssoc.get("orderItemSeqId")), + EntityCondition.makeCondition("shipGroupSeqId", EntityOperator.EQUALS, orderItemOrShipGroupAssoc.get("shipGroupSeqId")), + EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CANCELLED")) .cache().queryList(); } else { - existingProductionRuns = EntityQuery.use(delegator).from("WorkOrderItemFulfillment") - .where("orderId", orderItemOrShipGroupAssoc.get("orderId"), - "orderItemSeqId", orderItemOrShipGroupAssoc.get("orderItemSeqId")) + existingProductionRuns = EntityQuery.use(delegator).from("WorkAndOrderItemFulfillment") + .where( + EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderItemOrShipGroupAssoc.get("orderId")), + EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderItemOrShipGroupAssoc.get("orderItemSeqId")), + EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CANCELLED")) .cache().queryList(); } if (UtilValidate.isNotEmpty(existingProductionRuns)) { Modified: ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml?rev=1748387&r1=1748386&r2=1748387&view=diff ============================================================================== --- ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml (original) +++ ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml Tue Jun 14 11:12:46 2016 @@ -1742,4 +1742,17 @@ under the License. <key-map field-name="productId"/> </relation> </view-entity> + + <view-entity entity-name="WorkAndOrderItemFulfillment" + package-name="org.ofbiz.order.order" + never-cache="true" + title="WorkOrderItemFulfillment And WorkEffort View Entity"> + <member-entity entity-alias="WOIF" entity-name="WorkOrderItemFulfillment"/> + <member-entity entity-alias="WE" entity-name="WorkEffort"/> + <alias-all entity-alias="WOIF"/> + <alias-all entity-alias="WE"/> + <view-link rel-entity-alias="WE" entity-alias="WOIF"> + <key-map field-name="workEffortId"/> + </view-link> + </view-entity> </entitymodel> |
Free forum by Nabble | Edit this page |