From 03645d5014de64266f030ab2711a862d3ffc642e Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期五, 18 十月 2024 10:19:46 +0800
Subject: [PATCH] #
---
pages/pakin/repairPakin.vue | 188 +++++++++++++++++++++++++++++++++++++++++++++-
pages/pakin/confirmPakin.vue | 6 +
2 files changed, 185 insertions(+), 9 deletions(-)
diff --git a/pages/pakin/confirmPakin.vue b/pages/pakin/confirmPakin.vue
index 2098628..22e4c65 100644
--- a/pages/pakin/confirmPakin.vue
+++ b/pages/pakin/confirmPakin.vue
@@ -13,7 +13,9 @@
</view>
<view class="item">
<view class="code-decs">鐗╂枡鐮�:</view>
- <textarea style="background-color: #f0f0f0;max-height: 100rpx;padding: 4px;margin: 4px;" type="textarea" placeholder=" 鎵爜 / 杈撳叆" maxlength="1000" v-model="matnr" :focus="matFocus" @input="analysis2()" />
+ <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 class="item-right">
</view>
</view>
@@ -333,7 +335,7 @@
var len = this.dataList.length
var add = true
for (let k of this.dataList) {
- if (newMat.packagingGroupNumber == k.packagingGroupNumber && newMat.rollNo == k.rollNo) {
+ if (newMat.packageGroupNo == k.packageGroupNo && newMat.rollNo == k.rollNo) {
add = false
}
}
diff --git a/pages/pakin/repairPakin.vue b/pages/pakin/repairPakin.vue
index 09782da..1f1dc45 100644
--- a/pages/pakin/repairPakin.vue
+++ b/pages/pakin/repairPakin.vue
@@ -12,7 +12,9 @@
</view>
<view class="item">
<view class="code-decs">鐗╂枡鐮�:</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">
@@ -171,10 +173,183 @@
this.token = uni.getStorageSync('token');
},
methods: {
+ analysis2() {
+ const data = this.matnr
+ const parseData = (data) => {
+ const lines = data.split('\n');
+ const t = {
+ boxPos: '宸�',
+ 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);
+ // console.log(result);
+ // this.secAnalysis(result)
+ if (this.dataList.length > 0) this.checkAdd(result)
+ else this.dataList.push(result);
+ this.focuss()
+
+ },
+ // 浜屾瑙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];
+ 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.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) {
+ add = false
+ }
+ }
+ if (add) {
+ this.dataList.unshift(newMat)
+ }
+ if (this.dataList.length == 2) {
+ this.dataList[0].boxPos = '宸�'
+ this.dataList[1].boxPos = '鍙�'
+ this.list = ['宸�','鍙�']
+ }
+ },
onChange(e,index) {
+ if (this.dataList.length == 2) {
+ this.list = ['宸�','鍙�']
+ } else {
+ this.list = ['宸�','涓�','鍙�']
+ }
+ if (this.dataList.length == 2) {
+ this.dataList[index].boxPos = this.list[e.detail.value];
+ if (index == 0) {
+ if (e.detail.value == 0) {
+ this.dataList[1].boxPos = this.list[1];
+ } else {
+ this.dataList[1].boxPos = this.list[0];
+ }
+ } else {
+ if (e.detail.value == 0) {
+ this.dataList[0].boxPos = this.list[1];
+ } else {
+ this.dataList[0].boxPos = this.list[0];
+ }
+ }
+ } else {
+ this.dataList[index].boxPos = this.list[e.detail.value];
+ }
console.log(e,index)
- this.dataList[index].boxPos = this.list[e.detail.value];
- },
+
+ },
// onChange(e,item) {
// console.log(e,item)
// this.item.boxPos = this.list[e.detail.value];
@@ -442,13 +617,13 @@
}
.list:first-child {
- margin-top: 420rpx;
+ margin-top: 350rpx;
}
.code {
width: 100%;
position: fixed;
- min-height: 300rpx;
+ min-height: 100rpx;
background-color: #FFF;
z-index: 10;
}
@@ -456,7 +631,6 @@
.item {
display: flex;
align-items: center;
- height: 100rpx;
margin-left: 20rpx;
border-bottom: 1px solid #DCDFE6;
}
@@ -488,7 +662,7 @@
width: 100%;
background-color: white;
position: fixed;
- margin-top: 300rpx;
+ margin-top: 230rpx;
z-index: 9;
/* border-top: 1px solid #DCDFE6; */
text-align: center;
--
Gitblit v1.9.1