Files

1627 lines
50 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="top-blank" />
<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>
<view class="header-row-class">
<p class="header-row-title-class">源单编号</p>
<view style="flex: 1 1;">
<input class="detail-row-white-class" type="text" v-model="FSourceBillNo" :focus="sourceBillNoFocus"
@confirm="sourceBillNoInfoConfirm">
</view>
<image src="../../../static/img/scan-blue.png"
v-show="showScan" @click="scan('sourceBillScan')"></image>
</view>
<view class="header-row-class">
<p class="header-row-title-class">车&ensp;牌&ensp;号</p>
<view style="flex: 1 1;">
<input class="detail-row-white-class" type="text" v-model="carNO" :focus="carNOFocus"
@confirm="showBarcode">
<!--<input class="detail-row-white-class" type="text" v-model="carNO" :focus="carNOFocus"-->
<!-- @confirm="carNOConfirm">-->
</view>
<image src="../../../static/img/scan-blue.png"
v-show="showScan" @click="scan('carNOScan')"></image>
</view>
<view class="header-row-class">
<p class="header-row-title-class">条&ensp;&ensp;&ensp;&ensp;码</p>
<view style="flex: 1 1;">
<input class="detail-row-white-class" type="text" v-model="FBarcodeNumber" :focus="barcodeNumberFcous" @confirm="barcodeConfirm()">
</view>
<image src="../../../static/img/scan-blue.png"
v-show="showScan" @click="scan('barCodeScan')"></image>
</view>
<view class="header-row-class">
<p class="header-row-title-class">数&ensp;&ensp;&ensp;&ensp;量</p>
<view style="flex: 1 1;">
<input type="text" :class="[qtyDisable?'header-row-input-gray-class':'header-row-input-white-class']"
v-model="FQty" :disabled="qtyDisable" @confirm="fqtyConfirm()" :focus="fqtyFcous">
</view>
</view>
<view class="detail-row-class" style="margin-top: 10rpx;">
<p class="detail-row-title-class">箱&ensp;&ensp;&ensp;&ensp;数</p>
<view style="flex: 1 1;">
<input
type="text" :class="[boxQtyDisable?'detail-row-gray-class':'detail-row-white-class']"
v-model="BoxQty" :disabled="boxQtyDisable" @confirm="fboxQtyConfirm()" :focus="boxQtyFcous"
/>
</view>
<view style="flex: 1 1;">
<view class="detail-row-white-class-stock" @click="temporaryStorageBtnClick">
暂存
</view>
</view>
</view>
</view>
<view>
<view class="detail-tabs-class">
<!-- 已扫描 -->
<view @tap="detailTabIndex=3" :class="[detailTabIndex==3?'detail-tabs-btn-gray-class':'detail-tabs-btn-yes-class']">已扫描</view>
<view style="border-left-width:1.5px; border-left-color: #E5E5E5; border-left-style: solid; height:40rpx; flex-grow: 0; flex-shrink: 0;"></view>
<!-- 源单 -->
<view @tap="detailTabIndex=1" :class="[detailTabIndex==1?'detail-tabs-btn-gray-class':'detail-tabs-btn-base-class']">源单信息</view>
<view style="border-left-width:1.5px; border-left-color: #E5E5E5; border-left-style: solid; height:40rpx; flex-grow: 0; flex-shrink: 0;"></view>
<!-- 汇总 -->
<!--<view @tap="detailTabIndex=2" :class="[detailTabIndex==2?'detail-tabs-btn-gray-class':'detail-tabs-btn-total-class']">汇总</view>-->
</view>
<view class="tabs">
<!--源单信息-->
<z-table :tableData='baseTableData' :columns='baseColumns' v-if="detailTabIndex==1" />
<!--汇总-->
<!--<z-table :tableData='totalTableData' :columns='totalColumns' v-if="detailTabIndex==2" />-->
<!-- 已扫描 -->
<z-table :tableData='yesTableData' :columns='yesColumns' showSelect @onClick='rowClick' @onSelect='tableSelect'
@onSort='doSort' v-if="detailTabIndex==3" />
</view>
</view>
<view class="header-row-btn-class" v-if="showResult">
<view :class="'commitBtnOther'" @click="commitBtnClick()" style="font-size: 32rpx;"
:disabled="isCommitBtnDisable">提交</view>
</view>
<view class="header-row-btn-class-del" @click="del()" style="font-size: 32rpx;"
v-if="!showResult">删除</view>
</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 opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
import errorStrUntil from '@/common/errorStrUntil.js';
import {
mapState,
mapMutations
} from 'vuex';
const commonUtil = require('../../../common/util.js');
var _self;
export default {
components: {
zTable,
uniTag,
xflSelect,
opsoftDialogNotice
},
data() {
return {
dialogNoticeContent:'',
dialogNoticeTitle:'',
dialogNoticeType:'',
showDialog:false,
carNO:'',
carNOFocus:false,
showScan:true,
orgArry:[{name:"请选择组织",key:""}],
orgFItemID:'',
index:0,
isShowOrg:true,
showCashTips:false,
loadCash:false,
pageCashInfo: {},
FUnitID:"",
showResult:true,
sourceInterID:"",
// 源单
FSourceBillNo:"",
FBarcodeNumber:"",
// 当前条码的数量
FQty:"",
BoxQty:"",
sourceBillNoFocus:true,
barcodeNumberFcous:false,
qtyDisable:true,
boxQtyDisable:true,
detailTabIndex:1,
totalTableData: [],
// 源单信息
baseTableData: [],
// 已扫描
yesTableData: [],
tempYesTableData: [],
tempBaseTableData:[],
commitList:[],
barcodeList:[],
currentBarCodeInfo:[],
currentBarcodeList:[],
//表格选择框显示
showSelect: true,
selectedList:[],
//汇总FSourceBillTypeName', 'FSourceBillNo
totalColumns: [
{ title: "源单类型", key: "FSourceBillTypeName", width: 350, formatNum: false },
{ title: "源单编号", key: "FSourceBillNo", width: 350, formatNum: false },
{ title: "物料代码", key: "FItemNumber", width: 350, formatNum: false },
{ title: "物料名称", key: "FItemName", width: 350, formatNum: false },
{ title: "规格", key: "FSize", width: 350, formatNum: false },
{ title: "批号", key: "FBatchNO", width: 350, formatNum: false },
{ title: "辅助属性", key: "FAuxPropName", width: 350, formatNum: false },
{ title: "数量", key: "FQty", width: 350 },
{ title: "单位", key: "FUnitName", width: 120, formatNum: false },],
//已扫描
yesColumns: [
{ title: "条码", key: "FBARCODE", width: 350, formatNum: false },
{ title: "箱码", key: "FBOXBARCODE", width: 350, formatNum: false },
{ title: "物料代码", key: "FITEMNUMBER", width: 350, formatNum: false },
{ title: "物料名称", key: "FITEMNAME", width: 350, formatNum: false },
{ title: "规格", key: "FSPECIFICATION", width: 350, formatNum: false },
// { title: "型号", key: "FModel", width: 350, formatNum: false },
{ title: "批号", key: "FLOT", 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: "FQTY", width: 350 },
{ title: "单位", key: "FUNITNAME", width: 120, formatNum: false },
{ title: "仓库", key: "FSTOCKNAME", width: 200, formatNum: false },
{ title: "仓位", key: "FSTOCKLOCNAME", width: 200, formatNum: false }],
//源单信息
baseColumns: [
{ title: "源单类型", key: "FSourceBillTypeName", width: 350, formatNum: false },
{ title: "源单编号", key: "FSRCBILLNO", width: 350, formatNum: false },
{ title: "源单行号", key: "FSRCENTRYUD", width: 350, formatNum: false },
{ title: "物料代码", key: "FMATERIALNUMBER", width: 350, formatNum: false },
{ title: "物料名称", key: "FMATERIALNAME", width: 350, formatNum: false },
{ title: "规格", key: "FSPECIFICATION", width: 350, formatNum: false },
{ title: "批号", key: "FLOT", width: 350, formatNum: false },
{ title: "辅助属性", key: "FAUXPROPNAME", width: 350, formatNum: false },
{ title: "数量", key: "FREALQTY", width: 200,formatNum: false },
{ title: "仓库名称", key: "FSTOCKNAME", width: 200,formatNum: false },
{ title: "仓库代码", key: "FSTOCKNUMBER", width: 200,formatNum: false },
{ title: "仓位名称", key: "FSTOCKLOCNAME", width: 200,formatNum: false },
{ title: "库存状态", key: "FSTOCKSTATUSNAME", width: 200,formatNum: false },
{ title: "保质日期", key: "FKFDATE", width: 300,formatNum: false },
{ title: "有效期至", key: "FUSEFULDATE", width: 300,formatNum: false },
// { title: "入库数量", key: "FRelationQty", width: 200 },
{ title: "单位", key: "FUNITNAME", width: 120, formatNum: false }],
isCommitBtnDisable: false,
ztableShowLoading: false,
fqtyFcous: false,
boxQtyFcous: false,
currentTranType: 21
}
},
computed:{
barcodeRule(){
if(this.sysParameters) {
if(this.sysParameters.hasOwnProperty("BarcodeRuleForVerification")) {
let rule = this.sysParameters["BarcodeRuleForVerification"];
if (rule) {
return rule;
}
}
}
return "";
},
...mapState(['userInfo', "sysParameters"])
},
methods: {
Calculate: function() {
let b;
// if(this.currentTranType == 10 || this.currentTranType == 29){
// b = ['FItemNumber', 'FItemName', 'FModel', 'FAuxPropName', 'FUnitName'];
// }
// else{
b = ['FSourceBillTypeName', 'FSourceBillNo', 'FItemNumber', 'FItemName', 'FSize', 'FModel','FBatchNO', 'FAuxPropName','Fcommitqty', 'FUnitName'];
// };
let _self = this;
var groupdata = _self.GroupBy(_self.yesTableData, b,
(d, v) => {
d = d || 0
let qtyNumber = parseFloat(v.FQty)
return d += qtyNumber;
});
console.log(groupdata);
_self.totalTableData = [];
groupdata.forEach(v => {
_self.totalTableData.push({
"FSourceBillTypeName": v.key.FSourceBillTypeName,
"FSourceBillNo": v.key.FSourceBillNo,
"FItemNumber": v.key.FItemNumber,
"FItemName": v.key.FItemName,
"FSize":v.key.FSize,
"FModel": v.key.FModel,
"FBatchNO":v.key.FBatchNO,
"FAuxPropName": v.key.FAuxPropName ? v.key.FAuxPropName : "",
"FQty": v.data,
"Fcommitqty":v.key.Fcommitqty,
"FUnitName": v.key.FUnitName
});
});
console.log("-----------------聚合" + _self.baseTableData);
},
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;
},
// 条码
barcodeConfirm: function(){
if(!this.FBarcodeNumber) {
uni.showToast({
icon: "none",
title: "请输入条码",
duration: 3500,
})
return false;
}
this.FBarcodeNumber = this.FBarcodeNumber.toUpperCase();
let isFail = this.checkBarcodeNumber(this.FBarcodeNumber);
if (isFail) {
uni.showToast({
icon: "none",
title: "请输入正确的条码",
duration: 3500,
})
return false;
}
// let userID = this.userInfo.token;
// let isExit = 0;
let requestParams = {
// "isExit": 0,
"FBILLNO": this.FSourceBillNo,
"CODE": this.FBarcodeNumber,
// "sourceTranType":21,
"orgID":this.orgFItemID
};
// return
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post('/OutStock/SaleCheckScanCode',
requestParams
).then(res => {
uni.hideLoading();
let data = res.Data;
let _self = this;
this.currentBarCodeInfo = data[0]; // obj
// 扫描结果都是 条码
if(data.length === 1) {
for (let itemKey in this.currentBarCodeInfo) {
if (["FBARTYPE","FBASEQTY","FQTY","FSECUNITQTY"].includes(itemKey)) {
this.currentBarCodeInfo[itemKey] = Number(this.currentBarCodeInfo[itemKey]);
} else if (itemKey === "FISBOX") {
this.currentBarCodeInfo[itemKey] = this.currentBarCodeInfo[itemKey] === "False" ? 0 : 1;
} else if (!this.currentBarCodeInfo[itemKey] && this.currentBarCodeInfo[itemKey]!== 0) {
this.currentBarCodeInfo[itemKey] = "";
}
}
// 判断 条码是否重复 FBARTYPE: 3 批次条码 不用判断
if(_self.currentBarCodeInfo.FBARTYPE !== 3){
let currentBarcode = _self.currentBarCodeInfo.FBARCODE;
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,
})
_self.currentBarCodeInfo = {};
return false;
}
}
}
}
this.FQty = this.currentBarCodeInfo.FQTY;
this.BoxQty = 1;
this.qtyDisable = true;
this.boxQtyDisable = true;
// 控制是否 可编辑
if(this.currentBarCodeInfo.FBARTYPE === 3){
this.qtyDisable = false;
if (this.currentBarCodeInfo.FISBOX) {
this.boxQtyDisable = false;
}
}
if(this.currentBarCodeInfo.FISBOX === 1) {
data[1].forEach(
function(el){
let boxCodeItem = {
"FSourceBillTypeName":_self.currentBarCodeInfo.FSourceBillTypeName
? _self.currentBarCodeInfo.FSourceBillTypeName : "",
"FSourceBillNo":el.FSourceBillNo ?el.FSourceBillNo : "",
"FBARCODE":el.FBARCODE ?el.FBARCODE : "",
"FBOXBARCODE":el.FBOXBARCODE ?el.FBOXBARCODE : "",
"FITEMNUMBER":el.FITEMNUMBER ?el.FITEMNUMBER : "",
"FITEMNAME":el.FITEMNAME ?el.FITEMNAME : "",
"FSPECIFICATION":el.FSPECIFICATION ?el.FSPECIFICATION : "",
"FModel":el.FModel ?el.FModel : "",
"FLOT":el.FLOT ?el.FLOT : "",
"FQTY":el.FQTY ?el.FQTY : "",
"FAUXPROPNAME":el.FAUXPROPNAME ?el.FAUXPROPNAME : "",
"FUNITNAME":el.FUNITNAME ?el.FUNITNAME : "",
"FKFPeriod":el.FKFPeriod ?el.FKFPeriod : "",
"FKFDate":el.FKFDate ?el.FKFDate : "",
"FLocation":el.FLocation ?el.FLocation : "",
"FSTOCKNAME":el.FSTOCKNAME ?el.FSTOCKNAME : "",
"FSTOCKLOCNAME":el.FSTOCKLOCNAME ?el.FSTOCKLOCNAME : "",
"FSCStockNumber":el.FSCStockNumber ?el.FSCStockNumber : "",
"FSCSPNumber":el.FSCSPNumber ?el.FSCSPNumber : "",
"FISBOX":el.FISBOX ?el.FISBOX : 0,
"FSourceTranType":el.FSourceBillType ?el.FSourceBillType : "",
"FSCStockID":el.FSCStockID ?el.FSCStockID : "",
"FSCStockPlaceID":el.FSCStockPlaceID ?el.FSCStockPlaceID : "",
"FSourceInterID":_self.sourceInterID ?_self.sourceInterID : "",
"FSize":el.FSize ?el.FSize : "",
"FUnitID":el.FUnitID,
"FCType":el.FCType
}
_self.tempYesTableData.push(boxCodeItem);
}
);
} else {
_self.tempYesTableData.push(_self.currentBarCodeInfo);
}
if(this.qtyDisable) {
this.putTable();
} else {
this.showFqty();
}
} else if (data.length > 1) {
data.forEach((item) => {
for (let itemKey in item) {
if (["FBARTYPE","FBASEQTY","FQTY","FSECUNITQTY"].includes(itemKey)) {
item[itemKey] = Number(item[itemKey]);
} else if (itemKey === "FISBOX") {
item[itemKey] = item[itemKey] === "False" ? 0 : 1;
} else if (!item[itemKey] && item[itemKey]!== 0) {
item[itemKey] = "";
}
}
_self.barcodeList.push(item.FBARCODE);
_self.yesTableData.push(item);
_self.commitList.push(item);
_self.FBarcodeNumber = '';
})
this.qtyDisable = true;
this.boxQtyDisable = true;
}
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
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;
},
//提交
commitBtnClick:function(){
if(!this.commitList) {
uni.showToast({
icon: "none",
title: "请输入条码",
duration: 3500,
})
return false;
}
if(!this.FSourceBillNo) {
uni.showToast({
icon: "none",
title: "请输入源单编号",
duration: 3500,
})
return false;
}
let requestParams = {
// "id": userID,
"FBILLNO": this.FSourceBillNo,
// "tranType": 22,
"barcodeList": this.commitList,
"orgID":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post('/OutStock/SaleCheckSubmit',
requestParams
).then(res => {
// this.isCommitBtnDisable = false;
uni.hideLoading();
uni.showToast({
icon: "none",
title: "复核成功",
duration: 3500,
})
// 清空数据
this.commitList = [];
this.FSourceBillNo = "";
this.carNO = "";
this.FBarcodeNumber = '';
this.FQty = null;
this.BoxQty = null;
this.yesTableData = [];
this.baseTableData = [];
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
//删除
del: function(e) {
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 _self = this;
let 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);
}
);
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.yesTableData.filter(
function(el, index){
return el.FBoxNumber == FBoxNumber;
}
);
_self.yesTableData = _self.yesTableData.filter(
function(el, index){
return el.FBoxNumber != FBoxNumber;
}
);
tempBoxData.forEach(
function(boxBarcodeEl){
_self.barcodeList = _self.barcodeList.filter(
function(barcodeEl){
return barcodeEl != boxBarcodeEl.FBarcodeNumber;
}
);
}
);
}
_self.commitList = _self.commitList.filter(
function(commitEl){
return commitEl.FNumber != el.FNumber;
}
);
_self.barcodeList = _self.barcodeList.filter(
function(barcodeEl){
return barcodeEl != el.FNumber;
}
);
}
);
_self.selectedList = new Array();
_self.Calculate();
uni.showToast({
icon: 'none',
title: '删除成功'
});
_self.showResult = true;
this.saveCash();
} else if (res.cancel) {
//_self.showStarCousM();
}
},
fail: () => {},
complete: () => {}
});
},
fboxQtyConfirm:function(){
let checkCartonFlag = true;
checkCartonFlag = commonUtil.judgeFloat(this.BoxQty);
if(!checkCartonFlag) {
uni.showToast({
icon: "none",
title: "请输入正确的箱数值",
duration: 3500,
})
return false;
}
checkCartonFlag = commonUtil.judgeInt(this.BoxQty);
//数量检查
if(!checkCartonFlag) {
uni.showToast({
icon: "none",
title: "箱数请输入整数",
duration: 3500,
})
return false;
}
let currentQty = parseInt(this.BoxQty);
if (Number.isNaN(currentQty)) {
uni.showToast({
icon: "none",
title: "请输入正确的箱数值"
})
return false;
}
//this.showResult = true;
this.putTable();
// this.saveCash();
this.qtyDisable = true;
this.boxQtyDisable = true;
this.showBarcode();
},
fqtyConfirm:function(){
let qtyCheckFlag = commonUtil.judgeFloat(this.FQty);
if(!qtyCheckFlag) {
return false;
}
else {
this.saveCash();
this.showFBoxqty();
}
},
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.filter((item) => {
return item.FINTERID
})[0].FINTERID;
}else{
if(defaultOrgInfo){
this.orgFItemID = defaultOrgInfo.FINTERID;
}else{
this.orgFItemID = orgInfo.filter((item) => {
return item.FINTERID
})[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;
}
console.log(this.orgArry, this.index)
},
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();
}
}
},
loadByCash:function(){
let _self = this;
let lastSaveOrgid = uni.getStorageSync(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.barcodeList = cashValue.barcodeList;
this.baseTableData = cashValue.baseTableData;
this.totalTableData = cashValue.totalTableData;
this.commitList = cashValue.commitList;
this.FSourceBillNo = cashValue.otherInfo.FSourceBillNo;
this.FBarcodeNumber = cashValue.otherInfo.FBarcodeNumber;
this.FQty = cashValue.otherInfo.FQty;
this.BoxQty = cashValue.otherInfo.BoxQty;
if(this.FQty) {
this.qtyDisable = false;
}
if(this.BoxQty) {
this.boxQtyDisable = false;
}
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:'无';
}
}
);
},
orgChange:function(e){
this.isChangedOrg = true;
this.index = e.target.value;
let isOpenDefaultOrg = uni.getStorageSync('isOpenDefaultOrg');
if(!this.orgArry[this.index].FINTERID) {
this.orgFItemID = "";
}
else {
this.orgFItemID = this.orgArry[this.index].FINTERID;
if(isOpenDefaultOrg){
uni.setStorageSync('defaultOrgInfo',this.orgArry[this.index]);
}
}
let cashValue = uni.getStorageSync('pageCash'+this.dbAlise+this.userName+this.currentTranType+this.orgFItemID)
if(cashValue){
this.loadByCash()
}else{
this.orgChangedClear();
}
},
orgChangedClear:function(){
this.FSourceBillNo = "";
this.FBarcodeNumber = "";
this.FQty = "";
this.BoxQty = "";
this.showResult = true;
this.qtyDisable = true;
this.boxQtyDisable = true;
this.baseTableData = [];
this.totalTableData = [];
this.yesTableData = [];
this.barcodeList = [];
this.commitList = [];
this.$forceUpdate();
},
putTable:function(){
let _self = this;
this.currentBarCodeInfo.FQTY = this.FQty;
this.currentBarCodeInfo.BoxQty = this.BoxQty;
this.barcodeList.push(this.currentBarCodeInfo.FBARCODE);
this.tempYesTableData.forEach(
function(el){
_self.yesTableData.push(el);
}
);
this.tempYesTableData.splice(0, this.tempYesTableData.length);
this.commitList = this.yesTableData; // 暂存要用
// this.Calculate();
uni.showToast({
icon: 'success',
title: "数据输入成功",
duration: 3000
});
//this.FQty = "";
//this.BoxQty = "";
this.FBarcodeNumber = "";
this.currentBarCodeInfo = {};
},
saveCash:function(){
let otherInfo = {"currentTranType":this.currentTranType,
"orgFItemID":this.orgFItemID,
"dbAlise":this.userInfo.dbAlise,
"UserID":this.userInfo.UserID,
"FSourceBillNo":this.FSourceBillNo,
"FBarcodeNumber":this.FBarcodeNumber,
"FQty":this.FQty,
"BoxQty":this.BoxQty
};
this.pageCashInfo.baseTableData = this.baseTableData;
this.pageCashInfo.commitList = this.commitList;
this.pageCashInfo.otherInfo = otherInfo;
this.pageCashInfo.barcodeList = this.barcodeList;
this.pageCashInfo.totalTableData = this.totalTableData;
this.pageCashInfo.yesTableData = this.yesTableData;
uni.setStorageSync('pageCash'+this.currentTranType+this.orgFItemID,this.pageCashInfo);
},
scan:function(e){
let _self = this;
let currentScanType = e;
console.log(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::"+e);
uni.scanCode({
success:function(res){
if(currentScanType == 'sourceBillScan'){
_self.FSourceBillNo = res.result;
_self.sourceBillNoInfoConfirm();
}else if(currentScanType == 'carNOScan'){
_self.carNO = res.result;
// _self.carNOConfirm();
_self.showBarcode();
}else if(currentScanType == 'barCodeScan'){
_self.FBarcodeNumber = res.result;
_self.barcodeConfirm();
}
}
})
},
// 聚焦条码
showBarcode:function(){
this.sourceBillNoFocus = false;
this.barcodeNumberFcous = false;
this.carNOFocus = false;
this.fqtyFcous = false;
this.boxQtyFcous = false;
let _self = this;
setTimeout(function() {
_self.$nextTick(function(){
_self.barcodeNumberFcous = true;
// this.carNOFocus = false;
})
}, 500);
},
// 聚焦车牌号
showCarNo:function(){
this.sourceBillNoFocus = false;
this.barcodeNumberFcous = false;
this.carNOFocus = false;
this.fqtyFcous = false;
this.boxQtyFcous = false;
let _self = this;
setTimeout(function() {
_self.$nextTick(function(){
_self.carNOFocus = true;
})
}, 500);
},
// 聚焦源单
showBillNo:function(){
this.sourceBillNoFocus = false;
this.barcodeNumberFcous = false;
this.carNOFocus = false;
this.fqtyFcous = false;
this.boxQtyFcous = false;
let _self = this;
setTimeout(function() {
_self.$nextTick(function(){
_self.sourceBillNoFocus = true;
})
}, 500);
},
showFBoxqty:function(){
this.sourceBillNoFocus = false;
this.barcodeNumberFcous = false;
this.fqtyFcous = false;
this.boxQtyFcous = false;
let _self = this;
setTimeout(function() {
_self.$nextTick(function(){
_self.boxQtyFcous = true;
})
}, 500);
},
showFqty:function(){
this.sourceBillNoFocus = false;
this.barcodeNumberFcous = false;
this.fqtyFcous = false;
this.boxQtyFcous = false;
let _self = this;
setTimeout(function() {
_self.$nextTick(function(){
_self.fqtyFcous = true;
})
}, 500);
},
//源单信息调用获取
sourceBillNoInfoConfirm: function() {
let _self = this;
if(this.FSourceBillNo.length===0) {
uni.showToast({
icon: "none",
title: "请输入源单编号",
duration: 3500,
})
return false;
}
let isHaveSource = true;
let isExit = 0;
let sourceBillNO = this.FSourceBillNo;
let requestParams = {
// "id": userID,
"sourceBillNO": sourceBillNO,
"orgid":this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post('/OutStock/SaleCheckScanSourceBill',
{
FCOMPANYID: this.orgFItemID,
FBILLNO: sourceBillNO
}
).then(res => {
uni.hideLoading();
console.log(res)
// return
// let localRes = JSON.parse(res);
let data1 = res.SourceInfo
// this.sourceInterID = data[0].FInterID;
if (data1.length === 0) {
uni.showToast({
icon: "none",
title: "源单信息为空",
duration: 3500,
})
} else {
for (const itemKey in Object.keys(data1[0])) {
data1[0][itemKey] = data1[0][itemKey] ? data1[0][itemKey] : '-';
}
data1[0].FSourceBillTypeName = '销售出库(复核)';
}
// data.forEach(
// function(el){
// let elData = {
// "FSourceBillTypeName":"销售出库(复核)",
// "FBillNo":sourceBillNO, // ok
// "FEntryID":el["FEntryID"] ? el["FEntryID"] : 0,
// "FITEMNUMBER":el["FITEMNUMBER"] ? el["FITEMNUMBER"] : "", // ok
// "FITEMNAME": el["FITEMNAME"] ? el["FITEMNAME"] : "",
// "FSPECIFICATION": el["FSPECIFICATION"] ? el["FSPECIFICATION"] : "", // ok
// "FModel": el["FModel"] ? el["FModel"] : "",
// "FQTY":el["FQTY"] ? el["FQTY"] : 0, //ok
// "FRelationQty":el["FRelationQty"] ? el["FRelationQty"] : 0,
// "FLOT":el["FLOT"] ? el["FLOT"] : "",
// "FAUXPROPNAME":el["FAUXPROPNAME"] ? el["FAUXPROPNAME"] : "",
// "FUNITNAME":el["FUNITNAME"] ? el["FUNITNAME"] : "", // ok
// }
// _self.tempBaseTableData.push(elData);
// }
// );
// 有暂存 的条码信息
if (res.StoredBarcodes && res.StoredBarcodes.length > 0) {
let data2 = res.StoredBarcodes // arr
data2.forEach((item) => {
for (let itemKey in item) {
if (["FBARTYPE","FBASEQTY","FQTY","FSECUNITQTY"].includes(itemKey)) {
item[itemKey] = Number(item[itemKey]);
} else if (itemKey === "FISBOX") {
item[itemKey] = item[itemKey] === "False" ? 0 : 1;
} else if (!item[itemKey] && item[itemKey]!== 0) {
item[itemKey] = "";
}
}
})
this.yesTableData = data2;
this.commitList = this.yesTableData;
} else {
this.yesTableData = [];
}
this.baseTableData = data1
// this.saveCash();
// this.showCarNo();
// 清空部分信息
// this.commitList = [];
// this.FSourceBillNo = "";
this.carNO = "";
this.FBarcodeNumber = '';
this.FQty = null;
this.BoxQty = null;
// this.baseTableData = [];
this.showBarcode();
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
//选择下标元素
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;
},
//暂存
temporaryStorageBtnClick:function(){
// let userID = this.userInfo.token;
let requestParams = {
"FBILLNO": this.FSourceBillNo,
// "tranType": 22,
"barcodeList": this.commitList,
"orgID": this.orgFItemID
};
uni.showLoading({
icon:'loading',
title:'加载中……',
mask:true
});
this.$request.post('/OutStock/SaleCheckTemporaryStorage',
requestParams
).then(res => {
uni.hideLoading();
uni.showToast({
icon: "none",
title: res,
duration: 3500,
})
// uni.showModal({
// content: res,
// success: function (res) {
// if (res.confirm) {
// console.log('用户点击确定');
// }
// }
// });
}).catch(err => {
uni.hideLoading();
this.dialogNoticeProps(err,'error')
});
},
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;
},
},
onLoad() {
let _self = this;
this.getOrgList();
// this.judgeCash();
},
onBackPress(options) {
uni.redirectTo({
url: '../../tabbar/apply/apply'
});
return true;
}
};
</script>
<style lang="scss">
.top-blank{
width:100%;
height: 16rpx;
}
.header-row-class-organzie{
display: flex;
justify-content: flex-end;
align-items: center;
padding-right: 32rpx;
}
.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;
}
.header-row-class {
display: flex;
flex-wrap: nowrap;
height: 60rpx;
margin-top: 10rpx;
// 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: fixed;
right: 40rpx;
}
.header-row-title-class {
width: 130rpx;
height: 60rpx;
line-height: 60rpx;
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
}
.detail-row-white-class{
height: 60rpx;
border-radius: 10rpx;
border: 2rpx solid #D8D8D8;
// flex: 0 0;
font-size: 28rpx;
font-family: MicrosoftYaHei;
color: #666666;
margin-left: 24rpx;
padding-left: 24rpx;
}
.header-row-input-gray-class{
height: 60rpx;
border-radius: 10rpx;
border: 2rpx solid #D8D8D8;
flex: 0 0;
font-size: 28rpx;
font-family: MicrosoftYaHei;
color: #5F7EF8;
background-color: #F4F4F4;
margin-left: 24rpx;
padding-left: 24rpx;
}
.header-row-input-white-class{
height: 60rpx;
border-radius: 10rpx;
border: 2rpx solid #D8D8D8;
flex: 0 0;
font-size: 28rpx;
font-family: MicrosoftYaHei;
color: #5F7EF8;
margin-left: 24rpx;
padding-left: 24rpx;
}
.detail-tabs-class {
display: flex;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
height: 80rpx;
}
.detail-tabs-btn-gray-class {
position: relative;
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size:28rpx;
font-family:MicrosoftYaHei;
color:#4662FF;
}
.detail-tabs-btn-gray-class::after{
position: absolute;
content: " ";
width: 2rem;
height: 0.12rem;
background: #4662FF;
bottom: -0.1rem;
left: 50%;
transform: translateX(-50%);
}
.detail-tabs-btn-yes-class {
position: relative;
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size:28rpx;
font-family:MicrosoftYaHei;
color:#666666;
}
.detail-tabs-btn-total-class {
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size:28rpx;
font-family:MicrosoftYaHei;
color:#666666;
}
.detail-tabs-btn-base-class {
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size:28rpx;
font-family:MicrosoftYaHei;
color:#666666;
}
.header-row-btn-class{
display: flex;
width: 100%;
height: 80rpx;
margin-top: 16rpx;
}
.commitBtnOther{
width: 100%;
height: 80rpx;
line-height: 80rpx;
color: #FFFFFF;
background: #5778FF;
font-size: 32rpx;
font-family: MicrosoftYaHei;
text-align: center;
border-radius: unset;
position: fixed;
left: 0;
bottom: 0;
}
.header-row-btn-class-commit{
width: 50%;
position: fixed;
height: 80rpx;
line-height: 80rpx;
font-size: 32rpx;
font-family: MicrosoftYaHei;
text-align: center;
background: #5778FF;
color: #FFFFFF;
border-radius: unset;
right: 0;
bottom: 0;
}
.header-row-btn-class-clear{
width: 50%;
position: fixed;
height: 80rpx;
line-height: 80rpx;
font-size: 32rpx;
text-align: center;
font-family: MicrosoftYaHei;
background: #F5F5F4;
color: #666666;
border-radius: unset;
left: 0;
bottom: 0;
}
.header-row-btn-class-del{
width: 100%;
height: 80rpx;
line-height: 80rpx;
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #FFFFFF;
text-align: center;
background-color: #F76260;
border-radius: unset;
position: fixed;
left: 0;
bottom: 0;
}
.tabs{
margin-top: 8rpx;
margin-left: 32rpx;
margin-right: 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;
}
.detail-row-class {
display: flex;
flex-wrap: nowrap;
height: 60rpx;
margin-top: 8rpx;
// background-color: #f7f9ff;
justify-content: flex-start;
align-items: center;
margin-left: 32rpx;
margin-right: 32rpx;
// margin-top: 16rpx;
}
.detail-row-class image{
height: 40rpx;
width: 40rpx;
position: fixed;
right: 40rpx;
}
.detail-row-title-class{
width: 135rpx;
height: 60rpx;
line-height: 72rpx;
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
}
.detail-row-white-class{
height: 60rpx;
line-height: 60rpx;
border-radius: 10rpx;
border: 2rpx solid #D8D8D8;
// flex: 0 0;
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
margin-left: 24rpx;
padding-left: 24rpx;
}
.detail-row-white-class-stock{
height: 60rpx;
line-height: 60rpx;
border-radius: 10rpx;
border: 2rpx solid #D8D8D8;
// flex: 0 0;
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #FFFFFF;
text-align: center;
margin-left: 24rpx;
background-color: #007AFF;
// padding-left: 24rpx;
}
.detail-row-gray-class{
height: 60rpx;
border-radius: 10rpx;
border: 2rpx solid #D8D8D8;
// flex: 0 0;
font-size: 32rpx;
font-family: MicrosoftYaHei;
color: #666666;
background-color: #F4F4F4;
margin-left: 24rpx;
padding-left: 24rpx;
}
</style>