|
@@ -5,6 +5,8 @@ import java.io.PrintWriter;
|
|
|
import java.io.StringWriter;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import javax.servlet.ServletException;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -14,6 +16,7 @@ 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.pu.plugin.DataUtils.QueryDataUtil;
|
|
|
import nc.bs.servlet.service.BaseServlet;
|
|
|
import nc.itf.pu.m25.IInvoiceApprove;
|
|
|
import nc.itf.pu.m25.IInvoiceMaintain;
|
|
@@ -38,7 +41,7 @@ public class InvoiceAddImpl extends BaseServlet implements IHttpServletAdaptor {
|
|
|
@Override
|
|
|
public void doAction(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {
|
|
|
try {
|
|
|
- InvocationInfoProxy.getInstance().setUserDataSource("NC6337");
|
|
|
+ //InvocationInfoProxy.getInstance().setUserDataSource("NC6337");
|
|
|
NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
|
|
|
String createStr = buildJson(req, resp, this.getClass().getName());
|
|
|
JSONObject json = JSONObject.fromObject(createStr);
|
|
@@ -125,7 +128,45 @@ public class InvoiceAddImpl extends BaseServlet implements IHttpServletAdaptor {
|
|
|
invoiceItemVO.setFtaxtypeflag(Integer.parseInt(json.getString("ftaxtypeflagh")));//扣税类别(1=应税外加,0=应税内含)
|
|
|
invoiceItemVO.setVchangerate("1/1");//换算率
|
|
|
invoiceItemVO.setVbdef16(bodyObject.getString("vbdef16"));
|
|
|
+ invoiceItemVO.setCunitid(SqlexecuteQuery("pk_measdoc", "bd_measdoc", "code", bodyObject.getString("cunitid")));//主单位
|
|
|
+ invoiceItemVO.setCastunitid(invoiceItemVO.getCunitid());//单位
|
|
|
+ Map<String,String> map = new HashMap<String,String>();
|
|
|
+ String vfirstcode = bodyObject.getString("vfirstcode");
|
|
|
+ if(!"vfirstcode".equals(vfirstcode)) {
|
|
|
+ String vfirstrowno = bodyObject.getString("vfirstrowno");
|
|
|
+ String cfirsttypecode = bodyObject.getString("cfirsttypecode");
|
|
|
+ map = QueryDataUtil.getDataMap(cfirsttypecode, vfirstcode, vfirstrowno);
|
|
|
+ invoiceItemVO.setVfirstcode(vfirstcode);//源头单据号
|
|
|
+ invoiceItemVO.setVfirstrowno(vfirstrowno);//源头单据行号
|
|
|
+ invoiceItemVO.setCfirstid(map.get("pk_id")); //源头单据主键
|
|
|
+ invoiceItemVO.setCfirstbid(map.get("pk_id_b"));//源头单据行主键
|
|
|
+ invoiceItemVO.setCfirsttypecode(cfirsttypecode);//源头单据类型
|
|
|
+ invoiceItemVO.setVfirsttrantype(SqlexecuteQuery("pk_billtypeid", "bd_billtype", "pk_billtypecode",bodyObject.getString("vfirsttrantype")));//源头交易类型
|
|
|
+ }
|
|
|
+ invoiceItemVO.setVctcode(bodyObject.getString("vctcode"));//合同号
|
|
|
+
|
|
|
+ String vordercode = bodyObject.getString("vordercode");
|
|
|
+ if(!"".equals(vordercode)) {
|
|
|
+ String vorderrowno = bodyObject.getString("vorderrowno");//订单行号
|
|
|
+ map = QueryDataUtil.getDataMap("21", vordercode, vorderrowno);
|
|
|
+ invoiceItemVO.setVordercode(vordercode);//订单号
|
|
|
+ invoiceItemVO.setPk_order(map.get("pk_id"));//订单主键
|
|
|
+ invoiceItemVO.setPk_order_b(map.get("pk_id_b"));//订单行主键
|
|
|
+ invoiceItemVO.setVordertrantype(bodyObject.getString("vordertrantype"));//订单交易类型
|
|
|
+ }
|
|
|
|
|
|
+ String vsourcecode = bodyObject.getString("vsourcecode");
|
|
|
+ if(!"".equals(vsourcecode)) {
|
|
|
+ String vsourcerowno = bodyObject.getString("vsourcerowno");
|
|
|
+ String csourcetypecode = bodyObject.getString("csourcetypecode");
|
|
|
+ map = QueryDataUtil.getDataMap(csourcetypecode, vsourcecode, vsourcerowno);
|
|
|
+ invoiceItemVO.setVsourcecode(vsourcecode);//来源单据号
|
|
|
+ invoiceItemVO.setVsourcerowno(vsourcerowno);//来源单据行号
|
|
|
+ invoiceItemVO.setCsourceid(map.get("pk_id"));//来源单据主键
|
|
|
+ invoiceItemVO.setCsourcebid(map.get("pk_id_b"));//来源单据行主键
|
|
|
+ invoiceItemVO.setCsourcetypecode(csourcetypecode);//来源单据类型
|
|
|
+ invoiceItemVO.setVsourcetrantype(SqlexecuteQuery("pk_billtypeid", "bd_billtype", "pk_billtypecode",bodyObject.getString("vsourcetrantype")));//来源交易类型
|
|
|
+ }
|
|
|
if(bodyObject.opt("vbatchcode")!=null){
|
|
|
invoiceItemVO.setVbatchcode(bodyObject.getString("vbatchcode"));
|
|
|
}
|
|
@@ -144,7 +185,7 @@ public class InvoiceAddImpl extends BaseServlet implements IHttpServletAdaptor {
|
|
|
IInvoiceMaintain iInvoiceMaintain = (IInvoiceMaintain)NCLocator.getInstance().lookup(IInvoiceMaintain.class);
|
|
|
InvoiceVO[] invoiceVO = iInvoiceMaintain.insert(aggvos, null);
|
|
|
IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
|
|
|
- service.processAction("APPROVE","21", null, invoiceVO[0], null, null);
|
|
|
+ service.processAction("APPROVE","25", null, invoiceVO[0], null, null);
|
|
|
out.print(formatRSJsonData("成功","",vbillcode));
|
|
|
} catch (Exception e) {
|
|
|
resp.getWriter().write(formatRSJsonData("失败", e.getMessage().toString(), "").toString());
|