最近有不少提单关于新变更单的api保存接口,结合单据业务逻辑和功能代码逻辑,自测总结了一些经验。话不多说,直接上货!!!
一、json样例(见附件):
{
"NeedUpDateFields": [],
"NeedReturnFields": [],
"IsDeleteEntry": "true",
"SubSystemId": "",
"IsVerifyBaseDataField": "false",
"IsEntryBatchFill": "true",
"ValidateFlag": "true",
"NumberSearch": "true",
"IsAutoAdjustField": "false",
"InterationFlags": "",
"IgnoreInterationFlag": "",
"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"
},
"FPurchaserGroupId": {
"FNumber": ""
},
"FPurchaserId": {
"FNumber": "20150808"
},
"FChangeReason": "test",
"FPOOrderFinance": {
"FEntryId": 0,
"FPKIdX_F": 104756,
"FSettleModeId": {
"FNumber": ""
},
"FPayConditionId": {
"FNumber": "010"
},
"FSettleCurrId": {
"FNumber": "PRE001"
},
"FExchangeTypeId": {
"FNumber": "HLTX01_SYS"
},
"FLocalCurrId": {
"FNumber": "PRE001"
},
"FExchangeRate": 1
},
"FPOOrderEntry": [
{
"FEntryID": 0,
"FPKIDX": 107076,
"FCHANGETYPE": "B",
"FMaterialId": {
"FNumber": " 0.001"
},
"FQtyX": 20,
"FQty": 10,
"FDeliveryDate": "2022-01-12",
"FTaxPriceX": 5,
"FTaxPrice": 3,
"FEntryDiscountRate": 0,
"FEntryTaxRate": 13,
"FRequireOrgId": {
"FNumber": "00"
},
"FRequireDeptId": {
"FNumber": ""
},
"FReceiveOrgId": {
"FNumber": "00"
},
"FEntrySettleOrgId": {
"FNumber": "00"
},
"FGiveAway": "false"
},
{
"FEntryID": 0,
"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"
},
"FRequireDeptId": {
"FNumber": ""
},
"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"。
新变更单的版本号生效时会反写回原订单的,所以版本号必须传,否则会影响原订单的下一次变更以及变更查询功能。
付款计划如何变更?建议通过变更财务信息的付款条件,系统会自动根据付款条件和价税合计重算付款计划;如果一定要直接调整付款计划,一定要绑定原订单的付款计划分录主键,否则系统会报一些不可预知的错误,需要结合付款计划数据具体分析。
三、自测截图:
采购订单查询对象主键以及版本号json样例.docx(27.16KB)
采购订单新变更json样例.docx(28.10KB)
推荐阅读