yaoyu 2 vuotta sitten
vanhempi
commit
b5e4f1ac47

+ 48 - 1
ypff/ypff/src/private/nc/bs/yp/impl/UnvalidateMaintainImpl.java

@@ -8,15 +8,24 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+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.vo.pubapp.pattern.exception.ExceptionUtils;
 import nc.yp.dao.IUtilMaintain;
 import nc.bs.dao.BaseDAO;
 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.itf.ypff.IProCostCalMaintain;
 import nc.log.NcLog;
+import nc.md.persist.framework.IMDPersistenceQueryService;
 import net.sf.json.JSONObject;
 
 
@@ -28,6 +37,9 @@ public class UnvalidateMaintainImpl extends BaseServlet implements IHttpServletA
 
 	//请求唯一标识
 	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) throws ServletException, IOException {
@@ -36,7 +48,8 @@ public class UnvalidateMaintainImpl extends BaseServlet implements IHttpServletA
 			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数据
@@ -50,6 +63,40 @@ public class UnvalidateMaintainImpl extends BaseServlet implements IHttpServletA
 		
 	}
 	
+	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("UNVALIDATE", "Z3", Workflownote, aggCtSaleVO, null, null);
+	}
 	
 	/**
 	 * 

+ 51 - 2
ypff/ypff/src/private/nc/bs/yp/impl/ValidateMaintainImpl.java

@@ -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);