niexiting
12 months ago
43 changed files with 1902 additions and 784 deletions
@ -0,0 +1,407 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<com-empty-view v-if="requestList.length==0"></com-empty-view> |
||||
|
<request-filter ref="filter" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber" |
||||
|
:checkedWaitTask="checkedWaitTask"> |
||||
|
</request-filter> |
||||
|
<view v-if="requestList.length>0"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<view v-for="(item, index) in requestList" :key="index"> |
||||
|
<uni-swipe-action-item :right-options="item.options" @click="swipeClick($event,item)"> |
||||
|
<com-return-request-card :dataContent="item" @click='openRequestDetail(item)'> |
||||
|
</com-return-request-card> |
||||
|
</uni-swipe-action-item> |
||||
|
</view> |
||||
|
</uni-swipe-action> |
||||
|
<uni-load-more :status="loadingType" /> |
||||
|
<request-info-popup ref='requestInfoPopup'></request-info-popup> |
||||
|
</view> |
||||
|
<requestButton @goScan='openScanDetailPopup'></requestButton> |
||||
|
</view> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import requestFilter from '@/mycomponents/request/requestFilter.vue' |
||||
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
||||
|
import comReturnRequestCard from '@/pages/productionReturn/coms/comReturnRequestCard.vue' |
||||
|
import requestInfoPopup from '@/pages/productionReturn/coms/requestInfoPopup.vue' |
||||
|
import requestButton from '@/mycomponents/button/requestButton.vue' |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
} from '@/common/record.js'; |
||||
|
import { |
||||
|
getProductionReturnRequestList, |
||||
|
productionReturnRequestHandle, |
||||
|
productionReturnRequestSubmitApprove, |
||||
|
productionReturnRequestSubmitApproveAgree, |
||||
|
productionReturnRequestSubmitApproveRefused, |
||||
|
productionReturnRequestClose |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailAndApproveOption, |
||||
|
getDetailAndApprovePassAndApproveNoOption, |
||||
|
getDetailAndHandleOption, |
||||
|
getDetailAndCloseOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
comEmptyView, |
||||
|
requestFilter, |
||||
|
requiredLocation, |
||||
|
comMessage, |
||||
|
comReturnRequestCard, |
||||
|
requestInfoPopup, |
||||
|
requestButton, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
requestList: [], |
||||
|
pageNo: 1, |
||||
|
pageSize: 10, |
||||
|
status: "", |
||||
|
totalCount: 0, |
||||
|
checkedWaitTask: false, |
||||
|
detailOptions: [], |
||||
|
detailAndApproveOptions: [], |
||||
|
detailAndApprovePassAndApproveNoOption: [], |
||||
|
detailAndHandleOption: [], |
||||
|
detailAndCloseOption: [], |
||||
|
showOptions: [], |
||||
|
loadingType: "nomore", |
||||
|
title:"", |
||||
|
fromType:"" |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
props: { |
||||
|
businessType: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} else if (e.index == 1) { |
||||
|
this.$refs.filter.openFilter(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
mounted() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.detailAndApproveOptions = getDetailAndApproveOption() |
||||
|
this.detailAndApprovePassAndApproveNoOption = getDetailAndApprovePassAndApproveNoOption(), |
||||
|
this.detailAndHandleOption = getDetailAndHandleOption() |
||||
|
this.detailAndCloseOption = getDetailAndCloseOption() |
||||
|
this.updateTitle(); |
||||
|
this.getList('refresh'); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
updateTitle() { |
||||
|
if (this.businessType == 'ReturnToStore') { |
||||
|
this.title = "生产合格退料申请" |
||||
|
this.fromType ="ReturnToStore" |
||||
|
} else if (this.businessType == 'ReturnToHold') { |
||||
|
this.title = "生产隔离退料申请" |
||||
|
this.fromType ="ReturnToHold" |
||||
|
} |
||||
|
updateTitle(this.title) |
||||
|
}, |
||||
|
|
||||
|
onShow(){ |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
onReachBottom() { |
||||
|
//避免多次触发 |
||||
|
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
||||
|
return; |
||||
|
} |
||||
|
this.getList("more"); |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
|
||||
|
openRequestInfoPopup(item) { |
||||
|
this.$refs.requestInfoPopup.openPopup(item) |
||||
|
}, |
||||
|
openRequestDetail(item) { |
||||
|
uni.navigateTo({ |
||||
|
url: './requestDetail?id=' + item.id |
||||
|
}); |
||||
|
}, |
||||
|
getList(type) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.loadingType = "loading"; |
||||
|
if (type === "refresh") { |
||||
|
this.pageNo = 1; |
||||
|
this.requestList = []; |
||||
|
} |
||||
|
var filters = [] |
||||
|
if (this.checkedWaitTask) { |
||||
|
filters.push({ |
||||
|
column: "status", |
||||
|
action: "==", |
||||
|
value: this.status |
||||
|
}) |
||||
|
} |
||||
|
filters.push({ |
||||
|
column: "business_type", |
||||
|
action: "==", |
||||
|
value: this.businessType |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: this.pageNo, |
||||
|
pageSize: this.pageSize, |
||||
|
} |
||||
|
getProductionReturnRequestList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
|
||||
|
var list = res.data.list; |
||||
|
this.totalCount = res.data.total |
||||
|
this.loadingType = "loadmore"; |
||||
|
if (list == null || list.length == 0) { |
||||
|
this.loadingType = "nomore"; |
||||
|
return; |
||||
|
} |
||||
|
list.forEach(res => { |
||||
|
var options = this.updateOptions(res.status); |
||||
|
res.options = options; |
||||
|
}) |
||||
|
this.requestList = type === "refresh" ? list : this.requestList.concat(list); |
||||
|
|
||||
|
this.pageNo++; |
||||
|
updateTitle(this.title+"("+this.totalCount + ")") |
||||
|
|
||||
|
}).catch(error => { |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
updateTitle(this.title) |
||||
|
this.loadingType = ""; |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
updateOptions(status) { |
||||
|
if (status == "1") { |
||||
|
this.showOptions = this.detailAndApproveOptions; |
||||
|
} else if (status == "2") { |
||||
|
this.showOptions = this.detailAndApprovePassAndApproveNoOption; |
||||
|
} else if (status == "3") { |
||||
|
this.showOptions = this.detailAndHandleOption; |
||||
|
} else if (status == "4") { |
||||
|
this.showOptions = this.detailAndCloseOption; |
||||
|
} else { |
||||
|
this.showOptions = this.detailOptions; |
||||
|
} |
||||
|
return this.showOptions |
||||
|
}, |
||||
|
|
||||
|
openScanDetailPopup() { |
||||
|
uni.navigateTo({ |
||||
|
url: "./returnToStoreRequestSubmit?fromType=" + this.fromType |
||||
|
}) |
||||
|
}, |
||||
|
openFilter(){ |
||||
|
this.$refs.filter.openFilter(); |
||||
|
}, |
||||
|
|
||||
|
swipeClick(e, dataContent) { |
||||
|
var text = clearTirmAndWrap(e.content.text) |
||||
|
if (e.content.text == "详情") { |
||||
|
this.openRequestInfoPopup(dataContent); |
||||
|
} else if (e.content.text == "处理") { |
||||
|
this.showQuestionMessage("确定要处理当前申请吗?",res=>{ |
||||
|
this.productionReturnRequestHandle(dataContent.id) |
||||
|
}) |
||||
|
} else if (e.content.text == "审批") { |
||||
|
this.showQuestionMessage("确定要审批当前申请吗?",res=>{ |
||||
|
this.productionReturnRequestSubmitApprove(dataContent.id) |
||||
|
}) |
||||
|
} else if (e.content.text == "审批通过") { |
||||
|
this.showQuestionMessage("确定要审批通过当前申请吗?",res=>{ |
||||
|
this.productionReturnRequestSubmitApproveAgree(dataContent.id) |
||||
|
}) |
||||
|
} else if (e.content.text == "审批驳回") { |
||||
|
this.showQuestionMessage("确定要审批驳回当前申请吗?",res=>{ |
||||
|
this.productionReturnRequestSubmitApproveRefused(dataContent.id) |
||||
|
}) |
||||
|
} else if (e.content.text == "关闭") { |
||||
|
this.showQuestionMessage("确定要关闭当前申请吗?",res=>{ |
||||
|
this.productionReturnRequestClose(dataContent.id) |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
showQuestionMessage(hint,callBack){ |
||||
|
this.$refs.comMessage.showQuestionMessage(hint, |
||||
|
res => { |
||||
|
if (res) { |
||||
|
callBack() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
switchChangeWait(state, jobStatus) { |
||||
|
this.checkedWaitTask = state; |
||||
|
this.status = jobStatus; |
||||
|
this.getList("refresh"); |
||||
|
}, |
||||
|
|
||||
|
getScanNumber(code) { |
||||
|
this.getDataListByType(code) |
||||
|
}, |
||||
|
|
||||
|
getDataListByType(code) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
var filters = [] |
||||
|
filters.push({ |
||||
|
column: "number", |
||||
|
action: "==", |
||||
|
value: code |
||||
|
}) |
||||
|
|
||||
|
var params = { |
||||
|
filters: filters, |
||||
|
pageNo: 1, |
||||
|
pageSize: 100, |
||||
|
} |
||||
|
getProductionReturnRequestList(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data.list.length == 0) { |
||||
|
that.showMessage('未查找到' + '【' + code + '】的收货任务'); |
||||
|
} else if (res.data.list.length == 1) { |
||||
|
that.openRequestDetail(res.data.list[0]); |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(error); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
productionReturnRequestSubmitApprove(id) { |
||||
|
productionReturnRequestSubmitApprove(id).then(res => { |
||||
|
if (res.data) { |
||||
|
this.getList("refresh") |
||||
|
uni.showToast({ |
||||
|
title: "申请提交审批成功" |
||||
|
}) |
||||
|
} else { |
||||
|
this.showMessage("申请提交审批失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
productionReturnRequestClose(id) { |
||||
|
productionReturnRequestClose(id).then(res => { |
||||
|
if (res.data) { |
||||
|
this.getList("refresh") |
||||
|
uni.showToast({ |
||||
|
title: "申请关闭成功" |
||||
|
}) |
||||
|
} else { |
||||
|
this.showMessage("申请关闭失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
productionReturnRequestSubmitApproveAgree(id) { |
||||
|
productionReturnRequestSubmitApproveAgree(id).then(res => { |
||||
|
if (res.data) { |
||||
|
this.getList("refresh") |
||||
|
uni.showToast({ |
||||
|
title: "申请审批通过成功" |
||||
|
}) |
||||
|
} else { |
||||
|
this.showMessage("申请审批通过失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
productionReturnRequestSubmitApproveRefused(id) { |
||||
|
productionReturnRequestSubmitApproveRefused(id).then(res => { |
||||
|
if (res.data) { |
||||
|
this.getList("refresh") |
||||
|
uni.showToast({ |
||||
|
title: "申请审批驳回成功" |
||||
|
}) |
||||
|
} else { |
||||
|
this.showMessage("申请审批驳回失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
productionReturnRequestHandle(id) { |
||||
|
productionReturnRequestHandle(id).then(res => { |
||||
|
if (res.data) { |
||||
|
this.getList("refresh") |
||||
|
uni.showToast({ |
||||
|
title: "申请处理成功" |
||||
|
}) |
||||
|
} else { |
||||
|
this.showMessage("申请处理失败") |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
this.showMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,102 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-collapse ref="collapse"> |
||||
|
<uni-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<view class="" style="font-size: 32rpx;"> |
||||
|
<view class="" > |
||||
|
车间 : {{dataContent.workShopName}} ({{dataContent.workshopCode}}) |
||||
|
</view> |
||||
|
<view class="" > |
||||
|
类型 : {{getType(dataContent.businessType)}} |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
总数量 : {{dataContent.totalQty}} |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
</template> |
||||
|
<u-line /> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<view v-for="(item, index) in dataContent.subList" :key="index"> |
||||
|
<uni-swipe-action-item> |
||||
|
<view class="" style="font-size: 32rpx;margin: 10rpx;"> |
||||
|
<view class=""> |
||||
|
生产线 : {{item.productionLineName}}({{item.productionLineCode}}) |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
工位 : {{item.workStationName}} ({{item.workStationCode}}) |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
物品代码 : {{item.itemCode}} |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
物品名称 : {{item.itemName}} |
||||
|
</view> |
||||
|
|
||||
|
<view class="uni-flex uni-row uni-center"> |
||||
|
<view class=""> |
||||
|
数量 : {{item.qty}} 单位 : |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
<uom :uom="item.uom"></uom> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</uni-swipe-action-item> |
||||
|
<u-line /> |
||||
|
</view> |
||||
|
</uni-swipe-action> |
||||
|
|
||||
|
</uni-collapse-item> |
||||
|
</uni-collapse> |
||||
|
|
||||
|
|
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import uom from '@/mycomponents/qty/uom.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
uom |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
props: { |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
}, |
||||
|
methods: { |
||||
|
update(){ |
||||
|
this.$nextTick(r => { |
||||
|
this.$refs.collapse.resize() |
||||
|
}); |
||||
|
}, |
||||
|
getType(value){ |
||||
|
var type ="" |
||||
|
if(value=="ReturnToStore"){ |
||||
|
type ="合格退料" |
||||
|
}else if (value=='ReturnToHold'){ |
||||
|
type ="隔离退料" |
||||
|
} |
||||
|
return type; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,372 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup" :maskClick="false"> |
||||
|
<view class="uni-flex uni-column pop_customer"> |
||||
|
<view class="" style="padding:10rpx"> |
||||
|
<view class="uni-flex u-col-center uni-row space-between" style="padding: 10rpx 10rpx 20rpx 10rpx"> |
||||
|
<view class="" style="font-size: 35rpx;"> |
||||
|
{{title}} |
||||
|
</view> |
||||
|
<image style="width: 35rpx;height: 35rpx;" src="/static/icons/icons_close.svg" |
||||
|
@click="closeRequestPopup()"></image> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
<view class="uni-flex uni-column" style="background-color: white; "> |
||||
|
<view class="uni-flex uni-column "> |
||||
|
<view class="uni-flex uni-row padding title u-col-center"> |
||||
|
<text>位置 : </text> |
||||
|
<view class="uni-flex u-col-center uni-row" @click="showSelect"> |
||||
|
<view class="" style="margin-left: 20rpx;"> |
||||
|
{{positionInfo}} |
||||
|
</view> |
||||
|
<u-select v-model="show" mode="mutil-column-auto" :list="positionList" |
||||
|
@confirm="confirmSelect"></u-select> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
<u-line /> |
||||
|
|
||||
|
|
||||
|
<view class="title padding" style="display: flex;"> |
||||
|
<text style=" flex-shrink: 0;">箱码:</text> |
||||
|
<view class="" style="width: 100% ;"> |
||||
|
{{itemCode}} |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
<image src="/static/search.svg" mode="" |
||||
|
style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;" @click="itemCodeClick"> |
||||
|
</image> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
|
||||
|
<u-line /> |
||||
|
|
||||
|
<view class="uni-flex uni-row padding title u-col-center"> |
||||
|
<text>数量 : </text> |
||||
|
<view class="uni-flex uni-row uni-center" |
||||
|
style="align-items: center;margin-left: 20rpx;"> |
||||
|
<uni-number-box :value="counQty" @change="change" style='margin-left: 10rpx;' |
||||
|
:focus="numberFocus" @blur='numberFocus = false'> |
||||
|
</uni-number-box> |
||||
|
<uom :uom="uom"></uom> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line /> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="uni-flex uni-row hide_border"> |
||||
|
<button class="btn_edit_big_cancle" hover-class="btn_edit_big_after" @click="cancel()">取消</button> |
||||
|
<button class="btn_edit_big_confirm" hover-class="btn_edit_big_after" @click="confirm()">确认</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
<win-scan-item ref="scanPopup" title='物料代码' @getScanCode='getScanCode'> |
||||
|
</win-scan-item> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getBasicLocationByCode, |
||||
|
getBasicItemByCode, |
||||
|
getProductionlineItem, |
||||
|
getWorkShopLineStation |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
getLocationTypeName, |
||||
|
getListLocationTypeDesc, |
||||
|
checkDirectoryItemExist |
||||
|
} from '@/common/directory.js'; |
||||
|
import uom from '@/mycomponents/qty/uom.vue' |
||||
|
import balanceStatus from '@/mycomponents/status/balanceStatus.vue' |
||||
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
||||
|
import winScanItem from '@/mycomponents/scan/winScanItem.vue' |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
uom, |
||||
|
balanceStatus, |
||||
|
comMessage, |
||||
|
winScanItem |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
// itemCode: 'CE115F11161AG', |
||||
|
workshopCode: "", //车间 |
||||
|
workShopName: "", |
||||
|
productionLineCode: "", //生产线 |
||||
|
productionLineName: "", |
||||
|
workStationCode: "", //工位 |
||||
|
workStationName: "", |
||||
|
itemCode: '请扫描物料信息', |
||||
|
itemName: "", |
||||
|
qty: 0, |
||||
|
rawLocationCode: "", |
||||
|
fgLocationCode: "", |
||||
|
itemCodeFocus: false, |
||||
|
requestInfo: null, |
||||
|
itemCodeList: [], |
||||
|
isCheckItemCode: false, |
||||
|
counQty: 0, |
||||
|
editPosition: true, |
||||
|
numberFocus: false, |
||||
|
uom: "", |
||||
|
positionInfo: "请选择位置", |
||||
|
show: false, |
||||
|
isModifiedPosition: true, |
||||
|
positionList: [], |
||||
|
list: [{ |
||||
|
value: 1, |
||||
|
label: '车间1', |
||||
|
children: [{ |
||||
|
value: 2, |
||||
|
label: '生产线1', |
||||
|
children: [{ |
||||
|
value: 3, |
||||
|
label: '工位1' |
||||
|
}, |
||||
|
{ |
||||
|
value: 4, |
||||
|
label: '工位2' |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
value: 5, |
||||
|
label: '生产线2', |
||||
|
children: [{ |
||||
|
value: 6, |
||||
|
label: '工位1' |
||||
|
}, |
||||
|
{ |
||||
|
value: 7, |
||||
|
label: '工位2' |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
value: 8, |
||||
|
label: '车间2', |
||||
|
children: [{ |
||||
|
value: 9, |
||||
|
label: '生产线1', |
||||
|
children: [{ |
||||
|
value: 10, |
||||
|
label: '工位1' |
||||
|
}, |
||||
|
{ |
||||
|
value: 10, |
||||
|
label: '工位2' |
||||
|
} |
||||
|
] |
||||
|
}, { |
||||
|
value: 9, |
||||
|
label: '生产线2', |
||||
|
children: [{ |
||||
|
value: 10, |
||||
|
label: '工位1' |
||||
|
}, |
||||
|
{ |
||||
|
value: 10, |
||||
|
label: '工位2' |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
] |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
}, |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '需求信息' |
||||
|
}, |
||||
|
}, |
||||
|
methods: { |
||||
|
openRequestPopup(editPosition) { |
||||
|
if (this.positionList.length == 0) { |
||||
|
getWorkShopLineStation().then(res => { |
||||
|
this.positionList = res.data |
||||
|
}).catch(error => { |
||||
|
|
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
this.editPosition = editPosition; |
||||
|
if (this.isModifiedPosition) { |
||||
|
this.isModifiedPosition = false |
||||
|
} else { |
||||
|
this.itemCode = ""; |
||||
|
this.uom = "" |
||||
|
this.qty = 0 |
||||
|
this.itemCodeGetFocus(); |
||||
|
} |
||||
|
|
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, |
||||
|
closeRequestPopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
locationConfirm() { |
||||
|
//查询库位信息 |
||||
|
this.checkLocatioCode(); |
||||
|
}, |
||||
|
itemCodeClick() { |
||||
|
this.$refs.scanPopup.openScanPopup(); |
||||
|
}, |
||||
|
|
||||
|
itemCodeGetFocus() { |
||||
|
this.itemCodeFocus = true; |
||||
|
}, |
||||
|
itemCodeLoseFocus() { |
||||
|
this.itemCodeFocus = false; |
||||
|
}, |
||||
|
selectedItem(item) { |
||||
|
this.itemCode = item.itemCode; |
||||
|
this.checkItemCode(); |
||||
|
}, |
||||
|
|
||||
|
confirm() { |
||||
|
if (this.itemCode == "" || !this.isCheckItemCode) { |
||||
|
this.showErrorMessage("请输入物料", "itemCode") |
||||
|
return |
||||
|
} |
||||
|
if (this.qty == 0) { |
||||
|
this.showErrorMessage("数量必须大于0") |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
if (this.rawLocationCode == '') { |
||||
|
this.showErrorMessage(this.workStationName + "的原材料库位为空") |
||||
|
return |
||||
|
} |
||||
|
this.callback('add'); |
||||
|
}, |
||||
|
|
||||
|
checkItemCode(itemCode) { |
||||
|
//校验物料 |
||||
|
getBasicItemByCode(itemCode).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
if (res.data != null && res.data.list.length > 0) { |
||||
|
this.itemCode = res.data.list[0].code; |
||||
|
this.itemName = res.data.list[0].name |
||||
|
this.isCheckItemCode = true; |
||||
|
this.numberFocus = true |
||||
|
this.uom = res.data.list[0].uom |
||||
|
} else { |
||||
|
this.showErrorMessage('未查找到物料【' + this.itemCode + '】', "itemCode"); |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
this.showErrorMessage(error, "itemCode"); |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
callback(action) { |
||||
|
let item = { |
||||
|
positionInfo: this.positionInfo, |
||||
|
workshopCode: this.workshopCode, //车间 |
||||
|
workShopName: this.workShopName, |
||||
|
productionLineCode: this.productionLineCode, //生产线 |
||||
|
productionLineName: this.productionLineName, |
||||
|
workStationCode: this.workStationCode, //工位 |
||||
|
workStationName: this.workStationName, |
||||
|
rawLocationCode: this.rawLocationCode, |
||||
|
fgLocationCode: this.fgLocationCode, |
||||
|
itemCode: this.itemCode, |
||||
|
itemName: this.itemName, |
||||
|
uom: this.uom, |
||||
|
qty: this.qty |
||||
|
}; |
||||
|
this.closeRequestPopup(); |
||||
|
this.$emit("confirm", action, item); |
||||
|
}, |
||||
|
|
||||
|
showErrorMessage(message, type) { |
||||
|
setTimeout(r => { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (type == "itemCode") { |
||||
|
this.itemCodeGetFocus(); |
||||
|
} else { |
||||
|
this.numberFocus = true; |
||||
|
} |
||||
|
}) |
||||
|
if (type == "itemCode") { |
||||
|
this.itemCode = "" |
||||
|
this.isCheckItemCode = false; |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
change(value) { |
||||
|
this.qty = value; |
||||
|
}, |
||||
|
cancel(e) { |
||||
|
this.closeRequestPopup(); |
||||
|
}, |
||||
|
showSelect() { |
||||
|
if (this.editPosition) { |
||||
|
this.show = true |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
confirmSelect(e) { |
||||
|
this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label |
||||
|
console.log("位置", this.positionInfo) |
||||
|
this.workshopCode = e[0].value |
||||
|
this.productionLineCode = e[1].value |
||||
|
this.workStationCode = e[2].value |
||||
|
this.workShopName = e[0].label |
||||
|
this.productionLineName = e[1].label |
||||
|
this.workStationName = e[2].label |
||||
|
|
||||
|
let shop = this.positionList.find(shop => shop.value == this.workshopCode); |
||||
|
if (shop != undefined && shop.children != undefined) { |
||||
|
let prodLine = shop.children.find(line => line.value == this.productionLineCode); |
||||
|
if (prodLine != undefined && prodLine.children != undefined) { |
||||
|
let station = prodLine.children.find(r => r.value == this.workStationCode); |
||||
|
if (station.rawLocationCode == '' && station.rawLocationCode == null) { |
||||
|
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择") |
||||
|
return; |
||||
|
} else { |
||||
|
this.rawLocationCode = station.rawLocationCode; |
||||
|
this.fgLocationCode = station.fgLocationCode; |
||||
|
} |
||||
|
} else { |
||||
|
this.showErrorMessage("生产线-工位基础信息维护错误") |
||||
|
} |
||||
|
} else { |
||||
|
this.showErrorMessage("车间-生产线基础信息维护错误") |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getScanCode(code) { |
||||
|
if (code == "") { |
||||
|
this.showErrorMessage('物料号不能为空') |
||||
|
return; |
||||
|
} |
||||
|
this.itemCode = ""; |
||||
|
this.checkItemCode(code) |
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.title { |
||||
|
font-size: 30rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,508 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<uni-popup ref="popup" :maskClick='false'> |
||||
|
<view class=""> |
||||
|
<view class="popup_box"> |
||||
|
<view class="pop_title"> |
||||
|
扫描箱码 |
||||
|
<text class="fr" @click="closeScanPopup()">关闭</text> |
||||
|
</view> |
||||
|
<!-- <view class="uni-flex uni-row" style="align-items: center; |
||||
|
background-color: #fff; |
||||
|
margin-left: 20rpx; |
||||
|
margin-right: 20rpx; |
||||
|
padding:20rpx; |
||||
|
border-radius: 8rpx;"> |
||||
|
<view class="uni-center"> |
||||
|
位置 : |
||||
|
</view> |
||||
|
<view class="" style="width: 75%;padding: 0rpx"> |
||||
|
<view class="uni-flex u-col-center uni-row" @click="showSelect"> |
||||
|
<view class="" style="margin-left: 15rpx;font-size: 30rpx;"> |
||||
|
{{positionInfo}} |
||||
|
</view> |
||||
|
<u-select v-model="show" mode="mutil-column-auto" :list="positionList" :defaultValue="defaultValueList" |
||||
|
@confirm="confirmSelect"></u-select> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> --> |
||||
|
<!-- <u-line class='line_color'></u-line> --> |
||||
|
|
||||
|
<view class="uni-flex uni-row" style="align-items: center; |
||||
|
background-color: #fff; |
||||
|
margin-left: 20rpx; |
||||
|
margin-right: 20rpx; |
||||
|
margin-top: 8rpx; |
||||
|
border-radius: 8rpx;"> |
||||
|
<view class="uni-center" style="width: 25%; "> |
||||
|
来源库位 |
||||
|
</view> |
||||
|
<view class="" style="width: 75%; padding: 8rpx;"> |
||||
|
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" |
||||
|
@confirm="fromLocationUpdate"></uni-combox> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class=""> |
||||
|
<view class=""> |
||||
|
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" |
||||
|
:isShowHistory="false"> |
||||
|
</win-com-scan> |
||||
|
|
||||
|
<view style="width: 100%;"> |
||||
|
<view style="width: 100%;" v-if="issueRecord.length>0"> |
||||
|
<view class="uni-flex uni-row space-between u-col-center"> |
||||
|
<view class="" style="padding: 10rpx;"> |
||||
|
历史记录 |
||||
|
</view> |
||||
|
<view class="" style="padding-right: 10rpx;"> |
||||
|
<u-icon :name="expendIcon" size="35rpx" @click="expands()"></u-icon> |
||||
|
</view> |
||||
|
</view> |
||||
|
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'> |
||||
|
</u-line> |
||||
|
<scroll-view scroll-y="true" class="scroll-view" |
||||
|
v-if="expand&&issueRecord.length>0"> |
||||
|
<view class="uni-flex u-col" v-for="(record,index) in issueRecord"> |
||||
|
<view style="width: 100%;"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,record,index)" |
||||
|
:right-options="scanOptions"> |
||||
|
<view style="padding: 0px 10px"> |
||||
|
<balance :dataContent="record" :isShowLocation="false" |
||||
|
:isShowStdPack="false"></balance> |
||||
|
</view> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
<u-line class='line_color'></u-line> |
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
||||
|
<com-message ref="comMessage"></com-message> |
||||
|
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
||||
|
import winComScan from '@/mycomponents/scan/winComScan.vue' |
||||
|
import balance from '@/mycomponents/balance/balance.vue' |
||||
|
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
||||
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailEditRemoveOption |
||||
|
} from '@/common/array.js'; |
||||
|
import { |
||||
|
getWorkShopLineStation |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
getBalanceByManagementPrecision |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
export default { |
||||
|
name: 'winScanPack', |
||||
|
components: { |
||||
|
comMessage, |
||||
|
winComScan, |
||||
|
balance, |
||||
|
balanceQtyEdit, |
||||
|
balanceSelect |
||||
|
}, |
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
}, |
||||
|
|
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: {}, |
||||
|
jobContent: {}, |
||||
|
expendIcon: 'arrow-down', |
||||
|
show: false, |
||||
|
scanList: [], |
||||
|
toLocation: null, |
||||
|
toLocationCode: '', |
||||
|
fromLocationList: [], |
||||
|
fromLocationCode: '', |
||||
|
fromLocation: null, |
||||
|
issueRecord: [], //发料历史 |
||||
|
expand: true, |
||||
|
scanOptions: {}, |
||||
|
editItem: {}, |
||||
|
positionInfo: "请选择位置", |
||||
|
positionList: [], |
||||
|
defaultValueList: [], |
||||
|
fromInventoryStatuses :"", |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
|
||||
|
}, |
||||
|
watch: {}, |
||||
|
mounted() { |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.scanOptions = getDetailEditRemoveOption(); |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
|
||||
|
openScanPopup(content, jobcontent) { |
||||
|
this.issueRecord = []; |
||||
|
this.dataContent = content; |
||||
|
this.jobContent = jobcontent; |
||||
|
this.initData(); |
||||
|
// this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode + |
||||
|
// "-" + this.jobContent.subList[0].workStationCode |
||||
|
this.$refs.popup.open('bottom'); |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
this.$refs.popup.close(); |
||||
|
this.$emit("closeScan") |
||||
|
//清除数据,恢复默认值 |
||||
|
// Object.assign(this.$data, this.$options.data()); |
||||
|
}, |
||||
|
|
||||
|
initData() { |
||||
|
let that = this; |
||||
|
that.fromLocationList = []; |
||||
|
if (that.dataContent != null) { |
||||
|
that.fromInventoryStatuses = this.jobContent.outInventoryStatuses |
||||
|
that.toLocation = that.dataContent[0]; |
||||
|
that.toLocationCode = that.dataContent[0].toLocationCode; |
||||
|
that.fromLocationList = that.getFromLocationList(); |
||||
|
} |
||||
|
}, |
||||
|
showBalanceSelect(items) { |
||||
|
this.$refs.balanceSelect.openPopup(items); |
||||
|
}, |
||||
|
|
||||
|
getFromLocationList() { |
||||
|
let list = []; |
||||
|
let location = this.dataContent.find(r => r.toLocationCode == this.toLocationCode); |
||||
|
if (location != undefined) { |
||||
|
location.Items.forEach(item => { |
||||
|
item.Locations.forEach(f => { |
||||
|
list.push(f.fromLocationCode) |
||||
|
}) |
||||
|
}) |
||||
|
this.fromLocationCode = list[0]; |
||||
|
return list; |
||||
|
} else { |
||||
|
this.$refs.comMessage.showErrorMessages('需求库位【' + this.toLocationCode + '】不存在', res => { |
||||
|
this.toLocationCode = ''; |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
fromLocationUpdate(fromlocation) { |
||||
|
let location = this.fromLocationList.find(r => r == fromlocation) |
||||
|
if (location == undefined) { |
||||
|
this.fromLocationCode = '' |
||||
|
this.showErrorMessage('发料库位【' + fromlocation + '】不存在') |
||||
|
} |
||||
|
}, |
||||
|
onScan(result) { |
||||
|
try { |
||||
|
let that = this; |
||||
|
|
||||
|
if (that.fromLocationCode == '') { |
||||
|
that.showErrorMessage('请选择来源库位', res => { |
||||
|
that.$refs.toLocationCombox.onFocus(); |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
let packageInfo = result.package; |
||||
|
let itemCode = result.label.itemCode; |
||||
|
let packingCode = result.label.packingNumber; |
||||
|
let lot = result.label.batch; |
||||
|
let item = that.toLocation.Items.find(r => r.itemCode == itemCode); |
||||
|
if (item == undefined) { |
||||
|
that.showErrorMessage('未查找到零件【' + itemCode + '】的发料明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
return; |
||||
|
} else { |
||||
|
//查找库存信息 |
||||
|
uni.showLoading({ |
||||
|
title: '加载中', |
||||
|
mask: true |
||||
|
}) |
||||
|
getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses, balanceRes => { |
||||
|
if (balanceRes.success) { |
||||
|
if (balanceRes.data.list.length == 0) { |
||||
|
this.showErrorMessage('在来源库位[' + this.fromLocationCode + '],未查找到该包装的库存记录', |
||||
|
res => { |
||||
|
this.packGetFocus(); |
||||
|
}) |
||||
|
} else if (balanceRes.data.list.length == 1) { |
||||
|
let balance = balanceRes.data.list[0]; |
||||
|
this.afterGetBalance(result.label, balance,packageInfo); |
||||
|
} else { |
||||
|
this.showBalanceSelect(balanceRes.data.list); |
||||
|
} |
||||
|
} else { |
||||
|
this.showErrorMessage(balanceRes.message.message); |
||||
|
} |
||||
|
uni.hideLoading(); |
||||
|
}); |
||||
|
} |
||||
|
} catch (e) { |
||||
|
this.showErrorMessage(e.stack) |
||||
|
uni.hideLoading(); |
||||
|
} |
||||
|
}, |
||||
|
selectBalanceItem(balance) { |
||||
|
this.afterGetBalance(this.label, balance); |
||||
|
}, |
||||
|
|
||||
|
afterGetBalance(label, balance,packageInfo) { |
||||
|
try { |
||||
|
let that = this; |
||||
|
let itemCode = label.itemCode; |
||||
|
let packingCode = label.packingNumber; |
||||
|
let lot = label.batch; |
||||
|
let item = that.toLocation.Items.find(r => r.itemCode == itemCode); |
||||
|
let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode); |
||||
|
if (fromLocation != undefined) { |
||||
|
let batch = fromLocation.Batchs.find(r => r.batch == lot); |
||||
|
if (batch != undefined) { |
||||
|
if (batch.Records == undefined) { |
||||
|
batch.Records = []; |
||||
|
} |
||||
|
|
||||
|
let record = batch.Records.find(r => r.packingNumber == packingCode); |
||||
|
if (record == undefined) { |
||||
|
//如果有推荐箱码 |
||||
|
if (batch.Recommends.length > 0) { |
||||
|
let recommend = batch.Recommends.find(r => r.packingNumber == packingCode); |
||||
|
if (recommend != undefined) { |
||||
|
that.addRecord(batch, label, balance,packageInfo) |
||||
|
} else { |
||||
|
//允许修改箱码 |
||||
|
if (this.jobContent.allowModifyPackingNumber == 'TRUE') { |
||||
|
that.addRecord(batch, label, balance,packageInfo); |
||||
|
} else { |
||||
|
that.showErrorMessage('未查找到该箱码【' + packingCode + '】的明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
that.addRecord(batch, label, balance,packageInfo) |
||||
|
} |
||||
|
} else { |
||||
|
that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
} else { |
||||
|
if (this.jobContent.AllowModifyBatch == null) { |
||||
|
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot + |
||||
|
'】的发料明细,是否要继续发料?', res => { |
||||
|
if (res) { |
||||
|
let batch = that.createBatchInfo(label, balance); |
||||
|
fromLocation.Batchs.unshift(batch); |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
that.showErrorMessage('未查找到批次【' + lot + '】的发料明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
that.showErrorMessage('未查找到推荐库位【' + that.fromLocationCode + '】的发料明细', |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
} catch (e) { |
||||
|
that.showErrorMessage(e.stack, |
||||
|
res => { |
||||
|
that.getfocus(); |
||||
|
} |
||||
|
) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
createBatchInfo(data, balance) { |
||||
|
let batch = { |
||||
|
batch: data.lot, |
||||
|
qty: 0, |
||||
|
uom: data.uom, |
||||
|
handleQty: Number(data.qty), |
||||
|
Records: [] |
||||
|
} |
||||
|
let record = this.creatRecord(data, balance); |
||||
|
batch.Records.push(record); |
||||
|
this.issueRecord.unshift(record) |
||||
|
return batch; |
||||
|
}, |
||||
|
|
||||
|
creatRecord(label, balance,packageInfo) { |
||||
|
balance.stdPackQty = packageInfo.stdPackQty |
||||
|
balance.stdPackUnit = packageInfo.stdPackUnit |
||||
|
let record = { |
||||
|
itemCode: label.itemCode, |
||||
|
packingNumber: label.packingNumber, |
||||
|
batch: label.batch, |
||||
|
qty: Number(label.qty)>Number(balance.qty)?Number(balance.qty):Number(label.qty), |
||||
|
uom: balance.uom, |
||||
|
inventoryStatus: balance.inventoryStatus, |
||||
|
balance: balance, |
||||
|
toLocationCode: this.toLocationCode, |
||||
|
supplierCode: label.supplierCode |
||||
|
} |
||||
|
return record; |
||||
|
}, |
||||
|
|
||||
|
calcBatchHandleQty(batch) { |
||||
|
let handleQty = 0; |
||||
|
batch.Records.forEach(res => { |
||||
|
handleQty += Number(res.qty) |
||||
|
}) |
||||
|
batch.handleQty = handleQty; |
||||
|
}, |
||||
|
|
||||
|
addRecord(batch, label, balance,packageInfo) { |
||||
|
let record = this.creatRecord(label, balance,packageInfo); |
||||
|
batch.Records.push(record); |
||||
|
this.issueRecord.unshift(record) |
||||
|
this.calcBatchHandleQty(batch); |
||||
|
this.getfocus(); |
||||
|
}, |
||||
|
|
||||
|
getfocus() { |
||||
|
if (this.$refs.comscan != undefined) { |
||||
|
this.$refs.comscan.getfocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
losefocus() { |
||||
|
if (this.$refs.comscan != undefined) { |
||||
|
this.$refs.comscan.losefocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
expands() { |
||||
|
this.expand = !this.expand; |
||||
|
this.expendIcon = this.expand == true ? "arrow-down" : "arrow-up" |
||||
|
}, |
||||
|
|
||||
|
swipeClick(e, item, index) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.detail(item) |
||||
|
} else if (e.content.text == "编辑") { |
||||
|
this.edit(item) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(item, index) |
||||
|
} |
||||
|
}, |
||||
|
edit(item) { |
||||
|
this.editItem = item; |
||||
|
// item.balance.balanceQty = item.balance.qty; |
||||
|
item.balance.balanceQty = item.balance.qty; |
||||
|
this.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty); |
||||
|
}, |
||||
|
|
||||
|
detail(item) { |
||||
|
this.showItem = item; |
||||
|
this.$refs.receiptHint.openScanPopup() |
||||
|
}, |
||||
|
remove(record, index) { |
||||
|
this.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
record.qty = 0; |
||||
|
this.issueRecord.splice(index, 1) |
||||
|
|
||||
|
let item = this.toLocation.Items.find(r => r.itemCode == record.itemCode); |
||||
|
if (item != undefined) { |
||||
|
item.Locations.forEach(l => { |
||||
|
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b |
||||
|
.batch == record.batch); |
||||
|
let rIndex = batch.Records.findIndex(r => r.packingNumber == record |
||||
|
.packingNumber && r |
||||
|
.batch == record.batch); |
||||
|
batch.Records.splice(rIndex, 1); |
||||
|
}) |
||||
|
} |
||||
|
this.$emit('updateData', item); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
packGetFocus() { |
||||
|
this.$refs.comscan.getfocus(); |
||||
|
}, |
||||
|
packLoseFocus() { |
||||
|
this.$refs.comscan.losefocus(); |
||||
|
}, |
||||
|
showMessage(message, callback) { |
||||
|
setTimeout(r => { |
||||
|
this.packLoseFocus(); |
||||
|
this.$refs.comMessage.showMessage(message, callback); |
||||
|
}) |
||||
|
}, |
||||
|
showErrorMessage(message, callback) { |
||||
|
setTimeout(r => { |
||||
|
this.packLoseFocus(); |
||||
|
this.$refs.comMessage.showErrorMessage(message, callback); |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
showQuestionMessage(message, callback) { |
||||
|
setTimeout(r => { |
||||
|
this.packLoseFocus(); |
||||
|
this.$refs.comMessage.showQuestionMessage(message, callback); |
||||
|
}) |
||||
|
}, |
||||
|
confirm(val) { |
||||
|
this.editItem.qty = Number(val); |
||||
|
this.$emit('updateData', this.editItem) |
||||
|
}, |
||||
|
cancle() { |
||||
|
this.closeScanPopup() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
button { |
||||
|
border: none; |
||||
|
} |
||||
|
|
||||
|
button::after { |
||||
|
border: none |
||||
|
} |
||||
|
|
||||
|
.scroll-view { |
||||
|
overflow-y: scroll; |
||||
|
height: auto; |
||||
|
max-height: 300rpx; |
||||
|
padding: 10rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,200 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="" v-if='detailSource.subList.length==0'> |
||||
|
<com-blank-view @goScan='goScan(true)'></com-blank-view> |
||||
|
</view> |
||||
|
<view v-else class="page-wraper"> |
||||
|
<view class="page-main"> |
||||
|
<comReturnRequestCreator ref="issueRequest" :dataContent="detailSource"> |
||||
|
</comReturnRequestCreator> |
||||
|
<button class="btn_add" @click="goScan(false)">+去添加</button> |
||||
|
</view> |
||||
|
|
||||
|
<div class="btn_bottom"> |
||||
|
<view class="" style="display: flex;flex-direction: row;"> |
||||
|
<view class=""> |
||||
|
<button class="btn_commit" hover-class="btn_commit_after" @click="submit()">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</div> |
||||
|
|
||||
|
<comScanReturnPack ref="comScanIssuePack"> |
||||
|
</comScanReturnPack> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</view> |
||||
|
<comReturnRequestPopup ref="comIssueRequestPopup" @confirm='requestConfirm'></comReturnRequestPopup> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
productionReturnRequestCreate, |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
updateTitle, |
||||
|
navigateBack, |
||||
|
getRemoveOption, |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import comReturnRequestPopup from '@/pages/productionReturn/coms/comReturnRequestPopup.vue' |
||||
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
||||
|
import comScanReturnPack from '@/pages/productionReturn/coms/comScanReturnPack.vue' |
||||
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
||||
|
import comReturnRequestCreator from '@/pages/productionReturn/coms/comReturnRequestCreator.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: '', |
||||
|
components: { |
||||
|
comBlankView, |
||||
|
comReturnRequestPopup, |
||||
|
jobDetailPopup, |
||||
|
comScanReturnPack, |
||||
|
comMessage, |
||||
|
comReturnRequestCreator |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
jobContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: { |
||||
|
subList: [] |
||||
|
}, //绑定在页面上的数据源 |
||||
|
detailOptions: [], |
||||
|
scanOptions: [], |
||||
|
requestList: [], //需求信息 |
||||
|
fromType: '', |
||||
|
title: "" |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
this.goScan(true) |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
this.fromType = option.fromType |
||||
|
if (this.fromType == 'ReturnToStore') { |
||||
|
this.title = "生产合格退料申请" |
||||
|
} else if (this.fromType == 'ReturnToHold') { |
||||
|
this.title = "生产隔离退料申请" |
||||
|
} |
||||
|
updateTitle(this.title) |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
goScan(editPosition) { |
||||
|
this.$refs.comIssueRequestPopup.openRequestPopup(editPosition); |
||||
|
}, |
||||
|
|
||||
|
//确定需求信息 |
||||
|
requestConfirm(action, item) { |
||||
|
|
||||
|
if (this.detailSource.subList.length == 0) { |
||||
|
this.detailSource = { |
||||
|
workshopCode: item.workshopCode, |
||||
|
businessType:this.fromType, |
||||
|
status: "1", |
||||
|
totalQty: 0, |
||||
|
subList: [] |
||||
|
} |
||||
|
var subItem = { |
||||
|
productionLineCode: item.productionLineCode, |
||||
|
workStationCode: item.workStationCode, |
||||
|
itemCode: item.itemCode, |
||||
|
itemName: item.itemName, |
||||
|
inventoryStatus:"OK", |
||||
|
batch:"000000", |
||||
|
packingNumber:"", |
||||
|
fromLocationCode:item.rawLocationCode, |
||||
|
qty: item.qty, |
||||
|
uom: item.uom |
||||
|
} |
||||
|
this.detailSource.subList.push(subItem) |
||||
|
} else { |
||||
|
var result = this.detailSource.subList.filter(res => { |
||||
|
if (res.itemCode == item.itemCode) { |
||||
|
return res |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
//没有添加数据 |
||||
|
if (result.length == 0) { |
||||
|
var subItem = { |
||||
|
productionLineCode: item.productionLineCode, |
||||
|
workStationCode: item.workStationCode, |
||||
|
itemCode: item.itemCode, |
||||
|
itemName: item.itemName, |
||||
|
qty: item.qty, |
||||
|
uom: item.uom |
||||
|
} |
||||
|
|
||||
|
this.detailSource.subList.push(subItem) |
||||
|
|
||||
|
} else { |
||||
|
//有了更新数据 |
||||
|
result[0].qty += item.qty |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
this.caclcQty(); |
||||
|
if (this.$refs.issueRequest != undefined) { |
||||
|
this.$refs.issueRequest.update() |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
caclcQty() { |
||||
|
var totalQty = 0; |
||||
|
this.detailSource.subList.forEach(res => { |
||||
|
totalQty += res.qty |
||||
|
}) |
||||
|
this.detailSource.totalQty = totalQty; |
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
if(this.fromType=="ReturnToStore"){ |
||||
|
this.detailSource.isOK = true |
||||
|
}else if(this.fromType=="ReturnToHold"){ |
||||
|
this.detailSource.isOK = false |
||||
|
}else { |
||||
|
this.detailSource.isOK = false |
||||
|
} |
||||
|
return this.detailSource |
||||
|
}, |
||||
|
submit() { |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
var params = this.setParams() |
||||
|
console.log("提交参数", JSON.stringify(params)); |
||||
|
productionReturnRequestCreate(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
if (res.data) { |
||||
|
this.showCommitSuccessMessage("提交成功<br>生成发料申请" + res.data) |
||||
|
} else { |
||||
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
navigateBack(1) |
||||
|
}) |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) {} |
||||
|
}); |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
Loading…
Reference in new issue