Files

1506 lines
39 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="type-select-box">
<p class="p-taitl">待拆条码</p>
<view class="tool-box">
<input type="text" class="head-input" v-model="FBoxCodeNO" @confirm="getBoxBarCodeInfo()"
:focus="boxCodeFocus" />
</view>
<image src="../../../static/img/scan-blue.png" v-show="showScan" @click="scan('boxCodeScan')" />
</view>
<view class="type-select-box">
<p class="p-taitl">待拆条码类型</p>
<view class="tool-box">
<input type="text" class="showcolor" v-model="BoxCodeType" disbaled/>
</view>
</view>
<view class="type-select-box">
<p class="p-taitl">条&ensp;&ensp;&ensp;&ensp;码</p>
<view class="tool-box">
<input type="text" :class="[disableBarcode?'showcolor':'head-input']"
v-model="FBarCodeNO" @confirm="delBarcode()" :disabled="disableBarcode"
:focus="barCodeFocus"/>
</view>
<image src="../../../static/img/scan-blue.png" v-show="showScan && !disableBarcode"
@click="scan('barCodeScan')"></image>
</view>
<view class="type-select-box" v-if="printSwitch || bluetoothSwitch">
<p class="p-taitl">是否打印</p>
<checkbox-group @change="printCbChange">
<checkbox class="head-checkbox-class" :checked="isPrinted"></checkbox>
</checkbox-group>
</view>
</view>
<view style="height: 32rpx;"></view>
<view class="separate"></view>
<view class="lists">
<view @tap="showScannedTab()" :class="[selectScannedTabFlag?'btn-change':'btn']" style="flex-grow:2; flex-wrap: nowrap; ">已扫描</view>
<view class="tab-line-class" />
<view @tap="ShowSourceTab()" :class="[selectSourceTabFlag?'btn-change':'btn']" style="flex-shrink:1;">原箱内码</view>
<view class="tab-line-class" />
<view @tap="showBarcodeTab()" :class="[selectBarcodeTabFlag?'btn-change':'btn']" style="flex-shrink:1;"
>已拆箱</view>
<view class="tab-line-class" v-if="bluetoothSwitch || printSwitch" />
<view @tap="showPrintTab()" :class="[selectPrintTabFlag?'btn-change':'btn']"
v-if="printSwitch">打印设置</view>
<view class="tab-line-class" 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" style="padding-bottom: 100rpx;">
<z-table :tableData='YESTableData' :columns='YESColumns' emptyText='设置了showLoading=false才会看到我' showSelect
@onSelect='tableSelect' />
</view>
<view class="type-select-box-del" v-if="!showResult">
<view @click="delBtnClick()"
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-if="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="table" v-show="selectSourceTabFlag">
<view class="z-table">
<z-table :tableData='sourceTableData' :columns='YESColumns' emptyText='设置了showLoading=false才会看到我' :showSelect="false"></z-table>
</view>
</view>
<view v-show="selectPrintTabFlag">
<NetworkPrintTab :prgkey="currentTranType" :printInfo="printFBoxCodeNO" ref="networkPrintTab"
:orgId="orgFItemID" :baseUrl="baseUrl"/>
</view>
<view v-show="selectBluePrintTabFlag">
<BluetoothPrintTab ref="bluetoothPrintTab" :currentTranType = 'currentTranType' />
</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 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 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:'UN_DelPackaging',
showCashTips:false,
loadCash:false,
pageCashInfo: new Object(),
barcodeExistList:[],
isShowOrg:true,
orgArry:[{name:"请选择组织", key:"", FName:""}],
orgFItemID:'',
index:0,
commitData:[],
boxCodeFocus:true,
barCodeFocus:false,
showResult:true,
selectScannedTabFlag:true,
selectPrintTabFlag:false,
selectSourceTabFlag:false,
selectPrintTabFlag:true,
selectBluePrintTabFlag:false,
selectPrintTabFlag:false,
isCommitBtnDisable:false,
currentBillType: 2,
disableBarcode: true,
FBoxCodeNO: null,
FBarCodeNO: null,
selectedList: [],
delList:[],
YESTableData: [],
//已扫描
YESColumns:[{
title: "箱码",
key: "FBoxBarCodeNO",
width: 350,
formatNum: false
}, {
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
} ],
sourceTableData: [],
printFBoxCodeNO: "",
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,
printListTemp: [],
newIntelID: '',
BoxCodeType:null,
codeTypeList: [
{
id: 0,
value: '箱码'
},
{
id: 1,
value: '托盘码'
},
{
id: 2,
value: '栈板码'
}
],
}
},
// onBackPress(options) {
// uni.redirectTo({
// url: '../../tabbar/apply/apply'
// });
// return true;
// },
onLoad() {
let _self = this;
_self.getOrgList();
_self.baseUrl = uni.getStorageSync('RequestUrl');
_self.systemParameter = uni.getStorageSync('systemParameter');
_self.printSwitch = _self.systemParameter.printSwitch;
_self.bluetoothSwitch = _self.systemParameter.bluetoothSwitch;
_self.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() {
console.log(this.sysParameters);
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 == 'boxCodeScan'){
_self.FBoxCodeNO = res.result;
_self.getBoxBarCodeInfo();
}else if(currentScanType == 'barCodeScan'){
_self.FBarCodeNO = res.result;
_self.delBarcode();
}
}
})
},
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.barcodeExistList = cashValue.barcodeExistList;
this.isPrinted = cashValue.isPrinted;
this.commitDataList = cashValue.commitDataList;
this.sourceTableData = cashValue.sourceTableData;
// this.FBarCodeNO = cashValue.otherInfo.FBarCodeNO;
this.FBoxCodeNO = cashValue.otherInfo.FBoxCodeNO;
this.disableBarcode = cashValue.otherInfo.disableBarcode;
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){
let _self = this;
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.FBoxCodeNO = "";
this.printFBoxCodeNO = "";
this.showResult = true;
this.YESTableData = [];
this.sourceTableData = [];
this.commitDataList = [];
this.barcodeTableData = [];
this.disableBarcode = true;
this.BoxCodeType = null;
this.$forceUpdate();
},
getBoxBarCodeInfo: function() {
let _self = this;
this.disableBarcode = true;
this.YESTableData.splice(0, this.YESTableData.length);
this.sourceTableData.splice(0, this.sourceTableData.length);
this.printListTemp.splice(0, this.printListTemp.length);
if (!this.FBoxCodeNO) {
uni.showToast({
icon: "none",
title: "请输入箱码",
duration: 3500,
})
return false;
}
// this.FBoxCodeNO = this.FBarCodeNO.toUpperCase();
let isFail = this.checkBarcodeNumber(this.FBoxCodeNO);
if (isFail) {
uni.showToast({
icon: "none",
title: "请输入正确的箱码",
duration: 3500,
})
return false;
}
let requestParams = {
"barcode": this.FBoxCodeNO,
"billType": this.currentBillType,
"orgId":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.get('/Barcode/GetBarcodeInfo',{
params:requestParams
}).then(res => {
uni.hideLoading();
console.log("----BarCheck---- requestsuccess");
//返回的是字符串
let data = res;
let rowData = null;
if(data.length > 0) {
this.BoxCodeType = this.codeTypeList.find(item=>item.id == data[0].FBOXCODETYPE).value
data.forEach(
function(el) {
rowData = {
FBoxBarCodeNO: _self.FBoxCodeNO,
FNumber: el["FBARCODE"],
FDetailID: el["FDETAILID"],
FItemNumber: el["FMATERIALNUMBER"],
FItemName: el["FMATERIALNAME"],
FBatchNO: el["FLOT"],
FQty: el["FQTY"],
FUnitName: el["FUNITNAME"],
FSize: el["FSPECIFICATION"],
FModel: el["FSPECIFICATION"],
FIsBox: el["FISBOX"],
FBASEQTY:el["FBASEQTY"],
FBASEUNITID:el["FBASEUNITID"],
FUnitID:el["FUNITID"],
FItemID:el["FItemID"]
};
_self.YESTableData.push(rowData);
_self.sourceTableData.push(rowData);
_self.printListTemp.push(el["FBARCODE"]);
}
)
this.disableBarcode = false;
this.showBarCodeCursor();
}
//强制刷新数据
// this.$set(this.currentBarCodeInfo)
console.log(this.YESTableData)
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
commitBtnClick: function() {
let _self = this;
if (this.isCommitBtnDisable) {
return;
}
this.isCommitBtnDisable = true;
if(this.delList.length == 0){
uni.showModal({
title: '提示',
content: '未执行操作会将当前显示条码全部拆分,是否提交',
showCancel: true,
cancelText: '否',
confirmText: '是',
confirmColor: '#3860F3',
success: res => {
if (res.confirm) {
}
},
fail: () => {},
complete: () => {}
});
}
let isNullFlag = 0;
let userID = this.userInfo.token;
let commitDataList = [];
_self.commitData = [];
_self.YESTableData.forEach(
function(el){
let elData = {
FNumber: el["FNumber"],
FDetailID: el["FDetailID"],
FItemNumber: el["FItemNumber"],
FItemName: el["FItemName"],
FBatchNO: el["FBatchNO"],
FQty: el["FQty"],
FUnitName: el["FUnitName"],
FSize: el["FSize"],
FModel: el["FModel"],
FIsBox: el["FIsBox"],
FBASEQTY:el["FBASEQTY"],
FBASEUNITID:el["FBASEUNITID"],
FUnitID:el["FUnitID"],
FItemID:el["FItemID"]
};
_self.commitData.push(elData);
}
);
this.commitData.forEach(
function(el){
let data = {
Barcode: el.FNumber,
DetailId: el.FDetailID,
Qty: el.FQty,
BaseQty:el.FBASEQTY,
UnitId:el.FUnitID,
MaterialId:el.FItemID
};
commitDataList.push(data);
}
);
if(this.commitData.length == 0) {
isNullFlag = 1;
}
let requestParams = {
"BoxCode": this.FBoxCodeNO,
"OutBoxInfo": commitDataList,
"OrgId":this.orgFItemID,
"TranType": this.currentTranType.toUpperCase(),
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.localPost('/Barcode/OutBox', requestParams, 'all').then(res => {
this.isCommitBtnDisable = false;
uni.hideLoading();
let msg = "执行成功";
if (res.StatusCode == 200 && res.Success == true && res.Message) {
msg = res.Message;
}
else {
msg = res.Data;
}
uni.showModal({
showCancel: false,
content: msg,
confirmText: '确定',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
}
}
});
let data = res;
if (this.commitData) {
this.printListTemp = this.printListTemp.filter(
function(item) {
let filterFlag = true;
_self.commitData.forEach(
function(el){
if (item == el.FNumber) {
filterFlag = false;
}
}
);
return filterFlag;
}
);
this.printListTemp.forEach(
function(item){
let addFlag = true;
_self.barcodeTableData.forEach(
function(el) {
if (el.barcode == item) {
addFlag = false;
}
}
);
if (addFlag) {
let obj = {barcode:item, status:'拆箱后'};
_self.barcodeTableData.push(obj);
}
}
);
}
this.printFBoxCodeNO = this.FBoxCodeNO;
this.disableBarcode = true;
this.FBarCodeNO = "";
this.FBoxCodeNO = "";
this.YESTableData = [];
this.sourceTableData = [];
this.selectedList = [];
this.commitData = [];
this.showBoxCodeCursor();
if (res.StatusCode == 200 && res.Success == true && res.Message) {
if (this.printFBoxCodeNO) {
let addFlag = true;
_self.barcodeTableData.forEach(
function(item) {
if (item.barcode == _self.printFBoxCodeNO) {
addFlag = false;
}
}
);
if (addFlag) {
let obj = {barcode:_self.printFBoxCodeNO , status:'拆箱前'};
_self.barcodeTableData.push(obj);
}
if (this.isPrinted) {
let tempArray = [];
tempArray.push(this.printFBoxCodeNO);
if (this.printSwitch) {
this.printBarcode(tempArray);
}
if (!this.printSwitch && this.bluetoothSwitch) {
this.bluePrintBarcode(tempArray);
}
this.printListTemp.splice(0, this.printListTemp.length);
}
}
}
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.dialogNoticeProps(err,'error')
uni.hideLoading();
});
},
//已扫描
showScannedTab: function() {
this.selectScannedTabFlag = true;
this.selectPrintTabFlag = false;
this.selectSourceTabFlag = false;
this.selectBluePrintTabFlag = false;
this.selectBarcodeTabFlag = false;
},
//原箱内条码
ShowSourceTab: function() {
this.selectScannedTabFlag = false;
this.selectPrintTabFlag = false;
this.selectSourceTabFlag = true;
this.selectBluePrintTabFlag = false;
this.selectBarcodeTabFlag = false;
},
showBarcodeTab: function() {
this.selectBarcodeTabFlag = true;
this.selectScannedTabFlag = false;
this.selectPrintTabFlag = false;
this.selectSourceTabFlag = false;
this.selectBluePrintTabFlag = false;
},
//打印
showPrintTab: function() {
this.selectScannedTabFlag = false;
this.selectPrintTabFlag = true;
this.selectSourceTabFlag = false;
this.selectBluePrintTabFlag = false;
this.selectBarcodeTabFlag = false;
},
showBluePrintTab: function(){
this.selectScannedTabFlag = false;
this.selectPrintTabFlag = false;
this.selectSourceTabFlag = false;
this.selectBluePrintTabFlag = 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;
},
delBtnClick: function(e) {
let _self = this;
uni.vibrateShort({
success: function() {
console.log('success');
}
});
if (this.selectedList.length == 0) {
uni.showToast({
icon: "none",
title: "无删除数据"
})
//_self.showStarCousM();
return false;
}
uni.showModal({
title: '提示',
content: '确定删除数据吗?',
showCancel: true,
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
_self.delList = _self.YESTableData.filter(
function(el, index){
return _self.selectedList.includes(index);
}
);
_self.YESTableData = _self.YESTableData.filter(
function(el, index){
return !_self.selectedList.includes(index);
}
);
// _self.commitData = [];
// _self.YESTableData.forEach(
// function(el){
// let elData = {
// FNumber: el["FNumber"],
// FDetailID: el["FDetailID"],
// FItemNumber: el["FItemNumber"],
// FItemName: el["FItemName"],
// FBatchNO: el["FBatchNO"],
// FQty: el["FQty"],
// FUnitName: el["FUnitName"],
// FSize: el["FSize"], //部门、供应商、客户 内码
// FModel: el["FModel"], //部门、供应商、客户 代码
// FIsBox: el["FIsBox"],
// FBASEQTY:el["FBASEQTY"],
// };
// _self.commitData.push(elData);
// }
// );
uni.showToast({
icon: 'none',
title: '删除成功'
});
_self.selectedList = [];
_self.showResult = true;
if(_self.YESTableData.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;
},
delBarcode: function() {
let _self = this;
if (!this.FBarCodeNO) {
uni.showToast({
icon: "none",
title: "请输入条码",
duration: 3500,
})
return false;
}
let isFail = this.checkBarcodeNumber(this.FBarCodeNO);
if (isFail) {
uni.showToast({
icon: "none",
title: "请输入正确的条码",
duration: 3500,
})
_self.FBarCodeNO = "";
return false;
}
let barCodeNOList = [];
this.YESTableData.forEach(
function(each){
let barCodeNO = {
barCode:each.FNumber,
}
barCodeNOList.push(barCodeNO);
}
);
console.log(barCodeNOList);
let judgArr = barCodeNOList.filter(
function(judge){
return judge.barCode == _self.FBarCodeNO;
}
);
if(judgArr.length == 0){
uni.showToast({
icon: "none",
title: "条码不是此箱条码,请重新扫描",
duration: 3500,
})
_self.FBarCodeNO = "";
return false;
}
// let commitDataArr = this.YESTableData.filter(
// function(commitEl){
// return commitEl.FNumber != _self.FBarCodeNO;
// }
// );
// commitDataArr.forEach(
// function(arrEl){
// let arrElData = {
// FNumber: arrEl["FNumber"],
// FDetailID: arrEl["FDetailID"],
// FItemNumber: arrEl["FItemNumber"],
// FItemName: arrEl["FItemName"],
// FBatchNO: arrEl["FBatchNO"],
// FQty: arrEl["FQty"],
// FUnitName: arrEl["FUnitName"],
// FSize: arrEl["FSize"], //部门、供应商、客户 内码
// FModel: arrEl["FModel"], //部门、供应商、客户 代码
// FIsBox: arrEl["FIsBox"],
// FBASEQTY:arrEl["FBASEQTY"],
// };
// _self.commitData.push(arrElData);
// }
// );
// console.log(this.commitData);
this.YESTableData.forEach(
function(el,index){
if(el.FNumber == _self.FBarCodeNO){
_self.delList.push(_self.YESTableData[index]);
}
}
);
this.YESTableData = this.YESTableData.filter(
function(el){
return el.FNumber != _self.FBarCodeNO;
}
);
this.showResult = true;
console.log(this.YESTableData);
barCodeNOList.forEach(
function(codelist){
if(codelist.barCode == _self.FBarCodeNO){
_self.FBarCodeNO = "";
}
}
);
this.showResult = true;
let lastSaveOrgid = this.orgFItemID; //最后一次条码录入成功后(条码进入已扫描列表)的组织ID
uni.setStorageSync(this.dbAlise+this.userName+this.currentTranType+'lastSaveOrgid',lastSaveOrgid);
this.saveCash();
},
showBarCodeCursor: function(){
let _self = this;
setTimeout(
function(){
_self.boxCodeFocus = false;
_self.barCodeFocus = false;
},
100
);
setTimeout(
function(){
_self.barCodeFocus = true;
},
200
);
},
showBoxCodeCursor: function(){
let _self = this;
_self.barCodeFocus = false;
_self.boxCodeFocus = false;
setTimeout(
function(){
_self.$nextTick(function(){
_self.boxCodeFocus = true;
});
},
200
);
},
backBtnClick: function() {
uni.reLaunch({
url: '/pages/apply/moreapply/moreapply'
})
},
saveCash:function(){
let _self = this;
let otherInfo = {"currentTranType":this.currentTranType,
"orgFItemID":this.orgFItemID,
"dbAlise":this.userInfo.dbAlise,
"UserID":this.userInfo.UserID,
"FBarCodeNO":this.FBarCodeNO,
"FBoxCodeNO":this.FBoxCodeNO,
"disableBarcode":this.disableBarcode
};
this.pageCashInfo.YESTableData = this.YESTableData;
this.pageCashInfo.commitDataList = this.commitDataList;
this.pageCashInfo.otherInfo = otherInfo;
this.pageCashInfo.sourceTableData = this.sourceTableData;
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) {
let _self = this;
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();
},
...mapMutations(['updateCacheByStorage'])
}
}
</script>
<style>
.content {
width: 100%;
/* height: 1000rpx;
position: relative; */
}
.content-head{
/* height: 240rpx; */
}
.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;
}
.type-select-box {
display: flex;
flex-wrap: nowrap;
margin-left: 32rpx;
margin-right: 32rpx;
height: 60rpx;
line-height: 60rpx;
margin-top: 8rpx;
align-items: center;
}
.type-select-box image{
height: 40rpx;
width: 40rpx;
position: absolute;
right: 40rpx;
}
.p-taitl{
width:208rpx;
height: 60rpx;
line-height: 60rpx;
font-size:32rpx;
font-family:Helvetica;
color:rgba(102,102,102,1);
flex-shrink: 0;
}
.tool-box{
width: 100%;
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; */
}
.head-input{
/* width: 505rpx; */
width: 100%;
height:60rpx;
border-radius:10rpx;
border:2rpx solid rgba(216,216,216,1);
padding-left: 24rpx;
font-size: 28rpx;
font-family: MicrosoftYaHei;
}
.showcolor {
/* width: 505rpx; */
width: 100%;
height:60rpx;
border-radius:10rpx;
border:2rpx solid rgba(216,216,216,1);
background-color: #F4F4F4!important;
padding-left: 24rpx;
font-size: 28rpx;
font-family: MicrosoftYaHei;
}
.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;
}
.tab-line-class{
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%);
}
.print-input{
height: 60rpx;
line-height: 60rpx;
border-radius:4px;
border:1px solid #c0c4cc;
margin-top: 16rpx;
}
.show-print{
margin-top: 32rpx;
margin-left: 32rpx;
margin-right: 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;
}
.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;
}
.head-checkbox-class {
transform:scale(0.75);
margin-left: 18rpx;
}
.button-class{
height:80rpx;
line-height:80rpx;
border-radius:4rpx;
font-size:32rpx;
margin-top: 32rpx;
background-color: #4662FF;
color: #FFFFFF!important;
}
</style>