|
|
@ -1,23 +1,24 @@ |
|
|
|
<template> |
|
|
|
<view class="page-wraper"> |
|
|
|
<view class=""> |
|
|
|
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view> |
|
|
|
<com-blank-view @goScan='showContainerPopup' v-if="containerCode==''"></com-blank-view> |
|
|
|
</view> |
|
|
|
<view class="page-wraper" v-if="detailSource.length>0"> |
|
|
|
<view class="page-header"> |
|
|
|
<view class="header_item"> |
|
|
|
来源库位:{{fromLocationCode}} |
|
|
|
</view> |
|
|
|
<u-line color="#D8D8D8" style="margin-bottom: 15rpx;margin-top: 10rpx;"></u-line> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="page-wraper" v-if="containerCode!=''"> |
|
|
|
<view class="" style="margin-left: 20rpx;"> |
|
|
|
<targetContainer ref="targetContainer" title="托盘" :containerCode="containerCode" :isShowEdit="false" |
|
|
|
@getContainer="getContainer"></targetContainer> |
|
|
|
</view> |
|
|
|
<u-line color="#D8D8D8"></u-line> |
|
|
|
<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=""> |
|
|
|
<record-com-detail-card :dataContent="item" :isShowLocation="false" |
|
|
|
<!-- {{item.contentNumber}} --> |
|
|
|
<comPalletRecord :dataContent="item" :index="index" :isShowPatch="false" |
|
|
|
@removeItem="removeItem(index,item)" @updateData="updateData" @removePack="removePack"> |
|
|
|
</record-com-detail-card> |
|
|
|
</comPalletRecord> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</scroll-view> |
|
|
@ -27,33 +28,29 @@ |
|
|
|
<view class="uni-flex u-col-center space-between padding_10" |
|
|
|
style="background-color:ghostwhite; width: 100%; "> |
|
|
|
<view class=""> |
|
|
|
<targetContainer ref="scanContainer" title="器具" :containerCode="containerCode" |
|
|
|
@getContainer="getContainer"> |
|
|
|
</targetContainer> |
|
|
|
</view> |
|
|
|
<view class=" uni-flex uni-row"> |
|
|
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<win-scan-button @goScan='showScanPackagePopup'></win-scan-button> |
|
|
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|
|
|
</view> |
|
|
|
<win-scan-location ref="scanLocationPopup" title="库位" @getLocation="getFromLocation" |
|
|
|
:locationTypeList="fromlocationTypeList"></win-scan-location> |
|
|
|
<win-scan-container ref="scanContainer" title="器具" @getContainer='getContainer'></win-scan-container> |
|
|
|
<win-scan-location ref="scanLocationPopup" title="来源库位" @getLocation="getFromLocation"></win-scan-location> |
|
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation="false"> |
|
|
|
</win-scan-pack-and-location> |
|
|
|
<!-- <win-scan-pack ref="scanPopup" @getResult='getScanResult'></win-scan-pack> --> |
|
|
|
<com-message ref="comMessage"></com-message> |
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
import { |
|
|
|
containerBindRecordSubmit |
|
|
|
containerBindRecordSubmit, |
|
|
|
getContainerDetailByNumber |
|
|
|
} from '@/api/request2.js'; |
|
|
|
import { |
|
|
|
goHome, |
|
|
|
goHome |
|
|
|
} from '@/common/basic.js'; |
|
|
|
|
|
|
|
import { |
|
|
@ -67,59 +64,55 @@ |
|
|
|
calcHandleQty |
|
|
|
} from '@/common/record.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getScanCount |
|
|
|
} from '@/common/detail.js'; |
|
|
|
|
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|
|
|
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' |
|
|
|
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
|
|
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|
|
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
|
import targetContainer from "@/mycomponents/container/targetContainer.vue" |
|
|
|
import winScanContainer from "@/mycomponents/scan/winScanContainer.vue" |
|
|
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|
|
|
|
|
|
|
|
|
|
|
import comPalletRecord from '@/pages/container/coms/comPalletRecord.vue' |
|
|
|
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
|
|
|
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
winScanButton, |
|
|
|
winScanPack, |
|
|
|
winScanLocation, |
|
|
|
winScanPackAndLocation, |
|
|
|
recordComDetailCard, |
|
|
|
requiredLocation, |
|
|
|
comBlankView, |
|
|
|
comMessage, |
|
|
|
targetContainer, |
|
|
|
recordComDetailCard, |
|
|
|
winScanContainer, |
|
|
|
comPalletRecord, |
|
|
|
winScanPackAndLocation, |
|
|
|
winScanLocation |
|
|
|
}, |
|
|
|
|
|
|
|
data() { |
|
|
|
return { |
|
|
|
id: '', |
|
|
|
settingParam: {}, |
|
|
|
jobContent: {}, //任务内容 |
|
|
|
subList: [], //接口返回的任务subList |
|
|
|
scanCount: 0, |
|
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
|
locationTypeList: [], |
|
|
|
toLocationInfo: {}, |
|
|
|
fromLocationInfo: {}, |
|
|
|
toLocationInfo: {}, |
|
|
|
containerCode: "", |
|
|
|
businessType: {}, |
|
|
|
fromlocationCode: '', |
|
|
|
containerInfo: {}, |
|
|
|
fromlocationTypeList: [], |
|
|
|
tolocationTypeList: [] |
|
|
|
tolocationTypeList: [], |
|
|
|
allowModifyLocation: false, |
|
|
|
inInventoryStatus: "", //目标入库库存状态 |
|
|
|
outInventoryStatus: "", //来源出库库存状态 |
|
|
|
businessType: {} |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
|
onLoad(option) { |
|
|
|
var typeCode = "ContainerBind" |
|
|
|
getBusinessType(typeCode, res => { |
|
|
|
if (res.success) { |
|
|
|
this.businessType = res.businessType; |
|
|
|
this.fromlocationTypeList = res.fromlocationTypeList; |
|
|
|
this.tolocationTypeList = res.tolocationTypeList; |
|
|
|
this.showFromLocationPopup(); |
|
|
|
} else { |
|
|
|
this.showErrorMessage(res.message) |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
//返回首页 |
|
|
|
onNavigationBarButtonTap(e) { |
|
|
|
if (e.index === 0) { |
|
|
@ -132,111 +125,115 @@ |
|
|
|
onPullDownRefresh() {}, |
|
|
|
|
|
|
|
mounted() { |
|
|
|
|
|
|
|
getBusinessType('ContainerBind', res => { |
|
|
|
if (res.success) { |
|
|
|
this.businessType = res.businessType; |
|
|
|
this.fromlocationTypeList = res.fromlocationTypeList; |
|
|
|
this.tolocationTypeList = res.tolocationTypeList; |
|
|
|
this.showContainerPopup(); |
|
|
|
} else { |
|
|
|
this.showErrorMessage(res.message) |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
showFromLocationPopup() { |
|
|
|
this.$nextTick(r => { |
|
|
|
this.$refs.scanLocationPopup.openScanPopup(); |
|
|
|
getContainer(containerInfo) { |
|
|
|
this.containerInfo = containerInfo; |
|
|
|
this.containerCode = containerInfo.number; |
|
|
|
getContainerDetailByNumber(this.containerCode).then(res => { |
|
|
|
if (res.data != null && res.data.subList.length > 0) { |
|
|
|
this.detailSource = this.getDataSource(res.data.subList) |
|
|
|
} |
|
|
|
this.showScanLocation(); |
|
|
|
}).catch(error => { |
|
|
|
this.showErrorMessage(error.message) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
closeScanPopup() { |
|
|
|
this.$refs.scanPopup.closeScanPopup(); |
|
|
|
}, |
|
|
|
|
|
|
|
getFromLocation(location) { |
|
|
|
if (location != null) { |
|
|
|
this.fromLocationCode = location.code; |
|
|
|
this.showScanPackagePopup(); |
|
|
|
} |
|
|
|
showScanLocation() { |
|
|
|
this.$nextTick(r => { |
|
|
|
this.$refs.scanLocationPopup.openScanPopup(); |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
showScanPackagePopup() { |
|
|
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType) |
|
|
|
getFromLocation(location, code) { |
|
|
|
this.fromLocationInfo = location; |
|
|
|
this.openScanPopup(); |
|
|
|
}, |
|
|
|
|
|
|
|
getScanResult(result) { |
|
|
|
let balance = result.balance; |
|
|
|
let label = result.label; |
|
|
|
let pack = result.package; |
|
|
|
|
|
|
|
var item = this.detailSource.find(res => { |
|
|
|
if (res.itemCode == balance.itemCode) { |
|
|
|
return res |
|
|
|
} |
|
|
|
}) |
|
|
|
if (item == undefined) { |
|
|
|
var itemInfo = createItemInfo(balance, pack); |
|
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
|
itemInfo.subList.push(newDetail); |
|
|
|
this.detailSource.push(itemInfo) |
|
|
|
} else { |
|
|
|
var detail = item.subList.find(r => { |
|
|
|
if (r.packingNumber == balance.packingNumber && |
|
|
|
r.batch == balance.batch && |
|
|
|
r.locationCode == balance.locationCode && |
|
|
|
r.inventoryStatus == balance.inventoryStatus && |
|
|
|
r.scaned == true) { |
|
|
|
return r; |
|
|
|
try { |
|
|
|
var packingNumber = result.label.packingNumber; |
|
|
|
var batch = result.label.batch; |
|
|
|
var qty = result.label.qty; |
|
|
|
var itemCode = result.label.itemCode; |
|
|
|
|
|
|
|
var item = this.detailSource.find(r => r.itemCode == itemCode); |
|
|
|
if (item == undefined) { |
|
|
|
if (this.detailSource.length == 0) { |
|
|
|
item = this.createItemInfo(result.label); |
|
|
|
let itemDetail = result.balance; |
|
|
|
itemDetail.scaned = true; |
|
|
|
item.subList.push(itemDetail); |
|
|
|
this.detailSource.push(item); |
|
|
|
} else { |
|
|
|
this.showMessage("绑定物料【" + itemCode + "】与现有物料不一致,不可以绑定"); |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
if (detail == undefined) { |
|
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
|
item.subList.push(newDetail); |
|
|
|
} else { |
|
|
|
this.showErrorMessage('箱码[' + balance.packingNumber + "]已经在列表中") |
|
|
|
var itemDetail = item.subList.find(r => r.packingNumber == packingNumber && r.batch == batch); |
|
|
|
if (itemDetail == undefined) { |
|
|
|
itemDetail = result.balance; |
|
|
|
itemDetail.scaned = true; |
|
|
|
item.subList.push(itemDetail); |
|
|
|
} else { |
|
|
|
if (itemDetail.scaned) { |
|
|
|
this.showMessage("箱码【" + packingNumber + "】,批次【" + batch + "】已经扫描") |
|
|
|
} else { |
|
|
|
this.showMessage("箱码【" + packingNumber + "】,批次【" + batch + "】已经绑定到器具") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
this.showErrorMessage(e.message) |
|
|
|
} |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
// var packingNumber = result.label.packingNumber; |
|
|
|
// var batch = result.label.batch; |
|
|
|
// var qty = result.label.qty; |
|
|
|
// var itemCode = result.label.itemCode; |
|
|
|
// var pack = result.package; |
|
|
|
// var item = this.detailSource.find(res => { |
|
|
|
// if (res.itemCode == itemCode) { |
|
|
|
// return res |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// if (item == undefined) { |
|
|
|
// var itemp = createItemInfo(result.label, pack); |
|
|
|
// let newDetail = createDetailInfo(result.label, pack); // |
|
|
|
// itemp.subList.push(newDetail); |
|
|
|
// this.detailSource.push(itemp) |
|
|
|
// } else { |
|
|
|
// var detail = item.subList.find(r => { |
|
|
|
// if (r.packingNumber == packingNumber) { |
|
|
|
// return r; |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// if (detail == undefined) { |
|
|
|
// let newDetail = createDetailInfo(result.label, pack); |
|
|
|
// item.subList.push(newDetail); |
|
|
|
// } else { |
|
|
|
// if (detail.scaned == true) { |
|
|
|
// this.showErrorMessage("箱码[" + packingNumber + "批次[" + batch + "]已经在列表中") |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// this.calcHandleQty(); |
|
|
|
// this.scanPopupGetFocus(); |
|
|
|
}, |
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
if (res) { |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
createRecordInfo(detail, label) { |
|
|
|
var record = {} |
|
|
|
detail.scaned = true; |
|
|
|
// let record = JSON.parse(JSON.stringify(detail)); |
|
|
|
//克隆对象,深度克隆,防止双向绑定同一个变量 |
|
|
|
Object.assign(record, detail) |
|
|
|
record.qty = Number(label.qty); |
|
|
|
return record; |
|
|
|
}, |
|
|
|
|
|
|
|
calcHandleQty() { |
|
|
|
calcHandleQty(this.detailSource) |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
this.$forceUpdate(); |
|
|
|
}, |
|
|
|
|
|
|
|
getDataSource(subList) { |
|
|
|
let items = []; |
|
|
|
subList.forEach(detail => { |
|
|
|
var item = items.find(r => |
|
|
|
r.itemCode == detail.itemCode) |
|
|
|
if (item == undefined) { |
|
|
|
item = this.createItemInfo(detail); |
|
|
|
let newDetail = this.createDetailInfo(detail); // |
|
|
|
item.subList.push(newDetail); |
|
|
|
items.push(item) |
|
|
|
} else { |
|
|
|
item.qty += detail.qty |
|
|
|
let newDetail = this.createDetailInfo(detail); // |
|
|
|
item.subList.push(newDetail); |
|
|
|
} |
|
|
|
}) |
|
|
|
return items; |
|
|
|
}, |
|
|
|
|
|
|
|
updateData() { |
|
|
|
this.calcHandleQty(); |
|
|
|
}, |
|
|
@ -245,6 +242,28 @@ |
|
|
|
this.detailSource.splice(index, 1) |
|
|
|
}, |
|
|
|
|
|
|
|
createItemInfo(res) { |
|
|
|
let item = { |
|
|
|
itemCode: res.itemCode, |
|
|
|
itemName: res.itemName, |
|
|
|
stdPackQty: res.stdPackQty, |
|
|
|
stdPackUnit: res.stdPackUnit, |
|
|
|
qty: res.qty, |
|
|
|
handleQty: 0, |
|
|
|
uom: res.uom, |
|
|
|
subList: [] |
|
|
|
} |
|
|
|
return item; |
|
|
|
}, |
|
|
|
|
|
|
|
createDetailInfo(data) { |
|
|
|
data.scaned = false; |
|
|
|
data.packingNumber = data.contentNumber |
|
|
|
data.qty = Number(data.qty) |
|
|
|
let detail = data; |
|
|
|
return detail; |
|
|
|
}, |
|
|
|
|
|
|
|
removePack() { |
|
|
|
for (var i = 0; i < this.detailSource.length; i++) { |
|
|
|
var item = this.detailSource[i]; |
|
|
@ -255,25 +274,63 @@ |
|
|
|
this.updateData(); |
|
|
|
}, |
|
|
|
|
|
|
|
openScanPopup() { |
|
|
|
if (this.fromLocationInfo.code != undefined) { |
|
|
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationInfo.code, this.businessType); |
|
|
|
} else { |
|
|
|
this.showScanLocation(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
showContainerPopup() { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.scanContainer.openScanPopup(); |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
closeScanPopup() { |
|
|
|
this.$refs.scanPopup.closeScanPopup(); |
|
|
|
}, |
|
|
|
|
|
|
|
scanPopupGetFocus() { |
|
|
|
this.$refs.scanPopup.packGetFocus(); |
|
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
|
this.$refs.scanPopup.packGetFocus(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
scanPopupLoseFocus() { |
|
|
|
this.$refs.scanPopup.packLoseFocus(); |
|
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
|
this.$refs.scanPopup.packLoseFocus(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
commit() { |
|
|
|
if (this.containerCode == "") { |
|
|
|
this.showMessage("请先选择托码") |
|
|
|
return; |
|
|
|
} |
|
|
|
uni.showLoading({ |
|
|
|
title: '提交中...', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
|
|
|
|
if (this.detailSource.length == 0) { |
|
|
|
this.scanCount = getScanCount(this.detailSource[0].subList); |
|
|
|
if (this.scanCount == 0) { |
|
|
|
this.showErrorMessage("扫描数为0,请先扫描要解绑的箱码") |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
let params = this.getParams(); |
|
|
|
console.log("提交" + JSON.stringify(params)) |
|
|
|
|
|
|
|
containerBindRecordSubmit(params).then(res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data) { |
|
|
|
this.showCommitSuccessMessage("提交成功<br>生成器具绑定记录<br>" + res.data) |
|
|
|
this.clear(); |
|
|
|
} else { |
|
|
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
getParams() { |
|
|
@ -281,8 +338,9 @@ |
|
|
|
var creator = this.$store.state.user.id |
|
|
|
let params = { |
|
|
|
number: this.containerCode, |
|
|
|
type: 'bind', |
|
|
|
status: 'USED', |
|
|
|
toLocationCode: this.fromLocationInfo.code, |
|
|
|
containerType: this.containerInfo.type, |
|
|
|
creator: creator |
|
|
|
}; |
|
|
|
|
|
|
@ -291,11 +349,6 @@ |
|
|
|
if (detail.scaned) { |
|
|
|
detail.containerContentType = 'PACKAGE'; |
|
|
|
detail.contentNumber = detail.packingNumber; |
|
|
|
|
|
|
|
detail.itemCode = detail.itemCode; |
|
|
|
detail.batch = detail.batch; |
|
|
|
detail.inventoryStatus = detail.inventoryStatus; |
|
|
|
|
|
|
|
detail.package = null; |
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
@ -328,13 +381,22 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
getContainer(containerInfo) { |
|
|
|
this.containerCode = containerInfo.number; |
|
|
|
showScanMessage(message) { |
|
|
|
this.$refs.comMessage.showScanMessage(message); |
|
|
|
}, |
|
|
|
|
|
|
|
afterCloseMessage() { |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
}, |
|
|
|
|
|
|
|
closeScanMessage() { |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showCommitSuccessMessage(hint) { |
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
|
this.fromLocationCode = ''; |
|
|
|
this.containerCode = ''; |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
@ -353,38 +415,5 @@ |
|
|
|
</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> |
|
|
|