lijuncheng
4 months ago
20 changed files with 2233 additions and 731 deletions
@ -0,0 +1,25 @@ |
|||||
|
// 防止处理多次点击
|
||||
|
function noMultipleClicks(methods, info) { |
||||
|
// methods是需要点击后需要执行的函数, info是点击需要传的参数
|
||||
|
let that = this; |
||||
|
if (that.noClick) { |
||||
|
// 第一次点击
|
||||
|
that.noClick= false; |
||||
|
if(info && info !== '') { |
||||
|
// info是执行函数需要传的参数
|
||||
|
methods(info); |
||||
|
} else { |
||||
|
methods(); |
||||
|
} |
||||
|
setTimeout(()=> { |
||||
|
that.noClick= true; |
||||
|
}, 2000) |
||||
|
} else { |
||||
|
// 这里是重复点击的判断
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//导出
|
||||
|
export default { |
||||
|
noMultipleClicks,//禁止多次点击
|
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
<template> |
||||
|
<view class="card_view "> |
||||
|
<text class="card_level">{{title}}</text> |
||||
|
<text class="card_big_content" style="font-size: 40rpx;">{{getPriorityName1()}}</text> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import {getPriorityName} from '@/common/directory.js'; |
||||
|
export default { |
||||
|
components: { |
||||
|
}, |
||||
|
data() { |
||||
|
return {} |
||||
|
}, |
||||
|
props: { |
||||
|
priority: { |
||||
|
type: String, |
||||
|
default:'2' |
||||
|
}, |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '优先级' |
||||
|
}, |
||||
|
|
||||
|
}, |
||||
|
methods:{ |
||||
|
getPriorityName1(){ |
||||
|
return getPriorityName(this.priority) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
File diff suppressed because it is too large
@ -0,0 +1,432 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="" v-if='detailSource.length==0'> |
||||
|
<com-blank-view @goScan='goScan(true)'></com-blank-view> |
||||
|
</view> |
||||
|
<view v-else class="page-wraper"> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class=""> |
||||
|
<view v-for="(toLocation, index) in detailSource"> |
||||
|
<view class="uni-row uni-flex"> |
||||
|
<!-- <com-issue-request-info :workShopCode="workShopCode" :dataContent="toLocation"> |
||||
|
</com-issue-request-info> --> |
||||
|
<work-station :workshopCode="workShopCode" |
||||
|
:productionLineCode="toLocation.productionLineCode" |
||||
|
:workStationCode="toLocation.workStationCode" |
||||
|
:rawLocationCode="toLocation.toLocationCode"></work-station> |
||||
|
</view> |
||||
|
<com-issue-detail-card ref='comIssueDetailCard' :dataContent="toLocation" |
||||
|
@updateData='updateData' |
||||
|
@removeItemCode ="removeItemCode" |
||||
|
> |
||||
|
</com-issue-detail-card> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
<button class="btn_add" @click="goScan(false)">+去添加</button> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit()">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
<com-issue-request-popup ref="comIssueRequestPopup" @confirm='requestConfirm' :itemCodeTypeList="itemCodeTypeList"></com-issue-request-popup> |
||||
|
<win-scan-button v-if='detailSource.length>0' @goScan='openScanDetailPopup'></win-scan-button> |
||||
|
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'> |
||||
|
</com-scan-issue-pack> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
|
||||
|
|
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
issueRecordSubmit, |
||||
|
getBalanceByBatchOffShelf |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
getRemoveOption, |
||||
|
getISODateTime, |
||||
|
getCurrDateTime, |
||||
|
getPackingNumberAndBatch |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDataSource |
||||
|
} from '@/pages/issue/js/issue.js'; |
||||
|
import { |
||||
|
getBusinessType, |
||||
|
} from '@/common/record.js'; |
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
getManagementPrecisions |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import comIssueRequestPopup from '@/pages/issue/coms/comIssueRequestPopup.vue' |
||||
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
||||
|
import comIssueRequestCreator from '@/pages/issue/coms/comIssueRequestCreator.vue' |
||||
|
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue' |
||||
|
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue' |
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' |
||||
|
import workStation from '@/mycomponents/workStation/workStation.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: '', |
||||
|
components: { |
||||
|
comBlankView, |
||||
|
comIssueRequestPopup, |
||||
|
jobDetailPopup, |
||||
|
comIssueRequestCreator, |
||||
|
comIssueRequestInfo, |
||||
|
comIssueDetailCard, |
||||
|
winScanButton, |
||||
|
comScanIssuePack, |
||||
|
workStation |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
detailOptions: [], |
||||
|
scanOptions: [], |
||||
|
workShopCode: "", |
||||
|
fromInventoryStatuses: "", |
||||
|
toInventoryStatuses: "", |
||||
|
requestList: [], |
||||
|
dataContent: {}, |
||||
|
managementList: [], |
||||
|
itemCodeTypeList: [] |
||||
|
} |
||||
|
}, |
||||
|
mounted() { |
||||
|
|
||||
|
}, |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
var typeCode = "Issue" |
||||
|
getBusinessType(typeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.itemCodeTypeList = res.itemCodeTypeList; |
||||
|
this.fromInventoryStatuses = res.fromInventoryStatuses |
||||
|
this.toInventoryStatuses = res.toInventoryStatuses |
||||
|
this.goScan(true) |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
closeScan() { |
||||
|
this.resizeCollapse(); |
||||
|
}, |
||||
|
resizeCollapse() { |
||||
|
this.$nextTick(r => { |
||||
|
this.$refs.comIssueDetailCard.forEach(r => { |
||||
|
r.resizeCollapse(); |
||||
|
}) |
||||
|
}); |
||||
|
}, |
||||
|
goScan(editPosition) { |
||||
|
|
||||
|
this.$refs.comIssueRequestPopup.openRequestPopup(editPosition); |
||||
|
}, |
||||
|
|
||||
|
//确定需求信息 |
||||
|
requestConfirm(action, item) { |
||||
|
if (item.itemCode == '' || item.itemCode == null) return; |
||||
|
|
||||
|
let that = this; |
||||
|
let request = that.requestList.find(r => r.itemCode == item.itemCode); |
||||
|
if (request == undefined) { |
||||
|
that.requestList.push(item); |
||||
|
this.getRecommendInfo(item); |
||||
|
|
||||
|
} else { |
||||
|
this.$refs.comMessage.showQuestionMessage('已经存在物料[' + item.itemCode + ']的需求信息,是否要修改?', res => { |
||||
|
if (res) { |
||||
|
request.qty = item.qty; |
||||
|
that.detailSource.forEach(detail => { |
||||
|
let index = detail.Items.findIndex(r => { |
||||
|
r.itemCode == item.itemCode |
||||
|
}) |
||||
|
detail.Items.splice(index, 1); |
||||
|
}) |
||||
|
this.getRecommendInfo(item); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getRecommendInfo(item) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: '加载中...', |
||||
|
mask: true |
||||
|
}) |
||||
|
getBalanceByBatchOffShelf(item.itemCode, item.qty).then(res => { |
||||
|
if (res.data == null) { |
||||
|
that.showMessage('未获取到推荐信息'); |
||||
|
} else { |
||||
|
if (res.data.length > 0) { |
||||
|
that.workShopCode = item.workshopCode; |
||||
|
res.data.forEach(r => { |
||||
|
r.toLocationCode = item.rawLocationCode; |
||||
|
r.productionLineCode = item.productionLineCode; |
||||
|
r.workStationCode = item.workStationCode; |
||||
|
// r.itemCode = item.itemCode; |
||||
|
r.itemName = item.itemName |
||||
|
r.uom = item.uom; |
||||
|
that.subList.push(r); |
||||
|
}) |
||||
|
that.detailSource = getDataSource(that.detailSource, that.subList) |
||||
|
//要修改一下数量 |
||||
|
that.detailSource.forEach(detail => { |
||||
|
detail.Items.forEach(i => { |
||||
|
let request = that.requestList.find(r => r |
||||
|
.itemCode == i |
||||
|
.itemCode); |
||||
|
i.qty = request.qty; |
||||
|
}) |
||||
|
}) |
||||
|
that.resizeCollapse(); |
||||
|
} else { |
||||
|
that.showMessage('列表数据为0'); |
||||
|
} |
||||
|
uni.hideLoading(); |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
that.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
caclcQty() { |
||||
|
var totalQty = 0; |
||||
|
this.detailSource.subList.forEach(res => { |
||||
|
totalQty = calc.add(totalQty, res.qty); |
||||
|
}) |
||||
|
this.detailSource.totalQty = totalQty; |
||||
|
}, |
||||
|
|
||||
|
openScanDetailPopup() { |
||||
|
var datacontent = {} |
||||
|
//克隆对象,深度克隆,防止双向绑定同一个变量 |
||||
|
// Object.assign(datacontent, this.detailSource); |
||||
|
var dataContent = { |
||||
|
allowModifyPackingNumber: "FALSE", |
||||
|
outInventoryStatuses: this.fromInventoryStatuses |
||||
|
} |
||||
|
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, dataContent); |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.updateCommitBtn(); |
||||
|
}, |
||||
|
|
||||
|
updateData(record) { |
||||
|
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode); |
||||
|
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode); |
||||
|
let itemHandleQty = 0; |
||||
|
if (item != undefined) { |
||||
|
item.Locations.forEach(l => { |
||||
|
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b |
||||
|
.packingNumber == null || b.packingNumber == '') && b.batch == |
||||
|
record.batch); |
||||
|
let handleQty = 0; |
||||
|
if (batch != undefined) { |
||||
|
batch.Records.forEach(res => { |
||||
|
handleQty = calc.add(handleQty, res.qty); |
||||
|
}) |
||||
|
batch.handleQty = handleQty; |
||||
|
itemHandleQty = calc.add(itemHandleQty, handleQty) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
this.resizeCollapse(); |
||||
|
// item.handleQty=itemHandleQty; |
||||
|
// this.closeScan(); |
||||
|
}, |
||||
|
removeItemCode(){ |
||||
|
var isClear =this.detailSource[0].Items.length==0 |
||||
|
if(isClear){ |
||||
|
this.clearData(); |
||||
|
this.$refs.comIssueRequestPopup.initData() |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
var subList = [] |
||||
|
var createTime = getCurrDateTime(); |
||||
|
var creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach(toLocationCode => { |
||||
|
toLocationCode.Items.forEach(item => { |
||||
|
item.Locations.forEach(fromLocation => { |
||||
|
fromLocation.Batchs.forEach(batch => { |
||||
|
let subItem = batch.detail; |
||||
|
subItem.recordList = []; |
||||
|
if (batch.Records.length > 0) { |
||||
|
batch.Records.forEach(r => { |
||||
|
let record = {}; |
||||
|
record.handleQty = r.qty; |
||||
|
|
||||
|
record.fromPackingNumber = r |
||||
|
.packingNumber; |
||||
|
record.fromBatch = r.batch; |
||||
|
record.fromContainerNumber = r |
||||
|
.ContainerNumber; |
||||
|
|
||||
|
record.toContainerNumber = r |
||||
|
.ContainerNumber; |
||||
|
record.toInventoryStatus = r |
||||
|
.inventoryStatus; |
||||
|
record.toLocationCode = subItem |
||||
|
.toLocationCode; |
||||
|
record.fromLocationCode = fromLocation |
||||
|
.fromLocationCode |
||||
|
record.supplierCode = r.supplierCode; |
||||
|
|
||||
|
let single_price = r.singlePrice == null ? |
||||
|
0 : r.singlePrice; |
||||
|
|
||||
|
record.singlePrice = single_price; |
||||
|
record.amount = single_price * r.qty; |
||||
|
|
||||
|
|
||||
|
//使用在途库不改变管理模式 |
||||
|
var info = getPackingNumberAndBatch( |
||||
|
this.managementList, r |
||||
|
.itemCode, |
||||
|
r.packingNumber, r |
||||
|
.batch); |
||||
|
record.toPackingNumber = info |
||||
|
.packingNumber; |
||||
|
record.toBatch = info.batch; |
||||
|
subItem.recordList.push(record); |
||||
|
}) |
||||
|
subList.push(subItem); |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
this.dataContent.subList = subList |
||||
|
this.dataContent.createTime = createTime; |
||||
|
this.dataContent.creator = creator; |
||||
|
return this.dataContent; |
||||
|
}, |
||||
|
submit() { |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
//目前任务只到一个库位 |
||||
|
var itemCodes = [] |
||||
|
let locationCode = this.detailSource[0].toLocationCode |
||||
|
this.detailSource.forEach(toLocation => { |
||||
|
toLocation.Items.forEach(item => { |
||||
|
itemCodes.push(item.itemCode) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
//获取管理模式,封装参数 |
||||
|
getManagementPrecisions(itemCodes, locationCode, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
this.submitJob(); |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
submitJob() { |
||||
|
var params = this.setParams() |
||||
|
console.log("提交参数", JSON.stringify(params)); |
||||
|
issueRecordSubmit(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) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clearData(); |
||||
|
this.$refs.comIssueRequestPopup.initData() |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
clearData() { |
||||
|
this.subList= [], //接口返回的任务subList |
||||
|
this.detailSource=[], //绑定在页面上的数据源 |
||||
|
this.detailOptions=[], |
||||
|
this.scanOptions= [], |
||||
|
this.workShopCode="", |
||||
|
this.requestList= [], |
||||
|
this.dataContent= {}, |
||||
|
this.managementList= [] |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) {} |
||||
|
}); |
||||
|
}, |
||||
|
showQuestionMessage(message) { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
// this.$refs.comMessage.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', res => { |
||||
|
// if (res) { |
||||
|
// that.clearInfo(); |
||||
|
// } |
||||
|
// }); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,558 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='showRequestPopup' v-if="detailSource.length==0"></com-blank-view> |
||||
|
</view> |
||||
|
<view class="page-wraper" v-if="detailSource.length>0"> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(toLocation, index) in detailSource" :key="index"> |
||||
|
<view class=""> |
||||
|
<view class="page-header"> |
||||
|
<view class="text_lightblue fontsize-16">目标库位:{{toLocation.toLocationCode}}</view> |
||||
|
</view> |
||||
|
<com-issue-detail-card ref='comRepleinshDetailCard' :dataContent="toLocation" |
||||
|
@updateData='updateData'> |
||||
|
</com-issue-detail-card> |
||||
|
</view> |
||||
|
<!-- <view class='split_line'></view> --> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
</view> |
||||
|
<com-repleinsh-request-popup ref="comRepleinshRequestPopup" :toLocationAreaTypeList="toLocationAreaTypeList" |
||||
|
@confirm='requestConfirm' |
||||
|
:itemCodeTypeList="itemCodeTypeList"> |
||||
|
</com-repleinsh-request-popup> |
||||
|
<win-scan-button v-if='detailSource.length>0' @goScan='openScanDetailPopup'></win-scan-button> |
||||
|
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'> |
||||
|
</com-scan-issue-pack> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
repleinshRecordSubmit, |
||||
|
getBalanceByBatchOffShelf |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
getCurrDateTime, |
||||
|
getPackingNumberAndBatch |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getInventoryStatusDesc, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailRemoveOption, |
||||
|
getDetailEditRemoveOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
calcHandleQty |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
getDataSource |
||||
|
} from '@/pages/issue/js/issue.js'; |
||||
|
|
||||
|
import { |
||||
|
getManagementPrecisions |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
||||
|
import comRepleinshRequestPopup from '@/pages/repleinsh/coms/comRepleinshRequestPopup.vue' |
||||
|
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue' |
||||
|
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
comBlankView, |
||||
|
winScanPackAndLocation, |
||||
|
recordComDetailCard, |
||||
|
comRepleinshRequestPopup, |
||||
|
comIssueDetailCard, |
||||
|
comScanIssuePack |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
receiptJob: {}, |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
businessTypeInfo: {}, |
||||
|
fromLocationCode: "", |
||||
|
toLocationCode: "", |
||||
|
toLocationAreaTypeList: [], |
||||
|
allowModifyLocation: false, |
||||
|
businessType: {}, |
||||
|
requestList: [], |
||||
|
managementList: [], |
||||
|
dataContent: {}, |
||||
|
itemCodeTypeList:[] |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
var typeCode = "Repleinment" |
||||
|
getBusinessType(typeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.itemCodeTypeList = res.itemCodeTypeList; |
||||
|
this.toLocationAreaTypeList = res.toLocationAreaTypeList; |
||||
|
this.showRequestPopup(); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() {}, |
||||
|
|
||||
|
mounted() {}, |
||||
|
methods: { |
||||
|
closeScan() { |
||||
|
this.resizeCollapse(); |
||||
|
}, |
||||
|
resizeCollapse() { |
||||
|
this.$nextTick(r => { |
||||
|
this.$refs.comRepleinshDetailCard.forEach(r => { |
||||
|
r.resizeCollapse(); |
||||
|
}) |
||||
|
}); |
||||
|
}, |
||||
|
showRequestPopup() { |
||||
|
this.$refs.comRepleinshRequestPopup.openRequestPopup(); |
||||
|
}, |
||||
|
|
||||
|
//确定需求信息 |
||||
|
requestConfirm(action, item) { |
||||
|
if (item.itemCode == '' || item.itemCode == null) return; |
||||
|
let that = this; |
||||
|
let request = that.requestList.find(r => r.itemCode == item.itemCode); |
||||
|
if (request == undefined) { |
||||
|
that.requestList.push(item); |
||||
|
this.getRecommendInfo(item); |
||||
|
|
||||
|
} else { |
||||
|
this.$refs.comMessage.showQuestionMessage('已经存在物料[' + item.itemCode + ']的需求信息,是否要修改?', res => { |
||||
|
if (res) { |
||||
|
request.qty = item.qty; |
||||
|
that.detailSource.forEach(detail => { |
||||
|
let index = detail.Items.findIndex(r => { |
||||
|
r.itemCode == item.itemCode |
||||
|
}) |
||||
|
detail.Items.splice(index, 1); |
||||
|
}) |
||||
|
this.getRecommendInfo(item); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getRecommendInfo(item) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: '加载中...', |
||||
|
mask: true |
||||
|
}) |
||||
|
getBalanceByBatchOffShelf(item.itemCode, item.qty).then(res => { |
||||
|
if (res.data == null) { |
||||
|
that.showMessage('未获取到推荐信息'); |
||||
|
} else { |
||||
|
if (res.data.length > 0) { |
||||
|
res.data.forEach(r => { |
||||
|
r.toLocationCode = item.toLocation.code; |
||||
|
r.itemName = item.itemName |
||||
|
r.uom = item.uom; |
||||
|
that.subList.push(r); |
||||
|
}) |
||||
|
|
||||
|
that.detailSource = getDataSource(that.detailSource, that.subList) |
||||
|
//要修改一下数量 |
||||
|
that.detailSource.forEach(detail => { |
||||
|
detail.Items.forEach(i => { |
||||
|
let request = that.requestList.find(r => r |
||||
|
.itemCode == i |
||||
|
.itemCode); |
||||
|
i.qty = request.qty; |
||||
|
}) |
||||
|
}) |
||||
|
// that.resizeCollapse(); |
||||
|
} else { |
||||
|
that.showMessage('列表数据为0'); |
||||
|
} |
||||
|
uni.hideLoading(); |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
that.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
caclcQty() { |
||||
|
var totalQty = 0; |
||||
|
this.detailSource.subList.forEach(res => { |
||||
|
totalQty = calc.add(totalQty, res.qty) |
||||
|
}) |
||||
|
this.detailSource.totalQty = totalQty; |
||||
|
}, |
||||
|
|
||||
|
openScanDetailPopup() { |
||||
|
var datacontent = {} |
||||
|
//克隆对象,深度克隆,防止双向绑定同一个变量 |
||||
|
// Object.assign(datacontent, this.detailSource); |
||||
|
var dataContent = { |
||||
|
allowModifyPackingNumber: "FALSE", |
||||
|
outInventoryStatuses: this.fromInventoryStatuses |
||||
|
} |
||||
|
this.$refs.comScanIssuePack.openScanPopup(this.detailSource, dataContent); |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.updateCommitBtn(); |
||||
|
}, |
||||
|
|
||||
|
updateData(record) { |
||||
|
let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode); |
||||
|
let item = requestLocation.Items.find(r => r.itemCode == record.itemCode); |
||||
|
let itemHandleQty = 0; |
||||
|
if (item != undefined) { |
||||
|
item.Locations.forEach(l => { |
||||
|
let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b |
||||
|
.packingNumber == null || b.packingNumber == '') && b.batch == |
||||
|
record.batch); |
||||
|
let handleQty = 0; |
||||
|
if (batch != undefined) { |
||||
|
batch.Records.forEach(res => { |
||||
|
handleQty = calc.add(handleQty, res.qty) |
||||
|
}) |
||||
|
batch.handleQty = handleQty; |
||||
|
itemHandleQty = calc.add(itemHandleQty, handleQty) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
this.resizeCollapse(); |
||||
|
// item.handleQty=itemHandleQty; |
||||
|
// this.closeScan(); |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
calcHandleQty() { |
||||
|
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(); |
||||
|
}, |
||||
|
|
||||
|
removeItem(index, item) { |
||||
|
this.detailSource.splice(index, 1) |
||||
|
}, |
||||
|
|
||||
|
removePack() { |
||||
|
for (var i = 0; i < this.detailSource.length; i++) { |
||||
|
var item = this.detailSource[i]; |
||||
|
if (item.subList.length == 0) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
this.$refs.scanPopup.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(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
submit() { |
||||
|
if(this.getScanCount()==0){ |
||||
|
this.showErrorMessage("当前扫描数为0,请先扫描在提交"); |
||||
|
return |
||||
|
} |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
//目前任务只到一个库位 |
||||
|
var itemCodes = [] |
||||
|
let locationCode = this.detailSource[0].toLocationCode |
||||
|
this.detailSource.forEach(toLocation => { |
||||
|
toLocation.Items.forEach(item => { |
||||
|
itemCodes.push(item.itemCode) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
//获取管理模式,封装参数 |
||||
|
getManagementPrecisions(itemCodes, locationCode, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
this.submitJob(); |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
submitJob() { |
||||
|
var params = this.setParams() |
||||
|
console.log("提交参数", JSON.stringify(params)); |
||||
|
repleinshRecordSubmit(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) |
||||
|
}) |
||||
|
}, |
||||
|
setParams() { |
||||
|
var subList = [] |
||||
|
var createTime = getCurrDateTime(); |
||||
|
var creator = this.$store.state.user.id |
||||
|
this.detailSource.forEach(toLocationCode => { |
||||
|
toLocationCode.Items.forEach(item => { |
||||
|
item.Locations.forEach(fromLocation => { |
||||
|
fromLocation.Batchs.forEach(batch => { |
||||
|
let subItem = batch.detail; |
||||
|
subItem.recordList = []; |
||||
|
|
||||
|
if (batch.Records.length > 0) { |
||||
|
batch.Records.forEach(r => { |
||||
|
let record = {}; |
||||
|
record.handleQty = r.qty; |
||||
|
|
||||
|
record.fromPackingNumber = r |
||||
|
.packingNumber; |
||||
|
record.fromBatch = r.batch; |
||||
|
record.fromContainerNumber = r |
||||
|
.ContainerNumber; |
||||
|
|
||||
|
record.toContainerNumber = r |
||||
|
.ContainerNumber; |
||||
|
record.toInventoryStatus = r |
||||
|
.inventoryStatus; |
||||
|
record.toLocationCode = subItem |
||||
|
.toLocationCode; |
||||
|
record.fromLocationCode = fromLocation |
||||
|
.fromLocationCode |
||||
|
record.supplierCode = r.supplierCode; |
||||
|
|
||||
|
//使用在途库不改变管理模式 |
||||
|
var info = getPackingNumberAndBatch( |
||||
|
this.managementList, r |
||||
|
.itemCode, |
||||
|
r.packingNumber, r |
||||
|
.batch); |
||||
|
record.toPackingNumber = info |
||||
|
.packingNumber; |
||||
|
record.toBatch = info.batch; |
||||
|
subItem.recordList.push(record); |
||||
|
}) |
||||
|
subList.push(subItem); |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
this.dataContent.subList = subList |
||||
|
this.dataContent.createTime = createTime; |
||||
|
this.dataContent.creator = creator; |
||||
|
return this.dataContent; |
||||
|
}, |
||||
|
|
||||
|
getScanCount(){ |
||||
|
var scanCount = 0; |
||||
|
var subList = [] |
||||
|
this.detailSource.forEach(toLocationCode => { |
||||
|
toLocationCode.Items.forEach(item => { |
||||
|
item.Locations.forEach(fromLocation => { |
||||
|
fromLocation.Batchs.forEach(batch => { |
||||
|
let subItem = batch.detail; |
||||
|
subItem.recordList = []; |
||||
|
|
||||
|
if (batch.Records.length > 0) { |
||||
|
batch.Records.forEach(r => { |
||||
|
let record = {}; |
||||
|
record.handleQty = r.qty; |
||||
|
subItem.recordList.push(record); |
||||
|
}) |
||||
|
subList.push(subItem); |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
return scanCount =subList.length; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
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.getToLocationCode(location, code) |
||||
|
}, |
||||
|
getFromLocationCode(location, code) { |
||||
|
this.fromLocationCode = code; |
||||
|
this.openScanPopup(); |
||||
|
}, |
||||
|
getToLocationCode(location, code) { |
||||
|
// if (this.fromLocationCode == code) { |
||||
|
// uni.showToast({ |
||||
|
// title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致", |
||||
|
// duration: 2000 |
||||
|
// }) |
||||
|
// return |
||||
|
// } |
||||
|
this.ToLocationCodeInfo = location; |
||||
|
this.toLocationCode = code; |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.clearData(); |
||||
|
}) |
||||
|
}, |
||||
|
clearData() { |
||||
|
this.fromLocationCode = ''; |
||||
|
this.detailSource = []; |
||||
|
this.requestList = []; |
||||
|
this.dataContent = {} |
||||
|
this.managementList = [] |
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</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…
Reference in new issue