liuyanpeng 5 місяців тому
батько
коміт
5865261ca5

+ 5 - 0
public/index.html

@@ -24,6 +24,11 @@
             type="text/javascript"
             src="/android-device-sdk/SoundPlayApi.js"
         ></script>
+        <script
+            nonce="*NONCE_TOKEN*"
+            type="text/javascript"
+            src="/android-device-sdk/GateConfigApi.js"
+        ></script>
     </head>
     <body>
         <div id="app"></div>

+ 8 - 8
src/api/stockIn.js

@@ -1,11 +1,11 @@
 import request  from '../util/request.js';
 
 // 闸机外侧扫描查询工装设备信息
-export function cfStockIn() {
-    const warehouseId = localStorage.getItem('#warehouseId');
+export function cfStockIn(params) {
     return request({
-        url: '/api/stockInResource/queryInventoryByEPC?warehouseId=' + warehouseId,
-        method: 'get',
+        url: '/api/stockInResource/queryInventoryByEPC',
+        method: 'post',
+        data: params,
     });
 }
 
@@ -19,11 +19,11 @@ export function createStockIn(params) {
 }
 
 // 闸机内侧扫描查询工装设备信息
-export function cfStockInLeave() {
-    const warehouseId = localStorage.getItem('#warehouseId');
+export function cfStockInLeave(params) {
     return request({
-        url: '/api/stockInResource/validationInsideTurnstile?warehouseId=' + warehouseId,
-        method: 'get',
+        url: '/api/stockInResource/validationInsideTurnstile',
+        method: 'post',
+        data: params,
     });
 }
 

+ 4 - 4
src/api/stockOut.js

@@ -86,11 +86,11 @@ export function createStockOut(params) {
 }
 
 // 闸机内侧人工领料出库验证工装设备是否一致
-export function cfStockOut() {
-    const warehouseId = localStorage.getItem('#warehouseId');
+export function cfStockOut(params) {
     return request({
-        url: '/api/StockOutResource/verificationCFStockOut?warehouseId=' + warehouseId,
-        method: 'get',
+        url: '/api/StockOutResource/verificationCFStockOut',
+        method: 'post',
+        data: params,
     });
 }
 

+ 22 - 7
src/common/utils.js

@@ -1,10 +1,25 @@
 // 防抖函数
 export const debounce = (fn, wait = 1000) => {
-  let timer;
-  return function (...args) {
-    clearTimeout(timer);
-    timer = setTimeout(() => {
-      fn.call(this, args);
-    }, wait);
-  };
+    let timer;
+    return function (...args) {
+        clearTimeout(timer);
+        timer = setTimeout(() => {
+            fn.call(this, args);
+        }, wait);
+    };
+};
+
+// 深度判断两个数组是否相等(不考虑索引位置)
+export const areArraysEqual = (arr1, arr2) => {
+    // 如果数组长度不同,直接返回false
+    if (arr1.length !== arr2.length) {
+        return false;
+    }
+    
+    // 创建两个数组的副本进行排序
+    const sortedArr1 = [...arr1].sort();
+    const sortedArr2 = [...arr2].sort();
+    
+    // 逐个比较排序后的数组元素
+    return sortedArr1.every((element, index) => element === sortedArr2[index]);
 };

+ 3 - 3
src/finishProduct/FinishProductIn.vue

@@ -55,7 +55,7 @@
                 <span class="info-value">{{ product.inventoryName || '-' }}</span>
               </div>
               <div class="info-row">
-                <span class="info-label">号:</span>
+                <span class="info-label">号:</span>
                 <span class="info-value">{{ product.inventoryNo || '-' }}</span>
               </div>
               <div class="info-row location-row">
@@ -98,8 +98,8 @@
             <input v-model="newProduct.inventoryName" type="text" placeholder="请输入成品名称" />
           </div>
           <div class="form-item">
-            <label>成品号</label>
-            <input v-model="newProduct.inventoryNo" type="text" placeholder="请输入成品号" />
+            <label>成品号</label>
+            <input v-model="newProduct.inventoryNo" type="text" placeholder="请输入成品号" />
           </div>
           <div class="form-item">
             <label>货位选择</label>

+ 5 - 5
src/finishProduct/FinishProductOut.vue

@@ -28,7 +28,7 @@
           <div class="filter-item">
             <label class="filter-label">编号</label>
             <input
-              v-model="searchForm.inventoryNo" type="text" placeholder="输入编号"
+              v-model="searchForm.inventoryDrawNo" type="text" placeholder="输入编号"
               class="filter-input dark-input" @keyup.enter="handleSearch"
             />
           </div>
@@ -92,8 +92,8 @@
                 <span class="info-value">{{ product.inventoryName || '-' }}</span>
               </div>
               <div class="info-row">
-                <span class="info-label">号:</span>
-                <span class="info-value">{{ product.inventoryNo || '-' }}</span>
+                <span class="info-label">号:</span>
+                <span class="info-value">{{ product.inventoryDrawNo || '-' }}</span>
               </div>
               <div class="info-row location-row">
                 <i class="fas fa-map-marker-alt location-icon" />
@@ -196,7 +196,7 @@ const warehouseList = ref([]);
 // 筛选表单
 const searchForm = ref({
     inventoryName: '',
-    inventoryNo: '',
+    inventoryDrawNo: '',
     // warehouseId: undefined,
 });
 
@@ -296,7 +296,7 @@ const handleReset = () => {
     searchForm.value = {
         warehouseId: undefined,
         inventoryName: '',
-        inventoryNo: '',
+        inventoryDrawNo: '',
     };
     getList();
 };

+ 1 - 1
src/router/routes.js

@@ -47,7 +47,7 @@ const FeedingArea = () => import('../box/FeedingArea.vue');
 const ControlGate = () => import('../gate/ControlGate.vue');
 
 const routes = [
-    { path: '/', redirect: '/login' },
+    { path: '/', redirect: '/fingerprint-login' },
     { path: '/login', component: UserLogin, meta: { title: '用户登录' } },
     { path: '/home', component: UserHome, meta: { title: '首页' } },
     { path: '/order-picking', component: OrderPicking, meta: { title: '拣货管理' } },

+ 34 - 3
src/stock-in/InConfirm.vue

@@ -103,8 +103,9 @@
 <script setup>
 import { useRouter } from 'vue-router';
 import { showNotify } from 'vant';
-import { ref,reactive, onMounted, computed } from 'vue';
+import { ref,reactive, onMounted, computed, onUnmounted } from 'vue';
 import { cfStockIn, createStockIn } from '../api/stockIn.js';
+import { areArraysEqual } from '../common/utils.js';
 
 // 图片资源
 import bgImg from '../assets/images/bj.png';
@@ -121,6 +122,7 @@ const loading = ref(false);
 
 // 物料列表数据
 const materialList = ref([]);
+const epcs = ref([]);
 
 // 分页配置
 const pagination = reactive({
@@ -197,7 +199,11 @@ const getList = async () => {
     loading.value = true;
     try {
 
-        const res = await cfStockIn();
+        const params = {
+            epcList: epcs.value,
+        };
+
+        const res = await cfStockIn(params);
 
         if (res.errorCode === 0) {
             if (res.datas && res.datas.length > 0) {
@@ -238,8 +244,33 @@ const generateCFStockIn = async params => {
     }
 };
 
-onMounted(() => {
+const addEpc = data => {
+    const newEpcs = data.map(item => item.epc);
+    
+    // 深度判断新数据与当前epcs是否相等
+    if (areArraysEqual(newEpcs, epcs.value)) {
+        return; // 如果相等,直接返回,不执行后续操作
+    }
+    
+    // 如果不相等,则更新epcs并获取列表
+    epcs.value = [];
+    epcs.value = newEpcs;
     getList();
+};
+
+onMounted(() => {
+    // getList();
+    plugin.gateConfig.sendEpc = function(data){
+        if (typeof(GATE_CONFIG) == 'undefined') {
+            console.log('设备不支持读写器功能。');
+        } else {
+            addEpc(data);
+        }
+    };
+});
+
+onUnmounted(() => {
+    plugin.gateConfig.sendEpc = null;
 });
 </script>
 

+ 31 - 2
src/stock-in/ReturnedLeave.vue

@@ -103,8 +103,9 @@
 <script setup>
 import { useRouter } from 'vue-router';
 import { showNotify } from 'vant';
-import { ref, onMounted, computed } from 'vue';
+import { ref, onMounted, computed, onUnmounted } from 'vue';
 import { queryCFStockInByUser, backfillCFStockInTime, cfStockInLeave } from '../api/stockIn.js';
+import { areArraysEqual } from '../common/utils.js';
 
 // 图片资源
 import bgImg from '../assets/images/bj.png';
@@ -129,6 +130,7 @@ const inList = ref([]);
 
 // 校验列表
 const validateList = ref([]);
+const epcs = ref([]);
 
 // 是否可以还料离开
 const notInStockCount = computed(() => {
@@ -209,8 +211,11 @@ const getCFStockInByUser = async () => {
 // 获取物料列表(内侧校验)
 const getInnerList = async () => {
     loading.value = true;
+    const params = {
+        epcList: epcs.value,
+    };
     try {
-        const res = await cfStockInLeave();
+        const res = await cfStockInLeave(params);
 
         if (res.errorCode === 0) {
             isCanLeave.value = true;
@@ -256,9 +261,33 @@ const generateCFStockIn = async params => {
     }
 };
 
+const addEpc = data => {
+    const newEpcs = data.map(item => item.epc);
+    
+    // 深度判断新数据与当前epcs是否相等
+    if (areArraysEqual(newEpcs, epcs.value)) {
+        return; // 如果相等,直接返回,不执行后续操作
+    }
+    
+    // 如果不相等,则更新epcs并获取用户数据
+    epcs.value = [];
+    epcs.value = newEpcs;
+    getCFStockInByUser();
+};
 
 onMounted(() => {
     getCFStockInByUser();
+    plugin.gateConfig.sendEpc = function(data){
+        if (typeof(GATE_CONFIG) == 'undefined') {
+            console.log('设备不支持读写器功能。');
+        } else {
+            addEpc(data);
+        }
+    };
+});
+
+onUnmounted(() => {
+    plugin.gateConfig.sendEpc = null;
 });
 </script>
 

+ 33 - 4
src/stock-out/OutboundConfirm.vue

@@ -114,9 +114,10 @@
 
 <script setup>
 import { useRouter } from 'vue-router';
-import { ref, computed, onMounted } from 'vue';
+import { ref, computed, onMounted, onUnmounted } from 'vue';
 import { showNotify } from 'vant';
 import { cfStockOut, createStockOut, cfStockOutLeave,leaveCFWarehouse } from '../api/stockOut.js';
+import { areArraysEqual } from '../common/utils.js';
 
 // 图片资源
 import bgImg from '../assets/images/bj.png';
@@ -137,6 +138,7 @@ const loading = ref(false);
 
 // 物料列表数据
 const materialList = ref([]);
+const epcs = ref([]);
 
 // 完成数量统计
 const completedCount = computed(() => {
@@ -239,9 +241,11 @@ const handleLeave = async () => {
 // 获取扫描到的领料数据
 const getStockOutList = async (isOne = false) => {
     loading.value = true;
-
+    const params = {
+        epcList: epcs.value,
+    };
     try {
-        const res = await cfStockOut();
+        const res = await cfStockOut(params);
 
         if (res.errorCode === 0) {
             if (res.datas && res.datas.length > 0) {
@@ -301,8 +305,33 @@ const generateCFStockOut = async id => {
     }
 };
 
-onMounted(() => {
+const addEpc = data => {
+    const newEpcs = data.map(item => item.epc);
+    
+    // 深度判断新数据与当前epcs是否相等
+    if (areArraysEqual(newEpcs, epcs.value)) {
+        return; // 如果相等,直接返回,不执行后续操作
+    }
+    
+    // 如果不相等,则更新epcs并获取出库列表
+    epcs.value = [];
+    epcs.value = newEpcs;
     getStockOutList(false);
+};
+
+onMounted(() => {
+    // getStockOutList(false);
+    plugin.gateConfig.sendEpc = function(data){
+        if (typeof(GATE_CONFIG) == 'undefined') {
+            console.log('设备不支持读写器功能。');
+        } else {
+            addEpc(data);
+        }
+    };
+});
+
+onUnmounted(() => {
+    plugin.gateConfig.sendEpc = null;
 });
 </script>