【WEBAPI】采购订单新变更单接口JSON样例
【WEBAPI】采购订单新变更单接口JSON样例
场景一:采购订单无上游单据直接变更
{ "Model": { "FID": 0, "FBillTypeID": { "FNumber": "CGDD01_SYS" }, "FPKIDX_H": 113757,(原订单的单据FID,肯定不能为空的) "FVersionNo": "001", "FBillNo": "CGDD002796_V001", "FDate": "2022-01-12", "FPurchaseOrgId": { "FNumber": "00" }, "FSupplierId": { "FNumber": "GYS_XN" }, "FPurchaseDeptId": { "FNumber": "BM000001" }, "FPurchaserId": { "FNumber": "20150808" }, "FChangeReason": "test", "FPOOrderFinance": { "FPKIdX_F": 104756,(财务页签那张表的分录id,肯定也是不为空的) (以下财务页签里的汇率、结算币别、本位币、付款条件等内容肯定也是要填充好的) "FPayConditionId": { "FNumber": "010" }, "FSettleCurrId": { "FNumber": "PRE001" }, "FExchangeTypeId": { "FNumber": "HLTX01_SYS" }, "FLocalCurrId": { "FNumber": "PRE001" }, "FExchangeRate": 1 }, "FPOOrderEntry": [ { "FPKIDX": 107076,(B代表修改明细,所以要填入原订单对应行的分录id,不能为空) "FCHANGETYPE": "B", "FMaterialId": { "FNumber": " 0.001" }, "FQtyX": 20, "FQty": 10, "FDeliveryDate": "2022-01-12", "FTaxPriceX": 5, "FTaxPrice": 3 }, { "FPKIDX": 0,(A代表新增明细,所以没有原订单对应行的分录id,此处填0) "FCHANGETYPE": "A", "FMaterialId": { "FNumber": " 0.001" }, "FQtyX": 1, "FQty": 1, "FDeliveryDate": "2022-01-12", "FTaxPriceX": 1, "FTaxPrice": 1, "FEntryDiscountRate": 0, "FEntryTaxRate": 13, "FRequireOrgId": { "FNumber": "00" }, "FReceiveOrgId": { "FNumber": "00" }, "FEntrySettleOrgId": { "FNumber": "00" }, "FGiveAway": "false" } ] } }
场景二:采购订单上游有采购申请单据,需要在【修改(B)】行中,补充LINK包,避免出错
{ "Model": { "FID": 0, "FBillTypeID": { "FNumber": "CGDD01_SYS" }, "FPKIDX_H": 113757, "FVersionNo": "001", "FBillNo": "CGDD002796_V001", "FDate": "2022-01-12", "FPurchaseOrgId": { "FNumber": "00" }, "FSupplierId": { "FNumber": "GYS_XN" }, "FPurchaseDeptId": { "FNumber": "BM000001" }, "FPurchaserId": { "FNumber": "20150808" }, "FChangeReason": "test", "FPOOrderFinance": { "FPKIdX_F": 104756, "FPayConditionId": { "FNumber": "010" }, "FSettleCurrId": { "FNumber": "PRE001" }, "FExchangeTypeId": { "FNumber": "HLTX01_SYS" }, "FLocalCurrId": { "FNumber": "PRE001" }, "FExchangeRate": 1 }, "FPOOrderEntry": [ { "FPKIDX": 107076, "FCHANGETYPE": "B", "FMaterialId": { "FNumber": " 0.001" }, "FQtyX": 20, "FQty": 10, "FDeliveryDate": "2022-01-12", "FTaxPriceX": 5, "FTaxPrice": 3, "FSrcBillNo": "CGSQ00000", //源单编号填采购申请单的单号 "FSrcBillTypeId": "PUR_Requisition", //源单类型填采购申请单的标识 "FPOOrderEntry_Link": [{ //比起上面,我这里多了个link关联上游的采购申请单 "FPOOrderEntry_Link_FRuleId": "PUR_Requisition-PUR_PurchaseOrder", "FPOOrderEntry_Link_FSTableName": "T_PUR_ReqEntry", "FPOOrderEntry_Link_FSBillId": "100199", "FPOOrderEntry_Link_FSId": "100490", "FPOOrderEntry_Link_FBaseUnitQtyOld ": 10,//我是FQty,新的数量10 "FPOOrderEntry_Link_FBaseUnitQty ": 10, "FPOOrderEntry_Link_FStockBaseQtyOld ": 10, "FPOOrderEntry_Link_FStockBaseQty": 10 }] }, { "FPKIDX": 0, "FCHANGETYPE": "A", "FMaterialId": { "FNumber": " 0.001" }, "FQtyX": 1, "FQty": 1, "FDeliveryDate": "2022-01-12", "FTaxPriceX": 1, "FTaxPrice": 1, "FEntryDiscountRate": 0, "FEntryTaxRate": 13, "FRequireOrgId": { "FNumber": "00" }, "FReceiveOrgId": { "FNumber": "00" }, "FEntrySettleOrgId": { "FNumber": "00" }, "FGiveAway": "false" } ] } }
注意事项说明:
注意单据头、财务信息、明细信息等对象中的原始主键字段,分别为FPKIDX_H、FPKIdX_F、FPKIDX;
我们系统的新变更单是继承采购订单的,在新变更单的每个实体对象加上了原始主键字段,用于绑定对应原订单对象的主键字段(PS:单据头对单据头,财务信息对财务信息,明细信息行对行),生效时,直接根据原始主键更新原订单。
所以,单据头的FPKIDX_H、财务信息FPKIdX_F肯定是不为0的,明细信息的FPKIDX,只有FCHANGETYPE为:A,可为:0,其余变更类型FPKIDX字段均不为0。
新变更单的单号怎么传?
目前系统不会自动生成,标准做法应该是先调用单据查询接口,获取原订单的版本号比如"000",在此基础上+1得到"001".
新变更单的版本号生效时会反写回原订单的,所以版本号必须传,否则会影响原订单的下一次变更以及变更查询功能。
那么新变更单的版本号为"001",单据编号为:原订单编号_V新版本号,如:
"FVersionNo": "001", "FBillNo": "CGDD002796_V001"
如何查询上游采购订单的单据FID、明细体分录id、财务业务分录id、订单初始版本号呢?
{ "data": { "FormId": "PUR_PurchaseOrder", "FieldKeys": "FBILLNO,FID,FPOOrderEntry_FEntryid,FPOOrderFinance_FEntryid,FVersionNo", "FilterString": "FBILLNO='CGDD002796'", "OrderString": "", "TopRowCount": 0, "StartRow": 0, "Limit": 0, "SubSystemId": "" } }
自测截图:
更多知识:
官方API交流QQ群:857982100
【webapi】通过保存接口,实现采购订单-采购入库单关联的一些核心字段讲解(附带测试JSON) (kingdee.com)
【webapi】利用保存接口实现修改收料通知单批号字段 (kingdee.com)
【WEBAPI】采购订单新变更单接口JSON样例
【WEBAPI】采购订单新变更单接口JSON样例场景一:采购订单无上游单据直接变更{ "Model": { "FID": 0, "FBillTypeID": { "FNumb...
点击下载文档
本文2024-09-23 02:33:26发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-153212.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章