From 8ae325c7cbe1e4a0e8adf35aff06497baef319ab Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 26 十月 2026 14:02:38 +0800
Subject: [PATCH] feat(mes): 完善工艺路线产出配置功能
---
src/views/hrm/attendance/rule/modules/location-map-picker.vue | 12 +
src/api/mes/pro/route/process/index.ts | 20 ++
src/api/mes/pro/task/index.ts | 7
src/views/mes/pro/route/components/index.ts | 1
src/views/mes/pro/workorder/modules/process-form.vue | 177 ++++++++++++++--
.env | 2
src/views/mes/pro/route/modules/process-form.vue | 7
src/views/erp/sale/order/data.ts | 1
src/views/mes/pro/workorder/data.ts | 11 +
src/api/mes/pro/workorder/process/index.ts | 6
src/views/mes/pro/route/modules/route-configurator.vue | 14 +
src/api/erp/sale/order/index.ts | 2
src/views/erp/sale/order/index.vue | 1
src/views/mes/pro/route/data.ts | 32 ++
src/views/mes/md/item/components/select-dialog.vue | 46 ++--
src/views/mes/workbench/components/tabs/FeedbackTab.vue | 5
src/views/mes/pro/route/components/output-attribution.vue | 133 +++++++++++++
src/views/erp/sale/order/modules/form.vue | 1
src/views/mes/pro/workorder/modules/process-list.vue | 6
src/views/mes/workbench/components/WorkstationSelectDialog.vue | 67 ++++++
20 files changed, 482 insertions(+), 69 deletions(-)
diff --git a/.env b/.env
index 784c9f0..609f1ae 100644
--- a/.env
+++ b/.env
@@ -38,4 +38,4 @@
# VITE_APP_API_ENCRYPT_RESPONSE_KEY = MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOH8IfIFxL/MR9XIg1UDv5z1fGXQI93E8wrU4iPFovL/sEt9uSgSkjyidC2O7N+m7EKtoN6b1u7cEwXSkwf3kfK0jdWLSQaNpX5YshqXCBzbDfugDaxuyYrNA4/tIMs7mzZAk0APuRXB35Dmupou7Yw7TFW/7QhQmGfzeEKULQvnAgMBAAECgYAw8LqlQGyQoPv5p3gRxEMOCfgL0JzD3XBJKztiRd35RDh40Nx1ejgjW4dPioFwGiVWd2W8cAGHLzALdcQT2KDJh+T/tsd4SPmI6uSBBK6Ff2DkO+kFFcuYvfclQQKqxma5CaZOSqhgenacmgTMFeg2eKlY3symV6JlFNu/IKU42QJBAOhxAK/Eq3e61aYQV2JSguhMR3b8NXJJRroRs/QHEanksJtl+M+2qhkC9nQVXBmBkndnkU/l2tYcHfSBlAyFySMCQQD445tgm/J2b6qMQmuUGQAYDN8FIkHjeKmha+l/fv0igWm8NDlBAem91lNDIPBUzHL1X1+pcts5bjmq99YdOnhtAkAg2J8dN3B3idpZDiQbC8fd5bGPmdI/pSUudAP27uzLEjr2qrE/QPPGdwm2m7IZFJtK7kK1hKio6u48t/bg0iL7AkEAuUUs94h+v702Fnym+jJ2CHEkXvz2US8UDs52nWrZYiM1o1y4tfSHm8H8bv8JCAa9GHyriEawfBraILOmllFdLQJAQSRZy4wmlaG48MhVXodB85X+VZ9krGXZ2TLhz7kz9iuToy53l9jTkESt6L5BfBDCVdIwcXLYgK+8KFdHN5W7HQ==
# 鐧惧害鍦板浘
-VITE_BAIDU_MAP_KEY=Y2aJXiswwPxy6mwFs1z9c7U5gwX9WfUN
+VITE_BAIDU_MAP_KEY=5YhFUgsoi8KMm6tafbSljgz9NNpOYP1Z
diff --git a/src/api/erp/sale/order/index.ts b/src/api/erp/sale/order/index.ts
index 76789f9..b20ccb3 100644
--- a/src/api/erp/sale/order/index.ts
+++ b/src/api/erp/sale/order/index.ts
@@ -27,7 +27,7 @@
contractId?: number; // 鍏宠仈 CRM 鍚堝悓缂栧彿
contractNo?: string; // CRM 鍚堝悓鍗曞彿
needProduction?: number; // 鏄惁闇�瑕佺敓浜э細0-涓嶉渶瑕侊紝1-闇�瑕�
- productionStatus?: number; // 鐢熶骇鐘舵�侊細0-鏈畬鎴愶紝1-宸插畬鎴�
+ productionStatus?: number; // 鐢熶骇鐘舵�侊細0-鏈畬鎴愶紝1-宸插畬鎴愶紝2-宸插彇娑�
productionFinishTime?: Date; // 鐢熶骇瀹屾垚鏃堕棿
hasSalesNotice?: boolean; // 鏄惁宸茬敓鎴愬彂璐ч�氱煡鍗�
canCreateSalesNotice?: boolean; // 鏄惁鍙互鐢熸垚鍙戣揣閫氱煡鍗�
diff --git a/src/api/mes/pro/route/process/index.ts b/src/api/mes/pro/route/process/index.ts
index c207284..d44b20e 100644
--- a/src/api/mes/pro/route/process/index.ts
+++ b/src/api/mes/pro/route/process/index.ts
@@ -10,6 +10,19 @@
remark?: string;
}
+ /** 浜у嚭鐗╂枡褰掑睘 */
+ export interface OutputItem {
+ id?: number;
+ routeProcessId?: number;
+ productId?: number; // 褰掑睘浜у搧缂栧彿锛屼负绌鸿〃绀哄浜у搧閫氱敤
+ productName?: string;
+ itemId?: number;
+ itemCode?: string;
+ itemName?: string;
+ sort?: number;
+ remark?: string;
+ }
+
/** MES 宸ヨ壓璺嚎宸ュ簭 */
export interface RouteProcess {
id?: number;
@@ -32,6 +45,13 @@
outputItemName?: string;
outputItemIds?: number[];
outputItemNames?: string;
+ outputs?: OutputItem[]; // 浜у嚭鐗╂枡褰掑睘閰嶇疆
+ warehouseId?: number; // 榛樿鎶ュ伐浠撳簱缂栧彿
+ warehouseName?: string; // 榛樿鎶ュ伐浠撳簱鍚嶇О
+ locationId?: number; // 榛樿鎶ュ伐搴撳尯缂栧彿
+ locationName?: string; // 榛樿鎶ュ伐搴撳尯鍚嶇О
+ areaId?: number; // 榛樿鎶ュ伐搴撲綅缂栧彿
+ areaName?: string; // 榛樿鎶ュ伐搴撲綅鍚嶇О
remark?: string;
bomItems?: ProcessBomItem[];
createTime?: Date;
diff --git a/src/api/mes/pro/task/index.ts b/src/api/mes/pro/task/index.ts
index f832ffa..e484e2e 100644
--- a/src/api/mes/pro/task/index.ts
+++ b/src/api/mes/pro/task/index.ts
@@ -185,6 +185,13 @@
);
}
+/** 鎸夊伐浣滅珯鏌ヨ寰呮姤宸ヤ换鍔℃暟锛坘ey 涓哄伐浣滅珯缂栧彿锛� */
+export function getPendingFeedbackCountByWorkstation() {
+ return requestClient.get<Record<string, number>>(
+ '/mes/pro/task/pending-count-by-workstation',
+ );
+}
+
/** 鏍规嵁宸ヤ綔绔欏拰鏁伴噺璁$畻鐢熶骇鏃堕暱 */
export function calculateTaskDuration(workstationId: number, quantity: number) {
return requestClient.get<{ duration: number }>(
diff --git a/src/api/mes/pro/workorder/process/index.ts b/src/api/mes/pro/workorder/process/index.ts
index cc3630b..becabc2 100644
--- a/src/api/mes/pro/workorder/process/index.ts
+++ b/src/api/mes/pro/workorder/process/index.ts
@@ -34,6 +34,12 @@
outputItemName?: string; // 浜у嚭浜у搧鐗╂枡鍚嶇О锛堢涓�涓級
outputItemIds?: number[]; // 浜у嚭浜у搧鐗╂枡缂栧彿鍒楄〃
outputItemNames?: string; // 浜у嚭浜у搧鐗╂枡鍚嶇О锛堥�楀彿鎷兼帴锛�
+ warehouseId?: number; // 鎶ュ伐浠撳簱缂栧彿
+ warehouseName?: string; // 鎶ュ伐浠撳簱鍚嶇О
+ locationId?: number; // 鎶ュ伐搴撳尯缂栧彿
+ locationName?: string; // 鎶ュ伐搴撳尯鍚嶇О
+ areaId?: number; // 鎶ュ伐搴撲綅缂栧彿
+ areaName?: string; // 鎶ュ伐搴撲綅鍚嶇О
bomItems?: ProcessBomItem[]; // 宸ュ簭鎶曟枡BOM鏄庣粏
remark?: string; // 澶囨敞
}
diff --git a/src/views/erp/sale/order/data.ts b/src/views/erp/sale/order/data.ts
index 08272a4..fcc0181 100644
--- a/src/views/erp/sale/order/data.ts
+++ b/src/views/erp/sale/order/data.ts
@@ -406,6 +406,7 @@
{ label: '鏃犻渶鐢熶骇', value: -1 },
{ label: '鏈畬鎴�', value: 0 },
{ label: '宸插畬鎴�', value: 1 },
+ { label: '宸插彇娑�', value: 2 },
],
placeholder: '璇烽�夋嫨鐢熶骇鐘舵��',
allowClear: true,
diff --git a/src/views/erp/sale/order/index.vue b/src/views/erp/sale/order/index.vue
index 0b09c01..a4638cc 100644
--- a/src/views/erp/sale/order/index.vue
+++ b/src/views/erp/sale/order/index.vue
@@ -325,6 +325,7 @@
<template v-else>
<Tag v-if="row.productionStatus === 0" color="warning">鏈畬鎴�</Tag>
<Tag v-else-if="row.productionStatus === 1" color="success">宸插畬鎴�</Tag>
+ <Tag v-else-if="row.productionStatus === 2" color="error">宸插彇娑�</Tag>
</template>
</template>
<template #actions="{ row }">
diff --git a/src/views/erp/sale/order/modules/form.vue b/src/views/erp/sale/order/modules/form.vue
index 638f3ae..7a7b44f 100644
--- a/src/views/erp/sale/order/modules/form.vue
+++ b/src/views/erp/sale/order/modules/form.vue
@@ -161,6 +161,7 @@
<template #productionStatus="{ modelValue }">
<Tag v-if="modelValue === 0" color="warning">鏈畬鎴�</Tag>
<Tag v-else-if="modelValue === 1" color="success">宸插畬鎴�</Tag>
+ <Tag v-else-if="modelValue === 2" color="error">宸插彇娑�</Tag>
</template>
<template #items>
<ItemForm
diff --git a/src/views/hrm/attendance/rule/modules/location-map-picker.vue b/src/views/hrm/attendance/rule/modules/location-map-picker.vue
index b6856de..9524273 100644
--- a/src/views/hrm/attendance/rule/modules/location-map-picker.vue
+++ b/src/views/hrm/attendance/rule/modules/location-map-picker.vue
@@ -50,6 +50,10 @@
const env = (import.meta as any).env ?? {};
const baiduMapKey = String(env.VITE_BAIDU_MAP_KEY ?? '').trim();
const hasMapConfig = computed(() => Boolean(baiduMapKey));
+// 娴忚鍣ㄤ粎鍦ㄥ畨鍏ㄤ笂涓嬫枃锛圚TTPS 鎴� localhost锛夋斁寮�瀹氫綅鑳藉姏锛孒TTP 璁块棶涓嬫寜閽偣浜嗗繀鐒跺け璐�
+const canUseBrowserLocation = computed(
+ () => Boolean(navigator.geolocation) && window.isSecureContext,
+);
function outOfChina(longitude: number, latitude: number) {
return longitude < 72.004 || longitude > 137.8347 || latitude < 0.8293 || latitude > 55.8271;
@@ -324,8 +328,14 @@
placeholder="杈撳叆鐪併�佸競銆佸尯鍜屽叿浣撳湴鐐癸紝渚嬪锛氫箤椴佹湪榻愬競鏂伴珮鍔涘巶鍖�"
@search="handleSearch"
/>
- <a-button @click="handleCurrentLocation">瀹氫綅鍒板綋鍓嶄綅缃�</a-button>
+ <a-button v-if="canUseBrowserLocation" @click="handleCurrentLocation">瀹氫綅鍒板綋鍓嶄綅缃�</a-button>
</div>
+ <p
+ v-if="!disabled && !canUseBrowserLocation"
+ class="mb-2 text-xs text-gray-500"
+ >
+ 褰撳墠閫氳繃 HTTP 璁块棶锛屾祻瑙堝櫒涓嶅厑璁哥綉椤佃幏鍙栦綅缃�傝鐢ㄣ�屾悳绱㈠湴鍧�銆嶆垨鐩存帴鐐瑰嚮鍦板浘閫夌偣锛涘闇�缃戦〉瀹氫綅璇锋敼鐢� HTTPS 璁块棶銆�
+ </p>
<div ref="mapContainer" class="h-[360px] w-full overflow-hidden rounded border border-gray-200"></div>
<div class="mt-2 flex flex-wrap justify-between gap-2 text-xs text-gray-500">
<span>{{ disabled ? '鎵撳崱浣嶇疆鍙婂厑璁歌寖鍥�' : '鐐瑰嚮鍦板浘閫夋嫨鎵撳崱涓績鐐癸紱钃濊壊鍦嗗湀琛ㄧず鍏佽鎵撳崱鑼冨洿' }}</span>
diff --git a/src/views/mes/md/item/components/select-dialog.vue b/src/views/mes/md/item/components/select-dialog.vue
index a1b4d30..b1466b7 100644
--- a/src/views/mes/md/item/components/select-dialog.vue
+++ b/src/views/mes/md/item/components/select-dialog.vue
@@ -124,7 +124,7 @@
},
gridOptions: {
columns: useItemSelectGridColumns(true),
- height: 560,
+ height: '100%',
keepSource: true,
checkboxConfig: {
highlight: true,
@@ -230,29 +230,31 @@
:destroy-on-close="true"
@ok="handleConfirm"
@cancel="closeModal">
- <div class="flex h-[60vh] w-full">
- <Card
- v-if="!limitedToProducts"
- class="mr-4 h-full w-1/5"
- :body-style="{ height: '100%', overflow: 'hidden' }"
+ <div class="flex h-[calc(100vh-300px)] min-h-[380px] w-full flex-col">
+ <Alert
+ v-if="limitedToProducts"
+ class="mb-3 shrink-0"
+ message="浠呭彲閫夋嫨鏈骇鍝佸湪宸ヨ壓璺嚎涓凡閰嶇疆鐨勪骇鍑虹墿鏂�"
+ description="濡傞渶澧炲姞鍙�夐」锛岃鍏堝湪宸ヨ壓璺嚎瀵瑰簲宸ュ簭涓厤缃骇鍑哄苟淇濆瓨銆�"
+ show-icon
+ type="info"
>
- <MdItemTypeTree ref="typeTreeRef"
- @node-click="handleItemTypeNodeClick" />
- </Card>
- <div :class="limitedToProducts ? 'w-full' : 'w-4/5'">
- <Alert
- v-if="limitedToProducts"
- class="mb-3"
- message="浠呭彲閫夋嫨鏈矾绾垮凡閰嶇疆鐨勪骇鍑轰骇鍝�"
- description="濡傞渶澧炲姞鍙�夐」锛岃杩斿洖鈥滀骇鍑轰骇鍝佸強鍏ュ簱浠撯�濇楠ゅ厛娣诲姞浜у嚭銆�"
- show-icon
- type="info"
+ <template #action>
+ <Tag color="blue">{{ productIds.length }} 涓骇鍑�</Tag>
+ </template>
+ </Alert>
+ <div class="flex min-h-0 w-full flex-1 gap-4">
+ <Card
+ v-if="!limitedToProducts"
+ class="h-full w-1/5 shrink-0"
+ :body-style="{ height: '100%', overflow: 'hidden' }"
>
- <template #action>
- <Tag color="blue">{{ productIds.length }} 涓骇鍑�</Tag>
- </template>
- </Alert>
- <Grid :table-title="tableTitle" />
+ <MdItemTypeTree ref="typeTreeRef"
+ @node-click="handleItemTypeNodeClick" />
+ </Card>
+ <div class="h-full min-h-0 min-w-0 flex-1">
+ <Grid class="h-full" :table-title="tableTitle" />
+ </div>
</div>
</div>
</Modal>
diff --git a/src/views/mes/pro/route/components/index.ts b/src/views/mes/pro/route/components/index.ts
index 4a78a4c..7a20061 100644
--- a/src/views/mes/pro/route/components/index.ts
+++ b/src/views/mes/pro/route/components/index.ts
@@ -1 +1,2 @@
export { default as RouteColorPicker } from './color-picker.vue';
+export { default as RouteOutputAttribution } from './output-attribution.vue';
diff --git a/src/views/mes/pro/route/components/output-attribution.vue b/src/views/mes/pro/route/components/output-attribution.vue
new file mode 100644
index 0000000..29ec83e
--- /dev/null
+++ b/src/views/mes/pro/route/components/output-attribution.vue
@@ -0,0 +1,133 @@
+<script lang="ts" setup>
+import type { MesProRouteProcessApi } from '#/api/mes/pro/route/process';
+import type { MesProRouteProductApi } from '#/api/mes/pro/route/product';
+
+import { computed } from 'vue';
+
+import { IconifyIcon } from '@vben/icons';
+
+import { Button, Select } from 'ant-design-vue';
+
+defineOptions({ name: 'RouteOutputAttribution' });
+
+/** 褰掑睘閫夋嫨涓唬琛ㄢ�滃浜у搧閫氱敤鈥濈殑鍝ㄥ叺鍊硷紙浜у搧缂栧彿鍧囦负姝f暟锛� */
+const GENERAL_PRODUCT = 0;
+
+const props = withDefaults(
+ defineProps<{
+ disabled?: boolean;
+ modelValue?: MesProRouteProcessApi.OutputItem[];
+ products?: MesProRouteProductApi.RouteProduct[];
+ }>(),
+ {
+ disabled: false,
+ modelValue: () => [],
+ products: () => [],
+ },
+);
+
+const emit = defineEmits<{
+ 'update:modelValue': [value: MesProRouteProcessApi.OutputItem[]];
+}>();
+
+const rows = computed(() => props.modelValue ?? []);
+const productOptions = computed(() =>
+ props.products
+ .filter((product) => product.itemId != null)
+ .map((product) => ({
+ label: product.itemName ?? product.itemCode ?? String(product.itemId),
+ value: product.itemId!,
+ })),
+);
+const attributionOptions = computed(() => [
+ { label: '閫氱敤锛堟墍鏈変骇鍝侊級', value: GENERAL_PRODUCT },
+ ...productOptions.value,
+]);
+
+function commit(next: MesProRouteProcessApi.OutputItem[]) {
+ emit('update:modelValue', next);
+}
+
+function updateRow(
+ index: number,
+ patch: Partial<MesProRouteProcessApi.OutputItem>,
+) {
+ commit(rows.value.map((row, i) => (i === index ? { ...row, ...patch } : row)));
+}
+
+/** 閫夋嫨浜у嚭鐗╂枡鏃讹紝榛樿褰掑睘鍒拌嚜韬骇鍝侊紙鍗婃垚鍝佸叡鐢ㄦ椂鍐嶆墜鍔ㄦ敼鎴愨�滈�氱敤鈥濓級 */
+function handleItemChange(index: number, itemId: number | undefined) {
+ const current = rows.value[index];
+ const patch: Partial<MesProRouteProcessApi.OutputItem> = { itemId };
+ if (current?.productId == null && itemId != null) {
+ patch.productId = itemId;
+ }
+ updateRow(index, patch);
+}
+
+function handleAttributionChange(index: number, value: number | undefined) {
+ updateRow(index, {
+ productId: value === GENERAL_PRODUCT || value == null ? undefined : value,
+ });
+}
+
+function addRow() {
+ commit([...rows.value, { itemId: undefined, productId: undefined }]);
+}
+
+function removeRow(index: number) {
+ commit(rows.value.filter((_, i) => i !== index));
+}
+</script>
+
+<template>
+ <div class="w-full">
+ <div class="flex flex-col gap-2">
+ <div
+ v-for="(row, index) in rows"
+ :key="index"
+ class="flex items-center gap-2"
+ >
+ <Select
+ :disabled="disabled"
+ :options="productOptions"
+ :placeholder="'閫夋嫨浜у嚭鐗╂枡'"
+ :value="row.itemId"
+ class="min-w-0 flex-1"
+ option-filter-prop="label"
+ show-search
+ @change="(value) => handleItemChange(index, value as number | undefined)"
+ />
+ <Select
+ :disabled="disabled || row.itemId == null"
+ :options="attributionOptions"
+ :value="row.productId ?? GENERAL_PRODUCT"
+ class="min-w-0 flex-1"
+ @change="(value) => handleAttributionChange(index, value as number | undefined)"
+ />
+ <Button
+ :disabled="disabled"
+ danger
+ size="small"
+ type="text"
+ @click="removeRow(index)"
+ >
+ <IconifyIcon class="size-4" icon="lucide:trash-2" />
+ </Button>
+ </div>
+ <div v-if="rows.length === 0" class="text-sm text-gray-500">
+ 鏆傛棤浜у嚭锛涘舰鎴愬崐鎴愬搧鎴栨垚鍝佹椂娣诲姞
+ </div>
+ </div>
+ <Button
+ v-if="!disabled"
+ class="mt-2"
+ size="small"
+ type="dashed"
+ @click="addRow"
+ >
+ <IconifyIcon class="mr-1 size-4" icon="lucide:plus" />
+ 娣诲姞浜у嚭
+ </Button>
+ </div>
+</template>
diff --git a/src/views/mes/pro/route/data.ts b/src/views/mes/pro/route/data.ts
index 5fb905a..b6ee40f 100644
--- a/src/views/mes/pro/route/data.ts
+++ b/src/views/mes/pro/route/data.ts
@@ -26,7 +26,7 @@
MdProductBomSelect,
} from '#/views/mes/md/item/components';
-import { RouteColorPicker } from './components';
+import { RouteColorPicker, RouteOutputAttribution } from './components';
/** 琛ㄥ崟绫诲瀷 */
export type FormType = 'create' | 'detail' | 'update';
@@ -183,7 +183,7 @@
/** 宸ヨ壓璺嚎宸ュ簭鏄庣粏琛ㄥ崟 */
export function useRouteProcessFormSchema(
processOptions: Array<{ label: string; value: number }>,
- productIds: number[] = [],
+ products: MesProRouteProductApi.RouteProduct[] = [],
): VbenFormSchema[] {
return [
{
@@ -220,13 +220,11 @@
rules: 'selectRequired',
},
{
- fieldName: 'outputItemIds',
+ fieldName: 'outputs',
label: '鏈伐搴忎骇鍑�',
- component: markRaw(MdItemSelect),
+ component: markRaw(RouteOutputAttribution),
componentProps: {
- multiple: true,
- productIds,
- placeholder: '鍙暀绌猴紱褰㈡垚鍗婃垚鍝佹椂閫夋嫨锛屾湯閬撳伐搴忛�夋嫨鍏ㄩ儴鎴愬搧',
+ products,
},
formItemClass: 'col-span-2',
},
@@ -318,7 +316,25 @@
{ field: 'sort', title: '搴忓彿', width: 70, align: 'center', fixed: 'left' },
{ field: 'processCode', title: '宸ュ簭缂栫爜', width: 140, fixed: 'left' },
{ field: 'processName', title: '宸ュ簭鍚嶇О', width: 140, fixed: 'left' },
- { field: 'outputItemNames', title: '鏈伐搴忎骇鍑�', minWidth: 190 },
+ {
+ field: 'outputItemNames',
+ title: '鏈伐搴忎骇鍑�',
+ minWidth: 240,
+ formatter: ({ cellValue, row }) => {
+ const outputs = row.outputs ?? [];
+ if (!outputs.length) {
+ return cellValue ?? '';
+ }
+ return outputs
+ .map((output) => {
+ const name = output.itemName ?? output.itemCode ?? output.itemId;
+ return output.productId == null
+ ? `${name}锛堥�氱敤锛塦
+ : `${name}锛�${output.productName ?? output.productId}锛塦;
+ })
+ .join('銆�');
+ },
+ },
{ field: 'nextProcessName', title: '涓嬩竴閬撳伐搴�', width: 140 },
{
field: 'linkType',
diff --git a/src/views/mes/pro/route/modules/process-form.vue b/src/views/mes/pro/route/modules/process-form.vue
index 493f6c4..228ee31 100644
--- a/src/views/mes/pro/route/modules/process-form.vue
+++ b/src/views/mes/pro/route/modules/process-form.vue
@@ -48,10 +48,7 @@
value: item.id!,
}));
const products = routeId ? await getRouteProductListByRoute(routeId) : [];
- return useRouteProcessFormSchema(
- options,
- products.map((item) => item.itemId!).filter(Boolean),
- );
+ return useRouteProcessFormSchema(options, products);
}
const [Modal, modalApi] = useVbenModal({
@@ -124,7 +121,7 @@
<Alert
class="mx-4 mb-4"
message="鎸夊疄闄呯敓浜ц妭鐐归厤缃骇鍑�"
- description="涓棿宸ュ簭娌℃湁鐙珛浜у嚭鏃跺彲鐣欑┖锛涘舰鎴愬崐鎴愬搧鏃堕�夋嫨瀵瑰簲鍗婃垚鍝侊紝鏈亾宸ュ簭蹇呴』閫夋嫨鍏ㄩ儴鎴愬搧銆傚寮�鍚姤宸ヨ嚜鍔ㄦ墸鏂欙紝鎶ュ伐鏃朵細鎸夊伐搴忔姇鏂欓厤缃墸鍑忓簱瀛樸��"
+ description="涓棿宸ュ簭娌℃湁鐙珛浜у嚭鏃跺彲鐣欑┖锛涘舰鎴愬崐鎴愬搧鏃堕�夋嫨瀵瑰簲鍗婃垚鍝侊紝鏈亾宸ュ簭蹇呴』閫夋嫨鍏ㄩ儴鎴愬搧銆傚綊灞炶〃绀鸿浜у嚭灞炰簬鍝釜浜у搧锛氬浜у搧鍏辩敤鐨勫崐鎴愬搧閫夆�滈�氱敤鈥濓紝浜у搧涓撳睘锛堝挨鍏舵槸鎴愬搧锛夊綊灞炲埌鑷韩浜у搧銆傚寮�鍚姤宸ヨ嚜鍔ㄦ墸鏂欙紝鎶ュ伐鏃朵細鎸夊伐搴忔姇鏂欓厤缃墸鍑忓簱瀛樸��"
show-icon
type="info"
/>
diff --git a/src/views/mes/pro/route/modules/route-configurator.vue b/src/views/mes/pro/route/modules/route-configurator.vue
index f97e543..04cd49c 100644
--- a/src/views/mes/pro/route/modules/route-configurator.vue
+++ b/src/views/mes/pro/route/modules/route-configurator.vue
@@ -80,6 +80,18 @@
text: `鏈亾宸ュ簭鈥�${lastProcess.value.processName || lastProcess.value.processCode || lastProcess.value.sort}鈥濆繀椤婚厤缃垚鍝佷骇鍑篳,
});
}
+ const lastOutputs = lastProcess.value?.outputs ?? [];
+ if (
+ lastOutputs.length &&
+ lastOutputs.some(
+ (output) => output.productId == null || output.productId !== output.itemId,
+ )
+ ) {
+ issues.push({
+ step: 2,
+ text: '鏈亾宸ュ簭鐨勬垚鍝佷骇鍑哄繀椤诲綊灞炲埌鑷韩浜у搧锛屼笉鑳戒娇鐢ㄢ�滈�氱敤鈥�',
+ });
+ }
const productIds = new Set(productList.value.map((item) => item.itemId));
const invalidOutputCount = processList.value.filter((process) =>
process.outputItemIds?.some((itemId) => !productIds.has(itemId)),
@@ -299,7 +311,7 @@
<Alert
class="mb-4"
message="鎸夊疄闄呯敓浜ч『搴忕紪鎺掑伐搴�"
- description="涓棿宸ュ簭娌℃湁鐙珛浜у嚭鏃跺彲鐣欑┖锛涘舰鎴愬崐鎴愬搧鏃堕�夋嫨瀵瑰簲鍗婃垚鍝侊紝鏈�鍚庝竴閬撳伐搴忓繀椤婚�夋嫨璺嚎缁戝畾鐨勫叏閮ㄦ垚鍝併��"
+ description="涓棿宸ュ簭娌℃湁鐙珛浜у嚭鏃跺彲鐣欑┖锛涘舰鎴愬崐鎴愬搧鏃堕�夋嫨瀵瑰簲鍗婃垚鍝侊紝鏈�鍚庝竴閬撳伐搴忓繀椤婚�夋嫨璺嚎缁戝畾鐨勫叏閮ㄦ垚鍝併�傚浜у搧鍏辩敤鐨勫崐鎴愬搧褰掑睘閫夆�滈�氱敤鈥濓紝鎴愬搧蹇呴』褰掑睘鍒拌嚜韬骇鍝併��"
show-icon
type="info"
/>
diff --git a/src/views/mes/pro/workorder/data.ts b/src/views/mes/pro/workorder/data.ts
index 60ef22a..1006dd8 100644
--- a/src/views/mes/pro/workorder/data.ts
+++ b/src/views/mes/pro/workorder/data.ts
@@ -743,6 +743,17 @@
width: 160,
},
{
+ field: 'warehouseName',
+ title: '鎶ュ伐浠撳簱',
+ width: 130,
+ formatter: ({ cellValue, row }) => {
+ if (!cellValue) return '-';
+ return row.areaName
+ ? `${cellValue}/${row.locationName ?? ''}/${row.areaName}`
+ : cellValue;
+ },
+ },
+ {
field: 'remark',
title: '澶囨敞',
minWidth: 120,
diff --git a/src/views/mes/pro/workorder/modules/process-form.vue b/src/views/mes/pro/workorder/modules/process-form.vue
index bdbdcaa..fb2df51 100644
--- a/src/views/mes/pro/workorder/modules/process-form.vue
+++ b/src/views/mes/pro/workorder/modules/process-form.vue
@@ -10,11 +10,15 @@
import { useVbenForm } from '#/adapter/form';
import { getProcessSimpleList } from '#/api/mes/pro/process';
+import { getRouteProcessListByProduct } from '#/api/mes/pro/route/process';
import {
createWorkOrderProcess,
getWorkOrderProcess,
updateWorkOrderProcess,
} from '#/api/mes/pro/workorder/process';
+import { getWarehouseSimpleList } from '#/api/mes/wm/warehouse';
+import { getWarehouseAreaSimpleList } from '#/api/mes/wm/warehouse/area';
+import { getWarehouseLocationSimpleList } from '#/api/mes/wm/warehouse/location';
import { $t } from '#/locales';
import { MdItemSelect } from '#/views/mes/md/item/components';
@@ -23,6 +27,7 @@
const workOrderId = ref<number>();
const processList = ref<MesProWorkOrderProcessApi.WorkOrderProcess[]>([]);
const isCreateMode = ref(false);
+const allowedOutputItemIds = ref<number[]>([]);
const getTitle = computed(() => {
return formData.value?.id
@@ -39,9 +44,37 @@
}));
}
+/**
+ * 杞藉叆鏈伐鍗曚骇鍝佸彲閫夌殑浜у嚭鐗╂枡鑼冨洿
+ *
+ * 鍙栧伐鑹鸿矾绾挎寜浜у嚭褰掑睘杩囨护鍚庣殑浜у嚭锛堥�氱敤鍗婃垚鍝� + 鏈骇鍝佷笓灞炴垚鍝侊級锛�
+ * 骞跺苟鍏ヨ宸ュ簭宸查厤缃殑浜у嚭锛岄伩鍏嶅巻鍙叉暟鎹湪閲嶆柊閫夋嫨鏃惰璇竻绌恒��
+ */
+async function loadAllowedOutputItemIds(
+ productId?: number,
+ currentOutputItemIds: number[] = [],
+): Promise<number[]> {
+ if (!productId) {
+ return [];
+ }
+ const ids = new Set<number>([productId, ...currentOutputItemIds]);
+ const routeProcessList = await getRouteProcessListByProduct(productId);
+ (routeProcessList || []).forEach((process) => {
+ (process.outputItemIds || []).forEach((id) => {
+ if (id) {
+ ids.add(id);
+ }
+ });
+ });
+ return [...ids];
+}
+
/** 琛ㄥ崟 schema */
async function loadSchema(): Promise<VbenFormSchema[]> {
- const processOptions = await loadProcessOptions();
+ const [processOptions, warehouseList] = await Promise.all([
+ loadProcessOptions(),
+ getWarehouseSimpleList(),
+ ]);
return [
{
fieldName: 'id',
@@ -50,6 +83,21 @@
},
{
fieldName: 'workOrderId',
+ component: 'Input',
+ dependencies: { triggerFields: [''], show: () => false },
+ },
+ {
+ fieldName: 'warehouseName',
+ component: 'Input',
+ dependencies: { triggerFields: [''], show: () => false },
+ },
+ {
+ fieldName: 'locationName',
+ component: 'Input',
+ dependencies: { triggerFields: [''], show: () => false },
+ },
+ {
+ fieldName: 'areaName',
component: 'Input',
dependencies: { triggerFields: [''], show: () => false },
},
@@ -176,6 +224,80 @@
componentProps: {
multiple: true,
placeholder: '璇烽�夋嫨浜у嚭鐗╂枡',
+ productIds: allowedOutputItemIds.value,
+ },
+ },
+ {
+ fieldName: 'warehouseId',
+ label: '鎶ュ伐浠撳簱',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: (warehouseList || []).map((item) => ({
+ label: item.name ?? '',
+ value: item.id!,
+ })),
+ placeholder: '榛樿鍙栧伐鑹鸿矾绾块厤缃紝鍙慨鏀�',
+ onChange: async (value: number) => {
+ const warehouse = (warehouseList || []).find(
+ (item) => item.id === value,
+ );
+ await formApi.setFieldValue('warehouseName', warehouse?.name);
+ await formApi.setFieldValue('locationId', undefined);
+ await formApi.setFieldValue('locationName', undefined);
+ await formApi.setFieldValue('areaId', undefined);
+ await formApi.setFieldValue('areaName', undefined);
+ },
+ },
+ },
+ {
+ fieldName: 'locationId',
+ label: '鎶ュ伐搴撳尯',
+ component: 'Select',
+ dependencies: {
+ triggerFields: ['warehouseId'],
+ disabled: (values) => !values.warehouseId,
+ async componentProps(values) {
+ const options = values.warehouseId
+ ? await getWarehouseLocationSimpleList(values.warehouseId)
+ : [];
+ return {
+ allowClear: true,
+ fieldNames: { label: 'name', value: 'id' },
+ options,
+ placeholder: '璇烽�夋嫨鎶ュ伐搴撳尯',
+ onChange: async (value: number) => {
+ const location = options.find((item) => item.id === value);
+ await formApi.setFieldValue('locationName', location?.name);
+ await formApi.setFieldValue('areaId', undefined);
+ await formApi.setFieldValue('areaName', undefined);
+ },
+ };
+ },
+ },
+ },
+ {
+ fieldName: 'areaId',
+ label: '鎶ュ伐搴撲綅',
+ component: 'Select',
+ dependencies: {
+ triggerFields: ['locationId'],
+ disabled: (values) => !values.locationId,
+ async componentProps(values) {
+ const options = values.locationId
+ ? await getWarehouseAreaSimpleList(values.locationId)
+ : [];
+ return {
+ allowClear: true,
+ fieldNames: { label: 'name', value: 'id' },
+ options,
+ placeholder: '璇烽�夋嫨鎶ュ伐搴撲綅',
+ onChange: async (value: number) => {
+ const area = options.find((item) => item.id === value);
+ await formApi.setFieldValue('areaName', area?.name);
+ },
+ };
+ },
},
},
{
@@ -262,16 +384,9 @@
formData.value = undefined;
processList.value = [];
isCreateMode.value = false;
+ allowedOutputItemIds.value = [];
return;
}
- modalApi.lock();
- try {
- const schema = await loadSchema();
- formApi.setState({ schema });
- } finally {
- modalApi.unlock();
- }
-
const data = modalApi.getData<{
id?: number;
productId?: number;
@@ -287,27 +402,33 @@
processList.value = data.processList || [];
isCreateMode.value = !data.workOrderId;
- if (data.row) {
- // 缂栬緫涓存椂鍒楄〃涓殑宸ュ簭
- formData.value = data.row;
- await formApi.setValues(data.row);
- } else if (data.id) {
- // 缂栬緫宸蹭繚瀛樼殑宸ュ簭
- modalApi.lock();
- try {
- formData.value = await getWorkOrderProcess(data.id);
+ modalApi.lock();
+ try {
+ // 鍏堝彇宸ュ簭鏁版嵁锛氱紪杈戝凡淇濆瓨宸ュ簭鏃剁敤浜庡洖鏄撅紝涔熺敤浜庝繚鐣欏叾宸叉湁浜у嚭
+ const savedProcess = !data.row && data.id
+ ? await getWorkOrderProcess(data.id)
+ : undefined;
+ formData.value = data.row ?? savedProcess;
+
+ allowedOutputItemIds.value = await loadAllowedOutputItemIds(
+ data.productId,
+ formData.value?.outputItemIds || [],
+ );
+ formApi.setState({ schema: await loadSchema() });
+
+ if (formData.value) {
+ // 缂栬緫涓存椂鍒楄〃涓殑宸ュ簭 / 缂栬緫宸蹭繚瀛樼殑宸ュ簭
await formApi.setValues(formData.value);
- } finally {
- modalApi.unlock();
+ } else {
+ // 鏂板
+ const maxSort = Math.max(0, ...processList.value.map((item) => item.sort || 0));
+ await formApi.setValues({
+ colorCode: '#00AEF3',
+ sort: maxSort + 1,
+ });
}
- } else {
- // 鏂板
- formData.value = undefined;
- const maxSort = Math.max(0, ...processList.value.map((item) => item.sort || 0));
- await formApi.setValues({
- colorCode: '#00AEF3',
- sort: maxSort + 1,
- });
+ } finally {
+ modalApi.unlock();
}
},
});
diff --git a/src/views/mes/pro/workorder/modules/process-list.vue b/src/views/mes/pro/workorder/modules/process-list.vue
index 283424d..dd70150 100644
--- a/src/views/mes/pro/workorder/modules/process-list.vue
+++ b/src/views/mes/pro/workorder/modules/process-list.vue
@@ -158,6 +158,12 @@
backflushFlag: item.backflushFlag,
outputItemIds: item.outputItemIds,
outputItemNames: item.outputItemNames,
+ warehouseId: item.warehouseId,
+ warehouseName: item.warehouseName,
+ locationId: item.locationId,
+ locationName: item.locationName,
+ areaId: item.areaId,
+ areaName: item.areaName,
remark: item.remark,
bomItems: item.bomItems,
}));
diff --git a/src/views/mes/workbench/components/WorkstationSelectDialog.vue b/src/views/mes/workbench/components/WorkstationSelectDialog.vue
index 6d5e41d..f066e66 100644
--- a/src/views/mes/workbench/components/WorkstationSelectDialog.vue
+++ b/src/views/mes/workbench/components/WorkstationSelectDialog.vue
@@ -8,6 +8,7 @@
import { Input, Modal, Spin } from 'ant-design-vue';
import { getWorkstationPage } from '#/api/mes/md/workstation';
+import { getPendingFeedbackCountByWorkstation } from '#/api/mes/pro/task';
defineOptions({ name: 'WorkbenchWorkstationSelectDialog' });
@@ -19,6 +20,8 @@
const loading = ref(false);
const workstations = ref<MesMdWorkstationApi.Workstation[]>([]);
const searchKeyword = ref('');
+/** 宸ヤ綔绔欏緟鎶ュ伐浠诲姟鏁帮紝key 涓哄伐浣滅珯缂栧彿锛沶ull 琛ㄧず缁熻鍔犺浇澶辫触锛屼笉灞曠ず */
+const pendingCounts = ref<null | Record<string, number>>(null);
/** 鎵撳紑寮圭獥 */
async function open() {
@@ -31,11 +34,20 @@
async function loadWorkstations() {
loading.value = true;
try {
- const result = await getWorkstationPage({ pageNo: 1, pageSize: 200 });
+ const [result, counts] = await Promise.all([
+ getWorkstationPage({ pageNo: 1, pageSize: 200 }),
+ getPendingFeedbackCountByWorkstation().catch(() => null),
+ ]);
workstations.value = result.list ?? [];
+ pendingCounts.value = counts;
} finally {
loading.value = false;
}
+}
+
+/** 璇ュ伐浣滅珯鐨勫緟瀹屾垚锛堝緟鎶ュ伐锛変换鍔℃暟 */
+function getPendingCount(ws: MesMdWorkstationApi.Workstation) {
+ return pendingCounts.value?.[String(ws.id)] ?? 0;
}
/** 杩囨护鍚庣殑宸ヤ綔绔� */
@@ -102,7 +114,18 @@
{{ ws.processName }}
</span>
</div>
- <div class="ws-card__name">{{ ws.name }}</div>
+ <div class="ws-card__name-row">
+ <span class="ws-card__name">{{ ws.name }}</span>
+ <span
+ v-if="pendingCounts"
+ class="ws-card__pending"
+ :class="{ 'ws-card__pending--empty': getPendingCount(ws) === 0 }"
+ :title="`璇ュ伐浣滅珯寰呮姤宸ヤ换鍔℃暟锛�${getPendingCount(ws)}`"
+ >
+ <IconifyIcon icon="lucide:list-todo" class="ws-card__pending-icon" />
+ 寰呭畬鎴� {{ getPendingCount(ws) }}
+ </span>
+ </div>
<div class="ws-card__info">
<div v-if="ws.workshopName" class="ws-card__info-row">
<IconifyIcon icon="lucide:building-2" class="ws-card__info-icon" />
@@ -209,11 +232,51 @@
color: #fff;
}
+.ws-card__name-row {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+}
+
.ws-card__name {
+ flex: 1;
+ min-width: 0;
font-size: 15px;
font-weight: 600;
color: #1e3a5f;
line-height: 1.3;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.ws-card__pending {
+ display: inline-flex;
+ flex-shrink: 0;
+ align-items: center;
+ gap: 4px;
+ padding: 3px 9px;
+ border: 1px solid #fdba74;
+ border-radius: 999px;
+ background: #fff7ed;
+ color: #c2410c;
+ font-size: 12px;
+ font-weight: 700;
+ font-variant-numeric: tabular-nums;
+ line-height: 1.4;
+
+ &--empty {
+ border-color: #cbd5e1;
+ background: rgb(255 255 255 / 55%);
+ color: #64748b;
+ font-weight: 600;
+ }
+}
+
+.ws-card__pending-icon {
+ flex-shrink: 0;
+ font-size: 13px;
}
.ws-card__info {
diff --git a/src/views/mes/workbench/components/tabs/FeedbackTab.vue b/src/views/mes/workbench/components/tabs/FeedbackTab.vue
index 8439b83..de8aa5d 100644
--- a/src/views/mes/workbench/components/tabs/FeedbackTab.vue
+++ b/src/views/mes/workbench/components/tabs/FeedbackTab.vue
@@ -88,6 +88,10 @@
async function getAlignedData() {
const data = (await formApi.getValues()) as any;
+ // 鏂板缓鏃朵笉鑳芥惡甯︿笂涓�寮犳姤宸ュ崟娈嬬暀鐨� id锛屽惁鍒欏悗绔寜涓婚敭鎻掑叆浼氬啿绐�
+ if (formType.value === 'create') {
+ delete data.id;
+ }
alignQuantity(data);
return data;
}
@@ -131,6 +135,7 @@
itemSpecification: task.itemSpecification,
unitMeasureName: task.unitMeasureName,
scheduledQuantity: task.quantity,
+ reportableQuantity: task.reportableQuantity,
checkFlag,
});
--
Gitblit v1.9.3