19 changed files with 3011 additions and 731 deletions
@ -0,0 +1,549 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view> |
||||
|
</view> |
||||
|
<view class="page-wraper" v-if="detailSource.length>0"> |
||||
|
|
||||
|
<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="true" @removeItem="removeItem(index,item)" |
||||
|
:isShowToLocation="false" :isShowParentToLocation="false" @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="uni-row uni-flex"> |
||||
|
<text>生产线:</text> |
||||
|
<view class="uni-flex u-col-center uni-row" @click="showSelect"> |
||||
|
<view class="" style="margin-left: 20rpx;"> |
||||
|
{{positionInfo}} |
||||
|
</view> |
||||
|
<u-select v-model="show" mode="mutil-column-auto" :list="positionList" |
||||
|
@confirm="confirmSelect"></u-select> |
||||
|
</view> |
||||
|
</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-location ref="scanFromLocationCode" title="来源库位" @getLocation='getFromLocation' |
||||
|
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
||||
|
|
||||
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :title="'箱码'"> |
||||
|
</win-scan-pack-and-location> |
||||
|
<!-- <winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode"> |
||||
|
</winComScanBalance> --> |
||||
|
<balanceQuery ref="refBalanceQuery" :businessTypeCode="businessTypeCode"></balanceQuery> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
issueRecordSubmit, |
||||
|
getWorkShopLineStation, |
||||
|
getBalanceByFilter |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
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 { |
||||
|
Decimal |
||||
|
} from 'decimal.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 winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
|
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' |
||||
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
||||
|
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' |
||||
|
import balanceQuery from '@/mycomponents/query/balanceQuery.vue' |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
requiredLocation, |
||||
|
comBlankView, |
||||
|
winScanLocation, |
||||
|
winScanPackAndLocation, |
||||
|
recordComDetailCard, |
||||
|
recordDetailCard, |
||||
|
balanceSelect, |
||||
|
winComScanBalance, |
||||
|
balanceQuery |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
dataContent: {}, //内容 |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
fromLocationInfo: {}, |
||||
|
fromLocationCode: "", |
||||
|
fromLocationAreaTypeList: [], |
||||
|
toLocationAreaTypeList: [], |
||||
|
inInventoryStatus: "", //目标入库库存状态 |
||||
|
outInventoryStatus: "", //来源出库库存状态 |
||||
|
businessType: {}, |
||||
|
showToLoaction: true, |
||||
|
recommendLocationList: [], //推荐库位列表 |
||||
|
fromWarehouseCode: '', //来源仓库 |
||||
|
businessTypeCode: "Issue", |
||||
|
positionList: [], |
||||
|
show: false, |
||||
|
positionInfo: "请选择生产线", |
||||
|
resultData: {}, |
||||
|
itemCode: "", |
||||
|
managementType: '' |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: option.title |
||||
|
}) |
||||
|
this.clearData(); |
||||
|
this.getBusinessType() |
||||
|
|
||||
|
// if (this.positionList.length == 0) { |
||||
|
getWorkShopLineStation().then(res => { |
||||
|
if (res.data != null && res.data.length > 0) { |
||||
|
this.positionList = res.data |
||||
|
} else { |
||||
|
this.showErrorMessage('未查找到位置信息'); |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showErrorMessage(error); |
||||
|
}) |
||||
|
// } |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} else if (e.index == 1) { |
||||
|
this.$refs.refBalanceQuery.showDrawer(); |
||||
|
this.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
|
||||
|
methods: { |
||||
|
getBusinessType() { |
||||
|
getBusinessType(this.businessTypeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses); |
||||
|
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList |
||||
|
this.showFromLocationPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
getScanResult(result, managementTypeParams) { |
||||
|
this.managementType = managementTypeParams |
||||
|
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") { |
||||
|
this.setDataBatch(result); |
||||
|
} else { |
||||
|
this.setData(result); |
||||
|
} |
||||
|
}, |
||||
|
async setData(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 itemp = createItemInfo(balance, pack); |
||||
|
let newDetail = createDetailInfo(balance, pack); // |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
} 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) { |
||||
|
let newDetail = createDetailInfo(balance, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
if (detail.scaned == true) { |
||||
|
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]重复扫描") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
calcHandleQty(this.detailSource) |
||||
|
}, |
||||
|
|
||||
|
setDataBatch(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 itemp = createItemInfo(balance, pack); |
||||
|
let newDetail = createDetailInfo(balance, pack); // |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.batch == balance.batch && |
||||
|
r.locationCode == balance.locationCode && |
||||
|
r.inventoryStatus == balance.inventoryStatus) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
if (detail == undefined) { |
||||
|
let newDetail = createDetailInfo(balance, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
detail.handleQty =calc.add(detail.handleQty, result.label.qty) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
calcHandleQty(this.detailSource) |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.scanPopupGetFocus() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showSelect() { |
||||
|
// if (this.editPosition) { |
||||
|
this.show = true |
||||
|
// } |
||||
|
}, |
||||
|
|
||||
|
confirmSelect(e) { |
||||
|
this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label |
||||
|
console.log("位置", this.positionInfo) |
||||
|
this.workshopCode = e[0].value |
||||
|
this.productionLineCode = e[1].value |
||||
|
this.workStationCode = e[2].value |
||||
|
this.workShopName = e[0].label |
||||
|
this.productionLineName = e[1].label |
||||
|
this.workStationName = e[2].label |
||||
|
|
||||
|
let shop = this.positionList.find(shop => shop.value == this.workshopCode); |
||||
|
if (shop != undefined && shop.children != undefined) { |
||||
|
let prodLine = shop.children.find(line => line.value == this.productionLineCode); |
||||
|
if (prodLine != undefined && prodLine.children != undefined) { |
||||
|
let station = prodLine.children.find(r => r.value == this.workStationCode); |
||||
|
if (station.rawLocationCode == '' && station.rawLocationCode == null) { |
||||
|
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择") |
||||
|
return; |
||||
|
} else { |
||||
|
this.rawLocationCode = station.rawLocationCode; |
||||
|
this.fgLocationCode = station.fgLocationCode; |
||||
|
} |
||||
|
} else { |
||||
|
this.showErrorMessage("生产线-工位基础信息维护错误") |
||||
|
} |
||||
|
} else { |
||||
|
this.showErrorMessage("车间-生产线基础信息维护错误") |
||||
|
} |
||||
|
|
||||
|
//赋值到库位代码 |
||||
|
let toLocationCode = '' |
||||
|
this.positionList.forEach(item => { |
||||
|
if (this.workshopCode == item.value) { // 车间 |
||||
|
item.children.find(child => { |
||||
|
if (this.productionLineCode == child.value) { |
||||
|
toLocationCode = child.children.find(subChild => this.workStationCode == |
||||
|
subChild.value).rawLocationCode; |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = toLocationCode |
||||
|
detail.productionLineCode = this.productionLineCode |
||||
|
detail.workStationCode = this.workStationCode |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
|
||||
|
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() { |
||||
|
if (this.businessType) { |
||||
|
if (this.fromLocationCode == "") { |
||||
|
this.showFromLocationPopup(); |
||||
|
return |
||||
|
} |
||||
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); |
||||
|
} else { |
||||
|
this.getBusinessType() |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
showFromLocationPopup() { |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.scanFromLocationCode.openScanPopup(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if (this.$refs.scanFromLocationCode != undefined) { |
||||
|
this.$refs.scanFromLocationCode.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// scanLocationCode(location, code) { |
||||
|
// this.toLocationCode = code |
||||
|
// this.toLocationCode = location; |
||||
|
|
||||
|
// }, |
||||
|
|
||||
|
commit() { |
||||
|
if (this.positionInfo == '请选择生产线' || !this.positionInfo) { |
||||
|
this.showErrorMessage("请选择生产线") |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
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)); |
||||
|
const isHaveItem = params.subList.find(item => item.handleQty > item.balanceQty) |
||||
|
if (isHaveItem) { |
||||
|
this.showErrorMessage(`物料号${isHaveItem.itemCode}`) |
||||
|
this.$refs.comMessage.showConfirmWarningModal('物料号' + isHaveItem.itemCode + '数量[' + |
||||
|
isHaveItem.handleQty + ']不允许大于库存数量[' + isHaveItem.balanceQty + ']') |
||||
|
uni.hideLoading() |
||||
|
return |
||||
|
} |
||||
|
issueRecordSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功\n生成直接发料记录\n" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
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 = ""; |
||||
|
submitItem.balanceQty = detail.balanceQty; |
||||
|
submitItem.recordList = [{ |
||||
|
toInventoryStatus: detail.inventoryStatus, |
||||
|
fromParentPackingNumber: detail.parentNumber, |
||||
|
fromPackingNumber: info.packingNumber, |
||||
|
fromBatch: info.batch, |
||||
|
toPackingNumber: info.packingNumber, |
||||
|
toBatch: info.batch, |
||||
|
fromLocationCode: detail.locationCode, |
||||
|
toLocationCode: detail.toLocationCode, |
||||
|
handleQty: detail.handleQty, |
||||
|
fromPackUnit: detail.packUnit, |
||||
|
toPackUnit: detail.packUnit, |
||||
|
fromPackQty: detail.packQty, |
||||
|
toPackQty: detail.packQty |
||||
|
}] |
||||
|
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(); |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clearData(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
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(); |
||||
|
|
||||
|
}, |
||||
|
getFromLocation(location) { |
||||
|
this.fromLocationCode = location.code; |
||||
|
this.fromLocationInfo = location; |
||||
|
this.openScanPopup(); |
||||
|
}, |
||||
|
clearData() { |
||||
|
this.fromLocationInfo = {}; |
||||
|
this.fromLocationCode = ''; |
||||
|
this.fromWarehouseCode = ''; |
||||
|
this.toWarehouseCode = ''; |
||||
|
this.detailSource = []; |
||||
|
this.positionInfo = "请选择生产线"; |
||||
|
this.itemCode = "" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
</style> |
@ -0,0 +1,48 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<productPutawayRecordByBatch :title="title" ref="productPutawayRecordByBatch" putawayType='assemble'></productPutawayRecordByBatch> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import productPutawayRecordByBatch from '@/pages/productPutaway/record/productPutawayRecordByBatch.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
productPutawayRecordByBatch |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
title:'' |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option){ |
||||
|
this.title = option.title |
||||
|
}, |
||||
|
|
||||
|
onShow() { |
||||
|
if(this.$refs.productPutawayRecordByBatch!=undefined){ |
||||
|
// this.$refs.productPutawayRecord.refresh(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
// this.$refs.productPutawayRecord.refresh(); |
||||
|
}, |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
this.$refs.productPutawayRecordByBatch.toHome(); |
||||
|
} else if (e.index == 1) { |
||||
|
this.$refs.productPutawayRecordByBatch.openFilter(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,651 @@ |
|||||
|
<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" style="height: calc(100vh - 44px);"> |
||||
|
<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" |
||||
|
:isShowStatus="true" :isShowToLocation='false' @removeItem="removeItem(index,item)" |
||||
|
:isShowModifedLocation="true" |
||||
|
@updateData="updateData" @removePack="removePack" @editLocation="showScanToLocation" |
||||
|
> |
||||
|
</record-com-detail-card> |
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer" v-if="detailSource.length>0"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
|
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_reject" style="margin-right:5px ;" hover-class="btn_commit_after" |
||||
|
@click="cancel">取消</button> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
|
||||
|
<win-scan-button v-if="detailSource.length>0" @goScan='openScanPopup'></win-scan-button> |
||||
|
|
||||
|
|
||||
|
<winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode"> |
||||
|
</winComScanBalance> |
||||
|
|
||||
|
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getToLocationCode' |
||||
|
:locationAreaTypeList="toLocationAreaTypeList"></win-scan-location> |
||||
|
|
||||
|
<win-scan-pack-and-location ref="winScanPackAndLocationRef" @getResult='getScanResult' :allowModifyLocation='false'> |
||||
|
</win-scan-pack-and-location> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
<win-scan-location ref="winScanFromLocation" title="来源库位" @getLocation='getLocation' |
||||
|
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
productPutawayRecordSubmit, |
||||
|
getrecommendLocationExpectin, |
||||
|
recommendLocationRemoveExpectin, |
||||
|
getBalanceByFilter |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
goHome, |
||||
|
getPackingNumberAndBatchByList, |
||||
|
deepCopyData |
||||
|
} from '@/common/basic.js'; |
||||
|
import { |
||||
|
getPrecisionStrategyList, |
||||
|
getManagementPrecisions |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import { |
||||
|
getInventoryStatusDesc, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
createItemInfo, |
||||
|
createDetailInfo, |
||||
|
calcHandleQty, |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comProductionRecord from '@/pages/productionReceipt/coms/comProductionRecord.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
|
import winScanPackage from '@/mycomponents/scan/winScanPackage.vue' |
||||
|
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
||||
|
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' |
||||
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
import { |
||||
|
updateTitle |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
comProductionRecord, |
||||
|
requiredLocation, |
||||
|
comBlankView, |
||||
|
recordComDetailCard, |
||||
|
winScanPackage, |
||||
|
winScanLocation, |
||||
|
winComScanBalance, |
||||
|
winScanPackAndLocation, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
scanCount: 0, |
||||
|
dataContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
fromLocationCode: "", |
||||
|
toLocationCode: "", |
||||
|
fromLocationAreaTypeList: [], |
||||
|
tolocationTypeList: [], |
||||
|
toLocationAreaTypeList: [], |
||||
|
inInventoryStatus: "", //目标入库库存状态 |
||||
|
outInventoryStatus: "", //来源出库库存状态:"", |
||||
|
businessTypeCode: "ProductPutaway", |
||||
|
businessType: {}, |
||||
|
managementList: [], |
||||
|
type: '', |
||||
|
editItem: null, |
||||
|
managementType:'' |
||||
|
}; |
||||
|
}, |
||||
|
// 装配收货:type = 'assemble' |
||||
|
// 预生产收货:type = 'predict' |
||||
|
props: { |
||||
|
putawayType: 'assemble', |
||||
|
}, |
||||
|
|
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() { |
||||
|
getBusinessType(this.businessTypeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses); |
||||
|
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList |
||||
|
this.openScanPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
getScanResult(result,managementTypeParams) { |
||||
|
this.managementType = managementTypeParams |
||||
|
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){ |
||||
|
this.setDataBatch(result) |
||||
|
}else{ |
||||
|
this.setData(result) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
async setData(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 itemp = createItemInfo(balance, pack); |
||||
|
// itemp.containerNumber="" |
||||
|
let newDetail = createDetailInfo(balance, pack); // |
||||
|
newDetail.fromLocationCode=balance.locationCode |
||||
|
|
||||
|
newDetail.parentNumber = pack.parentNumber; |
||||
|
newDetail.packingNumber = pack.number |
||||
|
newDetail.packUnit = pack.packUnit; |
||||
|
newDetail.packQty = pack.packQty; |
||||
|
if (balance.lableQty) { |
||||
|
newDetail.handleQty = balance.lableQty |
||||
|
} |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
this.itemCode = balance.itemCode; |
||||
|
this.fromLocationCode = balance.locationCode |
||||
|
await this.getRecommendLocation(balance,result) |
||||
|
await this.scanPopupGetFocus() |
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == pack.parentNumber && |
||||
|
r.batch == balance.batch && |
||||
|
r.fromLocationCode == balance.locationCode && |
||||
|
r.inventoryStatus == balance.inventoryStatus) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if(detail == undefined){ |
||||
|
let newDetail = createDetailInfo(balance, pack); |
||||
|
newDetail.parentNumber = pack.parentNumber; |
||||
|
newDetail.packingNumber = pack.number |
||||
|
newDetail.packUnit = pack.packUnit; |
||||
|
newDetail.packQty = pack.packQty; |
||||
|
newDetail.fromLocationCode=balance.locationCode |
||||
|
if (balance.lableQty) { |
||||
|
newDetail.handleQty = balance.lableQty |
||||
|
} |
||||
|
item.subList.push(newDetail); |
||||
|
this.scanPopupGetFocus() |
||||
|
}else { |
||||
|
if (detail.scaned == true) { |
||||
|
this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]重复扫描") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
calcHandleQty(this.detailSource); |
||||
|
}, |
||||
|
|
||||
|
async setDataBatch(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 itemp = createItemInfo(balance, pack); |
||||
|
// itemp.containerNumber="" |
||||
|
let newDetail = createDetailInfo(balance, pack); // |
||||
|
newDetail.fromLocationCode=balance.locationCode |
||||
|
|
||||
|
newDetail.parentNumber = pack.parentNumber; |
||||
|
newDetail.packingNumber = pack.number |
||||
|
newDetail.packUnit = pack.packUnit; |
||||
|
newDetail.packQty = pack.packQty; |
||||
|
if (balance.lableQty) { |
||||
|
newDetail.handleQty = balance.lableQty |
||||
|
} |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
this.itemCode = balance.itemCode; |
||||
|
this.fromLocationCode = balance.locationCode |
||||
|
await this.getRecommendLocation(balance,result) |
||||
|
await this.scanPopupGetFocus() |
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == pack.parentNumber && |
||||
|
r.batch == balance.batch && |
||||
|
r.fromLocationCode == balance.locationCode && |
||||
|
r.inventoryStatus == balance.inventoryStatus) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if(detail == undefined){ |
||||
|
let newDetail = createDetailInfo(balance, pack); |
||||
|
newDetail.parentNumber = pack.parentNumber; |
||||
|
newDetail.packingNumber = pack.number |
||||
|
newDetail.packUnit = pack.packUnit; |
||||
|
newDetail.packQty = pack.packQty; |
||||
|
newDetail.fromLocationCode=balance.locationCode |
||||
|
if (balance.lableQty) { |
||||
|
newDetail.handleQty = balance.lableQty |
||||
|
} |
||||
|
item.subList.push(newDetail); |
||||
|
this.scanPopupGetFocus() |
||||
|
}else { |
||||
|
detail.handleQty = calc.add(detail.handleQty,result.label.qty) |
||||
|
} |
||||
|
} |
||||
|
calcHandleQty(this.detailSource); |
||||
|
}, |
||||
|
|
||||
|
async getRecommendLocation(balance,result) { |
||||
|
uni.showLoading({ |
||||
|
title: '扫描中...', |
||||
|
mask: true |
||||
|
}) |
||||
|
|
||||
|
let param = { |
||||
|
expectinNumber: balance.packingNumber + "-" + Date.now(), |
||||
|
itemCode: balance.itemCode, |
||||
|
inventoryStatus: balance.inventoryStatus, |
||||
|
batch: balance.batch |
||||
|
}; |
||||
|
console.log(JSON.stringify(param)) |
||||
|
await getrecommendLocationExpectin(param).then(async result1 => { |
||||
|
uni.hideLoading(); |
||||
|
let item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == balance.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
item.toLocationCode = result1.data.code; |
||||
|
item.expectinNumber = result1.data.expectinNumber; |
||||
|
await this.getToLocationBalance(item.toLocationCode,result) |
||||
|
this.$forceUpdate(); |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error); |
||||
|
}) |
||||
|
}, |
||||
|
//查询到目标库位的库存余额 |
||||
|
async getToLocationBalance(toLocationCode,result) { |
||||
|
uni.showLoading({ |
||||
|
title: '查询中', |
||||
|
mask: true |
||||
|
}) |
||||
|
var filters = [] |
||||
|
if (result.package.parentNumber) { |
||||
|
var packingNumber = result.package.parentNumber + "," + result.package.number; |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "in", |
||||
|
value: packingNumber |
||||
|
}) |
||||
|
} else { |
||||
|
filters.push({ |
||||
|
column: "packingNumber", |
||||
|
action: "==", |
||||
|
value: result.package.number |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
filters.push({ |
||||
|
column: "itemCode", |
||||
|
action: "==", |
||||
|
value: result.package.itemCode |
||||
|
}) |
||||
|
filters.push({ |
||||
|
column: "batch", |
||||
|
action: "==", |
||||
|
value: result.package.batch |
||||
|
}) |
||||
|
|
||||
|
filters.push({ |
||||
|
column: "areaType", |
||||
|
action: "in", |
||||
|
value: this.toLocationAreaTypeList.join(',') |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
await getManagementPrecisions([result.package.itemCode], toLocationCode,async res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
this.managementType = this.managementList.some(item => item.ManagementPrecision == 'BY_BATCH') ? 'BY_BATCH' : '' |
||||
|
if(this.managementType == 'BY_BATCH'){ |
||||
|
uni.hideLoading() |
||||
|
}else{ |
||||
|
await getBalanceByFilter(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data.list.length > 0) { |
||||
|
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额"); |
||||
|
} |
||||
|
// callback(res.data) |
||||
|
}).catch(err => { |
||||
|
this.showErrorMessage(err.message); |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
//移除推荐的预占用库位 |
||||
|
removeRecommendLocation(lst) { |
||||
|
let param = { |
||||
|
expectinNumberList: lst, |
||||
|
}; |
||||
|
recommendLocationRemoveExpectin(param).then(res => { |
||||
|
|
||||
|
}).catch(err => { |
||||
|
this.showErrorMessage('【' + lst.join(',') + '】移除预占用失败,请在PC端的预占用中移除') |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showScanToLocation(item) { |
||||
|
this.editItem = item; |
||||
|
setTimeout(r => { |
||||
|
this.$refs.scanLocationCode.openScanPopup(); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}); |
||||
|
}, |
||||
|
calcHandleQty() { |
||||
|
calcHandleQty(this.detailSource); |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
removeItem(index, item) { |
||||
|
this.removeRecommendLocation([item.expectinNumber]); |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
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.removeRecommendLocation(item) |
||||
|
} |
||||
|
} |
||||
|
this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
if (this.businessType) { |
||||
|
this.toLocationAreaTypeList = getDirectoryItemArray(this.businessType.inAreaTypes) |
||||
|
// this.$refs.scanPopup.openScanPopup(this.businessType); |
||||
|
this.openFromLocationScanPopup() |
||||
|
} else { |
||||
|
this.getBusinessType() |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupLoseFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.losefocus(); |
||||
|
} |
||||
|
}, |
||||
|
openFromLocationScanPopup() { |
||||
|
if (this.fromLocationCode == "") { |
||||
|
this.showFromLocationPopup(); |
||||
|
return |
||||
|
} |
||||
|
this.$refs.winScanPackAndLocationRef.openScanPopupForType(this.fromLocationCode, this.businessType); |
||||
|
}, |
||||
|
showFromLocationPopup() { |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.winScanFromLocation.openScanPopup(); |
||||
|
}) |
||||
|
}, |
||||
|
scanLocationCode(location, code) { |
||||
|
this.toLocationCode = code |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
||||
|
//查询管理模式 |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
var params = this.setParams() |
||||
|
|
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
const isHaveItem =params.subList.find(item=>item.handleQty > item.balanceQty) |
||||
|
if(isHaveItem){ |
||||
|
this.showErrorMessage(`物料号${isHaveItem.itemCode}`) |
||||
|
this.$refs.comMessage.showConfirmWarningModal('物料号'+isHaveItem.itemCode+'数量[' + isHaveItem.handleQty + ']不允许大于库存数量[' + isHaveItem.balanceQty + ']') |
||||
|
uni.hideLoading() |
||||
|
return |
||||
|
} |
||||
|
productPutawayRecordSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功\n生成制品上架记录\n" + res.data) |
||||
|
let removeId = []; |
||||
|
this.detailSource.forEach(r => { |
||||
|
removeId.push(r.expectinNumber); |
||||
|
}) |
||||
|
|
||||
|
this.removeRecommendLocation(removeId); |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
// } else { |
||||
|
// uni.hideLoading(); |
||||
|
// this.showErrorMessage(res.message); |
||||
|
// } |
||||
|
|
||||
|
} else { |
||||
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
setPrecisionStrategParams() { |
||||
|
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 && |
||||
|
detail.toLocationCode == res.locationCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素 |
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
let that = this; |
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
that.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var submitItem = deepCopyData(detail) |
||||
|
submitItem.itemCode = detail.itemCode; |
||||
|
submitItem.itemName = detail.package.itemName; |
||||
|
submitItem.itemDesc1 = detail.package.itemDesc1; |
||||
|
submitItem.itemDesc2 = detail.package.itemDesc2; |
||||
|
submitItem.inventoryStatus = detail.inventoryStatus; |
||||
|
|
||||
|
submitItem.fromPackingNumber = detail.packingNumber; |
||||
|
submitItem.toPackingNumber = detail.packingNumber; |
||||
|
|
||||
|
submitItem.fromParentPackingNumber = detail.parentNumber; |
||||
|
submitItem.fromBatch = detail.package.batch; |
||||
|
submitItem.toBatch = detail.package.batch; |
||||
|
|
||||
|
submitItem.fromLocationCode = detail.locationCode; |
||||
|
submitItem.toLocationCode = item.toLocationCode; |
||||
|
|
||||
|
submitItem.qty = detail.handleQty; |
||||
|
submitItem.package = ""; |
||||
|
subList.push(submitItem) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
that.dataContent.subList = subList; |
||||
|
that.dataContent.creator = creator; |
||||
|
that.dataContent.type = that.putawayType; |
||||
|
return that.dataContent; |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) {} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
getToLocationCode(location, code) { |
||||
|
this.editItem.toLocationCode = code; |
||||
|
}, |
||||
|
getLocation(location, code) { |
||||
|
this.getFromLocationCode(location, code) |
||||
|
}, |
||||
|
getFromLocationCode(location, code) { |
||||
|
this.fromLocationInfo = location; |
||||
|
this.fromLocationCode = code; |
||||
|
this.openScanPopup(); |
||||
|
}, |
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clearData(); |
||||
|
}) |
||||
|
}, |
||||
|
clearData() { |
||||
|
this.fromLocationCode = ''; |
||||
|
this.subList = []; |
||||
|
this.detailSource = []; |
||||
|
this.toLocationCode = ''; |
||||
|
this.dataContent = {} |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
let item = this.detailSource[i]; |
||||
|
if (item.qty == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
cancel() { |
||||
|
this.clearData(); |
||||
|
this.openScanPopup(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,48 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<productPutawayRecordByBatch :title="title" ref="productPutawayRecordByBatch" putawayType='predict'></productPutawayRecordByBatch> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import productPutawayRecordByBatch from '@/pages/productPutaway/record/productPutawayRecordByBatch.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
productPutawayRecordByBatch |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
title:'' |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option){ |
||||
|
this.title = option.title |
||||
|
}, |
||||
|
|
||||
|
onShow() { |
||||
|
if(this.$refs.productPutawayRecordByBatch!=undefined){ |
||||
|
this.$refs.productPutawayRecordByBatch.refresh(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.$refs.productPutawayRecordByBatch.refresh(); |
||||
|
}, |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
this.$refs.productPutawayRecordByBatch.toHome(); |
||||
|
} else if (e.index == 1) { |
||||
|
this.$refs.productPutawayRecordByBatch.openFilter(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,492 @@ |
|||||
|
<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-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=""> |
||||
|
<com-product-record :dataContent="item" :index="index" @removeItem="removeItem(index,item)" |
||||
|
@updateData="updateData" @removePack="removePack"> |
||||
|
</com-product-record> |
||||
|
</view> |
||||
|
<view class='split_line'></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=""> |
||||
|
<view class="uni-flex uni-row u-col-center"> |
||||
|
<text style="font-size: 32rpx;">位置 : </text> |
||||
|
<view class="uni-flex u-col-center uni-row" @click="showSelect"> |
||||
|
<view class="" style="margin-left: 20rpx;"> |
||||
|
{{positionInfo}} |
||||
|
</view> |
||||
|
<u-select v-model="show" mode="mutil-column-auto" :list="positionList" |
||||
|
@confirm="confirmSelect"></u-select> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</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' title="制品标签" headerType="HMQ"></win-scan-pack> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
productionReceiptRecordSubmit, |
||||
|
getWorkShopLineStation |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
getPrecisionStrategyList |
||||
|
} from '@/common/balance.js'; |
||||
|
import { |
||||
|
goHome, |
||||
|
getPackingNumberAndBatchByList, |
||||
|
deepCopyData |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { Decimal } from 'decimal.js';//引入 |
||||
|
|
||||
|
import { |
||||
|
getInventoryStatusDesc, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import comProductRecord from '@/pages/productReceipt/coms/comProductRecord.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
comProductRecord, |
||||
|
comBlankView, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
toLocationCode: "", |
||||
|
fromLocationTypeList: [], |
||||
|
fromLocationCode: "", |
||||
|
businessType: {}, |
||||
|
dataContent: {}, |
||||
|
managementList: [], |
||||
|
show: false, |
||||
|
positionInfo: "请选择位置", |
||||
|
positionList: [], |
||||
|
productionLineCode: '', |
||||
|
rawLocationCode: "", |
||||
|
fgLocationCode: "", |
||||
|
workshopCode: "", |
||||
|
workStationCode: "", |
||||
|
workShopName: "", |
||||
|
productionLineName: "", |
||||
|
workStationName: "", |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: option.title |
||||
|
}) |
||||
|
var typeCode = "ProductReceipt" |
||||
|
getBusinessType(typeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.openScanPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
getWorkShopLineStation().then(res => { |
||||
|
this.positionList = res.data |
||||
|
}).catch(error => { |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
methods: { |
||||
|
getScanResult(result) { |
||||
|
let label = result.label; |
||||
|
let pack = result.package; |
||||
|
|
||||
|
var item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == label.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (item == undefined) { |
||||
|
var itemp = this.createItemInfo(label, pack); |
||||
|
let newDetail = this.createDetailInfo(label, pack); |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == label.packingNumber && |
||||
|
r.batch == label.batch) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (detail == undefined) { |
||||
|
let newDetail = this.createDetailInfo(label, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
if (detail.scaned == true) { |
||||
|
this.showErrorMessage("箱码[" + label.packingNumber + "批次[" + label.batch + "]重复扫描") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
createItemInfo(label, pack) { |
||||
|
let item = { |
||||
|
itemCode: label.itemCode, |
||||
|
itemName: pack.itemName, |
||||
|
packQty: pack.packQty, |
||||
|
packUnit: pack.packUnit, |
||||
|
qty: new Decimal(label.qty).toNumber(), |
||||
|
handleQty: new Decimal(0).toNumber(), |
||||
|
uom: pack.uom, |
||||
|
subList: [] |
||||
|
} |
||||
|
return item; |
||||
|
}, |
||||
|
|
||||
|
createDetailInfo(label, pack) { |
||||
|
let detail = deepCopyData(label); |
||||
|
detail.scaned = true; |
||||
|
detail.qty = new Decimal(label.qty).toNumber(); |
||||
|
detail.handleQty = new Decimal(label.qty).toNumber(); |
||||
|
detail.inventoryStatus = "OK" |
||||
|
detail.packQty = pack.packQty; |
||||
|
detail.packUnit = pack.packUnit; |
||||
|
|
||||
|
detail.package = pack; |
||||
|
detail.label = label; |
||||
|
return detail; |
||||
|
}, |
||||
|
|
||||
|
calcHandleQty() { |
||||
|
for (let item of this.detailSource) { |
||||
|
item.handleQty = new Decimal(0).toNumber(); |
||||
|
for (let detail of item.subList) { |
||||
|
if (detail != undefined) { |
||||
|
item.handleQty = calc.add(item.handleQty,detail.handleQty) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.scanPopupGetFocus(); |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
openScanPopup() { |
||||
|
this.$refs.scanPopup.openScanPopup(); |
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
if (this.positionInfo == "请选择位置") { |
||||
|
this.showMessage("请先选择位置") |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
||||
|
//查询管理模式 |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.managementList = []; |
||||
|
var precisionStrategParams = this.setPrecisionStrategParams() |
||||
|
|
||||
|
getPrecisionStrategyList(precisionStrategParams, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
var params = this.setParams() |
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
productionReceiptRecordSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功\n生成制品收货记录\n" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
setPrecisionStrategParams() { |
||||
|
var itemList = [] |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
detail.toLocationCode = this.fgLocationCode; |
||||
|
var filterResult = itemList.filter(res => { |
||||
|
if (res.itemCode == item.itemCode && |
||||
|
detail.toLocationCode == res.locationCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素 |
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
|
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var submitItem = deepCopyData(detail) |
||||
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, |
||||
|
detail.packingNumber, detail.toLocationCode, detail.batch); |
||||
|
submitItem.itemCode = detail.itemCode; |
||||
|
submitItem.itemName = detail.package.itemName; |
||||
|
submitItem.itemDesc1 = detail.package.itemDesc1; |
||||
|
submitItem.itemDesc2 = detail.package.itemDesc2; |
||||
|
|
||||
|
submitItem.inventoryStatus = detail.inventoryStatus; |
||||
|
|
||||
|
submitItem.fromPackingNumber = info.packingNumber; |
||||
|
submitItem.toPackingNumber = info.packingNumber; |
||||
|
|
||||
|
submitItem.fromContainerNumber = detail.containerNumber; |
||||
|
submitItem.toContainerNumber = detail.containerNumber |
||||
|
|
||||
|
submitItem.fromBatch = info.batch; |
||||
|
submitItem.toBatch = info.batch; |
||||
|
|
||||
|
submitItem.fromLocationCode = detail.locationCode; |
||||
|
submitItem.toLocationCode = detail.toLocationCode; |
||||
|
|
||||
|
submitItem.productionlineCode = this.productionLineCode; |
||||
|
submitItem.workStationCode = this.workStationCode; |
||||
|
|
||||
|
submitItem.qty = detail.handleQty; |
||||
|
submitItem.package = ""; |
||||
|
|
||||
|
subList.push(submitItem) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
this.dataContent.subList = subList; |
||||
|
this.dataContent.creator = creator; |
||||
|
this.dataContent.type = "predict";//默认预生产直接报工,装配报工使用按计划完工和无计划完工 |
||||
|
this.dataContent.workshopCode = this.workshopCode; |
||||
|
return this.dataContent; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
showMessage(message) { |
||||
|
setTimeout(r => { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
setTimeout(r => { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.scanPopupGetFocus(); |
||||
|
} |
||||
|
}); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupLoseFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.losefocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clearData(); |
||||
|
}) |
||||
|
}, |
||||
|
clearData() { |
||||
|
this.subList = []; |
||||
|
this.detailSource = []; |
||||
|
this.toLocationCode = ''; |
||||
|
this.dataContent = {}; |
||||
|
this.positionInfo = "请选择位置"; |
||||
|
this.fgLocationCode = "" |
||||
|
}, |
||||
|
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(); |
||||
|
}, |
||||
|
|
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
showSelect() { |
||||
|
this.show = !this.show |
||||
|
|
||||
|
}, |
||||
|
confirmSelect(e) { |
||||
|
this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label |
||||
|
console.log("位置", this.positionInfo) |
||||
|
this.workshopCode = e[0].value |
||||
|
this.productionLineCode = e[1].value |
||||
|
this.workStationCode = e[2].value |
||||
|
this.workShopName = e[0].label |
||||
|
this.productionLineName = e[1].label |
||||
|
this.workStationName = e[2].label |
||||
|
|
||||
|
let shop = this.positionList.find(shop => shop.value == this.workshopCode); |
||||
|
if (shop != undefined && shop.children != undefined) { |
||||
|
let prodLine = shop.children.find(line => line.value == this.productionLineCode); |
||||
|
if (prodLine != undefined && prodLine.children != undefined) { |
||||
|
let station = prodLine.children.find(r => r.value == this.workStationCode); |
||||
|
if (station.rawLocationCode == '' && station.rawLocationCode == null) { |
||||
|
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择") |
||||
|
return; |
||||
|
} else { |
||||
|
this.rawLocationCode = station.rawLocationCode; |
||||
|
this.fgLocationCode = station.fgLocationCode; |
||||
|
} |
||||
|
} else { |
||||
|
this.showErrorMessage("生产线-工位基础信息维护错误") |
||||
|
} |
||||
|
} else { |
||||
|
this.showErrorMessage("车间-生产线基础信息维护错误") |
||||
|
} |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</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> |
@ -0,0 +1,482 @@ |
|||||
|
<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-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" :isShowFromLocation="false" |
||||
|
:isShowToLocation="false" |
||||
|
:isShowParentToLocation="false" |
||||
|
:allowModifyQty="true" |
||||
|
:queryBalance="false" |
||||
|
@removeItem="removeItem(index,item)" @updateData="updateData" @removePack="removePack"> |
||||
|
</record-com-detail-card> |
||||
|
</view> |
||||
|
<view class='split_line'></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 title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode' |
||||
|
:locationAreaTypeList="toLocationAreaTypeList"></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'></win-scan-pack> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
transferReceiptRecordSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
getPrecisionStrategyList |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
deepCopyData, |
||||
|
getPackingNumberAndBatchByList |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getInventoryStatusDesc, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
createItemInfo, |
||||
|
createDetailInfo, |
||||
|
calcHandleQty |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc' |
||||
|
|
||||
|
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 recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
requiredLocation, |
||||
|
comBlankView, |
||||
|
recordComDetailCard |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
toLocationCode: "", |
||||
|
toLocationAreaTypeList: [], |
||||
|
inInventoryStatus: "", //目标入库库存状态 |
||||
|
outInventoryStatus: "", //来源出库库存状态 |
||||
|
businessType: {}, |
||||
|
managementList: [], |
||||
|
dataContent: {}, |
||||
|
toWarehouseCode: '', |
||||
|
managementType:import.meta.env.VITE_MANAGE_MODEL |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: option.title |
||||
|
}) |
||||
|
var typeCode = "TransferReceipt" |
||||
|
|
||||
|
getBusinessType(typeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.toLocationAreaTypeList = res.toLocationAreaTypeList; |
||||
|
this.openScanPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
methods: { |
||||
|
getScanResult(result) { |
||||
|
var managementTypeParams =this.managementType |
||||
|
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") { |
||||
|
this.setDataBatch(result) |
||||
|
} else { |
||||
|
this.setData(result) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
setData(result){ |
||||
|
let label = result.label; |
||||
|
let pack = result.package; |
||||
|
var item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == label.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
if (item == undefined) { |
||||
|
var itemp = createItemInfo(label, pack); |
||||
|
let newDetail = createDetailInfo(label, pack); // |
||||
|
newDetail.inventoryStatus = "OK" |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == label.packingNumber && |
||||
|
r.batch == label.batch) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
if (detail == undefined) { |
||||
|
let newDetail = createDetailInfo(label, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
if (detail.scaned == true) { |
||||
|
this.showErrorMessage("箱码[" + label.packingNumber + "批次[" + balance.batch + "]重复扫描") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
setDataBatch(result){ |
||||
|
let label = result.label; |
||||
|
let pack = result.package; |
||||
|
var item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == label.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
if (item == undefined) { |
||||
|
var itemp = createItemInfo(label, pack); |
||||
|
let newDetail = createDetailInfo(label, pack); // |
||||
|
newDetail.inventoryStatus = "OK" |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == label.packingNumber && |
||||
|
r.batch == label.batch) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
if (detail == undefined) { |
||||
|
let newDetail = createDetailInfo(label, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
detail.handleQty =calc.add(detail.handleQty, result.label.qty) |
||||
|
} |
||||
|
} |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
calcHandleQty() { |
||||
|
calcHandleQty(this.detailSource) |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
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(); |
||||
|
}, |
||||
|
|
||||
|
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.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
|
||||
|
if (this.toLocationCode == "") { |
||||
|
this.showMessage("请先选择目标库位") |
||||
|
return; |
||||
|
} |
||||
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
||||
|
//查询管理模式 |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.managementList = []; |
||||
|
var precisionStrategParams = this.setPrecisionStrategParams() |
||||
|
|
||||
|
getPrecisionStrategyList(precisionStrategParams, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
var params = this.setParams() |
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
transferReceiptRecordSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功\n生成调拨入库记录\n" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
setPrecisionStrategParams() { |
||||
|
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 && |
||||
|
detail.toLocationCode == res.locationCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素 |
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
|
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var submitItem = deepCopyData(detail) |
||||
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, |
||||
|
detail.packingNumber, detail.toLocationCode, detail.batch); |
||||
|
submitItem.itemCode = detail.itemCode; |
||||
|
submitItem.itemName = detail.package.itemName; |
||||
|
submitItem.itemDesc1 = detail.package.itemDesc1; |
||||
|
submitItem.itemDesc2 = detail.package.itemDesc2; |
||||
|
|
||||
|
submitItem.inventoryStatus = detail.inventoryStatus; |
||||
|
|
||||
|
submitItem.fromPackingNumber = info.packingNumber; |
||||
|
submitItem.toPackingNumber = info.packingNumber; |
||||
|
|
||||
|
submitItem.fromContainerNumber = detail.containerNumber; |
||||
|
submitItem.toContainerNumber = detail.containerNumber |
||||
|
|
||||
|
submitItem.fromBatch = info.batch; |
||||
|
submitItem.toBatch = info.batch; |
||||
|
|
||||
|
submitItem.fromLocationCode = detail.locationCode; |
||||
|
submitItem.toLocationCode = detail.toLocationCode; |
||||
|
|
||||
|
submitItem.qty = detail.handleQty; |
||||
|
submitItem.package = ""; |
||||
|
|
||||
|
subList.push(submitItem) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
this.dataContent.subList = subList; |
||||
|
this.dataContent.creator = creator; |
||||
|
this.dataContent.fromWarehouseCode = this.detailSource[0].subList[0].warehouseCode; |
||||
|
this.dataContent.toWarehouseCode = this.toWarehouseCode; |
||||
|
return this.dataContent; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) {} |
||||
|
}); |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
getLocation(location, code) { |
||||
|
|
||||
|
}, |
||||
|
getToLocationCode(location, code) { |
||||
|
this.toWarehouseCode = location.warehouseCode |
||||
|
// if (this.fromLocationCode == code) { |
||||
|
// uni.showToast({ |
||||
|
// title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致", |
||||
|
// duration: 2000 |
||||
|
// }) |
||||
|
// return |
||||
|
// } |
||||
|
this.toLocationCode = code; |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
detail.toLocationCode = code |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clearData(); |
||||
|
}) |
||||
|
}, |
||||
|
clearData() { |
||||
|
this.fromLocationCode = ''; |
||||
|
this.subList = []; |
||||
|
this.detailSource = []; |
||||
|
this.toLocationCode = ''; |
||||
|
this.dataContent = {} |
||||
|
this.toWarehouseCode = "" |
||||
|
}, |
||||
|
|
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
let item = this.detailSource[i]; |
||||
|
if (item.qty == 0) { |
||||
|
this.detailSource.splice(i, 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> |
@ -0,0 +1,450 @@ |
|||||
|
<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='split_line'></view> |
||||
|
<view class="page-main"> |
||||
|
<uni-data-picker v-if="detailSource.length>0" style="padding: 20rpx; background-color:#fff;" |
||||
|
class='uni-data-picker' placeholder="请选择入库原因" popup-title="入库原因" :localdata="reasonList" |
||||
|
@change="reasonChange"> |
||||
|
</uni-data-picker> |
||||
|
|
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<com-receipt-record |
||||
|
:dataContent="item" @removeItem="removeItem(index,item)" |
||||
|
@updateData="updateData" |
||||
|
:queryBalance="false" |
||||
|
:isShowLocation="false" @removePack="removePack"> |
||||
|
</com-receipt-record> |
||||
|
</view> |
||||
|
<view class='split_line'></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 title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode' |
||||
|
:locationAreaTypeList="toLocationAreaTypeList"></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' :title="'箱码'" headerType="HPQ,HMQ"></win-scan-pack> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comReceiptRecord from '@/pages/unPlanned/coms/comReceiptRecord.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import winScanPack from "@/mycomponents/scan/winScanPack.vue" |
||||
|
|
||||
|
import { |
||||
|
unPlannedReceiptRecordbSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
getDirectoryItemArray, |
||||
|
getUnPlannedReceiptReasonList |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
Decimal |
||||
|
} from 'decimal.js'; //引入 |
||||
|
import { |
||||
|
goHome, |
||||
|
deepCopyData, |
||||
|
getPackingNumberAndBatchByList |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getPrecisionStrategyList |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
comEmptyView, |
||||
|
winScanButton, |
||||
|
requiredLocation, |
||||
|
comReceiptRecord, |
||||
|
comBlankView, |
||||
|
winScanPack, |
||||
|
}, |
||||
|
props: { |
||||
|
|
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
toLocationCode: "", |
||||
|
toInventoryStatus: [], |
||||
|
businessType: {}, //业务类型 |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
businessTypeCode: "UnplannedReceipt", |
||||
|
reasonText: "", |
||||
|
reasonCode: "", |
||||
|
reasonList: [], |
||||
|
dataContent: {}, |
||||
|
managementList: [], |
||||
|
toLocationAreaTypeList:[], |
||||
|
managementType:import.meta.env.VITE_MANAGE_MODEL |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
this.reasonList = getUnPlannedReceiptReasonList(); |
||||
|
getBusinessType(this.businessTypeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.toLocationAreaTypeList = res.toLocationAreaTypeList; |
||||
|
this.openScanPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
onLoad(option) { |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
openScanPopup() { |
||||
|
this.$refs.scanPopup.openScanPopup(); |
||||
|
}, |
||||
|
getToLocationCode(location, code) { |
||||
|
this.toLocationCode = code; |
||||
|
}, |
||||
|
getScanResult(result) { |
||||
|
var managementTypeParams =this.managementType |
||||
|
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") { |
||||
|
this.setDataBatch(result) |
||||
|
} else { |
||||
|
this.setData(result) |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
setData(result){ |
||||
|
let label = result.label; |
||||
|
let pack = result.package; |
||||
|
var item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == label.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
if (item == undefined) { |
||||
|
var itemp = this.createItemInfo(label, pack); |
||||
|
let newDetail = this.createDetailInfo(label, pack); |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
this.getfocus() |
||||
|
|
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == pack.number && |
||||
|
r.batch == pack.batch) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (detail == undefined) { |
||||
|
let newDetail = this.createDetailInfo(label, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
this.getfocus() |
||||
|
} else { |
||||
|
if (detail.scaned) { |
||||
|
this.showErrorMessage("箱码[" + pack.number + "]批次[" + pack.batch + "]已经扫描") |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
setDataBatch(result){ |
||||
|
let label = result.label; |
||||
|
let pack = result.package; |
||||
|
var item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == label.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
if (item == undefined) { |
||||
|
var itemp = this.createItemInfo(label, pack); |
||||
|
let newDetail = this.createDetailInfo(label, pack); |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
this.getfocus() |
||||
|
|
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == pack.number && |
||||
|
r.batch == pack.batch) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (detail == undefined) { |
||||
|
let newDetail = this.createDetailInfo(label, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
this.getfocus() |
||||
|
} else { |
||||
|
detail.handleQty =calc.add(detail.handleQty, result.label.qty) |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
getfocus(){ |
||||
|
if(this.$refs.scanPopup){ |
||||
|
this.$refs.scanPopup.getfocus() |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
createItemInfo(label, pack) { |
||||
|
let item = { |
||||
|
itemCode: pack.itemCode, |
||||
|
itemName: pack.itemName, |
||||
|
packQty: pack.packQty, |
||||
|
packUnit: pack.packUnit, |
||||
|
qty: new Decimal(label.qty).toNumber(), |
||||
|
handleQty: new Decimal(0).toNumber(), |
||||
|
uom: label.uom, |
||||
|
subList: [] |
||||
|
} |
||||
|
return item; |
||||
|
}, |
||||
|
|
||||
|
createDetailInfo(label, pack) { |
||||
|
let detail = deepCopyData(label); |
||||
|
detail.scaned = true; |
||||
|
// Object.assign(detail, label) |
||||
|
detail.qty = new Decimal(label.qty).toNumber(); |
||||
|
detail.handleQty = new Decimal(label.qty).toNumber(); |
||||
|
detail.inventoryStatus = "OK" |
||||
|
detail.packQty = pack.packQty; |
||||
|
detail.packUnit = pack.packUnit; |
||||
|
label.inventoryStatus = "OK"; |
||||
|
detail.package = pack; |
||||
|
detail.label = label; |
||||
|
detail.label.scaned = true |
||||
|
return detail; |
||||
|
}, |
||||
|
|
||||
|
calcHandleQty() { |
||||
|
for (let item of this.detailSource) { |
||||
|
item.handleQty = new Decimal(0).toNumber(); |
||||
|
item.qty = new Decimal(0).toNumber(); |
||||
|
for (let detail of item.subList) { |
||||
|
if (detail != undefined) { |
||||
|
item.handleQty = calc.add(item.handleQty, detail.handleQty) |
||||
|
item.qty = calc.add(item.qty, detail.qty); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.getfocus() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
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(); |
||||
|
}, |
||||
|
|
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
commit() { |
||||
|
if (this.toLocationCode == "") { |
||||
|
this.showErrorMessage("请先选择目标库位") |
||||
|
return; |
||||
|
} |
||||
|
if (this.reasonText == '') { |
||||
|
this.showErrorMessage("请选择入库原因") |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
||||
|
//查询管理模式 |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.managementList = []; |
||||
|
var precisionStrategParams = this.setPrecisionStrategParams() |
||||
|
getPrecisionStrategyList(precisionStrategParams, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
var params = this.setParams() |
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
unPlannedReceiptRecordbSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功\n生成计划外入库记录\n" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
} else { |
||||
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
setPrecisionStrategParams() { |
||||
|
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 && |
||||
|
detail.toLocationCode == res.locationCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素 |
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
}, |
||||
|
setParams() { |
||||
|
|
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var submitItem = deepCopyData(detail) |
||||
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.label |
||||
|
.itemCode, |
||||
|
detail.label.packingNumber, detail.toLocationCode, detail.label.batch); |
||||
|
|
||||
|
submitItem.itemCode = detail.package.itemCode; |
||||
|
submitItem.itemName = detail.package.itemName; |
||||
|
submitItem.itemDesc1 = detail.package.itemDesc1; |
||||
|
submitItem.itemDesc2 = detail.package.itemDesc2; |
||||
|
|
||||
|
submitItem.inventoryStatus = detail.inventoryStatus; |
||||
|
|
||||
|
submitItem.fromPackingNumber = info.packingNumber; |
||||
|
submitItem.toPackingNumber = info.packingNumber; |
||||
|
|
||||
|
// detail.fromContainerNumber = detail.containerNumber; |
||||
|
// detail.toContainerNumber = detail.containerNumber |
||||
|
|
||||
|
submitItem.fromBatch = info.batch; |
||||
|
submitItem.toBatch = info.batch; |
||||
|
|
||||
|
submitItem.fromLocationCode = ""; |
||||
|
submitItem.toLocationCode = detail.toLocationCode; |
||||
|
|
||||
|
submitItem.reason = this.reasonCode; |
||||
|
|
||||
|
submitItem.qty = detail.handleQty; |
||||
|
submitItem.package = ""; |
||||
|
|
||||
|
subList.push(submitItem) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
this.dataContent.subList = subList; |
||||
|
this.dataContent.creator = creator; |
||||
|
return this.dataContent; |
||||
|
}, |
||||
|
reasonChange(e) { |
||||
|
if (e.detail.value.length == 0) { |
||||
|
this.reasonCode = "" |
||||
|
this.reasonText = "" |
||||
|
} else { |
||||
|
this.reasonCode = e.detail.value[0].value |
||||
|
this.reasonText = e.detail.value[0].text |
||||
|
} |
||||
|
}, |
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clearData(); |
||||
|
}) |
||||
|
}, |
||||
|
clearData() { |
||||
|
this.reasonCode = "" |
||||
|
this.reasonText = ""; |
||||
|
this.detailSource = []; |
||||
|
this.managementList = []; |
||||
|
this.dataContent = {} |
||||
|
this.toLocationCode = "" |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: relative; |
||||
|
margin-top: 2px; |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue