Bläddra i källkod

自动审批+异币种换算+新增项目接口

zthwr 1 år sedan
förälder
incheckning
a58cb6a5bd

+ 146 - 0
ypff/ct/src/private/nc/bs/ct/saledaily/pfxx/Z3PfxxPlugin.java

@@ -0,0 +1,146 @@
+package nc.bs.ct.saledaily.pfxx;
+
+import nc.bs.ct.pfxx.AbstractCTPfxxPlugin;
+import nc.bs.framework.common.InvocationInfoProxy;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.scmpub.pf.PfParameterUtil;
+import nc.impl.ct.saledaily.action.SaledailyDeleteAction;
+import nc.impl.ct.saledaily.action.SaledailyInsertAction;
+import nc.impl.pubapp.pattern.data.bill.BillQuery;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.pubitf.uapbd.CurrencyRateUtil;
+import nc.vo.ct.saledaily.entity.AggCtSaleVO;
+import nc.vo.ct.saledaily.entity.CtSaleBVO;
+import nc.vo.ct.saledaily.entity.CtSaleVO;
+import nc.vo.pub.AggregatedValueObject;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.scmpub.res.billtype.CTBillType;
+import nc.vo.util.CloneUtil;
+
+import java.util.HashMap;
+
+import org.apache.commons.lang.ArrayUtils;
+
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+import nc.vo.pubapp.pattern.pub.MathTool;
+public class Z3PfxxPlugin extends AbstractCTPfxxPlugin {
+	private AggregatedValueObject save(AggregatedValueObject vo) {
+		AggCtSaleVO aggvo = (AggCtSaleVO) vo;
+		
+		
+		
+		/*异币种换算金额 */
+		
+		 /**
+	     * 根据源币种主键,目的币种主键,查询指定日期的汇率
+	     * 
+	     * @param src_currency_pk
+	     *            源币种主键
+	     * @param dest_currency_pk
+	     *            目的币种的主键,为null时则认为是默认目的币种主键
+	     * @param date
+	     * @return
+	     * @throws BusinessException
+	     */
+		
+		CtSaleVO headvo=aggvo.getParentVO();
+         if( headvo.getNexchangerate().compareTo(UFDouble.ONE_DBL)!=0){
+     		String corigcurrencyid= headvo.getCorigcurrencyid();
+     		String ccurrencyid = headvo.getCcurrencyid();
+     		CurrencyRateUtil currRateUtil = CurrencyRateUtil
+     				.getInstanceByOrg(headvo.getPk_org());
+     		try {
+     			UFDouble foreignrate = currRateUtil.getRate(corigcurrencyid,
+     					ccurrencyid, headvo.getDbilldate());//汇率
+     			
+     			 headvo.setNexchangerate(foreignrate);
+     			
+     			CtSaleBVO[]  bodyvos=aggvo.getCtSaleBVO();
+     			
+     			for(CtSaleBVO bodyvo:bodyvos){
+     				//norigprice 原币无税单价
+     				UFDouble norigprice=bodyvo.getNorigtaxprice();//主原币含税单价
+     				UFDouble foreignAmount=	currRateUtil.getAmountByOpp(corigcurrencyid,
+     						ccurrencyid, norigprice, foreignrate, headvo.getDbilldate());
+     				bodyvo.setNgtaxprice(foreignAmount);//主本币含税单价
+     				
+     				UFDouble ngprice=currRateUtil.getAmountByOpp(corigcurrencyid,
+     						ccurrencyid, bodyvo.getNorigprice()/*主原币无税单价*/, foreignrate, headvo.getDbilldate());
+     				
+     				bodyvo.setNgprice(ngprice); // 主本币无税单价
+     				
+     				bodyvo.setNqtprice(ngprice); //报价本币无税单价
+     				
+     				bodyvo.setNqttaxprice(foreignAmount);//报价本币含税单价
+     				
+     				
+     				UFDouble nmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+     						ccurrencyid, bodyvo.getNorigmny()/*原币无税金额*/, foreignrate, headvo.getDbilldate());
+     				
+     				bodyvo.setNmny(nmny);//本币无税金额  
+     				
+     				UFDouble ntaxmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+     						ccurrencyid, bodyvo.getNorigtaxmny()/*原币价税合计*/, foreignrate, headvo.getDbilldate());
+     				
+     				bodyvo.setNtaxmny(ntaxmny);//ntaxmny 本币价税合计
+     				
+     				bodyvo.setNcaltaxmny(nmny);//计税金额
+     				
+     				
+     				bodyvo.setNtax(ntaxmny.sub(nmny));//税额=价税合计-无税金额
+     			}
+     			
+     		} catch (BusinessException e1) {
+     			 ExceptionUtils.wrappException(e1);
+                  return null;
+     		}
+		}
+		
+		
+		this.processBeforeSave(aggvo, CTBillType.SaleDaily.getCode());
+		AggCtSaleVO[] billvo = (new SaledailyInsertAction()).insert(new AggCtSaleVO[]{aggvo});
+		//2023-05-24 yaoy  销售合同保存即审批,没有审批流
+		
+		try {
+			AggCtSaleVO aggCtSaleVO = (AggCtSaleVO) queryVOByPk(billvo[0].getParent().getAttributeValue("pk_ct_sale").toString());
+			String pk_org = aggCtSaleVO.getParentVO().getPk_org();
+			//0001V510000000002GEH   江门基地				
+			if(pk_org != null && (pk_org.equals("0001V510000000002GDX"))){
+				HashMap<String, Object> pfparam = new HashMap<String, Object>(); // 该参数用于控制自动审批时按钮的审批状态 
+				pfparam.put(PfParameterUtil.ORIGIN_VO_PARAMETER, CloneUtil.deepClone(new AggCtSaleVO[] {aggCtSaleVO})); 
+				CtSaleVO headvoSaleVO=aggCtSaleVO.getParentVO();
+//				headvoSaleVO.setApprover(headvoSaleVO.getBillmaker());
+//				Object[] userObjAry={headvoSaleVO.getBillmaker()};
+//				NCLocator.getInstance().lookup(IPFBusiAction.class) .processBatch("APPROVE", "Z3",new AggCtSaleVO[] {aggCtSaleVO}, userObjAry, null, pfparam);
+////				InvocationInfoProxy.getInstance().setUserCode("JG0009190");
+			    InvocationInfoProxy.getInstance().setUserId(headvoSaleVO.getApprover());
+////			    InvocationInfoProxy.getInstance().setGroupId(headvoSaleVO.getPk_group());
+				//设置单据的审批为参数数ZDR设置的用户
+////				headvoSaleVO.setApprover("1001V510000000C8IGOP");
+				NCLocator.getInstance().lookup(IPFBusiAction.class) .processBatch("APPROVE", "Z3",new AggCtSaleVO[] {aggCtSaleVO}, null, null, pfparam);
+				
+				return aggCtSaleVO;
+			}
+			
+			
+		} catch (BusinessException e) {
+			ExceptionUtils.wrappBusinessException(e.getMessage());
+		}
+		return billvo[0];
+	}
+
+	protected void deleteVO(AggregatedValueObject vo) {
+		(new SaledailyDeleteAction()).delete(new AggCtSaleVO[]{(AggCtSaleVO) vo});
+	}
+
+	protected AggregatedValueObject insert(AggregatedValueObject vo) {
+		return this.save(vo);
+	}
+
+	protected AggregatedValueObject queryVOByPk(String voPk) {
+		BillQuery<AggCtSaleVO> billquery = new BillQuery(AggCtSaleVO.class);
+		AggCtSaleVO[] vos = (AggCtSaleVO[]) billquery.query(new String[]{voPk});
+		return ArrayUtils.isEmpty(vos) ? null : vos[0];
+	}
+}

+ 55 - 0
ypff/pmpub/src/private/nc/bs/pmpub/pfxx/plugin/ProjectPfxxPlugin.java

@@ -0,0 +1,55 @@
+package nc.bs.pmpub.pfxx.plugin;
+
+import nc.bs.framework.common.NCLocator;
+import nc.bs.pfxx.ISwapContext;
+import nc.itf.pmpub.project.pub.IProjectServiceForPu;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.vo.pfxx.auxiliary.AggxsysregisterVO;
+import nc.vo.pmpub.project.ProjectHeadVO;
+import nc.vo.pub.BusinessException;
+
+public class ProjectPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin{
+ /**
+  * 
+  * 新增项目
+  * 
+  */
+	
+	private IProjectServiceForPu iproservice = null;
+	private IUAPQueryBS iuap = null;
+
+    private IProjectServiceForPu getiTeamMaintainService() {
+        if (this.iproservice == null) {
+            this.iproservice = NCLocator.getInstance().lookup(IProjectServiceForPu.class);
+        }
+        return this.iproservice;
+
+    }
+    
+    private IUAPQueryBS getIuap() {
+        if (this.iuap == null) {
+            this.iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);
+        }
+        return this.iuap;
+
+    }
+    
+	@Override
+	protected Object processBill(Object vo, ISwapContext swapContext,
+			AggxsysregisterVO aggvo) throws BusinessException {
+		if (vo == null)
+  	      throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
+  	          .getStrByID("4008001_0", "04008001-0137")/*@res "转换后的vo数据为空"*/);
+		ProjectHeadVO headvo=(ProjectHeadVO)vo;
+		//EPS节点 翻译
+		String sql="select pk_eps  from pm_eps where eps_code='" + headvo.getPk_eps() + "' and enablestate='2' and isnull(dr,0)=0 ";
+		Object objpk_eps=getIuap().executeQuery(sql, new ColumnProcessor("pk_eps"));
+		headvo.setPk_eps(objpk_eps==null?"":objpk_eps.toString());
+		ProjectHeadVO saveheadvo=getiTeamMaintainService().insertProject(headvo);
+		String vopk = saveheadvo.getPrimaryKey();
+		
+		return vopk;
+	}
+                
+}

+ 223 - 0
ypff/so/src/private/nc/pubimpl/so/m30/pfxx/M30PfxxPlugin.java

@@ -0,0 +1,223 @@
+package nc.pubimpl.so.m30.pfxx;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import nc.bs.framework.common.InvocationInfoProxy;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.pub.taskmanager.SynTaskTree;
+import nc.impl.pubapp.pattern.data.bill.BillQuery;
+import nc.impl.pubapp.pattern.data.bill.tool.BillConcurrentTool;
+import nc.impl.pubapp.pattern.rule.IRule;
+import nc.impl.so.m30.action.main.InsertSaleOrderAction;
+import nc.impl.so.m30.action.main.UpdateSaleOrderAction;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.pubimpl.so.pfxx.AbstractSOPfxxPlugin;
+import nc.pubimpl.so.pfxx.check.BillFreeStatusCheckRule;
+import nc.pubimpl.so.pfxx.check.MnyTaxCheckRule;
+import nc.pubimpl.so.pfxx.check.WriteBackInfoCheckRule;
+import nc.pubitf.uapbd.CurrencyRateUtil;
+import nc.vo.pub.AggregatedValueObject;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.pub.pf.workflow.IPFActionName;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+import nc.vo.so.m30.entity.SaleOrderBVO;
+import nc.vo.so.m30.entity.SaleOrderHVO;
+import nc.vo.so.m30.entity.SaleOrderVO;
+import nc.vo.wfengine.pub.WFTask;
+
+public class M30PfxxPlugin extends AbstractSOPfxxPlugin {
+
+  @Override
+  public List<IRule<AggregatedValueObject>> getCheckers() {
+    List<IRule<AggregatedValueObject>> rules =
+        new ArrayList<IRule<AggregatedValueObject>>();
+    // 单据状态检查,非自由态不可以导入
+    rules.add(new BillFreeStatusCheckRule());
+    // 价税合计=无税金额+税额(本币)
+//    rules.add(new MnyTaxCheckRule(SaleOrderBVO.NTAX, SaleOrderBVO.NMNY,
+//        SaleOrderBVO.NTAXMNY));
+    // 累计数量字段
+    rules.add(new WriteBackInfoCheckRule(new String[] {
+      SaleOrderBVO.NTOTALSENDNUM,// 累计发货主数量
+      SaleOrderBVO.NTOTALINVOICENUM,// 累计开票主数量
+      SaleOrderBVO.NTOTALOUTNUM,// 累计出库主数量
+      SaleOrderBVO.NTOTALNOTOUTNUM,// 累计应发未出库主数量
+      SaleOrderBVO.NTOTALSIGNNUM,// 累计签收主数量
+      SaleOrderBVO.NTRANSLOSSNUM,// 累计途损主数量
+      SaleOrderBVO.NTOTALRUSHNUM,// 累计出库对冲主数量
+      SaleOrderBVO.NTOTALESTARNUM,// 累计暂估应收主数量
+      SaleOrderBVO.NTOTALARNUM,// 累计确认应收主数量
+      SaleOrderBVO.NTOTALCOSTNUM,// 累计成本结算主数量
+      SaleOrderBVO.NTOTALESTARMNY,// 累计暂估应收金额
+      SaleOrderBVO.NTOTALARMNY,// 累计确认应收金额
+      SaleOrderBVO.NTOTALPAYMNY,// 累计收款核销金额
+      SaleOrderBVO.NORIGSUBMNY,// 累计冲抵金额
+      SaleOrderBVO.NARRANGESCORNUM,// 累计安排委外订单主数量
+      SaleOrderBVO.NARRANGEPOAPPNUM,// 累计安排请购单主数量
+      SaleOrderBVO.NARRANGETOORNUM,// 累计安排调拨订单主数量
+      SaleOrderBVO.NARRANGETOAPPNUM,// 累计安排调拨申请主数量
+      SaleOrderBVO.NARRANGEMONUM,// 累计安排生产订单主数量
+      SaleOrderBVO.NARRANGEPONUM,// 累计安排采购订单主数量
+      SaleOrderBVO.NTOTALPLONUM,// 累计生成计划订单主数量
+      SaleOrderBVO.NTOTALRETURNNUM,// 累计退货主数量
+      SaleOrderBVO.NTOTALTRADENUM
+    // 累计发出商品主数量
+        }));
+    return rules;
+  }
+
+  @Override
+  protected AggregatedValueObject insert(AggregatedValueObject vo) {
+
+    SaleOrderVO[] insertvo = new SaleOrderVO[] {
+      (SaleOrderVO) vo
+    };
+
+	/*异币种换算金额 */
+	
+	 /**
+     * 根据源币种主键,目的币种主键,查询指定日期的汇率
+     * 
+     * @param src_currency_pk
+     *            源币种主键
+     * @param dest_currency_pk
+     *            目的币种的主键,为null时则认为是默认目的币种主键
+     * @param date
+     * @return
+     * @throws BusinessException
+     */
+	
+
+    SaleOrderHVO headvo=(SaleOrderHVO) vo.getParentVO();
+ //    if( headvo.getNexchangerate().compareTo(UFDouble.ONE_DBL)!=0){
+ 		String corigcurrencyid= headvo.getCorigcurrencyid();
+ 		CurrencyRateUtil currRateUtil = CurrencyRateUtil
+ 				.getInstanceByOrg(headvo.getPk_org());
+ 		try {
+ 			SaleOrderBVO[]  bodyvos= (SaleOrderBVO[]) vo.getChildrenVO();
+ 			for(SaleOrderBVO bodyvo:bodyvos){
+ 				String ccurrencyid= bodyvo.getCcurrencyid();
+ 				
+ 				if(corigcurrencyid.equals(ccurrencyid)){
+ 					UFDouble nqtorigtaxprice = bodyvo.getNqtorigtaxprice();//含税单价
+ 					UFDouble nqtorigprice = bodyvo.getNqtorigprice();//无税单价
+ 					UFDouble norigmny = bodyvo.getNorigmny();//无税金额
+ 					UFDouble norigtaxmny = bodyvo.getNorigtaxmny();//价税合计
+ 					bodyvo.setNcaltaxmny(norigtaxmny);//计税金额
+ 					bodyvo.setNqttaxprice(nqtorigtaxprice);//本币含税单价
+ 					bodyvo.setNqtprice(nqtorigprice);//本币无税单价
+ 					bodyvo.setNqttaxnetprice(nqtorigtaxprice);//本币含税净价
+ 					bodyvo.setNqtnetprice(nqtorigprice);//本币无税净价
+ 					bodyvo.setNtaxprice(nqtorigtaxprice);//主本币含税单价
+ 					bodyvo.setNpiece(nqtorigprice);//主本币无税单价
+ 					bodyvo.setNtaxnetprice(nqtorigtaxprice);//主本币含税净价
+ 					bodyvo.setNnetprice(nqtorigprice);//主本币无税净价
+ 					bodyvo.setNmny(norigmny);//本币无税金额
+ 					bodyvo.setNtaxmny(norigtaxmny);//本币价税合计
+ 					
+ 					continue;
+ 				}
+ 				
+ 				
+ 				UFDouble foreignrate = currRateUtil.getRate(corigcurrencyid,/*原币*/
+ 	 					ccurrencyid/*本币*/, headvo.getDbilldate());//汇率
+ 				bodyvo.setNexchangerate(foreignrate);
+ 				//norigprice 原币无税单价
+ 				UFDouble norigprice=bodyvo.getNorigtaxprice();//主原币含税单价
+ 				UFDouble foreignAmount=	currRateUtil.getAmountByOpp(corigcurrencyid,
+ 						ccurrencyid, norigprice, foreignrate, headvo.getDbilldate());
+ 				bodyvo.setNtaxprice(foreignAmount);//主本币含税单价
+ 				
+ 				UFDouble ngprice=currRateUtil.getAmountByOpp(corigcurrencyid,
+ 						ccurrencyid, bodyvo.getNorigprice()/*主原币无税单价*/, foreignrate, headvo.getDbilldate());
+ 				
+ 				bodyvo.setNprice(ngprice); // 主本币无税单价
+ 				
+ 				bodyvo.setNqtprice(ngprice); //报价本币无税单价
+ 				
+ 				bodyvo.setNqttaxprice(foreignAmount);//报价本币含税单价
+ 				
+ 				
+ 				UFDouble nmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+ 						ccurrencyid, bodyvo.getNorigmny()/*原币无税金额*/, foreignrate, headvo.getDbilldate());
+ 				
+ 				bodyvo.setNmny(nmny);//本币无税金额  
+ 				
+ 				UFDouble ntaxmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+ 						ccurrencyid, bodyvo.getNorigtaxmny()/*原币价税合计*/, foreignrate, headvo.getDbilldate());
+ 				
+ 				bodyvo.setNtaxmny(ntaxmny);//ntaxmny 本币价税合计
+ 				
+ 				bodyvo.setNcaltaxmny(nmny);//计税金额
+ 				bodyvo.setNqtnetprice(ngprice);//本币无税净价
+ 				bodyvo.setNnetprice(ngprice);//主本币无税净价
+ 				
+ 				bodyvo.setNqttaxnetprice(foreignAmount);//本币含税净价
+ 				bodyvo.setNtaxnetprice(foreignAmount);//主本币含税净价
+
+ 				
+
+ 				bodyvo.setNtax(ntaxmny.sub(nmny));//税额=价税合计-无税金额
+ 			}
+ 			
+ 		} catch (BusinessException e1) {
+ 			 ExceptionUtils.wrappException(e1);
+              return null;
+ 		}
+	
+	  InsertSaleOrderAction insertact = new InsertSaleOrderAction();
+	    SaleOrderVO[] retvos = insertact.insert(insertvo);
+	    if (null == retvos || retvos.length == 0) {
+	      return null;
+	    }
+	    
+	    
+    
+    //add by ZTH 江门工玻 销售订单审批通过  
+    
+	String pk_org = retvos[0].getParentVO().getPk_org();
+	//0001V510000000002GEH   江门基地				
+	if(pk_org != null && (pk_org.equals("0001V510000000002GDX"))){
+	 IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
+	 InvocationInfoProxy.getInstance().setUserId(retvos[0].getParentVO().getApprover());
+	    try {
+	    	service.processAction(IPFActionName.APPROVE,
+			     "30", null, retvos[0], null, null);
+		} catch (BusinessException e) {
+			// TODO 自动生成的 catch 块
+			ExceptionUtils.wrappBusinessException(e.getMessage());
+		    return null;
+		}
+	}	
+    
+    
+
+  
+    
+    return retvos[0];
+  }
+
+  @Override
+  protected AggregatedValueObject update(AggregatedValueObject vo, String vopk) {
+
+    SaleOrderVO[] updatevo = new SaleOrderVO[] {
+      (SaleOrderVO) vo
+    };
+    BillQuery<SaleOrderVO> billquery =
+        new BillQuery<SaleOrderVO>(SaleOrderVO.class);
+    SaleOrderVO[] origvos = billquery.query(new String[] {
+      vopk
+    });
+    BillConcurrentTool tool = new BillConcurrentTool();
+    tool.lockBill(origvos);
+    UpdateSaleOrderAction insertact = new UpdateSaleOrderAction();
+    SaleOrderVO[] retvos = insertact.update(updatevo, origvos);
+    if (null == retvos || retvos.length == 0) {
+      return null;
+    }
+    return retvos[0];
+  }
+
+}

+ 139 - 0
ypff/so/src/private/nc/pubimpl/so/m4331/pfxx/M4331PfxxPlugin.java

@@ -0,0 +1,139 @@
+package nc.pubimpl.so.m4331.pfxx;
+
+import nc.bs.framework.common.NCLocator;
+import nc.impl.pubapp.pattern.data.bill.BillQuery;
+import nc.impl.pubapp.pattern.data.bill.tool.BillConcurrentTool;
+import nc.impl.so.m4331.action.maintain.DeliveryInsertAction;
+import nc.impl.so.m4331.action.maintain.DeliveryUpdateAction;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.pubitf.uapbd.CurrencyRateUtil;
+import nc.vo.ecpubapp.pattern.exception.ExceptionUtils;
+import nc.vo.pub.AggregatedValueObject;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.so.m4331.entity.DeliveryBVO;
+import nc.vo.so.m4331.entity.DeliveryHVO;
+import nc.vo.so.m4331.entity.DeliveryVO;
+
+/**
+ * <b> 在此处简要描述此类的功能 </b>
+ * 
+ * <p>
+ * 在此处添加此类的描述信息
+ * </p>
+ * 
+ * @author ufsoft
+ * @version Your Project V60
+ */
+public class M4331PfxxPlugin extends nc.pubimpl.so.pfxx.AbstractSOPfxxPlugin {
+  @Override
+  protected AggregatedValueObject insert(AggregatedValueObject vo) {
+    DeliveryVO[] insertvo = new DeliveryVO[] {
+      (DeliveryVO) vo
+    };
+    /**
+     * 根据源币种主键,目的币种主键,查询指定日期的汇率
+     * 
+     * @param src_currency_pk
+     *            源币种主键
+     * @param dest_currency_pk
+     *            目的币种的主键,为null时则认为是默认目的币种主键
+     * @param date
+     * @return
+     * @throws BusinessException
+     */
+    DeliveryVO newvo = insertvo[0];
+    DeliveryHVO headvo = newvo.getParentVO();
+    CurrencyRateUtil currRateUtil = CurrencyRateUtil
+				.getInstanceByOrg(headvo.getPk_org());
+    DeliveryBVO[] bodyvos = newvo.getChildrenVO();
+    for(DeliveryBVO bodyvo:bodyvos){
+    	String corigcurrencyid = bodyvo.getCorigcurrencyid();//原币
+    	String ccurrencyid= bodyvo.getCcurrencyid();//本位币
+    	try {
+			if(corigcurrencyid.equals(ccurrencyid)){
+					UFDouble nqtorigtaxprice = bodyvo.getNqtorigtaxprice();//含税单价
+					UFDouble nqtorigprice = bodyvo.getNqtorigprice();//无税单价
+					UFDouble norigmny = bodyvo.getNorigmny();//无税金额
+					UFDouble norigtaxmny = bodyvo.getNorigtaxmny();//价税合计
+					bodyvo.setNcaltaxmny(norigtaxmny);//计税金额
+					bodyvo.setNqttaxprice(nqtorigtaxprice);//本币含税单价
+					bodyvo.setNqtprice(nqtorigprice);//本币无税单价
+					bodyvo.setNqttaxnetprice(nqtorigtaxprice);//本币含税净价
+					bodyvo.setNqtnetprice(nqtorigprice);//本币无税净价
+					bodyvo.setNtaxprice(nqtorigtaxprice);//主本币含税单价
+					bodyvo.setNpiece(nqtorigprice);//主本币无税单价
+					bodyvo.setNtaxnetprice(nqtorigtaxprice);//主本币含税净价
+					bodyvo.setNnetprice(nqtorigprice);//主本币无税净价
+					bodyvo.setNmny(norigmny);//本币无税金额
+					bodyvo.setNtaxmny(norigtaxmny);//本币价税合计
+					continue;
+				}
+				UFDouble foreignrate = currRateUtil.getRate(corigcurrencyid,/*原币*/
+						ccurrencyid/*本币*/, headvo.getDbilldate());//汇率
+				bodyvo.setNexchangerate(foreignrate);
+				//norigprice 原币无税单价
+				UFDouble norigprice=bodyvo.getNorigtaxprice();//主原币含税单价
+				UFDouble foreignAmount=	currRateUtil.getAmountByOpp(corigcurrencyid,
+						ccurrencyid, norigprice, foreignrate, headvo.getDbilldate());
+				bodyvo.setNtaxprice(foreignAmount);//主本币含税单价
+				UFDouble ngprice=currRateUtil.getAmountByOpp(corigcurrencyid,
+						ccurrencyid, bodyvo.getNorigprice()/*主原币无税单价*/, foreignrate, headvo.getDbilldate());
+				bodyvo.setNprice(ngprice); // 主本币无税单价
+				bodyvo.setNqtprice(ngprice); //报价本币无税单价
+				bodyvo.setNqttaxprice(foreignAmount);//报价本币含税单价
+				UFDouble nmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+						ccurrencyid, bodyvo.getNorigmny()/*原币无税金额*/, foreignrate, headvo.getDbilldate());
+				bodyvo.setNmny(nmny);//本币无税金额  
+				UFDouble ntaxmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+						ccurrencyid, bodyvo.getNorigtaxmny()/*原币价税合计*/, foreignrate, headvo.getDbilldate());
+				bodyvo.setNtaxmny(ntaxmny);//ntaxmny 本币价税合计
+				bodyvo.setNcaltaxmny(nmny);//计税金额
+				bodyvo.setNqtnetprice(ngprice);//本币无税净价
+				bodyvo.setNnetprice(ngprice);//主本币无税净价
+				bodyvo.setNqttaxnetprice(foreignAmount);//本币含税净价
+				bodyvo.setNtaxnetprice(foreignAmount);//主本币含税净价
+				bodyvo.setNtax(ntaxmny.sub(nmny));//税额=价税合计-无税金额
+		} catch (BusinessException e) {
+			// TODO 自动生成的 catch 块
+			ExceptionUtils.wrappBusinessException(e.getMessage());
+		}
+	}
+    
+    
+    DeliveryInsertAction insert = new DeliveryInsertAction();
+    try {
+		DeliveryVO[] ret = insert.insert(insertvo);
+		if (null == ret || ret.length == 0) {
+		  return null;
+		}
+		IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
+		DeliveryVO[] approvevos = (DeliveryVO[]) service.processAction("APPROVE", "4331", null, ret[0], null, null);
+		return approvevos[0];
+	} catch (Exception e) {
+		// TODO 自动生成的 catch 块
+		e.printStackTrace();
+	}
+    return null;
+  }
+
+  @Override
+  protected AggregatedValueObject update(AggregatedValueObject vo, String vopk) {
+    DeliveryVO[] updatevo = new DeliveryVO[] {
+      (DeliveryVO) vo
+    };
+    BillQuery<DeliveryVO> billquery =
+        new BillQuery<DeliveryVO>(DeliveryVO.class);
+    DeliveryVO[] origvos = billquery.query(new String[] {
+      vopk
+    });
+    BillConcurrentTool tool = new BillConcurrentTool();
+    tool.lockBill(origvos);
+    DeliveryUpdateAction update = new DeliveryUpdateAction();
+    DeliveryVO[] retvos = update.update(updatevo, origvos);
+    if (null == retvos || retvos.length == 0) {
+      return null;
+    }
+    return retvos[0];
+  }
+}