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 ...
随机推荐
- 阻止默认行为stopDefault
function stopDefault(e){ if(e && e.preventDefault) e.preventDefault(); else window.event.ret ...
- FW:使用weave管理docker网络
Posted on 2014-11-12 22:20 feisky 阅读(1761) 评论(0) 编辑 收藏 weave简介 Weave creates a virtual network that ...
- 获得sql对应的binary
Declare @max Varbinary(max) select @Max = convert(Varbinary(max) , ' Select ' ) Print ' DECLARE @sql ...
- redis配置文件中文解释
# redis 配置文件示例 # 当你需要为某个配置项指定内存大小的时候,必须要带上单位, # 通常的格式就是 1k 5gb 4m 等酱紫: # # 1k => bytes # 1kb => ...
- jquery rotate
网上发现一个很有意思的jQuery旋转插件,支持Internet Explorer 6.0+ .Firefox 2.0 .Safari 3 .Opera 9 .Google Chrome,高级浏览器下 ...
- __proto__和protaotype的区分
直接看这样一个例子. var XXX = function(){}; var p = new XXX(); 可以把上面的例子拆分为如下一个过程: var p={}; //初始化一个对象p p.__pr ...
- js跳转方法
很有用的东西,参考自http://www.zhuoda.org/lunzi/66097.html 第一种 <script language="javascript" type ...
- 【转】Android 获得view的宽和高
转自:http://blog.csdn.net/yangdeli888/article/details/25405263 Android 获得view的宽和高 分类: android 技术点项目20 ...
- Sequential Read Ahead For SQL Server
Balancing CPU and I/O throughput is essential to achieve good overall performance and to maximize ha ...
- svn使用svnsync实现双机热备
前提条件: 主:10.11.100.205从:10.11.100.50 源目录:http://10.11.100.205/svn/rep-ops目标目录:http://10.11.100.50/svn ...