feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段
- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统 - 为BomItem实体添加relatedStandard字段及相关CRUD方法 - 为InspectionRecord实体添加reportNo、materialCode、materialName等字段 - 更新ent schema确保新字段的验证和默认值设置 - 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
@@ -123,6 +123,24 @@ async function loadSummary() {
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 可生产数量(MES 计算后推送快照,此处只读展示) ---------- */
|
||||
const producibleLoading = ref(false)
|
||||
const producibleList = ref([])
|
||||
const producibleSyncedAt = ref(0)
|
||||
async function loadProducible() {
|
||||
producibleLoading.value = true
|
||||
try {
|
||||
const data = await request.get('/stock/producible')
|
||||
producibleList.value = data?.list || []
|
||||
producibleSyncedAt.value = data?.syncedAt || 0
|
||||
} catch (e) {
|
||||
producibleList.value = []
|
||||
producibleSyncedAt.value = 0
|
||||
} finally {
|
||||
producibleLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function search() {
|
||||
if (viewTab.value === 'material') matPage.current = 1
|
||||
else if (viewTab.value === 'summary') { loadSummary(); return }
|
||||
@@ -225,6 +243,7 @@ async function exportCsv() {
|
||||
|
||||
onMounted(() => {
|
||||
loadZones()
|
||||
loadProducible()
|
||||
load()
|
||||
})
|
||||
</script>
|
||||
@@ -237,11 +256,40 @@ onMounted(() => {
|
||||
<el-tab-pane label="区域汇总" name="summary" />
|
||||
</el-tabs>
|
||||
|
||||
<!-- 可生产数量(MES 计算推送,只读):展示每个成品当前可装配套数与短板物料 -->
|
||||
<el-card v-if="viewTab === 'material'" shadow="never" class="mb12">
|
||||
<template #header>
|
||||
<div style="display:flex;align-items:center;justify-content:space-between">
|
||||
<span>可生产数量(按各物料可用量 ÷ 单台用量取最小值,由 MES 计算同步)</span>
|
||||
<span v-if="producibleSyncedAt" style="font-size:12px;color:#909399">
|
||||
同步时间:{{ fmtTime(producibleSyncedAt) }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-table :data="producibleList" border size="small" v-loading="producibleLoading"
|
||||
empty-text="暂无数据(等待 MES 同步)">
|
||||
<el-table-column prop="productCode" label="成品图号" min-width="140" />
|
||||
<el-table-column prop="productName" label="成品名称" min-width="160">
|
||||
<template #default="{ row }">{{ row.productName || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="可生产套数" width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :style="{ color: (row.producibleQty || 0) <= 0 ? '#f56c6c' : '#67c23a', fontWeight: 600 }">
|
||||
{{ row.producibleQty || 0 }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="shortText" label="短板物料" min-width="260">
|
||||
<template #default="{ row }">{{ row.shortText || '-' }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<!-- 筛选条件(区域/质量/入库时间仅对「库存明细」生效;物料汇总只按 编码/名称/类型) -->
|
||||
<el-card v-if="viewTab !== 'summary'" shadow="never" class="mb12">
|
||||
<el-form inline @submit.prevent="search">
|
||||
<el-form-item label="物料编码">
|
||||
<el-input v-model="filters.materialCode" placeholder="物料编码" clearable style="width:160px"
|
||||
<el-form-item label="图号">
|
||||
<el-input v-model="filters.materialCode" placeholder="图号" clearable style="width:160px"
|
||||
@keyup.enter="search" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称">
|
||||
@@ -292,7 +340,7 @@ onMounted(() => {
|
||||
<el-table-column label="ID" prop="id" width="70" align="center">
|
||||
<template #default="{ row }">{{ row.id || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="materialCode" label="物料编码" min-width="140">
|
||||
<el-table-column prop="materialCode" label="图号" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<span class="link">{{ row.materialCode }}</span>
|
||||
</template>
|
||||
@@ -363,7 +411,7 @@ onMounted(() => {
|
||||
<el-table :data="list" border size="small" v-loading="loading" empty-text="暂无库存数据"
|
||||
@row-click="openDetails" row-key="id">
|
||||
<el-table-column label="ID" prop="id" width="60" align="center" />
|
||||
<el-table-column prop="materialCode" label="物料编码" min-width="140">
|
||||
<el-table-column prop="materialCode" label="图号" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<span class="link">{{ row.materialCode }}</span>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user