NC63 后端通过单据执行动作 修改单据详细解读

Posted 廿二又

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NC63 后端通过单据执行动作 修改单据详细解读相关的知识,希望对你有一定的参考价值。

nc二次开发作为国内软件的短板 在此补充 给其他正在挠头的小伙伴

此次单据修改开发入坑一周 终于出坑

 单据执行动作

Object processAction_update = iIplatFormEntry_a.processAction("WRITE", ic_transOutHVO.getVtrantypecode(), null, transOutVO_a,null, null);
                    

一般修改的时候需要把vo的状态 status 设置为1

注意  单据类型 




public String out(String operation,String orderform)
		///4Y
		JSONObject resultJson=new JSONObject();
		
		JSONObject paramJson = JSON.parseObject(orderform);
		String vbillcode = paramJson.getString("vbillcode");//出库单好
		try 
			
			BaseDAO bd = new BaseDAO();
			nc.vo.ic.m4y.entity.TransOutHeadVO ic_transOutHVO = new nc.vo.ic.m4y.entity.TransOutHeadVO();
			//
			ic_transOutHVO = (nc.vo.ic.m4y.entity.TransOutHeadVO) bd.executeQuery("select * from ic_transout_h where dr=0 and vbillcode ='"+vbillcode+"'", new BeanProcessor(nc.vo.ic.m4y.entity.TransOutHeadVO.class));
			if (ic_transOutHVO != null)
				JSONArray bjsonarr = new JSONArray();
				String ic_transout_pk = ic_transOutHVO.getAttributeValue("cgeneralhid").toString();//主键
				//SuperVO[] ic_transOutBVO = HYPubBO_Client.queryByCondition(nc.vo.ic.m4y.entity.TransOutBodyVO.class,  " cgeneralhid = '"+ic_transout_pk+"'");
				List<nc.vo.ic.m4y.entity.TransOutBodyVO> ic_transOutBList = (List<nc.vo.ic.m4y.entity.TransOutBodyVO>) bd.executeQuery("select * from ic_transout_b where dr=0 and  cgeneralhid ='"+ic_transout_pk+"'", new BeanListProcessor(nc.vo.ic.m4y.entity.TransOutBodyVO.class));
				
				
				
				//给交换平台数据准备
				List<nc.vo.ic.m4y.entity.TransOutBodyVO> ic_transOutBList_new = new ArrayList<nc.vo.ic.m4y.entity.TransOutBodyVO>();
				
				JSONArray body = (JSONArray) paramJson.get("body");
				for (int j = 0;j<ic_transOutBList.size();j++) 
					nc.vo.ic.m4y.entity.TransOutBodyVO transOutBodyVO = ic_transOutBList.get(j);
					for (int i = 0;i<body.size();i++)
						JSONObject tmpb = body.getJSONObject(i);
						String crowno = tmpb.getString("crowno") ==null ?"":tmpb.getString("crowno"); // 行号
						if(transOutBodyVO.getCrowno().equals(crowno))
							String nnum  = tmpb.getString("nnum") ==null ?"":tmpb.getString("nnum"); //实发主数量
							
							nc.vo.ic.m4y.entity.TransOutBodyVO transOut_new = new nc.vo.ic.m4y.entity.TransOutBodyVO();
							transOut_new = transOutBodyVO;
							if(StringUtils.isNotBlank(nnum))
								UFDouble d_nnum = new UFDouble(Double.parseDouble(nnum));
								transOut_new.setNnum(d_nnum);
								transOut_new.setNassistnum(d_nnum);
								transOut_new.setStatus(1);
								transOut_new.setDbizdate(new UFDate());
								//transOut_new.setTs(new UFDateTime());
								ic_transOutBList_new.add(transOut_new);
							
						
					

				
				
				
				try 
					IplatFormEntry iIplatFormEntry_a = (IplatFormEntry) NCLocator.getInstance().lookup(IplatFormEntry.class.getName());
					InvocationInfoProxy.getInstance().setGroupId("00013910000000000N4S"); //这个字段很重要
					InvocationInfoProxy.getInstance().setUserId(ic_transOutHVO.getCreator());//用户
					nc.vo.ic.m4y.entity.TransOutBodyVO[] outsvo_a = new nc.vo.ic.m4y.entity.TransOutBodyVO[ic_transOutBList.size()];
					AggregatedValueObject transOutVO_a = new nc.vo.ic.m4y.entity.TransOutVO();
					ic_transOutHVO.setStatus(1);
					transOutVO_a.setParentVO(ic_transOutHVO);
					transOutVO_a.setChildrenVO(ic_transOutBList_new.toArray(outsvo_a));
					
					//调拨出库单  执行动作 ,单据类型 , null ,billvo,null, 环境  , WRITE   PUSHOUTSAVE	推式保存(实收) 4Y-Cxx-002 vtrantypecode 
					Object processAction_update = iIplatFormEntry_a.processAction("WRITE", ic_transOutHVO.getVtrantypecode(), null, transOutVO_a,null, null);
					
					System.out.println(processAction_update);
				 catch (Exception e1) 
					e1.printStackTrace();
					resultJson.put("$successful", "N");
					resultJson.put("sendresult", e1.getMessage());
					return resultJson.toString();
				
				
				
				
				//开始签字
				nc.vo.ic.m4y.entity.TransOutBodyVO[] insvo = new nc.vo.ic.m4y.entity.TransOutBodyVO[ic_transOutBList.size()];
				List<nc.vo.ic.m4y.entity.TransOutBodyVO> ic_transInBList2 = (List<nc.vo.ic.m4y.entity.TransOutBodyVO>) bd.executeQuery("select * from ic_transout_b where dr=0 and cgeneralhid ='"+ic_transout_pk+"'", new BeanListProcessor(nc.vo.ic.m4y.entity.TransOutBodyVO.class));

				IplatFormEntry iIplatFormEntry = (IplatFormEntry) NCLocator.getInstance().lookup(IplatFormEntry.class.getName());
				//这是集团ID 一般每个表都有 随便找 pk_group 字段
				InvocationInfoProxy.getInstance().setGroupId("00013910000000000N4S"); //这个字段很重要
				AggregatedValueObject transOutVO= new nc.vo.ic.m4y.entity.TransOutVO();
				transOutVO.setParentVO(ic_transOutHVO);
				transOutVO.setChildrenVO(ic_transInBList2.toArray(insvo));
				
				HashMap map = new HashMap();
				map.put("notechecked", "notechecked");
				//签字动作 ,签字单据类型 , null ,billvo,null, 环境  ,
				Object processAction = iIplatFormEntry.processAction("SIGN", "4Y", null, transOutVO,null, map);
				//head
				resultJson.put("vbillcode",vbillcode);
		
		    	//boyd
				List<nc.vo.ic.m4y.entity.TransOutBodyVO> ic_transinBList = (List<nc.vo.ic.m4y.entity.TransOutBodyVO>) bd.executeQuery("select * from ic_transout_b where dr=0 and  cgeneralhid ='"+ic_transout_pk+"'", new BeanListProcessor(nc.vo.ic.m4y.entity.TransOutBodyVO.class));
				
				for (int i=0;i < ic_transinBList.size();i++)
			    	String crowno = (String) ic_transinBList.get(i).getAttributeValue("crowno") == null?"": ic_transinBList.get(i).getAttributeValue("crowno").toString() ;//行号
			    	
			    	//应收数量
			    	String nshouldassistnum = ic_transinBList.get(i).getAttributeValue("nshouldassistnum") == null?"": String.valueOf((UFDouble) ic_transinBList.get(i).getAttributeValue("nshouldassistnum"));
			    	//实收数量
			    	String nassistnum = ic_transinBList.get(i).getAttributeValue("nassistnum") == null?"": String.valueOf((UFDouble) ic_transinBList.get(i).getAttributeValue("nassistnum"));
			    	//body
			    	JSONObject bjson = new JSONObject();
			    	bjson.put("crowno",crowno);//行号
			    	bjson.put("nshouldassistnum",nshouldassistnum);//应收数量
			    	bjson.put("nassistnum",nassistnum);//实收数量
			    	
			    	bjsonarr.add(bjson);
				
				if(null != ic_transinBList && ic_transinBList.size() > 0 )
					resultJson.put("$successful", "Y");
					resultJson.put("sendresult", bjsonarr);
				else
					resultJson.put("$successful", "N");
					resultJson.put("sendresult", "无调拨出库单");
				
				
				
			

祝你好运

以上是关于NC63 后端通过单据执行动作 修改单据详细解读的主要内容,如果未能解决你的问题,请参考以下文章

NC63 后端通过单据执行动作 修改单据详细解读

NC65修改单据字段名称

NC-UAP客户化开发-数据建模

NC-UAP客户化开发-数据建模

用友UAP NC 单据节点_打开参照字段的问题_从打不开参照放大镜_到成功打开了但是取不到值_到修复成功

NC代码调试 - 持续更新