diff --git a/inventory-check.html b/inventory-check.html index 92e15d0..5e0fc29 100644 --- a/inventory-check.html +++ b/inventory-check.html @@ -17,13 +17,19 @@ min-height: 100vh; } .container { - max-width: 600px; + max-width: 900px; margin: 0 auto; background: white; padding: 30px; border-radius: 12px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); } + + .form-row { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 20px; + } h1 { text-align: center; margin-bottom: 25px; @@ -237,14 +243,26 @@

盘点/随行工具

-
- - -
- -
- - +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
@@ -275,6 +293,8 @@ const loopToggle = document.getElementById('loopToggle'); const countInput = document.getElementById('countInput'); const specInput = document.getElementById('specInput'); + const trayCodeInput = document.getElementById('trayCodeInput'); + const scanCodeInput = document.getElementById('scanCodeInput'); const status = document.getElementById('status'); const progressBar = document.getElementById('progressBar'); const logContainer = document.getElementById('logContainer'); @@ -282,6 +302,7 @@ let isExecuting = false; let shouldStop = false; let currentTaskId = ''; // 当前任务ID,同一轮内保持一致 + let currentBatchNumber = ''; // 当前批次号,循环模式下同一轮内保持不变 // 生成新的 taskId(基于时间戳) function generateTaskId() { @@ -298,6 +319,20 @@ return `${year}${month}${day}-${hours}${minutes}${seconds}-${ms}`; } + // 生成批次号(基于时间戳) + function generateBatchNumber() { + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + const day = String(now.getDate()).padStart(2, '0'); + const hours = String(now.getHours()).padStart(2, '0'); + const minutes = String(now.getMinutes()).padStart(2, '0'); + const seconds = String(now.getSeconds()).padStart(2, '0'); + const ms = String(now.getMilliseconds()).padStart(3, '0'); + + return `BN${year}${month}${day}${hours}${minutes}${seconds}${ms}`; + } + // 写死的接口列表 const checkList = [ { @@ -334,15 +369,15 @@ shelfCode: '', pltCode: '', countNumber: '', // 个数 - wmsCode: 'UR202606', - wmsTrayCode: 'UR202606', + wmsCode: '{code}', + wmsTrayCode: '{trayCode}', wmsCategory: '', wmsCount: '', wmsItemCode: '{spec}', wmsShelfCode: '', wmsPltCode: '', wmsCountNumber: '{count}', - batchNumber: '', + batchNumber: '{batchNumber}', extendInfo: null }, timeout: 0 @@ -389,7 +424,7 @@ wmsShelfCode: '', wmsPltCode: '', wmsCountNumber: '{count}', - batchNumber: '', + batchNumber: '{batchNumber}', extendInfo: null }, timeout: 0 @@ -404,8 +439,8 @@ const followList = [ { - name: '货物放回', - url: 'http://192.168.100.99:8083/retract', + name: '货物归位', + url: 'http://192.168.100.99:8083/extend', method: 'GET', timeout: 0 }, @@ -445,7 +480,7 @@ wmsShelfCode: '', wmsPltCode: '', wmsCountNumber: '{count}', - batchNumber: '', + batchNumber: '{batchNumber}', extendInfo: null }, timeout: 0 @@ -486,14 +521,14 @@ wmsShelfCode: '', wmsPltCode: '', wmsCountNumber: '{count}', - batchNumber: '', + batchNumber: '{batchNumber}', extendInfo: null }, timeout: 0 }, { name: '货物拉出', - url: 'http://192.168.100.99:8083/extend', + url: 'http://192.168.100.99:8083/retract', method: 'GET', timeout: 0 }, @@ -533,7 +568,7 @@ wmsShelfCode: '', wmsPltCode: '', wmsCountNumber: '{count}', - batchNumber: '', + batchNumber: '{batchNumber}', extendInfo: null }, timeout: 0 @@ -574,14 +609,14 @@ wmsShelfCode: '', wmsPltCode: '', wmsCountNumber: '{count}', - batchNumber: '', + batchNumber: '{batchNumber}', extendInfo: null }, timeout: 0 }, { name: '货物放回', - url: 'http://192.168.100.99:8083/retract', + url: 'http://192.168.100.99:8083/extend', method: 'GET', timeout: 0 } @@ -622,7 +657,7 @@ wmsShelfCode: '', wmsPltCode: '', wmsCountNumber: '{count}', - batchNumber: '', + batchNumber: '{batchNumber}', extendInfo: null }, timeout: 0 @@ -663,11 +698,17 @@ wmsShelfCode: '', wmsPltCode: '', wmsCountNumber: '{count}', - batchNumber: '', + batchNumber: '{batchNumber}', extendInfo: null }, timeout: 0 }, + { + name: '货物放回', + url: 'http://192.168.100.99:8083/retract', + method: 'GET', + timeout: 0 + } ]; // 格式化时间 @@ -690,7 +731,7 @@ } // 替换参数中的占位符 - function replaceParams(params, count, spec, taskId) { + function replaceParams(params, count, spec, code, trayCode, taskId, batchNumber) { if (!params) return {}; const result = {}; for (const key in params) { @@ -699,7 +740,10 @@ result[key] = value .replace('{count}', count) .replace('{spec}', spec) - .replace('{taskId}', taskId); + .replace('{code}', code) + .replace('{trayCode}', trayCode) + .replace('{taskId}', taskId) + .replace('{batchNumber}', batchNumber); } else { result[key] = value; } @@ -708,17 +752,19 @@ } // 执行单个请求 - async function executeRequest(item, taskId) { + async function executeRequest(item, taskId, batchNumber) { let url = item.url; const name = item.name; const count = parseInt(countInput.value) || 21; const spec = specInput.value || '0143'; + const code = scanCodeInput.value || 'UR202606'; + const trayCode = trayCodeInput.value || 'UR202606'; const method = item.method || 'POST'; const baseParams = item.params || {}; const timeout = item.timeout || 0; // 0 表示不超时 - // 替换参数中的占位符(包括 taskId) - const params = replaceParams(baseParams, count, spec, taskId); + // 替换参数中的占位符(包括 taskId 和 batchNumber) + const params = replaceParams(baseParams, count, spec, code, trayCode, taskId, batchNumber); const startTime = new Date(); addLog(`[${formatTime(startTime)}] ${name} 开始 [${method}]`); @@ -786,14 +832,14 @@ } // 执行列表 - async function executeList(list, type, taskId) { + async function executeList(list, type, taskId, batchNumber) { const totalSteps = list.length; for (let i = 0; i < totalSteps; i++) { status.textContent = `${type === 'check' ? '盘点' : '随行'}中: ${i + 1}/${totalSteps} - ${list[i].name}`; progressBar.style.width = `${((i + 1) / totalSteps) * 100}%`; - await executeRequest(list[i], taskId); + await executeRequest(list[i], taskId, batchNumber); // 每个请求完成后延时 0.5 秒 await new Promise(resolve => setTimeout(resolve, 500)); @@ -814,15 +860,19 @@ activeBtn.textContent = '执行中...'; let loopCount = 0; + // 循环模式下生成批次号且保持不变,非循环模式每次重新生成 + if (!isLoop || !currentBatchNumber) { + currentBatchNumber = generateBatchNumber(); + } try { do { loopCount++; // 每一轮生成新的 taskId currentTaskId = generateTaskId(); - addLog(`[${formatTime(new Date())}] ========== 第 ${loopCount} ${type === 'check' ? '盘点' : '随行'} ========== (taskId: ${currentTaskId})`); + addLog(`[${formatTime(new Date())}] ========== 第 ${loopCount} ${type === 'check' ? '盘点' : '随行'} ========== (taskId: ${currentTaskId}, batch: ${currentBatchNumber})`); - await executeList(list, type, currentTaskId); + await executeList(list, type, currentTaskId, currentBatchNumber); if (shouldStop) { addLog(`[${formatTime(new Date())}] ========== 用户停止 ==========`); diff --git a/src/api/annotation/datas/index.ts b/src/api/annotation/datas/index.ts index 70b8aa0..d0f0641 100644 --- a/src/api/annotation/datas/index.ts +++ b/src/api/annotation/datas/index.ts @@ -85,4 +85,14 @@ export const DatasApi = { exportModel: async (id: number) => { return await request.download({ url: `/annotation/datas/export-model?id=` + id }) }, + + // 启动训练 + startTrain: async (id: number) => { + return await request.post({ url: `/annotation/datas/start-train?id=` + id }) + }, + + // 获取训练日志 + getTrainLog: async (id: number) => { + return await request.get({ url: `/annotation/datas/train-log?id=` + id }) + }, } diff --git a/src/api/annotation/mark/index.ts b/src/api/annotation/mark/index.ts index 108ae97..2f32cf8 100644 --- a/src/api/annotation/mark/index.ts +++ b/src/api/annotation/mark/index.ts @@ -98,6 +98,10 @@ export const MarkApi = { getProjectStatusList: async (data: { status: number }) => { return await request.post({ url: `/annotation/datas/listStatus`,data }) }, + // 更新项目状态 + updateProjectStatus: async (data: { id: number; status: number }) => { + return await request.put({ url: `/annotation/datas/update`, data }) + }, // 创建标注类型 createType: async (data: Partial) => { return await request.post({ url: `/annotation/types/create`, data }) diff --git a/src/views/annotation/datas/index.vue b/src/views/annotation/datas/index.vue index 89ca697..837f381 100644 --- a/src/views/annotation/datas/index.vue +++ b/src/views/annotation/datas/index.vue @@ -149,24 +149,31 @@ 增强 - - - 标注 - + + + 标注 - - - 训练 - - + + + + 训练 + + + + + 日志 + 确定 + + + + +
+
{{ trainLog }}
+
加载中...
+
+ +