| New file |
| | |
| | | <template> |
| | | <view> |
| | | <view class="combox"> |
| | | <view style="flex: 1;"><uni-combox :candidates="orderNoList" placeholder="请选择订单" v-model="orderNo" @input="getOrderDet"></uni-combox></view> |
| | | <view style="width: 80px;display: flex;align-items: center;justify-content: center;"><button size="mini" type="primary" @click="getOrderDetlByOrderNo()">检索</button></view> |
| | | </view> |
| | | <view class="list-header" style="display: flex;text-align: start;align-items: center;padding: 8px;"> |
| | | <text style="width: 6em;">扫码确认</text> |
| | | <view style="width: 10px;"></view> |
| | | <textarea style="background-color: #f0f0f0;max-height: 100rpx;padding: 4px;margin: 4px;font-weight: normal;" |
| | | type="textarea" placeholder=" 扫码 / 输入" maxlength="1000" v-model="matnr" :focus="matFocus" |
| | | @input="analysis2()" /> |
| | | </view> |
| | | <view class="list-header"> |
| | | <text>订单明细</text> |
| | | </view> |
| | | <!-- 包装组号:{{item.packageGroupNo}} --> |
| | | <view class="order-item" v-for="item in orderList"> |
| | | <view style="flex: 1;">包装组号:{{item.packageGroupNo}}</view> |
| | | <view style="width: 30px;" v-show="item.checked"> |
| | | <uni-icons type="checkbox-filled" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons> |
| | | </view> |
| | | <view style="width: 30px;" v-show="!item.checked"> |
| | | <uni-icons type="checkbox-filled" color="#c3c3c3" size="24" @click="revise(item,i)"></uni-icons> |
| | | </view> |
| | | |
| | | </view> |
| | | <view style="height: 60px;"></view> |
| | | <view class="orderDetl-none" v-if="orderList.length == 0">暂无明细</view> |
| | | |
| | | <!-- 底部操作按钮 --> |
| | | <view class="buttom"> |
| | | <button size="mini" @click="reset('warn')">重置</button> |
| | | <button size="mini" type="primary" @click="combConfirm('warn')">发货核对</button> |
| | | </view> |
| | | <!-- 确认组托 --> |
| | | <view> |
| | | <uni-popup ref="combConfirm" type="dialog"> |
| | | <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content" |
| | | @confirm="comb" @close="combClose"></uni-popup-dialog> |
| | | </uni-popup> |
| | | </view> |
| | | <!-- 确认重置 --> |
| | | <view> |
| | | <uni-popup ref="resetConfirm" type="dialog"> |
| | | <uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content" |
| | | @confirm="resetConfirm" @close="resetClose"></uni-popup-dialog> |
| | | </uni-popup> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | baseUrl: '', |
| | | token: '', |
| | | orderNoList: [], |
| | | orderNo: '', |
| | | orderList: [], |
| | | matnr: '', |
| | | matFocus: true, |
| | | msgType: 'success', |
| | | messageText: '', |
| | | title: '', |
| | | content: '', |
| | | |
| | | } |
| | | }, |
| | | onShow() { |
| | | this.baseUrl = uni.getStorageSync('baseUrl'); |
| | | this.token = uni.getStorageSync('token'); |
| | | }, |
| | | methods: { |
| | | getOrderDet() { |
| | | let _this = this |
| | | if (_this.orderNo.length == 0) { |
| | | _this.orderList = [] |
| | | _this.orderNoList = [] |
| | | return |
| | | } |
| | | uni.request({ |
| | | url: `${_this.baseUrl}/mobile/getOrderNoList/${_this.orderNo}`, |
| | | header: { 'token': uni.getStorageSync('token') }, |
| | | method: 'GET', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200 ) { |
| | | _this.orderNoList = res.data |
| | | } else if (res.code === 403) { |
| | | uni.showToast({ title: res.msg, icon: "error", position: 'center' }) |
| | | setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000); |
| | | } else { |
| | | uni.showToast({ title: res.msg, icon: "error", position: 'center' }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | getOrderDetlByOrderNo() { |
| | | let _this = this |
| | | uni.request({ |
| | | url: `${_this.baseUrl}/mobile/getOrderDetlByOrderNo/${_this.orderNo}`, |
| | | header: { 'token': uni.getStorageSync('token') }, |
| | | method: 'GET', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200 ) { |
| | | for (let k of res.data) { |
| | | var item = {packageGroupNo: '',checked:false} |
| | | console.log(k); |
| | | item.packageGroupNo = k |
| | | _this.orderList.push(item) |
| | | } |
| | | // console.log(_this.orderList); |
| | | // _this.orderList = res.data |
| | | } else if (res.code === 403) { |
| | | uni.showToast({ title: res.msg, icon: "error", position: 'center' }) |
| | | setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000); |
| | | } else { |
| | | uni.showToast({ title: res.msg, icon: "error", position: 'center' }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | choseOne() { |
| | | let _this = this |
| | | uni.navigateTo({ |
| | | url: './orderSelect', |
| | | success(res) { |
| | | res.eventChannel.emit('matList', { |
| | | matList: _this.dataList |
| | | }) |
| | | }, |
| | | events: { |
| | | pickList: function(data) { |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | 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); |
| | | // 解析基本信息 |
| | | 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(); |
| | | }); |
| | | |
| | | // 解析卷号信息 |
| | | 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.replace(/[^0-9]/ig, ""); |
| | | else if (key.startsWith('净重')) roll[index].netWeight = value.replace(/[^0-9]/ig, ""); |
| | | else if (key.startsWith('毛重')) roll[index].grossWeight = value.replace(/[^0-9]/ig, ""); |
| | | else if (key.startsWith('接头')) roll[index].splices = value.replace(/[^0-9]/ig, ""); |
| | | 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() |
| | | |
| | | }, |
| | | secAnalysis(data) { |
| | | for (let k of this.orderList) { |
| | | if (data.packageGroupNo == k.packageGroupNo) { |
| | | if (k.checked) { |
| | | uni.showToast({ title: '当前条码已确认', icon: "error", position: 'center' }) |
| | | } else { |
| | | uni.showToast({ title: '确认成功', icon: "success", position: 'center' }) |
| | | k.checked = true |
| | | } |
| | | } |
| | | } |
| | | this.focuss() |
| | | }, |
| | | focuss() { |
| | | this.matFocus = false; |
| | | setTimeout(() => { |
| | | this.matnr = ''; |
| | | this.matFocus = true; |
| | | }, 100); |
| | | }, |
| | | reset(type) { |
| | | this.msgType = type |
| | | this.title = '警告' |
| | | this.content = '是否重置!' |
| | | this.$refs.resetConfirm.open() |
| | | }, |
| | | combConfirm(type) { |
| | | this.msgType = type |
| | | this.title = '警告' |
| | | this.content = '是否现在核对!' |
| | | this.$refs.combConfirm.open() |
| | | }, |
| | | combClose() { |
| | | this.$refs.combConfirm.close() |
| | | }, |
| | | comb() { |
| | | let _this = this |
| | | for (let k of this.orderList) { |
| | | if (!k.checked) { |
| | | uni.showToast({ title: `包装号${ k.packageGroupNo},还未确认` , icon: "error", position: 'center' }) |
| | | return |
| | | } |
| | | } |
| | | uni.request({ |
| | | url: `${_this.baseUrl}/mobile/pdaFhhd`, |
| | | header: { 'token': uni.getStorageSync('token') }, |
| | | data: {orderNo: _this.orderNo}, |
| | | method: 'POST', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200 ) { |
| | | _this.orderList = [], |
| | | _this.orderNo = '' |
| | | uni.showToast({ title: res.msg, icon: "success", position: 'center' }) |
| | | } else if (res.code === 403) { |
| | | uni.showToast({ title: res.msg, icon: "error", position: 'center' }) |
| | | setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000); |
| | | } else { |
| | | uni.showToast({ title: res.msg, icon: "error", position: 'center' }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // 确认重置 |
| | | resetConfirm() { |
| | | this.orderList = [], |
| | | this.orderNo = '' |
| | | this.messageText = "重置完成" |
| | | this.messageToggle('success') |
| | | }, |
| | | // 取消重置 |
| | | resetClose() { |
| | | |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .combox { |
| | | background-color: white; |
| | | padding: 8px; |
| | | display: flex; |
| | | } |
| | | .list-header { |
| | | border-top: 1px solid #eee; |
| | | background-color: white; |
| | | text-align: center; |
| | | min-height: 70rpx; |
| | | line-height: 70rpx; |
| | | color: #555; |
| | | font-weight: bold; |
| | | } |
| | | .order-item { |
| | | margin: 8px; |
| | | padding: 16px; |
| | | background-color: white; |
| | | border-radius: 10px; |
| | | display: flex; |
| | | } |
| | | .orderDetl-none { |
| | | height: 100vh; |
| | | text-align: center; |
| | | line-height: 50vh; |
| | | color: #aaa; |
| | | } |
| | | .buttom { |
| | | width: 100%; |
| | | position: fixed; |
| | | bottom: 0; |
| | | left: 0; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | height: 100rpx; |
| | | background-color: #FFF; |
| | | } |
| | | </style> |