📄 bomnode.java
字号:
serviceContext.put("facilityId", getProduct().getString("facilityId")); } else { serviceContext.put("productId", getSubstitutedNode().getProduct().getString("productId")); serviceContext.put("facilityId", getSubstitutedNode().getProduct().getString("facilityId")); } if (facilityId != null) { serviceContext.put("facilityId", facilityId); } if (shipmentId != null) { serviceContext.put("workEffortName", "SP_" + shipmentId + "_" + serviceContext.get("productId")); } serviceContext.put("pRQuantity", new Double(getQuantity())); serviceContext.put("startDate", startDate); serviceContext.put("userLogin", userLogin); Map resultService = null; try { resultService = dispatcher.runSync("createProductionRun", serviceContext); productionRunId = (String)resultService.get("productionRunId"); } catch (GenericServiceException e) { Debug.logError("Problem calling the createProductionRun service", module); } try { if (productionRunId != null) { if (orderId != null && orderItemSeqId != null) { delegator.create("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", productionRunId, "orderId", orderId, "orderItemSeqId", orderItemSeqId)); } for (int i = 0; i < childProductionRuns.size(); i++) { delegator.create("WorkEffortAssoc", UtilMisc.toMap("workEffortIdFrom", (String)childProductionRuns.get(i), "workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY", "fromDate", startDate)); } } } catch (GenericEntityException e) { //Debug.logError(e, "Problem calling the getManufacturingComponents service", module); } } return productionRunId; } public boolean isWarehouseManaged() { boolean isWarehouseManaged = false; try { if ("WIP".equals(getProduct().getString("productTypeId"))) { return false; } List pfs = getProduct().getRelatedCache("ProductFacility"); Iterator pfsIt = pfs.iterator(); GenericValue pf = null; boolean found = false; while(pfsIt.hasNext()) { found = true; pf = (GenericValue)pfsIt.next(); if (pf.getDouble("minimumStock") != null && pf.getDouble("minimumStock").doubleValue() > 0) { isWarehouseManaged = true; } } // If no records are found, we try to search for substituted node's records if (!found && getSubstitutedNode() != null) { pfs = getSubstitutedNode().getProduct().getRelatedCache("ProductFacility"); pfsIt = pfs.iterator(); pf = null; while(pfsIt.hasNext()) { pf = (GenericValue)pfsIt.next(); if (pf.getDouble("minimumStock") != null && pf.getDouble("minimumStock").doubleValue() > 0) { isWarehouseManaged = true; } } } } catch(GenericEntityException gee) { Debug.logError("Problem in BOMNode.isWarehouseManaged()", module); } return isWarehouseManaged; } public boolean isManufactured() { return childrenNodes.size() > 0; } public boolean isVirtual() { return (product.get("isVirtual") != null? product.get("isVirtual").equals("Y"): false); } public void isConfigured(ArrayList arr) { // First of all we visit the current node. if (isVirtual()) { arr.add(this); } // Now (recursively) we visit the children. GenericValue oneChild = null; BOMNode oneChildNode = null; for (int i = 0; i < children.size(); i++) { oneChild = (GenericValue)children.get(i); oneChildNode = (BOMNode)childrenNodes.get(i); if (oneChildNode != null) { oneChildNode.isConfigured(arr); } } } /** Getter for property quantity. * @return Value of property quantity. * */ public double getQuantity() { return quantity; } public void setQuantity(double quantity) { this.quantity = quantity; } /** Getter for property depth. * @return Value of property depth. * */ public int getDepth() { return depth; } public GenericValue getProduct() { return product; } /** Getter for property substitutedNode. * @return Value of property substitutedNode. * */ public BOMNode getSubstitutedNode() { return substitutedNode; } /** Setter for property substitutedNode. * @param substitutedNode New value of property substitutedNode. * */ public void setSubstitutedNode(BOMNode substitutedNode) { this.substitutedNode = substitutedNode; } public String getRootProductForRules() { return getParentNode().getProductForRules(); } /** Getter for property productForRules. * @return Value of property productForRules. * */ public String getProductForRules() { return productForRules; } /** Setter for property productForRules. * @param productForRules New value of property productForRules. * */ public void setProductForRules(String productForRules) { this.productForRules = productForRules; } /** Getter for property bomTypeId. * @return Value of property bomTypeId. * */ public java.lang.String getBomTypeId() { return bomTypeId; } /** Getter for property quantityMultiplier. * @return Value of property quantityMultiplier. * */ public double getQuantityMultiplier() { return quantityMultiplier; } /** Setter for property quantityMultiplier. * @param quantityMultiplier New value of property quantityMultiplier. * */ public void setQuantityMultiplier(double quantityMultiplier) { this.quantityMultiplier = quantityMultiplier; } /** Getter for property ruleApplied. * @return Value of property ruleApplied. * */ public org.ofbiz.entity.GenericValue getRuleApplied() { return ruleApplied; } /** Setter for property ruleApplied. * @param ruleApplied New value of property ruleApplied. * */ public void setRuleApplied(org.ofbiz.entity.GenericValue ruleApplied) { this.ruleApplied = ruleApplied; } /** Getter for property scrapFactor. * @return Value of property scrapFactor. * */ public double getScrapFactor() { return scrapFactor; } /** Setter for property scrapFactor. * @param scrapFactor New value of property scrapFactor. * */ public void setScrapFactor(double scrapFactor) { this.scrapFactor = scrapFactor; } /** Getter for property childrenNodes. * @return Value of property childrenNodes. * */ public java.util.ArrayList getChildrenNodes() { return childrenNodes; } /** Setter for property childrenNodes. * @param childrenNodes New value of property childrenNodes. * */ public void setChildrenNodes(java.util.ArrayList childrenNodes) { this.childrenNodes = childrenNodes; } /** Getter for property productAssoc. * @return Value of property productAssoc. * */ public org.ofbiz.entity.GenericValue getProductAssoc() { return productAssoc; } /** Setter for property productAssoc. * @param productAssoc New value of property productAssoc. * */ public void setProductAssoc(org.ofbiz.entity.GenericValue productAssoc) { this.productAssoc = productAssoc; } public void setTree(BOMTree tree) { this.tree = tree; } public BOMTree getTree() { return tree; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -