修改领料页面
This commit is contained in:
parent
524da0b7e5
commit
79676c33ef
@ -498,6 +498,12 @@ export default {
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
confirmPrintUnclaimedWaveCount: {
|
||||
path: "order.wave.confirmPrintUnclaimedWaveCount",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
wavePickTaskList: {
|
||||
path: "order.wave.wavePickTaskList",
|
||||
auth: true,
|
||||
|
||||
@ -11,7 +11,8 @@ export default function http(
|
||||
data = {},
|
||||
toastBefore = '', // 请求前加载提示
|
||||
toastAfter = true, // 请求后错误提示
|
||||
responseType = 'text'
|
||||
responseType = 'text',
|
||||
timeout = 0 // 自定义请求超时(ms),0 表示使用默认 20s;长轮询接口需传入大于服务端等待时长的值
|
||||
) {
|
||||
let api = getApiPath(url);
|
||||
console.log(api);
|
||||
@ -98,7 +99,8 @@ export default function http(
|
||||
path: api.path,
|
||||
data,
|
||||
method: api.method,
|
||||
responseType
|
||||
responseType,
|
||||
...(timeout ? { timeout } : {})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
4
env.js
4
env.js
@ -1,4 +1,4 @@
|
||||
// export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址
|
||||
export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址
|
||||
export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址
|
||||
// export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址
|
||||
export const API_URL = `${BASE_URL}/system` //后台接口域名
|
||||
export const IMG_URL = 'https://ye4s.file.gzxunren.com' //全局网络图片地址变量,css背景图片地址变量在uni.scss
|
||||
|
||||
@ -30,25 +30,29 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view class="detail-scroll" scroll-y>
|
||||
<!-- 领料信息 -->
|
||||
<view class="claim-info-section">
|
||||
<view class="claim-info-header">
|
||||
<text class="claim-info-header-text">领料信息:</text>
|
||||
</view>
|
||||
<view v-if="claimList.length" class="claim-info-body">
|
||||
<!-- 已打印但未领料的波次数量(固定) -->
|
||||
<view class="unclaimed-wave-count">
|
||||
<text class="unclaimed-wave-count-label">确认打印未领料波次数量:</text>
|
||||
<text class="unclaimed-wave-count-value">{{ unclaimedWaveCount }}</text>
|
||||
</view>
|
||||
<!-- 领料信息:标题固定,波次号列表滚动 -->
|
||||
<view class="claim-info-section">
|
||||
<view class="claim-info-header">
|
||||
<text class="claim-info-header-text">领料信息:</text>
|
||||
</view>
|
||||
<scroll-view v-if="claimList.length" class="claim-info-scroll" scroll-y>
|
||||
<view class="claim-info-body">
|
||||
<view v-for="item in reversedClaimList" :key="item" class="info-row">
|
||||
<text class="info-value">{{ item }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content-placeholder">
|
||||
</scroll-view>
|
||||
<view v-else class="content-placeholder">
|
||||
<u-icon name="file-text" size="86" color="#c0c4cc"></u-icon>
|
||||
<text class="placeholder-text">暂无数据</text>
|
||||
</view>
|
||||
<view class="safe-area-bottom"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="safe-area-bottom"></view>
|
||||
|
||||
<!-- 底部操作栏 -->
|
||||
<view class="claim-footer">
|
||||
@ -76,7 +80,9 @@
|
||||
scanFocused: false,
|
||||
totalQuantity: 0,
|
||||
submitting: false,
|
||||
claimList: []
|
||||
claimList: [],
|
||||
unclaimedWaveCount: 0,
|
||||
unclaimedWavePolling: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -98,12 +104,16 @@
|
||||
onResult: this.onScanData
|
||||
});
|
||||
this.$store.dispatch('broadcast/resume');
|
||||
// 启动「已打印但未领料波次数量」长轮询
|
||||
this.startUnclaimedWavePolling();
|
||||
},
|
||||
onHide() {
|
||||
this.$store.dispatch('broadcast/pause');
|
||||
this.stopUnclaimedWavePolling();
|
||||
},
|
||||
onUnload() {
|
||||
this.$store.dispatch('broadcast/stop');
|
||||
this.stopUnclaimedWavePolling();
|
||||
},
|
||||
methods: {
|
||||
// 广播扫码回调:扫码枪扫描结果
|
||||
@ -199,6 +209,51 @@
|
||||
voice.speak(text, { minInterval: 800 });
|
||||
}
|
||||
},
|
||||
// 「已打印但未领料的波次数量」长轮询(order.wave.confirmPrintUnclaimedWaveCount)
|
||||
// 后端长轮询:不传 last_count 立即返回当前值;传 last_count 后最长等待 60s,变化立即返回
|
||||
startUnclaimedWavePolling() {
|
||||
if (this.unclaimedWavePolling) return;
|
||||
this.unclaimedWavePolling = true;
|
||||
this.pollUnclaimedWaveCount(null);
|
||||
},
|
||||
stopUnclaimedWavePolling() {
|
||||
this.unclaimedWavePolling = false;
|
||||
},
|
||||
async pollUnclaimedWaveCount(lastCount) {
|
||||
if (!this.unclaimedWavePolling) return;
|
||||
let nextCount = lastCount;
|
||||
try {
|
||||
const params = (lastCount === null || lastCount === undefined)
|
||||
? {}
|
||||
: { last_count: lastCount };
|
||||
// 最后一个参数 timeout=70000:后端长轮询最长等待 60s,客户端超时需大于 60s
|
||||
const res = await this.$http(
|
||||
'order.wave.confirmPrintUnclaimedWaveCount',
|
||||
params,
|
||||
'',
|
||||
false,
|
||||
'text',
|
||||
70000
|
||||
);
|
||||
const data = (res && res.data && typeof res.data === 'object' && !Array.isArray(res.data))
|
||||
? res.data
|
||||
: {};
|
||||
const payload = { ...(res || {}), ...data };
|
||||
const count = Number(payload.count);
|
||||
this.unclaimedWaveCount = Number.isFinite(count) ? count : 0;
|
||||
nextCount = this.unclaimedWaveCount;
|
||||
} catch (error) {
|
||||
console.warn('[面单波次领料] 未领料波次数量轮询失败:', error);
|
||||
// 失败后延迟 2s 重试(沿用原 last_count 基线)
|
||||
await this.sleep(2000);
|
||||
}
|
||||
if (this.unclaimedWavePolling) {
|
||||
this.pollUnclaimedWaveCount(nextCount);
|
||||
}
|
||||
},
|
||||
sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
},
|
||||
handleCameraScan() {
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
@ -230,17 +285,13 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.detail-scroll {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.content-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-top: 200rpx;
|
||||
flex: 1;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.placeholder-text {
|
||||
@ -249,8 +300,37 @@
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
/* ===== 已打印未领料波次数 ===== */
|
||||
.unclaimed-wave-count {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
margin: 20rpx 24rpx 0;
|
||||
padding: 24rpx;
|
||||
background: #FFE7BA;
|
||||
border-radius: 12rpx;
|
||||
|
||||
.unclaimed-wave-count-label {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #D46B08;
|
||||
}
|
||||
|
||||
.unclaimed-wave-count-value {
|
||||
margin-left: 12rpx;
|
||||
font-size: 48rpx;
|
||||
line-height: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #D46B08;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== 领料信息 ===== */
|
||||
.claim-info-section {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
margin: 20rpx 24rpx 0;
|
||||
border-radius: 12rpx;
|
||||
@ -258,15 +338,20 @@
|
||||
|
||||
.claim-info-header {
|
||||
padding: 24rpx;
|
||||
background-color: #ffedd5;
|
||||
background-color: #D9F7BE;
|
||||
|
||||
.claim-info-header-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
color: #389E0D;
|
||||
}
|
||||
}
|
||||
|
||||
.claim-info-scroll {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.claim-info-body {
|
||||
.info-row {
|
||||
display: flex;
|
||||
@ -361,7 +446,7 @@
|
||||
.claim-footer-total-value {
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
color: #fa8c16;
|
||||
color: #389E0D;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="Permissions-Policy" content="unload=(self)">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="https://cdn.uviewui.com/uview/common/favicon.webp">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<title>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user