15 changed files with 1786 additions and 618 deletions
@ -0,0 +1,168 @@ |
|||||
|
<template> |
||||
|
<view class="" style="background-color: #fff; margin-top: 0rpx;"> |
||||
|
<item-qty style="color: #000; font-weight: bold;" :dataContent="dataContent" :handleQty="dataContent.handleQty" |
||||
|
:isShowBalanceQty="true" :showRecommendQty="false" :showStdPack="true"> |
||||
|
</item-qty> |
||||
|
<view class='split_line'></view> |
||||
|
<view class="" style="margin-left: 20rpx;"> |
||||
|
<view class="" v-for="(item,index) in recordList"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,item)" :right-options="scanOptions"> |
||||
|
<recommend-count :detail="item" :isShowFromLocation="false" |
||||
|
style='margin:1px 0px;color: #000; font-weight: bold;' :isShowRecommendQty="false"> |
||||
|
</recommend-count> |
||||
|
|
||||
|
<view class='split_line'></view> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
|
||||
|
<count-qty-edit ref="countQtyEdit" @confirm="editConfirm" :isShowStatus="true" |
||||
|
:allowEditStatus="editInventoryStatus" :showConfirmCountdown="false" :isShowBalance="true"> |
||||
|
</count-qty-edit> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
||||
|
import item from '@/mycomponents/item/item.vue' |
||||
|
import recommendCount from '@/mycomponents/recommend/recommendCount.vue' |
||||
|
import countQtyEdit from '@/mycomponents/qty/countQtyEdit.vue' |
||||
|
|
||||
|
import { |
||||
|
getEditRemoveOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
import { |
||||
|
deepCopyData, |
||||
|
|
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
item, |
||||
|
itemQty, |
||||
|
recommendCount, |
||||
|
countQtyEdit |
||||
|
}, |
||||
|
props: { |
||||
|
recordList: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: {} |
||||
|
}, |
||||
|
editInventoryStatus: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
}, |
||||
|
// watch: { |
||||
|
// recordList: { |
||||
|
// handler(newName, oldName) { |
||||
|
// if (recordList.length > 0) { |
||||
|
// this.dataContent.itemName = this.recordList[0].itemName; |
||||
|
// this.dataContent.itemCode = this.recordList[0].itemCode; |
||||
|
// var handleQty = 0; |
||||
|
// this.recordList.forEach(item => { |
||||
|
// handleQty = calc(handleQty, item.handleQty) |
||||
|
// }) |
||||
|
// this.dataContent.handleQty = handleQty |
||||
|
// } |
||||
|
// } |
||||
|
// }, |
||||
|
// immediate: true, |
||||
|
// deep: true |
||||
|
// }, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
option: [], |
||||
|
title: "推荐详情", |
||||
|
currentEditItem: {}, |
||||
|
editItem: { |
||||
|
record: { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
scanOptions: [], |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
mounted() { |
||||
|
this.scanOptions = getEditRemoveOption(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
swipeClick(e, item) { |
||||
|
if (e.content.text == "编辑") { |
||||
|
this.edit(item) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(item) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
edit(detail) { |
||||
|
|
||||
|
var data =deepCopyData(detail) |
||||
|
this.currentEditItem = detail; |
||||
|
this.$refs.countQtyEdit.openEditPopup(data, |
||||
|
null); |
||||
|
}, |
||||
|
editConfirm(qty, inventoryStatus, mode) { |
||||
|
//按物料,箱码,批次,状态查找 |
||||
|
|
||||
|
let result = this.recordList.find(r => |
||||
|
r.itemCode == this.currentEditItem.itemCode && |
||||
|
r.packingNumber == this.currentEditItem.packingNumber && |
||||
|
r.batch == this.currentEditItem.batch && |
||||
|
r.inventoryStatus == inventoryStatus) |
||||
|
// 存在更新状态和数量 |
||||
|
if (result) { |
||||
|
result.handleQty = qty |
||||
|
result.inventoryStatus = inventoryStatus; |
||||
|
} else { |
||||
|
//不存在,添加到列表中 |
||||
|
var addItem = deepCopyData(this.currentEditItem) |
||||
|
addItem.handleQty = qty; |
||||
|
addItem.inventoryStatus = inventoryStatus |
||||
|
this.recordList.unshift(addItem) |
||||
|
} |
||||
|
var handleQty=0; |
||||
|
this.recordList.forEach(item => { |
||||
|
handleQty = calc.add(Number(handleQty), Number(item.handleQty)) |
||||
|
}) |
||||
|
this.dataContent.qty=handleQty; |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
remove(item, index) { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.recordList.splice(index, 1) |
||||
|
this.$emit('removePack') |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
confirm(qty) { |
||||
|
this.$emit('updateData') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,103 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<uni-popup ref="popup"> |
||||
|
<view class="uni-flex uni-column" |
||||
|
style="background-color: white;width: 100%; height:700rpx; align-items: center;justify-content: center; border-radius: 10rpx;"> |
||||
|
<scroll-view style="height:500px ; "> |
||||
|
<view class="" style="margin-bottom: 250rpx;"> |
||||
|
<view class="" style="font-size: 35rpx; font-weight: bold; padding: 15rpx;"> |
||||
|
盘点记录 |
||||
|
</view> |
||||
|
<view class='split_line'></view> |
||||
|
<view class="" style="" v-for="(item, index) in dataContent" :key="index"> |
||||
|
|
||||
|
<view class="uni-flex" style="flex-direction: column;"> |
||||
|
<view class="item uni-flex" style="margin: 20rpx;justify-content: space-between"> |
||||
|
<text class="item_title" style="font-weight: bold; font-size: 30rpx;">盘点记录单号 : |
||||
|
</text> |
||||
|
<text class="text_wrap">{{item.recordNumber}}</text> |
||||
|
</view> |
||||
|
<view class="item uni-flex" style="margin: 20rpx;justify-content: space-between"> |
||||
|
<text class="item_title" style="font-weight: bold; font-size: 30rpx;">盘点数量 : </text> |
||||
|
<view class="uni-flex uni-row center"> |
||||
|
<text class="text_wrap">{{item.countQty}}</text> |
||||
|
<uom :uom="item.uom" /> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
<view class="item uni-flex" style="margin: 20rpx;justify-content: space-between"> |
||||
|
<text class="item_title" style="font-weight: bold; font-size: 30rpx;">盘点人 : </text> |
||||
|
<text class="text_wrap">{{item.createName}}</text> |
||||
|
</view> |
||||
|
<view class="item uni-flex" style="margin: 20rpx;justify-content: space-between"> |
||||
|
<text class="item_title" style="font-weight: bold; font-size: 30rpx;">盘点时间 : </text> |
||||
|
<text class="text_wrap">{{formatDate(item.createTime)}}</text> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class='split_line'></view> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
<view class="uni-flex u-row-center " style="width: 100%; position: fixed; bottom: 2rpx;"> |
||||
|
<view class="close_button" style="width: 100%;" @click="closeScanPopup"> |
||||
|
关闭</view> |
||||
|
<!-- button 滚动不好使 --> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
|
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
dateFormat |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import uom from '@/mycomponents/qty/uom.vue' |
||||
|
export default { |
||||
|
components: { |
||||
|
uom, |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
props: { |
||||
|
title: { |
||||
|
type: String, |
||||
|
default: "" |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
dataContent: [] |
||||
|
}; |
||||
|
}, |
||||
|
methods: { |
||||
|
formatDate: function(val) { |
||||
|
return dateFormat(val) |
||||
|
}, |
||||
|
openScanPopup(data) { |
||||
|
this.dataContent = data; |
||||
|
setTimeout(res => { |
||||
|
this.$refs.popup.open('bottom') |
||||
|
}, 200) |
||||
|
|
||||
|
}, |
||||
|
closeScanPopup() { |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.popup_box { |
||||
|
width: 500rpx; |
||||
|
height: 500rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,802 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="page-header"> |
||||
|
<view class="header-view"> |
||||
|
<view class="header_job_top"> |
||||
|
<job-top :dataContent="jobContent"></job-top> |
||||
|
<view class="" style="margin-left: 10rpx; margin-top: 10rpx;margin-bottom: 10rpx;"> |
||||
|
<text style=" font-size: 32rpx; color: #6750F1">库位代码 </text> |
||||
|
<text style="font-size: 35rpx; font-weight: bold;">{{fromLocationCode}}</text> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
<view class="page-main" style="margin-bottom: 100rpx;background-color: #F3F4F5"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="" style="background-color: #F3F4F5" v-for="(item, index) in showList" :key="item.id"> |
||||
|
<uni-swipe-action ref="swipeAction"> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,item)" |
||||
|
:right-options="item.scaned?scanOptions:detailOptions"> |
||||
|
<view class="uni-flex uni-row " |
||||
|
style="align-items: center; margin: 10rpx; border-radius: 10rpx ;" |
||||
|
:class="item.scaned?'scan_view':'item'"> |
||||
|
<comCountDetailcards :ref="'countDetail_'+index" :dataContent="item" :index="index" |
||||
|
@editItem="editItem" :settingParam="jobContent" @remove="updateData" |
||||
|
@updateData="updateData"> |
||||
|
</comCountDetailcards> |
||||
|
</view> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
<uni-load-more :status="loadingType" v-if="showList.length>0" /> |
||||
|
|
||||
|
</view> |
||||
|
|
||||
|
<view class="page-footer"> |
||||
|
<view class="uni-flex u-col-center space-between padding_10" |
||||
|
style="background-color:ghostwhite; width: 100%; "> |
||||
|
<view class=""> |
||||
|
</view> |
||||
|
<view class=" uni-flex uni-row"> |
||||
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
||||
|
<win-scan-pack-and-location :allowModifyLocation="false" ref="scanPopup" :noShowBalanceMessage="true" |
||||
|
@getCountScanResult='getCountScanResult'> |
||||
|
</win-scan-pack-and-location> |
||||
|
<count-qty-edit ref="countQtyEdit" @confirm="editConfirm" @close="editClose" :isShowStatus="true" |
||||
|
:allowEditStatus="true" :isShowBalance="jobContent.isOpenCount=='TRUE'"> |
||||
|
</count-qty-edit> |
||||
|
<detail-info-popup ref="detailInfoPopup"></detail-info-popup> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
getCountJobDetail, |
||||
|
countJobSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
Decimal |
||||
|
} from 'decimal.js'; //引入 |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
navigateBack, |
||||
|
getPackingNumberAndBatch, |
||||
|
compare |
||||
|
} from '@/common/basic.js'; |
||||
|
import { |
||||
|
getCountStageName |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailEditRemoveOption, |
||||
|
getClearOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
import { |
||||
|
getManagementPrecisions, |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import comCountDetailcards from '@/pages/count/coms/comCountDetailcards.vue' |
||||
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
||||
|
import countQtyEdit from '@/mycomponents/qty/countQtyEdit.vue' |
||||
|
import jobTop from '@/mycomponents/job/jobTop.vue' |
||||
|
import detailInfoPopup from '@/pages/count/coms/detailInfoPopup.vue' |
||||
|
|
||||
|
export default { |
||||
|
name: 'receipt_detail', |
||||
|
components: { |
||||
|
winScanButton, |
||||
|
winScanPack, |
||||
|
comCountDetailcards, |
||||
|
winScanPackAndLocation, |
||||
|
countQtyEdit, |
||||
|
jobTop, |
||||
|
detailInfoPopup |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
id: '', |
||||
|
receiptJob: {}, |
||||
|
fromLocationCode: '', |
||||
|
isShowPackingCode: true, |
||||
|
jobContent: {}, //任务内容 |
||||
|
subList: [], //接口返回的任务subList |
||||
|
detailSource: [], //绑定在页面上的数据源 |
||||
|
balance: {}, //库存余额 |
||||
|
editInventoryStatus: false, |
||||
|
package: {}, //包装 |
||||
|
label: {}, //标签 |
||||
|
currentEditItem: {}, |
||||
|
jobStatus: "", |
||||
|
allCount: 0, |
||||
|
scanCount: 0, |
||||
|
index: 0, |
||||
|
pageSize: 20, |
||||
|
showList: [], |
||||
|
loadingType: "", |
||||
|
allDetails: [], |
||||
|
scanOptions: [], |
||||
|
detailOptions: [], |
||||
|
managementList: [], |
||||
|
managementType: '' |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option) { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: option.title + '详情' |
||||
|
}) |
||||
|
this.id = option.id; |
||||
|
if (this.id) { |
||||
|
this.getDetail(); |
||||
|
} |
||||
|
this.detailOptions = getDetailOption(); |
||||
|
this.scanOptions = getDetailEditRemoveOption(); |
||||
|
}, |
||||
|
//返回首页 |
||||
|
onNavigationBarButtonTap(e) { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}, |
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) { |
||||
|
//已经接收但是没提交任务 |
||||
|
if (e.from === 'backbutton') { |
||||
|
uni.navigateBack(); |
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
onPullDownRefresh() { |
||||
|
this.initList(); |
||||
|
uni.stopPullDownRefresh(); |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
computed(){ |
||||
|
}, |
||||
|
onReachBottom() { |
||||
|
console.log("onReachBottom") |
||||
|
//避免多次触发 |
||||
|
if (this.loadingType == 'nomore') { |
||||
|
return; |
||||
|
} |
||||
|
this.index++; |
||||
|
var list = this.getDataPage(this.index, this.pageSize) |
||||
|
if (list.length > 0) { |
||||
|
// this.showList=list |
||||
|
this.showList = this.showList.concat(list) |
||||
|
} else { |
||||
|
//没有更多了 |
||||
|
this.loadingType = "nomore"; |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
getDetail() { |
||||
|
var that = this; |
||||
|
uni.showLoading({ |
||||
|
title: "加载中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
getCountJobDetail(that.id).then(async res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data == null) { |
||||
|
that.showMessage('未获取到详情'); |
||||
|
} else { |
||||
|
that.jobContent = res.data; |
||||
|
that.jobStatus = res.data.status; |
||||
|
that.fromLocationCode = that.jobContent.countSplitCode; |
||||
|
res.data.subList.forEach(item => { |
||||
|
item.kucunQty=10 |
||||
|
item.pandianQty=50 |
||||
|
item.currentQty=0 |
||||
|
item.recommendQty = item.qty |
||||
|
item.handleQty = 0 |
||||
|
item.countTime = new Date() |
||||
|
item.fromLocationCode = that.fromLocationCode; |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
that.allDetails = res.data.subList; |
||||
|
that.allCount = res.data.subList.length; |
||||
|
that.updateList() |
||||
|
} |
||||
|
|
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
initList() { |
||||
|
this.index = 1; |
||||
|
this.showList = [] |
||||
|
this.loadingType = ""; |
||||
|
this.showList = this.getDataPage(this.index, this.pageSize) |
||||
|
}, |
||||
|
|
||||
|
getDataPage(pageNo, pageSize) { |
||||
|
//计算总页数 |
||||
|
var totalPages = Math.ceil(this.allCount / pageSize); |
||||
|
//当前页起始索引 |
||||
|
const start = (pageNo - 1) * pageSize; |
||||
|
const end = start + pageSize; //当前页结束索引 |
||||
|
return this.allDetails.slice(start, end) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
swipeClick(e, item) { |
||||
|
if (e.content.text == "详情") { |
||||
|
this.detail(item) |
||||
|
} else if (e.content.text == "编辑") { |
||||
|
this.editItem(item) |
||||
|
} else if (e.content.text == "移除") { |
||||
|
this.remove(item) |
||||
|
} |
||||
|
}, |
||||
|
detail(item) { |
||||
|
this.showItem = item; |
||||
|
this.$refs.detailInfoPopup.openPopup(item); |
||||
|
}, |
||||
|
|
||||
|
remove(item, index) { |
||||
|
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
item.scaned = false; |
||||
|
item.handleQty = 0; |
||||
|
this.showList.splice(index, 1) |
||||
|
this.$emit('removePack') |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
updateData() {}, |
||||
|
|
||||
|
openScanPopup() { |
||||
|
var fromlocationList = []; |
||||
|
fromlocationList.push(this.fromLocationCode) |
||||
|
this.$refs.scanPopup.openScanPopupForJob(this.fromLocationCode, fromlocationList, this.jobContent); |
||||
|
}, |
||||
|
|
||||
|
closeScanPopup() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.closeScanPopup(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupGetFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.packGetFocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
scanPopupLoseFocus() { |
||||
|
if (this.$refs.scanPopup != undefined) { |
||||
|
this.$refs.scanPopup.packLoseFocus(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//明盘 |
||||
|
getCountScanResult(result, managementPrecision) { |
||||
|
var itemCode = result.label.itemCode |
||||
|
var packingNumber = result.label.packingNumber |
||||
|
var pack = result.package |
||||
|
var batch = result.label.batch |
||||
|
var inventoryStatus = result.balance ? result.balance.inventoryStatus : "OK" |
||||
|
var qty = result.balance ? result.balance.qty : result.label.qty; |
||||
|
var uom = pack.uom |
||||
|
this.managementType = managementPrecision; |
||||
|
|
||||
|
//按批次管理 |
||||
|
if (this.managementType == 'BY_BATCH') { |
||||
|
//按物料、箱码、批次、状态匹配 |
||||
|
let item = this.allDetails.find(r => |
||||
|
r.itemCode == itemCode && |
||||
|
r.batch == batch && |
||||
|
r.inventoryStatus == inventoryStatus) |
||||
|
|
||||
|
//在任务列表中,添加到对应的recordList |
||||
|
if (item) { |
||||
|
if (!item.recordList) { |
||||
|
item.recordList = [] |
||||
|
} |
||||
|
var recordItem = { |
||||
|
itemCode: itemCode, |
||||
|
packingNumber: packingNumber, |
||||
|
batch: batch, |
||||
|
inventoryStatus: inventoryStatus, |
||||
|
qty: qty, |
||||
|
handleQty:qty, |
||||
|
uom: uom, |
||||
|
packUnit:pack.packUnit, |
||||
|
packQty:pack.packQty, |
||||
|
balanceQty:qty, |
||||
|
countQty:qty, |
||||
|
fromLocationCode:result.fromLocationCode |
||||
|
} |
||||
|
item.countTime = new Date(); |
||||
|
item.recordList.unshift(recordItem) |
||||
|
item.currentQty=item.recordList.length |
||||
|
this.$refs.countQtyEdit.openEditPopupShowSeconds(recordItem, |
||||
|
null); |
||||
|
this.updateList(); |
||||
|
} else { |
||||
|
//不在任务列表中,添加到列表中 |
||||
|
var detail = this.createAddDetailInfo(pack, qty) |
||||
|
detail.countTime = new Date(); |
||||
|
this.allDetails.push(detail) |
||||
|
this.updateList(); |
||||
|
this.$refs.countQtyEdit.openEditPopupShowSeconds(detail, |
||||
|
null); |
||||
|
} |
||||
|
|
||||
|
} else if (this.managementType == 'BY_QUANTITY') { |
||||
|
let item = this.allDetails.find(r => |
||||
|
r.itemCode == itemCode && |
||||
|
r.inventoryStatus == inventoryStatus) |
||||
|
//在任务列表中,添加到对应的recordList |
||||
|
if (item) { |
||||
|
if (!item.recordList) { |
||||
|
item.recordList = [] |
||||
|
} |
||||
|
var recordItem = { |
||||
|
itemCode: itemCode, |
||||
|
packingNumber: packingNumber, |
||||
|
batch: batch, |
||||
|
inventoryStatus: inventoryStatus, |
||||
|
qty: qty, |
||||
|
handleQty:qty, |
||||
|
uom: uom, |
||||
|
packUnit:pack.packUnit, |
||||
|
packQty:pack.packQty, |
||||
|
balanceQty:qty, |
||||
|
countQty:handleQty |
||||
|
} |
||||
|
item.recordList.push(recordItem) |
||||
|
this.updateList(); |
||||
|
this.$refs.countQtyEdit.openEditPopupShowSeconds(recordItem, |
||||
|
null); |
||||
|
|
||||
|
} else { |
||||
|
//不在任务列表中,添加到列表中 |
||||
|
var detail = this.createAddDetailInfo(pack, qty) |
||||
|
detail.countTime = new Date(); |
||||
|
this.allDetails.push(detail) |
||||
|
this.updateList(); |
||||
|
this.$refs.countQtyEdit.openEditPopupShowSeconds(detail, |
||||
|
null); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
// if (items.length == 0) { |
||||
|
// // 按批次 |
||||
|
// if (this.managementType == 'BY_BATCH'){ |
||||
|
// this.$refs.comMessage.showQuestionMessage("批次【" + result.label.batch + |
||||
|
// "】不在任务列表中,是否要添加到列表中?",res => { |
||||
|
// //创建盘点信息,标记为已经扫描 |
||||
|
// if (res) { |
||||
|
// var detail = this.createAddDetailInfo(pack, qty) |
||||
|
// detail.countTime = new Date(); |
||||
|
// this.allDetails.push(detail) |
||||
|
// this.updateList(); |
||||
|
// this.$refs.countQtyEdit.openEditPopupShowSeconds(detail, |
||||
|
// null); |
||||
|
// } else { |
||||
|
// this.scanPopupGetFocus(); |
||||
|
// } |
||||
|
// }) |
||||
|
// }else{ |
||||
|
// this.$refs.comMessage.showQuestionMessage("包装【" + result.label.packingNumber + |
||||
|
// "】不在任务列表中,是否要添加到列表中?",res => { |
||||
|
// //创建盘点信息,标记为已经扫描 |
||||
|
// if (res) { |
||||
|
// var detail = this.createAddDetailInfo(pack, qty) |
||||
|
// detail.countTime = new Date(); |
||||
|
// this.allDetails.push(detail) |
||||
|
// this.updateList(); |
||||
|
// this.$refs.countQtyEdit.openEditPopupShowSeconds(detail, |
||||
|
// null); |
||||
|
// } else { |
||||
|
// this.scanPopupGetFocus(); |
||||
|
// } |
||||
|
// }) |
||||
|
// } |
||||
|
// } else { |
||||
|
// var selectItem = items[0] |
||||
|
// //已经扫描 |
||||
|
// if (selectItem.scaned) { |
||||
|
// // 按批次 |
||||
|
// if (this.managementType == 'BY_BATCH'){ |
||||
|
// this.$refs.comMessage.showQuestionMessage("批次【" + result.label.batch + |
||||
|
// "】已经完成盘点,是否要编辑盘点结果?", |
||||
|
// res => { |
||||
|
// if (res) { |
||||
|
// this.currentEditItem = selectItem; |
||||
|
// this.$refs.countQtyEdit.openEditPopup(selectItem, |
||||
|
// null); |
||||
|
// } else { |
||||
|
// this.scanPopupGetFocus(); |
||||
|
// } |
||||
|
// }) |
||||
|
// }else{ |
||||
|
// this.$refs.comMessage.showQuestionMessage("包装【" + result.label.packingNumber + |
||||
|
// "】已经完成盘点,是否要编辑盘点结果?", |
||||
|
// res => { |
||||
|
// if (res) { |
||||
|
// this.currentEditItem = selectItem; |
||||
|
// this.$refs.countQtyEdit.openEditPopup(selectItem, |
||||
|
// null); |
||||
|
// } else { |
||||
|
// this.scanPopupGetFocus(); |
||||
|
// } |
||||
|
// }) |
||||
|
// } |
||||
|
|
||||
|
|
||||
|
// } else { |
||||
|
// //未扫描,赋值 |
||||
|
// selectItem.scaned = true; |
||||
|
// selectItem.balanceQty = Number(qty) |
||||
|
// selectItem.handleQty = Number(qty) |
||||
|
// selectItem.packQty = pack.packQty |
||||
|
// selectItem.packUnit = pack.packUnit |
||||
|
// selectItem.parentPackingNumber = pack.parentPackingNumber |
||||
|
// selectItem.locationCode = this.fromLocationCode |
||||
|
// selectItem.fromLocationCode = this.fromLocationCode |
||||
|
|
||||
|
// this.$refs.countQtyEdit.openEditPopupShowSeconds(selectItem, |
||||
|
// null); |
||||
|
// selectItem.countTime = new Date(); |
||||
|
// this.updateList(); |
||||
|
// } |
||||
|
// } |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
editConfirm(qty, inventoryStatus, mode) { |
||||
|
let that = this; |
||||
|
//编辑 |
||||
|
if (mode == 'edit') { |
||||
|
this.currentEditItem.handleQty = qty; |
||||
|
this.currentEditItem.inventoryStatus = inventoryStatus; |
||||
|
} |
||||
|
//重新排序 |
||||
|
this.currentEditItem.countTime = new Date(); |
||||
|
this.updateList(); |
||||
|
this.scanPopupGetFocus(); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
updateList() { |
||||
|
this.allDetails.sort(compare('countTime')); //按扫描信息排序 |
||||
|
this.initList() |
||||
|
this.scanPopupLoseFocus() |
||||
|
this.calcAllCount() |
||||
|
this.calcScanCount() |
||||
|
this.calcQtyAndUpdateSatus() |
||||
|
this.sortList(); |
||||
|
}, |
||||
|
calcQtyAndUpdateSatus(){ |
||||
|
this.allDetails.forEach(item=>{ |
||||
|
if(Number(item.currentQty)==0&&Number(Number(item.pandianQty)< Number(item.kucunQty))){ |
||||
|
item.countStatus="wait" |
||||
|
} |
||||
|
|
||||
|
if(Number(item.currentQty)>0){ |
||||
|
item.countStatus="doing" |
||||
|
} |
||||
|
|
||||
|
if(Number(item.currentQty)>=Number(item.kucunQty)){ |
||||
|
item.countStatus="finish" |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
sortList(){ |
||||
|
const statusOrder = { |
||||
|
'wait': 1, |
||||
|
'doing': 2, |
||||
|
'finish': 3 |
||||
|
}; |
||||
|
|
||||
|
this.allDetails.sort((a, b) => { |
||||
|
return statusOrder[a.countStatus] - statusOrder[b.countStatus]; |
||||
|
}); |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
calcAllCount() { |
||||
|
this.allCount = this.allDetails.length; |
||||
|
}, |
||||
|
|
||||
|
calcScanCount() { |
||||
|
this.scanCount = this.allDetails.filter(r => r.scaned === true).length; |
||||
|
}, |
||||
|
|
||||
|
editClose() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
//创建盘盈的明细 |
||||
|
createAddDetailInfo(pack, qty) { |
||||
|
var detail = { |
||||
|
masterId: this.jobContent.id, //新增的明细 |
||||
|
scaned: true, |
||||
|
countDetailNumber: "", |
||||
|
ownerCode: "", |
||||
|
packingNumber: pack.number, |
||||
|
containerNumber: "", |
||||
|
batch: pack.batch, |
||||
|
inventoryStatus: "OK", |
||||
|
itemCode: pack.itemCode, |
||||
|
itemName: pack.itemName, |
||||
|
itemDesc1: pack.itemDesc1, |
||||
|
itemDesc2: pack.itemDesc2, |
||||
|
packQty: pack.packQty, |
||||
|
packUnit: pack.packUnit, |
||||
|
projectCode: "", |
||||
|
recommendQty: Number(qty), |
||||
|
qty: Number(qty), |
||||
|
handleQty: Number(qty), |
||||
|
uom: pack.uom, |
||||
|
number: pack.number, |
||||
|
remark: "", |
||||
|
countQty: Number(qty), |
||||
|
balanceQty: Number(qty), |
||||
|
fromLocationCode: this.fromLocationCode, |
||||
|
locationCode: this.fromLocationCode, |
||||
|
creator: this.$store.state.user.id, |
||||
|
countTime: new Date() |
||||
|
} |
||||
|
return detail; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
|
||||
|
commit() { |
||||
|
this.calcAllCount() |
||||
|
this.calcScanCount() |
||||
|
// if(!this.scanCount){ |
||||
|
// this.$refs.comMessage.showErrorMessage('请先进行扫描,再进行提交'); |
||||
|
// return |
||||
|
// } |
||||
|
if (this.scanCount == this.allCount) { |
||||
|
this.submitJob(); |
||||
|
} else if (this.scanCount < this.allCount) { |
||||
|
//扫描数量小于任务数量,判断是否允许部分提交 |
||||
|
if (this.jobContent.allowPartialComplete == "TRUE") { |
||||
|
//提交 |
||||
|
this.$refs.comMessage.showQuestionMessage("已经扫描[" + this.scanCount + |
||||
|
"]总共[" + |
||||
|
this.allCount + "],是否把未扫描的盘点数量设置为0?", |
||||
|
res => { |
||||
|
if (res) { |
||||
|
this.allDetails.forEach(item => { |
||||
|
if (!item.scaned) { |
||||
|
item.scaned = true; |
||||
|
item.handleQty = 0 |
||||
|
item.locationCode = this.fromLocationCode |
||||
|
item.fromLocationCode = this.fromLocationCode |
||||
|
} |
||||
|
}) |
||||
|
this.submitJob(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} else { |
||||
|
//不允许部分提交,提示 |
||||
|
this.$refs.comMessage.showErrorMessage('请完成扫描后,再进行提交\n' + "已经扫描[" + this.scanCount + |
||||
|
"]总共[" + this |
||||
|
.getTotalCount() + "]", res => { |
||||
|
if (res) { |
||||
|
this.openScanPopup(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
submitJob() { |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
//获取管理模式,封装参数 |
||||
|
var itemCodes = [] |
||||
|
this.allDetails.forEach(item => { |
||||
|
itemCodes.push(item.itemCode) |
||||
|
// item.scaned = false |
||||
|
}) |
||||
|
getManagementPrecisions(itemCodes, this.fromLocationCode, res => { |
||||
|
if (res.success) { |
||||
|
this.managementList = res.list; |
||||
|
var params = this.setParams() |
||||
|
console.log("提交参数", params); |
||||
|
countJobSubmit(params).then(res => { |
||||
|
uni.hideLoading() |
||||
|
const str = res.data || '' |
||||
|
this.showCommitSuccessMessage("提交成功\n生成盘点记录\n" + str) |
||||
|
// if (res.data) { |
||||
|
// this.showCommitSuccessMessage("提交成功\n生成盘点记录\n" + res.data) |
||||
|
// } else { |
||||
|
// this.showErrorMessage("提交失败[" + res.msg + "]") |
||||
|
// } |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading() |
||||
|
this.showErrorMessage(error) |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
setParams() { |
||||
|
var subList = [] |
||||
|
var creator = this.$store.state.user.id |
||||
|
console.log(this.allDetails) |
||||
|
this.allDetails.forEach(item => { |
||||
|
if (item.scaned) { |
||||
|
item.countQty = item.handleQty; |
||||
|
var info = getPackingNumberAndBatch(this.managementList, item.itemCode, |
||||
|
item.packingNumber, item.batch); |
||||
|
item.toPackingNumber = info.packingNumber; |
||||
|
item.packingNumber = info.packingNumber; |
||||
|
item.fromPackingNumber = info.packingNumber; |
||||
|
|
||||
|
} |
||||
|
subList.push(item) |
||||
|
}) |
||||
|
|
||||
|
this.jobContent.subList = subList |
||||
|
this.jobContent.creator = creator; |
||||
|
return this.jobContent; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
showMessage(message) { |
||||
|
this.$refs.comMessage.showMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
showErrorMessage(message) { |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
this.afterCloseMessage() |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
showScanMessage(message) { |
||||
|
this.$refs.comMessage.showScanMessage(message); |
||||
|
}, |
||||
|
|
||||
|
afterCloseMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
closeScanMessage() { |
||||
|
this.scanPopupGetFocus(); |
||||
|
}, |
||||
|
|
||||
|
editItem(item) { |
||||
|
this.currentEditItem = item; |
||||
|
this.$refs.countQtyEdit.openEditPopup(this.currentEditItem, |
||||
|
null); |
||||
|
}, |
||||
|
|
||||
|
showCommitSuccessMessage(hint) { |
||||
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
||||
|
navigateBack(1); |
||||
|
}) |
||||
|
}, |
||||
|
getCountStageName(value) { |
||||
|
return getCountStageName(value) |
||||
|
}, |
||||
|
isOpenCount(value) { |
||||
|
return value == "TRUE" ? "明盘" : "盲盘" |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
page { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
|
||||
|
.page-wraper { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
.header { |
||||
|
position: fixed; |
||||
|
/* #ifdef H5 */ |
||||
|
top: 88rpx; |
||||
|
/* #endif */ |
||||
|
left: 0; |
||||
|
width: 100%; |
||||
|
background-color: #fff; |
||||
|
z-index: 10; |
||||
|
padding: 10rpx; |
||||
|
/* 确保头部在内容之上 */ |
||||
|
} |
||||
|
|
||||
|
.page-footer { |
||||
|
position: fixed; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
.page-main-list { |
||||
|
/* height: 80rpx; |
||||
|
line-height: 80rpx; */ |
||||
|
text-align: center; |
||||
|
background: #e0e0e0; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.item { |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
|
||||
|
.item_scaned { |
||||
|
background-color: antiquewhite; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,164 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class="page-wraper" v-if="dataList.length>0"> |
||||
|
<view class="page-main"> |
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list"> |
||||
|
<comCountRecordCard :dataContent="dataContent" :recordList="dataList" @removeData="removeData" |
||||
|
:isShowStatus="true" @updateData="updateData" @removePack='removePack' :allowEditQty="true" |
||||
|
:allowEditStatus="true"> |
||||
|
</comCountRecordCard> |
||||
|
</view> |
||||
|
</scroll-view> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
|
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import comCountRecordCard from '@/pages/count/coms/comCountRecordCard.vue' |
||||
|
|
||||
|
import { |
||||
|
inventoryMoveRecordSubmit, |
||||
|
getBasicLocationByCode, |
||||
|
getBasicItemByCode |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
getDirectoryItemArray, |
||||
|
getItemTypeName, |
||||
|
getInventoryStatusName, |
||||
|
getInventoryStatusDesc |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getPrecisionStrategyList |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import { |
||||
|
getPackingNumberAndBatchByList, |
||||
|
deepCopyData, |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
createItemInfo, |
||||
|
createDetailInfo, |
||||
|
calcHandleQty, |
||||
|
createItemInfoForLabel, |
||||
|
createDetailInfoForLabel |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
comCountRecordCard, |
||||
|
}, |
||||
|
props: {}, |
||||
|
onLoad(options) { |
||||
|
if (options.data) { |
||||
|
this.dataList = JSON.parse(decodeURIComponent(options.data)); |
||||
|
this.fromLocationCode = this.dataList[0].fromLocationCode |
||||
|
this.dataContent.itemName = this.dataList[0].itemName; |
||||
|
this.dataContent.itemDesc1=this.dataList[0].itemDesc1; |
||||
|
this.dataContent.itemCode = this.dataList[0].itemCode; |
||||
|
this.dataContent.uom =this.dataList[0].uom; |
||||
|
var handleQty = 0; |
||||
|
this.dataList.forEach(item => { |
||||
|
handleQty = calc.add(Number(handleQty), Number(item.handleQty)) |
||||
|
}) |
||||
|
this.dataContent.qty=handleQty; |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
//拦截返回按钮事件 |
||||
|
onBackPress(e) { |
||||
|
//已经接收但是没提交任务 |
||||
|
if (e.from === 'backbutton') { |
||||
|
uni.$emit('refreshData',this.dataList); |
||||
|
uni.navigateBack(); |
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
fromLocationCode: "", |
||||
|
toInventoryStatus: "", |
||||
|
businessType: {}, //业务类型 |
||||
|
dataContent: {}, |
||||
|
businessTypeCode: "Count", |
||||
|
dataList: [], |
||||
|
managementType: {} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
mounted() { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
|
||||
|
methods: { |
||||
|
|
||||
|
|
||||
|
showErrorMessage(message) { |
||||
|
if (this.$refs.scanPopup) { |
||||
|
this.$refs.scanPopup.packLoseFocus() |
||||
|
} |
||||
|
this.$refs.comMessage.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
if (this.$refs.scanPopup) { |
||||
|
this.$refs.scanPopup.packGetFocus() |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
updateData() { |
||||
|
calcHandleQty(this.dataList); |
||||
|
for (var i = 0; i < this.dataList.length; i++) { |
||||
|
let item = this.dataList[i]; |
||||
|
if (item.qty == 0) { |
||||
|
this.dataList.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
removePack() { |
||||
|
// for (var i = 0; i < this.dataList.length; i++) { |
||||
|
// var item = this.dataList[i]; |
||||
|
// if (item.subList.length == 0) { |
||||
|
// this.dataList.splice(i, 1) |
||||
|
// } |
||||
|
// } |
||||
|
// this.updateData(); |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
removeData(item) { |
||||
|
for (let i = 0; i < this.dataList.length; i++) { |
||||
|
if (this.dataList[i].itemCode == item.itemCode) { |
||||
|
this.dataList.splice(i, 1) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
clearData() { |
||||
|
this.fromLocationCode = ''; |
||||
|
this.subList = []; |
||||
|
this.dataList = []; |
||||
|
this.dataContent = {} |
||||
|
this.toWarehouseCode = "" |
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
Loading…
Reference in new issue