|  | @@ -3,6 +3,7 @@ package nc.bs.xh.impl;
 | 
	
		
			
				|  |  |  import java.io.IOException;
 | 
	
		
			
				|  |  |  import java.io.PrintWriter;
 | 
	
		
			
				|  |  |  import java.io.StringWriter;
 | 
	
		
			
				|  |  | +import java.util.HashMap;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.servlet.ServletException;
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletRequest;
 | 
	
	
		
			
				|  | @@ -14,12 +15,12 @@ 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.scmpub.pf.PfParameterUtil;
 | 
	
		
			
				|  |  |  import nc.bs.servlet.service.BaseServlet;
 | 
	
		
			
				|  |  |  import nc.itf.ic.m4n.ITransformMaitain;
 | 
	
		
			
				|  |  |  import nc.itf.pu.m21.IOrderMaintain;
 | 
	
		
			
				|  |  |  import nc.itf.uap.IUAPQueryBS;
 | 
	
		
			
				|  |  |  import nc.itf.uap.pf.IPFBusiAction;
 | 
	
		
			
				|  |  | -import nc.itf.xh.m4n.IUtilMaintain;
 | 
	
		
			
				|  |  |  import nc.jdbc.framework.processor.ColumnProcessor;
 | 
	
		
			
				|  |  |  import nc.log.NcLog;
 | 
	
		
			
				|  |  |  import nc.vo.ic.m4n.entity.TransformHeadVO;
 | 
	
	
		
			
				|  | @@ -29,6 +30,7 @@ import nc.vo.pub.BusinessException;
 | 
	
		
			
				|  |  |  import nc.vo.pub.lang.UFDate;
 | 
	
		
			
				|  |  |  import nc.vo.pub.lang.UFDateTime;
 | 
	
		
			
				|  |  |  import nc.vo.pub.lang.UFDouble;
 | 
	
		
			
				|  |  | +import nc.vo.util.CloneUtil;
 | 
	
		
			
				|  |  |  import net.sf.json.JSONArray;
 | 
	
		
			
				|  |  |  import net.sf.json.JSONObject;
 | 
	
		
			
				|  |  |  import nc.vo.ic.m4n.entity.TransformBodyVO;
 | 
	
	
		
			
				|  | @@ -43,6 +45,7 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 | 
	
		
			
				|  |  |  		// TODO Auto-generated method stub
 | 
	
		
			
				|  |  |  		InvocationInfoProxy.getInstance().setUserDataSource("nc65");
 | 
	
		
			
				|  |  |  		NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
 | 
	
		
			
				|  |  | +		InvocationInfoProxy.getInstance().setUserDataSource("nc65");
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |  			String createStr = buildJson(req, resp, this.getClass().getName());
 | 
	
		
			
				|  |  |  			JSONObject json = JSONObject.fromObject(createStr);
 | 
	
	
		
			
				|  | @@ -104,20 +107,19 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 | 
	
		
			
				|  |  |  				transformbodyvo.setNassistnum(new UFDouble(bodyObject.getString("nassistnum")));
 | 
	
		
			
				|  |  |  				transformbodyvo.setNcostprice(new UFDouble(bodyObject.getString("ncostprice")));
 | 
	
		
			
				|  |  |  				transformbodyvo.setNcostmny(new UFDouble(bodyObject.getString("ncostmny")));
 | 
	
		
			
				|  |  | -				transformbodyvo.setVbatchcode(bodyObject.getString("vbatchcode"));//批次号
 | 
	
		
			
				|  |  | -				transformbodyvo.setPk_batchcode(QueryBatchCode(transformbodyvo.getCmaterialoid(),transformbodyvo.getVbatchcode()));//批次主键
 | 
	
		
			
				|  |  | +				transformbodyvo.setVbatchcode(bodyObject.getString("vbatchcode"));
 | 
	
		
			
				|  |  |  				transformbodyvos[i] = transformbodyvo;
 | 
	
		
			
				|  |  |  				i++;
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  			transformvo.setChildrenVO(transformbodyvos);
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  | -//			ITransformMaitain itransform=(ITransformMaitain)NCLocator.getInstance().lookup(ITransformMaitain.class);
 | 
	
		
			
				|  |  | -//			itransform.insert(transformvos);
 | 
	
		
			
				|  |  | -//			IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
 | 
	
		
			
				|  |  | -//			service.processAction("APPROVE",
 | 
	
		
			
				|  |  | -//	                "4N", null, transformvos[0], null, null);
 | 
	
		
			
				|  |  | -			IUtilMaintain iUtilMaintain = NCLocator.getInstance().lookup(IUtilMaintain.class);
 | 
	
		
			
				|  |  | -			iUtilMaintain.ZK_RequiresNew(transformvo);
 | 
	
		
			
				|  |  | +			ITransformMaitain itransform=(ITransformMaitain)NCLocator.getInstance().lookup(ITransformMaitain.class);
 | 
	
		
			
				|  |  | +			itransform.insert(transformvos);
 | 
	
		
			
				|  |  | +			IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
 | 
	
		
			
				|  |  | +			HashMap<String, Object> pfparam = new HashMap<String, Object>(); // 该参数用于控制自动审批时按钮的审批状态 
 | 
	
		
			
				|  |  | +			pfparam.put(PfParameterUtil.ORIGIN_VO_PARAMETER, CloneUtil.deepClone(transformvos[0]));
 | 
	
		
			
				|  |  | +			service.processAction("APPROVE",
 | 
	
		
			
				|  |  | +	                "4N", null, transformvos[0], null, pfparam);
 | 
	
		
			
				|  |  |  			out.print(formatRSJsonData("成功","",vbillcode)); 
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  |  		} catch (Exception e) {
 | 
	
	
		
			
				|  | @@ -195,44 +197,45 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 | 
	
		
			
				|  |  |  	/*
 | 
	
		
			
				|  |  |  	 * 数据库查询
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  | -	private String SqlexecuteQuery(String out,String table,String key,String value) throws Exception {
 | 
	
		
			
				|  |  | +	private String SqlexecuteQuery(String out,String table,String key,String value) throws DAOException {
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		String sql = "select "+out+" from "+table+" where "+key+" = '"+value+"' and nvl(dr,0)=0";
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		Object object;
 | 
	
		
			
				|  |  | +		try {
 | 
	
		
			
				|  |  |  			object = iuap.executeQuery(sql, new ColumnProcessor());
 | 
	
		
			
				|  |  |  			if (object==null) {
 | 
	
		
			
				|  |  |  				throw new DAOException("未查询到数据!请检查编码"+value+"是否正确!");
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  |  			return object.toString();
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	public String QueryBatchCode(String cmaterialoid,String vbillcode) throws Exception {
 | 
	
		
			
				|  |  | -		String sql = "select pk_batchcode from scm_batchcode where cmaterialoid = '"+cmaterialoid+"' and vbatchcode = '"+vbillcode+"' and dr=0";
 | 
	
		
			
				|  |  | -		Object object;
 | 
	
		
			
				|  |  | -		object = iuap.executeQuery(sql, new ColumnProcessor());
 | 
	
		
			
				|  |  | -		if (object==null) {
 | 
	
		
			
				|  |  | -			return null;
 | 
	
		
			
				|  |  | -		}else {
 | 
	
		
			
				|  |  | -			return object.toString();
 | 
	
		
			
				|  |  | +		} catch (BusinessException e) {
 | 
	
		
			
				|  |  | +			// TODO Auto-generated catch block
 | 
	
		
			
				|  |  | +			e.printStackTrace();
 | 
	
		
			
				|  |  | +			return e.getMessage();
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	/*
 | 
	
		
			
				|  |  |  	 * 查询转换类型pk
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  | -	private String QueryTrantype(String code,String group) throws Exception {
 | 
	
		
			
				|  |  | +	private String QueryTrantype(String code,String group) throws DAOException {
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		String sql = "select pk_billtypeid from bd_billtype where pk_billtypecode = '"+code+"' and pk_group = '"+group+"' and nvl(dr,0)=0";
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		Object object;
 | 
	
		
			
				|  |  | +		try {
 | 
	
		
			
				|  |  |  			object = iuap.executeQuery(sql, new ColumnProcessor());
 | 
	
		
			
				|  |  |  			if (object==null) {
 | 
	
		
			
				|  |  |  				throw new DAOException("未查询到数据!请检查编码"+code+"是否正确!");
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  			
 | 
	
		
			
				|  |  |  			return object.toString();
 | 
	
		
			
				|  |  | +		} catch (BusinessException e) {
 | 
	
		
			
				|  |  | +			// TODO Auto-generated catch block
 | 
	
		
			
				|  |  | +			e.printStackTrace();
 | 
	
		
			
				|  |  | +			return e.getMessage();
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 |