Bläddra i källkod

形态转换表头加部门

pancy 1 år sedan
förälder
incheckning
b95883a3a5
1 ändrade filer med 32 tillägg och 15 borttagningar
  1. 32 15
      ic/ic/src/private/nc/bs/ic/impl/TransformAddImpl.java

+ 32 - 15
ic/ic/src/private/nc/bs/ic/impl/TransformAddImpl.java

@@ -80,12 +80,14 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 			transformheadvo.setCorpoid(json.getString("pk_org"));
 			transformheadvo.setCorpvid(SqlexecuteQuery2("pk_vid", "org_corp", "pk_corp", json.getString("pk_org")));
 			transformheadvo.setDbilldate(new UFDate(json.getString("dbilldate")));
-			transformheadvo.setCtrantypeid(json.getString("ctrantypeid"));
-			transformheadvo.setVtrantypecode(SqlexecuteQuery2("pk_billtypecode", "bd_billtype", "pk_billtypeid", json.getString("ctrantypeid")));
+			transformheadvo.setCtrantypeid(SqlexecuteQuery("pk_billtypeid", "bd_billtype", "pk_billtypecode", json.getString("ctrantypeid")));
+			transformheadvo.setVtrantypecode(json.getString("ctrantypeid"));
 			transformheadvo.setCreator(SqlexecuteQuery("cuserid", "sm_user", "user_code", json.getString("creator")));
 			transformheadvo.setCreationtime(new UFDateTime(json.getString("dbilldate")));
 			transformheadvo.setBillmaker(SqlexecuteQuery("cuserid", "sm_user", "user_code", json.getString("creator")));
 			transformheadvo.setDmakedate(new UFDate(json.getString("dbilldate")));
+			transformheadvo.setCdptid(json.getString("cdptid"));
+			transformheadvo.setCdptvid(SqlexecuteQuery2("pk_vid", "org_dept", "pk_dept", json.getString("cdptid")));
 			transformvo.setParentVO(transformheadvo);
 			
 			/**
@@ -104,16 +106,18 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 				transformbodyvo.setCorpoid(bodyObject.getString("pk_org"));
 				transformbodyvo.setCorpvid(SqlexecuteQuery2("pk_vid", "org_corp", "pk_corp", bodyObject.getString("pk_org")));
 				transformbodyvo.setCbodywarehouseid(bodyObject.getString("cbodywarehouseid"));
-				transformbodyvo.setCmaterialoid(bodyObject.getString("cmaterialoid"));
-				transformbodyvo.setCmaterialvid(SqlexecuteQuery2("pk_source", "bd_material", "pk_material", bodyObject.getString("cmaterialoid")));
-				transformbodyvo.setCunitid(SqlexecuteQuery("pk_measdoc", "bd_measdoc", "code", bodyObject.getString("cunitid")));
-				transformbodyvo.setCastunitid(SqlexecuteQuery("pk_measdoc", "bd_measdoc", "code", bodyObject.getString("castunitid")));
-				transformbodyvo.setVchangerate(bodyObject.getString("vchangerate"));
+				transformbodyvo.setCmaterialoid(SqlexecuteQuery2("pk_material", "bd_material", "code", bodyObject.getString("cmaterialoid")));
+				transformbodyvo.setCmaterialvid(SqlexecuteQuery2("pk_source", "bd_material", "code", bodyObject.getString("cmaterialoid")));
+				transformbodyvo.setCunitid(bodyObject.getString("cunitid"));
+				transformbodyvo.setCastunitid(bodyObject.getString("castunitid"));
+				transformbodyvo.setVchangerate(SqlexecuteQuery("measrate", "V_CD_VIEW_BD_MATERIAL_MEASDOC", "code", bodyObject.getString("cmaterialoid")));
 				transformbodyvo.setNnum(new UFDouble(bodyObject.getString("nnum")));
 				transformbodyvo.setNassistnum(new UFDouble(bodyObject.getString("nassistnum")));
-				transformbodyvo.setNcostprice(new UFDouble(bodyObject.getString("ncostprice")));
-				transformbodyvo.setNcostmny(new UFDouble(bodyObject.getString("ncostmny")));
-				transformbodyvo.setVbatchcode(bodyObject.getString("vbatchcode"));
+//				transformbodyvo.setNcostprice(new UFDouble(bodyObject.getString("ncostprice")));
+//				transformbodyvo.setNcostmny(new UFDouble(bodyObject.getString("ncostmny")));
+				if(bodyObject.getString("vbatchcode")!=null){
+					transformbodyvo.setVbatchcode(bodyObject.getString("vbatchcode"));
+				}
 				transformbodyvos[i] = transformbodyvo;
 				i++;
 			}
@@ -151,12 +155,15 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 		Boolean empty = true;
 		
 		String vbillcode = "vbillcode";//单据号
-		String group = "pk_group";//集团编码
+		String pk_org = "pk_org";//组织编码
 		String creator = "creator";//创建人
+		String dbilldate = "dbilldate";//单据日期
+		String ctrantypeid = "ctrantypeid";//转换类型
+		String cdptid = "cdptid";//部门
 		
 		String body = "cspecialbid";//表体
  
-		String[] HeadKey = {vbillcode,group,creator};
+		String[] HeadKey = {vbillcode,pk_org,creator,dbilldate,ctrantypeid,cdptid};
 		
 		for (String as : HeadKey) {
 
@@ -178,16 +185,26 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 		}
 		
 		String cmaterialoid = "cmaterialoid";//物料编码
+		String fbillrowflag = "fbillrowflag";//行状态
+		String pk_org_b = "pk_org";//组织
+		String cbodywarehouseid = "cbodywarehouseid";//仓库
+		String cunitid = "cunitid";//主单位
+		String castunitid = "castunitid";//辅单位
+//		String vchangerate = "vchangerate";//换算率
+		String nnum = "nnum";//主数量
+		String nassistnum = "nassistnum";//辅数量
+//		String ncostprice = "ncostprice";//单价
+//		String ncostmny = "ncostmny";//金额
+		
 		
 		for(int i = 0; i < oprepObjectBs.size(); i++) {
 			
 			JSONObject oprepJsonObjectB = oprepObjectBs.getJSONObject(i);
-			String[] BodyKey = {cmaterialoid};
+			String[] BodyKey = {cmaterialoid,fbillrowflag,pk_org_b,cbodywarehouseid,cunitid,castunitid,nnum,nassistnum};
 			int num = i+1;
 			
 			mags.append("第"+num+"块表体:{");
 			for (String as : BodyKey) {
-
 				if (oprepJsonObjectB.getString(as).isEmpty()) {
 					empty = false;
 					mags.append("'" + as + "' ");
@@ -225,7 +242,7 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 	
 	private String SqlexecuteQuery2(String out,String table,String key,String value) throws Exception {
 		
-		String sql = "select "+out+" from "+table+" where "+key+" = '"+value+"' and nvl(dr,0)=0 and enablestate = '2' and pk_group = '0001V5100000000006BX'";
+		String sql = "select "+out+" from "+table+" where "+key+" = '"+value+"' and nvl(dr,0)=0 and enablestate = '2'";
 		
 		Object object;
 		try {