Browse Source

直接发料不扫描来源库位 2024/8/8

pull/1/head
王志国 3 months ago
parent
commit
ac5f44c92c
  1. 7
      src/mycomponents/record/recordComDetailCard.vue
  2. 299
      src/pages/issue/record/directIssue.vue
  3. 718
      src/pages/issue/record/directIssue2.vue

7
src/mycomponents/record/recordComDetailCard.vue

@ -7,7 +7,7 @@
<item-qty :dataContent="dataContent" :isShowBalance="true" :isShowBalanceQty="isShowBalanceQty"></item-qty> <item-qty :dataContent="dataContent" :isShowBalance="true" :isShowBalanceQty="isShowBalanceQty"></item-qty>
<view style="margin-left: 10px; margin-top: 5px;"> <view style="margin-left: 10px; margin-top: 5px;">
<pack title='父包装' :packingCode='dataContent.containerNumber'></pack> <pack title='父包装' :packingCode='dataContent.containerNumber'></pack>
<location title='目标库位' :locationCode='dataContent.toLocationCode'></location> <location v-if="isShowParentToLocation" title='目标库位' :locationCode='dataContent.toLocationCode'></location>
</view> </view>
</u-swipe-action> </u-swipe-action>
</template> </template>
@ -57,7 +57,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: true default: true
}, },
isShowParentToLocation: {
type: Boolean,
default: true
},
isShowBalanceQty: { isShowBalanceQty: {
type: Boolean, type: Boolean,
default: false default: false

299
src/pages/issue/record/directIssue.vue

@ -1,7 +1,7 @@
<template> <template>
<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">
@ -13,7 +13,7 @@
<scroll-view scroll-y="true" class="page-main-scroll"> <scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> <view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class=""> <view class="">
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" :isShowFromLocation="false" @removeItem="removeItem(index, item)" :isShowToLocation="false" @updateData="updateData" @removePack="removePack"> </record-com-detail-card> <record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" :isShowFromLocation="false" @removeItem="removeItem(index, item)" :isShowToLocation="false" :isShowParentToLocation="false" @updateData="updateData" @removePack="removePack"> </record-com-detail-card>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@ -36,10 +36,8 @@
</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"> </win-scan-pack-and-location> <winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode"></winComScanBalance>
<com-message ref="comMessageRef" :queryBalance="false" /> <com-message ref="comMessageRef" :queryBalance="false" />
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation="getLocation" :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<balance-select ref="balanceSelectRef" @onSelectItem="selectBalanceItem"></balance-select>
</view> </view>
</template> </template>
@ -67,6 +65,7 @@ import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.v
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import { useCountStore } from '@/store' import { useCountStore } from '@/store'
// store // store
const store = useCountStore() const store = useCountStore()
@ -104,22 +103,24 @@ const fgLocationCode = ref('')
const managementList = ref([]) const managementList = ref([])
const resultData = ref({}) const resultData = ref({})
const balanceSelectRef = ref() const balanceSelectRef = ref()
const itemCode = ref('')
const fromInventoryStatuses = ref('')
onLoad((option) => { onLoad((option) => {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: option.title title: option.title
}) })
clearData() clearData()
getBusinessType(businessTypeCode.value, (res) => { getBusinessType()
if (res.success) { // getBusinessType(businessTypeCode.value, (res) => {
businessType.value = res.businessType // if (res.success) {
fromLocationAreaTypeList.value = res.fromLocationAreaTypeList // businessType.value = res.businessType
toLocationAreaTypeList.value = res.toLocationAreaTypeList // fromLocationAreaTypeList.value = res.fromLocationAreaTypeList
showFromLocationPopup() // toLocationAreaTypeList.value = res.toLocationAreaTypeList
} else { // showFromLocationPopup()
showErrorMessage(res.message) // } else {
} // showErrorMessage(res.message)
}) // }
// })
// if (this.positionList.length == 0) { // if (this.positionList.length == 0) {
getWorkShopLineStation() getWorkShopLineStation()
@ -135,218 +136,95 @@ onLoad((option) => {
}) })
// } // }
}) })
// //
onNavigationBarButtonTap((e) => { onNavigationBarButtonTap((e) => {
if (e.index === 0) { if (e.index === 0) {
goHome() goHome()
} }
}) })
const getBalance = (label, packageInfo, callback) => { const getBusinessType = ()=> {
const filters = [] getBusinessType(businessTypeCode.value, res => {
if (res.success) {
if (packageInfo.parentNumber) { businessType.value = res.businessType;
const packingNumber = `${packageInfo.parentNumber},${label.packingNumber}` fromInventoryStatuses.value = getDirectoryItemArray(res.fromInventoryStatuses);
filters.push({ fromLocationAreaTypeList.value = res.fromLocationAreaTypeList
column: 'packingNumber', openScanPopup();
action: 'in',
value: packingNumber
})
} else {
filters.push({
column: 'packingNumber',
action: '==',
value: label.packingNumber
})
}
filters.push({
column: 'itemCode',
action: '==',
value: label.itemCode
})
filters.push({
column: 'batch',
action: '==',
value: label.batch
})
if (fromInventoryStatuses.value != null && fromInventoryStatuses.value != '') {
filters.push({
column: 'inventoryStatus',
action: 'in',
value: fromInventoryStatuses.value
})
}
const params = {
filters,
pageNo: 1,
pageSize: 100
}
getBalanceByFilter(params)
.then((res) => {
callback(res.data)
})
.catch((err) => {
showErrorMessage(err.message)
})
}
const getScanResult = (result) => {
resultData.value = result
const packageInfo = result.package
getBalance(result.label, packageInfo, (balances) => {
//
const s = ''
if (!result.package.parentNumber) {
if (balances.list.length == 0) {
showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
const newBalances = balances.list.filter((b) => b.locationCode == fromLocationCode.value)
if (newBalances.length == 0) {
showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else if (newBalances.length == 1) {
const balance = newBalances[0]
result.balance = balance
afterGetBalance(result)
} else {
showBalanceSelect(newBalances)
}
}
} else { } else {
// showErrorMessage(res.message)
if (balances.list.length == 0) {
showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
//
const subPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.number)
//
const subParentPackitems = balances.list.filter((r) => r.packingNumber == packageInfo.parentNumber && r.locationCode == fromLocationCode.value)
//
if (subPackitems.length == 0) {
//
if (subParentPackitems.length > 0) {
if (subParentPackitems.length == 1) {
const balance = subParentPackitems[0]
balance.qty = packageInfo.qty
result.balance = balance
afterGetBalance(result)
} else {
showBalanceSelect(subParentPackitems)
}
} else {
showErrorMessage(`按外包装【${packageInfo.parentNumber}】和子包装【${packageInfo.number}】都未查找到库存余额`)
}
} else {
let locationCode = fromLocationCode.value
if (balances.list == 1) {
locationCode = balances.list[0].locationCode
} else {
const manyBlances = balances.list.filter((r) => r.locationCode != fromLocationCode.value)
if (manyBlances.length > 0) {
locationCode = manyBlances[0].locationCode
showErrorMessage(`该包装【${packageInfo.number}】在库位【${locationCode}】已经有库存余额,请重新扫描`)
}else {
afterGetBalance(result)
}
}
}
}
} }
}) });
} }
const getScanResult = (result)=> {
const showBalanceSelect = (items) => { setData(result);
balanceSelectRef.value.openPopup(items)
} }
const setData = (result)=> {
let balance = result.balance;
let label = result.label;
let pack = result.package;
if (fromLocationCode.value && fromLocationCode.value != balance.locationCode) {
showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]在库位[" + this
.fromLocationCode + "]没有库存余额")
return;
}
const selectBalanceItem = (balance) => { let item = detailSource.value.find(res => {
resultData.value.balance = balance
afterGetBalance(resultData.value)
}
const afterGetBalance = (result) => {
const { balance } = result
const { label } = result
const pack = result.package
const { packUnit } = pack
const { packQty } = pack
const item = detailSource.value.find((res) => {
if (res.itemCode == balance.itemCode) { if (res.itemCode == balance.itemCode) {
return res return res
} }
}) })
if (fromWarehouseCode.value == '') {
fromWarehouseCode.value = balance.warehouseCode
}
if (item == undefined) { if (item == undefined) {
const itemp = createItemInfo(balance, pack) if (itemCode.value != "" && itemCode.value != balance.itemCode) {
const newDetail = createDetailInfo(balance, pack) showErrorMessage("请扫描物料为【" + itemCode.value + "】的箱码")
newDetail.parentNumber = pack.parentNumber return;
}
if (fromWarehouseCode.value == '') {
fromWarehouseCode.value = balance.warehouseCode;
}
let itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
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) if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
itemp.subList.push(newDetail);
detailSource.value.push(itemp) detailSource.value.push(itemp)
calcHandleQty(detailSource.value) itemCode.value = balance.itemCode;
fromLocationCode.value = balance.locationCode
scanPopupGetFocus()
} else { } else {
const detail = item.subList.find((r) => { let detail = item.subList.find(r => {
if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { if (r.packingNumber == pack.number &&
return r r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
} }
}) })
if (detail == undefined) { if (detail == undefined) {
const 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) if (balance.lableQty) {
calcHandleQty(detailSource.value) newDetail.handleQty = balance.lableQty
} else if (detail.scaned == true) { }
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`) item.subList.push(newDetail);
} this.scanPopupGetFocus()
} } else {
} if (detail.scaned == true) {
const getScanResult1 = (result) => { this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]已经在列表中")
const { balance } = result
const { label } = result
const pack = result.package
const { packUnit } = pack
const { packQty } = pack
const item = detailSource.value.find((res) => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (fromWarehouseCode.value == '') {
fromWarehouseCode.value = balance.warehouseCode
}
if (item == undefined) {
const itemp = createItemInfo(balance, pack)
const newDetail = createDetailInfo(balance, pack) //
newDetail.packUnit = packUnit
newDetail.packQty = packQty
itemp.subList.push(newDetail)
detailSource.value.push(itemp)
calcHandleQty(detailSource.value)
} else {
const detail = item.subList.find((r) => {
if (r.packingNumber == balance.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) {
return r
} }
})
if (detail == undefined) {
const newDetail = createDetailInfo(balance, pack)
newDetail.packUnit = packUnit
newDetail.packQty = packQty
item.subList.push(newDetail)
calcHandleQty(detailSource.value)
} else if (detail.scaned == true) {
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`)
} }
} }
calcHandleQty(this.detailSource);
} }
// //
const getRecommendLocation = (balance, pack, callback) => { const getRecommendLocation = (balance, pack, callback) => {
proxy.$modal.loading('扫描中...') proxy.$modal.loading('扫描中...')
@ -456,11 +334,11 @@ const removePack = () => {
} }
const openScanPopup = () => { const openScanPopup = () => {
if (fromLocationCode.value == '') { if (businessType.value == '') {
showFromLocationPopup() scanPopup.value.openScanPopup(this.businessType);
return }else {
getBusinessType()
} }
scanPopup.value.openScanPopupForType(fromLocationCode.value, businessType.value)
} }
const showFromLocationPopup = () => { const showFromLocationPopup = () => {
nextTick(() => { nextTick(() => {
@ -595,16 +473,6 @@ const getFromLocationCode = (location, code) => {
fromLocationCode.value = code fromLocationCode.value = code
openScanPopup() openScanPopup()
} }
const getToLocationCode = (location, code) => {
if (fromLocationCode.value == code) {
uni.showToast({
title: `来源库位[${fromLocationCode.value}]不能与目标库位[${code}]一致`,
duration: 2000
})
return
}
toLocationCode.value = code
}
const showCommitSuccessMessage = (hint) => { const showCommitSuccessMessage = (hint) => {
comMessageRef.value.showScanMessage(hint, (res) => { comMessageRef.value.showScanMessage(hint, (res) => {
@ -628,6 +496,7 @@ const clearData = () => {
toWarehouseCode.value = '' toWarehouseCode.value = ''
detailSource.value = [] detailSource.value = []
positionInfo.value = '请选择生产线' positionInfo.value = '请选择生产线'
itemCode.value = ''
} }
</script> </script>

718
src/pages/issue/record/directIssue2.vue

@ -0,0 +1,718 @@
<template>
<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">
<view class="page-header">
<view class="header_item">
来源库位 : {{fromLocationCode}}
</view>
<view class='split_line'></view>
</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="">
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index,item)"
:isShowToLocation="false" @updateData="updateData" @removePack="removePack">
</record-com-detail-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="uni-row uni-flex">
<text>生产线:</text>
<view class="uni-flex u-col-center uni-row" @click="showSelect">
<view class="" style="margin-left: 20rpx;">
{{positionInfo}}
</view>
<u-select v-model="show" mode="mutil-column-auto" :list="positionList"
@confirm="confirmSelect"></u-select>
</view>
</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='openScanPopup'></win-scan-button>
</view>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false'
:queryBalance="false">
</win-scan-pack-and-location>
<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>
</template>
<script>
import {
issueRecordSubmit,
getWorkShopLineStation,
getBalanceByFilter
} from '@/api/request2.js';
import {
goHome,
getPackingNumberAndBatchByList,
deepCopyData
} from '@/common/basic.js';
import {
calc
} from '@/common/calc.js';
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
getBusinessType,
createItemInfo,
createDetailInfo,
calcTreeHandleQty,
calcHandleQty
} from '@/common/record.js';
import {
getManagementPrecisions,
getPrecisionStrategyList,
getPrecisionStrategyParams
} from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
export default {
components: {
winScanButton,
winScanPack,
requiredLocation,
comBlankView,
winScanLocation,
winScanPackAndLocation,
recordComDetailCard,
recordDetailCard,
balanceSelect
},
data() {
return {
id: '',
dataContent: {}, //
detailSource: [], //
fromLocationInfo: {},
fromLocationCode: "",
fromLocationAreaTypeList: [],
toLocationAreaTypeList: [],
inInventoryStatus: "", //
outInventoryStatus: "", //
businessType: {},
showToLoaction: true,
recommendLocationList: [], //
fromWarehouseCode: '', //
businessTypeCode: "Issue",
positionList: [],
show: false,
positionInfo: "请选择生产线",
resultData: {}
};
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title
})
this.clearData();
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.showFromLocationPopup();
} else {
this.showErrorMessage(res.message)
}
});
// if (this.positionList.length == 0) {
getWorkShopLineStation().then(res => {
if (res.data != null && res.data.length > 0) {
this.positionList = res.data
} else {
this.showErrorMessage('未查找到位置信息');
}
}).catch(error => {
this.showErrorMessage(error);
})
// }
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {},
methods: {
getBalance(label, packageInfo, callback) {
var filters = []
if (packageInfo.parentNumber) {
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: label.packingNumber
})
}
filters.push({
column: "itemCode",
action: "==",
value: label.itemCode
})
filters.push({
column: "batch",
action: "==",
value: label.batch
})
if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: this.fromInventoryStatuses
})
}
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
callback(res.data)
}).catch(err => {
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 +
'】已经有库存余额,请重新扫描')
} else {
this.afterGetBalance(result);
}
}
}
}
}
})
},
showBalanceSelect(items) {
this.$refs.balanceSelect.openPopup(items);
},
selectBalanceItem(balance) {
this.resultData.balance = balance;
this.afterGetBalance(this.resultData);
},
afterGetBalance(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
let packUnit = pack.packUnit;
let packQty = pack.packQty
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = packUnit;
newDetail.packQty = packQty;
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
calcHandleQty(this.detailSource);
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.number &&
r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = packUnit;
newDetail.packQty = packQty;
item.subList.push(newDetail);
calcHandleQty(this.detailSource);
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + detail.packingNumber + "]批次[" + balance.batch + "]重复扫描 }
}
}
},
getScanResult1(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
let packUnit = pack.packUnit;
let packQty = pack.packQty
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.packUnit = packUnit;
newDetail.packQty = packQty;
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
calcHandleQty(this.detailSource);
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == balance.packingNumber &&
r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
newDetail.packUnit = packUnit;
newDetail.packQty = packQty;
item.subList.push(newDetail);
calcHandleQty(this.detailSource);
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]重复扫描")
}
}
}
},
//
getRecommendLocation(balance, pack, callback) {
uni.showLoading({
title: '扫描中...',
mask: true
})
let recommend = this.recommendLocationList.find(r => r.itemCode == balance.itemCode);
if (recommend == undefined) {
let param = {
itemCode: balance.itemCode,
batch: balance.batch,
inventoryStatus: balance.inventoryStatus,
supplierCode: pack.supplierCode,
businessCode: this.businessTypeCode
};
console.log(JSON.stringify(param))
getPutawayRecommendLocation(param).then(res => {
this.recommendLocationList.push({
itemCode: balance.itemCode,
locationCode: res.data.code
})
callback(res.data);
uni.hideLoading();
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error);
uni.hideLoading();
})
} else {
callback(recommend);
}
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {}
});
},
calcTreeHandleQty() {
for (let item of this.detailSource) {
item.qty = 0;
for (let detail of item.subList) {
if (detail != undefined) {
item.qty = calc.add(item.qty, detail.qty)
}
}
}
this.$forceUpdate();
},
showSelect() {
// if (this.editPosition) {
this.show = true
// }
},
confirmSelect(e) {
this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label
console.log("位置", this.positionInfo)
this.workshopCode = e[0].value
this.productionLineCode = e[1].value
this.workStationCode = e[2].value
this.workShopName = e[0].label
this.productionLineName = e[1].label
this.workStationName = e[2].label
let shop = this.positionList.find(shop => shop.value == this.workshopCode);
if (shop != undefined && shop.children != undefined) {
let prodLine = shop.children.find(line => line.value == this.productionLineCode);
if (prodLine != undefined && prodLine.children != undefined) {
let station = prodLine.children.find(r => r.value == this.workStationCode);
if (station.rawLocationCode == '' && station.rawLocationCode == null) {
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择")
return;
} else {
this.rawLocationCode = station.rawLocationCode;
this.fgLocationCode = station.fgLocationCode;
}
} else {
this.showErrorMessage("生产线-工位基础信息维护错误")
}
} else {
this.showErrorMessage("车间-生产线基础信息维护错误")
}
//
let toLocationCode = ''
this.positionList.forEach(item => {
if (this.workshopCode == item.value) { //
item.children.find(child => {
if (this.productionLineCode == child.value) {
toLocationCode = child.children.find(subChild => this.workStationCode ==
subChild.value).rawLocationCode;
}
})
}
})
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = toLocationCode
detail.productionLineCode = this.productionLineCode
detail.workStationCode = this.workStationCode
})
})
},
removeItem(index, item) {
this.detailSource.splice(index, 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();
},
openScanPopup() {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanLocationCode.openScanPopup();
})
},
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup();
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
// scanLocationCode(location, code) {
// this.toLocationCode = code
// this.toLocationCode = location;
// },
commit() {
uni.showLoading({
title: "提交中....",
mask: true
});
//
let precisionStrategyParams = getPrecisionStrategyParams(this.detailSource);
//2:
getPrecisionStrategyList(precisionStrategyParams, res => {
if (res.success) {
this.managementList = res.list;
var params = {
...this.setRecordParams()
}
console.log("提交参数", JSON.stringify(params));
issueRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成直接发料记录\n" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
setRecordParams() {
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);
var submitItem = deepCopyData(detail)
submitItem.toPackingNumber = info.packingNumber;
submitItem.toBatch = info.batch;
submitItem.toContainerNumber = detail.containerNumber;
submitItem.fromPackingNumber = info.packingNumber;
submitItem.fromBatch = info.batch;
submitItem.fromContainerNumber = detail.containerNumber;
submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = detail.toLocationCode;
// detail.toInventoryStatus = detail.inventoryStatus
// detail.toLocationCode = detail.toLocationCode
submitItem.qty = detail.handleQty;
submitItem.package = "";
submitItem.recordList = [{
toInventoryStatus: detail.inventoryStatus,
fromParentPackingNumber: detail.parentNumber,
fromPackingNumber: info.packingNumber,
fromBatch: info.batch,
toPackingNumber: info.packingNumber,
toBatch: info.batch,
fromLocationCode: detail.locationCode,
toLocationCode: detail.toLocationCode,
handleQty: detail.handleQty,
fromPackUnit: detail.packUnit,
toPackUnit: detail.packUnit,
fromPackQty: detail.packQty,
toPackQty: detail.packQty
}]
subList.push(submitItem)
}
})
})
if (subList.length > 0) {
this.dataContent.toWarehouseCode = subList[0].toWarehouseCode;
}
this.dataContent.subList = subList
this.dataContent.creator = creator;
this.dataContent.fromWarehouseCode = this.fromWarehouseCode;
return this.dataContent;
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
getLocation(location, code) {
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationInfo = location;
this.fromLocationCode = code;
this.openScanPopup();
},
getToLocationCode(location, code) {
if (this.fromLocationCode == code) {
uni.showToast({
title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致",
duration: 2000
})
return
}
this.toLocationCode = code;
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
})
},
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)
}
}
this.$forceUpdate();
},
clearData() {
this.fromLocationInfo = {};
this.fromLocationCode = '';
this.fromWarehouseCode = '';
this.toWarehouseCode = '';
this.detailSource = [];
this.positionInfo = "请选择生产线";
}
}
}
</script>
<style scoped lang="scss">
</style>
Loading…
Cancel
Save