diff --git a/src/app/api/upload/route.js b/src/app/api/upload/route.js index ee45567..e9eb77d 100644 --- a/src/app/api/upload/route.js +++ b/src/app/api/upload/route.js @@ -203,7 +203,7 @@ export async function POST(request) { ); const spectralData = await readIntervalSpectralData( - new Date(requestData.measureStartDatetime).getTime(), + new Date(requestData.measureStartDatetime).getTime() - 10 * 1000, //前10秒的数据 new Date(requestData.measureEndDatetime).getTime() ); diff --git a/src/app/upload/page.js b/src/app/upload/page.js index 4118b90..9b2d139 100644 --- a/src/app/upload/page.js +++ b/src/app/upload/page.js @@ -46,17 +46,17 @@ export default function Upload() { // }; // }, []); - const [furnaceNumber, setFurnaceNumber] = useState(98213234); + const [furnaceNumber, setFurnaceNumber] = useState(24609); const handleFurnaceNumberChange = (event) => { setFurnaceNumber(event.target.value); }; - const getCurrentDateTime = () => { + const getDeayledCurrentDateTime = (interval = 0) => { let now = new Date(); // 将时间转换为 UTC+8 时区 - // const offset = 8 * 60 * 60 * 1000; // 8 小时的毫秒数 - // now = new Date(now.getTime() + offset); + const offset = interval * 1000; // 8 小时的毫秒数 + now = new Date(now.getTime() + offset); const year = now.getFullYear(); const month = String(now.getMonth() + 1).padStart(2, "0"); const day = String(now.getDate()).padStart(2, "0"); @@ -68,12 +68,12 @@ export default function Upload() { const [measureStartDatetime, setMeasureStartDatetime] = useState( // "2024-09-26T14:40:00" - getCurrentDateTime() + getDeayledCurrentDateTime(0) ); const [measureEndDatetime, setMeasureEndDatetime] = useState( // "2024-09-26T14:29:00" - getCurrentDateTime() + getDeayledCurrentDateTime(20) ); const handleMeasureEndDatetimeChange = (event) => { @@ -126,13 +126,13 @@ export default function Upload() { setUploadType(event.target.value); }; - const [stellType, setStellType] = useState(""); + const [stellType, setStellType] = useState("HRB400"); const handleStellTypeChange = (event) => { setStellType(event.target.value); }; - const [remark, setRemark] = useState(""); + const [remark, setRemark] = useState("正常炼钢"); const handleRemarkChange = (event) => { setRemark(event.target.value);