zthwr 1 anno fa
parent
commit
2fd47505b4

+ 20 - 6
ic/ic/src/private/nc/bs/ic/impl/IntoBillStatusImpl.java

@@ -12,16 +12,22 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import nc.bcmanage.bs.IBusiCenterManageService;
+import nc.bcmanage.vo.BusiCenterVO;
 import nc.bs.dao.DAOException;
 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.sm.login.AccountXMLUtil;
+import nc.bs.uap.sf.excp.SystemFrameworkException;
+import nc.desktop.ui.WorkbenchEnvironment;
 import nc.itf.uap.IUAPQueryBS;
 import nc.jdbc.framework.processor.ColumnProcessor;
 import nc.jdbc.framework.processor.MapListProcessor;
 import nc.log.NcLog;
+import nc.pub.util.DataSourceUtil;
 import nc.vo.pub.BusinessException;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
@@ -52,9 +58,15 @@ public class IntoBillStatusImpl extends BaseServlet implements IHttpServletAdapt
 	public void doAction(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
 			
 	   NcLog.initUI("查询NC单据状态开始","status");
+      // 获取数据源
+//       String oldDataSourceName = InvocationInfoProxy.getInstance()
+//       		.getUserDataSource();
+//       NcLog.initUI("数据源oldDataSourceName:"+oldDataSourceName,"status");
+      
 	   List<JSONObject> pljf = new ArrayList<JSONObject>();
 	   NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
        try {
+    	    DataSourceUtil.setDataSource();
 			String createStr = buildJson(req, resp, this.getClass().getName());
 			JSONObject json = JSONObject.fromObject(createStr);
 			PrintWriter out = resp.getWriter();
@@ -65,6 +77,9 @@ public class IntoBillStatusImpl extends BaseServlet implements IHttpServletAdapt
 //			InvocationInfoProxy.getInstance().setUserId(SqlexecuteQuery("cuserid", "sm_user", "user_code", json.getString("creator")));
 //			out.print(formatRSJsonData("成功","",tddtp)); 
 			
+			
+			
+			
 			out.print(pljf); 
 				
 		  } catch (Exception e) {
@@ -203,7 +218,7 @@ public class IntoBillStatusImpl extends BaseServlet implements IHttpServletAdapt
 				}else{
 					uds ="update "+tablename+" set vdef20='7' " + " where "+pkname+"='"+pkid+"'";
 				}
-//				getIuap().executeQuery(uds, null);
+				getIuap().executeQuery(uds, null);
 			} catch (Exception e2) {
 			}
 			if(billType==false){
@@ -280,9 +295,9 @@ public class IntoBillStatusImpl extends BaseServlet implements IHttpServletAdapt
 			}
 			//状态回传后设值为2
 			try {
-				String uds ="update "+tablename+" set vdef20='2' " +
+				String uds ="update "+tablename+" set vdef20='7' " +
 						" where vdef19='"+id+"'";
-//				getIuap().executeQuery(uds, null);
+				getIuap().executeQuery(uds, null);
 			} catch (Exception e2) {
 			}
 			jsonObj.put("status","4");
@@ -374,9 +389,8 @@ public class IntoBillStatusImpl extends BaseServlet implements IHttpServletAdapt
 			e.printStackTrace();
 			return e.getMessage();
 		}
-	}
-
-}
+	 }	
+  }
 
 
 

+ 47 - 0
ic/ic/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.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;
+	  }
+
+}