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

1396 lines
37 KiB
Vue
Executable File

<template>
<view class="content">
<opsoft-dialog-notice
:dialogNoticeShow="showDialog"
:dialogNoticeType="dialogNoticeType"
:dialogNoticeTitle="dialogNoticeTitle"
:dialogNoticeContent="dialogNoticeContent"
@dialogNoticeConfirmClick="dialogNoticeConfirmClick"
>
</opsoft-dialog-notice>
<view class="content-head">
<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="barcode">
<view class="text-barcode">条&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</view>
<view class="input-barcode">
<input type="text" v-model="currentBarCodeInfo.fBarCodeNO" style="font-size: 32rpx;"
@confirm="getBarCodeInfo()" :disabled="currentBarCodeInfo.barCodeNOdisabled" :focus="barCodeFocus"
:class="[currentBarCodeInfo.barCodeNOdisabled?'input-disable':'']" />
</view>
<image src="../../../static/img/scan-blue.png"
v-show="showScan && !currentBarCodeInfo.barCodeNOdisabled" @click="scan('barCodeScan')" />
</view>
<view class="qty-restQty">
<view class="text-qty">数&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;量</view>
<view class="inputQty-textRestQty-inputRestQty">
<view class="input-qty">
<input type="text" v-model="splitQty" style="font-size: 32rpx;"
@confirm="splitQtyConfirm()" :focus="qtyFocus"/>
</view>
<view class="text-rest">余&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;量</view>
<view class="text-restQty" style="font-size: 32rpx;" >{{currentBarCodeInfo.fQty}}</view>
</view>
</view>
<view class="type-select-box" v-if="printSwitch || bluetoothSwitch">
<p>是否自动打印</p>
<view class="tool-box">
<checkbox-group @change="printCbChange">
<checkbox class="head-checkbox" :checked="isPrinted" />
</checkbox-group>
</view>
</view>
</view>
<view style="height:32rpx;" />
<view class="separate" />
<view class="lists">
<view @tap="showScannedTab()" :class="[selectScannedTabFlag?'btn-change':'btn']">拆分界面</view>
<view class="lists-line" />
<view @tap="showBarcodeTab()" :class="[selectBarcodeTabFlag?'btn-change':'btn']">已拆分界面</view>
<view class="lists-line" v-if="bluetoothSwitch || printSwitch" />
<view @tap="showPrintTab()" :class="[selectPrintTabFlag?'btn-change':'btn']" v-if="printSwitch">打印设置</view>
<view class="lists-line" v-if="bluetoothSwitch && printSwitch" />
<view @tap="showBluePrintTab()" :class="[selectBluePrintTabFlag?'btn-change':'btn']" v-if="bluetoothSwitch">蓝牙设置</view>
</view>
<view class="table" v-show="selectScannedTabFlag">
<view class="z-table">
<z-table :tableData='scannedTableData' :columns='scannedColumns'
emptyText='设置了showLoading=false才会看到我' showSelect @onSelect='tableSelect'></z-table>
</view>
<view class="type-select-box-del" v-if="!showResult">
<view @click="del()"
style="color: #FFFFFF;border-radius: unset; background: #F76260;height: 80rpx;line-height: 80rpx;
text-align: center;font-size: 32rpx;">
删除
</view>
</view>
<view class="type-select-box-commit" v-if="showResult">
<view style="color: #FFFFFF;border-radius: unset;font-size: 32rpx;height: 80rpx;line-height: 80rpx; text-align: center;"
:style="{'background-color': (!isCommitBtnDisable ? '#4662FF' : '#808080')}"
@click="commitBtnClick()" :disabled="isCommitBtnDisable">
提交
</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 v-show="selectPrintTabFlag">
<NetworkPrintTab prgkey="STK_BARCODESPLIT" :printInfo="newIntelID" ref="networkPrintTab"
:orgId="orgFItemID" :baseUrl="baseUrl"/>
</view>
<view v-show="selectBluePrintTabFlag">
<BluetoothPrintTab ref="bluetoothPrintTab" :currentTranType = 'currentTranType'/>
</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 macAddress = require('../../../common/MacAddress.js');
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
import errorStrUntil from '@/common/errorStrUntil.js';
let _self;
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,
currentTranType:'STK_BARCODESPLIT',
showCashTips:false,
loadCash:false,
pageCashInfo: new Object(),
barcodeExistList:[],
FUnitID:"",
isShowOrg:true,
orgArry:[{name:"请选择组织", key:"", FName:""}],
orgFItemID:'',
index:0,
barCodeFocus:false,
qtyFocus:false,
showResult:true,
isCommitBtnDisable:false,
currentBillType: 3,
splitQty: null,
scannedTableData: [],
selectedList: [],
tempList:[],
currentBarCodeInfo: new Object(),
//已扫描
scannedColumns: [ { title: "条码", key: "fNumber", width: 350, formatNum: false },
{ title: "物料代码", key: "fItemNumber", width: 350, formatNum: false },
{ title: "物料名", key: "fItemName", width: 350, formatNum: false },
{ title: "批号", key: "fBatchNO", width: 350, formatNum: false },
{ title: "数量", key: "fQty", width: 250 },
{ title: "单位", key: "fUnitName", width: 250, formatNum: false},
{ title: "规格", key: "fSize", width: 250, formatNum: false },
{ title: "型号", key: "fModel", width: 250, formatNum: false} ],
barcodeTableData: [],
barcodeColumns: [
{ title: "条码", key: "barcode", width: 400, formatNum: false },
{ title: "状态", key: "status", width: 300, formatNum: false },
{ title: "数量", key: "fQty", width: 250 }
],
printList: [],
commitDataList: [],
newIntelID: "",
selectScannedTabFlag: true,
selectPrintTabFlag: false,
selectBluePrintTabFlag: false,
baseUrl: '',
isPrinted: true, // 自动打印
selectBarcodeTabFlag: false,
printSwitch: false,
bluetoothSwitch: false,
systemParameter: null,
currentQty: 0
}
},
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;
if (!_self.printSwitch && !_self.bluetoothSwitch) {
_self.isPrinted = false;
}
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: {
barcodeRule() {
if (this.sysParameters) {
if (this.sysParameters.hasOwnProperty("BarcodeRuleForVerification")) {
let rule = this.sysParameters["BarcodeRuleForVerification"];
if (rule) {
return rule;
}
}
}
return "";
},
indicatorStyle() {
return {
background: 'rgba(255,0,0,.2)',
height: '40px',
};
},
...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.currentBarCodeInfo.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.scannedTableData = cashValue.scannedTableData;
this.barcodeTableData = cashValue.barcodeTableData;
this.barcodeExistList = cashValue.barcodeExistList;
this.isPrinted = cashValue.isPrinted;
this.commitDataList = cashValue.commitDataList;
// this.currentBarCodeInfo.fBarCodeNO = cashValue.otherInfo.fBarCodeNO;
// if (this.currentBarCodeInfo.fBarCodeNO) {
// this.currentBarCodeInfo.barCodeNOdisabled = true;
// }
// this.splitQty = cashValue.otherInfo.splitQty;
// this.currentBarCodeInfo.fQty = parseFloat(cashValue.otherInfo.fQty);
this.isMixed = cashValue.otherInfo.isMixed;
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.currentBarCodeInfo.barCodeNOdisabled = false;
this.showResult = true;
this.currentBarCodeInfo.fBarCodeNO = "";
this.splitQty = "";
this.currentBarCodeInfo.fQty = "";
this.scannedTableData = [];
this.barcodeTableData = [];
this.commitDataList = [];
this.$forceUpdate();
},
showBarcodeFocus:function(){
let _self = this;
setTimeout(function(){
_self.barCodeFocus = true;
},500);
setTimeout(function(){
_self.qtyFocus = false;
},500)
},
showQtyFocus:function(){
let _self = this;
setTimeout(function(){
_self.qtyFocus = true;
},500);
setTimeout(function(){
_self.barCodeFocus = false;
},500);
},
printCbChange:function() {
this.isPrinted = !this.isPrinted;
this.$forceUpdate();
},
getBarCodeInfo: function() {
let _self = this;
if (!this.currentBarCodeInfo.fBarCodeNO) {
uni.showToast({
icon: "none",
title: "请输入条码",
duration: 3500,
});
return false;
}
this.currentBarCodeInfo.fBarCodeNO = this.currentBarCodeInfo.fBarCodeNO.toUpperCase();
let isFail = this.checkBarcodeNumber(this.currentBarCodeInfo.fBarCodeNO);
if (isFail) {
uni.showToast({
icon: "none",
title: "请输入正确的条码",
duration: 3500,
});
return false;
}
let requestParams = {
"barcode": this.currentBarCodeInfo.fBarCodeNO,
"billType": this.currentBillType,
"orgId":this.orgFItemID
};
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"]
};
this.scannedTableData.push(rowData);
this.currentBarCodeInfo.barCodeNOdisabled = true;
this.currentBarCodeInfo.fQty = parseFloat(rowData.fQty);
this.currentQty = rowData.fQty;
this.qtyFocus = false;
this.$nextTick(function(){
_self.qtyFocus = true;
});
this.$forceUpdate();
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
commitBtnClick: function() {
let _self = this;
if (this.isCommitBtnDisable) {
return;
}
this.isCommitBtnDisable = true;
if (this.scannedTableData.length <= 1) {
uni.showToast({
icon:'none',
title: "无提交数据",
duration: 2500,
});
this.isCommitBtnDisable = false;
return false;
}
this.commitDataList = [];
this.scannedTableData.forEach(
function(el) {
let rowData = {
"Barcode" : el.fNumber,
"Qty" : el.fQty
};
_self.commitDataList.push(rowData);
}
);
let userID = this.userInfo.token;
let currentBarCodeNo = this.currentBarCodeInfo.fBarCodeNO;
let fQty = this.currentBarCodeInfo.fQty;
let requestParams = {
"RemainQty": this.currentBarCodeInfo.fQty,
"Barcode": this.currentBarCodeInfo.fBarCodeNO,
"SplitInfo": this.commitDataList,
"CurrentUnitId": this.FUnitID,
"TranType": this.currentTranType.toUpperCase()
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.localPost('/Barcode/SplitBarcode', requestParams, "all").then(res => {
this.isCommitBtnDisable = false;
uni.hideLoading();
if (res.Success) {
uni.showToast({
icon: "none",
title: "条码拆分成功",
duration: 3500,
});
}
let addFlag = true;
this.barcodeTableData.forEach(
function(item){
if (item.barcode == _self.currentBarCodeInfo.fBarCodeNO) {
addFlag = false;
}
}
);
if (addFlag) {
let obj = {barcode:this.currentBarCodeInfo.fBarCodeNO, status:'拆分前', fQty:this.currentQty};
this.barcodeTableData.push(obj);
}
const localPrintList = [];
if (res.Data) {
res.Data.forEach(
function(item) {
localPrintList.push(item.fbarcode);
let obj = {barcode:item.fbarcode?item.fbarcode:'', status:'拆分后', fQty:item.fqty?item.fqty:0};
_self.barcodeTableData.push(obj);
}
);
}
this.commitDataList = new Array();
this.scannedTableData = new Array();
this.currentBarCodeInfo = new Object();
this.currentBarCodeInfo.fBarCodeNO = currentBarCodeNo;
this.currentBarCodeInfo.fQty = parseFloat(fQty);
this.currentBarCodeInfo.barCodeNOdisabled = false;
this.splitQty = null;
this.currentQty = 0;
this.showBarcodeFocus();
this.$forceUpdate();
if (this.isPrinted) {
if (this.printSwitch) {
this.printBarcode(localPrintList);
}
if (!this.printSwitch && this.bluetoothSwitch) {
this.bluePrintBarcode(localPrintList);
}
}
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;
this.commitDataList = new Array();
this.dialogNoticeProps(err,'error');
uni.hideLoading();
});
},
printBarcode: function(printListPa) {
let localList = this.printList;
if (printListPa) {
localList = printListPa;
}
console.log('printBarcode', localList);
this.$refs.networkPrintTab.printBarcode(localList);
},
// 蓝牙打印
bluePrintBarcode: function(bluePrintListPa) {
if (this.$store.state.blueConnectedFlag) {
// if (true) {
let localList = this.printList;
if (bluePrintListPa) {
localList = bluePrintListPa;
}
this.$refs.bluetoothPrintTab.bluePrintBarcode(localList);
// localList = null;
}
else {
uni.showToast({
icon: "none",
title: "请先连接蓝牙打印机!",
duration: 1500,
});
}
},
//已扫描
showScannedTab: function() {
this.selectPrintTabFlag = false;
this.selectScannedTabFlag = true;
this.selectBarcodeTabFlag = false;
this.selectBluePrintTabFlag = false;
},
showBarcodeTab: function() {
this.selectPrintTabFlag = false;
this.selectScannedTabFlag = false;
this.selectBarcodeTabFlag = true;
this.selectBluePrintTabFlag = false;
},
showPrintTab: function() {
this.selectScannedTabFlag = false;
this.selectPrintTabFlag = true;
this.selectBarcodeTabFlag = false;
this.selectBluePrintTabFlag = false;
},
showBluePrintTab: function() {
this.selectScannedTabFlag = false;
this.selectPrintTabFlag = false;
this.selectBarcodeTabFlag = false;
this.selectBluePrintTabFlag = true;
},
tableSelect: function(selected) {
if(selected.length > 0){
this.showResult = false;
} else {
this.showResult = true;
}
this.selectedList = selected;
},
barcodeSelect: function(selected) {
let _self = this;
this.printList.splice(0, this.printList.length);
selected.forEach(
function(item){
_self.printList.push(_self.barcodeTableData[item].barcode);
}
);
},
del: function(e) {
let _self = this;
uni.vibrateShort({
success: function() {
console.log('success');
}
});
let result = true;
if (this.selectedList.length == 0) {
uni.showToast({
icon: "none",
title: "无删除数据"
})
//_self.showStarCousM();
return false;
} else {
this.selectedList.forEach(
function(el){
if(el == 0){
result = false;
return result;
}
}
);
}
uni.showModal({
title: '提示',
content: '确定删除数据吗?',
showCancel: true,
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
let delSum = 0;
let arrSum = 0;
_self.tempList = _self.scannedTableData;
_self.tempList = _self.tempList.filter(
function(el, index){
return _self.selectedList.includes(index);
}
);
_self.tempList.forEach(
function(el) {
console.log(el);
arrSum = parseFloat(el.fQty);
delSum = parseFloat(delSum) + arrSum;
}
);
_self.currentBarCodeInfo.fQty = parseFloat((parseFloat(_self.currentBarCodeInfo.fQty) + delSum).toFixed(6));
_self.scannedTableData = _self.scannedTableData.filter(
function(el, index){
return !_self.selectedList.includes(index);
}
);
uni.showToast({
icon: 'none',
title: '删除成功'
});
_self.showResult = true;
_self.selectedList = [];
if (!result) {
//let currentBarCodeNo = this.currentBarCodeInfo.fBarCodeNO;
this.qtyFocus = false;
this.commitDataList = new Array();
this.scannedTableData = new Array();
this.currentBarCodeInfo = new Object();
//this.currentBarCodeInfo.fBarCodeNO = currentBarCodeNo;
this.currentBarCodeInfo.barCodeNOdisabled = false;
this.splitQty = '';
this.showBarcodeFocus();
this.$forceUpdate();
}
if(_self.scannedTableData.length==0){
uni.setStorageSync(this.dbAlise+this.userName+this.currentTranType+'lastSaveOrgid','');
}
this.saveCash();
} else if (res.cancel) {
//_self.showStarCousM();
}
},
fail: () => {},
complete: () => {}
});
},
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;
},
splitQtyConfirm: function() {
if (this.scannedTableData.length <= 0) {
uni.showToast({
icon:'none',
title: "请先查询条码!",
duration: 2500,
});
return false;
}
let checkSplitQty = this.splitQty;
if (!checkSplitQty) {
uni.showToast({
icon: "none",
title: "请输入正确的数量!"
})
//_self.showStarCousM();
return false;
}
if(isNaN(checkSplitQty)) {
uni.showToast({
icon: "none",
title: "请输入正确的数量!"
})
//_self.showStarCousM();
return false;
}
let currentQty = parseFloat(this.currentBarCodeInfo.fQty);
let mysplitQty = parseFloat(this.splitQty);
let barCodeFlag = false;
if(!this.currentBarCodeInfo.fBarCodeNO) {
barCodeFlag = true;
}
if(!barCodeFlag) {
let barCodeNoSpace = this.currentBarCodeInfo.fBarCodeNO.replace(/\s*/g, "");
if(barCodeNoSpace.length == 0){
barCodeFlag = true;
}
}
if(barCodeFlag) {
uni.showToast({
icon: "none",
title: "请输入条码!"
})
//_self.showStarCousM();
return false;
}
else {
if (!this.currentBarCodeInfo.fQty) {
uni.showToast({
icon: "none",
title: "请先查询条码!"
})
//_self.showStarCousM();
return false;
}
}
//数量检查
if (Number.isNaN(this.splitQty)) {
uni.showToast({
icon: "none",
title: "请输入正确的数字"
})
//_self.showStarCousM();
return false;
}
if (mysplitQty <= 0) {
uni.showToast({
icon: "none",
title: "请输入大于0的数字"
});
//_self.showStarCousM();
return false;
}
//条码数量相加大于最大值
if (mysplitQty > currentQty) {
uni.showToast({
icon: "none",
title: this.currentBarCodeInfo.fBarCodeNO+'拆分数量大于剩余数量'
});
return false;
}
let rowData = {
fNumber: "",
fItemNumber: this.scannedTableData[0].fItemNumber,
fItemName: this.scannedTableData[0].fItemName,
fBatchNO: this.scannedTableData[0].fBatchNO,
fQty: mysplitQty,
fUnitName: this.scannedTableData[0].fUnitName,
fSize: this.scannedTableData[0].fSize,
fModel: this.scannedTableData[0].fModel
};
this.scannedTableData.push(rowData);
this.currentBarCodeInfo.fQty = parseFloat((currentQty - mysplitQty).toFixed(6));
this.showResult = true;
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'
})
},
saveCash:function(){
let _self = this;
let otherInfo = {"currentTranType":this.currentTranType,
"orgFItemID":this.orgFItemID,
"dbAlise":this.dbAlise,
"userName":this.userName,
"fBarCodeNO":this.currentBarCodeInfo.fBarCodeNO,
"splitQty":this.splitQty,
"fQty":this.currentBarCodeInfo.fQty,
"isMixed":this.isMixed,
};
this.pageCashInfo.scannedTableData = this.scannedTableData;
this.pageCashInfo.barcodeTableData = this.barcodeTableData;
this.pageCashInfo.isPrinted = this.isPrinted
this.pageCashInfo.commitDataList = this.commitDataList;
this.pageCashInfo.otherInfo = otherInfo;
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('点击取消')
}
}
})
}
},
...mapMutations(['updateCacheByStorage'])
}
}
</script>
<style>
.content{
padding-left:0;
padding-right: 0;
}
.content-head{
/* height: 240rpx; */
margin-left: 32rpx;
margin-right: 32rpx;
}
.header-row-class-organzie{
display: flex;
justify-content: flex-end;
align-items: center;
/* padding-right: 50rpx; */
}
.header-row-title-class-organzie{
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
}
.head-row-content-class-organzie{
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
}
.img-organzie{
height: 32rpx;
width: 32rpx;
margin-left: 24rpx;
}
.barcode{
display: flex;
width: 100%;
/* margin-top: 48rpx; */
height: 60rpx;
line-height: 60rpx;
margin-top: 8rpx;
align-items: center;
}
.barcode image{
height: 40rpx;
width: 40rpx;
position: fixed;
right: 40rpx;
}
.text-barcode{
width: 128rpx;
height: 64rpx;
line-height: 64rpx;
font-size: 32rpx;
font-family:MicrosoftYaHei;
color:rgba(102,102,102,1);
flex-shrink: 0;
}
.input-barcode{
margin-left: 24rpx;
width: 100%;
}
.input-barcode input{
height: 60rpx;
border-radius:10rpx;
border:2rpx solid rgba(216,216,216,1);
padding-left: 24rpx;
font-size: 28rpx;
font-family: MicrosoftYaHei;
}
.input-disable{
background-color: #F0F0F0!important;
}
.qty-restQty{
display: flex;
width: 100%;
margin-top: 8rpx;
}
.text-qty{
width: 128rpx;
height: 60rpx;
height: 60rpx;
font-size: 32rpx;
font-family:MicrosoftYaHei;
color:rgba(102,102,102,1);
flex-shrink: 0;
flex-shrink: 0;
}
.inputQty-textRestQty-inputRestQty{
display: flex;
position: relative;
width: 100%;
margin-left: 24rpx;
}
.input-qty input{
height: 60rpx;
width: 160rpx;
border-radius:10rpx;
border:2rpx solid rgba(216,216,216,1);
padding-left: 24rpx;
padding-left: 10rpx;
}
input{
height: 60rpx;
border-radius:4px;
border:1px solid rgba(216,216,216,1);
}
.text-rest{
width: 160rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
margin-left: 38rpx;
font-size: 32rpx;
font-family:MicrosoftYaHei;
color:rgba(102,102,102,1);
border-radius:10rpx;
}
.text-restQty{
width: 160rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
border-radius:10rpx;
border:2rpx solid rgba(216,216,216,1);
background-color: #F4F4F4;
position: absolute;
right: 0;
}
.separate{
width: 100%;
height: 16rpx;
background-color:#F5F5F5;
}
.lists {
display: flex;
align-items: center;
/* height: 80rpx; */
/* margin-top: 32rpx; */
margin-left: 32rpx;
margin-right: 32rpx;
}
.lists-line{
border-left-width:1.5px;
border-left-color: #E5E5E5;
border-left-style: solid;
height:40rpx;
flex-grow: 0;
flex-shrink: 0;
}
.btn {
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size:28rpx;
font-family:MicrosoftYaHei;
color:#666666;
}
.btn-change{
position: relative;
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size:28rpx;
font-family:MicrosoftYaHei;
color:#4662FF;
}
.btn-change::after{
position: absolute;
content: " ";
width: 2rem;
height: 0.12rem;
background: #4662FF;
bottom: -0.1rem;
left: 50%;
transform: translateX(-50%);
}
.show-print{
margin-top: 32rpx;
margin-left: 32rpx;
margin-right: 32rpx;
}
.print-input{
height: 60rpx;
line-height: 60rpx;
border-radius:4px;
border:1px solid #c0c4cc;
margin-top: 16rpx;
}
.trP{
height:36rpx;
font-size:28rpx;
font-family:Helvetica;
color:rgba(51,51,51,1);
line-height:36rpx;
}
.trM{
width:120rpx;
height:36rpx;
font-size:28rpx;
font-family:Helvetica;
color:rgba(51,51,51,1);
line-height:36rpx;
margin-top: 24rpx;
}
.kc{
height:80rpx;
line-height:80rpx;
border-radius:4rpx;
font-size:32rpx;
font-family:Helvetica;
color:rgba(102,102,102,1);
background:rgba(240,240,240,1);
margin-top: 32rpx;
}
.table{
/* position: relative; */
/* height: 780rpx; */
margin-top: 32rpx;
margin-right: 32rpx;
margin-left: 32rpx;
}
.type-select-box-del{
position: fixed;
height:80rpx;
width: 100%;
bottom: 0rpx;
left: 0;
}
.type-select-box-commit{
position: fixed;
height:80rpx;
width: 100%;
bottom: 0rpx;
left: 0;
}
.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;
}
.errConfirm{
height: 80rpx;
line-height: 80rpx;
width: 100%;
font-size: 32rpx;
text-align: center;
color: #007AFF;
border-top: 2rpx solid #3D3D3D;
}
.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;
}
.type-select-box {
display: flex;
width: 100%;
/* margin-top: 48rpx; */
line-height: 60rpx;
margin-top: 8rpx;
align-items: center;
font-size: 32rpx;
font-family:MicrosoftYaHei;
color:rgba(102,102,102,1);
}
.tool-box{
padding-left: 24rpx;
/* margin-right: 24rpx; */
}
.head-checkbox{
transform:scale(0.75);
/* width:20px;
height:20px;
background:rgba(70,98,255,1);
border-radius:2px;
margin-left: 12px; */
}
.button-class{
height:80rpx;
line-height:80rpx;
border-radius:4rpx;
font-size:32rpx;
margin-top: 32rpx;
background-color: #4662FF;
color: #FFFFFF!important;
}
</style>