阳光网驿-企业信息化交流平台【DTC零售连锁全渠道解决方案】

 找回密码
 注册

QQ登录

只需一步,快速开始

扫描二维码登录本站

手机号码,快捷登录

老司机
查看: 1442|回复: 0

[原创] 在物料上新增即时库存字段,这样在写好多报表的的时候即时库存就可以直接取过来了.

[复制链接]
  • TA的每日心情
    难过
    2017-10-30 09:22
  • 签到天数: 57 天

    [LV.5]常住居民I

    发表于 2008-12-16 22:52:20 | 显示全部楼层 |阅读模式
    版本:k3 v11.01

    IF EXISTS (select name from sysobjects where name='tr_即时库存' and xtype='tr')
    DROP TRIGGER tr_即时库存
    GO
    CREATE TRIGGER tr_即时库存 ON ICInventory
    FOR INSERT,UPDATE,DELETE
    AS
    update t1 set t1.F_102=t2.FQty
    from t_ICItemCustom t1
    inner join (select t1.FItemID,t1.FBatchNo,sum(t1.FQty) as FQty
    from ICInventory t1
    where t1.FItemId in(select FItemID from inserted ) and t1.FQty<>0
    group by t1.FItemID,t1.FBatchNo) t2 on t1.FItemID=t2.FItemid

    IF EXISTS (select name from sysobjects where name='tr_即时库存icitem' and xtype='tr')
    DROP TRIGGER tr_即时库存icitem
    CREATE TRIGGER tr_即时库存icitem ON t_ICItem
    FOR INSERT,UPDATE
    AS
    update t1 set t1.F_102=t2.FQty
    from t_ICItemCustom t1
    inner join (select t1.FItemID,t1.FBatchNo,sum(t1.FQty) as FQty
    from ICInventory t1
    where t1.FItemId in(select FItemID from inserted ) and t1.FQty<>0
    group by t1.FItemID,t1.FBatchNo) t2 on t1.FItemID=t2.FItemid

    [ 本帖最后由 zhashutiao 于 2008-12-16 22:54 编辑 ]

    评分

    参与人数 1阳光币 +1 收起 理由
    M700 + 1 使用经验分享

    查看全部评分

    楼主热帖
    启用邀请码注册,提高发帖质量,建设交流社区
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    快速回复 返回顶部 返回列表