找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 2269|回复: 3

[求助] 未将对象引用设置到对象的实例 请问如何解决

[复制链接]
发表于 2022-12-6 09:35:21 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

×
[12-05 18:00:44][PATCH_RUN] - ExecuteSingleFile end (with error).
[12-05 18:00:44][PATCH_RUN] - 执行错误的脚本内容:if object_id(N'BC_AnalyzeASNBarCode',N'P') is not null
begin
    drop proc BC_AnalyzeASNBarCode
END
go
Create procedure BC_AnalyzeASNBarCode
    @BarCode Nvarchar(Max)
As
Begin

    Declare @ErrorMess Nvarchar(1000)

    Declare @BarCodeID bigint
    Declare @BarCodeType Nvarchar(100)
    Declare @EntityID bigint
    Declare @EntityType nvarchar(100)
    Declare @EntityLineID bigint
    Declare @EntityLineType nvarchar(100)
    Declare @Qty decimal

    Select @BarCodeID=ID, @BarCodeType=BarCodeType, @EntityID=CreateEntity_EntityID,@EntityType=CreateEntity_EntityType ,
        @EntityLineID=CreateEntity_EntityID,@Qty=Qty
    From BC_BarCode Where Code=@BarCode


    -- 单据头条码
    If @BarCodeType=0 and @EntityType='UFIDA.U9.PM.ASN.ASN' and  @EntityID>0
    Begin
        If Not Exists( Select 1 From PM_ASN where ID=@EntityID)
        Begin
            Raiserror('条码对应的创建ASN单据不存在,无法解析',16,1)
            Return
        End
                If Not Exists ( Select 1 From PM_ASN a   where a.ID=@EntityID and ((a.IsNeedPurConfirm=1 and a.IsConfirmed=1) or a.IsNeedPurConfirm=0) and a.Status=2)
        Begin
            Raiserror('ASN单未审核、或者需要做供应商确认',16,1)
            Return
        End

        Select
            @BarCode as BarCode,
            0 as IsItemCode,
            1 as Success,
            '' as ErrMsg,
            1 as 'DocInfos.$.*'

        Select
            1 as 'DocInfos.$',
            b.ID as EntityKey,
            'UFIDA.U9.PM.ASN.ASNLine' as EntityType,
            a.DocNo as DocNo,
            a.BusinessDate as DocDate,
            b.ItemInfo_ItemID as ItemID,
            c.Code as ItemCode,
            c.Name as ItemName,
            c.SPECS as ItemSpecs,
            b.LotMater as LotCode,
            b.TradeUOM as UOM,
            b.TradeBaseUOM as BaseUOM,
            d1.Name as TradeUOMName,
            b.ShipQtyTU-b.TotalRcvQtyTU as CanReceiveQty,
            b.ShipQtyTU-b.TotalRcvQtyTU as ReceivedQty,
            CONVERT(varchar(100), a.BusinessDate, 120) as DocDateStr,
            d.Round_RoundValue as RoundValue,
            d.Round_RoundType as RoundType,
            d.Round_Precision as RoundSpecision,
            a.Supplier_Supplier as SupplierID,
            a.Supplier_Code as SupplierCode,
            supplier.Name as SupplierName,
            @BarCode as BarCode
        From PM_ASN a
        Inner Join PM_ASNLine b on a.ID=b.ASN
        Inner Join CBO_ItemMaster c on b.ItemInfo_ItemID=c.ID
                left join CBO_Supplier_Trl supplier on supplier.ID = a.Supplier_Supplier and supplier.SysMLFlag='zh-CN'
        Inner Join Base_UOM d on b.TradeUOM=d.ID
        Left Join Base_UOM_trl d1 on d.ID=d1.ID and d1.SysMLFlag='zh-CN'
        Where a.ID=@EntityID  and ((a.IsNeedPurConfirm=1 and a.IsConfirmed=1) or a.IsNeedPurConfirm=0) and  a.Status=2

    End
    Else If @BarCodeType=1 and @EntityType='UFIDA.U9.PM.ASN.ASNLine' and  @EntityID>0
    Begin

        If Not Exists( Select 1 From PM_ASNLine where ID=@EntityID)
        Begin
            Raiserror('条码对应的创建ASN单据行不存在,无法解析',16,1)
            Return
        End

                If Not Exists ( Select 1 From PM_ASN a Inner Join PM_ASNLine b on a.ID=b.ASN  where b.ID=@EntityID and ((a.IsNeedPurConfirm=1 and a.IsConfirmed=1) or a.IsNeedPurConfirm=0) and a.Status=2)
        Begin
            Raiserror('ASN单未审核、或者需要做供应商确认',16,1)
            Return
        End

         Select
            @BarCode as BarCode,
            0 as IsItemCode,
            1 as Success,
            '' as ErrMsg,
            1 as 'DocInfos.$.*'

        Select
            1 as 'DocInfos.$',
            b.ID as EntityKey,
            'UFIDA.U9.PM.ASN.ASNLine' as EntityType,
            a.DocNo as DocNo,
            a.BusinessDate as DocDate,
            b.ItemInfo_ItemID as ItemID,
            c.Code as ItemCode,
            c.Name as ItemName,
            c.SPECS as ItemSpecs,
            b.LotMater as LotCode,
            b.TradeUOM as UOM,
            b.TradeBaseUOM as BaseUOM,
            d1.Name as TradeUOMName,
            b.ShipQtyTU-b.TotalRcvQtyTU as CanReceiveQty,
            b.ShipQtyTU-b.TotalRcvQtyTU as ReceivedQty,
            CONVERT(varchar(100), a.BusinessDate, 120) as DocDateStr,
            d.Round_RoundValue as RoundValue,
            d.Round_RoundType as RoundType,
            d.Round_Precision as RoundSpecision,
            a.Supplier_Supplier as SupplierID,
            a.Supplier_Code as SupplierCode,
            supplier.Name as SupplierName,
            @BarCode as BarCode
        From PM_ASN a
        Inner Join PM_ASNLine b on a.ID=b.ASN
        Inner Join CBO_ItemMaster c on b.ItemInfo_ItemID=c.ID
                left join CBO_Supplier_Trl supplier on supplier.ID = a.Supplier_Supplier  and supplier.SysMLFlag='zh-CN'
        Inner Join Base_UOM d on b.TradeUOM=d.ID
        Left Join Base_UOM_trl d1 on d.ID=d1.ID and d1.SysMLFlag='zh-CN'
        Where b.ID=@EntityID  and ((a.IsNeedPurConfirm=1 and a.IsConfirmed=1) or a.IsNeedPurConfirm=0) and  a.Status=2
    End
    Else If @BarCodeType=3 and @EntityType='UFIDA.U9.PM.ASN.ASNLine' and  @EntityID>0
    Begin
        
        If Not Exists( Select 1 From PM_ASNLine where ID=@EntityID)
        Begin
            Raiserror('条码对应的创建ASN单据行不存在,无法解析',16,1)
            Return
        End
               
                If Not Exists ( Select 1 From PM_ASN a Inner Join PM_ASNLine b on a.ID=b.ASN  where b.ID=@EntityID and ((a.IsNeedPurConfirm=1 and a.IsConfirmed=1) or a.IsNeedPurConfirm=0) and a.Status=2)
        Begin
            Raiserror('ASN单未审核、或者需要做供应商确认',16,1)
            Return
        End

        Select
            @BarCode as BarCode,
            1 as IsItemCode,
            1 as Success,
            '' as ErrMsg,
            1 as 'DocInfos.$.*'

        Select
            1 as 'DocInfos.$',
            b.ID as EntityKey,
            'UFIDA.U9.PM.ASN.ASNLine' as EntityType,
            a.DocNo as DocNo,
            a.BusinessDate as DocDate,
            b.ItemInfo_ItemID as ItemID,
            c.Code as ItemCode,
            c.Name as ItemName,
            c.SPECS as ItemSpecs,
            b.LotMater as LotCode,
            b.TradeUOM as UOM,
            b.TradeBaseUOM as BaseUOM,
            d1.Name as TradeUOMName,
            b.ShipQtyTU-b.TotalRcvQtyTU as CanReceiveQty,
            @Qty as ReceivedQty,
            CONVERT(varchar(100), a.BusinessDate, 120) as DocDateStr,
            d.Round_RoundValue as RoundValue,
            d.Round_RoundType as RoundType,
            d.Round_Precision as RoundSpecision,
            a.Supplier_Supplier as SupplierID,
            a.Supplier_Code as SupplierCode,
            supplier.Name as SupplierName,
            @BarCode as BarCode
        From PM_ASN a
        Inner Join PM_ASNLine b on a.ID=b.ASN
        Inner Join CBO_ItemMaster c on b.ItemInfo_ItemID=c.ID
                left join CBO_Supplier_Trl supplier on supplier.ID = a.Supplier_Supplier  and supplier.SysMLFlag='zh-CN'
        Inner Join Base_UOM d on b.TradeUOM=d.ID
        Left Join Base_UOM_trl d1 on d.ID=d1.ID and d1.SysMLFlag='zh-CN'
        Where b.ID=@EntityID  and ((a.IsNeedPurConfirm=1 and a.IsConfirmed=1) or a.IsNeedPurConfirm=0) and  a.Status=2
    End
    Else If @BarCodeID Is Not Null
    Begin      
        Raiserror('条码类型不是ASN创建的单据条码或者料品条码,无法解析',16,1)
        Return     
    End
    Else
    Begin      
        Raiserror('未在条码主档中找到当前条码,请检查',16,1)
        Return     
    End
   
End

[12-05 18:00:44][PATCH_RUN] - 列名 'LotMater' 无效。
列名 'LotMater' 无效。
列名 'LotMater' 无效。
[12-05 18:00:57][PATCH_RUN] - 下列SQL执行出错
[12-05 18:00:57][PATCH_RUN] - C:\U9Patch\temp\U9V66E.BC.1002211010000018_20221205.055928\PostSql\BC_AnalyzeASNBarCode.sql

[12-05 18:00:57][PATCH_RUN] - 执行出错的SQL
[12-05 18:00:57][PATCH_RUN] -         BC_AnalyzeASNBarCode.sql

发表于 2022-12-6 14:02:17 | 显示全部楼层
学习一下~
回复 点赞 拍砖

使用道具 举报

发表于 2022-12-10 14:49:57 | 显示全部楼层
不错不错
回复 点赞 拍砖

使用道具 举报

发表于 2022-12-13 13:00:24 | 显示全部楼层
说老实话,没看明白
回复 点赞 拍砖

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-12-4 01:54 , Processed in 0.055343 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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