|
@@ -76,7 +76,7 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
System.out.println("收到===" + arg1 + "\n");
|
|
System.out.println("收到===" + arg1 + "\n");
|
|
String equipmentNo = processMsg(arg1);
|
|
String equipmentNo = processMsg(arg1);
|
|
// 以下是配置下行数据
|
|
// 以下是配置下行数据
|
|
- // sendPackage(equipmentNo);
|
|
|
|
|
|
+ sendPackage(equipmentNo);
|
|
}
|
|
}
|
|
|
|
|
|
private String processMsg(String input) throws ParseException {
|
|
private String processMsg(String input) throws ParseException {
|
|
@@ -176,7 +176,7 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
// 本次运行周期内的开合模次数
|
|
// 本次运行周期内的开合模次数
|
|
int periodCnt = (end - start * 2) / 24;
|
|
int periodCnt = (end - start * 2) / 24;
|
|
logger.info("本次开合模次数==" + periodCnt);
|
|
logger.info("本次开合模次数==" + periodCnt);
|
|
- long aHeadOpenTimeLongVal = 0L;
|
|
|
|
|
|
+ long aHeadOpenTimeLongVal = 0L;
|
|
for (int pos = 0; pos < periodCnt; pos++) {
|
|
for (int pos = 0; pos < periodCnt; pos++) {
|
|
// 合模时间
|
|
// 合模时间
|
|
MouldHistoryTime time = new MouldHistoryTime();
|
|
MouldHistoryTime time = new MouldHistoryTime();
|
|
@@ -188,18 +188,18 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
// 开模时间
|
|
// 开模时间
|
|
Date openTime = parseDate(input, start, pos, 6);
|
|
Date openTime = parseDate(input, start, pos, 6);
|
|
time.setOpenTime(openTime);
|
|
time.setOpenTime(openTime);
|
|
- if(pos==0){
|
|
|
|
|
|
+ if (pos == 0) {
|
|
time.setTimeCost(0);
|
|
time.setTimeCost(0);
|
|
- }else{
|
|
|
|
- logger.info("本次开合周期--"+(openTime.getTime() - aHeadOpenTimeLongVal));
|
|
|
|
- time.setTimeCost((int)(openTime.getTime() - aHeadOpenTimeLongVal));
|
|
|
|
|
|
+ } else {
|
|
|
|
+ logger.info("本次开合周期--" + (openTime.getTime() - aHeadOpenTimeLongVal));
|
|
|
|
+ time.setTimeCost((int) (openTime.getTime() - aHeadOpenTimeLongVal));
|
|
}
|
|
}
|
|
mouldHistoryTimeMapper.insertSelective(time);
|
|
mouldHistoryTimeMapper.insertSelective(time);
|
|
- //处理周期逻辑
|
|
|
|
- handleMouldCycleRuntimeLogic(openTime,item);
|
|
|
|
|
|
+ // 处理周期逻辑
|
|
|
|
+ handleMouldCycleRuntimeLogic(openTime, item);
|
|
logger.info("mouldHistoryTime数据添加完毕");
|
|
logger.info("mouldHistoryTime数据添加完毕");
|
|
aHeadOpenTimeLongVal = openTime.getTime();
|
|
aHeadOpenTimeLongVal = openTime.getTime();
|
|
- logger.info("上一包数据的开合时间戳--"+aHeadOpenTimeLongVal);
|
|
|
|
|
|
+ logger.info("上一包数据的开合时间戳--" + aHeadOpenTimeLongVal);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
logger.info("本次开合模次数==0");
|
|
logger.info("本次开合模次数==0");
|
|
@@ -222,27 +222,29 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
List<MouldHistoryTime> historyList = mouldHistoryTimeMapper.selectByExample(mtExp);
|
|
List<MouldHistoryTime> historyList = mouldHistoryTimeMapper.selectByExample(mtExp);
|
|
int avgTime = 0;
|
|
int avgTime = 0;
|
|
int totalTime = 0;
|
|
int totalTime = 0;
|
|
-// if (historyList.size() == 1) {
|
|
|
|
-// // 证明盒子动了,找寻上一条记录
|
|
|
|
-// if (newList.size() > 0) {
|
|
|
|
-// MouldHistoryTime now = historyList.get(0);
|
|
|
|
-// MouldHistoryTime last = mouldHistoryTimeMapper.getDateByHistory(newList.get(0).getId());
|
|
|
|
-// if (null != now && null != last) {
|
|
|
|
-// avgTime = (int)((now.getOpenTime().getTime()) - (last.getOpenTime().getTime()));
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// } else {
|
|
|
|
- if (historyList.size() > 1) {
|
|
|
|
- for (int j = 0; j < historyList.size() - 1; j++) {
|
|
|
|
- totalTime += (historyList.get(j + 1).getOpenTime().getTime()
|
|
|
|
- - historyList.get(j).getOpenTime().getTime());
|
|
|
|
- }
|
|
|
|
- logger.info("totalTime" + totalTime);
|
|
|
|
- avgTime = (int)(totalTime / (historyList.size() - 1));
|
|
|
|
|
|
+ // if (historyList.size() == 1) {
|
|
|
|
+ // // 证明盒子动了,找寻上一条记录
|
|
|
|
+ // if (newList.size() > 0) {
|
|
|
|
+ // MouldHistoryTime now = historyList.get(0);
|
|
|
|
+ // MouldHistoryTime last =
|
|
|
|
+ // mouldHistoryTimeMapper.getDateByHistory(newList.get(0).getId());
|
|
|
|
+ // if (null != now && null != last) {
|
|
|
|
+ // avgTime = (int)((now.getOpenTime().getTime()) -
|
|
|
|
+ // (last.getOpenTime().getTime()));
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ if (historyList.size() > 1) {
|
|
|
|
+ for (int j = 0; j < historyList.size() - 1; j++) {
|
|
|
|
+ totalTime += (historyList.get(j + 1).getOpenTime().getTime()
|
|
|
|
+ - historyList.get(j).getOpenTime().getTime());
|
|
}
|
|
}
|
|
-// }
|
|
|
|
|
|
+ logger.info("totalTime" + totalTime);
|
|
|
|
+ avgTime = (int) (totalTime / (historyList.size() - 1));
|
|
|
|
+ }
|
|
|
|
+ // }
|
|
logger.info("avgTime-->" + avgTime);
|
|
logger.info("avgTime-->" + avgTime);
|
|
-
|
|
|
|
|
|
+
|
|
handleModLogic(item, avgTime);
|
|
handleModLogic(item, avgTime);
|
|
// 判断预留字节的
|
|
// 判断预留字节的
|
|
if ("02".equals(mobilePart)) {
|
|
if ("02".equals(mobilePart)) {
|
|
@@ -266,9 +268,16 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
List<MouldDownPacket> list = mouldDownPacketMapper.selectByExample(exp);
|
|
List<MouldDownPacket> list = mouldDownPacketMapper.selectByExample(exp);
|
|
if (list.size() > 0) {
|
|
if (list.size() > 0) {
|
|
MouldDownPacket packet = list.get(0);
|
|
MouldDownPacket packet = list.get(0);
|
|
- if (0 == packet.getIsUse()) {
|
|
|
|
- logger.info("开始下发数据包==>" + packet.getPacketStr());
|
|
|
|
- sendMsg(packet.getPacketStr());
|
|
|
|
|
|
+ TbMouldEquipmentExample meqExp = new TbMouldEquipmentExample();
|
|
|
|
+ meqExp.createCriteria().andEquipmentNoEqualTo(equipmentNo);
|
|
|
|
+ long count = tbMouldEquipmentMapper.countByExample(meqExp);
|
|
|
|
+ // 下发数据包,下发完后修改状态
|
|
|
|
+ logger.info("开始下发数据包==>" + packet.getPacketStr());
|
|
|
|
+ sendMsg(packet.getPacketStr());
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ TbMouldEquipment me = tbMouldEquipmentMapper.selectByExample(meqExp).get(0);
|
|
|
|
+ me.setIsUse(packet.getIsUse());
|
|
|
|
+ tbMouldEquipmentMapper.updateByPrimaryKeySelective(me);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -294,7 +303,7 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
|
|
|
|
private void handleModLogic(MouldHistory item, int avgTime) {
|
|
private void handleModLogic(MouldHistory item, int avgTime) {
|
|
logger.info("进了handleModLogic逻辑--");
|
|
logger.info("进了handleModLogic逻辑--");
|
|
- logger.info("item==>"+item);
|
|
|
|
|
|
+ logger.info("item==>" + item);
|
|
TbMouldEquipmentExample meqExp = new TbMouldEquipmentExample();
|
|
TbMouldEquipmentExample meqExp = new TbMouldEquipmentExample();
|
|
meqExp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo());
|
|
meqExp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo());
|
|
if (tbMouldEquipmentMapper.countByExample(meqExp) > 0) {
|
|
if (tbMouldEquipmentMapper.countByExample(meqExp) > 0) {
|
|
@@ -361,15 +370,18 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
}
|
|
}
|
|
|
|
|
|
private static Date parseDate(String input, int start, int pos, int dateStartPos) {
|
|
private static Date parseDate(String input, int start, int pos, int dateStartPos) {
|
|
- //pos为开合的一组的下标,一个开合时间占位是12*2
|
|
|
|
|
|
+ // pos为开合的一组的下标,一个开合时间占位是12*2
|
|
String year = input.substring((start + pos * 12 + dateStartPos) * 2, (start + pos * 12 + 1 + dateStartPos) * 2);
|
|
String year = input.substring((start + pos * 12 + dateStartPos) * 2, (start + pos * 12 + 1 + dateStartPos) * 2);
|
|
String month = input.substring((start + pos * 12 + 1 + dateStartPos) * 2,
|
|
String month = input.substring((start + pos * 12 + 1 + dateStartPos) * 2,
|
|
(start + pos * 12 + 2 + dateStartPos) * 2);
|
|
(start + pos * 12 + 2 + dateStartPos) * 2);
|
|
String day = input.substring((start + pos * 12 + 2 + dateStartPos) * 2,
|
|
String day = input.substring((start + pos * 12 + 2 + dateStartPos) * 2,
|
|
(start + pos * 12 + 3 + dateStartPos) * 2);
|
|
(start + pos * 12 + 3 + dateStartPos) * 2);
|
|
- String hh = input.substring((start + pos * 12 + 3 + dateStartPos) * 2, (start + pos * 12 + 4 + dateStartPos) * 2);
|
|
|
|
- String mm = input.substring((start + pos * 12 + 4 + dateStartPos) * 2, (start + pos * 12 + 5 + dateStartPos) * 2);
|
|
|
|
- String ss = input.substring((start + pos * 12 + 5 + dateStartPos) * 2, (start + pos * 12 + 6 + dateStartPos) * 2);
|
|
|
|
|
|
+ String hh = input.substring((start + pos * 12 + 3 + dateStartPos) * 2,
|
|
|
|
+ (start + pos * 12 + 4 + dateStartPos) * 2);
|
|
|
|
+ String mm = input.substring((start + pos * 12 + 4 + dateStartPos) * 2,
|
|
|
|
+ (start + pos * 12 + 5 + dateStartPos) * 2);
|
|
|
|
+ String ss = input.substring((start + pos * 12 + 5 + dateStartPos) * 2,
|
|
|
|
+ (start + pos * 12 + 6 + dateStartPos) * 2);
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|
|
int yearInt = Integer.parseInt(year, 16);
|
|
int yearInt = Integer.parseInt(year, 16);
|
|
if (yearInt == 0) {
|
|
if (yearInt == 0) {
|
|
@@ -394,86 +406,88 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
}
|
|
}
|
|
return parseDate;
|
|
return parseDate;
|
|
}
|
|
}
|
|
-
|
|
|
|
- private void handleMouldCycleRuntimeLogic(Date openTime,MouldHistory item) throws ParseException{
|
|
|
|
|
|
+
|
|
|
|
+ private void handleMouldCycleRuntimeLogic(Date openTime, MouldHistory item) throws ParseException {
|
|
MouldCycleRuntime mcr = new MouldCycleRuntime();
|
|
MouldCycleRuntime mcr = new MouldCycleRuntime();
|
|
Integer hours = openTime.getHours();
|
|
Integer hours = openTime.getHours();
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:");
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:");
|
|
- int housTime = openTime.getHours()-1;
|
|
|
|
|
|
+ int housTime = openTime.getHours() - 1;
|
|
openTime.setHours(housTime);
|
|
openTime.setHours(housTime);
|
|
String lastOpenTime = sdf.format(openTime);
|
|
String lastOpenTime = sdf.format(openTime);
|
|
- Date lastOpenTimeDate = sdf1.parse(lastOpenTime+"59:59");
|
|
|
|
|
|
+ Date lastOpenTimeDate = sdf1.parse(lastOpenTime + "59:59");
|
|
MouldHistoryTimeExample mExp = new MouldHistoryTimeExample();
|
|
MouldHistoryTimeExample mExp = new MouldHistoryTimeExample();
|
|
mExp.setOrderByClause("open_time desc limit 1");
|
|
mExp.setOrderByClause("open_time desc limit 1");
|
|
- mExp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo()).andOpenTimeLessThanOrEqualTo(lastOpenTimeDate);
|
|
|
|
|
|
+ mExp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo())
|
|
|
|
+ .andOpenTimeLessThanOrEqualTo(lastOpenTimeDate);
|
|
List<MouldHistoryTime> list = mouldHistoryTimeMapper.selectByExample(mExp);
|
|
List<MouldHistoryTime> list = mouldHistoryTimeMapper.selectByExample(mExp);
|
|
- if(list.size()>0){
|
|
|
|
|
|
+ if (list.size() > 0) {
|
|
MouldHistory mouldHistory = mouldHistoryMapper.selectByPrimaryKey(list.get(0).getHistoryId());
|
|
MouldHistory mouldHistory = mouldHistoryMapper.selectByPrimaryKey(list.get(0).getHistoryId());
|
|
mcr.setDateStr(sdf.format(openTime));
|
|
mcr.setDateStr(sdf.format(openTime));
|
|
mcr.setEquipmentNo(item.getEquipmentNo());
|
|
mcr.setEquipmentNo(item.getEquipmentNo());
|
|
mcr.setRuntime(item.getRunCnt() - mouldHistory.getRunCnt());
|
|
mcr.setRuntime(item.getRunCnt() - mouldHistory.getRunCnt());
|
|
- if(hours==0){
|
|
|
|
|
|
+ if (hours == 0) {
|
|
mcr.setTimeSlot("00:00-01:00");
|
|
mcr.setTimeSlot("00:00-01:00");
|
|
- }else if(hours==1){
|
|
|
|
|
|
+ } else if (hours == 1) {
|
|
mcr.setTimeSlot("01:00-02:00");
|
|
mcr.setTimeSlot("01:00-02:00");
|
|
- }else if(hours==2){
|
|
|
|
|
|
+ } else if (hours == 2) {
|
|
mcr.setTimeSlot("02:00-03:00");
|
|
mcr.setTimeSlot("02:00-03:00");
|
|
- }else if(hours==3){
|
|
|
|
|
|
+ } else if (hours == 3) {
|
|
mcr.setTimeSlot("03:00-04:00");
|
|
mcr.setTimeSlot("03:00-04:00");
|
|
- }else if(hours==4){
|
|
|
|
|
|
+ } else if (hours == 4) {
|
|
mcr.setTimeSlot("04:00-05:00");
|
|
mcr.setTimeSlot("04:00-05:00");
|
|
- }else if(hours==5){
|
|
|
|
|
|
+ } else if (hours == 5) {
|
|
mcr.setTimeSlot("05:00-06:00");
|
|
mcr.setTimeSlot("05:00-06:00");
|
|
- }else if(hours==6){
|
|
|
|
|
|
+ } else if (hours == 6) {
|
|
mcr.setTimeSlot("06:00-07:00");
|
|
mcr.setTimeSlot("06:00-07:00");
|
|
- }else if(hours==7){
|
|
|
|
|
|
+ } else if (hours == 7) {
|
|
mcr.setTimeSlot("07:00-08:00");
|
|
mcr.setTimeSlot("07:00-08:00");
|
|
- }else if(hours==8){
|
|
|
|
|
|
+ } else if (hours == 8) {
|
|
mcr.setTimeSlot("08:00-09:00");
|
|
mcr.setTimeSlot("08:00-09:00");
|
|
- }else if(hours==9){
|
|
|
|
|
|
+ } else if (hours == 9) {
|
|
mcr.setTimeSlot("09:00-10:00");
|
|
mcr.setTimeSlot("09:00-10:00");
|
|
- }else if(hours==10){
|
|
|
|
|
|
+ } else if (hours == 10) {
|
|
mcr.setTimeSlot("10:00-11:00");
|
|
mcr.setTimeSlot("10:00-11:00");
|
|
- }else if(hours==11){
|
|
|
|
|
|
+ } else if (hours == 11) {
|
|
mcr.setTimeSlot("11:00-12:00");
|
|
mcr.setTimeSlot("11:00-12:00");
|
|
- }else if(hours==12){
|
|
|
|
|
|
+ } else if (hours == 12) {
|
|
mcr.setTimeSlot("12:00-13:00");
|
|
mcr.setTimeSlot("12:00-13:00");
|
|
- }else if(hours==13){
|
|
|
|
|
|
+ } else if (hours == 13) {
|
|
mcr.setTimeSlot("13:00-14:00");
|
|
mcr.setTimeSlot("13:00-14:00");
|
|
- }else if(hours==14){
|
|
|
|
|
|
+ } else if (hours == 14) {
|
|
mcr.setTimeSlot("14:00-15:00");
|
|
mcr.setTimeSlot("14:00-15:00");
|
|
- }else if(hours==15){
|
|
|
|
|
|
+ } else if (hours == 15) {
|
|
mcr.setTimeSlot("15:00-16:00");
|
|
mcr.setTimeSlot("15:00-16:00");
|
|
- }else if(hours==16){
|
|
|
|
|
|
+ } else if (hours == 16) {
|
|
mcr.setTimeSlot("16:00-17:00");
|
|
mcr.setTimeSlot("16:00-17:00");
|
|
- }else if(hours==17){
|
|
|
|
|
|
+ } else if (hours == 17) {
|
|
mcr.setTimeSlot("17:00-18:00");
|
|
mcr.setTimeSlot("17:00-18:00");
|
|
- }else if(hours==18){
|
|
|
|
|
|
+ } else if (hours == 18) {
|
|
mcr.setTimeSlot("18:00-19:00");
|
|
mcr.setTimeSlot("18:00-19:00");
|
|
- }else if(hours==19){
|
|
|
|
|
|
+ } else if (hours == 19) {
|
|
mcr.setTimeSlot("19:00-20:00");
|
|
mcr.setTimeSlot("19:00-20:00");
|
|
- }else if(hours==20){
|
|
|
|
|
|
+ } else if (hours == 20) {
|
|
mcr.setTimeSlot("20:00-21:00");
|
|
mcr.setTimeSlot("20:00-21:00");
|
|
- }else if(hours==21){
|
|
|
|
|
|
+ } else if (hours == 21) {
|
|
mcr.setTimeSlot("21:00-22:00");
|
|
mcr.setTimeSlot("21:00-22:00");
|
|
- }else if(hours==22){
|
|
|
|
|
|
+ } else if (hours == 22) {
|
|
mcr.setTimeSlot("22:00-23:00");
|
|
mcr.setTimeSlot("22:00-23:00");
|
|
- }else if(hours==23){
|
|
|
|
|
|
+ } else if (hours == 23) {
|
|
mcr.setTimeSlot("23:00-00:00");
|
|
mcr.setTimeSlot("23:00-00:00");
|
|
}
|
|
}
|
|
MouldCycleRuntimeExample mcrExp = new MouldCycleRuntimeExample();
|
|
MouldCycleRuntimeExample mcrExp = new MouldCycleRuntimeExample();
|
|
- mcrExp.createCriteria().andDateStrEqualTo(mcr.getDateStr()).andEquipmentNoEqualTo(item.getEquipmentNo()).andTimeSlotEqualTo(mcr.getTimeSlot());
|
|
|
|
|
|
+ mcrExp.createCriteria().andDateStrEqualTo(mcr.getDateStr()).andEquipmentNoEqualTo(item.getEquipmentNo())
|
|
|
|
+ .andTimeSlotEqualTo(mcr.getTimeSlot());
|
|
List<MouldCycleRuntime> mList = mouldCycleRuntimeMapper.selectByExample(mcrExp);
|
|
List<MouldCycleRuntime> mList = mouldCycleRuntimeMapper.selectByExample(mcrExp);
|
|
- if(mList.size()>0){
|
|
|
|
|
|
+ if (mList.size() > 0) {
|
|
mcr.setId(mList.get(0).getId());
|
|
mcr.setId(mList.get(0).getId());
|
|
mouldCycleRuntimeMapper.updateByPrimaryKeySelective(mcr);
|
|
mouldCycleRuntimeMapper.updateByPrimaryKeySelective(mcr);
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
mouldCycleRuntimeMapper.insertSelective(mcr);
|
|
mouldCycleRuntimeMapper.insertSelective(mcr);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private static String getStringFromHexStr(String hexStr) {
|
|
private static String getStringFromHexStr(String hexStr) {
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|
|
for (int i = 0; i < hexStr.length() / 2; i++) {
|
|
for (int i = 0; i < hexStr.length() / 2; i++) {
|
|
@@ -610,12 +624,12 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws ParseException {
|
|
public static void main(String[] args) throws ParseException {
|
|
-// UserHandler h = new UserHandler();
|
|
|
|
-// h.timeCalibration();
|
|
|
|
|
|
+ // UserHandler h = new UserHandler();
|
|
|
|
+ // h.timeCalibration();
|
|
String a = "00:25:32";
|
|
String a = "00:25:32";
|
|
SimpleDateFormat s = new SimpleDateFormat("HH:mm:ss");
|
|
SimpleDateFormat s = new SimpleDateFormat("HH:mm:ss");
|
|
Date d = new Date();
|
|
Date d = new Date();
|
|
-// System.out.println(s.parse(a).getHours());
|
|
|
|
|
|
+ // System.out.println(s.parse(a).getHours());
|
|
// Date date = new Date();
|
|
// Date date = new Date();
|
|
// SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd,HH:mm:ss");
|
|
// SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd,HH:mm:ss");
|
|
// String dateStr = sdf.format(date);
|
|
// String dateStr = sdf.format(date);
|
|
@@ -628,8 +642,7 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
|
|
|
|
// String str = "1F51";
|
|
// String str = "1F51";
|
|
String input = "FAAF530000000000000000000000003137333030303239343310010000000000000000000"
|
|
String input = "FAAF530000000000000000000000003137333030303239343310010000000000000000000"
|
|
- + "000000000000000000000001F51E85F00000000000045004A"
|
|
|
|
- + "54000100110000001308160F171F1308160F2D188FCA";
|
|
|
|
|
|
+ + "000000000000000000000001F51E85F00000000000045004A" + "54000100110000001308160F171F1308160F2D188FCA";
|
|
// String temp = "0x"+str;
|
|
// String temp = "0x"+str;
|
|
// int i = Integer.decode(temp);
|
|
// int i = Integer.decode(temp);
|
|
// System.out.println(i);
|
|
// System.out.println(i);
|
|
@@ -639,29 +652,29 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
// System.out.println(str.substring(69*2));
|
|
// System.out.println(str.substring(69*2));
|
|
// Date d = parseDate(str, start, 0, 0);
|
|
// Date d = parseDate(str, start, 0, 0);
|
|
// System.out.println(d.toGMTString());
|
|
// System.out.println(d.toGMTString());
|
|
-// int start = 69;
|
|
|
|
-// int end = input.length() - 4; // 最后2位 0xXX,0xXX ,是CRC校验位
|
|
|
|
-// logger.info("时间信息==" + input.substring(start * 2, end));
|
|
|
|
-// if (end - start * 2 >= 24) {// 时间最少6位,1位显示0x00,开合算两个时间,所以是6*2*2=24
|
|
|
|
-// // 本次运行周期内的开合模次数
|
|
|
|
-// int periodCnt = (end - start * 2) / 24;
|
|
|
|
-// logger.info("本次开合模次数==" + periodCnt);
|
|
|
|
-// for (int pos = 0; pos < periodCnt; pos++) {
|
|
|
|
-// // 合模时间
|
|
|
|
-// MouldHistoryTime time = new MouldHistoryTime();
|
|
|
|
-// time.setSeq(pos + 1);
|
|
|
|
-// Date closeTime = parseDate(input, start, pos, 0);
|
|
|
|
-// System.out.println(closeTime);
|
|
|
|
-// time.setCloseTime(closeTime);
|
|
|
|
-// // 开模时间
|
|
|
|
-// Date openTime = parseDate(input, start, pos, 6);
|
|
|
|
-// time.setOpenTime(openTime);
|
|
|
|
-// System.out.println(openTime);
|
|
|
|
-// int timeCost = (int) (openTime.getTime() - closeTime.getTime());
|
|
|
|
-// time.setTimeCost(timeCost);
|
|
|
|
-// }
|
|
|
|
-// } else {
|
|
|
|
-// logger.info("本次开合模次数==0");
|
|
|
|
-// }
|
|
|
|
|
|
+ // int start = 69;
|
|
|
|
+ // int end = input.length() - 4; // 最后2位 0xXX,0xXX ,是CRC校验位
|
|
|
|
+ // logger.info("时间信息==" + input.substring(start * 2, end));
|
|
|
|
+ // if (end - start * 2 >= 24) {// 时间最少6位,1位显示0x00,开合算两个时间,所以是6*2*2=24
|
|
|
|
+ // // 本次运行周期内的开合模次数
|
|
|
|
+ // int periodCnt = (end - start * 2) / 24;
|
|
|
|
+ // logger.info("本次开合模次数==" + periodCnt);
|
|
|
|
+ // for (int pos = 0; pos < periodCnt; pos++) {
|
|
|
|
+ // // 合模时间
|
|
|
|
+ // MouldHistoryTime time = new MouldHistoryTime();
|
|
|
|
+ // time.setSeq(pos + 1);
|
|
|
|
+ // Date closeTime = parseDate(input, start, pos, 0);
|
|
|
|
+ // System.out.println(closeTime);
|
|
|
|
+ // time.setCloseTime(closeTime);
|
|
|
|
+ // // 开模时间
|
|
|
|
+ // Date openTime = parseDate(input, start, pos, 6);
|
|
|
|
+ // time.setOpenTime(openTime);
|
|
|
|
+ // System.out.println(openTime);
|
|
|
|
+ // int timeCost = (int) (openTime.getTime() - closeTime.getTime());
|
|
|
|
+ // time.setTimeCost(timeCost);
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // logger.info("本次开合模次数==0");
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
}
|
|
}
|