[code]
单据是生产入库单,二次开发的。想通过java调用webapi接口实现单据保存功能,单据上的必填字段都已经填写了,但是运行还是会提示物料编码字段必填。json字符串组织如下,一直没调试出来问题出在哪里
String saveJson = "";
StockLoc sl = new StockLoc();
sl.setFSTOCKLOCID__FF100004(new Number("1.006"));
//子单据体分录,目前不需要填写
List
JSONObject jo4SubEntry = new JSONObject();
jo4SubEntry.put("FDetailID", "0");
jo4SubEntry.put("FSerialNo", "");
jo4SubEntry.put("FSerialId", new Number(""));
jo4SubEntry.put("FSerialNote", "");
jo4SubEntryList.add(jo4SubEntry);
//分录entry
List
JSONObject jo4Entry = new JSONObject();
jo4Entry.put("FEntryID", "0");
jo4Entry.put("FSrcEntryId", "0");
jo4Entry.put("FIsNew", "false");//--
jo4Entry.put("FMaterialId", new Number("5.1.1.004.135"));// 提示物料编码必填的字段
jo4Entry.put("FCheckProduct", "false");//--
jo4Entry.put("FInStockType", "1");//--
jo4Entry.put("FProductType", "1");//--
jo4Entry.put("FUnitID", new Number("KG"));//--
jo4Entry.put("FMustQty", "20");
jo4Entry.put("FRealQty", "20");
jo4Entry.put("FCostRate", "100");
jo4Entry.put("FBaseUnitId", new Number("KG"));
jo4Entry.put("FBaseMustQty", "20");
jo4Entry.put("FBaseRealQty", "20");
jo4Entry.put("FOwnerTypeId", "BD_OwnerOrg");//--
jo4Entry.put("FOwnerId", new Number("100"));//--
jo4Entry.put("FStockId", new Number("01.02"));//--
//jo4Entry.put("FStockLocId", new StockLoc(new Number("1.006"), new Number(), new Number(), new Number(), new Number(), new Number(), new Number(), new Number(), new Number(), new Number(), new Number()));
jo4Entry.put("FStockLocId",sl);
jo4Entry.put("FBomId", new Number(""));
jo4Entry.put("FLot", new Number("X1671441"));
jo4Entry.put("FISBACKFLUSH", "false");
AuxProp auxprop = new AuxProp();
auxprop.setFAUXPROPID__FF100001(new Number("231.057"));
auxprop.setFAUXPROPID__FF100002(new Number("S71678"));
auxprop.setFAUXPROPID__FF100004(new Number("-"));
jo4Entry.put("FAuxpropId", auxprop);
jo4Entry.put("FMtoNo", "");
jo4Entry.put("FProjectNo", "");
jo4Entry.put("FWorkShopId1", new Number("02.02.11"));
jo4Entry.put("FShiftGroupId", new Number(""));
jo4Entry.put("FMoBillNo", "MO008319");
jo4Entry.put("FMoId", "120652");
jo4Entry.put("FMoEntryId", "123259");
jo4Entry.put("FMoEntrySeq", "1");
jo4Entry.put("FMemo", "");
jo4Entry.put("FStockUnitId", new Number(""));
jo4Entry.put("FStockRealQty", "0");
jo4Entry.put("FSecUnitId", new Number(""));
jo4Entry.put("FSecRealQty", "0");
jo4Entry.put("FSrcBillType", "PRD_MO");
jo4Entry.put("FSrcBillNo", "MO008319");
jo4Entry.put("FSrcInterId", "120652");
jo4Entry.put("FBasePrdRealQty", "");
jo4Entry.put("FIsFinished", "false");
jo4Entry.put("FStockStatusId", new Number("KCZT01_SYS"));
jo4Entry.put("FSrcEntrySeq", "0");
jo4Entry.put("FMOMAINENTRYID", "0");
jo4Entry.put("FKeeperTypeId", "BD_KeeperOrg");
jo4Entry.put("FKeeperId", new Number("100"));
jo4Entry.put("FProduceDate", "2016-12-30");
jo4Entry.put("FSelReStkQty", "0");
jo4Entry.put("FExpiryDate", "2016-12-30");
jo4Entry.put("FBaseSelReStkQty", "0");
jo4Entry.put("FXqAuxpropId", auxprop);
jo4Entry.put("FJs", "0");
jo4Entry.put("FBzxx", "");
jo4Entry.put("FJZ", "0");
jo4Entry.put("FHCL", "0");
jo4Entry.put("FSH", "0");
jo4Entry.put("FDBQTY", "0");
jo4Entry.put("FHCLGLQTY", "0");
jo4Entry.put("FSerialSubEntity", jo4SubEntryList);
jo4EntryList.add(jo4Entry);
//入库信息分录
List
JSONObject jo4Rkxx = new JSONObject();
jo4Rkxx.put("FEntryID", "0");
jo4Rkxx.put("FCpBzNo", "");
jo4Rkxx.put("FCpBzId", "0");
jo4Rkxx.put("FBoxNumber", "");
jo4Rkxx.put("FStockIdX", new Number("01.02"));
//jo4Rkxx.put("FSpId", new StockLoc(new Number("1.006"), new Number(), new Number(), new Number(), new Number(), new Number(), new Number(), new Number(), new Number(), new Number(), new Number()));
jo4Rkxx.put("FSpId", sl);
jo4Rkxx.put("FBatchno", "");
jo4Rkxx.put("FMatId", new Number(""));
jo4Rkxx.put("FAuxpropIdX", auxprop);
jo4Rkxx.put("FKhSh", "");
jo4Rkxx.put("FQrs", "");
jo4Rkxx.put("FMz", "0");
jo4Rkxx.put("FTzs", "0");
jo4Rkxx.put("FTzzl", "0");
jo4Rkxx.put("FPz", "0");
jo4Rkxx.put("FJzx", "0");
jo4Rkxx.put("FGdhc", "0");
jo4Rkxx.put("FSchc", "0");
jo4Rkxx.put("FBz", "0");
jo4Rkxx.put("FNote", "");
jo4RkxxList.add(jo4Rkxx);
//表头信息
JSONObject jo4Head = new JSONObject();
jo4Head.put("FID", "0");
jo4Head.put("FBillType", new Number("SCRKD02_SYS"));//--
jo4Head.put("FDate", "2016-12-30");//--
jo4Head.put("FStockOrgId", new Number("100"));//--
jo4Head.put("FStockId0", new Number("01.02"));//--
jo4Head.put("FPrdOrgId", new Number("100"));//--
jo4Head.put("FWorkShopId", new Number(""));//--
jo4Head.put("FOwnerTypeId0", "BD_OwnerOrg");//--
jo4Head.put("FOwnerId0", new Number("100"));//--
jo4Head.put("FSTOCKERID", new StaffNumber("02.01.03.0326"));
jo4Head.put("FDescription", "");//--
jo4Head.put("FIsEntrust", "false");//--
jo4Head.put("FCurrId", new Number("100"));//--
jo4Head.put("FEntrustInStockId", "0");//--
jo4Head.put("FScanBox", "");//--
jo4Head.put("FCheckerID", new StaffNumber("02.01.03.0326"));//--
jo4Head.put("FSmqy", "");//--
jo4Head.put("Fshdept", new Number(""));//--
jo4Head.put("Fshzz", new Number("100"));//--
jo4Head.put("FEntity", jo4EntryList);
jo4Head.put("FRKXXEntity", jo4RkxxList);
//单据数据json
JSONObject joBill = new JSONObject();
joBill.put("Creator", "");
joBill.put("NeedUpDateFields", new ArrayList());
joBill.put("Model", jo4Head);
//完整的json
JSONObject jo = new JSONObject();
jo.put("formid", "PRD_INSTOCK");
jo.put("data", joBill);
saveJson = jo.toString();
[/code][code]提示信息: {"Result":{"ResponseStatus":{"ErrorCode":500,"IsSuccess":false,"Errors":[{"FieldName":"FMaterialId","Message":"单据体“明细”第1行字段“物料编码”是必填项","DIndex":0},{"FieldName":"FSTOCKERID","Message":"字段“仓管员”是必填项","DIndex":0}],"SuccessEntitys":[],"SuccessMessages":[]},"Id":""}
[/code]推荐阅读