|
|
@ -4,14 +4,16 @@ |
|
|
|
<com-blank-view @goScan="openScanPopup" v-if="detailSource.length == 0"></com-blank-view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="uni-flex uni-column" v-if="detailSource.length > 0"> |
|
|
|
<view class="" style="flex: 1;"> |
|
|
|
<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" |
|
|
|
:isShowStatus="true" :isShowToLocation='false' @removeItem="removeItem(index,item)" |
|
|
|
@updateData="updateData" @removePack="removePack" @editLocation="showScanToLocation"> |
|
|
|
<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> |
|
|
@ -31,7 +33,8 @@ |
|
|
|
</view> |
|
|
|
<win-scan-button @goScan="openScanPopup"></win-scan-button> |
|
|
|
</view> |
|
|
|
<win-scan-package ref="scanPopup" @getResult='getScanResult'></win-scan-package> |
|
|
|
<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> |
|
|
|
<com-message ref="comMessageRef" /> |
|
|
@ -41,20 +44,21 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh ,onBackPress } from '@dcloudio/uni-app' |
|
|
|
import { productPutawayRecordSubmit,getrecommendLocationExpectin, recommendLocationRemoveExpectin } from '@/api/request2.js' |
|
|
|
import { productPutawayRecordSubmit,getrecommendLocationExpectin, recommendLocationRemoveExpectin,getBalanceByFilter } from '@/api/request2.js' |
|
|
|
import { goHome, getPackingNumberAndBatchByList, deepCopyData, updateTitle } from '@/common/basic.js' |
|
|
|
import { getPrecisionStrategyList } from '@/common/balance.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 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 { useCountStore } from '@/store' |
|
|
|
|
|
|
|
// 获取自定义的store |
|
|
@ -71,7 +75,7 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
const tolocationTypeList = ref([]) |
|
|
|
const inInventoryStatus = ref('') // 目标入库库存状态 |
|
|
|
const outInventoryStatus = ref('') // 来源出库库存状态 |
|
|
|
const bussinessCode = ref('ProductPutaway') |
|
|
|
const businessTypeCode = ref('ProductPutaway') |
|
|
|
const businessType = ref({}) |
|
|
|
const managementList = ref([]) |
|
|
|
const scanLocationCode = ref() |
|
|
@ -80,6 +84,9 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
const type = ref('') |
|
|
|
const editItem = ref(null) |
|
|
|
const toLocationAreaTypeList = ref([]) |
|
|
|
const fromInventoryStatuses = ref() |
|
|
|
const itemCode = ref() |
|
|
|
const managementType = ref() |
|
|
|
// 装配收货:type = 'assemble' |
|
|
|
// 预生产收货:type = 'predict' |
|
|
|
const props = defineProps({ |
|
|
@ -101,12 +108,11 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
// } else if (type.value == 'assemble') { |
|
|
|
// updateTitle('装配上架记录') |
|
|
|
// } |
|
|
|
getBusinessType(bussinessCode.value, (res) => { |
|
|
|
getBusinessType(businessTypeCode.value, (res) => { |
|
|
|
if (res.success) { |
|
|
|
businessType.value = res.businessType |
|
|
|
fromLocationAreaTypeList.value = res.fromLocationAreaTypeList |
|
|
|
tolocationTypeList.value = res.tolocationTypeList |
|
|
|
toLocationAreaTypeList.value = res.toLocationAreaTypeList; |
|
|
|
fromInventoryStatuses.value = getDirectoryItemArray(res.fromInventoryStatuses); |
|
|
|
fromLocationAreaTypeList.value = res.fromLocationAreaTypeList |
|
|
|
openScanPopup() |
|
|
|
} else { |
|
|
|
showErrorMessage(res.message) |
|
|
@ -121,51 +127,120 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
}) |
|
|
|
|
|
|
|
const getScanResult = (result) => { |
|
|
|
setData(result) |
|
|
|
const { label } = result |
|
|
|
const pack = result.package |
|
|
|
result.balance.forEach( |
|
|
|
balance => { |
|
|
|
let item = detailSource.value.find(res => { |
|
|
|
if (res.itemCode == balance.itemCode && res.containerNumber == balance.parentPackingNumber) { |
|
|
|
return res |
|
|
|
handleCalcHandleQty() |
|
|
|
} |
|
|
|
const setData = async (result)=>{ |
|
|
|
const { balance } = result.balance |
|
|
|
const { label } = result |
|
|
|
const pack = result.package |
|
|
|
let item = detailSource.value.find(res => { |
|
|
|
if (res.itemCode == balance.itemCode) { |
|
|
|
return res |
|
|
|
} |
|
|
|
}) |
|
|
|
if (item == undefined) { |
|
|
|
let itemp = createItemInfo(balance, pack); |
|
|
|
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); |
|
|
|
detailSource.value.push(itemp) |
|
|
|
itemCode.value = balance.itemCode; |
|
|
|
fromLocationCode.value = balance.locationCode |
|
|
|
await getRecommendLocation(balance, result) |
|
|
|
await scanPopupGetFocus() |
|
|
|
} else { |
|
|
|
let detail = item.subList.find(r => { |
|
|
|
if (r.batch == balance.batch && |
|
|
|
r.fromLocationCode == balance.locationCode && |
|
|
|
r.inventoryStatus == balance.inventoryStatus) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
if (detail == undefined) { |
|
|
|
if (pack.parentNumber) { |
|
|
|
let checkData = item.subList.find(r => { |
|
|
|
if (r.packingNumber == pack.parentNumber && |
|
|
|
r.batch == balance.batch&& |
|
|
|
r.fromLocationCode == balance.locationCode) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
if (item == undefined) { |
|
|
|
var itemp = createItemInfo(balance, pack); |
|
|
|
//查询推荐的目标库位 |
|
|
|
getRecommendLocation(balance, res => { |
|
|
|
itemp.toLocationCode = res.code; |
|
|
|
itemp.expectinNumber = res.expectinNumber; |
|
|
|
}) |
|
|
|
let newDetail = createDetailInfo(balance, pack); // |
|
|
|
newDetail.fromInventoryStatus = balance.inventoryStatus; |
|
|
|
itemp.subList.push(newDetail); |
|
|
|
detailSource.value.push(itemp) |
|
|
|
if (checkData) { |
|
|
|
//提示已经扫描 |
|
|
|
showErrorMessage("扫描箱码[" + pack.number + "]批次[" + balance.batch + |
|
|
|
"]的父包装已经扫描") |
|
|
|
} 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; |
|
|
|
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); |
|
|
|
} |
|
|
|
}else { |
|
|
|
//扫描的是父包装 |
|
|
|
let checkData = item.subList.find(r => { |
|
|
|
if (r.parentNumber == pack.number && |
|
|
|
r.batch == balance.batch&& |
|
|
|
r.fromLocationCode == balance.locationCode) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
if(checkData){ |
|
|
|
//是否移除 |
|
|
|
comMessageRef.value.showQuestionMessage("箱码[" + checkData.parentNumber+"]" + "批次[" + balance |
|
|
|
.batch + "]是父包装,是否移除子包装", res => { |
|
|
|
if (res) { |
|
|
|
item.subList = []; |
|
|
|
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); |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
} |
|
|
|
}) |
|
|
|
if (detail == undefined) { |
|
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
|
newDetail.fromInventoryStatus = balance.inventoryStatus; |
|
|
|
item.subList.push(newDetail); |
|
|
|
} else { |
|
|
|
if (detail.scaned == true) { |
|
|
|
showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + |
|
|
|
"]已经在列表中") |
|
|
|
} |
|
|
|
}else { |
|
|
|
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 |
|
|
|
} |
|
|
|
item.subList.push(newDetail); |
|
|
|
} |
|
|
|
handleCalcHandleQty(); |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
const getRecommendLocation = (balance, callback)=> { |
|
|
|
scanPopupGetFocus() |
|
|
|
} else { |
|
|
|
if (detail.scaned == true) { |
|
|
|
detail.handleQty = calc.add(detail.handleQty,result.label.qty) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const getRecommendLocation = async (balance, result)=> { |
|
|
|
uni.showLoading({ |
|
|
|
title: '扫描中...', |
|
|
|
mask: true |
|
|
@ -175,17 +250,116 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
expectinNumber: balance.packingNumber + "-" + Date.now(), |
|
|
|
itemCode: balance.itemCode, |
|
|
|
inventoryStatus: balance.inventoryStatus, |
|
|
|
batch: balance.batch |
|
|
|
}; |
|
|
|
console.log(JSON.stringify(param)) |
|
|
|
getrecommendLocationExpectin(param).then(res => { |
|
|
|
callback(res.data); |
|
|
|
await getrecommendLocationExpectin(param).then(async result1 => { |
|
|
|
uni.hideLoading(); |
|
|
|
let item = detailSource.value.find(res => { |
|
|
|
if (res.itemCode == balance.itemCode) { |
|
|
|
return res |
|
|
|
} |
|
|
|
}) |
|
|
|
item.toLocationCode = result1.data.code; |
|
|
|
item.expectinNumber = result1.data.expectinNumber; |
|
|
|
getToLocationBalance(item.toLocationCode,result) |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
showErrorMessage(error); |
|
|
|
}) |
|
|
|
} |
|
|
|
const getRecommendLocation = async (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 = detailSource.value.find(res => { |
|
|
|
if (res.itemCode == balance.itemCode) { |
|
|
|
return res |
|
|
|
} |
|
|
|
}) |
|
|
|
item.toLocationCode = result1.data.code; |
|
|
|
item.expectinNumber = result1.data.expectinNumber; |
|
|
|
await getToLocationBalance(item.toLocationCode,result) |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
showErrorMessage(error); |
|
|
|
}) |
|
|
|
} |
|
|
|
//查询到目标库位的库存余额 |
|
|
|
const getToLocationBalance = async (toLocationCode,result)=> { |
|
|
|
uni.showLoading({ |
|
|
|
title: '查询中', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
let filters = [] |
|
|
|
if (result.package.parentNumber) { |
|
|
|
let 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: toLocationAreaTypeList.value.join(',') |
|
|
|
}) |
|
|
|
|
|
|
|
const params = { |
|
|
|
filters: filters, |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 100, |
|
|
|
} |
|
|
|
await getManagementPrecisions([result.package.itemCode], toLocationCode,async res => { |
|
|
|
if (res.success) { |
|
|
|
managementList.value = res.list; |
|
|
|
managementType.value = managementList.value.some(item => item.ManagementPrecision == 'BY_BATCH') ? 'BY_BATCH' : '' |
|
|
|
if(managementType.value == 'BY_BATCH'){ |
|
|
|
uni.hideLoading() |
|
|
|
}else{ |
|
|
|
await getBalanceByFilter(params).then(res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data.list.length > 0) { |
|
|
|
showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额"); |
|
|
|
} |
|
|
|
// callback(res.data) |
|
|
|
}).catch(err => { |
|
|
|
showErrorMessage(err.message); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
//移除推荐的预占用库位 |
|
|
|
const removeRecommendLocation = ()=> { |
|
|
|
let param = { |
|
|
@ -225,9 +399,12 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
} |
|
|
|
|
|
|
|
const openScanPopup = () => { |
|
|
|
setTimeout(r => { |
|
|
|
scanPopup.value.openScanPopupByBusinessType(businessType.value) |
|
|
|
}) |
|
|
|
if (this.businessType) { |
|
|
|
toLocationAreaTypeList.value = getDirectoryItemArray(businessType.value.inAreaTypes) |
|
|
|
scanPopup.value.openScanPopupByBusinessType(businessType.value) |
|
|
|
} else { |
|
|
|
getBusinessType() |
|
|
|
} |
|
|
|
} |
|
|
|
const showFromLocationPopup = () => { |
|
|
|
nextTick(() => { |
|
|
@ -279,7 +456,7 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
.then((res) => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data) { |
|
|
|
showCommitSuccessMessage(`提交成功<br>生成制品上架记录<br>${res.data}`) |
|
|
|
showCommitSuccessMessage(`提交成功\n生成制品上架记录\n${res.data}`) |
|
|
|
let removeId = []; |
|
|
|
detailSource.value.forEach(r => { |
|
|
|
removeId.push(r.expectinNumber) |
|
|
@ -330,7 +507,6 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
item.subList.forEach((detail) => { |
|
|
|
if (detail.scaned) { |
|
|
|
const submitItem = deepCopyData(detail) |
|
|
|
// const info = getPackingNumberAndBatchByList(managementList.value, detail.itemCode, detail.packingNumber, detail.toLocationCode, detail.batch) |
|
|
|
submitItem.itemCode = detail.itemCode |
|
|
|
submitItem.itemName = detail.package.itemName |
|
|
|
submitItem.itemDesc1 = detail.package.itemDesc1 |
|
|
@ -338,9 +514,6 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
|
|
|
|
submitItem.inventoryStatus = detail.inventoryStatus |
|
|
|
|
|
|
|
// submitItem.fromPackingNumber = info.packingNumber |
|
|
|
// submitItem.toPackingNumber = info.packingNumber |
|
|
|
|
|
|
|
submitItem.fromPackingNumber = detail.packingNumber; |
|
|
|
submitItem.toPackingNumber = detail.packingNumber; |
|
|
|
|
|
|
@ -349,7 +522,7 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
|
|
|
|
// submitItem.fromBatch = info.batch |
|
|
|
// submitItem.toBatch = info.batch |
|
|
|
|
|
|
|
submitItem.fromParentPackingNumber = detail.parentNumber; |
|
|
|
submitItem.fromBatch = detail.package.batch; |
|
|
|
submitItem.toBatch = detail.package.batch; |
|
|
|
|
|
|
@ -375,9 +548,9 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
}) |
|
|
|
} |
|
|
|
const showErrorMessage = (message) => { |
|
|
|
scanPopupLoseFocus() |
|
|
|
comMessageRef.value.showErrorMessage(message, (res) => { |
|
|
|
if (res) { |
|
|
|
} |
|
|
|
scanPopupGetFocus() |
|
|
|
}) |
|
|
|
} |
|
|
|
const showScanMessage = (message) => { |
|
|
@ -431,9 +604,14 @@ import {ref, getCurrentInstance, nextTick, onMounted} from 'vue' |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const scanPopupLoseFocus = ()=> { |
|
|
|
if (scanPopup.value) { |
|
|
|
scanPopup.value.losefocus(); |
|
|
|
} |
|
|
|
} |
|
|
|
const cancel = () => { |
|
|
|
this.clearData(); |
|
|
|
this.openScanPopup(); |
|
|
|
clearData(); |
|
|
|
openScanPopup(); |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|