Browse Source

修改制品回收和采购上架

hella_online_20240829
lijuncheng 6 months ago
parent
commit
85a8549322
  1. 6
      .env.development
  2. 10
      src/mycomponents/record/recordComDetailCard.vue
  3. 77
      src/pages/productRecycle/job/productRecycleJobDetail.vue
  4. 122
      src/pages/putaway/record/putawayRecord.vue
  5. 506
      src/pages/putaway/record/putawayRecord_bat.vue

6
.env.development

@ -1,5 +1,7 @@
VITE_BASE_URL=http://dev.ccwin-in.com:25300/api/admin-api #VITE_BASE_URL=http://dev.ccwin-in.com:25300/api/admin-api
VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/api/admin-api #VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/api/admin-api
VITE_BASE_URL=http://172.21.32.13:81/api/admin-api VITE_BASE_URL_IMAGE=http://172.21.32.13:81/admin-api
# 租户配置 VITE_TENANT='[{"text":"长春","value":1},{"text":"成都","value":2}]' # 租户配置 VITE_TENANT='[{"text":"长春","value":1},{"text":"成都","value":2}]'
# 是否是测试环境 # 是否是测试环境

10
src/mycomponents/record/recordComDetailCard.vue

@ -3,16 +3,16 @@
<uni-collapse ref="collapse1" @change=""> <uni-collapse ref="collapse1" @change="">
<uni-collapse-item :open="true"> <uni-collapse-item :open="true">
<template v-slot:title> <template v-slot:title>
<uni-swipe-action ref="swipeAction"> <uni-swipe-action >
<uni-swipe-action-item @click="removeItem($event,dataContent)" :right-options="removeOptions"> <uni-swipe-action-item @click="removeItem($event,dataContent)" :right-options="removeOptions">
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" <item-qty :dataContent="dataContent"
:isShowBalance="true" :isShowBalanceQty="isShowBalanceQty"></item-qty> :isShowBalance="true" :isShowBalanceQty="isShowBalanceQty"></item-qty>
</uni-swipe-action-item> </uni-swipe-action-item>
</uni-swipe-action> </uni-swipe-action>
</template> </template>
<!-- <view class='split_line'></view> --> <view class='split_line'></view>
<view class="" v-for="(detail,index) in dataContent.subList"> <view class="" v-for="(detail,index) in dataContent.subList" :key="index">
<uni-swipe-action ref="swipeAction"> <uni-swipe-action >
<uni-swipe-action-item @click="swipeClick($event,detail,index)" <uni-swipe-action-item @click="swipeClick($event,detail,index)"
:right-options="detail.scaned?scanOptions:detailOptions"> :right-options="detail.scaned?scanOptions:detailOptions">
<balance :dataContent="detail" :isShowStdPack="false" :isShowStatus="true" <balance :dataContent="detail" :isShowStdPack="false" :isShowStatus="true"

77
src/pages/productRecycle/job/productRecycleJobDetail.vue

@ -236,39 +236,42 @@
if (detail == undefined) { if (detail == undefined) {
this.showMessage("物料号【" + itemCode + "】不在列表中") this.showMessage("物料号【" + itemCode + "】不在列表中")
} else { } else {
// let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus);
//
itemDetail = detail.subList.find(r => { itemDetail = detail.subList.find(r => {
return r.packingNumber == packingNumber && return r.packingNumber == packingNumber &&
r.batch == batch && r.batch == batch &&
r.fromLocationCode == result.fromLocationCode r.fromLocationCode == result.fromLocationCode&&
r.inventoryStatus == result.balance.inventoryStatus
}) })
let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); if(itemDetail){
// //
if (itemDetail == undefined) { if (itemDetail.scaned) {
this.showErrorMessage("箱码【" + packingNumber + "】<br>批次【" + batch + "】<br>库位【" + result this.showErrorMessage("箱码【" + packingNumber + "】<br>批次【" + batch + "】<br>库位【" + result
.fromLocationCode + "】<br>状态【" + balanceStatus + "】<br>已经扫描") .fromLocationCode + "】<br>状态【" + balanceStatus + "】<br>已经扫描")
return; return;
} else { } else {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.balance.qty);
itemDetail.toInventoryStatus = result.balance.inventoryStatus;
itemDetail.inventoryStatus =result.balance.inventoryStatus;
itemDetail.balance = result.balance;
itemDetail.balance.balanceQty = Number(result.balance.qty);
itemDetail.balance.packQty = Number(result.package.packQty)
itemDetail.balance.packUnit = result.package.packUnit
this.calcHandleQty();
}
}else {
//
itemDetail = detail.subList.find(r => { itemDetail = detail.subList.find(r => {
return r.packingNumber == packingNumber && return r.packingNumber == packingNumber &&
r.batch == batch && r.batch == batch &&
r.fromLocationCode == result.fromLocationCode && r.fromLocationCode == result.fromLocationCode
r.inventoryStatus == result.balance.inventoryStatus
}) })
//
if (itemDetail == undefined) { if(itemDetail){
itemDetail = detail.subList.find(r => { //
return r.packingNumber == packingNumber &&
r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail.scaned) {
this.showErrorMessage("箱码【" + packingNumber + "】<br>批次【" + batch + "】<br>库位【" + result
.fromLocationCode + "】<br>状态【" + balanceStatus + "】<br>已经扫描")
return;
}
let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus);
if (this.jobContent.allowModifyInventoryStatus == "TRUE") { if (this.jobContent.allowModifyInventoryStatus == "TRUE") {
this.showQuestionMessage('实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus + this.showQuestionMessage('实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus +
']不一致,是否继续退货?', res => { ']不一致,是否继续退货?', res => {
@ -293,27 +296,11 @@
this.scanPopupGetFocus(); this.scanPopupGetFocus();
}); });
} }
}else {
this.showErrorMessage("箱码【" + packingNumber + "】<br>批次【" + batch + "】<br>库位【" + result
} else { .fromLocationCode + "】<br>状态【" + balanceStatus + "】<br>不在任务列表中")
//
if (itemDetail.scaned) {
this.showErrorMessage("箱码【" + packingNumber + "】<br>批次【" + batch + "】<br>库位【" + result
.fromLocationCode + "】<br>状态【" + balanceStatus + "】<br>已经扫描")
return;
} else {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.balance.qty);
itemDetail.toInventoryStatus = result.balance.inventoryStatus;
itemDetail.inventoryStatus =result.balance.inventoryStatus;
itemDetail.balance = result.balance;
itemDetail.balance.balanceQty = Number(result.balance.qty);
itemDetail.balance.packQty = Number(result.package.packQty)
itemDetail.balance.packUnit = result.package.packUnit
this.calcHandleQty();
}
} }
} }
} }

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

@ -9,16 +9,16 @@
<view class="header_item"> <view class="header_item">
来源库位 : {{fromLocationCode}} 来源库位 : {{fromLocationCode}}
</view> </view>
<view class='split_line'></view> <u-line />
</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="">
<recordDetailCard :dataContent="item" :index="index" :settingParam="dataContent" <record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index,item)" :isShowFromLocation="false" @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack="removePack"> @updateData="updateData" @removePack="removePack">
</recordDetailCard> </record-com-detail-card>
</view> </view>
</view> </view>
@ -30,7 +30,7 @@
style="background-color:ghostwhite; width: 100%; "> style="background-color:ghostwhite; width: 100%; ">
<view class=""> <view class="">
<!-- <requiredLocation v-if="showToLoaction" title="目标库位" :locationCode="toLocationCode" <!-- <requiredLocation v-if="showToLoaction" title="目标库位" :locationCode="toLocationCode"
@getLocation='getToLocationCode' :locationAreaTypeList="toLocationAreaTypeList"></requiredLocation> --> @getLocation='getToLocationCode' :locationTypeList="tolocationTypeList"></requiredLocation> -->
</view> </view>
<view class=" uni-flex uni-row"> <view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> <button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
@ -57,6 +57,7 @@
import { import {
goHome, goHome,
updateTitle,
getCurrDateTime, getCurrDateTime,
getPackingNumberAndBatchByList, getPackingNumberAndBatchByList,
deepCopyData deepCopyData
@ -75,7 +76,7 @@
getBusinessType, getBusinessType,
createItemInfo, createItemInfo,
createDetailInfo, createDetailInfo,
calcTreeHandleQty calcHandleQty
} from '@/common/record.js'; } from '@/common/record.js';
import { import {
@ -91,8 +92,7 @@
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue'
export default { export default {
components: { components: {
winScanButton, winScanButton,
@ -101,8 +101,7 @@
comBlankView, comBlankView,
winScanLocation, winScanLocation,
winScanPackAndLocation, winScanPackAndLocation,
recordComDetailCard, recordComDetailCard
recordDetailCard
}, },
data() { data() {
return { return {
@ -118,12 +117,12 @@
businessType: {}, businessType: {},
showToLoaction: true, showToLoaction: true,
recommendLocationList: [], // recommendLocationList: [], //
fromWarehouseCode: '' ,// fromWarehouseCode: '', //
businessTypeCode:"PurchasePutaway" businessTypeCode: "PurchasePutaway"
}; };
}, },
onLoad(option) { onLoad(option) {
this.clearData(); this.clear();
getBusinessType(this.businessTypeCode, res => { getBusinessType(this.businessTypeCode, res => {
if (res.success) { if (res.success) {
this.businessType = res.businessType; this.businessType = res.businessType;
@ -166,32 +165,37 @@
this.getRecommendLocation(balance, pack, toLocation => { this.getRecommendLocation(balance, pack, toLocation => {
var itemp = createItemInfo(balance, pack); var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); // let newDetail = createDetailInfo(balance, pack); //
newDetail.toLocationCode = toLocation.code; newDetail.toLocationCode = toLocation.locationCode;
newDetail.toWarehouseCode = toLocation.warehouseCode; newDetail.toWarehouseCode = toLocation.toWarehouseCode;
itemp.subList.push(newDetail); itemp.subList.push(newDetail);
var dataList = pack.subList
this.detailSource.push(itemp) this.detailSource.push(itemp)
this.detailSource.forEach(res=>{ calcHandleQty(this.detailSource);
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 { } else {
var itemDetail = item.subList.find(r => r.packingNumber == balance.packingNumber && r.batch == var detail = item.subList.find(r => {
balance.batch); if (r.packingNumber == balance.packingNumber &&
if(itemDetail!=undefined){ r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
this.getRecommendLocation(balance, pack, toLocation => {
let newDetail = createDetailInfo(balance, pack);
newDetail.toLocationCode = toLocation.locationCode;
newDetail.toWarehouseCode = toLocation.toWarehouseCode;
item.subList.push(newDetail);
calcHandleQty(this.detailSource);
});
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中")
} }
}
} }
// calcTreeHandleQty(this.detailSource);
}, },
// //
@ -207,20 +211,25 @@
batch: balance.batch, batch: balance.batch,
inventoryStatus: balance.inventoryStatus, inventoryStatus: balance.inventoryStatus,
supplierCode: pack.supplierCode, supplierCode: pack.supplierCode,
businessCode:this.businessTypeCode businessCode: this.businessTypeCode
}; };
console.log(JSON.stringify(param)) console.log(JSON.stringify(param))
getPutawayRecommendLocation(param).then(res => { getPutawayRecommendLocation(param).then(res => {
this.recommendLocationList.push({ this.recommendLocationList.push({
itemCode: balance.itemCode, itemCode: balance.itemCode,
locationCode: res.data.code locationCode: res.data.code,
toWarehouseCode:res.data.toWarehouseCode
}) })
callback(res.data);
var result = {
locationCode: res.data.code,
toWarehouseCode:res.data.toWarehouseCode
}
callback(result);
uni.hideLoading(); uni.hideLoading();
}).catch(error => { }).catch(error => {
uni.hideLoading() uni.hideLoading()
this.showErrorMessage(error); this.showErrorMessage(error);
uni.hideLoading();
}) })
} else { } else {
@ -234,24 +243,22 @@
}); });
}, },
calcTreeHandleQty() {
for (let item of this.detailSource) { updateData() {
item.qty = 0; calcHandleQty(this.detailSource);
for (let detail of item.subList) { for (var i = 0; i < this.detailSource.length; i++) {
if (detail != undefined) { let item = this.detailSource[i];
item.qty = calc.add(item.qty,detail.qty) if (item.qty == 0) {
} this.detailSource.splice(i, 1)
} }
} }
this.$forceUpdate(); this.$forceUpdate();
},
updateData() {
this.calcTreeHandleQty();
}, },
removeItem(index, item) { removeItem(index, item) {
this.detailSource.splice(index, 1) this.detailSource.splice(index, 1)
this.updateData();
}, },
removePack() { removePack() {
@ -383,7 +390,7 @@
// detail.toInventoryStatus = detail.inventoryStatus // detail.toInventoryStatus = detail.inventoryStatus
// detail.toLocationCode = detail.toLocationCode // detail.toLocationCode = detail.toLocationCode
submitItem.qty = detail.handleQty ; submitItem.qty = detail.handleQty;
submitItem.package = ""; submitItem.package = "";
subList.push(submitItem) subList.push(submitItem)
} }
@ -403,13 +410,6 @@
if (res) {} if (res) {}
}); });
}, },
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
showScanMessage(message) { showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message); this.$refs.comMessage.showScanMessage(message);
@ -443,21 +443,11 @@
showCommitSuccessMessage(hint) { showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => { this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData(); this.clear();
}) })
}, },
updateData() { clear() {
// this.calcTreeHandleQty();
for (var i = 0; i < this.detailSource.length; i++) {
let item = this.detailSource[i];
if (item.qty == 0) {
this.detailSource.splice(i, 1)
}
}
},
clearData() {
this.fromLocationInfo = {}; this.fromLocationInfo = {};
this.fromLocationCode = ''; this.fromLocationCode = '';
this.fromWarehouseCode = ''; this.fromWarehouseCode = '';
@ -503,4 +493,4 @@
background: #e0e0e0; background: #e0e0e0;
} }
</style> </style>

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

@ -0,0 +1,506 @@
<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>
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'
export default {
components: {
winScanButton,
winScanPack,
requiredLocation,
comBlankView,
winScanLocation,
winScanPackAndLocation,
recordComDetailCard,
recordDetailCard
},
data() {
return {
id: '',
dataContent: {}, //
detailSource: [], //
fromLocationInfo: {},
fromLocationCode: "",
fromLocationAreaTypeList: [],
toLocationAreaTypeList: [],
inInventoryStatus: "", //
outInventoryStatus: "", //
businessType: {},
showToLoaction: true,
recommendLocationList: [], //
fromWarehouseCode: '' ,//
businessTypeCode:"PurchasePutaway"
};
},
onLoad(option) {
this.clearData();
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.showFromLocationPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {},
methods: {
getScanResult(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
if (item == undefined) {
//
this.getRecommendLocation(balance, pack, toLocation => {
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.toLocationCode = toLocation.code;
newDetail.toWarehouseCode = toLocation.warehouseCode;
itemp.subList.push(newDetail);
var dataList = pack.subList
this.detailSource.push(itemp)
this.detailSource.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 {
var itemDetail = item.subList.find(r => r.packingNumber == balance.packingNumber && r.batch ==
balance.batch);
if(itemDetail!=undefined){
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中")
}
}
// calcTreeHandleQty(this.detailSource);
},
//
getRecommendLocation(balance, pack, callback) {
uni.showLoading({
title: '扫描中...',
mask: true
})
let recommend = this.recommendLocationList.find(r => r.itemCode == balance.itemCode);
if (recommend == undefined) {
let param = {
itemCode: balance.itemCode,
batch: balance.batch,
inventoryStatus: balance.inventoryStatus,
supplierCode: pack.supplierCode,
businessCode:this.businessTypeCode
};
console.log(JSON.stringify(param))
getPutawayRecommendLocation(param).then(res => {
this.recommendLocationList.push({
itemCode: balance.itemCode,
locationCode: res.data.code
})
callback(res.data);
uni.hideLoading();
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error);
uni.hideLoading();
})
} else {
callback(recommend);
}
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {}
});
},
calcTreeHandleQty() {
for (let item of this.detailSource) {
item.qty = 0;
for (let detail of item.subList) {
if (detail != undefined) {
item.qty = calc.add(item.qty,detail.qty)
}
}
}
this.$forceUpdate();
},
updateData() {
this.calcTreeHandleQty();
},
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.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanLocationCode.openScanPopup();
})
},
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup();
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
// scanLocationCode(location, code) {
// this.toLocationCode = code
// this.toLocationCode = location;
// },
commit() {
uni.showLoading({
title: "提交中....",
mask: true
});
//
let precisionStrategyParams = getPrecisionStrategyParams(this.detailSource);
//2:
getPrecisionStrategyList(precisionStrategyParams, res => {
if (res.success) {
this.managementList = res.list;
var params = this.setRecordParams()
console.log("提交参数", JSON.stringify(params));
putawayRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功<br>生成采购上架记录<br>" + res.data, )
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
getItemAndLocationRelations() {
var itemList = []
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
detail.toLocationCode = this.toLocationCode;
var filterResult = itemList.filter(res => {
if (res.itemCode == item.itemCode &&
res.locationCode == detail.toLocationCode &&
res.batch == detail.batch &&
res.inventoryStatus == detail.inventoryStatus) {
return res
}
})
//
if (filterResult.length == 0) {
var result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode,
batch: detail.batch,
inventoryStatus: detail.inventoryStatus,
}
itemList.push(result)
}
}
})
})
return itemList;
},
setRecordParams() {
var subList = []
var creator = this.$store.state.user.id
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode,
detail.packingNumber, detail.toLocationCode, detail.batch);
var submitItem = deepCopyData(detail)
submitItem.toPackingNumber = info.packingNumber;
submitItem.toBatch = info.batch;
submitItem.toContainerNumber = detail.containerNumber;
submitItem.fromPackingNumber = info.packingNumber;
submitItem.fromBatch = info.batch;
submitItem.fromContainerNumber = detail.containerNumber;
submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = detail.toLocationCode;
// detail.toInventoryStatus = detail.inventoryStatus
// detail.toLocationCode = detail.toLocationCode
submitItem.qty = detail.handleQty ;
submitItem.package = "";
subList.push(submitItem)
}
})
})
if (subList.length > 0) {
this.dataContent.toWarehouseCode = subList[0].toWarehouseCode;
}
this.dataContent.subList = subList
this.dataContent.creator = creator;
this.dataContent.fromWarehouseCode = this.fromWarehouseCode;
return this.dataContent;
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
getLocation(location, code) {
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationInfo = location;
this.fromLocationCode = code;
this.openScanPopup();
},
getToLocationCode(location, code) {
if (this.fromLocationCode == code) {
uni.showToast({
title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致",
duration: 2000
})
return
}
this.toLocationCode = code;
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
})
},
updateData() {
// this.calcTreeHandleQty();
for (var i = 0; i < this.detailSource.length; i++) {
let item = this.detailSource[i];
if (item.qty == 0) {
this.detailSource.splice(i, 1)
}
}
},
clearData() {
this.fromLocationInfo = {};
this.fromLocationCode = '';
this.fromWarehouseCode = '';
this.toWarehouseCode = '';
this.detailSource = [];
}
}
}
</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