Browse Source

增加英唐之芯

koul 5 years ago
parent
commit
c4c8bc23d9

+ 4 - 6
src/com/uas/main/Download.java

@@ -18,12 +18,9 @@ import com.uas.util.JdbcUtil;
 public class Download {	
 	public static boolean updateAndLog(Connection connection,Map<String,Object> map,String depot,File file){
 		boolean bool = false;
-		String hk = "";
 		List<String> sqls = new ArrayList<String>();	
 		String content = BaseUtil.getStringByFile(file);
-		if("true".equals(map.get("hk"))){
-			hk = "YHND_HK.";
-		}
+		String hk = (String) map.get("hk");
 		sqls.add("insert into "+hk+"xmldatalog (xl_id,xl_data,xl_date,xl_depot,xl_code,xl_from,xl_status,xl_filename)"
 					+ " values("+hk+"XMLDATALOG_SEQ.NEXTVAL,'"+content+"',sysdate,'"+depot+"','"+map.get("code")+"','download','success','"+file.getName()+"')");			
 		sqls.add(map.get("sql").toString());
@@ -63,10 +60,11 @@ public class Download {
 									map = BaseUtil.getDataAndSqlByXml(file);
 									bol = updateAndLog(con,map,key,file);
 									if(bol){
-										if("1".equals(key)||"2".equals(key)|"3".equals(key)){
+										if("1".equals(key)||"2".equals(key)||"3".equals(key)){
 											client.rename(file.getName(),".."+ File.separator + "reply_bak"+ File.separator + file.getName());
 										}else{
-											FtpUtil.deleteFile(client,file.getName());
+											client.rename(file.getName(),".."+ File.separator + "reply_bak"+ File.separator + file.getName());
+											//FtpUtil.deleteFile(client,file.getName());
 										}
 									}
 									

+ 1 - 1
src/com/uas/main/Main.java

@@ -7,7 +7,7 @@ public class Main {
 		System.out.println("run start!");
 		BaseUtil.getLogger().info("run start!");
 		Upload.run();
-		Download.run();		
+		Download.run();
 		System.out.println("run over!");
 		BaseUtil.getLogger().info("run over!");
 	}

+ 10 - 8
src/com/uas/util/BaseUtil.java

@@ -54,7 +54,7 @@ public class BaseUtil {
 		String condition = "";
 		String code = "";
 		InputStream in = null;
-		boolean hkSob = false;
+		String hkSob =null;
 		
 		try {
 			in = new FileInputStream(file);
@@ -91,10 +91,12 @@ public class BaseUtil {
         	 }else if(name=="RefNo"){
         		 code = el.getData().toString();
         		 if(code.trim().toUpperCase().startsWith("HK")){
-        			 hkSob = true;
-        		 }else{
-        			 hkSob = false;
-        		 }
+        			 hkSob = "YHND_HK.";
+        		 }else if (code.trim().toUpperCase().startsWith("YT")){
+        			 hkSob = "YITOA_ZX.";
+        		 }else {
+					 hkSob = "YHND_SZ.";
+				 }
         		 json += ",\"PI_INOUTNO:\":\"" + code + "\"";
         		 condition = "PI_INOUTNO='"+code+"'";
         	 }
@@ -102,13 +104,13 @@ public class BaseUtil {
     	if(!"".equals(json)){
     		json = "{" + json.substring(1) + "}";
     	}
-    	if(!"".equals(sql)){
-    		sql = "update "+(hkSob?"YHND_HK.":"")+"prodinout set " + sql.substring(0,sql.lastIndexOf(",")) + " where " + condition;
+    	if(!"".equals(sql)&&hkSob != null){
+    		sql = "update " + hkSob + "prodinout set " + sql.substring(0, sql.lastIndexOf(",")) + " where " + condition;
     	}
     	map.put("json", json);
     	map.put("sql", sql);
     	map.put("code",code);
-    	map.put("hk",hkSob?"true":"false");
+    	map.put("hk",hkSob);
     	return map;		
 	}
 	

+ 1 - 21
src/properties/ftpconfig.properties

@@ -36,26 +36,6 @@
 		"out":"WMSRELS",
 		"remark":"上海仓库"
 	},
-	"6":{
-		"ip":"112.74.205.182",
-		"port":21,
-		"user":"YHND03",
-		"password":"Yhnd@#$2018",
-		"downloadpath":"reply",
-		"in":"appointment_in",
-		"out":"distribute_in",
-		"remark":"\u65D7\u4E30-Megafone"
-	},
-	"3":{
-		"ip":"sz.hi-mantech.com",
-		"port":46688,
-		"user":"userzx",
-		"password":"userzx_123456",
-		"downloadpath":"WMSANS",
-		"in":"WMSRECV",
-		"out":"WMSRELS",
-		"remark":"上海仓库"
-	},
 	"4":{
 		"ip":"112.74.205.182",
 		"port":21,
@@ -127,7 +107,7 @@
 		"remark":"YHND_LY"
 	},
 	"11":{
-		"ip":"183.62.216.214",
+		"ip":"112.74.205.182",
 		"port":21,
 		"user":"YTZX02",
 		"password":"Yhnd#$%2019",