Eclipse调用WebService(9)
单据新增WebService和Eclipse调用WebServcie.pdf
这个表是原来就有还是什么方法新建的,为啥直接就可以把数据写进去呀,是金蝶已经封装好了吗?
增加内容:
1:单据:增加明细文本备注;
2:json对应为:String jsonData = "{\"number\":\"080409\",\"description\":\"我是一个测试的\",\"billStatus\":\"1\",\"entry\":[{\"bz\":\"我是测试的\"},{\"bz\":\"我是第二个\"}]}";
3:webService对应代码修改为:
package com.kingdee.eas.custom.mylearn.app;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.basedata.master.material.billStatus;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.mylearn.MyLearnBillEntryFactory;
import com.kingdee.eas.custom.mylearn.MyLearnBillEntryInfo;
import com.kingdee.eas.custom.mylearn.MyLearnBillFactory;
import com.kingdee.eas.custom.mylearn.MyLearnBillInfo;
public class myLearnFacadeControllerBean extends AbstractmyLearnFacadeControllerBean
{
private static Logger logger =
Logger.getLogger("com.kingdee.eas.custom.mylearn.app.myLearnFacadeControllerBean");
@SuppressWarnings("unchecked")
@Override
protected String _addData(Context ctx, String json) throws BOSException,
EASBizException {
/***
* 添加业务逻辑
*/
JSONObject js = JSONObject.fromObject(json);
Map<String,String> mapinfo = (Map<String,String>)js;
MyLearnBillInfo myLearnBillInfo = new MyLearnBillInfo();
myLearnBillInfo.setNumber(mapinfo.get("number"));
myLearnBillInfo.setDescription(mapinfo.get("description"));
myLearnBillInfo.setBillStatus(billStatus.getEnum(mapinfo.get("billStatus")));
JSONArray jsonentry = JSONArray.fromObject(mapinfo.get("entry"));
MyLearnBillEntryInfo myLearnBillEntryInfo = new MyLearnBillEntryInfo();
MyLearnBillFactory.getLocalInstance(ctx).addnew(myLearnBillInfo);
for(int i=0;i< jsonentry.size();i++){
JSONObject jsonobentry = jsonentry.getJSONObject(i);
myLearnBillEntryInfo.setParent(myLearnBillInfo);
myLearnBillEntryInfo.setBz((String) jsonobentry.get("bz"));
myLearnBillEntryInfo.setId(BOSUuid.create("4B33A3EE"));
MyLearnBillEntryFactory.getLocalInstance(ctx).addnew(myLearnBillEntryInfo);
}
return "add success";
}
}
4.可以实现单据分录生成。
Eclipse调用WebService(9)
本文2024-09-16 22:02:06发表“eas cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-eas-45507.html