1234567891011121314151617181920212223242526 |
- /*********************************************************
- --¸ù¾Ý³ö»õ¼Æ»®ÐÐkey»ñÈ¡bomTree
- **********************************************************/
- If OBJECT_ID(N'Cust_BC_POShipLineGetBomTree',N'P') Is Not NULL
- Begin
- Drop Proc Cust_BC_POShipLineGetBomTree
- End
- GO
- Create Procedure Cust_BC_POShipLineGetBomTree
- @EntityKey bigint
- AS
- Begin
- declare @ParentID bigint =0;
- select @ParentID =ParentLine from PM_POShipLine where id=@EntityKey
- select a.ID,0 as ParentID,a.ItemInfo_ItemCode as ItemCode,a.ItemInfo_ItemName as ItemName,1 as Num from PM_POShipLine as a where ID=@ParentID
- union(
- select a.ID,a.ParentLine as ParentID,a.ItemInfo_ItemCode as ItemCode,a.ItemInfo_ItemName as ItemName,a.ReqQtyCU/b.ReqQtyCU as Num from PM_POShipLine as a left join PM_POShipLine as b on a.ParentLine=b.ID where a.ParentLine=@ParentID
- )
-
- End
|