﻿SELECT [r].[FID], [r].[FActionName], [r].[FDocType], [r].[FTimer]
FROM [r_ApiHostServices] AS [r]
INNER JOIN (
    SELECT [r0].[FID], [r0].[FActionName], [r0].[FDBName], [r0].[FDescription], [r0].[FDocType], [r0].[FFunctionID], [r0].[FGuidColName], [r0].[FIsHostService], [r0].[FNeedBreakSQL], [r0].[FUsing]
    FROM [r_FormIDType] AS [r0]
    WHERE [r0].[FUsing] = CAST(1 AS bit) AND [r0].[FIsHostService] = CAST(1 AS bit)
) AS [t] ON [r].[FDocType] = [t].[FDocType]
WHERE [r].[FTimer] > 0


DECLARE @__Parse_0 int = 8;

SELECT [r].[FID], [r].[FFieldKeys], [r].[FFiledString], [r].[FFormIDTypeID], [r].[FKDBillName], [r].[FLimit], [r].[FOrderString], [r].[FRBBillName], [r].[FStartRow], [r].[FSubSystemID], [r].[FTopRowCount], [r0].[FID], [r0].[FActionName], [r0].[FDBName], [r0].[FDescription], [r0].[FDocType], [r0].[FFunctionID], [r0].[FGuidColName], [r0].[FIsHostService], [r0].[FNeedBreakSQL], [r0].[FUsing], [r1].[FID], [r1].[FDescription], [r1].[FFunctionName], [r1].[FGoupID], [r1].[FInterfaceType], [r1].[FUrl], [r1].[FUsing], [a].[FID], [a].[FName], [a].[FTokenUrl], [a].[FVersion]
FROM [r_CloudBillQuery] AS [r]
INNER JOIN [r_FormIDType] AS [r0] ON [r].[FFormIDTypeID] = [r0].[FID]
INNER JOIN [r_FunctionList] AS [r1] ON [r0].[FFunctionID] = [r1].[FID]
INNER JOIN [APIGrou] AS [a] ON [r1].[FGoupID] = [a].[FID]
WHERE [r0].[FUsing] = CAST(1 AS bit) AND [r1].[FUsing] = CAST(1 AS bit) AND [a].[FID] = @__Parse_0
    AND r.FID = 3
    AND r0.FDocType = 'TB_PP_WPLAN'


    SELECT * FROM r_DataSaveBatch

    SELECT * FROM r_FormIDType WHERE FActionName = 'PostAsync'

    /*dialect*/SELECT DISTINCT  * from dbo.GetWPLAN(null,'@D',@defaultorgid)

    --'FID,FBillType.FNumber,FPrdOrgId.FNumber,FInStockOwnerTypeId,FInStockOwnerId.FNumber,FMaterialId.FNumber,FProductType,FInStockType,FUnitID.FNumber,FBaseUnitId.FNumber,FOwnerTypeId,FOwnerId.FNumber,FAuxPropId.FF100001.FNumber,FMTONO,FProjectNo,FWorkShopID.FNumber,FBillNo,FBillType,FTreeEntity_FEntryId,FTreeEntity_FSeq,FNoStockInQty,FBaseNoStockInQty'
    SELECT * FROM r_CloudBillQuery WHERE FFormIDTypeID = 25

    --update r_CloudBillQuery SET FFieldKeys = 'FID,FBillType.FNumber,FBillType,FPrdOrgId.FNumber,FInStockOwnerTypeId,FInStockOwnerId.FNumber,FMaterialId.FNumber,FProductType,FInStockType,FUnitID.FNumber,FBaseUnitId.FNumber,FOwnerTypeId,FOwnerId.FNumber,FAuxPropId.FF100001.FNumber,FMTONO,FProjectNo,FWorkShopID.FNumber,FBillNo,FTreeEntity_FEntryId,FTreeEntity_FSeq,FNoStockInQty,FBaseNoStockInQty'
    --WHERE FFormIDTypeID = 25 AND FID = 22
    SELECT * FROM r_BillConvertes

    SELECT ISNULL(QUEUE_ID,'') FQUEUE_ID,T1.FBillNo,T1.FID,T2.FENTRYID,T2.FSEQ FROM T_PRD_RETURNMTRL T1 INNER JOIN T_PRD_RETURNMTRLENTRY T2 ON T2.FID=T1.FID WHERE T1.FPRDORGID=@defaultorgid AND ISNULL(QUEUE_ID,'') IN ({0})