|
@@ -9,10 +9,19 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import nc.bs.framework.adaptor.IHttpServletAdaptor;
|
|
|
+import nc.bs.framework.common.InvocationInfoProxy;
|
|
|
import nc.bs.framework.common.NCLocator;
|
|
|
import nc.bs.framework.server.ISecurityTokenCallback;
|
|
|
import nc.bs.servlet.service.BaseServlet;
|
|
|
+import nc.bs.yp.plugin.GetBaseDAOUtil;
|
|
|
+import nc.itf.uap.pf.IPFBusiAction;
|
|
|
import nc.log.NcLog;
|
|
|
+import nc.md.persist.framework.IMDPersistenceQueryService;
|
|
|
+import nc.vo.ct.saledaily.entity.AggCtSaleVO;
|
|
|
+import nc.vo.ct.saledaily.entity.CtSaleExecVO;
|
|
|
+import nc.vo.org.SalesOrgVO;
|
|
|
+import nc.vo.pub.lang.UFDate;
|
|
|
+import nc.vo.pub.workflownote.WorkflownoteVO;
|
|
|
import nc.yp.dao.IUtilMaintain;
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
@@ -25,6 +34,9 @@ public class ValidateMaintainImpl extends BaseServlet implements IHttpServletAda
|
|
|
|
|
|
//请求唯一标识
|
|
|
private String vbillcode = "";
|
|
|
+ private WorkflownoteVO Workflownote = new WorkflownoteVO();
|
|
|
+ private IPFBusiAction ipf = NCLocator.getInstance().lookup(IPFBusiAction.class);
|
|
|
+ private IMDPersistenceQueryService service=NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
|
|
|
|
|
|
@Override
|
|
|
public void doAction(HttpServletRequest req, HttpServletResponse resp)
|
|
@@ -34,7 +46,8 @@ public class ValidateMaintainImpl extends BaseServlet implements IHttpServletAda
|
|
|
JSONObject json = JSONObject.fromObject(createStr);
|
|
|
NcLog.info("销售合同生效JSON:"+json);
|
|
|
vbillcode = json.getString("vbillcode");
|
|
|
- processAction(json);
|
|
|
+ //processAction(json);
|
|
|
+ collect(json);
|
|
|
resp.getWriter().write(formatRSJsonData("0",vbillcode,"").toString());
|
|
|
} catch (Exception e) {
|
|
|
//前端控制台打印xml数据
|
|
@@ -47,8 +60,44 @@ public class ValidateMaintainImpl extends BaseServlet implements IHttpServletAda
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public void collect(JSONObject json) throws Exception{
|
|
|
+ //指定集团pk
|
|
|
+ InvocationInfoProxy.getInstance().setGroupId(GetBaseDAOUtil.getGroup(json.getString("groupCode")).getPk_group());
|
|
|
+ NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
|
|
|
+ //组织
|
|
|
+ SalesOrgVO salesOrgVO = GetBaseDAOUtil.getSalesOrg(json.getString("pk_org"));
|
|
|
+ //根据唯一标识取到AggVO
|
|
|
+ AggCtSaleVO aggCtSaleVO = (AggCtSaleVO) service.queryBillOfNCObjectByPKWithDR(AggCtSaleVO.class,GetBaseDAOUtil.GetVOID("ct_sale",json.getString("vbillcode")),true).getContainmentObject();
|
|
|
+ CtSaleExecVO[] ctSaleExecArrVO = new CtSaleExecVO[aggCtSaleVO.getChildren(CtSaleExecVO.class).length+1];
|
|
|
+ for (int i = 0; i < aggCtSaleVO.getChildren(CtSaleExecVO.class).length; i++) {
|
|
|
+ ctSaleExecArrVO[i] = (CtSaleExecVO) aggCtSaleVO.getChildren(CtSaleExecVO.class)[i];
|
|
|
+ }
|
|
|
+ CtSaleExecVO ctSaleExecVO = new CtSaleExecVO();
|
|
|
+ //集团
|
|
|
+ ctSaleExecVO.setPk_group(aggCtSaleVO.getParentVO().getPk_group());
|
|
|
+ //原始组织
|
|
|
+ ctSaleExecVO.setPk_org(salesOrgVO.getPk_org());
|
|
|
+ //组织
|
|
|
+ ctSaleExecVO.setPk_org_v(salesOrgVO.getPk_vid());
|
|
|
+ //日期
|
|
|
+ ctSaleExecVO.setVexecdate(new UFDate(json.getString("dbilldate")));
|
|
|
+ //执行过程
|
|
|
+ ctSaleExecVO.setVexecflow("取消生效");
|
|
|
+ //原因
|
|
|
+ ctSaleExecVO.setVexecreason(json.getString("vexecreason"));
|
|
|
+ //vo状态
|
|
|
+ ctSaleExecVO.setStatus(2);
|
|
|
+ //上层主键
|
|
|
+ ctSaleExecVO.setPk_ct_sale((String) aggCtSaleVO.getParent().getAttributeValue("pk_ct_sale"));
|
|
|
+ ctSaleExecArrVO[ctSaleExecArrVO.length-1] = ctSaleExecVO;
|
|
|
+ aggCtSaleVO.setChildren(CtSaleExecVO.class, ctSaleExecArrVO);
|
|
|
+ //调用单据生效动作脚本
|
|
|
+ ipf.processAction("VALIDATE", "Z3", Workflownote, aggCtSaleVO, null, null);
|
|
|
+ }
|
|
|
|
|
|
- private void processAction(JSONObject json) throws Exception {
|
|
|
+ public void processAction(JSONObject json) throws Exception {
|
|
|
NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
|
|
|
IUtilMaintain iUtilMaintain = NCLocator.getInstance().lookup(IUtilMaintain.class);
|
|
|
iUtilMaintain.XSHT_RequiresNew(json);
|