From 94de74e476085082d966511289a6d8d4b240f5ad Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期四, 11 十二月 2025 15:11:24 +0800
Subject: [PATCH] 优化前端空托入库

---
 项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/EmptyTrayInbound.vue   |  113 ++++++++++++++
 项目代码/WIDESEA_WMSClient/config/buttons.js                                   |    8 +
 项目代码/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js               |  340 +++++++++++++++++++++--------------------
 项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue |   12 
 4 files changed, 302 insertions(+), 171 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/config/buttons.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/config/buttons.js"
index 646ec5c..355dec9 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/config/buttons.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/config/buttons.js"
@@ -235,6 +235,14 @@
     onClick: function () {
     }
 },
+{
+    name: "绌烘墭鍏ュ簱",
+    class: '',
+    value: 'EmptyTrayInbound',
+    type: 'primary',
+    onClick: function () {
+    }
+},
 ]
 
 export default buttons
\ No newline at end of file
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/EmptyTrayInbound.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/EmptyTrayInbound.vue"
new file mode 100644
index 0000000..d80b08e
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/EmptyTrayInbound.vue"
@@ -0,0 +1,113 @@
+<template>
+    <vol-box v-model="show" title="绌烘墭鍏ュ簱" :width="800" :height="1200">
+        <template #content>
+            <el-form ref="form" :model="form" label-width="90px">
+                <el-form-item label="鍏ュ簱鍖哄煙:">
+                    <el-select v-model="form.locationType" placeholder="璇烽�夋嫨鍏ュ簱鍖哄煙">
+                        <el-option v-for="item in locationTypes" :key="item.locationType" :label="item.locationTypeDesc"
+                            :value="item.locationType" />
+                    </el-select>
+                </el-form-item>
+
+                <el-form-item label="鎵樼洏鏉$爜:">
+                    <el-input v-model="form.palletCode" placeholder="璇锋壂鎻�/杈撳叆鎵樼洏鏉$爜" @keyup.enter="submit" @keyup.13="submit"
+                        clearable maxlength="50" @paste="handlePaste" @input="handleInput" />
+                </el-form-item>
+            </el-form>
+        </template>
+
+        <template #footer>
+            <div class="dialog-footer">
+                <el-button type="primary" @click="submit">纭</el-button>
+                <el-button @click="show = false">鍏抽棴</el-button>
+            </div>
+        </template>
+    </vol-box>
+</template>
+  
+<script>
+import VolBox from '@/components/basic/VolBox.vue'
+
+export default {
+    components: { VolBox },
+    props: {
+        value: { type: Boolean, default: false }
+    },
+    data() {
+        return {
+            show: false,
+            form: {
+                palletCode: '',
+                locationType: ''
+            },
+            locationTypes: []
+        }
+    },
+    methods: {
+        open() {
+            this.show = true
+            this.getData();
+        },
+
+        async getData() {
+            try {
+                const { data } = await this.http.post("api/LocationInfo/GetLocationTypes")
+                this.locationTypes = data
+            } catch (e) {
+                this.$message.error('鑾峰彇鍖哄煙绫诲瀷澶辫触')
+            }
+        },
+
+        async submit() {
+            if (!this.form.palletCode) {
+                this.$message.warning('璇疯緭鍏ユ墭鐩樻潯鐮�')
+                return
+            }
+
+            if (!this.form.locationType) {
+                this.$message.warning('璇烽�夋嫨鍏ュ簱鍖哄煙')
+                return
+            }
+
+            try {
+                let param = {
+                    WarehouseCode: this.form.locationType,
+                    PalletCode: this.form.palletCode
+                }
+
+                const { status, message } = await this.http.post(
+                    `/api/InboundOrder/EmptyMaterielGroup`,
+                    param
+                )
+
+                if (status) {
+                    this.$message.success("缁勭洏鎴愬姛")
+                    this.show = false
+                    this.$emit('refresh')
+                } else {
+                    this.$message.error(message || '鎿嶄綔澶辫触')
+                }
+            } catch (error) {
+                this.$message.error('璇锋眰寮傚父')
+            }
+        },
+
+        // 鎵弿鏋紭鍖栧鐞�
+        handleInput(value) {
+            // 杩囨护闈炴暟瀛楀拰鏉$爜甯哥敤瀛楃
+            this.form.palletCode = value.replace(/[^a-zA-Z0-9\-]/g, '')
+        },
+
+        handlePaste(e) {
+            // 绮樿创鏃惰嚜鍔ㄦ彁浜�
+            setTimeout(this.submit, 100)
+        }
+    }
+}
+</script>
+  
+<style scoped>
+.dialog-footer {
+    text-align: right;
+}
+</style>
\ No newline at end of file
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
index 4abb975..335d0cf 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/inboundOrder.js"
@@ -2,11 +2,11 @@
 import http from '@/api/http.js'
 import { h, createVNode, render, reactive, ref } from 'vue';
 import { ElDialog, ElForm, ElFormItem, ElInput, ElButton, ElMessage, ElSelect, ElOption } from 'element-plus'; // 寮曞叆ElMessage锛岃В鍐虫彁绀烘棤鍙嶅簲
-
+import gridHeader from './extend/EmptyTrayInbound.vue'
 let extension = {
   components: {
     //鏌ヨ鐣岄潰鎵╁睍缁勪欢
-    gridHeader: '',
+    gridHeader: gridHeader,
     gridBody: '',
     gridFooter: '',
     //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢
@@ -245,186 +245,194 @@
           }
         }
       },
-      {
-        name: '绌烘墭鐩樺叆搴�',
-        type: 'primary',
-        value: '绌烘墭鐩樺叆搴�',
+      // {
+      //   name: '绌烘墭鐩樺叆搴�',
+      //   type: 'primary',
+      //   value: '绌烘墭鐩樺叆搴�',
 
-        onClick: function () {
-          const mountNode = document.createElement('div');
-          document.body.appendChild(mountNode);
+      //   onClick: function () {
+      //     const mountNode = document.createElement('div');
+      //     document.body.appendChild(mountNode);
 
-          // 鍝嶅簲寮忚〃鍗曟暟鎹細鏂欑鐮侊紙蹇呭~锛屾壂鐮佹灙/鎵嬪姩杈撳叆锛�
-          const formData = reactive({
-            boxCode: '',
-            warehouseCode: ''
-          });
+      //     // 鍝嶅簲寮忚〃鍗曟暟鎹細鏂欑鐮侊紙蹇呭~锛屾壂鐮佹灙/鎵嬪姩杈撳叆锛�
+      //     const formData = reactive({
+      //       boxCode: '',
+      //       warehouseCode: ''
+      //     });
 
-          const warehouses = ref([]);
-          const isLoadingWarehouses = ref(false);
+      //     const warehouses = ref([]);
+      //     const isLoadingWarehouses = ref(false);
 
-          const getWarehouseList = async () => {
-            isLoadingWarehouses.value = true;
-            try {
-              const { data, status } = await http.post('/api/LocationInfo/GetLocationTypes');
-              if (status && Array.isArray(data)) {
-                // 鏍煎紡鍖栦粨搴撻�夐」锛氶�傞厤ElSelect鐨刲abel-value鏍煎紡
-                warehouses.value = data.map(item => ({
-                  label: item.locationTypeDesc,
-                  value: item.locationType
-                }));
-              } else {
-                ElMessage.error('鑾峰彇鍖哄煙鍒楄〃澶辫触');
-                warehouses.value = [];
-              }
-            } catch (err) {
-              ElMessage.error('鍖哄煙鏁版嵁璇锋眰寮傚父锛岃绋嶅悗閲嶈瘯');
-              warehouses.value = [];
-            } finally {
-              isLoadingWarehouses.value = false;
-            }
-          };
+      //     const getWarehouseList = async () => {
+      //       isLoadingWarehouses.value = true;
+      //       try {
+      //         const { data, status } = await http.post('/api/LocationInfo/GetLocationTypes');
+      //         if (status && Array.isArray(data)) {
+      //           // 鏍煎紡鍖栦粨搴撻�夐」锛氶�傞厤ElSelect鐨刲abel-value鏍煎紡
+      //           warehouses.value = data.map(item => ({
+      //             label: item.locationTypeDesc,
+      //             value: item.locationType
+      //           }));
+      //         } else {
+      //           ElMessage.error('鑾峰彇鍖哄煙鍒楄〃澶辫触');
+      //           warehouses.value = [];
+      //         }
+      //       } catch (err) {
+      //         ElMessage.error('鍖哄煙鏁版嵁璇锋眰寮傚父锛岃绋嶅悗閲嶈瘯');
+      //         warehouses.value = [];
+      //       } finally {
+      //         isLoadingWarehouses.value = false;
+      //       }
+      //     };
 
-          // 鎻愪氦琛ㄥ崟鐨勭粺涓�閫昏緫锛堜緵鍥炶溅瑙﹀彂鍜屾寜閽偣鍑诲叡鐢級
-          const submitForm = async () => {
-            const formRef = vnode.component.refs.batchInForm;
-            try {
-              // 鎵ц琛ㄥ崟鏍¢獙锛堟枡绠辩爜蹇呭~锛�
-              await formRef.validate();
-            } catch (err) {
-              ElMessage.warning('璇疯緭鍏ユ湁鏁堢殑鏂欑鐮�');
-              return;
-            }
+      //     // 鎻愪氦琛ㄥ崟鐨勭粺涓�閫昏緫锛堜緵鍥炶溅瑙﹀彂鍜屾寜閽偣鍑诲叡鐢級
+      //     const submitForm = async () => {
+      //       const formRef = vnode.component.refs.batchInForm;
+      //       try {
+      //         // 鎵ц琛ㄥ崟鏍¢獙锛堟枡绠辩爜蹇呭~锛�
+      //         await formRef.validate();
+      //       } catch (err) {
+      //         ElMessage.warning('璇疯緭鍏ユ湁鏁堢殑鏂欑鐮�');
+      //         return;
+      //       }
 
 
-            http.post('/api/InboundOrder/EmptyMaterielGroup', {
-              palletCode: formData.boxCode.trim(),
-              warehouseCode: formData.warehouseCode
-            }).then(({ data, status, message }) => {
-              if (status) {
-                ElMessage.success(`鍏ュ簱鎴愬姛锛屾枡绠辩爜锛�${formData.boxCode.trim()}`);
-                this.refresh();
-                formData.boxCode = '';
+      //       http.post('/api/InboundOrder/EmptyMaterielGroup', {
+      //         palletCode: formData.boxCode.trim(),
+      //         warehouseCode: formData.warehouseCode
+      //       }).then(({ data, status, message }) => {
+      //         if (status) {
+      //           ElMessage.success(`鍏ュ簱鎴愬姛锛屾枡绠辩爜锛�${formData.boxCode.trim()}`);
+      //           this.refresh();
+      //           formData.boxCode = '';
 
-                setTimeout(() => {
-                  const inputRef = vnode.component.refs.boxCodeInput;
-                  inputRef?.focus();
-                }, 100);
-              } else {
-                ElMessage.error(message || data?.message || '鍏ュ簱澶辫触');
-                selectBoxCodeInput();
-              }
-            }).catch(() => {
-              ElMessage.error('璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯');
-              selectBoxCodeInput();
-            });
-          };
+      //           setTimeout(() => {
+      //             const inputRef = vnode.component.refs.boxCodeInput;
+      //             inputRef?.focus();
+      //           }, 100);
+      //         } else {
+      //           ElMessage.error(message || data?.message || '鍏ュ簱澶辫触');
+      //           selectBoxCodeInput();
+      //         }
+      //       }).catch(() => {
+      //         ElMessage.error('璇锋眰澶辫触锛岃绋嶅悗閲嶈瘯');
+      //         selectBoxCodeInput();
+      //       });
+      //     };
 
-          const selectBoxCodeInput = () => {
-            setTimeout(() => {
-              const inputRef = vnode.component.refs.boxCodeInput;
-              if (inputRef) {
-                const targetInput = inputRef.$el?.querySelector('input') || inputRef;
-                targetInput?.focus();
-                targetInput?.select();
-              }
-            }, 100);
-          }
-          const vnode = createVNode(ElDialog, {
-            title: '绌烘墭鐩樺叆搴�',
-            width: '400px',
-            modelValue: true,
-            appendToBody: true,
+      //     const selectBoxCodeInput = () => {
+      //       setTimeout(() => {
+      //         const inputRef = vnode.component.refs.boxCodeInput;
+      //         if (inputRef) {
+      //           const targetInput = inputRef.$el?.querySelector('input') || inputRef;
+      //           targetInput?.focus();
+      //           targetInput?.select();
+      //         }
+      //       }, 100);
+      //     }
+      //     const vnode = createVNode(ElDialog, {
+      //       title: '绌烘墭鐩樺叆搴�',
+      //       width: '400px',
+      //       modelValue: true,
+      //       appendToBody: true,
 
-            onOpened: async () => {
-              await getWarehouseList();
-              const inputRef = vnode.component.refs.boxCodeInput;
-              inputRef?.focus();
-            },
-            'onUpdate:modelValue': (isVisible) => {
-              if (!isVisible) {
-                render(null, mountNode);
-                document.body.removeChild(mountNode);
-              }
-            }
-          }, {
-            default: () => h(ElForm, {
-              model: formData,
-              rules: {
-                boxCode: [
-                  { required: true, message: '璇疯緭鍏ユ枡绠辩爜', trigger: ['blur', 'enter'] }
-                ],
-                warehouseCode: [
-                  { required: true, message: '璇烽�夋嫨鍖哄煙', trigger: ['change', 'blur'] }
-                ]
-              },
-              ref: 'batchInForm'
-            }, [
-              //浠撳簱鏁版嵁
-              h(ElFormItem, { label: '鍖哄煙', prop: 'warehouseCode', required: true }, [
-                h(ElSelect, {
-                  modelValue: formData.warehouseCode,
-                  'onUpdate:modelValue': (val) => {
-                    formData.warehouseCode = val;
-                  },
-                  placeholder: '璇烽�夋嫨鍏ュ簱鍖哄煙',
-                  filterable: true, // 鏀寔鎼滅储浠撳簱
-                  loading: isLoadingWarehouses.value, // 鍔犺浇鐘舵��
-                  style: { width: '100%' }
-                }, [
-                  // 娓叉煋浠撳簱涓嬫媺閫夐」
-                  warehouses.value.map(item => h(ElOption, {
-                    label: item.label,
-                    value: item.value
-                  }))
-                ])
-              ]),
-              // 鏂欑鐮佽緭鍏ラ」锛堟敮鎸佽仛鐒︺�佸洖杞︽彁浜わ級
-              h(ElFormItem, { label: '鏂欑鐮�', prop: 'boxCode', required: true }, [
-                h(ElInput, {
-                  type: 'text',
-                  modelValue: formData.boxCode,
-                  'onUpdate:modelValue': (val) => {
-                    formData.boxCode = val;
-                  },
-                  ref: 'boxCodeInput',
-                  placeholder: '鎵爜杈撳叆鎴栨墜鍔ㄨ緭鍏ユ枡绠辩爜',
-                  // 鐩戝惉鍥炶溅浜嬩欢锛堟壂鐮佹灙榛樿浼氬彂閫佸洖杞︼級
-                  onKeydown: (e) => {
-                    if (e.key === 'Enter') {
-                      e.preventDefault();
-                      submitForm();
-                    }
-                  }
-                })
-              ]),
-              // 搴曢儴鎸夐挳鍖�
-              h('div', { style: { textAlign: 'right', marginTop: '16px' } }, [
-                h(ElButton, {
-                  type: 'text',
-                  onClick: () => {
-                    render(null, mountNode);
-                    document.body.removeChild(mountNode);
-                    ElMessage.info('鍙栨秷鍏ュ簱浠诲姟');
-                  }
-                }, '鍙栨秷'),
-                h(ElButton, {
-                  type: 'primary',
-                  onClick: submitForm
-                }, '纭畾')
-              ])
-            ])
-          });
+      //       onOpened: async () => {
+      //         await getWarehouseList();
+      //         const inputRef = vnode.component.refs.boxCodeInput;
+      //         inputRef?.focus();
+      //       },
+      //       'onUpdate:modelValue': (isVisible) => {
+      //         if (!isVisible) {
+      //           render(null, mountNode);
+      //           document.body.removeChild(mountNode);
+      //         }
+      //       }
+      //     }, {
+      //       default: () => h(ElForm, {
+      //         model: formData,
+      //         rules: {
+      //           boxCode: [
+      //             { required: true, message: '璇疯緭鍏ユ枡绠辩爜', trigger: ['blur', 'enter'] }
+      //           ],
+      //           warehouseCode: [
+      //             { required: true, message: '璇烽�夋嫨鍖哄煙', trigger: ['change', 'blur'] }
+      //           ]
+      //         },
+      //         ref: 'batchInForm'
+      //       }, [
+      //         //浠撳簱鏁版嵁
+      //         h(ElFormItem, { label: '鍖哄煙', prop: 'warehouseCode', required: true }, [
+      //           h(ElSelect, {
+      //             modelValue: formData.warehouseCode,
+      //             'onUpdate:modelValue': (val) => {
+      //               formData.warehouseCode = val;
+      //             },
+      //             placeholder: '璇烽�夋嫨鍏ュ簱鍖哄煙',
+      //             filterable: true, // 鏀寔鎼滅储浠撳簱
+      //             loading: isLoadingWarehouses.value, // 鍔犺浇鐘舵��
+      //             style: { width: '100%' }
+      //           }, [
+      //             // 娓叉煋浠撳簱涓嬫媺閫夐」
+      //             warehouses.value.map(item => h(ElOption, {
+      //               label: item.label,
+      //               value: item.value
+      //             }))
+      //           ])
+      //         ]),
+      //         // 鏂欑鐮佽緭鍏ラ」锛堟敮鎸佽仛鐒︺�佸洖杞︽彁浜わ級
+      //         h(ElFormItem, { label: '鏂欑鐮�', prop: 'boxCode', required: true }, [
+      //           h(ElInput, {
+      //             type: 'text',
+      //             modelValue: formData.boxCode,
+      //             'onUpdate:modelValue': (val) => {
+      //               formData.boxCode = val;
+      //             },
+      //             ref: 'boxCodeInput',
+      //             placeholder: '鎵爜杈撳叆鎴栨墜鍔ㄨ緭鍏ユ枡绠辩爜',
+      //             // 鐩戝惉鍥炶溅浜嬩欢锛堟壂鐮佹灙榛樿浼氬彂閫佸洖杞︼級
+      //             onKeydown: (e) => {
+      //               if (e.key === 'Enter') {
+      //                 e.preventDefault();
+      //                 submitForm();
+      //               }
+      //             }
+      //           })
+      //         ]),
+      //         // 搴曢儴鎸夐挳鍖�
+      //         h('div', { style: { textAlign: 'right', marginTop: '16px' } }, [
+      //           h(ElButton, {
+      //             type: 'text',
+      //             onClick: () => {
+      //               render(null, mountNode);
+      //               document.body.removeChild(mountNode);
+      //               ElMessage.info('鍙栨秷鍏ュ簱浠诲姟');
+      //             }
+      //           }, '鍙栨秷'),
+      //           h(ElButton, {
+      //             type: 'primary',
+      //             onClick: submitForm
+      //           }, '纭畾')
+      //         ])
+      //       ])
+      //     });
 
-          vnode.appContext = this.$.appContext;
-          render(vnode, mountNode);
-        }
-      }
+      //     vnode.appContext = this.$.appContext;
+      //     render(vnode, mountNode);
+      //   }
+      // }
     ], box: [], detail: []
   },
   methods: {
     //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄�
     onInit() {
+      var EmptyTrayInboundBtn = this.buttons.find(x => x.value == "EmptyTrayInbound");
+        if (EmptyTrayInboundBtn != null) {
+          EmptyTrayInboundBtn.onClick = () => {
+               this.$refs.gridHeader.open();
+            }
+        }
+
+
       this.columns.forEach(column => {
         if (column.field === 'orderStatistics') {
           column.formatter = (row) => {
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
index 55a652e..3460293 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/EmptyTrayOutbound.vue"
@@ -1,17 +1,19 @@
 <template>
-  <vol-box v-model="show" title="绌烘墭鍑哄簱" :width="400" :height="600">
+  <vol-box v-model="show" title="绌烘墭鍑哄簱" :width="800" :height="1200">
     <template #content>
       <el-form ref="form" :model="form" label-width="90px">
         <el-form-item label="鍑哄簱鍖哄煙:">
           <el-select v-model="locationType" placeholder="璇烽�夋嫨鍑哄簱鍖哄煙">
-            <el-option v-for="item in locationTypes" :key="item.locationType" :label="item.locationTypeDesc.toString()" :value="item.locationType">
+            <el-option v-for="item in locationTypes" :key="item.locationType" :label="item.locationTypeDesc.toString()"
+              :value="item.locationType">
             </el-option>
           </el-select>
         </el-form-item>
       </el-form>
       <el-form ref="form" :model="form" label-width="90px">
         <el-form-item label="鍑哄簱鏁伴噺:">
-          <el-input-number v-model="num" :min="1" :max="999" :controls="true" placeholder="璇烽�夋嫨鍑哄簱鏁伴噺" style="width: 100%;"></el-input-number>
+          <el-input-number v-model="num" :min="1" :max="999" :controls="true" placeholder="璇烽�夋嫨鍑哄簱鏁伴噺"
+            style="width: 100%;"></el-input-number>
         </el-form-item>
       </el-form>
     </template>
@@ -39,7 +41,7 @@
       num: 1,
       show: false,
       locationTypes: [],
-      locationType:"",
+      locationType: "",
     }
   },
   methods: {
@@ -63,7 +65,7 @@
     },
 
     getData() {
-      this.http.post("api/LocationInfo/GetLocationTypes",null, "鏌ヨ涓�")
+      this.http.post("api/LocationInfo/GetLocationTypes", null, "鏌ヨ涓�")
         .then((x) => {
           this.locationTypes = x.data;
         })

--
Gitblit v1.9.3