6 changed files with 630 additions and 1 deletions
@ -0,0 +1,38 @@ |
|||
<template> |
|||
<view class="ljh_box"> |
|||
<view class="tit_ljh">{{ itemData.itemCode }}</view> |
|||
<view class="ljh_left desc_ljh"> |
|||
<view class="font_xs text_lightblue">{{ itemData.itemName }}</view> |
|||
<view class="font_xs text_lightblue">{{ itemData.itemDesc1 }}</view> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'comBaseItem', |
|||
components: {}, |
|||
props: { |
|||
itemData: { |
|||
type: Object, |
|||
default: {} |
|||
}, |
|||
|
|||
}, |
|||
data() { |
|||
return {} |
|||
}, |
|||
filters: { |
|||
|
|||
}, |
|||
created() { |
|||
|
|||
}, |
|||
methods: { |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
@ -0,0 +1,153 @@ |
|||
<template> |
|||
<view> |
|||
<uni-popup ref="popup" @change="change" @maskClick="closeScanPopup()"> |
|||
<view class="popup_box"> |
|||
<view class="pop_title"> |
|||
扫描{{title}} |
|||
<text class="fr" @click="closeScanPopup()">关闭</text> |
|||
</view> |
|||
<view class="pop_tab"> |
|||
<!-- <view class="uni-flex uni-row"> |
|||
<view class="tab_tit tab_tit_active">箱标签</view> |
|||
</view> --> |
|||
<view class="tab_info"> |
|||
<win-com-scan ref="comscan" @getScanResult="getScanResult" placeholder="箱标签" |
|||
:clearResult="true" :placeholder="title"></win-com-scan> |
|||
<view class="uni-flex"> |
|||
<button class="clean_scan_btn" @click="cancelClick()">清空</button> |
|||
<button class="scan_btn" @click="scanClick()">扫描</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</uni-popup> |
|||
<com-message ref="comMessage" @afterClose="getfocus"></com-message> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import winComScan from '@/mycomponents/wincom/winComScan.vue' |
|||
import comMessage from '@/mycomponents/common/comMessage.vue' |
|||
import { |
|||
getInventoryLabel |
|||
} from '@/api/index.js'; |
|||
|
|||
export default { |
|||
name: 'winScanByPack', |
|||
components: { |
|||
winComScan, |
|||
comMessage |
|||
}, |
|||
props: { |
|||
title: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
}, |
|||
data() { |
|||
return { |
|||
scanResult: {}, |
|||
show: false, |
|||
} |
|||
}, |
|||
created() { |
|||
|
|||
}, |
|||
methods: { |
|||
openScanPopup(content) { |
|||
this.$refs.popup.open('bottom'); |
|||
}, |
|||
|
|||
closeScanPopup(content) { |
|||
this.$refs.popup.close(); |
|||
this.$emit("close", ''); |
|||
}, |
|||
|
|||
scanClick() { |
|||
this.$refs.comscan.handelScanMsg(); |
|||
}, |
|||
cancelClick() { |
|||
this.$refs.comscan.clearScanValue(); |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
if (result != null) { |
|||
uni.showLoading({ |
|||
title: '扫描中...', |
|||
mask: true |
|||
}) |
|||
//可以增加配置是否要查询标签表 |
|||
getInventoryLabel(result.data.code).then(label => { |
|||
if (label) { |
|||
this.losefocus(); //扫描完失去焦点,扫描完成后在业务里调用getfocus()方法 |
|||
let result = this.getLabelResult(label); |
|||
this.scanResult = result; |
|||
uni.hideLoading(); |
|||
this.callBack(); |
|||
} else { |
|||
this.showMessage('标签【' + result.data.code + '】,在标签表中不存在') |
|||
uni.hideLoading(); |
|||
} |
|||
}).catch(err => { |
|||
uni.hideLoading(); |
|||
this.showMessage(err.message) |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
getLabelResult(label) { |
|||
let labelResult = { |
|||
sucess: true, |
|||
message: "", |
|||
data: label, |
|||
// data: { |
|||
// isPack: true, |
|||
// // scanType: null, |
|||
// itemCode: label.itemCode, |
|||
// itemName: label.itemName, |
|||
// itemDesc1: label.itemDesc1, |
|||
// itemDesc2: label.itemDesc2, |
|||
// lot: label.lot, |
|||
// qty: label.qty, |
|||
// uom: label.uom, |
|||
// poNumber: label.poNumber, |
|||
// // asn: null, |
|||
// packingCode: label.code, |
|||
// supplierBatch: label.supplierBatch, |
|||
// // order: null, |
|||
// // poLine: null, |
|||
// code: label.code, |
|||
// } |
|||
|
|||
}; |
|||
labelResult.data.isPack = true; |
|||
labelResult.data.packingCode = label.code; |
|||
return labelResult; |
|||
}, |
|||
|
|||
callBack() { |
|||
this.$refs.comscan.clear(); |
|||
this.$emit("getScanResult", this.scanResult); |
|||
}, |
|||
getfocus() { |
|||
if (this.$refs.comscan != undefined) { |
|||
this.$refs.comscan.getfocus(); |
|||
} |
|||
}, |
|||
losefocus() { |
|||
if (this.$refs.comscan != undefined) { |
|||
this.$refs.comscan.losefocus(); |
|||
} |
|||
}, |
|||
showMessage(message) { |
|||
this.$refs.comMessage.showMessage(message); |
|||
}, |
|||
change(e) { |
|||
this.show = e.show |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
@ -0,0 +1,424 @@ |
|||
<template> |
|||
<page-meta root-font-size="18px"></page-meta> |
|||
<view class=""> |
|||
<win-blank-view @goScan='openScanPopup' v-if="dataList.length==0"></win-blank-view> |
|||
<scroll-view scroll-y="true" class="scroll-detail" style="margin-top: 10rpx;padding-bottom:100px"> |
|||
<view class="detail-list " v-for="(item, index) in dataList" :key="index"> |
|||
<view class="detail-content"> |
|||
<view class="" style=""> |
|||
<comItemCode :itemData="item"></comItemCode> |
|||
<uni-table border stripe style=""> |
|||
<uni-tr> |
|||
<uni-td align="center">数量</uni-td> |
|||
<uni-td> |
|||
<view class="uni-flex uni-row"> |
|||
<view class="uni-flex uni-row space-between"> |
|||
<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-tr> |
|||
<uni-td align="center">箱码</uni-td> |
|||
<uni-td>1234567890</uni-td> |
|||
</uni-tr> |
|||
</uni-table> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
</scroll-view> |
|||
<div class="new_bot_box" v-show="dataList.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="dataList.length>0"></win-scan-button> |
|||
<win-scan-by-code ref="scanToLocationPopup" title="目标库位" @getScanCode='getToLocation'></win-scan-by-code> |
|||
<winScanByProductCode ref="scanPackPopup" title="产品码" @getScanResult='getScanResult'></winScanByProductCode> |
|||
<com-balance ref="balanceItems" @selectedItem='selectedBalanceItem'></com-balance> |
|||
<com-message ref="comMessage" @afterCloseScanMessage='closeScanMessage' @afterRescanMessage='afterRescan' |
|||
@afterCloseCommitMessage='closeCommitMessage'> |
|||
</com-message> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
locations, |
|||
getBalancesByFilterAsync, |
|||
getWipListAsync, |
|||
returnToWarehouse, |
|||
} 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 comBalance from '@/mycomponents/common/comBalance.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: 'returnToWarehouse', |
|||
components: { |
|||
winBlankView, |
|||
comBaseItem, |
|||
comMessage, |
|||
winScanButton, |
|||
winScanByPack, |
|||
winScanByCode, |
|||
comScanSemiPutaway, |
|||
comBalance, |
|||
winCollapseLocation, |
|||
SemiCollapseItem, |
|||
winScanByProductCode, |
|||
comItemCode, |
|||
comNumberBox |
|||
}, |
|||
data() { |
|||
return { |
|||
options: [], |
|||
toLocation: null, |
|||
currentItem: {}, |
|||
dataList: [] |
|||
}; |
|||
}, |
|||
props: { |
|||
|
|||
}, |
|||
|
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} else if (e.index === 1) { |
|||
window.location.reload(); |
|||
} |
|||
}, |
|||
mounted: function() { |
|||
this.openScanPopup(); |
|||
}, |
|||
|
|||
methods: { |
|||
remove(item,index){ |
|||
showConfirmMsg("是否移除当前"+item.itemCode,res=>{ |
|||
if(res){ |
|||
this.dataList.splice(index,1); |
|||
this.$forceUpdate() |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
this.currentLabel = result.data; |
|||
let code = result.data.code; |
|||
|
|||
var filterItem= this.dataList.filter(res=>{ |
|||
if(res.itemCode==result.data.itemCode){ |
|||
return res; |
|||
} |
|||
}) |
|||
if(filterItem.length>0){ |
|||
this.showMessage(filterItem[0].itemCode+"已经扫描") |
|||
return; |
|||
} |
|||
|
|||
var item = { |
|||
itemCode: result.data.itemCode, |
|||
itemName: result.data.itemName, |
|||
itemDesc1: result.data.itemDesc1, |
|||
} |
|||
this.dataList.push(item) |
|||
|
|||
}, |
|||
|
|||
scanToLocation(item) { |
|||
this.currentItem = item; |
|||
this.openScanToLocationPopup(); |
|||
}, |
|||
|
|||
//扫描默认目标库位 |
|||
getDefaultToLocation(locationCode) { |
|||
let that = this; |
|||
|
|||
uni.showLoading({ |
|||
title: "扫描中", |
|||
mask: true |
|||
}); |
|||
locations(locationCode).then(res => { |
|||
if (res == null) { |
|||
that.showMessage('目标库位【' + locationCode + '】不存在'); |
|||
} else { |
|||
if (res.type == 2 || res.type == 3 || res.type == 4 || res.type == 6) { |
|||
|
|||
showConfirmMsg('是否要将所有未扫描目标库位的零件,指定目标库位【' + locationCode + '】', |
|||
confirm => { |
|||
if (confirm) { |
|||
that.defaultToLocation = res; |
|||
|
|||
} |
|||
}); |
|||
} else { |
|||
that.showMessage('目标库位的库位类型必须是【原料库】或【半成品库】或【成品库】或【隔离库】') |
|||
} |
|||
} |
|||
uni.hideLoading(); |
|||
}).catch(err => { |
|||
that.toLocation = null; |
|||
that.showMessage(err.message); |
|||
uni.hideLoading(); |
|||
}) |
|||
}, |
|||
|
|||
getToLocation(code) { |
|||
if (code == '') { |
|||
this.showMessage('目标库位不能为空'); |
|||
return; |
|||
} |
|||
uni.showLoading({ |
|||
title: "扫描中", |
|||
mask: true |
|||
}); |
|||
let that = this; |
|||
locations(code).then(res => { |
|||
if (res == null) { |
|||
that.showMessage('目标库位【' + code + '】不存在'); |
|||
} else { |
|||
|
|||
if (res.type == 2 || res.type == 3 || res.type == 4 || res.type == 6) { |
|||
this.handledToLocation(this.currentItem, res); |
|||
} else { |
|||
this.showMessage('目标库位的库位类型必须是【原料库】或【半成品库】或【成品库】或【隔离库】') |
|||
} |
|||
} |
|||
uni.hideLoading(); |
|||
}).catch(err => { |
|||
that.toLocation = null; |
|||
that.showMessage(err.message); |
|||
uni.hideLoading(); |
|||
}) |
|||
}, |
|||
|
|||
handledToLocation(item, location) { |
|||
item.toLocationCode = location.code; |
|||
item.toLocationGroup = location.locationGroupCode; |
|||
item.toLocationArea = location.areaCode; |
|||
item.toLocationErpCode = location.erpLocationCode; |
|||
this.$forceUpdate(); |
|||
this.closeScanToLocationPopup(); |
|||
}, |
|||
|
|||
clearDefaultLocation() { |
|||
this.toLocationCode="" |
|||
}, |
|||
|
|||
submit() { |
|||
let that = this; |
|||
if (that.dataList.length === 0) { |
|||
that.showMessage('请扫描要退货的条码'); |
|||
return; |
|||
} |
|||
|
|||
if(this.toLocation==""){ |
|||
that.showMessage('请扫描目标库位'); |
|||
return; |
|||
} |
|||
|
|||
|
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
|
|||
let item = this.getSubmitParam(); |
|||
let params = JSON.stringify(item); |
|||
returnToWarehouse(params) |
|||
.then(res => { |
|||
that.showCommitSuccess(); |
|||
that.clearInfo(); |
|||
uni.hideLoading(); |
|||
}) |
|||
.catch(err => { |
|||
that.showMessage(err.message); |
|||
uni.hideLoading(); |
|||
}); |
|||
}, |
|||
|
|||
|
|||
getSubmitParam() { |
|||
let that = this; |
|||
let item = { |
|||
number: "", |
|||
worker: localStorage.userName_CN == "" ? localStorage.userName : localStorage.userName_CN, |
|||
putawayType: 2, |
|||
details: [] |
|||
} |
|||
|
|||
that.dataList.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() { |
|||
let that = this; |
|||
that.dataList = []; |
|||
that.toLocation = null; |
|||
that.defaultToLocation = null; |
|||
}, |
|||
|
|||
openScanPopup() { |
|||
if (this.dataList.length == 0) { //扫描来源库位 |
|||
this.scanPackPopup(); |
|||
} else { //扫描箱标签 |
|||
this.openPackLabel(); |
|||
} |
|||
}, |
|||
|
|||
scanPopupGetFocus() { |
|||
this.$refs.scanPackPopup.getfocus(); |
|||
}, |
|||
showMessage(message) { |
|||
this.$refs.comMessage.showMessage(message); |
|||
}, |
|||
showCommitSuccess() { |
|||
this.$refs.comMessage.showCommitSuccess(); |
|||
}, |
|||
showRescanMessage(message) { |
|||
this.$refs.comMessage.showRescanMessage(message); |
|||
}, |
|||
showScanMessage(message) { |
|||
this.$refs.comMessage.showScanMessage(message); |
|||
}, |
|||
closeCommitMessage() { |
|||
// this.openScanPopup(); |
|||
}, |
|||
closeScanMessage() { |
|||
this.scanPopupGetFocus(); |
|||
}, |
|||
openPackLabel() { |
|||
this.$refs.scanPackPopup.openScanPopup() |
|||
}, |
|||
|
|||
scanPackPopup() { |
|||
this.$refs.scanPackPopup.openScanPopup() |
|||
}, |
|||
|
|||
openScanToLocationPopup() { |
|||
this.$refs.scanToLocationPopup.openScanPopup() |
|||
}, |
|||
|
|||
closeScanToLocationPopup() { |
|||
this.$refs.scanToLocationPopup.closeScanPopup(); |
|||
}, |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
</style> |
Loading…
Reference in new issue