Browse Source

修改直接补料查询库存

hella_online_20240829
lijuncheng 4 months ago
parent
commit
98374b342e
  1. 189
      src/pages/repleinsh/record/directRepleinshRecord.vue

189
src/pages/repleinsh/record/directRepleinshRecord.vue

@ -2,11 +2,11 @@
<view class="page-wraper"> <view class="page-wraper">
<view class=""> <view class="">
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view> <com-blank-view @goScan='getBusinessType' v-if="detailSource.length==0"></com-blank-view>
</view> </view>
<view class="page-wraper" v-if="detailSource.length>0"> <view class="page-wraper" v-if="detailSource.length>0">
<view class="page-header"> <view class="page-header">
<view class="header_item"> <view class="header_item" style="font-size:35rpx; padding: 10rpx;" >
来源库位 : {{fromLocationCode}} 来源库位 : {{fromLocationCode}}
</view> </view>
<u-line /> <u-line />
@ -40,12 +40,9 @@
</view> </view>
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
</view> </view>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false' :queryBalance="false"> <winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</win-scan-pack-and-location> </winComScanBalance>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
</view> </view>
</template> </template>
@ -94,7 +91,7 @@
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
export default { export default {
components: { components: {
@ -105,7 +102,7 @@
winScanLocation, winScanLocation,
winScanPackAndLocation, winScanPackAndLocation,
recordComDetailCard, recordComDetailCard,
balanceSelect winComScanBalance
}, },
data() { data() {
return { return {
@ -123,21 +120,13 @@
fromWarehouseCode: '', // fromWarehouseCode: '', //
businessTypeCode: "Repleinment", businessTypeCode: "Repleinment",
toLocationCode:"", toLocationCode:"",
resultData:{} resultData:{},
itemCode:""
}; };
}, },
onLoad(option) { onLoad(option) {
this.clear(); this.clear();
getBusinessType(this.businessTypeCode, res => { this.getBusinessType()
if (res.success) {
this.businessType = res.businessType;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.showFromLocationPopup();
} else {
this.showErrorMessage(res.message)
}
});
}, },
// //
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {
@ -153,6 +142,18 @@
mounted() {}, mounted() {},
methods: { methods: {
getBusinessType(){
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType=res.businessType;
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses);
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
this.openScanPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
getBalance(label, packageInfo, callback) { getBalance(label, packageInfo, callback) {
var filters = [] var filters = []
@ -201,122 +202,47 @@
this.showErrorMessage(err.message); this.showErrorMessage(err.message);
}) })
}, },
getScanResult(result) {
this.resultData=result;
let packageInfo = result.package;
this.getBalance(result.label, packageInfo, balances =>{
//
let s = '';
if (!result.package.parentNumber) {
if (balances.list.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
let newBalances = balances.list.filter(b => b.locationCode == this
.fromLocationCode);
if (newBalances.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else if (newBalances.length == 1) {
let balance = newBalances[0];
result.balance=balance;
this.afterGetBalance(result);
} else {
this.showBalanceSelect(newBalances);
}
}
} else {
//
if (balances.list.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
//
let subPackitems = balances.list.filter(r => r.packingNumber == packageInfo
.number)
//
let subParentPackitems = balances.list.filter(r => r.packingNumber ==
packageInfo
.parentNumber&&r.locationCode==this.fromLocationCode)
//
if (subPackitems.length == 0) {
//
if (subParentPackitems.length > 0) {
if(subParentPackitems.length==1){
let balance = subParentPackitems[0];
balance.qty=packageInfo.qty;
result.balance =balance;
this.afterGetBalance(result);
}else {
this.showBalanceSelect(subParentPackitems);
}
} else {
this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' +
packageInfo.number + '】都未查找到库存余额')
}
} else {
var locationCode = this.fromLocationCode
if(balances.list==1){
locationCode=balances.list[0].locationCode
}else {
var manyBlances = balances.list.filter(r=>r.locationCode!=this.fromLocationCode)
if(manyBlances.length>0){
locationCode = manyBlances[0].locationCode;
}
}
this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' +
locationCode +
'】已经有库存余额,请重新扫描')
}
} getScanResult(result) {
} this.setData(result);
})
},
showBalanceSelect(items) {
this.$refs.balanceSelect.openPopup(items);
},
selectBalanceItem(balance) {
this.resultData.balance =balance;
this.afterGetBalance(this.resultData);
}, },
afterGetBalance(result){ setData(result) {
let balance = result.balance; let balance = result.balance;
let label = result.label; let label = result.label;
let pack = result.package; let pack = result.package;
let packUnit = pack.packUnit; if(this.fromLocationCode&&this.fromLocationCode!=balance.locationCode){
let packQty =pack.packQty this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位["+this.fromLocationCode+"]没有库存余额")
return;
}
var item = this.detailSource.find(res => { var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) { if (res.itemCode == balance.itemCode) {
return res return res
} }
}) })
if (item == undefined) {
if (this.itemCode != "" && this.itemCode != balance.itemCode) {
this.showErrorMessage("请扫描物料为【" + this.itemCode + "】的箱码")
return;
}
if (this.fromWarehouseCode == '') { if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode; this.fromWarehouseCode = balance.warehouseCode;
} }
if (item == undefined) {
var itemp = createItemInfo(balance, pack); var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); // let newDetail = createDetailInfo(balance, pack); //
newDetail.parentNumber =pack.parentNumber; newDetail.parentNumber =pack.parentNumber;
newDetail.packingNumber =pack.number newDetail.packingNumber =pack.number
newDetail.packUnit =packUnit; newDetail.packUnit =pack.packUnit;
newDetail.packQty=packQty; newDetail.packQty=pack.packQty;
itemp.subList.push(newDetail); itemp.subList.push(newDetail);
this.detailSource.push(itemp) this.detailSource.push(itemp)
calcHandleQty(this.detailSource); this.itemCode = balance.itemCode;
this.fromLocationCode =balance.locationCode
this.scanPopupGetFocus()
} else { } else {
var detail = item.subList.find(r => { var detail = item.subList.find(r => {
if (r.packingNumber == pack.number && if (r.packingNumber == balance.packingNumber &&
r.batch == balance.batch && r.batch == balance.batch &&
r.locationCode == balance.locationCode && r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) { r.inventoryStatus == balance.inventoryStatus) {
@ -327,18 +253,21 @@
let newDetail = createDetailInfo(balance, pack); let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber =pack.parentNumber; newDetail.parentNumber =pack.parentNumber;
newDetail.packingNumber =pack.number newDetail.packingNumber =pack.number
newDetail.packUnit =packUnit; newDetail.packUnit =pack.packUnit;
newDetail.packQty=packQty; newDetail.packQty=pack.packQty;
item.subList.push(newDetail); item.subList.push(newDetail);
calcHandleQty(this.detailSource); this.scanPopupGetFocus()
} else { } else {
if (detail.scaned == true) { if (detail.scaned == true) {
this.showErrorMessage("箱码[" + detail.packingNumber + "]批次[" + balance.batch + "]已经在列表中") this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中")
} }
} }
} }
calcHandleQty(this.detailSource);
}, },
showErrorMessage(message) { showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => { this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {} if (res) {}
@ -374,27 +303,22 @@
}, },
openScanPopup() { openScanPopup() {
if (this.fromLocationCode == "") { if(this.businessType){
this.showFromLocationPopup(); this.$refs.scanPopup.openScanPopup(this.businessType);
return }else {
this.getBusinessType()
} }
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
}, },
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanLocationCode.openScanPopup();
})
},
closeScanPopup() { closeScanPopup() {
if (this.$refs.scanPopup != undefined) { if (this.$refs.scanPopup) {
this.$refs.scanPopup.closeScanPopup(); this.$refs.scanPopup.closeScanPopup();
} }
}, },
scanPopupGetFocus() { scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) { if (this.$refs.scanPopup) {
this.$refs.scanPopup.getfocus(); this.$refs.scanPopup.getfocus();
} }
}, },
@ -522,13 +446,6 @@
closeScanMessage() { closeScanMessage() {
this.scanPopupGetFocus(); this.scanPopupGetFocus();
}, },
getLocation(location, code) {
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationCode = code;
this.openScanPopup();
},
getToLocationCode(location, code) { getToLocationCode(location, code) {
if (this.fromLocationCode == code) { if (this.fromLocationCode == code) {
uni.showToast({ uni.showToast({

Loading…
Cancel
Save