feat(mes): 优化生产批次和袋码管理功能
- 在托盘绑定批次界面添加操作提示信息
- 移除托盘列表中的容量字段显示
- 重构物料基础数据界面,移除品种分类相关功能
- 为计量单位添加类型选项和表单字段
- 更新袋码界面增加品种筛选和显示列
- 重构生产批次表单,将品种改为加工单位,添加绑定托盘功能
- 在袋码生成界面实现按计量单位类型动态生成托盘或袋码
- 添加未绑定批次托盘查询接口和绑定功能
- 更新业务类型选项和条码详情组件的枚举值
- 移除物料API中的品类和采购价相关字段
- 添加原始袋码生成功能模块
| | |
| | | name: string; |
| | | barCode?: string; |
| | | specification?: string; |
| | | categoryId?: number; |
| | | categoryName?: string; |
| | | unitMeasureId?: number; |
| | | unitMeasureName?: string; |
| | | unitMeasureId2?: number; |
| | |
| | | brandName?: string; |
| | | itemType: number; |
| | | status: number; |
| | | purchasePrice?: number; |
| | | salesPrice?: number; |
| | | costPrice?: number; |
| | | safetyStock?: number; |
| | |
| | | export interface PageParams extends PageParam { |
| | | code?: string; |
| | | name?: string; |
| | | categoryId?: number; |
| | | itemType?: number; |
| | | status?: number; |
| | | } |
| | |
| | | id?: number; // åä½ç¼å· |
| | | code: string; // åä½ç¼ç |
| | | name: string; // åä½åç§° |
| | | type?: string; // ç±»åï¼48åå
/100åå
/å¨ï¼ |
| | | primaryFlag?: boolean; // æ¯å¦ä¸»åä½ |
| | | primaryId?: number; // 主åä½ç¼å· |
| | | changeRate?: number; // ä¸ä¸»å使¢ç®æ¯ä¾ |
| | |
| | | lineName?: string; // 产线åç§° |
| | | palletId?: number; // ç»å®æçç¼å· |
| | | palletCode?: string; // æçç |
| | | itemId?: number; // åç§ï¼ç©æï¼ç¼å· |
| | | itemCode?: string; // åç§ç¼ç |
| | | itemName?: string; // åç§åç§° |
| | | status?: number; // ç¶æï¼åå
¸ mes_pro_bag_code_statusï¼ |
| | | printTime?: string; // 导åºï¼äº¤ä»å°å·ï¼æ¶é´ |
| | | cancelTime?: string; // ä½åºæ¶é´ |
| | |
| | | batchCode?: string; |
| | | uuid?: string; |
| | | palletId?: number; |
| | | itemId?: number; |
| | | status?: number; |
| | | createTime?: string[]; |
| | | } |
| | | |
| | | /** çææ°æ®å
è¯·æ± */ |
| | | /** çææ°æ®å
请æ±ï¼åç§ä¸»è®¡éåä½ç±»å为 Nåå
æ¶ææçæ°æ¢ç®è¢æ°ï¼ä¸º å¨ æ¶æ æçãç´æ¥è¾å
¥è¢ç æ°ï¼ */ |
| | | export interface GenerateParams { |
| | | count: number; // çæè¢æ° |
| | | itemId: number; // åç§ï¼ç©æï¼ç¼å· |
| | | palletCount?: number; // æçæ°ï¼48åå
/100åå
åç§å¿
å¡«ï¼ |
| | | bagCount?: number; // è¢ç æ°ï¼å¨åç§å¿
å¡«ï¼ |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | |
| | | export interface GenerateResult { |
| | | uuid?: string; |
| | | uuid?: string; // çæç» UUID |
| | | type?: string; // åç§ä¸»è®¡éåä½ç±»åï¼48åå
/100åå
/å¨ï¼ |
| | | perPallet?: number; // æ¯æè¢æ°ï¼å¨åç§ä¸º 0ï¼ |
| | | totalCount?: number; // çæè¢ç æ»æ° |
| | | palletIds?: number[]; // èªå¨çæçæçç¼å·å表ï¼å¨åç§ä¸ºç©ºï¼ |
| | | } |
| | | |
| | | /** çæåå§è¢ç 请æ±ï¼ä»
åç§+è¢ç æ°éï¼ä¸å
³è计éåä½ç±»åãä¸çææçï¼ */ |
| | | export interface RawGenerateParams { |
| | | itemId: number; // åç§ï¼ç©æï¼ç¼å· |
| | | count: number; // è¢ç æ°é |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | |
| | | export interface BindBatchParams { |
| | |
| | | ); |
| | | } |
| | | |
| | | /** çæåå§è¢ç ï¼ä»
éåç§ä¸è¢ç æ°éï¼ä¸çææçï¼è¿åçæç» UUIDï¼ */ |
| | | export function generateRawBagCodes(data: MesProBagCodeApi.RawGenerateParams) { |
| | | return requestClient.post<MesProBagCodeApi.GenerateResult>( |
| | | '/mes/pro/bag-code/raw-generate', |
| | | data, |
| | | ); |
| | | } |
| | | |
| | | /** å½å
¥çäº§æ¹æ¬¡ */ |
| | | export function bindBagCodeBatch(data: MesProBagCodeApi.BindBatchParams) { |
| | | return requestClient.put('/mes/pro/bag-code/bind-batch', data); |
| | |
| | | id?: number; // ç¼å· |
| | | code?: string; // æ¹æ¬¡å·ï¼è¡¥å½æ£å¼ä¿¡æ¯åèªå¨çæï¼ |
| | | tempCode?: string; // ä¸´æ¶æ¹æ¬¡ç ï¼é¢çæäºç»´ç é¶æ®µä½¿ç¨ï¼æ«ç 追溯å
¼å®¹ï¼ |
| | | itemId?: number; // åç§ï¼äº§åç©æï¼ç¼å· |
| | | itemCode?: string; // åç§ç¼ç ï¼åç«¯æ¼æ¥ï¼ |
| | | itemName?: string; // åç§åç§°ï¼åç«¯æ¼æ¥ï¼ |
| | | itemSpecification?: string; // åç§è§æ ¼ï¼åç«¯æ¼æ¥ï¼ |
| | | lineId?: number; // 产线ç¼å· |
| | | lineCode?: string; // 产线ç¼ç ï¼å端åå¡«ï¼ |
| | | lineName?: string; // 产线åç§°ï¼å端åå¡«ï¼ |
| | | lineId?: number; // 产线ç¼å·ï¼é¡µé¢å±ç¤ºä¸ºãå å·¥åä½ãï¼ |
| | | lineCode?: string; // 产线ç¼ç ï¼å端åå¡«ï¼é¡µé¢å·²éèï¼ |
| | | lineName?: string; // 产线åç§°ï¼å端åå¡«ï¼é¡µé¢å±ç¤ºä¸ºãå å·¥åä½ãï¼ |
| | | processingTeam?: string; // å å·¥çç»ï¼æå·¥å¡«åï¼ |
| | | produceDate?: string; // çäº§æ¥æ |
| | | planQuantity?: number; // è®¡åæ°é |
| | | planQuantity?: number; // å å·¥æ°éï¼åè®¡åæ°éï¼é¡µé¢å±ç¤ºä¸ºãå å·¥æ°éãï¼ |
| | | ownerUserId?: number; // è´£ä»»äººç¨æ·ç¼å· |
| | | ownerUserName?: string; // 责任人æµç§° |
| | | bagQuantity?: number; // å·²çæè¢ç æ°é |
| | |
| | | remark?: string; // 夿³¨ |
| | | createTime?: string; // å建æ¶é´ |
| | | workers?: BatchWorker[]; // ç产人åé
ç½®å表 |
| | | palletIds?: number[]; // ç»å®æçç¼å·å表ï¼ä»
æ°å¢/è¡¥å½æäº¤æ¶ä¼ å
¥ï¼ç»å®æ¶æ¹æ¬¡ç´æ¥è¿å
¥ç产ä¸ï¼ |
| | | } |
| | | |
| | | /** çäº§æ¹æ¬¡æ«ç 追溯 */ |
| | |
| | | export interface PageParams extends PageParam { |
| | | code?: string; |
| | | tempCode?: string; |
| | | itemId?: number; |
| | | lineId?: number; |
| | | lineCode?: string; |
| | | lineName?: string; |
| | | processingTeam?: string; |
| | | ownerUserId?: number; |
| | | status?: number; |
| | | produceDate?: string[]; |
| | |
| | | batchId?: number; // çäº§æ¹æ¬¡ç¼å· |
| | | batchCode?: string; // æ¹æ¬¡å· |
| | | palletNo?: number; // æ¹æ¬¡å
æçåºå· |
| | | capacity?: number; // å¯è£
è¢æ°ï¼è¢/æçï¼ |
| | | autoGenerated?: boolean; // æ¯å¦èªå¨çæï¼è¢ç æ°æ®å
çææ¶èªå¨åå»ºï¼ |
| | | bagCount?: number; // å·²ç»å®è¢ç æ°é |
| | | status?: number; // ç¶æï¼åå
¸ mes_pro_pallet_statusï¼ |
| | | remark?: string; // 夿³¨ |
| | |
| | | export interface BatchCreateParams { |
| | | batchId: number; // çäº§æ¹æ¬¡ç¼å· |
| | | count: number; // çææ°é |
| | | capacity?: number; // å¯è£
è¢æ° |
| | | remark?: string; // 夿³¨ |
| | | } |
| | | |
| | |
| | | /** é¢çææç临æ¶äºç»´ç ï¼ä¸ç»å®çäº§æ¹æ¬¡ï¼ */ |
| | | export function preGeneratePallet(data: { |
| | | count: number; |
| | | capacity?: number; |
| | | remark?: string; |
| | | }) { |
| | | return requestClient.post<MesProPalletApi.PreGenerateResult[]>( |
| | |
| | | ); |
| | | } |
| | | |
| | | /** æ¥è¯¢æªç»å®æ¹æ¬¡çä¸´æ¶æçå表ï¼ä¾æ¹æ¬¡æ°å¢/è¡¥å½ç»å®æçä¸æä½¿ç¨ï¼ */ |
| | | export function getUnboundPalletList() { |
| | | return requestClient.get<MesProPalletApi.Pallet[]>( |
| | | '/mes/pro/pallet/unbound-list', |
| | | ); |
| | | } |
| | | |
| | | /** å¯¼åºæçç Excel */ |
| | | export function exportPalletExcel(params: MesProPalletApi.PageParams) { |
| | | return requestClient.download('/mes/pro/pallet/export-excel', { params }); |
| | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { getItemTypeSimpleList } from '#/api/mes/md/item/type'; |
| | | |
| | | /** ç©æéæ©å¼¹çªæç´¢è¡¨å */ |
| | | export function useMdmItemSelectGridFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥åç§åç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'categoryId', |
| | | label: 'åç§åç±»', |
| | | component: 'ApiSelect', |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åç§åç±»', |
| | | allowClear: true, |
| | | api: async () => { |
| | | const res = await getItemTypeSimpleList(); |
| | | return res || []; |
| | | }, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | title: 'è§æ ¼åå·', |
| | | minWidth: 150, |
| | | align: 'left', |
| | | }, |
| | | { |
| | | field: 'categoryId', |
| | | title: 'åç§åç±»', |
| | | minWidth: 120, |
| | | align: 'center', |
| | | slots: { default: 'categoryId' }, |
| | | }, |
| | | { |
| | | field: 'unitMeasureName', |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MdmItemApi } from '#/api/mdm/item'; |
| | | import type { MesMdItemTypeApi } from '#/api/mes/md/item/type'; |
| | | |
| | | import { nextTick, ref } from 'vue'; |
| | | |
| | |
| | | |
| | | import { useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { getItemPage } from '#/api/mdm/item'; |
| | | import { getItemTypeSimpleList } from '#/api/mes/md/item/type'; |
| | | |
| | | import { |
| | | useMdmItemSelectGridColumns, |
| | |
| | | const multiple = ref(true); // æ¯å¦å¤é |
| | | const selectedRows = ref<MdmItemApi.Item[]>([]); // å·²éç©æå表 |
| | | const preSelectedIds = ref<number[]>([]); // é¢éç©æç¼å·å表 |
| | | const categoryList = ref<MesMdItemTypeApi.ItemType[]>([]); // åç±»å表ç¼å |
| | | |
| | | const TAG_COLORS = ['green', 'orange', 'blue', 'purple', 'cyan', 'magenta', 'geekblue', 'volcano', 'gold', 'lime'] as const; |
| | | |
| | | function getCategoryName(categoryId?: number) { |
| | | if (!categoryId || !categoryList.value.length) return ''; |
| | | const category = categoryList.value.find((item) => item.id === categoryId); |
| | | return category?.name || ''; |
| | | } |
| | | |
| | | function getCategoryColor(categoryId?: number): string { |
| | | if (!categoryId) return ''; |
| | | const index = categoryList.value.findIndex((item) => item.id === categoryId); |
| | | return index >= 0 ? TAG_COLORS[index % TAG_COLORS.length]! : ''; |
| | | } |
| | | |
| | | /** è·åå½åè¡¨æ ¼æ°æ® */ |
| | | function getTableRows() { |
| | |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | if (!categoryList.value.length) { |
| | | try { |
| | | categoryList.value = await getItemTypeSimpleList(); |
| | | } catch { |
| | | categoryList.value = []; |
| | | } |
| | | } |
| | | return await getItemPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | |
| | | @cancel="closeModal" |
| | | > |
| | | <Grid table-title="åç§å表"> |
| | | <template #categoryId="{ row }"> |
| | | <Tag v-if="getCategoryColor(row.categoryId)" :color="getCategoryColor(row.categoryId)">{{ getCategoryName(row.categoryId) }}</Tag> |
| | | <span v-else>{{ getCategoryName(row.categoryId) || '-' }}</span> |
| | | </template> |
| | | <template #isBatchManaged="{ row }"> |
| | | <Tag v-if="row.isBatchManaged" color="success">æ¯</Tag> |
| | | <Tag v-else>å¦</Tag> |
| | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { MesAutoCodeRuleCode } from '@vben/constants'; |
| | | import { getItemTypeSimpleList } from '#/api/mes/md/item/type'; |
| | | import { getUnitPage } from '#/api/mdm/unit'; |
| | | import { getWarehouseSimpleList } from '#/api/mes/wm/warehouse'; |
| | | |
| | |
| | | // ç¼åä»åºå表 |
| | | let warehouseListCache: any[] | null = null; |
| | | let warehouseListPromise: Promise<any[]> | null = null; |
| | | |
| | | /** å°æå¹³åç±»å表转为 TreeSelect æéçæ å½¢ç»æ */ |
| | | export function buildCategoryTree(list: any[]): any[] { |
| | | const map = new Map<number, any>(); |
| | | const roots: any[] = []; |
| | | for (const item of list) { |
| | | map.set(item.id, { label: item.name, value: item.id, children: [] }); |
| | | } |
| | | for (const item of list) { |
| | | const node = map.get(item.id)!; |
| | | if (item.parentId && map.has(item.parentId)) { |
| | | map.get(item.parentId)!.children.push(node); |
| | | } else { |
| | | roots.push(node); |
| | | } |
| | | } |
| | | return roots; |
| | | } |
| | | |
| | | /** è·ååä½å表ï¼å¸¦ç¼åï¼ */ |
| | | async function getUnitListCached() { |
| | |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema(formApi?: VbenFormApi, categoryTreeData: any[] = []): VbenFormSchema[] { |
| | | export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | component: "Input", |
| | |
| | | placeholder: "请è¾å
¥åç§åç§°", |
| | | }, |
| | | rules: "required", |
| | | }, |
| | | { |
| | | component: "TreeSelect", |
| | | fieldName: "categoryId", |
| | | label: "åç§åç±»", |
| | | rules: "selectRequired", |
| | | componentProps: { |
| | | placeholder: "è¯·éæ©åç§åç±»", |
| | | allowClear: true, |
| | | treeDefaultExpandAll: true, |
| | | treeData: categoryTreeData, |
| | | fieldNames: { label: 'label', value: 'value', children: 'children' }, |
| | | }, |
| | | }, |
| | | { |
| | | component: "Input", |
| | |
| | | label: "æ¡ç ", |
| | | componentProps: { |
| | | placeholder: "请è¾å
¥æ¡ç ", |
| | | }, |
| | | }, |
| | | { |
| | | component: "InputNumber", |
| | | fieldName: "purchasePrice", |
| | | label: "éè´ä»·", |
| | | componentProps: { |
| | | class: "!w-full", |
| | | min: 0, |
| | | precision: 2, |
| | | placeholder: "请è¾å
¥éè´ä»·", |
| | | }, |
| | | }, |
| | | { |
| | |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: "categoryName", |
| | | title: "åç§åç±»", |
| | | minWidth: 120, |
| | | slots: { default: "categoryName" }, |
| | | }, |
| | | { |
| | | field: "unitMeasureName", |
| | | title: "åä½", |
| | | minWidth: 80, |
| | |
| | | field: "warehouseName", |
| | | title: "é»è®¤ä»åº", |
| | | minWidth: 100, |
| | | }, |
| | | { |
| | | field: "purchasePrice", |
| | | title: "éè´ä»·", |
| | | minWidth: 100, |
| | | formatter: ({ cellValue }) => { |
| | | return cellValue != null ? `Â¥${Number(cellValue).toFixed(2)}` : ""; |
| | | }, |
| | | }, |
| | | { |
| | | field: "salesPrice", |
| | |
| | | <script lang="ts" setup> |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MdmItemApi } from '#/api/mdm/item'; |
| | | import type { MesMdItemTypeApi } from '#/api/mes/md/item/type'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | import { ref } from 'vue'; |
| | | |
| | | import { confirm, Page, useVbenModal } from '#/packages/effects/common-ui/src'; |
| | | import { downloadFileFromBlobPart, isEmpty } from '#/packages/utils/src'; |
| | |
| | | updateItemStatus, |
| | | updateItemSync, |
| | | } from '#/api/mdm/item'; |
| | | import { getItemTypeSimpleList } from '#/api/mes/md/item/type'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useGridColumns, useGridFormSchema } from './data'; |
| | |
| | | connectedComponent: Form, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | // åç±»å表ç¼å |
| | | const categoryList = ref<MesMdItemTypeApi.ItemType[]>([]); |
| | | |
| | | const TAG_COLORS = [ |
| | | 'green', |
| | | 'orange', |
| | | 'blue', |
| | | 'purple', |
| | | 'cyan', |
| | | 'magenta', |
| | | 'geekblue', |
| | | 'volcano', |
| | | 'gold', |
| | | 'lime', |
| | | ] as const; |
| | | |
| | | /** åç±»ID â é¢è²æ å°ï¼åºäºåç±»å¨å表ä¸çç´¢å¼å¾ªç¯åé
ï¼ */ |
| | | const categoryColorMap = computed(() => { |
| | | const map = new Map<number, string>(); |
| | | categoryList.value.forEach((item, index) => { |
| | | map.set(item.id!, TAG_COLORS[index % TAG_COLORS.length]!); |
| | | }); |
| | | return map; |
| | | }); |
| | | |
| | | /** è·ååç±»Tagé¢è² */ |
| | | function getCategoryColor(categoryId?: number): string { |
| | | if (!categoryId) return ''; |
| | | return categoryColorMap.value.get(categoryId) || ''; |
| | | } |
| | | |
| | | /** è·ååç±»åç§° */ |
| | | function getCategoryName(categoryId?: number) { |
| | | if (!categoryId || !categoryList.value.length) return ''; |
| | | const category = categoryList.value.find((item) => item.id === categoryId); |
| | | return category?.name || ''; |
| | | } |
| | | |
| | | /** å·æ°è¡¨æ ¼ */ |
| | | function handleRefresh() { |
| | |
| | | proxyConfig: { |
| | | ajax: { |
| | | query: async ({ page }, formValues) => { |
| | | // å è½½åç±»å表ï¼ç¨äºæ¾ç¤ºåç±»åç§°ï¼ |
| | | if (!categoryList.value.length) { |
| | | try { |
| | | categoryList.value = await getItemTypeSimpleList(); |
| | | } catch { |
| | | categoryList.value = []; |
| | | } |
| | | } |
| | | return await getItemPage({ |
| | | pageNo: page.currentPage, |
| | | pageSize: page.pageSize, |
| | |
| | | }, |
| | | ]" |
| | | /> |
| | | </template> |
| | | <template #categoryName="{ row }"> |
| | | <Tag v-if="getCategoryColor(row.categoryId)" :color="getCategoryColor(row.categoryId)">{{ getCategoryName(row.categoryId) }}</Tag> |
| | | <span v-else>{{ getCategoryName(row.categoryId) }}</span> |
| | | </template> |
| | | <template #isBatchManaged="{ row }"> |
| | | <Tag v-if="row.isBatchManaged" color="success">æ¯</Tag> |
| | |
| | | import { createItem, getItem, updateItem } from '#/api/mdm/item'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema, clearUnitListCache, buildCategoryTree } from '../data'; |
| | | import { getItemTypeSimpleList } from '#/api/mes/md/item/type'; |
| | | import { useFormSchema, clearUnitListCache } from '../data'; |
| | | |
| | | defineOptions({ name: "ItemForm" }); |
| | | |
| | |
| | | const data = modalApi.getData<MdmItemApi.Item>(); |
| | | // æ¸
é¤åä½ç¼åï¼ç¡®ä¿è·åææ°æ°æ® |
| | | clearUnitListCache(); |
| | | // å è½½ææ°åç±»æ°æ® |
| | | const categoryRes = await getItemTypeSimpleList(); |
| | | const categoryTreeData = buildCategoryTree(categoryRes || []); |
| | | // 设置 schemaï¼formApi å·²åå§åï¼ |
| | | formApi.setState({ schema: useFormSchema(formApi, categoryTreeData) }); |
| | | formApi.setState({ schema: useFormSchema(formApi) }); |
| | | if (data?.id) { |
| | | // ç¼è¾æ¨¡å¼ |
| | | modalApi.lock(); |
| | |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | |
| | | /** 计éåä½ç±»åé项 */ |
| | | export const UNIT_TYPE_OPTIONS = [ |
| | | { label: '48åå
', value: '48åå
' }, |
| | | { label: '100åå
', value: '100åå
' }, |
| | | { label: 'å¨', value: 'å¨' }, |
| | | ]; |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | |
| | | rules: 'required', |
| | | componentProps: { |
| | | placeholder: '请è¾å
¥åä½åç§°', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'type', |
| | | label: 'ç±»å', |
| | | component: 'Select', |
| | | rules: 'required', |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©ç±»å', |
| | | allowClear: true, |
| | | options: UNIT_TYPE_OPTIONS, |
| | | }, |
| | | }, |
| | | { |
| | |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'type', |
| | | title: 'ç±»å', |
| | | minWidth: 100, |
| | | formatter: ({ cellValue }) => cellValue || '-', |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'ç¶æ', |
| | | minWidth: 80, |
| | |
| | | row.productUnitId = product.unitMeasureId; |
| | | row.productUnitName = product.unitMeasureName; |
| | | row.productName = product.name; |
| | | row.productPrice = product.purchasePrice || 0; |
| | | row.productPrice = 0; // åç§ç®¡ç已廿éè´ä»·ï¼éé¢éæå·¥å¡«å |
| | | row.count = row.count || 1; |
| | | handleRowChange(row); |
| | | } |
| | |
| | | row.productUnitId = product.unitMeasureId; |
| | | row.productUnitName = product.unitMeasureName; |
| | | row.productName = product.name; |
| | | row.productPrice = product.purchasePrice || 0; |
| | | row.productPrice = 0; // åç§ç®¡ç已廿éè´ä»·ï¼éé¢éæå·¥å¡«å |
| | | row.count = row.count || 1; |
| | | handleRowChange(row); |
| | | } |
| | |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesProBagCodeApi } from '#/api/mes/pro/bagCode'; |
| | | |
| | | import { markRaw } from 'vue'; |
| | | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | |
| | |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥çæç»ç¼å·', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'åç§', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åç§ï¼äº§ååç§ï¼', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | minWidth: 190, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: 'åç§ç¼ç ', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'åç§åç§°', |
| | | width: 140, |
| | | }, |
| | | { |
| | | field: 'lineCode', |
| | | title: '产线ç¼ç ', |
| | | width: 100, |
| | |
| | | import BindBatchModal from "./modules/bind-batch.vue"; |
| | | import BindPalletModal from "./modules/bind-pallet.vue"; |
| | | import GenerateModal from "./modules/generate-form.vue"; |
| | | import RawGenerateModal from "./modules/raw-generate-form.vue"; |
| | | import ReplaceModal from "./modules/replace-form.vue"; |
| | | import QrTraceModal from "../components/qr-trace-modal.vue"; |
| | | |
| | |
| | | |
| | | const [GenerateFormModal, generateFormModalApi] = useVbenModal({ |
| | | connectedComponent: GenerateModal, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | | const [RawGenerateFormModal, rawGenerateFormModalApi] = useVbenModal({ |
| | | connectedComponent: RawGenerateModal, |
| | | destroyOnClose: true, |
| | | }); |
| | | |
| | |
| | | /** çææ°æ®å
*/ |
| | | function handleGenerate() { |
| | | generateFormModalApi.open(); |
| | | } |
| | | |
| | | /** çæåå§è¢ç */ |
| | | function handleRawGenerate() { |
| | | rawGenerateFormModalApi.open(); |
| | | } |
| | | |
| | | /** æ¿æ¢æååå±ç¤ºç»æå¹¶å·æ°å表 */ |
| | |
| | | <template> |
| | | <Page auto-content-height> |
| | | <GenerateFormModal @success="handleRefresh" /> |
| | | <RawGenerateFormModal @success="handleRefresh" /> |
| | | <BindBatchFormModal @success="handleRefresh" /> |
| | | <BindPalletFormModal @success="handleRefresh" /> |
| | | <ReplaceFormModal @success="handleReplaceSuccess" /> |
| | |
| | | onClick: handleGenerate, |
| | | }, |
| | | { |
| | | label: 'çæåå§è¢ç ', |
| | | icon: ACTION_ICON.ADD, |
| | | auth: ['mes:pro-bag-code:create'], |
| | | onClick: handleRawGenerate, |
| | | }, |
| | | { |
| | | label: 'å½å
¥æ¹æ¬¡', |
| | | type: 'primary', |
| | | auth: ['mes:pro-bag-code:update'], |
| | |
| | | (pallet) => pallet.status !== MesProPalletStatusEnum.CANCELED |
| | | ) |
| | | .map((pallet) => ({ |
| | | label: `${pallet.code}ï¼å·²è£
${pallet.bagCount ?? 0} è¢ / å¯è£
${ |
| | | pallet.capacity ?? "ä¸é" |
| | | } è¢ï¼`, |
| | | label: `${pallet.code}ï¼å·²è£
${pallet.bagCount ?? 0} è¢ï¼`, |
| | | value: pallet.id!, |
| | | })); |
| | | await formApi.setState({ schema: buildSchema(options) }); |
| | |
| | | <script lang="ts" setup> |
| | | import type { VbenFormSchema } from "#/adapter/form"; |
| | | import type { MdmItemApi } from "#/api/mdm/item"; |
| | | import type { MesProBagCodeApi } from "#/api/mes/pro/bagCode"; |
| | | |
| | | import { computed, markRaw, ref } from "vue"; |
| | | |
| | | import { useVbenModal } from "@vben/common-ui"; |
| | | |
| | |
| | | |
| | | import { useVbenForm } from "#/adapter/form"; |
| | | import { generateBagCodes } from "#/api/mes/pro/bagCode"; |
| | | import { getUnit } from "#/api/mdm/unit"; |
| | | import { MdmItemSelect } from "#/views/basicData/mdm/components"; |
| | | |
| | | defineOptions({ name: "MesProBagCodeGenerateForm" }); |
| | | |
| | | const emit = defineEmits(["success"]); |
| | | |
| | | // æéåç§ä¸»è®¡éåä½ç±»åï¼48åå
/100åå
-> æ¯æ N è¢ï¼å¨ -> æ æçç´æ¥è¾è¢ç æ° |
| | | const unitType = ref(""); |
| | | const kgPerPallet = ref<number | null>(null); |
| | | const isTon = ref(false); |
| | | const unitTypeError = ref(false); |
| | | const palletCountVal = ref<number | null>(null); |
| | | const bagCountVal = ref<number | null>(null); |
| | | |
| | | /** æ¢ç®/é
ç½®æç¤ºææ¡ */ |
| | | const tipText = computed(() => { |
| | | if (unitTypeError.value) { |
| | | return "该åç§ä¸»è®¡éå使ªé
置类åï¼ä»
æ¯æ 48åå
/100åå
/å¨ï¼ï¼è¯·å
åå¾ã计éåä½ãç»´æ¤åéè¯"; |
| | | } |
| | | if (!unitType.value) { |
| | | return ""; |
| | | } |
| | | if (isTon.value) { |
| | | return `计éåä½ç±»å为ãå¨ãï¼ä¸çææçï¼è¢ç ä»
ç»å®çäº§æ¹æ¬¡${ |
| | | bagCountVal.value ? `ï¼å°çæ ${bagCountVal.value} 个è¢ç ` : "" |
| | | }`; |
| | | } |
| | | const per = kgPerPallet.value ?? 0; |
| | | const count = palletCountVal.value ?? 0; |
| | | return `计éåä½ç±»å为ã${unitType.value}ãï¼æ¯æ ${per} è¢${ |
| | | count > 0 |
| | | ? ` à ${count} æ = ${per * count} 个è¢ç ï¼å°èªå¨çæ ${count} 个æçå¹¶ç»å®` |
| | | : "ï¼è¯·è¾å
¥æçæ°" |
| | | }`; |
| | | }); |
| | | |
| | | function buildSchema(): VbenFormSchema[] { |
| | | return [ |
| | | const schema: VbenFormSchema[] = [ |
| | | { |
| | | fieldName: "count", |
| | | label: "çæè¢æ°", |
| | | fieldName: "itemId", |
| | | label: "åç§", |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: "è¯·éæ©åç§ï¼äº§ååç§ï¼", |
| | | onChange: handleItemChange, |
| | | }, |
| | | rules: "selectRequired", |
| | | }, |
| | | ]; |
| | | if (kgPerPallet.value) { |
| | | schema.push({ |
| | | fieldName: "palletCount", |
| | | label: "æçæ°", |
| | | component: "InputNumber", |
| | | componentProps: { |
| | | class: "!w-full", |
| | | min: 1, |
| | | placeholder: "请è¾å
¥éè¦çæçè¢ç æ°é", |
| | | placeholder: "请è¾å
¥æçæ°ï¼ç³»ç»èªå¨çææçå¹¶ååç»å®è¢ç ï¼", |
| | | precision: 0, |
| | | onChange: (value: number | string) => { |
| | | palletCountVal.value = Number(value) || null; |
| | | }, |
| | | }, |
| | | rules: "required", |
| | | }, |
| | | { |
| | | fieldName: "remark", |
| | | label: "夿³¨", |
| | | component: "Textarea", |
| | | }); |
| | | } |
| | | if (isTon.value) { |
| | | schema.push({ |
| | | fieldName: "bagCount", |
| | | label: "è¢ç æ°", |
| | | component: "InputNumber", |
| | | componentProps: { |
| | | placeholder: "请è¾å
¥å¤æ³¨", |
| | | rows: 2, |
| | | class: "!w-full", |
| | | min: 1, |
| | | placeholder: "请è¾å
¥è¢ç æ°ï¼å¨åç§æ æçï¼è¢ç ä»
ç»å®æ¹æ¬¡ï¼", |
| | | precision: 0, |
| | | onChange: (value: number | string) => { |
| | | bagCountVal.value = Number(value) || null; |
| | | }, |
| | | }, |
| | | rules: "required", |
| | | }); |
| | | } |
| | | schema.push({ |
| | | fieldName: "remark", |
| | | label: "夿³¨", |
| | | component: "Textarea", |
| | | componentProps: { |
| | | placeholder: "请è¾å
¥å¤æ³¨", |
| | | rows: 2, |
| | | }, |
| | | ]; |
| | | }); |
| | | return schema; |
| | | } |
| | | |
| | | /** éæ©åç§å读å主计éåä½ç±»åï¼å¨æåæ¢æçæ°/è¢ç æ°è¾å
¥ */ |
| | | async function handleItemChange(item?: MdmItemApi.Item) { |
| | | unitType.value = ""; |
| | | kgPerPallet.value = null; |
| | | isTon.value = false; |
| | | unitTypeError.value = false; |
| | | palletCountVal.value = null; |
| | | bagCountVal.value = null; |
| | | if (item?.unitMeasureId) { |
| | | try { |
| | | const unit = await getUnit(item.unitMeasureId); |
| | | const type = (unit?.type ?? "").trim(); |
| | | unitType.value = type; |
| | | if (type === "å¨") { |
| | | isTon.value = true; |
| | | } else { |
| | | const matcher = /^(\d{1,5})åå
$/.exec(type); |
| | | if (matcher) { |
| | | kgPerPallet.value = Number(matcher[1]); |
| | | } else { |
| | | unitTypeError.value = true; |
| | | } |
| | | } |
| | | } catch { |
| | | unitTypeError.value = true; |
| | | } |
| | | } else if (item) { |
| | | unitTypeError.value = true; |
| | | } |
| | | await formApi.setState({ schema: buildSchema() }); |
| | | } |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) return; |
| | | if (unitTypeError.value) { |
| | | message.warning(tipText.value); |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const values = |
| | | (await formApi.getValues()) as MesProBagCodeApi.GenerateParams; |
| | | await generateBagCodes(values); |
| | | message.success(`å·²æåçæ ${values.count} æ¡è¢ç `); |
| | | const data: MesProBagCodeApi.GenerateParams = { |
| | | itemId: values.itemId, |
| | | remark: values.remark, |
| | | }; |
| | | if (isTon.value) { |
| | | data.bagCount = values.bagCount; |
| | | } else { |
| | | data.palletCount = values.palletCount; |
| | | } |
| | | const result = await generateBagCodes(data); |
| | | message.success( |
| | | `å·²æåçæ ${result.totalCount} æ¡è¢ç ` + |
| | | (result.palletIds?.length |
| | | ? `ï¼å¹¶èªå¨çæ ${result.palletIds.length} 个æç` |
| | | : ""), |
| | | ); |
| | | emit("success"); |
| | | await modalApi.close(); |
| | | } finally { |
| | |
| | | if (!isOpen) return; |
| | | modalApi.lock(); |
| | | try { |
| | | unitType.value = ""; |
| | | kgPerPallet.value = null; |
| | | isTon.value = false; |
| | | unitTypeError.value = false; |
| | | palletCountVal.value = null; |
| | | bagCountVal.value = null; |
| | | await formApi.setValues({ |
| | | itemId: undefined, |
| | | palletCount: undefined, |
| | | bagCount: undefined, |
| | | remark: undefined, |
| | | }); |
| | | await formApi.setState({ schema: buildSchema() }); |
| | | } finally { |
| | | modalApi.unlock(); |
| | |
| | | <template> |
| | | <Modal title="çæè¢ç æ°æ®å
" class="w-2/5"> |
| | | <Form class="mx-4" /> |
| | | <div |
| | | v-if="tipText" |
| | | class="mx-4 mb-2 rounded bg-gray-50 px-3 py-2 text-sm" |
| | | :class="unitTypeError ? 'text-red-500' : 'text-gray-500'" |
| | | > |
| | | {{ tipText }} |
| | | </div> |
| | | </Modal> |
| | | </template> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { VbenFormSchema } from "#/adapter/form"; |
| | | |
| | | import { markRaw } from "vue"; |
| | | |
| | | import { useVbenModal } from "@vben/common-ui"; |
| | | |
| | | import { message } from "ant-design-vue"; |
| | | |
| | | import { useVbenForm } from "#/adapter/form"; |
| | | import { generateRawBagCodes } from "#/api/mes/pro/bagCode"; |
| | | import { MdmItemSelect } from "#/views/basicData/mdm/components"; |
| | | |
| | | defineOptions({ name: "MesProBagCodeRawGenerateForm" }); |
| | | |
| | | const emit = defineEmits(["success"]); |
| | | |
| | | const schema: VbenFormSchema[] = [ |
| | | { |
| | | fieldName: "itemId", |
| | | label: "åç§", |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: "è¯·éæ©åç§ï¼äº§ååç§ï¼", |
| | | }, |
| | | rules: "selectRequired", |
| | | }, |
| | | { |
| | | fieldName: "count", |
| | | label: "è¢ç æ°é", |
| | | component: "InputNumber", |
| | | componentProps: { |
| | | class: "!w-full", |
| | | min: 1, |
| | | placeholder: "请è¾å
¥éè¦çæçè¢ç æ°é", |
| | | precision: 0, |
| | | }, |
| | | rules: "required", |
| | | }, |
| | | { |
| | | fieldName: "remark", |
| | | label: "夿³¨", |
| | | component: "Textarea", |
| | | componentProps: { |
| | | placeholder: "请è¾å
¥å¤æ³¨", |
| | | rows: 2, |
| | | }, |
| | | }, |
| | | ]; |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | | commonConfig: { |
| | | componentProps: { |
| | | class: "w-full", |
| | | }, |
| | | labelWidth: 100, |
| | | }, |
| | | layout: "horizontal", |
| | | schema, |
| | | showDefaultActions: false, |
| | | }); |
| | | |
| | | const [Modal, modalApi] = useVbenModal({ |
| | | async onConfirm() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid) return; |
| | | modalApi.lock(); |
| | | try { |
| | | const values = await formApi.getValues(); |
| | | const result = await generateRawBagCodes({ |
| | | itemId: values.itemId, |
| | | count: values.count, |
| | | remark: values.remark, |
| | | }); |
| | | message.success(`å·²æåçæ ${result.totalCount} æ¡åå§è¢ç `); |
| | | emit("success"); |
| | | await modalApi.close(); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | }, |
| | | async onOpenChange(isOpen: boolean) { |
| | | if (!isOpen) return; |
| | | await formApi.setValues({ |
| | | itemId: undefined, |
| | | count: undefined, |
| | | remark: undefined, |
| | | }); |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal title="çæåå§è¢ç " class="w-2/5"> |
| | | <Form class="mx-4" /> |
| | | <div class="mx-4 mb-2 rounded bg-gray-50 px-3 py-2 text-sm text-gray-500"> |
| | | åå§è¢ç ä»
ééæ©åç§å¹¶è¾å
¥æ°éï¼ä¸æ¢ç®è®¡éåä½ç±»åãä¸çææçï¼åç»å¯æ£å¸¸å½å
¥æ¹æ¬¡æç»å®æç |
| | | </div> |
| | | </Modal> |
| | | </template> |
| | |
| | | import { DICT_TYPE } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | import { ProLineSelect } from '#/views/mes/pro/line/components'; |
| | | import { UserSelect } from '#/views/system/user/components'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | |
| | | /** 表åç±»åï¼fillï¼ä¸´æ¶æ¹æ¬¡ç è¡¥å½æ£å¼ä¿¡æ¯ï¼ */ |
| | | export type FormType = 'create' | 'detail' | 'update' | 'fill'; |
| | | |
| | | /** æªç»å®æç䏿é项 */ |
| | | export interface PalletOption { |
| | | label: string; |
| | | value: number; |
| | | } |
| | | |
| | | /** æ°å¢/ä¿®æ¹ç表å */ |
| | | export function useFormSchema(formType: FormType): VbenFormSchema[] { |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | palletOptions: PalletOption[] = [], |
| | | ): VbenFormSchema[] { |
| | | const disabled = formType === 'detail'; |
| | | return [ |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'åç§', |
| | | component: markRaw(MdmItemSelect), |
| | | fieldName: 'lineId', |
| | | label: 'å å·¥åä½', |
| | | component: markRaw(ProLineSelect), |
| | | componentProps: { |
| | | disabled, |
| | | placeholder: 'è¯·éæ©åç§ï¼äº§ååç§ï¼', |
| | | placeholder: 'è¯·éæ©å å·¥åä½', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'lineId', |
| | | label: '产线', |
| | | component: markRaw(ProLineSelect), |
| | | fieldName: 'processingTeam', |
| | | label: 'å å·¥çç»', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | disabled, |
| | | placeholder: 'è¯·éæ©äº§çº¿', |
| | | maxlength: 64, |
| | | placeholder: '请è¾å
¥å å·¥çç»', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'produceDate', |
| | |
| | | }, |
| | | { |
| | | fieldName: 'planQuantity', |
| | | label: 'è®¡åæ°é', |
| | | label: 'å å·¥æ°é', |
| | | component: 'InputNumber', |
| | | componentProps: { |
| | | class: '!w-full', |
| | | disabled, |
| | | min: 0, |
| | | placeholder: '请è¾å
¥è®¡åæ°é', |
| | | placeholder: '请è¾å
¥å å·¥æ°é', |
| | | precision: 2, |
| | | }, |
| | | }, |
| | |
| | | placeholder: 'è¯·éæ©è´£ä»»äºº', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'palletIds', |
| | | label: 'ç»å®æç', |
| | | component: 'Select', |
| | | componentProps: { |
| | | allowClear: true, |
| | | disabled, |
| | | maxTagCount: 3, |
| | | mode: 'multiple', |
| | | optionFilterProp: 'label', |
| | | options: palletOptions, |
| | | placeholder: 'è¯·éæ©æçï¼å¯ä¸éï¼', |
| | | showSearch: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => formType !== 'detail', |
| | | }, |
| | | help: 'ç»å®åæ¹æ¬¡ç´æ¥è¿å
¥ç产ä¸ï¼æççææ£å¼æçç ï¼æç䏿ªå½æ¹æ¬¡çè¢ç èªå¨çº§èå½å
¥æ¬æ¹æ¬¡ï¼è¢ç åç§é¡»ä¸è´ï¼ï¼ç¼è¾æ¶ä»
éå¾éæ°å¢æçï¼å·²ç»å®çä¸å¯è§£ç»', |
| | | }, |
| | | { |
| | | fieldName: 'remark', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | | label: 'åç§', |
| | | component: markRaw(MdmItemSelect), |
| | | componentProps: { |
| | | placeholder: 'è¯·éæ©åç§', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'lineCode', |
| | | label: '产线ç¼ç ', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥äº§çº¿ç¼ç ', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'lineName', |
| | | label: '产线åç§°', |
| | | label: 'å å·¥åä½', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥äº§çº¿åç§°', |
| | | placeholder: '请è¾å
¥å å·¥åä½', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'processingTeam', |
| | | label: 'å å·¥çç»', |
| | | component: 'Input', |
| | | componentProps: { |
| | | allowClear: true, |
| | | placeholder: '请è¾å
¥å å·¥çç»', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | slots: { default: 'code' }, |
| | | }, |
| | | { |
| | | field: 'itemCode', |
| | | title: 'åç§ç¼ç ', |
| | | field: 'lineName', |
| | | title: 'å å·¥åä½', |
| | | width: 120, |
| | | }, |
| | | { |
| | | field: 'itemName', |
| | | title: 'åç§åç§°', |
| | | width: 140, |
| | | }, |
| | | { |
| | | field: 'lineCode', |
| | | title: '产线ç¼ç ', |
| | | width: 100, |
| | | }, |
| | | { |
| | | field: 'lineName', |
| | | title: '产线åç§°', |
| | | field: 'processingTeam', |
| | | title: 'å å·¥çç»', |
| | | width: 120, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | field: 'planQuantity', |
| | | title: 'è®¡åæ°é', |
| | | title: 'å å·¥æ°é', |
| | | width: 100, |
| | | }, |
| | | { |
| | |
| | | }); |
| | | } |
| | | |
| | | /** é¢çææ¹æ¬¡äºç»´ç æåï¼å±ç¤ºçæçä¸´æ¶æ¹æ¬¡ç */ |
| | | /** é¢çææ¹æ¬¡äºç»´ç æåï¼å·æ°å表并å±ç¤ºçæçä¸´æ¶æ¹æ¬¡ç */ |
| | | function handlePreGenerateSuccess(result: { id: number; tempCode: string }[]) { |
| | | handleRefresh(); |
| | | Modal.success({ |
| | | title: "é¢çæä¸´æ¶æ¹æ¬¡ç æå", |
| | | content: result.map((item) => item.tempCode).join("\n"), |
| | |
| | | <script lang="ts" setup> |
| | | import type { FormType } from "../data"; |
| | | import type { FormType, PalletOption } from "../data"; |
| | | |
| | | import type { VxeTableGridOptions } from "#/adapter/vxe-table"; |
| | | import type { MesProBatchApi } from "#/api/mes/pro/batch"; |
| | |
| | | getBatch, |
| | | updateBatch, |
| | | } from "#/api/mes/pro/batch"; |
| | | import { getUnboundPalletList } from "#/api/mes/pro/pallet"; |
| | | import { $t } from "#/locales"; |
| | | import { UserSelect } from "#/views/system/user/components"; |
| | | |
| | |
| | | } |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ schema: useFormSchema(formType.value) }); |
| | | // æ°å¢/è¡¥å½/ç¼è¾æå è½½æªç»å®æ¹æ¬¡çæçï¼ä¾ãç»å®æçãå¤éä¸æä½¿ç¨ |
| | | let palletOptions: PalletOption[] = []; |
| | | if (formType.value !== "detail") { |
| | | const pallets = await getUnboundPalletList(); |
| | | palletOptions = pallets.map((pallet) => ({ |
| | | label: `${pallet.tempCode ?? `æç${pallet.id}`}ï¼å·²è£
${pallet.bagCount ?? 0} è¢ï¼`, |
| | | value: pallet.id as number, |
| | | })); |
| | | } |
| | | formApi.setState({ schema: useFormSchema(formType.value, palletOptions) }); |
| | | if (formType.value !== "detail") { |
| | | // æ¸
ç©ºä¸æ¬¡æå¼æ¶å¾éçæçï¼é¿å
æ®çå¼è¯¯è§¦åãæ¹æ¬¡è¿å
¥ç产ä¸ã |
| | | await formApi.setFieldValue("palletIds", undefined); |
| | | } |
| | | // æ ¹æ®è¡¨åæåæ¢äººåå表å |
| | | workerGridApi.setGridOptions({ |
| | | columns: isEditable.value |
| | |
| | | slots: { default: 'batchCode' }, |
| | | }, |
| | | { |
| | | field: 'capacity', |
| | | title: 'å¯è£
è¢æ°ï¼è¢/æçï¼', |
| | | width: 150, |
| | | }, |
| | | { |
| | | field: 'bagCount', |
| | | title: 'å·²ç»è¢ç æ°é', |
| | | width: 120, |
| | |
| | | generateFormModalApi.open(); |
| | | } |
| | | |
| | | /** é¢çææåï¼å±ç¤ºçæçä¸´æ¶æçç */ |
| | | /** é¢çææåï¼å·æ°å表并å±ç¤ºçæçä¸´æ¶æçç */ |
| | | function handlePreGenerateSuccess(result: { id: number; tempCode: string }[]) { |
| | | handleRefresh(); |
| | | Modal.success({ |
| | | title: "é¢çæä¸´æ¶æçç æå", |
| | | content: result.map((item) => item.tempCode).join("\n"), |
| | |
| | | <template #code="{ row }"> |
| | | <span>{{ getDisplayCode(row) }}</span> |
| | | <Tag v-if="!row.code" color="warning">æªç»å®æ¹æ¬¡</Tag> |
| | | <Tag v-if="row.autoGenerated" color="processing">èªå¨çæ</Tag> |
| | | </template> |
| | | <template #batchCode="{ row }"> |
| | | <span v-if="row.batchCode">{{ row.batchCode }}</span> |
| | |
| | | <template> |
| | | <Modal title="æçç ç»å®çäº§æ¹æ¬¡" class="w-2/5"> |
| | | <Form class="mx-4" /> |
| | | <div class="mx-4 mb-2 rounded bg-gray-50 px-3 py-2 text-sm text-gray-500"> |
| | | ç»å®åï¼æç䏿ªå½å
¥æ¹æ¬¡çè¢ç å°èªå¨éæçç»å®è¯¥çäº§æ¹æ¬¡ï¼è¢ç åç§é¡»ä¸è´ï¼ |
| | | </div> |
| | | </Modal> |
| | | </template> |
| | |
| | | const values = await formApi.getValues(); |
| | | const result = await preGeneratePallet({ |
| | | count: values.count, |
| | | capacity: values.capacity, |
| | | remark: values.remark, |
| | | }); |
| | | message.success(`å·²çæ ${result.length} ä¸ªä¸´æ¶æçç `); |
| | |
| | | precision: 0, |
| | | }, |
| | | rules: "required", |
| | | }, |
| | | { |
| | | fieldName: "capacity", |
| | | label: "å¯è£
è¢æ°", |
| | | component: "InputNumber", |
| | | componentProps: { |
| | | class: "!w-full", |
| | | min: 1, |
| | | placeholder: "请è¾å
¥æ¯æçå¯è£
è¢æ°ï¼è¢/æçï¼", |
| | | precision: 0, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: "remark", |
| | |
| | | return map[val || 1] || 'QR_CODE'; |
| | | }; |
| | | const getBizTypeText = (val?: number) => { |
| | | const map: Record<number, string> = { 1: 'ä»åº', 2: 'åºåº', 3: 'åºä½', 4: 'ç©æ', 5: '客æ·', 6: 'ä¾åºå', 7: 'å·¥å', 8: '设å¤', 9: 'å·¥å
·', 10: '人å', 11: 'å·¥ä½ç«', 12: '车é´', 13: 'åºå', 14: 'æµè½¬å¡', 15: 'è£
ç®±å', 16: 'æ¹æ¬¡' }; |
| | | return map[val || 1] || '-'; |
| | | // åå¼ä¸å端 BarcodeBizTypeEnumï¼MesBizTypeConstants ç¼å·ï¼ä¿æä¸è´ |
| | | const map: Record<number, string> = { 102: 'ä»åº', 103: 'åºåº', 104: 'åºä½', 105: 'è£
ç®±å', 106: 'åºå', 107: 'æ¹æ¬¡', 109: 'SN ç ', 300: 'æµè½¬å¡', 301: 'å·¥å', 302: 'æµè½¬å', 400: '设å¤', 500: 'å·¥å
·', 600: 'ç©æ', 601: 'ä¾åºå', 602: 'å·¥ä½ç«', 603: '车é´', 604: '人å', 605: '客æ·' }; |
| | | return map[val as number] || '-'; |
| | | }; |
| | | const getStatusText = (val?: number) => val === 0 ? 'ç¦ç¨' : 'å¯ç¨'; |
| | | |
| | |
| | | |
| | | /** ä¸å¡ç±»åé项 */ |
| | | const bizTypeOptions = [ |
| | | { label: 'ç§åè´¨æ£', value: 5 }, |
| | | { label: 'çç¹è°æ´', value: 107 }, |
| | | { label: 'èªå®ä¹å
¥åº', value: 126 }, |
| | | { label: 'èªå®ä¹åºåº', value: 127 }, |
| | | { label: 'éè´å
¥åº', value: 110 }, |
| | | { label: 'éè´å
¥åºåæ¶', value: 111 }, |
| | | { label: 'éå®åºåº', value: 119 }, |
| | | { label: 'è°æ¨åºåº', value: 112 }, |
| | | { label: 'è°æ¨å
¥åº', value: 113 }, |