Browse Source

应付单接口

yaoyu 2 weeks ago
parent
commit
1b48c6fe81

+ 29 - 2
arap/arap/src/private/nc/bs/arap/impl/PayableBillImpl.java

@@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -35,6 +36,11 @@ import nc.vo.pub.lang.UFDateTime;
 import nc.vo.pub.lang.UFDouble;
 import nc.vo.pub.workflownote.WorkflownoteVO;
 
+/**
+ * 壇마데
+ * @author Yaoyu
+ *
+ */
 public class PayableBillImpl extends BaseServlet implements IHttpServletAdaptor{
 
 	@Override
@@ -44,7 +50,7 @@ public class PayableBillImpl extends BaseServlet implements IHttpServletAdaptor{
 			NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
 			String createStr = buildJson(req, resp, this.getClass().getName());
 			JSONObject json = JSON.parseObject(createStr);
-			NcLog.info(json.toString());
+			NcLog.info("壇마데:"+json.toString());
 			billno = json.getString("billno");
 			InvocationInfoProxy.getInstance().setUserDataSource("NC6337");
 			GetDataUtil.getBillno(billno);
@@ -344,6 +350,27 @@ public class PayableBillImpl extends BaseServlet implements IHttpServletAdaptor{
 				payableBillItemVO.setTop_itemid("".equals(invoiceno) ? null : invoiceItemVO.getPk_invoice_b());
 				//�꿔슥弄잚謹 
 				payableBillItemVO.setTop_tradetype(item.getString("top_tradetype"));
+				//북谿뵀
+				payableBillItemVO.setContractno(item.getString("contractno"));
+				//땐데뵀
+				payableBillItemVO.setPurchaseorder(item.getString("purchaseorder"));
+				//都庫데앴뵀
+				String vfirstcode = item.getString("vfirstcode");
+				if(!"".equals(vfirstcode)) {
+					//都庫데앴잚謹
+					String  src_billtype = item.getString("src_billtype");
+					//都庫데앴契뵀
+					String vfirstrowno = item.getString("vfirstrowno");
+					Map<String,String> map = GetDataUtil.getDataMap(src_billtype, vfirstcode, vfirstrowno);
+					//都庫데앴寮숩
+					payableBillItemVO.setSrc_billid(map.get("pk_id"));
+					//都庫데앴契寮숩
+					payableBillItemVO.setSrc_itemid(map.get("pk_id_b"));
+					//都庫데앴잚謹
+					payableBillItemVO.setSrc_billtype(src_billtype);
+					//都庫슥弄잚謹
+					payableBillItemVO.setSrc_tradetype(GetDataUtil.getBilltypePK(item.getString("src_tradetype"), pk_group));
+				}
 				//뭔饋잚謹
 				payableBillItemVO.setBuysellflag(Integer.parseInt(item.getString("buysellflag")));
 				//왱江잚깎
@@ -437,7 +464,7 @@ public class PayableBillImpl extends BaseServlet implements IHttpServletAdaptor{
 			e.printStackTrace(new PrintWriter(stringWriter));
 			//삿혤圈玖斤口
 			String msg=stringWriter.getBuffer().toString();
-			NcLog.info(msg);
+			NcLog.info("壇마데:"+msg);
 		}
 	}
 		

+ 41 - 0
arap/arap/src/private/nc/bs/arap/plugin/GetDataUtil.java

@@ -1,9 +1,13 @@
 package nc.bs.arap.plugin;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import nc.bs.framework.common.NCLocator;
 import nc.itf.uap.IUAPQueryBS;
 import nc.jdbc.framework.processor.BeanProcessor;
 import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.jdbc.framework.processor.MapProcessor;
 import nc.vo.org.DeptVO;
 import nc.vo.org.FinanceOrgVO;
 import nc.vo.pu.m25.entity.InvoiceItemVO;
@@ -255,5 +259,42 @@ public class GetDataUtil {
 		return invoiceItemVO;
 	}
 	
+	//查询源头和来源数据
+	public static Map<String,String> getDataMap(String type,String vbillcode,String crowno)throws Exception {
+		if("".equals(vbillcode)) {
+			return null;
+		}
+		Map<String,String> map = new HashMap<String,String>();
+		String sql = "";
+		
+		if("20".equals(type)) {
+			sql = "select pk_praybill as pk_id,pk_praybill_b as pk_id_b from po_praybill_b where pk_praybill = (select pk_praybill from po_praybill where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0) and crowno = '"+crowno+"' and nvl(dr,0) = 0";
+			map = (Map<String, String>) iuap.executeQuery(sql.toString(), new MapProcessor());
+			if(map == null) {
+				throw new Exception("获取请购单信息失败,未找到与参数" + vbillcode + ","+crowno+"有关的数据!");
+			}
+		}else if("Z2".equals(type)) {
+			sql = "select pk_ct_pu as pk_id,pk_ct_pu_b as pk_id_b from ct_pu_b where pk_ct_pu = (select pk_ct_pu from ct_pu where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0) and crowno = '"+crowno+"' and nvl(dr,0) = 0";
+			map = (Map<String, String>) iuap.executeQuery(sql.toString(), new MapProcessor());
+			if(map == null) {
+				throw new Exception("获取采购合同信息失败,未找到与参数" + vbillcode + ","+crowno+"有关的数据!");
+			}
+		}else if("21".equals(type)) {
+			sql = "select pk_order as pk_id,pk_order_b as pk_id_b from po_order_b where pk_order = (select pk_order  from po_order where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0) and crowno = '"+crowno+"' and nvl(dr,0) = 0";
+			map = (Map<String, String>) iuap.executeQuery(sql.toString(), new MapProcessor());
+			if(map == null) {
+				throw new Exception("获取采购订单信息失败,未找到与参数" + vbillcode + ","+crowno+"有关的数据!");
+			}
+			
+		}else if("45".equals(type)) {
+			sql = "select cgeneralhid as pk_id,cgeneralbid as pk_id_b from ic_purchasein_b where cgeneralhid = (select cgeneralhid from vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0) and crowno = '"+crowno+"' and nvl(dr,0) = 0";
+			map = (Map<String, String>) iuap.executeQuery(sql.toString(), new MapProcessor());
+			if(map == null) {
+				throw new Exception("获取采购入库单信息失败,未找到与参数" + vbillcode + ","+crowno+"有关的数据!");
+			}
+		}
+		return map;
+	}
+	
 	
 }