zhang_li
3 months ago
10 changed files with 1164 additions and 1145 deletions
@ -1,383 +1,355 @@ |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class=""> |
|||
<com-blank-view @goScan='showContainerPopup' v-if="containerCode==''"></com-blank-view> |
|||
</view> |
|||
|
|||
<view class="page-wraper" v-if="containerCode!=''"> |
|||
<view class="" style="margin-left: 20rpx;"> |
|||
<targetContainer ref="targetContainer" title="托盘" :containerCode="containerCode" :isShowEdit="false" |
|||
@getContainer="getContainer"></targetContainer> |
|||
</view> |
|||
<view class='split_line'></view> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class=""> |
|||
<!-- {{item.contentNumber}} --> |
|||
<comPalletRecord :dataContent="item" :index="index" |
|||
:isShowPatch="false" @removeItem="removeItem(index,item)" @updateData="updateData" |
|||
@removePack="removePack"> |
|||
</comPalletRecord> |
|||
|
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" |
|||
style="background-color:ghostwhite; width: 100%; "> |
|||
<view class=""> |
|||
</view> |
|||
<view class=" uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|||
</view> |
|||
<win-scan-pack ref="scanPopup" @getResult='getScanResult'></win-scan-pack> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
<winScanContainer ref="scanContainer" title="托盘" @getContainer='getContainer'></winScanContainer> |
|||
</view> |
|||
<view class="page-wraper"> |
|||
<view class=""> |
|||
<com-blank-view @goScan="showContainerPopup" v-if="containerCode == ''"></com-blank-view> |
|||
</view> |
|||
|
|||
<view class="page-wraper" v-if="containerCode != ''"> |
|||
<view class="" style="margin-left: 20rpx"> |
|||
<targetContainer ref="targetContainer" title="托盘" :containerCode="containerCode" :isShowEdit="false" @getContainer="getContainer"></targetContainer> |
|||
</view> |
|||
<view class="split_line"></view> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class=""> |
|||
<!-- {{item.contentNumber}} --> |
|||
<comPalletRecord :dataContent="item" :index="index" :isShowPatch="false" @removeItem="removeItem(index, item)" @updateData="updateData" @removePack="removePack"> </comPalletRecord> |
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" style="background-color: ghostwhite; width: 100%"> |
|||
<view class=""> </view> |
|||
<view class="uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<win-scan-button @goScan="openScanPopup"></win-scan-button> |
|||
</view> |
|||
<win-scan-pack ref="scanPopup" @getResult="getScanResult"></win-scan-pack> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
<winScanContainer ref="scanContainer" title="托盘" @getContainer="getContainer"></winScanContainer> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
containerUnBindRecordSubmit, |
|||
getContainerDetailByNumber |
|||
} from '@/api/request2.js'; |
|||
import { |
|||
goHome |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
calc |
|||
} from '@/common/calc.js'; |
|||
|
|||
import { |
|||
getDirectoryItemArray |
|||
} from '@/common/directory.js'; |
|||
|
|||
import { |
|||
createItemInfo, |
|||
createDetailInfo, |
|||
calcHandleQty |
|||
} from '@/common/record.js'; |
|||
|
|||
import { |
|||
getScanCount |
|||
} from '@/common/detail.js'; |
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|||
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|||
import targetContainer from "@/mycomponents/container/targetContainer.vue" |
|||
import winScanContainer from "@/mycomponents/scan/winScanContainer.vue" |
|||
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|||
import comPalletRecord from '@/pages/container/coms/comPalletRecord.vue' |
|||
|
|||
export default { |
|||
components: { |
|||
winScanButton, |
|||
winScanPack, |
|||
comBlankView, |
|||
targetContainer, |
|||
recordComDetailCard, |
|||
winScanContainer, |
|||
comPalletRecord |
|||
}, |
|||
data() { |
|||
return { |
|||
id: '', |
|||
scanCount: 0, |
|||
detailSource: [], //绑定在页面上的数据源 |
|||
businessTypeInfo: {}, |
|||
fromLocationInfo: {}, |
|||
containerCode: "", |
|||
}; |
|||
}, |
|||
onLoad(option) { |
|||
|
|||
}, |
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} |
|||
}, |
|||
//拦截返回按钮事件 |
|||
onBackPress(e) {}, |
|||
|
|||
onPullDownRefresh() {}, |
|||
|
|||
mounted() { |
|||
this.showContainerPopup(); |
|||
}, |
|||
methods: { |
|||
getScanResult(result) { |
|||
try { |
|||
var packingNumber = result.label.packingNumber; |
|||
var batch = result.label.batch; |
|||
var qty = result.label.qty; |
|||
var itemCode = result.label.itemCode; |
|||
var detail = this.detailSource.find(r => r.itemCode == itemCode); |
|||
if (detail == undefined) { |
|||
this.showMessage("物料号【" + itemCode + "】不在列表中") |
|||
} else { |
|||
var itemDetail = detail.subList.find(r => r.packingNumber == packingNumber && r.batch == batch); |
|||
if (itemDetail == undefined) { |
|||
this.showMessage("箱码【" + packingNumber + "】,批次【" + batch + "】不在列表中") |
|||
} else { |
|||
if (itemDetail.scaned) { |
|||
this.showMessage("箱码【" + packingNumber + "】,批次【" + batch + "】已经扫描") |
|||
} else { |
|||
itemDetail.scaned = true; |
|||
itemDetail.record = this.createRecordInfo(itemDetail, result.label); |
|||
// this.calcHandleQty(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
} catch (e) { |
|||
this.showErrorMessage(e.message) |
|||
} |
|||
}, |
|||
|
|||
createRecordInfo(detail, label) { |
|||
var record = {} |
|||
detail.scaned = true; |
|||
// let record = JSON.parse(JSON.stringify(detail)); |
|||
//克隆对象,深度克隆,防止双向绑定同一个变量 |
|||
Object.assign(record, detail) |
|||
record.qty = Number(label.qty); |
|||
return record; |
|||
}, |
|||
|
|||
calcHandleQty() { |
|||
calcHandleQty(this.detailSource); |
|||
this.scanPopupGetFocus(); |
|||
this.$forceUpdate(); |
|||
}, |
|||
|
|||
getDataSource(subList) { |
|||
let items = []; |
|||
subList.forEach(detail => { |
|||
var item = items.find(r => |
|||
r.itemCode == detail.itemCode) |
|||
if (item == undefined) { |
|||
item = this.createItemInfo(detail); |
|||
let newDetail = this.createDetailInfo(detail); // |
|||
item.subList.push(newDetail); |
|||
items.push(item) |
|||
} else { |
|||
item.qty = calc.add(item.qty,detail.qty) |
|||
let newDetail = this.createDetailInfo(detail); // |
|||
item.subList.push(newDetail); |
|||
} |
|||
}) |
|||
return items; |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty(); |
|||
}, |
|||
|
|||
removeItem(index, item) { |
|||
this.detailSource.splice(index, 1) |
|||
}, |
|||
|
|||
createItemInfo(res) { |
|||
let item = { |
|||
itemCode: res.itemCode, |
|||
itemName: res.itemName, |
|||
packQty: res.packQty, |
|||
packUnit: res.packUnit, |
|||
qty: res.qty, |
|||
handleQty: 0, |
|||
uom: res.uom, |
|||
subList: [] |
|||
} |
|||
return item; |
|||
}, |
|||
|
|||
createDetailInfo(data) { |
|||
data.scaned = false; |
|||
data.packingNumber = data.contentNumber |
|||
data.qty = Number(data.qty) |
|||
data.handleQty =0; |
|||
let detail = data; |
|||
return detail; |
|||
}, |
|||
|
|||
removePack() { |
|||
for (var i = 0; i < this.detailSource.length; i++) { |
|||
var item = this.detailSource[i]; |
|||
if (item.subList.length == 0) { |
|||
this.detailSource.splice(i, 1) |
|||
} |
|||
} |
|||
this.updateData(); |
|||
}, |
|||
|
|||
openScanPopup() { |
|||
if (this.containerCode == "") { |
|||
this.showContainerPopup(); |
|||
return |
|||
} |
|||
this.$refs.scanPopup.openScanPopup(); |
|||
}, |
|||
showContainerPopup() { |
|||
this.$nextTick(() => { |
|||
this.$refs.scanContainer.openScanPopup(); |
|||
}) |
|||
|
|||
}, |
|||
closeScanPopup() { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
}, |
|||
|
|||
scanPopupGetFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.getfocus(); |
|||
} |
|||
}, |
|||
|
|||
scanPopupLoseFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.losefocus(); |
|||
} |
|||
}, |
|||
|
|||
commit() { |
|||
uni.showLoading({ |
|||
title: '提交中...', |
|||
mask: true |
|||
}) |
|||
|
|||
this.scanCount = getScanCount(this.detailSource[0].subList); |
|||
if (this.scanCount == 0) { |
|||
this.showErrorMessage("扫描数为0,请先扫描要解绑的箱码") |
|||
return; |
|||
} |
|||
|
|||
let params = this.getParams(); |
|||
console.log("提交" + JSON.stringify(params)) |
|||
|
|||
containerUnBindRecordSubmit(params).then(res => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
this.showCommitSuccessMessage("提交成功<br>生成器具绑定记录<br>" + res.data) |
|||
this.clear(); |
|||
} else { |
|||
this.showErrorMessage("提交失败[" + res.msg + "]") |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
getParams() { |
|||
var subList = [] |
|||
var creator = this.$store.state.user.id |
|||
let params = { |
|||
number: this.containerCode, |
|||
type: 'bind', |
|||
status: 'USED', |
|||
creator: creator |
|||
}; |
|||
|
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
if (detail.scaned) { |
|||
detail.containerContentType = 'PACKAGE'; |
|||
detail.contentNumber = detail.packingNumber; |
|||
|
|||
detail.itemCode = detail.itemCode; |
|||
detail.batch = detail.batch; |
|||
detail.inventoryStatus = detail.inventoryStatus; |
|||
detail.qty =detail.handleQty; |
|||
detail.package = null; |
|||
subList.push(detail) |
|||
} |
|||
}) |
|||
}) |
|||
params.subList = subList |
|||
return params; |
|||
}, |
|||
|
|||
|
|||
showMessage(message) { |
|||
setTimeout(r => { |
|||
this.scanPopupLoseFocus(); |
|||
this.$refs.comMessage.showMessage(message, res => { |
|||
if (res) { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
|
|||
showErrorMessage(message) { |
|||
setTimeout(r => { |
|||
this.scanPopupLoseFocus(); |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
this.scanPopupGetFocus(); |
|||
} |
|||
}); |
|||
}) |
|||
}, |
|||
|
|||
showScanMessage(message) { |
|||
this.$refs.comMessage.showScanMessage(message); |
|||
}, |
|||
|
|||
afterCloseMessage() { |
|||
this.scanPopupGetFocus(); |
|||
}, |
|||
|
|||
closeScanMessage() { |
|||
this.scanPopupGetFocus(); |
|||
}, |
|||
|
|||
getContainer(containerInfo) { |
|||
this.containerCode = containerInfo.number; |
|||
getContainerDetailByNumber(this.containerCode).then(res => { |
|||
if (res.data != null && res.data.subList.length > 0) { |
|||
this.detailSource = this.getDataSource(res.data.subList) |
|||
} |
|||
}).catch(error => { |
|||
this.showErrorMessage(error.message) |
|||
}) |
|||
}, |
|||
|
|||
showCommitSuccessMessage(hint) { |
|||
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|||
this.containerCode = ''; |
|||
|
|||
}) |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty(); |
|||
for (var i = 0; i < this.detailSource.length; i++) { |
|||
let item = this.detailSource[i]; |
|||
if (item.qty == 0) { |
|||
this.detailSource.splice(i, 1) |
|||
} |
|||
} |
|||
}, |
|||
clear() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
import { containerUnBindRecordSubmit, getContainerDetailByNumber } from '@/api/request2.js' |
|||
import { goHome } from '@/common/basic.js' |
|||
|
|||
import { calc } from '@/common/calc.js' |
|||
|
|||
import { getDirectoryItemArray } from '@/common/directory.js' |
|||
|
|||
import { createItemInfo, createDetailInfo, calcHandleQty } from '@/common/record.js' |
|||
|
|||
import { getScanCount } from '@/common/detail.js' |
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|||
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|||
import targetContainer from '@/mycomponents/container/targetContainer.vue' |
|||
import winScanContainer from '@/mycomponents/scan/winScanContainer.vue' |
|||
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|||
import comPalletRecord from '@/pages/container/coms/comPalletRecord.vue' |
|||
|
|||
export default { |
|||
components: { |
|||
winScanButton, |
|||
winScanPack, |
|||
comBlankView, |
|||
targetContainer, |
|||
recordComDetailCard, |
|||
winScanContainer, |
|||
comPalletRecord |
|||
}, |
|||
data() { |
|||
return { |
|||
id: '', |
|||
scanCount: 0, |
|||
detailSource: [], // 绑定在页面上的数据源 |
|||
businessTypeInfo: {}, |
|||
fromLocationInfo: {}, |
|||
containerCode: '' |
|||
} |
|||
}, |
|||
onLoad(option) { |
|||
uni.setNavigationBarTitle({ |
|||
title: option.title |
|||
}) |
|||
}, |
|||
// 返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome() |
|||
} |
|||
}, |
|||
// 拦截返回按钮事件 |
|||
onBackPress(e) {}, |
|||
|
|||
onPullDownRefresh() {}, |
|||
|
|||
mounted() { |
|||
this.showContainerPopup() |
|||
}, |
|||
methods: { |
|||
getScanResult(result) { |
|||
try { |
|||
const { packingNumber } = result.label |
|||
const { batch } = result.label |
|||
const { qty } = result.label |
|||
const { itemCode } = result.label |
|||
const detail = this.detailSource.find((r) => r.itemCode == itemCode) |
|||
if (detail == undefined) { |
|||
this.showMessage(`物料号【${itemCode}】不在列表中`) |
|||
} else { |
|||
const itemDetail = detail.subList.find((r) => r.packingNumber == packingNumber && r.batch == batch) |
|||
if (itemDetail == undefined) { |
|||
this.showMessage(`箱码【${packingNumber}】,批次【${batch}】不在列表中`) |
|||
} else if (itemDetail.scaned) { |
|||
this.showMessage(`箱码【${packingNumber}】,批次【${batch}】已经扫描`) |
|||
} else { |
|||
itemDetail.scaned = true |
|||
itemDetail.record = this.createRecordInfo(itemDetail, result.label) |
|||
// this.calcHandleQty(); |
|||
} |
|||
} |
|||
} catch (e) { |
|||
this.showErrorMessage(e.message) |
|||
} |
|||
}, |
|||
|
|||
createRecordInfo(detail, label) { |
|||
const record = {} |
|||
detail.scaned = true |
|||
// let record = JSON.parse(JSON.stringify(detail)); |
|||
// 克隆对象,深度克隆,防止双向绑定同一个变量 |
|||
Object.assign(record, detail) |
|||
record.qty = Number(label.qty) |
|||
return record |
|||
}, |
|||
|
|||
calcHandleQty() { |
|||
calcHandleQty(this.detailSource) |
|||
this.scanPopupGetFocus() |
|||
this.$forceUpdate() |
|||
}, |
|||
|
|||
getDataSource(subList) { |
|||
const items = [] |
|||
subList.forEach((detail) => { |
|||
let item = items.find((r) => r.itemCode == detail.itemCode) |
|||
if (item == undefined) { |
|||
item = this.createItemInfo(detail) |
|||
const newDetail = this.createDetailInfo(detail) // |
|||
item.subList.push(newDetail) |
|||
items.push(item) |
|||
} else { |
|||
item.qty = calc.add(item.qty, detail.qty) |
|||
const newDetail = this.createDetailInfo(detail) // |
|||
item.subList.push(newDetail) |
|||
} |
|||
}) |
|||
return items |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty() |
|||
}, |
|||
|
|||
removeItem(index, item) { |
|||
this.detailSource.splice(index, 1) |
|||
}, |
|||
|
|||
createItemInfo(res) { |
|||
const item = { |
|||
itemCode: res.itemCode, |
|||
itemName: res.itemName, |
|||
packQty: res.packQty, |
|||
packUnit: res.packUnit, |
|||
qty: res.qty, |
|||
handleQty: 0, |
|||
uom: res.uom, |
|||
subList: [] |
|||
} |
|||
return item |
|||
}, |
|||
|
|||
createDetailInfo(data) { |
|||
data.scaned = false |
|||
data.packingNumber = data.contentNumber |
|||
data.qty = Number(data.qty) |
|||
data.handleQty = 0 |
|||
const detail = data |
|||
return detail |
|||
}, |
|||
|
|||
removePack() { |
|||
for (let i = 0; i < this.detailSource.length; i++) { |
|||
const item = this.detailSource[i] |
|||
if (item.subList.length == 0) { |
|||
this.detailSource.splice(i, 1) |
|||
} |
|||
} |
|||
this.updateData() |
|||
}, |
|||
|
|||
openScanPopup() { |
|||
if (this.containerCode == '') { |
|||
this.showContainerPopup() |
|||
return |
|||
} |
|||
this.$refs.scanPopup.openScanPopup() |
|||
}, |
|||
showContainerPopup() { |
|||
this.$nextTick(() => { |
|||
this.$refs.scanContainer.openScanPopup() |
|||
}) |
|||
}, |
|||
closeScanPopup() { |
|||
this.$refs.scanPopup.closeScanPopup() |
|||
}, |
|||
|
|||
scanPopupGetFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.getfocus() |
|||
} |
|||
}, |
|||
|
|||
scanPopupLoseFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.losefocus() |
|||
} |
|||
}, |
|||
|
|||
commit() { |
|||
uni.showLoading({ |
|||
title: '提交中...', |
|||
mask: true |
|||
}) |
|||
|
|||
this.scanCount = getScanCount(this.detailSource[0].subList) |
|||
if (this.scanCount == 0) { |
|||
this.showErrorMessage('扫描数为0,请先扫描要解绑的箱码') |
|||
return |
|||
} |
|||
|
|||
const params = this.getParams() |
|||
console.log(`提交${JSON.stringify(params)}`) |
|||
|
|||
containerUnBindRecordSubmit(params) |
|||
.then((res) => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
this.showCommitSuccessMessage(`提交成功<br>生成器具绑定记录<br>${res.data}`) |
|||
this.clear() |
|||
} else { |
|||
this.showErrorMessage(`提交失败[${res.msg}]`) |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
}, |
|||
|
|||
getParams() { |
|||
const subList = [] |
|||
const creator = this.$store.state.user.id |
|||
const params = { |
|||
number: this.containerCode, |
|||
type: 'bind', |
|||
status: 'USED', |
|||
creator |
|||
} |
|||
|
|||
this.detailSource.forEach((item) => { |
|||
item.subList.forEach((detail) => { |
|||
if (detail.scaned) { |
|||
detail.containerContentType = 'PACKAGE' |
|||
detail.contentNumber = detail.packingNumber |
|||
|
|||
detail.itemCode = detail.itemCode |
|||
detail.batch = detail.batch |
|||
detail.inventoryStatus = detail.inventoryStatus |
|||
detail.qty = detail.handleQty |
|||
detail.package = null |
|||
subList.push(detail) |
|||
} |
|||
}) |
|||
}) |
|||
params.subList = subList |
|||
return params |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
setTimeout((r) => { |
|||
this.scanPopupLoseFocus() |
|||
this.$refs.comMessage.showMessage(message, (res) => { |
|||
if (res) { |
|||
this.scanPopupGetFocus() |
|||
} |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
showErrorMessage(message) { |
|||
setTimeout((r) => { |
|||
this.scanPopupLoseFocus() |
|||
this.$refs.comMessage.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
this.scanPopupGetFocus() |
|||
} |
|||
}) |
|||
}) |
|||
}, |
|||
|
|||
showScanMessage(message) { |
|||
this.$refs.comMessage.showScanMessage(message) |
|||
}, |
|||
|
|||
afterCloseMessage() { |
|||
this.scanPopupGetFocus() |
|||
}, |
|||
|
|||
closeScanMessage() { |
|||
this.scanPopupGetFocus() |
|||
}, |
|||
|
|||
getContainer(containerInfo) { |
|||
this.containerCode = containerInfo.number |
|||
getContainerDetailByNumber(this.containerCode) |
|||
.then((res) => { |
|||
if (res.data != null && res.data.subList.length > 0) { |
|||
this.detailSource = this.getDataSource(res.data.subList) |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
this.showErrorMessage(error.message) |
|||
}) |
|||
}, |
|||
|
|||
showCommitSuccessMessage(hint) { |
|||
this.$refs.comMessage.showSuccessMessage(hint, (res) => { |
|||
this.containerCode = '' |
|||
}) |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty() |
|||
for (let i = 0; i < this.detailSource.length; i++) { |
|||
const item = this.detailSource[i] |
|||
if (item.qty == 0) { |
|||
this.detailSource.splice(i, 1) |
|||
} |
|||
} |
|||
}, |
|||
clear() {} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
|
|||
</style> |
|||
<style scoped lang="scss"></style> |
|||
|
@ -1,5 +1,14 @@ |
|||
<template></template> |
|||
<template> |
|||
<view class=""> |
|||
<com-blank-view @goScan="openFg" v-if="detailSource.length == 0"></com-blank-view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script></script> |
|||
<script setup lang="ts"> |
|||
import { ref, onMounted, nextTick, watch, getCurrentInstance } from 'vue' |
|||
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|||
|
|||
const detailSource = ref([]) |
|||
</script> |
|||
|
|||
<style></style> |
|||
|
@ -1,390 +1,361 @@ |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class=""> |
|||
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view> |
|||
</view> |
|||
|
|||
<view class="page-wraper" v-if="detailSource.length>0"> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class=""> |
|||
<record-com-detail-card :dataContent="item" :index="index" |
|||
@removeItem="removeItem(index,item)" @updateData="updateData" @removePack="removePack"> |
|||
</record-com-detail-card> |
|||
</view> |
|||
<view class='split_line'></view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" |
|||
style="background-color:ghostwhite; width: 100%; "> |
|||
<view class=""> |
|||
<packageTarget title="目标箱码" :isShowEdit="true" :packingNumber="toPackingNumber" |
|||
@getScanResult='getToPackingNumber'></packageTarget> |
|||
</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> |
|||
</view> |
|||
|
|||
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation="false"> |
|||
</win-scan-pack-and-location> |
|||
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation' |
|||
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
<view class="page-wraper"> |
|||
<view class=""> |
|||
<com-blank-view @goScan="showFromLocationPopup" v-if="detailSource.length == 0"></com-blank-view> |
|||
</view> |
|||
|
|||
<view class="page-wraper" v-if="detailSource.length > 0"> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class=""> |
|||
<record-com-detail-card :dataContent="item" :index="index" @removeItem="removeItem(index, item)" @updateData="updateData" @removePack="removePack"> </record-com-detail-card> |
|||
</view> |
|||
<view class="split_line"></view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" style="background-color: ghostwhite; width: 100%"> |
|||
<view class=""> |
|||
<packageTarget title="目标箱码" :isShowEdit="true" :packingNumber="toPackingNumber" @getScanResult="getToPackingNumber"></packageTarget> |
|||
</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> |
|||
</view> |
|||
|
|||
<win-scan-pack-and-location ref="scanPopup" @getResult="getScanResult" :allowModifyLocation="false"> </win-scan-pack-and-location> |
|||
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
mergePackageRecordSubmit |
|||
} from '@/api/request2.js'; |
|||
import { |
|||
goHome |
|||
} from '@/common/basic.js'; |
|||
|
|||
import { |
|||
getInventoryStatusDesc, |
|||
getDirectoryItemArray |
|||
} from '@/common/directory.js'; |
|||
|
|||
import { |
|||
getBusinessType, |
|||
createItemInfo, |
|||
createDetailInfo, |
|||
calcHandleQty |
|||
} from '@/common/record.js'; |
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|||
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|||
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|||
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
|||
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
|||
import recommendBalance from '@/mycomponents/balance/recommendBalance.vue' |
|||
import packageTarget from '@/mycomponents/package/packageTarget.vue' |
|||
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|||
|
|||
export default { |
|||
components: { |
|||
winScanButton, |
|||
winScanPack, |
|||
requiredLocation, |
|||
comBlankView, |
|||
winScanLocation, |
|||
winScanPackAndLocation, |
|||
recommendBalance, |
|||
packageTarget, |
|||
recordComDetailCard |
|||
}, |
|||
data() { |
|||
return { |
|||
id: '', |
|||
scanCount: 0, |
|||
detailSource: [], //绑定在页面上的数据源 |
|||
fromLocationCode: "", |
|||
isShowLocation: false, |
|||
fromLocationAreaTypeList: [], |
|||
inInventoryStatus: "", //目标入库库存状态 |
|||
outInventoryStatus: "", //来源出库库存状态 |
|||
businessType: {}, |
|||
toPackingNumber: "", |
|||
toBatch:"", |
|||
currentItemCode: "", |
|||
dataContent: {} |
|||
}; |
|||
}, |
|||
onLoad(option) { |
|||
var typeCode = "MergePackage" |
|||
getBusinessType(typeCode, res => { |
|||
if (res.success) { |
|||
this.businessType = res.businessType; |
|||
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; |
|||
this.showFromLocationPopup(); |
|||
} else { |
|||
this.showErrorMessage(res.message) |
|||
} |
|||
}); |
|||
}, |
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} |
|||
}, |
|||
//拦截返回按钮事件 |
|||
onBackPress(e) {}, |
|||
|
|||
onPullDownRefresh() {}, |
|||
|
|||
mounted() {}, |
|||
|
|||
methods: { |
|||
scanPopupPack() { |
|||
this.$refs.scanPopupPack.openScanPopup(); |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
let balance = result.balance; |
|||
let label = result.label; |
|||
let pack = result.package; |
|||
var item = this.detailSource.find(res => { |
|||
if (res.itemCode == balance.itemCode) { |
|||
return res |
|||
} |
|||
}) |
|||
if (item == undefined) { |
|||
if (this.currentItemCode != "" && this.currentItemCode != balance.itemCode) { |
|||
this.showErrorMessage("合包当前物料号[" + this.currentItemCode + "与扫描物料号[" + balance.itemCode + |
|||
"]不一致,请扫描相同物料号") |
|||
return; |
|||
} |
|||
var itemp = createItemInfo(balance, pack); |
|||
let newDetail = createDetailInfo(balance, pack); // |
|||
itemp.subList.push(newDetail); |
|||
this.currentItemCode = balance.itemCode; |
|||
this.detailSource.push(itemp) |
|||
} else { |
|||
var detail = item.subList.find(r => { |
|||
if (r.packingNumber == balance.packingNumber && |
|||
r.batch == balance.batch && |
|||
r.locationCode == balance.locationCode && |
|||
r.inventoryStatus == balance.inventoryStatus) { |
|||
return r; |
|||
} |
|||
}) |
|||
if (detail == undefined) { |
|||
let newDetail = createDetailInfo(balance, pack); |
|||
item.subList.push(newDetail); |
|||
} else { |
|||
if (detail.scaned == true) { |
|||
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") |
|||
} |
|||
} |
|||
} |
|||
this.calcHandleQty(); |
|||
|
|||
}, |
|||
|
|||
calcHandleQty() { |
|||
calcHandleQty(this.detailSource) |
|||
this.$forceUpdate(); |
|||
}, |
|||
|
|||
showErrorMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
|
|||
} |
|||
}); |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty(); |
|||
}, |
|||
removeItem(index, item) { |
|||
this.detailSource.splice(index, 1) |
|||
}, |
|||
removePack() { |
|||
for (var i = 0; i < this.detailSource.length; i++) { |
|||
var item = this.detailSource[i]; |
|||
if (item.subList.length == 0) { |
|||
this.detailSource.splice(i, 1) |
|||
} |
|||
} |
|||
this.updateData(); |
|||
}, |
|||
|
|||
openScanPopup() { |
|||
if (this.fromLocationCode == "") { |
|||
this.showFromLocationPopup(); |
|||
return |
|||
} |
|||
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); |
|||
}, |
|||
showFromLocationPopup() { |
|||
this.$nextTick(() => { |
|||
this.$refs.scanLocationCode.openScanPopup(); |
|||
}) |
|||
|
|||
}, |
|||
closeScanPopup() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
} |
|||
}, |
|||
|
|||
scanPopupGetFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.getfocus(); |
|||
} |
|||
}, |
|||
|
|||
commit() { |
|||
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
|
|||
var params = this.setParams(); |
|||
console.log("提交" + JSON.stringify(params)) |
|||
mergePackageRecordSubmit(params).then(res => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
this.showCommitSuccessMessage("提交成功<br>生成合包记录<br>" + res.data) |
|||
} else { |
|||
this.showErrorMessage("提交失败[" + res.msg + "]") |
|||
} |
|||
}).catch(error => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} else { |
|||
this.showErrorMessage("没有要扫描的数据") |
|||
} |
|||
|
|||
}, |
|||
|
|||
setParams() { |
|||
|
|||
var subList = [] |
|||
var creator = this.$store.state.user.id |
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
if (detail.scaned) { |
|||
detail.itemCode = detail.itemCode; |
|||
detail.itemName = detail.package.itemName; |
|||
detail.itemDesc1 = detail.package.itemDesc1; |
|||
detail.itemDesc2 = detail.package.itemDesc2; |
|||
|
|||
detail.fromInventoryStatus = detail.inventoryStatus; |
|||
detail.toInventoryStatus = detail.inventoryStatus; |
|||
detail.fromQty = detail.handleQty |
|||
detail.fromPackingNumber = detail.packingNumber; |
|||
detail.toPackingNumber = this.toPackingNumber; |
|||
|
|||
detail.fromBatch = detail.batch; |
|||
detail.toBatch = detail.batch; |
|||
|
|||
detail.fromLocationCode = detail.locationCode; |
|||
// detail.toLocationCode = detail.toLocationCode; |
|||
|
|||
subList.push(detail) |
|||
} |
|||
}) |
|||
}) |
|||
this.dataContent.subList = subList; |
|||
this.dataContent.creator = creator; |
|||
return this.dataContent; |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
this.$refs.comMessage.showMessage(message, res => { |
|||
if (res) {} |
|||
}); |
|||
}, |
|||
showErrorMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
|
|||
} |
|||
}); |
|||
}, |
|||
|
|||
showScanMessage(message) { |
|||
this.$refs.comMessage.showScanMessage(message); |
|||
}, |
|||
|
|||
afterCloseMessage() { |
|||
this.scanPopupGetFocus(); |
|||
}, |
|||
|
|||
closeScanMessage() { |
|||
this.scanPopupGetFocus(); |
|||
}, |
|||
getLocation(location, code) { |
|||
this.getFromLocationCode(location, code) |
|||
}, |
|||
getFromLocationCode(location, code) { |
|||
this.fromLocationCode = code; |
|||
this.openScanPopup(); |
|||
}, |
|||
|
|||
showCommitSuccessMessage(hint) { |
|||
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|||
this.detailSource = [] |
|||
this.fromLocationCode = ''; |
|||
this.toPackingNumber ="" |
|||
this.toBatch ="" |
|||
this.currentItemCode ="" |
|||
this.dataContent ={} |
|||
|
|||
}) |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty(); |
|||
for (var i = 0; i < this.detailSource.length; i++) { |
|||
let item = this.detailSource[i]; |
|||
if (item.qty == 0) { |
|||
this.detailSource.splice(i, 1) |
|||
} |
|||
} |
|||
}, |
|||
getToPackingNumber(result) { |
|||
if(this.currentItemCode!=result.label.itemCode){ |
|||
this.showErrorMessage("合包当前物料号[" + this.currentItemCode + "与目标物料号[" + result.label.itemCode + |
|||
"]不一致,请扫描相同物料号") |
|||
return; |
|||
} |
|||
this.toPackingNumber = result.label.packingNumber; |
|||
this.toBatch =result.label.batch |
|||
|
|||
} |
|||
} |
|||
} |
|||
import { mergePackageRecordSubmit } from '@/api/request2.js' |
|||
import { goHome } from '@/common/basic.js' |
|||
|
|||
import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/directory.js' |
|||
|
|||
import { getBusinessType, createItemInfo, createDetailInfo, calcHandleQty } from '@/common/record.js' |
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|||
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|||
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|||
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' |
|||
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
|||
import recommendBalance from '@/mycomponents/balance/recommendBalance.vue' |
|||
import packageTarget from '@/mycomponents/package/packageTarget.vue' |
|||
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|||
|
|||
export default { |
|||
components: { |
|||
winScanButton, |
|||
winScanPack, |
|||
requiredLocation, |
|||
comBlankView, |
|||
winScanLocation, |
|||
winScanPackAndLocation, |
|||
recommendBalance, |
|||
packageTarget, |
|||
recordComDetailCard |
|||
}, |
|||
data() { |
|||
return { |
|||
id: '', |
|||
scanCount: 0, |
|||
detailSource: [], // 绑定在页面上的数据源 |
|||
fromLocationCode: '', |
|||
isShowLocation: false, |
|||
fromLocationAreaTypeList: [], |
|||
inInventoryStatus: '', // 目标入库库存状态 |
|||
outInventoryStatus: '', // 来源出库库存状态 |
|||
businessType: {}, |
|||
toPackingNumber: '', |
|||
toBatch: '', |
|||
currentItemCode: '', |
|||
dataContent: {} |
|||
} |
|||
}, |
|||
onLoad(option) { |
|||
uni.setNavigationBarTitle({ |
|||
title: option.title |
|||
}) |
|||
const typeCode = 'MergePackage' |
|||
getBusinessType(typeCode, (res) => { |
|||
if (res.success) { |
|||
this.businessType = res.businessType |
|||
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList |
|||
this.showFromLocationPopup() |
|||
} else { |
|||
this.showErrorMessage(res.message) |
|||
} |
|||
}) |
|||
}, |
|||
// 返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome() |
|||
} |
|||
}, |
|||
// 拦截返回按钮事件 |
|||
onBackPress(e) {}, |
|||
|
|||
onPullDownRefresh() {}, |
|||
|
|||
mounted() {}, |
|||
|
|||
methods: { |
|||
scanPopupPack() { |
|||
this.$refs.scanPopupPack.openScanPopup() |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
const { balance } = result |
|||
const { label } = result |
|||
const pack = result.package |
|||
const item = this.detailSource.find((res) => { |
|||
if (res.itemCode == balance.itemCode) { |
|||
return res |
|||
} |
|||
}) |
|||
if (item == undefined) { |
|||
if (this.currentItemCode != '' && this.currentItemCode != balance.itemCode) { |
|||
this.showErrorMessage(`合包当前物料号[${this.currentItemCode}与扫描物料号[${balance.itemCode}]不一致,请扫描相同物料号`) |
|||
return |
|||
} |
|||
const itemp = createItemInfo(balance, pack) |
|||
const newDetail = createDetailInfo(balance, pack) // |
|||
itemp.subList.push(newDetail) |
|||
this.currentItemCode = balance.itemCode |
|||
this.detailSource.push(itemp) |
|||
} else { |
|||
const detail = item.subList.find((r) => { |
|||
if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { |
|||
return r |
|||
} |
|||
}) |
|||
if (detail == undefined) { |
|||
const newDetail = createDetailInfo(balance, pack) |
|||
item.subList.push(newDetail) |
|||
} else if (detail.scaned == true) { |
|||
this.showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`) |
|||
} |
|||
} |
|||
this.calcHandleQty() |
|||
}, |
|||
|
|||
calcHandleQty() { |
|||
calcHandleQty(this.detailSource) |
|||
this.$forceUpdate() |
|||
}, |
|||
|
|||
showErrorMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty() |
|||
}, |
|||
removeItem(index, item) { |
|||
this.detailSource.splice(index, 1) |
|||
}, |
|||
removePack() { |
|||
for (let i = 0; i < this.detailSource.length; i++) { |
|||
const item = this.detailSource[i] |
|||
if (item.subList.length == 0) { |
|||
this.detailSource.splice(i, 1) |
|||
} |
|||
} |
|||
this.updateData() |
|||
}, |
|||
|
|||
openScanPopup() { |
|||
if (this.fromLocationCode == '') { |
|||
this.showFromLocationPopup() |
|||
return |
|||
} |
|||
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType) |
|||
}, |
|||
showFromLocationPopup() { |
|||
this.$nextTick(() => { |
|||
this.$refs.scanLocationCode.openScanPopup() |
|||
}) |
|||
}, |
|||
closeScanPopup() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.closeScanPopup() |
|||
} |
|||
}, |
|||
|
|||
scanPopupGetFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.getfocus() |
|||
} |
|||
}, |
|||
|
|||
commit() { |
|||
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
|||
uni.showLoading({ |
|||
title: '提交中....', |
|||
mask: true |
|||
}) |
|||
|
|||
const params = this.setParams() |
|||
console.log(`提交${JSON.stringify(params)}`) |
|||
mergePackageRecordSubmit(params) |
|||
.then((res) => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
this.showCommitSuccessMessage(`提交成功<br>生成合包记录<br>${res.data}`) |
|||
} else { |
|||
this.showErrorMessage(`提交失败[${res.msg}]`) |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} else { |
|||
this.showErrorMessage('没有要扫描的数据') |
|||
} |
|||
}, |
|||
|
|||
setParams() { |
|||
const subList = [] |
|||
const creator = this.$store.state.user.id |
|||
this.detailSource.forEach((item) => { |
|||
item.subList.forEach((detail) => { |
|||
if (detail.scaned) { |
|||
detail.itemCode = detail.itemCode |
|||
detail.itemName = detail.package.itemName |
|||
detail.itemDesc1 = detail.package.itemDesc1 |
|||
detail.itemDesc2 = detail.package.itemDesc2 |
|||
|
|||
detail.fromInventoryStatus = detail.inventoryStatus |
|||
detail.toInventoryStatus = detail.inventoryStatus |
|||
detail.fromQty = detail.handleQty |
|||
detail.fromPackingNumber = detail.packingNumber |
|||
detail.toPackingNumber = this.toPackingNumber |
|||
|
|||
detail.fromBatch = detail.batch |
|||
detail.toBatch = detail.batch |
|||
|
|||
detail.fromLocationCode = detail.locationCode |
|||
// detail.toLocationCode = detail.toLocationCode; |
|||
|
|||
subList.push(detail) |
|||
} |
|||
}) |
|||
}) |
|||
this.dataContent.subList = subList |
|||
this.dataContent.creator = creator |
|||
return this.dataContent |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
this.$refs.comMessage.showMessage(message, (res) => { |
|||
if (res) { |
|||
} |
|||
}) |
|||
}, |
|||
showErrorMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
showScanMessage(message) { |
|||
this.$refs.comMessage.showScanMessage(message) |
|||
}, |
|||
|
|||
afterCloseMessage() { |
|||
this.scanPopupGetFocus() |
|||
}, |
|||
|
|||
closeScanMessage() { |
|||
this.scanPopupGetFocus() |
|||
}, |
|||
getLocation(location, code) { |
|||
this.getFromLocationCode(location, code) |
|||
}, |
|||
getFromLocationCode(location, code) { |
|||
this.fromLocationCode = code |
|||
this.openScanPopup() |
|||
}, |
|||
|
|||
showCommitSuccessMessage(hint) { |
|||
this.$refs.comMessage.showSuccessMessage(hint, (res) => { |
|||
this.detailSource = [] |
|||
this.fromLocationCode = '' |
|||
this.toPackingNumber = '' |
|||
this.toBatch = '' |
|||
this.currentItemCode = '' |
|||
this.dataContent = {} |
|||
}) |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty() |
|||
for (let i = 0; i < this.detailSource.length; i++) { |
|||
const item = this.detailSource[i] |
|||
if (item.qty == 0) { |
|||
this.detailSource.splice(i, 1) |
|||
} |
|||
} |
|||
}, |
|||
getToPackingNumber(result) { |
|||
if (this.currentItemCode != result.label.itemCode) { |
|||
this.showErrorMessage(`合包当前物料号[${this.currentItemCode}与目标物料号[${result.label.itemCode}]不一致,请扫描相同物料号`) |
|||
return |
|||
} |
|||
this.toPackingNumber = result.label.packingNumber |
|||
this.toBatch = result.label.batch |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
page { |
|||
width: 100%; |
|||
height: 100%; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.page-wraper { |
|||
display: flex; |
|||
flex-direction: column; |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
|
|||
.page-main { |
|||
flex: 1; |
|||
position: relative; |
|||
} |
|||
|
|||
.page-main-scroll { |
|||
position: absolute; |
|||
left: 0; |
|||
right: 0; |
|||
top: 0; |
|||
bottom: 0; |
|||
} |
|||
|
|||
.page-main-list { |
|||
/* height: 80rpx; |
|||
page { |
|||
width: 100%; |
|||
height: 100%; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.page-wraper { |
|||
display: flex; |
|||
flex-direction: column; |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
|
|||
.page-main { |
|||
flex: 1; |
|||
position: relative; |
|||
} |
|||
|
|||
.page-main-scroll { |
|||
position: absolute; |
|||
left: 0; |
|||
right: 0; |
|||
top: 0; |
|||
bottom: 0; |
|||
} |
|||
|
|||
.page-main-list { |
|||
/* height: 80rpx; |
|||
line-height: 80rpx; */ |
|||
text-align: center; |
|||
background: #e0e0e0; |
|||
|
|||
} |
|||
text-align: center; |
|||
background: #e0e0e0; |
|||
} |
|||
</style> |
|||
|
@ -1,351 +1,418 @@ |
|||
<template> |
|||
<view class="page-wraper"> |
|||
<view class=""> |
|||
<com-blank-view @goScan="showFromLocationPopup" v-if="detailSource.length == 0"></com-blank-view> |
|||
</view> |
|||
|
|||
<view class="page-wraper" v-if="detailSource.length > 0"> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class=""> |
|||
<com-package-record :dataContent="item" @removeItem="removeItem(index, item)" @updateData="updateData" @removePack="updateData"> </com-package-record> |
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" style="background-color: ghostwhite; width: 100%"> |
|||
<view class=""> </view> |
|||
<view class="uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<win-scan-button @goScan="showScanPopupPack"></win-scan-button> |
|||
</view> |
|||
|
|||
<win-scan-pack-and-location ref="scanPopup" @getResult="getScanResult" :allowModifyLocation="false"> </win-scan-pack-and-location> |
|||
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
|||
<win-scan-pack title="拆分标签" ref="scanPopupPack" @getResult="getScanPackResult"></win-scan-pack> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
<view class="page-wraper"> |
|||
<view class=""> |
|||
<com-blank-view @goScan='getBusinessType' v-if="detailSource.length==0"></com-blank-view> |
|||
</view> |
|||
|
|||
<view class="page-wraper" v-if="detailSource.length>0"> |
|||
<view class="page-main"> |
|||
<scroll-view scroll-y="true" class="page-main-scroll"> |
|||
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|||
<view class=""> |
|||
<record-com-detail-card :dataContent="item" @removeItem="removeItem(index,item)" |
|||
@updateData="updateData" @removePack='updateData' :isShowToLocation="false"> |
|||
</record-com-detail-card> |
|||
</view> |
|||
</view> |
|||
<view class="uni-flex uni-row" style="margin-left: 30rpx;margin-top: 10rpx; "> |
|||
|
|||
<text style="font-size: 35rpx; margin-right: 20rpx;">拆出数量 :</text> |
|||
<uni-number-box @change="calcQty($event,splitCount)" :value="splitCount"> |
|||
</uni-number-box> |
|||
<uom :uom="detailSource[0].uom"></uom> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
|
|||
<view class="page-footer"> |
|||
<view class="uni-flex u-col-center space-between padding_10" |
|||
style="background-color:ghostwhite; width: 100%; "> |
|||
<view class=""> |
|||
</view> |
|||
<view class=" uni-flex uni-row"> |
|||
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|||
</view> |
|||
|
|||
<winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="typeCode"> |
|||
</winComScanBalance> |
|||
<comMessage ref="comMessage"></comMessage> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { goHome } from '@/common/basic.js' |
|||
import { splitPackageRecordSubmit } from '@/api/request2.js' |
|||
|
|||
import { calc } from '@/common/calc.js' |
|||
|
|||
import { getInventoryStatusDesc, getDirectoryItemArray } from '@/common/directory.js' |
|||
|
|||
import { getBusinessType, createItemInfo, createDetailInfo, calcHandleQty } from '@/common/record.js' |
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|||
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|||
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|||
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|||
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' |
|||
import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' |
|||
import recommendBalance from '@/mycomponents/balance/recommendBalance.vue' |
|||
import comPackageRecord from '@/pages/package/coms/comPackageRecord.vue' |
|||
|
|||
export default { |
|||
components: { |
|||
winScanButton, |
|||
winScanPack, |
|||
requiredLocation, |
|||
comBlankView, |
|||
winScanLocation, |
|||
winScanPackAndLocation, |
|||
recommendBalance, |
|||
recordComDetailCard, |
|||
comPackageRecord |
|||
}, |
|||
data() { |
|||
return { |
|||
id: '', |
|||
detailSource: [], // 绑定在页面上的数据源 |
|||
fromLocationCode: '', |
|||
toLocationCode: '', |
|||
fromLocationAreaTypeList: [], |
|||
inInventoryStatus: '', // 目标入库库存状态 |
|||
outInventoryStatus: '', // 来源出库库存状态 |
|||
businessType: {}, |
|||
dataContent: {}, |
|||
currentItemCode: '', |
|||
toPackingNumber: '' |
|||
} |
|||
}, |
|||
onLoad(option) { |
|||
const typeCode = 'SplitPackage' |
|||
getBusinessType(typeCode, (res) => { |
|||
if (res.success) { |
|||
this.businessType = res.businessType |
|||
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList |
|||
this.showFromLocationPopup() |
|||
} else { |
|||
this.showErrorMessage(res.message) |
|||
} |
|||
}) |
|||
}, |
|||
// 返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome() |
|||
} |
|||
}, |
|||
// 拦截返回按钮事件 |
|||
onBackPress(e) {}, |
|||
|
|||
onPullDownRefresh() {}, |
|||
|
|||
mounted() { |
|||
// this.showFromLocationPopup(); |
|||
}, |
|||
methods: { |
|||
showScanPopupPack() { |
|||
this.$refs.scanPopupPack.openScanPopup() |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
const { balance } = result |
|||
const { label } = result |
|||
const pack = result.package |
|||
const item = this.detailSource.find((res) => { |
|||
if (res.itemCode == balance.itemCode) { |
|||
return res |
|||
} |
|||
}) |
|||
if (item == undefined) { |
|||
const itemp = createItemInfo(balance, pack) |
|||
const newDetail = createDetailInfo(balance, pack) // |
|||
newDetail.scaned = false |
|||
newDetail.Records = [] |
|||
newDetail.handleQty = 0 |
|||
itemp.subList.push(newDetail) |
|||
this.detailSource.push(itemp) |
|||
} else { |
|||
this.showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`) |
|||
} |
|||
this.$refs.scanPopup.closeScanPopup() |
|||
this.showScanPopupPack() |
|||
}, |
|||
|
|||
getScanPackResult(result) { |
|||
const { packingNumber } = result.label |
|||
const { batch } = result.label |
|||
const { qty } = result.label |
|||
const { itemCode } = result.label |
|||
const { uom } = result.package |
|||
const item = this.detailSource.find((r) => r.itemCode == itemCode) |
|||
if (item == undefined) { |
|||
this.showErrorMessage(`物料号【${itemCode}】不在列表中`) |
|||
} else { |
|||
const temp = { |
|||
scaned: true, |
|||
packingNumber, |
|||
batch, |
|||
qty: Number(qty), |
|||
LabelQty: Number(qty), |
|||
stdPackUnit: result.package.stdPackUnit, |
|||
stdPackQty: result.package.stdPackQty, |
|||
uom |
|||
} |
|||
|
|||
let sumQty = 0 |
|||
item.subList[0].Records.forEach(function (item1, index) { |
|||
sumQty = calc.add(sumQty, item1.qty) |
|||
}) |
|||
// if (calc.add(qty,sumQty)> item.subList[0].qty) { |
|||
// this.showErrorMessage("扫描数量总和【" + (Number(qty) + sumQty) + "】(当前输入数量【" + qty + "】+已添加数量【" + |
|||
// sumQty + |
|||
// "】)已超过拆包箱码的数量【" + Number(item.subList[0].qty) + "】!"); |
|||
// return; |
|||
// } |
|||
item.subList[0].Records.push(temp) |
|||
this.$forceUpdate() |
|||
} |
|||
this.calcHandleQty() |
|||
}, |
|||
|
|||
calcHandleQty() { |
|||
for (const detail of this.detailSource[0].subList) { |
|||
let hQty = 0 |
|||
if (detail.Records.length > 0) { |
|||
detail.Records.forEach((r) => { |
|||
hQty = calc.add(hQty, r.qty) |
|||
}) |
|||
} |
|||
detail.handleQty = hQty |
|||
} |
|||
this.$forceUpdate() |
|||
}, |
|||
|
|||
showErrorMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty() |
|||
}, |
|||
removeItem(index, item) { |
|||
this.detailSource.splice(index, 1) |
|||
}, |
|||
|
|||
openScanPopup() { |
|||
if (this.fromLocationCode == '') { |
|||
this.showFromLocationPopup() |
|||
return |
|||
} |
|||
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType) |
|||
}, |
|||
showFromLocationPopup() { |
|||
this.$nextTick(() => { |
|||
this.$refs.scanLocationCode.openScanPopup() |
|||
}) |
|||
}, |
|||
closeScanPopup() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.closeScanPopup() |
|||
} |
|||
}, |
|||
|
|||
scanPopupGetFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.getfocus() |
|||
} |
|||
}, |
|||
|
|||
commit() { |
|||
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
|||
uni.showLoading({ |
|||
title: '提交中....', |
|||
mask: true |
|||
}) |
|||
|
|||
const params = this.setParams() |
|||
console.log(`提交${JSON.stringify(params)}`) |
|||
splitPackageRecordSubmit(params) |
|||
.then((res) => { |
|||
uni.hideLoading() |
|||
if (res.data) { |
|||
this.showCommitSuccessMessage(`提交成功<br>生成拆包记录<br>${res.data}`) |
|||
} else { |
|||
this.showErrorMessage(`提交失败[${res.msg}]`) |
|||
} |
|||
}) |
|||
.catch((error) => { |
|||
uni.hideLoading() |
|||
this.showErrorMessage(error) |
|||
}) |
|||
} else { |
|||
this.showErrorMessage('没有要提交的数据') |
|||
} |
|||
}, |
|||
|
|||
setParams() { |
|||
const subList = [] |
|||
const creator = this.$store.state.user.id |
|||
this.detailSource.forEach((item) => { |
|||
item.subList.forEach((detail) => { |
|||
detail.Records.forEach((record) => { |
|||
if (record.scaned) { |
|||
const subItem = {} |
|||
Object.assign(subItem, detail) |
|||
subItem.itemCode = subItem.itemCode |
|||
subItem.itemName = detail.package.itemName |
|||
subItem.itemDesc1 = detail.package.itemDesc1 |
|||
subItem.itemDesc2 = detail.package.itemDesc2 |
|||
|
|||
subItem.fromInventoryStatus = subItem.inventoryStatus |
|||
subItem.toInventoryStatus = subItem.inventoryStatus |
|||
|
|||
subItem.fromQty = subItem.qty |
|||
subItem.toQty = record.qty |
|||
|
|||
subItem.fromPackingNumber = subItem.packingNumber |
|||
subItem.toPackingNumber = record.packingNumber |
|||
|
|||
subItem.fromBatch = subItem.batch |
|||
subItem.toBatch = record.batch |
|||
subItem.fromLocationCode = subItem.fromLocationCode |
|||
subItem.package = '' |
|||
subItem.Records = '' |
|||
subList.push(subItem) |
|||
} |
|||
}) |
|||
}) |
|||
}) |
|||
|
|||
this.dataContent.subList = subList |
|||
this.dataContent.creator = creator |
|||
return this.dataContent |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
this.$refs.comMessage.showMessage(message, (res) => { |
|||
if (res) { |
|||
} |
|||
}) |
|||
}, |
|||
showErrorMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, (res) => { |
|||
if (res) { |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
showScanMessage(message) { |
|||
this.$refs.comMessage.showScanMessage(message) |
|||
}, |
|||
|
|||
afterCloseMessage() { |
|||
this.scanPopupGetFocus() |
|||
}, |
|||
|
|||
closeScanMessage() { |
|||
this.scanPopupGetFocus() |
|||
}, |
|||
getLocation(location, code) { |
|||
this.getFromLocationCode(location, code) |
|||
}, |
|||
getFromLocationCode(location, code) { |
|||
this.fromLocationCode = code |
|||
this.openScanPopup() |
|||
}, |
|||
getToLocationCode(location, code) { |
|||
if (this.fromLocationCode == code) { |
|||
uni.showToast({ |
|||
title: `来源库位[${this.fromLocationCode}]不能与目标库位[${code}]一致`, |
|||
duration: 2000 |
|||
}) |
|||
return |
|||
} |
|||
this.toLocationCode = code |
|||
}, |
|||
|
|||
showCommitSuccessMessage(hint) { |
|||
this.$refs.comMessage.showSuccessMessage(hint, (res) => { |
|||
this.detailSource = [] |
|||
this.fromLocationCode = '' |
|||
this.currentItemCode = '' |
|||
this.dataContent = {} |
|||
}) |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty() |
|||
} |
|||
} |
|||
} |
|||
import { |
|||
goHome, |
|||
showConfirmMsg |
|||
} from '@/common/basic.js'; |
|||
import { |
|||
splitPackageRecordSubmit |
|||
} from '@/api/request2.js'; |
|||
|
|||
import { |
|||
calc |
|||
} from '@/common/calc.js'; |
|||
|
|||
import { |
|||
getInventoryStatusDesc, |
|||
getDirectoryItemArray |
|||
} from '@/common/directory.js'; |
|||
|
|||
import { |
|||
getBusinessType, |
|||
createItemInfo, |
|||
createDetailInfo, |
|||
calcHandleQty |
|||
} from '@/common/record.js'; |
|||
|
|||
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|||
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
|||
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|||
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|||
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|||
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
|||
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
|||
import recommendBalance from '@/mycomponents/balance/recommendBalance.vue' |
|||
import comPackageRecord from '@/pages/package/coms/comPackageRecord.vue' |
|||
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' |
|||
import uom from '@/mycomponents/qty/uom.vue' |
|||
|
|||
export default { |
|||
components: { |
|||
winScanButton, |
|||
winScanPack, |
|||
requiredLocation, |
|||
comBlankView, |
|||
winScanLocation, |
|||
winScanPackAndLocation, |
|||
recommendBalance, |
|||
recordComDetailCard, |
|||
comPackageRecord, |
|||
winComScanBalance, |
|||
uom |
|||
}, |
|||
data() { |
|||
return { |
|||
id: '', |
|||
detailSource: [], //绑定在页面上的数据源 |
|||
fromLocationCode: "", |
|||
toLocationCode: "", |
|||
fromLocationAreaTypeList: [], |
|||
inInventoryStatus: "", //目标入库库存状态 |
|||
outInventoryStatus: "", //来源出库库存状态 |
|||
businessType: {}, |
|||
dataContent: {}, |
|||
currentItemCode: "", |
|||
toPackingNumber: "", |
|||
itemCode:"", |
|||
splitCount:1, |
|||
typeCode:"SplitPackage" |
|||
}; |
|||
}, |
|||
onLoad(option) { |
|||
<<<<<<< Updated upstream |
|||
uni.setNavigationBarTitle({ |
|||
title: option.title |
|||
}) |
|||
var typeCode = "SplitPackage" |
|||
getBusinessType(typeCode, res => { |
|||
if (res.success) { |
|||
this.businessType = res.businessType; |
|||
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; |
|||
this.showFromLocationPopup(); |
|||
} else { |
|||
this.showErrorMessage(res.message) |
|||
} |
|||
}); |
|||
======= |
|||
this.getBusinessType(); |
|||
>>>>>>> Stashed changes |
|||
}, |
|||
//返回首页 |
|||
onNavigationBarButtonTap(e) { |
|||
if (e.index === 0) { |
|||
goHome(); |
|||
} |
|||
}, |
|||
//拦截返回按钮事件 |
|||
onBackPress(e) {}, |
|||
|
|||
onPullDownRefresh() {}, |
|||
|
|||
mounted() {}, |
|||
methods: { |
|||
getBusinessType() { |
|||
getBusinessType(this.typeCode, res => { |
|||
if (res.success) { |
|||
this.businessType = res.businessType; |
|||
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses); |
|||
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList |
|||
this.openScanPopup(); |
|||
} else { |
|||
this.showErrorMessage(res.message) |
|||
} |
|||
}); |
|||
}, |
|||
openScanPopup() { |
|||
if (this.businessType) { |
|||
if(this.detailSource.length>0){ |
|||
showConfirmMsg("拆包信息还没提交,是否要重新扫描?",res=>{ |
|||
if(res){ |
|||
this.clearData(); |
|||
this.$refs.scanPopup.openScanPopup(this.businessType); |
|||
} |
|||
}) |
|||
}else { |
|||
this.$refs.scanPopup.openScanPopup(this.businessType); |
|||
} |
|||
} else { |
|||
this.getBusinessType() |
|||
} |
|||
}, |
|||
|
|||
getScanResult(result) { |
|||
this.setData(result); |
|||
}, |
|||
|
|||
setData(result) { |
|||
let balance = result.balance; |
|||
let label = result.label; |
|||
let pack = result.package; |
|||
this.fromPackUnit = pack.packUnit; |
|||
this.fromPack = pack; |
|||
if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) { |
|||
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this |
|||
.fromLocationCode + "]没有库存余额") |
|||
return; |
|||
} |
|||
|
|||
var item = this.detailSource.find(res => { |
|||
if (res.itemCode == balance.itemCode) { |
|||
return res |
|||
} |
|||
}) |
|||
if (item == undefined) { |
|||
if (this.itemCode != "" && this.itemCode != balance.itemCode) { |
|||
this.showErrorMessage("请扫描物料为【" + this.itemCode + "】的箱码") |
|||
return; |
|||
} |
|||
var itemp = createItemInfo(balance, pack); |
|||
itemp.handleQty=0 |
|||
let newDetail = createDetailInfo(balance, pack); // |
|||
newDetail.handleQty=0 |
|||
newDetail.scaned=false |
|||
itemp.subList.push(newDetail); |
|||
this.detailSource.push(itemp) |
|||
this.itemCode = balance.itemCode; |
|||
this.fromLocationCode = balance.locationCode |
|||
this.closeScanPopup() |
|||
} else { |
|||
var detail = item.subList.find(r => { |
|||
if (r.packingNumber == balance.packingNumber && |
|||
r.batch == balance.batch && |
|||
r.locationCode == balance.locationCode && |
|||
r.inventoryStatus == balance.inventoryStatus) { |
|||
return r; |
|||
} |
|||
}) |
|||
if (detail == undefined) { |
|||
let newDetail = createDetailInfo(balance, pack); |
|||
newDetail.handleQty=0 |
|||
item.subList.push(newDetail); |
|||
this.closeScanPopup() |
|||
} else { |
|||
if (detail.scaned == true) { |
|||
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") |
|||
} |
|||
} |
|||
} |
|||
this.calcHandleQty(); |
|||
}, |
|||
|
|||
calcHandleQty() { |
|||
calcHandleQty(this.detailSource) |
|||
this.$forceUpdate(); |
|||
}, |
|||
|
|||
|
|||
showErrorMessage(message) { |
|||
this.$refs.comMessage.showErrorMessage(message, res => { |
|||
if (res) { |
|||
|
|||
} |
|||
}); |
|||
}, |
|||
|
|||
updateData() { |
|||
this.calcHandleQty(); |
|||
for (var i = 0; i < this.detailSource.length; i++) { |
|||
let item = this.detailSource[i]; |
|||
if (item.qty == 0) { |
|||
this.detailSource.splice(i, 1) |
|||
} |
|||
} |
|||
}, |
|||
removeItem(index, item) { |
|||
this.detailSource.splice(index, 1) |
|||
}, |
|||
|
|||
closeScanPopup() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.closeScanPopup(); |
|||
} |
|||
}, |
|||
|
|||
scanPopupGetFocus() { |
|||
if (this.$refs.scanPopup != undefined) { |
|||
this.$refs.scanPopup.getfocus(); |
|||
} |
|||
}, |
|||
|
|||
commit() { |
|||
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
|||
|
|||
if(this.splitCount==0){ |
|||
this.showErrorMessage("拆出数量不能等于0") |
|||
return; |
|||
} |
|||
if(this.splitCount>this.detailSource[0].qty){ |
|||
this.showErrorMessage("拆出数量不能大于库存数量") |
|||
return; |
|||
} |
|||
uni.showLoading({ |
|||
title: "提交中....", |
|||
mask: true |
|||
}); |
|||
|
|||
var params = this.setParams(); |
|||
console.log("提交" + JSON.stringify(params)) |
|||
// splitPackageRecordSubmit(params).then(res => { |
|||
// uni.hideLoading() |
|||
// if (res.data) { |
|||
|
|||
// let list = [] |
|||
// res.data.forEach(item => { |
|||
// list.push({ |
|||
// itemCode: item.itemCode, // 物品代码 |
|||
// itemName: item.itemName, // 物品名称 |
|||
// packName: item.packName, // 包装名称 |
|||
// packageCode: item.toPackingNumber, // 包装号 |
|||
// batch: item.toBatch, //批次 |
|||
// parentNumber: item.parentNumber, //父包装号 |
|||
// itemType: item.itemType, //物料类型 |
|||
// asnNumber: item.asnNumber, //ASN |
|||
// supplierCode: item.supplierCode, // 供应商 |
|||
// qty: item.qty, // 数量 |
|||
// printTimes: getCurrDateTime(), // 打印时间 |
|||
// productionLineCode: item.productionLineCode, //生产线 |
|||
// barcodeString: item.barcodeString, // 标签信息 |
|||
// barcodeBase64: '', |
|||
// }) |
|||
// }) |
|||
// this.showCommitSuccessMessage("提交成功<br>生成拆包记录<br>", list) |
|||
|
|||
// } else { |
|||
// this.showErrorMessage("提交失败[" + res.msg + "]") |
|||
// } |
|||
// }).catch(error => { |
|||
// uni.hideLoading() |
|||
// this.showErrorMessage(error) |
|||
// }) |
|||
} else { |
|||
this.showErrorMessage("没有要提交的数据") |
|||
} |
|||
|
|||
}, |
|||
|
|||
setParams() { |
|||
var subList = [] |
|||
var creator = this.$store.state.user.id |
|||
this.detailSource.forEach(item => { |
|||
item.subList.forEach(detail => { |
|||
var subItem = {}; |
|||
Object.assign(subItem, detail) |
|||
subItem.itemCode = subItem.itemCode; |
|||
subItem.itemName = detail.package.itemName; |
|||
subItem.itemDesc1 = detail.package.itemDesc1; |
|||
subItem.itemDesc2 = detail.package.itemDesc2; |
|||
|
|||
subItem.fromInventoryStatus = subItem.inventoryStatus; |
|||
subItem.toInventoryStatus = subItem.inventoryStatus; |
|||
|
|||
subItem.fromQty = subItem.qty |
|||
subItem.toQty = subItem.qty |
|||
|
|||
subItem.fromPackingNumber = subItem.packingNumber; |
|||
subItem.toPackingNumber = subItem.packingNumber; |
|||
|
|||
subItem.fromBatch = subItem.batch; |
|||
subItem.toBatch = subItem.batch; |
|||
subItem.fromLocationCode = subItem.fromLocationCode; |
|||
subItem.package = "" |
|||
subItem.Records = "" |
|||
subList.push(subItem) |
|||
|
|||
}) |
|||
}) |
|||
|
|||
this.dataContent.subList = subList; |
|||
this.dataContent.creator = creator; |
|||
return this.dataContent; |
|||
}, |
|||
|
|||
showMessage(message) { |
|||
this.$refs.comMessage.showMessage(message, res => { |
|||
if (res) {} |
|||
}); |
|||
}, |
|||
|
|||
showScanMessage(message) { |
|||
this.$refs.comMessage.showScanMessage(message); |
|||
}, |
|||
|
|||
afterCloseMessage() { |
|||
this.scanPopupGetFocus(); |
|||
}, |
|||
|
|||
closeScanMessage() { |
|||
this.scanPopupGetFocus(); |
|||
}, |
|||
|
|||
showCommitSuccessMessage(hint, pointData) { |
|||
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|||
this.clearData(); |
|||
if (pointData.length > 0) { |
|||
uni.navigateTo({ |
|||
url: `/pages/point/index?points=${JSON.stringify(pointData)}` |
|||
}); |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
clearData(){ |
|||
this.detailSource = [] |
|||
this.fromLocationCode = ''; |
|||
this.currentItemCode = "" |
|||
this.dataContent = {} |
|||
this.itemCode="" |
|||
this.splitCount=1 |
|||
}, |
|||
|
|||
calcQty(val) { |
|||
this.splitCount =val; |
|||
// if(val<=0){ |
|||
// this.showErrorMessage("数量必须大于0") |
|||
// } |
|||
}, |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped lang="scss"></style> |
|||
<style scoped lang="scss"> |
|||
|
|||
</style> |
Loading…
Reference in new issue