|
@@ -233,8 +233,10 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
|
time.setTimeCost((int) (openTime.getTime() - aHeadOpenTimeLongVal));
|
|
|
}
|
|
|
mouldHistoryTimeMapper.insertSelective(time);
|
|
|
- // 处理周期逻辑
|
|
|
- handleMouldCycleRuntimeLogic(openTime, item);
|
|
|
+ // 处理最后一包周期逻辑
|
|
|
+ if(pos==periodCnt-1){
|
|
|
+ handleMouldCycleRuntimeLogic(openTime, item);
|
|
|
+ }
|
|
|
logger.info("mouldHistoryTime数据添加完毕");
|
|
|
aHeadOpenTimeLongVal = openTime.getTime();
|
|
|
logger.info("上一包数据的开合时间戳--" + aHeadOpenTimeLongVal);
|
|
@@ -453,19 +455,21 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
|
|
|
}
|
|
|
|
|
|
private void handleMouldCycleRuntimeLogic(Date openTime, MouldHistory item) throws ParseException {
|
|
|
+ System.out.println("开始handleMouldCycleRuntimeLogic逻辑开合时间"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(openTime));
|
|
|
MouldCycleRuntime mcr = new MouldCycleRuntime();
|
|
|
Integer hours = openTime.getHours();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:");
|
|
|
int housTime = openTime.getHours() - 1;
|
|
|
openTime.setHours(housTime);
|
|
|
- String lastOpenTime = sdf.format(openTime);
|
|
|
+ String lastOpenTime = sdf1.format(openTime);
|
|
|
Date lastOpenTimeDate = sdf1.parse(lastOpenTime + "59:59");
|
|
|
MouldHistoryTimeExample mExp = new MouldHistoryTimeExample();
|
|
|
mExp.setOrderByClause("open_time desc limit 1");
|
|
|
mExp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo())
|
|
|
.andOpenTimeLessThanOrEqualTo(lastOpenTimeDate);
|
|
|
List<MouldHistoryTime> list = mouldHistoryTimeMapper.selectByExample(mExp);
|
|
|
+ logger.info("满足条件的上一个小数数据集合长度:"+list.size());
|
|
|
if (list.size() > 0) {
|
|
|
MouldHistory mouldHistory = mouldHistoryMapper.selectByPrimaryKey(list.get(0).getHistoryId());
|
|
|
logger.info("本次运行次数: " + item.getRunCnt()+" 上一小时的运行次数:"+mouldHistory.getRunCnt()+" 上一小时的historyId:"+mouldHistory.getId());
|