Files

2267 lines
65 KiB
Vue
Executable File

<template>
<scroll-view class="content" scroll-y="true">
<opsoft-dialog-notice
:dialogNoticeShow="showDialog"
:dialogNoticeType="dialogNoticeType"
:dialogNoticeTitle="dialogNoticeTitle"
:dialogNoticeContent="dialogNoticeContent"
@dialogNoticeConfirmClick="dialogNoticeConfirmClick">
</opsoft-dialog-notice>
<view class="content-head">
<view class="header-top">
<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="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" style="position: absolute;"
v-show="showScan" @click="scan('planScan')"></image>
</view>
<view class="inputContent">
<p>方案名称</p>
<view class="tool-box">
<input type="text" disabled="true" v-model="FInvenPlanName" style="background: #F4F4F4;color: #666666;font-size: 32rpx;" />
</view>
</view>
<!-- //增加起始|终止仓库 -->
<view class="inputContent" style="">
<p>开始仓库</p>
<view class="tool-box">
<input type="text" disabled="true" v-model="startStockCode" style="background: #F4F4F4;color: #666666;font-size: 32rpx;">
</view>
</view>
<view class="inputContent" style="">
<p>结束仓库</p>
<view class="tool-box">
<input type="text" disabled="true" v-model="endStockCode" style="background: #F4F4F4;color: #666666;font-size: 32rpx;">
</view>
</view>
<!-- //增加截至日期 -->
<view class="inputContent">
<p>截至日期</p>
<view class="tool-box">
<input type="text" disabled="true" v-model="endDate" 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="ShowStockTab()" :class="[isShowStockTab?'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>条&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</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" style="position: absolute;"
v-show="showScan" @click="scan('barCodeScan')"></image>
</view>
<view class="operateItem">
<p class="tr">数&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;量</p>
<view class="tool-box">
<input type="number" v-model="currentBarCodeInfo.FQty" style="color: #666666;font-size: 32rpx;"
:disabled="fQtyDisabled" @confirm="fQtyConfirm()" :focus="QFocus"
:style="{'background':(!fQtyDisabled ? '#FFFFFF' : '#F4F4F4')}"/>
</view>
</view>
<view class="operateItem">
<p>调整数量</p>
<view class="tool-box">
<input type="number" @confirm="justQtyInput" :focus="justQtyFocus"
v-model="FADJUSTQTY" style="color: #666666;font-size: 32rpx;"/>
</view>
<!-- <image src="../../../static/img/scan-blue.png"
v-show="showScan" @click="scan('barCodeScan')"></image> -->
</view>
<!-- 库存状态 -->
<view class="header-row-class" v-if="stockStatus">
<p class="header-row-title-class">库存状态</p>
<xfl-select :list="stockStatusList" :listOrigin="stockStatusList" :clearable="false" :showItemNum="5"
@change="stockStatusChange" :isCanInput="false" ref="stockStatusList"
class="header-row-select-class" :defaultSelectText="stockStatusSelectText" />
</view>
<view class="operateItem" v-if="isShowStock">
<p class="tr">存放位置</p>
<view class="tool-box">
<input v-model="currentBarCodeInfo.FLocation" :focus="LFocus"
@confirm="fLocationConfirm()" style="color: #666666;font-size: 32rpx;"/>
</view>
<image src="../../../static/img/scan-blue.png" style="position: absolute;"
v-show="showScan" @click="scan('FLocationScan')"></image>
</view>
<view v-if="!isShowStock">
<view class="operateItem">
<p class="tr">仓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;库</p>
<view class="tool-box">
<input v-model="currentBarCodeInfo.FSCStockNumber" style="color: #666666;font-size: 32rpx;"
@confirm="fSCStockNumberConfirm()" :focus="FSCStockNumberFocus"/>
</view>
<image src="../../../static/img/scan-blue.png"
v-show="showScan" @click="scan('FSCStockScan')"></image>
</view>
<view class="operateItem">
<p class="tr">仓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位</p>
<view class="tool-box">
<input v-model="currentBarCodeInfo.FSCSPNumber" :disabled="fSCSPNumberDisabled"
:style="{'background':(!fSCSPNumberDisabled ? '#FFFFFF' : '#F4F4F4')}"
@confirm="fSCSPNumberConfirm()" :focus="FSCSPNumberFocus"
style="color: #666666;font-size: 32rpx;"/>
</view>
<image src="../../../static/img/scan-blue.png"
v-show="showScan && !fSCSPNumberDisabled" @click="scan('FSCSPScan')"></image>
</view>
</view>
<view class="operateItem">
<p class="tr">辅助数量</p>
<view class="tool-box">
<input disabled="true" style="background: #F4F4F4;color: #666666;font-size: 32rpx;"/>
</view>
</view>
<!-- 增加帐存数量|统计数量 -->
<view class="operateItem">
<p class="tr">帐存数量</p>
<view class="tool-box">
<input disabled="true" v-model="stockExitQty" style="background: #F4F4F4;color: #666666;font-size: 32rpx;"/>
</view>
</view>
<view class="operateItem">
<p class="tr">统计数量</p>
<view class="tool-box">
<input disabled="true" v-model="scanCodeTotalQty" style="background: #F4F4F4;color: #666666;font-size: 32rpx;"/>
</view>
</view>
<view class="operateItem">
<p class="tr">物料代码</p>
<view class="tool-box">
<input disabled="true" type="text" v-model="currentBarCodeInfo.FItemNumber"
style="background: #F4F4F4;color: #666666;font-size: 32rpx;"/>
</view>
</view>
<view class="operateItem">
<p class="tr">物料名称</p>
<view class="tool-box">
<input disabled="true" v-model="currentBarCodeInfo.FItemName"
style="background: #F4F4F4;color: #666666;font-size: 32rpx;"/>
</view>
</view>
<view class="operateItem">
<p class="tr">辅助属性</p>
<view class="tool-box">
<input disabled="true" v-model="currentBarCodeInfo.FAuxPropName"
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才会看到我' showSelect @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="table" v-if="isShowStockTab">
<z-table :tableData='stockInfoData' :columns='stockInfoColumns' 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 :style="{'background-color':(!isCommitBtnDisable ? '#007AFF' :'#808080')}"
@tap="commitBtnClick()" :disabled="isCommitBtnDisable" style="font-size: 32rpx;"
:class="[isShowOperateTab ? 'commitBtn' : 'commitBtnOther']">
提交
</view>
</view>
<view @click="DeleteRow()" class="retback" style="font-size: 32rpx;" v-if="!showResult">
删除
</view>
</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 DateTimePicker from '@/components/bory-dateTimePickerWithOutTime/bory-dateTimePickerWithOutTime.vue';
const commonUtil = require('@/common/util.js');
// import errorUtil from '@/common/errorutil.js';
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
import errorStrUntil from '@/common/errorStrUntil.js';
import Big from 'big.js';
import {
mapState,
mapMutations
} from 'vuex';
var _self;
// var currentTranType = STK_StockDiff;
export default {
data() {
return {
dialogNoticeContent:'',
dialogNoticeTitle:'',
dialogNoticeType:'',
showDialog:false,
// 日期选择
dateString: '',
type: 'date',
creatlist: [{
type: 'date',
detail: '选择开始时间'
}],
curDate: '',
startStockCode:'',
startStockCodeID:'',
endStockCodeID:'',
endStockCode:'',
// 截至日期
endDate:'',
//帐存信息
isShowStockTab:false,
filterParams:'',
stockExitQty:0, //帐存数量
scanCodeTotalQty:0, //统计数量
stockInfoData:[],
stockInfoColumns:[
{
title: "物料名称",
key: "FMATERIALNAME",
width: 300,
formatNum: false
},
{
title: "规格型号",
key: "FSPECIFICATION",
width: 350,
formatNum: false
},
{
title: "数量",
key: "FQTY",
width: 200,
formatNum: false
},
{
title: "批号",
key: "FLOT",
width: 350,
formatNum: false
},
{
title: "仓库",
key: "FSTOCKNUMBER",
width: 200,
formatNum: false
},
{
title: "仓位",
key: "FSTOCKLOCNAME",
width: 200,
formatNum: false
},
{
title: "单位",
key: "FSTOCKUNITNAME",
width: 200,
formatNum: false
},
{
title: "物料编码",
key: "FMATERIALNUMBER",
width: 350,
formatNum: false
},
{
title: "辅助属性",
key: "FAUXPROPID",
width: 350,
formatNum: false
},
{
title: "统计数量",
key: "FSUMQTY",
width: 350,
formatNum: false
}
],
FUSEFULDATE:'',
stockStatusList:[],
stockStatusSelectText:'',
FSTOCKSTATUSNAME:'',
FSTOCKSTATUSID:'',
FADJUSTQTY:'',
sourceEntryID:'',
showScan:true,
currentTranType:'STK_StockDiff',
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,
justQtyFocus:false,
FSCSPNumberFocus: false,
FSCStockNumberFocus: false,
fQtyDisabled: true,
FInvenPlanNO: null,
FInvenPlanName: null,
selectedList: [],
scannedColumns: [
// { title: "单据编号", key: "FSourceBillNo", width: 350, formatNum: false},
{ title: "箱码", key: "FBoxNumber", width: 350, formatNum: false },
{ title: "条码", key: "FBarcodeNumber", width: 350, formatNum: false },
{ title: "物料代码", key: "FItemNumber", width: 350, formatNum: false },
{ title: "物料名称", key: "FItemName", 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,
FLOT: '',
stockStatus: true,
}
},
onBackPress(options) {
uni.redirectTo({
url: '../../tabbar/apply/apply'
});
return true;
},
onLoad() {
this.showPFocus();
this.getOrgList();
//库存状态
if (this.stockStatus) {
this.getStockStatusList();
}
this.judgeCash();
//当前时间
let date = new Date();
this.curDate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
this.creatlist[0].detail = this.curDate;
this.$forceUpdate();
},
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(['userInfo', "sysParameters"])
},
updated() {
if(this.$refs.stockStatusList){
this.$refs.stockStatusList.selectText = this.FSTOCKSTATUSNAME;
}
},
components: {DateTimePicker,opsoftDialogNotice,zTable,uniTag,xflSelect},
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;
console.log(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::"+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();
}
}
})
},
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.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;
this.storageLocation = cashValue.otherInfo.FLocation;
this.storageFSCStockNumber = cashValue.otherInfo.FSCStockNumber;
this.storageFSCSPNumber = cashValue.otherInfo.FSCSPNumber;
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:'无';
}
}
);
this.stockInfoData = cashValue.stockInfoData;
this.Calculate();
},
fQtyConfirm:function(){
let _self = this;
let nextFlag = commonUtil.judgeFloat(_self.currentBarCodeInfo.FQty);
if (nextFlag) {
this.showJustQtyFocus();
}
},
justQtyInput:function(){
this.FADJUSTQTY = parseFloat(this.FADJUSTQTY);
if(this.FADJUSTQTY<=0){
uni.showToast({
title:'调整数量需大于0',
icon:'none'
})
}
this.showLFocus();
},
//组织
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.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.$forceUpdate();
},
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;
this.isShowStockTab = false;
},
ShowScanTab() {
this.isShowScanTab = true;
this.isShowOperateTab = false;
this.isShowTotalTab = false;
this.isShowStockTab = false;
},
ShowTotalTab() {
this.isShowTotalTab = true;
this.isShowOperateTab = false;
this.isShowScanTab = false;
this.isShowStockTab = false;
},
ShowStockTab() {
this.isShowStockTab = true;
this.isShowTotalTab = false;
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;
}
},
DeleteRow() {
let _self = this;
uni.vibrateShort({
success: function() {
console.log('success');
}
});
if (this.selectedList.length == 0) {
uni.showToast({
icon: "none",
title: "无删除数据"
})
return false;
}
uni.showModal({
title: '提示',
content: '确定删除数据吗?',
showCancel: true,
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
let delList = _self.scannedDataList.filter(
function(el, index){
return _self.selectedList.includes(index);
}
);
delList.forEach(
function(item){
_self.stockInfoData.forEach(
(el) => {
if (item.filterParams == el.filterParams) {
let bigQty = new Big(el.FSUMQTY);
bigQty = bigQty.minus(item.FQty);
el.FSUMQTY = bigQty.toString();
}
}
);
}
);
_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;
if(_self.scannedDataList.length==0){
uni.setStorageSync(this.dbAlise+this.userName+this.currentTranType+'lastSaveOrgid','');
}
this.saveCash();
} else if (res.cancel) {
//_self.showStarCousM();
}
},
fail: () => {},
complete: () => {}
});
},
backBtnClick() {
uni.reLaunch({
url: '/pages/apply/moreapply/moreapply'
})
},
FBarCodeFocus() {
let _self = this;
_self.barcodefocus = true;
_self.fstoragenumberfocus = false;
_self.fstockplacefocus = false;
_self.fstocknumberfocus = false;
},
//方案编码回车
invenPlanNOConfirm() {
let _self = this;
if(!this.FInvenPlanNO){
uni.showToast({
title:'方案编码不能为空',
icon:'none'
})
return false
}
if(this.boxTempList.length > 0){
this.boxTempList.splice(0, this.boxTempList.length);
}
if (this.scannedDataList.length > 0) {
uni.showToast({
icon: "none",
title: "有未提交的扫描数据,需先执行提交动作,再重新下载!",
duration: 2500,
});
return false;
}
let planCheckFlag = false;
if(this.FInvenPlanNO){
let ruleNoSpace = this.FInvenPlanNO.replace(/\s*/g,"");
if (this.FInvenPlanNO.length <= 0) {
uni.showToast({
title: "盘点方案不可空白!",
duration: 2500,
});
return false;
}
}
let userID = this.userInfo.token;
let requestParams = {
"sourceBillNO": this.FInvenPlanNO,
"orgID":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.get('/STKStockScheme/QuerySourceInvPrg',
{
params:requestParams
}).then(res => {
uni.hideLoading();
let data = res;
this.FInvenPlanName = data.HeadInfo.FNAME;
this.sourceEntryID = data.HeadInfo.FINTERID;
//开始|结束仓库
this.startStockCode = data.HeadInfo.FSTOCKNUMBER;
this.startStockCodeID = data.HeadInfo.FSTOCKID;
this.endStockCode = data.HeadInfo.FSTOCKTONUMBER;
this.endStockCodeID = data.HeadInfo.FSTOCKIDTO;
//截止日期
this.endDate = data.HeadInfo.FLOSEDATE?data.HeadInfo.FLOSEDATE:'';
//帐存信息
this.stockInfoData = data.OnBillEntryInfo;
if(!this.stockInfoData || this.stockInfoData.length==0){
console.log('帐存信息为空');
}
else {
this.stockInfoData.forEach(e => {
e.filterParams = e.FMATERIALID+e.FSTOCKID+e.FSTOCKLOCID+e.FSTOCKORGID+e.FKEEPERTYPEID+
e.FKEEPERID+e.FOWNERTYPEID+e.FOWNERID+e.FAUXPROPID+e.FSTOCKSTATUSID+
e.FSTOCKUNITID+e.FKFDATE+e.FLOT
});
//console.log("this.stockInfoData", JSON.stringify(this.stockInfoData));
}
this.BFocus = false;
this.$nextTick(function(){
_self.BFocus = true;
});
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
//获取库存状态列表
getStockStatusList(){
let _self = this;
let requestParams = {"orgID":this.orgFItemID}
this.$request.post('/SelBill/QueryStockStatus',requestParams).then(res => {
this.stockStatusList = res;
this.stockStatusList.forEach(e => {
e.value = e.FNAME;
})
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
})
},
stockStatusChange({ newVal, oldVal, index, orignItem }){
this.FSTOCKSTATUSNAME = orignItem.FNAME;
this.FSTOCKSTATUSID = orignItem.FNO;
},
//条码回车
barCodeConfirm() {
let _self = this;
if(!_self.currentBarCodeInfo.FBarcodeNumber) {
uni.showToast({
title: "请先扫描条码",
icon: "none",
duration: 3000,
});
return;
}
let currentBarcode = _self.currentBarCodeInfo.FBarcodeNumber;
let isFail = _self.checkBarcodeNumber(_self.currentBarCodeInfo.FBarcodeNumber);
if (isFail) {
uni.showToast({
icon: "none",
title: "请输入正确的条码",
duration: 3500,
})
return false;
}
let isHaveSource = true;
let isExit = 0;
let requestParams = {
"barCodeNum": currentBarcode,
"sourceBillNO": this.FInvenPlanNO,
"sourceTranType": 'STK_StockDiff',
"isHaveSource": isHaveSource,
"tranType": 'STK_StockDiff',
"isExit": isExit,
"sourceEntryID": this.sourceEntryID,
"orgID":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post('/SelBill/QueryBarCode',requestParams).then(res => {
uni.hideLoading();
let data = res;
this.filterParams = data.FMATERIALID+data.FSTOCKID+data.FSTOCKLOCID+this.orgFItemID+data.FKEEPERTYPEID+
data.FKEEPERID+data.FOWNERTYPEID+data.FOWNERID+data.FAUXPROPID+data.FSTOCKSTATUSID+
data.FUNITID+data.FKFDATE+data.FLOT;
console.log("this.filterParams", this.filterParams);
//帐存数量
let currCodeStockQty = this.stockInfoData.filter(e => {
return _self.filterParams == e.filterParams;
});
if (currCodeStockQty.length > 0) {
this.stockExitQty = currCodeStockQty[0].FQTY;
this.scanCodeTotalQty = currCodeStockQty[0].FSUMQTY;
}
else {
this.stockExitQty = 0;
this.scanCodeTotalQty = 0;
}
//库存状态
if (_self.stockStatus) {
if (res.FSTOCKSTATUSID) {
_self.FSTOCKSTATUSID = res.FSTOCKSTATUSID;
}
if (res.FSTOCKSTATUSNAME) {
_self.FSTOCKSTATUSNAME = res.FSTOCKSTATUSNAME;
if (_self.$refs.stockStatusList) {
_self.$refs.stockStatusList.selectText = res.FSTOCKSTATUSNAME;
}
}
}
_self.FUSEFULDATE = res.FUSEFULDATE;
_self.FADJUSTQTY = data["FQTY"];
_self.currentBarCodeInfo.barCodeInfo = data;
_self.FUnitID = data["FUNITID"];
_self.currentBarCodeInfo.FLOT = data["FLOT"];
_self.currentBarCodeInfo.FSCStockNumber = data["FLOCATION"];
_self.currentBarCodeInfo.FSCStockNumber =
_self.currentBarCodeInfo.FSCStockNumber.replace(/\s*/g,"");
_self.currentBarCodeInfo.FSCStockID = data["FSTOCKID"];
_self.currentBarCodeInfo.FSCSPNumber = data["FLOCATION"];
_self.currentBarCodeInfo.FSCSPNumber =
_self.currentBarCodeInfo.FSCSPNumber.replace(/\s*/g,"");
_self.currentBarCodeInfo.FSCStockPlaceID = data["FSTOCKLOCID"];
_self.currentBarCodeInfo.FItemNumber = data["FITEMNUMBER"];
_self.currentBarCodeInfo.FItemName = data["FITEMNAME"];
_self.currentBarCodeInfo.FModel = data["FSPECIFICATION"];
_self.currentBarCodeInfo.FCType = data["FBARTYPE"];
_self.currentBarCodeInfo.FKFPeriod = data["FKFPERIOD"];
_self.currentBarCodeInfo.FQty = data["FQTY"];
_self.currentBarCodeInfo.FID = data["FID"];//部门、供应商、客户 内码
_self.currentBarCodeInfo.FNO = data["FNO"];//部门、供应商、客户 代码
_self.currentBarCodeInfo.FName = data["FNAME"];//部门、供应商、客户 名称
_self.currentBarCodeInfo.FSourceBillNo = data["FSRCBILLNO"];
_self.currentBarCodeInfo.FBoxNumber = data["FBOXBARCODE"];
_self.currentBarCodeInfo.FBarcodeNumber = data["FBARCODE"];
_self.currentBarCodeInfo.FItemID = data["FMATERIALID"];
_self.currentBarCodeInfo.FBatchNO = data["FLOT"];
_self.currentBarCodeInfo.FAuxPropName = data["FAUXPROPNAME"];
_self.currentBarCodeInfo.FKFDate = data["FKFDATE"];
_self.currentBarCodeInfo.FUnitName = data["FUNITNAME"];
_self.currentBarCodeInfo.FLocation = data["FLOCATION"];
_self.currentBarCodeInfo.FLocation =
_self.currentBarCodeInfo.FLocation.replace(/\s*/g,"");
let isBox = Boolean(data["FISBOX"]);
_self.currentBarCodeInfo.FIsBox = isBox;
if((!_self.currentBarCodeInfo.FLocation) || (_self.currentBarCodeInfo.FLocation.length == 0)){
_self.currentBarCodeInfo.FLocation = _self.storageLocation;
}
let newFSCStockNumberFlag = true;
if((!_self.currentBarCodeInfo.FSCStockNumber) || (_self.currentBarCodeInfo.FSCStockNumber.length == 0)){
_self.currentBarCodeInfo.FSCStockNumber = _self.storageFSCStockNumber;
newFSCStockNumberFlag = false;
}
if((!_self.currentBarCodeInfo.FSCSPNumber) && (_self.currentBarCodeInfo.FSCSPNumber.length == 0) && (!newFSCStockNumberFlag)){
_self.currentBarCodeInfo.FSCSPNumber = _self.storageFSCSPNumber;
}
if((!_self.currentBarCodeInfo.FSCSPNumber) && (_self.currentBarCodeInfo.FSCSPNumber.length == 0)){
_self.fSCSPNumberDisabled = true;
}
if(_self.currentBarCodeInfo.FCType == 3 && _self.currentBarCodeInfo.FIsBox ==0){
_self.fQtyDisabled = false
}
if(_self.currentBarCodeInfo.FCType != 3){
if(_self.barcodeList.length > 0){
let barcodeExistList = _self.barcodeList.filter(
function(barcode){
return barcode == currentBarcode;
}
);
if (barcodeExistList) {
if (barcodeExistList.length > 0) {
uni.showToast({
icon: "none",
title: "条码已存在",
duration: 3500,
})
return false;
}
}
}
}
let extendBox = data.FBOXINFO;
if(extendBox.length>0){
extendBox.forEach(
function(el){
let elData = {
FSourceBillTypeName: _self.currentBarCodeInfo.FSourceBillTypeName?_self.currentBarCodeInfo.FSourceBillTypeName:"",
FSourceBillNo: el["FSRCBILLNO"]?el["FSRCBILLNO"]:"",
FBoxNumber: el["FBOXBARCODE"]?el["FBOXBARCODE"]:"",
FBarcodeNumber: el["FBARCODE"]?el["FBARCODE"]:"",
FItemNumber: el["FITEMNUMBER"]?el["FITEMNUMBER"]:"",
FItemName: el["FITEMNAME"]?el["FITEMNAME"]:"",
FItemID: el["FMATERIALID"]?el["FMATERIALID"]:"",
FSize: el["FSPECIFICATION"]?el["FSPECIFICATION"]:'',
// FModel: el["FSPECIFICATION"]?el["FSPECIFICATION"]:"",
FBatchNO: el["FLOT"]?el["FLOT"]:"",
FAuxPropName: el["FAUXPROPNAME"] ? el["FAUXPROPNAME"] : "",
FKFPeriod: el["FKFPERIOD"]?el["FKFPERIOD"]:"",
FKFDate: el["FKFDATE"]?el["FKFDATE"]:"",
FQty: el["FQTY"]?el["FQTY"]:"",
FUnitName: el["FUNITNAME"]?el["FUNITNAME"]:"",
FStockNumber: el["FLOCATION"]?el["FLOCATION"]:"",
FStockPlaceNumber: el["FLOCATION"]?el["FLOCATION"]:"",
FStockID:el["FSTOCKID"]?el["FSTOCKID"]:"",
FStockPlaceID:el["FSTOCKLOCID"]?el["FSTOCKLOCID"]:"",
FIsBox:true,
FCType: el["FBARTYPE"]?el["FBARTYPE"]:"",
FID: el["FID"]?el["FID"]:"",
FNO: el["FNO"]?el["FNO"]:"",
FName: el["FNAME"]?el["FNAME"]:"",
FLocation: el["FLOCATION"]?el["FLOCATION"]:"",
FBASEQTY: el["FBASEQTY"]?el["FBASEQTY"]:0
}
_self.boxTempList.push(elData);
}
)
}
_self.$set(_self.currentBarCodeInfo);
if (!_self.fQtyDisabled) {
_self.showQFocus();
}
else {
_self.showJustQtyFocus();
}
this.saveCash();
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
clearBtnClick:function(){
this.currentBarCodeInfo.FBarcodeNumber = "";
this.currentBarCodeInfo.FItemNumber = "";
this.currentBarCodeInfo.FItemName = "";
this.currentBarCodeInfo.FAuxPropName = "";
this.currentBarCodeInfo.FQty = "";
this.fQtyDisabled = true;
},
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;
}
}
}
}
//库存状态非空
if (_self.stockStatus) {
if (!_self.FSTOCKSTATUSID) {
uni.showToast({
title:'请选择库存状态',
icon:'none'
})
return false
}
}
let requestParams = {
"tranType": this.currentTranType,
"stockData": this.currentBarCodeInfo.FLocation,
"sourceTranType": 0,
"sourceBillNO": "",
// "icmoEntryID":0,
"orgID":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post('/SelBill/QueryStockData',requestParams).then(res => {
uni.hideLoading();
let data = res;
//校验库存状态是否在存放位置的库存状态中
if (_self.stockStatus) {
let isFDEFSTOCKSTATUSID = true;
let statusList = '';
if(_self.FSTOCKSTATUSID){
if(res.FSTOCKSTATUSALL){
isFDEFSTOCKSTATUSID = res.FSTOCKSTATUSALL.some(e => {
return e.FNO == _self.FSTOCKSTATUSID
});
res.FSTOCKSTATUSALL.forEach(e => {
statusList = statusList + e.FNAME + ' '
});
}
}
let tips = "库存状态["+_self.FSTOCKSTATUSNAME+"]与仓库["+statusList+"]不符";
if(!isFDEFSTOCKSTATUSID){
uni.showModal({
title: '异常',
content: tips,
showCancel:false,
success: function (res) {}
});
return false
}
}
// let location = data.Location;
this.currentBarCodeInfo.FLocation = data.FLOCATION;
this.currentBarCodeInfo.FStockID = data.FSTOCKID;
this.currentBarCodeInfo.FStockNumber = data.FSTOCKNUMBER? data.FSTOCKLOCNUMBER: "";
this.currentBarCodeInfo.FStockPlaceID = data.FSTOCKLOCID;
this.currentBarCodeInfo.FStockPlaceNumber = data.FSTOCKLOCNUMBER? data.FSTOCKLOCNUMBER: "";
// this.currentBarCodeInfo.FIsStockMgr = data.FIsStockMgr;
if (data.FSTOCKID || data.FSTOCKID == 0) {
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.FADJUSTQTY,
"FUnitName": this.currentBarCodeInfo.FUnitName,
"FStockNumber":this.currentBarCodeInfo.FStockNumber,
"FStockPlaceNumber":this.currentBarCodeInfo.FStockPlaceNumber?this.currentBarCodeInfo.FStockPlaceNumber:'',
"FStockID": this.currentBarCodeInfo.FStockID,
"FStockPlaceID": this.currentBarCodeInfo.FStockPlaceID,
"FIsBox": false,
"filterParams": _self.filterParams,
};
if (!_self.currentBarCodeInfo.FIsBox) {
_self.scannedDataList.push(rowDataBarcode);
}
else {
_self.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);
}
_self.barcodeList.push(_self.currentBarCodeInfo.FBarcodeNumber);
let commitDataBarcode = {
FBARCODE:this.currentBarCodeInfo.FBarcodeNumber,
FQTY:this.currentBarCodeInfo.FQty,
FSCSTOCKID:this.currentBarCodeInfo.FStockID,
FSCSTOCKPLACEID:this.currentBarCodeInfo.FStockPlaceID,
FADJUSTQTY:this.FADJUSTQTY,
"FSTOCKSTATUSID":this.FSTOCKSTATUSID,
"FUSEFULDATE":this.FUSEFULDATE
};
this.commitList.push(commitDataBarcode);
this.Calculate();
uni.showToast({
icon: 'success',
title: "数据输入成功"
});
if ((_self.FLOT == _self.currentBarCodeInfo.FLOT) && _self.currentBarCodeInfo.FQty) {
let bigQty = new Big(_self.currentBarCodeInfo.FQty);
bigQty = bigQty.plus(_self.scanCodeTotalQty);
_self.scanCodeTotalQty = bigQty.toString();
_self.stockInfoData.forEach(
(el) => {
if (_self.filterParams == el.filterParams) {
el.FSUMQTY = _self.scanCodeTotalQty;
}
}
);
}
else {
_self.FLOT = _self.currentBarCodeInfo.FLOT;
_self.stockInfoData.forEach(
(el) => {
if (_self.filterParams == el.filterParams) {
let bigQty = new Big(_self.currentBarCodeInfo.FQty);
bigQty = bigQty.plus(el.FSUMQTY);
_self.scanCodeTotalQty = bigQty.toString();
el.FSUMQTY = _self.scanCodeTotalQty;
}
}
);
}
let lastSaveOrgid = this.orgFItemID; //最后一次条码录入成功后(条码进入已扫描列表)的组织ID
uni.setStorageSync(this.dbAlise+this.userName+this.currentTranType+'lastSaveOrgid',lastSaveOrgid);
this.saveCash();
this.storageLocation = this.currentBarCodeInfo.FLocation;
this.clearBtnClick();
this.BFocus = false;
this.$nextTick(function(){
this.BFocus = true;
});
}
else {
uni.showModal({
content: "系统未找到存放位置" + this.currentBarCodeInfo.FLocation,
showCancel:false,
success: function (res) {
}
});
}
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
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 requestParams = {
"stockNumber":this.currentBarCodeInfo.FSCStockNumber,
"orgid":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.get('/SysConfigData/SearchStock',{
params:requestParams
}).then(res => {
uni.hideLoading();
let data = 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();
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
fSCSPNumberConfirm:function(){
console.log("存放仓位"+this.currentBarCodeInfo);
if(!this.currentBarCodeInfo.FSCStockNumber) {
uni.showToast({
title: "请录入仓库编号",
icon: "none",
duration: 3000,
});
return;
}
if(!this.currentBarCodeInfo.FBarcodeNumber) {
uni.showToast({
title: "请先扫描条码",
icon: "none",
duration: 3000,
});
return;
}
let requestParams = {
// "id": userID,
"stockNumber":this.currentBarCodeInfo.FSCStockNumber,
// "stockPlaceNumber":this.currentBarCodeInfo.FSCSPNumber ? this.currentBarCodeInfo.FSCSPNumber : "",
// "stockID":this.currentBarCodeInfo.typeFStockID ? this.currentBarCodeInfo.typeFStockID : "",
"orgid":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.get('/SysConfigData/SearchStockPlace',{
params:requestParams
}).then(res => {
uni.hideLoading();
let data = res;
uni.showToast({
icon: 'success',
title: "仓位录入成功"
});
this.storageFSCSPNumber = this.currentBarCodeInfo.FSCSPNumber;
this.currentBarCodeInfo.FLocation = data.FLocation;
this.fLocationConfirm();
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
//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) {
let _self = this;
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;
},
changeBtnStatu:function(){
let _self = this;
this.isCommitBtnDisable = true;
setTimeout(function(){
_self.isCommitBtnDisable = false;
},1000);
},
commitBtnClick: function(){
let _self = this;
this.changeBtnStatu();
if (this.scannedDataList.length <= 0) {
uni.showToast({
icon: 'none',
title: "无提交数据",
duration: 1600,
});
return false;
}
let requestParams = {
"sourceBillNO": this.FInvenPlanNO,
"submitData": this.commitList,
"orgid":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post('/STKStockScheme/SubmitBill',requestParams).then(res => {
uni.hideLoading();
let data = res;
this.commitList.splice(0, _self.commitList.length);
this.scannedDataList.splice(0, _self.scannedDataList.length);
this.barcodeList.splice(0, _self.barcodeList.length);
this.FInvenPlanName = "";
this.FInvenPlanNO = "";
this.startStockCode = '';
this.endStockCode = '';
this.endDate = '';
this.stockExitQty = '';
this.scanCodeTotalQty = '';
this.stockInfoData = [];
this.filterParamsTotalQtyArray = [];
this.Calculate();
uni.showModal({
showCancel: false,
content: data,
confirmText: '确定',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
}
}
});
uni.removeStorageSync(this.dbAlise+this.userName+this.currentTranType+'lastSaveOrgid');
uni.removeStorageSync('pageCash'+this.dbAlise+this.userName+this.currentTranType+this.orgFItemID);
this.BFocus = false;
this.$nextTick(function(){
_self.BFocus = true;
})
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
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(){
let _self = this;
_self.justQtyFocus = false;
_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(){
let _self = this;
_self.justQtyFocus = false;
_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(){
let _self = this;
_self.justQtyFocus = false;
_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(){
let _self = this;
_self.justQtyFocus = false;
_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);
},
showJustQtyFocus:function(){
let _self = this;
_self.justQtyFocus = false;
_self.LFocus = false;
_self.PFocus = false;
_self.QFocus = false;
_self.BFocus = false;
_self.FSCSPNumberFocus = false;
_self.FSCStockNumberFocus = false;
setTimeout(function() {
_self.$nextTick(function(){
_self.justQtyFocus = true;
})
}, 500);
},
showFSCSPNumberFocus:function(){
let _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(){
let _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;
this.pageCashInfo.stockInfoData = this.stockInfoData;
uni.setStorageSync('pageCash'+this.dbAlise+this.userName+this.currentTranType+this.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.commitList){
uni.showModal({
content:'存在未提交数据是否加载',
success: function (res) {
if (res.confirm) {
_self.loadByCash();
}
else if (res.cancel) {
console.log("点击取消")
}
}
})
}
},
...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;
}
.header-row-class {
display: flex;
flex-wrap: nowrap;
height: 60rpx;
line-height: 60rpx;
margin-top: 8rpx;
// background-color: #f7f9ff;
justify-content: flex-start;
align-items: center;
margin-left: 32rpx;
margin-right: 32rpx;
}
.header-row-class image{
height: 40rpx;
width: 40rpx;
position: absolute;
right: 40rpx;
}
.header-row-title-class {
width: 130rpx;
height: 60rpx;
line-height: 60rpx;
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
}
.header-row-select-class{
width: 100%;
height: 66rpx;
line-height: 66rpx;
border-radius: 10rpx;
border: 2rpx solid #D8D8D8;
flex: 1 1;
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #5F7EF8;
margin-left: 24rpx;
}
</style>