|
|
|
<template>
|
|
|
|
<view class="page-wraper">
|
|
|
|
<view class="">
|
|
|
|
<com-blank-view @goScan='showPopup' v-if="detailSource.length==0"></com-blank-view>
|
|
|
|
</view>
|
|
|
|
<view class="page-wraper" v-if="detailSource.length>0">
|
|
|
|
<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="">
|
|
|
|
<com-move-record-card :dataContent="item" :index="index" @removeData="removeData"
|
|
|
|
:isShowStatus="isShowStatus" @updateData="updateData" @removePack='removePack'
|
|
|
|
:allowEditQty="true"
|
|
|
|
:allowEditStatus="allowEditStatus" >
|
|
|
|
</com-move-record-card>
|
|
|
|
</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="">
|
|
|
|
<!-- :isShowEdit="isShowEditLocation" -->
|
|
|
|
<requiredLocation title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocation'
|
|
|
|
:locationAreaTypeList="toLocationAreaTypeList" :isShowEdit='true'></requiredLocation>
|
|
|
|
</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='showPopup'></win-scan-button>
|
|
|
|
</view>
|
|
|
|
<!-- 合格转隔离单独的弹窗-->
|
|
|
|
<okToHoldRecordPack ref="okToHoldRecordPackRef" :showOnePop='showOnePop' @showFromLocationPopup='showFromLocationPopup' @itemCodeClick='openScanPopup' @confirm='okToHoldRecordPackConfirm' @getInputMsgResult="getInputMsgResult" @itemCodeScanMsg='itemCodeScanMsg' ></okToHoldRecordPack>
|
|
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :title="'箱码'" >
|
|
|
|
</win-scan-pack-and-location>
|
|
|
|
<win-scan-location ref="scanFromLocationCode" title="来源库位" @getLocation='getFromLocation'
|
|
|
|
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
|
|
|
|
<comMessage ref="comMessage"></comMessage>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
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 okToHoldRecordPack from '@/pages/inventoryMove/coms/okToHoldRecordPack.vue'
|
|
|
|
|
|
|
|
import {
|
|
|
|
getInventoryStatusName
|
|
|
|
} from '@/common/directory.js';
|
|
|
|
import {
|
|
|
|
inventoryMoveRecordSubmit,
|
|
|
|
getBasicLocationByCode,
|
|
|
|
} from '@/api/request2.js';
|
|
|
|
|
|
|
|
import {
|
|
|
|
getDirectoryItemArray
|
|
|
|
} 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: {
|
|
|
|
comEmptyView,
|
|
|
|
winScanButton,
|
|
|
|
requiredLocation,
|
|
|
|
comMoveRecordCard,
|
|
|
|
comBlankView,
|
|
|
|
winScanLocation,
|
|
|
|
winScanPackAndLocation,
|
|
|
|
okToHoldRecordPack
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
// fromInventoryStatus: {
|
|
|
|
// type: String,
|
|
|
|
// default: ""
|
|
|
|
// },
|
|
|
|
// toInventoryStatus: {
|
|
|
|
// type: String,
|
|
|
|
// default: ""
|
|
|
|
// },
|
|
|
|
isShowStatus: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
allowEditStatus: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
businessTypeCode: {
|
|
|
|
type: String,
|
|
|
|
default: "Move"
|
|
|
|
}, //业务类型
|
|
|
|
// toLocationCode: {
|
|
|
|
// type: String,
|
|
|
|
// default: ""
|
|
|
|
// },
|
|
|
|
myTitle: {
|
|
|
|
type: String,
|
|
|
|
default: ""
|
|
|
|
},
|
|
|
|
// 是否显示第一层弹窗
|
|
|
|
showOnePop: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fromLocationCode: "",
|
|
|
|
fromLocationInfo: {},
|
|
|
|
toLocationCode: "",
|
|
|
|
toLocationInfo: {},
|
|
|
|
toLocationTypeArray: [],
|
|
|
|
toInventoryStatus: "",
|
|
|
|
businessType: {}, //业务类型
|
|
|
|
detailSource: [], //绑定在页面上的数据源
|
|
|
|
title: "",
|
|
|
|
dataContent: {},
|
|
|
|
fromLocationAreaTypeList: [],
|
|
|
|
toLocationAreaTypeList: [],
|
|
|
|
isShowEditLocation: false,
|
|
|
|
isJustReplay:true,//是否只是回显,不走库存余额接口
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
getBusinessType(this.businessTypeCode, res => {
|
|
|
|
if (res.success) {
|
|
|
|
this.businessType = res.businessType;
|
|
|
|
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList;
|
|
|
|
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
|
|
|
|
this.showPopup()
|
|
|
|
} else {
|
|
|
|
this.showErrorMessage(res.message)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.initData();
|
|
|
|
this.getLocationInfo();
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
initData() {
|
|
|
|
if (this.businessTypeCode == "Move") {
|
|
|
|
// this.title = "库存转移记录";
|
|
|
|
this.toInventoryStatus = ""
|
|
|
|
this.toLocationCode = ""
|
|
|
|
this.isShowEditLocation = true;
|
|
|
|
} else if (this.businessTypeCode == "HoldToOk") {
|
|
|
|
// this.title = "隔离转合格记录";
|
|
|
|
this.toInventoryStatus = "OK"
|
|
|
|
this.toLocationCode = ""
|
|
|
|
this.isShowEditLocation = true;
|
|
|
|
} else if (this.businessTypeCode == "HoldToScrap") {
|
|
|
|
// this.title = "隔离转报废记录";
|
|
|
|
this.toInventoryStatus = "SCRAP"
|
|
|
|
this.toLocationCode = ""
|
|
|
|
// this.toLocationCode = "SCRAP"
|
|
|
|
} else if (this.businessTypeCode == "OkToHold") {
|
|
|
|
// this.title = "合格转隔离记录";
|
|
|
|
this.toInventoryStatus = "HOLD"
|
|
|
|
this.toLocationCode = ""
|
|
|
|
// this.toLocationCode = "HOLD"
|
|
|
|
} else if (this.businessTypeCode == "OkToScrap") {
|
|
|
|
// this.title = "合格转报废记录";
|
|
|
|
this.toInventoryStatus = "SCRAP"
|
|
|
|
this.toLocationCode = ""
|
|
|
|
// this.toLocationCode = "SCRAP"
|
|
|
|
} else if (this.businessTypeCode == "ScrapToHold") {
|
|
|
|
// this.title = "报废转隔离记录";
|
|
|
|
this.toInventoryStatus = "HOLD"
|
|
|
|
// this.toLocationCode = "HOLD"
|
|
|
|
this.toLocationCode = ""
|
|
|
|
}
|
|
|
|
this.title = this.myTitle
|
|
|
|
uni.setNavigationBarTitle({
|
|
|
|
title: this.title
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getLocationInfo() {
|
|
|
|
if (this.toLocationCode != "") {
|
|
|
|
getBasicLocationByCode(this.toLocationCode).then(res => {
|
|
|
|
if (res.data.total > 0) {
|
|
|
|
let result = res.data.list[0];
|
|
|
|
if (result.code != this.toLocationCode) {
|
|
|
|
this.showErrorMessage('未查询到库位[' + this.toLocationCode + ']')
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var type = result.type;
|
|
|
|
var available = result.available;
|
|
|
|
if (available == "TRUE") {
|
|
|
|
this.toLocationInfo = res.data.list[0];
|
|
|
|
} else {
|
|
|
|
this.showErrorMessage("扫描库位[" + this.code + "]不可用")
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.showErrorMessage('库位[' + this.toLocationCode + ']不存在')
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
uni.hideLoading();
|
|
|
|
this.showErrorMessage(error)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
openScanPopup() {
|
|
|
|
this.isJustReplay = true
|
|
|
|
if (this.fromLocationCode == "") {
|
|
|
|
this.showFromLocationPopup();
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
|
|
|
|
},
|
|
|
|
showFromLocationPopup() {
|
|
|
|
this.$refs.scanFromLocationCode.openScanPopup();
|
|
|
|
},
|
|
|
|
showPopup() {
|
|
|
|
setTimeout(()=>{
|
|
|
|
if(this.showOnePop){
|
|
|
|
this.$refs.okToHoldRecordPackRef.fromLocationCode = ''
|
|
|
|
this.$refs.okToHoldRecordPackRef.itemCode = ''
|
|
|
|
this.$refs.okToHoldRecordPackRef.batch = ''
|
|
|
|
this.$refs.okToHoldRecordPackRef.handleQty = 0
|
|
|
|
this.$refs.okToHoldRecordPackRef.showOne = true
|
|
|
|
|
|
|
|
}else{
|
|
|
|
this.$refs.scanFromLocationCode.openScanPopup();
|
|
|
|
}
|
|
|
|
},200)
|
|
|
|
},
|
|
|
|
getFromLocation(location) {
|
|
|
|
this.fromLocationCode = location.code;
|
|
|
|
this.$refs.okToHoldRecordPackRef.fromLocationCode = location.code
|
|
|
|
this.fromLocationInfo = location;
|
|
|
|
if(!this.showOnePop){
|
|
|
|
this.openScanPopup();
|
|
|
|
}else{
|
|
|
|
this.itemCode =''
|
|
|
|
this.batch =''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getToLocation(location, code) {
|
|
|
|
this.toLocationCode = code;
|
|
|
|
this.toLocationInfo = location;
|
|
|
|
},
|
|
|
|
getScanResult(result,managementTypeParams) {
|
|
|
|
this.managementType = managementTypeParams
|
|
|
|
if(this.showOnePop){
|
|
|
|
if(this.isJustReplay){
|
|
|
|
this.$refs.okToHoldRecordPackRef.itemCode= result.label.itemCode
|
|
|
|
this.$refs.okToHoldRecordPackRef.batch = result.label.batch
|
|
|
|
this.getResult = result//存储接受的结果
|
|
|
|
this.$refs.scanPopup.closeScanPopup()
|
|
|
|
}else{
|
|
|
|
this.getScanResultAfterBatch(result,managementTypeParams)
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
|
|
|
|
this.getScanResultAfterBatch(result,managementTypeParams)
|
|
|
|
}else{
|
|
|
|
this.getScanResultAfter(result,managementTypeParams)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
okToHoldRecordPackConfirm(obj){
|
|
|
|
// this.getResult. = result//存储接受的结果
|
|
|
|
if(!obj.fromLocationCode){
|
|
|
|
this.$refs.comMessage.showErrorMessage('请输入来源库位');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(!obj.itemCode){
|
|
|
|
this.$refs.comMessage.showErrorMessage('请输入零件');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(!obj.handleQty){
|
|
|
|
this.$refs.comMessage.showErrorMessage('请输入数量');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.getResult = this.getResult ? this.getResult : {
|
|
|
|
label:{},
|
|
|
|
fromLocationCode:''
|
|
|
|
}
|
|
|
|
this.getResult.fromLocationCode = obj.fromLocationCode
|
|
|
|
this.getResult.label.itemCode = obj.itemCode
|
|
|
|
this.getResult.label.batch = obj.batch
|
|
|
|
this.getResult.label.qty = obj.handleQty
|
|
|
|
this.isJustReplay=false
|
|
|
|
this.$refs.scanPopup.getScanResult(this.getResult,this.businessType)
|
|
|
|
},
|
|
|
|
getScanResultAfter(result){
|
|
|
|
var balance = result.balance;
|
|
|
|
var pack = result.package;
|
|
|
|
var item = this.detailSource.find(res => {
|
|
|
|
if (res.itemCode == balance.itemCode) {
|
|
|
|
return res
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if (item == undefined) {
|
|
|
|
var itemp = createItemInfo(balance, pack);
|
|
|
|
let newDetail = createDetailInfo(balance, pack);
|
|
|
|
|
|
|
|
if (newDetail.packingNumber == '') {
|
|
|
|
newDetail.packingNumber = pack.number;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.businessTypeCode == "Move") {
|
|
|
|
newDetail.toInventoryStatus = balance.inventoryStatus;
|
|
|
|
} else {
|
|
|
|
newDetail.toInventoryStatus = this.toInventoryStatus;
|
|
|
|
}
|
|
|
|
newDetail.toLocationCode = this.toLocationCode;
|
|
|
|
newDetail.fromLocationCode = result.fromLocationCode
|
|
|
|
itemp.subList.push(newDetail);
|
|
|
|
this.detailSource.push(itemp)
|
|
|
|
} else {
|
|
|
|
var detail = item.subList.find(r => {
|
|
|
|
if (r.packingNumber == pack.number &&
|
|
|
|
r.batch == pack.batch &&
|
|
|
|
r.fromLocationCode == balance.locationCode &&
|
|
|
|
r.toInventoryStatus == balance.inventoryStatus &&
|
|
|
|
r.scaned == true) {
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
if (detail == undefined) {
|
|
|
|
let newDetail = createDetailInfo(balance, pack);
|
|
|
|
// newDetail.inventoryStatus = balance.inventoryStatus;
|
|
|
|
if (this.businessTypeCode == "Move") {
|
|
|
|
newDetail.toInventoryStatus = balance.inventoryStatus;
|
|
|
|
} else {
|
|
|
|
newDetail.toInventoryStatus = this.toInventoryStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (newDetail.packingNumber == '') {
|
|
|
|
newDetail.packingNumber = pack.number;
|
|
|
|
}
|
|
|
|
newDetail.toLocationCode = this.toLocationCode;
|
|
|
|
newDetail.fromLocationCode = result.fromLocationCode
|
|
|
|
item.subList.push(newDetail);
|
|
|
|
} else {
|
|
|
|
this.showErrorMessage("包装[" + detail.packingNumber + "]\n" +
|
|
|
|
"批次[" + detail.batch + "]\n" + "库位[" + detail.fromLocationCode + "]\n" +
|
|
|
|
"库存状态[" + getInventoryStatusName(detail.toInventoryStatus) + "]\n" +
|
|
|
|
"重复扫描")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
calcHandleQty(this.detailSource);
|
|
|
|
},
|
|
|
|
getScanResultAfterBatch(result,managementTypeParams){
|
|
|
|
var balance = result.balance;
|
|
|
|
this.balanceInfo = result.balance;
|
|
|
|
var pack = result.package;
|
|
|
|
var item = this.detailSource.find(res => {
|
|
|
|
if (res.itemCode == balance.itemCode) {
|
|
|
|
return res
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if (item == undefined) {
|
|
|
|
var itemp = createItemInfoForLabel(balance, result.label);
|
|
|
|
let newDetail = createDetailInfoForLabel(balance, pack, result.label);
|
|
|
|
|
|
|
|
// if (newDetail.packingNumber == '') {
|
|
|
|
// newDetail.packingNumber = pack.number;
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (this.businessTypeCode == "Move") {
|
|
|
|
newDetail.toInventoryStatus = balance.inventoryStatus;
|
|
|
|
} else {
|
|
|
|
newDetail.toInventoryStatus = this.toInventoryStatus;
|
|
|
|
}
|
|
|
|
newDetail.toLocationCode = this.toLocationCode;
|
|
|
|
newDetail.managementTypeParams = managementTypeParams;
|
|
|
|
newDetail.fromLocationCode = result.fromLocationCode
|
|
|
|
newDetail.handleQty = Number(result.label.qty)
|
|
|
|
itemp.subList.push(newDetail);
|
|
|
|
this.detailSource.push(itemp)
|
|
|
|
|
|
|
|
this.clearFromLocation()
|
|
|
|
this.$refs.okToHoldRecordPackRef.handleQty = 0
|
|
|
|
this.$refs.okToHoldRecordPackRef.showOne = false
|
|
|
|
} else {
|
|
|
|
var detail = ''
|
|
|
|
console.log(9988,managementTypeParams)
|
|
|
|
if(managementTypeParams == 'BY_QUANTITY'){
|
|
|
|
detail = item.subList.find(r => {
|
|
|
|
if (r.fromLocationCode == balance.locationCode &&
|
|
|
|
r.scaned == true) {
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}else if(managementTypeParams == 'BY_BATCH'){
|
|
|
|
detail = item.subList.find(r => {
|
|
|
|
if (r.batch == result.label.batch &&
|
|
|
|
r.fromLocationCode == balance.locationCode &&
|
|
|
|
r.scaned == true) {
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
console.log(detail)
|
|
|
|
if (detail == undefined) {
|
|
|
|
let newDetail = createDetailInfo(balance, pack);
|
|
|
|
// newDetail.inventoryStatus = balance.inventoryStatus;
|
|
|
|
if (this.businessTypeCode == "Move") {
|
|
|
|
newDetail.toInventoryStatus = balance.inventoryStatus;
|
|
|
|
} else {
|
|
|
|
newDetail.toInventoryStatus = this.toInventoryStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (newDetail.packingNumber == '') {
|
|
|
|
newDetail.packingNumber = pack.number;
|
|
|
|
}
|
|
|
|
newDetail.toLocationCode = this.toLocationCode;
|
|
|
|
newDetail.managementTypeParams = managementTypeParams;
|
|
|
|
newDetail.fromLocationCode = result.fromLocationCode
|
|
|
|
item.subList.push(newDetail);
|
|
|
|
this.clearFromLocation()
|
|
|
|
this.$refs.okToHoldRecordPackRef.handleQty = 0
|
|
|
|
this.$refs.okToHoldRecordPackRef.showOne = false
|
|
|
|
} else {
|
|
|
|
// console.log(999,detail.handleQty)
|
|
|
|
// detail.handleQty =calc.add(detail.handleQty, result.label.qty)
|
|
|
|
if(managementTypeParams == 'BY_QUANTITY'){
|
|
|
|
this.showErrorMessage(
|
|
|
|
"批次[]\n" + "库位[" + detail.fromLocationCode + "]\n" +
|
|
|
|
"已经存在")
|
|
|
|
}else if(managementTypeParams == 'BY_BATCH'){
|
|
|
|
this.showErrorMessage(
|
|
|
|
"批次[" + detail.batch + "]\n" + "库位[" + detail.fromLocationCode + "]\n" +
|
|
|
|
"已经存在")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
calcHandleQty(this.detailSource);
|
|
|
|
},
|
|
|
|
getInputMsgResult(result,fromWitch){
|
|
|
|
if(fromWitch == 'fromLocationScanMsg'){
|
|
|
|
this.isClearFromLocationCode = false
this.$refs.scanFromLocationCode.getScanResult(result)
}else if(fromWitch == 'itemCodeScanMsg'){
result.fromLocationCode = this.fromLocationCode
this.$refs.scanPopup.getScanResult(result)
}
|
|
|
|
},
|
|
|
|
// 清除来源库位
|
|
|
|
clearFromLocation(fromLocationCodeParams){
|
|
|
|
this.$refs.okToHoldRecordPackRef.fromLocationCode = ''
|
|
|
|
// this.$refs.okToHoldRecordPackRef.itemCode =''
|
|
|
|
// this.$refs.okToHoldRecordPackRef.batch =''
|
|
|
|
// this.isClearFromLocationCode = true
|
|
|
|
},
|
|
|
|
// 清除批次和物料
|
|
|
|
clearItemCode(label){
|
|
|
|
this.$refs.okToHoldRecordPackRef.itemCode =''
|
|
|
|
// this.$refs.okToHoldRecordPackRef.batch =''
|
|
|
|
},
|
|
|
|
|
|
|
|
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.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.showErrorMessage("请先选择目标库位")
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// if(this.fromLocationCode==this.toLocationCode){
|
|
|
|
// this.showErrorMessage("来源库位和目标库位不能一致")
|
|
|
|
// 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;
|
|
|
|
this.submit()
|
|
|
|
} else {
|
|
|
|
uni.hideLoading();
|
|
|
|
this.showErrorMessage(res.message);
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this.showErrorMessage("没有要提交的数据,请先扫描")
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
submit() {
|
|
|
|
//目标库位和状态都一致时不可以提交
|
|
|
|
var params = this.setParams()
|
|
|
|
let hint = ""
|
|
|
|
this.dataContent.subList.forEach(res => {
|
|
|
|
if (res.fromLocationCode == res.toLocationCode) {
|
|
|
|
if (res.fromInventoryStatus == res.toInventoryStatus) {
|
|
|
|
var resultHint = res.fromPackingNumber ? `包装号【${res.fromPackingNumber}】` : ""
|
|
|
|
hint += resultHint + `来源库位与目标库位 来源状态与目标状态一致,不可以提交\n`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if (hint) {
|
|
|
|
uni.hideLoading()
|
|
|
|
this.$refs.comMessage.showQuestionMessage1(hint, 'red', res => {
|
|
|
|
if (res) {}
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// if(this.balanceInfo)
|
|
|
|
console.log("提交" ,params)
|
|
|
|
let obj = params.subList.find(item=>item.balanceQty < item.handleQty)
|
|
|
|
if(obj){
|
|
|
|
this.$refs.comMessage.showConfirmWarningModal('批次[' +obj.batch + ']数量[' + obj.handleQty + ']不允许大于库存数量[' +obj.balanceQty + ']')
|
|
|
|
uni.hideLoading()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
inventoryMoveRecordSubmit(params).then(res => {
|
|
|
|
uni.hideLoading()
|
|
|
|
if (res.data) {
|
|
|
|
this.showCommitSuccessMessage("提交成功\n生成" + this.title + "\n" +
|
|
|
|
res.data)
|
|
|
|
} else {
|
|
|
|
this.showErrorMessage("提交失败[" + res.msg + "]")
|
|
|
|
}
|
|
|
|
}).catch(error => {
|
|
|
|
uni.hideLoading()
|
|
|
|
this.showErrorMessage(error)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
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
|
|
|
|
console.log(233,this.detailSource)
|
|
|
|
this.detailSource.forEach(item => {
|
|
|
|
item.subList.forEach(detail => {
|
|
|
|
if (detail.scaned) {
|
|
|
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode,
|
|
|
|
detail.packingNumber, detail.toLocationCode, detail.batch);
|
|
|
|
var submitItem = deepCopyData(detail)
|
|
|
|
submitItem.itemCode = detail.itemCode;
|
|
|
|
submitItem.itemName = detail.itemName;
|
|
|
|
submitItem.itemDesc1 = detail.itemDesc1;
|
|
|
|
submitItem.itemDesc2 = detail.itemDesc2;
|
|
|
|
|
|
|
|
submitItem.fromInventoryStatus = detail.inventoryStatus;
|
|
|
|
submitItem.toInventoryStatus = detail.toInventoryStatus;
|
|
|
|
|
|
|
|
submitItem.fromPackingNumber = info.packingNumber;
|
|
|
|
submitItem.toPackingNumber = info.packingNumber;
|
|
|
|
submitItem.packingNumber = info.packingNumber;
|
|
|
|
submitItem.fromContainerNumber = detail.containerNumber;
|
|
|
|
submitItem.toContainerNumber = detail.containerNumber
|
|
|
|
|
|
|
|
submitItem.fromBatch = info.batch;
|
|
|
|
submitItem.toBatch = info.batch;
|
|
|
|
|
|
|
|
submitItem.fromLocationCode = detail.fromLocationCode;
|
|
|
|
submitItem.toLocationCode = detail.toLocationCode;
|
|
|
|
|
|
|
|
submitItem.package = null;
|
|
|
|
submitItem.Records = null;
|
|
|
|
|
|
|
|
submitItem.qty = detail.handleQty;
|
|
|
|
|
|
|
|
subList.push(submitItem)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
this.dataContent.subList = subList;
|
|
|
|
this.dataContent.creator = creator;
|
|
|
|
this.dataContent.fromWarehouseCode = this.fromLocationInfo.warehouseCode;
|
|
|
|
this.dataContent.toWarehouseCode = this.toLocationInfo.warehouseCode;
|
|
|
|
this.dataContent.businessType = this.businessTypeCode;
|
|
|
|
return this.dataContent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|