lijuncheng
4 months ago
5 changed files with 630 additions and 0 deletions
@ -0,0 +1,124 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<uni-popup ref="popup" @change="change" :mask-click="false"> |
||||
|
<view class="popup_box"> |
||||
|
<view class="pop_title uni-flex space-between"> |
||||
|
<view class="" style="font-size: 35rpx;"> |
||||
|
扫描{{title}} |
||||
|
</view> |
||||
|
|
||||
|
<view class=""> |
||||
|
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" |
||||
|
@click="closeScanPopup()"></image> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
<view class=""> |
||||
|
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" :headerType="headerType" |
||||
|
:isShowHistory="isShowHistory" :clearResult="true"></win-com-scan> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
<!-- 模拟扫描功能 --> |
||||
|
<win-com-scan v-show="false" ref="comscansimulate" @getResult="getScanResult" :headerType="headerType" :isShowHistory="false" :clearResult="true"></win-com-scan> |
||||
|
<comMessage ref="comMessage" @afterClose="getfocus"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: 'winScanPack', |
||||
|
components: { |
||||
|
winComScan, |
||||
|
}, |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '箱标签' |
||||
|
}, |
||||
|
isShowHistory: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
headerType:{ |
||||
|
type: String, |
||||
|
default: 'HPQ' |
||||
|
} |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
show: false, |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
simulateScan(item){ |
||||
|
this.$refs.comscansimulate.setItemCodeSimulate(item.copyContent) |
||||
|
this.$refs.comscansimulate.clickScanMsg(); |
||||
|
}, |
||||
|
openScanPopup() { |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 200) |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.$refs.popup.close(); |
||||
|
this.$emit("close", ''); |
||||
|
}, |
||||
|
|
||||
|
scanClick() { |
||||
|
if(this.$refs.comscan){ |
||||
|
this.$refs.comscan.clickScanMsg(); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
cancelClick() { |
||||
|
if(this.$refs.comscan){ |
||||
|
this.$refs.comscan.clearScanValue(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getScanResult(result) { |
||||
|
if (result.success) { |
||||
|
this.$emit("getResult", result); |
||||
|
} else { |
||||
|
this.showMessage(result.message) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getfocus() { |
||||
|
if (this.$refs.comscan != undefined) { |
||||
|
this.$refs.comscan.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
losefocus() { |
||||
|
if (this.$refs.comscan != undefined) { |
||||
|
this.$refs.comscan.losefocus(); |
||||
|
} |
||||
|
}, |
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message); |
||||
|
}, |
||||
|
change(e) { |
||||
|
this.show = e.show |
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.scroll-view { |
||||
|
overflow-y: scroll; |
||||
|
height: auto; |
||||
|
max-height: 300rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,8 @@ |
|||||
|
<template> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,8 @@ |
|||||
|
<template> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,469 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
|
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='openScanPopup' v-if="detailSource.length==0"></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 /> |
||||
|
</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=""> |
||||
|
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" |
||||
|
:isShowFromLocation="false" @removeItem="removeItem(index,item)" |
||||
|
@updateData="updateData" @removePack="removePack"> |
||||
|
</record-com-detail-card> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
<!-- <requiredLocation v-if="showToLoaction" title="目标库位" :locationCode="toLocationCode" |
||||
|
@getLocation='getToLocationCode' :locationTypeList="tolocationTypeList"></requiredLocation> --> |
||||
|
</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='openScanPopup'></win-scan-button> |
||||
|
</view> |
||||
|
<win-scan-pack ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false'> |
||||
|
</win-scan-pack> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<!-- <win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation' |
||||
|
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> --> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
putawayRecordSubmit, |
||||
|
validateItemAndLocation, |
||||
|
getPutawayRecommendLocation |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle, |
||||
|
getCurrDateTime, |
||||
|
getPackingNumberAndBatchByList, |
||||
|
deepCopyData |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
getInventoryStatusDesc, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
createItemInfo, |
||||
|
createDetailInfo, |
||||
|
calcHandleQty |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
getManagementPrecisions, |
||||
|
getPrecisionStrategyList, |
||||
|
getPrecisionStrategyParams |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
// import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
||||
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
// requiredLocation, |
||||
|
comBlankView, |
||||
|
winScanLocation, |
||||
|
recordComDetailCard |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
dataContent: {}, //内容 |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
fromLocationInfo: {}, |
||||
|
fromLocationCode: "", |
||||
|
fromLocationAreaTypeList: [], |
||||
|
toLocationAreaTypeList: [], |
||||
|
inInventoryStatus: "", //目标入库库存状态 |
||||
|
outInventoryStatus: "", //来源出库库存状态 |
||||
|
businessType: {}, |
||||
|
showToLoaction: true, |
||||
|
recommendLocationList: [], //推荐库位列表 |
||||
|
fromWarehouseCode: '', //来源仓库 |
||||
|
businessTypeCode: "PurchasePutaway" |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
this.clear(); |
||||
|
getBusinessType(this.businessTypeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; |
||||
|
this.toLocationAreaTypeList = res.toLocationAreaTypeList; |
||||
|
this.openScanPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
|
||||
|
methods: { |
||||
|
getScanResult(result) { |
||||
|
let balance = result.balance; |
||||
|
let label = result.label; |
||||
|
let pack = result.package; |
||||
|
let poLine =label.poLine; |
||||
|
let poNumber =label.poNumber; |
||||
|
let supplierCode=label.supplierCode; |
||||
|
var item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == balance.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
if (this.fromWarehouseCode == '') { |
||||
|
this.fromWarehouseCode = balance.warehouseCode; |
||||
|
} |
||||
|
if (item == undefined) { |
||||
|
// 获取推荐库位 |
||||
|
this.getRecommendLocation(balance, pack, toLocation => { |
||||
|
var itemp = createItemInfo(balance, pack); |
||||
|
let newDetail = createDetailInfo(balance, pack); // |
||||
|
newDetail.toLocationCode = toLocation.locationCode; |
||||
|
newDetail.toWarehouseCode = toLocation.toWarehouseCode; |
||||
|
newDetail.poLine=poLine; |
||||
|
newDetail.poNumber=poNumber; |
||||
|
newDetail.supplierCode=supplierCode; |
||||
|
newDetail.fromInventoryStatus = balance.inventoryStatus; |
||||
|
|
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
calcHandleQty(this.detailSource); |
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == balance.packingNumber && |
||||
|
r.batch == balance.batch && |
||||
|
r.locationCode == balance.locationCode && |
||||
|
r.inventoryStatus == balance.inventoryStatus) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
if (detail == undefined) { |
||||
|
this.getRecommendLocation(balance, pack, toLocation => { |
||||
|
let newDetail = createDetailInfo(balance, pack); |
||||
|
newDetail.toLocationCode = toLocation.locationCode; |
||||
|
newDetail.toWarehouseCode = toLocation.toWarehouseCode; |
||||
|
newDetail.poLine=poLine; |
||||
|
newDetail.poNumber=poNumber; |
||||
|
newDetail.supplierCode=supplierCode; |
||||
|
newDetail.fromInventoryStatus = balance.inventoryStatus; |
||||
|
|
||||
|
item.subList.push(newDetail); |
||||
|
calcHandleQty(this.detailSource); |
||||
|
}); |
||||
|
} else { |
||||
|
if (detail.scaned == true) { |
||||
|
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
//获取推荐库位 |
||||
|
getRecommendLocation(balance, pack, callback) { |
||||
|
uni.showLoading({ |
||||
|
title: '扫描中...', |
||||
|
mask: true |
||||
|
}) |
||||
|
let recommend = this.recommendLocationList.find(r => r.itemCode == balance.itemCode); |
||||
|
if (recommend == undefined) { |
||||
|
let param = { |
||||
|
itemCode: balance.itemCode, |
||||
|
batch: balance.batch, |
||||
|
inventoryStatus: balance.inventoryStatus, |
||||
|
supplierCode: pack.supplierCode, |
||||
|
businessCode: this.businessTypeCode |
||||
|
}; |
||||
|
console.log(JSON.stringify(param)) |
||||
|
getPutawayRecommendLocation(param).then(res => { |
||||
|
this.recommendLocationList.push({ |
||||
|
itemCode: balance.itemCode, |
||||
|
locationCode: res.data.code, |
||||
|
toWarehouseCode:res.data.toWarehouseCode |
||||
|
}) |
||||
|
|
||||
|
var result = { |
||||
|
locationCode: res.data.code, |
||||
|
toWarehouseCode:res.data.toWarehouseCode |
||||
|
} |
||||
|
callback(result); |
||||
|
uni.hideLoading(); |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error); |
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
callback(recommend); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) {} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
updateData() { |
||||
|
calcHandleQty(this.detailSource); |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
let item = this.detailSource[i]; |
||||
|
if (item.qty == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
this.$forceUpdate(); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
removePack() { |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
var item = this.detailSource[i]; |
||||
|
if (item.subList.length == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
this.$refs.scanPopup.openScanPopup(this.businessType); |
||||
|
}, |
||||
|
|
||||
|
showFromLocationPopup() { |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.scanLocationCode.openScanPopup(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// scanLocationCode(location, code) { |
||||
|
// this.toLocationCode = code |
||||
|
// this.toLocationCode = location; |
||||
|
|
||||
|
// }, |
||||
|
|
||||
|
commit() { |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
//记录有目标库位,需要查询管理模式 |
||||
|
let precisionStrategyParams = getPrecisionStrategyParams(this.detailSource); |
||||
|
//2:获取管理模式,封装参数 |
||||
|
getPrecisionStrategyList(precisionStrategyParams, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
var params = this.setRecordParams() |
||||
|
console.log("提交参数", JSON.stringify(params)); |
||||
|
|
||||
|
putawayRecordSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功<br>生成采购上架记录<br>" + res.data, ) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
getItemAndLocationRelations() { |
||||
|
var itemList = [] |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
detail.toLocationCode = this.toLocationCode; |
||||
|
var filterResult = itemList.filter(res => { |
||||
|
if (res.itemCode == item.itemCode && |
||||
|
res.locationCode == detail.toLocationCode && |
||||
|
res.batch == detail.batch && |
||||
|
res.inventoryStatus == detail.inventoryStatus) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素 |
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode, |
||||
|
batch: detail.batch, |
||||
|
inventoryStatus: detail.inventoryStatus, |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
}, |
||||
|
|
||||
|
setRecordParams() { |
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, |
||||
|
detail.packingNumber, detail.toLocationCode, detail.batch); |
||||
|
var submitItem = deepCopyData(detail) |
||||
|
submitItem.toPackingNumber = info.packingNumber; |
||||
|
submitItem.toBatch = info.batch; |
||||
|
submitItem.toContainerNumber = detail.containerNumber; |
||||
|
|
||||
|
submitItem.fromPackingNumber = info.packingNumber; |
||||
|
submitItem.fromBatch = info.batch; |
||||
|
submitItem.fromContainerNumber = detail.containerNumber; |
||||
|
|
||||
|
submitItem.fromLocationCode = detail.locationCode; |
||||
|
submitItem.toLocationCode = detail.toLocationCode; |
||||
|
|
||||
|
// detail.toInventoryStatus = detail.inventoryStatus |
||||
|
// detail.toLocationCode = detail.toLocationCode |
||||
|
submitItem.qty = detail.handleQty; |
||||
|
submitItem.package = ""; |
||||
|
subList.push(submitItem) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
if (subList.length > 0) { |
||||
|
this.dataContent.toWarehouseCode = subList[0].toWarehouseCode; |
||||
|
} |
||||
|
this.dataContent.subList = subList |
||||
|
this.dataContent.creator = creator; |
||||
|
this.dataContent.fromWarehouseCode = this.fromWarehouseCode; |
||||
|
return this.dataContent; |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) {} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
getLocation(location, code) { |
||||
|
this.getFromLocationCode(location, code) |
||||
|
}, |
||||
|
getFromLocationCode(location, code) { |
||||
|
this.fromLocationInfo = location; |
||||
|
this.fromLocationCode = code; |
||||
|
this.openScanPopup(); |
||||
|
}, |
||||
|
getToLocationCode(location, code) { |
||||
|
if (this.fromLocationCode == code) { |
||||
|
uni.showToast({ |
||||
|
title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致", |
||||
|
duration: 2000 |
||||
|
}) |
||||
|
return |
||||
|
} |
||||
|
this.toLocationCode = code; |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clear(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
clear() { |
||||
|
this.fromLocationInfo = {}; |
||||
|
this.fromLocationCode = ''; |
||||
|
this.fromWarehouseCode = ''; |
||||
|
this.toWarehouseCode = ''; |
||||
|
this.detailSource = []; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
Loading…
Reference in new issue