sql=@"SELECT y.DepCode+a.ToWarehouseCode+y.OOCode+a.MUSER AS Costre,y.DepCode,a.ToWarehouseCode AS WarehouseCode,y.OOCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY y.DepCode,a.ToWarehouseCode,y.OOCode,c.SourceDetailID,a.InvCode) AS Sequence,
sql=@"SELECT y.DepCode+a.ToWarehouseCode+y.OOCode+a.MUSER AS Costre,y.DepCode,a.ToWarehouseCode AS WarehouseCode,y.OOCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY y.DepCode,a.ToWarehouseCode,y.OOCode,c.SourceDetailID,a.InvCode) AS Sequence,
sql=@"SELECT a.ToWarehouseCode+z.ApplyCode+a.MUSER AS Costre,'' AS DepCode,a.ToWarehouseCode AS WarehouseCode,z.ApplyCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY a.ToWarehouseCode,z.ApplyCode,c.SourceDetailID,a.InvCode) AS Sequence,
sql=@"SELECT a.ToWarehouseCode+z.ApplyCode+a.MUSER AS Costre,'' AS DepCode,a.ToWarehouseCode AS WarehouseCode,z.ApplyCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY a.ToWarehouseCode,z.ApplyCode,c.SourceDetailID,a.InvCode) AS Sequence,
sql=@"SELECT ISNULL(y.DepCode, '')+a.ToWarehouseCode+ISNULL(y.OOCode, z.ApplyCode)+a.MUSER AS Costre,ISNULL(y.DepCode, '') AS DepCode,a.ToWarehouseCode AS WarehouseCode,CASE WHEN m.PickID IS NOT NULL THEN '生产订单' WHEN m.ApplyDetailID IS NOT NULL THEN '领料申请单' ELSE '' END AS SourceType,ISNULL(y.OOCode, z.ApplyCode) AS OOCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY ISNULL(y.DepCode, ''),a.ToWarehouseCode,ISNULL(y.OOCode, z.ApplyCode),a.InvCode) AS Sequence,
sql=@"SELECT ISNULL(y.DepCode, '')+a.ToWarehouseCode+ISNULL(y.OOCode, z.ApplyCode)+a.MUSER AS Costre,ISNULL(y.DepCode, '') AS DepCode,a.ToWarehouseCode AS WarehouseCode,CASE WHEN m.PickID IS NOT NULL THEN '生产订单' WHEN m.ApplyDetailID IS NOT NULL THEN '领料申请单' ELSE '' END AS SourceType,ISNULL(y.OOCode, z.ApplyCode) AS OOCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY ISNULL(y.DepCode, ''),a.ToWarehouseCode,ISNULL(y.OOCode, z.ApplyCode),a.InvCode) AS Sequence,