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/Inbound/Inbound.vue | 412 ++++++++++++++++++++++++++++++----------------------------
1 files changed, 216 insertions(+), 196 deletions(-)
diff --git a/Code Management/PDA-FG/pages/Inbound/Inbound.vue b/Code Management/PDA-FG/pages/Inbound/Inbound.vue
index 5c0f969..41edd7d 100644
--- a/Code Management/PDA-FG/pages/Inbound/Inbound.vue
+++ b/Code Management/PDA-FG/pages/Inbound/Inbound.vue
@@ -2,312 +2,332 @@
<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-easyinput type="text" :focus="addressFocus" v-model="SourceAddress" placeholder="璇疯緭鍏ヨ捣鐐�"
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>
</view>
</view>
+
+ <!-- 鐗╂枡缁戝畾 -->
<view v-show="current === 1">
<view style="padding: 5%;">
<uni-forms label-width="120">
<uni-forms-item label="鎵樼洏缂栫爜">
- <uni-easyinput type="text" :focus="barcodefocus" @input="inputChangebarcode"
- v-model="PalletCode2" placeholder="璇疯緭鍏ユ墭鐩樼紪鐮�" ref='midInput' />
+ <uni-easyinput type="text" :focus="barcodefocus" v-model="PalletCode2" placeholder="璇疯緭鍏ユ墭鐩樼紪鐮�" ref='midInput' @input="onMaterSnInput" />
</uni-forms-item>
- <uni-forms-item label="澶栫鏍囩:">
+ <uni-forms-item label="澶栫鏍囩">
<uni-easyinput type="text" placeholder="璇锋壂鎻忓绠辨爣绛�" ref='midInput' :focus="focus" v-model="materSn"
- @input="snInput" />
+ />
</uni-forms-item>
- <view v-if="group.length" class="scan-result">
- <uni-card v-for="(item, index) in group" :key="item.orderNo">
- <view class="info-grid">
- <view class="info-row">
- <text class="label">璁㈠崟缂栫爜锛�</text>
- <text>{{ item.orderNo }}</text>
- </view>
- <br>
- <view class="info-row">
- <text class="label">浠撳簱鍚嶇О锛�</text>
- <text>{{ item.warehouseName }}</text>
- </view><br>
- <view class="info-row">
- <text class="label">鐗╂枡缂栫爜锛�</text>
- <text>{{ item.materialNo }}</text>
- </view><br>
- <uni-forms-item label="缁勭洏鏁伴噺">
- <uni-easyinput v-model="item.quantity" type="number" />
- </uni-forms-item>
- </view>
- <uni-icons type="trash" class="delete-icon" @click="removeScanItem(item.orderNo)" />
- </uni-card>
- </view>
</uni-forms>
<button @click="GroupPlate" type="primary" size="default" style="margin-top: 2%;">缁勭洏</button>
</view>
</view>
+
+ <!-- 鐗╂枡瑙g粦 -->
<view v-show="current === 2">
<view style="padding: 5%;">
<uni-forms label-width="120">
<uni-forms-item label="鎵樼洏缂栫爜">
- <uni-easyinput type="text" :focus="barcodefocus" @input="inputChange" v-model="PalletCode3"
+ <uni-easyinput type="text" :focus="barcodefocus" @input="onPalletCode3Input" v-model="PalletCode3"
placeholder="璇疯緭鍏ユ墭鐩樼紪鐮�" ref='midInput' />
</uni-forms-item>
</uni-forms>
<button @click="SolvePlate" type="primary" size="default" style="margin-top: 2%;">瑙g洏</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: "",
+ // 琛ㄥ崟鏁版嵁
PalletCode1: "",
PalletCode2: "",
PalletCode3: "",
+ SourceAddress: "",
+ AreaId: "",
+ selectedAreaName: "",
materSn: "",
- items: ['鍏ュ簱','鐗╂枡缁戝畾', '鐗╂枡瑙g粦'],
+ group: null,
+
+ // 鍖哄煙鏁版嵁
+ areaList: [], // 鍘熷鍖哄煙鏁版嵁 [{id, name}]
+ areaNames: [], // 鍖哄煙鍚嶇О鏁扮粍锛堢敤浜巔icker鏄剧ず锛�
+
+ // 鐒︾偣鎺у埗
+ barcodeFocus: true,
+ addressFocus: false,
+ barcodefocus: false,
+ focus: false,
+ istrue: false,
+
+ // UI鎺у埗
+ items: ['鍏ュ簱', '鐗╂枡缁戝畾', '鐗╂枡瑙g粦'],
current: 0
}
},
- 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;
+ // 鍒囨崲tab鏃堕噸缃劍鐐�
+ this.resetFocus();
}
},
+
+ // 閲嶇疆鐒︾偣鐘舵��
+ resetFocus() {
+ this.barcodeFocus = true;
+ this.addressFocus = false;
+ this.barcodefocus = false;
+ this.focus = 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) {
+ // 鍚庣杩斿洖鏁扮粍鏍煎紡
+ this.areaList = res.data;
+ // 鎻愬彇鍚嶇О鏁扮粍渚沺icker浣跨敤
+ this.areaNames = this.areaList.map(item => item.name);
+
+ // this.$refs.luToast.show({
+ // title: res.message || "鍔犺浇鎴愬姛",
+ // type: "success"
+ // });
+ } 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;
+ }
+ },
+
+ // 鍏ュ簱浠诲姟
+ InboundTask() {
+ // 楠岃瘉
+ if (!this.PalletCode1 || this.PalletCode1.trim() === "") {
+ this.$refs.luToast.show({
+ title: "鎵樼洏缂栫爜涓嶈兘涓虹┖",
+ type: "error"
+ });
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"
+ });
+ return;
}
+
+ if (!this.AreaId) {
+ this.$refs.luToast.show({
+ title: "璇烽�夋嫨缁堢偣鍖哄煙",
+ type: "error"
+ });
+ return;
+ }
+
+ const param = {
+ PalletCode: this.PalletCode1,
+ Position: this.SourceAddress,
+ AreaId: this.AreaId,
+ };
+
this.$u.post('/api/Task/RequestInboundTaskAsync', param).then(res => {
if (res.status) {
this.$refs.luToast.show({
- title: res.message,
+ title: res.message || "浠诲姟鍒涘缓鎴愬姛",
type: "success"
- })
+ });
+ // 閲嶇疆琛ㄥ崟
this.PalletCode1 = "";
this.SourceAddress = "";
- this.TargetAddress = "";
this.AreaId = "";
- this.istrue = false;
+ this.selectedAreaName = "";
+ this.barcodeFocus = true;
} else {
this.$refs.luToast.show({
- title: res.message,
+ title: res.message || "浠诲姟鍒涘缓澶辫触",
type: "error"
- })
+ });
}
- })
- },
- SendTask() {
- if (this.PalletCode3.length <= 0 && this.SourceAddress3.length) {
+ }).catch(err => {
+ 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"
- })
- }
- })
+ });
+ });
},
+
+ // 鎵樼洏缂栫爜1杈撳叆浜嬩欢
+ onPalletCode1Input() {
+ this.barcodeFocus = false;
+ this.$nextTick(() => {
+ if (this.PalletCode1 && this.PalletCode1 !== '') {
+ this.addressFocus = true;
+ }
+ });
+ },
+
+ // 缁勭洏锛堢墿鏂欑粦瀹氾級
GroupPlate() {
- if (this.PalletCode2.length <= 0 && this.InBoundOrder.length) {
+ if (!this.PalletCode2 || this.PalletCode2.trim() === "") {
this.$refs.luToast.show({
- title: "璇疯緭鍏ヨ捣鐐圭珯鍙�",
+ title: "鎵樼洏缂栫爜涓嶈兘涓虹┖",
type: "error"
- })
+ });
return;
}
- var param = {
- "PalletCode": this.PalletCode2,
- "groups": this.group
+
+ if (!this.materSn) {
+ this.$refs.luToast.show({
+ title: "璇峰厛鎵弿澶栫鏍囩",
+ type: "error"
+ });
+ return;
}
+
+ const param = {
+ PalletCode: this.PalletCode2,
+ group: this.materSn,
+ };
+
this.$u.post('/api/BoxingInfo/AddGroupPlateAsync', param).then(res => {
if (res.status) {
this.$refs.luToast.show({
- title: res.message,
+ title: res.message || "缁勭洏鎴愬姛",
type: "success"
- })
+ });
+ // 閲嶇疆琛ㄥ崟
this.PalletCode2 = "";
- this.group = [];
+ this.materSn = "";
this.barcodefocus = false;
+ this.focus = false;
+ this.voiceSpeech('../../static/success.mp3');
} else {
this.$refs.luToast.show({
- title: res.message,
+ title: res.message || "缁勭洏澶辫触",
type: "error"
- })
+ });
}
- })
- },
-
- SolvePlate() {
- if (this.PalletCode3.length <= 0) {
+ }).catch(err => {
+ console.error('GroupPlate error:', err);
this.$refs.luToast.show({
- title: "璇疯緭鍏ユ墭鐩樻潯鐮�",
+ 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() {
+
+ // 澶栫鏍囩杈撳叆浜嬩欢
+ onMaterSnInput() {
+ this.barcodefocus = false;
this.$nextTick(() => {
- this.materSn = '';
- if (!this.focus) {
+ if (this.PalletCode2 && this.PalletCode2 !== '') {
this.focus = 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"
- })
- }
- })
-
+
+ // 瑙g洏锛堢墿鏂欒В缁戯級
+ SolvePlate() {
+ if (!this.PalletCode3 || this.PalletCode3.trim() === "") {
+ this.$refs.luToast.show({
+ title: "鎵樼洏缂栫爜涓嶈兘涓虹┖",
+ type: "error"
+ });
+ return;
+ }
+
+ const param = {
+ PalletCode: this.PalletCode3,
+ };
+
+ this.$u.post('/api/BoxingInfo/DeleteGroupPlateAsync', param).then(res => {
+ if (res.status) {
+ this.$refs.luToast.show({
+ title: res.message || "瑙g洏鎴愬姛",
+ type: "success"
+ });
+ this.PalletCode3 = "";
+ this.barcodefocus = false;
} else {
this.$refs.luToast.show({
- title: "鎵爜閲嶅",
+ title: res.message || "瑙g洏澶辫触",
type: "error"
- })
- setTimeout(this.updateFocus, 200);
- setTimeout(() => {
- this.voiceSpeech('../../static/fail.mp3');
- }, 100);
+ });
}
-
- })
+ }).catch(err => {
+ console.error('SolvePlate 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);
+
+ // 鎵樼洏缂栫爜3杈撳叆浜嬩欢
+ onPalletCode3Input() {
+ this.barcodefocus = false;
}
}
}
--
Gitblit v1.9.3