Browse Source

YT-1124 直接物料隔离,校验物料是否在业务类型里

intex
lijuncheng 2 days ago
parent
commit
b55f37367b
  1. 7
      src/common/directory.js
  2. 200
      src/pages/inventoryMove/coms/comMoveRecord.vue
  3. 2
      src/pages/inventoryMove/coms/okToHoldRecordPack.vue

7
src/common/directory.js

@ -304,6 +304,13 @@ export function getLocationAreaTypeName(value) {
return location == '' ? value : location.label; return location == '' ? value : location.label;
} }
//获取物品类型名称
export function getItemTypeName(value) {
let location = getItemTypeInfo(value);
return location == '' ? value : location.label;
}
//获取库位类型名称 //获取库位类型名称
export function getLocationTypeName(value) { export function getLocationTypeName(value) {

200
src/pages/inventoryMove/coms/comMoveRecord.vue

@ -11,8 +11,7 @@
<view class=""> <view class="">
<com-move-record-card :dataContent="item" :index="index" @removeData="removeData" <com-move-record-card :dataContent="item" :index="index" @removeData="removeData"
:isShowStatus="isShowStatus" @updateData="updateData" @removePack='removePack' :isShowStatus="isShowStatus" @updateData="updateData" @removePack='removePack'
:allowEditQty="true" :allowEditQty="true" :allowEditStatus="allowEditStatus">
:allowEditStatus="allowEditStatus" >
</com-move-record-card> </com-move-record-card>
</view> </view>
</view> </view>
@ -35,8 +34,11 @@
<win-scan-button @goScan='showPopup'></win-scan-button> <win-scan-button @goScan='showPopup'></win-scan-button>
</view> </view>
<!-- 合格转隔离单独的弹窗--> <!-- 合格转隔离单独的弹窗-->
<okToHoldRecordPack ref="okToHoldRecordPackRef" :showOnePop='showOnePop' @showFromLocationPopup='showFromLocationPopup' @itemCodeClick='openScanPopup' @confirm='okToHoldRecordPackConfirm' @getInputMsgResult="getInputMsgResult" @itemCodeScanMsg='itemCodeScanMsg' ></okToHoldRecordPack> <okToHoldRecordPack ref="okToHoldRecordPackRef" :showOnePop='showOnePop'
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :title="'箱码'" > @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-pack-and-location>
<win-scan-location ref="scanFromLocationCode" title="来源库位" @getLocation='getFromLocation' <win-scan-location ref="scanFromLocationCode" title="来源库位" @getLocation='getFromLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
@ -60,10 +62,14 @@
import { import {
inventoryMoveRecordSubmit, inventoryMoveRecordSubmit,
getBasicLocationByCode, getBasicLocationByCode,
getBasicItemByCode
} from '@/api/request2.js'; } from '@/api/request2.js';
import { import {
getDirectoryItemArray getDirectoryItemArray,
getItemTypeName,
checkDirectoryItemExist,
getListItemTypeDesc
} from '@/common/directory.js'; } from '@/common/directory.js';
import { import {
@ -72,7 +78,7 @@
import { import {
getPackingNumberAndBatchByList, getPackingNumberAndBatchByList,
deepCopyData deepCopyData,
} from '@/common/basic.js'; } from '@/common/basic.js';
import { import {
@ -148,8 +154,9 @@
dataContent: {}, dataContent: {},
fromLocationAreaTypeList: [], fromLocationAreaTypeList: [],
toLocationAreaTypeList: [], toLocationAreaTypeList: [],
itemCodeTypeList: [],
isShowEditLocation: false, isShowEditLocation: false,
isJustReplay:true,// isJustReplay: true, //
} }
}, },
@ -157,6 +164,7 @@
getBusinessType(this.businessTypeCode, res => { getBusinessType(this.businessTypeCode, res => {
if (res.success) { if (res.success) {
this.businessType = res.businessType; this.businessType = res.businessType;
this.itemCodeTypeList = res.itemCodeTypeList;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; this.fromLocationAreaTypeList = res.fromLocationAreaTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList; this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.showPopup() this.showPopup()
@ -249,80 +257,122 @@
this.$refs.scanFromLocationCode.openScanPopup(); this.$refs.scanFromLocationCode.openScanPopup();
}, },
showPopup() { showPopup() {
setTimeout(()=>{ setTimeout(() => {
if(this.showOnePop){ if (this.showOnePop) {
this.$refs.okToHoldRecordPackRef.fromLocationCode = '' this.$refs.okToHoldRecordPackRef.fromLocationCode = ''
this.$refs.okToHoldRecordPackRef.itemCode = '' this.$refs.okToHoldRecordPackRef.itemCode = ''
this.$refs.okToHoldRecordPackRef.batch = '' this.$refs.okToHoldRecordPackRef.batch = ''
this.$refs.okToHoldRecordPackRef.handleQty = 0 this.$refs.okToHoldRecordPackRef.handleQty = 0
this.$refs.okToHoldRecordPackRef.showOne = true this.$refs.okToHoldRecordPackRef.showOne = true
}else{ } else {
this.$refs.scanFromLocationCode.openScanPopup(); this.$refs.scanFromLocationCode.openScanPopup();
} }
},200) }, 200)
}, },
getFromLocation(location) { getFromLocation(location) {
this.fromLocationCode = location.code; this.fromLocationCode = location.code;
this.$refs.okToHoldRecordPackRef.fromLocationCode = location.code this.$refs.okToHoldRecordPackRef.fromLocationCode = location.code
this.fromLocationInfo = location; this.fromLocationInfo = location;
if(!this.showOnePop){ if (!this.showOnePop) {
this.openScanPopup(); this.openScanPopup();
}else{ } else {
this.itemCode ='' this.itemCode = ''
this.batch ='' this.batch = ''
} }
}, },
getToLocation(location, code) { getToLocation(location, code) {
this.toLocationCode = code; this.toLocationCode = code;
this.toLocationInfo = location; this.toLocationInfo = location;
}, },
getScanResult(result,managementTypeParams) { getScanResult(result, managementTypeParams) {
this.managementType = managementTypeParams this.managementType = managementTypeParams
if(this.showOnePop){ if (this.showOnePop) {
if(this.isJustReplay){ if (this.isJustReplay) {
this.$refs.okToHoldRecordPackRef.itemCode= result.label.itemCode this.$refs.okToHoldRecordPackRef.itemCode = result.label.itemCode
this.$refs.okToHoldRecordPackRef.batch = result.label.batch this.$refs.okToHoldRecordPackRef.batch = result.label.batch
this.getResult = result// this.getResult = result //
this.$refs.scanPopup.closeScanPopup() this.$refs.scanPopup.closeScanPopup()
}else{ } else {
this.getScanResultAfterBatch(result,managementTypeParams) this.getScanResultAfterBatch(result, managementTypeParams)
} }
}else{ } else {
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){ if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.getScanResultAfterBatch(result,managementTypeParams) this.getScanResultAfterBatch(result, managementTypeParams)
}else{ } else {
this.getScanResultAfter(result,managementTypeParams) this.getScanResultAfter(result, managementTypeParams)
} }
} }
}, },
okToHoldRecordPackConfirm(obj){ okToHoldRecordPackConfirm(obj) {
// this.getResult. = result// // this.getResult. = result//
if(!obj.fromLocationCode){ if (!obj.fromLocationCode) {
this.$refs.comMessage.showErrorMessage('请输入来源库位'); this.$refs.comMessage.showErrorMessage('请输入来源库位');
return; return;
} }
if(!obj.itemCode){ if (!obj.itemCode) {
this.$refs.comMessage.showErrorMessage('请输入零件'); this.$refs.comMessage.showErrorMessage('请输入零件');
return; return;
} }
if(!obj.handleQty){ if (!obj.handleQty) {
this.$refs.comMessage.showErrorMessage('请输入数量'); this.$refs.comMessage.showErrorMessage('请输入数量');
return; return;
} }
this.getResult = this.getResult ? this.getResult : {
label:{}, this.checkItemCode(obj.itemCode, callBack => {
fromLocationCode:''
if (callBack) {
if (checkDirectoryItemExist(this.itemCodeTypeList, callBack)) {
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)
} else {
var hint = getListItemTypeDesc(this.itemCodeTypeList);
this.showErrorMessage("扫描物料[" + obj.itemCode + "]是[" +
getItemTypeName(callBack) + "],需要的物料类型是[" + hint + "]")
}
} else {
this.showErrorMessage('未查找到物料【' + obj.itemCode + '】');
}
})
},
//checkItemCode
checkItemCode(itemCode, callBack) {
getBasicItemByCode(itemCode).then(res => {
if (res.data.list.length > 0) {
var itemType = res.data.list[0].type
callBack(itemType)
} else {
callBack(null)
}
}).catch(error => {
callBack(null)
})
},
isInItemCodeTypeList(itemType) {
var item = this.itemCodeTypeList.find(res => res == itemType)
if (item = undefined) {
return false
} }
this.getResult.fromLocationCode = obj.fromLocationCode return true
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){
getScanResultAfter(result) {
var balance = result.balance; var balance = result.balance;
var pack = result.package; var pack = result.package;
var item = this.detailSource.find(res => { var item = this.detailSource.find(res => {
@ -382,7 +432,7 @@
} }
calcHandleQty(this.detailSource); calcHandleQty(this.detailSource);
}, },
getScanResultAfterBatch(result,managementTypeParams){ getScanResultAfterBatch(result, managementTypeParams) {
var balance = result.balance; var balance = result.balance;
this.balanceInfo = result.balance; this.balanceInfo = result.balance;
var pack = result.package; var pack = result.package;
@ -392,13 +442,14 @@
} }
}) })
// 0 // 0
if(!balance.qty){ if (!balance.qty) {
this.$refs.comMessage.showConfirmWarningModal("物料号[" + result.label.itemCode + "]库存余额数量是0") this.$refs.comMessage.showConfirmWarningModal("物料号[" + result.label.itemCode + "]库存余额数量是0")
return return
} }
// //
if(result.label.qty > balance.qty){ if (result.label.qty > balance.qty) {
this.$refs.comMessage.showConfirmWarningModal("物料号[" + result.label.itemCode + "]数量[" + result.label.qty + "]不可以大于库存余额数量[" + balance.qty + "]") this.$refs.comMessage.showConfirmWarningModal("物料号[" + result.label.itemCode + "]数量[" + result.label
.qty + "]不可以大于库存余额数量[" + balance.qty + "]")
return return
} }
if (item == undefined) { if (item == undefined) {
@ -429,14 +480,14 @@
this.$refs.okToHoldRecordPackRef.showOne = false this.$refs.okToHoldRecordPackRef.showOne = false
} else { } else {
var detail = '' var detail = ''
if(managementTypeParams == 'BY_QUANTITY'){ if (managementTypeParams == 'BY_QUANTITY') {
detail = item.subList.find(r => { detail = item.subList.find(r => {
if (r.fromLocationCode == balance.locationCode && if (r.fromLocationCode == balance.locationCode &&
r.scaned == true) { r.scaned == true) {
return r; return r;
} }
}) })
}else if(managementTypeParams == 'BY_BATCH'){ } else if (managementTypeParams == 'BY_BATCH') {
detail = item.subList.find(r => { detail = item.subList.find(r => {
if (r.batch == result.label.batch && if (r.batch == result.label.batch &&
r.fromLocationCode == balance.locationCode && r.fromLocationCode == balance.locationCode &&
@ -447,7 +498,7 @@
} }
console.log(detail) console.log(detail)
if (detail == undefined) { if (detail == undefined) {
let newDetail = createDetailInfoForLabel(balance, pack, result.label); let newDetail = createDetailInfoForLabel(balance, pack, result.label);
// newDetail.inventoryStatus = balance.inventoryStatus; // newDetail.inventoryStatus = balance.inventoryStatus;
if (this.businessTypeCode == "Move") { if (this.businessTypeCode == "Move") {
newDetail.toInventoryStatus = balance.inventoryStatus; newDetail.toInventoryStatus = balance.inventoryStatus;
@ -471,35 +522,41 @@
this.$refs.okToHoldRecordPackRef.showOne = false this.$refs.okToHoldRecordPackRef.showOne = false
} else { } else {
// console.log(999,detail.handleQty) // console.log(999,detail.handleQty)
// detail.handleQty =calc.add(detail.handleQty, result.label.qty) // detail.handleQty =calc.add(detail.handleQty, result.label.qty)
if(managementTypeParams == 'BY_QUANTITY'){ if (managementTypeParams == 'BY_QUANTITY') {
this.showErrorMessage( this.showErrorMessage(
"物料号[" + item.itemCode + "]\n" + "批次[]\n" + "库位[" + detail.fromLocationCode + "]\n" + "物料号[" + item.itemCode + "]\n" + "批次[]\n" + "库位[" + detail.fromLocationCode + "]\n" +
"已经存在") "已经存在")
}else if(managementTypeParams == 'BY_BATCH'){ } else if (managementTypeParams == 'BY_BATCH') {
this.showErrorMessage( this.showErrorMessage(
"物料号[" + item.itemCode + "]\n" + "批次[" + detail.batch + "]\n" + "库位[" + detail.fromLocationCode + "]\n" + "物料号[" + item.itemCode + "]\n" + "批次[" + detail.batch + "]\n" + "库位[" + detail
"已经存在") .fromLocationCode + "]\n" +
} "已经存在")
}
} }
} }
calcHandleQty(this.detailSource); calcHandleQty(this.detailSource);
}, },
getInputMsgResult(result,fromWitch){ getInputMsgResult(result, fromWitch) {
if(fromWitch == 'fromLocationScanMsg'){ if (fromWitch == 'fromLocationScanMsg') {
this.isClearFromLocationCode = false this.$refs.scanFromLocationCode.getScanResult(result) }else if(fromWitch == 'itemCodeScanMsg'){ result.fromLocationCode = this.fromLocationCode this.$refs.scanPopup.getScanResult(result) } this.isClearFromLocationCode = false
this.$refs.scanFromLocationCode.getScanResult(result)
} else if (fromWitch == 'itemCodeScanMsg') {
result.fromLocationCode = this.fromLocationCode
this.$refs.scanPopup.getScanResult(result)
}
}, },
// //
clearFromLocation(fromLocationCodeParams){ clearFromLocation(fromLocationCodeParams) {
this.$refs.okToHoldRecordPackRef.fromLocationCode = '' this.$refs.okToHoldRecordPackRef.fromLocationCode = ''
// this.$refs.okToHoldRecordPackRef.itemCode ='' // this.$refs.okToHoldRecordPackRef.itemCode =''
// this.$refs.okToHoldRecordPackRef.batch ='' // this.$refs.okToHoldRecordPackRef.batch =''
// this.isClearFromLocationCode = true // this.isClearFromLocationCode = true
}, },
// //
clearItemCode(label){ clearItemCode(label) {
this.$refs.okToHoldRecordPackRef.itemCode ='' this.$refs.okToHoldRecordPackRef.itemCode = ''
// this.$refs.okToHoldRecordPackRef.batch ='' // this.$refs.okToHoldRecordPackRef.batch =''
}, },
showErrorMessage(message) { showErrorMessage(message) {
@ -611,10 +668,11 @@
return; return;
} }
// if(this.balanceInfo) // if(this.balanceInfo)
console.log("提交" ,params) console.log("提交", params)
let obj = params.subList.find(item=>item.balanceQty < item.handleQty) let obj = params.subList.find(item => item.balanceQty < item.handleQty)
if(obj){ if (obj) {
this.$refs.comMessage.showConfirmWarningModal('物料号[' +obj.itemCode + ']批次[' +obj.batch + ']数量[' + obj.handleQty + ']不允许大于库存数量[' +obj.balanceQty + ']') this.$refs.comMessage.showConfirmWarningModal('物料号[' + obj.itemCode + ']批次[' + obj.batch + ']数量[' + obj
.handleQty + ']不允许大于库存数量[' + obj.balanceQty + ']')
uni.hideLoading() uni.hideLoading()
return return
} }
@ -661,7 +719,7 @@
setParams() { setParams() {
var subList = [] var subList = []
var creator = this.$store.state.user.id var creator = this.$store.state.user.id
console.log(233,this.detailSource) console.log(233, this.detailSource)
this.detailSource.forEach(item => { this.detailSource.forEach(item => {
item.subList.forEach(detail => { item.subList.forEach(detail => {
if (detail.scaned) { if (detail.scaned) {

2
src/pages/inventoryMove/coms/okToHoldRecordPack.vue

@ -38,7 +38,7 @@
<view class="item"> <view class="item">
<view class="label">数量</view> <view class="label">数量</view>
<view class="value1"> <view class="value1">
<u-number-box v-model="handleQty" @change="valChange"></u-number-box> <u-number-box v-model="handleQty" ></u-number-box>
<view class="uom">EA</view> <view class="uom">EA</view>
</view> </view>
</view> </view>

Loading…
Cancel
Save