Browse Source

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

hella_vue3
王志国 3 weeks ago
parent
commit
3db82d1364
  1. 116
      src/pages/putaway/record/putawayRecord.vue
  2. 443
      src/pages/putaway/record/putawayRecord_bat.vue

116
src/pages/putaway/record/putawayRecord.vue

@ -6,15 +6,24 @@
<view class="page-wraper" v-if="detailSource.length > 0"> <view class="page-wraper" v-if="detailSource.length > 0">
<view class="page-header"> <view class="page-header">
<view class="page-header-box"> <view class="page-header-box">
<view class="header_item u-p-t-20"> 来源库位 : {{ fromLocationCode }} </view> <view class="header-view">
<u-line /> <view class="header_item">
来源库位 : {{fromLocationCode}}
</view>
</view>
</view> </view>
</view> </view>
<view class="page-main"> <view class="page-main">
<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="">
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" :isShowFromLocation="false" @removeItem="removeItem(index, item)" @updateData="updateData" @removePack="removePack"> </record-com-detail-card> <record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index,item)"
:isShowModifedLocation="true"
@updateData="updateData"
@editLocation="showScanToLocation"
@removePack="removePack">
</record-com-detail-card>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@ -35,13 +44,17 @@
<win-scan-pack-and-location ref="scanPopup" @getResult="getScanResult" :allowModifyLocation="false"> </win-scan-pack-and-location> <win-scan-pack-and-location ref="scanPopup" @getResult="getScanResult" :allowModifyLocation="false"> </win-scan-pack-and-location>
<com-message ref="comMessageRef" /> <com-message ref="comMessageRef" />
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> <win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<win-scan-location ref="scanToLocationCode" title="目标库位" @getLocation='getToLocationCode'
:locationAreaTypeList="toLocationAreaTypeList"></win-scan-location>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, getCurrentInstance, nextTick } from 'vue' import { ref, getCurrentInstance, nextTick } from 'vue'
import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { putawayRecordSubmit, validateItemAndLocation, getPutawayRecommendLocation } from '@/api/request2.js' import { putawayRecordSubmit, getPutawayRecommendLocation,
checkItemCodeAndLocation,
recommendLocationRemoveExpectin } from '@/api/request2.js'
import { goHome, updateTitle, getCurrDateTime, getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js' import { goHome, updateTitle, getCurrDateTime, getPackingNumberAndBatchByList, deepCopyData } from '@/common/basic.js'
@ -84,6 +97,8 @@ const scanLocationCode = ref()
const managementList = ref([]) const managementList = ref([])
const toLocationCode = ref() const toLocationCode = ref()
const toWarehouseCode = ref('') const toWarehouseCode = ref('')
const editItem = ref({})
const scanToLocationCode = ref(null)
onLoad((option) => { onLoad((option) => {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: option.title title: option.title
@ -126,6 +141,7 @@ const getScanResult = (result) => {
getRecommendLocation(balance, pack, (toLocation) => { getRecommendLocation(balance, pack, (toLocation) => {
const itemp = createItemInfo(balance, pack) const itemp = createItemInfo(balance, pack)
const newDetail = createDetailInfo(balance, pack) // const newDetail = createDetailInfo(balance, pack) //
itemp.toLocationCode = toLocation.locationCode;
newDetail.toLocationCode = toLocation.locationCode newDetail.toLocationCode = toLocation.locationCode
newDetail.toWarehouseCode = toLocation.toWarehouseCode newDetail.toWarehouseCode = toLocation.toWarehouseCode
newDetail.poLine = poLine newDetail.poLine = poLine
@ -151,11 +167,17 @@ const getScanResult = (result) => {
newDetail.poNumber = poNumber newDetail.poNumber = poNumber
newDetail.fromInventoryStatus = balance.inventoryStatus newDetail.fromInventoryStatus = balance.inventoryStatus
newDetail.supplierCode = supplierCode newDetail.supplierCode = supplierCode
if(item.subList&&item.subList.length>0){
if(item.subList[0].batch!=newDetail.batch){
showErrorMessage("扫描的批次是["+newDetail.batch+"],请扫描["+item.subList[0].batch+"的批次的箱码")
}
}else {
item.subList.push(newDetail) item.subList.push(newDetail)
calcHandleQty(detailSource.value) calcHandleQty(detailSource.value)
}
}) })
} else if (detail.scaned == true) { } else if (detail.scaned == true) {
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`) showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]重复扫描`)
} }
} }
// calcTreeHandleQty(this.detailSource); // calcTreeHandleQty(this.detailSource);
@ -264,7 +286,7 @@ const commit = () => {
.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}]`)
} }
@ -325,7 +347,7 @@ const setRecordParams = () => {
submitItem.fromLocationCode = detail.locationCode submitItem.fromLocationCode = detail.locationCode
submitItem.toLocationCode = detail.toLocationCode submitItem.toLocationCode = detail.toLocationCode
submitItem.itemName = item.itemName;
// detail.toInventoryStatus = detail.inventoryStatus // detail.toInventoryStatus = detail.inventoryStatus
// detail.toLocationCode = detail.toLocationCode // detail.toLocationCode = detail.toLocationCode
submitItem.qty = detail.handleQty submitItem.qty = detail.handleQty
@ -379,9 +401,78 @@ const getToLocationCode = (location, code) => {
}) })
return return
} }
toLocationCode.value = code let item = editItem.value.subList[0]
if(item){
const param ={
batch:item.batch,
inventoryStatus:item.inventoryStatus,
itemCode:item.itemCode,
toLocationCode:code,
expectinNumber: item.packingNumber + "-" + Date.now(),
}
checkItemCodeAndLocation(param).then(res=>{
if(res.data.recommendFlag){
editItem.value.toLocationCode = code;
}else {
if(res.data.errorMsg){
showErrorMessage("系统异常:"+res.data.errorMsg)
}else {
if(res.data.balanceMsg){
comMessageRef.value.showQuestionMessage("系统异常:"+res.data.balanceMsg, confirmRes => {
if (confirmRes) {
editItem.value.toLocationCode = code;
let item = detailSource.value.find(res => {
if (res.itemCode == editItem.value.itemCode) {
return res
}
})
if(item){
item.subList.forEach(r=>{
r.toLocationCode =code
})
}
}else {
removeRecommendLocation(res.data.expectinNumberList)
}
});
}else {
//
editItem.value.toLocationCode = code;
let item = detailSource.value.find(res => {
if (res.itemCode == editItem.value.itemCode) {
return res
}
})
if(item){
item.subList.forEach(r=>{
r.toLocationCode =code
})
}
}
}
}
}).catch(error=>{
showErrorMessage(error)
})
}
} }
//
const removeRecommendLocation = (lst)=> {
let param = {
expectinNumberList: lst,
};
recommendLocationRemoveExpectin(param).then(res => {
}).catch(err => {
showErrorMessage('【' + lst.join(',') + '】移除预占用失败,请在PC端的预占用中移除')
})
}
const showScanToLocation = (item)=> {
editItem.value = item;
setTimeout(r => {
scanToLocationCode.value.openScanPopup();
})
}
const showCommitSuccessMessage = (hint) => { const showCommitSuccessMessage = (hint) => {
comMessageRef.value.showSuccessMessage(hint, (res) => { comMessageRef.value.showSuccessMessage(hint, (res) => {
if (res) { if (res) {
@ -389,13 +480,20 @@ const showCommitSuccessMessage = (hint) => {
} }
}) })
} }
const showQuestionMessage = (hint)=> {
comMessageRef.value.showQuestionMessage('已经有库存余额,是否继续上架?', res => {
if (res) {
}else {
}
});
}
const clear = () => { const clear = () => {
fromLocationInfo.value = {} fromLocationInfo.value = {}
fromLocationCode.value = '' fromLocationCode.value = ''
fromWarehouseCode.value = '' fromWarehouseCode.value = ''
toWarehouseCode.value = '' toWarehouseCode.value = ''
detailSource.value = [] detailSource.value = []
editItem.value = {}
} }
</script> </script>

443
src/pages/putaway/record/putawayRecord_bat.vue

@ -0,0 +1,443 @@
<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-header">
<view class="header_item">
来源库位 : {{ fromLocationCode }}
</view>
<view class='split_line'></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="">
<recordDetailCard :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack="removePack">
</recordDetailCard>
</view>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
<!-- <requiredLocation v-if="showToLoaction" title="目标库位" :locationCode="toLocationCode"
@getLocation='getToLocationCode' :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-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false'>
</win-scan-pack-and-location>
<comMessage ref="comMessage"></comMessage>
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
</view>
</template>
<script setup lang="ts">
import {
putawayRequestSubmit,
putawayRecordSubmit,
validateItemAndLocation,
getPutawayRecommendLocation
} from '@/api/request2.js';
import {
goHome,
getCurrDateTime,
getPackingNumberAndBatchByList,
deepCopyData
} from '@/common/basic.js';
import {
calc
} from '@/common/calc.js';
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
getBusinessType,
createItemInfo,
createDetailInfo,
calcTreeHandleQty
} from '@/common/record.js';
import {
getManagementPrecisions,
getPrecisionStrategyList,
getPrecisionStrategyParams
} from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue'
import { ref, onMounted,nextTick } from 'vue';
import { useCountStore } from '@/store';
import { onLoad,onNavigationBarButtonTap,onBackPress,onPullDownRefresh } from '@dcloudio/uni-app'
const store = useCountStore();
const id = ref('');
const dataContent = ref({});
const detailSource = ref([]);
const fromLocationInfo = ref({});
const fromLocationCode = ref("");
const fromLocationAreaTypeList = ref([]);
const toLocationAreaTypeList = ref([]);
const inInventoryStatus = ref(""); //
const outInventoryStatus = ref(""); //
const businessType = ref({});
const showToLoaction = ref(true);
const recommendLocationList = ref([]); //
const fromWarehouseCode = ref(''); //
const businessTypeCode = ref("PurchasePutaway");
const toLocationCode = ref()
const managementList = ref([])
const toWarehouseCode = ref('')
const scanPopup = ref(null);
const scanLocationCode = ref(null);
const comMessage = ref(null);
onMounted(() => {
//
clearData();
});
onLoad((option) => {
clearData();
getBusinessType(businessTypeCode.value, (res) => {
if (res.success) {
businessType.value = res.businessType;
fromLocationAreaTypeList.value = res.fromLocationAreaTypeList;
toLocationAreaTypeList.value = res.toLocationAreaTypeList;
showFromLocationPopup();
} else {
showErrorMessage(res.message);
}
});
})
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome();
}
})
onBackPress((e) => {})
onPullDownRefresh(() => {})
const getScanResult = (result) => {
const {balance,label,pack} = result
const item = detailSource.value.find((res) => res.itemCode === balance.itemCode);
if (fromWarehouseCode.value === '') {
fromWarehouseCode.value = balance.warehouseCode;
}
if (item === undefined) {
getRecommendLocation(balance, pack, (toLocation) => {
const itemp = createItemInfo(balance, pack);
const newDetail = createDetailInfo(balance, pack);
newDetail.toLocationCode = toLocation.code;
newDetail.toWarehouseCode = toLocation.warehouseCode;
itemp.subList.push(newDetail);
const dataList = pack.subList;
detailSource.value.push(itemp);
detailSource.value.forEach((res) => {
res.subList.forEach((pack) => {
pack.packList = dataList.filter((c) => c.parentNumber === pack.packingNumber);
pack.packList.forEach((pac) => {
pac.parentPackingNumber = pac.parentNumber;
pac.packingNumber = pac.number;
pac.inventoryStatus = "OK";
pac.scaned = true;
});
});
});
});
} else {
const itemDetail = item.subList.find((r) => r.packingNumber === balance.packingNumber && r.batch === balance.batch);
if (itemDetail !== undefined) {
showErrorMessage(`箱码[${balance.packingNumber}]批次[${balance.batch}]重复扫描`);
}
}
// calcTreeHandleQty(detailSource.value);
};
const getRecommendLocation = (balance, pack, callback) => {
uni.showLoading({
title: '扫描中...',
mask: true
});
const recommend = recommendLocationList.value.find((r) => r.itemCode === balance.itemCode);
if (recommend === undefined) {
const param = {
itemCode: balance.itemCode,
batch: balance.batch,
inventoryStatus: balance.inventoryStatus,
supplierCode: pack.supplierCode,
businessCode: businessTypeCode.value
};
console.log(JSON.stringify(param));
getPutawayRecommendLocation(param).then((res) => {
recommendLocationList.value.push({
itemCode: balance.itemCode,
locationCode: res.data.code
});
callback(res.data);
uni.hideLoading();
}).catch((error) => {
uni.hideLoading();
showErrorMessage(error);
});
} else {
callback(recommend);
}
};
const calcTreeHandleQty = () => {
detailSource.value.forEach((item) => {
item.qty = 0;
item.subList.forEach((detail) => {
if (detail !== undefined) {
item.qty = calc.add(item.qty, detail.qty);
}
});
});
};
const removeItem = (index, item) => {
detailSource.value.splice(index, 1);
};
const removePack = () => {
detailSource.value = detailSource.value.filter((item) => item.subList.length > 0);
updateData();
};
const openScanPopup = () => {
if (fromLocationCode.value === "") {
showFromLocationPopup();
return;
}
scanPopup.value?.openScanPopupForType(fromLocationCode.value, businessType.value);
};
const showFromLocationPopup = () => {
nextTick(() => {
scanLocationCode.value?.openScanPopup();
});
};
const closeScanPopup = () => {
scanPopup.value?.closeScanPopup();
};
const scanPopupGetFocus = () => {
scanPopup.value?.getfocus();
};
const commit = () => {
uni.showLoading({
title: "提交中....",
mask: true
});
const precisionStrategyParams = getPrecisionStrategyParams(detailSource.value);
getPrecisionStrategyList(precisionStrategyParams, (res) => {
if (res.success) {
const params = setRecordParams();
console.log("提交参数", JSON.stringify(params));
putawayRecordSubmit(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 getItemAndLocationRelations = () => {
const itemList = [];
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
if (detail.scaned) {
detail.toLocationCode = toLocationCode.value;
const filterResult = itemList.filter((res) => {
return res.itemCode === item.itemCode &&
res.locationCode === detail.toLocationCode &&
res.batch === detail.batch &&
res.inventoryStatus === detail.inventoryStatus;
});
if (filterResult.length === 0) {
const result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode,
batch: detail.batch,
inventoryStatus: detail.inventoryStatus,
};
itemList.push(result);
}
}
});
});
return itemList;
};
const setRecordParams = () => {
const subList = [];
const creator = store.id;
detailSource.value.forEach((item) => {
item.subList.forEach((detail) => {
if (detail.scaned) {
const info = getPackingNumberAndBatchByList(managementList.value, detail.itemCode, detail.packingNumber, detail.toLocationCode, detail.batch);
let 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;
submitItem.qty = detail.handleQty;
submitItem.package = "";
subList.push(submitItem);
}
});
});
if (subList.length > 0) {
dataContent.value.toWarehouseCode = subList[0].toWarehouseCode;
}
dataContent.value.subList = subList;
dataContent.value.creator = creator;
dataContent.value.fromWarehouseCode = fromWarehouseCode.value;
return dataContent.value;
};
const showMessage = (message) => {
comMessage.value?.showMessage(message, (res) => {});
};
const showErrorMessage = (message) => {
comMessage.value?.showErrorMessage(message, (res) => {});
};
const showScanMessage = (message) => {
comMessage.value?.showScanMessage(message);
};
const afterCloseMessage = () => {
scanPopupGetFocus();
};
const closeScanMessage = () => {
scanPopupGetFocus();
};
const getLocation = (location, code) => {
getFromLocationCode(location, code);
};
const getFromLocationCode = (location, code) => {
fromLocationInfo.value = location;
fromLocationCode.value = code;
openScanPopup();
};
const getToLocationCode = (location, code) => {
if (fromLocationCode.value === code) {
uni.showToast({
title: `来源库位[${fromLocationCode.value}]不能与目标库位[${code}]一致`,
duration: 2000
});
return;
}
toLocationCode.value = code;
};
const showCommitSuccessMessage = (hint) => {
comMessage.value?.showSuccessMessage(hint, (res) => {
clearData();
});
};
const updateData = () => {
detailSource.value = detailSource.value.filter((item) => item.qty > 0);
};
const clearData = () => {
fromLocationInfo.value = {};
fromLocationCode.value = '';
fromWarehouseCode.value = '';
toWarehouseCode.value = '';
detailSource.value = [];
};
</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>
Loading…
Cancel
Save