更新客户管理、订单进度、生产计划、仓储汇总和配置文件
This commit is contained in:
@@ -102,7 +102,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" label="登记时间" align="center" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.登记时间 ? scope.row.登记时间.substring(0, 10) : '' }}
|
||||
{{ scope.row.登记时间 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="100px" label="客户来源" align="center" show-overflow-tooltip>
|
||||
@@ -234,7 +234,7 @@
|
||||
<el-form-item label="登记时间:" prop="登记时间">
|
||||
<el-date-picker
|
||||
v-model="form.登记时间"
|
||||
:disabled="flag1 === 2 && id != 273"
|
||||
:disabled="true"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
size="small"
|
||||
@@ -348,6 +348,10 @@ export default {
|
||||
this.$refs['form'].resetFields()
|
||||
}
|
||||
this.title = '新增客户'
|
||||
var now = new Date()
|
||||
var month = (now.getMonth() + 1).toString().padStart(2, '0')
|
||||
var day = now.getDate().toString().padStart(2, '0')
|
||||
this.form.登记时间 = now.getFullYear() + '-' + month + '-' + day
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
handleEdit(row) {
|
||||
|
||||
@@ -195,6 +195,14 @@
|
||||
<span class="detail-label">装配人</span>
|
||||
<span class="detail-value">{{ detailData[0].装配结束人员 }}</span>
|
||||
</div>
|
||||
<div v-if="detailData[0].采购入库日期" class="detail-row">
|
||||
<span class="detail-label">入库日期</span>
|
||||
<span class="detail-value">{{ detailData[0].采购入库日期 }}</span>
|
||||
</div>
|
||||
<div v-if="detailData[0].自制入库日期" class="detail-row">
|
||||
<span class="detail-label">入库日期</span>
|
||||
<span class="detail-value">{{ detailData[0].自制入库日期 }}</span>
|
||||
</div>
|
||||
<div v-if="detailData[0].发货日期" class="detail-row">
|
||||
<span class="detail-label">发货日期</span>
|
||||
<span class="detail-value">{{ detailData[0].发货日期 }}</span>
|
||||
|
||||
@@ -230,6 +230,14 @@ export default {
|
||||
statusValue: '',
|
||||
loading: false,
|
||||
tableData2: [],
|
||||
processConfig: {
|
||||
maxProcessCount: 11,
|
||||
processNamePattern: 'OP0{index}0',
|
||||
statusRules: {
|
||||
completed: 100,
|
||||
dispatching: 0
|
||||
}
|
||||
},
|
||||
dashboardVisible: false,
|
||||
statusPieChart: null,
|
||||
completionBarChart: null,
|
||||
@@ -354,76 +362,105 @@ export default {
|
||||
this.$message.warning('月份不能为空')
|
||||
}
|
||||
},
|
||||
groupByOrder(data) {
|
||||
const grouped = {}
|
||||
if (!Array.isArray(data)) {
|
||||
return []
|
||||
// 初始化工序字段
|
||||
initializeProcessFields() {
|
||||
const fields = {}
|
||||
for (let i = 1; i <= this.processConfig.maxProcessCount; i++) {
|
||||
const opKey = this.processConfig.processNamePattern.replace('{index}', i)
|
||||
fields[opKey] = ''
|
||||
}
|
||||
return fields
|
||||
},
|
||||
// 创建订单分组对象
|
||||
createOrderGroup(item) {
|
||||
return {
|
||||
订单号: item.订单号,
|
||||
MK订单编号: item.MK订单编号,
|
||||
收货人: item.MK订单收货人,
|
||||
产品名称: item.产品名称,
|
||||
零件名称: item.零件名称,
|
||||
零件图号: item.零件图号,
|
||||
订单数: item.订单数,
|
||||
计划数: item.计划数,
|
||||
剩余数: item.剩余数,
|
||||
状态: item.状态,
|
||||
完成率: '',
|
||||
投产时间: item.投产时间,
|
||||
精工期限: item.精工期限,
|
||||
设备: item.设备,
|
||||
材料: item.材料,
|
||||
_totalProcesses: 0,
|
||||
_completedProcesses: 0,
|
||||
...this.initializeProcessFields()
|
||||
}
|
||||
},
|
||||
// 解析工序索引
|
||||
parseProcessIndex(processOrder) {
|
||||
if (processOrder === null || processOrder === undefined || processOrder === '') {
|
||||
return null
|
||||
}
|
||||
const opIndex = parseInt(processOrder, 10)
|
||||
if (isNaN(opIndex) || opIndex < 1 || opIndex > this.processConfig.maxProcessCount) {
|
||||
console.warn('无效的工序顺序: ' + processOrder)
|
||||
return null
|
||||
}
|
||||
return opIndex
|
||||
},
|
||||
// 处理工序数据
|
||||
processWorkProcesses(group, item) {
|
||||
if (!item.工序) return
|
||||
group._totalProcesses++
|
||||
const remainingCount = Number(item.剩余数) || 0
|
||||
if (remainingCount <= 0) {
|
||||
group._completedProcesses++
|
||||
}
|
||||
const opIndex = this.parseProcessIndex(item.工序顺序)
|
||||
if (opIndex !== null) {
|
||||
const opKey = this.processConfig.processNamePattern.replace('{index}', opIndex)
|
||||
group[opKey] = item.工序
|
||||
}
|
||||
},
|
||||
// 计算订单状态
|
||||
calculateOrderStatus(group) {
|
||||
var rate = 0
|
||||
if (group._totalProcesses > 0) {
|
||||
rate = Math.round(group._completedProcesses / group._totalProcesses * 100)
|
||||
}
|
||||
group.完成率 = rate + '%'
|
||||
if (rate === this.processConfig.statusRules.completed) {
|
||||
group.状态 = '已完成'
|
||||
} else if (rate === this.processConfig.statusRules.dispatching) {
|
||||
group.状态 = '派工中'
|
||||
} else {
|
||||
group.状态 = '生产中'
|
||||
}
|
||||
delete group._totalProcesses
|
||||
delete group._completedProcesses
|
||||
},
|
||||
// 数据分组主逻辑
|
||||
groupDataByOrder(data) {
|
||||
const grouped = {}
|
||||
data.forEach(item => {
|
||||
if (!item) return
|
||||
if (!item || !item.订单号) return
|
||||
const orderNo = item.订单号
|
||||
if (!grouped[orderNo]) {
|
||||
grouped[orderNo] = {
|
||||
订单号: item.订单号,
|
||||
MK订单编号: item.MK订单编号,
|
||||
收货人: item.MK订单收货人,
|
||||
产品名称: item.产品名称,
|
||||
零件名称: item.零件名称,
|
||||
零件图号: item.零件图号,
|
||||
订单数: item.订单数,
|
||||
计划数: item.计划数,
|
||||
剩余数: item.剩余数,
|
||||
状态: item.状态,
|
||||
完成率: '',
|
||||
投产时间: item.投产时间,
|
||||
精工期限: item.精工期限,
|
||||
设备: item.设备,
|
||||
材料: item.材料,
|
||||
_totalProcesses: 0,
|
||||
_completedProcesses: 0,
|
||||
OP010: '',
|
||||
OP020: '',
|
||||
OP030: '',
|
||||
OP040: '',
|
||||
OP050: '',
|
||||
OP060: '',
|
||||
OP070: '',
|
||||
OP080: '',
|
||||
OP090: '',
|
||||
OP100: '',
|
||||
OP110: ''
|
||||
}
|
||||
grouped[orderNo] = this.createOrderGroup(item)
|
||||
}
|
||||
if (item.工序) {
|
||||
grouped[orderNo]._totalProcesses++
|
||||
if (item.剩余数 <= 0) {
|
||||
grouped[orderNo]._completedProcesses++
|
||||
}
|
||||
}
|
||||
const opIndex = parseInt(item.工序顺序)
|
||||
if (opIndex >= 1 && opIndex <= 11) {
|
||||
const opKey = `OP0${opIndex}0`
|
||||
grouped[orderNo][opKey] = item.工序
|
||||
}
|
||||
})
|
||||
Object.values(grouped).forEach(group => {
|
||||
var rate = 0
|
||||
if (group._totalProcesses > 0) {
|
||||
rate = Math.round(group._completedProcesses / group._totalProcesses * 100)
|
||||
}
|
||||
group.完成率 = rate + '%'
|
||||
if (rate === 100) {
|
||||
group.状态 = '已完成'
|
||||
} else if (rate === 0) {
|
||||
group.状态 = '派工中'
|
||||
} else {
|
||||
group.状态 = '生产中'
|
||||
}
|
||||
delete group._totalProcesses
|
||||
delete group._completedProcesses
|
||||
this.processWorkProcesses(grouped[orderNo], item)
|
||||
})
|
||||
return Object.values(grouped)
|
||||
},
|
||||
groupByOrder(data) {
|
||||
if (!Array.isArray(data)) {
|
||||
console.warn('生产数据格式错误:期望数组格式')
|
||||
return []
|
||||
}
|
||||
const groupedData = this.groupDataByOrder(data)
|
||||
groupedData.forEach(group => {
|
||||
this.calculateOrderStatus(group)
|
||||
})
|
||||
return groupedData
|
||||
},
|
||||
openDashboard() {
|
||||
if (this.tableData2.length === 0) {
|
||||
this.$message.warning('暂无数据,请先查询')
|
||||
|
||||
@@ -510,7 +510,7 @@ export default {
|
||||
var param = []
|
||||
var Data = this.CreateData('11', '仓储管理_生产订单_查询', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
var filtered = response.data.filter(item => item.状态 === '加工中')
|
||||
var filtered = response.data.filter(item => item.状态 === '加工中' && item.补货数 !== item.入库数)
|
||||
filtered.forEach(item => {
|
||||
item.期限状态 = this.calculateDeadlineStatus(item)
|
||||
item.超期时间 = this.calculateOverdueDays(item)
|
||||
|
||||
Reference in New Issue
Block a user