1148 lines
37 KiB
1148 lines
37 KiB
<template>
|
|
<view class="page-wraper">
|
|
<view class="page-header">
|
|
<view class="header-view">
|
|
<view class="header_job_top">
|
|
<jobTopAsn :dataContent="jobContent"></jobTopAsn>
|
|
</view>
|
|
<view v-if="operation=='receipt' && (managementType != 'BY_BATCH' && managementType != 'BY_QUANTITY')" class="uni-flex uni-row "
|
|
style=";margin-top: 10rpx; margin-left: 10rpx; text-align: right;">
|
|
<view class="font_default" style="display: block; ">
|
|
整单收货
|
|
</view>
|
|
<view class="uni-flex" style="margin-left: 20rpx; align-items: center; text-align: center;">
|
|
<u-switch v-model="isAllReceived" active-color="#5FCB94" inactive-color="#eee" size="35"
|
|
@change="switchChange"></u-switch>
|
|
</view>
|
|
</view>
|
|
<view class="" v-if="operation=='reject'">
|
|
<uni-section title="拒收原因" type="line">
|
|
<uni-easyinput v-model="reasonText" placeholder="请输入拒收原因"></uni-easyinput>
|
|
</uni-section>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- <required-location ref="locationCompare" title="默认收货库位 :" :locationCode="jobToLocationCode"
|
|
:isShowEdit="false"></required-location>
|
|
<view class='split_line'></view> -->
|
|
</view>
|
|
|
|
<view class="page-main">
|
|
<scroll-view scroll-y="true" class="page-main-scroll">
|
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
|
|
<view class="">
|
|
<!-- 管理精度是批次 -->
|
|
<comReceiptDetailCardBacth ref='comReceiptDetailCardBacthRef' :dataContent="item" :index="index" :settingParam="jobContent"
|
|
@remove="updateData" @updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList'
|
|
v-if="managementType == 'BY_BATCH' || managementType =='BY_QUANTITY'" :isNumPackTips='true'>
|
|
</comReceiptDetailCardBacth>
|
|
<com-receipt-detail-card :dataContent="item" :index="index" :settingParam="jobContent" @remove="updateData"
|
|
@updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList' v-else>
|
|
</com-receipt-detail-card>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
|
|
<!-- <div style="background: white;" v-if="operation=='receipt'" >
|
|
<uni-collapse>
|
|
<uni-collapse-item>
|
|
<template v-slot:title>
|
|
<view class="card_itemName" style="padding: 3px 5px; font-size: 28rpx;">
|
|
打印设置
|
|
</view>
|
|
</template>
|
|
<print ref="printService" @printCode="printCode" @templateCode="templateCode"></print>
|
|
</uni-collapse-item>
|
|
</uni-collapse>
|
|
</div> -->
|
|
|
|
<view class="page-footer">
|
|
<view style="background-color:ghostwhite; width: 100%; ">
|
|
<view v-if="operation=='receipt'" class="uni-flex u-col-center space-between padding_10">
|
|
<view>
|
|
<locationCompare ref="locationCompare" title="收货库位" :recommendLocationCode="jobToLocationCode"
|
|
@getLocation='scanLocationCode' :locationAreaTypeList="toLocationAreaTypeList">
|
|
</locationCompare>
|
|
</view>
|
|
<view>
|
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
|
|
</view>
|
|
</view>
|
|
<view v-else class="uni-flex u-col-center space-between padding_10">
|
|
<button class="btn_single_reject" hover-class="btn_commit_after" @click="reject"
|
|
style="width: 100%;">拒收</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<win-scan-pack ref="scanPopup" @getResult='getScanResult' :locationCode='jobToLocationCode'></win-scan-pack>
|
|
<win-scan-button @goScan='openScanPopup' v-if="operation=='receipt'"></win-scan-button>
|
|
<!-- <winScanPackAndCont ref="scanPopup" @getResult='getScanResult'></winScanPackAndCont> -->
|
|
<comMessage ref="comMessage"></comMessage>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
purchaseReceiptJobSubmit,
|
|
getPurchaseReceiptJobDetail,
|
|
takePurchaseReceiptJob,
|
|
cancleTakePurchaseReceiptJob,
|
|
getPutawayJobList,
|
|
getPurchaseReceiptJobDetailListByNmber
|
|
} from '@/api/request2.js';
|
|
|
|
import {
|
|
goHome,
|
|
getCurrDateTime,
|
|
getPackingNumberAndBatch,
|
|
compareDesc,
|
|
navigateBack,
|
|
getSwitchInfoByCode
|
|
} from '@/common/basic.js';
|
|
|
|
import {
|
|
getDirectoryItemArray,
|
|
} from '@/common/directory.js';
|
|
|
|
import {
|
|
getManagementPrecisions
|
|
} from '@/common/balance.js';
|
|
|
|
import {
|
|
getTreeDataSource,
|
|
createRecordInfo,
|
|
calcHandleQty,
|
|
getScanCount,
|
|
calcTreeHandleQty
|
|
} from '@/common/detail.js';
|
|
|
|
import {
|
|
Decimal
|
|
} from 'decimal.js'; //引入
|
|
|
|
import {
|
|
calc
|
|
} from '@/common/calc'
|
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
|
|
import winScanPackAndCont from '@/mycomponents/scan/winScanPackAndCont.vue'
|
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
|
|
import locationCompare from '@/mycomponents/location/locationCompare.vue'
|
|
import comReceiptDetailCard from '@/pages/purchaseReceipt/coms/comReceiptDetailCard.vue'
|
|
import comReceiptDetailCardBacth from '@/pages/purchaseReceipt/coms/comReceiptDetailCardBacth.vue'
|
|
import jobTopAsn from '@/mycomponents/job/jobTopAsn.vue'
|
|
// import print from '@/mycomponents/print/print.vue'
|
|
import {
|
|
productDismantleJobClose
|
|
} from '@/api/request2.js';
|
|
import {
|
|
nextTick
|
|
} from 'vue';
|
|
|
|
export default {
|
|
name: 'receipt_detail',
|
|
components: {
|
|
winScanButton,
|
|
winScanPackAndCont,
|
|
winScanPack,
|
|
comReceiptDetailCard,
|
|
locationCompare,
|
|
jobTopAsn,
|
|
comReceiptDetailCardBacth
|
|
// print
|
|
},
|
|
data() {
|
|
return {
|
|
id: '',
|
|
receiptJob: {},
|
|
scanCount: 0,
|
|
jobContent: {}, //任务内容
|
|
subList: [], //接口返回的任务subList
|
|
detailSource: [], //绑定在页面上的数据源
|
|
toLocationAreaTypeList: [],
|
|
toLocationCode: '',
|
|
jobToLocationCode: "",
|
|
toLocationInfo: {},
|
|
businessTypeInfo: {},
|
|
managementList: [],
|
|
managementType: '', //管理精度
|
|
jobStatus: "",
|
|
isAllReceived: false,
|
|
operation: '',
|
|
scanMessage: '',
|
|
status: '',
|
|
switchCode: "",
|
|
switchCode1: "",
|
|
isCheckLocation: 'purchaseReceiptLocationCodeValidate', //校验收货库位
|
|
reasonText: "",
|
|
packingNumberList:[],
|
|
source_type:'',
|
|
idValue:0
|
|
// printDeafult: {}, //默认打印机
|
|
// templateDeafult: {} //默认的模板
|
|
|
|
};
|
|
},
|
|
|
|
|
|
onLoad(option) {
|
|
this.id = option.id;
|
|
this.scanMessage = option.scanMessage;
|
|
this.operation = option.operation;
|
|
this.status = option.status;
|
|
this.source_type = option.source_type;
|
|
this.switchCode = "purchasereceiptPrintPDA" //采购收货PDA打印开关
|
|
this.switchCode1 = "EnableQms" //根据开关中是否启用QMS去判断,如果为TRUE显示检验指引单,如果为FALSE不显示检验指引单
|
|
uni.setNavigationBarTitle({
|
|
title:option.title + '详情'
|
|
})
|
|
if (this.id != undefined) {
|
|
//新建的任务自动接收
|
|
if (this.status == "1") {
|
|
this.receive((callback => {
|
|
this.getDetail();
|
|
}));
|
|
} else {
|
|
this.getDetail();
|
|
}
|
|
}
|
|
},
|
|
|
|
onShow() {
|
|
|
|
},
|
|
//返回首页
|
|
onNavigationBarButtonTap(e) {
|
|
if (e.index === 0) {
|
|
goHome();
|
|
}
|
|
},
|
|
//拦截返回按钮事件
|
|
onBackPress(e) {
|
|
//已经接收但是没提交任务
|
|
if (e.from == 'backbutton') {
|
|
if (this.jobStatus == "2") {
|
|
//取消承接任务
|
|
cancleTakePurchaseReceiptJob(this.id).then(res => {
|
|
uni.navigateBack();
|
|
}).catch(error => {
|
|
uni.navigateBack();
|
|
})
|
|
} else {
|
|
uni.navigateBack();
|
|
}
|
|
return true;
|
|
}
|
|
},
|
|
|
|
onPullDownRefresh() {
|
|
this.getDetail();
|
|
uni.stopPullDownRefresh();
|
|
},
|
|
|
|
mounted() {
|
|
|
|
},
|
|
methods: {
|
|
//接收
|
|
receive(callback) {
|
|
uni.showLoading({
|
|
title: "加载中....",
|
|
mask: true
|
|
});
|
|
if (this.id != null) {
|
|
takePurchaseReceiptJob(this.id).then(res => {
|
|
uni.hideLoading();
|
|
callback();
|
|
}).catch(error => {
|
|
uni.hideLoading();
|
|
this.showErrorMessage(error)
|
|
})
|
|
}
|
|
},
|
|
|
|
getDetail() {
|
|
var that = this;
|
|
uni.showLoading({
|
|
title: "加载中....",
|
|
mask: true
|
|
});
|
|
getPurchaseReceiptJobDetail(this.id).then(res => {
|
|
uni.hideLoading();
|
|
if (res.data == null) {
|
|
that.showMessage('未获取到详情');
|
|
} else {
|
|
if (res.data.subList.length > 0) {
|
|
that.jobContent = res.data;
|
|
that.toLocationAreaTypeList = getDirectoryItemArray(that.jobContent.toAreaTypes);
|
|
// that.jobContent.toLocationAreaTypeList = that.toLocationAreaTypeList;
|
|
that.subList = res.data.subList;
|
|
that.jobStatus = res.data.status
|
|
that.jobToLocationCode = that.subList[0].toLocationCode
|
|
that.detailSource = getTreeDataSource(that.subList)
|
|
that.isCheckLocation = getSwitchInfoByCode(that.isCheckLocation)
|
|
if (that.isCheckLocation) {
|
|
that.toLocationCode = ""
|
|
} else {
|
|
that.toLocationCode = that.jobToLocationCode;
|
|
}
|
|
console.log(777,that.toLocationCode)
|
|
that.isAllReceived = false;
|
|
|
|
//获取管理模式,封装参数
|
|
var itemCodes = []
|
|
this.detailSource.forEach(item => {
|
|
itemCodes.push(item.itemCode)
|
|
})
|
|
getManagementPrecisions(itemCodes, that.jobToLocationCode, res => {
|
|
if (res.success) {
|
|
this.managementList = res.list;
|
|
this.managementType = this.managementList&& this.managementList[0]&& this.managementList[0].ManagementPrecision ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING'
|
|
}
|
|
})
|
|
// 获取收货记录列表,用于判断扫描包装是否已被收货
|
|
getPurchaseReceiptJobDetailListByNmber(that.jobContent.requestNumber).then((res)=>{
|
|
console.log(res)
|
|
this.receiptRecordList = res.data
|
|
})
|
|
// if (uni.getStorageSync('purchaseReceiptDetailPointParams')) {
|
|
// const purchaseReceiptDetailPointParams = uni.getStorageSync(
|
|
// 'purchaseReceiptDetailPointParams')
|
|
// this.jobContent.printerUuid = purchaseReceiptDetailPointParams
|
|
// .printDeafult.value;
|
|
// this.jobContent.modelCode = purchaseReceiptDetailPointParams
|
|
// .templateDeafult.value;
|
|
// this.$refs.printService.setDefaultData(purchaseReceiptDetailPointParams
|
|
// .printDeafult, purchaseReceiptDetailPointParams.templateDeafult)
|
|
// }
|
|
//如果箱码扫描自动扫描,ASN不自动扫描
|
|
if (this.scanMessage) {
|
|
this.$refs.scanPopup.simulateScan(this.scanMessage);
|
|
}
|
|
} else {
|
|
that.showMessage('列表数据为0');
|
|
}
|
|
}
|
|
}).catch(error => {
|
|
uni.hideLoading()
|
|
this.showErrorMessage(error)
|
|
})
|
|
},
|
|
getScanResult(result) {
|
|
this.balanceInfo = result.balance
|
|
if(this.managementType == 'BY_BATCH'||this.managementType == 'BY_QUANTITY'){
|
|
this.getScanResultAfterBatch(result)
|
|
}else{
|
|
this.getScanResultAfter(result)
|
|
}
|
|
},
|
|
// 包装扫码之后逻辑
|
|
getScanResultAfter(result){
|
|
try {
|
|
var itemCode = result.label.itemCode;
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode);
|
|
if (detail == undefined) {
|
|
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
|
|
return;
|
|
}
|
|
detail.scaned = true;
|
|
if (result.label.labelType == "ContainerLabel") {
|
|
var containerNumber = result.label.container;
|
|
var itemDetail = detail.subList.filter(r => r.containerNumber == containerNumber);
|
|
if (itemDetail.length == 0) {
|
|
this.showErrorMessage("物料【" + itemCode + "】、托码【" + containerNumber + "】不在列表中")
|
|
} else {
|
|
if (itemDetail[0].scaned) {
|
|
this.showErrorMessage("物料【" + itemCode + "】、托码【" + containerNumber + "】已经扫描")
|
|
} else {
|
|
itemDetail.forEach(item => {
|
|
item.scaned = true;
|
|
itemDetail.scanDate = new Date();
|
|
item.handleQty = item.qty;
|
|
item.toLocationCode = this.toLocationCode;
|
|
})
|
|
calcHandleQty(this.detailSource);
|
|
this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序
|
|
this.continueScan()
|
|
this.$forceUpdate()
|
|
}
|
|
}
|
|
} else if (result.label.labelType == "PurchaseLabel") {
|
|
var packingNumber = result.package.number;
|
|
var parentpackingNumber = result.package.parentNumber;
|
|
var batch = result.label.batch;
|
|
var qty = result.label.qty;
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode);
|
|
if (detail == undefined) {
|
|
this.showMessage("物料号【" + itemCode + "】不在列表中")
|
|
} else {
|
|
//物料在列表中
|
|
var itemDetail = detail.subList.find(r => r.packingNumber == packingNumber && r.batch ==
|
|
batch);
|
|
if (itemDetail == undefined) {
|
|
itemDetail = detail.subList.find(r => r.packingNumber == parentpackingNumber && r.batch ==
|
|
batch);
|
|
|
|
if (itemDetail == undefined) {
|
|
this.showMessage("箱码【" + packingNumber + "】、批次【" + batch + "】不在列表中")
|
|
} else {
|
|
var pack = itemDetail.packList.find(p => p.packingNumber == packingNumber &&
|
|
p.batch == batch)
|
|
if (pack == undefined) {
|
|
this.showMessage("箱码【" + packingNumber + "】、批次【" + batch + "】不在列表中")
|
|
} else {
|
|
if (pack.scaned) {
|
|
pack.scanDate = new Date();
|
|
this.showMessage("箱码【" + packingNumber + "】已经扫描");
|
|
} else {
|
|
pack.scaned = true
|
|
pack.scanDate = new Date();
|
|
pack.handleQty = Number(result.label.qty);
|
|
pack.toLocationCode = this.toLocationCode;
|
|
pack.labelQty = Number(result.label.qty);
|
|
}
|
|
}
|
|
calcHandleQty(this.detailSource);
|
|
itemDetail.packList.sort(compareDesc('scanDate')); //按扫描信息排序
|
|
this.$forceUpdate()
|
|
}
|
|
|
|
} else {
|
|
//扫描的是外包装,将包装集合全部扫描
|
|
var scanedLength = 0;
|
|
itemDetail.packList.forEach(res => {
|
|
if (res.scaned) {
|
|
scanedLength++;
|
|
}
|
|
})
|
|
if (itemDetail.scaned && scanedLength == itemDetail
|
|
.packList.length) {
|
|
itemDetail.scanDate = new Date();
|
|
this.showMessage("箱码【" + packingNumber + "】已经扫描")
|
|
} else {
|
|
itemDetail.scaned = true;
|
|
itemDetail.scanDate = new Date();
|
|
itemDetail.handleQty = Number(result.label.qty);
|
|
itemDetail.toLocationCode = this.toLocationCode;
|
|
itemDetail.labelQty = Number(result.label.qty);
|
|
itemDetail.packList.forEach(pac => {
|
|
pac.scaned = true
|
|
pac.scanDate = new Date();
|
|
pac.handleQty = Number(pac.qty);
|
|
pac.toLocationCode = this.toLocationCode;
|
|
})
|
|
|
|
calcTreeHandleQty(this.detailSource);
|
|
this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序
|
|
this.continueScan()
|
|
this.$forceUpdate()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
} catch (e) {
|
|
this.showErrorMessage(e.message)
|
|
}
|
|
},
|
|
// 批次扫码之后逻辑
|
|
getScanResultAfterBatch(result){
|
|
console.log(222,result)
|
|
try {
|
|
var itemCode = result.label.itemCode;
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode);
|
|
if (detail == undefined) {
|
|
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
|
|
return;
|
|
}
|
|
detail.scaned = true;
|
|
if (result.label.labelType == "ContainerLabel") {
|
|
var containerNumber = result.label.container;
|
|
var itemDetail = detail.subList.filter(r => r.containerNumber == containerNumber);
|
|
if (itemDetail.length == 0) {
|
|
this.showErrorMessage("物料【" + itemCode + "】、托码【" + containerNumber + "】不在列表中")
|
|
} else {
|
|
if (itemDetail[0].scaned) {
|
|
this.showErrorMessage("物料【" + itemCode + "】、托码【" + containerNumber + "】已经扫描")
|
|
} else {
|
|
itemDetail.forEach(item => {
|
|
item.scaned = true;
|
|
itemDetail.scanDate = new Date();
|
|
item.handleQty = calc.add(item.handleQty,result.label.qty)
|
|
item.toLocationCode = this.toLocationCode;
|
|
})
|
|
// calcHandleQty(this.detailSource);
|
|
this.detailSource[0].subList.sort(compareDesc('scanDate')); //按扫描信息排序
|
|
this.continueScan()
|
|
this.$forceUpdate()
|
|
}
|
|
}
|
|
} else if (result.label.labelType == "PurchaseLabel") {
|
|
// debugger
|
|
var packingNumber = result.package.number;
|
|
var parentpackingNumber = result.package.parentNumber;
|
|
var batch = result.label.batch;
|
|
var qty = result.label.qty;
|
|
var detail = this.detailSource.find(r => r.itemCode == itemCode);
|
|
if (detail == undefined) {
|
|
this.showMessage("物料号【" + itemCode + "】不在列表中")
|
|
} else {
|
|
//物料在列表中
|
|
const batchDetailList = detail.subList.filter(r => r.batch ==
|
|
batch);
|
|
if (!batchDetailList || batchDetailList && batchDetailList.length == 0) {
|
|
this.showMessage("批次【" + batch + "】不在列表中")
|
|
} else {
|
|
// 箱码是否已经扫描
|
|
var isHavePackingNumber1 =this.receiptRecordList.find(r => r.packingNumber == packingNumber);
|
|
if(isHavePackingNumber1){
|
|
this.showMessage("箱码【" + packingNumber + "】已经生成任务");
|
|
return
|
|
}
|
|
var isHavePackingNumber =this.packingNumberList.find(r => r.packingNumber == packingNumber);
|
|
if(isHavePackingNumber){
|
|
this.showMessage("箱码【" + packingNumber + "】已经扫描");
|
|
return
|
|
}
|
|
for(let i = 0 ; i <batchDetailList.length;i++){
|
|
// 记录已经扫描箱码的总数量
|
|
let packAllHandleQty = new Decimal(0).toNumber()
|
|
batchDetailList[i].packList.forEach(pack=>{
|
|
pack.handleQty =pack.handleQty? pack.handleQty :0
|
|
packAllHandleQty = calc.add(packAllHandleQty,pack.handleQty)
|
|
})
|
|
// 批次任务数量减去当前扫描总箱码数量的差为该批次还有多少任务数量没有扫
|
|
let handleQtySub = calc.sub(parseFloat(batchDetailList[i].qty),parseFloat(packAllHandleQty))
|
|
let pack = {}
|
|
pack.packingNumber =packingNumber
|
|
pack.packQty = Number(result.package.packQty);
|
|
pack.packUnit = result.package.packUnit
|
|
pack.qty = batchDetailList[i].qty
|
|
|
|
pack.toLocationCode = this.toLocationCode;
|
|
console.log(999,result.package)
|
|
pack.labelQty = Number(result.label.qty);
|
|
pack.scaned = true;
|
|
// 当前批次剩余可以扫进的数量大于当前扫描的标签数量的时候直接插入当前的批次
|
|
if(handleQtySub >= parseFloat(qty)){
|
|
pack.handleQty = Number(qty);
|
|
batchDetailList[i].packList.push(pack)
|
|
batchDetailList[i].scaned = true
|
|
const isHave = this.packingNumberList.find(item=>item.packingNumber == packingNumber)
|
|
if(!isHave){
|
|
this.packingNumberList.push(pack)
|
|
}
|
|
calcTreeHandleQty(this.detailSource);
|
|
break
|
|
}else{
|
|
// 如果扫描的数量大于每行的任务剩余扫进去的数量
|
|
if(handleQtySub != 0){
|
|
// 如果是最后一行所有数量直接放入最后一行
|
|
if(batchDetailList.length-1 == i){
|
|
pack.handleQty = qty;
|
|
}else{
|
|
// 不是最后一行取当前批次剩余可以扫进的数量
|
|
pack.handleQty = handleQtySub;
|
|
}
|
|
batchDetailList[i].packList.push(pack)
|
|
batchDetailList[i].scaned = true
|
|
qty = calc.sub(parseFloat(qty),parseFloat(handleQtySub))
|
|
// 如果箱码没有被扫过直接插入记录箱码的列表,扫过了不计入
|
|
const isHave = this.packingNumberList.find(item=>item.packingNumber == packingNumber)
|
|
if(!isHave){
|
|
this.packingNumberList.push(pack)
|
|
}
|
|
calcTreeHandleQty(this.detailSource);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
console.log(8777,this.detailSource)
|
|
|
|
setTimeout(()=>{
|
|
this.$refs.comReceiptDetailCardBacthRef.forEach(item=>{
|
|
item.resizeCollapse()
|
|
|
|
item.$refs.packageListRef.$refs.collapse2.forEach(cur=>{
|
|
cur.resize()
|
|
})
|
|
})
|
|
},500)
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
} catch (e) {
|
|
this.showErrorMessage(e.message)
|
|
}
|
|
},
|
|
//继续扫描
|
|
continueScan() {
|
|
this.scanCount = getScanCount(this.subList);
|
|
if (this.scanCount == this.subList.length) {
|
|
this.closeScanPopup();
|
|
} else {
|
|
this.scanPopupGetFocus();
|
|
}
|
|
},
|
|
|
|
updateData(type,item,index,ele) {
|
|
if(type == 'parent'){
|
|
item.packList=[]
|
|
item.scaned = false
|
|
}else if(type == 'child'){
|
|
console.log(ele)
|
|
ele.packList.splice(index,1)
|
|
if(ele.packList.length == 0){
|
|
ele.scaned = false
|
|
}
|
|
}
|
|
this.packingNumberList = []
|
|
this.detailSource.forEach(item=>{
|
|
item.subList.forEach(cur=>{
|
|
if(cur.packList.length>0){
|
|
cur.packList.forEach(i=>{
|
|
this.packingNumberList.push(i)
|
|
})
|
|
}
|
|
})
|
|
})
|
|
setTimeout(()=>{
|
|
this.$refs.comReceiptDetailCardBacthRef.forEach(item=>{
|
|
item.resizeCollapse()
|
|
|
|
item.$refs.packageListRef.$refs.collapse2.forEach(cur=>{
|
|
cur.resize()
|
|
})
|
|
})
|
|
},500)
|
|
calcTreeHandleQty(this.detailSource);
|
|
},
|
|
|
|
scanLocationCode(location, code) {
|
|
if (this.jobContent.allowModifyLocation == 'TRUE') {
|
|
this.toLocationCode = code;
|
|
this.jobToLocationCode= code
|
|
} else {
|
|
if (code == this.jobToLocationCode) {
|
|
this.toLocationCode = code;
|
|
} else {
|
|
this.showErrorMessage("任务设置中不允许修改库位,扫描的库位【" + code + "】与推荐的库位【" + this.jobToLocationCode + "】不一致")
|
|
}
|
|
}
|
|
|
|
// this.toLocationCode = code
|
|
// this.detailSource.forEach(item => {
|
|
// item.subList.forEach(detail => {
|
|
// detail.toLocationCode = code
|
|
// })
|
|
// })
|
|
},
|
|
|
|
commit() {
|
|
this.scanCount = getScanCount(this.subList);
|
|
if (this.scanCount == 0) {
|
|
this.showErrorMessage("扫描数为0,请先扫描")
|
|
return;
|
|
}
|
|
//校验库位、
|
|
if (!this.checkLocation()) {
|
|
return
|
|
}
|
|
var itemCodes = []
|
|
this.detailSource.forEach(item => {
|
|
itemCodes.push(item.itemCode)
|
|
})
|
|
|
|
//获取管理模式,封装参数
|
|
getManagementPrecisions(itemCodes, this.toLocationCode, res => {
|
|
if (res.success) {
|
|
this.managementList = res.list;
|
|
this.managementType = this.managementList&&this.managementList[0]&&this.managementList[0].ManagementPrecision ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING'
|
|
if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY'){
|
|
this.checkBatch()
|
|
}else{
|
|
this.check()
|
|
}
|
|
} else {
|
|
uni.hideLoading();
|
|
this.showErrorMessage(res.message);
|
|
}
|
|
})
|
|
},
|
|
// 校验
|
|
check(){
|
|
//扫描数量和任务数量相等,直接提交
|
|
if (this.scanCount == this.subList.length) {
|
|
this.submitJob();
|
|
} else if (this.scanCount < this.subList.length) {
|
|
//扫描数量小于任务数量,判断是否允许部分提交
|
|
if (this.jobContent.allowPartialComplete == "TRUE") {
|
|
//提交
|
|
this.$refs.comMessage.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', res => {
|
|
if (res) {
|
|
|
|
this.submitJob()
|
|
}
|
|
});
|
|
} else {
|
|
//不允许部分提交,提示
|
|
this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
|
|
if (res) {
|
|
this.openScanPopup(this.jobToLocationCode);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
},
|
|
//按批次的校验
|
|
checkBatch(){
|
|
//扫描数量和任务数量相等,直接提交
|
|
let str = ''
|
|
let str1 = ''
|
|
let str2 = ''
|
|
this.detailSource.forEach((item) => {
|
|
item.subList.forEach(cur=>{
|
|
if(cur.scaned){
|
|
if(parseFloat(cur.qty)>parseFloat(cur.handleQty)){
|
|
str += `物料号【${item.itemCode}】批次【${cur.batch}】扫描数量【${cur.handleQty}】小于任务推荐数量【${cur.qty}】,\n请修改后再提交`
|
|
}
|
|
if(parseFloat(cur.qty)<parseFloat(cur.handleQty)){
|
|
str1 += `物料号【${item.itemCode}】批次【${cur.batch}】扫描数量【${cur.handleQty}】大于任务推荐数量【${cur.qty}】,\n请修改后再提交`
|
|
}
|
|
if(parseFloat(cur.qty)!=parseFloat(cur.handleQty)){
|
|
str2 += `物料号【${item.itemCode}】批次【${cur.batch}】扫描数量【${cur.handleQty}】与任务推荐数量【${cur.qty}】不一致,\n`
|
|
}
|
|
}
|
|
})
|
|
})
|
|
if(this.jobContent.allowBiggerQty == "FALSE"){
|
|
if(str1){
|
|
this.$refs.comMessage.showErrorMessage(str1);
|
|
return;
|
|
}
|
|
}
|
|
// if(this.jobContent.allowSmallerQty == "FALSE"){
|
|
// if(str){
|
|
// this.$refs.comMessage.showErrorMessage(str);
|
|
// return;
|
|
// }
|
|
// }
|
|
if(this.scanCount < this.subList.length){
|
|
//扫描数量小于任务数量,判断是否允许部分提交
|
|
if (this.jobContent.allowPartialComplete == "TRUE") {
|
|
//提交
|
|
this.$refs.comMessage.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', res => {
|
|
if (res) {
|
|
if(str2){
|
|
setTimeout(()=>{
|
|
this.$refs.comMessage.showQuestionMessage1(str2 + "是否提交?", 'red', res => {
|
|
if (res) {
|
|
this.submitJob()
|
|
}
|
|
});
|
|
},100)
|
|
}else{
|
|
this.submitJob()
|
|
}
|
|
|
|
}
|
|
});
|
|
} else {
|
|
//不允许部分提交,提示
|
|
this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
|
|
if (res) {
|
|
this.openScanPopup(this.jobToLocationCode);
|
|
}
|
|
});
|
|
}
|
|
}else{
|
|
this.submitJob();
|
|
}
|
|
},
|
|
reject() {
|
|
if (!this.reasonText) {
|
|
this.showMessage("请输入拒收原因")
|
|
return;
|
|
}
|
|
this.$refs.comMessage.showQuestionMessage('是否要拒收任务\n[' + this.jobContent.asnNumber + ']?', res => {
|
|
if (res) {
|
|
uni.showLoading({
|
|
title: "提交中....",
|
|
mask: true
|
|
});
|
|
var params = {
|
|
id: this.id,
|
|
refuseReason: this.reasonText
|
|
}
|
|
productDismantleJobClose(params).then(res => {
|
|
if (res.data) {
|
|
navigateBack(1)
|
|
} else {
|
|
this.showErrorMessage(res.msg)
|
|
}
|
|
}).catch(error => {
|
|
uni.hideLoading()
|
|
this.showErrorMessage(error)
|
|
})
|
|
}
|
|
})
|
|
},
|
|
submitJob() {
|
|
uni.showLoading({
|
|
title: "提交中....",
|
|
mask: true
|
|
});
|
|
|
|
var params = '';
|
|
if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY'){
|
|
params = this.setParamsBatch()
|
|
}else{
|
|
params = this.setParams()
|
|
}
|
|
let that = this
|
|
console.log(877,params)
|
|
purchaseReceiptJobSubmit(params).then(res => {
|
|
|
|
if (res.data) {
|
|
let isCheckPrint = getSwitchInfoByCode(this.switchCode)//是否显示上架指引单
|
|
let isCheckPrint1 = getSwitchInfoByCode(this.switchCode1)//是否显示采购收货检验指引单
|
|
if (isCheckPrint1 && !isCheckPrint) {
|
|
uni.hideLoading()
|
|
// this.showCommitSuccessMessage("提交成功\n生成采购收货记录\n" + res.data.number)
|
|
uni.redirectTo({
|
|
url: '/pages/pointPutawayJob/index?number=' + that.jobContent.number
|
|
})
|
|
}else if(!isCheckPrint1 && !isCheckPrint){
|
|
this.showCommitSuccessMessage("提交成功\n生成采购收货记录\n" + res.data.number)
|
|
uni.hideLoading()
|
|
}else if(that.source_type!='TOOL'&&that.source_type!='Develop'){
|
|
// if (res.data == '打印任务已发送,等待打印机处理!') {
|
|
// this.showCommitSuccessMessage(res.data)
|
|
// const purchaseReceiptDetailPointParams = {
|
|
// printDeafult: this.printDeafult,
|
|
// templateDeafult: this.templateDeafult,
|
|
// }
|
|
// uni.setStorageSync('purchaseReceiptDetailPointParams', purchaseReceiptDetailPointParams)
|
|
// } else {
|
|
// this.showErrorMessage(res.data)
|
|
// }
|
|
|
|
uni.showLoading({
|
|
title: "提交成功,将跳转到打印页面",
|
|
mask: true
|
|
});
|
|
|
|
// 获取上架任务
|
|
let timerCount = 0
|
|
const timer1 = setInterval(async () => {
|
|
if (timerCount == 15) {
|
|
clearInterval(timer1)
|
|
uni.hideLoading()
|
|
this.showErrorMessage("上架任务生成异常,请到收货记录里重新生成上架申请")
|
|
return;
|
|
}
|
|
await getPutawayJobList({
|
|
filters: [{
|
|
column: "purchaseReceiptRecordNumber",
|
|
action: "in",
|
|
value: res.data.number
|
|
}],
|
|
pageNo: 1,
|
|
pageSize: 1000,
|
|
}).then(res1 => {
|
|
timerCount = timerCount + 1
|
|
if (res1.data && res1.data.list && res1
|
|
.data
|
|
.list.length && (res1.data.total >= res
|
|
.data.detailCount)) {
|
|
uni.hideLoading()
|
|
clearInterval(timer1)
|
|
const dataParams = {
|
|
toLocationCode: res1.data.list[
|
|
0]
|
|
.toLocationCode,
|
|
number: res1.data.list[0]
|
|
.number,
|
|
creator: res1.data.list[0]
|
|
.creator,
|
|
createTime: res1.data.list[0]
|
|
.createTime,
|
|
ids: res1.data.list.map(item =>
|
|
item.masterId).join(
|
|
',')
|
|
}
|
|
uni.hideLoading()
|
|
if(!isCheckPrint1 && isCheckPrint){
|
|
uni.redirectTo({
|
|
url: '/pages/pointPutawayJob/index?data=' +
|
|
encodeURIComponent(JSON.stringify(dataParams))
|
|
})
|
|
}else if(isCheckPrint1 && isCheckPrint){
|
|
uni.redirectTo({
|
|
url: '/pages/pointPutawayJob/index?number=' + that.jobContent.number +
|
|
'&data=' +
|
|
encodeURIComponent(JSON.stringify(dataParams))
|
|
})
|
|
}
|
|
|
|
}
|
|
})
|
|
}, 2000)
|
|
|
|
}else if(that.source_type=='TOOL'||that.source_type=='Develop'){
|
|
uni.hideLoading()
|
|
this.showCommitSuccessMessage("提交成功\n生成采购收货记录\n" + res.data.number)
|
|
}
|
|
|
|
} else {
|
|
this.showErrorMessage("提交失败[" + res.msg + "]")
|
|
}
|
|
}).catch(error => {
|
|
uni.hideLoading()
|
|
this.$refs.comMessage.showErrorMessage(error, res => {
|
|
if (res) {
|
|
navigateBack(1)
|
|
}
|
|
});
|
|
})
|
|
|
|
|
|
},
|
|
|
|
setParamsBatch() {
|
|
var subList = []
|
|
var createTime = getCurrDateTime();
|
|
var creator = this.$store.state.user.id
|
|
console.log(8787,this.detailSource)
|
|
this.detailSource.forEach(item => {
|
|
let obj = ''
|
|
item.subList.forEach(detail => {
|
|
// if (!detail.scaned) {
|
|
// detail.handleQty = 0
|
|
// }
|
|
if(detail.scaned){
|
|
detail.packList.forEach(pack => {
|
|
obj= {...item,...detail, ...pack}
|
|
obj.toLocationCode = detail.toLocationCode
|
|
if (!pack.scaned) {
|
|
pack.handleQty = 0
|
|
}
|
|
obj.toPackingNumber =pack.packingNumber
|
|
// obj.packingNumber = ''
|
|
delete obj.subList
|
|
delete obj.packList
|
|
subList.push(obj)
|
|
})
|
|
// // obj.packList = []
|
|
// obj.toLocationCode = this.toLocationCode ? this.toLocationCode :this.jobToLocationCode
|
|
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,detail.packingNumber, detail.batch);
|
|
// console.log(info)
|
|
// obj.toPackingNumber =info.packingNumber;
|
|
// obj.packingNumber = info.packingNumber;
|
|
// obj.formPackingNumber = info.packingNumber;
|
|
obj.toBatch = info.batch;
|
|
}
|
|
|
|
})
|
|
})
|
|
|
|
this.jobContent.subList = subList
|
|
this.jobContent.createTime = createTime;
|
|
this.jobContent.creator = creator;
|
|
return this.jobContent;
|
|
},
|
|
setParams() {
|
|
var subList = []
|
|
var createTime = getCurrDateTime();
|
|
var creator = this.$store.state.user.id
|
|
|
|
this.detailSource.forEach(item => {
|
|
item.subList.forEach(detail => {
|
|
// if (!detail.scaned) {
|
|
// detail.handleQty = 0
|
|
// }
|
|
detail.packList.forEach(pack => {
|
|
if (!pack.scaned) {
|
|
pack.handleQty = 0
|
|
}
|
|
})
|
|
var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
|
|
detail.packingNumber, detail.batch);
|
|
detail.toPackingNumber = info.packingNumber;
|
|
detail.toBatch = info.batch;
|
|
subList.push(detail)
|
|
})
|
|
})
|
|
this.jobContent.subList = subList
|
|
this.jobContent.createTime = createTime;
|
|
this.jobContent.creator = creator;
|
|
return this.jobContent;
|
|
},
|
|
// printCode(e) {
|
|
// this.jobContent.printerUuid = e.value;
|
|
// this.printDeafult = e
|
|
// },
|
|
// templateCode(e) {
|
|
// this.jobContent.modelCode = e.value;
|
|
// this.templateDeafult = e
|
|
// },
|
|
checkLocation() {
|
|
var isPass = true;
|
|
if (this.toLocationCode == "" || this.toLocationCode == null) {
|
|
this.$refs.comMessage.showMessage('请扫描收货库位', res => {
|
|
if (res) {
|
|
this.$refs.locationCompare.showLocation();
|
|
}
|
|
});
|
|
return isPass = false;
|
|
}
|
|
//空库位校验
|
|
// var isHaveNullLocation = false;
|
|
// var nullLocationList = [];
|
|
// this.detailSource.forEach(item => {
|
|
// item.subList.forEach(detail => {
|
|
// if (detail.toLocationCode == null || detail.toLocationCode == "") {
|
|
// nullLocationList.push(detail)
|
|
// }
|
|
// })
|
|
// })
|
|
|
|
// if (nullLocationList.length > 0) {
|
|
// //弹出提示,是否把其他的库位都变成默认库位
|
|
// this.$refs.comMessage.showQuestionMessage("是否把其他的库位都变成默认库位", res => {
|
|
// nullLocationList.forEach(res => {
|
|
// res.toLocationCode = this.toLocationCode
|
|
// })
|
|
// })
|
|
// isPass = false;
|
|
// }
|
|
return isPass;
|
|
},
|
|
|
|
switchChange(isOn) {
|
|
this.isAllReceived = isOn
|
|
if (this.isAllReceived) {
|
|
this.detailSource.forEach(item => {
|
|
item.scaned = true
|
|
item.subList.forEach(detail => {
|
|
detail.scaned = true
|
|
detail.handleQty = detail.qty;
|
|
detail.toLocationCode = this.toLocationCode;
|
|
detail.labelQty = detail.qty;
|
|
detail.packList.forEach(pack => {
|
|
pack.scaned = true;
|
|
pack.handleQty = Number(pack.qty);
|
|
pack.toLocationCode = this.toLocationCode;
|
|
})
|
|
|
|
})
|
|
})
|
|
this.scanCount = getScanCount(this.detailSource);
|
|
calcHandleQty(this.detailSource);
|
|
} else {
|
|
this.$refs.comMessage.showQuestionMessage("是否要关闭整单收货?", res => {
|
|
if (res) {
|
|
|
|
this.getDetail()
|
|
} else {
|
|
this.isAllReceived = true;
|
|
}
|
|
});
|
|
|
|
}
|
|
},
|
|
|
|
|
|
showMessage(message) {
|
|
if (this.$refs.scanPopup) {
|
|
this.$refs.scanPopup.losefocus();
|
|
}
|
|
setTimeout(r => {
|
|
this.$refs.comMessage.showMessage(message, res => {
|
|
if (res) {
|
|
this.scanPopupGetFocus()
|
|
}
|
|
});
|
|
})
|
|
},
|
|
|
|
showErrorMessage(message) {
|
|
if (this.$refs.scanPopup) {
|
|
this.$refs.scanPopup.losefocus();
|
|
}
|
|
setTimeout(r => {
|
|
this.$refs.comMessage.showErrorMessage(message, res => {
|
|
if (res) {
|
|
this.scanPopupGetFocus()
|
|
}
|
|
});
|
|
})
|
|
},
|
|
|
|
openScanPopup() {
|
|
// 第一个参数是库位查精度,第二个参数是判断是否走包装信息接口
|
|
this.$refs.scanPopup.openScanPopup(this.jobToLocationCode,true);
|
|
},
|
|
|
|
closeScanPopup() {
|
|
this.$refs.scanPopup.closeScanPopup();
|
|
},
|
|
|
|
scanPopupGetFocus() {
|
|
if (this.$refs.scanPopup != undefined) {
|
|
this.$refs.scanPopup.getfocus();
|
|
}
|
|
},
|
|
|
|
showCommitSuccessMessage(hint) {
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => {
|
|
navigateBack(1)
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
page {
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.page-wraper {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
|
|
.page-main {
|
|
flex: 1;
|
|
position: relative;
|
|
}
|
|
|
|
.page-main-scroll {
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
}
|
|
|
|
.page-main-list {
|
|
/* height: 80rpx;
|
|
line-height: 80rpx; */
|
|
text-align: center;
|
|
background: #e0e0e0;
|
|
|
|
}
|
|
</style>
|