From 960b33fa24c47a330e51a2c24859d681ae62caeb Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期四, 16 四月 2026 10:09:49 +0800
Subject: [PATCH] 重构任务与库存模型,增强日志管理与区域接口
---
Code Management/PDA-FG/pages/Empty/Empty.vue | 491 ++++++++++++++++++++++++++----------------------------
1 files changed, 236 insertions(+), 255 deletions(-)
diff --git a/Code Management/PDA-FG/pages/Empty/Empty.vue b/Code Management/PDA-FG/pages/Empty/Empty.vue
index 2559613..529d0f0 100644
--- a/Code Management/PDA-FG/pages/Empty/Empty.vue
+++ b/Code Management/PDA-FG/pages/Empty/Empty.vue
@@ -2,278 +2,311 @@
<view>
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
</uni-segmented-control>
+
+ <!-- 绌烘墭鍏ュ簱 -->
<view v-show="current === 0">
<view style="padding: 5%;">
<uni-forms label-width="120">
<uni-forms-item label="鎵樼洏缂栫爜">
<uni-easyinput type="text" :focus="barcodeFocus" v-model="PalletCode1" placeholder="璇疯緭鍏ユ墭鐩樼紪鐮�"
- ref='midInput' @input="Changebarcode()"/>
+ ref="midInput" @input="onPalletCode1Input" />
</uni-forms-item>
- <uni-forms-item label="鍏ュ簱璧风偣">
+
+ <uni-forms-item label="鎼繍璧风偣">
<uni-easyinput type="text" :focus="addressFocus" v-model="SourceAddress" placeholder="璇疯緭鍏ヨ捣鐐�"
- ref='midInput' />
+ ref="midInput" />
</uni-forms-item>
+
<uni-forms-item label="缁堢偣鍖哄煙">
- <uni-data-select :focus="!istrue" v-model="AreaId" :localdata="range"
- placeholder="璇疯緭閫夋嫨缁堢偣鍖哄煙"></uni-data-select>
+ <picker mode="selector" :range="areaNames" @change="onAreaChange">
+ <view
+ style="padding: 10px; background-color: #fff; border: 1px solid #dcdfe6; border-radius: 4px; min-height: 16px; line-height: 16px;">
+ {{ selectedAreaName || '璇烽�夋嫨缁堢偣鍖哄煙' }}
+ </view>
+ </picker>
</uni-forms-item>
</uni-forms>
- <button @click="InboundTask" type="primary" size="default" style="margin-top: 2%;">鎼繍</button>
+
+ <button @click="inboundTask" type="primary" size="default" style="margin-top: 2%;"
+ :disabled="isLoading">
+ {{ isLoading ? '澶勭悊涓�...' : '鎼繍' }}
+ </button>
</view>
- </view><view v-show="current === 1">
+ </view>
+
+ <!-- 绌烘墭鍑哄簱 -->
+ <view v-show="current === 1">
<view style="padding: 5%;">
<uni-forms label-width="120">
<uni-forms-item label="鍑哄簱鍖哄煙">
- <uni-data-select :focus="!istrue" v-model="AreaId" :localdata="range"
- placeholder="璇疯緭閫夋嫨缁堢偣鍖哄煙"></uni-data-select>
+ <picker mode="selector" :range="areaNames" @change="onOutAreaChange">
+ <view
+ style="padding: 10px; background-color: #fff; border: 1px solid #dcdfe6; border-radius: 4px; min-height: 16px; line-height: 16px;">
+ {{ selectedOutAreaName || '璇烽�夋嫨鍑哄簱鍖哄煙' }}
+ </view>
+ </picker>
</uni-forms-item>
+
<uni-forms-item label="鍑哄簱缁堢偣">
- <uni-easyinput type="text" :focus="addressFocus" v-model="TargetAddress" placeholder="璇疯緭鍏ヨ捣鐐�"
- ref='midInput' />
+ <uni-easyinput type="text" v-model="TargetAddress" placeholder="璇疯緭鍏ュ嚭搴撶粓鐐�" ref="targetInput" />
</uni-forms-item>
</uni-forms>
- <button @click="SolvePlate" type="primary" size="default" style="margin-top: 2%;">瑙g洏</button>
+
+ <button @click="outboundTask" type="primary" size="default" style="margin-top: 2%;"
+ :disabled="isLoading">
+ {{ isLoading ? '澶勭悊涓�...' : '鍑哄簱' }}
+ </button>
</view>
</view>
+
<u-toast ref="luToast" />
</view>
</template>
<script>
- import {
- config
- } from '../../common/config';
const innerAudioContext = uni.createInnerAudioContext();
+
export default {
data() {
return {
- barcodeFocus:true,
- focus: false,
- istrue: false,
- addressFocus:false,
- barcodefocus: false,
- range: [],
- rangethree:[],
- group: [],
- AreaId: 0,
- acrossFloor:0,
- quantity: "",
- SourceAddress: "",
- TargetAddress: "",
+ // 褰撳墠閫変腑鐨則ab
+ items: ['绌烘墭鍏ュ簱', '绌烘墭鍑哄簱'],
+ current: 0,
+
+ // 鍏ュ簱琛ㄥ崟鏁版嵁
PalletCode1: "",
- PalletCode2: "",
- PalletCode3: "",
- materSn: "",
- items: ['绌烘墭鍏ュ簱','绌烘墭鍑哄簱'],
- current: 0
+ SourceAddress: "",
+
+ // 鍑哄簱琛ㄥ崟鏁版嵁
+ TargetAddress: "",
+
+ // 鍖哄煙閫夋嫨
+ areaList: [], // 鍖哄煙鏁版嵁 [{id, name}]
+ areaNames: [], // 鍖哄煙鍚嶇О鏁扮粍
+ AreaId: "", // 鍏ュ簱閫変腑鐨勫尯鍩烮D
+ selectedAreaName: "", // 鍏ュ簱閫変腑鐨勫尯鍩熷悕绉�
+ outAreaId: "", // 鍑哄簱閫変腑鐨勫尯鍩烮D
+ selectedOutAreaName: "", // 鍑哄簱閫変腑鐨勫尯鍩熷悕绉�
+
+ // 鐒︾偣鎺у埗
+ barcodeFocus: true,
+ addressFocus: false,
+
+ // 鍔犺浇鐘舵��
+ isLoading: false,
}
},
- onLoad(res) {
- this.range = config.AreaId;
- this.rangethree = config.AcrossFloor;
+
+ onLoad() {
+ this.queryAreaInfo();
},
+
methods: {
+ // 鍒嗘閫夋嫨鍣ㄧ偣鍑讳簨浠�
onClickItem(e) {
- if (this.current != e.currentIndex) {
+ if (this.current !== e.currentIndex) {
this.current = e.currentIndex;
+ this.resetForm();
}
},
+
+ // 閲嶇疆琛ㄥ崟
+ resetForm() {
+ this.PalletCode1 = "";
+ this.SourceAddress = "";
+ this.TargetAddress = "";
+ this.AreaId = "";
+ this.selectedAreaName = "";
+ this.outAreaId = "";
+ this.selectedOutAreaName = "";
+ this.barcodeFocus = true;
+ this.addressFocus = false;
+ },
+
+ // 鎾斁璇煶鎻愮ず
voiceSpeech(src) {
- innerAudioContext.src = src; // '../../static/success.mp3';
+ innerAudioContext.src = src;
innerAudioContext.play();
},
- InboundTask() {
- if (this.PalletCode1.length <= 0 && this.SourceAddress.length) {
+
+ // 鏌ヨ鍖哄煙淇℃伅
+ queryAreaInfo() {
+ this.$u.post('/api/Dt_AreaInfo/QueryAreaInfo').then(res => {
+ if (res.status && res.data && Array.isArray(res.data)) {
+ this.areaList = res.data;
+ this.areaNames = res.data.map(item => item.name);
+ console.log('鍖哄煙鏁版嵁鍔犺浇鎴愬姛', this.areaList);
+ } else {
+ this.$refs.luToast.show({
+ title: res.message || "鍔犺浇鍖哄煙鏁版嵁澶辫触",
+ type: "error"
+ });
+ }
+ }).catch(err => {
+ console.error('QueryAreaInfo error:', err);
this.$refs.luToast.show({
- title: "鎵樼洏缂栫爜璺熺粦瀹氳揣浣嶄笉鑳戒负绌�",
+ title: "缃戠粶璇锋眰澶辫触",
type: "error"
- })
+ });
+ });
+ },
+
+ // 鍏ュ簱鍖哄煙閫夋嫨
+ onAreaChange(e) {
+ const index = e.detail.value;
+ if (this.areaList[index]) {
+ this.selectedAreaName = this.areaList[index].name;
+ this.AreaId = this.areaList[index].id;
+ }
+ },
+
+ // 鍑哄簱鍖哄煙閫夋嫨
+ onOutAreaChange(e) {
+ const index = e.detail.value;
+ if (this.areaList[index]) {
+ this.selectedOutAreaName = this.areaList[index].name;
+ this.outAreaId = this.areaList[index].id;
+ }
+ },
+
+ // 鎵樼洏缂栫爜杈撳叆浜嬩欢
+ onPalletCode1Input() {
+ this.barcodeFocus = false;
+ this.$nextTick(() => {
+ if (this.PalletCode1 && this.PalletCode1 !== '') {
+ this.addressFocus = true;
+ }
+ });
+ },
+
+ // 鍏ュ簱浠诲姟
+ inboundTask() {
+ // 琛ㄥ崟楠岃瘉
+ if (!this.PalletCode1 || this.PalletCode1.trim() === "") {
+ this.$refs.luToast.show({
+ title: "鎵樼洏缂栫爜涓嶈兘涓虹┖",
+ type: "error"
+ });
+ this.barcodeFocus = true;
return;
}
- var param = {
- "PalletCode": this.PalletCode1,
- "Position": this.SourceAddress,
- "TargetAddress": this.TargetAddress,
- "AreaId": this.AreaId,
+
+ if (!this.SourceAddress || this.SourceAddress.trim() === "") {
+ this.$refs.luToast.show({
+ title: "鎼繍璧风偣涓嶈兘涓虹┖",
+ type: "error"
+ });
+ this.addressFocus = true;
+ return;
}
+
+ if (!this.AreaId) {
+ this.$refs.luToast.show({
+ title: "璇烽�夋嫨缁堢偣鍖哄煙",
+ type: "error"
+ });
+ return;
+ }
+
+ if (this.isLoading) return;
+ this.isLoading = true;
+
+ const param = {
+ PalletCode: this.PalletCode1.trim(),
+ Position: this.SourceAddress.trim(),
+ AreaId: this.AreaId,
+ IsFull: false,
+ };
+
this.$u.post('/api/Task/RequestInboundTaskAsync', param).then(res => {
+ this.isLoading = false;
+
if (res.status) {
this.$refs.luToast.show({
- title: res.message,
+ title: res.message || "鍏ュ簱浠诲姟鍒涘缓鎴愬姛",
type: "success"
- })
+ });
+ this.voiceSpeech('../../static/success.mp3');
+
+ // 閲嶇疆琛ㄥ崟
this.PalletCode1 = "";
this.SourceAddress = "";
this.TargetAddress = "";
this.AreaId = "";
- this.istrue = false;
+ this.selectedAreaName = "";
+ this.barcodeFocus = true;
+ this.addressFocus = false;
} else {
this.$refs.luToast.show({
- title: res.message,
+ title: res.message || "鍏ュ簱浠诲姟鍒涘缓澶辫触",
type: "error"
- })
+ });
+ this.barcodeFocus = true;
}
- })
- },
- SendTask() {
- if (this.PalletCode3.length <= 0 && this.SourceAddress3.length) {
+ }).catch(err => {
+ this.isLoading = false;
+ console.error('InboundTask error:', err);
this.$refs.luToast.show({
- title: "鎵樼洏缂栫爜璺熺粦瀹氳揣浣嶄笉鑳戒负绌�",
+ title: "缃戠粶璇锋眰澶辫触",
type: "error"
- })
- return;
- }
- var param = {
- "PalletCode": this.PalletCode3,
- "Position": this.SourceAddress3,
- "AreaId": this.acrossFloor,
- "DoubleTray":1,
- }
- this.$u.post('/api/Task/RequestInboundTaskAsync', param).then(res => {
- if (res.status) {
- this.$refs.luToast.show({
- title: res.message,
- type: "success"
- })
- this.PalletCode3 = "";
- this.SourceAddress3 = "";
- this.acrossFloor = "";
- this.istrue = false;
- } else {
- this.$refs.luToast.show({
- title: res.message,
- type: "error"
- })
- }
- })
- },
- GroupPlate() {
- if (this.PalletCode2.length <= 0 && this.InBoundOrder.length) {
- this.$refs.luToast.show({
- title: "璇疯緭鍏ヨ捣鐐圭珯鍙�",
- type: "error"
- })
- return;
- }
- var param = {
- "PalletCode": this.PalletCode2,
- "groups": this.group
- }
- this.$u.post('/api/BoxingInfo/AddGroupPlateAsync', param).then(res => {
- if (res.status) {
- this.$refs.luToast.show({
- title: res.message,
- type: "success"
- })
- this.PalletCode2 = "";
- this.group = [];
- this.barcodefocus = false;
- } else {
- this.$refs.luToast.show({
- title: res.message,
- type: "error"
- })
- }
- })
- },
-
- SolvePlate() {
- if (this.PalletCode3.length <= 0) {
- this.$refs.luToast.show({
- title: "璇疯緭鍏ユ墭鐩樻潯鐮�",
- type: "error"
- })
- return;
- }
- var param = {
- "PalletCode": this.PalletCode3,
- }
- this.$u.post('/api/BoxingInfo/DeleteGroupPlateAsync', param).then(res => {
- if (res.status) {
- this.$refs.luToast.show({
- title: res.message,
- type: "success"
- })
- this.PalletCode3 = "";
- this.barcodefocus = false;
- } else {
- this.$refs.luToast.show({
- title: res.message,
- type: "error"
- })
- }
- })
- },
- updateFocus() {
- this.$nextTick(() => {
- this.materSn = '';
- if (!this.focus) {
- this.focus = true;
- }
+ });
+ this.barcodeFocus = true;
});
},
- snInput() {
- this.$nextTick(() => {
- var matObj = {
- orderNo: this.materSn,
- }
- var temp = this.group.find(x => x.orderNo == matObj.orderNo);
- if (!temp) {
- this.$u.post('/api/InboundOrder/GetInboundOrderInfo?orderNo=' + this.materSn, "").then(
- res => {
- if (res.status) {
- this.group.push(res.data);
- setTimeout(this.updateFocus, 200);
- setTimeout(() => {
- this.voiceSpeech('../../static/success.mp3');
- }, 100);
- } else {
- this.$refs.luToast.show({
- title: res.message,
- type: "error"
- })
- }
- })
+ // 鍑哄簱浠诲姟
+ outboundTask() {
+ if (!this.outAreaId) {
+ this.$refs.luToast.show({
+ title: "璇烽�夋嫨鍑哄簱鍖哄煙",
+ type: "error"
+ });
+ return;
+ }
+
+ if (this.isLoading) return;
+ this.isLoading = true;
+
+ const param = {
+ AreaId: this.outAreaId,
+ TargetAddress: this.TargetAddress,
+ IsFull: false,
+ };
+
+ this.$u.post('/api/Task/RequestOutboundTaskAsync', param).then(res => {
+ this.isLoading = false;
+
+ if (res.status) {
+ this.$refs.luToast.show({
+ title: res.message || "鍑哄簱浠诲姟鍒涘缓鎴愬姛",
+ type: "success"
+ });
+ this.voiceSpeech('../../static/success.mp3');
+
+ // 閲嶇疆琛ㄥ崟
+ this.TargetAddress = "";
+ this.outAreaId = "";
+ this.selectedOutAreaName = "";
} else {
this.$refs.luToast.show({
- title: "鎵爜閲嶅",
+ title: res.message || "鍑哄簱浠诲姟鍒涘缓澶辫触",
type: "error"
- })
- setTimeout(this.updateFocus, 200);
- setTimeout(() => {
- this.voiceSpeech('../../static/fail.mp3');
- }, 100);
+ });
}
+ }).catch(err => {
+ this.isLoading = false;
+ console.error('OutboundTask error:', err);
+ this.$refs.luToast.show({
+ title: "缃戠粶璇锋眰澶辫触",
+ type: "error"
+ });
+ });
+ },
+ },
- })
- },
- Changebarcode() {
- this.barcodeFocus = false;
- this.$nextTick(function(x) {
- if (this.PalletCode1 != '') {
- this.addressFocus = true;
- }
- })
- },
- inputChangebarcode() {
- this.$nextTick(() => {
- this.$u.post('/api/BoxingInfo/GetPalletCodeInfo?palletCode=' + this.PalletCode2, "").then(
- res => {
- if (res.status) {
- this.group = res.data;
- console.log(this.group);
- setTimeout(this.updateFocus, 200);
- setTimeout(() => {
- this.voiceSpeech('../../static/success.mp3');
- }, 100);
- }
- })
- })
- },
- removeScanItem(orderNo) {
- this.group = this.group.filter(item => item.orderNo !== orderNo);
- }
+ // 椤甸潰鍗歌浇鏃堕攢姣侀煶棰�
+ onUnload() {
+ innerAudioContext.destroy();
}
}
</script>
@@ -288,57 +321,5 @@
background-color: #efeff4;
min-height: 100%;
height: auto;
- }
-
- .tips {
- color: #67c23a;
- font-size: 14px;
- line-height: 40px;
- text-align: center;
- background-color: #f0f9eb;
- height: 0;
- opacity: 0;
- transform: translateY(-100%);
- transition: all 0.3s;
- }
-
- .tips-ani {
- transform: translateY(0);
- height: 40px;
- opacity: 1;
- }
-
- .content {
- width: 100%;
- display: flex;
- }
-
- .list-picture {
- width: 100%;
- height: 145px;
- }
-
- .thumb-image {
- width: 100%;
- height: 100%;
- }
-
- .ellipsis {
- display: flex;
- overflow: hidden;
- }
-
- .uni-ellipsis-1 {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
-
- .uni-ellipsis-2 {
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3