ofbiz进击 。 ofbiz 退货流程(包含获取可退货项流程分析 以及 取消退货项的过程分析)
<eca service="updateReturnHeader" event="return">
<condition field-name="statusId" operator="equals" value="RETURN_ACCEPTED"/>
<!-- The quickReceiveReturn service checks this, and some status update calls may not pass it in, so don't
check it here or the option may be ignored.
<condition field-name="needsInventoryReceive" operator="equals" value="Y"/> -->
<action service="quickReceiveReturn" mode="sync"/>
</eca>
<eca service="updateReturnHeader" event="commit">
<condition field-name="statusId" operator="equals" value="RETURN_ACCEPTED"/>
<condition field-name="oldStatusId" operator="not-equals" value="RETURN_ACCEPTED"/>
<action service="processWaitReplacementReservedReturn" mode="sync"/>
<action service="processReplaceImmediatelyReturn" mode="sync"/>
<action service="createShipmentAndItemsForReturn" mode="sync"/>
<action service="processCrossShipReplacementReturn" mode="sync"/>
<action service="createTrackingCodeOrderReturns" mode="sync" run-as-user="system"/>
<action service="sendReturnAcceptNotification" mode="async" persist="true"/>
<action service="processRefundImmediatelyReturn" mode="sync"/>
<action service="createReturnStatus" mode="sync"/>
</eca>
首先当触发event事件并且statusId状态为RETURN_ACCEPTED的时候,就会调用quickReceiveReturn服务,下面为该服务的逻辑判断,如果嫌长可以快速掠过。
<simple-method method-name="quickReceiveReturn" short-description="Quick Receive Entire Return">
<entity-one entity-name="ReturnHeader" value-field="returnHeader">
<field-map field-name="returnId" from-field="parameters.returnId"/>
</entity-one> <if-compare field="returnHeader.needsInventoryReceive" operator="equals" value="Y">
<!-- before receiving inventory, check to see if there is inventory information in this database -->
<entity-count entity-name="InventoryItem" count-field="iiCount">
<condition-expr field-name="facilityId" operator="equals" from-field="returnHeader.destinationFacilityId"/>
</entity-count> <if-compare field="iiCount" operator="greater" value="0" type="Integer">
<!-- create a return shipment for this return -->
<set field="shipmentCtx.returnId" from-field="parameters.returnId"/>
<call-service service-name="createShipmentForReturn" in-map-name="shipmentCtx">
<result-to-field result-name="shipmentId"/>
</call-service>
<log level="info" message="Created new shipment ${shipmentId}"/> <entity-condition entity-name="ReturnItem" list="returnItems">
<condition-expr field-name="returnId" operator="equals" from-field="returnHeader.returnId"/>
</entity-condition> <!-- if no inventory item type specified, get default from facility -->
<if-empty field="parameters.inventoryItemTypeId">
<get-related-one value-field="returnHeader" relation-name="Facility" to-value-field="facility"/>
<set field="parameters.inventoryItemTypeId" from-field="facility.defaultInventoryItemTypeId" default-value="NON_SERIAL_INV_ITEM"/>
</if-empty> <now-timestamp field="nowTimestamp"/> <entity-count entity-name="ReturnItem" count-field="returnItemCount">
<condition-expr field-name="returnId" operator="equals" from-field="returnHeader.returnId"/>
</entity-count>
<set field="nonProductItems" type="Long" value="0"/> <iterate entry="returnItem" list="returnItems">
<!-- record this return item on the return shipment as well. not sure if this is actually necessary... -->
<clear-field field="shipItemCtx"/>
<set from-field="shipmentId" field="shipItemCtx.shipmentId"/>
<set from-field="returnItem.productId" field="shipItemCtx.productId"/>
<set from-field="returnItem.returnQuantity" field="shipItemCtx.quantity"/>
<log level="info" message="calling create shipment item with ${shipItemCtx}"/>
<call-service service-name="createShipmentItem" in-map-name="shipItemCtx">
<result-to-field result-name="shipmentItemSeqId"/>
</call-service>
</iterate>
<iterate entry="returnItem" list="returnItems">
<clear-field field="receiveCtx"/> <if-empty field="returnItem.expectedItemStatus">
<set value="INV_RETURNED" field="returnItem.expectedItemStatus" type="String"/>
</if-empty>
<get-related-one value-field="returnItem" relation-name="OrderItem" to-value-field="orderItem"/>
<if-not-empty field="orderItem.productId">
<set field="costCtx.returnItemSeqId" from-field="returnItem.returnItemSeqId"/>
<set field="costCtx.returnId" from-field="returnItem.returnId"/>
<call-service service-name="getReturnItemInitialCost" in-map-name="costCtx">
<result-to-field result-name="initialItemCost" field="receiveCtx.unitCost"/>
</call-service>
<!--check if the items already have SERIALIZED inventory. If so, it still puts them back as SERIALIZED with status "Accepted."-->
<entity-count entity-name="InventoryItem" count-field="serializedItemCount">
<condition-list combine="and">
<condition-expr field-name="productId" operator="equals" from-field="returnItem.productId"/>
<condition-expr field-name="facilityId" operator="equals" from-field="returnHeader.destinationFacilityId"/>
<condition-expr field-name="inventoryItemTypeId" operator="equals" value="SERIALIZED_INV_ITEM"/>
</condition-list>
</entity-count>
<set field="setNonSerial" value="false"/>
<if-compare field="parameters.inventoryItemTypeId" value="NON_SERIAL_INV_ITEM" operator="equals">
<if-compare field="serializedItemCount" value="0" operator="equals">
<set field="parameters.inventoryItemTypeId" value="NON_SERIAL_INV_ITEM"/>
<set field="setNonSerial" value="true"/>
</if-compare>
</if-compare>
<if-compare field="setNonSerial" value="false" operator="equals">
<set field="parameters.inventoryItemTypeId" value="SERIALIZED_INV_ITEM"/>
<set field="returnItem.returnQuantity" value="1" type="BigDecimal"/>
</if-compare> <set from-field="parameters.inventoryItemTypeId" field="receiveCtx.inventoryItemTypeId"/>
<set from-field="returnItem.expectedItemStatus" field="receiveCtx.statusId"/>
<set from-field="returnItem.productId" field="receiveCtx.productId"/>
<set from-field="returnItem.returnItemSeqId" field="receiveCtx.returnItemSeqId"/>
<set from-field="returnItem.returnId" field="receiveCtx.returnId"/>
<set from-field="returnItem.returnQuantity" field="receiveCtx.quantityAccepted"/>
<set from-field="returnHeader.destinationFacilityId" field="receiveCtx.facilityId"/>
<!-- important: associate ShipmentReceipt with return shipment created -->
<set field="receiveCtx.shipmentId" from-field="shipmentId"/> <set field="receiveCtx.comments" value="Returned Item RA# ${returnItem.returnId}"/>
<set field="receiveCtx.datetimeReceived" from-field="nowTimestamp"/>
<set field="receiveCtx.quantityRejected" value="0" type="BigDecimal"/> <call-service service-name="receiveInventoryProduct" in-map-name="receiveCtx"/>
<else>
<calculate field="nonProductItems" type="Long">
<calcop operator="add">
<number value="1"/>
</calcop>
</calculate>
</else>
</if-not-empty>
</iterate> <!-- now that the receive is done; set the need flag to N -->
<refresh-value value-field="returnHeader"/>
<set field="returnHeader.needsInventoryReceive" value="N"/>
<store-value value-field="returnHeader"/> <!-- always check/update the ReturnHeader status, even though it might have been from the receiving above, just make sure -->
<if-compare field="returnHeader.statusId" operator="not-equals" value="RETURN_RECEIVED">
<set field="retStCtx.returnId" from-field="returnHeader.returnId"/>
<set field="retStCtx.statusId" value="RETURN_RECEIVED"/>
<call-service service-name="updateReturnHeader" in-map-name="retStCtx"/>
</if-compare>
<else>
<log level="info" message="Not receiving inventory for returnId ${returnHeader.returnId}, no inventory information available."/>
</else>
</if-compare>
</if-compare>
</simple-method>
大概分析下该simple-method方法,判断returnHeader退货头的needsInventoryReceive字段(需要仓库接收 ),如果是的话,判断退货头的DESTINATION_FACILITY_ID是否等于facilityId,如果等于,就获取库存项的数目,如果库存量大于0,则调用createShipmentForReturn(创建针对退货的装运头)的服务,生成shipmentId,然后判断参数parameters.inventoryItemTypeId是否为空,如果为空,就给默认值NON_SERIAL_INV_ITEM,获取退货项的数目,循环退货项的列表,调用createShipmentItem(装运项)服务,接着继续根据退货项列表循环调用receiveInventoryProduct(创建新的库存项目接收库存(S))服务。
然后还会调好多的别的服务,我就实在没有心思一一仔细阅读了,最后还需要调用这个createReturnStatus服务,这个服务就跟流程日志一样,不管是创建还是针对该对象进行的任何修改操作,都会新增一条这样的状态,用于跟踪退货单的流程。
ofbiz进击 。 ofbiz 退货流程(包含获取可退货项流程分析 以及 取消退货项的过程分析)的更多相关文章
- activiti自定义流程之整合(五):启动流程时获取自定义表单
流程定义部署之后,自然就是流程定义列表了,但和前一节一样的是,这里也是和之前单独的activiti没什么区别,因此也不多说.我们先看看列表页面以及对应的代码,然后在一步步说明点击启动按钮时如何调用自定 ...
- Net Core 使用外部登陆提供程序登陆的流程,以及身份认证的流程
在Asp.Net Core 中使用外部登陆(google.微博...) 原文出自Rui Figueiredo的博文<External Login Providers in ASP.NET C ...
- Android 4.4 Kitkat Phone工作流程浅析(六)__InCallActivity显示更新流程
本文来自http://blog.csdn.net/yihongyuelan 转载请务必注明出处 本文代码以MTK平台Android 4.4为分析对象,与Google原生AOSP有些许差异,请读者知悉. ...
- activiti 一个流程的运转步骤 以请假流程为例
---为了加深对activiti的理解记忆,对自己做的一个流程进行自述.加强记忆 请假实例 一.设计请假的流程图以及流程文件,完善对应数据项,比如用户信息,请假单信息 --请假单 --流程图 --流程 ...
- Activiti第二篇【管理流程定义、执行任务和流程实例、流程变量】
上篇Activiti只是一个快速入门案例,这篇就讲定义.部署.查看任务等等的一些细节[涉及到的数据库表.对象等等]- 管理流程定义 管理流程定义主要涉及到以下的4张表: -- 流程部署相关的表 SEL ...
- 以太网驱动的流程浅析(四)-以太网驱动probe流程【原创】
以太网驱动的流程浅析(四)-以太网驱动probe流程 Author:张昺华 Email:920052390@qq.com Time:2019年3月23日星期六 此文也在我的个人公众号以及<Lin ...
- 034 01 Android 零基础入门 01 Java基础语法 04 Java流程控制之选择结构 01 流程控制概述
034 01 Android 零基础入门 01 Java基础语法 04 Java流程控制之选择结构 01 流程控制概述 本文知识点:Java中的流程控制相关概念的认识 三大流程控制语句结构的简介 顺序 ...
- .NET 开源工作流: Slickflow流程引擎高级开发(十) -- BpmnJS流程设计器集成
前言: 在Slickflow产品开发过程中,前端流程设计器经历了几个不同的版本(jsPlumb, mxGraph等),目的是为了在设计流程时的用户体验更加良好,得到客户的好评和认可.BpmnJS流程设 ...
- java使用websocket,并且获取HttpSession,源码分析
转载请在页首注明作者与出处 http://www.cnblogs.com/zhuxiaojie/p/6238826.html 一:本文使用范围 此文不仅仅局限于spring boot,普通的sprin ...
随机推荐
- MySQL主从架构之Master-Master互为主备
前言 通常,为了简化逻辑,master会设置为只读,正常只通过slave进行读写. 若要两边都写,为了避免自增id冲突,一般会设置奇偶错开,即一台的自增ID均为奇数,另一台均为偶数. 基本原理 首先, ...
- 【转】 Build a RESTful Web service using Jersey and Apache Tomcat 2009
Build a RESTful Web service using Jersey and Apache Tomcat Yi Ming Huang with Dong Fei Wu, Qing GuoP ...
- [troubleshoot][archlinux][X] plasma(KDE) 窗口滚动刷新冻结(约延迟10s)(已解决,root cause不明,无法再次复现)
现象: konsole,setting等plasma的系统应用反应缓慢,在滚动条滚动时,尤为明显. 触发条件: 并不是十分明确的系统滚动升级(Syu)后,产生. 现象收集: 可疑的dmesg [ :: ...
- SQL实现将一个表的数据插入到另外一个表的代码
--第一种情况的 1>如果2张表的字段一致,并且希望插入全部数据,可以用这种方法: INSERT INTO 目标表 SELECT * FROM 来源表; 2>比如要将 articles 表 ...
- mark down pad2
邮箱:Soar360@live.com授权秘钥:GBPduHjWfJU1mZqcPM3BikjYKF6xKhlKIys3i1MU2eJHqWGImDHzWdD6xhMNLGVpbP2M5SN6bnxn ...
- freebsd 禁用root登录ssh并给普通用户登录权限
转自http://www.linux521.com/2009/system/200904/2021.html http://www.myhack58.com/Article/48/67/2011/30 ...
- 使用git Rebase让历史变得清晰
当多人协作开发一个分支时,历史记录通常如下方左图所示,比较凌乱.如果希望能像右图那样呈线性提交,就需要学习git rebase的用法. “Merge branch”提交的产生 我们的工作流程是:修改代 ...
- 美国VPS - DigitalOcean 推荐创业团队使用
初创公司DigitalOcean在美国正迅速成为一个家喻户晓的公司.每月5美元,该公司就可以让你享受到一个虚拟的私有服务器(或者说droplets,很多公司都这么称呼它).该公司的联合创始人兼首席执行 ...
- Aptana Studio 3的汉化
Aptana Studio 3(下面简称Aptana 3)的汉化方法 1.找到这个网站 http://aptana.com/support 2.单击下面的链接 view documentation 在 ...
- Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below binary tree andsum =
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all ...