From 6f233d299d4d6792404f4ca7ea5083acb845d992 Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期一, 21 十月 2024 08:58:36 +0800
Subject: [PATCH] #
---
pages/pakin/repairPakin.vue | 36 +++---
pages/pakin/stocktaking.vue | 190 +++++++++++++++++++++++++++++++++----
pages.json | 2
pages/pakin/confirmPakin.vue | 36 +++---
4 files changed, 206 insertions(+), 58 deletions(-)
diff --git a/pages.json b/pages.json
index e2f68c5..1152794 100644
--- a/pages.json
+++ b/pages.json
@@ -272,7 +272,7 @@
"path" : "pages/pakin/confirmPakin",
"style" :
{
- "navigationBarTitleText": "鐩樼偣",
+ "navigationBarTitleText": "鐩樼偣璋冩暣",
"enablePullDownRefresh": false
}
diff --git a/pages/pakin/confirmPakin.vue b/pages/pakin/confirmPakin.vue
index 68214bf..427fc6b 100644
--- a/pages/pakin/confirmPakin.vue
+++ b/pages/pakin/confirmPakin.vue
@@ -98,7 +98,7 @@
<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
<view class="buttom">
<button size="mini" @click="reset('warn')">閲嶇疆</button>
- <button size="mini" type="primary" @click="combConfirm('warn')">缁勬墭</button>
+ <button size="mini" type="primary" @click="combConfirm('warn')">璋冩暣</button>
</view>
<!-- 寮圭獥 -->
<!-- 淇敼鏁伴噺 -->
@@ -149,7 +149,7 @@
<uni-popup-message :type="msgType1" :message="messageText" :duration="2000"></uni-popup-message>
</uni-popup>
</view>
- <!-- 纭缁勬墭 -->
+ <!-- 纭璋冩暣 -->
<view>
<uni-popup ref="combConfirm" type="dialog">
<uni-popup-dialog :type="msgType" cancelText="鍙栨秷" confirmText="纭" :title="title" :content="content"
@@ -312,10 +312,10 @@
if (key.startsWith('鍗峰彿')) roll.rollNo = item[key];
else if (key.startsWith('绠卞彿')) roll.boxNo = item[key];
else if (key.startsWith('瑙勬牸')) roll.specs = item[key];
- else if (key.startsWith('闀垮害')) roll.length = item[key];
- else if (key.startsWith('鍑�閲�')) roll.netWeight = item[key];
- else if (key.startsWith('姣涢噸')) roll.grossWeight = item[key];
- else if (key.startsWith('鎺ュご')) roll.splices = item[key];
+ else if (key.startsWith('闀垮害')) roll.length = item[key].split(' ')[0];
+ else if (key.startsWith('鍑�閲�')) roll.netWeight = item[key].split(' ')[0];
+ else if (key.startsWith('姣涢噸')) roll.grossWeight = item[key].split(' ')[0];
+ else if (key.startsWith('鎺ュご')) roll.splices = item[key].split(' ')[0];
else if (key.startsWith('鍒嗗垏鏃堕棿')) roll.fqTime = item[key];
})
let newObj = {...nedata,...roll}
@@ -447,15 +447,15 @@
// 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏�
setTimeout(() => {
var len = this.barcode.length
- if (len != 8) {
- uni.showToast({
- title: '鎵樼洏鐮佹湁璇閲嶈瘯',
- icon: "none",
- position: 'top'
- });
- this.barcodeFocuss()
- return;
- }
+ // if (len != 8) {
+ // uni.showToast({
+ // title: '鎵樼洏鐮佹湁璇閲嶈瘯',
+ // icon: "none",
+ // position: 'top'
+ // });
+ // this.barcodeFocuss()
+ // return;
+ // }
this.bomFocuss()
}, 200)
},
@@ -696,7 +696,7 @@
combConfirm(type) {
this.msgType = type
this.title = '璀﹀憡'
- this.content = '鏄惁鐜板湪缁勬墭!'
+ this.content = '鏄惁鐜板湪璋冩暣!'
this.$refs.combConfirm.open()
},
combClose() {
@@ -717,7 +717,7 @@
}
for (var i = 0; i < that.dataList.length; i++) {
if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
- this.messageText = that.dataList[i].matnr + '缁勬墭鏁伴噺涓嶈兘涓�0'
+ this.messageText = that.dataList[i].matnr + '璋冩暣鏁伴噺涓嶈兘涓�0'
this.messageToggle('error')
return;
}
@@ -737,7 +737,7 @@
var res = result.data
if (res.code === 200) {
that.resst();
- that.messageText = "缁勬墭鎴愬姛"
+ that.messageText = "璋冩暣鎴愬姛"
that.messageToggle('success')
} else if (res.code == 403) {
that.messageText = res.msg
diff --git a/pages/pakin/repairPakin.vue b/pages/pakin/repairPakin.vue
index a4accc1..8339a2a 100644
--- a/pages/pakin/repairPakin.vue
+++ b/pages/pakin/repairPakin.vue
@@ -276,10 +276,10 @@
if (key.startsWith('鍗峰彿')) roll[index].rollNo = value;
else if (key.startsWith('绠卞彿')) roll[index].boxNo = value;
else if (key.startsWith('瑙勬牸')) roll[index].specs = value;
- else if (key.startsWith('闀垮害')) roll[index].length = value;
- else if (key.startsWith('鍑�閲�')) roll[index].netWeight = value;
- else if (key.startsWith('姣涢噸')) roll[index].grossWeight = value;
- else if (key.startsWith('鎺ュご')) roll[index].splices = value;
+ else if (key.startsWith('闀垮害')) roll[index].length = value.split(' ')[0];
+ else if (key.startsWith('鍑�閲�')) roll[index].netWeight = value.split(' ')[0];
+ else if (key.startsWith('姣涢噸')) roll[index].grossWeight = value.split(' ')[0];
+ else if (key.startsWith('鎺ュご')) roll[index].splices = value.split(' ')[0];
else if (key.startsWith('鍒嗗垏鏃堕棿')) roll[index].fqTime = value;
// 濡傛灉鏈夋墍鏈夊弬鏁帮紝鍒欏皢鍏舵帹鍏� rolls 鏁扮粍
@@ -363,10 +363,10 @@
if (key.startsWith('鍗峰彿')) roll.rollNo = item[key];
else if (key.startsWith('绠卞彿')) roll.boxNo = item[key];
else if (key.startsWith('瑙勬牸')) roll.specs = item[key];
- else if (key.startsWith('闀垮害')) roll.length = item[key];
- else if (key.startsWith('鍑�閲�')) roll.netWeight = item[key];
- else if (key.startsWith('姣涢噸')) roll.grossWeight = item[key];
- else if (key.startsWith('鎺ュご')) roll.splices = item[key];
+ else if (key.startsWith('闀垮害')) roll.length = item[key].split(' ')[0];
+ else if (key.startsWith('鍑�閲�')) roll.netWeight = item[key].split(' ')[0];
+ else if (key.startsWith('姣涢噸')) roll.grossWeight = item[key].split(' ')[0];
+ else if (key.startsWith('鎺ュご')) roll.splices = item[key].split(' ')[0];
else if (key.startsWith('鍒嗗垏鏃堕棿')) roll.fqTime = item[key];
})
nedata.rolls.push(roll)
@@ -441,15 +441,15 @@
// 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏�
setTimeout(() => {
var len = this.barcode.length
- if (len != 6) {
- uni.showToast({
- title: '鎵樼洏鐮佹湁璇閲嶈瘯',
- icon: "none",
- position: 'top'
- });
- this.barcodeFocuss()
- return;
- }
+ // if (len != 6) {
+ // uni.showToast({
+ // title: '鎵樼洏鐮佹湁璇閲嶈瘯',
+ // icon: "none",
+ // position: 'top'
+ // });
+ // this.barcodeFocuss()
+ // return;
+ // }
this.focuss()
}, 200)
},
@@ -618,7 +618,7 @@
data: JSON.stringify({
palletizingNo: that.sta,
barcode: that.barcode,
- boxList: that.dataList
+ matList: that.dataList
}),
method: 'POST',
header: {
diff --git a/pages/pakin/stocktaking.vue b/pages/pakin/stocktaking.vue
index b061d1b..e824917 100644
--- a/pages/pakin/stocktaking.vue
+++ b/pages/pakin/stocktaking.vue
@@ -8,12 +8,10 @@
</view>
<view class="item">
<view class="code-decs">鐗╂枡鐮�:</view>
- <input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="matnr" :focus="matFocus" @input="findMat()">
- <!-- <view class="item-right">
- <button></button>
- <text style="text-align: right;color: #409EFF;" @click="selectMat()">鎻愬彇+</text>
- <uni-icons type="right" color="#c1c1c1"></uni-icons>
- </view> -->
+ <!-- <input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="matnr" :focus="matFocus" @input="findMat()"> -->
+ <textarea style="background-color: #f0f0f0;max-height: 100rpx;padding: 4px;margin: 4px;"
+ type="textarea" placeholder=" 鎵爜 / 杈撳叆" maxlength="1000" v-model="matnr" :focus="matFocus"
+ @input="analysis2()" />
</view>
</view>
<view class="mat-list-title">
@@ -166,6 +164,148 @@
this.token = uni.getStorageSync('token');
},
methods: {
+ analysis2() {
+ const data = this.matnr
+
+ const parseData = (data) => {
+ const lines = data.split('\n');
+ const t = {
+ packageGroupNo: '',
+ rollType: '',
+ boxType: '',
+ thickness: '',
+ wideInWidth: '',
+ totalGrossWeight: '',
+ totalNetWeight: '',
+ rolls: []
+ };
+
+ // console.log(lines);
+ // 瑙f瀽鍩烘湰淇℃伅
+ lines.forEach(line => {
+ if (line.startsWith('鍖呰缁勫彿锛�')) t.packageGroupNo = line.split('锛�')[1].trim();
+ else if (line.startsWith('绠¤姱绫诲瀷锛�')) t.rollType = line.split('锛�')[1].trim();
+ else if (line.startsWith('鏈ㄧ绫诲瀷锛�')) t.boxType = line.split('锛�')[1].trim();
+ else if (line.startsWith('鍘氬害锛�')) t.thickness = line.split('锛�')[1].trim();
+ else if (line.startsWith('瀹藉箙锛�')) t.wideInWidth = line.split('锛�')[1].trim();
+ else if (line.startsWith('鎬绘瘺閲嶏細')) t.totalGrossWeight = line.split('锛�')[1].trim();
+ else if (line.startsWith('鎬诲噣閲嶏細')) t.totalNetWeight = line.split('锛�')[1].trim();
+ });
+
+ // 瑙f瀽鍗峰彿淇℃伅
+ let rollData = {};
+ let roll = {
+ rollNo: '',
+ boxNo: '',
+ specs: '',
+ length: '',
+ splices: '',
+ netWeight: '',
+ grossWeight: '',
+ fqTime: '',
+ }
+ lines.forEach(line => {
+ const match = line.match(/鍗峰彿(\d+)锛�(.+)/) || line.match(/绠卞彿(\d+)锛�(.+)/) || line.match(/瑙勬牸(\d+)锛�(.+)/) ||
+ line.match(/闀垮害(\d+)锛�(.+)/) || line.match(/鍑�閲�(\d+)锛�(.+)/) || line.match(/姣涢噸(\d+)锛�(.+)/) ||
+ line.match(/鎺ュご(\d+)锛�(.+)/) || line.match(/鍒嗗垏鏃堕棿(\d+)锛�(.+)/);
+
+ if (match) {
+ const index = match[1]; // 鑾峰彇搴忓彿
+ const key = match[0].split('锛�')[0]; // 鑾峰彇鍙傛暟鍚嶇О
+ const value = match[2].trim(); // 鑾峰彇鍙傛暟鍊�
+
+
+ // 鍒濆鍖栧嵎淇℃伅瀵硅薄
+ if (!rollData[index]) rollData[index] = {};
+ rollData[index][key] = value;
+ if (!roll[index]) roll[index] = {};
+ if (key.startsWith('鍗峰彿')) roll[index].rollNo = value;
+ else if (key.startsWith('绠卞彿')) roll[index].boxNo = value;
+ else if (key.startsWith('瑙勬牸')) roll[index].specs = value;
+ else if (key.startsWith('闀垮害')) roll[index].length = value;
+ else if (key.startsWith('鍑�閲�')) roll[index].netWeight = value;
+ else if (key.startsWith('姣涢噸')) roll[index].grossWeight = value;
+ else if (key.startsWith('鎺ュご')) roll[index].splices = value;
+ else if (key.startsWith('鍒嗗垏鏃堕棿')) roll[index].fqTime = value;
+
+ // 濡傛灉鏈夋墍鏈夊弬鏁帮紝鍒欏皢鍏舵帹鍏� rolls 鏁扮粍
+ if (Object.keys(rollData[index]).length === 8) { // 鎵�鏈夊瓧娈甸兘宸茬粡濉厖
+ t.rolls.push(rollData[index]);
+ rollData[index] = {}; // 閲嶇疆浠ュ噯澶囦笅涓�涓嵎
+ }
+
+ }
+ });
+ return t;
+ };
+
+ const result = parseData(data);
+
+ this.secAnalysis(result)
+
+ },
+ // 浜屾瑙f瀽
+ secAnalysis(data) {
+ let rolls = data.rolls
+ let nedata = {
+ packageGroupNo: data.packageGroupNo,
+ rollType: data.rollType,
+ boxType: data.boxType,
+ thickness: data.thickness,
+ wideInWidth: data.wideInWidth,
+ totalGrossWeight: data.totalGrossWeight,
+ totalNetWeight: data.totalNetWeight,
+ }
+
+
+ for (let item of rolls) {
+ let roll = {
+ rollNo: '',
+ boxNo: '',
+ specs: '',
+ length: '',
+ splices: '',
+ netWeight: '',
+ grossWeight: '',
+ fqTime: '',
+ }
+ Object.keys(item).forEach(key=>{
+ if (key.startsWith('鍗峰彿')) roll.rollNo = item[key];
+ else if (key.startsWith('绠卞彿')) roll.boxNo = item[key];
+ else if (key.startsWith('瑙勬牸')) roll.specs = item[key];
+ else if (key.startsWith('闀垮害')) roll.length = item[key].split(' ')[0];
+ else if (key.startsWith('鍑�閲�')) roll.netWeight = item[key].split(' ')[0];
+ else if (key.startsWith('姣涢噸')) roll.grossWeight = item[key].split(' ')[0];
+ else if (key.startsWith('鎺ュご')) roll.splices = item[key].split(' ')[0];
+ else if (key.startsWith('鍒嗗垏鏃堕棿')) roll.fqTime = item[key];
+ })
+ let newObj = {...nedata,...roll}
+ if (this.dataList.length > 0) this.checkAdd(newObj)
+ else this.dataList.push(newObj);
+
+ }
+ this.focuss()
+ },
+ // 纭娣诲姞
+ checkAdd(newMat) {
+ // let mats = this.dataList
+ // for (let item of mats) {
+ // if (item.packagingGroupNumber != newMat.packagingGroupNumber) {
+ // if (item.rollNo == newMat.rollNo)
+ // } this.dataList.push(newMat);
+ // }
+
+ var len = this.dataList.length
+ var add = true
+ for (let k of this.dataList) {
+ if (newMat.packageGroupNo == k.packageGroupNo && newMat.rollNo == k.rollNo) {
+ add = false
+ }
+ }
+ if (add) {
+ this.dataList.unshift(newMat)
+ }
+ },
messageToggle(type) {
this.msgType1 = type
this.$refs.message.open()
@@ -175,15 +315,15 @@
// 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏�
setTimeout(() => {
var len = this.barcode.length
- if (len != 6) {
- uni.showToast({
- title: '鎵樼洏鐮佹湁璇閲嶈瘯',
- icon: "none",
- position: 'top'
- });
- this.barcodeFocuss()
- return;
- }
+ // if (len != 6) {
+ // uni.showToast({
+ // title: '鎵樼洏鐮佹湁璇閲嶈瘯',
+ // icon: "none",
+ // position: 'top'
+ // });
+ // this.barcodeFocuss()
+ // return;
+ // }
this.focuss()
}, 200)
},
@@ -368,9 +508,17 @@
});
}, 1000);
} else {
- that.goto()
- that.messageText = res.msg
- that.messageToggle('error')
+ if (res.msg === '鐩樼偣纭寮傚父') {
+ that.messageText = res.msg
+ that.messageToggle('error')
+ setTimeout(()=>{
+ that.goto()
+ })
+ } else {
+ that.messageText = res.msg
+ that.messageToggle('error')
+ }
+
}
}
});
@@ -427,7 +575,7 @@
.code {
width: 100%;
position: fixed;
- min-height: 200rpx;
+ /* min-height: 200rpx; */
background-color: #FFF;
z-index: 10;
}
@@ -435,7 +583,7 @@
.item {
display: flex;
align-items: center;
- height: 100rpx;
+ /* height: 100rpx; */
margin-left: 20rpx;
border-bottom: 1px solid #DCDFE6;
}
@@ -467,7 +615,7 @@
width: 100%;
background-color: white;
position: fixed;
- margin-top: 200rpx;
+ margin-top: 180rpx;
z-index: 9;
/* border-top: 1px solid #DCDFE6; */
text-align: center;
--
Gitblit v1.9.1