|
|
@ -1,6 +1,5 @@ |
|
|
|
<template> |
|
|
|
<view class="page-wraper" style="background-color: #fff;"> |
|
|
|
|
|
|
|
<view class="header"> |
|
|
|
<view class=""> |
|
|
|
<com-blank-view @goScan='openFg' v-if="!dataContent"></com-blank-view> |
|
|
@ -13,23 +12,19 @@ |
|
|
|
<view class="text_lightblue">完工库位</view> |
|
|
|
<view style="font-size: 30rpx; margin-top: 13rpx;">{{dataContent.fgLocationCode}} |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
<view class="cell_info"> |
|
|
|
<view class="text_lightblue">报工数量</view> |
|
|
|
<view>{{dataContent.planQty}}{{dataContent.uom}}</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="cell_info"> |
|
|
|
<view class="text_lightblue">已报工数量</view> |
|
|
|
<view>{{scanedQty}}{{dataContent.uom}}</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class='split_line'></view> |
|
|
|
|
|
|
|
<view class="" style="padding: 10rpx;margin-left: 10rpx;"> |
|
|
|
<item :dataContent="dataContent"></item> |
|
|
|
</view> |
|
|
@ -50,35 +45,30 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view style="margin-top: 350rpx; padding-bottom: 160rpx;" v-if="dataContent"> |
|
|
|
<scroll-view scroll-y="true" class=""> |
|
|
|
<view class="scan_view" v-for="(item, index) in showList" :key="index"> |
|
|
|
<uni-swipe-action> |
|
|
|
<uni-swipe-action-item :right-options="options" @click="swipeClick($event,item,index)"> |
|
|
|
<view class="uni-flex uni-row " |
|
|
|
style="margin-left: 30rpx; margin-top: 10rpx; margin-bottom: 10rpx;"> |
|
|
|
<light :lightCode='item.content'></light> |
|
|
|
<!-- <view class="auto-wrap" style="font-size: 35rpx;font-weight: bold; width: 100%;"> |
|
|
|
<text style="font-size: 30rpx;color: #B66463;">唯一码 </text> |
|
|
|
{{item.content}} |
|
|
|
</view> --> |
|
|
|
</view> |
|
|
|
</uni-swipe-action-item> |
|
|
|
</uni-swipe-action> |
|
|
|
<u-swipe-action :options="options" @click="(...event)=>swipeClick(event,item,index)"> |
|
|
|
<<view class="uni-flex uni-row " |
|
|
|
style="margin-left: 30rpx; margin-top: 10rpx; margin-bottom: 10rpx;"> |
|
|
|
<light :lightCode='item.content'></light> |
|
|
|
<!-- <view class="auto-wrap" style="font-size: 35rpx;font-weight: bold; width: 100%;"> |
|
|
|
<text style="font-size: 30rpx;color: #B66463;">唯一码 </text> |
|
|
|
{{item.content}} |
|
|
|
</view> --> |
|
|
|
</view> |
|
|
|
</u-swipe-action> |
|
|
|
<u-line color="#D8D8D8"></u-line> |
|
|
|
</view> |
|
|
|
|
|
|
|
</scroll-view> |
|
|
|
<uni-load-more :status="loadingType" v-if="showList.length>0" /> |
|
|
|
|
|
|
|
</view> |
|
|
|
<view class="page-footer" v-if="dataContent"> |
|
|
|
<view class="uni-flex u-col-center space-between " style="background-color:ghostwhite; width: 100%; "> |
|
|
|
<view class=""> |
|
|
|
<view class="uni-flex uni-row"> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
<view class=" uni-flex uni-row"> |
|
|
|
<button class="btn_single_clear" hover-class="btn_commit_after" style="margin-right: 50rpx;" |
|
|
@ -94,7 +84,7 @@ |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
<script setup lang="ts"> |
|
|
|
import { |
|
|
|
isCheckMesCode, |
|
|
|
planReceiptSubmit, |
|
|
@ -124,388 +114,335 @@ import winScanFgLabel from "@/mycomponents/scan/winScanFgLabel.vue" |
|
|
|
import comFgCard from "@/pages/productReceipt/coms/comFgCard.vue" |
|
|
|
import light from '@/mycomponents/balance/light.vue' |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
comBlankView, |
|
|
|
comNoReceiptPopup, |
|
|
|
item, |
|
|
|
batch, |
|
|
|
pack, |
|
|
|
winScanButton, |
|
|
|
winScanFgLabel, |
|
|
|
comFgCard, |
|
|
|
light |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
dataContent: null, |
|
|
|
options: [], |
|
|
|
showList: [], |
|
|
|
allList: [], |
|
|
|
index: 1, |
|
|
|
loadingType: "", |
|
|
|
pageSize: 20, |
|
|
|
scanedQty: 0, |
|
|
|
settingPutAwayRequestSwitch:true, |
|
|
|
settingPutAwayInspectSwitch :true |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
onShow() {}, |
|
|
|
|
|
|
|
onLoad() { |
|
|
|
this.options = getRemoveOption() |
|
|
|
this.openFg(); |
|
|
|
}, |
|
|
|
import { ref } from 'vue'; |
|
|
|
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app'; |
|
|
|
|
|
|
|
const dataContent = ref(null); |
|
|
|
const options = ref([]); |
|
|
|
const showList = ref([]); |
|
|
|
const allList = ref([]); |
|
|
|
const index = ref(1); |
|
|
|
const loadingType = ref(""); |
|
|
|
const pageSize = ref(20); |
|
|
|
const scanedQty = ref(0); |
|
|
|
const settingPutAwayRequestSwitch = ref(true); |
|
|
|
const settingPutAwayInspectSwitch = ref(true); |
|
|
|
|
|
|
|
// 模板引用 |
|
|
|
const comNoReceiptPopup = ref(null); |
|
|
|
const comMessage = ref(null); |
|
|
|
const scanPopup = ref(null); |
|
|
|
|
|
|
|
onLoad(() => { |
|
|
|
options.value = getRemoveOption(); |
|
|
|
openFg(); |
|
|
|
}); |
|
|
|
|
|
|
|
onShow(() => {}); |
|
|
|
|
|
|
|
onReachBottom(() => { |
|
|
|
console.log("onReachBottom"); |
|
|
|
if (loadingType.value === 'nomore') { |
|
|
|
return; |
|
|
|
} |
|
|
|
index.value++; |
|
|
|
const list = getDataPage(index.value, pageSize.value); |
|
|
|
if (list.length > 0) { |
|
|
|
showList.value = showList.value.concat(list); |
|
|
|
} else { |
|
|
|
loadingType.value = "nomore"; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
onReachBottom() { |
|
|
|
console.log("onReachBottom") |
|
|
|
//避免多次触发 |
|
|
|
if (this.loadingType == 'nomore') { |
|
|
|
return; |
|
|
|
const openFg = () => { |
|
|
|
setTimeout(() => { |
|
|
|
if (comNoReceiptPopup.value) { |
|
|
|
comNoReceiptPopup.value.openRequestPopup(); |
|
|
|
} |
|
|
|
this.index++; |
|
|
|
var list = this.getDataPage(this.index, this.pageSize) |
|
|
|
if (list.length > 0) { |
|
|
|
// this.showList=list |
|
|
|
this.showList = this.showList.concat(list) |
|
|
|
} else { |
|
|
|
//没有更多了 |
|
|
|
this.loadingType = "nomore"; |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, 600); |
|
|
|
}; |
|
|
|
|
|
|
|
const requestConfirm = (result) => { |
|
|
|
dataContent.value = { |
|
|
|
itemCode: result.itemCode, |
|
|
|
planNumber: result.planNumber, // 计划单号 |
|
|
|
handleQty: 0, |
|
|
|
qty: 0, |
|
|
|
planQty: result.planQty, |
|
|
|
goodQty: result.goodQty, |
|
|
|
noGoodQty: calc.sub(result.planQty, result.goodQty), |
|
|
|
packQtyHint: result.packQtyHint, |
|
|
|
packQty: result.packQty, |
|
|
|
uom: result.uom, |
|
|
|
batch: result.batch, |
|
|
|
packUnit: result.packUnit, |
|
|
|
workStationCode: result.workStationCode, |
|
|
|
fgLocationCode: result.fgLocationCode, |
|
|
|
subList: [], |
|
|
|
productionLine: result.productionLine, |
|
|
|
bomVersion: result.bomVersion, |
|
|
|
workshop: result.workshop, |
|
|
|
team: "", |
|
|
|
shift: "", |
|
|
|
putAwayRequestSwitch: result.putAwayRequestSwitch, |
|
|
|
putAwayInspectSwitch: result.putAwayInspectSwitch |
|
|
|
}; |
|
|
|
settingPutAwayRequestSwitch.value = result.putAwayRequestSwitch; |
|
|
|
settingPutAwayInspectSwitch.value = result.putAwayInspectSwitch; |
|
|
|
}; |
|
|
|
|
|
|
|
const initList = () => { |
|
|
|
index.value = 1; |
|
|
|
showList.value = []; |
|
|
|
loadingType.value = ""; |
|
|
|
showList.value = getDataPage(index.value, pageSize.value); |
|
|
|
}; |
|
|
|
|
|
|
|
const getDataPage = (pageNo, pageSize) => { |
|
|
|
const totalPages = Math.ceil(allList.value.length / pageSize); |
|
|
|
const start = (pageNo - 1) * pageSize; |
|
|
|
const end = start + pageSize; |
|
|
|
return allList.value.slice(start, end); |
|
|
|
}; |
|
|
|
|
|
|
|
const swipeClick = (e, dataContent, index) => { |
|
|
|
if (e.content.text === "移除") { |
|
|
|
comMessage.value.showQuestionMessage("是否要移除", (res) => { |
|
|
|
if (res) { |
|
|
|
showList.value.splice(index, 1); |
|
|
|
calcFgQty(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
mounted() { |
|
|
|
const submit = () => { |
|
|
|
if (showList.value.length === 0) { |
|
|
|
showErrorMessage("请先扫描唯一码"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
openFg() { |
|
|
|
setTimeout(res => { |
|
|
|
if (this.$refs.comNoReceiptPopup) { |
|
|
|
this.$refs.comNoReceiptPopup.openRequestPopup(); |
|
|
|
} |
|
|
|
}, 600) |
|
|
|
}, |
|
|
|
requestConfirm(result) { |
|
|
|
this.dataContent = { |
|
|
|
itemCode: result.itemCode, |
|
|
|
planNumber: result.planNumber, //计划单号 |
|
|
|
handleQty: 0, |
|
|
|
qty: 0, |
|
|
|
planQty: result.planQty, |
|
|
|
goodQty: result.goodQty, |
|
|
|
noGoodQty: calc.sub(result.planQty, result.goodQty), |
|
|
|
packQtyHint: result.packQtyHint, |
|
|
|
packQty: result.packQty, |
|
|
|
uom: result.uom, |
|
|
|
batch: result.batch, |
|
|
|
packUnit: result.packUnit, |
|
|
|
workStationCode: result.workStationCode, |
|
|
|
fgLocationCode: result.fgLocationCode, |
|
|
|
subList: [], |
|
|
|
productionLine: result.productionLine, |
|
|
|
bomVersion: result.bomVersion, |
|
|
|
workshop: result.workshop, |
|
|
|
team: "", |
|
|
|
shift: "", |
|
|
|
putAwayRequestSwitch:result.putAwayRequestSwitch, |
|
|
|
putAwayInspectSwitch:result.putAwayInspectSwitch |
|
|
|
} |
|
|
|
this.settingPutAwayRequestSwitch = result.putAwayRequestSwitch |
|
|
|
this.settingPutAwayInspectSwitch = result.putAwayInspectSwitch |
|
|
|
}, |
|
|
|
|
|
|
|
initList() { |
|
|
|
this.index = 1; |
|
|
|
this.showList = [] |
|
|
|
this.loadingType = ""; |
|
|
|
this.showList = this.getDataPage(this.index, this.pageSize) |
|
|
|
}, |
|
|
|
|
|
|
|
getDataPage(pageNo, pageSize) { |
|
|
|
//计算总页数 |
|
|
|
var totalPages = Math.ceil(this.allList.length / pageSize); |
|
|
|
//当前页起始索引 |
|
|
|
const start = (pageNo - 1) * pageSize; |
|
|
|
const end = start + pageSize; //当前页结束索引 |
|
|
|
return this.allList.slice(start, end) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
swipeClick(e, dataContent, index) { |
|
|
|
if (e.content.text == "移除") { |
|
|
|
this.$refs.comMessage.showQuestionMessage("是否要移除", res => { |
|
|
|
if (res) { |
|
|
|
this.showList.splice(index, 1); |
|
|
|
this.calcFgQty(); |
|
|
|
//this.initList() |
|
|
|
} |
|
|
|
}) |
|
|
|
if (showList.value.length < dataContent.value.packQty) { |
|
|
|
comMessage.value.showQuestionMessage("扫描数量小于包装规格数量,是否提交?", (res) => { |
|
|
|
if (res) { |
|
|
|
commit(); |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
} else { |
|
|
|
commit(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const commit = async () => { |
|
|
|
let list = []; |
|
|
|
try { |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中...", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
const params = setParams(); |
|
|
|
|
|
|
|
const planData = await createByPlanSubmit(params); |
|
|
|
if (planData.data.tb1 && planData.data.tb1.length > 0) { |
|
|
|
planData.data.tb1.forEach((item) => { |
|
|
|
list.push({ |
|
|
|
itemCode: item.itemCode, // 物品代码 |
|
|
|
itemName: item.itemName, // 物品名称 |
|
|
|
packName: item.packName, // 包装名称 |
|
|
|
packageCode: item.toPackingNumber, // 包装号 |
|
|
|
batch: item.toBatch, // 批次 |
|
|
|
parentNumber: item.parentNumber, // 父包装号 |
|
|
|
itemType: item.itemType, // 物料类型 |
|
|
|
asnNumber: item.asnNumber, // ASN |
|
|
|
supplierCode: item.supplierCode, // 供应商 |
|
|
|
qty: item.qty, // 数量 |
|
|
|
printTimes: getCurrDateTime(), // 打印时间 |
|
|
|
productionLineCode: item.productionLineCode, // 生产线 |
|
|
|
barcodeString: item.barcodeString, // 标签信息 |
|
|
|
barcodeBase64: '', |
|
|
|
requestNumber: item.requestNumber |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
throw new Error("提交失败"); |
|
|
|
} |
|
|
|
|
|
|
|
submit() { |
|
|
|
if (this.showList.length == 0) { |
|
|
|
this.showErrorMessage("请先扫描唯一码") |
|
|
|
return; |
|
|
|
} |
|
|
|
let hintMsg = "提交成功\n生成装配收货记录\n"; |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
hintMsg += list[0].requestNumber; |
|
|
|
} |
|
|
|
showCommitSuccessMessage(hintMsg, list); |
|
|
|
scanedQty.value += showList.value.length; |
|
|
|
showList.value = []; |
|
|
|
dataContent.value.handleQty = 0; |
|
|
|
uni.hideLoading(); |
|
|
|
} catch (error) { |
|
|
|
uni.hideLoading(); |
|
|
|
const hint = error.message ? error.message : error; |
|
|
|
showErrorMessage(hint); |
|
|
|
} |
|
|
|
startSetting(list); |
|
|
|
}; |
|
|
|
|
|
|
|
if (this.showList.length < this.dataContent.packQty) { |
|
|
|
this.$refs.comMessage.showQuestionMessage("扫描数量小于包装规格数量,是否提交?", res => { |
|
|
|
if (res) { |
|
|
|
this.commit() |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.commit(); |
|
|
|
} |
|
|
|
const startSetting = async (list) => { |
|
|
|
if (settingPutAwayRequestSwitch.value) { |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
await createPutawayRequestByPlan(list[0].requestNumber); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
async commit() { |
|
|
|
let list = [] |
|
|
|
try { |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中...", |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
|
|
|
|
let params = this.setParams() |
|
|
|
|
|
|
|
var planData = await createByPlanSubmit(params) |
|
|
|
if (planData.data.tb1&&planData.data.tb1.length>0) { |
|
|
|
planData.data.tb1.forEach(item => { |
|
|
|
list.push({ |
|
|
|
itemCode: item.itemCode, // 物品代码 |
|
|
|
itemName: item.itemName, // 物品名称 |
|
|
|
packName: item.packName, // 包装名称 |
|
|
|
packageCode: item.toPackingNumber, // 包装号 |
|
|
|
batch: item.toBatch, //批次 |
|
|
|
parentNumber: item.parentNumber, //父包装号 |
|
|
|
itemType: item.itemType, //物料类型 |
|
|
|
asnNumber: item.asnNumber, //ASN |
|
|
|
supplierCode: item.supplierCode, // 供应商 |
|
|
|
qty: item.qty, // 数量 |
|
|
|
printTimes: getCurrDateTime(), // 打印时间 |
|
|
|
productionLineCode: item.productionLineCode, //生产线 |
|
|
|
barcodeString: item.barcodeString, // 标签信息 |
|
|
|
barcodeBase64: '', |
|
|
|
requestNumber: item.requestNumber |
|
|
|
}) |
|
|
|
}) |
|
|
|
if (settingPutAwayInspectSwitch.value) { |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
await createInspectRequestByPlan(list[0].requestNumber); |
|
|
|
} |
|
|
|
} |
|
|
|
console.log("提交所有完成" + getCurrDateTime()); |
|
|
|
}; |
|
|
|
|
|
|
|
const setParams = () => { |
|
|
|
showList.value.forEach((res) => { |
|
|
|
res.outsideItemCode = res.itemCode; |
|
|
|
res.outsideProduceDate = null; |
|
|
|
res.outsideSerialNumber = res.order; |
|
|
|
}); |
|
|
|
dataContent.value.subList = showList.value; |
|
|
|
return dataContent.value; |
|
|
|
}; |
|
|
|
|
|
|
|
const clear = () => { |
|
|
|
comMessage.value.showQuestionMessage("是否要清空?", (res) => { |
|
|
|
if (res) { |
|
|
|
clearData(); |
|
|
|
openFg(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const clearData = () => { |
|
|
|
dataContent.value = null; |
|
|
|
showList.value = []; |
|
|
|
allList.value = []; |
|
|
|
index.value = 1; |
|
|
|
}; |
|
|
|
|
|
|
|
const openScanPopup = () => { |
|
|
|
const itemCode = dataContent.value.itemCode; |
|
|
|
console.log("物料", itemCode); |
|
|
|
scanPopup.value.openScanPopup(itemCode); |
|
|
|
}; |
|
|
|
|
|
|
|
const getScanResult = (result) => { |
|
|
|
isCheckMesCode(result.content).then((res) => { |
|
|
|
if (res.data) { |
|
|
|
if (dataContent.value) { |
|
|
|
const itemIndex = showList.value.findIndex((r) => r.content === result.content); |
|
|
|
if (itemIndex === -1) { |
|
|
|
result.countTime = new Date(); |
|
|
|
showList.value.push(result); |
|
|
|
showList.value.sort(compare('countTime')); |
|
|
|
calcFgQty(); |
|
|
|
} else { |
|
|
|
throw new Error("提交失败") |
|
|
|
} |
|
|
|
var hintMsg ="提交成功\n生成装配收货记录\n"; |
|
|
|
if(list.length>0&&list[0].requestNumber){ |
|
|
|
hintMsg += list[0].requestNumber |
|
|
|
comMessage.value.showQuestionMessage(`唯一码【${result.content}】已经扫描,是否移除`, (res) => { |
|
|
|
if (res) { |
|
|
|
showList.value.splice(itemIndex, 1); |
|
|
|
showList.value.sort(compare('countTime')); |
|
|
|
calcFgQty(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
this.showCommitSuccessMessage(hintMsg, list) |
|
|
|
this.scanedQty = this.scanedQty + this.showList.length; |
|
|
|
this.showList = []; |
|
|
|
this.dataContent.handleQty = 0; |
|
|
|
this.$forceUpdate(); |
|
|
|
uni.hideLoading() |
|
|
|
} catch (error) { |
|
|
|
uni.hideLoading() |
|
|
|
var hint = error.message ? error.message : error |
|
|
|
this.showErrorMessage(hint) |
|
|
|
} |
|
|
|
this.startSetting(list) |
|
|
|
}, |
|
|
|
|
|
|
|
async startSetting(list){ |
|
|
|
//创建上架申请 |
|
|
|
if (this.settingPutAwayRequestSwitch) { |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
await createPutawayRequestByPlan(list[0].requestNumber) |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch((error) => { |
|
|
|
showErrorMessage(error); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const calcFgQty = () => { |
|
|
|
dataContent.value.handleQty = showList.value.length; |
|
|
|
if (parseFloat(dataContent.value.planQty) - parseFloat(scanedQty.value) <= parseFloat(dataContent.value.packQty)) { |
|
|
|
if (parseFloat(dataContent.value.handleQty) === parseFloat(dataContent.value.planQty) - parseFloat(scanedQty.value)) { |
|
|
|
if (scanPopup.value) { |
|
|
|
scanPopup.value.closeScanPopup(); |
|
|
|
} |
|
|
|
|
|
|
|
//创建检验申请 |
|
|
|
if (this.settingPutAwayInspectSwitch) { |
|
|
|
if (list.length > 0 && list[0].requestNumber) { |
|
|
|
await createInspectRequestByPlan(list[0].requestNumber) |
|
|
|
} |
|
|
|
commit(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (parseFloat(dataContent.value.handleQty) === parseFloat(dataContent.value.packQty)) { |
|
|
|
if (scanPopup.value) { |
|
|
|
scanPopup.value.closeScanPopup(); |
|
|
|
} |
|
|
|
console.log("提交所有完成"+getCurrDateTime()) |
|
|
|
}, |
|
|
|
|
|
|
|
setParams() { |
|
|
|
this.showList.forEach(res => { |
|
|
|
res.outsideItemCode = res.itemCode |
|
|
|
res.outsideProduceDate = null |
|
|
|
res.outsideSerialNumber = res.order |
|
|
|
}) |
|
|
|
this.dataContent.subList = this.showList |
|
|
|
|
|
|
|
return this.dataContent |
|
|
|
}, |
|
|
|
|
|
|
|
clear() { |
|
|
|
this.$refs.comMessage.showQuestionMessage("是否要清空?", res => { |
|
|
|
if (res) { |
|
|
|
this.clearData() |
|
|
|
this.openFg(); |
|
|
|
} |
|
|
|
commit(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
clearData() { |
|
|
|
this.dataContent = null |
|
|
|
this.showList = [] |
|
|
|
this.allList = [] |
|
|
|
this.index = 1; |
|
|
|
}, |
|
|
|
|
|
|
|
openScanPopup() { |
|
|
|
var itemCode = this.dataContent.itemCode |
|
|
|
console.log("物料", itemCode) |
|
|
|
this.$refs.scanPopup.openScanPopup(itemCode); |
|
|
|
}, |
|
|
|
getScanResult(result) { |
|
|
|
let that = this; |
|
|
|
//TODO缺少零件号的对应关系 |
|
|
|
//查询mes码是否完工 |
|
|
|
isCheckMesCode(result.content).then(res => { |
|
|
|
if (res.data) { |
|
|
|
if (that.dataContent) { |
|
|
|
var itemIndex = this.showList.findIndex(r => |
|
|
|
r.content == result.content); |
|
|
|
//不存在 |
|
|
|
if (itemIndex == -1) { |
|
|
|
// if (this.allList.length > this.dataContent.packQty) { |
|
|
|
// this.showErrorMessage("唯一码数量不能大于计划数量") |
|
|
|
// return; |
|
|
|
// } |
|
|
|
result.countTime = new Date(); |
|
|
|
this.showList.push(result); |
|
|
|
this.showList.sort(compare('countTime')); //按扫描信息排序 |
|
|
|
//this.initList() |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
this.calcFgQty(); |
|
|
|
} else { |
|
|
|
this.$refs.comMessage.showQuestionMessage("唯一码【" + result.content + |
|
|
|
'】已经扫描,是否移除', |
|
|
|
res => { |
|
|
|
if (res) { |
|
|
|
this.showList.splice(itemIndex, 1) |
|
|
|
this.showList.sort(compare('countTime')); //按扫描信息排序 |
|
|
|
//this.initList() |
|
|
|
that.calcFgQty(); |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
calcFgQty() { |
|
|
|
this.dataContent.handleQty = this.showList.length; |
|
|
|
if(parseFloat(this.dataContent.planQty) -parseFloat(this.scanedQty) <= parseFloat(this.dataContent.packQty)){ |
|
|
|
if(parseFloat(this.dataContent.handleQty) == parseFloat(this.dataContent.planQty) -parseFloat(this.scanedQty)){ |
|
|
|
if (this.$refs.scanPopup) { |
|
|
|
this.$refs.scanPopup.closeScanPopup(); |
|
|
|
} |
|
|
|
this.commit() |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if (parseFloat(this.dataContent.handleQty) == parseFloat(this.dataContent.packQty)) { |
|
|
|
if (this.$refs.scanPopup) { |
|
|
|
this.$refs.scanPopup.closeScanPopup(); |
|
|
|
} |
|
|
|
this.commit() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
const scanPopupGetFocus = () => { |
|
|
|
if (scanPopup.value) { |
|
|
|
scanPopup.value.getfocus(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
scanPopupGetFocus() { |
|
|
|
if (this.$refs.scanPopup) { |
|
|
|
this.$refs.scanPopup.getfocus(); |
|
|
|
} |
|
|
|
}, |
|
|
|
scanPopupLoseFocus() { |
|
|
|
if (this.$refs.scanPopup) { |
|
|
|
this.$refs.scanPopup.losefocus(); |
|
|
|
} |
|
|
|
}, |
|
|
|
getH5BatchPrintingLable( number) { |
|
|
|
let _this = this |
|
|
|
batchPrintingLable(number).then(resLable => { |
|
|
|
const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712` |
|
|
|
const webData = { |
|
|
|
token: storage.getStorage(storage.constant.token), |
|
|
|
asn_number: resLable.data |
|
|
|
} |
|
|
|
if ( this.scanedQty + this.showList.length == this.dataContent.planQty) { |
|
|
|
uni.redirectTo({ |
|
|
|
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}` |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
uni.navigateTo({ |
|
|
|
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}` |
|
|
|
}); |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
print(pointData){ |
|
|
|
let _this = this |
|
|
|
// #ifdef APP |
|
|
|
if (pointData.length > 0) { |
|
|
|
if (this.scanedQty + this.showList.length == this.dataContent.planQty) { |
|
|
|
uni.redirectTo({ |
|
|
|
url: `/pages/point/index?points=${JSON.stringify(pointData)}` |
|
|
|
}); |
|
|
|
} else { |
|
|
|
uni.navigateTo({ |
|
|
|
url: `/pages/point/index?points=${JSON.stringify(pointData)}` |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
// #endif |
|
|
|
// #ifdef H5 |
|
|
|
let packingNumber = [] |
|
|
|
pointData.forEach(item=>{ |
|
|
|
packingNumber.push(item.packageCode) |
|
|
|
}) |
|
|
|
getBalanceToPackage({ |
|
|
|
packingNumber: packingNumber.join(',') |
|
|
|
}).then(res => { |
|
|
|
console.log('PC打印', res) |
|
|
|
_this.getH5BatchPrintingLable(res.data.number) |
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
_this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
// #endif |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
showCommitSuccessMessage(hint, pointData) { |
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
|
this.print(pointData) |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
if (res) { |
|
|
|
this.scanPopupGetFocus() |
|
|
|
} |
|
|
|
const scanPopupLoseFocus = () => { |
|
|
|
if (scanPopup.value) { |
|
|
|
scanPopup.value.losefocus(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const getH5BatchPrintingLable = (number) => { |
|
|
|
batchPrintingLable(number).then((resLable) => { |
|
|
|
const webUrl = `${import.meta.env.VITE_JMREPORT_BASE_URL}/jmreport/view/922734157577715712`; |
|
|
|
const webData = { |
|
|
|
token: storage.getStorage(storage.constant.token), |
|
|
|
asn_number: resLable.data |
|
|
|
}; |
|
|
|
if (scanedQty.value + showList.value.length === dataContent.value.planQty) { |
|
|
|
uni.redirectTo({ |
|
|
|
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}` |
|
|
|
}); |
|
|
|
} else { |
|
|
|
uni.navigateTo({ |
|
|
|
url: `/pages/pointProductReceipt/webview?url=${webUrl}&webData=${JSON.stringify(webData)}` |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const print = (pointData) => { |
|
|
|
if (pointData.length > 0) { |
|
|
|
if (scanedQty.value + showList.value.length === dataContent.value.planQty) { |
|
|
|
uni.redirectTo({ |
|
|
|
url: `/pages/point/index?points=${JSON.stringify(pointData)}` |
|
|
|
}); |
|
|
|
} else { |
|
|
|
uni.navigateTo({ |
|
|
|
url: `/pages/point/index?points=${JSON.stringify(pointData)}` |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
const packingNumber = pointData.map((item) => item.packageCode).join(','); |
|
|
|
getBalanceToPackage({ packingNumber }).then((res) => { |
|
|
|
console.log('PC打印', res); |
|
|
|
getH5BatchPrintingLable(res.data.number); |
|
|
|
}).catch((error) => { |
|
|
|
showErrorMessage(error); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const showCommitSuccessMessage = (hint, pointData) => { |
|
|
|
comMessage.value.showSuccessMessage(hint, (res) => { |
|
|
|
print(pointData); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const showErrorMessage = (message) => { |
|
|
|
comMessage.value.showErrorMessage(message, (res) => { |
|
|
|
if (res) { |
|
|
|
scanPopupGetFocus(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|