From ce1292c9cf37195b6abd2699dfc5d6cb3e143c9b Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期日, 12 四月 2026 23:38:19 +0800
Subject: [PATCH] feat(MES): 添加MES接口相关实体和DTO JS扩展文件至JSX格式并更新配置
---
Code/WMS/WIDESEA_WMSClient/src/extension/taskinfo/extend/gridBodyExtension.vue | 329 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 329 insertions(+), 0 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSClient/src/extension/taskinfo/extend/gridBodyExtension.vue b/Code/WMS/WIDESEA_WMSClient/src/extension/taskinfo/extend/gridBodyExtension.vue
new file mode 100644
index 0000000..cf4fe98
--- /dev/null
+++ b/Code/WMS/WIDESEA_WMSClient/src/extension/taskinfo/extend/gridBodyExtension.vue
@@ -0,0 +1,329 @@
+<template>
+ <div>
+ <!-- 鎵嬪姩鍒涘缓浠诲姟寮圭獥 -->
+ <vol-box v-model="showManualCreate" :lazy="true" width="500px" :padding="15" title="鎵嬪姩鍒涘缓浠诲姟">
+ <el-form :model="manualFormData" ref="form" label-width="100px">
+ <el-form-item label="浠诲姟绫诲瀷" prop="taskType" required>
+ <el-select v-model="manualFormData.taskType" placeholder="璇烽�夋嫨浠诲姟绫诲瀷">
+ <el-option label="鍏ュ簱" value="鍏ュ簱"></el-option>
+ <el-option label="鍑哄簱" value="鍑哄簱"></el-option>
+ <el-option label="绉诲簱" value="绉诲簱"></el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="璧风偣鍦板潃" prop="sourceAddress" required>
+ <el-input v-model="manualFormData.sourceAddress" placeholder="璇疯緭鍏ヨ捣鐐瑰湴鍧�"></el-input>
+ </el-form-item>
+ <el-form-item label="缁堢偣鍦板潃" prop="targetAddress" required>
+ <el-input v-model="manualFormData.targetAddress" placeholder="璇疯緭鍏ョ粓鐐瑰湴鍧�"></el-input>
+ </el-form-item>
+ <el-form-item label="鏉$爜" prop="barcode" required>
+ <el-input v-model="manualFormData.barcode" placeholder="璇疯緭鍏ユ潯鐮�"></el-input>
+ </el-form-item>
+ <el-form-item label="浠撳簱ID" prop="warehouseId" required>
+ <el-input v-model="manualFormData.warehouseId" placeholder="璇疯緭鍏ヤ粨搴揑D"></el-input>
+ </el-form-item>
+ <el-form-item label="浼樺厛绾�">
+ <el-input v-model="manualFormData.grade" readonly></el-input>
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <el-button type="primary" size="small" @click="submitManualCreate">纭畾</el-button>
+ <el-button type="danger" size="small" @click="showManualCreate = false">鍏抽棴</el-button>
+ </template>
+ </vol-box>
+
+ <!-- 鎵嬪姩涓嬪彂浠诲姟寮圭獥 -->
+ <vol-box v-model="showDispatch" :lazy="true" width="900px" :padding="15" title="鎵嬪姩涓嬪彂浠诲姟鍒� WCS">
+ <div v-if="dispatchRows.length > 0" class="dispatch-info">
+ 宸查�変换鍔℃暟: <span class="count">{{ dispatchRows.length }}</span> 涓�
+ </div>
+
+ <el-table :data="dispatchTableData" border style="width: 100%; margin-top: 10px" max-height="400">
+ <el-table-column prop="taskNum" label="浠诲姟鍙�" width="120"></el-table-column>
+ <el-table-column prop="palletCode" label="鎵樼洏鍙�" width="140">
+ <template v-slot="{ row }">
+ <el-input v-if="row && row.editable" v-model="row.palletCode" size="small" placeholder="璇疯緭鍏�"></el-input>
+ <span v-else>{{ row ? row.palletCode : '' }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="sourceAddress" label="璧风偣鍦板潃" width="160">
+ <template v-slot="{ row }">
+ <el-input v-if="row && row.editable" v-model="row.sourceAddress" size="small" placeholder="璇疯緭鍏�"></el-input>
+ <span v-else>{{ row ? row.sourceAddress : '' }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="targetAddress" label="缁堢偣鍦板潃" width="160">
+ <template v-slot="{ row }">
+ <el-input v-if="row && row.editable" v-model="row.targetAddress" size="small" placeholder="璇疯緭鍏�"></el-input>
+ <span v-else>{{ row ? row.targetAddress : '' }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="grade" label="浼樺厛绾�" width="100">
+ <template v-slot="{ row }">
+ <el-input-number v-if="row && row.editable" v-model="row.grade" :min="1" :max="99" size="small" style="width: 80px"></el-input-number>
+ <span v-else>{{ row ? row.grade : '' }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="statusName" label="鐘舵��" width="120">
+ <template v-slot="{ row }">
+ <span :class="{ 'status-error': row && !row.editable }">{{ row ? row.statusName : '' }}</span>
+ </template>
+ </el-table-column>
+ </el-table>
+
+ <div v-if="dispatchFailResults && dispatchFailResults.length > 0" class="fail-results">
+ <div class="fail-title">涓嬪彂澶辫触浠诲姟锛�</div>
+ <el-table :data="dispatchFailResults" border style="width: 100%; margin-top: 10px" max-height="200">
+ <el-table-column prop="taskNum" label="浠诲姟鍙�" width="120"></el-table-column>
+ <el-table-column prop="errorMessage" label="澶辫触鍘熷洜"></el-table-column>
+ </el-table>
+ </div>
+
+ <template #footer>
+ <el-button type="primary" size="small" @click="submitDispatch" :loading="dispatchLoading">纭涓嬪彂</el-button>
+ <el-button type="danger" size="small" @click="showDispatch = false">鍙栨秷</el-button>
+ </template>
+ </vol-box>
+ </div>
+</template>
+
+<script>
+import VolBox from "@/components/basic/VolBox.vue";
+
+export default {
+ components: { VolBox },
+ emits: ["parentCall"],
+ data() {
+ return {
+ // 鎵嬪姩鍒涘缓浠诲姟
+ showManualCreate: false,
+ manualFormData: {
+ taskType: "",
+ sourceAddress: "",
+ targetAddress: "",
+ barcode: "",
+ warehouseId: "",
+ grade: 1,
+ },
+ // 鎵嬪姩涓嬪彂浠诲姟
+ showDispatch: false,
+ dispatchLoading: false,
+ dispatchRows: [],
+ dispatchTableData: [],
+ dispatchFailResults: [],
+ dispatchOriginalData: [],
+ };
+ },
+ methods: {
+ // 鎵嬪姩鍒涘缓浠诲姟 - 鎵撳紑
+ open() {
+ this.showManualCreate = true;
+ this.resetManualForm();
+ },
+ resetManualForm() {
+ this.manualFormData = {
+ taskType: "",
+ sourceAddress: "",
+ targetAddress: "",
+ barcode: "",
+ warehouseId: "",
+ grade: 1,
+ };
+ },
+ submitManualCreate() {
+ if (!this.manualFormData.taskType) return this.$message.error("璇烽�夋嫨浠诲姟绫诲瀷");
+ if (!this.manualFormData.sourceAddress) return this.$message.error("璇疯緭鍏ヨ捣鐐瑰湴鍧�");
+ if (!this.manualFormData.targetAddress) return this.$message.error("璇疯緭鍏ョ粓鐐瑰湴鍧�");
+ if (!this.manualFormData.barcode) return this.$message.error("璇疯緭鍏ユ潯鐮�");
+ if (!this.manualFormData.warehouseId) return this.$message.error("璇疯緭鍏ヤ粨搴揑D");
+
+ this.http
+ .post("/api/Task/CreateManualTask", this.manualFormData, "鏁版嵁澶勭悊涓�...")
+ .then((res) => {
+ if (!res.status) return this.$message.error(res.message);
+ this.$message.success("浠诲姟鍒涘缓鎴愬姛");
+ this.showManualCreate = false;
+ this.$emit("parentCall", ($vue) => { $vue.refresh(); });
+ });
+ },
+ // 鎵嬪姩涓嬪彂浠诲姟 - 鎵撳紑
+ openDispatch(rows) {
+ console.log('openDispatch called with rows:', rows);
+ console.log('rows type:', typeof rows, Array.isArray(rows));
+ // 纭繚鏄暟缁�
+ if (!rows) {
+ this.dispatchRows = [];
+ } else if (Array.isArray(rows)) {
+ this.dispatchRows = rows;
+ } else {
+ // 濡傛灉鏄崟涓璞★紝鍖呰鎴愭暟缁�
+ this.dispatchRows = [rows];
+ }
+ console.log('dispatchRows length:', this.dispatchRows.length);
+ this.dispatchFailResults = [];
+ // 鍏堝垵濮嬪寲鏁版嵁锛屽啀鏄剧ず寮圭獥
+ this.initDispatchTableData();
+ this.showDispatch = true;
+ },
+ initDispatchTableData() {
+ console.log('initDispatchTableData dispatchRows:', this.dispatchRows);
+ console.log('dispatchRows isArray:', Array.isArray(this.dispatchRows), 'length:', this.dispatchRows?.length);
+
+ // 纭繚 dispatchRows 鏄暟缁�
+ if (!this.dispatchRows || !Array.isArray(this.dispatchRows)) {
+ console.warn('dispatchRows 涓嶆槸鏈夋晥鏁扮粍锛岄噸缃负绌烘暟缁�');
+ this.dispatchTableData = [];
+ return;
+ }
+
+ const statusNames = {
+ 'inbound_200': '鍏ュ簱鏂板崟',
+ 'outbound_100': '鍑哄簱鏂板崟',
+ 'relocation_300': '绉诲簱鏂板崟',
+ 'outbound_110': '鍫嗗灈鏈哄嚭搴撴墽琛屼腑',
+ 'outbound_115': '鍫嗗灈鏈哄嚭搴撳畬鎴�',
+ 'inbound_220': '杈撻�佺嚎鍏ュ簱鎵ц涓�',
+ 'inbound_230': '鍫嗗灈鏈哄叆搴撴墽琛屼腑',
+ 'inbound_290': '鍏ュ簱浠诲姟瀹屾垚',
+ 'outbound_120': '杈撻�佺嚎鍑哄簱鎵ц涓�',
+ 'outbound_125': '杈撻�佺嚎鍑哄簱瀹屾垚',
+ 'outbound_200': '鍑哄簱浠诲姟瀹屾垚',
+ 'relocation_310': '鍫嗗灈鏈虹Щ搴撴墽琛屼腑'
+ };
+
+ const result = [];
+ const original = [];
+ let filteredCount = 0; // 璁板綍琚繃婊ょ殑浠诲姟鏁伴噺
+ for (const row of this.dispatchRows) {
+ console.log('Processing row:', row);
+ // Handle possible field name differences (camelCase vs PascalCase)
+ const taskId = row.taskId ?? row.Id ?? row.id ?? 0;
+ const taskType = row.taskType ?? row.TaskType ?? row.task_type ?? 0;
+ const taskStatus = row.taskStatus ?? row.TaskStatus ?? row.task_status ?? 0;
+ console.log('taskId:', taskId, 'taskType:', taskType, 'taskStatus:', taskStatus);
+ const statusKey = this.getStatusKey(taskType, taskStatus);
+ console.log('statusKey:', statusKey);
+ const statusName = statusNames[statusKey] || `鐘舵��${taskStatus}`;
+ const editable = this.isEditable(taskType, taskStatus);
+ console.log('editable:', editable, '鏍规嵁 taskType:', taskType, 'taskStatus:', taskStatus);
+
+ // 闈炴柊寤虹姸鎬佺殑浠诲姟涓嶆樉绀哄湪寮圭獥涓�
+ if (!editable) {
+ console.log(`浠诲姟${taskId}鐘舵�乕${statusName}]涓嶆槸鏂板缓锛屽凡杩囨护`);
+ filteredCount++;
+ continue;
+ }
+
+ const item = {
+ taskId: taskId,
+ taskNum: row.taskNum ?? row.TaskNum ?? 0,
+ sourceAddress: row.sourceAddress || row.SourceAddress || '',
+ targetAddress: row.targetAddress || row.TargetAddress || '',
+ grade: row.grade ?? row.Grade ?? 1,
+ statusName: statusName,
+ palletCode: row.palletCode || row.PalletCode || '',
+ editable: editable,
+ taskType: taskType,
+ taskStatus: taskStatus
+ };
+ result.push(item);
+ // 淇濆瓨鍘熷鏁版嵁鐨勫壇鏈�
+ original.push({ ...item });
+ }
+ this.dispatchTableData = result;
+ this.dispatchOriginalData = original;
+ console.log('dispatchTableData result:', this.dispatchTableData);
+ console.log('dispatchOriginalData:', this.dispatchOriginalData);
+
+ // 濡傛灉鏈夎杩囨护鐨勪换鍔★紝鏄剧ず鎻愮ず
+ if (filteredCount > 0) {
+ this.$message.warning(`閫変腑鐨�${this.dispatchRows.length}涓换鍔′腑鏈�${filteredCount}涓潪鏂板缓鐘舵�佷换鍔″凡杩囨护`);
+ }
+ },
+ getStatusKey(taskType, taskStatus) {
+ if (taskType === 200) return `inbound_${taskStatus}`;
+ if (taskType === 100) return `outbound_${taskStatus}`;
+ if (taskType === 300) return `relocation_${taskStatus}`;
+ return `other_${taskStatus}`;
+ },
+ isEditable(taskType, taskStatus) {
+ if (taskType === 200 && taskStatus === 200) return true;
+ if (taskType === 100 && taskStatus === 100) return true;
+ if (taskType === 300 && taskStatus === 300) return true;
+ return false;
+ },
+ submitDispatch() {
+ if (this.dispatchTableData.length === 0) return this.$message.error("璇峰厛閫夋嫨浠诲姟");
+
+ const dispatchData = this.dispatchTableData.map(row => ({
+ taskId: row.taskId,
+ palletCode: row.palletCode,
+ sourceAddress: row.sourceAddress,
+ targetAddress: row.targetAddress,
+ grade: row.grade
+ }));
+ console.log('Dispatching data:', dispatchData);
+
+ this.dispatchLoading = true;
+ this.http
+ .post("/api/Task/DispatchTasksToWCS", dispatchData, "鏁版嵁澶勭悊涓�...")
+ .then((res) => {
+ this.dispatchLoading = false;
+ if (!res.status) {
+ this.$message.error(res.message);
+ if (res.data && res.data.failResults) {
+ this.dispatchFailResults = res.data.failResults;
+ }
+ return;
+ }
+
+ if (res.data && res.data.failCount === 0) {
+ this.$message.success(res.message);
+ this.showDispatch = false;
+ this.$emit("parentCall", ($vue) => { $vue.refresh(); });
+ return;
+ }
+
+ if (res.data && res.data.failResults) {
+ this.dispatchFailResults = res.data.failResults;
+ }
+
+ if (res.data && res.data.failCount > 0 && res.data.successCount > 0) {
+ this.$message.warning(res.message);
+ } else {
+ this.$message.error(res.message);
+ }
+ })
+ .catch(() => {
+ this.dispatchLoading = false;
+ });
+ }
+ }
+};
+</script>
+
+<style scoped>
+.dispatch-info {
+ font-size: 14px;
+ color: #606266;
+ margin-bottom: 10px;
+}
+.dispatch-info .count {
+ color: #409eff;
+ font-weight: bold;
+}
+.status-error {
+ color: #f56c6c;
+}
+.fail-results {
+ margin-top: 15px;
+ padding: 10px;
+ background: #fef0f0;
+ border-radius: 4px;
+}
+.fail-title {
+ font-size: 14px;
+ color: #f56c6c;
+ margin-bottom: 5px;
+}
+</style>
--
Gitblit v1.9.3