Merge remote-tracking branch 'origin/master'

This commit is contained in:
liuhanqing
2025-11-07 16:14:33 +08:00
10 changed files with 233 additions and 204 deletions

View File

@@ -17,63 +17,65 @@
this.updateTabBarText()
})
},
onShow: function() {
// 检查应用状态,确保从后台恢复时状态一致
this.checkAppState()
},
// onShow: function() {
// // 检查应用状态,确保从后台恢复时状态一致
// this.checkAppState()
// },
onDestroy() {
// 移除事件监听器
uni.$off('languageChanged')
},
methods: {
// 初始化应用
initApp() {
// 初始化应用配置
this.initConfig()
// 检查用户登录状态
//#ifdef H5
this.checkLogin()
//#endif
},
initConfig() {
this.globalData.config = config
},
checkLogin() {
if (!getToken()) {
this.$tab.reLaunch('/pages/login')
}
},
checkAppState() {
// 检查Token状态和页面导航栈状态
console.log('应用从后台切换到前台,检查应用状态')
initApp() {
// 初始化应用配置
this.initConfig()
// 检查用户登录状态
//#ifdef H5
this.checkLogin()
//#endif
},
initConfig() {
this.globalData.config = config
},
checkLogin() {
if (!getToken()) {
console.log('checkLogin 检查登录状态,token不存在')
this.$tab.reLaunch('/pages/login')
}
},
// checkAppState() {
// // 检查Token状态和页面导航栈状态
// console.log('应用从后台切换到前台,检查应用状态')
// 获取当前页面路径,判断是否在登录页
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const currentPagePath = currentPage ? currentPage.route : ''
// // 获取当前页面路径,判断是否在登录页
// const pages = getCurrentPages()
// const currentPage = pages[pages.length - 1]
// const currentPagePath = currentPage ? currentPage.route : ''
// 如果当前页面是登录页,则不检查token
if (currentPagePath === 'pages/login') {
console.log('当前已在登录页面,不进行token检查')
return
}
// // 如果当前页面是登录页,则不检查token
// if (currentPagePath === 'pages/login') {
// console.log('当前已在登录页面,不进行token检查')
// return
// }
// 检查Token状态
if (!getToken()) {
console.log('Token不存在,提示并跳转到登录页')
uni.showToast({
icon: 'none',
title: '登录已过期,请重新登录'
})
setTimeout(() => {
uni.reLaunch({ url: '/pages/login' })
}, 1500)
} else {
console.log('Token存在,不做操作')
}
// // 检查Token状态
// if (!getToken()) {
// console.log('Token不存在,提示并跳转到登录页')
// uni.showToast({
// icon: 'none',
// title: '登录已过期,请重新登录'
// })
// setTimeout(() => {
// uni.reLaunch({ url: '/pages/login' })
// }, 1500)
// } else {
// console.log('Token存在,不做操作')
// }
},
// },
updateTabBarText() {
// 使用 nextTick 确保 DOM 更新完成
this.$nextTick(() => {

View File

@@ -352,7 +352,10 @@
"outboundSuccess": "Outbound confirmation successful",
"outboundFailed": "Outbound confirmation failed",
"trayInfoNotFound": "No related pallet information found",
"getTrayInfoFailed": "Failed to get pallet information"
"getTrayInfoFailed": "Failed to get pallet information",
"exit": "Exit",
"exitPlaceholder": "Please select exit",
"selectExit": "Please select exit"
},
"bindShelf": {
"title": "Bind Shelf",

View File

@@ -353,7 +353,10 @@
"outboundSuccess": "出库确认成功",
"outboundFailed": "出库确认失败",
"trayInfoNotFound": "未找到相关托盘信息",
"getTrayInfoFailed": "获取托盘信息失败"
"getTrayInfoFailed": "获取托盘信息失败",
"exit": "出口",
"exitPlaceholder": "请选择出口",
"selectExit": "请选择出口"
},
"bindShelf": {
"title": "绑定料架",

View File

@@ -1,19 +1,29 @@
<template>
<view class="container">
<view class="input-group">
<uni-easyinput
v-model="trayCode"
:placeholder="$t('outbound.ckMakeSureByTray.trayCodePlaceholder')"
:clearable="true"
@input="handleInput"
@clear="handleClear"
ref="trayCodeInput"
>
<template #right>
<text class="scan-icon" @click="handleScan">📷</text>
</template>
</uni-easyinput>
</view>
<view class="input-group">
<uni-easyinput
v-model="trayCode"
:placeholder="$t('outbound.ckMakeSureByTray.trayCodePlaceholder')"
:clearable="true"
@input="handleInput"
@clear="handleClear"
ref="trayCodeInput"
>
<template #right>
<text class="scan-icon" @click="handleScan">📷</text>
</template>
</uni-easyinput>
</view>
<!-- 条件显示出口下拉框 -->
<view class="select-group" v-if="showEntrySelect">
<view class="select-label">{{ $t('outbound.ckMakeSureByTray.exit') }}</view>
<uni-data-select
v-model="selectedEntry"
:localdata="entryOptions"
:placeholder=" $t('outbound.ckMakeSureByTray.exitPlaceholder')"
></uni-data-select>
</view>
<view class="loading-container" v-if="loading">
<uni-load-more status="loading" :content-text="{contentdown: $t('outbound.ckMakeSureByTray.loading'),contentrefresh: $t('outbound.ckMakeSureByTray.loading'),contentnomore: $t('outbound.ckMakeSureByTray.noMoreData')}"></uni-load-more>
@@ -69,19 +79,48 @@
return {
trayCode: '',
materialList: [],
loading: false
loading: false,
showEntrySelect: false,
entryOptions: [],
selectedEntry: ''
}
},
methods: {
// 处理输入事件
handleInput(value) {
async handleInput(value) {
if (value) {
this.fetchTrayInfo(value)
await this.fetchTrayInfo(value)
const first = this.materialList && this.materialList.length > 0 ? this.materialList[0] : null
if (first && (first.warehouseId === '02' || first.warehouseId === '13')) {
this.showEntrySelect = true
if (first.warehouseId === '02') {
this.entryOptions = [
{ text: 'G1001', value: 'G1001' },
{ text: 'G1007', value: 'G1007' }
]
} else {
this.entryOptions = [
{ text: 'G4004', value: 'G4004' },
{ text: 'G4005', value: 'G4005' },
{ text: 'G4006', value: 'G4006' },
{ text: 'G5004', value: 'G5004' },
{ text: 'G5005', value: 'G5005' },
{ text: 'G5006', value: 'G5006' }
]
}
} else {
this.showEntrySelect = false
this.entryOptions = []
this.selectedEntry = ''
}
}
},
// 处理清除事件
handleClear() {
this.materialList = []
this.showEntrySelect = false
this.entryOptions = []
this.selectedEntry = ''
},
// 处理扫码事件
handleScan() {
@@ -131,10 +170,20 @@
})
return
}
// 当入口下拉框显示时,校验是否选择了入口
if (this.showEntrySelect && !this.selectedEntry) {
uni.showToast({
title: this.$t('outbound.ckMakeSureByTray.selectExit'),
icon: 'none'
})
return
}
try {
const response=await ckMakeSure({
trayCode: this.trayCode
trayCode: this.trayCode,
exitId: this.selectedEntry
})
if (response.code==200) {
@@ -145,14 +194,17 @@
// 清空数据
this.trayCode = ''
this.materialList = []
this.showEntrySelect = false
this.entryOptions = []
this.selectedEntry = ''
}else{
uni.showToast({
title: response.msg,
icon: 'none'
})
}
} catch (error) {
uni.showToast({
title: this.$t('outbound.ckMakeSureByTray.outboundFailed'),
@@ -178,6 +230,19 @@
margin-bottom: 30rpx;
}
.select-group {
background-color: #fff;
border-radius: 16rpx;
padding: 20rpx;
margin-bottom: 30rpx;
}
.select-label {
font-size: 28rpx;
color: #666;
margin-bottom: 16rpx;
}
.scan-icon {
font-size: 40rpx;
padding: 0 20rpx;

View File

@@ -12,8 +12,18 @@
<template #right>
<text class="scan-icon" @click="handleScan">📷</text>
</template>
</uni-easyinput>
</view>
</uni-easyinput>
</view>
<!-- 条件显示出口下拉框 -->
<view class="select-group" v-if="showExitSelect">
<view class="select-label">出口</view>
<uni-data-select
v-model="selectedExit"
:localdata="exitOptions"
placeholder="请选择出口"
></uni-data-select>
</view>
<view class="materials-list" v-if="materialList.length > 0">
<button class="add-button" @click="showAddMaterialPopup">{{ $t('stocktaking.confirm.addMaterial') }}</button>
@@ -79,7 +89,11 @@
newMaterial: {
productId: '',
inQuantity: ''
}
},
// 出口选择
showExitSelect: false,
exitOptions: [],
selectedExit: ''
}
},
methods: {
@@ -92,6 +106,9 @@
// 处理清除事件
handleClear() {
this.materialList = []
this.showExitSelect = false
this.exitOptions = []
this.selectedExit = ''
},
// 处理扫码事件
handleScan() {
@@ -110,6 +127,31 @@
...item,
countQuantity: item.outQuantity
}))
// 根据首条物料的仓库,决定是否显示出口选择
const first = this.materialList && this.materialList.length > 0 ? this.materialList[0] : null
if (first && (first.warehouseId === '02' || first.warehouseId === '13')) {
this.showExitSelect = true
if (first.warehouseId === '02') {
this.exitOptions = [
{ text: 'G1001', value: 'G1001' },
{ text: 'G1007', value: 'G1007' }
]
} else {
this.exitOptions = [
{ text: 'G4004', value: 'G4004' },
{ text: 'G4005', value: 'G4005' },
{ text: 'G4006', value: 'G4006' },
{ text: 'G5004', value: 'G5004' },
{ text: 'G5005', value: 'G5005' },
{ text: 'G5006', value: 'G5006' }
]
}
} else {
this.showExitSelect = false
this.exitOptions = []
this.selectedExit = ''
}
} catch (error) {
uni.showToast({
title: this.$t('stocktaking.confirm.getTrayInfoFailed'),
@@ -158,8 +200,17 @@
// 确认盘点
async handleConfirm() {
try {
// 出口显示时必须选择
if (this.showExitSelect && !this.selectedExit) {
uni.showToast({
title: '请选择出口',
icon: 'none'
})
return
}
const data = {
trayCode: this.trayCode,
exitId: this.selectedExit,
materials: this.materialList.map(item => ({
stockId: item.stockId,
productId:item.productId,
@@ -173,10 +224,13 @@
uni.showToast({
title: this.$t('stocktaking.confirm.stocktakingSuccess'),
icon: 'success'
})
})
// 清空数据
this.trayCode = ''
this.materialList = []
this.showExitSelect = false
this.exitOptions = []
this.selectedExit = ''
}
@@ -213,6 +267,19 @@
}
}
.select-group {
background-color: #fff;
border-radius: 16rpx;
padding: 20rpx;
margin-bottom: 30rpx;
}
.select-label {
font-size: 28rpx;
color: #666;
margin-bottom: 16rpx;
}
.scan-icon {
font-size: 40rpx;
padding: 0 20rpx;

View File

@@ -3,165 +3,39 @@ import { getToken } from '@/utils/auth'
// 登录页面
const loginPage = "/pages/login"
// 首页
const indexPage = "/pages/index"
// 标记是否由navigateBack触发的reLaunch
let isNavigateBackTriggered = false
// 获取当前页面路径
function getCurrentPageUrl() {
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
console.log("当前页面",currentPage.route)
console.log("上一层页面", pages[pages.length - 2].route)
return currentPage ? currentPage.route : ''
}
// 页面白名单
const whiteList = [
'/pages/login', '/pages/register', '/pages/common/webview/index','/pages/setting'
]
// 检查地址白名单
function checkWhite(url) {
// 确保url以/开头
const normalizedUrl = url.startsWith('/') ? url : '/' + url
const path = normalizedUrl.split('?')[0]
const path = url.split('?')[0]
return whiteList.indexOf(path) !== -1
}
// 页面跳转验证拦截器
let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"]
list.forEach(item => {
uni.addInterceptor(item, {
invoke(to) {
console.log(`${item} 拦截器被触发,目标页面:`, to.url)
console.log('当前 Token 状态:', getToken() ? '存在' : '不存在')
// 如果是由navigateBack触发的reLaunch,直接放行
if (item === 'reLaunch' && isNavigateBackTriggered) {
console.log('由navigateBack触发的reLaunch,直接放行')
return true
}
if (getToken()) {
console.log('Token 存在,检查是否为登录页面')
if (to.url === loginPage) {
console.log('当前为登录页面,重定向到首页')
uni.reLaunch({ url: "/" })
}
return true
} else {
console.log('Token 不存在,检查是否在白名单中')
if (checkWhite(to.url)) {
console.log('目标页面在白名单中,允许访问')
return true
}
console.log('页面不在白名单中,准备跳转到登录页')
uni.showToast({
icon: 'none',
title: '登录已过期,请重新登录'
})
setTimeout(() => {
console.log('执行跳转到登录页')
uni.reLaunch({ url: loginPage })
}, 1500)
uni.reLaunch({ url: loginPage })
return false
}
},
fail(err) {
console.error(err)
console.log(err)
}
})
})
// 单独处理返回按钮操作
uni.addInterceptor('navigateBack', {
invoke(e) {
console.log('navigateBack 拦截器被触发', e)
console.log('当前 Token 状态:', getToken() ? '存在' : '不存在')
// 获取当前页面栈
const pages = getCurrentPages()
// 检查页面导航栈是否为空
if (pages.length <= 1) {
console.log('页面导航栈为空或只有一个页面,无法正常返回')
// 检查Token状态
if (getToken()) {
console.log('Token存在,跳转到首页')
// 设置标志,表明当前的reLaunch是由navigateBack触发的
isNavigateBackTriggered = true
uni.reLaunch({ url: indexPage })
// 重置标志
setTimeout(() => {
isNavigateBackTriggered = false
}, 100)
} else {
console.log('Token不存在,跳转到登录页')
uni.showToast({
icon: 'none',
title: '登录已过期,请重新登录'
})
// 设置标志,表明当前的reLaunch是由navigateBack触发的
isNavigateBackTriggered = true
setTimeout(() => {
console.log('执行跳转到登录页')
uni.reLaunch({ url: loginPage })
// 重置标志
setTimeout(() => {
isNavigateBackTriggered = false
}, 100)
}, 1500)
}
return false
}
// 页面导航栈不为空,检查Token状态
if (!getToken()) {
const currentPage = getCurrentPageUrl()
console.log('当前页面路径:', currentPage)
// 确保currentPage不为空且有内容
if (currentPage && currentPage.trim() && checkWhite(currentPage)) {
console.log('当前页面在白名单中,允许返回')
return true
}
console.log('Token不存在且页面不在白名单中,准备跳转到登录页')
uni.showToast({
icon: 'none',
title: '登录已过期,请重新登录'
})
// 设置标志,表明当前的reLaunch是由navigateBack触发的
isNavigateBackTriggered = true
setTimeout(() => {
console.log('执行跳转到登录页')
uni.reLaunch({ url: loginPage })
// 重置标志
setTimeout(() => {
isNavigateBackTriggered = false
}, 100)
}, 1500)
return false
}
// Token存在且页面导航栈不为空,允许正常返回
const currentPage = pages[pages.length - 1]
console.log("当前页面:", currentPage.route)
if (pages.length > 1) {
console.log("上一层页面:", pages[pages.length - 2].route)
}
console.log('Token存在,允许正常返回')
return true
},
fail(err) {
console.error('navigateBack 拦截器执行失败:', err)
}
})
})

View File

@@ -128,6 +128,16 @@ public class MydoJobDetail extends BaseEntity
private String pickQuantityReal;
//绑定容器物品数量
private String pickBindQuantity;
private String warehouseId;
public String getWarehouseId() {
return warehouseId;
}
public void setWarehouseId(String warehouseId) {
this.warehouseId = warehouseId;
}
public String getPickBindQuantity() {
return pickBindQuantity;

View File

@@ -388,6 +388,7 @@ public class PdaServiceImp implements PdaService {
HashMap<String, Object> map = new HashMap<>();
map.put("v_tray_code", trayCodeMakeSure.getTrayCode());
map.put("v_entrance_id",trayCodeMakeSure.getExitId());
map.put("v_type", "1");
pdaMapper.outMakeSure(map);
//iToWcsService.pushInMydoJob();

View File

@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="jobDetailId" column="job_detail_id" />
<result property="jobId" column="job_id" />
<result property="stockId" column="stock_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="lotNo" column="lot_no" />
<result property="inDate" column="in_date" />
<result property="inOrOutId" column="in_or_out_id" />
@@ -75,10 +76,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mjd.pick_quantity,
mjd.out_quantity-mjd.pick_quantity as pick_quantity_real,
bp.product_name, bp.spare1 as englishDesc,
bp.spare2 as netWeight,bp.spare5 as length,bp.spare6 as width,bp.spare7 as height,bp.spare8 as volume
bp.spare2 as netWeight,bp.spare5 as length,bp.spare6 as width,bp.spare7 as height,bp.spare8 as volume,
mj.warehouse_id
from mydo_job_detail mjd
left join bas_product bp on mjd.product_id = bp.product_id
left join mydo_job mj on mjd.job_id = mj.job_id
</sql>

View File

@@ -7,6 +7,7 @@
{call proc_out_makesure(
#{v_tray_code,mode=IN,jdbcType=VARCHAR},
#{v_type,mode=IN,jdbcType=VARCHAR},
#{v_entrance_id,mode=IN,jdbcType=VARCHAR},
#{v_result,mode=OUT,jdbcType=INTEGER},
#{v_resultmsg,mode=OUT,jdbcType=VARCHAR}
)}