From 600fe725775e28af1f86f7f7f1e2521f494252b1 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 01 九月 2026 15:27:26 +0800
Subject: [PATCH] feat(mes): 新增管理驾驶舱页面

---
 src/api/mes/management-cockpit/index.ts |  158 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 158 insertions(+), 0 deletions(-)

diff --git a/src/api/mes/management-cockpit/index.ts b/src/api/mes/management-cockpit/index.ts
new file mode 100644
index 0000000..c85c268
--- /dev/null
+++ b/src/api/mes/management-cockpit/index.ts
@@ -0,0 +1,158 @@
+import { requestClient } from '#/api/request';
+
+export namespace ManagementCockpitApi {
+  /** 閫氱敤鍚嶇О-鏁伴噺鍒嗗竷椤� */
+  export interface NameCountItem {
+    name: string; // 鍚嶇О锛堜粨搴�/鍝佺/鐘舵��/缁忛攢鍟�/鐪佷唤/娓犻亾绛夛級
+    count: number; // 鏁伴噺
+  }
+
+  /** 鎸夋棩鏁伴噺瓒嬪娍椤� */
+  export interface DailyCountItem {
+    date: string; // 鏃ユ湡 yyyy-MM-dd
+    count: number; // 鏁伴噺
+  }
+
+  /** 璐ㄦ鎸囨爣鍧囧�奸」 */
+  export interface IndicatorAvgItem {
+    indicatorCode: string; // 鎸囨爣缂栫爜
+    indicatorName: string; // 鎸囨爣鍚嶇О锛堢函搴�/鍑�搴�/鍙戣娊鐜�/姘村垎锛�
+    checkCount: number; // 妫�楠屾鏁�
+    averageValue: number; // 鎸囨爣骞冲潎鍊�
+    passRate: number; // 鎸囨爣鍚堟牸鐜囷紙%锛�
+  }
+
+  /** 浜旂淮搴︽眹鎬荤粺璁� */
+  export interface Summary {
+    // 鐢熶骇
+    batchTotal: number; // 鎵规鎬绘暟
+    batchDraft: number; // 鑽夌鎵规
+    batchProducing: number; // 鐢熶骇涓壒娆�
+    batchFinished: number; // 宸插畬鎴愭壒娆�
+    batchCanceled: number; // 宸蹭綔搴熸壒娆�
+    bagCodeTotal: number; // 琚嬬爜鎬绘暟
+    bagCodeGenerated: number; // 宸茬敓鎴愯鐮�
+    bagCodePrinted: number; // 宸插鍑哄嵃鍒疯鐮�
+    bagCodeCanceled: number; // 宸蹭綔搴熻鐮�
+    palletTotal: number; // 鎵樼洏鐮佹�绘暟
+    todayInboundBagCount: number; // 浠婃棩鎵爜鍏ュ簱琚嬫暟
+    // 璐ㄦ
+    qualityTotal: number; // 妫�楠岃褰曟�绘暟
+    qualityPending: number; // 澶勭悊涓�
+    qualityPass: number; // 鍚堟牸
+    qualityFail: number; // 涓嶅悎鏍�
+    qualityPassRate: number; // 妫�楠屽悎鏍肩巼锛�%锛�
+    // 搴撳瓨
+    stockTotal: number; // 褰撳墠搴撳瓨鎬婚噺
+    stockTemporary: number; // 鏆傚瓨搴撳瓨閲�
+    stockQualified: number; // 鍚堟牸搴撳瓨閲�
+    stockOutbound: number; // 宸插嚭搴撴暟閲�
+    lowStockCount: number; // 浣庡簱瀛橀璀︽暟
+    // 鍑哄簱
+    outboundOrderTotal: number; // 鍑哄簱鍗曟�绘暟
+    outboundQuantityTotal: number; // 鍑哄簱鎬婚噺
+    todayOutboundQuantity: number; // 浠婃棩鍑哄簱閲�
+    // 杩芥函
+    scanTotal: number; // 鎵爜鎬绘暟
+    todayScanCount: number; // 浠婃棩鎵爜鏁�
+    scanSuccessCount: number; // 鎵爜鎴愬姛鏁�
+    crossRegionWarningTotal: number; // 绐滆揣棰勮鎬绘暟
+    crossRegionPendingCount: number; // 寰呭鐞嗙獪璐ч璀︽暟
+  }
+
+  /** 鐢熶骇瓒嬪娍椤� */
+  export interface ProductionTrendItem {
+    date: string;
+    batchCount: number; // 鏂板鎵规
+    bagCodeCount: number; // 鏂板琚嬬爜
+    palletCount: number; // 鏂板鎵樼洏
+    inboundBagQuantity: number; // 鎵爜鍏ュ簱琚嬫暟
+  }
+
+  /** 璐ㄦ缁村害缁熻 */
+  export interface QualityStatistics {
+    resultDistribution: NameCountItem[]; // 妫�楠岀粨鏋滃垎甯�
+    indicatorList: IndicatorAvgItem[]; // 鍥涢」鎸囨爣鍧囧��
+  }
+
+  /** 搴撳瓨缁村害缁熻 */
+  export interface InventoryStatistics {
+    warehouseDistribution: NameCountItem[]; // 鎸変粨搴�
+    itemDistribution: NameCountItem[]; // 鎸夊搧绉�
+    stateDistribution: NameCountItem[]; // 鎸夌姸鎬�
+  }
+
+  /** 鍑哄簱缁村害缁熻 */
+  export interface OutboundStatistics {
+    trend: DailyCountItem[]; // 鎸夋棩鍑哄簱瓒嬪娍
+    dealerDistribution: NameCountItem[]; // 鎸夌粡閿�鍟�
+  }
+
+  /** 绐滆揣棰勮姹囨�� */
+  export interface CrossRegionSummary {
+    total: number;
+    pending: number;
+    handled: number;
+    falseAlarm: number;
+    crossProvince: number;
+    crossCity: number;
+  }
+
+  /** 杩芥函缁村害缁熻 */
+  export interface TraceStatistics {
+    scanTrend: DailyCountItem[]; // 鎵爜鎸夋棩瓒嬪娍
+    provinceDistribution: NameCountItem[]; // 鐪佷唤鍒嗗竷
+    channelDistribution: NameCountItem[]; // 娓犻亾鍒嗗竷
+    crossRegionSummary: CrossRegionSummary; // 绐滆揣棰勮姹囨��
+  }
+}
+
+/** 鑾峰緱绠$悊椹鹃┒鑸变簲缁村害姹囨�荤粺璁� */
+export function getManagementCockpitSummary() {
+  return requestClient.get<ManagementCockpitApi.Summary>(
+    '/mes/dashboard/summary',
+  );
+}
+
+/** 鑾峰緱鐢熶骇瓒嬪娍 */
+export function getManagementCockpitProductionTrend(days?: number) {
+  return requestClient.get<ManagementCockpitApi.ProductionTrendItem[]>(
+    '/mes/dashboard/production-trend',
+    { params: { days } },
+  );
+}
+
+/** 鑾峰緱璐ㄦ缁村害缁熻 */
+export function getManagementCockpitQuality() {
+  return requestClient.get<ManagementCockpitApi.QualityStatistics>(
+    '/mes/dashboard/quality-statistics',
+  );
+}
+
+/** 鑾峰緱搴撳瓨缁村害缁熻 */
+export function getManagementCockpitInventory() {
+  return requestClient.get<ManagementCockpitApi.InventoryStatistics>(
+    '/mes/dashboard/inventory-statistics',
+  );
+}
+
+/** 鑾峰緱鍑哄簱缁村害缁熻 */
+export function getManagementCockpitOutbound(days?: number) {
+  return requestClient.get<ManagementCockpitApi.OutboundStatistics>(
+    '/mes/dashboard/outbound-statistics',
+    { params: { days } },
+  );
+}
+
+/** 鑾峰緱杩芥函缁村害缁熻 */
+export function getManagementCockpitTrace(days?: number) {
+  return requestClient.get<ManagementCockpitApi.TraceStatistics>(
+    '/mes/dashboard/trace-statistics',
+    { params: { days } },
+  );
+}
+
+/** 瀵煎嚭绠$悊椹鹃┒鑸� Excel 鎶ヨ〃锛堣繑鍥� Blob锛� */
+export function exportManagementCockpitExcel() {
+  return requestClient.download('/mes/dashboard/export-excel');
+}

--
Gitblit v1.9.3