|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
[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
|
|