Browse Source

项目、出库申请单接口

zthwr 1 week ago
parent
commit
1a22a1ad85
51 changed files with 2342 additions and 0 deletions
  1. 23 0
      gy/.classpath
  2. 29 0
      gy/.project
  3. 14 0
      gy/META-INF/dzgyapi.upm
  4. 7 0
      gy/META-INF/module.xml
  5. 23 0
      gy/bin/.project
  6. 7 0
      gy/bin/META-INF/module.xml
  7. BIN
      gy/gy/classes/com/yonyou/iuap/corp/gy/utils/AppController.class
  8. BIN
      gy/gy/classes/com/yonyou/iuap/corp/gy/utils/HttpUtils$1.class
  9. BIN
      gy/gy/classes/com/yonyou/iuap/corp/gy/utils/HttpUtils$miTM.class
  10. BIN
      gy/gy/classes/com/yonyou/iuap/corp/gy/utils/HttpUtils.class
  11. BIN
      gy/gy/classes/com/yonyou/iuap/corp/gy/utils/SignHelper.class
  12. 3 0
      gy/gy/classes/nc-bip.properties
  13. BIN
      gy/gy/classes/nc/bs/gy/yfk/m4455/SapplySaveAfterToYFK.class
  14. BIN
      gy/gy/classes/nc/bs/servlet/service/BaseServlet.class
  15. BIN
      gy/gy/classes/nc/bs/servlet/service/Outbdapplication.class
  16. BIN
      gy/gy/classes/nc/bs/servlet/service/Outbdapplication查询出库申请单的数据.class
  17. BIN
      gy/gy/classes/nc/bs/servlet/service/ProprojectServlet.class
  18. BIN
      gy/gy/classes/nc/dz/json/Data.class
  19. BIN
      gy/gy/classes/nc/dz/json/Entry.class
  20. BIN
      gy/gy/classes/nc/dz/json/Result.class
  21. BIN
      gy/gy/classes/nc/dz/json/Root.class
  22. BIN
      gy/gy/classes/nc/gy/log/NcLog.class
  23. BIN
      gy/gy/classes/nc/impl/hrrm/MyX509TrustManager.class
  24. BIN
      gy/gy/classes/nc/json/com/JsonExample.class
  25. BIN
      gy/gy/classes/nc/json/com/JsonGeneratorExample$Data.class
  26. BIN
      gy/gy/classes/nc/json/com/JsonGeneratorExample$Entry.class
  27. BIN
      gy/gy/classes/nc/json/com/JsonGeneratorExample$Result.class
  28. BIN
      gy/gy/classes/nc/json/com/JsonGeneratorExample$Root.class
  29. BIN
      gy/gy/classes/nc/json/com/JsonGeneratorExample.class
  30. BIN
      gy/gy/classes/nc/json/com/JsonParseExample_TWO.class
  31. BIN
      gy/gy/classes/nc/pub/util/DataSourceUtil.class
  32. 3 0
      gy/gy/component.xml
  33. 3 0
      gy/gy/resources/nc-bip.properties
  34. 88 0
      gy/gy/src/private/nc/bs/servlet/service/BaseServlet.java
  35. 278 0
      gy/gy/src/private/nc/bs/servlet/service/Outbdapplication.java
  36. 399 0
      gy/gy/src/private/nc/bs/servlet/service/Outbdapplication查询出库申请单的数据.java
  37. 240 0
      gy/gy/src/private/nc/bs/servlet/service/ProprojectServlet.java
  38. 26 0
      gy/gy/src/private/nc/impl/hrrm/MyX509TrustManager.java
  39. 47 0
      gy/gy/src/private/nc/pub/util/DataSourceUtil.java
  40. 85 0
      gy/gy/src/public/com/yonyou/iuap/corp/gy/utils/AppController.java
  41. 247 0
      gy/gy/src/public/com/yonyou/iuap/corp/gy/utils/HttpUtils.java
  42. 81 0
      gy/gy/src/public/com/yonyou/iuap/corp/gy/utils/SignHelper.java
  43. 73 0
      gy/gy/src/public/nc/bs/gy/yfk/m4455/SapplySaveAfterToYFK.java
  44. 52 0
      gy/gy/src/public/nc/dz/json/Data.java
  45. 72 0
      gy/gy/src/public/nc/dz/json/Entry.java
  46. 21 0
      gy/gy/src/public/nc/dz/json/Result.java
  47. 55 0
      gy/gy/src/public/nc/dz/json/Root.java
  48. 149 0
      gy/gy/src/public/nc/gy/log/NcLog.java
  49. 60 0
      gy/gy/src/test/nc/json/com/JsonExample.java
  50. 236 0
      gy/gy/src/test/nc/json/com/JsonGeneratorExample.java
  51. 21 0
      gy/gy/src/test/nc/json/com/JsonParseExample_TWO.java

+ 23 - 0
gy/.classpath

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="gy/classes" path="gy/src/public"/>
+	<classpathentry kind="src" output="gy/classes" path="gy/src/client"/>
+	<classpathentry kind="src" output="gy/classes" path="gy/src/private"/>
+	<classpathentry kind="src" output="gy/classes" path="gy/src/test"/>
+	<classpathentry kind="src" output="gy/classes" path="gy/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Ant_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Product_Common_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Middleware_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Framework_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Module_Public_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Module_Client_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Module_Private_Library">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**"/>
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Module_Lang_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Generated_EJB"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

+ 29 - 0
gy/.project

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>gy</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.yonyou.studio.udt.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.yonyou.ria.g2.riabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>com.yonyou.studio.udt.core.nature</nature>
+		<nature>com.yonyou.ria.g2.rianature</nature>
+	</natures>
+</projectDescription>

+ 14 - 0
gy/META-INF/dzgyapi.upm

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding='gb2312'?>
+<module name="gy">
+     <public>
+       <!--项目-项目组织-->
+ 	   <component name="proproject" accessProtected="false"  remote="true" singleton="true" tx="NONE" supportAlias="true">
+       <implementation>nc.bs.servlet.service.ProprojectServlet</implementation>
+ 	   </component>
+ 	    <!--出库申请汇总数据-->
+ 	    <component name="outbdapplication" accessProtected="false"  remote="true" singleton="true" tx="NONE" supportAlias="true">
+       <implementation>nc.bs.servlet.service.Outbdapplication</implementation>
+ 	   </component>
+ 	   
+    </public>
+</module>

+ 7 - 0
gy/META-INF/module.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="gb2312"?>
+<module name="gy">
+    <public>
+    </public>
+    <private>
+    </private>
+</module>

+ 23 - 0
gy/bin/.project

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>gy</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.yonyou.studio.udt.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>com.yonyou.studio.udt.core.nature</nature>
+	</natures>
+</projectDescription>

+ 7 - 0
gy/bin/META-INF/module.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="gb2312"?>
+<module name="gy">
+    <public>
+    </public>
+    <private>
+    </private>
+</module>

BIN
gy/gy/classes/com/yonyou/iuap/corp/gy/utils/AppController.class


BIN
gy/gy/classes/com/yonyou/iuap/corp/gy/utils/HttpUtils$1.class


BIN
gy/gy/classes/com/yonyou/iuap/corp/gy/utils/HttpUtils$miTM.class


BIN
gy/gy/classes/com/yonyou/iuap/corp/gy/utils/HttpUtils.class


BIN
gy/gy/classes/com/yonyou/iuap/corp/gy/utils/SignHelper.class


+ 3 - 0
gy/gy/classes/nc-bip.properties

@@ -0,0 +1,3 @@
+appKey=cd9332bb053149cc829a16296e74b232
+appSecret=99bb086c453a1cbd5fdf934ef6bc39185c999f10
+openApiUrl=https://c3.yonyoucloud.com

BIN
gy/gy/classes/nc/bs/gy/yfk/m4455/SapplySaveAfterToYFK.class


BIN
gy/gy/classes/nc/bs/servlet/service/BaseServlet.class


BIN
gy/gy/classes/nc/bs/servlet/service/Outbdapplication.class


BIN
gy/gy/classes/nc/bs/servlet/service/Outbdapplication查询出库申请单的数据.class


BIN
gy/gy/classes/nc/bs/servlet/service/ProprojectServlet.class


BIN
gy/gy/classes/nc/dz/json/Data.class


BIN
gy/gy/classes/nc/dz/json/Entry.class


BIN
gy/gy/classes/nc/dz/json/Result.class


BIN
gy/gy/classes/nc/dz/json/Root.class


BIN
gy/gy/classes/nc/gy/log/NcLog.class


BIN
gy/gy/classes/nc/impl/hrrm/MyX509TrustManager.class


BIN
gy/gy/classes/nc/json/com/JsonExample.class


BIN
gy/gy/classes/nc/json/com/JsonGeneratorExample$Data.class


BIN
gy/gy/classes/nc/json/com/JsonGeneratorExample$Entry.class


BIN
gy/gy/classes/nc/json/com/JsonGeneratorExample$Result.class


BIN
gy/gy/classes/nc/json/com/JsonGeneratorExample$Root.class


BIN
gy/gy/classes/nc/json/com/JsonGeneratorExample.class


BIN
gy/gy/classes/nc/json/com/JsonParseExample_TWO.class


BIN
gy/gy/classes/nc/pub/util/DataSourceUtil.class


+ 3 - 0
gy/gy/component.xml

@@ -0,0 +1,3 @@
+<component name="gy" displayname="gy">
+  <dependencies/>
+</component>

+ 3 - 0
gy/gy/resources/nc-bip.properties

@@ -0,0 +1,3 @@
+appKey=cd9332bb053149cc829a16296e74b232
+appSecret=99bb086c453a1cbd5fdf934ef6bc39185c999f10
+openApiUrl=https://c3.yonyoucloud.com

+ 88 - 0
gy/gy/src/private/nc/bs/servlet/service/BaseServlet.java

@@ -0,0 +1,88 @@
+package nc.bs.servlet.service;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.text.ParseException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+
+
+import org.codehaus.jettison.json.JSONException;
+
+import uap.json.JSONObject;
+
+/**
+ * 提供一些公共方法
+ * 具体业务请在实际服务类实现
+ */
+public class BaseServlet {
+
+	public static String STATUS_SUCCESS ="success";
+	public static String STATUS_FAILURE ="fail";
+
+	/**
+	 * 格式化传入的数据,JSON化在具体服务类实现
+	 * @param req
+	 * @param resp
+	 * @param 类名
+	 * @return
+	 * @throws ServletException
+	 * @throws IOException
+	 */
+	protected String buildJson(HttpServletRequest req,
+							   HttpServletResponse resp, String classname)
+			throws ServletException, IOException {
+		req.setCharacterEncoding("UTF-8");
+		/* 设置格式为text/json */
+		resp.setContentType("text/json");
+		/* 设置字符集为'UTF-8' */
+		resp.setCharacterEncoding("UTF-8");
+		String reqJsonData = null;
+		// 接收流
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				req.getInputStream(), "UTF-8"));
+		StringBuffer jsonStr = new StringBuffer();
+		try {
+			String line = "";
+			while ((line = reader.readLine()) != null) {
+				jsonStr.append(line);
+			}
+			if (jsonStr != null && !"".equals(jsonStr.toString())) {
+				reqJsonData = jsonStr.toString();
+//				PrLogger.error(new UFDateTime(System.currentTimeMillis()).toString()
+//						+ "客户端传入:" + classname + "~~" + reqJsonData);
+			} else {
+				throw new ServletException("传入的数据不合法!");
+			}
+		} catch (IOException e) {
+			throw new IOException("数据读取失败" + e.getMessage());
+		} finally {
+			reader.close();
+		}
+		return reqJsonData;
+	}
+
+
+
+	/**
+	 * 格式返回json数据
+	 * 
+	 * @return
+	 * @throws JSONException
+	 * @throws Exception
+	 */
+	public static JSONObject formatRSJsonData(String status,String error,String message){
+		JSONObject rs = new JSONObject();
+		rs.put("status", status);
+		rs.put("message", message);
+		rs.put("error", error);
+		return rs;
+	}
+	
+	
+}

+ 278 - 0
gy/gy/src/private/nc/bs/servlet/service/Outbdapplication.java

@@ -0,0 +1,278 @@
+package nc.bs.servlet.service;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.alibaba.fastjson.JSON;
+
+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.dz.json.Data;
+import nc.dz.json.Entry;
+import nc.dz.json.Result;
+import nc.dz.json.Root;
+import nc.gy.log.NcLog;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.processor.BeanListProcessor;
+import nc.md.persist.framework.IMDPersistenceQueryService;
+import nc.pub.util.DataSourceUtil;
+import nc.vo.ic.m4d.entity.MaterialOutBodyVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pubapp.pattern.pub.SqlBuilder;
+
+
+public class Outbdapplication extends BaseServlet implements IHttpServletAdaptor{
+	
+	private IUAPQueryBS iuapquerybs=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+	
+	private ArrayList<String> pickDates = new ArrayList<String>();// 领料时间
+	
+	private ArrayList<String> proNos = new ArrayList<String>();// 工程编号
+
+	@Override
+	public void doAction(HttpServletRequest request, HttpServletResponse req)
+			throws ServletException, IOException {
+		 try {	
+				NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
+				DataSourceUtil.setDataSource();
+				String invocatpk_group=InvocationInfoProxy.getInstance().getGroupId();
+				InvocationInfoProxy.getInstance().setGroupId(invocatpk_group);
+				String createStr = buildJson(request, req, this.getClass().getName());
+
+				 JSONObject jsonObject = new JSONObject(createStr);
+				  
+				 NcLog.initUI("json:"+jsonObject.toString(),"dzgy_query"); 
+				
+				String token =request.getParameter("token");
+				
+		        if(!(token!=null && !token.equals("")&&("07a81a68-c60c-4ee4-83dc-25aa51a51497").equals(token))){
+		        	req.getWriter().write(formatRSJsonData("失败",
+							"请确认通讯密码是否正确!","").toString());
+		        	NcLog.initUI("通讯密码不正确!","dzgy_query");
+					return;
+				
+				}
+		        
+		        
+		        checkJson(jsonObject);
+				String pickDate=jsonObject.getString("pickDate");//领料时间
+				String proNo=jsonObject.getString("proNo");//工程编号
+	
+				ArrayList<MaterialOutBodyVO>  bodyvos=  getMapMaterialOutBodyVO(pickDate,proNo);
+				
+				if(null==bodyvos ||  bodyvos.size()==0){
+					req.getWriter().write(formatRSJsonData("失败","数据为空!","").toString());
+					return;
+				}
+				
+				String rutunjson=getJsonExample(bodyvos);
+				
+				req.getWriter().write(rutunjson);
+				
+				
+				} catch (Exception e) {
+					req.getWriter().write(formatRSJsonData("失败", e.getMessage(),"").toString());
+				}
+
+       }
+	
+	
+	
+  
+	
+	
+	
+	   private void checkJson(JSONObject jsonObject) throws Exception {
+		   
+		    StringBuffer mags = new StringBuffer();
+			Boolean empty = true;
+			
+			String pickDate = "pickDate";
+//			String proNo = "proNo";
+//			String[] HeadKey = {pickDate,proNo};   
+			
+			String[] HeadKey = {pickDate};   
+			
+			for (String as : HeadKey) {
+				if (jsonObject.getString(as).isEmpty()) {
+					empty = false;
+					mags.append("'" + as + "'");
+				}
+			}		
+			if (!empty) {
+				throw new Exception("以下字段不可为空:"+mags);
+			}
+			
+	  }
+
+
+
+	private ArrayList<MaterialOutBodyVO >  getMapMaterialOutBodyVO(String pickDates, String proNos) throws BusinessException{
+				
+        StringBuffer sbf=new StringBuffer();
+        String sql ="select h.cgeneralhid,p.project_code vbdef1,h.vbillcode vbdef2,case when h.vdef3 is not null then"
+        		+ " (select name from bd_defdoc where pk_defdoc=h.vdef3)  else '' end  as vbdef3, h.dbilldate vbdef4,"
+        		+ " m.code vbdef5 ,m.name vbdef6,m.materialspec ||  m.materialtype vbdef7 ,b.nnum,"
+        		+ " b.nshouldnum,e.dbilldate vbdef9 from  ic_material_b b"
+        		+ " inner join ic_material_h h  on h.cgeneralhid =b.cgeneralhid"
+        		+ " inner join bd_project p on p.pk_project=h.vdef2"
+        		+ " inner join org_stockorg o on o.pk_stockorg =h.pk_org"
+        		+ " inner join bd_material m on m.pk_material =b.cmaterialvid"
+        		+ " inner join ic_sapply_h e on e.cgeneralhid =b.csourcebillhid"
+        		+ " and nvl(h.dr,0)=0 and nvl(b.dr,0)=0 and  nvl(p.dr,0)=0 and nvl(m.dr,0)=0 "
+        		+ " and nvl(e.dr,0)=0 and nvl(o.dr,0)=0 and o.code='0103' "
+        		+ " and substr (h.dbilldate,1,10) ='"+pickDates+"' ";
+		
+		sbf.append(sql);
+		
+		if(null!=proNos && !"".equals(proNos)){
+			sbf.append(" and p.project_code='"+proNos+"'");	
+		}
+		
+//		if(null!=corpcode && !"".equals(corpcode)){
+//			sbf.append(" and o.code='"+corpcode+"'");	
+//		}
+		
+		
+		//非本部的组织,没有出库申请单
+		 String sqlNoBb =" union all select h.cgeneralhid,p.project_code vbdef1,h.vbillcode vbdef2,case when h.vdef3 is not null then"
+	        		+ " (select name from bd_defdoc where pk_defdoc=h.vdef3)  else '' end  as vbdef3, h.dbilldate vbdef4,"
+	        		+ " m.code vbdef5 ,m.name vbdef6,m.materialspec ||  m.materialtype vbdef7 ,b.nnum,"
+	        		+ " b.nnum nshouldnum,h.dbilldate vbdef9 from  ic_material_b b"
+	        		+ " inner join ic_material_h h  on h.cgeneralhid =b.cgeneralhid"
+	        		+ " inner join bd_project p on p.pk_project=h.vdef2"
+	        		+ " inner join org_stockorg o on o.pk_stockorg =h.pk_org"
+	        		+ " inner join bd_material m on m.pk_material =b.cmaterialvid"
+	        		+ " and nvl(h.dr,0)=0 and nvl(b.dr,0)=0 and  nvl(p.dr,0)=0 and nvl(m.dr,0)=0 "
+	        		+ " and nvl(o.dr,0)=0 and o.code<>'0103' "
+	        		+ " and substr (h.dbilldate,1,10) ='"+pickDates+"' ";
+		 
+		 
+		 sbf.append(sqlNoBb);
+		
+		 if(null!=proNos && !"".equals(proNos)){
+			 sbf.append(" and p.project_code='"+proNos+"'");	
+		  }
+		
+		
+		
+		
+		ArrayList<MaterialOutBodyVO >  bodyvos=(ArrayList<MaterialOutBodyVO >) iuapquerybs.executeQuery(sbf.toString(), new BeanListProcessor(MaterialOutBodyVO .class));
+		
+
+		
+		
+		
+		
+	    return bodyvos;
+	}
+	
+	
+	
+	
+	
+	
+	private  String  getJsonExample(ArrayList<MaterialOutBodyVO>  sapbodyvos) throws JSONException, JsonGenerationException, JsonMappingException, IOException{
+		
+		
+		Map<String,ArrayList<MaterialOutBodyVO>> map=new HashMap<String,ArrayList<MaterialOutBodyVO>>();
+		//按表头分单
+		 for(MaterialOutBodyVO bodyvo:sapbodyvos){
+			 
+			 if(null==map.get(bodyvo.getCgeneralhid()) ||  map.get(bodyvo.getCgeneralhid()).size()==0){
+				 
+				 ArrayList<MaterialOutBodyVO> sarrysap=new  ArrayList<MaterialOutBodyVO>();
+				 
+				 sarrysap.add(bodyvo);
+				 
+				 map.put(bodyvo.getCgeneralhid(), sarrysap);
+				 
+			 }else{
+				 
+				 ArrayList<MaterialOutBodyVO> sarrysaps=map.get(bodyvo.getCgeneralhid());
+				 
+				 sarrysaps.add(bodyvo);
+				 
+				 map.put(bodyvo.getCgeneralhid(), sarrysaps); 
+				 
+			 }
+			 
+			 
+			 
+		 }
+		
+		
+		List<Data> dataList =new ArrayList<Data>();
+	
+		for(Map.Entry<String,ArrayList<MaterialOutBodyVO>> entrymap : map.entrySet()){
+			
+			List<Entry> entryList = new ArrayList<Entry>();
+			
+			Data data = new Data();
+	        data.setEntry(entryList);
+	        data.setBi1INo(entrymap.getValue().get(0).getVbdef2());//领料单编号
+	        data.setSmanager(entrymap.getValue().get(0).getVbdef3()==null?"":entrymap.getValue().get(0).getVbdef3());//领料人
+	        data.setProNo(entrymap.getValue().get(0).getVbdef1());//工程编号
+	        data.setPickDate(entrymap.getValue().get(0).getVbdef4());//领料时间
+	        dataList.add(data);
+			
+			for(MaterialOutBodyVO bodyvo:entrymap.getValue()){
+				Entry entry = new Entry();
+				entry.setQuistDate(bodyvo.getVbdef9());//申请领料日期
+		        entry.setGuistOty(bodyvo.getNshouldnum().toString());//申请数量
+		        entry.setMatModel(bodyvo.getVbdef7()==null?"":bodyvo.getVbdef7());//规格型号
+		        entry.setQty(bodyvo.getNnum().toString());//已出库数量
+		        entry.setSourceBi11(bodyvo.getVbdef2());//申请计划单号 
+		        entry.setMatName(bodyvo.getVbdef6());//物料名称
+		        entry.setMatNum(bodyvo.getVbdef5());//物料编码
+		        entryList.add(entry);
+			}
+
+		 }
+		
+		 Result result = new Result();
+	     result.setData(dataList);
+		
+		 Root root = new Root("", result, "", "成功");
+		 
+		 ObjectMapper objectMapper = new ObjectMapper();
+		 
+	     String jsonString = objectMapper.writeValueAsString(root);
+		
+		 return jsonString;
+		
+	  }
+	
+	
+ }	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	

+ 399 - 0
gy/gy/src/private/nc/bs/servlet/service/Outbdapplication查询出库申请单的数据.java

@@ -0,0 +1,399 @@
+package nc.bs.servlet.service;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.alibaba.fastjson.JSON;
+
+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.dz.json.Data;
+import nc.dz.json.Entry;
+import nc.dz.json.Result;
+import nc.dz.json.Root;
+import nc.gy.log.NcLog;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.processor.BeanListProcessor;
+import nc.md.persist.framework.IMDPersistenceQueryService;
+import nc.pub.util.DataSourceUtil;
+import nc.vo.ic.m4455.entity.SapplyBillBodyVO;
+import nc.vo.ic.m4455.entity.SapplyBillVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pubapp.pattern.pub.SqlBuilder;
+
+
+public class Outbdapplication查询出库申请单的数据 extends BaseServlet implements IHttpServletAdaptor{
+	
+	private IUAPQueryBS iuapquerybs=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+	
+	private ArrayList<String> pickDates = new ArrayList<String>();// 领料时间
+	
+	private ArrayList<String> proNos = new ArrayList<String>();// 工程编号
+
+	@Override
+	public void doAction(HttpServletRequest request, HttpServletResponse req)
+			throws ServletException, IOException {
+		 try {	
+				NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
+				DataSourceUtil.setDataSource();
+				String invocatpk_group=InvocationInfoProxy.getInstance().getGroupId();
+				InvocationInfoProxy.getInstance().setGroupId(invocatpk_group);
+				String createStr = buildJson(request, req, this.getClass().getName());
+		//		com.alibaba.fastjson.JSONObject json = JSON.parseObject(createStr);
+		//		NcLog.initUI("json:"+json.toString(),"dzgy_query");
+		//		com.alibaba.fastjson.JSONArray bodyArray = json.getJSONArray("result");
+				 JSONObject jsonObject = new JSONObject(createStr);
+				  
+				 NcLog.initUI("json:"+jsonObject.toString(),"dzgy_query"); 
+				
+				String token =request.getParameter("token");
+				
+		        if(!(token!=null && !token.equals("")&&("07a81a68-c60c-4ee4-83dc-25aa51a51497").equals(token))){
+		        	req.getWriter().write(formatRSJsonData("失败",
+							"请确认通讯密码是否正确!","").toString());
+		        	NcLog.initUI("通讯密码不正确!","dzgy_query");
+					return;
+				
+				}
+		        
+//				for (int i = 0; i < bodyArray.size(); i++) {
+//					com.alibaba.fastjson.JSONObject jsonObject = bodyArray.getJSONObject(i);
+//					checkJson(jsonObject);
+//					String pickDate=jsonObject.getString("pickDate");//领料时间
+//					String proNo=jsonObject.getString("proNo");//工程编号
+//					pickDates.add(pickDate);
+//					proNos.add(proNo);
+//				 }
+
+				
+//				Map<String,ArrayList<SapplyBillBodyVO>> map=getMapSapplyBodyVO();  //查询的结果集
+				
+				
+//				for (int i = 0; i < bodyArray.size(); i++) {
+//					com.alibaba.fastjson.JSONObject jsonObject = bodyArray.getJSONObject(i);
+//					String proNo=jsonObject.getString("proNo");//工程编号
+//					String pickDate=jsonObject.getString("pickDate");//领料时间
+//				
+//					ArrayList<SapplyBillBodyVO> bodyvo=map.get(proNo+pickDate);
+//					
+//					String rutunjson=getJsonExample(bodyvo);
+//					
+//					req.getWriter().write(rutunjson);
+//					
+//				 }
+				
+		        
+		        checkJson(jsonObject);
+				String pickDate=jsonObject.getString("pickDate");//领料时间
+				String proNo=jsonObject.getString("proNo");//工程编号
+//				String corpcode=jsonObject.getString("corpcode");//公司
+//				ArrayList<SapplyBillBodyVO>  bodyvos=  getMapSapplyBodyVO(pickDate,proNo,corpcode);
+				
+				ArrayList<SapplyBillBodyVO>  bodyvos=  getMapSapplyBodyVO(pickDate,proNo);
+				
+				if(null==bodyvos ||  bodyvos.size()==0){
+					req.getWriter().write(formatRSJsonData("失败","数据为空!","").toString());
+					return;
+				}
+				
+				String rutunjson=getJsonExample(bodyvos);
+				
+				req.getWriter().write(rutunjson);
+				
+				
+				} catch (Exception e) {
+					req.getWriter().write(formatRSJsonData("失败", e.getMessage(),"").toString());
+				}
+
+       }
+	
+	
+	
+  
+	
+	
+	
+	   private void checkJson(JSONObject jsonObject) throws Exception {
+		   
+		    StringBuffer mags = new StringBuffer();
+			Boolean empty = true;
+			
+			String pickDate = "pickDate";
+//			String proNo = "proNo";
+//			String[] HeadKey = {pickDate,proNo};   
+			
+			String[] HeadKey = {pickDate};   
+			
+			for (String as : HeadKey) {
+				if (jsonObject.getString(as).isEmpty()) {
+					empty = false;
+					mags.append("'" + as + "'");
+				}
+			}		
+			if (!empty) {
+				throw new Exception("以下字段不可为空:"+mags);
+			}
+			
+	  }
+
+
+
+
+/*	private Map<String,ArrayList<SapplyBillBodyVO>> getMapSapplyBodyVO() throws BusinessException{
+		
+		SqlBuilder  sqlbulid =new SqlBuilder();
+		
+		String sql =" select p.project_code vbcdef1,h.vbillcode vbcdef2,a.Vdef3 vbcdef3,a.dbilldate vbcdef4,m.code vbcdef5 ,m.name vbcdef6  "
+				+ " m.materialspec ||  m.materialtype vbcdef7 , b.noutboundastnum ,b.nnum   from  ic_sapply_b b "
+				+ " innser join ic_sapply_h h on h.cgeneralhid =b.cgeneralhid "
+				+ " inner join bd_project p on p.pk_project=b.Cprojectid "
+				+ " inner join org_stockorg o on o.pk_stockorg =h.cissueorg  "
+				+ " inner join bd_material m on m. pk_material =b.cmaterialvid "
+				+ " and nvl(a.dr,0)=0 and nvl(b.dr,0)=0 and  nvl(p.dr,0)=0 and o.code='0103' and ";
+		
+		sqlbulid.append(sql);
+		sqlbulid.append("a.dbilldate", pickDates.toArray(new String[pickDates.size()]) );
+		sqlbulid.append(" and " );
+		sqlbulid.append("p.project_code", proNos.toArray(new String[proNos.size()]) );
+		
+		
+		ArrayList<SapplyBillBodyVO>  bodyvos=(ArrayList<SapplyBillBodyVO>) iuapquerybs.executeQuery(sqlbulid.toString(), new BeanListProcessor(SapplyBillBodyVO.class));
+		
+		if(bodyvos == null || bodyvos.size() == 0){
+			return null;
+		}
+		
+		Map<String,ArrayList<SapplyBillBodyVO>> map = new HashMap<String, ArrayList<SapplyBillBodyVO>>();
+		
+		for(SapplyBillBodyVO vo : bodyvos){
+			
+			if(null==map.get(vo.getVbcdef1()+vo.getVbcdef4())){
+				ArrayList<SapplyBillBodyVO> sappbillbody=new ArrayList<SapplyBillBodyVO> ();
+				sappbillbody.add(vo);
+			}else{
+				
+				map.get(vo.getVbcdef1()+vo.getVbcdef4()).add(vo);	
+				
+			}
+			
+		}
+		return map;
+	}
+	*/
+	
+	
+	
+	private ArrayList<SapplyBillBodyVO>  getMapSapplyBodyVO(String pickDates, String proNos) throws BusinessException{
+				
+        StringBuffer sbf=new StringBuffer();
+//		String sql =" select h.cgeneralhid,p.project_code vbcdef1,h.vbillcode vbcdef2,h.Vdef3 vbcdef3,h.dbilldate vbcdef4,m.code vbcdef5 ,m.name vbcdef6,  "
+        String sql =" select h.cgeneralhid,p.project_code vbcdef1,h.vbillcode vbcdef2,case when h.vdef3 is not null then  (select name from bd_defdoc where pk_defdoc=h.vdef3)  else '' end  as vbcdef3,"
+        		+ " h.dbilldate vbcdef4,m.code vbcdef5 ,m.name vbcdef6,  "
+                + " m.materialspec ||  m.materialtype vbcdef7 , e.noutboundastnum vbcdef8 ,b.nnum   from  ic_sapply_b b "
+				+ " inner join ic_sapply_h h on h.cgeneralhid =b.cgeneralhid "
+//				+ " inner join bd_project p on p.pk_project=b.Cprojectid "
+                + " inner join bd_project p on p.pk_project=h.vdef2 "
+				+ " inner join org_stockorg o on o.pk_stockorg =h.cissueorg  "
+				+ " inner join bd_material m on m. pk_material =b.cmaterialvid "
+				+ " inner join ic_sapply_e e on e. cgeneralbid =b.cgeneralbid "
+				+ " and nvl(h.dr,0)=0 and nvl(b.dr,0)=0 and  nvl(p.dr,0)=0 and nvl(m.dr,0)=0 and nvl(o.dr,0)=0 "
+				+ " and e.noutboundastnum is not null "
+				+ " and nvl(e.dr,0)=0 "
+//				+ " and o.code='0103' "
+				+ " and substr (h.dbilldate,1,10) ='"+pickDates+"'  ";
+		
+		sbf.append(sql);
+		
+		if(null!=proNos && !"".equals(proNos)){
+			sbf.append(" and p.project_code='"+proNos+"'");	
+		}
+		
+//		if(null!=corpcode && !"".equals(corpcode)){
+//			sbf.append(" and o.code='"+corpcode+"'");	
+//		}
+		
+		ArrayList<SapplyBillBodyVO>  bodyvos=(ArrayList<SapplyBillBodyVO>) iuapquerybs.executeQuery(sbf.toString(), new BeanListProcessor(SapplyBillBodyVO.class));
+		
+
+	    return bodyvos;
+	}
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+/*	private  String  getJsonExample(ArrayList<SapplyBillBodyVO>  sapbodyvos) throws JSONException{
+		
+		// 创建最外层的JSONObject
+        JSONObject root = new JSONObject();
+ 
+        // 创建result对象
+        JSONObject result = new JSONObject();
+        // 创建data数组
+        JSONArray data = new JSONArray();
+ 
+        // 创建data数组中的第一个对象
+        JSONObject dataItem = new JSONObject();
+        dataItem.put("proNo", sapbodyvos.get(0).getVbcdef1());//工程编号
+        dataItem.put("bi1INo", sapbodyvos.get(0).getVbcdef2());//领料单编号
+        dataItem.put("smanager", sapbodyvos.get(0).getVbcdef3());//领料人
+        dataItem.put("pickDate",  sapbodyvos.get(0).getVbcdef4());//领料时间
+ 
+        // 创建entry数组
+        JSONArray entryArray = new JSONArray();
+        
+        for(SapplyBillBodyVO bodyvo:sapbodyvos){
+        	
+        	// 创建entry数组中的第一个对象
+            JSONObject entryItem = new JSONObject();
+            entryItem.put("matNum", bodyvo.getVbcdef5());//物料编码
+            entryItem.put("matName", bodyvo.getVbcdef6());//物料名称
+            entryItem.put("matModel", bodyvo.getVbcdef7());//规格型号
+            entryItem.put("qty", bodyvo.getVbcdef8());//已出库数量
+            entryItem.put("guistOty", bodyvo.getNnum());//申请数量
+            entryItem.put("quistDate", sapbodyvos.get(0).getVbcdef4());//申请领料日期
+            entryItem.put("sourceBi11",sapbodyvos.get(0).getVbcdef2());//申请计划单号
+            // 将entryItem添加到entryArray
+            entryArray.put(entryItem);
+        	
+        }
+      
+ 
+        // 将entryArray添加到dataItem
+        dataItem.put("entry", entryArray);
+ 
+        // 将dataItem添加到data数组
+        data.put(dataItem);
+ 
+        // 将data数组添加到result对象
+        result.put("data", data);
+ 
+        // 将result对象添加到root对象
+        root.put("result", result);
+ 
+        // 添加其他字段到root对象
+        root.put("status", "成功");
+        root.put("error", "");
+        root.put("message", "");
+ 
+		return root.toString();
+		
+		
+	}*/
+	
+	
+	
+	
+	
+	
+	
+	private  String  getJsonExample(ArrayList<SapplyBillBodyVO>  sapbodyvos) throws JSONException, JsonGenerationException, JsonMappingException, IOException{
+		
+		
+		Map<String,ArrayList<SapplyBillBodyVO>> map=new HashMap<String,ArrayList<SapplyBillBodyVO>>();
+		//按表头分单
+		 for(SapplyBillBodyVO bodyvo:sapbodyvos){
+			 
+			 if(null==map.get(bodyvo.getCgeneralhid()) ||  map.get(bodyvo.getCgeneralhid()).size()==0){
+				 
+				 ArrayList<SapplyBillBodyVO> sarrysap=new  ArrayList<SapplyBillBodyVO>();
+				 
+				 sarrysap.add(bodyvo);
+				 
+				 map.put(bodyvo.getCgeneralhid(), sarrysap);
+				 
+			 }else{
+				 
+				 ArrayList<SapplyBillBodyVO> sarrysaps=map.get(bodyvo.getCgeneralhid());
+				 
+				 sarrysaps.add(bodyvo);
+				 
+				 map.put(bodyvo.getCgeneralhid(), sarrysaps); 
+				 
+			 }
+			 
+			 
+			 
+		 }
+		
+		
+		List<Data> dataList =new ArrayList<Data>();
+	
+		for(Map.Entry<String,ArrayList<SapplyBillBodyVO>> entrymap : map.entrySet()){
+			
+			List<Entry> entryList = new ArrayList<Entry>();
+			
+			Data data = new Data();
+	        data.setEntry(entryList);
+	        data.setBi1INo(entrymap.getValue().get(0).getVbcdef2());//领料单编号
+	        data.setSmanager(entrymap.getValue().get(0).getVbcdef3()==null?"":entrymap.getValue().get(0).getVbcdef3());//领料人
+	        data.setProNo(entrymap.getValue().get(0).getVbcdef1());//工程编号
+	        data.setPickDate(entrymap.getValue().get(0).getVbcdef4());//领料时间
+	        dataList.add(data);
+			
+			for(SapplyBillBodyVO bodyvo:entrymap.getValue()){
+				Entry entry = new Entry();
+				entry.setQuistDate(bodyvo.getVbcdef4());//申请领料日期
+		        entry.setGuistOty(bodyvo.getNnum().toString());//申请数量
+		        entry.setMatModel(bodyvo.getVbcdef7());//规格型号
+		        entry.setQty(bodyvo.getVbcdef8()==null ? "0":bodyvo.getVbcdef8());//已出库数量
+		        entry.setSourceBi11(bodyvo.getVbcdef2());//申请计划单号 
+		        entry.setMatName(bodyvo.getVbcdef6());//物料名称
+		        entry.setMatNum(bodyvo.getVbcdef5());//物料编码
+		        entryList.add(entry);
+			}
+
+		 }
+		
+		 Result result = new Result();
+	     result.setData(dataList);
+		
+		 Root root = new Root("", result, "", "成功");
+		 
+		 ObjectMapper objectMapper = new ObjectMapper();
+		 
+	     String jsonString = objectMapper.writeValueAsString(root);
+		
+		 return jsonString;
+		
+	  }
+	
+	
+ }	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	

+ 240 - 0
gy/gy/src/private/nc/bs/servlet/service/ProprojectServlet.java

@@ -0,0 +1,240 @@
+package nc.bs.servlet.service;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+
+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.gy.log.NcLog;
+import nc.impl.ic.util.DateCalUtil;
+import nc.itf.pmpub.project.pub.IProjectServiceForPu;
+import nc.itf.pmpub.prv.IProject;
+import nc.itf.pmpub.prv.IProjectAssignService;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.SQLParameter;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.pub.util.DataSourceUtil;
+import nc.vo.pmpub.project.ProjectHeadVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFDate;
+import nc.vo.pub.lang.UFDateTime;
+
+import com.alibaba.fastjson.JSONObject;
+
+public class ProprojectServlet extends BaseServlet implements IHttpServletAdaptor{
+	
+	private IUAPQueryBS iUAPQueryBS = null;
+//	private IProjectServiceForPu iprojectservice=null;
+	private IProjectAssignService iprojectassign=null;
+	   
+    private IUAPQueryBS getIUAPQueryBS() {
+        if (this.iUAPQueryBS == null) {
+            this.iUAPQueryBS = (IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class);
+        }
+        return this.iUAPQueryBS;
+
+    }
+    
+//    private IProjectServiceForPu getIProjectServiceForPu(){
+//    	  if (this.iprojectservice == null) {
+//              this.iprojectservice = (IProjectServiceForPu) NCLocator.getInstance().lookup(IProjectServiceForPu.class);
+//          }
+//          return this.iprojectservice;
+//    }
+	
+    
+    
+    private IProjectAssignService getIProjectAssignService(){
+    	  if (this.iprojectassign == null) {
+              this.iprojectassign = (IProjectAssignService) NCLocator.getInstance().lookup(IProjectAssignService.class);
+          }
+          return this.iprojectassign;
+    }
+
+	@SuppressWarnings("restriction")
+	@Override
+	public void doAction(HttpServletRequest request, HttpServletResponse req)
+			throws ServletException, IOException {
+	 try {	
+		NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
+		DataSourceUtil.setDataSource();
+		String invocatpk_group=this.qryGroup();
+		InvocationInfoProxy.getInstance().setGroupId(invocatpk_group);
+		String createStr = buildJson(request, req, this.getClass().getName());
+		JSONObject json = JSON.parseObject(createStr);
+		NcLog.initUI("json:"+json.toString(),"dzgy");
+		JSONArray bodyArray = json.getJSONArray("result");
+		
+		
+		String token =request.getParameter("token");
+		
+        if(!(token!=null && !token.equals("")&&("07a81a68-c60c-4ee4-83dc-25aa51a51497").equals(token))){
+        	req.getWriter().write(formatRSJsonData("失败",
+					"请确认通讯密码是否正确!","").toString());
+        	NcLog.initUI("通讯密码不正确!","dzgy");
+			return;
+		
+		}
+		
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");    
+		for (int i = 0; i < bodyArray.size(); i++) {
+			JSONObject jsonObject = bodyArray.getJSONObject(i);
+			ProjectHeadVO headvo=new ProjectHeadVO();
+			checkJson(jsonObject);
+			String pk_org=jsonObject.getString("pk_org");//集团
+			String value_org=getDataMate("pk_org","org_orgs"," code=? ",pk_org);
+//			String value_org_v=getDataMate("pk_vid","org_itemorg_v"," code=? ",pk_org);
+	
+			String project_code=jsonObject.getString("project_code");//编码
+			String project_name=jsonObject.getString("project_name");//名称
+			String project_sh_name=jsonObject.getString("project_sh_name");
+			
+			String pk_projectclass=jsonObject.getString("pk_projectclass");//类型
+			String value_projectclass=getDataMate("pk_projectclass","bd_projectclass"," type_code=? ",pk_projectclass);
+			
+			String plan_start_date=jsonObject.getString("plan_start_date");//计划开始日期 
+			String plan_finish_date=jsonObject.getString("plan_finish_date");//计划完成日期
+			
+			String creator=jsonObject.getString("creator");//创建人 
+			String value_creator=getDataMate("cuserid","sm_user"," user_code=? ",creator);
+			
+			String creationtime=jsonObject.getString("creationtime");//创建时间 
+			
+			String eps=jsonObject.getString("eps");//eps
+			String value_eps=getDataMate("pk_eps","pm_eps"," eps_code=? ",eps);
+		//	String pk_group=getDataMate("pk_group ","org_group"," code=? ",pk_org);
+			
+			headvo.setPk_group(invocatpk_group);
+			headvo.setPk_org(value_org);
+	//		headvo.setPk_org_v(value_org_v);
+			headvo.setProject_code(project_code);
+			headvo.setProject_name(project_name);
+			headvo.setProject_sh_name(project_sh_name);
+			headvo.setPk_projectclass(value_projectclass);
+			headvo.setPlan_start_date(new UFDate(plan_start_date));
+			headvo.setPlan_finish_date(new UFDate(plan_finish_date));
+//			headvo.setCreator(value_creator);
+//			InvocationInfoProxy.getInstance().setUserId(value_creator);
+//			InvocationInfoProxy.getInstance().setUserCode(creator);
+			headvo.setCreationtime(new UFDateTime(creationtime));
+			headvo.setPk_eps(value_eps);
+			headvo.setBegin_flag(UFBoolean.FALSE);
+			headvo.setTax_flag(UFBoolean.FALSE);
+			headvo.setUpload_flag(UFBoolean.FALSE);
+			headvo.setBill_type("4D10");
+			headvo.setTransi_type("4D10-01");
+			headvo.setPk_currtype("1002Z0100000000001K1");//币种 
+			
+			Date beginDate = format.parse(plan_start_date);
+	        Date endDate= format.parse(plan_finish_date);    
+	        long day=(endDate.getTime()-beginDate.getTime())/(24*60*60*1000);  
+		    int planduration=(int) day;    
+			headvo.setPlanduration(planduration+1);
+//			ProjectHeadVO newheadvo=getIProjectServiceForPu().insertProject(headvo);
+			IProject insert= NCLocator.getInstance().lookup(IProject.class);
+			ProjectHeadVO newheadvo=insert.insertProject(headvo);
+			//分配
+			getIProjectAssignService().assignProjectByPks(new String[]{newheadvo.getPk_project()}, new String[]{value_org}, new String[]{value_org});
+			req.getWriter().write(formatRSJsonData("成功", "", "项目编码:"+project_code).toString());
+			
+
+			BaseDAO basdao=new BaseDAO();
+			
+			basdao.executeUpdate(" update  bd_project set creator='"+value_creator+"'  "
+					+ " where project_code='"+project_code+"'  and nvl(dr,0)=0");
+			
+		 }
+		 
+
+		 
+		 
+		 
+
+		} catch (Exception e) {
+			req.getWriter().write(formatRSJsonData("失败", e.getMessage(),"").toString());
+		}
+	}
+	
+	
+	private void checkJson(JSONObject json) throws Exception {
+		
+		StringBuffer mags = new StringBuffer();
+		Boolean empty = true;
+		
+		String pk_org = "pk_org";//管理组织
+		String pk_jobtype = "pk_projectclass";//项目类型
+		String jobcode = "project_code";//项目编码
+		String jobname = "project_name";//项目名称
+		String[] HeadKey = {pk_org,pk_jobtype,jobcode,jobname};
+		
+		for (String as : HeadKey) {
+			if (json.getString(as).isEmpty()) {
+				empty = false;
+				mags.append("'" + as + "'");
+			}
+		}		
+		if (!empty) {
+			throw new Exception("以下字段不可为空:"+mags);
+		}
+	}
+	
+	
+	/**
+	 * 
+	 * @param value      查询值
+	 * @param tablename  表名
+	 * @param where      条件拼接
+	 * @param parm       查询参数 
+	 * @return
+	 * @throws Exception
+	 */
+	private String  getDataMate(String value,String tablename,String where,String parm) throws Exception{
+		
+		String sql="select "+value+"  from  " +  tablename + " where nvl(dr,0)=0 and " + where ;
+		
+		SQLParameter sqlparamter=new SQLParameter();
+		sqlparamter.addParam(parm);
+		
+		Object valueobj=getIUAPQueryBS().executeQuery(sql, sqlparamter, new ColumnProcessor());
+		
+		if(null==valueobj){
+			throw new Exception("未找到与参数"+parm+"有关的数据!");
+		}
+		
+		return valueobj.toString();
+	}
+	
+	/**
+	 * 获取集团id
+	 * 
+	 * @return
+	 */
+	private String qryGroup() {
+		String qrysql = "select pk_group from org_group where nvl(dr,0)=0 and rownum = 1";
+		String pk_group;
+		try {
+			pk_group = (String) getIUAPQueryBS()
+					.executeQuery(qrysql, new ColumnProcessor());
+			return pk_group;
+		} catch (BusinessException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+	
+
+}

+ 26 - 0
gy/gy/src/private/nc/impl/hrrm/MyX509TrustManager.java

@@ -0,0 +1,26 @@
+package nc.impl.hrrm;
+
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.X509TrustManager;
+public class MyX509TrustManager implements X509TrustManager
+{
+	@Override
+    public void checkClientTrusted(X509Certificate ax509certificate[], String s) throws CertificateException
+    {
+		//TODO nothing
+    }
+
+	@Override
+	public void checkServerTrusted(X509Certificate ax509certificate[], String s) throws CertificateException
+	{
+		//TODO nothing
+	}
+ 
+	@Override
+	public X509Certificate[] getAcceptedIssuers()
+	{
+		return new X509Certificate[]{};
+	}
+
+}

+ 47 - 0
gy/gy/src/private/nc/pub/util/DataSourceUtil.java

@@ -0,0 +1,47 @@
+package nc.pub.util;
+
+import nc.bcmanage.bs.IBusiCenterManageService;
+import nc.bcmanage.vo.BusiCenterVO;
+import nc.bs.framework.common.InvocationInfoProxy;
+import nc.bs.framework.common.NCLocator;
+import nc.gy.log.NcLog;
+import nc.vo.pub.BusinessException;
+
+public class DataSourceUtil {
+	
+	
+	
+	/**
+	 * 
+	 * 设置NC数据源
+	 * 
+	 */
+	public static void setDataSource() throws BusinessException{
+	   BusiCenterVO[] centerVOs = getBusiCenterVOs();
+	   if (centerVOs != null && centerVOs.length > 0) {
+	   // 设置数据源,默认只有一个账套
+	  InvocationInfoProxy.getInstance().setUserDataSource(
+	  centerVOs[0].getDataSourceName());//设置数据源----第一条数据
+	  NcLog.initUI("查询数据源名称为:"+centerVOs[0].getDataSourceName(),"status");
+	  NcLog.initUI("查询数据源名称为:"+centerVOs[1].getDataSourceName(),"status");
+     }
+   }
+	
+	
+
+	/**
+	 * 
+	 * 获取当前所有数据源
+	 * 
+	 */
+	
+	  private static BusiCenterVO[] getBusiCenterVOs() throws BusinessException{
+          IBusiCenterManageService service = NCLocator.getInstance().lookup(
+                      IBusiCenterManageService.class);
+       
+          BusiCenterVO[]   centerVOs = service.getBusiCenterVOs();
+       
+          return centerVOs;
+	  }
+
+}

+ 85 - 0
gy/gy/src/public/com/yonyou/iuap/corp/gy/utils/AppController.java

@@ -0,0 +1,85 @@
+package com.yonyou.iuap.corp.gy.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.util.EntityUtils;
+
+import nc.bs.framework.common.RuntimeEnv;
+import nc.vo.pub.BusinessException;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+
+public class AppController {
+
+	public String getToken() throws Exception{
+		  String token=null;
+		  Map<String,String> map=getPer();
+		  Map<String, String> params = new HashMap<>();
+	        // 除签名外的其他参数
+	        params.put("appKey", map.get("appKey"));
+	        params.put("timestamp", String.valueOf(System.currentTimeMillis()));
+	        //params.put("timestamp", "1687247814552");
+	        // 计算签名
+	        String signature = SignHelper.sign(params, map.get("appSecret"));
+	        params.put("signature", signature);
+	        
+	        // 请求
+	        String requestUrl = map.get("openApiUrl") + "/iuap-api-auth/open-auth/selfAppAuth/getAccessToken";
+	        //String json =RequestTool.doGet(requestUrl, params);
+	       String url=requestUrl + "?appKey=" + params.get("appKey") + "&timestamp=" + params.get("timestamp") + "&signature=" + params.get("signature");
+	       String json= HttpUtils.urlGet(url);
+	       JSONObject rtnJson=(JSONObject) JSON.parse(json);
+	       if("00000".equals(rtnJson.get("code"))){
+	    	   JSONObject js=(JSONObject) JSON.toJSON(rtnJson.get("data"));
+	    	   token=js.getString("access_token");
+	       }else{
+	    	   throw new Exception(rtnJson.get("message").toString());
+	       }
+	   return token;
+	}
+ 
+//	public static String GetRequest(String url) throws BusinessException {
+//  		HttpEntity entity = null;
+//  		HttpClient httpclient = HttpClients.createDefault();
+//  	    try {
+//  		     HttpGet request = new HttpGet(url);
+//  		     HttpResponse response = httpclient.execute(request);
+//  		     entity = response.getEntity();
+//  		     if (entity == null) {
+//  		       throw new BusinessException("Response is null");
+//  		     }
+//  		     return EntityUtils.toString(entity);
+//  		   } catch (Exception e) {
+//  		     throw new BusinessException(e.getMessage());
+//  		   }
+//  	}
+	
+   public Map<String,String> getPer() throws IOException{
+	  // String filePath = RuntimeEnv.getInstance().getNCHome() + File.separator + "resources" + File.separator + "nc-bip.properties";
+	   String filePath = RuntimeEnv.getInstance().getNCHome()+File.separator + "resources/gy" + File.separator +"nc-bip.properties";
+	   File file=new File(filePath);
+	   FileInputStream fis = new FileInputStream(file);
+	   Properties pro=new Properties();
+	   pro.load(fis);
+	   Map<String,String> map=new HashMap<String,String>();
+	   map.put("appKey", pro.getProperty("appKey"));
+	   map.put("appSecret",pro.getProperty("appSecret"));
+	   map.put("openApiUrl", pro.getProperty("openApiUrl"));
+	   return map;
+   }
+    
+
+}

+ 247 - 0
gy/gy/src/public/com/yonyou/iuap/corp/gy/utils/HttpUtils.java

@@ -0,0 +1,247 @@
+package com.yonyou.iuap.corp.gy.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.SecureRandom;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+
+import nc.impl.hrrm.MyX509TrustManager;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.params.HttpMethodParams;
+
+public  class HttpUtils {
+	public static PostMethod Post(String url,String json) throws Exception{
+		HttpClient httpClient = new HttpClient();
+		// 设置httpClient连接主机服务器超时时间:15000毫秒
+		httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(15000);
+		// 创建post请求方法实例对象
+		PostMethod postMethod = new PostMethod(url);
+		// 设置post请求超时时间
+		postMethod.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, 60000);
+		postMethod.addRequestHeader("Content-Type", "application/json;charset=utf-8");
+
+		//json格式的参数解析
+		RequestEntity entity = new StringRequestEntity(json, "application/json", "UTF-8");
+		postMethod.setRequestEntity(entity);
+
+		httpClient.executeMethod(postMethod);
+
+		//postMethod.releaseConnection();
+		return postMethod;
+
+	}
+
+	public static GetMethod get(String url) throws Exception{
+		HttpClient httpClient = new HttpClient();
+		// 设置httpClient连接主机服务器超时时间:15000毫秒
+		httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(15000);
+		// 创建GET请求方法实例对象
+		GetMethod getMethod = new GetMethod(url);
+		// 设置post请求超时时间
+		getMethod.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, 60000);
+		getMethod.addRequestHeader("Content-Type", "application/json");
+
+		httpClient.executeMethod(getMethod);
+		return getMethod;
+
+	}
+
+	public static String  urlPost(String url,String str) throws Exception{
+		OutputStreamWriter out = null;
+		BufferedReader in = null;
+		StringBuilder result = new StringBuilder("");
+		try {
+			URL realUrl = new URL(url);
+			// 打开和URL之间的连接
+			URLConnection conn = realUrl.openConnection();
+			
+			if(url.contains("https")) {
+		    	  trustAllHttpsCertificates();  
+			      HttpsURLConnection.setDefaultHostnameVerifier(hv); 
+//			      conn = getMyHttpsURLConnection(url);
+			}else {
+				URL restServiceURL = new URL(url);
+				conn = restServiceURL.openConnection();
+			}
+			// 设置通用的请求属性
+			conn.setRequestProperty("Content-Type","application/json;charset=UTF-8");
+			conn.setRequestProperty("accept", "*/*");
+			conn.setRequestProperty("connection", "Keep-Alive");
+			conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+			// 发送POST请求必须设置如下两行
+			conn.setDoOutput(true);
+			conn.setDoInput(true);
+			// 获取URLConnection对象对应的输出流
+			out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
+			// 发送请求参数
+			out.write(str);
+			// flush输出流的缓冲
+			out.flush();
+			// 定义BufferedReader输入流来读取URL的响应
+			InputStream is = null;
+		    int code = ((HttpURLConnection) conn).getResponseCode();
+		    if (code == 200) {
+		    	is = conn.getInputStream(); // 得到网络返回的正确输入流
+		    } else {
+		    	is = ((HttpURLConnection) conn).getErrorStream(); // 得到网络返回的错误输入流
+		    }
+			in = new BufferedReader(new InputStreamReader(is,"UTF-8"));
+			String line=null;
+			while ((line = in.readLine()) != null) {
+				result.append(line);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		//使用finally块来关闭输出流、输入流
+		finally{
+			if(out!=null){ try { out.close(); }catch(Exception ex){} }
+			if(in!=null){ try { in.close(); }catch(Exception ex){} }
+		}
+		return result.toString();
+
+	}
+	
+	public  static String urlGet(String url){ 
+		    StringBuilder result = new StringBuilder();
+		    BufferedReader in = null;
+		    try {
+		        URL realUrl = new URL(url);
+		        // 打开和URL之间的连接
+		        URLConnection connection = realUrl.openConnection();
+				
+				if(url.contains("https")) {
+			    	  trustAllHttpsCertificates();  
+				      HttpsURLConnection.setDefaultHostnameVerifier(hv); 
+//				      connection = getMyHttpsURLConnection(url);
+				}else {
+					URL restServiceURL = new URL(url);
+					connection = restServiceURL.openConnection();
+				}
+		        // 设置通用的请求属性
+		        connection.setRequestProperty("accept", "*/*");
+		        connection.setRequestProperty("connection", "Keep-Alive");
+				connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)");
+				connection.setRequestProperty("Charset", "UTF-8");
+		        connection.setRequestProperty("Content-Type", "application/json");
+//		        connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+		        // 建立实际的连接
+		        connection.connect();
+		        // 获取所有响应头字段
+		        // 定义 BufferedReader输入流来读取URL的响应
+		        in = new BufferedReader(new InputStreamReader(connection.getInputStream(),"UTF-8"));
+		        String line;
+		        while ((line = in.readLine()) != null) {
+		            result.append(line);
+		        }
+		    } catch (Exception e) {
+		        System.out.println("发送GET请求出现异常!" + e);
+		        e.printStackTrace();
+		    }
+		    finally {
+		        if (in != null){ try { in.close(); }catch(Exception e2){} }
+		    }
+		    return result.toString();
+	}
+	
+	/**
+	 * 获取不安全的HttpsConnection
+	 * 关闭证书验证,可以和任何https站点建立连接
+	 * @param url
+	 * @return
+	 * @throws IOException
+	 */
+	public static HttpsURLConnection getMyHttpsURLConnection(String url) throws IOException
+	{
+		HttpsURLConnection rs = null;
+		if(null != url && !url.isEmpty())
+		{
+			try
+			{
+				rs = (HttpsURLConnection)new URL(url.trim()).openConnection();
+				TrustManager[] trustManagers = {new MyX509TrustManager()};
+				SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); 
+				System.setProperty("https.protocols", "TLSv1.2"); 
+				sslContext.init(null, trustManagers, new SecureRandom());
+				rs.setSSLSocketFactory(sslContext.getSocketFactory());
+			}
+			catch(Exception e)
+			{
+				throw new IOException(e);
+			}
+		}
+		return rs;
+	}
+	
+	
+	/**
+	 * 设置SSL协议版本
+	 * @throws Exception
+	 */
+	private static void trustAllHttpsCertificates() throws Exception {  
+	      javax.net.ssl.TrustManager[] trustAllCerts = new javax.net.ssl.TrustManager[1];  
+	      javax.net.ssl.TrustManager tm = new miTM();  
+	      trustAllCerts[0] = tm;  
+	      javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext  
+	              .getInstance("TLSv1.2");  
+	      System.setProperty("https.protocols", "TLSv1.2"); 
+	      sc.init(null, trustAllCerts, null);  
+	      javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc  
+	              .getSocketFactory());  
+	} 
+	
+	
+	static class miTM implements javax.net.ssl.TrustManager,  
+    javax.net.ssl.X509TrustManager {  
+	
+		public java.security.cert.X509Certificate[] getAcceptedIssuers() {  
+			return null;  
+		}  
+
+	public boolean isServerTrusted(  
+	        java.security.cert.X509Certificate[] certs) {  
+	    return true;  
+	}  
+	
+	public boolean isClientTrusted(  
+	        java.security.cert.X509Certificate[] certs) {  
+	    return true;  
+	}  
+	
+	public void checkServerTrusted(  
+	        java.security.cert.X509Certificate[] certs, String authType)  
+	        throws java.security.cert.CertificateException {  
+	    return;  
+	}  
+	
+	public void checkClientTrusted(  
+	        java.security.cert.X509Certificate[] certs, String authType)  
+	        throws java.security.cert.CertificateException {  
+	    return;  
+	}  						
+}
+	
+	static HostnameVerifier hv = new HostnameVerifier() {  
+	      public boolean verify(String urlHostName, SSLSession session) {  
+	          System.out.println("Warning: URL Host: " + urlHostName + " vs. "  
+	                             + session.getPeerHost());  
+	          return true;  
+	      }  
+	};  
+}

+ 81 - 0
gy/gy/src/public/com/yonyou/iuap/corp/gy/utils/SignHelper.java

@@ -0,0 +1,81 @@
+package com.yonyou.iuap.corp.gy.utils;
+
+
+import sun.misc.BASE64Encoder;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+import nc.bs.logging.Logger;
+import org.apache.commons.codec.binary.Base64;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * 请求开放平台套件授权相关接口的加签类
+ */
+public class SignHelper {
+
+    /**
+     * 按参数名排序后依次拼接参数名称与数值,之后对该字符串使用 HmacSHA256 加签,加签结果进行 base 64 返回
+     * @param params 请求参数 map
+     * @param suiteSecret 套件密钥,用作 mac key
+     * @return 签名
+     * @throws NoSuchAlgorithmException
+     * @throws UnsupportedEncodingException
+     * @throws InvalidKeyException
+     */
+//    public static String sign(Map<String, String> params, String suiteSecret) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
+//        // use tree map to sort params by name
+//        Map<String, String> treeMap;
+//        if (params instanceof TreeMap) {
+//            treeMap = params;
+//        } else {
+//            treeMap = new TreeMap<>(params);
+//        }
+//
+//        StringBuilder stringBuilder = new StringBuilder();
+//        for (Map.Entry<String, String> entry : treeMap.entrySet()) {
+//            stringBuilder.append(entry.getKey()).append(entry.getValue());
+//        }
+//
+//        Mac mac = Mac.getInstance("HmacSHA256");
+//        mac.init(new SecretKeySpec(suiteSecret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
+//        byte[] signData = mac.doFinal(stringBuilder.toString().getBytes(StandardCharsets.UTF_8));
+//        String base64String = new BASE64Encoder().encode(signData);//Base64.getEncoder().encodeToString(signData);
+//       
+//        return base64String;
+//        		//URLEncoder.encode(base64String, "UTF-8").toString();
+//    }
+    
+    
+    public static String sign(Map<String, String> params, String suiteSecret) {
+        try {
+          Map<String, String> treeMap;
+          if (params instanceof TreeMap) {
+            treeMap = params;
+          } else {
+            treeMap = new TreeMap<>(params);
+          }
+          StringBuilder stringBuilder = new StringBuilder();
+          for (Map.Entry<String, String> entry : treeMap.entrySet()) {
+            stringBuilder.append(entry.getKey()).append(entry.getValue());
+          }
+          Mac mac = Mac.getInstance("HmacSHA256");
+          mac.init(new SecretKeySpec(suiteSecret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
+          byte[] signData = mac.doFinal(stringBuilder.toString().getBytes(StandardCharsets.UTF_8));
+          String base64String = new String(Base64.encodeBase64(signData), "UTF-8");
+          return URLEncoder.encode(base64String, "UTF-8");
+        } catch (Exception e) {
+          Logger.error(e);
+        }
+        return null;
+      }
+
+}

+ 73 - 0
gy/gy/src/public/nc/bs/gy/yfk/m4455/SapplySaveAfterToYFK.java

@@ -0,0 +1,73 @@
+package nc.bs.gy.yfk.m4455;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.yonyou.iuap.corp.gy.utils.AppController;
+import com.yonyou.iuap.corp.gy.utils.HttpUtils;
+
+import nc.bs.businessevent.BdUpdateEvent;
+import nc.bs.businessevent.BusinessEvent;
+import nc.bs.businessevent.IBusinessEvent;
+import nc.bs.businessevent.IBusinessListener;
+import nc.bs.businessevent.bd.BDCommonEvent;
+import nc.bs.ic.general.businessevent.ICGeneralCommonEvent;
+import nc.vo.ic.m4455.entity.SapplyBillVO;
+import nc.vo.pub.BusinessException;
+
+
+/**
+ * 놔욋�헝데谿꼍堂롤왠
+ * 
+ * @author Administrator
+ *
+ */
+
+public class SapplySaveAfterToYFK implements IBusinessListener{
+
+	//쌈왯
+    final String  url="/iuap-api-gateway/yonbip/qyjx/yonbip-fi-sepmbcdc/execdata/openQueryData";
+	
+	@Override
+	public void doAction(IBusinessEvent arg0) throws BusinessException {
+		
+		
+/*		SapplyBillVO[] sapplybillvo=null;
+		//錦맣
+		if(arg0 instanceof BdUpdateEvent){
+			
+			sapplybillvo=(SapplyBillVO[]) ((BdUpdateEvent) arg0).getNewObject();
+			
+		}else if(arg0 instanceof BusinessEvent){
+			
+			sapplybillvo=(SapplyBillVO[]) ((BusinessEvent) arg0).getObject();
+			
+		}else if (arg0 instanceof ICGeneralCommonEvent){
+			//瓊슥
+			sapplybillvo=(SapplyBillVO[]) ((ICGeneralCommonEvent) arg0).getOldObjs();
+			
+		}*/
+		
+		
+	  try {
+			SapplyBillVO[] sapplybillvo=(SapplyBillVO[]) ((ICGeneralCommonEvent) arg0).getOldObjs();
+			AppController controller=new AppController();
+			String token=controller.getToken();
+			String headurl= controller.getPer().get("openApiUrl");
+			StringBuffer sb1=new StringBuffer();
+			sb1.append(headurl);
+			sb1.append(url);
+			sb1.append("?access_token="+token); 
+		//	 String reqJson=HttpUtils.urlPost(sb1.toString(), JSON.toJSONString(json));
+		//     JSONObject reqstr=(JSONObject)JSON.parse(reqJson);
+		  
+	   }catch (Exception e1) {
+		   // TODO Auto-generated catch block
+	 	   throw new BusinessException(e1.toString());
+	 }
+	
+	
+		
+	}
+
+	
+}

+ 52 - 0
gy/gy/src/public/nc/dz/json/Data.java

@@ -0,0 +1,52 @@
+package nc.dz.json;
+
+import java.util.List;
+
+public class Data {
+    private List<Entry> entry;
+    private String bi1INo;
+    private String smanager;
+    private String proNo;
+    private String pickDate;
+
+    // Getters and Setters
+    public List<Entry> getEntry() {
+        return entry;
+    }
+
+    public void setEntry(List<Entry> entry) {
+        this.entry = entry;
+    }
+
+    public String getBi1INo() {
+        return bi1INo;
+    }
+
+    public void setBi1INo(String bi1INo) {
+        this.bi1INo = bi1INo;
+    }
+
+    public String getSmanager() {
+        return smanager;
+    }
+
+    public void setSmanager(String smanager) {
+        this.smanager = smanager;
+    }
+
+    public String getProNo() {
+        return proNo;
+    }
+
+    public void setProNo(String proNo) {
+        this.proNo = proNo;
+    }
+
+    public String getPickDate() {
+        return pickDate;
+    }
+
+    public void setPickDate(String pickDate) {
+        this.pickDate = pickDate;
+    }
+}

+ 72 - 0
gy/gy/src/public/nc/dz/json/Entry.java

@@ -0,0 +1,72 @@
+package nc.dz.json;
+
+public class Entry {
+
+
+    private String quistDate;
+    private String guistOty;
+    private String matModel;
+    private String qty;
+    private String sourceBi11;
+    private String matName;
+    private String matNum;
+
+    // Getters and Setters
+    public String getQuistDate() {
+        return quistDate;
+    }
+
+    public void setQuistDate(String quistDate) {
+        this.quistDate = quistDate;
+    }
+
+    public String getGuistOty() {
+        return guistOty;
+    }
+
+    public void setGuistOty(String guistOty) {
+        this.guistOty = guistOty;
+    }
+
+    public String getMatModel() {
+        return matModel;
+    }
+
+    public void setMatModel(String matModel) {
+        this.matModel = matModel;
+    }
+
+    public String getQty() {
+        return qty;
+    }
+
+    public void setQty(String qty) {
+        this.qty = qty;
+    }
+
+    public String getSourceBi11() {
+        return sourceBi11;
+    }
+
+    public void setSourceBi11(String sourceBi11) {
+        this.sourceBi11 = sourceBi11;
+    }
+
+    public String getMatName() {
+        return matName;
+    }
+
+    public void setMatName(String matName) {
+        this.matName = matName;
+    }
+
+    public String getMatNum() {
+        return matNum;
+    }
+
+    public void setMatNum(String matNum) {
+        this.matNum = matNum;
+    }
+
+	
+}

+ 21 - 0
gy/gy/src/public/nc/dz/json/Result.java

@@ -0,0 +1,21 @@
+package nc.dz.json;
+
+import java.util.List;
+
+
+public class Result {
+	
+
+    private List<Data> data;
+
+    // Getters and Setters
+    public List<Data> getData() {
+        return data;
+    }
+
+    public void setData(List<Data> data) {
+        this.data = data;
+    }
+
+
+}

+ 55 - 0
gy/gy/src/public/nc/dz/json/Root.java

@@ -0,0 +1,55 @@
+package nc.dz.json;
+
+
+public class Root {
+    private String message;
+    private Result result;
+    private String error;
+    private String status;
+
+
+    // Getters and Setters
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public Result getResult() {
+        return result;
+    }
+
+    public void setResult(Result result) {
+        this.result = result;
+    }
+
+    public String getError() {
+        return error;
+    }
+
+    public void setError(String error) {
+        this.error = error;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+
+
+    // 构造函数,用于初始化currentTimeMillis以外的字段
+    public Root(String message, Result result, String error, String status) {
+        this.message = message;
+        this.result = result;
+        this.error = error;
+        this.status = status;
+    }
+
+
+}

+ 149 - 0
gy/gy/src/public/nc/gy/log/NcLog.java

@@ -0,0 +1,149 @@
+package nc.gy.log;
+
+import nc.bs.framework.common.RuntimeEnv;
+import org.apache.log4j.Logger;
+
+import java.io.IOException;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+/**
+ * nclog
+ * @author YY
+ * @datetime 2021-9-29 
+ */
+public class NcLog
+{
+  private static final Logger logger = Logger.getLogger(NcLog.class);
+  private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+  private static SimpleDateFormat format$ = new SimpleDateFormat("yyyy-MM-dd");
+
+  
+  
+  public static void initUI(String str){
+	  info(str);
+  }
+  
+  public static void initUI(String str,String logname){
+	  info2(str,logname);
+  }
+  
+  
+  public static void info2(String str,String logname)
+  {
+    String logFilePath = getLogFile(logname);
+    File file = new File(logFilePath);
+    BufferedWriter fos = null;
+    try
+    {
+      fos = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
+      str = format.format(new Date()) + " " + str + "\r\n";
+      
+      fos.write(str + "\r\n");
+      fos.flush();
+    }
+    catch (Exception localException)
+    {
+      if (fos != null)
+        try
+        {
+          fos.close();
+        }
+        catch (IOException localIOException)
+        {
+        }
+    }
+    finally {
+      if (fos != null)
+        try
+        {
+          fos.close();
+        }
+        catch (IOException localIOException2)
+        {
+        }
+    }
+  }
+  
+  
+  public static void info(String str)
+  {
+    String logFilePath = getLogFile();
+    File file = new File(logFilePath);
+    BufferedWriter fos = null;
+    try
+    {
+      fos = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
+      str = format.format(new Date()) + " " + str + "\r\n";
+      
+      fos.write(str + "\r\n");
+      fos.flush();
+    }
+    catch (Exception localException)
+    {
+      if (fos != null)
+        try
+        {
+          fos.close();
+        }
+        catch (IOException localIOException)
+        {
+        }
+    }
+    finally {
+      if (fos != null)
+        try
+        {
+          fos.close();
+        }
+        catch (IOException localIOException2)
+        {
+        }
+    }
+  }
+  
+  private static String getLogFile() {
+	    String destFileFolder = RuntimeEnv.getInstance().getNCHome() + File.separator + "mancLog" + File.separator + format$.format(new Date());
+	    String destFilePath = destFileFolder + File.separator + "org.log";
+	    File destFolder = new File(destFileFolder);
+	    if (!destFolder.exists()) {
+	      destFolder.mkdirs();
+	    }
+	    File destFile = new File(destFilePath);
+	    if (!destFile.exists()) {
+	      try
+	      {
+	        destFile.createNewFile();
+	      }
+	      catch (Exception e)
+	      {
+	        logger.info(e);
+	      }
+	    }
+	    return destFilePath;
+	  }
+
+  private static String getLogFile(String logname) {
+    String destFileFolder = RuntimeEnv.getInstance().getNCHome() + File.separator + "dzgyLog" + File.separator + format$.format(new Date());
+    String destFilePath = destFileFolder + File.separator + logname + ".log" ;
+    File destFolder = new File(destFileFolder);
+    if (!destFolder.exists()) {
+      destFolder.mkdirs();
+    }
+    File destFile = new File(destFilePath);
+    if (!destFile.exists()) {
+      try
+      {
+        destFile.createNewFile();
+      }
+      catch (Exception e)
+      {
+        logger.info(e);
+      }
+    }
+    return destFilePath;
+  }
+}

+ 60 - 0
gy/gy/src/test/nc/json/com/JsonExample.java

@@ -0,0 +1,60 @@
+package nc.json.com;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class JsonExample {
+
+	public static void main(String[] args) throws JSONException {
+		// 创建最外层的JSONObject
+        JSONObject root = new JSONObject();
+ 
+        // 创建result对象
+        JSONObject result = new JSONObject();
+        // 创建data数组
+        JSONArray data = new JSONArray();
+ 
+        // 创建data数组中的第一个对象
+        JSONObject dataItem = new JSONObject();
+        dataItem.put("proNo", "6");
+        dataItem.put("bi1INo", "46-Cxx-07");
+        dataItem.put("smanager", "6");
+        dataItem.put("pickDate", "46-Cxx-07");
+ 
+        // 创建entry数组
+        JSONArray entryArray = new JSONArray();
+        // 创建entry数组中的第一个对象
+        JSONObject entryItem = new JSONObject();
+        entryItem.put("matNum", "1");
+        entryItem.put("matName", "");
+        entryItem.put("matModel", "");
+        entryItem.put("qty", "");
+        entryItem.put("guistOty", "");
+        entryItem.put("quistDate", "");
+        entryItem.put("sourceBi11", "");
+ 
+        // 将entryItem添加到entryArray
+        entryArray.put(entryItem);
+ 
+        // 将entryArray添加到dataItem
+        dataItem.put("entry", entryArray);
+ 
+        // 将dataItem添加到data数组
+        data.put(dataItem);
+ 
+        // 将data数组添加到result对象
+        result.put("data", data);
+ 
+        // 将result对象添加到root对象
+        root.put("result", result);
+ 
+        // 添加其他字段到root对象
+        root.put("status", "成功");
+        root.put("error", "");
+        root.put("message", "");
+ 
+        // 打印生成的JSON字符串
+        System.out.println(root.toString(4)); // 使用缩进格式打印,4表示每个级别的缩进空格数
+    }
+}
+

+ 236 - 0
gy/gy/src/test/nc/json/com/JsonGeneratorExample.java

@@ -0,0 +1,236 @@
+package nc.json.com;
+
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+public class JsonGeneratorExample {
+	
+	 static class Entry {
+	        private String quistDate;
+	        private int guistOty;
+	        private String matModel;
+	        private String qty;
+	        private String sourceBi11;
+	        private String matName;
+	        private String matNum;
+
+	        // Getters and Setters
+	        public String getQuistDate() {
+	            return quistDate;
+	        }
+
+	        public void setQuistDate(String quistDate) {
+	            this.quistDate = quistDate;
+	        }
+
+	        public int getGuistOty() {
+	            return guistOty;
+	        }
+
+	        public void setGuistOty(int guistOty) {
+	            this.guistOty = guistOty;
+	        }
+
+	        public String getMatModel() {
+	            return matModel;
+	        }
+
+	        public void setMatModel(String matModel) {
+	            this.matModel = matModel;
+	        }
+
+	        public String getQty() {
+	            return qty;
+	        }
+
+	        public void setQty(String qty) {
+	            this.qty = qty;
+	        }
+
+	        public String getSourceBi11() {
+	            return sourceBi11;
+	        }
+
+	        public void setSourceBi11(String sourceBi11) {
+	            this.sourceBi11 = sourceBi11;
+	        }
+
+	        public String getMatName() {
+	            return matName;
+	        }
+
+	        public void setMatName(String matName) {
+	            this.matName = matName;
+	        }
+
+	        public String getMatNum() {
+	            return matNum;
+	        }
+
+	        public void setMatNum(String matNum) {
+	            this.matNum = matNum;
+	        }
+	    }
+
+	    static class Data {
+	        private List<Entry> entry;
+	        private String bi1INo;
+	        private String smanager;
+	        private String proNo;
+	        private String pickDate;
+
+	        // Getters and Setters
+	        public List<Entry> getEntry() {
+	            return entry;
+	        }
+
+	        public void setEntry(List<Entry> entry) {
+	            this.entry = entry;
+	        }
+
+	        public String getBi1INo() {
+	            return bi1INo;
+	        }
+
+	        public void setBi1INo(String bi1INo) {
+	            this.bi1INo = bi1INo;
+	        }
+
+	        public String getSmanager() {
+	            return smanager;
+	        }
+
+	        public void setSmanager(String smanager) {
+	            this.smanager = smanager;
+	        }
+
+	        public String getProNo() {
+	            return proNo;
+	        }
+
+	        public void setProNo(String proNo) {
+	            this.proNo = proNo;
+	        }
+
+	        public String getPickDate() {
+	            return pickDate;
+	        }
+
+	        public void setPickDate(String pickDate) {
+	            this.pickDate = pickDate;
+	        }
+	    }
+
+	    static class Result {
+	        private List<Data> data;
+
+	        // Getters and Setters
+	        public List<Data> getData() {
+	            return data;
+	        }
+
+	        public void setData(List<Data> data) {
+	            this.data = data;
+	        }
+	    }
+
+	    static class Root {
+	        private String message;
+	        private Result result;
+	        private String error;
+	        private String status;
+
+	        // 使用ToStringSerializer来格式化日期为字符串
+	        @JsonSerialize(using = ToStringSerializer.class)
+	        private long currentTimeMillis;
+
+	        // Getters and Setters
+	        public String getMessage() {
+	            return message;
+	        }
+
+	        public void setMessage(String message) {
+	            this.message = message;
+	        }
+
+	        public Result getResult() {
+	            return result;
+	        }
+
+	        public void setResult(Result result) {
+	            this.result = result;
+	        }
+
+	        public String getError() {
+	            return error;
+	        }
+
+	        public void setError(String error) {
+	            this.error = error;
+	        }
+
+	        public String getStatus() {
+	            return status;
+	        }
+
+	        public void setStatus(String status) {
+	            this.status = status;
+	        }
+
+	        public long getCurrentTimeMillis() {
+	            return System.currentTimeMillis(); // 这是一个示例字段,实际使用中你可能不需要它
+	        }
+
+	        // 构造函数,用于初始化currentTimeMillis以外的字段
+	        public Root(String message, Result result, String error, String status) {
+	            this.message = message;
+	            this.result = result;
+	            this.error = error;
+	            this.status = status;
+	        }
+	    }
+
+	    public static void main(String[] args) throws IOException {
+	        Entry entry = new Entry();
+	        entry.setQuistDate("2025-01-10 07:47:01");
+	        entry.setGuistOty(30);
+	        entry.setMatModel("48.3*4");
+	        entry.setQty("30");
+	        entry.setSourceBi11("SA202501101109");
+	        entry.setMatName("镀锌无缝管");
+	        entry.setMatNum("011702006003");
+
+	        List<Entry> entryList = Arrays.asList(entry);
+
+	        Data data = new Data();
+	        data.setEntry(entryList);
+	        data.setBi1INo("SA202501101109");
+	        data.setSmanager("1001B2100000000CI89S");
+	        data.setProNo("FXJ2024097-1");
+	        data.setPickDate("2025-01-10 07:47:01");
+
+	        List<Data> dataList = Arrays.asList(data, data); // 重复添加以匹配示例数据
+
+	        Result result = new Result();
+	        result.setData(dataList);
+
+	        Root root = new Root("", result, "", "成功");
+
+	        ObjectMapper objectMapper = new ObjectMapper();
+	        String jsonString = objectMapper.writeValueAsString(root);
+
+	        // 由于我们不需要currentTimeMillis字段,所以从JSON字符串中移除它(如果需要的话)
+	        // 这里我们直接输出整个JSON字符串,因为currentTimeMillis字段在构造函数中未被使用
+	        System.out.println(jsonString);
+	    }
+	}

+ 21 - 0
gy/gy/src/test/nc/json/com/JsonParseExample_TWO.java

@@ -0,0 +1,21 @@
+package nc.json.com;
+import org.json.JSONException;
+import org.json.JSONObject;
+public class JsonParseExample_TWO {
+
+	public static void main(String[] args) throws JSONException {
+		 // 假设这是你的JSON字符串
+        String jsonString = "{\"pickDate\": \"\", \"proNo\": \"\"}";
+ 
+        // 创建一个JSONObject来解析JSON字符串
+        JSONObject jsonObject = new JSONObject(jsonString);
+ 
+        // 获取JSON对象中的值
+        String pickDate = jsonObject.getString("pickDate");
+        String proNo = jsonObject.getString("proNo");
+ 
+        // 打印获取到的值
+        System.out.println("pickDate: " + pickDate);
+        System.out.println("proNo: " + proNo);
+    }
+}