feat&refactor: 2026-09-22 半成品业务模型重构与功能完善

- 重构半成品流转逻辑:进度权威源改为 workpiece.currentStationNo,新增 completedText 快照字段,废除 doneProcessCodes
- 清理物料品类中半成品类型,存量数据幂等清理,调整物料管理方式文案为批次/序列号
- 新增日排产状态专用更新接口,修复工单工艺校验逻辑
- 新增物料档案代理接口、深路径文件下载接口
- 优化前端界面文案与工位选择逻辑,补充追溯页半成品流转展示
- 调整WMS端物料品类校验与入库接口契约
- 新增/更新数据库表结构与实体类代码
This commit is contained in:
SunYF
2026-09-22 14:42:52 +08:00
parent 09cfc6ca1c
commit d3eda6b588
49 changed files with 1155 additions and 1122 deletions
+25 -4
View File
@@ -131,7 +131,7 @@ const query = reactive({ orderNo: '', planDate: '' })
const list = ref([])
const workOrders = ref([])
const productTypes = ref([])
const dialog = reactive({ show: false, id: 0, orderNo: '', planDate: '', planRange: [], mode: 'AVG', planQty: 1, productType: '', productCode: '', productName: '', woQty: '', stationPlanQty: {}, combination: [] })
const dialog = reactive({ show: false, id: 0, orderNo: '', planDate: '', planRange: [], mode: 'AVG', planQty: 1, productType: '', productCode: '', productName: '', woQty: '', woStart: '', woDue: '', stationPlanQty: {}, combination: [] })
// 工位号→接驳台编码、工位号→名称(送达接驳台由工单工艺组合派生)
const stationDockMap = ref({})
@@ -210,6 +210,7 @@ function loadWorkOrderInfo() {
if (!wo) {
dialog.productType = ''; dialog.productCode = ''; dialog.productName = ''; dialog.woQty = ''
dialog.combination = []
dialog.woStart = ''; dialog.woDue = ''
return
}
dialog.productCode = wo.productCode || ''
@@ -218,9 +219,20 @@ function loadWorkOrderInfo() {
dialog.combination = Array.isArray(wo.flowCombination) ? wo.flowCombination : []
const pt = productTypes.value.find((p) => p.id === wo.productTypeId)
dialog.productType = pt ? (pt.name + (pt.code ? ' / ' + pt.code : '')) : ''
// 记录工单起止日期(planStart/dueDate),用于日期预填与超期提示
dialog.woStart = wo.planStart ? String(wo.planStart).slice(0, 10) : ''
dialog.woDue = wo.dueDate ? String(wo.dueDate).slice(0, 10) : ''
// 新建排产:日期范围默认取所选工单的开始/结束日期(可修改)
if (!dialog.id && (dialog.woStart || dialog.woDue)) {
dialog.planRange = [dialog.woStart || dialog.woDue, dialog.woDue || dialog.woStart]
}
}
function onOrderChange() {
loadWorkOrderInfo()
// 编辑弹窗切换工单:排产日期默认取该工单开始日期(无则取结束日期,可修改)
if (dialog.id && (dialog.woStart || dialog.woDue)) {
dialog.planDate = dialog.woStart || dialog.woDue
}
}
function openAdd() {
const today = new Date().toISOString().slice(0, 10)
@@ -242,6 +254,15 @@ function openEdit(row) {
: dialog.combination
loadAlloc()
}
// 所选日期超出工单执行期间(planStart~dueDate)时提示,但不阻断提交
function warnOutOfWindow(dates) {
const s = dialog.woStart || ''
const e = dialog.woDue || ''
if ((!s && !e) || !dialog.orderNo) return
if (dates.some((d) => (s && d < s) || (e && d > e))) {
ElMessage.warning('所选日期超出工单执行期间')
}
}
async function save() {
if (!dialog.orderNo) return ElMessage.warning('请选择工单号')
if (dialog.id) {
@@ -251,6 +272,7 @@ async function save() {
if (alloc[st]) spq[String(st)] = Number(alloc[st]) || 0
})
if (!dialog.planDate) return ElMessage.warning('请选择排产日期')
warnOutOfWindow([dialog.planDate])
await request.put(`/daily-plans/${dialog.id}`, {
id: dialog.id, orderNo: dialog.orderNo, planDate: dialog.planDate, planQty: dialog.planQty, stationPlanQty: spq
})
@@ -259,6 +281,7 @@ async function save() {
if (!dialog.planRange || dialog.planRange.length !== 2 || !dialog.planRange[0] || !dialog.planRange[1])
return ElMessage.warning('请选择排产日期范围')
if (!dialog.planQty || dialog.planQty < 1) return ElMessage.warning('请填写数量')
warnOutOfWindow([dialog.planRange[0], dialog.planRange[1]])
await request.post('/daily-plans', {
orderNo: dialog.orderNo, planRange: dialog.planRange, mode: dialog.mode, planQty: dialog.planQty
})
@@ -292,9 +315,7 @@ 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, status: target
})
await request.post(`/daily-plans/${row.id}/status`, { status: target })
ElMessage.success(`已${label}`)
load()
}