12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052 |
- <template>
- <view>
- <view class="sticky-box">
- <view class="button-group">
- <button type="default" @click="reset">取消</button>
- <!-- <button type="default" @click="navigateToSummary">统计</button> -->
- <button type="default" @click="navigateToSearch">查询</button>
- <button type="default" >源单</button>
- <button type="default" @click="navigateToStage">暂存</button>
- <button type="default" @click="navigateToSearch">提交</button>
- </view>
- <uni-easyinput prefixIcon="search" :focus="isFocus" v-model="searchValue" @blur="isFocus = false"
- @confirm="scan" @clear="clear" placeholder="请扫描拼件单号">
- </uni-easyinput>
- </view>
- <view class="table-container" style="height: 100vh;">
- <scroll-view class="table-content" :style="{'height': clientHeight + 'px'}" scroll-x scroll-y
- :scroll-into-view="scrollItem">
- <!-- <scroll-view scroll-x="true" class="scroll-view-header"> -->
- <view class="table-header">
- <view class="table-cell">操作</view>
- <view class="table-cell">扫描状态</view>
- <view class="table-cell">调出仓位</view>
- <view class="table-cellwl">物料编码</view>
- <view class="table-cell1">装箱单号</view>
- <view class="table-cell1">调拨数量</view>
- <view class="table-cell1">箱号</view>
- <view class="table-cell1">等级</view>
- <view class="table-cellph">批号</view>
- <view class="table-cell2">总件数</view>
- <view class="table-cell" v-if="showRemark">备注</view>
- <view class="table-cell2">仓位原件数</view>
- <view class="table-cell">发货件数</view>
- <view class="table-cell3">单据编号</view>
- <view class="table-cell">仓管员</view>
- </view>
- <view class="table-row" v-for="(item, index) in indexList" :key="index" :id="'scrollItem-' + index"
- :style="getStyle(item.smzt)">
- <view class="table-cell"><button type="default" size="mini" @click="edit(item,index)">编辑</button>
- </view>
- <view class="table-cell">{{ item.smzt? '已扫描' : '未扫描' }}</view>
- <view class="table-cell">{{ item["FSrcStockLocId.FF102029.FName"] }}</view>
- <view class="table-cellwl" :style="getStyle(item.smzt)">{{ item["FMaterialId.FNumber"] }}</view>
- <view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FENCHASENUM.LT"] }}</view>
- <view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FQty"] }}</view>
- <view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FBOXNO.LT"] }}</view>
- <view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FAuxPropId.FF101501.FDataValue"] }}</view>
- <view class="table-cellph" :style="getStyle(item.smzt)">{{ item["FLot.FNumber"] }}</view>
- <view class="table-cell2" :style="getStyle(item.smzt)">{{ item["rowCount"] }}</view>
- <view class="table-cell" :style="getStyle(item.smzt)">{{ item["FNoteEntry"] }}</view>
- <view class="table-cell2" :style="getStyle(item.smzt)">{{ item["quantity"] }}</view>
- <view class="table-cell" :style="getStyle(item.smzt)">{{ item["rowCount"] }}</view>
- <view class="table-cell3" :style="getStyle(item.smzt)">{{ item["FBillNo"] }}</view>
- <view class="table-cell" :style="getStyle(item.smzt)">{{ item["FStockerId.FName"] }}</view>
- </view>
- </scroll-view>
- </view>
- <view style="height: 200px;touch-action: none;"></view>
- <view class="card-bottom" style="">
- <view style="margin: 0 auto;">
- <!-- <view class="input-select">
- <uni-data-select v-model="loginForm.acctID" :localdata="range" @change="change"
- :clear="false"></uni-data-select>
- </view> -->
- <view
- style="display: flex;flex-direction: row;margin-top: 8px;font-size: 12px;margin-right: 15px;margin-bottom: 8px;">
- <view style="margin-right: 15px;">源单明细:{{ indexList.length }}</view>
- <view style="margin-right: 15px;">已扫描:{{ indexListLength }}</view>
- <!-- <view>剩余件数:{{ balance }}</view> -->
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- audit,
- getInventoryList,
- save,
- submit
- } from '../../api/production_replenishment';
- import modal from '../../plugins/modal';
- // import {
- // audioUrls,
- // playVoice
- // } from '../../utils/audio';
- import {
- playVoice,
- audioUrls,
- playSequentially
- } from '../../utils/audio2';
- import {
- getAuditParam,
- getSaveParam,
- getSubmitParam
- } from '../../utils/params';
- import submitHelper from '@/utils/commonSubmitHelper.js'; // 确保路径正确
- import {
- executeSql
- } from '../../utils/database';
- import {
- createInventoryQueryRequest
- } from '@/utils/transferparams.js';
- export default {
- onShow() {
- const res = uni.getSystemInfo({
- success: (res => {
- console.log(res.windowHeight)
- if (res.windowHeight < 600) {
- this.clientHeight = 580
- } else {
- this.clientHeight = res.windowHeight - 150;
- }
- console.log(res.windowHeight)
- console.log(this.clientHeight)
- // console.log(getApp().globalData.navHeight)
- })
- });
- this.$nextTick(() => {
- this.searchValue = ''
- this.isFocus = true;
- })
- },
- computed: {
- //已扫描数量
- indexListLength() {
- console.log("执行了计算属性")
- console.log(this.indexList.filter(obj => obj.smzt === 1).length)
- return this.indexList.filter(obj => obj.smzt === 1).length
- },
- //剩余数量
- indexList2Length() {
- let arr1 = this.indexList.filter((item, index, self) => {
- return item.smzt == 0
- })
- console.log(arr1)
- return arr1.length
- },
- //正操作仓位未扫描数量
- indexList3Length() {
- return this.indexList.filter(item =>
- item["FSrcStockLocId.FF102029.FName"] == this.Location && item['smzt'] != 1
- ).length
- },
- showWorkCenter() {
- return this.formId !== 'PUR_MRB';
- },
- showRemark() {
- return this.formId !== 'PUR_MRB';
- },
- showApplicant() {
- return this.formId !== 'PUR_MRB';
- }
- },
- mounted() {
- // 页面加载完成后滚动到目标数据位置
- uni.$on('scrollIntoView', (target) => {
- this.$nextTick(() => {
- // 使用id属性定位
- uni.createSelectorQuery().select('#' + target).boundingClientRect().exec((rect) => {
- console.log(rect)
- uni.pageScrollTo({
- scrollTop: rect[0].top - 95,
- duration: 0
- });
- });
- });
- })
- this.$nextTick(() => {
- this.searchValue = ''
- this.isFocus = true;
- })
- },
- //监听
- watch: {
- Location(newValue, oldValue) {
- console.log(`Location changed from ${oldValue} to ${newValue}`)
- this.Location = newValue
- // 可以在这里执行相应的操作
- },
- },
- data() {
- return {
- formId: '',
- fbillType: '',
- isFocus: true,
- indexList: [],
- clientHeight: '',
- searchValue: '',
- scrollItem: '', // 滚动到的指定元素
- color: '',
- Location: '', //正操作仓位
- uniqueFStockLocId: [],
- balance: 0,
- isStage: false,
- stageIds: [],
- stageLists: [],
- tableName: "common_bill",
- destStockLocId: '',
- };
- },
- //获取上一页传过来的参数
- onLoad(option) {
- this.formId = uni.getStorageSync("formId")
- this.fbillType = uni.getStorageSync("fbillType");
- console.log(this.formId)
- console.log(this.fbillType)
- uni.setNavigationBarTitle({
- title: uni.getStorageSync("moudleName")
- });
- uni.$on('item', (data) => {
- console.log(data)
- let index = data["index"]
- this.indexList[index]['FQty'] = data["FQty"]
- if ("NewFENCHASENUM.LT" in data) {
- this.indexList[index]["FENCHASENUM.LT"] = data["NewFENCHASENUM.LT"]
- }
- if (this.indexList[index]["FSrcStockLocId.FF102029.FName"] != data["FSrcStockLocId.FF102029.FName"]) {
-
- const requestData = createInventoryQueryRequest(data["FSrcStockLocId.FF102029.FName"])
- getInventoryList(JSON.stringify(requestData)).then(res => {
- this.indexList[index]["quantity"] = res.length
- console.log("修改了原仓位条数", res.length)
- this.indexList[index]['FSrcStockLocId.FF102029.FName'] = data[
- "FSrcStockLocId.FF102029.FName"]
- // 用于记录每个组合的计数
- let countMap = {};
- // 统计每个组合的行数
- this.indexList.forEach(obj => {
- // 获取当前对象的组合键
- let key = obj.FBillNo + '|' + obj['FSrcStockLocId.FF102029.FName'];
- // 如果该组合已经存在于 countMap 中,则增加计数,否则初始化为 1
- if (countMap[key]) {
- countMap[key]++;
- } else {
- countMap[key] = 1;
- }
- });
- // 将计数值添加到每个对象中
- this.indexList.forEach(obj => {
- let key = obj.FBillNo + '|' + obj['FSrcStockLocId.FF102029.FName'];
- obj.rowCount = countMap[key];
- });
- })
- }
- this.indexList[index]['FInventoryQty'] = data["FInventoryQty"]
-
-
- // 定义一个映射对象
- const formIdMap = {
- 'STK_TransferDirect': 'FQty',
- };
- // 获取对应的字段名称
- const field = formIdMap[this.formId];
- // 如果存在匹配的字段,则更新 indexList
- if (field) {
- this.indexList[index][field] = data[field];
- }
- console.log(this.indexList[index])
- this.$nextTick(() => {
- this.searchValue = ''
- this.isFocus = true
- })
- })
- uni.$on('search', (data) => {
- console.log(data)
- this.indexList = data
- this.indexList.forEach(item => {
- // item.smzt = 0; // 增加属性 smzt,并设置初始值为0
- this.$set(item, 'smzt', 0);
- })
- // 用于记录每个组合的计数
- let countMap = {};
- // 统计每个组合的行数
- this.indexList.forEach(obj => {
- // 获取当前对象的组合键
- let key = obj.FBillNo + '|' + obj['FSrcStockLocId.FF102029.FName'];
- // 如果该组合已经存在于 countMap 中,则增加计数,否则初始化为 1
- if (countMap[key]) {
- countMap[key]++;
- } else {
- countMap[key] = 1;
- }
- });
- // 将计数值添加到每个对象中
- this.indexList.forEach(obj => {
- let key = obj.FBillNo + '|' + obj['FSrcStockLocId.FF102029.FName'];
- // obj.rowCount = countMap[key];
- this.$set(obj, 'rowCount', countMap[key])
- });
- // 1. 提取不同的仓位
- this.uniqueFStockLocId = [...new Set(this.indexList.map(obj => obj[
- 'FSrcStockLocId.FF102029.FName']))];
- console.log(this.uniqueFStockLocId)
- // this.processQuantity(this.uniqueFStockLocId[0])
- this.updateIndexList(this.indexList)
- this.$nextTick(() => {
- this.searchValue = ''
- this.isFocus = true;
- })
- })
- uni.$on('summary', (data) => {
- console.log(data)
- this.indexList = data
- this.searchValue = ''
- this.isFocus = true;
- })
- uni.$on('stage', (data) => {
- console.log(data)
- // 处理每个对象
- this.stageLists = data.map(item => {
- // 解析 data 字段
- const parsedData = JSON.parse(item.data);
- // 返回处理后的对象
- return {
- ...item,
- data: parsedData
- };
- });
- this.stageIds = data.map(item => item.id)
- // this.stageLists = data.map(item => item.data)
- console.log(this.stageIds)
- console.log(this.stageLists)
- // 解析字符串为数组并合并
- const combinedArray = this.stageLists
- .map(item => item.data) // 解析每个字符串
- .flat(); // 合并所有数组
- console.log(combinedArray);
- this.indexList = combinedArray
- this.searchValue = ''
- this.isFocus = true;
- this.isStage = true
- })
- this.$nextTick(() => {
- console.log('dddd')
- this.searchValue = ''
- this.isFocus = true;
- })
- // this.$forceUpdate()
- },
- methods: {
- getActualWorkQuantity(item) {
- switch (this.formId) {
- case 'LT_PRD_PMCWorkBench':
- case 'SP_PickMtrl':
- return item["FActualQty"];
- case 'STK_MisDelivery':
- return item["FQty"];
- case 'PUR_MRB':
- return item["FRMREALQTY"];
- default:
- return item["FQty"];
- }
- },
- getFabricOrderNo(item) {
- switch (this.formId) {
- case 'PUR_MRB':
- return item["FFabricOrderNo"];
- default:
- return item["FFabricOrderNo.LT"];
- }
- },
- getWorkCenterName(item) {
- switch (this.formId) {
- case 'LT_PRD_PMCWorkBench':
- return item["FEWorkCenterId.LT.fname"];
- case 'STK_MisDelivery':
- case 'SP_PickMtrl':
- return item["FWorkCenterId.fname"];
- default:
- return '';
- }
- },
- getApplicantName(item) {
- switch (this.formId) {
- case 'LT_PRD_PMCWorkBench':
- return item["FApplicantId.fname"];
- case 'STK_MisDelivery':
- return item["FPickingPeople.LT.fname"];
- case 'SP_PickMtrl':
- return item["FPickerId.fname"];
- default:
- return ''; // 默认返回值,可以根据需求调整
- }
- },
- async updateIndexList(data1) {
- try {
- // 存储所有的异步操作 promise
- let promises = [];
- // 遍历 uniqueFStockLocId 数组
- for (let fname of this.uniqueFStockLocId) {
- // const data = {
- // "parameters": [{
- // "FormId": "STK_Inventory",
- // "FieldKeys": "fID",
- // "FilterString": [{
- // "Left": "",
- // "FieldName": "FSrcStockLocId.FF102029.FName",
- // "Compare": "67",
- // "Value": fname,
- // "Right": "",
- // "Logic": 0
- // },
- // {
- // "Left": "",
- // "FieldName": "FBaseQty",
- // "Compare": "21",
- // "Value": "0",
- // "Right": "",
- // "Logic": 0
- // }
- // ],
- // }]
- // };
- const requestData = createInventoryQueryRequest(fname)
- // 发起异步请求,并将 promise 存储在数组中
- let promise = getInventoryList(JSON.stringify(requestData)).then(res => {
- let objs = data1.filter(item => item['FSrcStockLocId.FF102029.FName'] === fname);
- objs.forEach(obj => {
- this.$set(obj, 'quantity', res.length);
- });
- });
- promises.push(promise);
- }
- // 等待所有异步操作完成
- await Promise.all(promises)
- console.log(data1)
- this.indexList = data1
- console.log('indexList updated:', this.indexList);
- } catch (error) {
- console.error('Error updating indexList:', error);
- }
- },
-
- scrollToItem(itemId) {
- // 设置滚动到的指定元素的 ID
- this.scrollItem = itemId;
- console.log(this.scrollItem)
- },
- //取消
- reset() {
- const self = this
- modal.confirm("是否重置?").then(res => {
- if (res) {
- self.indexList = []
- self.searchValue = ""
- self.balance = 0
- this.isFocus = true
- playVoice(audioUrls.warningSuccessUrl)
- } else {
- // 用户点击取消,不执行任何操作
- }
- })
- },
- edit(item, index) {
- uni.navigateTo({
- url: '/pages/direct-transfer/show?item=' + encodeURIComponent(JSON.stringify(
- item)) +
- '&&index=' + encodeURIComponent(JSON.stringify(index))
- });
- },
- // scrollToItem(id) {
- // // 使用id属性定位
- // this.$nextTick(() => {
- // uni.$emit('scrollIntoView', id);
- // })
- // },
- showDetail(index) {
- console.log(index);
- let item = this.indexList[index.name]
- console.log(item)
- uni.navigateTo({
- url: '/pages/automatedwarehouse/listshow?Info=' + encodeURIComponent(JSON.stringify(
- item))
- });
- },
- focusPoint() {
- this.isFocus = false;
- this.$nextTick(() => {
- this.isFocus = true;
- });
- },
- clear() {
- this.focusPoint()
- },
- //跳转到查询页面
- navigateToSearch() {
- if (this.indexList.length > 0) {
- // this.isRangeSelected = false; // 显示错误提示
- playVoice(audioUrls.failVoiceUrl)
- uni.showToast({
- title: '源单已选择',
- duration: 2000,
- icon: "error"
- });
- return;
- }
- uni.navigateTo({
- // url: '/pages/production-replenishment/search', //这是你的当前页面地址
- url: `/pages/direct-transfer/search?FormId=${this.formId}&FBillType=${this.fbillType}`
- });
- },
- navigateToSummary() {
- uni.navigateTo({
- url: '/pages/direct-transfer/summary?Info=' + encodeURIComponent(JSON
- .stringify(this.indexList)) + '&&stageInfo=' + encodeURIComponent(JSON
- .stringify(this.stageLists)), //这是你的当前页面地址
- });
- },
- navigateToStage() {
- uni.navigateTo({
- url: '/pages/direct-transfer/stage?Info=' + encodeURIComponent(JSON
- .stringify(this.indexList)), //这是你的当前页面地址
- });
- },
- searchValueIsEmpty(data) {
- console.log(data)
- if (data == "" || data == undefined) {
- return true
- } else {
- return false
- }
- },
- checkBarcodeInArray(barcode, arrayOfObjects, propertyName) {
- if (arrayOfObjects.findIndex(item => item[propertyName] === barcode) < 0) { //不存在
- return true
- }
- return false
- },
- areAllDetailsScanned(nowindex) {
- if (this.indexList.filter(item =>
- item["FBillNo"] == this.indexList[nowindex].FBillNo && item[
- 'smzt'] == 0
- ).length == 0) {
- return true
- }
- return false
- },
- showToast() {
- uni.showToast({
- title: '请扫描条码',
- icon: 'none',
- duration: 3000
- })
- },
- handlePositionScanCompletion() { //根据仓位扫描的完成情况来处理不同的逻辑
- if (this.indexList.filter(item =>
- item["FSrcStockLocId.FF102029.FName"] == this.Location && item[
- 'smzt'] != 1
- ).length == 0) { //该仓位扫描完
- playVoice(audioUrls.allSuccessVoiceUrl)
- uni.showToast({
- title: '该仓位扫描完成',
- icon: 'none',
- duration: 3000
- })
- } else { //如果改仓位未扫描完,提示音
- playVoice(audioUrls.successVoiceUrl)
- uni.showToast({
- title: '扫描成功',
- icon: 'none',
- duration: 3000
- })
- }
- },
- handleError(error) {
- playVoice(audioUrls.failVoiceUrl)
- console.error('操作失败:', error);
- modal.confirm(error.message || '操作失败').then(res => {
- if (res) {
- } else {
- // 用户点击取消,不执行任何操作
- }
- })
- // uni.showToast({
- // title: error.message || '操作失败',
- // duration: 3000,
- // icon: "none"
- // });
- },
- async handleSubmit(FID) {
- const FormId = uni.getStorageSync('formId')
- try {
- await submitHelper.submit(FormId, FID, this.indexList);
- this.indexList = this.indexList.filter(item => item.FID !== FID);
- console.log(this.indexList)
- if (this.isStage == true) {
- // 处理每个对象
- this.stageLists.forEach(item => {
- // 过滤掉 FID 匹配的对象
- item.data = item.data.filter(obj => obj.FID !== FID);
- // 检查 data 数组是否为空
- if (item.data.length === 0) {
- console.log("data 数组为空"); //删除暂存
- this.deleteStages(item.id)
- } else {
- console.log("data 数组不为空");
- }
- })
- console.log(this.stageLists)
- }
- this.balance = 0
- } catch (error) {
- this.handleError(error)
- }
- },
- async deleteStages(id) {
- let condition = `id = (${id})`
- let sql = `delete from ${this.tableName} where ${condition}`
- executeSql(sql).then(result => {
- console.log('结果:', result);
- // this.handleDeleteSuccess()
- })
- .catch(error => {
- console.error('捕获错误:', error); // 输出: 捕获错误: 失败的结果
- // this.handleDeleteFail(error)
- })
- },
- showModalAndHandleSubmit(nowindex) {
- let vm = this
- console.log(nowindex)
- let bBillNo = this.indexList[nowindex]["FBillNo"]
- let FID = this.indexList[nowindex]["FID"]
- this.$nextTick(() => {
- this.searchValue = ''
- this.isFocus = true;
- })
- playVoice(audioUrls.allSuccessVoiceUrl)
- uni.showModal({
- title: "提示",
- content: "单号(" + bBillNo + ")已扫描完毕,是否提交",
- showCancel: true,
- success: function(res) {
- if (res.confirm) {
- // this.submit(FID)
- this.handleSubmit(FID)
- } else {
- // 执行取消后的操作
- }
- }.bind(this)
- })
- },
- handleScanSuccess(nowindex) {
- this.Location = this.indexList[nowindex]["FSrcStockLocId.FF102029.FName"]
- this.indexList[nowindex].smzt = 1 //修改数据状态
- console.log(this.indexList.filter(obj => obj.smzt === 1).length)
- this.$forceUpdate()
- const audioUrlsArr = [];
- console.log(this.getActualWorkQuantity(this.indexList[nowindex]))
- //是否全发
- // if (this.getActualWorkQuantity(this.indexList[nowindex]) == this.indexList[nowindex][
- // "FInventoryQty"
- // ]) { //全发播放声音
- // console.log("播放声音")
- // audioUrlsArr.push(audioUrls.successVoiceUrl);
- // } else { //不全发播放声音
- // audioUrlsArr.push(audioUrls.success2VoiceUrl);
- // }
- audioUrlsArr.push(audioUrls.success2VoiceUrl);
- playSequentially(audioUrlsArr);
- if (this.indexList.filter(item =>
- item["FSrcStockLocId.FF102029.FName"] == this.Location && item[
- 'smzt'] != 1
- ).length == 0) { //该仓位扫描完
- // playVoice(audioUrls.allSuccessVoiceUrl)
- audioUrlsArr.push(audioUrls.storeSuccessUrl);
- }
- if (this.areAllDetailsScanned(nowindex)) { //校验单号是否全扫完
- audioUrlsArr.push(audioUrls.allSuccessVoiceUrl)
- // playVoice(audioUrls.allSuccessVoiceUrl)
- this.showModalAndHandleSubmit(nowindex)
- } else { //单号未全扫完
- // this.handlePositionScanCompletion()
- this.$nextTick(() => {
- this.searchValue = ''
- this.isFocus = true;
- this.scrollToItem("scrollItem-" + nowindex)
- })
- }
- playSequentially(audioUrlsArr);
- },
- scan() {
- let vm = this
- //校验是否输入条码
- if (this.searchValueIsEmpty(this.searchValue)) {
- playVoice(audioUrls.failVoiceUrl)
- this.showToast()
- this.focusPoint()
- return
- }
- // 校验条码是否存在
- if (this.checkBarcodeInArray(this.searchValue, this.indexList, "FENCHASENUM.LT")) {
- uni.showModal({
- title: '提示',
- content: "条码:" + vm.searchValue + '不存在',
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- this.focusPoint()
- vm.searchValue = ''
- return
- } else {
- // 执行取消后的操作
- }
- }.bind(this)
- })
- playVoice(audioUrls.failVoiceUrl)
- return
- }
-
- //条码存在未扫描
- let nowlocation = null; //该条码的仓位
- let nowindex = null; //该条码的索引
- for (let i = 0; i < this.indexList.length; i++) { //获取查询装箱单号对应仓位,并切换当前仓位
- if (this.indexList[i]["FENCHASENUM.LT"] === this.searchValue) {
- nowlocation = this.indexList[i]["FSrcStockLocId.FF102029.FName"] //当前仓位
- nowindex = i //当前索引
- this.balance = this.indexList[i]["quantity"] - this.indexList[i]["rowCount"]
- break;
- }
- }
- //不是首次扫描
- if (this.indexListLength != 0) { //已有操作,计算上次操作的仓位未扫描数
- let UnscannedNumber = this.indexList.filter(item =>
- item["FSrcStockLocId.FF102029.FName"] === this.Location && item['smzt'] != 1
- ).length
-
- if (nowlocation != this.Location && UnscannedNumber != 0) { //仓位不一致
- playVoice(audioUrls.warningSuccessUrl)
- uni.showModal({
- title: "提示",
- content: "是否切换仓位",
- showCancel: true,
- success: function(res) {
- if (res.confirm) {
- vm.handleScanSuccess(nowindex)
- } else {
- // 执行取消后的操作
- vm.$nextTick(() => {
- vm.searchValue = ''
- vm.isFocus = true;
- })
- }
- }
- })
- return
- } else { //仓位一致或原仓位已扫完,正常扫描,无切换
- this.handleScanSuccess(nowindex)
- }
- } else { //首次扫描
- this.handleScanSuccess(nowindex)
- }
- },
- getHeightStyle() {
- return 'height:' + this.listHeight + 'px';
- },
- getStyle(smzt) {
- return smzt ? 'background-color: Navy;color:white' : '';
- // return 'scrollItem-' + index === this.scrollItem ? 'background-color: blue;color:white' : '';
- },
- }
- };
- </script>
- <style lang="scss">
- .button-group {
- display: flex;
- justify-content: flex-start;
- /* 主轴上左对齐 */
- align-items: center;
- /* 垂直居中对齐 */
- }
- .button-group button {
- white-space: nowrap;
- /* 禁止换行 */
- // margin-right: 10px;
- }
- .button-item {
- flex: 1;
- text-align: center;
- padding: 10px;
- font-size: 16px;
- background-color: #eee;
- }
- /* 容器样式 */
- .table-container {
- width: 100%;
- // overflow: hidden;
- /* 添加滚动条 */
- }
- /* 表头样式 */
- .table-header {
- // background-color: #f0f0f0;
- font-weight: bold;
- display: flex;
- }
- /* 表行样式 */
- .table-row {
- display: flex;
- flex-direction: row;
- /* 水平布局 */
- // border-top: 1px solid #ccc;
- }
- /* 表内容样式 */
- .table-content {
- width: 100%;
- overflow: auto;
- }
- /* 单元格样式 */
- .table-cell1 {
- min-width: 85px;
- /* 设置最小宽度 */
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 5px;
- border: 0.5px solid #ccc;
- // text-align: center;
- }
- /* 单元格样式 */
- .table-cell2 {
- min-width: 90px;
- /* 设置最小宽度 */
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 5px;
- border: 0.5px solid #ccc;
- // text-align: center;
- }
- /* 单元格样式 */
- .table-cell3 {
- min-width: 100px;
- /* 设置最小宽度 */
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 5px;
- border: 0.5px solid #ccc;
- // text-align: center;
- }
- /* 单元格样式 */
- .table-cell4 {
- min-width: 85px;
- /* 设置最小宽度 */
- flex: 1;
- padding: 8px;
- border: 0.5px solid #ccc;
- text-align: center;
- }
- /* 单元格样式 */
- .table-cell {
- min-width: 80px;
- padding: 5px;
- display: flex;
- justify-content: center;
- align-items: center;
- border: 0.5px solid #ccc;
- // text-align: center;
- }
- /* 单元格样式 */
- .table-cellph {
- min-width: 310px;
- display: flex;
- justify-content: center;
- align-items: center;
- border: 0.5px solid #ccc;
- }
- /* 单元格样式 */
- .table-cellwl {
- min-width: 150px;
- /* 设置最小宽度 */
- display: flex;
- justify-content: center;
- align-items: center;
- border: 0.5px solid #ccc;
- // text-align: center;
- }
- /* 最后一个单元格去掉右边框 */
- .table-cell:last-child {
- // border-right: none;
- }
- .example {
- padding: 15px;
- background-color: #fff;
- }
- .form-item {
- display: flex;
- align-items: center;
- }
- .sticky-box {
- /* #ifndef APP-PLUS-NVUE */
- // display: flex;
- position: -webkit-sticky;
- /* #endif */
- position: sticky;
- top: var(--window-top);
- z-index: 99;
- flex-direction: row;
- margin: 0px;
- // padding: 15px 0 15px 0;
- background-color: #F4F5F6;
- // border-bottom-style: solid;
- // border-bottom-color: #E2E2E2;
- }
- .button {
- border-color: #e5e5e5;
- border-style: solid;
- border-width: 1px;
- padding: 4px 8px;
- border-radius: 4px;
- }
- .card-bottom {
- touch-action: none;
- // height: 60px;
- position: fixed;
- bottom: 0;
- width: 100%;
- z-index: 999;
- background-color: white;
- border-top: 1px;
- display: flex;
- flex-direction: column;
- }
- .text {
- font-size: 12px;
- color: #666;
- margin-top: 5px;
- }
- .button {
- margin-bottom: 10px;
- }
- .segmented-control {
- margin-bottom: 15px;
- }
- // .button-group {
- // margin-top: 15px;
- // display: flex;
- // justify-content: space-around;
- // }
- .form-item {
- display: flex;
- align-items: center;
- }
- .button {
- display: flex;
- align-items: center;
- height: 35px;
- margin-left: 10px;
- }
- </style>
- <style lang="scss">
- .u-page {
- padding: 0;
- }
- .u-demo-block__title {
- padding: 10px 0 2px 15px;
- }
- .swipe-action {
- &__content {
- padding: 25rpx 0;
- display: flex;
- flex-direction: column; //设置布局方向为竖直
- &__text {
- font-size: 15px;
- color: $u-main-color;
- padding-left: 30rpx;
- }
- }
- }
- .u-swipe-action-item {
- touch-action: none;
- }
- .red {
- color: red;
- }
- .label-picker-container {
- display: flex;
- align-items: center;
- /* 垂直居中对齐 */
- font-size: 12px;
- /* 设置标签的字体大小 */
- }
- </style>
|