feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段

- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统
- 为BomItem实体添加relatedStandard字段及相关CRUD方法
- 为InspectionRecord实体添加reportNo、materialCode、materialName等字段
- 更新ent schema确保新字段的验证和默认值设置
- 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
SunYF
2026-09-17 12:49:07 +08:00
parent b4b274301d
commit 1cc93795ce
191 changed files with 24504 additions and 1250 deletions
+20 -4
View File
@@ -32,8 +32,12 @@
</template>
</el-table-column>
<el-table-column prop="operator" label="操作人" min-width="90" />
<el-table-column label="操作" width="160">
<el-table-column label="操作" width="230">
<template #default="{ row }">
<el-button v-if="can('produce.workorder:dailyplan') && (row.status === 'PENDING' || row.status === 'CONFIRMED')"
size="small" :type="row.status === 'CONFIRMED' ? 'warning' : 'success'" @click="toggleStatus(row)">
{{ row.status === 'CONFIRMED' ? '停用' : '启用' }}
</el-button>
<el-button v-if="can('produce.workorder:dailyplan')" size="small" @click="openEdit(row)">编辑</el-button>
<el-button v-if="can('produce.workorder:dailyplan')" size="small" type="danger" @click="del(row)">删除</el-button>
</template>
@@ -95,12 +99,12 @@ const dialog = reactive({ show: false, id: 0, orderNo: '', planDate: '', planQty
const dockOptions = [...Array.from({ length: 20 }, (_, i) => `DOCK${String(i + 1).padStart(2, '0')}`), 'DOCK21']
const statusOptions = [
{ v: 'PENDING', l: '待执行' }, { v: 'PROCESSING', l: '执行中' },
{ v: 'DONE', l: '已完成' }, { v: 'CANCELLED', l: '已取消' }
{ v: 'PENDING', l: '未启用' }, { v: 'CONFIRMED', l: '已启用' },
{ v: 'PROCESSING', l: '执行中' }, { v: 'DONE', l: '已完成' }, { v: 'CANCELLED', l: '已取消' }
]
const statusText = (s) => (statusOptions.find((x) => x.v === s) || {}).l || s
const planStatusTag = (s) =>
s === 'DONE' ? 'success' : s === 'CANCELLED' ? 'info' : s === 'PROCESSING' ? 'warning' : 'primary'
s === 'DONE' ? 'success' : s === 'PROCESSING' ? 'warning' : s === 'CONFIRMED' ? 'primary' : 'info'
async function load() {
list.value = (await request.get('/daily-plans', { params: query })) || []
@@ -134,6 +138,18 @@ async function del(row) {
await request.delete(`/daily-plans/${row.id}`)
load()
}
// 启用(PENDING→CONFIRMED) / 停用(CONFIRMED→PENDING):自动排产生成的是 PENDING,需人工启用后才生效
async function toggleStatus(row) {
const target = row.status === 'CONFIRMED' ? 'PENDING' : 'CONFIRMED'
const label = target === 'CONFIRMED' ? '启用' : '停用'
await ElMessageBox.confirm(`确认${label}该排产(${row.orderNo} ${row.planDate})?`, '提示', { type: 'warning' })
await request.put(`/daily-plans/${row.id}`, {
orderNo: row.orderNo, planDate: row.planDate, planQty: row.planQty,
dockCodes: row.dockCodes || [], status: target
})
ElMessage.success(`${label}`)
load()
}
onMounted(async () => {
workOrders.value = (await request.get('/work-orders')) || []
load()