9 changed files with 1423 additions and 181 deletions
@ -0,0 +1,553 @@ |
|||||
|
<template> |
||||
|
<page-meta root-font-size="18px"></page-meta> |
||||
|
<view class=""> |
||||
|
<win-blank-view @goScan='openScanPopup' v-if="fromLocationCode==''"></win-blank-view> |
||||
|
<view class="" style=" background-color: #5A7CF3; color: #fff; border-radius: 20rpx; margin: 15rpx;" v-if="fromLocationCode!=''"> |
||||
|
<view class="" style=""> |
||||
|
<view class="uni-flex top_lines_info" style="flex-direction: column;"> |
||||
|
<view class="" style="padding: 10rpx;"> |
||||
|
来源库位: |
||||
|
<text class="text_bold" >{{fromLocationCode.code}}</text> |
||||
|
</view> |
||||
|
<!-- <view class="" style="padding: 10rpx;"> |
||||
|
扫描数量: |
||||
|
<text class="text_bold"> {{allCount}}</text> |
||||
|
</view> --> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<scroll-view scroll-y class="scroll-detail" style="margin-top: 10rpx;padding-bottom:100px" > |
||||
|
<view class="detail-list " v-for="(item, index) in showList" :key="index"> |
||||
|
<view class="detail-content"> |
||||
|
<view class="" style=""> |
||||
|
<view class="uni-flex uni-row u-col-center"> |
||||
|
<view class="" style="margin-top: 20rpx; margin-left: 10rpx; font-weight: bold;"> |
||||
|
({{index+1}}). |
||||
|
</view> |
||||
|
<comItemCode :itemData="item"></comItemCode> |
||||
|
</view> |
||||
|
|
||||
|
<uni-table border stripe style=""> |
||||
|
<!-- <uni-tr> |
||||
|
<uni-td align="center">物品代码</uni-td> |
||||
|
<uni-td>{{item.itemCode}}</uni-td> |
||||
|
</uni-tr> --> |
||||
|
<uni-tr> |
||||
|
<uni-td align="center">单位</uni-td> |
||||
|
<uni-td>{{item.uom}}</uni-td> |
||||
|
</uni-tr> |
||||
|
<uni-tr> |
||||
|
<uni-td align="center">标包数</uni-td> |
||||
|
<uni-td>{{item.stdPackQty}}</uni-td> |
||||
|
</uni-tr> |
||||
|
|
||||
|
<uni-tr> |
||||
|
<uni-td align="center">数量</uni-td> |
||||
|
<uni-td> |
||||
|
<view class="uni-flex uni-row"> |
||||
|
<view class="uni-flex uni-row space-between" style="width: 100%;"> |
||||
|
<view class=""> |
||||
|
<com-number-box :ref="'comNumberBox_'+index" v-model="item.qty" |
||||
|
:max="99999" :min="0" @change="qtyChanged($event,item,index)"> |
||||
|
</com-number-box> |
||||
|
</view> |
||||
|
|
||||
|
<view class=""> |
||||
|
<button type="primary" size="mini" style="margin-left: 30rpx;" |
||||
|
@click="remove(item,index)">移除</button> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
</uni-td> |
||||
|
</uni-tr> |
||||
|
</uni-table> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
</scroll-view> |
||||
|
<uni-load-more :status="loadingType" v-if="showList.length>0" /> |
||||
|
<div class="new_bot_box" v-show="showList.length>0"> |
||||
|
<win-collapse-location scanTitle='扫描目标库位' ref='comCollapseLocation' @getLocationCode='getDefaultToLocation' |
||||
|
@clear='clearDefaultLocation'> |
||||
|
</win-collapse-location> |
||||
|
<view class="new_btn_bot bot_pos uni-flex"> |
||||
|
<button class="new_clear_btn btn_double" @click="cancel()">清空</button> |
||||
|
<button class="new_save_btn btn_double" @click="submit()">提交</button> |
||||
|
</view> |
||||
|
</div> |
||||
|
<win-scan-button @goScan='openScanPopup' v-if="showList.length>0"></win-scan-button> |
||||
|
<winScanByProductCode ref="scanPackPopup" title="单件码" @getScanResult='getScanResult'></winScanByProductCode> |
||||
|
<win-scan-by-code ref="scanFromLocationPopup" title="来源库位" @getScanCode='scanFromLocation'></win-scan-by-code> |
||||
|
<com-message ref="comMessage" @afterCloseScanMessage='closeScanMessage' @afterRescanMessage='afterRescan' |
||||
|
@afterCloseCommitMessage='closeCommitMessage'> |
||||
|
</com-message> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
locations, |
||||
|
getBalancesByFilterAsync, |
||||
|
getWipListAsync, |
||||
|
customerReturn, |
||||
|
} from '@/api/index.js'; |
||||
|
|
||||
|
import { |
||||
|
showConfirmMsg, |
||||
|
goHome, |
||||
|
getRemoveOption |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import winBlankView from '@/mycomponents/wincom/winBlankView.vue' |
||||
|
import comBaseItem from '@/mycomponents/comItem/comBaseItem.vue' |
||||
|
import winScanButton from '@/mycomponents/wincom/winScanButton.vue' |
||||
|
import winScanByPack from '@/mycomponents/wincom/winScanByPack.vue' |
||||
|
import winScanByProductCode from '@/mycomponents/wincom/winScanByProductCode.vue' |
||||
|
|
||||
|
import winScanByCode from '@/mycomponents/wincom/winScanByCode.vue' |
||||
|
import comScanSemiPutaway from '@/mycomponents/scan/comScanSemiPutaway.vue' |
||||
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
||||
|
import winCollapseLocation from '@/mycomponents/wincom/winCollapseLocation.vue' |
||||
|
import SemiCollapseItem from '@/mycomponents/common/SemiCollapseItem.vue' |
||||
|
import comItemCode from '@/mycomponents/comItem/comItemCode.vue' |
||||
|
import comNumberBox from '@/mycomponents/common/comNumberBox.vue'; |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
name: 'customerReturn', |
||||
|
components: { |
||||
|
winBlankView, |
||||
|
comBaseItem, |
||||
|
comMessage, |
||||
|
winScanButton, |
||||
|
winScanByPack, |
||||
|
winScanByCode, |
||||
|
comScanSemiPutaway, |
||||
|
winCollapseLocation, |
||||
|
SemiCollapseItem, |
||||
|
winScanByProductCode, |
||||
|
comItemCode, |
||||
|
comNumberBox |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
options: [], |
||||
|
currentItem: {}, |
||||
|
showList: [], |
||||
|
defaultToLocation: {}, |
||||
|
defaultToLocationCode: "", |
||||
|
fromLocationCode: "", |
||||
|
allCount: 0, |
||||
|
allDataList: [], |
||||
|
loadingType: "", |
||||
|
pageNo: 0, |
||||
|
pageSize: 5, |
||||
|
scrollTop: 60, |
||||
|
old: { |
||||
|
scrollTop: 0 |
||||
|
}, |
||||
|
}; |
||||
|
}, |
||||
|
onLoad() { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: "三方库发货" |
||||
|
}) |
||||
|
}, |
||||
|
onPullDownRefresh() { |
||||
|
this.pageNo = 1; |
||||
|
this.showList=[] |
||||
|
this.loadingType = ""; |
||||
|
this.showList = this.getDataPage(this.pageNo, this.pageSize) |
||||
|
uni.stopPullDownRefresh() |
||||
|
}, |
||||
|
onReachBottom() { |
||||
|
console.log("底部") |
||||
|
if (this.loadingType == 'nomore') { |
||||
|
console.log("没有更多了") |
||||
|
return; |
||||
|
} |
||||
|
this.pageNo++; |
||||
|
var list = this.getDataPage(this.pageNo, this.pageSize) |
||||
|
if (list.length > 0) { |
||||
|
console.log("加载更多了") |
||||
|
this.showList = this.showList.concat(list) |
||||
|
} else { |
||||
|
//没有更多了 |
||||
|
this.loadingType = "nomore"; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} else if (e.index === 1) { |
||||
|
window.location.reload(); |
||||
|
} |
||||
|
}, |
||||
|
mounted: function() { |
||||
|
this.openScanPopup(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
//扫描源库位 |
||||
|
scanFromLocation(code) { |
||||
|
let that = this; |
||||
|
if (code == '') return; |
||||
|
uni.showLoading({ |
||||
|
title: '扫描中...', |
||||
|
mask: true |
||||
|
}); |
||||
|
locations(code).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if(res){ |
||||
|
if(res.type == 3||res.type == 5){ |
||||
|
that.fromLocationCode = res; |
||||
|
this.openPackLabel(); |
||||
|
this.closeScanFromLocationPopup(); |
||||
|
}else { |
||||
|
that.showMessage('扫描的库位【' + code + '】不是【半成品库】或【成品库位】'); |
||||
|
} |
||||
|
}else { |
||||
|
that.showMessage('未查询到库位【' + code + '】'); |
||||
|
} |
||||
|
|
||||
|
}).catch(err => { |
||||
|
uni.hideLoading(); |
||||
|
that.showMessage(err.message); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
getDataPage(pageNo, pageSize) { |
||||
|
//计算总页数 |
||||
|
var totalPages = Math.ceil(this.allCount / pageSize); |
||||
|
//当前页起始索引 |
||||
|
const start = (pageNo - 1) * pageSize; |
||||
|
const end = start + pageSize; //当前页结束索引 |
||||
|
return this.allDataList.slice(start, end) |
||||
|
|
||||
|
}, |
||||
|
qtyChanged(value, item, index) { |
||||
|
if (value <= 0) { |
||||
|
this.showMessage('退货数量必须大于0') |
||||
|
item.handledQty = item.qty |
||||
|
this.$refs['comNumberBox_' + index][0].setValue(item.handledQty); |
||||
|
} |
||||
|
}, |
||||
|
remove(item, index) { |
||||
|
showConfirmMsg("是否移除当前" + item.itemCode, res => { |
||||
|
if (res) { |
||||
|
this.allDataList.splice(index, 1); |
||||
|
this.allCount = this.allDataList.length; |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: "三方库发货"+"("+this.allCount+")" |
||||
|
}) |
||||
|
this.$forceUpdate() |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
async getScanResult(result) { |
||||
|
var balanceParam={ |
||||
|
pageIndex: 1, |
||||
|
pageSize: 100, |
||||
|
itemCode:result.itemCode, |
||||
|
locationCode:this.fromLocationCode |
||||
|
|
||||
|
} |
||||
|
let balanceRes = await getBalancesByFilterAsync(balanceParam); |
||||
|
|
||||
|
if(balanceRes.totalCount==0){ |
||||
|
this.showMessage("单件码【" + filterItem[0].itemCode + "】在库位【"+this.fromLocationCode+"】没有库存") |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var filterItem = this.allDataList.filter(res => { |
||||
|
if (res.itemCode == result.itemCode) { |
||||
|
return res; |
||||
|
} |
||||
|
}) |
||||
|
if (filterItem.length > 0) { |
||||
|
this.showMessage("单件码【" + filterItem[0].itemCode + "】已经扫描") |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var item = { |
||||
|
itemCode: result.itemCode, |
||||
|
itemName: result.itemName, |
||||
|
itemDesc1: result.itemDesc1, |
||||
|
stdPackQty: result.stdPackQty, |
||||
|
uom: result.uom, |
||||
|
qty: result.stdPackQty |
||||
|
|
||||
|
} |
||||
|
this.allDataList.unshift(item) |
||||
|
this.allCount = this.allDataList.length; |
||||
|
this.pageNo = 1; |
||||
|
this.showList = [] |
||||
|
this.loadingType = ""; |
||||
|
this.showList = this.getDataPage(this.pageNo, this.pageSize) |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: "三方库发货"+"("+this.allCount+")" |
||||
|
}) |
||||
|
|
||||
|
this.$forceUpdate(); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
//扫描默认目标库位 |
||||
|
getDefaultToLocation(locationCode) { |
||||
|
uni.showLoading({ |
||||
|
title: "扫描中", |
||||
|
mask: true |
||||
|
}); |
||||
|
locations(locationCode).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res) { |
||||
|
this.defaultToLocation = res; |
||||
|
this.defaultToLocationCode = res.code |
||||
|
} else { |
||||
|
this.showMessage('目标库位【' + locationCode + '】不存在'); |
||||
|
} |
||||
|
|
||||
|
}).catch(err => { |
||||
|
uni.hideLoading(); |
||||
|
this.defaultToLocation = {}; |
||||
|
this.defaultToLocationCode = "" |
||||
|
this.showMessage(err.message); |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
clearDefaultLocation() { |
||||
|
this.defaultToLocationCode = "" |
||||
|
this.defaultToLocation = {}; |
||||
|
}, |
||||
|
|
||||
|
submit() { |
||||
|
if (this.allDataList.length === 0) { |
||||
|
this.showMessage('请扫描单件码'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (this.defaultToLocationCode == "") { |
||||
|
this.showMessage('请扫描目标库位'); |
||||
|
return; |
||||
|
} |
||||
|
var checkQtyItem =this.checkQty() |
||||
|
if(checkQtyItem!=undefined){ |
||||
|
this.showMessage("【"+checkQtyItem.itemCode+'】数量为0,退货数量必须大于0'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
let params = this.setSubmitParam(); |
||||
|
console.log( JSON.stringify(params) ) |
||||
|
customerReturn(params) |
||||
|
.then(res => { |
||||
|
uni.hideLoading(); |
||||
|
this.showCommitSuccess(); |
||||
|
this.clearInfo(); |
||||
|
|
||||
|
}) |
||||
|
.catch(err => { |
||||
|
uni.hideLoading(); |
||||
|
this.showMessage(err.message); |
||||
|
|
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
checkQty(){ |
||||
|
var isCheck =true; |
||||
|
var result =undefined |
||||
|
for (let item of this.allDataList) { |
||||
|
if(item.qty==0){ |
||||
|
result =item |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
return result; |
||||
|
}, |
||||
|
|
||||
|
setSubmitParam() { |
||||
|
let item = { |
||||
|
worker: localStorage.userName_CN == "" ? localStorage.userName : localStorage.userName_CN, |
||||
|
details: [] |
||||
|
} |
||||
|
this.allDataList.forEach(res => { |
||||
|
var detail = { |
||||
|
itemCode: res.itemCode, |
||||
|
itemName: res.itemName, |
||||
|
itemDesc1: res.itemDesc1, |
||||
|
uom: res.uom, |
||||
|
qty: res.qty, |
||||
|
stdPackQty: res.stdPackQty, |
||||
|
toLocationCode:this.defaultToLocationCode |
||||
|
} |
||||
|
item.details.push(detail) |
||||
|
}) |
||||
|
|
||||
|
return item; |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
getSubmitParam() { |
||||
|
let that = this; |
||||
|
let item = { |
||||
|
number: "", |
||||
|
worker: localStorage.userName_CN == "" ? localStorage.userName : localStorage.userName_CN, |
||||
|
putawayType: 2, |
||||
|
details: [] |
||||
|
} |
||||
|
|
||||
|
that.showList.forEach(i => { |
||||
|
let balanceItem = i.balanceItem; |
||||
|
i.labelList.forEach(l => { |
||||
|
let detail = {}; |
||||
|
detail.itemCode = balanceItem.itemCode; |
||||
|
detail.itemName = balanceItem.itemName; |
||||
|
detail.itemDesc1 = balanceItem.itemDesc1; |
||||
|
detail.itemDesc2 = balanceItem.itemDesc2; |
||||
|
detail.uom = l.uom; |
||||
|
detail.qty = l.qty; |
||||
|
detail.stdPackQty = balanceItem.stdPackQty; |
||||
|
|
||||
|
detail.fromPackingCode = balanceItem.packingCode; |
||||
|
detail.toPackingCode = l.packingCode; |
||||
|
detail.fromLot = balanceItem.lot; |
||||
|
detail.toLot = l.lot; |
||||
|
|
||||
|
|
||||
|
detail.toLocationCode = l.toLocationCode ?? that.defaultToLocation.code; |
||||
|
detail.toLocationGroup = l.toLocationGroup ?? that.defaultToLocation |
||||
|
.locationGroupCode; |
||||
|
detail.toLocationArea = l.toLocationArea ?? that.defaultToLocation.areaCode; |
||||
|
detail.toLocationErpCode = l.toLocationErpCode ?? that.defaultToLocation |
||||
|
.erpLocationCode; |
||||
|
|
||||
|
detail.fromStatus = balanceItem.status; |
||||
|
detail.toStatus = l.status; |
||||
|
|
||||
|
detail.fromWarehouseCode = localStorage.warehouseCode; |
||||
|
detail.toWarehouseCode = localStorage.warehouseCode; |
||||
|
|
||||
|
detail.supplierBatch = balanceItem.supplierBatch; |
||||
|
detail.arriveDate = balanceItem.arriveDate; |
||||
|
detail.produceDate = balanceItem.produceDate; |
||||
|
detail.expireDate = balanceItem.expireDate; |
||||
|
//=========================================== |
||||
|
detail.recommendPackingCode = balanceItem.packingCode; |
||||
|
detail.recommendSupplierBatch = l.supplierBatch; |
||||
|
detail.recommendArriveDate = l.arriveDate; |
||||
|
detail.recommendProduceDate = l.produceDate; |
||||
|
detail.recommendExpireDate = l.expireDate; |
||||
|
detail.recommendLot = balanceItem.lot;; |
||||
|
detail.recommendToLocationCode = l.toLocationCode ?? that.defaultToLocation.code; |
||||
|
detail.recommendToLocationArea = l.toLocationArea ?? that.defaultToLocation |
||||
|
.areaCode; |
||||
|
detail.recommendToLocationGroup = l.toLocationGroup ?? that.defaultToLocation |
||||
|
.locationGroupCode; |
||||
|
detail.recommendToLocationErpCode = l.toLocationErpCode ?? that.defaultToLocation |
||||
|
.erpLocationCode; |
||||
|
detail.recommendToWarehouseCode = localStorage.warehouseCode; |
||||
|
detail.recommendQty = balanceItem.qty; |
||||
|
|
||||
|
|
||||
|
detail.handledContainerCode = l.containerCode; |
||||
|
detail.handledPackingCode = l.packingCode; |
||||
|
detail.handledSupplierBatch = l.supplierBatch; |
||||
|
detail.handledArriveDate = l.arriveDate; |
||||
|
detail.handledProduceDate = l.produceDate; |
||||
|
detail.handledExpireDate = l.expireDate; |
||||
|
detail.handledLot = l.lot; |
||||
|
detail.handledToLocationCode = l.toLocationCode ?? that.defaultToLocation.code; |
||||
|
detail.handledToLocationArea = l.toLocationArea ?? that.defaultToLocation.areaCode; |
||||
|
detail.handledToLocationGroup = l.toLocationGroup ?? that.defaultToLocation |
||||
|
.locationGroupCode; |
||||
|
detail.handledToLocationErpCode = l.toLocationErpCode ?? that.defaultToLocation |
||||
|
.erpLocationCode; |
||||
|
detail.handledToWarehouseCode = localStorage.warehouseCode; |
||||
|
detail.handledQty = l.qty; |
||||
|
item.details.push(detail); |
||||
|
}); |
||||
|
}) |
||||
|
return item; |
||||
|
}, |
||||
|
|
||||
|
cancel() { |
||||
|
let that = this; |
||||
|
showConfirmMsg('是否要清空已扫描信息?', confirm => { |
||||
|
if (confirm) { |
||||
|
that.clearInfo(); |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
clearInfo() { |
||||
|
this.allDataList = []; |
||||
|
this.showList = []; |
||||
|
this.defaultToLocation = {}; |
||||
|
this.defaultToLocationCode = ""; |
||||
|
this.allCount = 0; |
||||
|
this.loadingType = "" |
||||
|
this.pageNo = 0 |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: "三方库发货" |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
this.scanPackPopup(); |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
this.$refs.scanPackPopup.getfocus(); |
||||
|
}, |
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message); |
||||
|
}, |
||||
|
showCommitSuccess() { |
||||
|
this.$refs.comMessage.showCommitSuccess(); |
||||
|
}, |
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
closeCommitMessage() { |
||||
|
// this.openScanPopup(); |
||||
|
}, |
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
openPackLabel() { |
||||
|
this.$refs.scanPackPopup.openScanPopup() |
||||
|
}, |
||||
|
openScanFromLocationPopup() { |
||||
|
this.$refs.scanFromLocationPopup.openScanPopup() |
||||
|
}, |
||||
|
|
||||
|
closeScanFromLocationPopup() { |
||||
|
this.$refs.scanFromLocationPopup.closeScanPopup(); |
||||
|
}, |
||||
|
scanPackPopup(){ |
||||
|
if (this.fromLocationCode == "") { //扫描来源库位 |
||||
|
this.openScanFromLocationPopup(); |
||||
|
} else { //扫描箱标签 |
||||
|
this.openPackLabel(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
</style> |
@ -0,0 +1,193 @@ |
|||||
|
<template> |
||||
|
<page-meta root-font-size="18px"></page-meta> |
||||
|
<view class=""> |
||||
|
<win-empty-view v-if="deliverList.length==0"></win-empty-view> |
||||
|
<view hover-class="uni-list-cell-hover" v-for="(item, index) in deliverList" :key="item.id" |
||||
|
@click="openDetail(item)"> |
||||
|
<com-deliver :dataContent="item"></com-deliver> |
||||
|
</view> |
||||
|
<uni-load-more :status="loadingType" v-if="deliverList.length>0" /> |
||||
|
<!-- <win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
<win-mulit-scan ref="scanPopup" :titleArray="titleArray" @getScanResult='getScanResult'> |
||||
|
</win-mulit-scan> --> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getDeliverList, |
||||
|
getDeliverJobByNumber |
||||
|
} from '@/api/index.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import winEmptyView from '@/mycomponents/wincom/winEmptyView.vue' |
||||
|
import comDeliver from '@/mycomponents/coms/task/comDeliver.vue'; |
||||
|
import winScanButton from '@/mycomponents/wincom/winScanButton.vue' |
||||
|
import winMulitScan from '@/mycomponents/wincom/winMulitScan.vue' |
||||
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
||||
|
export default { |
||||
|
name: 'deliver', |
||||
|
components: { |
||||
|
winEmptyView, |
||||
|
winScanButton, |
||||
|
winMulitScan, |
||||
|
comDeliver, |
||||
|
comMessage |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
deliverList: [], |
||||
|
reload: false, |
||||
|
status: '', |
||||
|
contentText: { |
||||
|
contentdown: '上拉加载更多', |
||||
|
contentrefresh: '加载中', |
||||
|
contentnomore: '没有更多' |
||||
|
}, |
||||
|
pageSize: this.modelConfig, |
||||
|
pageIndex: 1, |
||||
|
isTimeWindowSorting: false, |
||||
|
isToday: true, |
||||
|
titleArray: ['任务编号'], |
||||
|
loadingType: "nomore" |
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
props: { |
||||
|
datacontent: { |
||||
|
type: Object, |
||||
|
value: null |
||||
|
} |
||||
|
}, |
||||
|
onShow: function() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
onReachBottom() { |
||||
|
//避免多次触发 |
||||
|
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
||||
|
return; |
||||
|
} |
||||
|
this.getList("more"); |
||||
|
}, |
||||
|
onPullDownRefresh() { |
||||
|
this.getList('refresh'); |
||||
|
}, |
||||
|
//后退按钮 |
||||
|
onBackPress(options) { |
||||
|
if (options.from === 'navigateBack') { |
||||
|
return false; |
||||
|
} |
||||
|
goHome(); |
||||
|
return true; |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
}else if(e.index === 1){ |
||||
|
window.location.reload(); |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
openScanPopup() { |
||||
|
this.$refs.scanPopup.openScanPopup(); |
||||
|
}, |
||||
|
//按时间窗口排序 |
||||
|
timeSortingChange: function(e) { |
||||
|
this.isTimeWindowSorting = e.detail.value |
||||
|
this.getList() |
||||
|
}, |
||||
|
|
||||
|
//只看当天到货 |
||||
|
isTodayChange: function(e) { |
||||
|
this.isToday = e.detail.value |
||||
|
this.getList() |
||||
|
}, |
||||
|
|
||||
|
//查询发货任务 |
||||
|
getList(type) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
this.loadingType = "loading"; |
||||
|
if (type === "refresh") { |
||||
|
this.pageIndex = 1; |
||||
|
this.deliverList = []; |
||||
|
} |
||||
|
let params = { |
||||
|
pageSize: that.pageSize, |
||||
|
pageIndex: that.pageIndex, |
||||
|
// isCreationTimeSorting: that.isTimeWindowSorting, |
||||
|
// isToday: that.isToday |
||||
|
}; |
||||
|
getDeliverList(params) |
||||
|
.then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
var list = res.items; |
||||
|
this.loadingType = "loadmore"; |
||||
|
if (list == null || list.length == 0) { |
||||
|
//没数据了 |
||||
|
this.loadingType = "nomore"; |
||||
|
return; |
||||
|
} |
||||
|
// that.deliverList = [...that.deliverList, ...list]; |
||||
|
that.deliverList = type === "refresh" ? list : this.deliverList.concat(list); |
||||
|
that.pageIndex++; |
||||
|
}) |
||||
|
.catch(err => { |
||||
|
this.loadingType = ""; |
||||
|
this.showMessage(err.message); |
||||
|
uni.hideLoading(); |
||||
|
if (type === "refresh") { |
||||
|
uni.stopPullDownRefresh(); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
getScanResult(type, result) { |
||||
|
if (type == '任务编号') { |
||||
|
this.getByNumber(type, result.data.code); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getByNumber(type, code) { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
getDeliverJobByNumber(code).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res != null) { |
||||
|
that.openDetail(res); |
||||
|
} else { |
||||
|
that.showMessage('未查找到' + type + '为【' + code + '】的盘点任务'); |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
that.showMessage(err.message); |
||||
|
uni.hideLoading(); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
openDetail(item) { |
||||
|
uni.navigateTo({ |
||||
|
url: './thirdLocationDetail?id=' + item.id + '&jobStatus=' + item.jobStatus |
||||
|
}); |
||||
|
}, |
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message); |
||||
|
}, |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
<style scoped lang="scss"> |
||||
|
</style> |
@ -0,0 +1,410 @@ |
|||||
|
<template> |
||||
|
<page-meta root-font-size="18px"></page-meta> |
||||
|
<view class=""> |
||||
|
<view class="top_card"> |
||||
|
<com-job-scan-detail :jobContent="datacontent" :allCount="allCount" :scanCount="scanCount"> |
||||
|
</com-job-scan-detail> |
||||
|
</view> |
||||
|
|
||||
|
<scroll-view scroll-y="true" @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" |
||||
|
class="scroll-detail"> |
||||
|
<view class="detail-list margin_top" v-for="(item, index) in details" :key="item.id"> |
||||
|
<!-- 单选卡片 --> |
||||
|
<view class="detail-content"> |
||||
|
<view class="choose_main"> |
||||
|
<view class="ljh_box"> |
||||
|
<view class="tit_ljh">{{ item.itemCode }}</view> |
||||
|
<view class="ljh_left"> |
||||
|
<view class="font_xs text_lightblue">{{ item.itemName }}</view> |
||||
|
<view class="font_xs text_lightblue">{{ item.itemDesc1 }}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="list_form hold_form"> |
||||
|
<view class="uni-container"> |
||||
|
<uni-table style="overflow-x: hidden;"> |
||||
|
<uni-tr> |
||||
|
<!-- <uni-th width="90"></uni-th> |
||||
|
<uni-th width="100" align="center">推荐</uni-th> |
||||
|
<uni-th width="100" align="center">实际</uni-th> --> |
||||
|
<uni-th width="50"></uni-th> |
||||
|
<uni-th width="120" align="center">推荐</uni-th> |
||||
|
<uni-th width="120" align="center">实际</uni-th> |
||||
|
</uni-tr> |
||||
|
<uni-tr> |
||||
|
<uni-th width="50">数量</uni-th> |
||||
|
<uni-th width="120" align="center"> |
||||
|
<view class="text_black">{{item.recommendQty}}({{item.uom}})</text> |
||||
|
</view> |
||||
|
</uni-th> |
||||
|
<!-- --> |
||||
|
<uni-th width="120" align="center"> |
||||
|
<view v-if="item.scaned" class="text_black"> |
||||
|
{{item.handledQty}}({{item.uom}}) |
||||
|
</view> |
||||
|
</uni-th> |
||||
|
</uni-tr> |
||||
|
<uni-tr> |
||||
|
<uni-th width="50">箱码</uni-th> |
||||
|
<uni-th width="120" align="center"> |
||||
|
<view class="text_packingCode">{{ item.recommendPackingCode }}</view> |
||||
|
</uni-th> |
||||
|
<uni-th width="120" align="center"> |
||||
|
<view v-if="item.scaned" class="text_packingCode"> |
||||
|
{{ item.handledPackingCode }} |
||||
|
</view> |
||||
|
</uni-th> |
||||
|
</uni-tr> |
||||
|
<uni-tr> |
||||
|
<uni-th width="50">批次</uni-th> |
||||
|
<uni-th width="120" align="center"> |
||||
|
<view><text class="text_black">{{item.recommendLot }}</text> |
||||
|
</view> |
||||
|
</uni-th> |
||||
|
<uni-th width="120" align="center"> |
||||
|
<view v-if="item.scaned"> |
||||
|
<text class="text_black">{{item.handledLot }}</text> |
||||
|
</view> |
||||
|
</uni-th> |
||||
|
</uni-tr> |
||||
|
<uni-tr> |
||||
|
<uni-th width="50">库位</uni-th> |
||||
|
<uni-th width="120" align="center"> |
||||
|
<view class="text_black">{{ item.recommendLocationCode }}</view> |
||||
|
</uni-th> |
||||
|
<uni-th width="120" align="center"> |
||||
|
<view v-if="item.scaned" class="text_black"> |
||||
|
{{ item.handledFromLocationCode }} |
||||
|
</view> |
||||
|
</uni-th> |
||||
|
</uni-tr> |
||||
|
</uni-table> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="choose_marked" v-if="item.scaned"> |
||||
|
<image src="@/static/image_marked.svg"></image> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
|
||||
|
<view class="new_btn_bot count_shadow"> |
||||
|
<button type="primary" class="new_save_btn" @click="submit()">提交</button> |
||||
|
</view> |
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
<win-scan-by-pack ref="scanPopup" @getScanResult='getScanResult'></win-scan-by-pack> |
||||
|
<com-balance ref="balanceItems" @selectedItem='selectedBalanceItem'></com-balance> |
||||
|
<comMessage ref="comMessage" @afterCloseCommitMessage='closeCommitMessage()'></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getDeliverDetail, |
||||
|
takeDeliverJob, |
||||
|
cancelTakeDeliverJob, |
||||
|
finshDeliverJob, |
||||
|
balances |
||||
|
} from '@/api/index.js'; |
||||
|
import { |
||||
|
showConfirmMsg, |
||||
|
goHome, |
||||
|
navigateBack |
||||
|
} from '@/common/basic.js'; |
||||
|
import winScanButton from '@/mycomponents/wincom/winScanButton.vue' |
||||
|
import winMulitScan from '@/mycomponents/wincom/winMulitScan.vue' |
||||
|
import winScanByPack from '@/mycomponents/wincom/winScanByPack.vue' |
||||
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
||||
|
import comJobScanDetail from '@/mycomponents/comjob/comJobScanDetail.vue' |
||||
|
import comBalance from '@/mycomponents/common/comBalance.vue' |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winMulitScan, |
||||
|
winScanByPack, |
||||
|
comMessage, |
||||
|
comJobScanDetail, |
||||
|
comBalance |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
type: '', |
||||
|
id: "", |
||||
|
datacontent: {}, |
||||
|
details: {}, |
||||
|
toLocation: '', |
||||
|
scrollTop: 0, |
||||
|
old: { |
||||
|
scrollTop: 0 |
||||
|
}, |
||||
|
ispending: false, |
||||
|
balancesItem: {}, |
||||
|
titleArray: ['箱标签', '目标库位'], |
||||
|
allCount: 0, |
||||
|
scanCount: 0, |
||||
|
jobStatus:"" |
||||
|
} |
||||
|
}, |
||||
|
props: { |
||||
|
itemCode: "", |
||||
|
}, |
||||
|
onLoad(param) { |
||||
|
this.id = param.id; |
||||
|
if (param.jobStatus == 1) { |
||||
|
this.receive((callback => { |
||||
|
this.getDetail(); |
||||
|
})); |
||||
|
} else { |
||||
|
this.getDetail(); |
||||
|
} |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
}else if(e.index === 1){ |
||||
|
window.location.reload(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) { |
||||
|
//已经接收但是没提交任务 |
||||
|
if (e.from == 'backbutton') { |
||||
|
if (this.jobStatus == 2) { |
||||
|
//取消承接任务 |
||||
|
cancelTakeDeliverJob(this.id).then(res => { |
||||
|
uni.navigateBack(); |
||||
|
}).catch(error => { |
||||
|
uni.navigateBack(); |
||||
|
}) |
||||
|
} else { |
||||
|
uni.navigateBack(); |
||||
|
} |
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
|
mounted() { |
||||
|
uni.setNavigationBarColor({ |
||||
|
frontColor: '#ffffff', |
||||
|
backgroundColor: "#5A7CF3 !important" |
||||
|
}) |
||||
|
}, |
||||
|
methods: { |
||||
|
openScanPopup() { |
||||
|
this.$refs.scanPopup.openScanPopup(); |
||||
|
}, |
||||
|
//加载零件信息 |
||||
|
getDetail() { |
||||
|
let that = this; |
||||
|
let params = { |
||||
|
id: that.id, |
||||
|
}; |
||||
|
getDeliverDetail(params) |
||||
|
.then(item => { |
||||
|
console.log('item', item); |
||||
|
that.datacontent = item; |
||||
|
that.jobStatus = item.jobStatus |
||||
|
that.details = item.details; |
||||
|
that.details.forEach(r => r.scaned = false); |
||||
|
that.ispending = item.jobStatus === 2; |
||||
|
that.allCount = item.details.length; |
||||
|
// that.toLocation = item.details[0].recommendLocationCode; |
||||
|
}) |
||||
|
.catch(err => { |
||||
|
this.showMessage('未查找到详细信息') |
||||
|
}); |
||||
|
}, |
||||
|
//扫描箱标签 |
||||
|
getScanResult(result) { |
||||
|
let that = this; |
||||
|
let code = result.data.code; |
||||
|
let item = this.details.find(r => { |
||||
|
return r.recommendPackingCode === code |
||||
|
}); |
||||
|
|
||||
|
if (item === undefined) { |
||||
|
this.showMessage('在发货任务详情中,未找到箱码【' + code + '】'); |
||||
|
return; |
||||
|
} else { |
||||
|
if (item.scaned) { |
||||
|
this.showMessage('箱码【' + code + '】已经扫描,请扫描下一箱零件'); |
||||
|
return; |
||||
|
} |
||||
|
} |
||||
|
//按照零件号和箱码去查询库存 |
||||
|
let params = { |
||||
|
pageSize: 1000, |
||||
|
pageIndex: 1, |
||||
|
packingCode: code, |
||||
|
locationTypes: [4], //成品 |
||||
|
inventoryStatuses: [2], //合格 |
||||
|
}; |
||||
|
balances(params) |
||||
|
.then(res => { |
||||
|
try { |
||||
|
if (res.totalCount == 0) { |
||||
|
this.showMessage('箱码【' + code + '】在【成品库】未查询到库存信息'); |
||||
|
} else if (res.totalCount == 1) { |
||||
|
that.balancesItem = res.items[0]; |
||||
|
this.createItem(item); |
||||
|
} else { |
||||
|
this.$refs.balanceItems.openPopup(res.items); |
||||
|
} |
||||
|
uni.hideLoading(); |
||||
|
} catch (e) { |
||||
|
this.showMessage(e.message) |
||||
|
} |
||||
|
}) |
||||
|
.catch(err => { |
||||
|
this.showMessage(err.message) |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
createItem(item) { |
||||
|
let that = this; |
||||
|
if (that.balancesItem != null || that.balancesItem != undefined) { |
||||
|
// if (that.balancesItem.qty != item.recommendQty) { |
||||
|
// this.showMessage('库存余额数量【' + that.balancesItem.qty + '】不等于推荐数量【' + item.recommendQty + '】,不可以进行发货') |
||||
|
// } else { |
||||
|
item.scaned = true; |
||||
|
item.handledContainerCode = that.balancesItem.containerCode; |
||||
|
item.handledPackingCode = that.balancesItem.packingCode; |
||||
|
item.handledBatch = that.balancesItem.batch; |
||||
|
item.handledLot = that.balancesItem.lot; |
||||
|
item.handledFromLocationArea = that.balancesItem.locationCode; |
||||
|
item.handledQty = that.balancesItem.qty; |
||||
|
|
||||
|
|
||||
|
// ================================== |
||||
|
// item.recommendFromLocationCode = string; |
||||
|
// item.recommendFromLocationArea = string; |
||||
|
// item.recommendFromLocationGroup = string; |
||||
|
// item.recommendFromLocationErpCode = string; |
||||
|
// item.recommendFromWarehouseCode = string; |
||||
|
// item.uom = string; |
||||
|
// item.recommendQty = 0; |
||||
|
// item.handledFromLocationCode = string; |
||||
|
// item.handledFromLocationArea = string; |
||||
|
// item.handledFromLocationGroup = string; |
||||
|
// item.handledFromLocationErpCode = string; |
||||
|
// item.handledFromWarehouseCode = string; |
||||
|
// item.handledQty = that.balancesItem.qty; |
||||
|
// item.toLocationCode = string; |
||||
|
// item.toLocationArea = string; |
||||
|
// item.toLocationGroup = string; |
||||
|
// item.toLocationErpCode = string; |
||||
|
// item.toWarehouseCode = string; |
||||
|
// item.onTheWayLocationCode = string; |
||||
|
|
||||
|
|
||||
|
this.getScanCount(); |
||||
|
this.closeScanPopup(); |
||||
|
that.$forceUpdate(); |
||||
|
// } |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
getScanCount() { |
||||
|
this.scanCount = this.datacontent.details.filter(r => r.scaned).length; |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if (this.allCount == this.scanCount) { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
selectedBalanceItem(balanceItem) { |
||||
|
that.balancesItem = balanceItem; |
||||
|
this.createItem(item); |
||||
|
}, |
||||
|
|
||||
|
//接收 |
||||
|
receive(callback) { |
||||
|
let params = { |
||||
|
id: this.id |
||||
|
}; |
||||
|
takeDeliverJob(params) |
||||
|
.then(res => { |
||||
|
callback(true); |
||||
|
}) |
||||
|
.catch(err => { |
||||
|
this.showMessage(err.message); |
||||
|
callback(false); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
submit() { |
||||
|
let that = this; |
||||
|
if (that.datacontent.details.length === 0) { |
||||
|
this.showMessage('该任务没有要发货的零件'); |
||||
|
return; |
||||
|
} |
||||
|
let items = that.datacontent.details.filter(r => r.scaned); |
||||
|
if (items.length === 0) { |
||||
|
this.showMessage('请扫描要发货的零件'); |
||||
|
return; |
||||
|
} else if (items.length < that.datacontent.details.length) { |
||||
|
this.showMessage('还有未扫描的零件,不可以发货'); |
||||
|
return; |
||||
|
} else { |
||||
|
that.finsh(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
finsh() { |
||||
|
let that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "提交中..." |
||||
|
}); |
||||
|
|
||||
|
let params = JSON.stringify(that.datacontent); |
||||
|
console.log(params); |
||||
|
// finshDeliverJob(that.id, params) |
||||
|
// .then(res => { |
||||
|
// uni.hideLoading(); |
||||
|
// if (res != null) { |
||||
|
// that.showCommitSuccessMessage(); |
||||
|
// navigateBack(1); |
||||
|
// } |
||||
|
// }) |
||||
|
// .catch(err => { |
||||
|
// this.showMessage(err.message); |
||||
|
// uni.hideLoading(); |
||||
|
// }); |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage() { |
||||
|
this.$refs.comMessage.showCommitSuccess(); |
||||
|
}, |
||||
|
|
||||
|
closeCommitMessage() { |
||||
|
navigateBack(1); //点关闭直接返回列表 |
||||
|
uni.hideLoading(); |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if (this.allCount == this.scanCount) { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
clearScanLocation() { |
||||
|
// this.$refs.scanLocation.getfocus(); |
||||
|
// this.$refs.scanLocation.clear(); |
||||
|
}, |
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message); |
||||
|
}, |
||||
|
|
||||
|
scroll: function(e) { |
||||
|
this.old.scrollTop = e.detail.scrollTop; |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
</style> |
Loading…
Reference in new issue