Files

1753 lines
46 KiB
Vue
Executable File

<template>
<scroll-view class="content" scroll-y="true">
<view class="content-head">
<view class="header-row-class-organzie" v-if="isShowOrg">
<view class="header-row-title-class-organzie">当前组织:</view>
<picker @change="orgChange" :value="index" :range="orgArry" range-key="FNAME">
<view class="head-row-content-class-organzie">{{orgArry[index].FNAME}}</view>
</picker>
<image class="img-organzie" src="../../../static/img/changearrow.svg"></image>
</view>
<view class="inputContent" style="">
<p>方案编码</p>
<view class="tool-box">
<input type="text" v-model="FInvenPlanNO" style="color: #666666;font-size: 32rpx;"
@confirm="invenPlanNOConfirm()" :focus="PFocus">
</view>
<image src="../../../static/img/scan-blue.png"
v-show="showScan" @click="scan('planScan')"></image>
</view>
<view class="inputContent">
<p>方案名称</p>
<view class="tool-box">
<input disabled="true" v-model="FInvenPlanName" style="background: #F4F4F4;color: #666666;font-size: 32rpx;" />
</view>
</view>
</view>
<view style="height: 32rpx;"></view>
<view class="separate"></view>
<view class="tabs">
<view @tap="ShowScanTab()" :class="[isShowScanTab?'table-change':'table-stay']">已扫描</view>
<view style="width: 8rpx;height:40rpx ;background-color: #E5E5E5;"></view>
<!-- <view @tap="ShowTotalTab()" :class="[isShowTotalTab?'table-change':'table-stay']">汇总</view>
<view style="width: 8rpx;height:40rpx ;background-color: #E5E5E5;"></view> -->
<view @tap="ShowOperateTab()" :class="[isShowOperateTab?'table-change':'table-stay']">正操作</view>
</view>
<view class="OperateTab" v-if="isShowOperateTab">
<view class="operateItem">
<p>资产编码</p>
<view class="tool-box">
<input type="text" @confirm="barCodeConfirm()" :focus="BFocus"
v-model="currentBarCodeInfo.FBarcodeNumber" style="color: #666666;font-size: 32rpx;"/>
</view>
<image src="../../../static/img/scan-blue.png"
v-show="showScan" @click="scan('barCodeScan')"></image>
</view>
<view class="operateItem">
<p>资产名称</p>
<view class="tool-box">
<input type="text" v-model="FNAME" disabled="true"
style="background: #F4F4F4;color: #666666;font-size: 32rpx;"/>
</view>
</view>
<view class="operateItem">
<p>资产型号</p>
<view class="tool-box">
<input type="text" v-model="FMODEL" disabled="true"
style="background: #F4F4F4;color: #666666;font-size: 32rpx;"/>
</view>
</view>
<view class="operateItem">
<p> 资产数量</p>
<view class="tool-box">
<input type="text" v-model="FNUM"
disabled="true" style="background: #F4F4F4;color: #666666;font-size: 32rpx;"/>
</view>
</view>
</view>
<view class="table" v-if="isShowScanTab">
<z-table :tableData='scannedDataList' :columns='scannedColumns' emptyText='设置了showLoading=false才会看到我' @onClick='rowClick'
@onSelect='tableSelect' @onSort='doSort' />
</view>
<!-- <view class="table" v-if="isShowTotalTab">
<z-table :tableData='totalData' :columns='totalColumns' emptyText='设置了showLoading=false才会看到我' @onClick='rowClick'
@onSort='doSort' />
</view> -->
<view class="inputContent" v-if="showResult">
<view class="clear" v-if="isShowOperateTab" style="font-size: 32rpx;"
@click="clearBtnClick()">
清除
</view>
<view class="clear" v-if="isShowScanTab" style="font-size: 32rpx;"
@click="tempStorageSubmit()">
暂存
</view>
<view :style="{'background-color':(!isCommitBtnDisable ? '#007AFF' :'#808080')}"
@tap="commitBtnClick()" :disabled="isCommitBtnDisable" style="font-size: 32rpx;"
:class="[isShowOperateTab||isShowScanTab ? 'commitBtn' : 'commitBtnOther']">
提交
</view>
</view>
<view @click="DeleteRow()" class="retback" style="font-size: 32rpx;" v-if="!showResult">
删除
</view>
<opsoft-dialog-notice
:dialogNoticeShow="showDialog"
:dialogNoticeType="dialogNoticeType"
:dialogNoticeTitle="dialogNoticeTitle"
:dialogNoticeContent="dialogNoticeContent"
@dialogNoticeConfirmClick="dialogNoticeConfirmClick"
>
</opsoft-dialog-notice>
<opsoft-dialog
@dialogCancelClick="dialogCancelClick"
@dialogConfirmClick="dialogConfirmClick"
:dialogContent="dialogContent"
:dialogTitle="dialogTitle"
:dialogShow="dialogShow"
></opsoft-dialog>
</scroll-view>
</template>
<script>
import zTable from "../../../components/z-table/z-table.vue";
import uniTag from "../../../components/uni-badge/uni-badge.vue";
import xflSelect from '../../../components/xfl-select/xfl-select.vue';
import errorUtil from '@/common/errorutil.js'
const commonUtil = require('@/common/util.js');
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
import opsoftDialog from '@/components/opsoft-dialog/opsoft-dialog.vue'
import errorStrUntil from '@/common/errorStrUntil.js';
import {
mapState,
mapMutations
} from 'vuex';
var _self;
var currentTranType = 40;
export default {
data() {
return {
dialogNoticeContent:'',
dialogNoticeTitle:'',
dialogNoticeType:'',
showDialog:false,
dialogShow:false,
dialogTitle:'',
dialogContent:'',
dialogType:'',
dialogParams:new Object,
FINTERID:'',
FNAME:'',
FMODEL:'',
FNUM:'',
showScan:true,
currentTranType:'IASSE01',
showCashTips:false,
loadCash:false,
pageCashInfo: new Object(),
showStockType:1,
FUnitID:"",
isShowOrg:true,
orgArry:[{name:"请选择组织",key:""}],
orgFItemID:'',
index:0,
storageLocation:"",
storageFSCSPNumber:"",
storageFSCStockNumber:"",
showResult:true,
isShowStock:true,
isCommitBtnDisable:false,
isShowOperateTab: true,
isShowScanTab: false,
isShowTotalTab: false,
PFocus:true,
LFocus:false,
BFocus:false,
QFocus:false,
FSCSPNumberFocus: false,
FSCStockNumberFocus: false,
fQtyDisabled: true,
FInvenPlanNO: null,
FInvenPlanName: null,
selectedList: [],
scannedColumns: [ { title: "资产编码", key: "FNUMBER", width: 350, formatNum: false},
{ title: "资产名称", key: "FNAME", width: 350, formatNum: false },
{ title: "资产型号", key: "FMODEL", width: 350, formatNum: false },
{ title: "资产数量", key: "FNUM", width: 350, formatNum: false },
{ title: "盘点数量", key: "FQTY", width: 350, formatNum: false }
// { title: "辅助属性", key: "FAuxPropName", width: 350, formatNum: false },
// { title: "保质期", key: "FKFPeriod", width: 350, formatNum: false },
// { title: "生产日期", key: "FKFDate", width: 350, formatNum: false },
// { title: "批号", key: "FBatchNO", width: 350, formatNum: false },
// { title: "数量", key: "FQty", width: 350 },
// { title: "单位", key: "FUnitName", width: 350, formatNum: false } ,
],
scannedDataList: [],
totalColumns: [ { title: "物料代码", key: "FItemNumber", width: 350, formatNum: false },
{ title: "物料名称", key: "FItemName", width: 350, formatNum: false },
{ title: "实盘数量", key: "FQty", width: 350 },
{ title: "实盘仓库", key: "FStockNumber", width: 350, formatNum: false },
{ title: "实盘仓位", key: "FStockPlaceNumber", width: 350, formatNum: false } ],
totalData: [],
currentBarCodeInfo: new Object(),
boxTempList: [],
barcodeList: [],
commitList: [],
fSCSPNumberDisabled: true,
isScanenter: false,
}
},
components: {
zTable,
uniTag,
xflSelect,
opsoftDialogNotice,
opsoftDialog
},
onBackPress(options) {
uni.redirectTo({
url: '../../tabbar/apply/apply'
});
return true;
},
beforeMount() {
// this.updateCacheByStorage();
// this.getOrgList();
// this.showOrg();
// this.choseStockType();
// this.$forceUpdate();
},
mounted() {
// this.judgeCash();
},
onLoad() {
this.showPFocus();
this.getOrgList();
},
computed: {},
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;
},
dialogProps(dialogContent,type,params){
this.dialogShow = true;
this.dialogTitle = '提示';
this.dialogContent = dialogContent;
this.dialogType = type;
this.dialogParams.params = params;
},
dialogConfirmClick:function() {
let _self = this;
console.log("dialogConfirmClick");
this.dialogShow=false;
if(this.dialogType=='del'){
uni.showModal({
title: '提示',
content: '确定删除数据吗?',
showCancel: true,
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
let delList = _self.scannedDataList.filter(
function(el, index){
return _self.selectedList.includes(index);
}
);
_self.scannedDataList = _self.scannedDataList.filter(
function(el, index){
return !_self.selectedList.includes(index);
}
);
_self.barcodeList = _self.barcodeList.filter(
function(el,index){
return !_self.selectedList.includes(index);
}
);
console.log(_self.barcodeList );
_self.commitList = _self.commitList.filter(
function(el,index){
return !_self.selectedList.includes(index)
}
);
delList.forEach(
function(el, index){
if(el.FIsBox) {
let FBoxNumber = el.FBoxNumber;
_self.commitList = _self.commitList.filter(
function(commitEl){
return commitEl.FNumber != FBoxNumber;
}
);
_self.barcodeList = _self.barcodeList.filter(
function(barcodeEl){
return barcodeEl != FBoxNumber;
}
);
let tempBoxData = _self.scannedDataList.filter(
function(el, index){
return el.FBoxNumber == FBoxNumber;
}
);
_self.scannedDataList = _self.scannedDataList.filter(
function(el, index){
return el.FBoxNumber != FBoxNumber;
}
);
_self.commitList = _self.commitList.filter(
function(commitEl){
return commitEl.FNumber != el.FBarcodeNumber;
}
);
_self.barcodeList = _self.barcodeList.filter(
function(barcodeEl){
return barcodeEl != el.FBarcodeNumber;
}
);
tempBoxData.forEach(
function(boxBarcodeEl){
_self.barcodeList = _self.barcodeList.filter(
function(barcodeEl){
return barcodeEl != boxBarcodeEl.FBarcodeNumber;
}
);
}
);
}
}
);
_self.selectedList = new Array();
_self.Calculate();
uni.showToast({
icon: 'none',
title: '删除成功'
});
_self.showResult = true;
console.log(_self.userInfo);
this.saveCash();
uni.setStorageSync('pageCash'+_self.currentTranType+_self.orgFItemID,_self.pageCashInfo);
} else if (res.cancel) {
//_self.showStarCousM();
}
},
fail: () => {},
complete: () => {}
});
}
},
dialogCancelClick:function() {
console.log("dialogCancelClick");
this.dialogShow=false
},
scan:function(e){
let currentScanType = e;
uni.scanCode({
success:function(res){
if(currentScanType == 'planScan'){
_self.FInvenPlanNO = res.result;
_self.invenPlanNOConfirm();
}else if(currentScanType == 'barCodeScan'){
_self.currentBarCodeInfo.FBarcodeNumber = res.result;
_self.barCodeConfirm();
}else if(currentScanType == "FLocationScan"){
_self.currentBarCodeInfo.FLocation = res.result;
_self.fLocationConfirm();
}else if(currentScanType == "FSCStockScan"){
_self.currentBarCodeInfo.FSCStockNumber = res.result;
_self.fSCStockNumberConfirm();
}else if(currentScanType == "FSCSPScan"){
_self.currentBarCodeInfo.FSCSPNumber = res.result;
_self.fSCSPNumberConfirm();
}
}
})
},
//方案编码回车
invenPlanNOConfirm() {
let _self = this;
if(this.FInvenPlanNO){
let ruleNoSpace = this.FInvenPlanNO.replace(/\s*/g,"");
if (this.FInvenPlanNO.length <= 0) {
uni.showToast({
title: "盘点方案不可空白!",
duration: 2500,
});
return false;
}
}
let params;
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.get('/AssetInventory/GetAssetInventory',{
params:{
FBillNO:this.FInvenPlanNO
}
}).then(res => {
uni.hideLoading();
_self.FInvenPlanName = res[0].FNAME;
_self.FINTERID = res[0].FINTERID;
if(res[0].Deposit && res[0].Deposit.length>0){
_self.scannedDataList = res[0].Deposit;
}
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
//条码回车
barCodeConfirm() {
let _self = this;
if(!_self.currentBarCodeInfo.FBarcodeNumber) {
uni.showToast({
title: "请先扫描条码",
icon: "none",
duration: 3000,
});
return;
}
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
let params;
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.get('/AssetInventory/GetAssets',{
params:{
FBillNO:this.currentBarCodeInfo.FBarcodeNumber
}
}).then(res => {
uni.hideLoading();
this.FNAME = res[0].FNAME;
this.FMODEL = res[0].FMODEL;
this.FNUM = res[0].FNUM;
let scanArr = {
FASSETID:res[0].FINTERID,
FNUMBER:res[0].FNUMBER,
FNAME:res[0].FNAME,
FMODEL:res[0].FMODEL,
FNUM:res[0].FNUM,
FQTY:'',
}
this.scannedDataList.push(scanArr)
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
changeBtnStatu:function(){
let _self = this;
this.isCommitBtnDisable = true;
setTimeout(function(){
_self.isCommitBtnDisable = false;
},1000);
},
//暂存
tempStorageSubmit(){
let _self = this;
// this.changeBtnStatu();
if (this.scannedDataList.length <= 0) {
uni.vibrateShort({
success: function() {
console.log('success');
}
});
uni.showToast({
icon: 'none',
title: "无暂存数据",
duration: 1600,
});
return false;
}
let submitData = this.scannedDataList;
submitData.forEach(e => {
e.FNOTE = '';
})
let requestParams = {
basicType:1,
FINTERID:this.FINTERID,
FBILLNO:this.FInvenPlanNO,
SData:submitData
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post('/AssetInventory/TemporaryStorage',requestParams).then(res => {
uni.hideLoading();
let data = res;
this.currentBarCodeInfo.FBarcodeNumber = "";
this.FNAME = "";
this.FMODEL = "";
this.FNUM = "";
// uni.showModal({
// showCancel: false,
// content: data,
// confirmText: '确定',
// success: function (res) {
// if (res.confirm) {
// console.log('用户点击确定');
// }
// }
// });
this.BFocus = false;
this.$nextTick(function(){
this.BFocus = true;
})
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
//提交
commitBtnClick: function(){
let _self = this;
this.changeBtnStatu();
if (this.scannedDataList.length <= 0) {
uni.vibrateShort({
success: function() {
console.log('success');
}
});
uni.showToast({
icon: 'none',
title: "无提交数据",
duration: 1600,
});
return false;
}
let submitData = this.scannedDataList;
submitData.forEach(e => {
e.FNOTE = '';
})
let requestParams = {
basicType:2,
FINTERID:this.FINTERID,
FBILLNO:this.FInvenPlanNO,
SData:submitData
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post('/AssetInventory/TemporaryStorage',requestParams).then(res => {
uni.hideLoading();
let data = res;
this.scannedDataList.splice(0, _self.scannedDataList.length);
this.FInvenPlanName = "";
this.FInvenPlanNO = "";
this.currentBarCodeInfo.FBarcodeNumber = "";
this.FNAME = "";
this.FMODEL = "";
this.FNUM = "";
// uni.showModal({
// showCancel: false,
// content: data,
// confirmText: '确定',
// success: function (res) {
// if (res.confirm) {
// console.log('用户点击确定');
// }
// }
// });
this.BFocus = false;
this.$nextTick(function(){
this.BFocus = true;
})
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
//组织
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;
}
}
);
}else{
this.orgArry = [{name:"请选择组织", key:"", FNAME:"当前无组织"}];
this.index = 0;
}
},
orgChange:function(e){
console.log(this.orgArry)
this.index = e.target.value;
let isOpenDefaultOrg = uni.getStorageSync('isOpenDefaultOrg');
if(!this.orgArry[this.index].FItemID){
this.orgFItemID = "";
}else{
this.orgFItemID = this.orgArry[this.index].FItemID;
if(isOpenDefaultOrg){
uni.setStorageSync('defaultOrgInfo',this.orgArry[this.index]);
}
}
console.log(this.orgFItemID);
this.orgChangedClear();
},
showOrg:function(){
let userID = this.userInfo.token;
let currentPage = "MESMT05";
let requestParams = {
"id": userID,
"prgkey": currentPage
};
this.$request.post(
{
data: {
action: 'QueryIsEnableOr',
params: requestParams
}
}
).then(res => {
uni.hideLoading();
this.isShowOrg = JSON.parse(res);
if(!this.isShowOrg){
this.orgFItemID = "";
}
});
},
orgChangedClear:function(){
this.currentBarCodeInfo = new Object();
this.FInvenPlanNO = "";
this.FInvenPlanName = "";
this.currentBarCodeInfo.FBarcodeNumber = "";
this.currentBarCodeInfo.FItemNumber = "";
this.currentBarCodeInfo.FItemName = "";
this.currentBarCodeInfo.FAuxPropName = "";
this.currentBarCodeInfo.FQty = "";
this.currentBarCodeInfo.FLocation = "";
this.currentBarCodeInfo.FSCStockNumber = "";
this.currentBarCodeInfo.FSCSPNumber = "";
this.fQtyDisabled = true;
this.showResult = true;
this.fSCSPNumberDisabled = true;
this.scannedDataList = [];
this.totalData = [];
this.barcodeList = [];
this.commitList = [];
this.judgeCash();
this.$forceUpdate();
},
ShowOperateTab() {
this.isShowOperateTab = true;
this.isShowScanTab = false;
this.isShowTotalTab = false;
},
ShowScanTab() {
this.isShowScanTab = true;
this.isShowOperateTab = false;
this.isShowTotalTab = false;
},
comfirmHideCashTips:function(){
this.loadCash = true;
this.loadByCash();
this.showCashTips = false;
},
cancelHideCashTips:function(){
this.loadCash = false;
this.loadByCash();
this.showCashTips = false;
},
loadByCash:function(){
const cashValue = uni.getStorageSync('pageCash'+this.currentTranType+this.orgFItemID);
//if(this.loadCash){
this.orgFItemID = cashValue.otherInfo.orgFItemID;
this.scannedDataList = cashValue.scannedDataList;
this.barcodeList = cashValue.barcodeList;
this.commitList = cashValue.commitList;
this.totalData = cashValue.totalData;
this.billTypeSelectText = cashValue.otherInfo.FSourceBillName;
this.FInvenPlanNO = cashValue.otherInfo.FInvenPlanNO;
this.FInvenPlanName = cashValue.otherInfo.FInvenPlanName;
this.currentBarCodeInfo.FLocation = cashValue.otherInfo.FLocation;
this.currentBarCodeInfo.FSCStockNumber = cashValue.otherInfo.FSCStockNumber;
this.currentBarCodeInfo.FSCSPNumber = cashValue.otherInfo.FSCSPNumber;
if(this.currentBarCodeInfo.FSCSPNumber) {
this.fSCSPNumberDisabled = false;
}
this.storageLocation = cashValue.otherInfo.FLocation;
this.storageFSCStockNumber = cashValue.otherInfo.FSCStockNumber;
this.storageFSCSPNumber = cashValue.otherInfo.FSCSPNumber;
//}
// }else{
// uni.removeStorageSync('pageCash'+this.currentTranType+this.orgFItemID);
// }
},
fQtyConfirm:function(){
let _self = this;
let nextFlag = commonUtil.judgeFloat(_self.currentBarCodeInfo.FQty);
if (nextFlag) {
if(_self.showStockType == 1){
_self.showLFocus();
}
if(_self.showStockType == 2){
_self.showFSCStockNumberFocus();
}
}
},
ShowTotalTab() {
this.isShowTotalTab = true;
this.isShowOperateTab = false;
this.isShowScanTab = false;
},
//选择下标元素
tableSelect: function(selected) {
if(selected.length > 0){
this.showResult = false;
}else{
this.showResult = true;
}
let index = -1;
if(selected.length > this.selectedList.length){
index = selected[selected.length-1];
}
if(selected.length > (this.selectedList.length+1) && (index > -1)){
index = -1;
}
this.selectedList = selected;
if(index > -1) {
let barcode = this.scannedDataList[index].fBarcodeNumber;
// if (barcode) {
// uni.showToast({
// title: "您选择了条码:" + barcode,
// icon: 'none'
// });
// }
}
},
DeleteRow() {
let _self = this;
uni.vibrateShort({
success: function() {
console.log('success');
}
});
if (this.selectedList.length == 0) {
uni.showToast({
icon: "none",
title: "无删除数据"
})
return false;
}
this.dialogProps('确定删除数据吗?','del')
},
backBtnClick() {
uni.reLaunch({
url: '/pages/apply/moreapply/moreapply'
})
},
FBarCodeFocus() {
_self.barcodefocus = true;
_self.fstoragenumberfocus = false;
_self.fstockplacefocus = false;
_self.fstocknumberfocus = false;
},
clearBtnClick:function(){
this.currentBarCodeInfo.FBarcodeNumber = "";
this.currentBarCodeInfo.FItemNumber = "";
this.currentBarCodeInfo.FItemName = "";
this.currentBarCodeInfo.FAuxPropName = "";
this.currentBarCodeInfo.FQty = "";
this.fQtyDisabled = true;
this.$forceUpdate()
},
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;
},
fLocationConfirm: function(){
let _self = this;
if(!this.currentBarCodeInfo.FBarcodeNumber) {
uni.showToast({
title: "请先扫描条码",
icon: "none",
duration: 3000,
});
return;
}
let currentBarcode = this.currentBarCodeInfo.FBarcodeNumber;
if(this.currentBarCodeInfo.FCType != 3){
if(this.barcodeList.length > 0){
let barcodeExistList = this.barcodeList.filter(
function(barcode){
return barcode == currentBarcode;
}
);
if (barcodeExistList) {
if (barcodeExistList.length > 0) {
uni.showToast({
icon: "none",
title: "条码已存在",
duration: 3500,
})
return false;
}
}
}
}
let userID = this.userInfo.token;
let requestParams = {
"id": userID,
"tranType": currentTranType,
"stockData": this.currentBarCodeInfo.FLocation,
"sourceTranType": 0,
"souceBill": "",
"icmoEntryID":0,
"orgid":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post(
{
data: {
action: 'QueryStockData',
params: requestParams
}
}
).then(res => {
uni.hideLoading();
let data = JSON.parse(res);
let location = data.Location;
this.currentBarCodeInfo.FLocation = location.FLocation;
this.currentBarCodeInfo.FStockID = location.FStockID;
this.currentBarCodeInfo.FStockNumber = location.FStockNumber;
this.currentBarCodeInfo.FStockPlaceID = location.FStockPlaceID;
this.currentBarCodeInfo.FStockPlaceNumber = location.FStockPlaceNumber;
this.currentBarCodeInfo.FIsStockMgr = location.FIsStockMgr;
let sourceBillInfos = data.SourceBill;
//test 数据显示
let rowDataBarcode = {
"FSourceBillTypeName": this.currentBarCodeInfo.FSourceBillTypeName,
"FSourceBillNo": this.currentBarCodeInfo.FSourceBillNo,
"FBoxNumber": this.currentBarCodeInfo.FBoxNumber,
"FBarcodeNumber": this.currentBarCodeInfo.FBarcodeNumber,
"FItemNumber": this.currentBarCodeInfo.FItemNumber,
"FItemName": this.currentBarCodeInfo.FItemName,
"FModel": this.currentBarCodeInfo.FModel,
"FBatchNO": this.currentBarCodeInfo.FBatchNO,
"FAuxPropName": this.currentBarCodeInfo.FAuxPropName,
"FKFPeriod": this.currentBarCodeInfo.FKFPeriod,
"FKFDate": this.currentBarCodeInfo.FKFDate,
"FQty": this.currentBarCodeInfo.FQty,
"FUnitName": this.currentBarCodeInfo.FUnitName,
"FStockNumber": " "+this.currentBarCodeInfo.FStockNumber,
"FStockPlaceNumber": " "+this.currentBarCodeInfo.FStockPlaceNumber,
"FStockID": this.currentBarCodeInfo.FStockID,
"FStockPlaceID": this.currentBarCodeInfo.FStockPlaceID,
"FIsBox": false
};
if(!this.currentBarCodeInfo.FIsBox) {
this.scannedDataList.push(rowDataBarcode);
} else {
this.boxTempList.forEach(
function(el){
let elData = {
"FSourceBillTypeName": el.FSourceBillTypeName,
"FSourceBillNo": el.FSourceBillNo,
"FBoxNumber": el.FBoxNumber,
"FBarcodeNumber": el.FBarcodeNumber,
"FItemNumber": el.FItemNumber,
"FItemName": el.FItemName,
"FModel": el.FModel,
"FBatchNO": el.FBatchNO,
"FAuxPropName": el.FAuxPropName,
"FKFPeriod": el.FKFPeriod,
"FKFDate": el.FKFDate,
"FQty": el.FQty,
"FUnitName": el.FUnitName,
"FStockNumber": " "+location.FStockNumber,
"FStockPlaceNumber": " "+location.FStockPlaceNumber,
"FStockID": location.FStockID,
"FStockPlaceID": location.FStockPlaceID,
"FIsBox": true
};
_self.scannedDataList.push(elData);
//已扫箱码的条码
_self.barcodeList.push(el.FBarcodeNumber);
}
);
_self.boxTempList.splice(0, _self.boxTempList.length);
}
this.barcodeList.push(this.currentBarCodeInfo.FBarcodeNumber);
let commitDataBarcode = {
"FNumber": this.currentBarCodeInfo.FBarcodeNumber,
"FQty": this.currentBarCodeInfo.FQty,
"FSCStockID": this.currentBarCodeInfo.FStockID,
"FSCStockPlaceID": this.currentBarCodeInfo.FStockPlaceID,
"FEntryID": 0,
"FUnitID": this.FUnitID
};
this.commitList.push(commitDataBarcode);
this.Calculate();
uni.showToast({
icon: 'success',
title: "数据输入成功"
});
console.log(_self.userInfo);
this.saveCash();
this.storageLocation = this.currentBarCodeInfo.FLocation;
this.clearBtnClick();
this.BFocus = false;
this.$nextTick(function(){
this.BFocus = true;
})
this.saveCash();
// this.clearAllExpectType();
});
},
fSCStockNumberConfirm:function(){
console.log("存放仓库"+this.currentBarCodeInfo);
let userId = this.$store.state.userInfo.UserID;
if(!this.currentBarCodeInfo.FBarcodeNumber) {
uni.showToast({
title: "请先扫描条码",
icon: "none",
duration: 3000,
});
return;
}
if(!this.currentBarCodeInfo.FItemNumber || this.currentBarCodeInfo.FItemNumber.length == 0) {
uni.showToast({
title: "请先查询条码",
icon: "none",
duration: 3000,
});
return;
}
let SNO = this.currentBarCodeInfo.FSCStockNumber;
let userID = this.userInfo.token;
let requestParams = {
"id": userID,
"stockNumber":this.currentBarCodeInfo.FSCStockNumber,
"orgid":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post(
{
data: {
action: 'SearchStock',
params: requestParams
}
}
).then(res => {
uni.hideLoading();
let data = JSON.parse(res);
this.currentBarCodeInfo.TypeFStockID = data.FStockID;
this.fSCSPNumberDisabled = !data.FIsStockMgr;
uni.showToast({
icon: 'success',
title: "仓库录入成功"
});
this.storageFSCStockNumber = this.currentBarCodeInfo.FSCStockNumber;
if(this.fSCSPNumberDisabled) {
this.storageFSCSPNumber = "";
this.currentBarCodeInfo.FSCSPNumber = "";
this.currentBarCodeInfo.FLocation = this.currentBarCodeInfo.FSCStockNumber;
this.fLocationConfirm();
}
else {
this.showFSCSPNumberFocus();
}
this.saveCash();
});
},
fSCSPNumberConfirm:function(){
console.log("存放仓位"+this.currentBarCodeInfo);
let userId = this.$store.state.userInfo.UserID;
if(!this.currentBarCodeInfo.FSCStockNumber) {
uni.showToast({
title: "请录入仓库编号",
icon: "none",
duration: 3000,
});
return;
}
if(!this.currentBarCodeInfo.FBarcodeNumber) {
uni.showToast({
title: "请先扫描条码",
icon: "none",
duration: 3000,
});
return;
}
console.log(this.currentBarCodeInfo.FSCSPNumber);
console.log(this.currentBarCodeInfo.TypeFStockID);
let userID = this.userInfo.token;
let requestParams = {
"id": userID,
"stockNumber":this.currentBarCodeInfo.FSCStockNumber,
"stockPlaceNumber":this.currentBarCodeInfo.FSCSPNumber,
"stockID":this.currentBarCodeInfo.TypeFStockID ? this.currentBarCodeInfo.TypeFStockID : "",
"orgid":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post(
{
data: {
action: 'SearchStockPlace',
params: requestParams
}
}
).then(res => {
uni.hideLoading();
let data = JSON.parse(res);
uni.showToast({
icon: 'success',
title: "仓位录入成功"
});
this.storageFSCSPNumber = this.currentBarCodeInfo.FSCSPNumber;
this.currentBarCodeInfo.FLocation = data.FLocation;
this.fLocationConfirm();
});
},
//2020-04-24 ADD BY LYY对扫描记录的记录汇总
//删除重调
//源单案例
Calculate: function() {
let _self = this;
var groupdata = _self.GroupBy(_self.scannedDataList,
['FItemNumber', 'FItemName', 'FStockNumber', 'FStockPlaceNumber'], (d, v) => {
d = d || 0
let qtyNumber = parseInt(v.FQty)
return d += qtyNumber;
});
console.log(groupdata);
_self.totalData = [],
groupdata.forEach(v => {
_self.totalData.push({
"FItemNumber": v.key.FItemNumber,
"FItemName": v.key.FItemName,
"FStockNumber": v.key.FStockNumber,
"FQty": v.data,
"FStockPlaceNumber": v.key.FStockPlaceNumber
})
});
},
GroupBy: function(datas, keys, callBack) {
////debugger;
const list = datas || [];
const groups = [];
list.forEach(v => {
const key = {};
const data = {};
keys.forEach(k => {
key[k] = v[k];
});
let group = groups.find(v => {
return v._key === JSON.stringify(key);
});
if (!group) {
group = {
_key: JSON.stringify(key),
key: key,
};
groups.push(group);
}
if (callBack) {
group.data = callBack(group.data, v);
group.total = group.total || 0;
group.total++;
} else {
group.data = group.data || [];
group.data.push(v);
}
});
return groups;
},
choseStockType:function(){
console.log(this.sysParameters)
this.showStockType = this.sysParameters.STOCKPLACECHAR;
if(this.showStockType == 1){
this.isShowStock = true;
}
if(this.showStockType == 2){
this.isShowStock = false;
}
},
showPFocus:function(){
_self = this;
_self.LFocus = false;
_self.PFocus = false;
_self.BFocus = false;
_self.QFocus = false
_self.FSCSPNumberFocus = false;
_self.FSCStockNumberFocus = false;
setTimeout(function() {
_self.$nextTick(function(){
_self.PFocus = true;
})
}, 500);
},
showBFocus:function(){
_self = this;
_self.LFocus = false;
_self.PFocus = false;
_self.QFocus = false;
_self.BFocus = false;
_self.FSCSPNumberFocus = false;
_self.FSCStockNumberFocus = false;
setTimeout(function() {
_self.$nextTick(function(){
_self.BFocus = true;
})
}, 500);
},
showLFocus:function(){
_self = this;
_self.LFocus = false;
_self.PFocus = false;
_self.QFocus = false;
_self.BFocus = false;
_self.FSCSPNumberFocus = false;
_self.FSCStockNumberFocus = false;
setTimeout(function() {
_self.$nextTick(function(){
_self.LFocus = true;
if(_self.isScanenter && _self.currentBarCodeInfo.FLocation) {
_self.fLocationConfirm();
}
})
}, 500);
},
showQFocus:function(){
_self = this;
_self.LFocus = false;
_self.PFocus = false;
_self.QFocus = false;
_self.BFocus = false;
_self.FSCSPNumberFocus = false;
_self.FSCStockNumberFocus = false;
setTimeout(function() {
_self.$nextTick(function(){
_self.QFocus = true;
if(_self.isScanenter && _self.currentBarCodeInfo.FQty) {
_self.fQtyConfirm();
}
})
}, 500);
},
showFSCSPNumberFocus:function(){
_self = this;
this.LFocus = false;
this.PFocus = false;
this.BFocus = false;
this.QFocus = false;
this.FSCStockNumberFocus = false;
this.FSCSPNumberFocus = false
setTimeout(function() {
_self.$nextTick(function(){
_self.FSCSPNumberFocus = true;
if(_self.isScanenter && _self.currentBarCodeInfo.FSCSPNumber) {
_self.fSCSPNumberConfirm();
}
})
}, 500);
},
showFSCStockNumberFocus:function(){
_self = this;
this.LFocus = false;
this.PFocus = false;
this.BFocus = false;
this.QFocus = false;
this.FSCStockNumberFocus = false;
this.FSCSPNumberFocus = false
setTimeout(function() {
_self.$nextTick(function(){
_self.FSCStockNumberFocus = true;
if(_self.isScanenter && _self.currentBarCodeInfo.FSCStockNumber) {
_self.fSCStockNumberConfirm();
}
})
}, 500);
},
saveCash:function(){
let otherInfo = {"currentTranType":this.currentTranType,
"orgFItemID":this.orgFItemID,
"dbAlise":this.userInfo.dbAlise,
"UserID":this.userInfo.UserID,
"FInvenPlanName":this.FInvenPlanName,
"FInvenPlanNO":this.FInvenPlanNO,
"FLocation":this.currentBarCodeInfo.FLocation,
"FSCStockNumber":this.currentBarCodeInfo.FSCStockNumber,
"FSCSPNumber":this.currentBarCodeInfo.FSCSPNumber,
};
this.pageCashInfo.scannedDataList = this.scannedDataList;
this.pageCashInfo.commitList = this.commitList;
this.pageCashInfo.otherInfo = otherInfo;
this.pageCashInfo.barcodeList = this.barcodeList;
this.pageCashInfo.totalData = this.totalData;
uni.setStorageSync('pageCash'+this.currentTranType+this.orgFItemID,this.pageCashInfo);
},
judgeCash:function(){
const cashValue = uni.getStorageSync('pageCash'+this.currentTranType+this.orgFItemID);
if(cashValue) {
if(cashValue.otherInfo.dbAlise == this.userInfo.dbAlise &&
cashValue.otherInfo.UserID == this.userInfo.UserID){
// this.showCashTips = true;
this.loadByCash();
}
}
},
...mapMutations(['updateCacheByStorage'])
}
}
</script>
<style lang="scss">
.content {}
.content-head{
// height: 200rpx;
padding-left: 32rpx;
padding-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;
}
.inputContent {
display: flex;
width: 100%;
// height: 80rpx;
margin-top: 8rpx;
// margin-left: 32rpx;
}
.commitBtnOther{
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #FFFFFF;
border-radius: unset;
position: fixed;
left: 0;
bottom: 0;
}
.clear{
width: 50%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size: 32rpx;
font-family: MicrosoftYaHei;
background: #F5F5F4;
color: #666666;
position: fixed;
left: 0;
bottom: 0;
}
.commitBtn{
width: 50%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
color: #FFFFFF;
font-size: 32rpx;
font-family: MicrosoftYaHei;
border-radius: unset;
position: fixed;
right: 0;
bottom: 0;
}
.retback {
width: 100%;
color: #FFFFFF;
font-size: 32rpx;
font-family: MicrosoftYaHei;
text-align: center;
height: 80rpx;
line-height: 80rpx;
background-color: #F76260;
border-radius: unset;
position: fixed;
left: 0;
bottom: 0;
}
.inputContent{
display: flex;
align-items: center;
}
.inputContent image{
height: 40rpx;
width: 40rpx;
position: fixed;
right: 40rpx;
}
.inputContent p{
width: 180rpx;
height:60rpx;
line-height: 60rpx;
font-size:32rpx;
font-family:MicrosoftYaHei;
color:rgba(102,102,102,1);
}
.tool-box{
margin-left: 24rpx;
width: 100%;
}
.tool-box input{
height:60rpx;
line-height: 60rpx;
border-radius:10rpx;
padding-left: 24rpx;
border:1px solid rgba(216,216,216,1);
}
.separate{
width: 100%;
height: 16rpx;
background-color:#F5F5F5;
}
.OperateTab{
margin-bottom: 0rpx;
}
.operateItem {
display: flex;
// width: 100%;
margin-top: 8rpx;
padding-left: 32rpx;
padding-right: 32rpx;
align-items: center;
}
.operateItem image{
height: 40rpx;
width: 40rpx;
position: fixed;
right: 40rpx;
}
.operateItem p{
width: 180rpx;
height:60rpx;
line-height: 60rpx;
font-size:32rpx;
font-family:MicrosoftYaHei;
color:rgba(102,102,102,1);
}
.tabs {
display: flex;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
height: 80rpx;
// margin-top: 32rpx;
margin-left: 32rpx;
margin-right: 32rpx;
}
.table-stay{
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size:28rpx;
font-family:MicrosoftYaHei;
color:#666666;
}
.table-change{
position: relative;
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size:28rpx;
font-family:MicrosoftYaHei;
color:#4662FF;
// border-bottom: 1px solid #4662FF;
}
.table-change::after{
position: absolute;
content: " ";
width: 2rem;
height: 0.12rem;
background: #4662FF;
bottom: -0.1rem;
left: 50%;
transform: translateX(-50%);
}
.table{
margin-top: 16rpx;
margin-right: 32rpx;
margin-left: 32rpx;
}
.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;
}
</style>