|
@@ -5,7 +5,7 @@
|
|
|
<el-form :inline="true" :model="searchForm" class="search-form">
|
|
<el-form :inline="true" :model="searchForm" class="search-form">
|
|
|
<el-form-item label="工单编号">
|
|
<el-form-item label="工单编号">
|
|
|
<el-input
|
|
<el-input
|
|
|
- v-model="searchForm.WorkOrd"
|
|
|
|
|
|
|
+ v-model="searchForm.workOrd"
|
|
|
placeholder="请输入工单编号"
|
|
placeholder="请输入工单编号"
|
|
|
clearable
|
|
clearable
|
|
|
@keyup.enter="handleSearch"
|
|
@keyup.enter="handleSearch"
|
|
@@ -13,7 +13,7 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="物料编码">
|
|
<el-form-item label="物料编码">
|
|
|
<el-input
|
|
<el-input
|
|
|
- v-model="searchForm.ItemNum"
|
|
|
|
|
|
|
+ v-model="searchForm.itemNum"
|
|
|
placeholder="请输入物料编码"
|
|
placeholder="请输入物料编码"
|
|
|
clearable
|
|
clearable
|
|
|
@keyup.enter="handleSearch"
|
|
@keyup.enter="handleSearch"
|
|
@@ -21,7 +21,7 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="物料名称">
|
|
<el-form-item label="物料名称">
|
|
|
<el-input
|
|
<el-input
|
|
|
- v-model="searchForm.Descr"
|
|
|
|
|
|
|
+ v-model="searchForm.descr"
|
|
|
placeholder="请输入物料名称"
|
|
placeholder="请输入物料名称"
|
|
|
clearable
|
|
clearable
|
|
|
@keyup.enter="handleSearch"
|
|
@keyup.enter="handleSearch"
|
|
@@ -29,7 +29,7 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="开工日期">
|
|
<el-form-item label="开工日期">
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
- v-model="searchForm.OrdDate"
|
|
|
|
|
|
|
+ v-model="searchForm.ordDate"
|
|
|
type="date"
|
|
type="date"
|
|
|
placeholder="请选择日期"
|
|
placeholder="请选择日期"
|
|
|
value-format="YYYY-MM-DD"
|
|
value-format="YYYY-MM-DD"
|
|
@@ -70,36 +70,36 @@
|
|
|
border
|
|
border
|
|
|
stripe
|
|
stripe
|
|
|
>
|
|
>
|
|
|
- <el-table-column prop="WorkOrd" label="工单编号" width="180" fixed="left" />
|
|
|
|
|
- <el-table-column prop="Priority" label="优先级" width="100" align="center" />
|
|
|
|
|
- <el-table-column prop="ItemNum" label="物料编码" width="150" />
|
|
|
|
|
- <el-table-column prop="Descr" label="物料名称" width="200" show-overflow-tooltip />
|
|
|
|
|
- <el-table-column prop="Descr1" label="规格型号" width="150" show-overflow-tooltip />
|
|
|
|
|
- <el-table-column prop="QtyOrded" label="工单数量" width="120" align="right">
|
|
|
|
|
|
|
+ <el-table-column prop="workOrd" label="工单编号" width="180" fixed="left" />
|
|
|
|
|
+ <el-table-column prop="priority" label="优先级" width="100" align="center" />
|
|
|
|
|
+ <el-table-column prop="itemNum" label="物料编码" width="150" />
|
|
|
|
|
+ <el-table-column prop="descr" label="物料名称" width="200" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column prop="descr1" label="规格型号" width="150" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column prop="qtyOrded" label="工单数量" width="120" align="right">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- {{ formatNumber(row.QtyOrded) }}
|
|
|
|
|
|
|
+ {{ formatNumber(row.qtyOrded) }}
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column prop="MaterialSituation" label="物料齐套" width="120">
|
|
|
|
|
|
|
+ <el-table-column prop="materialSituation" label="物料齐套" width="120">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- <el-tag v-if="row.MaterialSituation === '齐套'" type="success">齐套</el-tag>
|
|
|
|
|
- <el-tag v-else-if="row.MaterialSituation === '不齐套'" type="danger">不齐套</el-tag>
|
|
|
|
|
- <el-tag v-else type="info">{{ row.MaterialSituation || '未检查' }}</el-tag>
|
|
|
|
|
|
|
+ <el-tag v-if="row.materialSituation === '齐套'" type="success">齐套</el-tag>
|
|
|
|
|
+ <el-tag v-else-if="row.materialSituation === '不齐套'" type="danger">不齐套</el-tag>
|
|
|
|
|
+ <el-tag v-else type="info">{{ row.materialSituation || '未检查' }}</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column prop="OrdDate" label="开工日期" width="120">
|
|
|
|
|
|
|
+ <el-table-column prop="ordDate" label="开工日期" width="120">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- {{ row.OrdDate ? row.OrdDate.substring(0, 10) : '' }}
|
|
|
|
|
|
|
+ {{ formatDate(row.ordDate) }}
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column prop="DueDate" label="完成日期" width="120">
|
|
|
|
|
|
|
+ <el-table-column prop="dueDate" label="完成日期" width="120">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- {{ row.DueDate ? row.DueDate.substring(0, 10) : '' }}
|
|
|
|
|
|
|
+ {{ formatDate(row.dueDate) }}
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column prop="Status" label="状态" width="100">
|
|
|
|
|
|
|
+ <el-table-column prop="status" label="状态" width="100">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- <el-tag :type="getStatusType(row.Status)">{{ getStatusText(row.Status) }}</el-tag>
|
|
|
|
|
|
|
+ <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" width="120" fixed="right">
|
|
<el-table-column label="操作" width="120" fixed="right">
|
|
@@ -129,41 +129,6 @@
|
|
|
/>
|
|
/>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
|
|
|
|
|
- <!-- 物料齐套检查对话框 -->
|
|
|
|
|
- <el-dialog
|
|
|
|
|
- v-model="checkDialogVisible"
|
|
|
|
|
- title="物料齐套检查"
|
|
|
|
|
- width="500px"
|
|
|
|
|
- :close-on-click-modal="false"
|
|
|
|
|
- >
|
|
|
|
|
- <el-form :model="checkForm" label-width="100px">
|
|
|
|
|
- <el-form-item label="开始时间">
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="checkForm.startDate"
|
|
|
|
|
- type="date"
|
|
|
|
|
- placeholder="请选择开始时间"
|
|
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
|
|
- style="width: 100%"
|
|
|
|
|
- />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="结束时间">
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="checkForm.endDate"
|
|
|
|
|
- type="date"
|
|
|
|
|
- placeholder="请选择结束时间"
|
|
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
|
|
- style="width: 100%"
|
|
|
|
|
- />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- <template #footer>
|
|
|
|
|
- <el-button @click="checkDialogVisible = false">取消</el-button>
|
|
|
|
|
- <el-button type="primary" :loading="checkLoading" @click="handleConfirmCheck">
|
|
|
|
|
- 确认检查
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
-
|
|
|
|
|
<!-- 工单下达前处理表单 -->
|
|
<!-- 工单下达前处理表单 -->
|
|
|
<WorkOrderReleaseForm ref="releaseFormRef" @success="handleSearch" />
|
|
<WorkOrderReleaseForm ref="releaseFormRef" @success="handleSearch" />
|
|
|
</div>
|
|
</div>
|
|
@@ -183,13 +148,12 @@ import WorkOrderReleaseForm from './components/WorkOrderReleaseForm.vue'
|
|
|
const loading = ref(false)
|
|
const loading = ref(false)
|
|
|
const checkLoading = ref(false)
|
|
const checkLoading = ref(false)
|
|
|
const tableData = ref([])
|
|
const tableData = ref([])
|
|
|
-const checkDialogVisible = ref(false)
|
|
|
|
|
|
|
|
|
|
const searchForm = reactive({
|
|
const searchForm = reactive({
|
|
|
- WorkOrd: '',
|
|
|
|
|
- ItemNum: '',
|
|
|
|
|
- Descr: '',
|
|
|
|
|
- OrdDate: ''
|
|
|
|
|
|
|
+ workOrd: '',
|
|
|
|
|
+ itemNum: '',
|
|
|
|
|
+ descr: '',
|
|
|
|
|
+ ordDate: ''
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const pagination = reactive({
|
|
const pagination = reactive({
|
|
@@ -198,11 +162,6 @@ const pagination = reactive({
|
|
|
total: 0
|
|
total: 0
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const checkForm = reactive({
|
|
|
|
|
- startDate: '',
|
|
|
|
|
- endDate: ''
|
|
|
|
|
-})
|
|
|
|
|
-
|
|
|
|
|
const releaseFormRef = ref(null)
|
|
const releaseFormRef = ref(null)
|
|
|
|
|
|
|
|
// 查询
|
|
// 查询
|
|
@@ -211,12 +170,16 @@ const handleSearch = async () => {
|
|
|
try {
|
|
try {
|
|
|
const params = {
|
|
const params = {
|
|
|
...searchForm,
|
|
...searchForm,
|
|
|
- page: pagination.page,
|
|
|
|
|
|
|
+ pageNo: pagination.page,
|
|
|
pageSize: pagination.pageSize
|
|
pageSize: pagination.pageSize
|
|
|
}
|
|
}
|
|
|
- const { data } = await getWorkOrderPoolList(params)
|
|
|
|
|
- tableData.value = data.list || []
|
|
|
|
|
- pagination.total = data.total || 0
|
|
|
|
|
|
|
+ console.log('查询参数:', params)
|
|
|
|
|
+ const res = await getWorkOrderPoolList(params)
|
|
|
|
|
+ console.log('查询结果:', res)
|
|
|
|
|
+ tableData.value = res?.list || []
|
|
|
|
|
+ pagination.total = res?.total || 0
|
|
|
|
|
+ console.log('表格数据:', tableData.value)
|
|
|
|
|
+ console.log('总数:', pagination.total)
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('查询失败:', error)
|
|
console.error('查询失败:', error)
|
|
|
if (error.code === 'ERR_NETWORK' || error.response?.status === 404) {
|
|
if (error.code === 'ERR_NETWORK' || error.response?.status === 404) {
|
|
@@ -241,32 +204,47 @@ const handleReset = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 物料齐套检查
|
|
// 物料齐套检查
|
|
|
-const handleMaterialCheck = () => {
|
|
|
|
|
- checkForm.startDate = ''
|
|
|
|
|
- checkForm.endDate = ''
|
|
|
|
|
- checkDialogVisible.value = true
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// 确认齐套检查
|
|
|
|
|
-const handleConfirmCheck = async () => {
|
|
|
|
|
- if (!checkForm.startDate || !checkForm.endDate) {
|
|
|
|
|
- ElMessage.warning('请选择开始时间和结束时间')
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+const handleMaterialCheck = async () => {
|
|
|
try {
|
|
try {
|
|
|
|
|
+ await ElMessageBox.confirm('将按计划开始及结束时间范围齐套检查,是否确认?', '提示', {
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ confirmButtonText: '确认',
|
|
|
|
|
+ cancelButtonText: '取消'
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
checkLoading.value = true
|
|
checkLoading.value = true
|
|
|
- await checkMaterialComplete({
|
|
|
|
|
- startDate: checkForm.startDate,
|
|
|
|
|
- endDate: checkForm.endDate,
|
|
|
|
|
- companyId: '', // 从用户状态获取
|
|
|
|
|
- userAccount: '' // 从用户状态获取
|
|
|
|
|
|
|
+ // 获取当前日期作为默认时间范围
|
|
|
|
|
+ const today = new Date()
|
|
|
|
|
+ const startDate = new Date(today.getFullYear(), today.getMonth(), 1) // 本月第一天
|
|
|
|
|
+ const endDate = new Date(today.getFullYear(), today.getMonth() + 1, 0) // 本月最后一天
|
|
|
|
|
+
|
|
|
|
|
+ const formatDate = (date) => {
|
|
|
|
|
+ const year = date.getFullYear()
|
|
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
+ const day = String(date.getDate()).padStart(2, '0')
|
|
|
|
|
+ return `${year}-${month}-${day}`
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // TODO: 从配置或用户信息中获取 domain 和 userAccount
|
|
|
|
|
+ // 这里暂时使用默认值
|
|
|
|
|
+ const response = await checkMaterialComplete({
|
|
|
|
|
+ startDate: formatDate(startDate),
|
|
|
|
|
+ endDate: formatDate(endDate),
|
|
|
|
|
+ domain: '8010', // 应该从配置 order.default.domain 获取
|
|
|
|
|
+ userAccount: '' // 应该从当前登录用户获取
|
|
|
})
|
|
})
|
|
|
- ElMessage.success('物料齐套检查完成')
|
|
|
|
|
- checkDialogVisible.value = false
|
|
|
|
|
- handleSearch()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 检查返回结果
|
|
|
|
|
+ if (response.data === 'ok') {
|
|
|
|
|
+ ElMessage.success('物料齐套检查完成')
|
|
|
|
|
+ handleSearch()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error('物料齐套检查异常:' + response.data)
|
|
|
|
|
+ }
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
- ElMessage.error('齐套检查失败:' + (error.message || '未知错误'))
|
|
|
|
|
|
|
+ if (error !== 'cancel') {
|
|
|
|
|
+ ElMessage.error('齐套检查失败:' + (error.message || '未知错误'))
|
|
|
|
|
+ }
|
|
|
} finally {
|
|
} finally {
|
|
|
checkLoading.value = false
|
|
checkLoading.value = false
|
|
|
}
|
|
}
|
|
@@ -275,16 +253,25 @@ const handleConfirmCheck = async () => {
|
|
|
// 生成物料需求
|
|
// 生成物料需求
|
|
|
const handleGenerateMaterialRequirement = async () => {
|
|
const handleGenerateMaterialRequirement = async () => {
|
|
|
try {
|
|
try {
|
|
|
- await ElMessageBox.confirm('确定要生成物料需求计划吗?', '提示', {
|
|
|
|
|
- type: 'warning'
|
|
|
|
|
|
|
+ await ElMessageBox.confirm('将计算下周一开工的物料需求,是否确认?', '提示', {
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ confirmButtonText: '确认',
|
|
|
|
|
+ cancelButtonText: '取消'
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
loading.value = true
|
|
loading.value = true
|
|
|
- await generateMaterialRequirement({
|
|
|
|
|
- companyId: '' // 从用户状态获取
|
|
|
|
|
|
|
+ // TODO: 从配置中获取 domain
|
|
|
|
|
+ const response = await generateMaterialRequirement({
|
|
|
|
|
+ domain: '8010' // 应该从配置 order.default.domain 获取
|
|
|
})
|
|
})
|
|
|
- ElMessage.success('物料需求计划生成成功')
|
|
|
|
|
- handleSearch()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 检查返回结果
|
|
|
|
|
+ if (response.data === 'ok') {
|
|
|
|
|
+ ElMessage.success('物料需求计划生成完成')
|
|
|
|
|
+ handleSearch()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error('物料需求计划生成失败:' + response.data)
|
|
|
|
|
+ }
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
if (error !== 'cancel') {
|
|
if (error !== 'cancel') {
|
|
|
ElMessage.error('生成物料需求失败:' + (error.message || '未知错误'))
|
|
ElMessage.error('生成物料需求失败:' + (error.message || '未知错误'))
|
|
@@ -308,6 +295,35 @@ const formatNumber = (value) => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 格式化日期
|
|
|
|
|
+const formatDate = (date) => {
|
|
|
|
|
+ if (!date) return ''
|
|
|
|
|
+
|
|
|
|
|
+ // 如果是数字(时间戳)
|
|
|
|
|
+ if (typeof date === 'number') {
|
|
|
|
|
+ const d = new Date(date)
|
|
|
|
|
+ const year = d.getFullYear()
|
|
|
|
|
+ const month = String(d.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
+ const day = String(d.getDate()).padStart(2, '0')
|
|
|
|
|
+ return `${year}-${month}-${day}`
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如果是字符串
|
|
|
|
|
+ if (typeof date === 'string') {
|
|
|
|
|
+ return date.substring(0, 10)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如果是 Date 对象
|
|
|
|
|
+ if (date instanceof Date) {
|
|
|
|
|
+ const year = date.getFullYear()
|
|
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
+ const day = String(date.getDate()).padStart(2, '0')
|
|
|
|
|
+ return `${year}-${month}-${day}`
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return String(date).substring(0, 10)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 获取状态类型
|
|
// 获取状态类型
|
|
|
const getStatusType = (status) => {
|
|
const getStatusType = (status) => {
|
|
|
const typeMap = {
|
|
const typeMap = {
|
|
@@ -330,8 +346,8 @@ const getStatusText = (status) => {
|
|
|
return textMap[status?.toLowerCase()] || status
|
|
return textMap[status?.toLowerCase()] || status
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 初始化 - 注释掉自动查询,等后端API准备好后再启用
|
|
|
|
|
-// handleSearch()
|
|
|
|
|
|
|
+// 初始化 - 启用自动查询
|
|
|
|
|
+handleSearch()
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|