From 7f686a5ea018786809135b5f970be114f815165e Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期四, 05 二月 2026 12:55:25 +0800
Subject: [PATCH] 组托优化
---
pages/listing/matnrPalletising.vue | 171 +++++++++++++++++++++++----------
package-lock.json | 2
pages/login/index.vue | 87 ++++++++++++++++
manifest.json | 5
common/request.js | 6 +
uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue | 22 +++
6 files changed, 230 insertions(+), 63 deletions(-)
diff --git a/common/request.js b/common/request.js
index b3842e2..5711352 100644
--- a/common/request.js
+++ b/common/request.js
@@ -15,7 +15,11 @@
return new Promise((resolve, reject) => {
const token = uni.getStorageSync('token');
// const URL = 'http://192.168.4.34:8085/rsf-server/pda' + url;
- const URL = 'http://127.0.0.1:8085/rsf-server/pda' + url;
+ let baseUrl = uni.getStorageSync('baseUrl');
+ if (!baseUrl) {
+ baseUrl = 'http://127.0.0.1:8085/rsf-server/pda';
+ }
+ const URL = baseUrl+'/pda' + url;
uni.request({
url: URL,
data: postData,
diff --git a/manifest.json b/manifest.json
index d03f340..7529272 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,6 +1,6 @@
{
"name" : "涓壃wms",
- "appid" : "__UNI__AE0F207",
+ "appid" : "__UNI__26FF7F0",
"description" : "",
"versionName" : "20250613",
"versionCode" : 100,
@@ -113,5 +113,6 @@
"devServer" : {
"port" : 8133
}
- }
+ },
+ "fallbackLocale" : "zh-Hans"
}
diff --git a/package-lock.json b/package-lock.json
index 36e6485..e5070dd 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "pda-master",
+ "name": "pda-jdxaj",
"lockfileVersion": 3,
"requires": true,
"packages": {
diff --git a/pages/listing/matnrPalletising.vue b/pages/listing/matnrPalletising.vue
index 8f9ed48..7148980 100644
--- a/pages/listing/matnrPalletising.vue
+++ b/pages/listing/matnrPalletising.vue
@@ -9,16 +9,16 @@
</view>
<view class="cu-form-group">
<view class="title">鐗╂枡缂栫爜</view>
- <input placeholder="璇锋壂鎻忕墿鏂欑紪鐮�" v-model="matnrCode"></input>
+ <input placeholder="璇锋壂鎻忕墿鏂欑紪鐮�" v-model="matnrCode" @input="onMatnrCodeInput" @confirm="search"></input>
<text class='cuIcon-search text-blue' @click="search"></text>
</view>
- <view class="cu-form-group">
- <view class="title">绁ㄥ彿</view>
- <input placeholder="璇锋壂鎻忕幇鍝佺エ鍙�" v-model="fieldsIndex" @input="search()" focus></input>
- <text class='cuIcon-close text-gray margin-right-xs' v-show="fieldsIndex!==''"
- @click="clearCode"></text>
- <!-- <text class='cuIcon-search text-blue' @click="search"></text> -->
- </view>
+<!-- <view class="cu-form-group">-->
+<!-- <view class="title">绁ㄥ彿</view>-->
+<!-- <input placeholder="璇锋壂鎻忕幇鍝佺エ鍙�" v-model="fieldsIndex" @input="search()" focus></input>-->
+<!-- <text class='cuIcon-close text-gray margin-right-xs' v-show="fieldsIndex!==''"-->
+<!-- @click="clearCode"></text>-->
+<!-- <!– <text class='cuIcon-search text-blue' @click="search"></text> –>-->
+<!-- </view>-->
<view class="cu-form-group">
<view class="title">ASN鍗曞彿</view>
<input placeholder="璇疯緭鍏SN鍗曞彿" v-model="asnCode"></input>
@@ -72,11 +72,11 @@
<text class="text-grey ">{{item.splrBatch}}</text>
</view>
</view>
- <view class="cu-item">
- <view class="content">
- <text class="text-black">绁ㄥ彿锛�<text class="text-grey ">{{item.crushNo}}</text></text>
- </view>
- </view>
+<!-- <view class="cu-item">-->
+<!-- <view class="content">-->
+<!-- <text class="text-black">绁ㄥ彿锛�<text class="text-grey ">{{item.crushNo}}</text></text>-->
+<!-- </view>-->
+<!-- </view>-->
<view class="cu-item">
<view class="content">
<text class="text-black">搴撳瓨鍗曚綅锛� <text class="text-grey ">{{item.stockUnit}}</text></text>
@@ -86,7 +86,7 @@
</view>
</view>
<view class="cu-item">
- <view class="content">
+ <view class="content" v-if="item.asnCode">
<text class="text-black">鍙粍鐩樻暟閲忥細<text
class="text-grey ">{{item.anfme - item.workQty - item.qty}}</text></text>
</view>
@@ -101,7 +101,7 @@
<view class="title text-blue"><text
class="text-red text-xl vertical-middle">*</text>缁勭洏鏁伴噺锛�
</view>
- <uni-number-box style="width: 70%;" :min="0" :max="max" :decimal="2" :step="0.000001"
+ <uni-number-box style="width: 70%;" :min="0" :max="max" :decimal="6" :step="1"
v-model="item.receiptQty"></uni-number-box>
</view>
</view>
@@ -141,10 +141,10 @@
range: [],
asnCode: '',
repeatClick: false,
- fieldsIndex: null,
isconfirm: false,
matnrCode: '',
max: 99999999,
+ searchTimer: null,
}
},
computed: {
@@ -155,24 +155,56 @@
},
mounted() {},
methods: {
+ onMatnrCodeInput(e) {
+ // 鎵爜杈撳叆鏃惰嚜鍔ㄨЕ鍙戞煡璇�
+ if (e.detail && e.detail.value && e.detail.value.trim() !== '') {
+ this.matnrCode = e.detail.value;
+ // 濡傛灉鐗╂枡缂栫爜涓�"0"锛屼笉璇锋眰鎺ュ彛
+ if (this.matnrCode.trim() === '0') {
+ return;
+ }
+ // 寤惰繜涓�涓嬪啀鏌ヨ锛岄伩鍏嶉绻佽姹�
+ if (this.searchTimer) {
+ clearTimeout(this.searchTimer);
+ }
+ this.searchTimer = setTimeout(() => {
+ this.getDet();
+ }, 500);
+ }
+ },
async search() {
- // if (this.fieldsIndex.length < 25) {
- // return;
- // }
- const find = this.list.find(el => el.trackCode === this.barcode);
- find ? this.scrollTo() : this.getDet();
+ // 濡傛灉鐗╂枡缂栫爜涓虹┖锛屼笉鎵ц鏌ヨ
+ if (!this.matnrCode || this.matnrCode.trim() === '') {
+ return;
+ }
+ // 濡傛灉鐗╂枡缂栫爜涓�"0"锛屼笉璇锋眰鎺ュ彛
+ if (this.matnrCode.trim() === '0') {
+ return;
+ }
+ // 鐩存帴璋冪敤鏌ヨ鏂规硶
+ this.getDet();
},
getDet() {
let that = this;
+ // 濡傛灉鐗╂枡缂栫爜涓�"0"锛屼笉璇锋眰鎺ュ彛
+ if (that.matnrCode && that.matnrCode.trim() === '0') {
+ return;
+ }
+ // 妫�鏌ユ槸鍚︽湁鏌ヨ鏉′欢
+ if ((!that.matnrCode || that.matnrCode.trim() === '') &&
+ (!that.asnCode || that.asnCode.trim() === '')) {
+ uni.showToast({
+ title: "璇疯緭鍏ョ墿鏂欑紪鐮佹垨ASN鍗曞彿",
+ icon: "none",
+ position: 'top'
+ })
+ return;
+ }
let param = {
- matnrCode: that.matnrCode.trim(),
- asnCode: that.asnCode.trim(),
- fieldsIndex: that.fieldsIndex.trim()
+ matnrCode: that.matnrCode ? that.matnrCode.trim() : '',
+ asnCode: that.asnCode ? that.asnCode.trim() : ''
}
that.getDetl(param);
- },
- clearCode() {
- this.fieldsIndex = ''
},
async getDetl(req) {
let that = this;
@@ -180,28 +212,55 @@
title: "鍔犺浇涓�...",
mask: true
})
+ // 鏋勫缓璇锋眰鍙傛暟锛屽彧浼犻�掗潪绌哄��
+ let requestParams = {};
+ if (that.matnrCode && that.matnrCode.trim() !== '') {
+ requestParams.matnrCode = that.matnrCode.trim();
+ }
+ if (that.asnCode && that.asnCode.trim() !== '') {
+ requestParams.asnCode = that.asnCode.trim();
+ requestParams.code = that.asnCode.trim();
+ }
+ if (req && req.batch) {
+ requestParams.batch = req.batch;
+ }
+
const {
code,
data,
msg
- } = await request('/asnOrderItem/trackCode', {
- matnrCode: that.matnrCode,
- asnCode: that.asnCode,
- code: that.asnCode,
- fieldsIndex: that.fieldsIndex,
- batch: req.batch
- }, "post")
+ } = await request('/asnOrderItem/trackCode', requestParams, "post")
+ console.log('鏌ヨ鍙傛暟:', requestParams);
+ console.log('鏌ヨ缁撴灉:', code, data);
if (code === 200) {
+ if (!data || data.length === 0) {
+ console.warn('鏈壘鍒板彲缁勬墭鐨勭墿鏂欙紝璇锋鏌ワ細1.鐗╂枡缂栫爜鏄惁姝g‘ 2.鐗╂枡鏄惁宸叉敹璐ц嚦鏀惰揣鍖� 3.鏄惁杩樻湁鍙粍鎵樻暟閲�');
+ uni.showToast({
+ title: "鏈壘鍒板彲缁勬墭鐨勭墿鏂�",
+ icon: "none",
+ position: 'top'
+ })
+ uni.hideLoading();
+ return;
+ }
for (var i = 0; i < data.length; i++) {
- data[i].receiptQty = data[i].anfme - data[i].workQty;
- data[i].crushNo = that.fieldsIndex;
+ // 璁$畻鍙粍鐩樻暟閲� = 鎬绘暟閲� - 宸叉墽琛屾暟閲� - 宸叉敹璐ф暟閲�
+ let anfme = data[i].anfme || 0;
+ let workQty = data[i].workQty || 0;
+ let qty = data[i].qty || 0;
+ data[i].receiptQty = anfme - workQty - qty;
+ // 纭繚鍙粍鐩樻暟閲忎笉涓鸿礋鏁�
+ if (data[i].receiptQty < 0) {
+ data[i].receiptQty = 0;
+ }
data[i].selected = true;
}
- that.fieldsIndex = null;
that.showBackData(data)
+ // 鍔犺浇鐗╂枡鎴愬姛鍚庯紝娓呯┖鐗╂枡缂栫爜杈撳叆妗�
+ that.matnrCode = '';
} else {
uni.showToast({
- title: msg,
+ title: msg || "鏌ヨ澶辫触",
icon: "none",
position: 'top'
})
@@ -244,21 +303,14 @@
}
},
showBackData(data) {
- let status;
- data.map(item => {
- this.list.push(item)
- })
- let oldLength = this.list.length
- this.list = this.list.filter((item, index, self) =>
- self.findIndex(i => (
- i.id === item.id // 鏍规嵁id鍘婚噸
- )) === index && item.isptResult === self[0].isptResult
- );
- let newLength = this.list.length
-
- if (oldLength > newLength) {
- this.showMsg("鏂版槑缁嗚杩囨护锛岃妫�鏌ョ姸鎬�")
- }
+ // 杩藉姞鏂扮墿鏂欏埌鍒楄〃锛屽彧鏍规嵁id鍘婚噸锛屼笉闄愬埗璐ㄦ缁撴灉
+ data.forEach(item => {
+ // 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩稿悓id鐨勭墿鏂欙紝濡傛灉涓嶅瓨鍦ㄥ垯杩藉姞
+ const exists = this.list.some(existingItem => existingItem.id === item.id);
+ if (!exists) {
+ this.list.push(item);
+ }
+ });
},
showMsg(msg) {
setTimeout(function() {
@@ -315,6 +367,19 @@
})
return;
}
+ // 鏍¢獙鎵�鏈夌墿鏂欑殑缁勭洏鏁伴噺涓嶈兘涓虹┖銆佷笉鑳戒负0
+ for (let i = 0; i < this.list.length; i++) {
+ const item = this.list[i];
+ if (item.receiptQty === null || item.receiptQty === undefined || item.receiptQty === '' || item.receiptQty === 0) {
+ uni.showToast({
+ title: `绗�${i + 1}涓墿鏂欙紙${item.matnrCode || item.maktx || '鏈煡'}锛夌殑缁勭洏鏁伴噺涓嶈兘涓虹┖鎴�0`,
+ icon: "none",
+ position: 'top',
+ duration: 3000
+ })
+ return;
+ }
+ }
this.repeatClick = true
const newArr = this.list.map(item => {
return {
diff --git a/pages/login/index.vue b/pages/login/index.vue
index c807b4b..2929bb8 100644
--- a/pages/login/index.vue
+++ b/pages/login/index.vue
@@ -1,5 +1,11 @@
<template>
<view class="bodyView">
+ <!-- 璁剧疆鎸夐挳 -->
+ <view class="settings">
+ <view class="settings-btn">
+ <uni-icons type="gear" size="30" color="#707070" @click="settings"></uni-icons>
+ </view>
+ </view>
<view class="topView">
<image src="/static/img/login_top.png" mode="aspectFill">
</image>
@@ -16,7 +22,7 @@
<view class="itemView">
<view class="textType3">{{$t('login.user')}}:</view>
<view class="input-wrapper">
- <input class="uni-input" v-model="user.userName" focus :placeholder="$t('login.inputUser')" />
+ <input class="uni-input" v-model="user.userName" :placeholder="$t('login.inputUser')" />
</view>
</view>
<view class="itemView">
@@ -58,6 +64,32 @@
<button class="loadingButton" @click="onLogin()" :loading="loading">{{btnText}}</button>
</view>
</view>
+
+ <!-- 璁剧疆寮圭獥鍖哄煙 -->
+ <view>
+ <uni-popup ref="inputDialog" type="dialog">
+ <view class="popup">
+ <!-- 鏍囬 -->
+ <view class="title">閰嶇疆</view>
+ <view class="popup-item">
+ <view class="popup-item-left">IP:</view>
+ <view class="popup-item-right"><input type="text" v-model="url.ip"></view>
+ </view>
+ <view class="popup-item">
+ <view class="popup-item-left">绔彛:</view>
+ <view class="popup-item-right"><input type="text" v-model="url.port"></view>
+ </view>
+ <view class="popup-item">
+ <view class="popup-item-left">椤圭洰:</view>
+ <view class="popup-item-right"><input type="text" v-model="url.project"></view>
+ </view>
+ <view class="btn">
+ <view class="btn-left" @click="close">鍙栨秷</view>
+ <view class="btn-right" @click="settingConfirm">纭</view>
+ </view>
+ </view>
+ </uni-popup>
+ </view>
</view>
</template>
@@ -80,6 +112,12 @@
userName: '',
password: '',
},
+ url: {
+ ip: '',
+ port: '',
+ project: ''
+ },
+ baseUrl: '',
}
},
computed:{
@@ -118,11 +156,20 @@
this.applicationLocale = e.locale;
})
- this.user = uni.getStorageSync('user')
+ this.user = uni.getStorageSync('user')
+ this.url = uni.getStorageSync('url')
+ this.baseUrl = uni.getStorageSync('baseUrl')
if (!this.user) {
this.user = {
userName: '',
password: ''
+ }
+ }
+ if (!this.url) {
+ this.url = {
+ ip: '',
+ port: '',
+ project: ''
}
}
},
@@ -234,11 +281,44 @@
this.showLanguageDropdown = false;
}
},
+ // 璁剧疆绐楀彛寮�鍚寜閽�
+ settings() {
+ this.$refs.inputDialog.open('')
+ },
+ // 璁剧疆绐楀彛鍏抽棴鎸夐挳
+ close() {
+ this.$refs.inputDialog.close()
+ },
+ // 淇濆瓨ip
+ settingConfirm() {
+ this.baseUrl = "http://" + this.url.ip + ':' + this.url.port + '/' + this.url.project
+ uni.setStorageSync('baseUrl', this.baseUrl);
+ uni.setStorageSync('url', this.url);
+ uni.setStorageSync('project', 'tzsk')
+ this.$refs.inputDialog.close()
+ },
}
}
</script>
-<style>
+<style>
+ @import url('../../static/css/wms.css/wms.css');
+
+ /* 璁剧疆鍖哄煙 */
+ .settings {
+ position: absolute;
+ top: 0;
+ right: 0;
+ z-index: 999;
+ min-height: 100rpx;
+ padding: 20rpx;
+ }
+
+ .settings-btn {
+ float: right;
+ margin-right: 10rpx;
+ }
+
.helloText{
font-family: a2;
font-size: 20px;
@@ -254,6 +334,7 @@
font-family: a4;
}
.bodyView{
+ position: relative;
display: flex;
flex-direction: column;
background-image: url("/static/img/login_backg.png");
diff --git a/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue b/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue
index 03a349e..9e6d9dc 100644
--- a/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue
+++ b/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue
@@ -51,6 +51,10 @@
type: Number,
default: 1
},
+ decimal: {
+ type: Number,
+ default: null
+ },
background: {
type: String,
default: '#f5f5f5'
@@ -113,7 +117,11 @@
}
}
- this.inputValue = (value / scale).toFixed(String(scale).length - 1);
+ // 濡傛灉鎸囧畾浜哾ecimal灞炴�э紝浣跨敤decimal锛涘惁鍒欐牴鎹畇cale璁$畻
+ let decimalPlaces = this.decimal !== null && this.decimal !== undefined
+ ? this.decimal
+ : (String(scale).length - 1);
+ this.inputValue = (value / scale).toFixed(decimalPlaces);
this.$emit("change", +this.inputValue);
// TODO vue2 鍏煎
this.$emit("input", +this.inputValue);
@@ -121,7 +129,11 @@
this.$emit("update:modelValue", +this.inputValue);
},
_getDecimalScale() {
-
+ // 濡傛灉鎸囧畾浜哾ecimal灞炴�э紝浼樺厛浣跨敤decimal
+ if (this.decimal !== null && this.decimal !== undefined) {
+ return Math.pow(10, this.decimal);
+ }
+
let scale = 1;
// 娴偣鍨�
if (~~this.step !== this.step) {
@@ -143,7 +155,11 @@
value = this.min;
}
const scale = this._getDecimalScale();
- this.inputValue = value.toFixed(String(scale).length - 1);
+ // 濡傛灉鎸囧畾浜哾ecimal灞炴�э紝浣跨敤decimal锛涘惁鍒欐牴鎹畇cale璁$畻
+ let decimalPlaces = this.decimal !== null && this.decimal !== undefined
+ ? this.decimal
+ : (String(scale).length - 1);
+ this.inputValue = value.toFixed(decimalPlaces);
this.$emit("change", +this.inputValue);
this.$emit("input", +this.inputValue);
},
--
Gitblit v1.9.1