From d01658c63cd541fe4ea5cec5c4bd7f23b9408cdb Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期六, 18 十月 2025 15:04:56 +0800
Subject: [PATCH] 前端,pda,后端接口更改,新增,优化
---
吉安PDA/pages/stash/raworderboxing.vue | 310 ++++++++++++++++++++++++++++++---------------------
1 files changed, 182 insertions(+), 128 deletions(-)
diff --git "a/\345\220\211\345\256\211PDA/pages/stash/raworderboxing.vue" "b/\345\220\211\345\256\211PDA/pages/stash/raworderboxing.vue"
index 5e9afbe..7b52fb5 100644
--- "a/\345\220\211\345\256\211PDA/pages/stash/raworderboxing.vue"
+++ "b/\345\220\211\345\256\211PDA/pages/stash/raworderboxing.vue"
@@ -22,9 +22,6 @@
v-model="Initiallife" />
</uni-forms-item>
- <!-- <uni-forms-item>
- <checkbox checked="check">鏄惁婊$洏</checkbox>
- </uni-forms-item> -->
<uni-forms-item>
<view style="display: flex;justify-content: space-around;margin-top: 2%;">
<button @click="reset" type="default" size="default"
@@ -34,16 +31,6 @@
</uni-forms-item>
</uni-forms>
<uni-list>
- <!-- <uni-list-item direction="column" v-for="item in matTotal" :key="item.matCode">
- <template v-slot:body>
- <view class="uni-list-box">
- <view class="uni-content">
- <view class="uni-title-sub uni-ellipsis-2">鐗╂枡缂栫爜锛歿{item.matCode}}</view>
- <view class="uni-title-sub uni-ellipsis-2">鏁伴噺锛歿{item.matQuantity}}</view>
- </view>
- </view>
- </template>
- </uni-list-item> -->
<uni-list-item direction="column" v-for="(item,index) in matInfos" :key="index">
<template v-slot:body>
<view class="uni-list-box">
@@ -54,7 +41,17 @@
<view class="uni-title-sub uni-ellipsis-2">閲囪喘鍗曞彿锛歿{item.purchaseOrderNo}}</view>
<view class="uni-note">鐗╂枡缂栫爜锛歿{item.materielCode}}</view>
<view class="uni-note">鎵规鍙凤細{{item.lotNo}}</view>
- <view class="uni-note">鏁伴噺锛歿{item.quantity}}</view>
+ <!-- 鐩存帴缂栬緫Q鍊煎搴旂殑quantity瀛楁 -->
+ <view class="uni-note" style="display: flex; align-items: center; gap: 10rpx;">
+ 鏁伴噺锛�
+ <uni-easyinput
+ type="number"
+ min="1"
+ style="width: 150rpx; display: inline-block;"
+ v-model="item.quantity"
+ @input="handleQuantityChange(item)"
+ />
+ </view>
<view class="uni-note">鐢熶骇鏃ユ湡锛歿{item.productionDate}}</view>
<view class="uni-note">鏈夋晥鏈燂細{{item.effectiveDate}}</view>
<view class="uni-note">浜よ揣鍗曞彿锛歿{item.deliveryNote}}</view>
@@ -92,8 +89,6 @@
<view style="font-size: 18px;">鍗曟嵁鍙凤細{{orderNo}}</view>
<view style="font-size: 18px;">鐗╂枡缂栫爜锛歿{item.materielCode}}</view>
<view>鐗╂枡鍚嶇О锛歿{item.materielName}}</view>
- <!-- <view>鐗╂枡瑙勬牸锛歿{item.materielSpec}}</view> -->
- <!-- <view style="font-size: 18px;">鐗╂枡鍚嶇О锛歿{item.matName}}</view> -->
<view style="font-size: 18px;">鏁伴噺锛歿{item.orderQuantity}}</view>
<view style="font-size: 18px;">缁勭洏鏁伴噺锛歿{item.receiptQuantity}}</view>
</view>
@@ -132,7 +127,17 @@
<view class="uni-title-sub uni-ellipsis-2">閲囪喘鍗曞彿锛歿{item.purchaseOrderNo}}</view>
<view class="uni-note">鐗╂枡缂栫爜锛歿{item.materielCode}}</view>
<view class="uni-note">鎵规鍙凤細{{item.lotNo}}</view>
- <view class="uni-note">鏁伴噺锛歿{item.quantity}}</view>
+ <!-- 鐩存帴缂栬緫Q鍊煎搴旂殑quantity瀛楁 -->
+ <view class="uni-note" style="display: flex; align-items: center; gap: 10rpx;">
+ 鏁伴噺锛�
+ <uni-easyinput
+ type="number"
+ min="1"
+ style="width: 150rpx; display: inline-block;"
+ v-model="item.quantity"
+ @input="handlePkQuantityChange(item)"
+ />
+ </view>
<view class="uni-note">鐢熶骇鏃ユ湡锛歿{item.productionDate}}</view>
<view class="uni-note">鏈夋晥鏈燂細{{item.effectiveDate}}</view>
<view class="uni-note">浜よ揣鍗曞彿锛歿{item.deliveryNote}}</view>
@@ -153,7 +158,7 @@
export default {
data() {
return {
- items: ['缁勭洏', '鍏ュ簱', '鍗曟嵁淇℃伅'], //, '瑙g洏'
+ items: ['缁勭洏', '鍏ュ簱', '鍗曟嵁淇℃伅'],
current: 0,
matTotal: [],
matInfos: [],
@@ -212,12 +217,17 @@
this.getData();
},
methods: {
- // voiceSpeech(src) {
- // innerAudioContext.src = src; // '../../static/success.mp3';
- // innerAudioContext.play();
- // },
+ // 缁勭洏椤垫暟閲忕紪杈戞牎楠岋紙鐩存帴淇敼鍘熺敓quantity瀛楁锛�
+ handleQuantityChange(item) {
+ item.quantity = item.quantity ? Math.max(1, parseInt(item.quantity)) : 1;
+ },
+
+ // 鍏ュ钩搴撻〉鏁伴噺缂栬緫鏍¢獙锛堢洿鎺ヤ慨鏀瑰師鐢焣uantity瀛楁锛�
+ handlePkQuantityChange(item) {
+ item.quantity = item.quantity ? Math.max(1, parseInt(item.quantity)) : 1;
+ },
+
updateFocus() {
- debugger
this.$nextTick(() => {
this.materSn = '';
if (!this.focus) {
@@ -225,13 +235,14 @@
}
});
},
+
barcodeFocus() {
- debugger
this.barcode = '';
if (this.focus) {
this.focus = false;
}
},
+
getData() {
var postData = {
MainData: {
@@ -247,6 +258,7 @@
}
})
},
+
onClickItem(e) {
this.focus = false;
this.addressFocus = false;
@@ -257,108 +269,127 @@
}
}
},
+
barcodeInput() {
this.$nextTick(function(x) {
if (this.barcode.length > 0) {
- // if (this.barcode.substring(0, 1) == 'A' || this.barcode.substring(0, 2) == 'TP') {
this.focus = true;
- // } else {
- // this.$refs.uToast.show({
- // title: "鎵爜閿欒,璇锋壂鎻忔墭鐩樼爜",
- // type: "error"
- // })
- // }
}
})
},
+
+ // 缁勭洏椤靛唴绠辩爜瑙f瀽锛堢洿鎺ユ搷浣滃師鐢焣uantity瀛楁锛�
snInput() {
this.$nextTick(() => {
- if (this.materSn != "") {
+ if (!this.materSn) return;
+
+ // 寤惰繜100ms纭繚鎵爜瀹屾垚
+ setTimeout(() => {
this.focus = false;
- var matSn = this.materSn;
+ let matSn = this.materSn.trim();
+
+ // 浠撳簱11鐨勭壒娈婂鐞�
if (this.warehouseId == 11) {
matSn = matSn.replace(/,SC.*/, '');
}
- //鏌ヨmatSn鏄惁瀛樺湪瀛楃
- if(matSn.indexOf("PO")>0){
- this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
- this.Testcheck = false;
- if (res.status) {
- this.sns.push(res.data.serialNumber);
-
- this.matInfos.push(res.data);
- if (res.message) {
- this.$refs.uToast.show({
- title: res.message,
- type: "error"
- })
- // setTimeout(() => {
- // this.voiceSpeech('../../static/fail.mp3');
- // }, 100);
- return;
- }
- // setTimeout(() => {
- // this.voiceSpeech('../../static/success.mp3');
- // }, 100);
- } else {
+
+ // 鏍¢獙鍐呯鐮佸畬鏁存��
+ const requiredFields = ['M:', 'BS:', 'DM:', 'DE:', 'Q:', 'PO:', 'DN:'];
+ const hasAllFields = requiredFields.every(field => matSn.includes(field));
+ if (!hasAllFields) {
+ this.$refs.uToast.show({
+ title: "鍐呯鐮佷笉瀹屾暣锛岃閲嶆柊鎵弿",
+ type: "error"
+ });
+ this.materSn = "";
+ return;
+ }
+
+ // 鏍¢獙PO瀛楁瀛樺湪鎬�
+ if (matSn.indexOf("PO") <= 0) {
+ this.$refs.uToast.show({
+ title: "鍐呯鐮佹牸寮忛敊璇紙鏃燩O鏍囪瘑锛�",
+ type: "error"
+ });
+ this.materSn = "";
+ return;
+ }
+
+ // 瑙f瀽鍐呯鐮侊紙鐩存帴浣跨敤杩斿洖鐨剄uantity浣滀负Q鍊硷級
+ this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
+ this.Testcheck = false;
+ if (res.status) {
+ this.sns.push(res.data.serialNumber);
+ this.matInfos.push(res.data);
+
+ if (res.message) {
this.$refs.uToast.show({
title: res.message,
- type: "error"
- })
- // setTimeout(() => {
- // this.voiceSpeech('../../static/fail.mp3');
- // }, 100);
+ type: "warning"
+ });
}
- })
- }
- setTimeout(() => {
- this.materSn = "";
- }, 100);
- }
+ } else {
+ this.$refs.uToast.show({
+ title: res.message,
+ type: "error"
+ });
+ }
+ });
+
+ this.materSn = "";
+ }, 1000);
})
},
+
+ // 鍏ュ钩搴撻〉鍐呯鐮佽В鏋愶紙鐩存帴鎿嶄綔鍘熺敓quantity瀛楁锛�
pksnInput() {
this.$nextTick(() => {
- if (this.pkmaterSn != "") {
-
- var matSn = this.pkmaterSn;
-
- if(matSn.indexOf("PO")>0){
- this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
- if (res.status) {
- this.pksns.push(res.data.serialNumber);
- this.pkmatInfos.push(res.data);
- if (!res.status) {
- this.$refs.uToast.show({
- title: res.message,
- type: "error"
- })
- // setTimeout(() => {
- // this.voiceSpeech('../../static/fail.mp3');
- // }, 100);
- return;
- }
- // setTimeout(() => {
- // this.voiceSpeech('../../static/success.mp3');
- // }, 100);
- return;
- } else {
- this.$refs.uToast.show({
- title: res.message,
- type: "error"
- })
- // setTimeout(() => {
- // this.voiceSpeech('../../static/fail.mp3');
- // }, 100);
- }
- })
- }
- setTimeout(() => {
+ if (!this.pkmaterSn) return;
+
+ // 寤惰繜100ms纭繚鎵爜瀹屾垚
+ setTimeout(() => {
+ let matSn = this.pkmaterSn.trim();
+
+ // 鏍¢獙鍐呯鐮佸畬鏁存��
+ const requiredFields = ['M:', 'BS:', 'DM:', 'DE:', 'Q:', 'PO:', 'DN:'];
+ const hasAllFields = requiredFields.every(field => matSn.includes(field));
+ if (!hasAllFields) {
+ this.$refs.uToast.show({
+ title: "鍐呯鐮佷笉瀹屾暣锛岃閲嶆柊鎵弿",
+ type: "error"
+ });
this.pkmaterSn = "";
- }, 100);
- }
+ return;
+ }
+
+ // 鏍¢獙PO瀛楁瀛樺湪鎬�
+ if (matSn.indexOf("PO") <= 0) {
+ this.$refs.uToast.show({
+ title: "鍐呯鐮佹牸寮忛敊璇紙鏃燩O鏍囪瘑锛�",
+ type: "error"
+ });
+ this.pkmaterSn = "";
+ return;
+ }
+
+ // 瑙f瀽鍐呯鐮侊紙鐩存帴浣跨敤杩斿洖鐨剄uantity浣滀负Q鍊硷級
+ this.$u.post('/api/MaterielInfo/CodeAnalysis?serNum=' + matSn, {}).then((res) => {
+ if (res.status) {
+ this.pksns.push(res.data.serialNumber);
+ this.pkmatInfos.push(res.data);
+ } else {
+ this.$refs.uToast.show({
+ title: res.message,
+ type: "error"
+ });
+ }
+ });
+
+ this.pkmaterSn = "";
+ }, 100);
})
},
+
inbound() {
if (this.inboundBarcode == "") {
this.$refs.uToast.show({
@@ -405,6 +436,7 @@
})
})
},
+
inputChangebarcode() {
this.addressFocus = false;
this.$nextTick(function(x) {
@@ -413,29 +445,34 @@
}
})
},
+
deleteList(res) {
this.matInfos.splice(res, 1);
this.sns.splice(res, 1);
},
+
pkdeleteList(res) {
this.pkmatInfos.splice(res, 1);
this.pksns.splice(res, 1);
},
+
reset() {
this.barcode = "";
this.matInfos = [];
this.sns = [];
this.materSn = "";
- if (this.warehouseId = !6) {
+ if (this.warehouseId != 6) {
this.Initiallife = 0;
}
},
+
resetInPk() {
this.pkmaterSn = "";
this.pkfocus = false;
this.pkmatInfos = [];
this.pksns = [];
},
+
pksubmit() {
if (this.pkmatInfos.length == 0) {
this.$refs.uToast.show({
@@ -444,24 +481,32 @@
})
return;
}
- this.$u.post('/api/InboundOrder/InPinKu?warehouseId=' + this.warehouseId + "&orderNo=" + this.orderNo, this
- .pksns).then(res => {
- if (res.status) {
- this.$refs.uToast.show({
- title: "鍏ュ簱鎴愬姛",
- type: "success"
- })
- this.pkfocus = false;
- this.pkmatInfos = [];
- this.pksns = [];
- } else {
- this.$refs.uToast.show({
- title: res.message,
- type: "error"
- })
- }
- })
+
+ // 鐩存帴浣跨敤淇敼鍚庣殑quantity锛堝搴擰鍊硷級鎻愪氦
+ const submitData = this.pkmatInfos.map(item => ({
+ serialNumber: item.serialNumber,
+ quantity: item.quantity
+ }));
+
+ this.$u.post('/api/InboundOrder/InPinKu?warehouseId=' + this.warehouseId + "&orderNo=" + this.orderNo, submitData)
+ .then(res => {
+ if (res.status) {
+ this.$refs.uToast.show({
+ title: "鍏ュ簱鎴愬姛",
+ type: "success"
+ })
+ this.pkfocus = false;
+ this.pkmatInfos = [];
+ this.pksns = [];
+ } else {
+ this.$refs.uToast.show({
+ title: res.message,
+ type: "error"
+ })
+ }
+ })
},
+
submit() {
if (this.barcode == "") {
this.$refs.uToast.show({
@@ -494,21 +539,29 @@
return;
}
}
- if (this.warehouseId == 2) { //娌瑰ⅷ浠撳簱鍖篒D
- this.sn = this.sns[0];
+
+ // 鐩存帴浣跨敤淇敼鍚庣殑quantity锛堝搴擰鍊硷級鎻愪氦
+ let submitSns = this.matInfos.map(item => ({
+ serialNumber: item.serialNumber,
+ quantity: item.quantity
+ }));
+
+ // 娌瑰ⅷ浠撳簱鐗规畩澶勭悊
+ if (this.warehouseId == 2) {
+ const firstItem = submitSns[0];
for (var i = 0; i < this.Initiallife - 1; i++) {
- this.sns.push(this.sn);
+ submitSns.push({...firstItem});
}
}
+
this.$u.post('/api/InboundOrder/MaterielGroup', {
MainData: {
"palletCode": this.barcode,
"orderNo": this.orderNo,
"initiallife": this.Initiallife,
- // "isFull": this.check
"warehouseId": this.warehouseId
},
- DelKeys: this.sns
+ DelKeys: submitSns
}).then(res => {
this.Testcheck = false;
if (res.status) {
@@ -521,7 +574,7 @@
this.matInfos = [];
this.sns = [];
this.matTotal = [];
- if (this.warehouseId != 6) { //娴嬭瘯鏋朵粨搴撳尯ID
+ if (this.warehouseId != 6) {
this.Initiallife = "";
}
} else {
@@ -557,4 +610,5 @@
.headerstyle {
width: 90%;
}
-</style>
\ No newline at end of file
+</style>
+
\ No newline at end of file
--
Gitblit v1.9.3