LotSerMst-tabel stelt de kosten in op nul tijdens een bin-naar-bin-overdracht in één stap

Dit artikel biedt een oplossing voor het probleem dat de kosten in de tabel LotSerMst naar nul gaan in een bin-to-bin-overdracht met één stap in Microsoft Dynamics SL.

Van toepassing op: Microsoft Dynamics SL
Origineel KB-nummer: 3034220

Symptomen

U ziet dat de kosten in de tabel LotSerMst op nul worden ingesteld nadat u een overdracht in één stap hebt uitgevoerd, van bin naar bin.

Oplossing

Trigger toepassen op database:

create trigger xLotSerMstCost on LotSerMst for insert as
set nocount on
if (select COUNT(*) from inserted where Cost=0)>0
begin
update L set L.Cost=(select MAX(m.cost) from LotSerMst m with (nolock) inner join inserted i on m.Invtid = i.invtid and m.LotSerNbr=i.LotSerNbr)
 from LotSerMst L
 inner join inserted i on L.InvtID=i.InvtID and L.LotSerNbr=i.LotSerNbr and L.SiteID=i.SiteID and L.WhseLoc=i.WhseLoc
 inner join Inventory invt with (nolock) on i.InvtID=invt.InvtID
 where i.Cost=0 and i.LotSerNbr<>'' and i.OrigQty=1 and invt.LotSerTrack='SI'
end
go