王志国
2 weeks ago
33 changed files with 2567 additions and 146 deletions
@ -0,0 +1,86 @@ |
|||||
|
<template> |
||||
|
<view> |
||||
|
<status v-if="isShowStatus" :status='dataContent.inventoryStatus'></status> |
||||
|
|
||||
|
<view class="uni-flex uni-row center"> |
||||
|
<view class="text_recommend " v-if="Number(recommendQty)"> |
||||
|
{{ Number(recommendQty) }}/ |
||||
|
</view> |
||||
|
<view class="text_recommend "> |
||||
|
{{ Number(dataContent.qty) }} |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view> |
||||
|
<pack-unit :dataContent="dataContent"></pack-unit> |
||||
|
<!-- <std-pack-qty v-show="isShowStdPack" :dataContent="dataContent"></std-pack-qty> --> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import packUnit from '@/mycomponents/qty/packUnit.vue' |
||||
|
import uom from '@/mycomponents/qty/uom.vue' |
||||
|
import status from '@/mycomponents/status/status.vue' |
||||
|
|
||||
|
import { ref, watch } from 'vue'; |
||||
|
import { onLoad } from '@dcloudio/uni-app'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
type: { |
||||
|
type: String, |
||||
|
default: 'default' // recommend:推荐 compare:对比 |
||||
|
}, |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: () => ({}) |
||||
|
}, |
||||
|
recommendQty: { |
||||
|
type: Number, |
||||
|
default: 0 |
||||
|
}, |
||||
|
handleQty: { |
||||
|
type: Number, |
||||
|
default: 0 |
||||
|
}, |
||||
|
isShowStatus: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
isShowStdPack: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
objTextStyle: { |
||||
|
type: Object, |
||||
|
default: null |
||||
|
}, |
||||
|
isShowPackCount: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
isShowCount: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const calc = (qty, packQty) => { |
||||
|
if (qty && packQty) { |
||||
|
return Math.ceil(Number(qty) / Number(packQty)); |
||||
|
} else { |
||||
|
return 0; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
watch(() => props.type, (newVal) => { |
||||
|
// 可以在这里处理业务逻辑 |
||||
|
}); |
||||
|
|
||||
|
onLoad(() => { |
||||
|
// 初始化操作 |
||||
|
}); |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
</style> |
@ -0,0 +1,293 @@ |
|||||
|
<template> |
||||
|
<view style=" "> |
||||
|
<u-popup ref="showRight" mode="left" length="80%"> |
||||
|
<view style="height:100vh;display:flex;flex-direction:column;"> |
||||
|
<view class="" style=" display:flex; background-color:#007AFF ; |
||||
|
flex-direction: row; |
||||
|
align-items: center; |
||||
|
|
||||
|
justify-content: center; |
||||
|
"> |
||||
|
<view class="uni-flex" style=" |
||||
|
color: #fff; |
||||
|
padding: 20rpx; |
||||
|
font-size: 35rpx;"> |
||||
|
先进先出查询 |
||||
|
</view> |
||||
|
<view class="" @click="closeDrawer" |
||||
|
style="position: fixed; color: #fff; font-size: 35rpx;right: 0; padding-right: 15rpx;"> |
||||
|
关闭 |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<scroll-view v-if="true" style="height: calc(100vh - 180rpx)" scroll-y="true"> |
||||
|
<!-- <button @click="closeDrawer" type="primary">关闭Drawer</button> --> |
||||
|
<!-- <view v-for="item in 110" :key="item">可滚动内容 {{ item }}</view> --> |
||||
|
<view class="" style="margin: 10rpx; font-size: 35rpx;"> |
||||
|
物料号: |
||||
|
</view> |
||||
|
<view style=" margin: 10rpx; display: flex; align-items: center;"> |
||||
|
<u-input class="uni-mt-5" prefixIcon="search" v-model="itemCode" placeholder="请输入物料号" |
||||
|
@clear="clearItemCode"></u-input> |
||||
|
<!-- <view>查询</view> --> |
||||
|
<!-- <button style="height: 80rpx; align-items: center; text-align: center;" type="primary" size="mini" >查询</button> --> |
||||
|
</view> |
||||
|
|
||||
|
<view class="" style="margin: 10rpx; margin-top: 20rpx; font-size: 35rpx;"> |
||||
|
仓库: |
||||
|
</view> |
||||
|
<view style=" margin: 10rpx; display: flex; align-items: center;"> |
||||
|
<u-input class="uni-mt-5" prefixIcon="search" v-model="warehouseCode" placeholder="请输入仓库" |
||||
|
></u-input> |
||||
|
</view> |
||||
|
|
||||
|
<view v-for="(item, index) in itemCodeResult" :key="index" @click="selectItemCode(item)"> |
||||
|
<view class="" style="font-size: 30rpx; margin: 20rpx;"> |
||||
|
<view class=""> |
||||
|
({{ index + 1 }}) 物料代码 : {{ item.code }} |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
名称 : {{ item.name }} |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
描述1 : {{ item.desc1 }} |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
描述2 : {{ item.desc1 }} |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="split_line"></view> |
||||
|
</view> |
||||
|
<scroll-view v-if="tableData.length>0" |
||||
|
|
||||
|
:scroll-x="true" |
||||
|
:scroll-y="true" |
||||
|
style=" width: 340px; display: flex; align-items: center; justify-content: center; "> |
||||
|
|
||||
|
<u-table border stripe emptyText="暂无更多数据"> |
||||
|
<!-- 表头行 --> |
||||
|
<u-tr> |
||||
|
<!-- <uni-th align="left">批次</uni-th> |
||||
|
<uni-th align="left">库位</uni-th> |
||||
|
<uni-th align="left">状态</uni-th> |
||||
|
<uni-th align="left">数量</uni-th> |
||||
|
<uni-th align="left">单位</uni-th> --> |
||||
|
<u-th width="60" align="left">批次</u-th> |
||||
|
<u-th width="60" align="left">库位</u-th> |
||||
|
<u-th width="60" align="left">状态</u-th> |
||||
|
<u-th width="100" align="left">数量</u-th> |
||||
|
<u-th width="60" align="left">单位</u-th> |
||||
|
</u-tr> |
||||
|
<!-- 表格数据行 --> |
||||
|
<u-tr v-for="(item, index) in tableData" :key="index"> |
||||
|
<u-td>{{ item.batch }}</u-td> |
||||
|
<u-td>{{ item.locationCode }}</u-td> |
||||
|
<u-td>{{ statusDesc(item.inventoryStatus) }}</u-td> |
||||
|
<u-td>{{ item.totalQty }}</u-td> |
||||
|
<u-td> |
||||
|
<uom :uom="uom"></uom> |
||||
|
</u-td> |
||||
|
</u-tr> |
||||
|
|
||||
|
</u-table> |
||||
|
<!-- <view class="uni-flex" style=" flex-direction: column; position: fixed; bottom: 0; margin-bottom: 100rpx; background-color: #fff; width: 100%; align-items: center;" > |
||||
|
<view class="" style="width: 100%; display: flex; justify-content: center; font-size: 32rpx;margin-top: 10rpx;margin-bottom: 10rpx;"> |
||||
|
<view class="" >当前页:{{ current }},总数:{{ total }}条,每页:{{ pageSize }} |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
<uni-pagination :current="current" :total="total" :show-icon="true" |
||||
|
@change="change" /> |
||||
|
</view> --> |
||||
|
|
||||
|
|
||||
|
</scroll-view> |
||||
|
|
||||
|
</scroll-view> |
||||
|
|
||||
|
<button @click="query" type="primary" style="padding-left: 20rpx; width: 100%;">查询</button> |
||||
|
</view> |
||||
|
|
||||
|
</u-popup> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import { |
||||
|
getBasicItemByCodeSenior, |
||||
|
getBalanceByBusinessType, |
||||
|
getBasicItemByCode |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
getInventoryStatusStyle, |
||||
|
getInventoryStatusName |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import Uom from '@/mycomponents/qty/uom.vue' |
||||
|
|
||||
|
import {ref, watch} from 'vue'; |
||||
|
|
||||
|
const itemCode = ref(''); |
||||
|
const itemCodeResult = ref([]); |
||||
|
const current = ref(1); |
||||
|
const total = ref(18); |
||||
|
const tableData = ref([]); |
||||
|
const warehouseCode = ref(''); |
||||
|
const areaCode = ref(''); |
||||
|
const uom = ref(''); |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
businessTypeCode: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const comMessage = ref(null); |
||||
|
const showRight = ref(); |
||||
|
|
||||
|
const statusStyle = (val) => { |
||||
|
return getInventoryStatusStyle(val); |
||||
|
}; |
||||
|
|
||||
|
const statusDesc = (value) => { |
||||
|
return getInventoryStatusName(value); |
||||
|
}; |
||||
|
|
||||
|
const change = () => { |
||||
|
}; |
||||
|
|
||||
|
const showErrorMessage = (message) => { |
||||
|
comMessage.value.showErrorMessage(message, (res) => { |
||||
|
if (res) { |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const selectItemCode = (item) => { |
||||
|
itemCode.value = item.code; |
||||
|
itemCodeResult.value = []; |
||||
|
getBalanceByBusiness(itemCode.value, props.businessTypeCode); |
||||
|
}; |
||||
|
|
||||
|
const clearItemCode = () => { |
||||
|
itemCode.value = ''; |
||||
|
itemCodeResult.value = []; |
||||
|
tableData.value = []; |
||||
|
}; |
||||
|
|
||||
|
const onConfirmItemCode = () => { |
||||
|
if (!itemCode.value) { |
||||
|
showErrorMessage('物料号为空,请先输入物料号'); |
||||
|
return; |
||||
|
} |
||||
|
tableData.value = []; |
||||
|
uni.showLoading({ |
||||
|
title: '加载中', |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
getBasicItemByCodeSenior(itemCode.value).then((res) => { |
||||
|
if (res.data && res.data.list.length > 0) { |
||||
|
if (res.data.list.length === 1) { |
||||
|
itemCode.value = res.data.list[0].code; |
||||
|
getBalanceByBusiness(itemCode.value, props.businessTypeCode); |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
itemCodeResult.value = res.data.list; |
||||
|
} |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(`未查找到物料[${itemCode.value}]`); |
||||
|
} |
||||
|
}).catch((error) => { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(error); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const getBalanceByBusiness = (itemCode, businessType) => { |
||||
|
const params = { |
||||
|
itemCode, |
||||
|
businessType, |
||||
|
inOrOut: 'out' |
||||
|
}; |
||||
|
getBalanceByBusinessType(params).then((res) => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data && res.data.length > 0) { |
||||
|
tableData.value = res.data; |
||||
|
} else { |
||||
|
showErrorMessage(`系统异常:按${res.msg}未查找到库存`); |
||||
|
} |
||||
|
}).catch((error) => { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(error); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showDrawer = () => { |
||||
|
showRight.value.open(); |
||||
|
}; |
||||
|
|
||||
|
const closeDrawer = () => { |
||||
|
showRight.value.close(); |
||||
|
}; |
||||
|
|
||||
|
const query = () => { |
||||
|
if (itemCode.value === '') { |
||||
|
showErrorMessage('物料代码为空,请输入物料代码'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (warehouseCode.value === '') { |
||||
|
showErrorMessage('仓库代码为空,请输入仓库代码'); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
uni.showLoading({ |
||||
|
title: '查询中', |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
getBasicItemByCode(itemCode.value).then((res) => { |
||||
|
if (res.data && res.data.list.length === 1) { |
||||
|
uom.value = res.data.list[0].uom; |
||||
|
queryBalance(); |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(`未查询到物料号${itemCode.value}的信息`); |
||||
|
} |
||||
|
}).catch((error) => { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(error); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const queryBalance = () => { |
||||
|
const params = { |
||||
|
itemCode: itemCode.value, |
||||
|
warehouseCode: warehouseCode.value, |
||||
|
businessType: props.businessTypeCode, |
||||
|
inOrOut: 'out' |
||||
|
}; |
||||
|
getBalanceByBusinessType(params).then((res) => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data && res.data.length > 0) { |
||||
|
tableData.value = res.data; |
||||
|
} else { |
||||
|
showErrorMessage(`系统异常:按${res.msg}未查找到库存`); |
||||
|
} |
||||
|
}).catch((error) => { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(error); |
||||
|
}); |
||||
|
}; |
||||
|
defineExpose({ |
||||
|
showDrawer |
||||
|
}) |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,207 @@ |
|||||
|
<template> |
||||
|
<view class="" style="background-color: #fff;"> |
||||
|
<uni-collapse ref="collapse1"> |
||||
|
<uni-collapse-item :open="true"> |
||||
|
<template v-slot:title> |
||||
|
<uni-swipe-action> |
||||
|
<uni-swipe-action-item @click="removeItem($event,dataContent)" :right-options="removeOptions"> |
||||
|
<item-qty :dataContent="dataContent" :isShowBalance="true" |
||||
|
:isShowBalanceQty="isShowBalanceQty" |
||||
|
:isShowRecommendQty="false" |
||||
|
></item-qty> |
||||
|
<view style="margin-left: 10px; margin-top: 5px;"> |
||||
|
<pack title='父包装' v-if="dataContent.containerNumber" |
||||
|
:packingCode='dataContent.containerNumber'></pack> |
||||
|
<location v-if="isShowParentToLocation" title='目标库位' |
||||
|
:locationCode='dataContent.toLocationCode'></location> |
||||
|
</view> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
</template> |
||||
|
<view class='split_line'></view> |
||||
|
<view class="" v-for="(detail,index) in dataContent.subList" :key="index"> |
||||
|
<uni-swipe-action> |
||||
|
<uni-swipe-action-item @click="swipeClick($event,detail,index)" |
||||
|
:right-options="detail.scaned?scanOptions:detailOptions"> |
||||
|
<balance :dataContent="detail" :isShowStdPack="false" :isShowStatus="isShowStatus" |
||||
|
:isShowPack="true" :isShowFromLocation="isShowFromLocation" |
||||
|
:isShowToLocation="isShowToLocation" :isShowParentPack="isShowParentPack"> |
||||
|
</balance> |
||||
|
</uni-swipe-action-item> |
||||
|
</uni-swipe-action> |
||||
|
<!-- <view class='split_line'></view> --> |
||||
|
</view> |
||||
|
</uni-collapse-item> |
||||
|
</uni-collapse> |
||||
|
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm"></balance-qty-edit> |
||||
|
<record-detail-popup ref="recordDetailPopup"></record-detail-popup> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import itemQty from '@/mycomponents/item/itemQty.vue' |
||||
|
import balance from '@/mycomponents/balance/balance.vue' |
||||
|
import recommend from '@/mycomponents/recommend/recommend.vue' |
||||
|
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' |
||||
|
import balanceDetailPopup from '@/mycomponents/balance/balanceDetailPopup.vue' |
||||
|
import purchaseLabel from '@/mycomponents/balance/purchaseLabel.vue' |
||||
|
import location from '@/mycomponents/balance/location.vue' |
||||
|
import recordDetailPopup from '@/mycomponents/detail/recordDetailPopup.vue' |
||||
|
import pack from '@/mycomponents/balance/pack.vue' |
||||
|
import PackageAndItemCard from '@/mycomponents/package/PackageAndItemCard.vue' |
||||
|
|
||||
|
import { |
||||
|
getDetailOption, |
||||
|
getDetailEditRemoveOption, |
||||
|
getClearOption, |
||||
|
getEditLocationRemoveOption, |
||||
|
getRecordOption |
||||
|
} from '@/common/array.js'; |
||||
|
|
||||
|
import {ref, watch, onMounted, nextTick} from 'vue'; |
||||
|
|
||||
|
const props = defineProps({ |
||||
|
dataContent: { |
||||
|
type: Object, |
||||
|
default: () => ({}) |
||||
|
}, |
||||
|
settingParam: { |
||||
|
type: Object, |
||||
|
default: () => ({}) |
||||
|
}, |
||||
|
isShowStatus: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
isShowFromLocation: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
isShowToLocation: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
isShowParentToLocation: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
isShowBalanceQty: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
isShowParentPack: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
isShowModifedLocation: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
}, |
||||
|
allowModifyQty: { |
||||
|
type: Boolean, |
||||
|
default: true |
||||
|
}, |
||||
|
allowModifyLocation: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
} |
||||
|
}); |
||||
|
const emit = defineEmits(['removeItem', 'removePack', 'editLocation', 'updateData']); |
||||
|
|
||||
|
const option = ref([]); |
||||
|
const title = ref("推荐详情"); |
||||
|
const showItem = ref({}); |
||||
|
const editItem = ref({}); |
||||
|
const detailOptions = ref([]); |
||||
|
const scanOptions = ref([]); |
||||
|
const removeOptions = ref([]); |
||||
|
const dataList = ref([]); |
||||
|
|
||||
|
watch(() => props.dataContent, (newDataContent, oldDataContent) => { |
||||
|
if (newDataContent.subList.length > 0) { |
||||
|
nextTick(() => { |
||||
|
setTimeout(() => { |
||||
|
const collapse1 = ref(null); |
||||
|
if (collapse1.value) { |
||||
|
collapse1.value.init(); |
||||
|
} |
||||
|
}, 500); |
||||
|
}); |
||||
|
} |
||||
|
}, {immediate: true, deep: true}); |
||||
|
|
||||
|
onMounted(() => { |
||||
|
detailOptions.value = getDetailOption(); |
||||
|
scanOptions.value = getRecordOption(props.allowModifyQty, props.allowModifyLocation); |
||||
|
removeOptions.value = props.isShowModifedLocation ? getEditLocationRemoveOption() : getClearOption(); |
||||
|
}); |
||||
|
|
||||
|
const removeItem = (e, dataContent) => { |
||||
|
if (e.content.text === "移除") { |
||||
|
uni.showModal({ |
||||
|
title: "提示", |
||||
|
content: "确定清空物料及箱码信息?", |
||||
|
success: (res) => { |
||||
|
if (res.confirm) { |
||||
|
emit('removeItem', dataContent); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} else { |
||||
|
editLocation(dataContent); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const swipeClick = (e, item, index) => { |
||||
|
if (e.content.text === "详情") { |
||||
|
detail(item); |
||||
|
} else if (e.content.text === "编辑") { |
||||
|
edit(item); |
||||
|
} else if (e.content.text === "移除") { |
||||
|
remove(item, index); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const edit = (item) => { |
||||
|
editItem.value = item; |
||||
|
const balanceQtyEdit = ref(null); |
||||
|
if (balanceQtyEdit.value) { |
||||
|
balanceQtyEdit.value.openEditPopup(editItem.value, editItem.value.handleQty); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const detail = (item) => { |
||||
|
showItem.value = item; |
||||
|
const recordDetailPopup = ref(null); |
||||
|
if (recordDetailPopup.value) { |
||||
|
recordDetailPopup.value.openPopup(item); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const remove = (item, index) => { |
||||
|
uni.showModal({ |
||||
|
title: "提示", |
||||
|
content: "确定移除扫描信息?", |
||||
|
success: (res) => { |
||||
|
if (res.confirm) { |
||||
|
props.dataContent.subList.splice(index, 1); |
||||
|
emit('removePack'); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const editLocation = (item) => { |
||||
|
editItem.value = item; |
||||
|
emit('editLocation', item); |
||||
|
}; |
||||
|
|
||||
|
const confirm = (qty) => { |
||||
|
editItem.value.handleQty = qty; |
||||
|
emit('updateData'); |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
</style> |
@ -0,0 +1,502 @@ |
|||||
|
<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-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="true" @removeItem="removeItem(index,item)" |
||||
|
:isShowToLocation="false" :isShowParentToLocation="false" @updateData="updateData" |
||||
|
:allowModifyQty="true" |
||||
|
@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-location ref="scanFromLocationCode" title="来源库位" @getLocation='getFromLocation' |
||||
|
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
||||
|
|
||||
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :title="'箱码'"> |
||||
|
</win-scan-pack-and-location> |
||||
|
<!-- <winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode"> |
||||
|
</winComScanBalance> --> |
||||
|
<fifoQuery ref="refFifoQuery" :businessTypeCode="businessTypeCode"></fifoQuery> |
||||
|
|
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import { |
||||
|
issueRecordSubmit, |
||||
|
getWorkShopLineStation, |
||||
|
getBalanceByFilter |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
goHome, |
||||
|
getPackingNumberAndBatchByList, |
||||
|
deepCopyData, |
||||
|
getSwitchInfoByCode |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
getInventoryStatusDesc, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
createItemInfo, |
||||
|
createDetailInfo, |
||||
|
calcHandleQty, |
||||
|
createDetailInfoForLabel |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
getManagementPrecisions, |
||||
|
getPrecisionStrategyList, |
||||
|
getPrecisionStrategyParams |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import { |
||||
|
Decimal |
||||
|
} from 'decimal.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' |
||||
|
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' |
||||
|
import fifoQuery from '@/mycomponents/query/fifoQuery.vue' |
||||
|
|
||||
|
|
||||
|
import { ref, onMounted ,nextTick} from 'vue'; |
||||
|
import { onLoad, onNavigationBarButtonTap, onBackPress, onPullDownRefresh } from '@dcloudio/uni-app'; |
||||
|
|
||||
|
const businessTypeCode = ref(''); |
||||
|
const businessType = ref(''); |
||||
|
const fromInventoryStatuses = ref([]); |
||||
|
const fromLocationAreaTypeList = ref([]); |
||||
|
const positionList = ref([]); |
||||
|
const fifoSwitch = ref(false); |
||||
|
const detailSource = ref([]); |
||||
|
const workshopCode = ref(''); |
||||
|
const productionLineCode = ref(''); |
||||
|
const workStationCode = ref(''); |
||||
|
const workShopName = ref(''); |
||||
|
const productionLineName = ref(''); |
||||
|
const workStationName = ref(''); |
||||
|
const rawLocationCode = ref(''); |
||||
|
const fgLocationCode = ref(''); |
||||
|
const positionInfo = ref('请选择生产线'); |
||||
|
const fromLocationCode = ref(''); |
||||
|
const fromLocationInfo = ref({}); |
||||
|
const fromWarehouseCode = ref(''); |
||||
|
const toWarehouseCode = ref(''); |
||||
|
const dataContent = ref({ subList: [] }); |
||||
|
const managementType = ref(''); |
||||
|
const managementList = ref([]); |
||||
|
const itemCode = ref('') |
||||
|
const refFifoQuery = ref(null); |
||||
|
const comMessage = ref(null); |
||||
|
const scanPopup = ref(null); |
||||
|
const scanFromLocationCode = ref(null); |
||||
|
const show = ref(false) |
||||
|
onLoad((option) => { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: option.title |
||||
|
}); |
||||
|
clearData(); |
||||
|
getBusinessTypeFun(); |
||||
|
fifoSwitch.value = getSwitchInfoByCode("directIssueFifoSwitch"); |
||||
|
getWorkShopLineStation().then((res) => { |
||||
|
if (res.data && res.data.length > 0) { |
||||
|
positionList.value = res.data; |
||||
|
} else { |
||||
|
showErrorMessage('未查找到位置信息'); |
||||
|
} |
||||
|
}).catch((error) => { |
||||
|
showErrorMessage(error); |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
onNavigationBarButtonTap((e) => { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} else if (e.index === 1) { |
||||
|
refFifoQuery.value.showDrawer(); |
||||
|
closeScanPopup(); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
onBackPress(() => {}); |
||||
|
|
||||
|
onPullDownRefresh(() => {}); |
||||
|
|
||||
|
onMounted(() => {}); |
||||
|
|
||||
|
const getBusinessTypeFun = () => { |
||||
|
getBusinessType(businessTypeCode.value, (res) => { |
||||
|
if (res.success) { |
||||
|
businessType.value = res.businessType; |
||||
|
fromInventoryStatuses.value = getDirectoryItemArray(res.fromInventoryStatuses); |
||||
|
fromLocationAreaTypeList.value = res.fromLocationAreaTypeList; |
||||
|
showFromLocationPopup(); |
||||
|
} else { |
||||
|
showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const getScanResult = (result, managementTypeParams) => { |
||||
|
managementType.value = managementTypeParams; |
||||
|
if (managementTypeParams === "BY_BATCH" || managementTypeParams === "BY_QUANTITY") { |
||||
|
setDataBatch(result); |
||||
|
} else { |
||||
|
setData(result); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const setData = async (result) => { |
||||
|
const balance = result.balance; |
||||
|
const label = result.label; |
||||
|
const pack = result.package; |
||||
|
const item = detailSource.value.find((res) => res.itemCode === balance.itemCode); |
||||
|
if (!item) { |
||||
|
const itemp = createItemInfo(balance, pack); |
||||
|
const newDetail = createDetailInfo(balance, pack); |
||||
|
itemp.subList.push(newDetail); |
||||
|
detailSource.value.push(itemp); |
||||
|
} else { |
||||
|
const detail = item.subList.find((r) => r.packingNumber === balance.packingNumber && |
||||
|
r.batch === balance.batch && |
||||
|
r.locationCode === balance.locationCode && |
||||
|
r.inventoryStatus === balance.inventoryStatus); |
||||
|
if (!detail) { |
||||
|
const newDetail = createDetailInfo(balance, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
if (detail.scaned) { |
||||
|
showErrorMessage(`箱码[${balance.packingNumber}]批次[${balance.batch}]重复扫描`); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
calcHandleQty(detailSource.value); |
||||
|
}; |
||||
|
|
||||
|
const setDataBatch = (result) => { |
||||
|
const balance = result.balance; |
||||
|
const label = result.label; |
||||
|
const pack = result.package; |
||||
|
const item = detailSource.value.find((res) => res.itemCode === balance.itemCode); |
||||
|
if (!item) { |
||||
|
const itemp = createItemInfo(balance, pack); |
||||
|
const newDetail = createDetailInfoForLabel(balance, pack, label); |
||||
|
itemp.subList.push(newDetail); |
||||
|
detailSource.value.push(itemp); |
||||
|
} else { |
||||
|
const detail = item.subList.find((r) => r.batch === balance.batch && |
||||
|
r.locationCode === balance.locationCode && |
||||
|
r.inventoryStatus === balance.inventoryStatus); |
||||
|
if (!detail) { |
||||
|
const newDetail = createDetailInfoForLabel(balance, pack, label); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
detail.handleQty = calc.add(detail.handleQty, result.label.qty); |
||||
|
} |
||||
|
} |
||||
|
calcHandleQty(detailSource.value); |
||||
|
}; |
||||
|
|
||||
|
const showErrorMessage = (message) => { |
||||
|
comMessage.value.showErrorMessage(message, (res) => { |
||||
|
if (res) { |
||||
|
scanPopupGetFocus(); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showSelect = () => { |
||||
|
show.value = true; |
||||
|
}; |
||||
|
|
||||
|
const confirmSelect = (e) => { |
||||
|
positionInfo.value = e[0].label + "-" + e[1].label + "-" + e[2].label; |
||||
|
console.log("位置", positionInfo.value); |
||||
|
workshopCode.value = e[0].value; |
||||
|
productionLineCode.value = e[1].value; |
||||
|
workStationCode.value = e[2].value; |
||||
|
workShopName.value = e[0].label; |
||||
|
productionLineName.value = e[1].label; |
||||
|
workStationName.value = e[2].label; |
||||
|
|
||||
|
const shop = positionList.value.find((shop) => shop.value === workshopCode.value); |
||||
|
if (shop && shop.children) { |
||||
|
const prodLine = shop.children.find((line) => line.value === productionLineCode.value); |
||||
|
if (prodLine && prodLine.children) { |
||||
|
const station = prodLine.children.find((r) => r.value === workStationCode.value); |
||||
|
if (!station.rawLocationCode) { |
||||
|
showErrorMessage(`${workStationName.value}的原材料库位为空,请重新选择`); |
||||
|
return; |
||||
|
} else { |
||||
|
rawLocationCode.value = station.rawLocationCode; |
||||
|
fgLocationCode.value = station.fgLocationCode; |
||||
|
} |
||||
|
} else { |
||||
|
showErrorMessage("生产线-工位基础信息维护错误"); |
||||
|
} |
||||
|
} else { |
||||
|
showErrorMessage("车间-生产线基础信息维护错误"); |
||||
|
} |
||||
|
|
||||
|
let toLocationCode = ''; |
||||
|
positionList.value.forEach((item) => { |
||||
|
if (workshopCode.value === item.value) { |
||||
|
item.children.find((child) => { |
||||
|
if (productionLineCode.value === child.value) { |
||||
|
toLocationCode = child.children.find((subChild) => workStationCode.value === subChild.value).rawLocationCode; |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
detailSource.value.forEach((item) => { |
||||
|
item.subList.forEach((detail) => { |
||||
|
detail.toLocationCode = toLocationCode; |
||||
|
detail.productionLineCode = productionLineCode.value; |
||||
|
detail.workStationCode = workStationCode.value; |
||||
|
}); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const removeItem = (index) => { |
||||
|
detailSource.value.splice(index, 1); |
||||
|
}; |
||||
|
|
||||
|
const removePack = () => { |
||||
|
for (let i = 0; i < detailSource.value.length; i++) { |
||||
|
const item = detailSource.value[i]; |
||||
|
if (item.subList.length === 0) { |
||||
|
detailSource.value.splice(i, 1); |
||||
|
} |
||||
|
} |
||||
|
updateData(); |
||||
|
}; |
||||
|
|
||||
|
const openScanPopup = () => { |
||||
|
if (businessType.value) { |
||||
|
if (fromLocationCode.value === '') { |
||||
|
showFromLocationPopup(); |
||||
|
return; |
||||
|
} |
||||
|
scanPopup.value.openScanPopupForType(fromLocationCode.value, businessType.value); |
||||
|
} else { |
||||
|
getBusinessTypeFun(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const showFromLocationPopup = () => { |
||||
|
nextTick(() => { |
||||
|
scanFromLocationCode.value.openScanPopup(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const closeScanPopup = () => { |
||||
|
if (scanFromLocationCode.value) { |
||||
|
scanFromLocationCode.value.closeScanPopup(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const scanPopupGetFocus = () => { |
||||
|
if (scanPopup.value) { |
||||
|
scanPopup.value.getfocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const commit = () => { |
||||
|
if (positionInfo.value === '请选择生产线' || !positionInfo.value) { |
||||
|
showErrorMessage("请选择生产线"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
|
||||
|
const precisionStrategyParams = getPrecisionStrategyParams(detailSource.value); |
||||
|
getPrecisionStrategyList(precisionStrategyParams, (res) => { |
||||
|
if (res.success) { |
||||
|
managementList.value = res.list; |
||||
|
const params = setRecordParams(); |
||||
|
console.log("提交参数", JSON.stringify(params)); |
||||
|
const isHaveItem = params.subList.find((item) => item.handleQty > item.balanceQty); |
||||
|
if (isHaveItem) { |
||||
|
showErrorMessage(`物料号${isHaveItem.itemCode}`); |
||||
|
comMessage.value.showConfirmWarningModal(`物料号${isHaveItem.itemCode}数量[${isHaveItem.handleQty}]不允许大于库存数量[${isHaveItem.balanceQty}]`); |
||||
|
uni.hideLoading(); |
||||
|
return; |
||||
|
} |
||||
|
issueRecordSubmit(params).then((res) => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data) { |
||||
|
showCommitSuccessMessage(`提交成功\n生成直接发料记录\n${res.data}`); |
||||
|
} else { |
||||
|
showErrorMessage(`提交失败[${res.msg}]`); |
||||
|
} |
||||
|
}).catch((error) => { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(error); |
||||
|
}); |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const setRecordParams = () => { |
||||
|
const subList = []; |
||||
|
const creator = store.state.user.id; |
||||
|
detailSource.value.forEach((item) => { |
||||
|
item.subList.forEach((detail) => { |
||||
|
if (detail.scaned) { |
||||
|
const info = getPackingNumberAndBatchByList(managementList.value, detail.itemCode, detail.packingNumber, detail.toLocationCode, detail.batch); |
||||
|
const 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; |
||||
|
submitItem.qty = detail.handleQty; |
||||
|
submitItem.package = ''; |
||||
|
submitItem.balanceQty = detail.balanceQty; |
||||
|
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) { |
||||
|
dataContent.value.toWarehouseCode = subList[0].toWarehouseCode; |
||||
|
} |
||||
|
dataContent.value.subList = subList; |
||||
|
dataContent.value.creator = creator; |
||||
|
dataContent.value.fromWarehouseCode = fromWarehouseCode.value; |
||||
|
return dataContent.value; |
||||
|
}; |
||||
|
|
||||
|
const showMessage = (message) => { |
||||
|
comMessage.value.showMessage(message, (res) => {}); |
||||
|
}; |
||||
|
|
||||
|
const showScanMessage = (message) => { |
||||
|
comMessage.value.showScanMessage(message); |
||||
|
}; |
||||
|
|
||||
|
const afterCloseMessage = () => { |
||||
|
scanPopupGetFocus(); |
||||
|
}; |
||||
|
|
||||
|
const closeScanMessage = () => { |
||||
|
scanPopupGetFocus(); |
||||
|
}; |
||||
|
|
||||
|
const getLocation = (location, code) => { |
||||
|
getFromLocationCode(location, code); |
||||
|
}; |
||||
|
|
||||
|
const getFromLocationCode = (location, code) => { |
||||
|
fromLocationInfo.value = location; |
||||
|
fromLocationCode.value = code; |
||||
|
openScanPopup(); |
||||
|
}; |
||||
|
|
||||
|
const showCommitSuccessMessage = (hint) => { |
||||
|
comMessage.value.showSuccessMessage(hint, (res) => { |
||||
|
clearData(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const updateData = () => { |
||||
|
calcHandleQty(detailSource.value); |
||||
|
for (let i = 0; i < detailSource.value.length; i++) { |
||||
|
const item = detailSource.value[i]; |
||||
|
if (item.qty === 0) { |
||||
|
detailSource.value.splice(i, 1); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const getFromLocation = (location) => { |
||||
|
fromLocationCode.value = location.code; |
||||
|
fromLocationInfo.value = location; |
||||
|
openScanPopup(); |
||||
|
}; |
||||
|
|
||||
|
const clearData = () => { |
||||
|
fromLocationInfo.value = {}; |
||||
|
fromLocationCode.value = ''; |
||||
|
fromWarehouseCode.value = ''; |
||||
|
toWarehouseCode.value = ''; |
||||
|
detailSource.value = []; |
||||
|
positionInfo.value = "请选择生产线"; |
||||
|
itemCode.value = ''; |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
</style> |
@ -0,0 +1,447 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='openScanPopup' v-if="detailSource.length==0"></com-blank-view> |
||||
|
</view> |
||||
|
<view class="page-wraper" v-if="detailSource.length>0"> |
||||
|
<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=""> |
||||
|
<com-product-record :dataContent="item" :index="index" @removeItem="removeItem(index,item)" |
||||
|
@updateData="updateData" @removePack="removePack"> |
||||
|
</com-product-record> |
||||
|
</view> |
||||
|
<view class='split_line'></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=""> |
||||
|
<view class="uni-flex uni-row u-col-center"> |
||||
|
<text style="font-size: 32rpx;">位置 :</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> |
||||
|
<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 ref="scanPopup" @getResult='getScanResult' title="制品标签" headerType="HMQ"></win-scan-pack> |
||||
|
<comMessage ref="comMessage"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import { |
||||
|
productionReceiptRecordSubmit, |
||||
|
getWorkShopLineStation |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
getPrecisionStrategyList |
||||
|
} from '@/common/balance.js'; |
||||
|
import { |
||||
|
goHome, |
||||
|
getPackingNumberAndBatchByList, |
||||
|
deepCopyData |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import {Decimal} from 'decimal.js';//引入 |
||||
|
|
||||
|
import { |
||||
|
getInventoryStatusDesc, |
||||
|
getDirectoryItemArray |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import winScanPack from '@/mycomponents/scan/winScanPack.vue' |
||||
|
import comProductRecord from '@/pages/productReceipt/coms/comProductRecord.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
|
||||
|
import {ref, onMounted} from 'vue'; |
||||
|
import {useCountStore} from '@/store'; |
||||
|
import {onLoad,onNavigationBarButtonTap,onBackPress,onPullDownRefresh} from '@dcloudio/uni-app' |
||||
|
const store = useCountStore(); |
||||
|
|
||||
|
// 定义所有数据 |
||||
|
const detailSource = ref([]); |
||||
|
const toLocationCode = ref(""); |
||||
|
const fromLocationTypeList = ref([]); |
||||
|
const fromLocationCode = ref(""); |
||||
|
const businessType = ref({}); |
||||
|
const dataContent = ref({}); |
||||
|
const managementList = ref([]); |
||||
|
const show = ref(false); |
||||
|
const positionInfo = ref("请选择位置"); |
||||
|
const positionList = ref([]); |
||||
|
const productionLineCode = ref(''); |
||||
|
const rawLocationCode = ref(""); |
||||
|
const fgLocationCode = ref(""); |
||||
|
const workshopCode = ref(""); |
||||
|
const workStationCode = ref(""); |
||||
|
const workShopName = ref(""); |
||||
|
const productionLineName = ref(""); |
||||
|
const workStationName = ref(""); |
||||
|
|
||||
|
const scanPopup = ref(null); |
||||
|
const comMessage = ref(null); |
||||
|
onLoad((option) => { |
||||
|
uni.setNavigationBarTitle({ |
||||
|
title: option.title |
||||
|
}); |
||||
|
const typeCode = "ProductReceipt"; |
||||
|
getBusinessType(typeCode, (res) => { |
||||
|
if (res.success) { |
||||
|
businessType.value = res.businessType; |
||||
|
openScanPopup(); |
||||
|
} else { |
||||
|
showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
getWorkShopLineStation().then((res) => { |
||||
|
positionList.value = res.data; |
||||
|
}).catch((error) => { |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
onNavigationBarButtonTap((e) => { |
||||
|
if (e.index === 0) { |
||||
|
goHome(); |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
onBackPress((e) => { |
||||
|
}) |
||||
|
|
||||
|
onPullDownRefresh((e) => { |
||||
|
}) |
||||
|
|
||||
|
const getScanResult = (result) => { |
||||
|
const label = result.label; |
||||
|
const pack = result.package; |
||||
|
if (!result.label.itemCode) { |
||||
|
showErrorMessage('扫描标签不对,请重新扫描'); |
||||
|
emit('clearItemCode', result.label); |
||||
|
return; |
||||
|
} |
||||
|
const item = detailSource.value.find((res) => res.itemCode === label.itemCode); |
||||
|
|
||||
|
if (item === undefined) { |
||||
|
const itemp = createItemInfo(label, pack); |
||||
|
const newDetail = createDetailInfo(label, pack); |
||||
|
itemp.subList.push(newDetail); |
||||
|
detailSource.value.push(itemp); |
||||
|
} else { |
||||
|
const detail = item.subList.find((r) => r.packingNumber === label.packingNumber && r.batch === label.batch); |
||||
|
|
||||
|
if (detail === undefined) { |
||||
|
const newDetail = createDetailInfo(label, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
} else { |
||||
|
if (detail.scaned) { |
||||
|
showErrorMessage(`箱码[${label.packingNumber}]批次[${label.batch}]重复扫描`); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
calcHandleQty(); |
||||
|
}; |
||||
|
|
||||
|
const createItemInfo = (label, pack) => { |
||||
|
return { |
||||
|
itemCode: label.itemCode, |
||||
|
itemName: pack.itemName, |
||||
|
packQty: pack.packQty, |
||||
|
packUnit: pack.packUnit, |
||||
|
qty: new Decimal(label.qty).toNumber(), |
||||
|
handleQty: new Decimal(0).toNumber(), |
||||
|
uom: pack.uom, |
||||
|
subList: [] |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
const createDetailInfo = (label, pack) => { |
||||
|
const detail = deepCopyData(label); |
||||
|
detail.scaned = true; |
||||
|
detail.qty = new Decimal(label.qty).toNumber(); |
||||
|
detail.handleQty = new Decimal(label.qty).toNumber(); |
||||
|
detail.inventoryStatus = "OK"; |
||||
|
detail.packQty = pack.packQty; |
||||
|
detail.packUnit = pack.packUnit; |
||||
|
detail.package = pack; |
||||
|
detail.label = label; |
||||
|
return detail; |
||||
|
}; |
||||
|
|
||||
|
const calcHandleQty = () => { |
||||
|
detailSource.value.forEach((item) => { |
||||
|
item.handleQty = new Decimal(0).toNumber(); |
||||
|
item.subList.forEach((detail) => { |
||||
|
if (detail !== undefined) { |
||||
|
item.handleQty = calc.add(item.handleQty, detail.handleQty); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
scanPopupGetFocus(); |
||||
|
}; |
||||
|
|
||||
|
const openScanPopup = () => { |
||||
|
scanPopup.value.openScanPopup(); |
||||
|
}; |
||||
|
|
||||
|
const commit = () => { |
||||
|
if (positionInfo.value === "请选择位置") { |
||||
|
showMessage("请先选择位置"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (detailSource.value.length > 0 && detailSource.value[0].subList.length > 0) { |
||||
|
uni.showLoading({ |
||||
|
title: "提交中....", |
||||
|
mask: true |
||||
|
}); |
||||
|
managementList.value = []; |
||||
|
const precisionStrategParams = setPrecisionStrategParams(); |
||||
|
|
||||
|
getPrecisionStrategyList(precisionStrategParams, (res) => { |
||||
|
if (res.success) { |
||||
|
managementList.value = res.list; |
||||
|
const params = setParams(); |
||||
|
console.log("提交" + JSON.stringify(params)); |
||||
|
productionReceiptRecordSubmit(params).then((res) => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data) { |
||||
|
showCommitSuccessMessage(`提交成功\n生成制品收货记录\n${res.data}`); |
||||
|
} else { |
||||
|
showErrorMessage(`提交失败[${res.msg}]`); |
||||
|
} |
||||
|
}).catch((error) => { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(error); |
||||
|
}); |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
} else { |
||||
|
showErrorMessage("没有要提交的数据,请先扫描"); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const setPrecisionStrategParams = () => { |
||||
|
const itemList = []; |
||||
|
detailSource.value.forEach((item) => { |
||||
|
item.subList.forEach((detail) => { |
||||
|
if (detail.scaned) { |
||||
|
detail.toLocationCode = fgLocationCode.value; |
||||
|
const filterResult = itemList.filter((res) => res.itemCode === item.itemCode && detail.toLocationCode === res.locationCode); |
||||
|
if (filterResult.length === 0) { |
||||
|
itemList.push({itemCode: item.itemCode, locationCode: detail.toLocationCode}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
return itemList; |
||||
|
}; |
||||
|
|
||||
|
const setParams = () => { |
||||
|
const subList = []; |
||||
|
const creator = store.state.user.id; |
||||
|
detailSource.value.forEach((item) => { |
||||
|
item.subList.forEach((detail) => { |
||||
|
if (detail.scaned) { |
||||
|
const submitItem = deepCopyData(detail); |
||||
|
const info = getPackingNumberAndBatchByList(managementList.value, detail.itemCode, detail.packingNumber, detail.toLocationCode, detail.batch); |
||||
|
submitItem.itemCode = detail.itemCode; |
||||
|
submitItem.itemName = detail.package.itemName; |
||||
|
submitItem.itemDesc1 = detail.package.itemDesc1; |
||||
|
submitItem.itemDesc2 = detail.package.itemDesc2; |
||||
|
submitItem.inventoryStatus = detail.inventoryStatus; |
||||
|
submitItem.fromPackingNumber = info.packingNumber; |
||||
|
submitItem.toPackingNumber = info.packingNumber; |
||||
|
submitItem.fromContainerNumber = detail.containerNumber; |
||||
|
submitItem.toContainerNumber = detail.containerNumber; |
||||
|
submitItem.fromBatch = info.batch; |
||||
|
submitItem.toBatch = info.batch; |
||||
|
submitItem.fromLocationCode = detail.locationCode; |
||||
|
submitItem.toLocationCode = detail.toLocationCode; |
||||
|
submitItem.productionlineCode = productionLineCode.value; |
||||
|
submitItem.workStationCode = workStationCode.value; |
||||
|
submitItem.qty = detail.handleQty; |
||||
|
submitItem.package = ""; |
||||
|
subList.push(submitItem); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
dataContent.value.subList = subList; |
||||
|
dataContent.value.creator = creator; |
||||
|
dataContent.value.type = "predict"; |
||||
|
dataContent.value.workshopCode = workshopCode.value; |
||||
|
return dataContent.value; |
||||
|
}; |
||||
|
|
||||
|
const showMessage = (message) => { |
||||
|
setTimeout(() => { |
||||
|
scanPopupLoseFocus(); |
||||
|
comMessage.value.showMessage(message, (res) => { |
||||
|
if (res) { |
||||
|
scanPopupGetFocus(); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showErrorMessage = (message) => { |
||||
|
setTimeout(() => { |
||||
|
scanPopupLoseFocus(); |
||||
|
comMessage.value.showErrorMessage(message, (res) => { |
||||
|
if (res) { |
||||
|
scanPopupGetFocus(); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const closeScanPopup = () => { |
||||
|
scanPopup.value.closeScanPopup(); |
||||
|
}; |
||||
|
|
||||
|
const scanPopupGetFocus = () => { |
||||
|
if (scanPopup.value !== undefined) { |
||||
|
scanPopup.value.getfocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const scanPopupLoseFocus = () => { |
||||
|
if (scanPopup.value !== undefined) { |
||||
|
scanPopup.value.losefocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const afterCloseMessage = () => { |
||||
|
scanPopupGetFocus(); |
||||
|
}; |
||||
|
|
||||
|
const closeScanMessage = () => { |
||||
|
scanPopupGetFocus(); |
||||
|
}; |
||||
|
|
||||
|
const showCommitSuccessMessage = (hint) => { |
||||
|
comMessage.value.showSuccessMessage(hint, (res) => { |
||||
|
clearData(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const clearData = () => { |
||||
|
detailSource.value = []; |
||||
|
toLocationCode.value = ''; |
||||
|
dataContent.value = {}; |
||||
|
positionInfo.value = "请选择位置"; |
||||
|
fgLocationCode.value = ""; |
||||
|
}; |
||||
|
|
||||
|
const removePack = () => { |
||||
|
detailSource.value = detailSource.value.filter((item) => item.subList.length > 0); |
||||
|
updateData(); |
||||
|
}; |
||||
|
|
||||
|
const removeItem = (index) => { |
||||
|
detailSource.value.splice(index, 1); |
||||
|
}; |
||||
|
|
||||
|
const updateData = () => { |
||||
|
calcHandleQty(); |
||||
|
}; |
||||
|
|
||||
|
const showSelect = () => { |
||||
|
show.value = !show.value; |
||||
|
}; |
||||
|
|
||||
|
const confirmSelect = (e) => { |
||||
|
positionInfo.value = `${e[0].label}-${e[1].label}-${e[2].label}`; |
||||
|
workshopCode.value = e[0].value; |
||||
|
productionLineCode.value = e[1].value; |
||||
|
workStationCode.value = e[2].value; |
||||
|
workShopName.value = e[0].label; |
||||
|
productionLineName.value = e[1].label; |
||||
|
workStationName.value = e[2].label; |
||||
|
|
||||
|
const shop = positionList.value.find((shop) => shop.value === workshopCode.value); |
||||
|
if (shop !== undefined && shop.children !== undefined) { |
||||
|
const prodLine = shop.children.find((line) => line.value === productionLineCode.value); |
||||
|
if (prodLine !== undefined && prodLine.children !== undefined) { |
||||
|
const station = prodLine.children.find((r) => r.value === workStationCode.value); |
||||
|
if (station.rawLocationCode === '' || station.rawLocationCode === null) { |
||||
|
showErrorMessage(`${workStationName.value}的原材料库位为空,请重新选择`); |
||||
|
return; |
||||
|
} else { |
||||
|
rawLocationCode.value = station.rawLocationCode; |
||||
|
fgLocationCode.value = station.fgLocationCode; |
||||
|
} |
||||
|
} else { |
||||
|
showErrorMessage("生产线-工位基础信息维护错误"); |
||||
|
} |
||||
|
} else { |
||||
|
showErrorMessage("车间-生产线基础信息维护错误"); |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
page { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
.page-wraper { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
.page-main-list { |
||||
|
/* height: 80rpx; |
||||
|
line-height: 80rpx; */ |
||||
|
text-align: center; |
||||
|
background: #e0e0e0; |
||||
|
|
||||
|
} |
||||
|
</style> |
@ -0,0 +1,41 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<receipt-job :title="title" source_type="Develop" scanTitle="箱标签/ASN单号" :isShowAsn="false" :isShowJob="false" |
||||
|
ref="receiptjob" operation='receipt'></receipt-job> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import ReceiptJob from '@/pages/purchaseReceipt/job/receiptJob.vue' |
||||
|
import {ref} from 'vue' |
||||
|
import {onShow, onLoad, onPullDownRefresh, onReachBottom, onNavigationBarButtonTap} from '@dcloudio/uni-app' |
||||
|
|
||||
|
const title = ref('') |
||||
|
const receiptjob = ref(null) |
||||
|
onShow(() => { |
||||
|
if (receiptjob.value != undefined) { |
||||
|
receiptjob.value.refresh() |
||||
|
} |
||||
|
}) |
||||
|
onLoad((option) => { |
||||
|
title.value = option.title |
||||
|
}) |
||||
|
onPullDownRefresh(() => { |
||||
|
receiptjob.value.refresh() |
||||
|
}) |
||||
|
onReachBottom(() => { |
||||
|
receiptjob.value.onReach() |
||||
|
}) |
||||
|
onNavigationBarButtonTap((e) => { |
||||
|
if (e.index === 0) { |
||||
|
receiptjob.value.goHome1(); |
||||
|
// receiptjob.value.refresh(); |
||||
|
} else if (e.index == 1) { |
||||
|
receiptjob.value.openFilter(); |
||||
|
} |
||||
|
}) |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,42 @@ |
|||||
|
<template> |
||||
|
<view class=""> |
||||
|
<receipt-job :title="title" source_type="TOOL" scanTitle="箱标签/ASN单号" :isShowAsn="false" :isShowJob="false" |
||||
|
ref="receiptjob" operation='receipt'></receipt-job> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import ReceiptJob from '@/pages/purchaseReceipt/job/receiptJob.vue' |
||||
|
|
||||
|
import {ref} from 'vue' |
||||
|
import {onShow, onLoad, onPullDownRefresh, onReachBottom, onNavigationBarButtonTap} from '@dcloudio/uni-app' |
||||
|
|
||||
|
const title = ref('') |
||||
|
const receiptjob = ref(null) |
||||
|
onShow(() => { |
||||
|
if (receiptjob.value != undefined) { |
||||
|
receiptjob.value.refresh() |
||||
|
} |
||||
|
}) |
||||
|
onLoad((option) => { |
||||
|
title.value = option.title |
||||
|
}) |
||||
|
onPullDownRefresh(() => { |
||||
|
receiptjob.value.refresh() |
||||
|
}) |
||||
|
onReachBottom(() => { |
||||
|
receiptjob.value.onReach() |
||||
|
}) |
||||
|
onNavigationBarButtonTap((e) => { |
||||
|
if (e.index === 0) { |
||||
|
receiptjob.value.goHome1(); |
||||
|
// receiptjob.value.refresh(); |
||||
|
} else if (e.index == 1) { |
||||
|
receiptjob.value.openFilter(); |
||||
|
} |
||||
|
}) |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,346 @@ |
|||||
|
<template> |
||||
|
<view class="page-wraper"> |
||||
|
<view class=""> |
||||
|
<com-blank-view @goScan='openScanPopup' v-if="detailSource.length==0"></com-blank-view> |
||||
|
</view> |
||||
|
<view class="page-wraper" v-if="detailSource.length>0"> |
||||
|
<view class='split_line'></view> |
||||
|
<view class="page-main"> |
||||
|
<uni-data-picker v-if="detailSource.length>0" style="padding: 20rpx; background-color:#fff;" |
||||
|
class='uni-data-picker' placeholder="请选择入库原因" popup-title="入库原因" :localdata="reasonList" |
||||
|
@change="reasonChange"> |
||||
|
</uni-data-picker> |
||||
|
|
||||
|
<scroll-view scroll-y="true" class="page-main-scroll"> |
||||
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
||||
|
<view class=""> |
||||
|
<com-receipt-record |
||||
|
:dataContent="item" @removeItem="removeItem(index,item)" |
||||
|
@updateData="updateData" |
||||
|
:queryBalance="false" |
||||
|
:allowModifyQty="true" |
||||
|
:isShowLocation="false" @removePack="removePack"> |
||||
|
</com-receipt-record> |
||||
|
</view> |
||||
|
<view class='split_line'></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=""> |
||||
|
<requiredLocation title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode' |
||||
|
:locationAreaTypeList="toLocationAreaTypeList"></requiredLocation> |
||||
|
</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 ref="scanPopupRef" @getResult='getScanResult' :title="'箱码'" headerType="HPQ,HMQ"></win-scan-pack> |
||||
|
<comMessage ref="comMessageRef"></comMessage> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script setup> |
||||
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
||||
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
||||
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue' |
||||
|
import comReceiptRecord from '@/pages/unPlanned/coms/comReceiptRecord.vue' |
||||
|
import comBlankView from '@/mycomponents/common/comBlankView.vue' |
||||
|
import winScanPack from "@/mycomponents/scan/winScanPack.vue" |
||||
|
|
||||
|
import { |
||||
|
unPlannedReceiptRecordbSubmit |
||||
|
} from '@/api/request2.js'; |
||||
|
|
||||
|
import { |
||||
|
getDirectoryItemArray, |
||||
|
getUnPlannedReceiptReasonList |
||||
|
} from '@/common/directory.js'; |
||||
|
|
||||
|
import { |
||||
|
getBusinessType, |
||||
|
} from '@/common/record.js'; |
||||
|
|
||||
|
import { |
||||
|
calc |
||||
|
} from '@/common/calc.js'; |
||||
|
|
||||
|
import { |
||||
|
Decimal |
||||
|
} from 'decimal.js'; //引入 |
||||
|
import { |
||||
|
goHome, |
||||
|
deepCopyData, |
||||
|
getPackingNumberAndBatchByList |
||||
|
} from '@/common/basic.js'; |
||||
|
|
||||
|
import { |
||||
|
getPrecisionStrategyList |
||||
|
} from '@/common/balance.js'; |
||||
|
|
||||
|
import { ref, onMounted } from 'vue'; |
||||
|
|
||||
|
const toLocationCode = ref(""); |
||||
|
const toInventoryStatus = ref([]); |
||||
|
const businessType = ref({}); |
||||
|
const detailSource = ref([]); |
||||
|
const businessTypeCode = ref("UnplannedReceipt"); |
||||
|
const reasonText = ref(""); |
||||
|
const reasonCode = ref(""); |
||||
|
const reasonList = ref([]); |
||||
|
const dataContent = ref({}); |
||||
|
const managementList = ref([]); |
||||
|
const toLocationAreaTypeList = ref([]); |
||||
|
const scanPopupRef = ref(null); |
||||
|
const comMessageRef = ref(null); |
||||
|
|
||||
|
onMounted(() => { |
||||
|
reasonList.value = getUnPlannedReceiptReasonList(); |
||||
|
getBusinessType(businessTypeCode.value, res => { |
||||
|
if (res.success) { |
||||
|
businessType.value = res.businessType; |
||||
|
toLocationAreaTypeList.value = res.toLocationAreaTypeList; |
||||
|
openScanPopup(); |
||||
|
} else { |
||||
|
showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
const openScanPopup = () => { |
||||
|
scanPopupRef.value.openScanPopup(); |
||||
|
}; |
||||
|
|
||||
|
const getToLocationCode = (location, code) => { |
||||
|
toLocationCode.value = code; |
||||
|
}; |
||||
|
|
||||
|
const getScanResult = (result) => { |
||||
|
setDataBatch(result); |
||||
|
}; |
||||
|
|
||||
|
const setDataBatch = (result) => { |
||||
|
const label = result.label; |
||||
|
const pack = result.package; |
||||
|
const item = detailSource.value.find(res => res.itemCode === label.itemCode); |
||||
|
|
||||
|
if (item === undefined) { |
||||
|
const itemp = createItemInfo(label, pack); |
||||
|
const newDetail = createDetailInfo(label, pack); |
||||
|
itemp.subList.push(newDetail); |
||||
|
detailSource.value.push(itemp); |
||||
|
getfocus(); |
||||
|
} else { |
||||
|
const detail = item.subList.find(r => r.packingNumber === pack.number && r.batch === pack.batch); |
||||
|
|
||||
|
if (detail === undefined) { |
||||
|
const newDetail = createDetailInfo(label, pack); |
||||
|
item.subList.push(newDetail); |
||||
|
getfocus(); |
||||
|
} else { |
||||
|
detail.handleQty = calc.add(detail.handleQty, result.label.qty); |
||||
|
} |
||||
|
} |
||||
|
calcHandleQty(); |
||||
|
}; |
||||
|
|
||||
|
const getfocus = () => { |
||||
|
if (scanPopupRef.value) { |
||||
|
scanPopupRef.value.getfocus(); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const createItemInfo = (label, pack) => { |
||||
|
return { |
||||
|
itemCode: pack.itemCode, |
||||
|
itemName: pack.itemName, |
||||
|
packQty: pack.packQty, |
||||
|
packUnit: pack.packUnit, |
||||
|
qty: new Decimal(label.qty).toNumber(), |
||||
|
handleQty: new Decimal(0).toNumber(), |
||||
|
uom: label.uom, |
||||
|
subList: [] |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
const createDetailInfo = (label, pack) => { |
||||
|
const detail = deepCopyData(label); |
||||
|
detail.scaned = true; |
||||
|
detail.qty = new Decimal(label.qty).toNumber(); |
||||
|
detail.handleQty = new Decimal(label.qty).toNumber(); |
||||
|
detail.inventoryStatus = "OK"; |
||||
|
detail.packQty = pack.packQty; |
||||
|
detail.packUnit = pack.packUnit; |
||||
|
label.inventoryStatus = "OK"; |
||||
|
detail.package = pack; |
||||
|
detail.label = label; |
||||
|
detail.label.scaned = true; |
||||
|
return detail; |
||||
|
}; |
||||
|
|
||||
|
const calcHandleQty = () => { |
||||
|
detailSource.value.forEach(item => { |
||||
|
item.handleQty = new Decimal(0).toNumber(); |
||||
|
item.qty = new Decimal(0).toNumber(); |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail !== undefined) { |
||||
|
item.handleQty = calc.add(item.handleQty, detail.handleQty); |
||||
|
item.qty = calc.add(item.qty, detail.qty); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const showErrorMessage = (message) => { |
||||
|
comMessageRef.value.showErrorMessage(message, res => { |
||||
|
if (res) { |
||||
|
getfocus(); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const updateData = () => { |
||||
|
calcHandleQty(); |
||||
|
}; |
||||
|
|
||||
|
const removePack = () => { |
||||
|
detailSource.value = detailSource.value.filter(item => item.subList.length > 0); |
||||
|
updateData(); |
||||
|
}; |
||||
|
|
||||
|
const removeItem = (index) => { |
||||
|
detailSource.value.splice(index, 1); |
||||
|
}; |
||||
|
|
||||
|
const commit = () => { |
||||
|
if (toLocationCode.value === "") { |
||||
|
showErrorMessage("请先选择目标库位"); |
||||
|
return; |
||||
|
} |
||||
|
if (reasonText.value === '') { |
||||
|
showErrorMessage("请选择入库原因"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (detailSource.value.length > 0 && detailSource.value[0].subList.length > 0) { |
||||
|
uni.showLoading({ title: "提交中....", mask: true }); |
||||
|
managementList.value = []; |
||||
|
const precisionStrategParams = setPrecisionStrategParams(); |
||||
|
getPrecisionStrategyList(precisionStrategParams, res => { |
||||
|
if (res.success) { |
||||
|
managementList.value = res.list; |
||||
|
const params = setParams(); |
||||
|
console.log("提交" + JSON.stringify(params)); |
||||
|
unPlannedReceiptRecordbSubmit(params).then(res => { |
||||
|
uni.hideLoading(); |
||||
|
if (res.data) { |
||||
|
showCommitSuccessMessage("提交成功\n生成计划外入库记录\n" + res.data); |
||||
|
} else { |
||||
|
showErrorMessage("提交失败[" + res.msg + "]"); |
||||
|
} |
||||
|
}).catch(error => { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(error); |
||||
|
}); |
||||
|
} else { |
||||
|
uni.hideLoading(); |
||||
|
showErrorMessage(res.message); |
||||
|
} |
||||
|
}); |
||||
|
} else { |
||||
|
showErrorMessage("没有要提交的数据,请先扫描"); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const setPrecisionStrategParams = () => { |
||||
|
const itemList = []; |
||||
|
detailSource.value.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
detail.toLocationCode = toLocationCode.value; |
||||
|
const filterResult = itemList.filter(res => res.itemCode === item.itemCode && detail.toLocationCode === res.locationCode); |
||||
|
if (filterResult.length === 0) { |
||||
|
itemList.push({ itemCode: item.itemCode, locationCode: detail.toLocationCode }); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
return itemList; |
||||
|
}; |
||||
|
|
||||
|
const setParams = () => { |
||||
|
const subList = []; |
||||
|
const creator = store.state.user.id; |
||||
|
detailSource.value.forEach(item => { |
||||
|
item.subList.forEach(detail => { |
||||
|
if (detail.scaned) { |
||||
|
const submitItem = deepCopyData(detail); |
||||
|
const info = getPackingNumberAndBatchByList(managementList.value, detail.label.itemCode, detail.label.packingNumber, detail.toLocationCode, detail.label.batch); |
||||
|
|
||||
|
submitItem.itemCode = detail.package.itemCode; |
||||
|
submitItem.itemName = detail.package.itemName; |
||||
|
submitItem.itemDesc1 = detail.package.itemDesc1; |
||||
|
submitItem.itemDesc2 = detail.package.itemDesc2; |
||||
|
submitItem.inventoryStatus = detail.inventoryStatus; |
||||
|
submitItem.fromPackingNumber = info.packingNumber; |
||||
|
submitItem.toPackingNumber = info.packingNumber; |
||||
|
submitItem.fromBatch = info.batch; |
||||
|
submitItem.toBatch = info.batch; |
||||
|
submitItem.fromLocationCode = ""; |
||||
|
submitItem.toLocationCode = detail.toLocationCode; |
||||
|
submitItem.reason = reasonCode.value; |
||||
|
submitItem.qty = detail.handleQty; |
||||
|
submitItem.package = ""; |
||||
|
|
||||
|
subList.push(submitItem); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
dataContent.value.subList = subList; |
||||
|
dataContent.value.creator = creator; |
||||
|
return dataContent.value; |
||||
|
}; |
||||
|
|
||||
|
const reasonChange = (e) => { |
||||
|
if (e.detail.value.length === 0) { |
||||
|
reasonCode.value = ""; |
||||
|
reasonText.value = ""; |
||||
|
} else { |
||||
|
reasonCode.value = e.detail.value[0].value; |
||||
|
reasonText.value = e.detail.value[0].text; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const showCommitSuccessMessage = (hint) => { |
||||
|
comMessageRef.value.showSuccessMessage(hint, res => { |
||||
|
clearData(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const clearData = () => { |
||||
|
reasonCode.value = ""; |
||||
|
reasonText.value = ""; |
||||
|
detailSource.value = []; |
||||
|
managementList.value = []; |
||||
|
dataContent.value = {}; |
||||
|
toLocationCode.value = ""; |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
.page-main { |
||||
|
flex: 1; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.page-main-scroll { |
||||
|
position: relative; |
||||
|
margin-top: 2px; |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue