SBO系统中销售订单日志的跟踪统计思路分析
来源:互联网 发布:淘宝游戏专营申请入口 编辑:程序博客网 时间:2024/05/04 14:51
在一个客户做项目的时候,客户碰到一个问题,就是销售人员在作了销售订单后,在后续过程中由于客户的原因或其他原因需要不断的调整销售订单的行交期,导致生产及仓库及管理人员无法及时监控这种变化,尽管SBO的销售订单上可以通过日志来查看某一张销售订单的变更日志,但必须知道订单号才可以查看订单修改情况,而且只能一张一张得去找,人工找的工作量又很大,而且如果该销售订单存在多次修改的情况,同一行多次修改了行交期等因素的存在使得这个情况的掌控变得越来越复杂。
为了解决这个问题,经过对SBO的日志进行分析,写了一个查询来实现这个跟踪查询。尽管这个查询在数据库单据量比较大的时候会有点慢,但毕竟可以监控这个流程了。
再次我把其中的完整的查询语句贡献给大家,希望对大家有所帮助。我也希望所有从事SBO工作的朋友也能够把大家的经验共享出来,为自己也为大家解决些实实在在的问题。这也是人生的一大乐事。
对于这个SQL,我是用到了一些游标的循环处理,建议大家参考sql的帮助。
_declare@WL_result table (docentry int,numatcard nvarchar(100) ,linenum int,itemcode nvarchar(20),itemname nvarchar(250),num1 int,num2 int,dt1 datetime,dt2
datetime,dt3 datetime)
_declare@dt1 datetime
_declare@dt2 datetime
_declare@dt3 datetime
_declare@loginstanc int
_declare@docentry int
_declare@linenum int
_declare@numatcard nvarchar(100)
_declare@itemcode nvarchar(20)
_declare@itemname nvarchar(250)
_insertinto @WL_result(docentry,linenum,num1,num2)
_selecta4.docentry,a4.linenum ,a4.num1,qty2
from
(
_selecta3.docentry,a3.linenum,a3.num1,sum(a3.qty) qty2
from (
_selectdistinct a1.docentry,a1.linenum,shipdate,
(_selectcount(*) from ado1 a2 where a2.docentry=a1.docentry and a2.linenum=a1.linenum and a2.ObjType= a1.ObjType) num1,1 qty
from ado1 a1
where a1.ObjType =’17′ ) a3
group by a3.docentry,a3.linenum,a3.num1
) a4
where a4.qty2>1
order by a4.docentry,a4.linenum
_declareGET_0 CURSOR
FOR _selectdocentry, linenum
FROM @WL_result
OPEN GET_0
FETCH GET_0 INTO @docentry,@linenum
WHILE @@fetch_status=0
begin
_selecttop 1 @dt2=a1.shipdate ,@dt3=a2.updatedate,@loginstanc=a1.loginstanc from ado1 a1,adoc a2 where a1.ObjType =’17′ and a1.docentry=@docentry and
a1.linenum=@linenum
and a2.ObjType=a1.ObjType and a2.docentry=a1.docentry and a1.loginstanc=a2.loginstanc order by a1.shipdate desc ,a2.updatedate
_select@dt1=a1.shipdate from ado1 a1 where a1.ObjType =’17′ and a1.docentry=@docentry and a1.linenum=@linenum and loginstanc=@loginstanc-1
_select@numatcard=numatcard from ordr where docentry=@docentry
_select@itemcode=itemcode,@itemname=dscription from rdr1 where docentry=@docentry and linenum=@linenum
_update@WL_result set dt1= @dt1,dt2=@dt2,dt3=@dt3, numatcard=@numatcard,itemcode=@itemcode,itemname=@itemname
where docentry=@docentry and linenum=@linenum
FETCH next from GET_0 INTO @docentry,@linenum
end
CLOSE GET_0
DEALLOCATE GET_0
_selectdocentry ‘订单编号‘,numatcard ‘客户参考号‘,linenum ‘行号‘,itemcode ‘物料代码‘,itemname ‘物料名称‘,dt1 ‘行原交期‘,dt2 ‘最后修改后交期‘,dt3 ‘最后修改日期‘ from @WL_result where dt3>_cast(’2008-9-1′ as datetime) and dt3<_cast(’2009-4-1′ as datetime) order by docentry,linenum
基于这个思路大家可以结合SBO的功能对SBO任何日志去做日志需求定制查询。
在以上语句中,倒数第二行中的日期范围可以大家自己输入一个日期范围。如果大家希望在SBO的查询里边实现也能看到订单连接和物料代码的连接以及这两个时间段的条件变量也可以输入的功能。
0 0
- SBO系统中销售订单日志的跟踪统计思路分析
- 订单状态的跟踪分析
- Oracle EBS中订单登记后,发放销售订单以便挑库时,找不到相应的销售订单
- abap中 生产订单、销售订单、内部订单各自编号的数据字段类型
- ABAP中(生产订单、销售订单、内部订单)各自编号的数据字段类型
- 将销售订单中docType改成下拉列表的方法
- zencart lightinthebox 整合ERP 进销存 销售利润报表分析 订单导出excel 导出excel 和图表统计 zencart lightinthebox订单统计报表分析
- 关于销售订单的状态
- 关于销售订单的状态
- 关于销售订单的状态
- 关于销售订单的状态
- 关于销售订单的状态
- 关于销售订单的状态
- SBO中打印Pack List的方法
- SBO 中 预收款对应的业务分录
- 订单管理系统设计思路
- sap-abap-销售订单的订货,生产,存货,发货情况统计报表
- WCF广州本田整车销售系统技术解析(二) 订单管理功能实现分析
- 大神帮忙 谢谢了 求哪里错了 新手 问题有点幼稚 谢谢了
- Android API Guiede---Animation and Graphics
- HTTP协议的一些笔记
- 字长与指针
- 南京理工大学第八届程序设计大赛(校外镜像) - 谁才是最强战舰! (博弈论)
- SBO系统中销售订单日志的跟踪统计思路分析
- 大神帮我看看这段代码为什么运行不了,谢谢了
- 我的第一个Android项目。
- html5屏幕旋转事件
- Coding
- hdu4751(判断二分图)
- 缺失索引自动创建语句
- 【自定义标签开发】07-标签案例-开发if标签
- 修改jar启动时命令行参数,修改引用库路径,及本地化设置