|
|
@@ -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>
|
|
|
|