Browse Source

page/putaway/job 文件迁移 8/8-10/25

hella_vue3
王志国 4 weeks ago
parent
commit
5df309e342
  1. 248
      src/pages/putaway/job/putawayDetail.vue
  2. 19
      src/pages/putaway/job/putawayJob.vue
  3. 517
      src/pages/putaway/job/quantityPutawayJob.vue
  4. 508
      src/pages/putaway/job/quantityPutawayJobDetail.vue

248
src/pages/putaway/job/putawayDetail.vue

@ -13,7 +13,16 @@
<scroll-view scroll-y="true" class="page-main-scroll"> <scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> <view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class=""> <view class="">
<comJobDetailCard :dataContent="item" :index="index" :settingParam="jobContent" :isShowStatus="false" @remove="updateData" @updateData="updateData" :locationAreaTypeList="toLocationAreaTypeList"> </comJobDetailCard> <!-- 物料按照批次的组件 批次不显示包装 -->
<comJobDetailCardBatch :dataContent="item" :index="index" :settingParam="jobContent" :isShowStatus="true"
@remove="updateData" @updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList'
:isShowPackListStatus="false" v-if="managementType == 'BY_BATCH'">
</comJobDetailCardBatch>
<!-- 物料按照包装的组件 -->
<comJobDetailCard :dataContent="item" :index="index" :settingParam="jobContent" :isShowStatus="true"
@remove="updateData" @updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList'
:isShowPackListStatus="false" v-else>
</comJobDetailCard>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@ -32,7 +41,9 @@
<win-scan-button @goScan="openScanPopup"></win-scan-button> <win-scan-button @goScan="openScanPopup"></win-scan-button>
<!-- <winScanPackAndLocationNoBalance ref="scanPopup" @getResult="getScanResult" :allowNullBalance="true"> </winScanPackAndLocationNoBalance> --> <!-- <winScanPackAndLocationNoBalance ref="scanPopup" @getResult="getScanResult" :allowNullBalance="true"> </winScanPackAndLocationNoBalance> -->
<winScanPackAndLocation :balanceFromInventoryStatuses="false" ref="scanPopup" @getResult="getScanResult" :noShowBalanceMessage="true"></winScanPackAndLocation> <winScanPackAndLocation :balanceFromInventoryStatuses="false" :toLocationCode="jobToLocationCode" ref="scanPopup"
@getResult='getScanResult' :noShowBalanceMessage="false">
</winScanPackAndLocation>
<com-message ref="comMessageRef" /> <com-message ref="comMessageRef" />
</view> </view>
</template> </template>
@ -54,6 +65,7 @@ import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.v
import comJobDetailCard from '@/mycomponents/detail/comJobDetailCard.vue' import comJobDetailCard from '@/mycomponents/detail/comJobDetailCard.vue'
import locationCompare from '@/mycomponents/location/locationCompare.vue' import locationCompare from '@/mycomponents/location/locationCompare.vue'
import jobTop from '@/mycomponents/job/jobTop.vue' import jobTop from '@/mycomponents/job/jobTop.vue'
import comJobDetailCardBatch from "@/mycomponents/detail/comJobDetailCardBatch.vue"
import { useCountStore } from '@/store' import { useCountStore } from '@/store'
// store // store
@ -65,6 +77,7 @@ const jobContent = ref({}) // 任务内容
const subList = ref([]) // subList const subList = ref([]) // subList
const detailSource = ref([]) // const detailSource = ref([]) //
const managementList = ref([]) const managementList = ref([])
const managementType = ref('')
const fromLocationCode = ref('') const fromLocationCode = ref('')
const toLocationCode = ref('') const toLocationCode = ref('')
const toLocationAreaTypeList = ref([]) const toLocationAreaTypeList = ref([])
@ -145,9 +158,12 @@ const getDetail = () => {
} else if (res.data.subList.length > 0) { } else if (res.data.subList.length > 0) {
jobContent.value = res.data jobContent.value = res.data
jobStatus.value = res.data.status jobStatus.value = res.data.status
//
res.data.subList.forEach(item => {
item.inventoryStatus = item.inspectResult
})
subList.value = res.data.subList subList.value = res.data.subList
detailSource.value = getTreeDataSource(subList.value) detailSource.value = getTreeDataSource(subList.value)
fromLocationCode.value = subList.value[0].fromLocationCode fromLocationCode.value = subList.value[0].fromLocationCode
jobToLocationCode.value = subList.value[0].toLocationCode jobToLocationCode.value = subList.value[0].toLocationCode
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes) toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes)
@ -157,6 +173,19 @@ const getDetail = () => {
} else { } else {
toLocationCode.value = jobToLocationCode.value toLocationCode.value = jobToLocationCode.value
} }
//
let itemCodes = []
detailSource.value.forEach(item => {
itemCodes.push(item.itemCode)
item.scaned = false
})
getManagementPrecisions(itemCodes, that.jobToLocationCode, res => {
if (res.success) {
managementList.value = res.list;
managementType.value = managementList.value.some(item => item.ManagementPrecision ==
'BY_BATCH') ? 'BY_BATCH' : ''
}
})
// //
if (scanMessage.value) { if (scanMessage.value) {
openScanPopupSimulate(scanMessage.value) openScanPopupSimulate(scanMessage.value)
@ -197,7 +226,7 @@ const continueScan = () => {
} }
} }
const updateData = () => { const updateData = () => {
calcTreeHandleQty(detailSource.value) // calcTreeHandleQty(detailSource.value)
} }
// //
const openScanPopupSimulate = (message) => { const openScanPopupSimulate = (message) => {
@ -255,8 +284,9 @@ const openScanPopup = () => {
const closeScanPopup = () => { const closeScanPopup = () => {
scanPopup.value.closeScanPopup() scanPopup.value.closeScanPopup()
} }
const getScanResult = (result) => { const getScanResult = (result,managementPrecision) => {
try { try {
managementType.value = managementPrecision
const { packingNumber } = result.label const { packingNumber } = result.label
const { batch } = result.label const { batch } = result.label
const { qty } = result.label const { qty } = result.label
@ -272,70 +302,158 @@ const getScanResult = (result) => {
if (detail == undefined) { if (detail == undefined) {
showErrorMessage(`物料号【${itemCode}】不在列表中`) showErrorMessage(`物料号【${itemCode}】不在列表中`)
} else { } else {
const itemDetail = detail.subList.find((r) => { detail.scaned = true
return r.packingNumber == packingNumber && r.batch == batch && r.fromLocationCode == result.fromLocationCode if (managementType.value == 'BY_BATCH') {
}) verificationBatch(detail, packingNumber, batch, qty, itemCode, locationCode, result)
}else {
if (itemDetail == undefined) { const itemDetail = detail.subList.find((r) => {
let isExit return r.packingNumber == packingNumber && r.batch == batch && r.fromLocationCode == result.fromLocationCode
for (const subItem of detail.subList) { })
var item if (itemDetail == undefined) {
for (const pack of subItem.packList) { let isExit
if (pack.packingNumber == packingNumber && pack.batch == batch) { for (const subItem of detail.subList) {
item = pack let item
isExit = pack for (const pack of subItem.packList) {
break if (pack.packingNumber == packingNumber && pack.batch == batch) {
item = pack
isExit = pack
break
}
}
if (item != undefined) {
subItem.scaned = true
subItem.handleQty = 0
item = undefined
} }
} }
if (item != undefined) { if (isExit == undefined) {
subItem.scaned = true showErrorMessage(`箱码【${packingNumber}】,批次【${batch}】库位【${result.fromLocationCode}】不在列表中`)
subItem.handleQty = 0 } else if (!isExit.cancleScanedHiht && isExit.scaned) {
item = undefined showMessage(`箱码【${packingNumber}】已经扫描`)
}
}
if (isExit == undefined) {
showErrorMessage(`箱码【${packingNumber}】,批次【${batch}】库位【${result.fromLocationCode}】不在列表中`)
} else if (!isExit.cancleScanedHiht && isExit.scaned) {
showMessage(`箱码【${packingNumber}】已经扫描`)
} else {
isExit.scaned = true
let qty = 0
if (result.balance != null) {
qty = Number(result.balance.qty)
} else { } else {
qty = Number(result.label.qty) isExit.scaned = true
let qty = 0
if (result.balance != null) {
qty = Number(result.balance.qty)
} else {
qty = Number(result.label.qty)
}
isExit.handleQty = Number(result.label.qty)
isExit.toLocationCode = toLocationCode.value
} }
isExit.handleQty = Number(result.label.qty) calcTreeHandleQty(detailSource.value)
isExit.toLocationCode = toLocationCode.value continueScan()
} }
calcTreeHandleQty(detailSource.value) else {
} else { let scanedLength = 0
let scanedLength = 0 itemDetail.packList.forEach((res) => {
itemDetail.packList.forEach((res) => { if (res.scaned) {
if (res.scaned) { scanedLength++
scanedLength++ }
})
itemDetail.fromInventoryStatus = result.balance.inventoryStatus
if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList.length) {
showMessage(`箱码【${packingNumber}】已经扫描`)
} }
else {
itemDetail.scaned = true
detailSource.value[0].subList.sort(compareAsc('scaned')) //
itemDetail.handleQty = result.label.qty
// itemDetail.toInventoryStatus = 'OK'
itemDetail.packList.forEach((pac) => {
pac.scaned = true
pac.handleQty = Number(pac.qty)
pac.toLocationCode = toLocationCode.value
})
calcTreeHandleQty(detailSource.value)
continueScan()
}
}
}
}
if (managementType.value == 'BY_BATCH') {
detailSource.value.forEach(item => {
item.subList.forEach(detail => {
detail.packingNumber = ''
}) })
itemDetail.fromInventoryStatus = result.balance.inventoryStatus })
if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList.length) { }
showMessage(`箱码【${packingNumber}】已经扫描`) } catch (e) {
showMessage(e.message)
}
}
//
const verificationBatch = (detail,packingNumber,batch,qty,itemCode,locationCode,result)=>{
let itemDetail = detail.subList.find(r => {
return r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail == undefined) {
let isExit;
for (let subItem of detail.subList) {
let item;
for (let pack of subItem.packList) {
if (pack.batch == batch) {
item = pack;
isExit = pack;
break;
}
}
if (item != undefined) {
subItem.scaned = true
subItem.handleQty = 0;
item = undefined
}
}
if (isExit == undefined) {
showErrorMessage("批次【" + batch + "】库位【" + result
.fromLocationCode + "】不在列表中")
} else {
if (!isExit.cancleScanedHiht && isExit.scaned) {
showMessage("批次【" + batch + "】已经扫描")
} else {
isExit.scaned = true
let qty = 0;
if (result.balance != null) {
qty = Number(result.balance.qty);
} else { } else {
itemDetail.scaned = true qty = Number(result.label.qty);
detailSource.value[0].subList.sort(compareAsc('scaned')) //
itemDetail.handleQty = result.label.qty
// itemDetail.toInventoryStatus = 'OK'
itemDetail.packList.forEach((pac) => {
pac.scaned = true
pac.handleQty = Number(pac.qty)
pac.toLocationCode = toLocationCode.value
})
calcTreeHandleQty(detailSource.value)
continueScan()
} }
isExit.handleQty = Number(result.label.qty);
isExit.toLocationCode = this.toLocationCode;
} }
} }
} catch (e) { calcTreeHandleQty(this.detailSource);
// showMessage(e.message) continueScan()
} else {
let scanedLength = 0;
itemDetail.packList.forEach(res => {
if (res.scaned) {
scanedLength++;
}
})
//
itemDetail.fromInventoryStatus = result.balance.inventoryStatus;
if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength == itemDetail.packList
.length) {
// this.showMessage("" + packingNumber + "")
showMessage("批次【" + batch + "】已经扫描")
} else {
itemDetail.scaned = true;
detailSource.value[0].subList.sort(compareAsc('scaned')); //
itemDetail.handleQty = result.label.qty;
// itemDetail.toInventoryStatus = "OK"
itemDetail.packList.forEach(pac => {
pac.scaned = true
pac.handleQty = Number(pac.qty);
pac.toLocationCode = toLocationCode.value;
})
calcTreeHandleQty(this.detailSource);
continueScan()
}
} }
} }
const scanLocationCode = (location, code) => { const scanLocationCode = (location, code) => {
@ -384,12 +502,16 @@ const commit = () => {
// //
if (jobContent.value.allowPartialComplete == 'TRUE') { if (jobContent.value.allowPartialComplete == 'TRUE') {
// //
submitJob() comMessageRef.value.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', res => {
if (res) {
submitJob()
}
});
} else { } else {
// //
comMessageRef.value.showErrorMessage('请完成扫描后,再进行提交<br>' + `已经扫描[${scanCount.value}]箱总共[${subList.value.length}]箱`, (res) => { comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
if (res) { if (res) {
openScanPopup() openScanPopup();
} }
}) })
} }
@ -412,7 +534,7 @@ const submitJob = () => {
.then((res) => { .then((res) => {
uni.hideLoading() uni.hideLoading()
if (res.data) { if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成采购上架记录<br>${res.data}`) showCommitSuccessMessage(`提交成功\n生成采购上架记录\n${res.data}`)
} else { } else {
showErrorMessage(`提交失败[${res.msg}]`) showErrorMessage(`提交失败[${res.msg}]`)
} }
@ -435,6 +557,8 @@ const setParams = () => {
if (detail.scaned) { if (detail.scaned) {
const info = getPackingNumberAndBatch(managementList.value, detail.itemCode, detail.packingNumber, detail.batch) const info = getPackingNumberAndBatch(managementList.value, detail.itemCode, detail.packingNumber, detail.batch)
detail.toPackingNumber = info.packingNumber detail.toPackingNumber = info.packingNumber
detail.packingNumber = info.packingNumber;
detail.fromPackingNumber = info.packingNumber;
detail.toBatch = info.batch detail.toBatch = info.batch
detail.toContainerNumber = '' detail.toContainerNumber = ''

19
src/pages/putaway/job/putawayJob.vue

@ -26,7 +26,6 @@ import { getPutawayJobList, cancleTakePutawayJob } from '@/api/request2.js'
import { goHome, updateTitle } from '@/common/basic.js' import { goHome, updateTitle } from '@/common/basic.js'
import { getDetailOption, getDetailGiveupOption } from '@/common/array.js' import { getDetailOption, getDetailGiveupOption } from '@/common/array.js'
import {Exception} from 'sass';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue' import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comPutawayJobCard from '@/pages/putaway/coms/comPutawayJobCard.vue' import comPutawayJobCard from '@/pages/putaway/coms/comPutawayJobCard.vue'
@ -264,8 +263,14 @@ const getDataListByType = (code) => {
} }
const showMessage = (message) => { const showMessage = (message) => {
if(scanPopup.value){
scanPopup.value.packLoseFocus()
}
comMessageRef.value.showErrorMessage(message, (res) => { comMessageRef.value.showErrorMessage(message, (res) => {
if (res) { if (res) {
if(scanPopup.value){
scanPopup.value.packGetFocus()
}
} }
}) })
} }
@ -348,23 +353,23 @@ const getScanResult = (result) => {
if (list[0].acceptUserId == store.id) { if (list[0].acceptUserId == store.id) {
selectItem(list[0]) selectItem(list[0])
} else { } else {
showMessage(`该任务已经被[${list[0].acceptUserName}]承接` + `<br>任务号[${list[0].number}]扫描[${result.scanMessage}]`) showMessage(`该任务已经被[${list[0].acceptUserName}]承接` + `\n任务号[${list[0].number}]扫描[${result.scanMessage}]`)
} }
} else if (list[0].status == 3) { } else if (list[0].status == 3) {
showMessage(`该任务已经完成<br>承接人[${list[0].acceptUserName}]<br>任务号[${list[0].number}]扫描[${result.scanMessage}]`) showMessage(`该任务已经完成\n承接人[${list[0].acceptUserName}]\n任务号[${list[0].number}]扫描[${result.scanMessage}]`)
} }
} else { } else {
showMessage('查询到多条任务<br>' + `扫描[${result.scanMessage}]`) showMessage('查询到多条任务\n' + `扫描[${result.scanMessage}]`)
} }
} else { } else {
showMessage('未查找到任务<br>' + `扫描[${result.scanMessage}]`) showMessage('未查找到任务\n' + `扫描[${result.scanMessage}]`)
} }
}) })
.catch((error) => { .catch((error) => {
showMessage(`${error}<br>扫描[${result.scanMessage}]`) showMessage(`${error}\n扫描[${result.scanMessage}]`)
}) })
} catch (e) { } catch (e) {
showMessage(`${e}<br>扫描[${result.scanMessage}]`) showMessage(`${e}\n扫描[${result.scanMessage}]`)
} }
} }
</script> </script>

517
src/pages/putaway/job/quantityPutawayJob.vue

@ -0,0 +1,517 @@
<template>
<view class="">
<view class="" v-if="jobList.length>0"
style="background: white;padding: 20rpx;position: fixed;width: 100%;box-shadow: 0px 0px 10px 10px rgba(1, 1, 1, 0.05);z-index: 22; ">
<uni-pagination :total="totalCount" title="每页30" :pageSize='pageSize' @change="changePage"
:current="pageNo"/>
<view class="uni-flex uni-row">
<view class="uni-flex uni-row">
<view class="">
<u-checkbox size="40" v-model="checkAll" @change="checkAllItems">
</u-checkbox>
</view>
<view>
<text
style="margin-left: 2rpx; font-size: 32rpx;font-weight: bold;">当前页({{ jobList.length }})
</text>
</view>
</view>
<view class=""
style=" margin-left: 10rpx; font-size: 32rpx; align-items: center; text-align: center;">
{{ pageNo }}每页/{{ pageSize }}, :{{ totalCount }}
</view>
</view>
</view>
<com-empty-view v-if="jobList.length==0"></com-empty-view>
<job-filter ref="filter" otherTitle="ASN" :isShowToAreaCode="true" :isShowQurery='true' :isShowStatus='false'
:isShowToLocationCode="true" :isShowItemCode="true" @onQuery="getListByFilter">
</job-filter>
<view v-if="jobList.length>0" style="padding-bottom: 100rpx;padding-top: 150rpx;">
<view class="" style="padding-left: 60rpx; padding-top: 10rpx; padding-bottom: 10rpx; background-color:#D3D1CC">
<locationCompare ref='comScanLocation' title="目标库位"
:recommendLocationCode="toSubmitLocationCode" @getLocation='scanLocationCode'
:isShowEdit="true"
:locationAreaTypeList="toLocationAreaTypeList"></locationCompare>
</view>
<uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in jobList" :key="index">
<uni-swipe-action-item :right-options="item.status=='2'?detailGiveupOptions:detailOptions"
@click="swipeClick($event,item)">
<view class="flex" style="flex-direction: row; align-items: center;">
<view class="uni-flex" style="flex-direction: column; align-items: center;">
<text style="margin-bottom: 10rpx;">({{ index + 1 }})</text>
<u-checkbox v-model="item.checked" :name="item.id" size="50" shape="circle">
</u-checkbox>
</view>
<view class="" style="width: 100%;">
<com-putaway-job-card :dataContent="item"
@click='checkedItem(item)'></com-putaway-job-card>
</view>
</view>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
<putaway-info-popup ref='jobInfoPopup'></putaway-info-popup>
<putaway-job-list-popup ref="jobListPopup" @selectedItem="selectedItem"></putaway-job-list-popup>
<!-- <uni-load-more :status="loadingType" v-if="jobList.length>0" /> -->
</view>
<jobList ref="jobList" @selectItem="selectItem"></jobList>
<view class="footer" v-if="jobList.length>0">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="takeAllJob">执行当前已选择项</button>
</view>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script setup lang="ts">
import jobList from '@/mycomponents/jobList/jobList.vue'
import {
getPutawayJobList,
cancleTakePutawayJob,
putawayJobAllExecute,
takeAllPutawayJob,
cancleAllTakePutawayJob
} from '@/api/request2.js';
import {
getDirectoryItemArray,
} from '@/common/directory.js';
import {
goHome,
updateTitle
} from '@/common/basic.js';
import {
getDetailOption,
getDetailGiveupOption
} from '@/common/array.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comPutawayJobCard from '@/pages/putaway/coms/comPutawayJobCard.vue'
import putawayJobListPopup from '@/pages/putaway/coms/putawayJobListPopup.vue'
import putawayInfoPopup from '@/pages/putaway/coms/putawayInfoPopup.vue'
import winScanPackJob from "@/mycomponents/scan/winScanPackJob.vue"
import comCheckAll from "@/mycomponents/button/comCheckAll.vue"
import locationCompare from '@/mycomponents/location/locationCompare.vue'
import {
Exception
} from 'sass';
import {ref, onMounted, onBeforeUnmount} from 'vue';
import {onLoad, onShow, onReady, onBackPress, onNavigationBarButtonTap, onPullDownRefresh} from '@dcloudio/uni-app';
//
const jobList = ref([]);
const pageNo = ref(1);
const currentPageNo = ref(1);
const pageSize = ref(30);
const totalCount = ref(0);
const loadingType = ref("nomore");
const checkedToday = ref(false);
const checkedWaitTask = ref(false);
const todayTime = ref("");
const status = ref('1'); //
const detailOptions = ref([]);
const detailGiveupOptions = ref([]);
const title = ref('');
const scanMessage = ref("");
const jobNumberList = ref([]); //
const creationTime = ref("");
const itemCode = ref("");
const toAreaCode = ref("");
const toLocationCode = ref("");
const checkAll = ref(false);
const toSubmitLocationCode = ref("");
const toLocationAreaTypeList = ref([]);
const filter = ref(null)
const scanList = ref(null)
const jobInfoPopup = ref(null)
const comMessage = ref(null)
const scanPopup = ref(null)
const comScanLocation = ref(null)
//
onLoad((option) => {
title.value = option.title;
});
onShow(() => {
getList('refresh');
});
onReady(() => {
detailOptions.value = getDetailOption();
detailGiveupOptions.value = getDetailGiveupOption();
});
onBackPress((options) => {
if (options.from === 'navigateBack') {
uni.navigateBack({
delta: 1
});
return false;
}
});
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome();
} else if (e.index == 1) {
filter.value.openFilter();
}
});
// onReachBottom(() => {
// //
// if (loadingType.value == 'loading' || loadingType.value == 'nomore') {
// return;
// }
// getList("more");
// });
onPullDownRefresh(() => {
getList('refresh');
});
//
const getList = (type) => {
uni.showLoading({
title: "加载中­....",
mask: true
});
loadingType.value = "loading";
if (type === "refresh") {
pageNo.value = 1;
jobList.value = [];
}
const queryFiltersParams = setQueryParam();
const params = {
filters: queryFiltersParams,
pageNo: pageNo.value,
pageSize: pageSize.value,
};
currentPageNo.value = pageNo.value;
getPutawayJobList(params).then((res) => {
uni.hideLoading();
if (type === "refresh") {
uni.stopPullDownRefresh();
}
const list = res.data.list;
list.forEach((item) => {
item.checked = false;
});
checkAll.value = false;
totalCount.value = res.data.total;
updateTitle(title.value + "(" + totalCount.value + ")");
jobList.value = list;
if (jobList.value.length > 0) {
toLocationAreaTypeList.value = getDirectoryItemArray(jobList.value[0].toAreaTypes);
}
toSubmitLocationCode.value = "";
// pageNo.value++;
}).catch((error) => {
if (type === "refresh") {
uni.stopPullDownRefresh();
}
loadingType.value = "";
updateTitle(title.value);
uni.hideLoading();
showMessage(error);
});
};
const openJobDetail = (item) => {
uni.navigateTo({
url: './putawayDetail?id=' + item.masterId + '&status=' + item.status + '&title=' + title.value
});
scanMessage.value = "";
};
const setQueryParam = () => {
const filterParams = [];
const queryParams = {
status: status.value,
creationTime: creationTime.value,
itemCode: itemCode.value,
toAreaCode: toAreaCode.value,
toLocationCode: toLocationCode.value
};
if (queryParams.creationTime) {
filterParams.push({
column: "create_time",
action: "between",
value: queryParams.creationTime
});
}
if (queryParams.status) {
filterParams.push({
column: "status",
action: "in",
value: queryParams.status
});
}
if (queryParams.itemCode) {
filterParams.push({
column: "itemCode",
action: "like",
value: queryParams.itemCode
});
}
if (queryParams.toAreaCode) {
filterParams.push({
column: "toAreaCode",
action: "==",
value: queryParams.toAreaCode
});
}
if (queryParams.toLocationCode) {
filterParams.push({
column: "toLocationCode",
action: "==",
value: queryParams.toLocationCode
});
}
return filterParams;
};
const showItemList = (itemList) => {
scanList.value.openPopup(itemList);
};
const selectedItem = (item) => {
openJobDetail(item);
};
const swipeClick = (e, dataContent) => {
if (e.content.text === "详情") {
openjobInfoPopup(dataContent);
} else if (e.content.text === "放弃") {
comMessage.value.showQuestionMessage("确定要放弃当前任务?", (res) => {
if (res) {
cancleJob(dataContent.masterId);
}
});
}
};
const openjobInfoPopup = (item) => {
jobInfoPopup.value.openPopup(item);
};
const cancleJob = (id) => {
cancleTakePutawayJob(id).then((res) => {
if (res.data) {
getList("refresh");
uni.showToast({
title: "放弃任务成功"
});
} else {
showMessage("放弃任务失败");
}
}).catch((error) => {
showMessage(error);
});
};
const showMessage = (message) => {
if (comMessage.value) {
comMessage.value.packLoseFocus();
}
comMessage.value.showErrorMessage(message, (res) => {
if (res) {
if (comMessage.value) {
comMessage.value.packGetFocus();
}
}
});
};
const openScanPopup = () => {
scanPopup.value.openScanPopup();
};
const selectItem = (item) => {
scanPopup.value.closeScanPopup();
uni.navigateTo({
url: './putawayDetail?id=' +
item.masterId +
'&status=' + item.status +
'&scaned=' + item.packingNumber +
'&title=' + title.value +
"&scanMessage=" + scanMessage.value
});
scanMessage.value = "";
};
const getListByFilter = (params) => {
console.log('getListByFilter', params);
uni.showLoading({
title: "加载中­....",
mask: true
});
creationTime.value = params.creationTime;
itemCode.value = params.itemCode;
toAreaCode.value = params.toAreaCode;
toLocationCode.value = params.toLocationCode;
getList('refresh');
};
const takeAllJob = () => {
if (!toSubmitLocationCode.value) {
comMessage.value.showQuestionMessage("是否要修改目标库位?", (res) => {
if (res) {
comScanLocation.value.showLocation();
} else {
submitJob();
}
});
} else {
submitJob();
}
};
const submitJob = () => {
jobNumberList.value = [];
jobList.value.forEach((item) => {
if (item.checked) {
jobNumberList.value.push(item.number);
}
});
if (jobNumberList.value.length === 0) {
showMessage("最少选择一条数据");
return;
}
uni.showLoading({
title: "加载中­....",
mask: true
});
takeAllPutawayJob({
jobNumberList: jobNumberList.value
}).then((res) => {
if (res.data) {
executeAllJob();
} else {
uni.hideLoading();
showMessage("承接任务失败");
}
}).catch((error) => {
uni.hideLoading();
showMessage(error);
});
};
const executeAllJob = () => {
const params = {
toLocationCode: toSubmitLocationCode.value,
jobNumberList: jobNumberList.value
};
putawayJobAllExecute(params).then((res) => {
if (res.data) {
uni.hideLoading();
comMessage.value.showSuccessMessage("执行任务成功", (res) => {
if (res) {
getList('refresh');
}
});
} else {
uni.hideLoading();
showMessage("执行任务失败");
cancleAllJob();
}
}).catch((error) => {
uni.hideLoading();
showMessage(error);
cancleAllJob();
});
};
const cancleAllJob = () => {
cancleAllTakePutawayJob({
jobNumberList: jobNumberList.value
}).then(() => {
}).catch((error) => {
uni.hideLoading();
showMessage(error);
});
};
const changePage = (e) => {
console.log(e);
pageNo.value = e.current;
status.value = 1;
getList();
};
const checkAllItems = (checkAll) => {
if (checkAll.value) {
jobList.value.forEach((res) => {
res.checked = true;
});
} else {
jobList.value.forEach((res) => {
res.checked = false;
});
}
};
const cancleAll = () => {
jobList.value.forEach((res) => {
res.checked = false;
});
};
const checkedItem = (item) => {
item.checked = !item.checked;
};
const scanLocationCode = (location, code) => {
toSubmitLocationCode.value = code;
};
</script>
<style scoped lang="scss">
.footer {
position: fixed;
bottom: 0px;
background: white;
width: 100%;
padding: 16rpx 20rpx;
box-shadow: 0px 0px 20rpx 20rpx rgba(0, 0, 0, 0.05);
button {
width: 100%;
}
}
</style>

508
src/pages/putaway/job/quantityPutawayJobDetail.vue

@ -0,0 +1,508 @@
<template>
<view class="page-wraper">
<view class="page-header">
<view class="header-view">
<view class="header_job_top">
<job-top :dataContent="jobContent"></job-top>
</view>
<view class="header_item">
申请单号 : {{ jobContent.requestNumber }}
</view>
</view>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<comJobDetailCard :dataContent="item" :index="index" :settingParam="jobContent"
:isShowStatus="false" @remove="updateData" @updateData="updateData"
:locationAreaTypeList='toLocationAreaTypeList'>
</comJobDetailCard>
</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="">
<locationCompare ref='comScanLocation' title="目标库位" :recommendLocationCode="jobToLocationCode"
:locationCode="toLocationCode" @getLocation='scanLocationCode' :isShowEdit="isCheckLocation"
:locationAreaTypeList="toLocationAreaTypeList"></locationCompare>
</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>
<!-- <winScanPackAndLocationNoBalance ref="scanPopup" @getResult='getScanResult' :allowNullBalance="true">
</winScanPackAndLocationNoBalance> -->
<winScanPackAndLocation :balanceFromInventoryStatuses="false" ref="scanPopup" @getResult='getScanResult'
:noShowBalanceMessage="true">
</winScanPackAndLocation>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script setup lang="ts">
import {
getManagementPrecisions,
} from '@/common/balance.js';
import {
getPutawayJobDetail,
putawayJobSubmit,
takePutawayJob,
cancleTakePutawayJob,
getSwitchByCode
} from '@/api/request2.js';
import {
goHome,
getCurrDateTime,
getPackingNumberAndBatch,
navigateBack,
compareAsc,
getSwitchInfoByCode
} from '@/common/basic.js';
import {
getDirectoryItemArray,
getInventoryStatusName
} from '@/common/directory.js';
import {
getTreeDataSource,
calcHandleQty,
calcTreeHandleQty,
getScanCount
} from '@/common/detail.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import comJobDetailCard from "@/mycomponents/detail/comJobDetailCard.vue"
import locationCompare from '@/mycomponents/location/locationCompare.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import {ref, onMounted, onBeforeUnmount} from 'vue';
import {onLoad, onPullDownRefresh, onBackPress, onNavigationBarButtonTap} from '@dcloudio/uni-app';
const id = ref('');
const scanCount = ref(0);
const jobContent = ref({});
const subList = ref([]);
const detailSource = ref([]);
const managementList = ref([]);
const fromLocationCode = ref("");
const toLocationCode = ref("");
const toLocationAreaTypeList = ref([]);
const jobStatus = ref("");
const jobToLocationCode = ref("");
const isCheckLocation = ref(false);
const scanMessage = ref("");
const scanPopupRef = ref(null);
const jobDetailPopupRef = ref(null);
const comScanLocationRef = ref(null);
const comMessageRef = ref(null);
//
onLoad((option) => {
uni.setNavigationBarTitle({
title: option.title + '详情'
});
id.value = option.id;
scanMessage.value = option.scanMessage;
if (id.value !== undefined) {
if (option.status === "1") {
receive(() => {
getDetail();
});
} else {
getDetail();
}
}
});
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome();
}
});
onBackPress((e) => {
if (e.from === 'backbutton') {
if (jobStatus.value === "2") {
cancleTakePutawayJob(id.value).then(() => {
uni.navigateBack();
}).catch(() => {
uni.navigateBack();
});
} else {
uni.navigateBack();
}
return true;
}
});
onPullDownRefresh(() => {
getDetail();
uni.stopPullDownRefresh();
});
const receive = (callback) => {
if (id.value !== null) {
takePutawayJob(id.value).then(() => {
callback();
}).catch((error) => {
showErrorMessage(error);
});
}
};
const getDetail = () => {
uni.showLoading({
title: "加载中....",
mask: true
});
getPutawayJobDetail(id.value).then((res) => {
uni.hideLoading();
if (res.data === null) {
showMessage('未获取到详情');
} else {
if (res.data.subList.length > 0) {
jobContent.value = res.data;
jobStatus.value = res.data.status;
subList.value = res.data.subList;
detailSource.value = getTreeDataSource(subList.value);
fromLocationCode.value = subList.value[0].fromLocationCode;
jobToLocationCode.value = subList.value[0].toLocationCode;
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes);
isCheckLocation.value = getSwitchInfoByCode("PurchasePutawayToLocationCodeValidate");
if (isCheckLocation.value) {
toLocationCode.value = "";
} else {
toLocationCode.value = jobToLocationCode.value;
}
if (scanMessage.value) {
openScanPopupSimulate(scanMessage.value);
}
} else {
showMessage('列表数据为0');
}
}
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
};
const calcScanCount = (closeScan) => {
const items = subList.value.filter(r => r.scaned);
scanCount.value = items.length;
if (scanCount.value === subList.value.length) {
closeScanPopup();
}
};
const calcHandleQty = () => {
calcTreeHandleQty(detailSource.value);
continueScan();
// this.$forceUpdate(); // Vue 3
};
const continueScan = () => {
scanCount.value = getScanCount(subList.value);
if (scanCount.value === subList.value.length) {
closeScanPopup();
} else {
scanPopupGetFocus();
}
};
const updateData = () => {
console.log("updateData");
calcTreeHandleQty(detailSource.value);
};
const openScanPopupSimulate = (message) => {
let fromlocationCode = '';
let fromlocationList = [];
for (let i = 0; i < detailSource.value.length; i++) {
let item = detailSource.value[i];
item.subList.forEach(l => {
if (!fromlocationList.includes(l.fromLocationCode)) {
fromlocationList.push(l.fromLocationCode);
}
if (fromlocationCode === '') {
fromlocationCode = l.fromLocationCode;
}
});
}
scanPopupRef.value.openScanPopupForJobSimulate(fromlocationCode, fromlocationList, jobContent.value, message);
};
const openScanPopup = () => {
let fromlocationCode = '';
let fromlocationList = [];
for (let i = 0; i < detailSource.value.length; i++) {
let item = detailSource.value[i];
item.subList.forEach(l => {
if (!fromlocationList.includes(l.fromLocationCode)) {
fromlocationList.push(l.fromLocationCode);
}
if (fromlocationCode === '' && !l.scaned) {
fromlocationCode = l.fromLocationCode;
}
});
}
scanPopupRef.value.openScanPopupForJob(fromlocationCode, fromlocationList, jobContent.value);
};
const closeScanPopup = () => {
scanPopupRef.value.closeScanPopup();
};
const getScanResult = (result) => {
try {
const {packingNumber, batch, qty, itemCode, fromLocationCode, balance} = result.label;
if (!balance) {
showMessage(`箱码【${packingNumber}】没有库存余额`);
return;
}
const detail = detailSource.value.find(r => r.itemCode === itemCode);
if (!detail) {
showErrorMessage(`物料号【${itemCode}】不在列表中`);
} else {
const itemDetail = detail.subList.find(r => r.packingNumber === packingNumber && r.batch === batch && r.fromLocationCode === fromLocationCode);
if (!itemDetail) {
let isExit;
for (let subItem of detail.subList) {
for (let pack of subItem.packList) {
if (pack.packingNumber === packingNumber && pack.batch === batch) {
isExit = pack;
break;
}
}
if (isExit) {
subItem.scaned = true;
subItem.handleQty = 0;
isExit = undefined;
}
}
if (!isExit) {
showErrorMessage(`箱码【${packingNumber}】,批次【${batch}】库位【${fromLocationCode}】不在列表中`);
} else {
if (!isExit.cancleScanedHiht && isExit.scaned) {
showMessage(`箱码【${packingNumber}】已经扫描`);
} else {
isExit.scaned = true;
const qtyValue = result.balance?.qty ? Number(result.balance.qty) : Number(qty);
isExit.handleQty = Number(qty);
isExit.toLocationCode = toLocationCode.value;
}
}
calcTreeHandleQty(detailSource.value);
continueScan();
} else {
const scanedLength = itemDetail.packList.filter(res => res.scaned).length;
itemDetail.fromInventoryStatus = result.balance.inventoryStatus;
if (!itemDetail.cancleScanedHiht && itemDetail.scaned && scanedLength === itemDetail.packList.length) {
showMessage(`箱码【${packingNumber}】已经扫描`);
} else {
itemDetail.scaned = true;
detailSource.value[0].subList.sort(compareAsc('scaned'));
itemDetail.handleQty = qty;
itemDetail.packList.forEach(pac => {
pac.scaned = true;
pac.handleQty = Number(pac.qty);
pac.toLocationCode = toLocationCode.value;
});
calcTreeHandleQty(detailSource.value);
continueScan();
}
}
}
} catch (e) {
showMessage(e.message);
}
};
const scanLocationCode = (location, code) => {
toLocationCode.value = code;
detailSource.value.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = code;
});
});
};
const openDetail = (item) => {
jobDetailPopupRef.value.openPopup(item);
};
const checkLocation = () => {
if (!toLocationCode.value) {
showMessageHint('请扫描收货库位', () => {
comScanLocationRef.value.showLocation();
});
return false;
}
return true;
};
const showMessageHint = (hint, callback) => {
comMessageRef.value.showErrorMessage(hint, res => {
if (res) {
callback();
}
});
};
const commit = () => {
scanCount.value = getScanCount(subList.value);
if (scanCount.value === 0) {
showErrorMessage("扫描数为0,请先扫描");
return;
}
if (!checkLocation()) {
return;
}
if (scanCount.value === subList.value.length) {
submitJob();
} else if (scanCount.value < subList.value.length) {
if (jobContent.value.allowPartialComplete === "TRUE") {
comMessageRef.value.showQuestionMessage1("任务明细未全部完成,是否提交?", 'red', res => {
if (res) {
submitJob();
}
});
} else {
comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
if (res) {
openScanPopup();
}
});
}
}
};
const submitJob = () => {
uni.showLoading({
title: "提交中....",
mask: true
});
const itemCodes = detailSource.value.map(item => item.itemCode);
getManagementPrecisions(itemCodes, toLocationCode.value, res => {
if (res.success) {
managementList.value = res.list;
const params = setParams();
console.log("提交参数", JSON.stringify(params));
putawayJobSubmit(params).then(res => {
uni.hideLoading();
if (res.data) {
showCommitSuccessMessage(`提交成功\n生成采购上架记录\n${res.data}`);
} else {
showErrorMessage(`提交失败[${res.msg}]`);
}
}).catch(error => {
uni.hideLoading();
showErrorMessage(error);
});
} else {
uni.hideLoading();
showErrorMessage(res.message);
}
});
};
const setParams = () => {
const subList = [];
const creator = store.state.user.id;
detailSource.value.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
const info = getPackingNumberAndBatch(managementList.value, detail.itemCode, detail.packingNumber, detail.batch);
detail.toPackingNumber = info.packingNumber;
detail.toBatch = info.batch;
detail.toContainerNumber = '';
detail.singlePrice = 1;
detail.amount = 11;
detail.arriveDate = getCurrDateTime();
detail.produceDate = getCurrDateTime();
detail.expireDate = getCurrDateTime();
detail.packList = detail.packList.filter(p => p.scaned);
subList.push(detail);
}
});
});
jobContent.value.subList = subList;
jobContent.value.creator = creator;
return jobContent.value;
};
const showMessage = (message) => {
setTimeout(() => {
scanPopupLoseFocus();
comMessageRef.value.showMessage(message, res => {
if (res) {
afterCloseMessage();
}
});
});
};
const showErrorMessage = (message) => {
setTimeout(() => {
scanPopupLoseFocus();
comMessageRef.value.showErrorMessage(message, res => {
if (res) {
afterCloseMessage();
}
});
});
};
const showQuestionMessage = (message, callback) => {
setTimeout(() => {
scanPopupLoseFocus();
comMessageRef.value.showQuestionMessage(message, res => {
if (res) {
callback(res);
}
});
});
};
const scanPopupGetFocus = () => {
scanPopupRef.value.packGetFocus();
};
const scanPopupLoseFocus = () => {
scanPopupRef.value.packLoseFocus();
};
const afterCloseMessage = () => {
scanPopupGetFocus();
};
const showCommitSuccessMessage = (hint) => {
comMessageRef.value.showSuccessMessage(hint, res => {
navigateBack(1);
});
};
</script>
<style scoped lang="scss">
</style>
Loading…
Cancel
Save