|
|
@ -15,7 +15,19 @@ |
|
|
|
|
|
|
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|
|
|
<view class=""> |
|
|
|
<record-com-detail-card :dataContent="item" :index="index" @removeItem="removeItem(index, item)" @updateData="updateData" :isShowLocation="true" @removePack="removePack" :isShowToLocation="false"> </record-com-detail-card> |
|
|
|
<record-com-detail-card-batch :dataContent="item" :index="index" :isShowFromLocation="false" |
|
|
|
:isShowParentToLocation="false" |
|
|
|
@removeItem="removeItem(index,item)" :isShowToLocation="false" @updateData="updateData" |
|
|
|
@removePack="removePack" |
|
|
|
:allowModifyQty="true" |
|
|
|
v-if="managementType == 'BY_BATCH'||managementType =='BY_QUANTITY' "> |
|
|
|
</record-com-detail-card-batch> |
|
|
|
<record-com-detail-card :dataContent="item" :index="index" v-else |
|
|
|
@removeItem="removeItem(index, item)" |
|
|
|
@updateData="updateData" :isShowLocation="true" |
|
|
|
@removePack="removePack" |
|
|
|
:isShowToLocation="false"> |
|
|
|
</record-com-detail-card> |
|
|
|
</view> |
|
|
|
<view class="split_line"></view> |
|
|
|
</view> |
|
|
@ -37,16 +49,18 @@ |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import { ref, getCurrentInstance, nextTick, onMounted } from 'vue' |
|
|
|
import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' |
|
|
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.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 RecordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|
|
|
import RecordComDetailCardBatch from '@/mycomponents/record/recordComDetailCardBatch.vue' |
|
|
|
import { unPlannedIssueRecordSubmit } from '@/api/request2.js' |
|
|
|
|
|
|
|
import { getBusinessType, createItemInfo, createDetailInfo, calcHandleQty } from '@/common/record.js' |
|
|
|
import { |
|
|
|
calc |
|
|
|
} from '@/common/calc.js'; |
|
|
|
|
|
|
|
import { getDirectoryItemArray, getUnPlannedIssuseReasonList } from '@/common/directory.js' |
|
|
|
|
|
|
@ -70,6 +84,8 @@ const show = ref(false) |
|
|
|
const scanFromLocationCode = ref() |
|
|
|
const scanPopup = ref() |
|
|
|
const comMessageRef = ref() |
|
|
|
const managementType = ref('') |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
reasonList.value = getUnPlannedIssuseReasonList() |
|
|
|
const typeCode = 'UnplannedDeliver' |
|
|
@ -85,11 +101,15 @@ onMounted(() => { |
|
|
|
}) |
|
|
|
|
|
|
|
const openScanPopup = () => { |
|
|
|
if (businessType.value) { |
|
|
|
if (fromLocationCode.value == '') { |
|
|
|
showFromLocationPopup() |
|
|
|
return |
|
|
|
} |
|
|
|
scanPopup.value.openScanPopupForType(fromLocationCode.value, businessType.value) |
|
|
|
} else { |
|
|
|
getBusinessType() |
|
|
|
} |
|
|
|
} |
|
|
|
const showFromLocationPopup = () => { |
|
|
|
nextTick(() => { |
|
|
@ -103,10 +123,52 @@ const getfromLocationCode = (location) => { |
|
|
|
fromLocationCode.value = location.code |
|
|
|
openScanPopup() |
|
|
|
} |
|
|
|
const getScanResult = (result) => { |
|
|
|
getDataSource(result) |
|
|
|
const getScanResult = (result,managementTypeParams) => { |
|
|
|
this.managementType = managementTypeParams |
|
|
|
console.log(managementTypeParams) |
|
|
|
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") { |
|
|
|
setDataBatch(result) |
|
|
|
} else { |
|
|
|
setData(result) |
|
|
|
} |
|
|
|
} |
|
|
|
const setDataBatch = (result)=> { |
|
|
|
let balance = result.balance; |
|
|
|
let label = result.label; |
|
|
|
let pack = result.package; |
|
|
|
let item = detailSource.value.find(res => { |
|
|
|
if (res.itemCode == label.itemCode) { |
|
|
|
return res |
|
|
|
} |
|
|
|
}) |
|
|
|
if (item == undefined) { |
|
|
|
let itemp = createItemInfo(balance, pack); |
|
|
|
let newDetail = createDetailInfo(balance, pack); // |
|
|
|
// newDetail.inventoryStatus ="OK"; |
|
|
|
itemp.subList.push(newDetail); |
|
|
|
detailSource.value.push(itemp) |
|
|
|
packGetFocus() |
|
|
|
} else { |
|
|
|
let detail = item.subList.find(r => { |
|
|
|
if (r.batch == balance.batch && |
|
|
|
r.locationCode == balance.locationCode && |
|
|
|
r.inventoryStatus == balance.inventoryStatus && |
|
|
|
r.scaned == true) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
if (detail == undefined) { |
|
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
|
item.subList.push(newDetail); |
|
|
|
packGetFocus() |
|
|
|
}else { |
|
|
|
detail.handleQty = calc.add(detail.handleQty, result.label.qty) |
|
|
|
} |
|
|
|
} |
|
|
|
handleCalcHandleQty() |
|
|
|
} |
|
|
|
const getDataSource = (result) => { |
|
|
|
const setData = (result) => { |
|
|
|
const { balance } = result |
|
|
|
const { label } = result |
|
|
|
const pack = result.package |
|
|
@ -176,7 +238,7 @@ const commit = () => { |
|
|
|
.then((res) => { |
|
|
|
uni.hideLoading() |
|
|
|
if (res.data) { |
|
|
|
showCommitSuccessMessage(`提交成功<br>生成采购收货记录<br>${res.data}`) |
|
|
|
showCommitSuccessMessage(`提交成功\n生成计划外出库记录\n${res.data}`) |
|
|
|
} else { |
|
|
|
showErrorMessage(`提交失败[${res.msg}]`) |
|
|
|
} |
|
|
|