📄 addpaymentdocumentaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package cn.bway.foreigntrade.finance.buy.document.action;
import java.sql.Connection;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.Session;
import org.hibernate.Transaction;
import cn.bway.common.LoginConstants;
import cn.bway.common.WebConstant;
import cn.bway.common.action.BaseAction;
import cn.bway.common.code.codeDao;
import cn.bway.common.dao.HibernateSessionFactory;
import cn.bway.common.vo.PageListVO;
import cn.bway.common.vo.QueryVO;
import cn.bway.foreigntrade.finance.buy.document.form.PaymentdocumentForm;
import cn.bway.foreigntrade.finance.buy.document.impl.PaymentdocumentManagerFactory;
import cn.bway.foreigntrade.finance.buy.document.model.Paymentdocument;
import cn.bway.foreigntrade.operation.guestmanage.logs.impl.LogsManagerFactory;
import cn.bway.foreigntrade.operation.guestmanage.logs.model.Logs;
import cn.bway.foreigntrade.repertory.buydocument.impl.BuydocumentManagerFactory;
import cn.bway.foreigntrade.repertory.buydocument.model.Buydocument;
import cn.bway.foreigntrade.repertory.buyproduct.impl.BuyproductManagerFactory;
/**
* MyEclipse Struts
* Creation date: 03-25-2008
*
* XDoclet definition:
* @struts.action path="/showPaymentdocument" name="paymentdocumentForm" scope="request" validate="true"
*/
public class AddPaymentdocumentAction extends BaseAction {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
PaymentdocumentForm paymentdocumentForm = (PaymentdocumentForm) form;// TODO Auto-generated method stub
String id=request.getParameter("id");
System.out.println(id+"============================");
ActionErrors errors = new ActionErrors();
PageListVO rvo = null;
QueryVO qvo = new QueryVO();
Session sess =null;
Transaction tx =null;
String returnStr = null;
Connection conn = null;
try {
request.setCharacterEncoding("utf-8");
Buydocument client=(Buydocument) BuydocumentManagerFactory.getBuydocumentManager().getBuydocument(id);
// rvo=(PageListVO) BuyproductManagerFactory.getBuyproductManager().getAllBuyproduct(id);
// ArrayList listresult = (ArrayList) rvo.getretVO();
Paymentdocument exp=new Paymentdocument();
exp.setOrderid(client.getOrderid() );
exp.setCodes(client.getCodes() );
exp.setProvidername(client.getProvidername() );
exp.setAddress(client.getAddress() );
exp.setLinkman(client.getLinkman() );
exp.setTel(client.getTel() );
exp.setTimes(client.getTimes() );
exp.setFax(client.getFax() );
exp.setEmails(client.getEmails() );
exp.setPay("0");
PaymentdocumentManagerFactory.getPaymentdocumentManager().addPaymentdocument(exp);
// 更新采购单
Buydocument buy=new Buydocument();
buy.setOrderid(client.getOrderid() );
buy.setCodes(client.getCodes() );
buy.setProvidername(client.getProvidername() );
buy.setAddress(client.getAddress() );
buy.setLinkman(client.getLinkman() );
buy.setTel(client.getTel() );
buy.setTimes(client.getTimes() );
buy.setFax(client.getFax() );
buy.setEmails(client.getEmails() );
buy.setId(client.getId() );
buy.setChecks("4");
BuydocumentManagerFactory.getBuydocumentManager().modfilyBuydocument(buy);
// 添加往来日志
String username=(String) request.getSession().getAttribute(LoginConstants.GLOBLE_STAFF_NAME);
String[] menuid=new codeDao().getId("paymentbuy","id","P");
Logs log=new Logs("申请付款",exp.getCodes(),new codeDao().getDate(),username,""+(Integer.parseInt(menuid[1])-1),"paymentbuy","provide");
LogsManagerFactory.getLogsManager().addLogs(log);
returnStr = WebConstant.FORWARD_INITPAGE;
} catch (Exception e) {
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("edu.system.excption", e.getMessage()));
this.saveErrors(request, errors);
tx.rollback();
e.printStackTrace();
} finally {
try {
if (null != conn) {
conn.close();
}
} catch (Exception ex) {
ex.printStackTrace();
}
HibernateSessionFactory.closeSession();
}
return mapping.findForward(returnStr);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -