From f984f80ff5d6c36af7860a17d762fe92731e28bd Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期六, 07 十一月 2026 19:16:04 +0800
Subject: [PATCH] feat(feedback): 优化报工审批流程并增加报工人校验
---
src/views/wls/productreceipt/data.ts | 7
src/api/mes/pro/route/process/index.ts | 2
src/views/mes/pro/task/data.ts | 1
src/api/mes/pro/task/index.ts | 53 ++++
src/views/mes/qc/ipqc/data.ts | 5
src/views/mes/qc/iqc/data.ts | 3
src/views/wls/productreceipt/modules/form.vue | 10
src/views/mes/pro/feedback/modules/form.vue | 23 +
src/views/mes/qc/pendinginspect/data.ts | 7
src/views/mes/qc/pendinginspect/index.vue | 16 +
src/views/wls/arrivalnotice/modules/form.vue | 5
src/views/mes/pro/route/modules/route-configurator.vue | 14 -
src/views/mes/pro/route/data.ts | 21 -
src/api/mes/qc/pendinginspect/index.ts | 1
src/views/mes/pro/route/modules/product-bom-list.vue | 49 +++
src/views/mes/workbench/index.vue | 8
src/api/mes/wm/productreceipt/index.ts | 1
src/views/mes/pro/route/modules/process-form.vue | 2
src/views/wls/productreceipt/index.vue | 6
src/views/mes/pro/workorder-center/index.vue | 43 ---
src/views/mes/qc/oqc/data.ts | 4
src/views/mes/pro/task/modules/auto-schedule.vue | 185 +++++++++++++++
src/views/mes/md/item/components/product-bom-select-dialog.vue | 49 +++
src/views/mes/pro/task/index.vue | 59 ++--
src/views/mes/workbench/components/tabs/FeedbackTab.vue | 21 +
src/views/mes/pro/route/components/output-attribution.vue | 88 ++++++-
src/packages/effects/layouts/src/basic/tabbar/tabbar.vue | 11
src/views/mes/pro/feedback/data.ts | 6
src/views/mes/qc/rqc/data.ts | 2
src/views/mes/workbench/components/WorkstationSelectDialog.vue | 16 +
30 files changed, 568 insertions(+), 150 deletions(-)
diff --git a/src/api/mes/pro/route/process/index.ts b/src/api/mes/pro/route/process/index.ts
index d44b20e..fc7c519 100644
--- a/src/api/mes/pro/route/process/index.ts
+++ b/src/api/mes/pro/route/process/index.ts
@@ -19,6 +19,8 @@
itemId?: number;
itemCode?: string;
itemName?: string;
+ quantity?: number; // 閰嶆瘮锛氭瘡 1 涓富浜у嚭鐨勯檮甯︽暟閲忥紝涓讳骇鍑哄浐瀹氫负 1
+ mainFlag?: boolean; // 鏄惁涓讳骇鍑�
sort?: number;
remark?: string;
}
diff --git a/src/api/mes/pro/task/index.ts b/src/api/mes/pro/task/index.ts
index e484e2e..708c0da 100644
--- a/src/api/mes/pro/task/index.ts
+++ b/src/api/mes/pro/task/index.ts
@@ -92,6 +92,7 @@
name?: string;
checkFlag?: boolean;
createTime?: string[];
+ onlyMine?: boolean; // 浠呮煡鐪嬫垜鏄姤宸ヤ汉鐨勪换鍔★紙宸ヤ綔鍙颁娇鐢級
}
}
@@ -175,6 +176,55 @@
);
}
+export interface BatchScheduleRequest {
+ workOrderIds: number[];
+ startTime: string;
+ previewHash?: string;
+ previewTime?: string;
+ allowLate?: boolean;
+}
+
+export interface BatchSchedulePreview {
+ canExecute: boolean;
+ previewHash: string;
+ previewTime: string;
+ warnings: string[];
+ notices: string[];
+ orders: {
+ workOrderId: number;
+ workOrderCode?: string;
+ workOrderName?: string;
+ quantity?: number;
+ taskCount: number;
+ requestDate?: string;
+ endTime?: string;
+ late: boolean;
+ error?: string;
+ }[];
+ tasks: {
+ workOrderId: number;
+ workOrderCode: string;
+ processId: number;
+ processName: string;
+ workstationId: number;
+ workstationName: string;
+ machineryNames: string;
+ quantity: number;
+ hourlyCapacity: number;
+ duration: number;
+ startTime: string;
+ endTime: string;
+ }[];
+}
+
+export function previewBatchSchedule(data: BatchScheduleRequest) {
+ return requestClient.post<BatchSchedulePreview>('/mes/pro/task/auto-schedule/preview', data);
+}
+
+export function executeBatchSchedule(data: BatchScheduleRequest) {
+ return requestClient.post<{ taskIds: number[] }>('/mes/pro/task/auto-schedule', data);
+}
+
/** 鏌ヨ寰呮姤宸ュ彴璐︼紙鍒嗛〉锛� */
export function getPendingFeedbackPage(
params: MesProTaskApi.PendingFeedbackPageParams,
@@ -186,9 +236,10 @@
}
/** 鎸夊伐浣滅珯鏌ヨ寰呮姤宸ヤ换鍔℃暟锛坘ey 涓哄伐浣滅珯缂栧彿锛� */
-export function getPendingFeedbackCountByWorkstation() {
+export function getPendingFeedbackCountByWorkstation(onlyMine?: boolean) {
return requestClient.get<Record<string, number>>(
'/mes/pro/task/pending-count-by-workstation',
+ { params: onlyMine === undefined ? undefined : { onlyMine } },
);
}
diff --git a/src/api/mes/qc/pendinginspect/index.ts b/src/api/mes/qc/pendinginspect/index.ts
index cbfbe7f..25808d2 100644
--- a/src/api/mes/qc/pendinginspect/index.ts
+++ b/src/api/mes/qc/pendinginspect/index.ts
@@ -28,6 +28,7 @@
// 瀹㈡埛锛圤QC/RQC 鍦烘櫙锛�
clientId?: number; // 瀹㈡埛 ID
clientName?: string; // 瀹㈡埛鍚嶇О
+ canInspect?: boolean; // 鏄惁鍙楠岋紙宸查厤缃惎鐢ㄧ殑妫�楠屾ā鏉匡級
recordTime?: number; // 璁板綍鏃堕棿锛坋poch ms锛�
}
}
diff --git a/src/api/mes/wm/productreceipt/index.ts b/src/api/mes/wm/productreceipt/index.ts
index 7319755..4308dac 100644
--- a/src/api/mes/wm/productreceipt/index.ts
+++ b/src/api/mes/wm/productreceipt/index.ts
@@ -10,6 +10,7 @@
name?: string; // 鍏ュ簱鍗曞悕绉�
workOrderId?: number; // 鐢熶骇璁㈠崟缂栧彿
workOrderCode?: string; // 鐢熶骇璁㈠崟缂栫爜
+ produceId?: number; // 鏉ユ簮鐢熶骇浜у嚭鍗曠紪鍙凤紱涓虹┖琛ㄧず鎵嬪伐鍏ュ簱鍗�
itemId?: number; // 浜у搧鐗╂枡缂栧彿
itemCode?: string; // 浜у搧鐗╂枡缂栫爜
itemName?: string; // 浜у搧鐗╂枡鍚嶇О
diff --git a/src/packages/effects/layouts/src/basic/tabbar/tabbar.vue b/src/packages/effects/layouts/src/basic/tabbar/tabbar.vue
index 7d5b180..61cbd7c 100644
--- a/src/packages/effects/layouts/src/basic/tabbar/tabbar.vue
+++ b/src/packages/effects/layouts/src/basic/tabbar/tabbar.vue
@@ -1,3 +1,8 @@
+<script lang="ts">
+// 妯″潡绾ф爣璁帮細娴忚鍣ㄥ埛鏂颁細閲嶇疆锛屽竷灞�閲嶆柊鎸傝浇锛堝浠庡叏灞忓伐浣滃彴杩斿洖锛変笉浼氶噸缃�
+let tabbarInitialized = false;
+</script>
+
<script lang="ts" setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
@@ -46,8 +51,10 @@
});
});
-// 鍒锋柊鍚庡鏋滀笉淇濇寔tab鐘舵�侊紝鍏抽棴鍏朵粬tab
-if (!preferences.tabbar.persist) {
+// 鍒锋柊鍚庡鏋滀笉淇濇寔tab鐘舵�侊紝鍏抽棴鍏朵粬tab锛�
+// 浠呭湪娴忚鍣ㄥ埛鏂帮紙妯″潡閲嶆柊鍔犺浇锛夋椂鎵ц涓�娆★紝甯冨眬閲嶆柊鎸傝浇涓嶆竻绌洪〉绛�
+if (!preferences.tabbar.persist && !tabbarInitialized) {
+ tabbarInitialized = true;
tabbarStore.closeOtherTabs(route);
}
</script>
diff --git a/src/views/mes/md/item/components/product-bom-select-dialog.vue b/src/views/mes/md/item/components/product-bom-select-dialog.vue
index 9718d32..785fc1a 100644
--- a/src/views/mes/md/item/components/product-bom-select-dialog.vue
+++ b/src/views/mes/md/item/components/product-bom-select-dialog.vue
@@ -15,19 +15,29 @@
const emit = defineEmits<{
selected: [row: MesMdProductBomApi.ProductBom];
+ 'selected-many': [rows: MesMdProductBomApi.ProductBom[]];
}>();
const open = ref(false); // 寮圭獥鏄惁鎵撳紑
const list = ref<MesMdProductBomApi.ProductBom[]>([]); // BOM 瀛愮墿鏂欏垪琛�
const selectedRow = ref<MesMdProductBomApi.ProductBom>(); // 褰撳墠閫変腑鐨� BOM 琛�
+const multiple = ref(false); // 鏄惁澶氶��
+const disabledItemIds = ref<number[]>([]); // 宸叉坊鍔犮�佺姝㈤噸澶嶉�夋嫨鐨勭墿鏂�
+
+const baseColumns = useProductBomGridColumns(true) || [];
const [Grid, gridApi] = useVbenVxeGrid({
gridOptions: {
border: true,
columns: [
{ type: 'radio', width: 55, align: 'center' },
- ...(useProductBomGridColumns(true) || []),
+ ...baseColumns,
],
+ checkboxConfig: {
+ highlight: true,
+ checkMethod: ({ row }: { row: MesMdProductBomApi.ProductBom }) =>
+ !disabledItemIds.value.includes(row.bomItemId!),
+ },
data: list.value,
height: 500,
keepSource: true,
@@ -49,6 +59,9 @@
} as VxeTableGridOptions<MesMdProductBomApi.ProductBom>,
gridEvents: {
cellDblclick: ({ row }: { row: MesMdProductBomApi.ProductBom }) => {
+ if (multiple.value || disabledItemIds.value.includes(row.bomItemId!)) {
+ return;
+ }
selectedRow.value = row;
gridApi.grid.setRadioRow(row);
handleConfirm();
@@ -59,16 +72,35 @@
},
});
+/** 鍒囨崲鍗曢��/澶氶�夊垪 */
+function applySelectMode() {
+ gridApi.setGridOptions({
+ columns: [
+ multiple.value
+ ? { type: 'checkbox', width: 55, align: 'center' }
+ : { type: 'radio', width: 55, align: 'center' },
+ ...baseColumns,
+ ],
+ });
+}
+
/** 鎵撳紑 BOM 鐗╂枡閫夋嫨寮圭獥 */
-async function openModal(itemId: number, selectedBomItemId?: number) {
+async function openModal(
+ itemId: number,
+ selectedBomItemId?: number,
+ options?: { disabledItemIds?: number[]; multiple?: boolean },
+) {
open.value = true;
selectedRow.value = undefined;
+ multiple.value = options?.multiple === true;
+ disabledItemIds.value = options?.disabledItemIds ?? [];
+ applySelectMode();
gridApi.setLoading(true);
try {
list.value = await getProductBomListByItemId(itemId);
gridApi.setGridOptions({ data: list.value });
await nextTick();
- if (selectedBomItemId !== null) {
+ if (!multiple.value && selectedBomItemId !== null) {
const match = list.value.find(
(row) => row.bomItemId === selectedBomItemId,
);
@@ -87,10 +119,21 @@
open.value = false;
selectedRow.value = undefined;
await gridApi.grid.clearRadioRow();
+ await gridApi.grid.clearCheckboxRow();
}
/** 纭閫夋嫨 BOM 鐗╂枡 */
function handleConfirm() {
+ if (multiple.value) {
+ const rows = gridApi.grid.getCheckboxRecords();
+ if (!rows.length) {
+ message.warning('璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�');
+ return;
+ }
+ emit('selected-many', rows);
+ open.value = false;
+ return;
+ }
if (!selectedRow.value) {
message.warning('璇烽�夋嫨涓�鏉℃暟鎹�');
return;
diff --git a/src/views/mes/pro/feedback/data.ts b/src/views/mes/pro/feedback/data.ts
index 23927ef..bd93129 100644
--- a/src/views/mes/pro/feedback/data.ts
+++ b/src/views/mes/pro/feedback/data.ts
@@ -304,8 +304,10 @@
workstationId: task.workstationId,
reportableQuantity: task.reportableQuantity,
});
- // 宸ヨ壓璺嚎宸ュ簭鐨� checkFlag 鍐冲畾鏁伴噺鍖哄煙灞曠ず
- if (task.routeId && task.processId) {
+ // 鏄惁璐ㄦ浠ヤ换鍔★紙宸ュ崟宸ュ簭蹇収锛変负鍑嗭紝浠呭湪缂哄け鏃跺洖閫�宸ヨ壓璺嚎宸ュ簭
+ if (typeof task.checkFlag === 'boolean') {
+ await formApi?.setFieldValue('checkFlag', task.checkFlag);
+ } else if (task.routeId && task.processId) {
try {
const routeProcess = await getRouteProcessByRouteAndProcess(
task.routeId,
diff --git a/src/views/mes/pro/feedback/modules/form.vue b/src/views/mes/pro/feedback/modules/form.vue
index f7e2e8f..be59a78 100644
--- a/src/views/mes/pro/feedback/modules/form.vue
+++ b/src/views/mes/pro/feedback/modules/form.vue
@@ -1,4 +1,4 @@
-锘�<script lang="ts" setup>
+<script lang="ts" setup>
import type { FormType } from '../data';
import type { MesProFeedbackApi } from '#/api/mes/pro/feedback';
@@ -11,7 +11,7 @@
import { MesAutoCodeRuleCode, MesProFeedbackStatusEnum } from '@vben/constants';
import { useUserStore } from '@vben/stores';
-import { Button, message, Popconfirm, Tabs } from 'ant-design-vue';
+import { Alert, Button, message, Popconfirm, Tabs } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { generateAutoCode } from '#/api/mes/md/autocode/record';
@@ -233,7 +233,15 @@
}
/** 鍔犺浇宸ュ簭鐨� checkFlag 鐢ㄤ簬鍥炴樉鏁伴噺鍖哄煙 */
-async function resolveCheckFlag(routeId?: number, processId?: number) {
+async function resolveCheckFlag(
+ routeId?: number,
+ processId?: number,
+ taskCheckFlag?: boolean,
+) {
+ // 鏄惁璐ㄦ浠ヤ换鍔★紙宸ュ崟宸ュ簭蹇収锛変负鍑�
+ if (typeof taskCheckFlag === 'boolean') {
+ return taskCheckFlag;
+ }
if (!routeId || !processId) {
return true;
}
@@ -302,6 +310,7 @@
const checkFlag = await resolveCheckFlag(
formData.value.routeId,
formData.value.processId,
+ formData.value.checkFlag,
);
// 璁剧疆鍒� values
await formApi.setValues({ ...formData.value, checkFlag });
@@ -316,6 +325,14 @@
<template>
<Modal :title="getTitle" class="w-3/5">
+ <Alert
+ v-if="canApprove"
+ class="mx-4 mb-4"
+ type="info"
+ show-icon
+ message="瀹℃壒鍓嶈鏍稿鐢熶骇涓庡簱瀛橀厤缃�"
+ description="鑷姩鎵f枡宸ュ簭闇�瑕佺嚎杈瑰簱鏈夎冻澶熺墿鏂欙紱闇�妫�宸ュ簭闇�瑕侀厤缃繃绋嬫楠屾柟妗堛�傛湯閬撳伐搴忚鍏堥厤缃垚鍝佸叆搴撲粨浣嶃��"
+ />
<Form class="mx-4" />
<FeedbackParamFields ref="paramFields" :task-id="paramTaskId" :snapshot="paramSnapshot" :readonly="!isEditable" />
<Tabs
diff --git a/src/views/mes/pro/route/components/output-attribution.vue b/src/views/mes/pro/route/components/output-attribution.vue
index 29ec83e..9aafffb 100644
--- a/src/views/mes/pro/route/components/output-attribution.vue
+++ b/src/views/mes/pro/route/components/output-attribution.vue
@@ -6,7 +6,8 @@
import { IconifyIcon } from '@vben/icons';
-import { Button, Select } from 'ant-design-vue';
+import { Button, Checkbox, InputNumber, Select, Tooltip } from 'ant-design-vue';
+import { MdItemSelect } from '#/views/mes/md/item/components';
defineOptions({ name: 'RouteOutputAttribution' });
@@ -57,11 +58,19 @@
/** 閫夋嫨浜у嚭鐗╂枡鏃讹紝榛樿褰掑睘鍒拌嚜韬骇鍝侊紙鍗婃垚鍝佸叡鐢ㄦ椂鍐嶆墜鍔ㄦ敼鎴愨�滈�氱敤鈥濓級 */
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;
- }
+ patch.productId = productOptions.value.some((product) => product.value === itemId) ? itemId : undefined;
+ // 鍚屼竴褰掑睘鍒嗙粍鍐呴粯璁ょ涓�鏉′负涓讳骇鍑猴紝鏂板姞鍏ョ殑浜у嚭鑻ュ垎缁勫唴杩樻病鏈変富浜у嚭鍒欒涓轰富浜у嚭
+ const groupKey = patch.productId ?? GENERAL_PRODUCT;
+ const groupHasMain = rows.value.some(
+ (row, i) =>
+ i !== index &&
+ row.itemId != null &&
+ (row.productId ?? GENERAL_PRODUCT) === groupKey &&
+ row.mainFlag === true,
+ );
+ patch.mainFlag = !groupHasMain;
+ patch.quantity = groupHasMain ? (rows.value[index]?.quantity ?? 1) : 1;
updateRow(index, patch);
}
@@ -71,8 +80,39 @@
});
}
+/** 鍒囨崲涓讳骇鍑猴細鍚屼竴褰掑睘鍒嗙粍鍐呭彧鑳芥湁涓�涓富浜у嚭锛屼富浜у嚭閰嶆瘮鍥哄畾涓� 1 */
+function handleMainChange(index: number, checked: boolean) {
+ const target = rows.value[index];
+ if (!target) {
+ return;
+ }
+ const groupKey = target.productId ?? GENERAL_PRODUCT;
+ commit(
+ rows.value.map((row, i) => {
+ if (i === index) {
+ return {
+ ...row,
+ mainFlag: checked,
+ quantity: checked ? 1 : (row.quantity ?? 1),
+ };
+ }
+ if (checked && (row.productId ?? GENERAL_PRODUCT) === groupKey) {
+ return { ...row, mainFlag: false };
+ }
+ return row;
+ }),
+ );
+}
+
+function handleQuantityChange(index: number, value: number | null) {
+ updateRow(index, { quantity: value ?? undefined });
+}
+
function addRow() {
- commit([...rows.value, { itemId: undefined, productId: undefined }]);
+ commit([
+ ...rows.value,
+ { itemId: undefined, productId: undefined, quantity: 1 },
+ ]);
}
function removeRow(index: number) {
@@ -88,16 +128,7 @@
: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)"
- />
+ <MdItemSelect :disabled="disabled" :model-value="row.itemId" placeholder="閫夋嫨浜у嚭鐗╂枡" class="min-w-0 flex-1" @update:model-value="(value) => handleItemChange(index, value as number | undefined)" />
<Select
:disabled="disabled || row.itemId == null"
:options="attributionOptions"
@@ -105,6 +136,31 @@
class="min-w-0 flex-1"
@change="(value) => handleAttributionChange(index, value as number | undefined)"
/>
+ <Tooltip
+ title="閰嶆瘮锛氭瘡 1 涓富浜у嚭鐨勯檮甯︽暟閲忥紝渚嬪涓讳骇鍑� 1 鍙伴檮甯� 2 涓崐鎴愬搧鍒欏~ 2锛涗富浜у嚭鍥哄畾涓� 1"
+ placement="top"
+ >
+ <span class="inline-flex shrink-0">
+ <InputNumber
+ :disabled="disabled || row.itemId == null || row.mainFlag === true"
+ :min="0.000001"
+ :precision="6"
+ :value="row.mainFlag === true ? 1 : (row.quantity ?? 1)"
+ class="w-32"
+ placeholder="閰嶆瘮"
+ addon-before="脳"
+ @change="(value) => handleQuantityChange(index, value as number | null)"
+ />
+ </span>
+ </Tooltip>
+ <Checkbox
+ :checked="row.mainFlag === true"
+ :disabled="disabled || row.itemId == null"
+ class="shrink-0"
+ @change="(event) => handleMainChange(index, event.target.checked)"
+ >
+ 涓讳骇鍑�
+ </Checkbox>
<Button
:disabled="disabled"
danger
diff --git a/src/views/mes/pro/route/data.ts b/src/views/mes/pro/route/data.ts
index 0444b0e..d43419a 100644
--- a/src/views/mes/pro/route/data.ts
+++ b/src/views/mes/pro/route/data.ts
@@ -226,6 +226,7 @@
componentProps: {
products,
},
+ help: '閰嶆瘮琛ㄧず姣忎骇鍑� 1 涓富浜у嚭鏃剁殑闄勫甫鏁伴噺锛氫富浜у嚭鍥哄畾涓� 1锛岃仈浜у搧鎸夊疄闄呮瘮渚嬪~鍐欙紙濡� 1 鍙颁富浜у搧闄勫甫 2 涓崐鎴愬搧鍒欏~ 2锛夛紱鎶ュ伐鏃舵寜銆屾湰娆℃姤宸ユ暟閲� 脳 閰嶆瘮銆嶇敓鎴愬悇浜у嚭鏁伴噺',
formItemClass: 'col-span-2',
},
{
@@ -238,6 +239,7 @@
placeholder: '璇烽�夋嫨',
},
rules: z.number().default(3),
+ dependencies: { triggerFields: [''], show: () => false },
},
{
fieldName: 'colorCode',
@@ -328,23 +330,18 @@
return outputs
.map((output) => {
const name = output.itemName ?? output.itemCode ?? output.itemId;
- return output.productId == null
- ? `${name}锛堥�氱敤锛塦
- : `${name}锛�${output.productName ?? output.productId}锛塦;
+ const ratio = output.quantity ?? 1;
+ const text = `${name} 脳 ${ratio}`;
+ const product =
+ output.productId == null
+ ? '閫氱敤'
+ : (output.productName ?? output.productId);
+ return `${output.mainFlag ? '鈽�' : ''}${text}锛�${product}锛塦;
})
.join('銆�');
},
},
{ field: 'nextProcessName', title: '涓嬩竴閬撳伐搴�', width: 140 },
- {
- field: 'linkType',
- title: '涓庝笅涓�閬撳伐搴忓叧绯�',
- width: 160,
- cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.MES_PRO_LINK_TYPE },
- },
- },
{
field: 'keyFlag',
title: '鍏抽敭宸ュ簭',
diff --git a/src/views/mes/pro/route/modules/process-form.vue b/src/views/mes/pro/route/modules/process-form.vue
index 228ee31..bb79b30 100644
--- a/src/views/mes/pro/route/modules/process-form.vue
+++ b/src/views/mes/pro/route/modules/process-form.vue
@@ -121,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/product-bom-list.vue b/src/views/mes/pro/route/modules/product-bom-list.vue
index 9d36a56..afea7f1 100644
--- a/src/views/mes/pro/route/modules/product-bom-list.vue
+++ b/src/views/mes/pro/route/modules/product-bom-list.vue
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import type { FormType } from '../data';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { MesMdProductBomApi } from '#/api/mes/md/item/productBom';
import type { MesProRouteProcessApi } from '#/api/mes/pro/route/process';
import type { MesProRouteProductBomApi } from '#/api/mes/pro/route/productbom';
@@ -13,10 +14,12 @@
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getRouteProcessListByRoute } from '#/api/mes/pro/route/process';
import {
+ createRouteProductBom,
deleteRouteProductBom,
getRouteProductBomList,
} from '#/api/mes/pro/route/productbom';
import { $t } from '#/locales';
+import { MdProductBomSelectDialog } from '#/views/mes/md/item/components';
import { useRouteProductBomGridColumns } from '../data';
import BomForm from './bom-form.vue';
@@ -42,6 +45,8 @@
connectedComponent: BomForm,
destroyOnClose: true,
});
+
+const bomSelectRef = ref<InstanceType<typeof MdProductBomSelectDialog>>();
const [Grid, gridApi] = useVbenVxeGrid({
gridOptions: {
@@ -88,19 +93,43 @@
}
}
-/** 鏂板 BOM */
+/** 鏂板 BOM锛氭墦寮�浜у搧 BOM 鐗╂枡寮圭獥锛屾敮鎸佸閫夋壒閲忔坊鍔� */
function handleCreate() {
if (!activeProcessId.value) {
message.warning('璇峰厛閫夋嫨宸ュ簭');
return;
}
- bomFormModalApi
- .setData({
- processId: activeProcessId.value,
- productId: props.productId,
- routeId: props.routeId,
- })
- .open();
+ bomSelectRef.value?.open(props.productId, undefined, {
+ multiple: true,
+ disabledItemIds: list.value
+ .map((item) => item.itemId)
+ .filter((id): id is number => id !== undefined),
+ });
+}
+
+/** 鎵归噺娣诲姞閫変腑鐨� BOM 鐗╂枡 */
+async function handleSelectedMany(rows: MesMdProductBomApi.ProductBom[]) {
+ const processId = activeProcessId.value;
+ if (!processId) {
+ return;
+ }
+ gridApi.setLoading(true);
+ try {
+ for (const row of rows) {
+ await createRouteProductBom({
+ routeId: props.routeId,
+ processId,
+ productId: props.productId,
+ itemId: row.bomItemId,
+ quantity: row.quantity ?? 1,
+ });
+ }
+ message.success(`宸叉坊鍔� ${rows.length} 鏉℃姇鏂欑墿鏂檂);
+ await getList();
+ emit('change');
+ } finally {
+ gridApi.setLoading(false);
+ }
}
/** 缂栬緫 BOM */
@@ -141,6 +170,10 @@
<template>
<BomFormModal @success="handleSaved" />
+ <MdProductBomSelectDialog
+ ref="bomSelectRef"
+ @selected-many="handleSelectedMany"
+ />
<Tabs v-model:active-key="activeProcessId" @change="getList">
<TabPane
v-for="item in processList"
diff --git a/src/views/mes/pro/route/modules/route-configurator.vue b/src/views/mes/pro/route/modules/route-configurator.vue
index 9a460af..975c056 100644
--- a/src/views/mes/pro/route/modules/route-configurator.vue
+++ b/src/views/mes/pro/route/modules/route-configurator.vue
@@ -92,16 +92,6 @@
text: '鏈亾宸ュ簭鐨勬垚鍝佷骇鍑哄繀椤诲綊灞炲埌鑷韩浜у搧锛屼笉鑳戒娇鐢ㄢ�滈�氱敤鈥�',
});
}
- const productIds = new Set(productList.value.map((item) => item.itemId));
- const invalidOutputCount = processList.value.filter((process) =>
- process.outputItemIds?.some((itemId) => !productIds.has(itemId)),
- ).length;
- if (invalidOutputCount) {
- issues.push({
- step: 2,
- text: `${invalidOutputCount} 閬撳伐搴忕殑浜у嚭鏈寘鍚湪璺嚎浜у嚭浜у搧涓璥,
- });
- }
const noBomProducts = productList.value.filter(
(item) => item.itemId && !configuredProductIds.value.has(item.itemId),
);
@@ -295,8 +285,8 @@
<section v-if="routeId" v-show="activeStep === 1" class="route-step-panel">
<Alert
class="mb-4"
- message="鍏堢淮鎶ゆ墍鏈夊彲鑳界殑宸ュ簭浜у嚭"
- description="瀹為檯褰㈡垚鐨勪腑闂村崐鎴愬搧鍜屾湯閬撳伐搴忕殑鎴愬搧閮借鍔犲叆锛屽苟鎸囧畾鍏ュ簱浠撲綅锛涢�夋嫨涓�涓垚鍝佷綔涓烘ā鏉垮紩鐢紝渚涘伐鑹烘祦绋嬫ā鏉夸笅杞戒娇鐢ㄣ��"
+ message="缁存姢鎴愬搧鍙婃姤宸ュ叆搴撲綅缃�"
+ description="杩欓噷鍙淮鎶ゆ垚鍝佸苟鎸囧畾鍏ュ簱浠撲綅锛涗腑闂村崐鎴愬搧鍦ㄥ伐搴忎骇鍑轰腑浠庡熀纭�鐗╂枡閫夋嫨銆傞�夋嫨涓�涓垚鍝佷綔涓烘ā鏉垮紩鐢紝渚涘伐鑹烘祦绋嬫ā鏉夸笅杞戒娇鐢ㄣ��"
show-icon
type="info"
/>
diff --git a/src/views/mes/pro/task/data.ts b/src/views/mes/pro/task/data.ts
index 50b2ca0..bb3353d 100644
--- a/src/views/mes/pro/task/data.ts
+++ b/src/views/mes/pro/task/data.ts
@@ -85,6 +85,7 @@
/** 寰呮帓浜ц鍗曞垪琛ㄧ殑瀛楁 */
export function useGridColumns(): VxeTableGridOptions<MesProWorkOrderApi.WorkOrder>['columns'] {
return [
+ { type: 'checkbox', width: 48, fixed: 'left' },
{
field: 'code',
title: '璁㈠崟缂栫爜',
diff --git a/src/views/mes/pro/task/index.vue b/src/views/mes/pro/task/index.vue
index 5fb103f..b0a8cb9 100644
--- a/src/views/mes/pro/task/index.vue
+++ b/src/views/mes/pro/task/index.vue
@@ -6,19 +6,18 @@
import { useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui';
-import { MesProWorkOrderStatusEnum } from '@vben/constants';
+import { MesProWorkOrderStatusEnum, MesProWorkOrderTypeEnum } from '@vben/constants';
import { Button, Card, message, Tabs } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
-import { getGanttTaskList, previewAutoGenerate, autoGenerateTasks } from '#/api/mes/pro/task';
-import { getWorkOrderPage } from '#/api/mes/pro/workorder';
+import { getGanttTaskList } from '#/api/mes/pro/task';
import ArchiveDetail from '#/views/mes/pd/archive/modules/detail.vue';
import { GanttChart } from './components';
import { useGridColumns, useGridFormSchema } from './data';
import ScheduleForm from './modules/schedule-form.vue';
-import SchedulePreview from '../workorder-center/modules/schedule-preview.vue';
+import AutoSchedule from './modules/auto-schedule.vue';
const router = useRouter();
const ganttTasks = ref<any[]>([]); // 鐢樼壒鍥鹃瑙堟暟鎹�
@@ -32,13 +31,14 @@
destroyOnClose: true,
});
-const [SchedulePreviewModal, schedulePreviewModalApi] = useVbenModal({
- connectedComponent: SchedulePreview,
+const [AutoScheduleModal, autoScheduleModalApi] = useVbenModal({
+ connectedComponent: AutoSchedule,
destroyOnClose: true,
});
/** 鍒锋柊琛ㄦ牸 */
function handleRefresh() {
+ gridApi.grid.clearCheckboxRow();
gridApi.query();
loadGanttPreview();
}
@@ -60,27 +60,17 @@
scheduleModalApi.setData({ formType: 'schedule', id: row.id }).open();
}
-/** 涓�閿帓浜ч瑙� */
-async function handleAutoSchedulePreview(row: MesProWorkOrderApi.WorkOrder) {
- try {
- const preview = await previewAutoGenerate({ workOrderId: row.id! });
- schedulePreviewModalApi
- .setData({ workOrder: row, preview })
- .open();
- } catch {
- message.error('鑾峰彇鎺掍骇棰勮澶辫触');
- }
+function canAutoSchedule(row: MesProWorkOrderApi.WorkOrder) {
+ return row.status === MesProWorkOrderStatusEnum.CONFIRMED
+ && row.type === MesProWorkOrderTypeEnum.SELF
+ && (row.quantity ?? 0) > 0 && (row.quantityProduced ?? 0) < (row.quantity ?? 0);
}
-
-/** 涓�閿帓浜ф墽琛� */
-async function handleAutoSchedule(row: MesProWorkOrderApi.WorkOrder) {
- try {
- const result = await autoGenerateTasks({ workOrderId: row.id! });
- message.success(`鎺掍骇鎴愬姛锛岀敓鎴� ${result.taskIds?.length || 0} 涓换鍔);
- handleRefresh();
- } catch {
- message.error('鎺掍骇澶辫触');
- }
+function handleAutoSchedule(row?: MesProWorkOrderApi.WorkOrder) {
+ const rows: MesProWorkOrderApi.WorkOrder[] = row ? [row] : gridApi.grid.getCheckboxRecords();
+ if (!rows.length) return message.warning('璇峰厛鍕鹃�夊緟鎺掍骇宸ュ崟');
+ if (rows.length > 30) return message.warning('涓�娆℃渶澶氶�夋嫨 30 涓伐鍗曪紝璇峰垎鎵规帓浜�');
+ if (rows.some((order) => !canAutoSchedule(order))) return message.warning('璇烽�夋嫨宸茬‘璁や笖鏈敓浜у畬鎴愮殑鑷鐢熶骇宸ュ崟');
+ autoScheduleModalApi.setData({ workOrderIds: rows.map((order) => order.id!) }).open();
}
/** 鎵撳紑褰掓。璇︽儏 */
@@ -101,6 +91,7 @@
gridOptions: {
columns: useGridColumns(),
keepSource: true,
+ checkboxConfig: { checkStrictly: true, showHeader: true, checkMethod: ({ row }: { row: MesProWorkOrderApi.WorkOrder }) => canAutoSchedule(row) },
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
@@ -146,7 +137,7 @@
<template>
<Page auto-content-height>
<ScheduleModal @success="handleRefresh" />
- <SchedulePreviewModal @success="handleRefresh" />
+ <AutoScheduleModal @success="handleRefresh" />
<!-- 鎺掍骇鐢樼壒鍥鹃瑙� -->
<Card title="鎺掍骇鐢樼壒鍥�" class="mb-4">
@@ -168,6 +159,13 @@
<TableAction
:actions="[
{
+ label: '涓�閿帓浜�',
+ type: 'primary',
+ icon: ACTION_ICON.ADD,
+ auth: ['mes:pro-task:create'],
+ onClick: () => handleAutoSchedule(),
+ },
+ {
label: '鐢樼壒鍥剧紪杈�',
type: 'primary',
icon: ACTION_ICON.EDIT,
@@ -185,6 +183,13 @@
<TableAction
:actions="[
{
+ label: '涓�閿帓浜�',
+ type: 'link',
+ auth: ['mes:pro-task:create'],
+ ifShow: canAutoSchedule(row),
+ onClick: () => handleAutoSchedule(row),
+ },
+ {
label: '鎺掍骇',
type: 'link',
auth: ['mes:pro-task:create'],
diff --git a/src/views/mes/pro/task/modules/auto-schedule.vue b/src/views/mes/pro/task/modules/auto-schedule.vue
new file mode 100644
index 0000000..6ac0fe1
--- /dev/null
+++ b/src/views/mes/pro/task/modules/auto-schedule.vue
@@ -0,0 +1,185 @@
+<script setup lang="ts">
+import type { BatchSchedulePreview, BatchScheduleRequest } from '#/api/mes/pro/task';
+import { computed, ref, watch } from 'vue';
+import { useVbenModal } from '@vben/common-ui';
+import { Alert, Button, Checkbox, DatePicker, Descriptions, Table, Tag, message } from 'ant-design-vue';
+import dayjs from 'dayjs';
+import { executeBatchSchedule, previewBatchSchedule } from '#/api/mes/pro/task';
+
+const emit = defineEmits(['success']);
+const ids = ref<number[]>([]);
+function defaultStartTime() {
+ let value = dayjs().add(5, 'minute').startOf('minute');
+ if (value.hour() >= 18) value = value.add(1, 'day').hour(9).minute(0).second(0);
+ else if (value.hour() < 9) value = value.hour(9).minute(0).second(0);
+ while (value.day() === 0 || value.day() === 6) value = value.add(1, 'day').hour(9).minute(0).second(0);
+ return value;
+}
+const startTime = ref(defaultStartTime());
+const preview = ref<BatchSchedulePreview>();
+const loading = ref(false);
+const executing = ref(false);
+const acceptLate = ref(false);
+const errorText = ref('');
+let sequence = 0;
+let open = false;
+const canConfirm = computed(() => !!preview.value?.canExecute && !loading.value && !executing.value
+ && (!preview.value.warnings.length || acceptLate.value));
+
+const [Modal, modalApi] = useVbenModal({
+ confirmText: '纭鎺掍骇',
+ confirmDisabled: true,
+ onBeforeClose: () => !executing.value,
+ onConfirm: execute,
+ async onOpenChange(isOpen) {
+ open = isOpen;
+ sequence++;
+ if (!isOpen) {
+ preview.value = undefined;
+ ids.value = [];
+ loading.value = false;
+ errorText.value = '';
+ return;
+ }
+ ids.value = modalApi.getData<{ workOrderIds: number[] }>().workOrderIds;
+ startTime.value = defaultStartTime();
+ await calculate();
+ },
+});
+
+watch(canConfirm, (value) => modalApi.setState({ confirmDisabled: !value }));
+watch(startTime, () => {
+ sequence++;
+ preview.value = undefined;
+ acceptLate.value = false;
+ loading.value = false;
+ errorText.value = '';
+}, { flush: 'sync' });
+
+function request(): BatchScheduleRequest {
+ return { workOrderIds: [...ids.value], startTime: startTime.value.format('YYYY-MM-DD HH:mm:ss') };
+}
+
+async function calculate() {
+ if (executing.value || !startTime.value || !ids.value.length) return;
+ const current = ++sequence;
+ preview.value = undefined;
+ acceptLate.value = false;
+ errorText.value = '';
+ loading.value = true;
+ try {
+ const result = await previewBatchSchedule(request());
+ if (open && current === sequence) preview.value = result;
+ } catch (error) {
+ if (open && current === sequence) errorText.value = error instanceof Error ? error.message : '棰勮澶辫触锛岃绋嶅悗閲嶈瘯';
+ } finally {
+ if (current === sequence) loading.value = false;
+ }
+}
+
+async function execute() {
+ if (!canConfirm.value || !preview.value) return;
+ executing.value = true;
+ errorText.value = '';
+ modalApi.lock();
+ try {
+ const result = await executeBatchSchedule({ ...request(), previewHash: preview.value.previewHash,
+ previewTime: preview.value.previewTime, allowLate: acceptLate.value });
+ message.success(`鎺掍骇鎴愬姛锛�${ids.value.length} 涓伐鍗曪紝鐢熸垚 ${result.taskIds.length} 涓换鍔);
+ executing.value = false;
+ await modalApi.close();
+ emit('success');
+ } catch (error) {
+ errorText.value = error instanceof Error ? error.message : '鎵ц缁撴灉鏈‘璁わ紝璇峰埛鏂板垪琛ㄥ苟閲嶆柊棰勮';
+ // 璇锋眰澶辫触鎴栫粨鏋滄湭纭鍚庡繀椤婚噸绠楋紱鏃ч瑙堜笉鑳界洿鎺ュ啀娆℃彁浜ゃ��
+ preview.value = undefined;
+ acceptLate.value = false;
+ emit('success'); // 鍒锋柊宸ュ崟鍜岀敇鐗瑰浘锛屾牳瀵硅秴鏃惰姹傛槸鍚﹀凡缁忔彁浜ゃ��
+ } finally {
+ executing.value = false;
+ modalApi.unlock();
+ }
+}
+
+const orderColumns = [
+ { title: '宸ュ崟缂栫爜', dataIndex: 'workOrderCode', width: 170 },
+ { title: '鐢熶骇鏁伴噺', dataIndex: 'quantity', width: 100 },
+ { title: '鏂板浠诲姟', dataIndex: 'taskCount', width: 90 },
+ { title: '闇�姹傛棩鏈�', dataIndex: 'requestDate', width: 120 },
+ { title: '棰勮瀹屾垚', dataIndex: 'endTime', width: 175 },
+ { title: '鏍¢獙缁撴灉', dataIndex: 'error', width: 300 },
+];
+const taskColumns = [
+ { title: '宸ュ崟', dataIndex: 'workOrderCode', width: 160 },
+ { title: '宸ュ簭', dataIndex: 'processName', width: 130 },
+ { title: '宸ヤ綔绔�', dataIndex: 'workstationName', width: 150 },
+ { title: '璁惧', dataIndex: 'machineryNames', width: 180 },
+ { title: '鏈鏁伴噺', dataIndex: 'quantity', width: 100 },
+ { title: '灏忔椂浜ц兘', dataIndex: 'hourlyCapacity', width: 100 },
+ { title: '宸ユ椂(h)', dataIndex: 'duration', width: 85 },
+ { title: '寮�宸ユ椂闂�', dataIndex: 'startTime', width: 180 },
+ { title: '瀹屾垚鏃堕棿', dataIndex: 'endTime', width: 180 },
+];
+</script>
+
+<template>
+ <Modal title="涓�閿帓浜�" class="w-[min(96vw,1200px)]">
+ <div class="space-y-5 px-1">
+ <Alert type="info" show-icon message="鍏堟牎楠屼笌棰勮锛屽啀纭鎺掍骇"
+ description="鎸変氦鏈熶紭鍏堝強宸ュ簭椤哄簭瀹夋帓宸ヤ綔绔欎笌璁惧锛涙瘡澶�09:00鈥�18:00锛屾帓闄ゅ懆鏈拰宸查厤缃妭鍋囨棩锛岄潪宸ヤ綔鏃堕棿鑷姩椤哄欢銆傚凡閮ㄥ垎鎺掍骇鐨勫伐鍗曞彧琛ラ綈鍓╀綑鏁伴噺锛屾渶澶�30涓伐鍗曘��200涓柊浠诲姟銆�" />
+ <div class="flex flex-wrap items-end gap-3">
+ <label class="flex flex-col gap-2">
+ <span class="font-medium">鏈�鏃╁紑宸ユ椂闂�</span>
+ <DatePicker v-model:value="startTime" show-time :allow-clear="false" :disabled="executing"
+ format="YYYY-MM-DD HH:mm:ss" :disabled-date="(date) => date.endOf('day').isBefore(dayjs())" />
+ </label>
+ <Button :loading="loading" :disabled="executing" @click="calculate">
+ {{ preview ? '閲嶆柊璁$畻棰勮' : '鐢熸垚鎺掍骇棰勮' }}
+ </Button>
+ <span class="text-sm text-muted-foreground">宸查�夋嫨 {{ ids.length }} 涓伐鍗�</span>
+ </div>
+ <Alert v-if="errorText" type="error" show-icon :message="errorText" />
+ <template v-if="preview">
+ <Descriptions :column="{ xs: 1, sm: 3 }" size="small" bordered>
+ <Descriptions.Item label="宸ュ崟鏁�">{{ preview.orders.length }}</Descriptions.Item>
+ <Descriptions.Item label="鏂板浠诲姟鏁�">{{ preview.tasks.length }}</Descriptions.Item>
+ <Descriptions.Item label="棰勮鏈夋晥鏈�">15鍒嗛挓锛屾彁浜ゆ椂閲嶆柊鏍¢獙</Descriptions.Item>
+ </Descriptions>
+ <Alert v-if="!preview.canExecute" type="error" show-icon message="閮ㄥ垎宸ュ崟鏈�氳繃鏍¢獙锛屾湰鎵规涓嶈兘鎻愪氦"
+ description="璇锋牴鎹笅鏂规牎楠岀粨鏋滀慨姝e伐鍗曘�佽澶囨垨宸叉湁浠诲姟鐨勯厤缃紝鍐嶉噸鏂拌绠楅瑙堛��" />
+ <div>
+ <h3 class="mb-2 font-medium">宸ュ崟鏍¢獙</h3>
+ <Table :columns="orderColumns" :data-source="preview.orders" row-key="workOrderId"
+ :pagination="false" size="small" :scroll="{ x: 1055 }">
+ <template #bodyCell="{ column, record, text }">
+ <template v-if="column.dataIndex === 'error'">
+ <span v-if="record.error" class="text-destructive">{{ record.error }}</span>
+ <Tag v-else :color="record.late ? 'orange' : 'green'">{{ record.late ? '鏈夊欢鏈熼闄�' : '閫氳繃' }}</Tag>
+ </template>
+ <template v-else-if="column.dataIndex === 'requestDate'">{{ text ? String(text).slice(0, 10) : '鏈寚瀹�' }}</template>
+ </template>
+ </Table>
+ </div>
+ <div v-if="preview.tasks.length">
+ <h3 class="mb-2 font-medium">浠诲姟瀹夋帓</h3>
+ <Table :columns="taskColumns" :data-source="preview.tasks"
+ :row-key="(row) => `${row.workOrderId}-${row.processId}`" :pagination="{ pageSize: 10, showSizeChanger: false }"
+ size="small" :scroll="{ x: 1365 }" />
+ </div>
+ <Alert v-if="preview.notices.length" type="info" show-icon message="鑱斾骇鍑烘彁绀�">
+ <template #description>
+ <p v-for="notice in preview.notices" :key="notice">{{ notice }}</p>
+ </template>
+ </Alert>
+ <Alert v-if="preview.warnings.length" type="warning" show-icon message="璇锋牳瀵逛氦鏈熼闄�">
+ <template #description>
+ <p v-for="warning in preview.warnings" :key="warning">{{ warning }}</p>
+ <Checkbox v-model:checked="acceptLate" :disabled="executing" class="mt-2">
+ 鎴戝凡鏍稿骞舵帴鍙椾互涓婁氦鏈熷欢鏈熼闄�
+ </Checkbox>
+ </template>
+ </Alert>
+ </template>
+ </div>
+ </Modal>
+</template>
diff --git a/src/views/mes/pro/workorder-center/index.vue b/src/views/mes/pro/workorder-center/index.vue
index 99ada7d..ae7cde6 100644
--- a/src/views/mes/pro/workorder-center/index.vue
+++ b/src/views/mes/pro/workorder-center/index.vue
@@ -16,12 +16,12 @@
getWorkOrderProgress,
checkAndAutoFinishWorkOrder,
} from '#/api/mes/pro/workorder';
-import { previewAutoGenerate, autoGenerateTasks } from '#/api/mes/pro/task';
+
import ArchiveDetail from '#/views/mes/pd/archive/modules/detail.vue';
import { useGridColumns, useGridFormSchema, useTaskGridColumns } from './data';
import QuickFeedbackForm from './modules/quick-feedback.vue';
-import SchedulePreviewModal from './modules/schedule-preview.vue';
+import AutoSchedule from '../task/modules/auto-schedule.vue';
defineOptions({ name: 'WorkorderCenter' });
const archiveDetailRef = ref<InstanceType<typeof ArchiveDetail>>();
@@ -38,7 +38,7 @@
});
const [SchedulePreviewModalWrap, schedulePreviewModalApi] = useVbenModal({
- connectedComponent: SchedulePreviewModal,
+ connectedComponent: AutoSchedule,
destroyOnClose: true,
});
@@ -107,27 +107,8 @@
.open();
}
-/** 涓�閿帓浜ч瑙� */
-async function handleSchedulePreview(row: MesProWorkOrderApi.WorkOrder) {
- try {
- const preview = await previewAutoGenerate({ workOrderId: row.id! });
- schedulePreviewModalApi
- .setData({ workOrder: row, preview })
- .open();
- } catch {
- message.error('鑾峰彇鎺掍骇棰勮澶辫触');
- }
-}
-
-/** 鎵ц涓�閿帓浜� */
-async function handleScheduleExecute(row: MesProWorkOrderApi.WorkOrder) {
- try {
- const result = await autoGenerateTasks({ workOrderId: row.id! });
- message.success(`鎺掍骇鎴愬姛锛岀敓鎴� ${result.taskIds?.length || 0} 涓换鍔);
- handleRefresh();
- } catch {
- message.error('鎺掍骇澶辫触');
- }
+function handleSchedulePreview(row: MesProWorkOrderApi.WorkOrder) {
+ schedulePreviewModalApi.setData({ workOrderIds: [row.id!] }).open();
}
const [Grid, gridApi] = useVbenVxeGrid({
@@ -193,21 +174,11 @@
<TableAction
:actions="[
{
- label: '鎺掍骇棰勮',
- type: 'link',
- auth: ['mes:pro-task:create'],
- ifShow: row.quantityScheduled < row.quantity,
- onClick: handleSchedulePreview.bind(null, row),
- },
- {
label: '涓�閿帓浜�',
type: 'link',
auth: ['mes:pro-task:create'],
- ifShow: row.quantityScheduled < row.quantity,
- popConfirm: {
- title: '纭涓�閿帓浜э紵灏嗘寜鐓у伐鑹鸿矾绾胯嚜鍔ㄧ敓鎴愪换鍔°��',
- confirm: handleScheduleExecute.bind(null, row),
- },
+ ifShow: row.status === MesProWorkOrderStatusEnum.CONFIRMED && row.type === MesProWorkOrderTypeEnum.SELF && (row.quantity ?? 0) > 0 && (row.quantityProduced ?? 0) < (row.quantity ?? 0),
+ onClick: handleSchedulePreview.bind(null, row),
},
{
label: '褰掓。',
diff --git a/src/views/mes/qc/ipqc/data.ts b/src/views/mes/qc/ipqc/data.ts
index 688c95f..1d99b4e 100644
--- a/src/views/mes/qc/ipqc/data.ts
+++ b/src/views/mes/qc/ipqc/data.ts
@@ -264,7 +264,6 @@
onChange: () => syncUnqualified(formApi),
},
defaultValue: 0,
- rules: 'required',
dependencies: {
triggerFields: ['unqualifiedQuantity'],
show: (values) =>
@@ -283,7 +282,6 @@
onChange: () => syncUnqualified(formApi),
},
defaultValue: 0,
- rules: 'required',
dependencies: {
triggerFields: ['unqualifiedQuantity'],
show: (values) =>
@@ -302,7 +300,6 @@
onChange: () => syncUnqualified(formApi),
},
defaultValue: 0,
- rules: 'required',
dependencies: {
triggerFields: ['unqualifiedQuantity'],
show: (values) =>
@@ -320,7 +317,6 @@
placeholder: '璇烽�夋嫨妫�娴嬩汉鍛�',
valueField: 'id',
},
- rules: 'selectRequired',
},
{
fieldName: 'inspectDate',
@@ -331,7 +327,6 @@
placeholder: '璇烽�夋嫨妫�娴嬫棩鏈�',
valueFormat: 'YYYY-MM-DD',
},
- rules: 'required',
},
{
fieldName: 'checkResult',
diff --git a/src/views/mes/qc/iqc/data.ts b/src/views/mes/qc/iqc/data.ts
index 40e693f..c608980 100644
--- a/src/views/mes/qc/iqc/data.ts
+++ b/src/views/mes/qc/iqc/data.ts
@@ -219,7 +219,6 @@
placeholder: '璇烽�夋嫨鏉ユ枡鏃ユ湡',
valueFormat: 'YYYY-MM-DD',
},
- rules: 'required',
},
{
fieldName: 'inspectorUserId',
@@ -232,7 +231,6 @@
placeholder: '璇烽�夋嫨妫�娴嬩汉鍛�',
valueField: 'id',
},
- rules: 'selectRequired',
},
{
fieldName: 'inspectDate',
@@ -243,7 +241,6 @@
placeholder: '璇烽�夋嫨妫�娴嬫棩鏈�',
valueFormat: 'YYYY-MM-DD',
},
- rules: 'required',
},
{
fieldName: 'checkResult',
diff --git a/src/views/mes/qc/oqc/data.ts b/src/views/mes/qc/oqc/data.ts
index 78b877b..3072ef5 100644
--- a/src/views/mes/qc/oqc/data.ts
+++ b/src/views/mes/qc/oqc/data.ts
@@ -139,7 +139,6 @@
componentProps: {
placeholder: '璇烽�夋嫨瀹㈡埛',
},
- rules: 'selectRequired',
dependencies: {
triggerFields: ['sourceDocId'],
componentProps: (values) => ({
@@ -246,7 +245,6 @@
placeholder: '璇烽�夋嫨妫�娴嬩汉鍛�',
valueField: 'id',
},
- rules: 'selectRequired',
},
{
fieldName: 'outDate',
@@ -257,7 +255,6 @@
placeholder: '璇烽�夋嫨鍑鸿揣鏃ユ湡',
valueFormat: 'YYYY-MM-DD',
},
- rules: 'required',
},
{
fieldName: 'inspectDate',
@@ -268,7 +265,6 @@
placeholder: '璇烽�夋嫨妫�娴嬫棩鏈�',
valueFormat: 'YYYY-MM-DD',
},
- rules: 'required',
},
{
fieldName: 'checkResult',
diff --git a/src/views/mes/qc/pendinginspect/data.ts b/src/views/mes/qc/pendinginspect/data.ts
index 71c6adc..63527d8 100644
--- a/src/views/mes/qc/pendinginspect/data.ts
+++ b/src/views/mes/qc/pendinginspect/data.ts
@@ -94,6 +94,13 @@
width: 80,
},
{
+ field: 'canInspect',
+ title: '鍙楠�',
+ width: 100,
+ align: 'center',
+ slots: { default: 'canInspect' },
+ },
+ {
title: '鎿嶄綔',
width: 130,
fixed: 'right',
diff --git a/src/views/mes/qc/pendinginspect/index.vue b/src/views/mes/qc/pendinginspect/index.vue
index 486e3ad..30a3f0d 100644
--- a/src/views/mes/qc/pendinginspect/index.vue
+++ b/src/views/mes/qc/pendinginspect/index.vue
@@ -8,6 +8,7 @@
import { Page, useVbenModal } from '@vben/common-ui';
import { MesQcTypeEnum } from '@vben/constants';
+import { Alert, Tag } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getPendingInspectPage } from '#/api/mes/qc/pendinginspect';
@@ -141,7 +142,18 @@
<OqcFormModal @success="handleRefresh" />
<RqcFormModal @success="handleRefresh" />
+ <Alert
+ class="mb-4"
+ type="info"
+ show-icon
+ message="浠庡緟妫�浠诲姟鍒涘缓妫�楠屽崟"
+ description="璇峰厛涓虹墿鏂欓厤缃苟鍚敤瀵瑰簲绫诲瀷鐨勮川妫�鏂规銆傛湭鏄剧ず銆屽彲妫�楠屻�嶇殑鐗╂枡鏃犳硶鍒涘缓妫�楠屽崟銆傜敓浜ц繃绋嬫楠屽畬鎴愬悗锛岀郴缁熶細鍥炲啓鎶ュ伐骞跺鐞嗗悎鏍间骇鍑恒��"
+ />
<Grid table-title="寰呮浠诲姟鍒楄〃">
+ <template #canInspect="{ row }">
+ <Tag v-if="row.canInspect" color="success">鍙楠�</Tag>
+ <Tag v-else color="error">鏈厤缃ā鏉�</Tag>
+ </template>
<template #actions="{ row }">
<TableAction
:actions="[
@@ -150,6 +162,7 @@
type: 'link',
icon: ACTION_ICON.ADD,
auth: ['mes:qc-iqc:create'],
+ disabled: row.canInspect === false,
ifShow: row.qcType === MesQcTypeEnum.IQC,
onClick: handleCreateIqc.bind(null, row),
},
@@ -158,6 +171,7 @@
type: 'link',
icon: ACTION_ICON.ADD,
auth: ['mes:qc-ipqc:create'],
+ disabled: row.canInspect === false,
ifShow: row.qcType === MesQcTypeEnum.IPQC,
onClick: handleCreateIpqc.bind(null, row),
},
@@ -166,6 +180,7 @@
type: 'link',
icon: ACTION_ICON.ADD,
auth: ['mes:qc-oqc:create'],
+ disabled: row.canInspect === false,
ifShow: row.qcType === MesQcTypeEnum.OQC,
onClick: handleCreateOqc.bind(null, row),
},
@@ -174,6 +189,7 @@
type: 'link',
icon: ACTION_ICON.ADD,
auth: ['mes:qc-rqc:create'],
+ disabled: row.canInspect === false,
ifShow: row.qcType === MesQcTypeEnum.RQC,
onClick: handleCreateRqc.bind(null, row),
},
diff --git a/src/views/mes/qc/rqc/data.ts b/src/views/mes/qc/rqc/data.ts
index 23ca51e..e0f9945 100644
--- a/src/views/mes/qc/rqc/data.ts
+++ b/src/views/mes/qc/rqc/data.ts
@@ -222,7 +222,6 @@
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
- rules: 'required',
},
{
fieldName: 'inspectorUserId',
@@ -235,7 +234,6 @@
placeholder: '璇烽�夋嫨妫�娴嬩汉鍛�',
valueField: 'id',
},
- rules: 'selectRequired',
},
{
fieldName: 'checkResult',
diff --git a/src/views/mes/workbench/components/WorkstationSelectDialog.vue b/src/views/mes/workbench/components/WorkstationSelectDialog.vue
index f066e66..13170e2 100644
--- a/src/views/mes/workbench/components/WorkstationSelectDialog.vue
+++ b/src/views/mes/workbench/components/WorkstationSelectDialog.vue
@@ -36,7 +36,7 @@
try {
const [result, counts] = await Promise.all([
getWorkstationPage({ pageNo: 1, pageSize: 200 }),
- getPendingFeedbackCountByWorkstation().catch(() => null),
+ getPendingFeedbackCountByWorkstation(true).catch(() => null),
]);
workstations.value = result.list ?? [];
pendingCounts.value = counts;
@@ -50,14 +50,22 @@
return pendingCounts.value?.[String(ws.id)] ?? 0;
}
-/** 杩囨护鍚庣殑宸ヤ綔绔� */
+/** 杩囨护鍚庣殑宸ヤ綔绔欙細浠呭睍绀哄綋鍓嶇敤鎴锋湁鍙姤宸ヤ换鍔$殑锛涚粺璁″け璐ユ椂涓嶈繃婊わ紝閬垮厤鍏ㄩ儴闅愯棌 */
const filtered = computed(() => {
const kw = searchKeyword.value.trim().toLowerCase();
- if (!kw) return workstations.value;
return workstations.value.filter((ws) => {
+ if (pendingCounts.value && getPendingCount(ws) <= 0) return false;
+ if (!kw) return true;
const fields = [ws.code, ws.name, ws.processName, ws.workshopName, ws.address];
return fields.some((f) => String(f ?? '').toLowerCase().includes(kw));
});
+});
+
+/** 绌虹姸鎬佹枃妗� */
+const emptyText = computed(() => {
+ if (!pendingCounts.value) return '鏆傛棤宸ヤ綔绔欐暟鎹�';
+ if (searchKeyword.value.trim()) return '娌℃湁鍖归厤鐨勫伐浣滅珯';
+ return '鏆傛棤鍙姤宸ョ殑宸ヤ綔绔�';
});
/** 閫夋嫨宸ヤ綔绔� */
@@ -96,7 +104,7 @@
<!-- 绌虹姸鎬� -->
<div v-if="!filtered.length && !loading" class="ws-select__empty">
<IconifyIcon icon="lucide:inbox" class="ws-select__empty-icon" />
- <p>鏆傛棤宸ヤ綔绔欐暟鎹�</p>
+ <p>{{ emptyText }}</p>
</div>
<!-- 鍗$墖缃戞牸 -->
diff --git a/src/views/mes/workbench/components/tabs/FeedbackTab.vue b/src/views/mes/workbench/components/tabs/FeedbackTab.vue
index a5dc6e4..1296ec6 100644
--- a/src/views/mes/workbench/components/tabs/FeedbackTab.vue
+++ b/src/views/mes/workbench/components/tabs/FeedbackTab.vue
@@ -101,8 +101,13 @@
return data;
}
-/** 鍔犺浇 checkFlag */
-async function resolveCheckFlag(routeId?: number, processId?: number) {
+/** 鍔犺浇 checkFlag锛氫换鍔★紙宸ュ崟宸ュ簭蹇収锛変紭鍏堬紝缂哄け鏃跺洖閫�宸ヨ壓璺嚎宸ュ簭 */
+async function resolveCheckFlag(
+ routeId?: number,
+ processId?: number,
+ taskCheckFlag?: boolean,
+) {
+ if (typeof taskCheckFlag === 'boolean') return taskCheckFlag;
if (!routeId || !processId) return true;
try {
const rp = await getRouteProcessByRouteAndProcess(routeId, processId);
@@ -124,7 +129,11 @@
formApi.setState({ schema: useFormSchema(formType.value, formApi) });
const code = await generateAutoCode(MesAutoCodeRuleCode.PRO_FEEDBACK_CODE);
- const checkFlag = await resolveCheckFlag(task.routeId, task.processId);
+ const checkFlag = await resolveCheckFlag(
+ task.routeId,
+ task.processId,
+ task.checkFlag,
+ );
await formApi.setValues({
code,
@@ -285,7 +294,11 @@
feedbackStatus.value = data.status;
formType.value = 'update';
formApi.setState({ schema: useFormSchema(formType.value, formApi) });
- const checkFlag = await resolveCheckFlag(data.routeId, data.processId);
+ const checkFlag = await resolveCheckFlag(
+ data.routeId,
+ data.processId,
+ data.checkFlag,
+ );
await formApi.setValues({ ...data, checkFlag });
originalSnapshot.value = JSON.stringify(await getAlignedData(false));
}
diff --git a/src/views/mes/workbench/index.vue b/src/views/mes/workbench/index.vue
index b49191b..11604db 100644
--- a/src/views/mes/workbench/index.vue
+++ b/src/views/mes/workbench/index.vue
@@ -113,6 +113,7 @@
workstationId: workstationId.value,
pageNo: 1,
pageSize: 200,
+ onlyMine: true,
});
taskList.value = result.list ?? [];
// 鍚屾 selectedTask 鍒版渶鏂版暟鎹紙涓嶈嚜鍔ㄩ�変腑绗竴涓紝闇�鐢ㄦ埛鎵嬪姩鐐瑰嚮锛�
@@ -156,7 +157,12 @@
// --- 杩斿洖绯荤粺 ---
function goBack() {
- router.push('/');
+ // 杩斿洖涓婁竴姝ワ紱鐩存帴鎵撳紑宸ヤ綔鍙帮紙鏃犲巻鍙茶褰曪級鏃跺厹搴曞洖棣栭〉
+ if (window.history.state?.back) {
+ router.back();
+ } else {
+ router.push('/');
+ }
}
</script>
diff --git a/src/views/wls/arrivalnotice/modules/form.vue b/src/views/wls/arrivalnotice/modules/form.vue
index 1f4224b..1e6d4bb 100644
--- a/src/views/wls/arrivalnotice/modules/form.vue
+++ b/src/views/wls/arrivalnotice/modules/form.vue
@@ -8,7 +8,7 @@
import { useVbenModal } from '@vben/common-ui';
import { MesWmArrivalNoticeStatusEnum } from '@vben/constants';
-import { Button, Divider, message, Popconfirm } from 'ant-design-vue';
+import { Alert, Button, Divider, message, Popconfirm } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import {
@@ -75,7 +75,7 @@
originalSnapshot.value = current;
}
await submitArrivalNotice(formData.value.id);
- message.success('鎻愪氦鎴愬姛');
+ message.success('鎻愪氦鎴愬姛锛岃鎸夊崟鎹姸鎬佺户缁川妫�鎴栧叆搴�');
await modalApi.close();
emit('success');
} finally {
@@ -148,6 +148,7 @@
<template>
<Modal :title="getTitle" class="w-3/5">
+ <Alert v-if="isEditable" class="mx-4 mb-4" type="info" show-icon message="鎻愪氦鍓嶈瀹屽杽鐗╂枡鏄庣粏" description="闇�妫�鐗╂枡璇峰厛閰嶇疆鍚敤鐨勬潵鏂欐楠屾ā鏉裤�傛彁浜ゅ悗绯荤粺浼氱敓鎴愭楠屽崟锛涙楠屽畬鎴愬悗鍐嶅姙鐞嗗叆搴撱�備笉闇�妫�鐨勭墿鏂欏彲鐩存帴杩涘叆寰呭叆搴撱��" />
<Form class="mx-4" />
<!-- 闈炴柊寤烘ā寮忓睍绀虹墿鏂欎俊鎭� -->
<template v-if="formData?.id">
diff --git a/src/views/wls/productreceipt/data.ts b/src/views/wls/productreceipt/data.ts
index d5a5881..8c3b042 100644
--- a/src/views/wls/productreceipt/data.ts
+++ b/src/views/wls/productreceipt/data.ts
@@ -182,6 +182,13 @@
formatter: 'formatDate',
},
{
+ field: 'produceId',
+ title: '鏉ユ簮',
+ width: 110,
+ align: 'center',
+ slots: { default: 'source' },
+ },
+ {
field: 'status',
title: '鍗曟嵁鐘舵��',
minWidth: 110,
diff --git a/src/views/wls/productreceipt/index.vue b/src/views/wls/productreceipt/index.vue
index 8fcdb71..8efbad5 100644
--- a/src/views/wls/productreceipt/index.vue
+++ b/src/views/wls/productreceipt/index.vue
@@ -6,7 +6,7 @@
import { MesWmProductReceiptStatusEnum } from '@vben/constants';
import { downloadFileFromBlobPart } from '@vben/utils';
-import { Button, message } from 'ant-design-vue';
+import { Button, message, Tag } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
@@ -172,6 +172,10 @@
{{ row.code }}
</Button>
</template>
+ <template #source="{ row }">
+ <Tag v-if="row.produceId" color="blue">浜у嚭鑷姩鐢熸垚</Tag>
+ <Tag v-else>鎵嬪伐鍒涘缓</Tag>
+ </template>
<template #actions="{ row }">
<TableAction
:actions="[
diff --git a/src/views/wls/productreceipt/modules/form.vue b/src/views/wls/productreceipt/modules/form.vue
index d9fa648..9d7fcce 100644
--- a/src/views/wls/productreceipt/modules/form.vue
+++ b/src/views/wls/productreceipt/modules/form.vue
@@ -8,7 +8,7 @@
import { confirm, useVbenModal } from '@vben/common-ui';
import { MesWmProductReceiptStatusEnum } from '@vben/constants';
-import { Button, Divider, message, Popconfirm } from 'ant-design-vue';
+import { Alert, Button, Divider, message, Popconfirm } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import {
@@ -214,6 +214,14 @@
<template>
<Modal :title="getTitle" class="w-3/5">
+ <Alert
+ v-if="formData?.produceId"
+ class="mx-4 mb-3"
+ type="info"
+ show-icon
+ message="浜у嚭鑷姩鐢熸垚鐨勫叆搴撳崟"
+ description="璇ュ崟鎹敱鐢熶骇浜у嚭鑷姩鐢熸垚锛屽簱瀛樺凡鍦ㄤ骇鍑烘椂鍏ヨ处銆傛墽琛屽叆搴撲粎鍏抽棴涓氬姟鍗曟嵁锛屼笉浼氶噸澶嶆洿鏂板簱瀛樸��"
+ />
<Form class="mx-4" />
<!-- 闈炴柊寤烘ā寮忓睍绀虹墿鏂欎俊鎭� -->
<template v-if="formData?.id">
--
Gitblit v1.9.3