From 722fbd988c81f77a8b224194e03268372f119536 Mon Sep 17 00:00:00 2001 From: zc Date: Tue, 17 Mar 2026 10:47:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 1 + src/apis/material/materialInfo.ts | 2 + src/apis/materialProcess/materialProcess.ts | 53 +++++++ src/apis/materialType/materialType.ts | 46 ++++++ src/hooks/app/materialProcess.ts | 22 +++ src/hooks/app/materialType.ts | 22 +++ src/types/components.d.ts | 10 ++ src/views/barcodePrint/index.vue | 17 +- src/views/material/MaterialInfoAddModal.vue | 45 ++++++ src/views/material/index.vue | 5 +- .../MaterialProcessAddModal.vue | 104 ++++++++++++ src/views/materialProcess/index.vue | 130 +++++++++++++++ .../materialType/MaterialTypeAddModal.vue | 99 ++++++++++++ src/views/materialType/index.vue | 149 ++++++++++++++++++ src/views/weightManage/index.vue | 16 +- src/views/workOrder/index.vue | 6 +- 16 files changed, 700 insertions(+), 27 deletions(-) create mode 100644 src/apis/materialProcess/materialProcess.ts create mode 100644 src/apis/materialType/materialType.ts create mode 100644 src/hooks/app/materialProcess.ts create mode 100644 src/hooks/app/materialType.ts create mode 100644 src/views/materialProcess/MaterialProcessAddModal.vue create mode 100644 src/views/materialProcess/index.vue create mode 100644 src/views/materialType/MaterialTypeAddModal.vue create mode 100644 src/views/materialType/index.vue diff --git a/package-lock.json b/package-lock.json index 0b82da4..85bd175 100644 --- a/package-lock.json +++ b/package-lock.json @@ -766,6 +766,7 @@ }, "node_modules/@clack/prompts/node_modules/is-unicode-supported": { "version": "1.3.0", + "extraneous": true, "inBundle": true, "license": "MIT", "engines": { diff --git a/src/apis/material/materialInfo.ts b/src/apis/material/materialInfo.ts index 0ea2719..67bbf79 100644 --- a/src/apis/material/materialInfo.ts +++ b/src/apis/material/materialInfo.ts @@ -3,6 +3,7 @@ import http from '@/utils/http' const BASE_URL = '/admin/materialInfo' export interface MaterialInfoResp { + id: string materialName: string encoding: string unitWeight: string @@ -13,6 +14,7 @@ export interface MaterialInfoResp { createUserString: string updateUserString: string disabled: boolean + photoLoadError: boolean } export interface MaterialInfoQuery { materialName: string | undefined diff --git a/src/apis/materialProcess/materialProcess.ts b/src/apis/materialProcess/materialProcess.ts new file mode 100644 index 0000000..e420b3b --- /dev/null +++ b/src/apis/materialProcess/materialProcess.ts @@ -0,0 +1,53 @@ +import http from '@/utils/http' +import type {LabelValueState} from "@/types/global"; + +const BASE_URL = '/materialProcess/materialProcess' + +export interface MaterialProcessResp { + id: string + processName: string + processCode: string + createTime: string + updateTime: string + createUser: string + updateUser: string + createUserString: string + updateUserString: string + disabled: boolean +} +export interface MaterialProcessQuery { + processName: string | undefined + processCode: string | undefined + sort: Array +} +export interface MaterialProcessPageQuery extends MaterialProcessQuery, PageQuery {} + +/** @desc 查询海康物料流程列表 */ +export function listMaterialProcess(query: MaterialProcessPageQuery) { + return http.get>(`${BASE_URL}`, query) +} + +/** @desc 查询海康物料流程详情 */ +export function selectList() { + return http.get(`${BASE_URL}/selectList`) +} + +/** @desc 新增海康物料流程 */ +export function addMaterialProcess(data: any) { + return http.post(`${BASE_URL}`, data) +} + +/** @desc 修改海康物料流程 */ +export function updateMaterialProcess(data: any, id: string) { + return http.put(`${BASE_URL}/${id}`, data) +} + +/** @desc 删除海康物料流程 */ +export function deleteMaterialProcess(id: string) { + return http.del(`${BASE_URL}/${id}`) +} + +/** @desc 导出海康物料流程 */ +export function exportMaterialProcess(query: MaterialProcessQuery) { + return http.download(`${BASE_URL}/export`, query) +} diff --git a/src/apis/materialType/materialType.ts b/src/apis/materialType/materialType.ts new file mode 100644 index 0000000..23f415b --- /dev/null +++ b/src/apis/materialType/materialType.ts @@ -0,0 +1,46 @@ +import http from '@/utils/http' + +const BASE_URL = '/materialType/materialType' + +export interface MaterialTypeResp { + id: string + typeName: string + floatRatio: string + createTime: string + updateTime: string + createUser: string + updateUser: string + createUserString: string + updateUserString: string + disabled: boolean +} +export interface MaterialTypeQuery { + typeName: string | undefined + sort: Array +} +export interface MaterialTypePageQuery extends MaterialTypeQuery, PageQuery {} + +/** @desc 查询物料品类列表 */ +export function listMaterialType(query: MaterialTypePageQuery) { + return http.get>(`${BASE_URL}`, query) +} + +/** @desc 新增物料品类 */ +export function selectList() { + return http.get(`${BASE_URL}/selectList`) +} + +/** @desc 修改物料品类 */ +export function updateMaterialType(data: any, id: string) { + return http.put(`${BASE_URL}/${id}`, data) +} + +/** @desc 删除物料品类 */ +export function deleteMaterialType(id: string) { + return http.del(`${BASE_URL}/${id}`) +} + +/** @desc 导出物料品类 */ +export function exportMaterialType(query: MaterialTypeQuery) { + return http.download(`${BASE_URL}/export`, query) +} diff --git a/src/hooks/app/materialProcess.ts b/src/hooks/app/materialProcess.ts new file mode 100644 index 0000000..4949d7b --- /dev/null +++ b/src/hooks/app/materialProcess.ts @@ -0,0 +1,22 @@ +import { ref } from 'vue' +import { selectList } from '@/apis/materialProcess/materialProcess' +import type { LabelValueState } from '@/types/global' + +/** 物料品类模块 */ +export function materialProcess(options?: { onSuccess?: () => void }) { + const loading = ref(false) + const materialProcessList = ref([]) + + const getMaterialProcessSelect = async () => { + try { + loading.value = true + const res = await selectList() + materialProcessList.value = res.data + // eslint-disable-next-line ts/no-unused-expressions + options?.onSuccess && options.onSuccess() + } finally { + loading.value = false + } + } + return { materialProcessList, getMaterialProcessSelect, loading } +} diff --git a/src/hooks/app/materialType.ts b/src/hooks/app/materialType.ts new file mode 100644 index 0000000..1607694 --- /dev/null +++ b/src/hooks/app/materialType.ts @@ -0,0 +1,22 @@ +import { ref } from 'vue' +import { selectList } from '@/apis/materialType/materialType' +import type { LabelValueState } from '@/types/global' + +/** 物料品类模块 */ +export function materialType(options?: { onSuccess?: () => void }) { + const loading = ref(false) + const materialTypeList = ref([]) + + const getMaterialTypeSelect = async () => { + try { + loading.value = true + const res = await selectList() + materialTypeList.value = res.data + // eslint-disable-next-line ts/no-unused-expressions + options?.onSuccess && options.onSuccess() + } finally { + loading.value = false + } + } + return { materialTypeList, getMaterialTypeSelect, loading } +} diff --git a/src/types/components.d.ts b/src/types/components.d.ts index 5250238..7accf54 100644 --- a/src/types/components.d.ts +++ b/src/types/components.d.ts @@ -13,8 +13,10 @@ declare module 'vue' { ABreadcrumb: typeof import('@arco-design/web-vue')['Breadcrumb'] ABreadcrumbItem: typeof import('@arco-design/web-vue')['BreadcrumbItem'] AButton: typeof import('@arco-design/web-vue')['Button'] + ACard: typeof import('@arco-design/web-vue')['Card'] ACheckbox: typeof import('@arco-design/web-vue')['Checkbox'] ACol: typeof import('@arco-design/web-vue')['Col'] + AColorPicker: typeof import('@arco-design/web-vue')['ColorPicker'] AConfigProvider: typeof import('@arco-design/web-vue')['ConfigProvider'] ADatePicker: typeof import('@arco-design/web-vue')['DatePicker'] ADescriptions: typeof import('@arco-design/web-vue')['Descriptions'] @@ -35,14 +37,17 @@ declare module 'vue' { AInputPassword: typeof import('@arco-design/web-vue')['InputPassword'] AInputSearch: typeof import('@arco-design/web-vue')['InputSearch'] ALayout: typeof import('@arco-design/web-vue')['Layout'] + ALayoutContent: typeof import('@arco-design/web-vue')['LayoutContent'] ALayoutHeader: typeof import('@arco-design/web-vue')['LayoutHeader'] ALayoutSider: typeof import('@arco-design/web-vue')['LayoutSider'] ALink: typeof import('@arco-design/web-vue')['Link'] AMenu: typeof import('@arco-design/web-vue')['Menu'] AMenuItem: typeof import('@arco-design/web-vue')['MenuItem'] AModal: typeof import('@arco-design/web-vue')['Modal'] + AOption: typeof import('@arco-design/web-vue')['Option'] AOverflowList: typeof import('@arco-design/web-vue')['OverflowList'] APagination: typeof import('@arco-design/web-vue')['Pagination'] + APopconfirm: typeof import('@arco-design/web-vue')['Popconfirm'] APopover: typeof import('@arco-design/web-vue')['Popover'] AProgress: typeof import('@arco-design/web-vue')['Progress'] ARadio: typeof import('@arco-design/web-vue')['Radio'] @@ -51,6 +56,8 @@ declare module 'vue' { ARow: typeof import('@arco-design/web-vue')['Row'] AScrollbar: typeof import('@arco-design/web-vue')['Scrollbar'] ASelect: typeof import('@arco-design/web-vue')['Select'] + ASkeleton: typeof import('@arco-design/web-vue')['Skeleton'] + ASkeletonLine: typeof import('@arco-design/web-vue')['SkeletonLine'] ASpace: typeof import('@arco-design/web-vue')['Space'] ASpin: typeof import('@arco-design/web-vue')['Spin'] AStatistic: typeof import('@arco-design/web-vue')['Statistic'] @@ -61,8 +68,11 @@ declare module 'vue' { ATabs: typeof import('@arco-design/web-vue')['Tabs'] ATag: typeof import('@arco-design/web-vue')['Tag'] ATooltip: typeof import('@arco-design/web-vue')['Tooltip'] + ATree: typeof import('@arco-design/web-vue')['Tree'] ATreeSelect: typeof import('@arco-design/web-vue')['TreeSelect'] + ATrigger: typeof import('@arco-design/web-vue')['Trigger'] ATypographyParagraph: typeof import('@arco-design/web-vue')['TypographyParagraph'] + ATypographyTitle: typeof import('@arco-design/web-vue')['TypographyTitle'] AUpload: typeof import('@arco-design/web-vue')['Upload'] Avatar: typeof import('./../components/Avatar/index.vue')['default'] AWatermark: typeof import('@arco-design/web-vue')['Watermark'] diff --git a/src/views/barcodePrint/index.vue b/src/views/barcodePrint/index.vue index 3518e12..e507241 100644 --- a/src/views/barcodePrint/index.vue +++ b/src/views/barcodePrint/index.vue @@ -77,7 +77,7 @@
-
标重(kg)
+
标重(g)
{{ labelData.totalCalculatedWeight }}
@@ -91,7 +91,7 @@
-
实重(kg)
+
实重(g)
{{ labelData.totalWeight || '' }}
@@ -147,19 +147,6 @@ const labelData = reactive({ qrCodeData: '', }) -// 标签数据 -// const labelData = reactive({ -// partName: '物料3', -// partNumber: '1', -// totalCalculatedWeight: '100', -// totalWeight: '100', -// productionDate: '202401010000', -// totalCount: '100', -// packingSignature: '', -// inspectionSignature: '', -// qrCodeData: '10#$$DY', -// }) - // 标签容器引用 const labelContainer = ref(null) diff --git a/src/views/material/MaterialInfoAddModal.vue b/src/views/material/MaterialInfoAddModal.vue index cdecab4..d0562a8 100644 --- a/src/views/material/MaterialInfoAddModal.vue +++ b/src/views/material/MaterialInfoAddModal.vue @@ -19,6 +19,8 @@ import { useWindowSize } from '@vueuse/core' import { addMaterialInfo, getMaterialInfo, updateMaterialInfo } from '@/apis/material/materialInfo' import { type ColumnItem, GiForm } from '@/components/GiForm' import { useResetReactive } from '@/hooks' +import { materialType } from "@/hooks/app/materialType"; +import {materialProcess} from "@/hooks/app/materialProcess"; const emit = defineEmits<{ (e: 'save-success'): void @@ -32,6 +34,11 @@ const isUpdate = computed(() => !!dataId.value) const title = computed(() => (isUpdate.value ? '修改物料管理' : '新增物料管理')) const formRef = ref>() +const { materialTypeList, getMaterialTypeSelect } = materialType() +const { materialProcessList, getMaterialProcessSelect } = materialProcess() + + + const [form, resetForm] = useResetReactive({ // todo 待补充 }) @@ -56,6 +63,31 @@ const columns: ColumnItem[] = reactive([ field: 'unitWeight', type: 'input-number', span: 24, + required: true, + }, + { + label: '物料品类', + field: 'materialTypeId', + type: 'select', + span: 24, + required: true, + props: { + options: materialTypeList, + allowClear: true, + allowSearch: true, + }, + }, + { + label: '物料流程编码', + field: 'materialProcessId', + type: 'select', + span: 24, + required: true, + props: { + options: materialProcessList, + allowClear: true, + allowSearch: true, + }, }, { label: '物料规格', @@ -69,6 +101,7 @@ const columns: ColumnItem[] = reactive([ type: 'image', savePath: 'material/', span: 24, + required: true, }, ]) @@ -101,6 +134,12 @@ const save = async () => { const onAdd = async () => { reset() dataId.value = '' + if (!materialTypeList.value.length) { + await getMaterialTypeSelect() + } + if (!materialProcessList.value.length) { + await getMaterialProcessSelect(); + } visible.value = true } @@ -109,6 +148,12 @@ const onUpdate = async (id: string) => { reset() dataId.value = id const { data } = await getMaterialInfo(id) + if (!materialTypeList.value.length) { + await getMaterialTypeSelect() + } + if (!materialProcessList.value.length) { + await getMaterialProcessSelect(); + } Object.assign(form, data) visible.value = true } diff --git a/src/views/material/index.vue b/src/views/material/index.vue index da71745..40ddf58 100644 --- a/src/views/material/index.vue +++ b/src/views/material/index.vue @@ -99,8 +99,6 @@ import has from '@/utils/has' defineOptions({ name: 'MaterialInfo' }) -// 扩展类型定义,允许动态添加 photoLoadError 属性 -// 如果 TS 报错,可以在 MaterialInfoResp 接口定义中添加 photoLoadError?: boolean; interface MaterialInfoRespWithStatus extends MaterialInfoResp { photoLoadError?: boolean; } @@ -108,7 +106,7 @@ interface MaterialInfoRespWithStatus extends MaterialInfoResp { const queryForm = reactive({ materialName: undefined, encoding: undefined, - sort: ['id,desc'], + sort: ['mi.id,desc'], }) const { @@ -123,6 +121,7 @@ const columns = ref([ { title: '物料名称', dataIndex: 'materialName', slotName: 'materialName' }, { title: '物料编码', dataIndex: 'encoding', slotName: 'encoding' }, { title: '物料单位重量(g)', dataIndex: 'unitWeight', slotName: 'unitWeight' }, + { title: '物料品类', dataIndex: 'typeName' }, { title: '物料规格', dataIndex: 'materialSpec', slotName: 'materialSpec' }, { title: '物料照片', dataIndex: 'photoUrl', slotName: 'photoUrl', width: 120, align: 'center' }, { title: '创建人', dataIndex: 'createUserString', slotName: 'createUser' }, diff --git a/src/views/materialProcess/MaterialProcessAddModal.vue b/src/views/materialProcess/MaterialProcessAddModal.vue new file mode 100644 index 0000000..c429493 --- /dev/null +++ b/src/views/materialProcess/MaterialProcessAddModal.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/src/views/materialProcess/index.vue b/src/views/materialProcess/index.vue new file mode 100644 index 0000000..e638250 --- /dev/null +++ b/src/views/materialProcess/index.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/src/views/materialType/MaterialTypeAddModal.vue b/src/views/materialType/MaterialTypeAddModal.vue new file mode 100644 index 0000000..06bc77f --- /dev/null +++ b/src/views/materialType/MaterialTypeAddModal.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/src/views/materialType/index.vue b/src/views/materialType/index.vue new file mode 100644 index 0000000..97f9ab0 --- /dev/null +++ b/src/views/materialType/index.vue @@ -0,0 +1,149 @@ + + + + + \ No newline at end of file diff --git a/src/views/weightManage/index.vue b/src/views/weightManage/index.vue index 06e37f4..9d73b30 100644 --- a/src/views/weightManage/index.vue +++ b/src/views/weightManage/index.vue @@ -74,7 +74,7 @@
图片展示 @@ -230,16 +230,16 @@ 物料编码: {{ formData.encoding }}
-
- 物料规格: - {{ formData.materialSpec }} -
物料总个数: {{ workOrderResp.totalCount }}
- 物料总重量(g): + 标准总重量(g): + {{ workOrderResp.totalCalculatedWeight }} +
+
+ 实际总重量(g): {{ workOrderResp.totalWeight }}
@@ -556,7 +556,7 @@ watch(activeStep, (newVal) => { // 组件挂载时 onMounted(async () => { await loadFlvJs() - pollingInterval = setInterval(getImage, 1000) + // pollingInterval = setInterval(getImage, 1000) }) // 组件卸载时 @@ -741,7 +741,6 @@ const handleNext = async () => { // 准备工作订单数据 const workOrderData = { materialId: formData.id, - materialName: formData.materialName, workOrderInfos: weighingList.value, } // 调用后端接口 @@ -755,6 +754,7 @@ const handleNext = async () => { workOrderResp.value.title = res.data?.title || '' workOrderResp.value.orderNo = res.data?.orderNo || '' workOrderResp.value.totalWeight = res.data?.totalWeight || '' + workOrderResp.value.totalCalculatedWeight = res.data?.totalCalculatedWeight || '' workOrderResp.value.totalCount = res.data?.totalCount || '' // 关闭WebSocket连接 diff --git a/src/views/workOrder/index.vue b/src/views/workOrder/index.vue index d6c35d3..d5d8e91 100644 --- a/src/views/workOrder/index.vue +++ b/src/views/workOrder/index.vue @@ -63,6 +63,9 @@ +