生产工单新增修改时修改日期格式
This commit is contained in:
parent
43b8c320df
commit
6483af23fb
@ -7,19 +7,9 @@
|
||||
start-placeholder="开始时间" end-placeholder="结束时间" placeholder="请选择工单日期区间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="组别" prop="groupCode">
|
||||
<!-- <el-select v-model="queryParams.groupCode" placeholder="全部">
|
||||
<el-option label="全部" value="" />
|
||||
<el-option v-for="(item, index) in allGroupOptions" :key="index" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select> -->
|
||||
<el-input v-model="queryParams.groupCode" placeholder="请输入组别" />
|
||||
</el-form-item>
|
||||
<el-form-item label="线别" prop="lineCode">
|
||||
<!-- <el-select v-model="queryParams.lineCode" placeholder="全部">
|
||||
<el-option label="全部" value="" />
|
||||
<el-option v-for="(item, index) in allRouteOptions" :key="index" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select> -->
|
||||
<el-input v-model="queryParams.lineCode" placeholder="请输入线别" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
@ -29,9 +19,6 @@
|
||||
<el-form-item label="产品名称" prop="productionName">
|
||||
<el-input v-model.trim="queryParams.productionName" clearable placeholder="请输入产品名称" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="客户编码" prop="customCode">
|
||||
<el-input v-model.trim="queryParams.customCode" clearable placeholder="请输入客户编码" />
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
||||
@ -45,16 +32,6 @@
|
||||
<el-button class="tool-box" type="primary" v-hasPermi="['productManagement:proworkorder:add']"
|
||||
icon="plus" @click="handleAdd(-1)"> 手动新增工单 </el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
class="tool-box"
|
||||
type="warning"
|
||||
v-hasPermi="['productManagement:proworkorder:edit']"
|
||||
icon="Expand"
|
||||
@click="handleCreateWorkOrder">
|
||||
生成工单号
|
||||
</el-button>
|
||||
</el-col> -->
|
||||
|
||||
<el-col :span="1.5">
|
||||
<el-button class="tool-box" color="#626aef" v-hasPermi="['productManagement:proworkorder:list']"
|
||||
@ -72,14 +49,6 @@
|
||||
<el-button class="tool-box" color="#55557f" v-hasPermi="['productManagement:proworkorder:list']"
|
||||
icon="Printer" @click="handlePrint"> 打印 </el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button class="tool-box" color="#0077cc" icon="Refresh" @click="syncPaintBOM"> 更新涂装BOM
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button class="tool-box" color="#aa00ff" icon="List" @click="openCreateMaterialPlanDialog"> 更新MRP
|
||||
</el-button>
|
||||
</el-col> -->
|
||||
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
@ -132,22 +101,8 @@
|
||||
<el-link @click="showBOM(scope.row)" type="primary">{{ scope.row.productionCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
prop="productionName"
|
||||
label="物料描述"
|
||||
min-width="200"
|
||||
align="center"
|
||||
:show-overflow-tooltip="true"
|
||||
v-if="columns.showColumn('productionName')" /> -->
|
||||
<el-table-column prop="specification" label="规格" width="160" align="center" :show-overflow-tooltip="true"
|
||||
v-if="columns.showColumn('specification')" />
|
||||
<!-- <el-table-column
|
||||
prop="customCode"
|
||||
label="客户编码"
|
||||
width="140"
|
||||
align="center"
|
||||
:show-overflow-tooltip="true"
|
||||
v-if="columns.showColumn('customCode')" /> -->
|
||||
<el-table-column prop="deliveryNum" label="计划数量" align="center" v-if="columns.showColumn('deliveryNum')" />
|
||||
<el-table-column prop="unit" label="单位" align="center" :show-overflow-tooltip="true"
|
||||
v-if="columns.showColumn('unit')" />
|
||||
@ -189,26 +144,6 @@
|
||||
v-if="columns.showColumn('updatedBy')" />
|
||||
<el-table-column prop="updatedTime" label="更新时间" :show-overflow-tooltip="true"
|
||||
v-if="columns.showColumn('updatedTime')" />
|
||||
<!-- <el-table-column label="排序" width="120" fixed="right" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@click="handleMove(scope.row.id, 1)"
|
||||
:disabled="moveLoading"
|
||||
color="#b67900"
|
||||
size="small"
|
||||
plain
|
||||
icon="ArrowUpBold"
|
||||
title="上移"></el-button>
|
||||
<el-button
|
||||
@click="handleMove(scope.row.id, 2)"
|
||||
:disabled="moveLoading"
|
||||
color="#3f7f00"
|
||||
size="small"
|
||||
plain
|
||||
icon="ArrowDownBold"
|
||||
title="下移"></el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="操作" align="center" fixed="right" width="80">
|
||||
<template #default="scope">
|
||||
<el-dropdown>
|
||||
@ -250,13 +185,13 @@
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="物料名称" prop="productionName">
|
||||
<el-input v-model.trim="form.productionName" placeholder="请输入物料名称" />
|
||||
<el-input v-model.trim="form.productionName" placeholder="请输入物料名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="物料编号" prop="productionCode">
|
||||
<el-input v-model.trim="form.productionCode" placeholder="请输入物料编号" />
|
||||
<el-input v-model.trim="form.productionCode" placeholder="请输入物料编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@ -265,28 +200,6 @@
|
||||
<el-input v-model.trim="form.specification" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :lg="24">
|
||||
<el-form-item label="客户搜索" prop="search02">
|
||||
<el-select
|
||||
v-model="search02"
|
||||
filterable
|
||||
value-key="id"
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="请输入物料名称或物料编号"
|
||||
:remote-method="querySearch02"
|
||||
@change="search02Change"
|
||||
:loading="search02Loading"
|
||||
class="select">
|
||||
<el-option v-for="item in search02Options" :key="item.id" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="客户编码" prop="customCode">
|
||||
<el-input disabled v-model.trim="form.customCode" placeholder="请输入客户编码" />
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="工单日期" prop="workorderDate">
|
||||
<el-date-picker @change="getFormLineOptions(true)" style="width: 100%"
|
||||
@ -315,19 +228,11 @@
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="线别" prop="lineCode">
|
||||
<!-- <el-select v-model="form.lineCode" placeholder="请选择线别" class="select">
|
||||
<el-option v-for="(item, index) in allRouteOptions" :key="index" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select> -->
|
||||
<el-input v-model="form.lineCode" placeholder="请输入线别" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="组别" prop="groupCode">
|
||||
<!-- <el-select v-model="form.groupCode" placeholder="请选择组别" class="select">
|
||||
<el-option v-for="(item, index) in groupOptions" :key="index" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select> -->
|
||||
<el-input v-model="form.groupCode" placeholder="请输入组别" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -374,6 +279,15 @@
|
||||
<el-input v-model.number="form.sort" placeholder="请输入序号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item label="选择时段" prop="workOrderNum">
|
||||
<el-date-picker
|
||||
v-model="value1"
|
||||
type="datetimerange"
|
||||
range-separator="To"
|
||||
start-placeholder="开始"
|
||||
end-placeholder="结束时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-col :lg="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注" />
|
||||
@ -629,32 +543,27 @@ var dictParams = []
|
||||
|
||||
const allList = ref([])
|
||||
const lackMaterialCodeTotal = computed(() => {
|
||||
// 根据 count 的值计算出新的值
|
||||
return allList.value.filter((item) => item.isMatch_material_code === null).length
|
||||
})
|
||||
const lackMaterialNameTotal = computed(() => {
|
||||
// 根据 count 的值计算出新的值
|
||||
return allList.value.filter((item) => item.isMatch_material_name === null).length
|
||||
})
|
||||
const lackLineTotal = computed(() => {
|
||||
// 根据 count 的值计算出新的值
|
||||
return allList.value.filter((item) => item.isMatch_line === null).length
|
||||
})
|
||||
const lackGroupTotal = computed(() => {
|
||||
// 根据 count 的值计算出新的值
|
||||
return allList.value.filter((item) => item.isMatch_group === null).length
|
||||
})
|
||||
const lackMatchUnitTotal = computed(() => {
|
||||
// 根据 count 的值计算出新的值
|
||||
return allList.value.filter((item) => item.isMatch_Unit === null).length
|
||||
})
|
||||
|
||||
// 日期格式化函数
|
||||
// 日期格式化函数(仅用于页面展示)
|
||||
function formatDate(dateString) {
|
||||
if (!dateString) return ''
|
||||
|
||||
const date = new Date(dateString)
|
||||
if (isNaN(date.getTime())) return '' // 检查日期是否有效
|
||||
if (isNaN(date.getTime())) return ''
|
||||
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
@ -751,7 +660,6 @@ function handleQuery() {
|
||||
// 重置查询操作
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryRef')
|
||||
// 重置日期范围为当前日期
|
||||
queryParams.workorderDate = [new Date(), new Date()]
|
||||
handleQuery()
|
||||
}
|
||||
@ -785,7 +693,6 @@ function tableCellClassName({ row, column, rowIndex, columnIndex }) {
|
||||
if (row.isMatch_Unit === null && column.label === '单位') {
|
||||
return 'danger-cell-1'
|
||||
}
|
||||
// return 'common-row'
|
||||
}
|
||||
/*************** form操作 ***************/
|
||||
const formRef = ref()
|
||||
@ -805,7 +712,7 @@ const state = reactive({
|
||||
lineCode: [{ required: true, message: '线别不能为空', trigger: 'blur' }]
|
||||
},
|
||||
options: {
|
||||
// 工单状态 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
|
||||
// 工单状态 选项列表
|
||||
statusOptions: [],
|
||||
// 优先级
|
||||
priorityOptions: [
|
||||
@ -819,7 +726,7 @@ const state = reactive({
|
||||
{ dictLabel: '个', dictValue: '个', listClass: 'info' },
|
||||
{ dictLabel: '件', dictValue: '件', listClass: 'info' }
|
||||
],
|
||||
// 是否足料(1-缺料 2-足料) 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
|
||||
// 是否足料
|
||||
isSufficientOptions: [
|
||||
{ dictLabel: '足料', dictValue: '2', listClass: '' },
|
||||
{ dictLabel: '缺料', dictValue: '1', listClass: '' },
|
||||
@ -844,29 +751,7 @@ async function initDict() {
|
||||
}
|
||||
/// ===================================================
|
||||
|
||||
/// ===================== 获取单位下拉 ====================
|
||||
// import { listBaseUnit } from '@/api/baseManagement/baseunit.js'
|
||||
// function getUnitOptions() {
|
||||
// const params = {
|
||||
// status: 1
|
||||
// }
|
||||
// listBaseUnit(params).then((res) => {
|
||||
// if (res.code === 200) {
|
||||
// options.value.unitOptions = res.data.result.map((item) => {
|
||||
// return {
|
||||
// dictLabel: `${item.unitName}`,
|
||||
// dictValue: `${item.unitCode}`
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// getUnitOptions()
|
||||
|
||||
/// ======================================================
|
||||
|
||||
/// ===================== 获取线别下拉,组别下拉 =======================
|
||||
|
||||
const lineOptions = ref([])
|
||||
function getFormLineOptions(clear = false) {
|
||||
lineOptions.value = []
|
||||
@ -909,21 +794,6 @@ function getGroupOptions(routeCode = null) {
|
||||
}
|
||||
})
|
||||
}
|
||||
// import { listBaseGroup } from '@/api/baseManagement/basegroup.js'
|
||||
// function getAllGroupOptions() {
|
||||
// listBaseGroup({ pageNum: 1, pageSize: 100, status: 1 }).then((res) => {
|
||||
// const { code, data } = res
|
||||
// if (code == 200) {
|
||||
// groupOptions.value = data.result.map((item) => {
|
||||
// return {
|
||||
// label: `${item.groupCode}-${item.groupName}`,
|
||||
// value: `${item.groupCode}`
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// getAllGroupOptions()
|
||||
/// =================================================================
|
||||
|
||||
// 关闭dialog
|
||||
@ -934,11 +804,14 @@ function cancel() {
|
||||
|
||||
// 重置表单
|
||||
function reset() {
|
||||
// 初始化日期为 ISO 格式(2026-01-13T00:00:00 样式)
|
||||
const today = new Date()
|
||||
const isoDate = new Date(today.setHours(0, 0, 0, 0)).toISOString().slice(0, 19)
|
||||
|
||||
form.value = {
|
||||
id: null,
|
||||
productionName: null,
|
||||
productionCode: null,
|
||||
// productionCodeList: [],
|
||||
specification: '',
|
||||
customCode: null,
|
||||
deliveryNum: 0,
|
||||
@ -948,13 +821,12 @@ function reset() {
|
||||
groupCode: null,
|
||||
lineCode: null,
|
||||
sort: 1,
|
||||
workorderDate: new Date().toISOString().split('T')[0], // 使用原生JS获取当前日期
|
||||
workorderDate: isoDate, // 保持ISO格式
|
||||
year: null,
|
||||
week: null,
|
||||
date: null,
|
||||
priority: '2',
|
||||
status: 1,
|
||||
// beat工单节拍
|
||||
beat: 0,
|
||||
remark: null,
|
||||
createdBy: null,
|
||||
@ -964,13 +836,11 @@ function reset() {
|
||||
}
|
||||
search01.value = ''
|
||||
search02.value = ''
|
||||
// lineOptions.value = []
|
||||
// groupOptions.value = []
|
||||
proxy.resetForm('formRef')
|
||||
}
|
||||
|
||||
// 插入生产工单
|
||||
const nextId = ref('')
|
||||
|
||||
function handleAdd(id = -1) {
|
||||
reset()
|
||||
open.value = true
|
||||
@ -982,8 +852,8 @@ function handleAdd(id = -1) {
|
||||
} else {
|
||||
form.value.priority = 2
|
||||
}
|
||||
// getFormLineOptions()
|
||||
}
|
||||
|
||||
// 修改按钮操作
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
@ -995,30 +865,49 @@ function handleUpdate(row) {
|
||||
title.value = '修改生产工单'
|
||||
opertype.value = 2
|
||||
|
||||
// 确保回显的日期是 ISO 格式
|
||||
if (data.workorderDate && !(data.workorderDate.includes('T'))) {
|
||||
data.workorderDate = new Date(data.workorderDate).toISOString().slice(0, 19)
|
||||
}
|
||||
|
||||
form.value = {
|
||||
...data
|
||||
}
|
||||
// getFormLineOptions()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 添加&修改 表单提交
|
||||
// 添加&修改 表单提交 - 核心修改:确保提交的是 ISO 格式日期
|
||||
function submitForm(toNext = false) {
|
||||
proxy.$refs['formRef'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.id != undefined && opertype.value === 2) {
|
||||
updateProWorkorder(form.value).then((res) => {
|
||||
// 深拷贝表单数据,避免修改原数据
|
||||
const submitData = { ...form.value }
|
||||
|
||||
// 确保 workorderDate 是 2026-01-13T00:00:00 格式
|
||||
if (submitData.workorderDate) {
|
||||
// 如果是 Date 对象,转换为 ISO 格式
|
||||
if (submitData.workorderDate instanceof Date) {
|
||||
submitData.workorderDate = submitData.workorderDate.toISOString().slice(0, 19)
|
||||
}
|
||||
// 如果是 YYYY-MM-DD 字符串,转换为 ISO 格式
|
||||
else if (typeof submitData.workorderDate === 'string' && submitData.workorderDate.includes('-') && !submitData.workorderDate.includes('T')) {
|
||||
submitData.workorderDate = new Date(submitData.workorderDate + 'T00:00:00').toISOString().slice(0, 19)
|
||||
}
|
||||
}
|
||||
|
||||
if (submitData.id != undefined && opertype.value === 2) {
|
||||
updateProWorkorder(submitData).then((res) => {
|
||||
proxy.$modal.msgSuccess('修改成功')
|
||||
if (!toNext) {
|
||||
open.value = false
|
||||
}
|
||||
WorkOrderLog({ workorder: form.value.workorder, log: '修改' })
|
||||
WorkOrderLog({ workorder: submitData.workorder, log: '修改' })
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
form.value.next_id = nextId.value
|
||||
Insert_workOrder(form.value).then((res) => {
|
||||
submitData.next_id = nextId.value
|
||||
Insert_workOrder(submitData).then((res) => {
|
||||
proxy.$modal.msgSuccess('新增成功')
|
||||
if (!toNext) {
|
||||
open.value = false
|
||||
@ -1048,14 +937,13 @@ function handleDelete(row) {
|
||||
// 生成工单
|
||||
const createWorkOrderShow = ref(false)
|
||||
const createWorkOrderDate = ref(new Date())
|
||||
|
||||
function handleCreateWorkOrder() {
|
||||
createWorkOrderShow.value = true
|
||||
}
|
||||
|
||||
function submitCreateWorkOrder() {
|
||||
const submitData = {
|
||||
workorderDate: createWorkOrderDate.value
|
||||
workorderDate: createWorkOrderDate.value.toISOString().slice(0, 19) // 保持ISO格式
|
||||
}
|
||||
Generate_workorder(submitData).then((res) => {
|
||||
const { code, data } = res
|
||||
@ -1085,24 +973,19 @@ function handleMove(row, type) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
import { getToken } from '@/utils/auth'
|
||||
/*** 导入参数 */
|
||||
const upload = reactive({
|
||||
// 是否显示弹出层(导入)
|
||||
open: false,
|
||||
// 弹出层标题(导入)
|
||||
title: '',
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 是否更新数据
|
||||
updateSupport: 0,
|
||||
// 更新方式 1-覆盖 2-追加
|
||||
uploadType: 1,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: 'Bearer ' + getToken() },
|
||||
// 上传的地址
|
||||
url: import.meta.env.VITE_APP_BASE_API + '/mes/productManagement/ProWorkorder/importData'
|
||||
})
|
||||
|
||||
/** 导入按钮操作 */
|
||||
function handleImport(type) {
|
||||
if (type === 1) {
|
||||
@ -1114,17 +997,19 @@ function handleImport(type) {
|
||||
upload.uploadType = 2
|
||||
upload.url = import.meta.env.VITE_APP_BASE_API + '/mes/productManagement/ProWorkorder/importData_append'
|
||||
}
|
||||
|
||||
upload.open = true
|
||||
}
|
||||
|
||||
/** 下载模板操作 */
|
||||
function importTemplate() {
|
||||
proxy.download('/mes/productManagement/ProWorkorder/importTemplate', '工单数据导入模板')
|
||||
}
|
||||
|
||||
/**文件上传中处理 */
|
||||
const handleFileUploadProgress = (event, file, fileList) => {
|
||||
upload.isUploading = true
|
||||
}
|
||||
|
||||
/** 文件上传成功处理 */
|
||||
const handleFileSuccess = (response, file, fileList) => {
|
||||
const { code, msg, data } = response
|
||||
@ -1147,16 +1032,13 @@ const handleFileSuccess = (response, file, fileList) => {
|
||||
dangerouslyUseHTMLString: true
|
||||
})
|
||||
handleUpdatePaintingMrp()
|
||||
// submitCreateWorkOrder()
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 文件上传异常处理 */
|
||||
const handleFileError = (error, file, fileList) => {
|
||||
const { code, msg, data } = response
|
||||
if (error) {
|
||||
proxy.$message.error('模板导入异常!')
|
||||
return
|
||||
}
|
||||
proxy.$message.error('模板导入异常!')
|
||||
upload.isUploading = false
|
||||
}
|
||||
|
||||
/** 提交上传文件 */
|
||||
@ -1166,20 +1048,18 @@ function submitFileForm() {
|
||||
|
||||
/*** 导出参数 */
|
||||
const exportDialog = reactive({
|
||||
// 是否显示弹出层(导入)
|
||||
open: false,
|
||||
// 弹出层标题(导入)
|
||||
title: '',
|
||||
// 设置上传的请求头部
|
||||
time: new Date(),
|
||||
// 导出的地址
|
||||
url: '/mes/productManagement/ProWorkorder/export'
|
||||
})
|
||||
|
||||
// 导出弹框
|
||||
function handleExport() {
|
||||
exportDialog.title = '按日期导出工单Excel'
|
||||
exportDialog.open = true
|
||||
}
|
||||
|
||||
// 导出提交
|
||||
function submitExport() {
|
||||
proxy.$modal
|
||||
@ -1192,14 +1072,10 @@ function submitExport() {
|
||||
const time = exportDialog.time
|
||||
let dateString = `${time.getFullYear()}-${(time.getMonth() + 1).toString().padStart(2, '0')}-${time.getDate().toString().padStart(2, '0')}`
|
||||
proxy.download(exportDialog.url + '?extportDate=' + dateString, '工单数据导出模板')
|
||||
// await downFile(exportDialog.url, { extportDate: exportDialog.time })
|
||||
exportDialog.open = false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// =========== 生成物料需求计划MRP ===============
|
||||
import { GenerateMmRequirePlan } from '@/api/materialManagement/mmrequireplan.js'
|
||||
import { GenerateLineMmCallMRP } from '@/api/materialManagement/mmcallrequests/mmcallrequests.js'
|
||||
@ -1207,32 +1083,25 @@ const CreateMaterialPlanDialogShow = ref(false)
|
||||
const planDate = ref(new Date())
|
||||
const syncLoading = ref(false)
|
||||
const updateResults = ref([])
|
||||
|
||||
function openCreateMaterialPlanDialog() {
|
||||
CreateMaterialPlanDialogShow.value = true
|
||||
}
|
||||
|
||||
// 更新物流需求计划
|
||||
function handleCreateMaterialPlan() {
|
||||
// 清空之前的结果
|
||||
updateResults.value = []
|
||||
|
||||
// 获取所有线别
|
||||
const lines = allRouteOptions.value.map(item => item.value)
|
||||
|
||||
// 如果没有线别,直接返回
|
||||
if (lines.length === 0) {
|
||||
proxy.$modal.msgWarning('没有可更新的线别')
|
||||
return
|
||||
}
|
||||
|
||||
// 设置加载状态
|
||||
syncLoading.value = true
|
||||
|
||||
// 创建一个Promise数组来处理所有线别的更新
|
||||
const updatePromises = lines.map(lineCode => {
|
||||
// 格式化日期为YYYY-MM-DD格式
|
||||
const formattedDate = formatDate(planDate.value);
|
||||
const formattedDate = new Date(planDate.value).toISOString().slice(0, 19)
|
||||
return GenerateMmRequirePlan({ lineCode, plan_date: formattedDate }).then(res => {
|
||||
// 更新结果
|
||||
updateResults.value.push({
|
||||
lineCode: lineCode,
|
||||
status: res.code === 200 ? '成功' : '失败',
|
||||
@ -1240,7 +1109,6 @@ function handleCreateMaterialPlan() {
|
||||
})
|
||||
return res
|
||||
}).catch(error => {
|
||||
// 更新结果
|
||||
updateResults.value.push({
|
||||
lineCode: lineCode,
|
||||
status: '失败',
|
||||
@ -1250,7 +1118,6 @@ function handleCreateMaterialPlan() {
|
||||
})
|
||||
})
|
||||
|
||||
// 等待所有更新完成
|
||||
Promise.all(updatePromises).then(() => {
|
||||
syncLoading.value = false
|
||||
proxy.$modal.msgSuccess('所有线别更新完成')
|
||||
@ -1263,27 +1130,18 @@ function handleCreateMaterialPlan() {
|
||||
|
||||
// 更新涂装MRP
|
||||
function handleUpdatePaintingMrp() {
|
||||
// 清空之前的结果
|
||||
updateResults.value = []
|
||||
|
||||
// 获取所有线别
|
||||
const lines = allRouteOptions.value.map(item => item.value)
|
||||
|
||||
// 如果没有线别,直接返回
|
||||
if (lines.length === 0) {
|
||||
proxy.$modal.msgWarning('没有可更新的线别')
|
||||
return
|
||||
}
|
||||
|
||||
// 设置加载状态
|
||||
syncLoading.value = true
|
||||
|
||||
// 创建一个Promise数组来处理所有线别的更新
|
||||
const updatePromises = lines.map(lineCode => {
|
||||
// 格式化日期为YYYY-MM-DD格式
|
||||
const formattedDate = formatDate(planDate.value);
|
||||
const formattedDate = new Date(planDate.value).toISOString().slice(0, 19)
|
||||
return GenerateLineMmCallMRP({ lineCode, workOrderDate: formattedDate }).then(res => {
|
||||
// 更新结果
|
||||
updateResults.value.push({
|
||||
lineCode: lineCode,
|
||||
status: res.msg === 'ok' ? '成功' : '更新失败',
|
||||
@ -1291,7 +1149,6 @@ function handleUpdatePaintingMrp() {
|
||||
})
|
||||
return res
|
||||
}).catch(error => {
|
||||
// 更新结果
|
||||
updateResults.value.push({
|
||||
lineCode: lineCode,
|
||||
status: '失败',
|
||||
@ -1301,7 +1158,6 @@ function handleUpdatePaintingMrp() {
|
||||
})
|
||||
})
|
||||
|
||||
// 等待所有更新完成
|
||||
Promise.all(updatePromises).then(() => {
|
||||
syncLoading.value = false
|
||||
proxy.$modal.msgSuccess('所有线别更新完成')
|
||||
@ -1317,6 +1173,7 @@ function handleUpdatePaintingMrp() {
|
||||
const search01 = ref('')
|
||||
const search01Loading = ref(false)
|
||||
const search01Options = ref([])
|
||||
|
||||
function querySearch01(query) {
|
||||
search01Loading.value = true
|
||||
GetMaterialInfo({ Name_or_Code: query }).then((res) => {
|
||||
@ -1333,14 +1190,17 @@ function querySearch01(query) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function search01Change(value) {
|
||||
form.value.productionName = value.name
|
||||
form.value.productionCode = value.code
|
||||
form.value.specification = value.specification
|
||||
}
|
||||
|
||||
const search02 = ref('')
|
||||
const search02Loading = ref(false)
|
||||
const search02Options = ref([])
|
||||
|
||||
function querySearch02(query) {
|
||||
GetCustomInfo({ CustomNo: query }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
@ -1354,6 +1214,7 @@ function querySearch02(query) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function search02Change(value) {
|
||||
form.value.customCode = value
|
||||
}
|
||||
@ -1361,18 +1222,14 @@ function search02Change(value) {
|
||||
|
||||
/// ============= 更新BOM表 ===============
|
||||
import { GeneratePaintBOM } from '@/api/materialManagement/mmcallrequests/mmcallrequests.js'
|
||||
// 同步涂装车间BOM清单
|
||||
let isSyncing = false
|
||||
|
||||
|
||||
|
||||
/// ======================================
|
||||
|
||||
|
||||
/// ======================= BOM展示 ======================
|
||||
const bomListShow = ref(false)
|
||||
const bomList = ref([])
|
||||
const selectMaterialCode = ref('')
|
||||
|
||||
function showBOM(row) {
|
||||
const params = {
|
||||
workorder_num: row.workorder
|
||||
@ -1384,12 +1241,8 @@ function showBOM(row) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// ======================================================
|
||||
|
||||
|
||||
|
||||
|
||||
/// ================= 工单打印 =========================
|
||||
const PrintDialogShow = ref(false)
|
||||
const printList = ref([])
|
||||
@ -1397,10 +1250,12 @@ const printObj = {
|
||||
id: 'printTable',
|
||||
popTitle: '工单打印'
|
||||
}
|
||||
|
||||
function handlePrint() {
|
||||
PrintDialogShow.value = true
|
||||
printList.value = getPrintList()
|
||||
}
|
||||
|
||||
function getPrintList() {
|
||||
const _list = allList.value
|
||||
const groupedData = _list.reduce((acc, item) => {
|
||||
@ -1413,6 +1268,7 @@ function getPrintList() {
|
||||
}, {})
|
||||
return Object.values(groupedData)
|
||||
}
|
||||
|
||||
// 获取打印时间
|
||||
function getPrintTime() {
|
||||
if (queryParams.workorderDate != null && queryParams.workorderDate.length > 0) {
|
||||
@ -1425,6 +1281,9 @@ function getPrintTime() {
|
||||
}
|
||||
/// ================================================
|
||||
|
||||
// 初始化变量
|
||||
const value1 = ref('')
|
||||
|
||||
initDict()
|
||||
handleQuery()
|
||||
</script>
|
||||
@ -1443,18 +1302,6 @@ handleQuery()
|
||||
width: 500px !important;
|
||||
}
|
||||
|
||||
/* :deep(.table-header) {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
background: black;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
:deep(.common-row) {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
} */
|
||||
|
||||
:deep(.warning-cell-1) {
|
||||
background-color: #e6a23c !important;
|
||||
color: black;
|
||||
@ -1532,17 +1379,12 @@ handleQuery()
|
||||
.qrCode {
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
/* width: 36px !important;
|
||||
height: 36px !important; */
|
||||
}
|
||||
|
||||
td {
|
||||
white-space: normal;
|
||||
/* 允许内容换行 */
|
||||
word-break: break-all;
|
||||
/* 在长单词或URL需要时允许换行 */
|
||||
overflow: hidden;
|
||||
/* 隐藏超出的部分 */
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user