master
吴普建 12 months ago
parent 003897fbc2
commit 1a9689c228

@ -2,31 +2,34 @@ import { request } from '~/src/service/request';
// 获取列表 // 获取列表
export const getWorkbenchEnamellingList = (params: any) => { export const getWorkbenchEnamellingList = (params: any) => {
return request.get('/md/mes/md/mdWorkbenchEnamelling/list', { params }); return request.get('/md/mes/md/mdWorkbenchEnamelling/list', { params });
};
export const getMdPrintData = (params: any) => {
return request.get('/mes/md/mdPrintData', { params });
}; };
export const selectAllWorkbenchEnamellingList = (params: any) => { export const selectAllWorkbenchEnamellingList = (params: any) => {
return request.get('/md/mes/md/mdWorkbenchEnamelling/selectAll', { params }); return request.get('/md/mes/md/mdWorkbenchEnamelling/selectAll', { params });
}; };
// 通过ID查询单条数据 // 通过ID查询单条数据
export const queryWorkbenchEnamellingById = (params: any) => { export const queryWorkbenchEnamellingById = (params: any) => {
return request.get(`/md/mes/md/mdWorkbenchEnamelling/${params.id}`); return request.get(`/md/mes/md/mdWorkbenchEnamelling/${params.id}`);
}; };
// 删除产品 // 删除产品
export const deleteWorkbenchEnamelling = (params: any) => { export const deleteWorkbenchEnamelling = (params: any) => {
return request.delete(`/md/mes/md/mdWorkbenchEnamelling/${params.id}`); return request.delete(`/md/mes/md/mdWorkbenchEnamelling/${params.id}`);
}; };
// 新增产品 // 新增产品
export const addWorkbenchEnamelling = (data: any) => { export const addWorkbenchEnamelling = (data: any) => {
return request.post(`/md/mes/md/mdWorkbenchEnamelling`, data); return request.post(`/md/mes/md/mdWorkbenchEnamelling`, data);
}; };
// 编辑 // 编辑
export const editWorkbenchEnamelling = (data: any) => { export const editWorkbenchEnamelling = (data: any) => {
return request.put(`/md/mes/md/mdWorkbenchEnamelling`, data); return request.put(`/md/mes/md/mdWorkbenchEnamelling`, data);
}; };
// 启用禁用 // 启用禁用
export const updateIsEnable = (data: any) => { export const updateIsEnable = (data: any) => {
return request.put(`/md/mes/md/mdWorkbenchEnamelling/updateEnable`, data); return request.put(`/md/mes/md/mdWorkbenchEnamelling/updateEnable`, data);
}; };

@ -1,143 +1,144 @@
<template> <template>
<div> <div>
<my-card title="搜索条件" search> <my-card title="搜索条件" search>
<n-form label-placement="top" class="flex gap-2" style="display: flex; flex-wrap: wrap"> <n-form label-placement="top" class="flex gap-2" style="display: flex; flex-wrap: wrap">
<n-form-item label="工单类型"> <n-form-item label="工单类型">
<n-select <n-select
v-model:value="searchForm.taskType" v-model:value="searchForm.taskType"
placeholder="请选择工单类型" placeholder="请选择工单类型"
class="w-160px" class="w-160px"
:options="processOptions" :options="processOptions"
:style="{ width: formItemWidth }" :style="{ width: formItemWidth }"
@update-value="selectTaskType" @update-value="selectTaskType"
></n-select> ></n-select>
</n-form-item> </n-form-item>
<n-form-item label="生产工单号"> <n-form-item label="生产工单号">
<n-input <n-input
v-model:value="searchForm.taskSn" v-model:value="searchForm.taskSn"
type="text" type="text"
placeholder="生产工单号" placeholder="生产工单号"
:style="{ width: formItemWidth }" :style="{ width: formItemWidth }"
/> />
</n-form-item> </n-form-item>
<n-form-item label="机台"> <n-form-item label="机台">
<n-select <n-select
v-model:value="searchForm.workstationId" v-model:value="searchForm.workstationId"
placeholder="请选择机台" placeholder="请选择机台"
:options="machineList" :options="machineList"
class="w-160px" class="w-160px"
:style="{ width: formItemWidth }" :style="{ width: formItemWidth }"
></n-select> ></n-select>
</n-form-item> </n-form-item>
<n-form-item label="报工时间"> <n-form-item label="报工时间">
<n-date-picker v-model:value="range" type="datetimerange" clearable /> <n-date-picker v-model:value="range" type="datetimerange" clearable />
</n-form-item> </n-form-item>
<n-form-item label="批号"> <n-form-item label="批号">
<n-input <n-input
v-model:value="searchForm.batchCode" v-model:value="searchForm.batchCode"
placeholder="请输入批号" placeholder="请输入批号"
:style="{ width: formItemWidth }" :style="{ width: formItemWidth }"
></n-input> ></n-input>
</n-form-item> </n-form-item>
<n-form-item label="规格"> <n-form-item label="规格">
<n-input <n-input
v-model:value="searchForm.itemSpecification" v-model:value="searchForm.itemSpecification"
placeholder="请输入规格" placeholder="请输入规格"
:style="{ width: formItemWidth }" :style="{ width: formItemWidth }"
></n-input> ></n-input>
</n-form-item> </n-form-item>
<!-- <n-form-item label="贸易商"> <!-- <n-form-item label="贸易商">
<n-select <n-select
v-model:value="ingredientsId" v-model:value="ingredientsId"
placeholder="请选择贸易商" placeholder="请选择贸易商"
:filterable="true" :filterable="true"
:options="merchantList" :options="merchantList"
:style="{ width: formItemWidth }" :style="{ width: formItemWidth }"
@update-value="(val, item: any) => { @update-value="(val, item: any) => {
searchForm.ingredientsName = item.label; searchForm.ingredientsName = item.label;
} }
" "
></n-select> ></n-select>
</n-form-item> </n-form-item>
<n-form-item label="规格"> <n-form-item label="规格">
<n-select <n-select
v-model:value="itemId" v-model:value="itemId"
placeholder="选择规格" placeholder="选择规格"
:filterable="true" :filterable="true"
:options="specificationList" :options="specificationList"
:style="{ width: formItemWidth }" :style="{ width: formItemWidth }"
@update-value="(val, item: any) => { @update-value="(val, item: any) => {
searchForm.itemSpecification = item.label; searchForm.itemSpecification = item.label;
} }
" "
></n-select> ></n-select>
</n-form-item> </n-form-item>
<n-form-item label="材料厂家"> <n-form-item label="材料厂家">
<n-select <n-select
v-model:value="manufacturerId" v-model:value="manufacturerId"
placeholder="选择材料厂家" placeholder="选择材料厂家"
:filterable="true" :filterable="true"
:options="manufacturerList" :options="manufacturerList"
@update-value="(val, item: any) => { @update-value="(val, item: any) => {
searchForm.manufacturerName = item.label; searchForm.manufacturerName = item.label;
} }
" "
></n-select> ></n-select>
</n-form-item> </n-form-item>
<n-form-item label="称重时间"> <n-form-item label="称重时间">
<n-date-picker <n-date-picker
v-model:formatted-value="searchForm.weightTime" v-model:formatted-value="searchForm.weightTime"
type="date" type="date"
:style="{ width: formItemWidth }" :style="{ width: formItemWidth }"
clearable clearable
/> />
</n-form-item> --> </n-form-item> -->
<n-form-item label="投料二维码"> <n-form-item label="投料二维码">
<n-input <n-input
v-model:value="searchForm.inputSn" v-model:value="searchForm.inputSn"
placeholder="请输入投料二维码" placeholder="请输入投料二维码"
:style="{ width: formItemWidth }" :style="{ width: formItemWidth }"
></n-input> ></n-input>
</n-form-item> </n-form-item>
<n-form-item label="报工二维码"> <n-form-item label="报工二维码">
<n-input <n-input
v-model:value="searchForm.outputSn" v-model:value="searchForm.outputSn"
placeholder="请输入报工二维码" placeholder="请输入报工二维码"
:style="{ width: formItemWidth }" :style="{ width: formItemWidth }"
></n-input> ></n-input>
</n-form-item> </n-form-item>
<n-form-item> <n-form-item>
<component :is="useSearchBtn(search, resetThen)"></component> <component :is="useSearchBtn(search, resetThen)"></component>
</n-form-item> </n-form-item>
</n-form> </n-form>
</my-card> </my-card>
<my-card title="报工记录"> <my-card title="报工记录">
<template #right> <template #right>
<div style="display: flex"> <div style="display: flex">
<!-- <n-button type="info" size="small" style="margin-right: 10px" @click="lookReport"></n-button> --> <!-- <n-button type="info" size="small" style="margin-right: 10px" @click="lookReport"></n-button> -->
<CxColumns v-if="searchForm.taskType === 0" v-model:columns="lsColumns" /> <CxColumns v-if="searchForm.taskType === 0" v-model:columns="lsColumns" />
<CxColumns v-else v-model:columns="qbColumns" /> <CxColumns v-else v-model:columns="qbColumns" />
</div> </div>
</template> </template>
<n-data-table <n-data-table
:loading="loading" :loading="loading"
:columns="searchForm.taskType === 0 ? lsColumns : qbColumns" :columns="searchForm.taskType === 0 ? lsColumns : qbColumns"
:data="data" :data="data"
:scroll-x="dataTableConfig.scrollWidth(columns)" :scroll-x="dataTableConfig.scrollWidth(columns)"
:max-height="dataTableConfig.maxHeight" :max-height="dataTableConfig.maxHeight"
></n-data-table> ></n-data-table>
<my-pagination v-model:search-form="searchForm" @init="init"></my-pagination> <my-pagination v-model:search-form="searchForm" @init="init"></my-pagination>
</my-card> </my-card>
</div> </div>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import type { Ref } from 'vue'; import type { Ref } from 'vue';
import { hiprint } from 'vue-plugin-hiprint';
import type { DataTableColumns } from 'naive-ui'; import type { DataTableColumns } from 'naive-ui';
import { getWorkbenchWiredrawingList } from '@/service/api/md/workbench/wiredrawing'; import { getWorkbenchWiredrawingList } from '@/service/api/md/workbench/wiredrawing';
import { getWorkbenchEnamellingList } from '@/service/api/md/workbench/enamelling'; import { getWorkbenchEnamellingList, getMdPrintData } from '@/service/api/md/workbench/enamelling';
// import { getMaterialList } from '@/service/api/md/itemlist/index'; // import { getMaterialList } from '@/service/api/md/itemlist/index';
// import { getIngredientsTradersList } from '@/service/api/md/ingredients/traders'; // import { getIngredientsTradersList } from '@/service/api/md/ingredients/traders';
// import { getIngredientsManufacturerList } from '@/service/api/md/ingredients/manufacturer'; // import { getIngredientsManufacturerList } from '@/service/api/md/ingredients/manufacturer';
@ -147,23 +148,26 @@ import { useLoading } from '~/src/hooks';
import { getOutputLog } from '~/src/service/api/produre/workRecords/index'; import { getOutputLog } from '~/src/service/api/produre/workRecords/index';
import { formatDate } from '~/src/utils/form/rule'; import { formatDate } from '~/src/utils/form/rule';
import { useResetSearch } from '~/src/utils/common/searchReset'; import { useResetSearch } from '~/src/utils/common/searchReset';
import { useSocketStore } from '@/store/modules/socket';
const { loading, startLoading, endLoading } = useLoading(); const { loading, startLoading, endLoading } = useLoading();
const socketStore = useSocketStore();
const { searchForm, reset } = useResetSearch({ const { searchForm, reset } = useResetSearch({
taskSn: '', // taskSn: '', //
workstationId: null, // workstationId: null, //
taskType: 0, // taskType: 0, //
orderSn: '', // orderSn: '', //
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
batchCode: '', batchCode: '',
ingredientsName: '', ingredientsName: '',
manufacturerName: '', manufacturerName: '',
itemSpecification: '', itemSpecification: '',
weightTime: null, weightTime: null,
outputSn: '', outputSn: '',
inputSn: '' inputSn: ''
}); });
const ingredientsId = ref<number | null>(null); const ingredientsId = ref<number | null>(null);
@ -171,14 +175,14 @@ const manufacturerId = ref<number | null>(null);
const itemId = ref<number | null>(null); const itemId = ref<number | null>(null);
const processOptions = [ const processOptions = [
{ {
value: 0, value: 0,
label: '金属' label: '金属'
}, },
{ {
value: 1, value: 1,
label: '板材' label: '板材'
} }
]; ];
const machineList = ref<{ label: string; value: number }[]>([]); const machineList = ref<{ label: string; value: number }[]>([]);
@ -197,147 +201,166 @@ const columnsFilterData = ref<Array<string>>(['alexPositionNumber', 'alexLot']);
const data = ref<workRecords.TabelList[]>([]); const data = ref<workRecords.TabelList[]>([]);
const columns: Ref<DataTableColumns<workRecords.TabelList>> = ref([ const columns: Ref<DataTableColumns<workRecords.TabelList>> = ref([
{ {
title: '序号', title: '序号',
key: 'index', key: 'index',
align: 'center', align: 'center',
width: 70, width: 70,
render: (_row, index) => (searchForm.value.pageNum - 1) * searchForm.value.pageSize + index + 1 render: (_row, index) => (searchForm.value.pageNum - 1) * searchForm.value.pageSize + index + 1
}, },
{ {
title: '工单类型', title: '工单类型',
align: 'center', align: 'center',
key: 'taskType', key: 'taskType',
width: 100, width: 100,
render: row => { render: row => {
return row.taskType === '0' ? '金属' : '板材'; return row.taskType === '0' ? '金属' : '板材';
} }
}, },
{ {
title: '机台', title: '机台',
align: 'center', align: 'center',
key: 'workstationCode', key: 'workstationCode',
width: 100 width: 100
}, },
{ {
title: '轴位置数', title: '轴位置数',
align: 'center', align: 'center',
key: 'alexPositionNumber', key: 'alexPositionNumber',
width: 100 width: 100
}, },
{ {
title: '批次', title: '批次',
align: 'center', align: 'center',
key: 'alexLot', key: 'alexLot',
width: 100 width: 100
}, },
{ {
title: '订单类型', title: '订单类型',
align: 'center', align: 'center',
key: 'orderType', key: 'orderType',
width: 100, width: 100,
render: row => { render: row => {
return row.orderType === '0' ? '客户订单' : '备库订单'; return row.orderType === '0' ? '客户订单' : '备库订单';
} }
}, },
{ {
title: '客户', title: '客户',
align: 'center', align: 'center',
key: 'clientName', key: 'clientName',
width: 150, width: 150,
ellipsis: { ellipsis: {
tooltip: true tooltip: true
} }
}, },
{ {
title: '生产工单号', title: '生产工单号',
align: 'center', align: 'center',
key: 'taskSn', key: 'taskSn',
width: 140, width: 140,
ellipsis: { ellipsis: {
tooltip: true tooltip: true
} }
}, },
{ {
title: '投料二维码', title: '投料二维码',
align: 'center', align: 'center',
key: 'inputSn', key: 'inputSn',
width: 140, width: 140,
render: row => { render: row => {
return ( return (
<n-space> <n-space>
<n-ellipsis line-clamp="1">{row.inputSn}</n-ellipsis> <n-ellipsis line-clamp="1">{row.inputSn}</n-ellipsis>
</n-space> </n-space>
); );
} }
}, },
{ {
title: '报工二维码', title: '报工二维码',
align: 'center', align: 'center',
key: 'outputSn', key: 'outputSn',
width: 140, width: 140,
render: row => { render: row => {
return ( return (
<n-space> <n-space>
<n-ellipsis line-clamp="1">{row.outputSn}</n-ellipsis> <n-ellipsis line-clamp="1">{row.outputSn}</n-ellipsis>
</n-space> </n-space>
); );
} }
}, },
{ {
title: '产品型号', title: '产品型号',
align: 'center', align: 'center',
key: 'productModel', key: 'productModel',
width: 100 width: 100
}, },
{ {
title: '产品规格', title: '产品规格',
align: 'center', align: 'center',
key: 'productSpecification', key: 'productSpecification',
width: 100 width: 100
}, },
{ {
title: '报工数量', title: '报工数量(副)',
align: 'center', align: 'center',
key: 'outputWeight', key: 'outputWeight',
width: 100 width: 100
}, },
{ {
title: '报工规格', title: '报工规格',
align: 'center', align: 'center',
key: 'itemSpecification', key: 'itemSpecification',
width: 100 width: 100
}, },
{ {
title: '单位', title: '单位',
align: 'center', align: 'center',
key: 'measureName', key: 'measureName',
width: 100 width: 100
}, },
{ {
title: '报工时间', title: '报工时间',
align: 'center', align: 'center',
key: 'createTime', key: 'createTime',
width: 180 width: 180
}, },
{ {
title: '报工人', title: '报工人',
align: 'center', align: 'center',
key: 'createBy', key: 'createBy',
width: 100 width: 100
}, },
{ {
title: '报工工号', title: '报工工号',
align: 'center', align: 'center',
key: 'jobNumber', key: 'jobNumber',
width: 100 width: 100
}, },
{ {
title: '批号', title: '批号',
align: 'center', align: 'center',
key: 'batchCode', key: 'batchCode',
width: 100 width: 100
} },
{
title: '操作',
key: 'action',
fixed: 'right',
width: 100,
render(row) {
return (
<n-button
type="primary"
size="tiny"
onClick={() => {
printTemp(row);
}}
>
补打标签
</n-button>
);
}
}
]); ]);
const lsColumns: Ref<DataTableColumns<workRecords.TabelList>> = ref([]); const lsColumns: Ref<DataTableColumns<workRecords.TabelList>> = ref([]);
@ -345,61 +368,61 @@ const lsColumns: Ref<DataTableColumns<workRecords.TabelList>> = ref([]);
const qbColumns: Ref<DataTableColumns<workRecords.TabelList>> = ref([]); const qbColumns: Ref<DataTableColumns<workRecords.TabelList>> = ref([]);
function search(): void { function search(): void {
if (range.value !== null) { if (range.value !== null) {
searchForm.value['params[beginTime]'] = formatDate(new Date(range.value[0]), 'yyyy-MM-dd'); searchForm.value['params[beginTime]'] = formatDate(new Date(range.value[0]), 'yyyy-MM-dd');
searchForm.value['params[endTime]'] = formatDate(new Date(range.value[1]), 'yyyy-MM-dd'); searchForm.value['params[endTime]'] = formatDate(new Date(range.value[1]), 'yyyy-MM-dd');
} else { } else {
searchForm.value['params[beginTime]'] = null; searchForm.value['params[beginTime]'] = null;
searchForm.value['params[endTime]'] = null; searchForm.value['params[endTime]'] = null;
} }
init(); init();
} }
function resetThen(): void { function resetThen(): void {
reset(); reset();
ingredientsId.value = null; ingredientsId.value = null;
manufacturerId.value = null; manufacturerId.value = null;
itemId.value = null; itemId.value = null;
range.value = null; range.value = null;
search(); search();
} }
function selectTaskType(value: number) { function selectTaskType(value: number) {
if (value === searchForm.value.taskType) return; if (value === searchForm.value.taskType) return;
searchForm.value.taskType = value; searchForm.value.taskType = value;
searchForm.value.workstationId = null; searchForm.value.workstationId = null;
init(); init();
if (searchForm.value.taskType === 0) { if (searchForm.value.taskType === 0) {
machineList.value = []; machineList.value = [];
wiredrawingList.value.forEach(item => { wiredrawingList.value.forEach(item => {
machineList.value.push({ machineList.value.push({
label: item.label, label: item.label,
value: item.value value: item.value
}); });
}); });
lsColumns.value = columns.value.filter((item: any) => !columnsFilterData.value.includes(item.key)); lsColumns.value = columns.value.filter((item: any) => !columnsFilterData.value.includes(item.key));
} else { } else {
qbColumns.value = columns.value.map(item => item); qbColumns.value = columns.value.map(item => item);
if (isGetEnamelCoverList.value) { if (isGetEnamelCoverList.value) {
machineList.value = []; machineList.value = [];
enamellingList.value.forEach(item => { enamellingList.value.forEach(item => {
machineList.value.push({ machineList.value.push({
label: item.label, label: item.label,
value: item.value value: item.value
}); });
}); });
return; return;
} }
getWorkbenchEnamellingList({ pageSize: 999 }).then(res => { getWorkbenchEnamellingList({ pageSize: 999 }).then(res => {
isGetEnamelCoverList.value = true; isGetEnamelCoverList.value = true;
res.rows.forEach((item: { equipmentCode: any; id: any }) => { res.rows.forEach((item: { equipmentCode: any; id: any }) => {
enamellingList.value.push({ enamellingList.value.push({
label: item.equipmentCode, label: item.equipmentCode,
value: item.id value: item.id
}); });
}); });
machineList.value = enamellingList.value; machineList.value = enamellingList.value;
}); });
} }
} }
// function lookReport() { // function lookReport() {
// let url = 'http://huaerda-jimu.24yt.com/jmreport/view/989752370909216768'; // let url = 'http://huaerda-jimu.24yt.com/jmreport/view/989752370909216768';
@ -456,33 +479,69 @@ function selectTaskType(value: number) {
// }); // });
// } // }
function printTemp(row: any) {
let printData = row.printObj;
if (window.hiwebSocket?.opened) {
if (!printData) {
window.$message?.error('补打数据为空,不可打印!');
return;
}
const hiprintTemplate = new hiprint.PrintTemplate({ template: JSON.parse(printData?.templateJson) });
hiprintTemplate.print2(JSON.parse(printData?.templateData));
} else {
window.$message?.error('客户端未连接,无法直接打印');
}
// getMdPrintData({bizId: id}).then(res => {
// console.log(res)
// })
// socketStore.setMsg(
// JSON.stringify({
// templateType: 'paintStorage',
// printValue: [rawMaterial1Row.value],
// reprintData: reprintDatas
// })
// );
// window.$message?.success('');
// if (window.hiwebSocket.opened) {
// if (!printData) {
// window.$message?.error('');
// return;
// }
// const hiprintTemplate = new hiprint.PrintTemplate({ template: JSON.parse(printData?.templateJson) });
// hiprintTemplate.print2(JSON.parse(printData?.templateData));
// } else {
// window.$message?.error(',');
// }
}
function init() { function init() {
startLoading(); startLoading();
getOutputLog({ ...searchForm.value }).then(res => { getOutputLog({ ...searchForm.value }).then(res => {
if (res.code === 200) { if (res.code === 200) {
data.value = res.rows; data.value = res.rows;
searchForm.value.total = res.total; searchForm.value.total = res.total;
} }
endLoading(); endLoading();
}); });
if (isGetWiredrawingList.value) return; if (isGetWiredrawingList.value) return;
getWorkbenchWiredrawingList({ pageSize: 999 }).then(res => { getWorkbenchWiredrawingList({ pageSize: 999 }).then(res => {
if (res.code === 200) { if (res.code === 200) {
isGetWiredrawingList.value = true; isGetWiredrawingList.value = true;
res.rows.forEach((item: { equipmentCode: any; id: any }) => { res.rows.forEach((item: { equipmentCode: any; id: any }) => {
wiredrawingList.value.push({ wiredrawingList.value.push({
label: item.equipmentCode, label: item.equipmentCode,
value: item.id value: item.id
}); });
}); });
machineList.value = wiredrawingList.value; machineList.value = wiredrawingList.value;
} }
}); });
} }
onMounted(() => { onMounted(() => {
init(); init();
// getList(); // getList();
lsColumns.value = columns.value.filter((item: any) => !columnsFilterData.value.includes(item.key)); lsColumns.value = columns.value.filter((item: any) => !columnsFilterData.value.includes(item.key));
}); });
</script> </script>

Loading…
Cancel
Save