Browse Source

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

intex
lijuncheng 2 days ago
parent
commit
b55f37367b
  1. 7
      src/common/directory.js
  2. 170
      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;
}
//获取物品类型名称
export function getItemTypeName(value) {
let location = getItemTypeInfo(value);
return location == '' ? value : location.label;
}
//获取库位类型名称
export function getLocationTypeName(value) {

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

@ -11,8 +11,7 @@
<view class="">
<com-move-record-card :dataContent="item" :index="index" @removeData="removeData"
:isShowStatus="isShowStatus" @updateData="updateData" @removePack='removePack'
:allowEditQty="true"
:allowEditStatus="allowEditStatus" >
:allowEditQty="true" :allowEditStatus="allowEditStatus">
</com-move-record-card>
</view>
</view>
@ -35,8 +34,11 @@
<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="'箱码'" >
<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>
@ -60,10 +62,14 @@
import {
inventoryMoveRecordSubmit,
getBasicLocationByCode,
getBasicItemByCode
} from '@/api/request2.js';
import {
getDirectoryItemArray
getDirectoryItemArray,
getItemTypeName,
checkDirectoryItemExist,
getListItemTypeDesc
} from '@/common/directory.js';
import {
@ -72,7 +78,7 @@
import {
getPackingNumberAndBatchByList,
deepCopyData
deepCopyData,
} from '@/common/basic.js';
import {
@ -148,8 +154,9 @@
dataContent: {},
fromLocationAreaTypeList: [],
toLocationAreaTypeList: [],
itemCodeTypeList: [],
isShowEditLocation: false,
isJustReplay:true,//
isJustReplay: true, //
}
},
@ -157,6 +164,7 @@
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.itemCodeTypeList = res.itemCodeTypeList;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.showPopup()
@ -249,80 +257,122 @@
this.$refs.scanFromLocationCode.openScanPopup();
},
showPopup() {
setTimeout(()=>{
if(this.showOnePop){
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{
} else {
this.$refs.scanFromLocationCode.openScanPopup();
}
},200)
}, 200)
},
getFromLocation(location) {
this.fromLocationCode = location.code;
this.$refs.okToHoldRecordPackRef.fromLocationCode = location.code
this.fromLocationInfo = location;
if(!this.showOnePop){
if (!this.showOnePop) {
this.openScanPopup();
}else{
this.itemCode =''
this.batch =''
} else {
this.itemCode = ''
this.batch = ''
}
},
getToLocation(location, code) {
this.toLocationCode = code;
this.toLocationInfo = location;
},
getScanResult(result,managementTypeParams) {
getScanResult(result, managementTypeParams) {
this.managementType = managementTypeParams
if(this.showOnePop){
if(this.isJustReplay){
this.$refs.okToHoldRecordPackRef.itemCode= result.label.itemCode
if (this.showOnePop) {
if (this.isJustReplay) {
this.$refs.okToHoldRecordPackRef.itemCode = result.label.itemCode
this.$refs.okToHoldRecordPackRef.batch = result.label.batch
this.getResult = result//
this.getResult = result //
this.$refs.scanPopup.closeScanPopup()
}else{
this.getScanResultAfterBatch(result,managementTypeParams)
} else {
this.getScanResultAfterBatch(result, managementTypeParams)
}
}else{
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
this.getScanResultAfterBatch(result,managementTypeParams)
}else{
this.getScanResultAfter(result,managementTypeParams)
} else {
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.getScanResultAfterBatch(result, managementTypeParams)
} else {
this.getScanResultAfter(result, managementTypeParams)
}
}
},
okToHoldRecordPackConfirm(obj){
okToHoldRecordPackConfirm(obj) {
// this.getResult. = result//
if(!obj.fromLocationCode){
if (!obj.fromLocationCode) {
this.$refs.comMessage.showErrorMessage('请输入来源库位');
return;
}
if(!obj.itemCode){
if (!obj.itemCode) {
this.$refs.comMessage.showErrorMessage('请输入零件');
return;
}
if(!obj.handleQty){
if (!obj.handleQty) {
this.$refs.comMessage.showErrorMessage('请输入数量');
return;
}
this.checkItemCode(obj.itemCode, callBack => {
if (callBack) {
if (checkDirectoryItemExist(this.itemCodeTypeList, callBack)) {
this.getResult = this.getResult ? this.getResult : {
label:{},
fromLocationCode:''
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)
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 + '】');
}
})
},
getScanResultAfter(result){
//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
}
return true
},
getScanResultAfter(result) {
var balance = result.balance;
var pack = result.package;
var item = this.detailSource.find(res => {
@ -382,7 +432,7 @@
}
calcHandleQty(this.detailSource);
},
getScanResultAfterBatch(result,managementTypeParams){
getScanResultAfterBatch(result, managementTypeParams) {
var balance = result.balance;
this.balanceInfo = result.balance;
var pack = result.package;
@ -392,13 +442,14 @@
}
})
// 0
if(!balance.qty){
if (!balance.qty) {
this.$refs.comMessage.showConfirmWarningModal("物料号[" + result.label.itemCode + "]库存余额数量是0")
return
}
//
if(result.label.qty > balance.qty){
this.$refs.comMessage.showConfirmWarningModal("物料号[" + result.label.itemCode + "]数量[" + result.label.qty + "]不可以大于库存余额数量[" + balance.qty + "]")
if (result.label.qty > balance.qty) {
this.$refs.comMessage.showConfirmWarningModal("物料号[" + result.label.itemCode + "]数量[" + result.label
.qty + "]不可以大于库存余额数量[" + balance.qty + "]")
return
}
if (item == undefined) {
@ -429,14 +480,14 @@
this.$refs.okToHoldRecordPackRef.showOne = false
} else {
var detail = ''
if(managementTypeParams == 'BY_QUANTITY'){
if (managementTypeParams == 'BY_QUANTITY') {
detail = item.subList.find(r => {
if (r.fromLocationCode == balance.locationCode &&
r.scaned == true) {
return r;
}
})
}else if(managementTypeParams == 'BY_BATCH'){
} else if (managementTypeParams == 'BY_BATCH') {
detail = item.subList.find(r => {
if (r.batch == result.label.batch &&
r.fromLocationCode == balance.locationCode &&
@ -472,33 +523,39 @@
} else {
// console.log(999,detail.handleQty)
// detail.handleQty =calc.add(detail.handleQty, result.label.qty)
if(managementTypeParams == 'BY_QUANTITY'){
if (managementTypeParams == 'BY_QUANTITY') {
this.showErrorMessage(
"物料号[" + item.itemCode + "]\n" + "批次[]\n" + "库位[" + detail.fromLocationCode + "]\n" +
"已经存在")
}else if(managementTypeParams == 'BY_BATCH'){
} else if (managementTypeParams == 'BY_BATCH') {
this.showErrorMessage(
"物料号[" + item.itemCode + "]\n" + "批次[" + detail.batch + "]\n" + "库位[" + detail.fromLocationCode + "]\n" +
"物料号[" + item.itemCode + "]\n" + "批次[" + 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) }
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){
clearFromLocation(fromLocationCodeParams) {
this.$refs.okToHoldRecordPackRef.fromLocationCode = ''
// this.$refs.okToHoldRecordPackRef.itemCode =''
// this.$refs.okToHoldRecordPackRef.batch =''
// this.isClearFromLocationCode = true
},
//
clearItemCode(label){
this.$refs.okToHoldRecordPackRef.itemCode =''
clearItemCode(label) {
this.$refs.okToHoldRecordPackRef.itemCode = ''
// this.$refs.okToHoldRecordPackRef.batch =''
},
@ -611,10 +668,11 @@
return;
}
// if(this.balanceInfo)
console.log("提交" ,params)
let obj = params.subList.find(item=>item.balanceQty < item.handleQty)
if(obj){
this.$refs.comMessage.showConfirmWarningModal('物料号[' +obj.itemCode + ']批次[' +obj.batch + ']数量[' + obj.handleQty + ']不允许大于库存数量[' +obj.balanceQty + ']')
console.log("提交", params)
let obj = params.subList.find(item => item.balanceQty < item.handleQty)
if (obj) {
this.$refs.comMessage.showConfirmWarningModal('物料号[' + obj.itemCode + ']批次[' + obj.batch + ']数量[' + obj
.handleQty + ']不允许大于库存数量[' + obj.balanceQty + ']')
uni.hideLoading()
return
}
@ -661,7 +719,7 @@
setParams() {
var subList = []
var creator = this.$store.state.user.id
console.log(233,this.detailSource)
console.log(233, this.detailSource)
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {

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

@ -38,7 +38,7 @@
<view class="item">
<view class="label">数量</view>
<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>
</view>

Loading…
Cancel
Save