lijuncheng
11 months ago
8 changed files with 603 additions and 110 deletions
@ -0,0 +1,51 @@ |
|||||
|
<template> |
||||
|
<view class="header_job_top"> |
||||
|
<view class="cen_card"> |
||||
|
<view class="cell_box uni-flex uni-row"> |
||||
|
<view class="cell_info"> |
||||
|
<view class="text_lightblue">车间</view> |
||||
|
<view>{{workshopCode}}</view> |
||||
|
</view> |
||||
|
<view class="cell_info"> |
||||
|
<view class="text_lightblue">生产线</view> |
||||
|
<view>{{productionLineCode}}</view> |
||||
|
</view> |
||||
|
<view class="cell_info"> |
||||
|
<view class="text_lightblue">工位</view> |
||||
|
<view>{{ workStationCode }}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
watch: {}, |
||||
|
|
||||
|
props: { |
||||
|
workshopCode: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
}, |
||||
|
productionLineCode: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
}, |
||||
|
workStationCode: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
methods: {} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -1,29 +1,464 @@ |
|||||
<template> |
<template> |
||||
<view class="page-wraper"> |
<view class="page-wraper"> |
||||
<comReturn businessTypeCode="ReturnToHold" > </comReturn> |
<view class=""> |
||||
|
<com-blank-view @goScan='openScanPopup(true)' v-if="detailSource.length==0"></com-blank-view> |
||||
|
</view> |
||||
|
<view class="page-wraper" v-if="detailSource.length>0"> |
||||
|
<view class="page-header"> |
||||
|
<comReturnRecordTitle :workshopCode="workshopCode" |
||||
|
:productionLineCode="productionLineCode" |
||||
|
:workStationCode ="workStationCode" |
||||
|
></comReturnRecordTitle> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
<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=""> |
||||
|
<comReturnRecord :dataContent="item" :index="index" |
||||
|
@removeItem="removeItem(index,item)" @updateData="updateData" @removePack="removePack"> |
||||
|
</comReturnRecord> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
</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="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<win-scan-button @goScan='openScanPopup(false)'></win-scan-button> |
||||
|
</view> |
||||
|
<winScanPackAndPosition ref="scanPopup" @getResult='getScanResult'></winScanPackAndPosition> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
</view> |
</view> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import comReturn from '@/pages/productionReturn/coms/comReturn.vue' |
import { |
||||
|
productionReturnRecordSubmit, |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
getPackingNumberAndBatchByList |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
} from '@/common/record.js'; |
||||
|
import { |
||||
|
getPrecisionStrategyList, |
||||
|
getPrecisionStrategyParams |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comReturnRecord from '@/pages/productionReturn/coms/comReturnRecord.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import winScanPackAndPosition from "@/mycomponents/scan/winScanPackAndPosition.vue" |
||||
|
import comReturnRecordTitle from '@/pages/productionReturn/coms/comReturnRecordTitle.vue' |
||||
|
|
||||
|
|
||||
|
|
||||
export default { |
export default { |
||||
|
name: 'comReturn', |
||||
components: { |
components: { |
||||
comReturn |
winScanButton, |
||||
|
comReturnRecordTitle, |
||||
|
requiredLocation, |
||||
|
comBlankView, |
||||
|
comMessage, |
||||
|
comReturnRecord, |
||||
|
winScanPack, |
||||
|
winScanPackAndPosition |
||||
}, |
}, |
||||
data() { |
|
||||
|
|
||||
|
watch: {}, |
||||
|
|
||||
|
data() { |
||||
return { |
return { |
||||
|
id: '', |
||||
|
dataContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
fromLocationCode: '', |
||||
|
fromLocationTypeList: [], |
||||
|
toLocationCode: '', |
||||
|
tolocationTypeList: [], |
||||
|
businessType: {}, |
||||
|
inventoryStatus: '', |
||||
|
managementList: [], |
||||
|
show: false, |
||||
|
positionList: [], |
||||
|
productionLineCode: '', |
||||
|
rawLocationCode: "", |
||||
|
fgLocationCode: "", |
||||
|
workshopCode: "", |
||||
|
workStationCode: "", |
||||
|
workShopName: "", |
||||
|
productionLineName: "", |
||||
|
workStationName: "", |
||||
|
businessTypeCode :"ReturnToHold", |
||||
|
positionInfo:"", |
||||
|
recommendLocationList: [], //推荐库位列表 |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
onLoad() { |
||||
|
getBusinessType(this.businessTypeCode, res => { |
||||
|
if (res.success) { |
||||
|
this.businessType = res.businessType; |
||||
|
this.fromlocationTypeList = res.fromlocationTypeList; |
||||
|
this.tolocationTypeList = res.tolocationTypeList; |
||||
|
this.openScanPopup(true); |
||||
|
} else { |
||||
|
this.showErrorMessage(res.message) |
||||
} |
} |
||||
|
}); |
||||
}, |
}, |
||||
|
mounted() { |
||||
|
|
||||
|
|
||||
onLoad(option) { |
|
||||
}, |
}, |
||||
|
|
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) {}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
}, |
||||
|
|
||||
methods: { |
methods: { |
||||
|
openScanPopup(isEditPosition) { |
||||
|
this.$refs.scanPopup.openScanPopup(isEditPosition); |
||||
|
}, |
||||
|
|
||||
|
getScanResult(result,param) { |
||||
|
this.positionInfo = param.positionInfo; |
||||
|
this.workshopCode = param.workshopCode; |
||||
|
this.productionLineCode = param.productionLineCode; |
||||
|
this.workStationCode = param.workStationCode ; |
||||
|
|
||||
|
let label = result.label; |
||||
|
let pack = result.package; |
||||
|
|
||||
|
var item = this.detailSource.find(res => { |
||||
|
if (res.itemCode == label.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (item == undefined) { |
||||
|
var itemp = this.createItemInfo(label, pack); |
||||
|
let newDetail = this.createDetailInfo(label, pack); |
||||
|
newDetail.toLocationCode = "HOLD"; |
||||
|
itemp.subList.push(newDetail); |
||||
|
this.detailSource.push(itemp) |
||||
|
|
||||
|
} else { |
||||
|
var detail = item.subList.find(r => { |
||||
|
if (r.packingNumber == label.packingNumber && |
||||
|
r.batch == label.batch) { |
||||
|
return r; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
if (detail == undefined) { |
||||
|
let newDetail = this.createDetailInfo(label, pack); |
||||
|
newDetail.toLocationCode ="HOLD"; |
||||
|
item.subList.push(newDetail); |
||||
|
|
||||
|
} else { |
||||
|
if (detail.scaned == true) { |
||||
|
this.showErrorMessage("箱码[" + label.packingNumber + "批次[" + label.batch + "]已经在列表中") |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
createItemInfo(label, pack) { |
||||
|
let item = { |
||||
|
itemCode: label.itemCode, |
||||
|
itemName: pack.itemName, |
||||
|
stdPackQty: pack.stdPackQty, |
||||
|
stdPackUnit: pack.stdPackUnit, |
||||
|
qty: Number(label.qty), |
||||
|
handleQty: 0, |
||||
|
uom: pack.uom, |
||||
|
subList: [] |
||||
|
} |
||||
|
return item; |
||||
|
}, |
||||
|
|
||||
|
createDetailInfo(label, pack) { |
||||
|
let detail = {}; |
||||
|
Object.assign(detail, label) |
||||
|
detail.scaned = true; |
||||
|
detail.qty = Number(label.qty); |
||||
|
detail.inventoryStatus = "HOLD" |
||||
|
detail.stdPackQty = pack.stdPackQty; |
||||
|
detail.stdPackUnit = pack.stdPackUnit; |
||||
|
|
||||
|
detail.package = pack; |
||||
|
detail.label = label; |
||||
|
return detail; |
||||
|
}, |
||||
|
|
||||
|
calcHandleQty() { |
||||
|
for (let item of this.detailSource) { |
||||
|
item.qty = 0; |
||||
|
for (let detail of item.subList) { |
||||
|
if (detail != undefined) { |
||||
|
item.qty += Number(detail.qty) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.scanPopupGetFocus(); |
||||
|
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(); |
||||
|
}, |
||||
|
|
||||
|
showSelect() { |
||||
|
this.show = !this.show |
||||
|
}, |
||||
|
updateData() { |
||||
|
this.calcHandleQty(); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
removeData(item) { |
||||
|
for (let i = 0; i < this.detailSource.length; i++) { |
||||
|
if (this.detailSource[i].itemCode == item.itemCode) { |
||||
|
this.detailSource.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
commit() { |
||||
|
if (this.positionInfo == "请选择位置") { |
||||
|
this.showMessage("请先选择位置") |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
||||
|
//查询管理模式 |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.managementList = []; |
||||
|
var precisionStrategParams = getPrecisionStrategyParams(this.detailSource) |
||||
|
|
||||
|
getPrecisionStrategyList(precisionStrategParams, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
var params = this.setParams() |
||||
|
console.log("提交" + JSON.stringify(params)) |
||||
|
productionReturnRecordSubmit(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); |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
setPrecisionStrategParams() { |
||||
|
var itemList = [] |
||||
|
this.detailSource.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
var filterResult = itemList.filter(res => { |
||||
|
if (res.itemCode == item.itemCode && |
||||
|
detail.toLocationCode == res.locationCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
//去掉重复元素 |
||||
|
if (filterResult.length == 0) { |
||||
|
var result = { |
||||
|
itemCode: item.itemCode, |
||||
|
locationCode: detail.toLocationCode |
||||
|
} |
||||
|
itemList.push(result) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return itemList; |
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
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); |
||||
|
detail.itemCode = detail.itemCode; |
||||
|
detail.itemName = detail.package.itemName; |
||||
|
detail.itemDesc1 = detail.package.itemDesc1; |
||||
|
detail.itemDesc2 = detail.package.itemDesc2; |
||||
|
|
||||
|
detail.inventoryStatus = detail.inventoryStatus; |
||||
|
|
||||
|
detail.fromPackingNumber = info.packingNumber; |
||||
|
detail.toPackingNumber = info.packingNumber; |
||||
|
|
||||
|
detail.fromContainerNumber = detail.containerNumber; |
||||
|
detail.toContainerNumber = detail.containerNumber |
||||
|
|
||||
|
detail.fromBatch = info.batch; |
||||
|
detail.toBatch = info.batch; |
||||
|
|
||||
|
detail.fromLocationCode = detail.locationCode; |
||||
|
detail.toLocationCode = detail.toLocationCode; |
||||
|
|
||||
|
detail.productionlineCode = this.productionLineCode; |
||||
|
detail.workStationCode = this.workStationCode; |
||||
|
|
||||
|
subList.push(detail) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
this.dataContent.subList = subList; |
||||
|
this.dataContent.creator = creator; |
||||
|
this.dataContent.workshopCode = this.workshopCode; |
||||
|
this.dataContent.businessType = this.businessTypeCode; |
||||
|
return this.dataContent; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
this.scanPopupLoseFocus(); |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
this.$refs.scanPopup.getfocus(); |
||||
|
}, |
||||
|
|
||||
|
scanPopupLoseFocus() { |
||||
|
this.$refs.scanPopup.losefocus(); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
this.subList = []; |
||||
|
this.detailSource = []; |
||||
|
this.toLocationCode = ''; |
||||
|
this.dataContent = {}; |
||||
|
this.positionInfo = "请选择位置"; |
||||
|
}) |
||||
|
}, |
||||
} |
} |
||||
} |
} |
||||
</script> |
</script> |
||||
|
|
||||
<style> |
<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> |
</style> |
||||
|
Loading…
Reference in new issue