65.3、WebApi,保存接口,更新,NeedUpDateFields:需要更新的字段原创
金蝶云社区-林荫大道cc
林荫大道cc
13人赞赏了该文章 9148次浏览 未经作者许可,禁止转载编辑于2020年07月18日 14:37:57
封面

65.1


业务场景:用WebApi,新增采购订单,保存后,更新修改字段


1、继续上一节,生成一笔创建状态的采购订单,返回结果如下图


image.png


image.png


{
    "Result": {
        "ResponseStatus": {
            "IsSuccess": true,
            "Errors": [],
            "SuccessEntitys": [
                {
                    "Id": 100033,
                    "Number": "CGDD000016",
                    "DIndex": 0
                }
            ],
            "SuccessMessages": [],
            "MsgCode": 0
        },
        "Id": 100033,
        "Number": "CGDD000016",
        "NeedReturnData": [
            {
                "FID": 100033,
                "FBillNo": "CGDD000016",
                "FPOOrderEntry": [
                    {
                        "FEntryID": 100037,
                        "FMaterialId": {
                            "FNumber": "001"
                        },
                        "FQty": "300"
                    }
                ]
            }
        ]
    }
}


image.png




2、更新,修改 单据体,物料数量,物料001改成002,数量300改成2



image.png


{
    "Creator": "",
    "NeedUpDateFields": [
        "FBillNo",
        "FPOOrderEntry",
        "FMaterialId",
        "FQty"
    ],
    "Model": {
        "FID": "100033",
        "FBillNo": "CGDD000016",
        "FPOOrderEntry": [{
            "FEntryID": "100037",
            "FMaterialId": {
                "FNumber": "002"
            },
            "FQty":2
        }]
    }
}


image.png


更新:NeedUpDateFields:需要更新的字段,数组类型,格式:[key1,key2,...](非必录) 

注(更新单据体字段得加上单据体key)



3、采购订单,修改后


image.png



4、注意,不能只更新修改物料,需要同时更新物料和数量,单价等等


     1、更新物料后,会清空单价


     2、只更新物料,测试,报错


{
    "Creator": "",
    "NeedUpDateFields": [
        "FBillNo",
        "FPOOrderEntry",
        "FMaterialId"
    ],
    "Model": {
        "FID": "100033",
        "FBillNo": "CGDD000016",
        "FPOOrderEntry": [{
            "FEntryID": "100037",
            "FMaterialId": {
                "FNumber": "002"
            }
        }]
    }
}


image.png


image.png


总目录链接

https://vip.kingdee.com/article/649938720145912

赞 13