通过WebAPI保存接口创建分步式调入单(API接口生成关联单据)原创
金蝶云社区-fengyj
fengyj
120人赞赏了该文章 1,328次浏览 未经作者许可,禁止转载编辑于2023年12月29日 19:56:07

       通过WebAPI保存接口创建分步式调入单。我们知道,分步式调入单一般是与分步式调出单一起使用的,他们之间存在上下游关联关系,即可以通过下查或者上查来找到彼此。这种关联关系的创建在系统里一般是通过【下推】或【选单】的操作完成。当然,WebAPI也提供了下推接口供我们使用,由于API下推存在一些局限性,可能不能满足我们的需求,如分多次下推等场景不能通过下推接口直接实现,这时我们就需要通过分步式调入单的保存接口来实现。


        API创建关联关系说明:https://vip.kingdee.com/article/178896?productLineId=1


一、分步式调入单JSON示例:

{
    "NeedUpDateFields": [ ], 
    "NeedReturnFields": [ ], 
    "IsDeleteEntry": "true", 
    "SubSystemId": "", 
    "IsVerifyBaseDataField": "false", 
    "IsEntryBatchFill": "true", 
    "ValidateFlag": "true", 
    "NumberSearch": "true", 
    "IsAutoAdjustField": "false", 
    "InterationFlags": "", 
    "IgnoreInterationFlag": "", 
    "IsControlPrecision": "false", 
    "ValidateRepeatJson": "false", 
    "Model": {
        "FID": 0, 
        "FBillTypeID": {
            "FNUMBER": "FBDR01_SYS"
        }, 
        "FTransferBizType": "InnerOrgTransfer", 
        "FTransferDirect": "GENERAL", 
        "FStockOrgID": {
            "FNumber": "101.2"
        }, 
        "FStockOutOrgID": {
            "FNumber": "101.2"
        }, 
        "FTransferMode": "INDIRECT", 
        "FDate": "2023-12-29 00:00:00", 
        "FOwnerTypeOutIdHead": "BD_OwnerOrg", 
        "FOwnerOutIdHead": {
            "FNumber": "101.2"
        }, 
        "FBizType": "NORMAL", 
        "FVESTONWAY": "A", 
        "FOwnerTypeIdHead": "BD_OwnerOrg", 
        "FBaseCurrID": {
            "FNumber": "PRE001"
        }, 
        "FSUPPLIERID": {
            "FNUMBER": "VEN00007"
        }, 
        "FVirIsSameAcctOrg": false, 
        "FSTKTRSINENTRY": [
            {
                "FMaterialID": {
                    "FNumber": "000136"
                }, 
                "FUnitID": {
                    "FNumber": "Pcs"
                }, 
                "FPlanTransferQty": 10, 
                "FQty": 10, 
                "FPathLossQty": 0, 
                "FDestLot": {
                    "FNumber": "00011"
                }, 
                "FSrcStockID": {
                    "FNumber": "CK006"
                }, 
                "FDestStockID": {
                    "FNumber": "CK001"
                }, 
                "FSrcStockStatusID": {
                    "FNumber": "KCZT05_SYS"
                }, 
                "FDestStockStatusID": {
                    "FNumber": "KCZT01_SYS"
                }, 
                "FSrcBillType": "STK_TRANSFEROUT", 
                "FSrcBillNo": "FBDC000319", 
                "FKeeperTypeOutID": "BD_KeeperOrg", 
                "FKeeperOutID": {
                    "FNumber": "101.2"
                }, 
                "FOwnerTypeOutID": "BD_OwnerOrg", 
                "FOwnerOutID": {
                    "FNumber": "101.2"
                }, 
                "FOwnerTypeID": "BD_OwnerOrg", 
                "FOwnerID": {
                    "FNumber": "101.2"
                }, 
                "FBusinessDate": "2023-05-19 00:00:00", 
                "FSrcMaterialId": {
                    "FNumber": "000136"
                }, 
                "FLOT": {
                    "FNumber": "00011"
                }, 
                "FBaseQty": 10, 
                "FExtAuxUnitQty": 0, 
                "FWayAuxUnitQty": 0, 
                "FBasePlanTransQty": 10, 
                "FKeeperTypeID": "BD_KeeperOrg", 
                "FKeeperID": {
                    "FNumber": "101.2"
                }, 
                "FBasePathLossQty": 0, 
                "FBaseUnitID": {
                    "FNumber": "Pcs"
                }, 
                "FSTKTSTKRANSFERINENTRY_Link": [/*包含在每行明细中,数组类型*/
                    {
                        "FSTKTSTKRANSFERINENTRY_Link_FRuleId": "STK_TRANSFEROUT-STK_TRANSFERIN", /*单据转换规则*/
                        "FSTKTSTKRANSFERINENTRY_Link_FSTableName": "T_STK_STKTRANSFEROUTENTRY", /*上游单据明细表,需要注意单据转换关联的是哪个单据体*/
                        "FSTKTSTKRANSFERINENTRY_Link_FSBillId": 10000, /*上游单据的单据內码ID*/
                        "FSTKTSTKRANSFERINENTRY_Link_FSId": 1000000, /*上游单据的明细內码ID*/
                        "FSTKTSTKRANSFERINENTRY_Link_FBaseTransferQtyOld": 5, /*上游单据数量,也就是调出数量,当有拆单时也是不变的*/
                        "FSTKTSTKRANSFERINENTRY_Link_FBaseTransferQty": 5 /*在本单中的调入数量,这个数量应该是小于等于FSTKTSTKRANSFERINENTRY_Link_FBaseTransferQtyOld*/
                    }, 
                    {
                        "FSTKTSTKRANSFERINENTRY_Link_FRuleId": "STK_TRANSFEROUT-STK_TRANSFERIN", /*当合并下推时,一行调入单分录中存在多个上游单据或明细行*/
                        "FSTKTSTKRANSFERINENTRY_Link_FSTableName": "T_STK_STKTRANSFEROUTENTRY", 
                        "FSTKTSTKRANSFERINENTRY_Link_FSBillId": 10001, 
                        "FSTKTSTKRANSFERINENTRY_Link_FSId": 1000001, 
                        "FSTKTSTKRANSFERINENTRY_Link_FBaseTransferQtyOld": 5, 
                        "FSTKTSTKRANSFERINENTRY_Link_FBaseTransferQty": 5
                    }
                ]
            }
        ]
    }
}


二、如何查看关联单据体的字段


       在系统WEBAPI列表中,每个单据的保存接口说明文档中都包含了关联单据体的内容,如下图:

上传图片



三、查看 单据转换规则 ID


上传图片


图标赞 120
120人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!