| | |
| | | <view> |
| | | <view class="code"> |
| | | <view class="item"> |
| | | <view class="code-decs">箱号:</view> |
| | | <input type="text" placeholder=" 扫码 / 输入" v-model="barcode" :focus="barcodeFocus" |
| | | @input="barcodeInput()"> |
| | | <view class="code-decs">条码:</view> |
| | | <textarea style="background-color: #f0f0f0;max-height: 100rpx;padding: 4px;margin: 4px;" |
| | | type="textarea" placeholder=" 扫码 / 输入" maxlength="1000" v-model="barcode" :focus="barcodeFocus" |
| | | @input="analysis()" /> |
| | | </view> |
| | | </view> |
| | | <view class="mat-list-title"> |
| | |
| | | <view class="list" v-for="(item,i) in dataList" :key="i"> |
| | | <view class="list-left"> |
| | | <view class="list-left-item"> |
| | | <view class="desc">规格:</view> |
| | | <view class="left-item">{{item.matnr}}</view> |
| | | </view> |
| | | <view class="list-left-item"> |
| | | <view class="desc">箱号:</view> |
| | | <view class="left-item"> |
| | | <uni-tag :text="item.batch" type="primary"></uni-tag> |
| | | </view> |
| | | </view> |
| | | <view class="list-left-item"> |
| | | <view class="desc">品名:</view> |
| | | <view class="left-item">{{item.maktx}}</view> |
| | | <view class="desc">净重:</view> |
| | | <view class="left-item">{{item.weight}}</view> |
| | | </view> |
| | | <view class="list-left-item"> |
| | | <view class="desc">规格:</view> |
| | | <view class="left-item">{{item.specs}}</view> |
| | | <view class="desc">长度:</view> |
| | | <view class="left-item">{{item.price}}</view> |
| | | </view> |
| | | <view class="list-left-item"> |
| | | <view class="desc">批号:</view> |
| | | <view class="desc">卷号:</view> |
| | | <view class="left-item"> |
| | | <uni-tag :text="item.batch" type="warning"></uni-tag> |
| | | <uni-tag :text="item.model" type="warning"></uni-tag> |
| | | </view> |
| | | </view> |
| | | <view class="list-left-item"> |
| | | <view class="desc">状态:</view> |
| | | <view class="left-item"> |
| | | <uni-tag :text="item.deadTime" type="error"></uni-tag> |
| | | <uni-tag :text="item.deadTime" :type="deadTimeType"></uni-tag> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | matFocus: false, |
| | | matData: '', |
| | | removeNum: 0, |
| | | targetBatch: '', |
| | | deadTimeType: 'error' |
| | | } |
| | | }, |
| | | onLoad() { |
| | |
| | | this.msgType1 = type |
| | | this.$refs.message.open() |
| | | }, |
| | | // barcode input 事件 |
| | | barcodeInput() { |
| | | analysis() { |
| | | let _this = this |
| | | let barcode = this.barcode.split(",") |
| | | _this.barcode = barcode[0] |
| | | // let batch = barcode[0] |
| | | var matObj= { |
| | | rollNo: '', // 卷号 |
| | | boxNo: '', // 箱号 |
| | | specs: '', // 规格 |
| | | length: '', // 长度 |
| | | netWeight: '', // 净重 |
| | | grossWeight: '', // 毛重 |
| | | splices: '', // 接头 个 |
| | | } |
| | | // 创建一个 Map 对象 |
| | | const resultMap = new Map(); |
| | | |
| | | // 使用换行符作为分隔符分割字符串 |
| | | const lines = this.barcode.split('\n'); |
| | | console.log(lines); |
| | | lines.forEach(line => { |
| | | // 使用中文冒号作为分隔符 |
| | | const match = line.split(':'); |
| | | if (match.length === 2) { |
| | | const key = match[0].trim(); // 中文部分作为键 |
| | | const value = match[1].trim(); // 后面的字符串作为值 |
| | | resultMap.set(key, value); // 将键值对存入 Map |
| | | } |
| | | }); |
| | | |
| | | // 输出结果 |
| | | console.log(resultMap); |
| | | |
| | | |
| | | |
| | | // 如果需要将 Map 转换为普通对象 |
| | | const resultObject = Object.fromEntries(resultMap); |
| | | console.log(resultObject.净重); |
| | | console.log(lines); |
| | | matObj.rollNo = resultObject.卷号 |
| | | matObj.boxNo = resultObject.箱号 |
| | | matObj.specs = resultObject.规格 |
| | | matObj.length = resultObject.长度 |
| | | matObj.netWeight = resultObject.净重 |
| | | matObj.grossWeight = resultObject.毛重 |
| | | matObj.splices = resultObject.接头 |
| | | |
| | | console.log(matObj); |
| | | this.barcodeInput(matObj) |
| | | // this.checkMatObj(matObj) |
| | | this.barcodeFocus = false; |
| | | this.matFocus = false; |
| | | setTimeout(() => { |
| | | this.matnr = ''; |
| | | this.matFocus = true; |
| | | }, 100); |
| | | }, |
| | | checkMatObj(mat) { |
| | | var len = this.dataList.length |
| | | var add = true |
| | | for (let k of this.dataList) { |
| | | if (mat.boxNo == k.boxNo) { |
| | | add = false |
| | | } |
| | | } |
| | | if (add) { |
| | | this.dataList.unshift(mat) |
| | | } |
| | | }, |
| | | // barcode input 事件 |
| | | barcodeInput(code) { |
| | | let _this = this |
| | | let newBarcode = code |
| | | uni.request({ |
| | | url: _this.baseUrl + '/mobile/wrkDetl/search/batch/auth', |
| | | header: {'token': uni.getStorageSync('token')}, |
| | | data: _this.barcode, |
| | | data: newBarcode, |
| | | method:'POST', |
| | | success(res) { |
| | | res = res.data |
| | | console.log(res); |
| | | if (res.code === 200) { |
| | | if (res.data.source === 1) { |
| | | _this.deadTimeType = "primary" |
| | | } else { |
| | | _this.deadTimeType = "error" |
| | | } |
| | | _this.dataList.push(res.data) |
| | | console.log(_this.dataList); |
| | | } else if (res.code == 403) { |
| | | _this.messageText = res.msg |
| | | _this.messageToggle('error') |
| | | setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: '../login/login' |
| | | }); |
| | | }, 1000); |
| | | } else { |
| | | _this.messageText = res.data |
| | | _this.messageToggle('error') |
| | | } |
| | | |
| | | } |
| | |
| | | }, |
| | | comb() { |
| | | let that = this; |
| | | console.log(that.dataList[0]); |
| | | var matObj= { |
| | | rollNo: that.dataList[0].model, // 卷号 |
| | | boxNo: that.dataList[0].batch, // 箱号 |
| | | specs: that.dataList[0].matnr, // 规格 |
| | | length: that.dataList[0].price, // 长度 |
| | | netWeight: that.dataList[0].weight, // 净重 |
| | | grossWeight: that.dataList[0].volume, // 毛重 |
| | | splices: that.dataList[0].specs, // 接头 个 |
| | | } |
| | | uni.request({ |
| | | url: that.baseUrl + '/mobile/order/search/orderNo/auth', |
| | | data: that.barcode, |
| | | url: that.baseUrl + '/mobile/order/search/batch/auth', |
| | | data: matObj, |
| | | method: 'POST', |
| | | header: {'token': uni.getStorageSync('token')}, |
| | | method:'POST', |
| | | success(result) { |
| | | let res = result.data |
| | | if (res.code === 200) { |
| | | that.dataList = [] |
| | | this.barcode = '' |
| | | that.barcode = '' |
| | | that.messageText = "确认成功" |
| | | that.messageToggle('success') |
| | | } else if (res.code == 403) { |
| | |
| | | resetConfirm() { |
| | | this.dataList = [] |
| | | this.barcode = '' |
| | | this.targetBatch = '' |
| | | this.messageText = "重置完成" |
| | | this.messageToggle('success') |
| | | }, |
| | |
| | | resst() { |
| | | this.dataList = [] |
| | | this.barcode = '' |
| | | this.targetBatch = '' |
| | | this.barcodeFocuss() |
| | | }, |
| | | } |
| | |
| | | .item { |
| | | display: flex; |
| | | align-items: center; |
| | | height: 100rpx; |
| | | height: 130rpx; |
| | | margin-left: 20rpx; |
| | | border-bottom: 1px solid #DCDFE6; |
| | | } |
| | |
| | | width: 100%; |
| | | background-color: white; |
| | | position: fixed; |
| | | margin-top: 100rpx; |
| | | margin-top: 130rpx; |
| | | z-index: 9; |
| | | /* border-top: 1px solid #DCDFE6; */ |
| | | text-align: center; |