rev: 半条任务与全任务、mes对接的部分日志记录
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
package org.nl.ext;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.wms.ext.mes.service.WmsToMesService;
|
||||
import org.nl.wms.ext.mes.service.dao.mapper.MesRequestMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
@@ -56,4 +60,55 @@ public class TestDemo {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2() {
|
||||
wmsToMesService.reportProductData("1700746947708719104");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 静置时长(分钟)
|
||||
int staticDurationMinutes = 60;
|
||||
// 入库时间
|
||||
String inputDateString = "2023-09-15 11:55:01";
|
||||
|
||||
// 创建SimpleDateFormat以解析日期时间字符串
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
try {
|
||||
// 将输入日期时间字符串解析为Date对象
|
||||
Date inputDate = dateFormat.parse(inputDateString);
|
||||
|
||||
// 获取当前时间
|
||||
Date currentDate = new Date();
|
||||
|
||||
// 计算距离静置完成还有多少毫秒
|
||||
long timeDifferenceMillis = inputDate.getTime() + (staticDurationMinutes * 60 * 1000) - currentDate.getTime();
|
||||
|
||||
// 将毫秒转换为分钟
|
||||
long timeDifferenceMinutes = timeDifferenceMillis / (60 * 1000);
|
||||
// 计算预计完成时间
|
||||
Date estimatedCompletionTime = new Date(currentDate.getTime() + timeDifferenceMillis);
|
||||
|
||||
// 格式化预计完成时间为字符串
|
||||
String estimatedCompletionTimeString = dateFormat.format(estimatedCompletionTime);
|
||||
|
||||
|
||||
System.out.println("距离静置完成还有 " + timeDifferenceMinutes + " 分钟");
|
||||
System.out.println("预计完成时间为:" + estimatedCompletionTimeString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void test03() throws InterruptedException {
|
||||
// for (int i = 0; i < 50; i++) {
|
||||
// System.out.println("生成标识code: " + CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
// Thread.sleep(1000);
|
||||
// }
|
||||
// for (int i = 0; i < 5; i++) {
|
||||
// new Thread(() -> System.out.println("生成标识code: " + CodeUtil.getNewCode("PDM_SHIFTORDER"))).start();
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user