Files
GX.O3.WMS/APK/APP_O3/pages/views/UN_Packaging/UN_Packaging.vue
T

1468 lines
40 KiB
Vue
Executable File

<template>
<view class="page-class">
<opsoft-dialog-notice
:dialogNoticeShow="showDialog"
:dialogNoticeType="dialogNoticeType"
:dialogNoticeTitle="dialogNoticeTitle"
:dialogNoticeContent="dialogNoticeContent"
@dialogNoticeConfirmClick="dialogNoticeConfirmClick"
></opsoft-dialog-notice>
<view class="head-class">
<view class="header-top" style="margin: 0;">
<view class="header-top-organzie" style="">
<text class="header-row-title-class">当前组织</text>
<view class="header-top-organzie-select">
<picker @change="orgChange" :value="index" :range="orgArry" range-key="FNAME" style="width: 100%;">
<view class="header-top-organzie-content">{{ orgArry[index].FNAME }}</view>
</picker>
</view>
<image class="header-top-organzie-img" src="@/static/login/icon-pull.png" />
</view>
<view class="header-top-date">
<view class="header-top-data-select" @click="creatDatePicker()">{{ creatlist[0].detail }}</view>
<!-- <image class="" src="@/static/login/icon-pull.png" style="height: 32rpx;width: 32rpx;padding-left: 10rpx;position: absolute;right: 0;"></image> -->
<date-time-picker ref="creatTime" :indicatorStyle="indicatorStyle" :type="type" :datestring="dateString" @change="creatTimeChange"></date-time-picker>
</view>
</view>
<view class="head-row-class">
<p class="head-row-title-class">生成条码类型</p>
<xfl-select
:list="codeTypeList"
:listOrigin="codeTypeList"
:clearable="false"
:isCanInput="false"
ref="billTypeList"
class="head-row-input-class"
:defaultSelectText="codeTypeSelectText"
@change="codeTypeChange"
/>
</view>
<view class="head-row-class">
<p class="head-row-title-class">条&ensp;&ensp;&ensp;&ensp;码</p>
<input type="text" class="head-row-input-class" v-model="FBarCodeNO" @confirm="getBarCodeInfo()" :focus="barcodeFocus" />
<image src="../../../static/img/scan-blue.png" v-show="showScan" @click="scan('barCodeScan')"></image>
</view>
<view class="head-row-class">
<p class="head-row-title-class">数&ensp;&ensp;&ensp;&ensp;量</p>
<input
type="text"
:class="[qtyDisable ? 'head-row-input-disable-class' : 'head-row-input-class']"
v-model="FQty"
@confirm="checkQtyConfirm()"
:disabled="qtyDisable"
:focus="qtyFocus"
/>
</view>
<view class="head-row-class">
<p class="head-row-title-class">是否混装</p>
<checkbox-group @change="mixedCbChange" style="width: 150rpx;">
<checkbox class="head-checkbox-class" :checked="isMixed" :disabled="mixedDisabled"></checkbox>
</checkbox-group>
<view v-if="printSwitch || bluetoothSwitch" style="display: flex; align-items: center;">
<p class="head-row-title-class">是否打印</p>
<checkbox-group @change="printCbChange"><checkbox class="head-checkbox-class" :checked="isPrinted"></checkbox></checkbox-group>
</view>
</view>
</view>
<view class="space-separate-class"></view>
<view class="tab-lists-class">
<view @tap="showScannedTab()" :class="[selectScannedTabFlag ? 'tab-selected-class' : 'tab-unselected-class']">已扫描</view>
<view class="tab-line-class" />
<view @tap="showBarcodeTab()" :class="[selectBarcodeTabFlag ? 'tab-selected-class' : 'tab-unselected-class']">已装箱</view>
<view class="tab-line-class" v-if="bluetoothSwitch || printSwitch" />
<view @tap="showPrintTab()" :class="[selectPrintTabFlag ? 'tab-selected-class' : 'tab-unselected-class']" v-if="printSwitch">打印设置</view>
<view class="tab-line-class" v-if="bluetoothSwitch && printSwitch" />
<view @tap="showBluePrintTab()" :class="[selectBluePrintTabFlag ? 'tab-selected-class' : 'tab-unselected-class']" v-if="bluetoothSwitch">蓝牙设置</view>
</view>
<view v-show="showPrintContentFlag">
<NetworkPrintTab :prgkey="currentTranType" :printInfo="newIntelID" ref="networkPrintTab" :orgId="orgFItemID" :baseUrl="baseUrl" />
</view>
<view v-show="showBluePrint"><BluetoothPrintTab ref="bluetoothPrintTab" :currentTranType="currentTranType" /></view>
<view class="table" v-show="showYesShow">
<view class="z-table" style="padding-bottom: 100rpx;">
<z-table :tableData="YESTableData" :columns="YESColumns" emptyText="设置了showLoading=false才会看到我" showSelect @onSelect="tableSelect" />
</view>
<!-- <view class="del-commit"> -->
<view class="type-select-box-del" v-show="!showResult">
<view
@click="del()"
style="color: #FFFFFF;border-radius: unset; background: #F76260;height: 80rpx;
line-height: 80rpx;font-size: 32rpx; text-align: center;"
>
删除
</view>
</view>
<view class="type-select-box-commit" v-show="showResult">
<view
style="color: #FFFFFF;border-radius: unset;height: 80rpx;line-height: 80rpx;font-size: 32rpx; text-align: center;"
:style="{ 'background-color': !isCommitBtnDisable ? '#4662FF' : '#808080' }"
@click="commitBtnClick()"
:disabled="isCommitBtnDisable"
>
提交
</view>
</view>
<!-- </view> -->
<view class="alter" v-show="showCashTips"></view>
<view class="err" v-show="showCashTips">
<view class="errTitle">温馨提示</view>
<view class="errList"><view class="errDetails">当前页面存在未提交数据,是否需要加载</view></view>
<view style="height: 20rpx;"></view>
<view class="cash-btn">
<view class="cashConfirm" @click="comfirmHideCashTips">确定</view>
<view class="cashCancel" @click="cancelHideCashTips">取消</view>
</view>
</view>
</view>
<view class="table" v-show="selectBarcodeTabFlag">
<view class="z-table">
<z-table :tableData="barcodeTableData" :columns="barcodeColumns" emptyText="设置了showLoading=false才会看到我" showSelect @onSelect="barcodeSelect"></z-table>
<button
class="button-class"
@tap="printBarcode()"
:disabled="printList.length == 0"
:style="{ 'background-color': printList.length == 0 ? '#808080' : '' }"
v-if="printSwitch"
>
普通打印
</button>
<button
class="button-class"
@tap="bluePrintBarcode()"
:disabled="printList.length == 0"
:style="{ 'background-color': printList.length == 0 ? '#808080' : '' }"
v-if="bluetoothSwitch"
>
蓝牙打印
</button>
</view>
</view>
</view>
</template>
<script>
import { mapState, mapMutations } from 'vuex';
import BluetoothPrintTab from '@/components/bluetooth-print-tab/bluetooth-print-tab.vue';
import NetworkPrintTab from '@/components/network-print-tab/network-print-tab.vue';
import DateTimePicker from '@/components/bory-dateTimePickerWithOutTime/bory-dateTimePickerWithOutTime.vue';
const commonUtil = require('../../../common/util.js');
let _self;
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
import errorStrUntil from '@/common/errorStrUntil.js';
export default {
components: {
BluetoothPrintTab,
NetworkPrintTab,
DateTimePicker,
opsoftDialogNotice
},
data() {
return {
dialogNoticeContent: '',
dialogNoticeTitle: '',
dialogNoticeType: '',
showDialog: false,
// 日期选择
dateString: '',
type: 'date',
creatlist: [
{
type: 'date',
detail: '选择开始时间'
}
],
curDate: '',
dbAlise: '',
userName: '',
isChangedOrg: false,
showScan: true,
barcodeDisable: false,
currentTranType: 'UN_Packaging',
showCashTips: false,
loadCash: false,
pageCashInfo: new Object(),
barcodeExistList: [],
FUnitID: '',
showOrgFlag: true,
orgArry: [{ name: '请选择组织', key: '', FName: '' }],
orgFItemID: '',
index: 0,
barcodeFocus: false,
qtyFocus: false,
showResult: true,
selectScannedTabFlag: true,
selectBluePrintTabFlag: false,
selectPrintTabFlag: false,
isCommitBtnDisable: false,
currentBillType: 1,
isMixed: false,
showYesShow: true,
showPrintContentFlag: false,
YESTableData: [],
qtyDisable: true,
FBarCodeNO: null,
FBoxCodeNO: null,
currentBarcodeNO: null,
FQty: null,
//已扫描
YESColumns: [
{ title: '条码', key: 'FNumber', width: 350, formatNum: false },
{ title: '批号', key: 'FBatchNO', width: 450, formatNum: false },
{ title: '数量', key: 'FQty', width: 250 },
{ title: '单位', key: 'FUnitName', width: 250, formatNum: false },
{ title: '物料代码', key: 'FItemNumber', width: 350, formatNum: false },
{ title: '物料名', key: 'FItemName', width: 350, formatNum: false },
// { title: "规格", key: "FSize", width: 250, formatNum: false },
{ title: '规格型号', key: 'FModel', width: 250, formatNum: false }
],
barcodeDataTempList: [],
commitDataList: [],
selectedList: [],
showBluePrint: false,
mixedDisabled: false,
baseUrl: '',
selectBarcodeTabFlag: false,
barcodeTableData: [],
barcodeColumns: [{ title: '条码', key: 'barcode', width: 400, formatNum: false }, { title: '状态', key: 'status', width: 300, formatNum: false }],
printList: [],
isPrinted: true,
printSwitch: false,
bluetoothSwitch: false,
systemParameter: null,
newIntelID: '',
codeType: 0,
codeTypeList: [
{
id: 0,
value: '箱码'
},
{
id: 1,
value: '托盘码'
}
],
codeTypeSelectText: '箱码'
};
},
onBackPress(options) {
uni.redirectTo({
url: '../../tabbar/apply/apply'
});
return true;
},
onLoad() {
let _self = this;
this.dbAlise = uni.getStorageSync('dbAlise');
this.userName = uni.getStorageSync('userName');
_self.showbarCodeFocus();
_self.getOrgList();
_self.baseUrl = uni.getStorageSync('RequestUrl');
_self.systemParameter = uni.getStorageSync('systemParameter');
_self.printSwitch = _self.systemParameter.printSwitch;
_self.bluetoothSwitch = _self.systemParameter.bluetoothSwitch;
this.judgeCash();
//当前时间
let date = new Date();
this.curDate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
this.creatlist[0].detail = this.curDate;
},
onReady() {
if (this.$refs.bluetoothPrintTab) {
this.$refs.bluetoothPrintTab.orgId = this.orgFItemID;
}
},
computed: {
indicatorStyle() {
return {
background: 'rgba(255,0,0,.2)',
height: '40px'
};
},
barcodeRule() {
if (this.sysParameters) {
if (this.sysParameters.hasOwnProperty('BarcodeRuleForVerification')) {
let rule = this.sysParameters['BarcodeRuleForVerification'];
if (rule) {
return rule;
}
}
}
return '';
},
...mapState(['sysParameters', 'userInfo'])
},
methods: {
dialogNoticeConfirmClick() {
this.showDialog = false;
},
dialogNoticeProps(err, type) {
err = errorStrUntil.handle(err);
this.showDialog = true;
this.dialogNoticeType = 'error';
this.dialogNoticeTitle = '异常提示';
if (type == 'success') {
this.dialogNoticeType = 'success';
this.dialogNoticeTitle = '执行成功';
}
this.dialogNoticeContent = err;
},
//日期切换
creatDatePicker() {
this.type = 'date';
this.$refs['creatTime'].show();
},
creatTimeChange(value) {
let item = this.creatlist[0];
item['detail'] = value;
},
scan: function(e) {
let _self = this;
let currentScanType = e;
uni.scanCode({
success: function(res) {
if (currentScanType == 'barCodeScan') {
_self.FBarCodeNO = res.result;
_self.getBarCodeInfo();
}
}
});
},
loadByCash: function() {
let _self = this;
let lastSaveOrgid = uni.getStorageSync(this.dbAlise + this.userName + this.currentTranType + 'lastSaveOrgid');
let cashValue;
if (!this.isChangedOrg) {
cashValue = uni.getStorageSync('pageCash' + this.dbAlise + this.userName + this.currentTranType + lastSaveOrgid);
} else {
cashValue = uni.getStorageSync('pageCash' + this.dbAlise + this.userName + this.currentTranType + this.orgFItemID);
}
this.orgFItemID = cashValue.otherInfo.orgFItemID;
this.YESTableData = cashValue.YESTableData;
this.barcodeTableData = cashValue.barcodeTableData;
this.barcodeExistList = cashValue.barcodeExistList;
this.isPrinted = cashValue.isPrinted;
this.commitDataList = cashValue.commitDataList;
this.isMixed = cashValue.otherInfo.isMixed;
this.mixedDisabled = cashValue.otherInfo.mixedDisabled;
// this.FQty = cashValue.otherInfo.FQty;
// this.qtyDisable = cashValue.otherInfo.qtyDisable;
// this.FBarCodeNO = cashValue.otherInfo.FBarCodeNO;
this.currentBarcodeNO = cashValue.otherInfo.currentBarcodeNO;
this.orgArry.forEach(function(el, index) {
let currentOrgid = el.FINTERID;
let result = currentOrgid == _self.orgFItemID;
if (result) {
_self.index = index;
el.FNAME = el.FNAME ? el.FNAME : '无';
}
});
},
//组织
getOrgList: function() {
let _self = this;
let orgInfo = uni.getStorageSync('orgInfo');
if (orgInfo && orgInfo.length > 0) {
let defaultOrgInfo = uni.getStorageSync('defaultOrgInfo');
let isOpenDefaultOrg = uni.getStorageSync('isOpenDefaultOrg');
if (!isOpenDefaultOrg) {
this.orgFItemID = orgInfo[0].FINTERID;
} else {
if (defaultOrgInfo) {
this.orgFItemID = defaultOrgInfo.FINTERID;
} else {
this.orgFItemID = orgInfo[0].FINTERID;
}
}
this.orgArry = orgInfo;
this.orgArry.forEach(function(el, index) {
let currentOrgid = el.FINTERID;
let result = currentOrgid == _self.orgFItemID;
if (result) {
_self.index = index;
el.FNAME = el.FNAME ? el.FNAME : '无';
}
});
} else {
this.orgArry = [{ name: '请选择组织', key: '', FNAME: '当前无组织' }];
this.index = 0;
}
},
orgChange: function(e) {
this.isChangedOrg = true;
this.index = e.target.value;
let isOpenDefaultOrg = uni.getStorageSync('isOpenDefaultOrg');
if (!this.orgArry[this.index].FINTERID) {
this.orgFItemID = '';
} else {
this.orgFItemID = this.orgArry[this.index].FINTERID;
if (isOpenDefaultOrg) {
uni.setStorageSync('defaultOrgInfo', this.orgArry[this.index]);
}
}
let cashValue = uni.getStorageSync('pageCash' + this.dbAlise + this.userName + this.currentTranType + this.orgFItemID);
if (cashValue) {
this.loadByCash();
} else {
this.orgChangedClear();
}
this.$refs.bluetoothPrintTab.orgId = this.orgFItemID;
this.$forceUpdate();
},
orgChangedClear: function() {
this.FBarCodeNO = '';
this.FQty = '';
this.FUnitID = '';
this.isMixed = false;
this.qtyDisable = true;
this.showResult = true;
this.YESTableData = [];
this.commitDataList = [];
this.barcodeTableData = [];
this.$forceUpdate();
},
showbarCodeFocus: function() {
let _self = this;
setTimeout(function() {
_self.qtyFocus = false;
_self.barcodeFocus = false;
}, 500);
setTimeout(function() {
_self.barcodeFocus = true;
}, 600);
},
showqtyFocus: function() {
let _self = this;
setTimeout(function() {
_self.barcodeFocus = false;
_self.qtyFocus = false;
}, 500);
setTimeout(function() {
_self.qtyFocus = true;
}, 600);
},
getBarCodeInfo: function() {
let _self = this;
// if (this.barcodeDisable) {
// return false;
// }
// this.barcodeDisable = true;
this.qtyDisable = true;
this.FQty = null;
this.barcodeDataTempList.splice(0, this.barcodeDataTempList.length);
if (!this.FBarCodeNO) {
uni.showToast({
icon: 'none',
title: '请输入条码',
duration: 3500
});
// this.barcodeDisable = false;
return false;
}
this.FBoxCodeNO = this.FBarCodeNO.toUpperCase();
let isFail = this.checkBarcodeNumber(this.FBarCodeNO);
if (isFail) {
uni.showToast({
icon: 'none',
title: '请输入正确的条码',
duration: 3500
});
// this.barcodeDisable = false;
return false;
}
let requestParams = {
barcode: this.FBarCodeNO,
billType: this.currentBillType,
orgId: this.orgFItemID
};
requestParams.isMix = this.isMixed;
uni.showLoading({
icon: 'loading',
title: '加载中……',
mask: true
});
this.$request
.get('/Barcode/GetBarcodeInfo', {
params: requestParams
})
.then(res => {
uni.hideLoading();
//返回的是字符串
let data = res;
this.FUnitID = data['FUNITID'];
let rowData = {
FNumber: data['FBARCODE'],
FCType: data['FBARTYPE'],
FBarStatus: data['FBARCODESTATUS'],
FItemID: data['FMATERIALID'],
FItemNumber: data['FMATERIALNUMBER'],
FItemName: data['FMATERIALNAME'],
FBatchNO: data['FLOT'],
FQty: data['FQTY'],
FUnitName: data['FUNITNAME'],
FSize: data['FSPECIFICATION'],
FModel: data['FSPECIFICATION'],
FIsBox: data['FISBOX'],
FUnitID: data['FUNITID'],
FBASEQTY: data['FBASEQTY'],
FBASEUNITID: data['FBASEUNITID'],
MixBoxFactor: data['MixBoxFactor'],
FSTOCKSTATUSID: data.FSTOCKSTATUSID,
FUSEFULDATE: data.FUSEFULDATE,
FSTOCKLOCID: data.FSTOCKLOCID,
FSTOCKID: data.FSTOCKID
};
if (this.YESTableData.length > 0) {
// 2024-08-06 新增若混装时,不校验条码的仓库仓位是否一致
// 校验仓库/仓位是否一致
if (!this.isMixed && (rowData.FSTOCKLOCID + rowData.FSTOCKID) != (this.YESTableData[0].FSTOCKLOCID + this.YESTableData[0].FSTOCKID)) {
uni.showToast({
icon: 'none',
title: '条码的仓库,仓位一致才能合并',
duration: 3500
})
return
}
//校验仓库状态,保质期
if (rowData.FSTOCKSTATUSID != this.YESTableData[0].FSTOCKSTATUSID || rowData.FUSEFULDATE != this.YESTableData[0].FUSEFULDATE) {
uni.showToast({
icon: 'none',
title: '条码的库存状态,有效期一致才能合并',
duration: 3500
});
// this.barcodeDisable = false;
this.FBarCodeNO = '';
return false;
}
//批次条码不用判断是否重复
if (rowData.FCType != 3 || rowData.FIsBox) {
this.barcodeExistList = this.YESTableData.filter(function(el) {
return el.FNumber == _self.FBarCodeNO;
});
if (Boolean(_self.barcodeExistList) && _self.barcodeExistList.length > 0) {
uni.showToast({
icon: 'none',
title: '条码已存在',
duration: 3500
});
// this.barcodeDisable = false;
this.FBarCodeNO = '';
this.showbarCodeFocus();
// this.barcodeFocus = false;
// this.qtyFocus = false;
// this.$nextTick(function(){
// _self.barcodeFocus = true;
// _self.qtyFocus = false;
// })
return false;
}
//判断条码 FBarStatus 是否相同 -- 不需要判断条码状态要一样
/*
if (this.YESTableData[0].FBarStatus != rowData.FBarStatus) {
uni.showToast({
icon: 'none',
title: '条码状态必须相同',
duration: 3500
});
// this.barcodeDisable = false;
this.FBarCodeNO = '';
this.showbarCodeFocus();
// this.barcodeFocus = false;
// this.qtyFocus = false;
// this.$nextTick(function(){
// _self.barcodeFocus = true;
// _self.qtyFocus = false;
// })
return false;
}
*/
}
//若不混箱 MixBoxFactor 必须相同
if (!this.isMixed && this.YESTableData[0].MixBoxFactor != rowData.MixBoxFactor) {
uni.showToast({
icon: 'none',
title: '此箱未勾选混装,如果有需要请选择混装',
duration: 3500
});
// this.barcodeDisable = false;
this.FBarCodeNO = '';
this.showbarCodeFocus();
// this.barcodeFocus = false;
// this.qtyFocus = false;
// this.$nextTick(function(){
// _self.barcodeFocus = true;
// _self.qtyFocus = false;
// })
return false;
}
if (this.isMixed && this.YESTableData[0].MixBoxFactor != rowData.MixBoxFactor) {
this.mixedDisabled = true;
}
}
//只有批次条码,但不是箱码的 条码 才能变更数量
if (rowData.FCType == 3 && rowData.FIsBox == false) {
this.barcodeDataTempList.push(rowData);
this.qtyDisable = false;
this.FQty = rowData.FQty;
let commitData = {
Barcode: rowData.FNumber,
BarStatus: rowData.FBarStatus,
IsBox: rowData.FIsBox,
CartonNumber: 0,
Qty: this.FQty,
UnitId: this.FUnitID,
BaseQty: rowData.FBASEQTY,
BaseUnitId: rowData.FBASEUNITID,
MixBoxFactor: rowData.MixBoxFactor
};
this.showqtyFocus();
} else {
this.qtyDisable = true;
this.FQty = rowData.FQty;
this.YESTableData.push(rowData);
let commitData = {
Barcode: rowData.FNumber,
BarStatus: rowData.FBarStatus,
IsBox: rowData.FIsBox,
CartonNumber: 0,
Qty: rowData.FQty,
UnitId: this.FUnitID,
BaseQty: rowData.FBASEQTY,
BaseUnitId: rowData.FBASEUNITID,
MixBoxFactor: rowData.MixBoxFactor
};
this.commitDataList.push(commitData);
}
if (this.qtyDisable) {
let lastSaveOrgid = this.orgFItemID; //最后一次条码录入成功后(条码进入已扫描列表)的组织ID
uni.setStorageSync(this.dbAlise + this.userName + this.currentTranType + 'lastSaveOrgid', lastSaveOrgid);
this.saveCash();
}
this.$forceUpdate();
this.currentBarcodeNO = this.FBarCodeNO;
if (rowData.FCType == 3 && rowData.FIsBox == false) {
console.log(this.currentBarcodeNO);
} else {
this.FBarCodeNO = '';
// this.barcodeDisable = false;
this.showbarCodeFocus();
}
})
.catch(err => {
uni.hideLoading();
this.FBarCodeNO = '';
// this.barcodeDisable = false;
this.barcodeFocus = false;
this.$nextTick(function() {
_self.barcodeFocus = true;
_self.qtyFocus = false;
});
this.dialogNoticeProps(err, 'error');
});
},
commitBtnClick: function() {
let _self = this;
if (this.isCommitBtnDisable) {
return;
}
this.isCommitBtnDisable = true;
if (this.YESTableData.length <= 0) {
uni.showToast({
icon: 'none',
title: '无提交数据',
duration: 2500
});
this.isCommitBtnDisable = false;
return false;
}
let userID = this.userInfo.token;
let requestParams = {
IsMix: this.mixedDisabled,
IsAdd: false,
BoxCode: '',
InBoxInfo: this.commitDataList,
// "orgid":this.orgFItemID
TranType: this.currentTranType.toUpperCase(),
BoxCodeType:this.codeType
};
uni.showLoading({
icon: 'loading',
title: '加载中……',
mask: true
});
this.$request
.post('/Barcode/InBox', requestParams)
.then(res => {
this.isCommitBtnDisable = false;
uni.hideLoading();
uni.showModal({
showCancel: false,
content: res,
confirmText: '确定',
success: function(res) {
if (res.confirm) {
}
}
});
this.FBoxCodeNO = res.substr(8, res.length - 9);
if (this.FBoxCodeNO) {
this.YESTableData.forEach(function(el) {
let addFlag = true;
_self.barcodeTableData.forEach(function(item) {
if (item.barcode == el.FNumber) {
addFlag = false;
}
});
if (addFlag) {
let obj = { barcode: el.FNumber, status: '装箱前' };
_self.barcodeTableData.push(obj);
}
});
}
this.commitDataList.splice(0, this.commitDataList.length);
this.YESTableData.splice(0, this.YESTableData.length);
this.FBarCodeNO = '';
this.FQty = '';
this.FUnitID = '';
this.isMixed = false;
this.mixedDisabled = false;
this.$forceUpdate();
this.showbarCodeFocus();
if (this.FBoxCodeNO && this.isPrinted) {
let obj = { barcode: this.FBoxCodeNO, status: '装箱后' };
_self.barcodeTableData.push(obj);
let tempArray = [];
tempArray.push(this.FBoxCodeNO);
if (this.printSwitch) {
this.printBarcode(tempArray);
}
if (!this.printSwitch && this.bluetoothSwitch) {
this.bluePrintBarcode(tempArray);
}
}
uni.removeStorageSync(this.dbAlise + this.userName + this.currentTranType + 'lastSaveOrgid');
uni.removeStorageSync('pageCash' + this.dbAlise + this.userName + this.currentTranType + this.orgFItemID);
})
.catch(err => {
this.isCommitBtnDisable = false;
uni.hideLoading();
this.dialogNoticeProps(err, 'error');
});
},
//已扫描
showScannedTab: function() {
this.showPrintContentFlag = false;
this.showYesShow = true;
this.selectScannedTabFlag = true;
this.selectPrintTabFlag = false;
this.selectBluePrintTabFlag = false;
this.showBluePrint = false;
this.selectBarcodeTabFlag = false;
},
//正操作
showPrintTab: function() {
this.showPrintContentFlag = true;
this.showYesShow = false;
this.selectScannedTabFlag = false;
this.selectPrintTabFlag = true;
this.selectBluePrintTabFlag = false;
this.showBluePrint = false;
this.selectBarcodeTabFlag = false;
},
showBarcodeTab: function() {
this.selectBarcodeTabFlag = true;
this.showPrintContentFlag = false;
this.showYesShow = false;
this.selectScannedTabFlag = false;
this.selectPrintTabFlag = false;
this.selectBluePrintTabFlag = false;
this.showBluePrint = false;
},
showBluePrintTab: function() {
this.showPrintContentFlag = false;
this.showYesShow = false;
this.selectScannedTabFlag = false;
this.selectPrintTabFlag = false;
this.selectBluePrintTabFlag = true;
this.showBluePrint = true;
this.selectBarcodeTabFlag = false;
},
//选择下标元素
tableSelect: function(selected) {
if (selected.length > 0) {
this.showResult = false;
} else {
this.showResult = true;
}
if (selected.length > 0 && selected.length > this.selectedList.length) {
let index = selected[selected.length - 1];
let barcode = this.YESTableData[index].FNumber;
// if (barcode) {
// uni.showToast({
// title: "您选择了条码:" + barcode,
// icon: 'none'
// })
// }
}
this.selectedList = selected;
},
//删除
del: function(e) {
let _self = this;
uni.vibrateShort({
success: function() {}
});
if (this.selectedList.length == 0) {
uni.showToast({
icon: 'none',
title: '无删除数据'
});
return false;
}
uni.showModal({
title: '提示',
content: '确定删除数据吗?',
showCancel: true,
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
_self.YESTableData = _self.YESTableData.filter(function(el, index) {
return !_self.selectedList.includes(index);
});
// delList.forEach(
// function(el, index){
// _self.commitDataList = _self.commitDataList.filter(
// function(commitEl){
// return commitEl.FNumber != el.FBarcodeNumber;
// }
// );
// }
// );
_self.selectedList = new Array();
_self.commitDataList = [];
uni.showToast({
icon: 'none',
title: '删除成功'
});
_self.showResult = true;
_self.YESTableData.forEach(function(item, index) {
let a = item.FNumber;
let commitData = {
Barcode: item.FNumber,
BarStatus: item.FBarStatus,
IsBox: item.FIsBox,
CartonNumber: 0,
Qty: item.FQty,
UnitId: item.FUnitID,
BaseQty: item.FBASEQTY,
BaseUnitId: item.FBASEUNITID,
MixBoxFactor: item.MixBoxFactor
};
_self.commitDataList.push(commitData);
_self.mixedDisabled = false;
if (_self.YESTableData[0].MixBoxFactor != item.MixBoxFactor) {
_self.mixedDisabled = true;
}
});
if (_self.YESTableData.length == 0) {
uni.setStorageSync(this.dbAlise + this.userName + this.currentTranType + 'lastSaveOrgid', '');
}
this.saveCash();
} else if (res.cancel) {
//_self.showStarCousM();
}
}
});
if (_self.YESTableData.length == 0) {
_self.mixedDisabled = false;
}
},
checkBarcodeNumber: function(barcodeNumber) {
if (!barcodeNumber) {
return true;
}
let ruleNoSpace = this.barcodeRule.replace(/\s*/g, '');
if (!ruleNoSpace) {
return false;
}
if (ruleNoSpace.length === 0) {
return false;
}
let rules = ruleNoSpace.split('|');
//最小长度|最大长度|起始字符|结束字符|包含字符(字符之间可以已逗号隔开)
if (rules[0]) {
if (barcodeNumber.length < Number.parseInt(rules[0])) {
return true;
}
}
if (rules[1]) {
if (barcodeNumber.length > Number.parseInt(rules[1])) {
return true;
}
}
if (rules[2]) {
let header = barcodeNumber.substr(0, 1);
let ruleChart2 = rules[2].split(',');
if (ruleChart2) {
if (ruleChart2.length > 0) {
let filterChart2 = ruleChart2.filter(function(myChar) {
return myChar == header;
});
if (!filterChart2) {
return true;
}
if (filterChart2.length === 0) {
return true;
}
}
}
}
if (rules[3]) {
let end = barcodeNumber.substr(-1, 1);
let ruleChart3 = rules[3].split(',');
if (ruleChart3) {
if (ruleChart3.length > 0) {
let filterChart3 = ruleChart3.filter(function(myChar) {
return myChar == end;
});
if (!filterChart3) {
return true;
}
if (filterChart3.length === 0) {
return true;
}
}
}
}
if (rules[4]) {
let myBarcodeNumber = barcodeNumber;
if (rules[2]) {
myBarcodeNumber = myBarcodeNumber.substr(1, myBarcodeNumber.length - 1);
}
if (rules[3]) {
myBarcodeNumber = myBarcodeNumber.substr(0, myBarcodeNumber.length - 1);
}
let ruleChart4 = rules[4].split(',');
if (ruleChart4) {
if (ruleChart4.length > 0) {
ruleChart4.forEach(function(myChar) {
myBarcodeNumber = myBarcodeNumber.replace(new RegExp(myChar, 'gm'), '');
});
if (myBarcodeNumber) {
if (myBarcodeNumber.length > 0) {
return true;
}
}
}
}
}
return false;
},
checkQtyConfirm: function() {
if (this.currentBarcodeNO != this.FBarCodeNO) {
uni.showToast({
icon: 'none',
title: '请先查询当前条码'
});
//_self.showStarCousM();
return false;
}
let currentQty = 0;
let qtyCheckFlag = commonUtil.judgeFloat(this.FQty);
if (!qtyCheckFlag) {
return false;
} else {
currentQty = parseFloat(this.FQty);
}
let sum = 0;
let _self = this
this.YESTableData.forEach(function tableData(el) {
if (el.FNumber == _self.FBarCodeNO) {
sum = parseFloat(el.FQty) + sum;
}
});
sum = sum + currentQty;
//条码数量相加大于最大值
// if (sum > this.barcodeDataTempList[0].FQty) {
// uni.showToast({
// icon: "none",
// title: this.barcodeDataTempList[0].FNumber+'输入数量总计超过最大数量'
// });
// return false;
// }
let commitData = {
Barcode: this.barcodeDataTempList[0].FNumber,
BarStatus: this.barcodeDataTempList[0].FBarStatus,
IsBox: this.barcodeDataTempList[0].FIsBox,
CartonNumber: 0,
Qty: currentQty,
UnitId: this.FUnitID,
BaseQty: this.barcodeDataTempList[0].FBASEQTY,
BaseUnitId: this.barcodeDataTempList[0].FBASEUNITID,
MixBoxFactor: this.barcodeDataTempList[0].MixBoxFactor
};
this.barcodeDataTempList[0].FQty = currentQty;
this.commitDataList.push(commitData);
this.YESTableData.push(this.barcodeDataTempList[0]);
this.barcodeDataTempList.splice(0, this.barcodeDataTempList.length);
this.FBarCodeNO = null;
this.currentBarcodeNO = null;
this.FQty = null;
this.qtyDisable = true;
this.showbarCodeFocus();
let lastSaveOrgid = this.orgFItemID; //最后一次条码录入成功后(条码进入已扫描列表)的组织ID
uni.setStorageSync(this.dbAlise + this.userName + this.currentTranType + 'lastSaveOrgid', lastSaveOrgid);
this.saveCash();
},
backBtnClick: function() {
uni.reLaunch({
url: '/pages/apply/moreapply/moreapply'
});
},
mixedCbChange: function() {
let _self = this;
if (this.isMixed) {
this.YESTableData.forEach(function(el) {
if (el.FItemID != _self.YESTableData[0].FItemID) {
uni.showToast({
icon: 'none',
title: '此箱有不一样的条码,不可以取消混装',
duration: 3500
});
return false;
}
});
}
this.isMixed = !this.isMixed;
this.$forceUpdate();
},
saveCash: function() {
let _self = this;
let otherInfo = {
currentTranType: this.currentTranType,
orgFItemID: this.orgFItemID,
dbAlise: this.dbAlise,
userName: this.userName,
isMixed: this.isMixed,
FBarCodeNO: this.FBarCodeNO,
FQty: this.FQty,
qtyDisable: this.qtyDisable,
mixedDisabled: this.mixedDisabled,
currentBarcodeNO: this.currentBarcodeNO
};
this.pageCashInfo.YESTableData = this.YESTableData;
this.pageCashInfo.commitDataList = this.commitDataList;
this.pageCashInfo.otherInfo = otherInfo;
this.pageCashInfo.barcodeExistList = this.barcodeExistList;
this.pageCashInfo.barcodeTableData = this.barcodeTableData;
this.pageCashInfo.isPrinted = this.isPrinted;
uni.setStorageSync('pageCash' + _self.dbAlise + _self.userName + _self.currentTranType + _self.orgFItemID, this.pageCashInfo);
},
judgeCash: function() {
let _self = this;
let lastSaveOrgid = uni.getStorageSync(this.dbAlise + this.userName + this.currentTranType + 'lastSaveOrgid');
let cashValue;
if (!this.isChangedOrg) {
cashValue = uni.getStorageSync('pageCash' + this.dbAlise + this.userName + this.currentTranType + lastSaveOrgid);
} else {
cashValue = uni.getStorageSync('pageCash' + this.dbAlise + this.userName + this.currentTranType + this.orgFItemID);
}
if (cashValue.commitDataList) {
uni.showModal({
content: '存在未提交数据是否加载',
success: function(res) {
if (res.confirm) {
_self.loadByCash();
} else if (res.cancel) {
console.log('点击取消');
}
}
});
}
},
barcodeSelect: function(selected) {
this.printList.splice(0, this.printList.length);
selected.forEach(function(item) {
_self.printList.push(_self.barcodeTableData[item].barcode);
});
},
printBarcode: function(printListPa) {
let localList = this.printList;
if (printListPa) {
localList = printListPa;
}
this.$refs.networkPrintTab.printBarcode(localList);
},
bluePrintBarcode: function(bluePrintListPa) {
if (this.$store.state.blueConnectedFlag) {
let localList = this.printList;
if (bluePrintListPa) {
localList = bluePrintListPa;
}
this.$refs.bluetoothPrintTab.bluePrintBarcode(localList);
localList = null;
} else {
uni.showToast({
icon: 'none',
title: '请先连接蓝牙!',
duration: 3500
});
}
},
printCbChange: function() {
this.isPrinted = !this.isPrinted;
this.$forceUpdate();
this.saveCash();
},
codeTypeChange(arg){
const {orignItem} = arg
this.codeType = orignItem.id
},
...mapMutations(['updateCacheByStorage'])
}
};
</script>
<style>
.page-class {
width: 100%;
}
.head-class {
padding: 0rpx 32rpx 0rpx 32rpx;
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
}
.head-organzie-class {
display: flex;
justify-content: flex-end;
align-items: center;
}
.head-row-content-class-organzie {
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
}
.head-organzie-img-class {
height: 32rpx;
width: 32rpx;
margin-left: 24rpx;
}
.head-row-class {
display: flex;
flex-wrap: nowrap;
align-items: center;
height: 60rpx;
line-height: 60rpx;
margin-top: 8rpx;
}
.head-row-class image {
height: 40rpx;
width: 40rpx;
position: absolute;
right: 40rpx;
}
.head-row-title-class {
width: 170rpx;
height: 60rpx;
line-height: 60rpx;
flex-shrink: 0;
}
.head-checkbox-class {
transform: scale(0.75);
margin-left: 18rpx;
}
.head-row-input-class {
height: 60rpx;
width: 100%;
flex-shrink: 1;
border-radius: 10rpx;
border: 2rpx solid #d8d8d8;
margin-left: 24rpx;
padding: 0px 4px 0px 4px;
font-size: 28rpx;
font-family: MicrosoftYaHei;
}
.head-row-input-disable-class {
width: 100%;
height: 60rpx;
border-radius: 10rpx;
border: 2rpx solid rgba(216, 216, 216, 1);
background-color: #f4f4f4 !important;
margin-left: 24rpx;
font-size: 28rpx;
font-family: MicrosoftYaHei;
}
.space-separate-class {
width: 100%;
margin-top: 32rpx;
height: 16rpx;
background-color: #f5f5f5;
}
.tab-lists-class {
display: flex;
align-items: center;
/* height: 80rpx; */
/* margin-top: 32rpx; */
margin-left: 32rpx;
margin-right: 32rpx;
text-align: center;
font-size: 28rpx;
font-family: MicrosoftYaHei;
}
.tab-line-class {
border-left-width: 1.5px;
border-left-color: #e5e5e5;
border-left-style: solid;
height: 40rpx;
flex-grow: 0;
flex-shrink: 0;
}
.tab-unselected-class {
width: 100%;
height: 80rpx;
line-height: 80rpx;
color: #666666;
}
.tab-selected-class {
position: relative;
width: 100%;
height: 80rpx;
line-height: 80rpx;
color: #4662ff;
}
.tab-selected-class::after {
position: absolute;
content: ' ';
width: 2rem;
height: 0.12rem;
background: #4662ff;
bottom: -0.1rem;
left: 50%;
transform: translateX(-50%);
}
.table {
margin-top: 32rpx;
margin-right: 32rpx;
margin-left: 32rpx;
}
/* .del-commit{
display: flex;
position: fixed;
width: 100%;
height:80rpx ;
left: 0;
bottom: 18rpx;
} */
.type-select-box-del {
/* width: 100%;
height:80rpx; */
position: fixed;
width: 100%;
height: 80rpx;
left: 0;
bottom: 0rpx;
}
.type-select-box-commit {
/* width: 100%;
height:80rpx; */
position: fixed;
width: 100%;
height: 80rpx;
line-height: 80rpx;
left: 0;
bottom: 0rpx;
}
.alter {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: #333333;
opacity: 0.5;
}
.err {
position: fixed;
left: 100rpx;
right: 100rpx;
top: 400rpx;
background-color: #ffffff;
border-radius: 20rpx;
opacity: 1;
z-index: 5;
}
.errTitle {
height: 80rpx;
line-height: 80rpx;
width: 100%;
font-size: 32rpx;
text-align: center;
// border-bottom: 2rpx solid #3D3D3D;
}
.errList {
width: 100%;
margin-left: 16rpx;
margin-right: 16rpx;
}
.errDetails {
width: 90%;
font-size: 26rpx;
color: #3d3d3d;
text-align: center;
}
.cash-btn {
display: flex;
}
.cashConfirm {
height: 80rpx;
line-height: 80rpx;
width: 50%;
font-size: 32rpx;
text-align: center;
color: #007aff;
border-top: 2rpx solid #3d3d3d;
border-right: 2rpx solid #3b4144;
}
.cashCancel {
height: 80rpx;
line-height: 80rpx;
width: 50%;
font-size: 32rpx;
text-align: center;
color: #007aff;
border-top: 2rpx solid #3d3d3d;
}
.button-class {
height: 80rpx;
line-height: 80rpx;
border-radius: 4rpx;
font-size: 32rpx;
margin-top: 32rpx;
background-color: #4662ff;
color: #ffffff !important;
}
</style>