|
|
@ -1,79 +1,98 @@ |
|
|
|
<template> |
|
|
|
<view class="" style="background-color: #fff;"> |
|
|
|
<uni-collapse ref="collapse1" @change=""> |
|
|
|
<uni-collapse-item :open="true"> |
|
|
|
<template v-slot:title> |
|
|
|
<uni-swipe-action ref="swipeAction"> |
|
|
|
<uni-swipe-action-item @click="removeData($event,dataContent)" :right-options="removeOptions"> |
|
|
|
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" |
|
|
|
:isShowBalance="true"></item-qty> |
|
|
|
</uni-swipe-action-item> |
|
|
|
</uni-swipe-action> |
|
|
|
</template> |
|
|
|
|
|
|
|
<view class="" v-for="(item,index) in dataContent.subList"> |
|
|
|
<uni-swipe-action ref="swipeAction"> |
|
|
|
<uni-swipe-action-item @click="swipeClick($event,item,index)" |
|
|
|
:right-options="item.scaned?scanOptions:detailOptions"> |
|
|
|
<comMovebalance :dataContent="item" :isShowStdPack="false" :isShowPack="true" |
|
|
|
:fromInventoryStatus="item.inventoryStatus" :toInventoryStatus="item.toInventoryStatus" |
|
|
|
:isShowLocation="true"></comMovebalance> |
|
|
|
</uni-swipe-action-item> |
|
|
|
</uni-swipe-action> |
|
|
|
<u-line color="#D8D8D8"></u-line> |
|
|
|
<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"> |
|
|
|
<u-line /> |
|
|
|
<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-move-record-card :dataContent="item" :index="index" @removeData="removeData" |
|
|
|
:isShowStatus="isShowStatus" @updateData="updateData" @removePack='removePack' |
|
|
|
:allowEditStatus="allowEditStatus"> |
|
|
|
</com-move-record-card> |
|
|
|
</view> |
|
|
|
<u-line /> |
|
|
|
</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=""> |
|
|
|
<requiredLocation title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode' |
|
|
|
:locationTypeList="toLocationTypeArray" :isShowEdit="toLocationCode==''"></requiredLocation> |
|
|
|
</view> |
|
|
|
<view class=" uni-flex uni-row"> |
|
|
|
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-collapse-item> |
|
|
|
</uni-collapse> |
|
|
|
<balanceQtyEdit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="isShowStatus" :allowEditStatus="allowEditStatus"> |
|
|
|
</balanceQtyEdit> |
|
|
|
<job-detail-popup ref="winHint" :dataContent="showItem"></job-detail-popup> |
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
</view> |
|
|
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|
|
|
</view> |
|
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :title="'箱码'"> |
|
|
|
</win-scan-pack-and-location> |
|
|
|
<win-scan-location ref="scanFromLocationCode" title="来源库位" @getLocation='getLocation' |
|
|
|
:locationTypeList="fromlocationTypeList"></win-scan-location> |
|
|
|
<com-message ref="comMessage"></com-message> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
|
|
|
import recommend from '@/mycomponents/recommend/recommend.vue' |
|
|
|
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' |
|
|
|
import balance from '@/mycomponents/balance/balance.vue' |
|
|
|
import balanceMove from '@/mycomponents/balance/balanceMove.vue' |
|
|
|
import comMovebalance from '@/pages/inventoryMove/coms/comMovebalance.vue' |
|
|
|
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
|
|
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
|
|
|
import comMoveRecordCard from '@/pages/inventoryMove/coms/comMoveRecordCard.vue' |
|
|
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
|
|
|
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" |
|
|
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
|
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
|
import { |
|
|
|
inventoryMoveRecordSubmit, |
|
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getDirectoryItemArray |
|
|
|
} from '@/common/directory.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getPrecisionStrategyList |
|
|
|
} from '@/common/balance.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getDetailOption, |
|
|
|
getDetailEditRemoveOption, |
|
|
|
getRemoveOption |
|
|
|
} from '@/common/array.js'; |
|
|
|
getPackingNumberAndBatchByList |
|
|
|
} from '@/common/basic.js'; |
|
|
|
|
|
|
|
import { |
|
|
|
getBusinessType, |
|
|
|
createItemInfo, |
|
|
|
createDetailInfo, |
|
|
|
calcHandleQty |
|
|
|
} from '@/common/record.js'; |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
itemQty, |
|
|
|
recommend, |
|
|
|
jobDetailPopup, |
|
|
|
balance, |
|
|
|
balanceQtyEdit, |
|
|
|
balanceMove, |
|
|
|
comMovebalance, |
|
|
|
comEmptyView, |
|
|
|
winScanButton, |
|
|
|
requiredLocation, |
|
|
|
comMoveRecordCard, |
|
|
|
comBlankView, |
|
|
|
winScanLocation, |
|
|
|
winScanPackAndLocation, |
|
|
|
comMessage |
|
|
|
}, |
|
|
|
props: { |
|
|
|
dataContent: { |
|
|
|
type: Object, |
|
|
|
default: {} |
|
|
|
}, |
|
|
|
settingParam: { |
|
|
|
type: Object, |
|
|
|
default: {} |
|
|
|
}, |
|
|
|
fromInventoryStatus: { |
|
|
|
type: String, |
|
|
|
default: "" |
|
|
|
}, |
|
|
|
toInventoryStatus: { |
|
|
|
type: String, |
|
|
|
default: "" |
|
|
|
}, |
|
|
|
// fromInventoryStatus: { |
|
|
|
// type: String, |
|
|
|
// default: "" |
|
|
|
// }, |
|
|
|
// toInventoryStatus: { |
|
|
|
// type: String, |
|
|
|
// default: "" |
|
|
|
// }, |
|
|
|
isShowStatus: { |
|
|
|
type: Boolean, |
|
|
|
default: true |
|
|
@ -82,97 +101,309 @@ |
|
|
|
type: Boolean, |
|
|
|
default: false |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
watch: { |
|
|
|
|
|
|
|
businessTypeCode: { |
|
|
|
type: String, |
|
|
|
default: "Move" |
|
|
|
}, //业务类型 |
|
|
|
toLocationCode: { |
|
|
|
type: String, |
|
|
|
default: "" |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
data() { |
|
|
|
return { |
|
|
|
option: [], |
|
|
|
title: "推荐详情", |
|
|
|
showItem: {}, |
|
|
|
editItem: {}, |
|
|
|
detailOptions: [], |
|
|
|
scanOptions: [], |
|
|
|
removeOptions: [], |
|
|
|
dataList: [] |
|
|
|
fromLocationCode: "", |
|
|
|
// toLocationCode: "", |
|
|
|
toLocationInfo: {}, |
|
|
|
toLocationTypeArray: [], |
|
|
|
toInventoryStatus: "", |
|
|
|
businessType: {}, //业务类型 |
|
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
|
title: "", |
|
|
|
dataContent: {}, |
|
|
|
toWarehouseCode: "", |
|
|
|
fromlocationTypeList: [], |
|
|
|
tolocationTypeList: [], |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
mounted() { |
|
|
|
this.detailOptions = getDetailOption(); |
|
|
|
this.scanOptions = getDetailEditRemoveOption(); |
|
|
|
this.removeOptions = getRemoveOption(); |
|
|
|
getBusinessType(this.businessTypeCode, res => { |
|
|
|
if (res.success) { |
|
|
|
this.businessType = res.businessType; |
|
|
|
this.fromlocationTypeList = res.fromlocationTypeList; |
|
|
|
this.tolocationTypeList = res.tolocationTypeList; |
|
|
|
this.showFromLocationPopup(); |
|
|
|
} else { |
|
|
|
this.showErrorMessage(res.message) |
|
|
|
} |
|
|
|
}); |
|
|
|
this.updateTitle(); |
|
|
|
}, |
|
|
|
|
|
|
|
onLoad() { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
removeData(e, dataContent) { |
|
|
|
if (e.content.text == "移除") { |
|
|
|
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", |
|
|
|
res => { |
|
|
|
if (res) { |
|
|
|
this.$emit('removeData', dataContent) |
|
|
|
} |
|
|
|
}); |
|
|
|
updateTitle() { |
|
|
|
if (this.businessTypeCode == "Move") { |
|
|
|
this.title = "库存转移记录"; |
|
|
|
this.toInventoryStatus = "OK" |
|
|
|
} else if (this.businessTypeCode == "HoldToOk") { |
|
|
|
this.title = "隔离转合格记录"; |
|
|
|
this.toInventoryStatus = "OK" |
|
|
|
} else if (this.businessTypeCode == "HoldToScrap") { |
|
|
|
this.title = "隔离转报废记录"; |
|
|
|
this.toInventoryStatus = "SCRAP" |
|
|
|
} else if (this.businessTypeCode == "OkToHold") { |
|
|
|
this.title = "合格转隔离记录"; |
|
|
|
this.toInventoryStatus = "HOLD" |
|
|
|
} else if (this.businessTypeCode == "OktoScrap") { |
|
|
|
this.title = "合格转报废记录"; |
|
|
|
this.toInventoryStatus = "SCRAP" |
|
|
|
} else if (this.businessTypeCode == "ScrapToHold") { |
|
|
|
this.title = "报废转隔离记录"; |
|
|
|
this.toInventoryStatus = "HOLD" |
|
|
|
} |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
title: this.title |
|
|
|
}) |
|
|
|
}, |
|
|
|
swipeClick(e, item, index) { |
|
|
|
if (e.content.text == "详情") { |
|
|
|
this.detail(item) |
|
|
|
} else if (e.content.text == "编辑") { |
|
|
|
this.edit(item) |
|
|
|
} else if (e.content.text == "移除") { |
|
|
|
this.remove(item, index) |
|
|
|
openScanPopup() { |
|
|
|
if (this.fromLocationCode == "") { |
|
|
|
this.showFromLocationPopup(); |
|
|
|
return |
|
|
|
} |
|
|
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); |
|
|
|
}, |
|
|
|
showFromLocationPopup() { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.scanFromLocationCode.openScanPopup(); |
|
|
|
}) |
|
|
|
|
|
|
|
edit(item) { |
|
|
|
this.editItem = item; |
|
|
|
this.$refs.balanceQtyEdit.openEditPopup(item, item.qty); |
|
|
|
}, |
|
|
|
|
|
|
|
detail(item) { |
|
|
|
this.showItem = item; |
|
|
|
this.dataList = [ |
|
|
|
|
|
|
|
{ |
|
|
|
title: "箱码", |
|
|
|
content: item.packingNumber |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "批次", |
|
|
|
content: item.batch |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "库位", |
|
|
|
content: item.locationCode |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "数量", |
|
|
|
content: item.qty |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: "单位", |
|
|
|
content: item.uom |
|
|
|
}, |
|
|
|
getLocation(location) { |
|
|
|
this.getfromLocationCode(location) |
|
|
|
}, |
|
|
|
getfromLocationCode(location) { |
|
|
|
this.fromLocationCode = location.code; |
|
|
|
this.openScanPopup(); |
|
|
|
}, |
|
|
|
getToLocationCode(location, code) { |
|
|
|
this.toWarehouseCode = location.warehouseCode |
|
|
|
this.toLocationCode = code; |
|
|
|
}, |
|
|
|
getScanResult(result) { |
|
|
|
this.getDataSource(result) |
|
|
|
}, |
|
|
|
|
|
|
|
getDataSource(result) { |
|
|
|
var balance = result.balance; |
|
|
|
var pack = result.package; |
|
|
|
var item = this.detailSource.find(res => { |
|
|
|
if (res.itemCode == balance.itemCode) { |
|
|
|
return res |
|
|
|
} |
|
|
|
] |
|
|
|
this.$refs.winHint.openScanPopup(this.showItem) |
|
|
|
}, |
|
|
|
remove(item, index) { |
|
|
|
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?", |
|
|
|
res => { |
|
|
|
if (res) { |
|
|
|
this.dataContent.subList.splice(index, 1) |
|
|
|
this.$emit('removePack', item) |
|
|
|
}) |
|
|
|
if (item == undefined) { |
|
|
|
var itemp = createItemInfo(balance, pack); |
|
|
|
let newDetail = createDetailInfo(balance, pack); // |
|
|
|
newDetail.inventoryStatus = balance.inventoryStatus; |
|
|
|
newDetail.toInventoryStatus = this.toInventoryStatus; |
|
|
|
itemp.subList.push(newDetail); |
|
|
|
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 && |
|
|
|
r.scaned == true) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
if (detail == undefined) { |
|
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
|
newDetail.inventoryStatus = balance.inventoryStatus; |
|
|
|
newDetail.toInventoryStatus = this.toInventoryStatus |
|
|
|
item.subList.push(newDetail); |
|
|
|
} else { |
|
|
|
this.showErrorMessage(balance.packingNumber + "已经在列表中") |
|
|
|
} |
|
|
|
} |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
if (res) { |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
updateData() { |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
for (var i = 0; i < this.detailSource.length; i++) { |
|
|
|
let item = this.detailSource[i]; |
|
|
|
if (item.qty == 0) { |
|
|
|
this.detailSource.splice(i, 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(); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
removeData(item) { |
|
|
|
for (let i = 0; i < this.detailSource.length; i++) { |
|
|
|
if (this.detailSource[i].itemCode == item.itemCode) { |
|
|
|
this.detailSource.splice(i, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
showCommitSuccessMessage(hint) { |
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
|
this.clearData() |
|
|
|
}) |
|
|
|
}, |
|
|
|
clearData() { |
|
|
|
this.fromLocationCode = ''; |
|
|
|
this.subList = []; |
|
|
|
this.detailSource = []; |
|
|
|
this.toLocationCode = ''; |
|
|
|
this.dataContent = {} |
|
|
|
this.toWarehouseCode = "" |
|
|
|
}, |
|
|
|
commit() { |
|
|
|
if (this.toLocationCode == "") { |
|
|
|
this.showMessage("请先选择目标库位") |
|
|
|
return; |
|
|
|
} |
|
|
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
|
|
|
//查询管理模式 |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中....", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
this.managementList = []; |
|
|
|
var precisionStrategParams = this.setPrecisionStrategParams() |
|
|
|
|
|
|
|
getPrecisionStrategyList(precisionStrategParams, res => { |
|
|
|
if (res.success) { |
|
|
|
this.managementList = res.list; |
|
|
|
var params = this.setParams() |
|
|
|
console.log("提交" + JSON.stringify(params)) |
|
|
|
inventoryMoveRecordSubmit(params).then(res => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data) { |
|
|
|
this.showCommitSuccessMessage("提交成功<br>生成" + this.title + "记录<br>" + |
|
|
|
res.data) |
|
|
|
} else { |
|
|
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
uni.hideLoading(); |
|
|
|
this.showErrorMessage(res.message); |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
confirm(qty) { |
|
|
|
this.editItem.qty = qty; |
|
|
|
this.$emit('updateData') |
|
|
|
} |
|
|
|
|
|
|
|
setPrecisionStrategParams() { |
|
|
|
var itemList = [] |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
detail.toLocationCode = this.toLocationCode; |
|
|
|
var filterResult = itemList.filter(res => { |
|
|
|
if (res.itemCode == item.itemCode && |
|
|
|
detail.toLocationCode == res.locationCode) { |
|
|
|
return res |
|
|
|
} |
|
|
|
}) |
|
|
|
//去掉重复元素 |
|
|
|
if (filterResult.length == 0) { |
|
|
|
var result = { |
|
|
|
itemCode: item.itemCode, |
|
|
|
locationCode: detail.toLocationCode |
|
|
|
} |
|
|
|
itemList.push(result) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
return itemList; |
|
|
|
}, |
|
|
|
setParams() { |
|
|
|
var subList = [] |
|
|
|
var creator = this.$store.state.user.id |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, |
|
|
|
detail.packingNumber, detail.toLocationCode, detail.batch); |
|
|
|
detail.itemCode = detail.itemCode; |
|
|
|
detail.itemName = detail.package.itemName; |
|
|
|
detail.itemDesc1 = detail.package.itemDesc1; |
|
|
|
detail.itemDesc2 = detail.package.itemDesc2; |
|
|
|
|
|
|
|
detail.fromInventoryStatus = detail.inventoryStatus; |
|
|
|
|
|
|
|
detail.fromPackingNumber = info.packingNumber; |
|
|
|
detail.toPackingNumber = info.packingNumber; |
|
|
|
|
|
|
|
detail.fromContainerNumber = detail.containerNumber; |
|
|
|
detail.toContainerNumber = detail.containerNumber |
|
|
|
|
|
|
|
detail.fromBatch = info.batch; |
|
|
|
detail.toBatch = info.batch; |
|
|
|
|
|
|
|
detail.fromLocationCode = detail.locationCode; |
|
|
|
|
|
|
|
// if (this.businessType != '') { |
|
|
|
// detail.toLocationCode = this.toLocationCode; |
|
|
|
// detail.toInventoryStatus = this.toInventoryStatus; |
|
|
|
// } |
|
|
|
|
|
|
|
subList.push(detail) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.dataContent.subList = subList; |
|
|
|
this.dataContent.creator = creator; |
|
|
|
this.dataContent.fromWarehouseCode = this.detailSource[0].subList[0].warehouseCode; |
|
|
|
this.dataContent.toWarehouseCode = this.toWarehouseCode; |
|
|
|
this.dataContent.businessType = this.businessTypeCode; |
|
|
|
return this.dataContent; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|