Browse Source

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

# Conflicts:
#	target/classes/main/resources/mapper/MouldEquipmentMapper.xml
#	target/classes/main/resources/mapper/MouldMapper.xml
5 years ago
parent
commit
6794ba46fc

+ 49 - 0
cloud-socket/src/com/js/kbt/controller/WeiXinUserInfoController.java

@@ -327,8 +327,57 @@ public class WeiXinUserInfoController {
 			return Integer.parseInt(str, 16);
 		}
 		
+//		public static byte[] strToByte(String data) {
+//	        data = data.replace(" ", "");
+//	        int len = data.length();
+//	        if (!(len % 2 == 0)) {
+//	        	byte[] para = new byte[]{0,0,0,0};
+//	            return para;
+//	        }
+//	        int num = len / 2;
+//	        byte[] para = new byte[num];
+//	        for (int i = 0; i < num; i++) {
+//	            int value = Integer.valueOf(data.substring(i * 2, 2 * (i + 1)), 16);
+//	            para[i] = (byte) value;
+//	        }
+//	        for (byte b : para) {
+//				
+//			}
+//	        return para;
+//	    }
+//		
+//		private static String crc(byte str[],int len){
+//		    int crc =  0xFFFF;
+//		    byte data;
+//		    for(int i = 0 ; i < len ; i++){
+//		        data =  str[i];
+//		        for(int j = 0; j < 8; j++){
+//		            if ((((crc&0x8000)>>8)^(data&0x80))!=0){
+//		                crc =  ((crc << 1) ^ 0x8005);
+//		            }
+//		            else
+//		            {
+//		                crc <<= 1;
+//		            }
+//		            data <<= 1;
+//		        }
+//		    }
+//		    System.out.println("crc"+crc);
+//		  //结果转换为16进制
+//	        String result = Integer.toHexString(crc).toUpperCase();
+//	        if (result.length() != 4) {
+//	            StringBuffer sb = new StringBuffer("0000");
+//	            result = sb.replace(4 - result.length(), 4, result).toString();
+//	        }
+//		    return result;  
+//		}
+		
 		public static void main(String[] args) {
 			String ret = "D5 37";
+			String part = "FA AF 00 07 02 1e 78"+" 1e"+" "+"50"+" 00 3C"; 
+//			byte[] strToByte = strToByte(part);
+//			String crc1 = crc(part.getBytes(),strToByte.length);
+//			System.out.println("crc"+crc1);
 			ret = ret.replaceAll(" ", "");
 			System.out.println(ret);
 //			int parseInt = Integer.parseInt(ret, 16);

+ 2 - 0
cloud-socket/src/com/js/kbt/util/CRC16Util.java

@@ -46,8 +46,10 @@ public class CRC16Util {
                 }
             }
         }
+        System.out.println("CRC"+CRC);
         //结果转换为16进制
         String result = Integer.toHexString(CRC).toUpperCase();
+        System.out.println("result"+result);
         if (result.length() != 4) {
             StringBuffer sb = new StringBuffer("0000");
             result = sb.replace(4 - result.length(), 4, result).toString();

+ 3 - 2
target/classes/main/resources/mapper/MouldMapper.xml

@@ -67,6 +67,7 @@
         <result column="equipmentNo" property="equipmentNo"/>
         <result column="stage" property="stage"/>
         <result column="endTime" property="endTime"/>
+        <result column="lastopentime" property="lastOpenTime"/>
         <result column="hillNumber" property="hillNumber"/>
         <result column="ownerCompanyName" property="ownerCompanyName"/>
         <result column="companyName" property="companyName"/>
@@ -87,7 +88,7 @@
         tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbco.company_name produceCompany,tbm.pre_update_id,
         tbp.manager mangerName,tbco.company_address area,tbmp.hill_number hillNumber,tbm.oc_cycle oc_cycle,tbp.manager_id managerId,
         tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
-        tbmp.lng,tbmp.lat,tbmp.stage
+        tbmp.lng,tbmp.lat,tbmp.stage,(SELECT open_time FROM `mould_history_time` WHERE equipment_no=equipmentNo ORDER BY indate DESC LIMIT 1) lastopentime
         from
         tb_mould tbm
         left join
@@ -133,7 +134,7 @@
         tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbm.holes,tbm.pre_update_id,tbco.company_name produceCompany,
         tbp.manager mangerName,tbco.company_address area,tbmp.hill_number hillNumber,tbm.oc_cycle oc_cycle,tbm.creator_id creator_id,
         tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
-        tbmp.lng,tbmp.lat,tbmp.stage
+        tbmp.lng,tbmp.lat,tbmp.stage,(SELECT open_time FROM `mould_history_time` WHERE equipment_no=equipmentNo ORDER BY indate DESC LIMIT 1) lastopentime
         from
         tb_mould tbm
         left join