盘点物料 数量统计

盘点物料 数量统计
pull/3/head
siontion 9 months ago
parent 7e17c48f35
commit b6cf6c1ec9

@ -56,7 +56,7 @@
(select label from system_dict_data where dict_type='heli_material_unit' and value= mat.unit) as mat_unit,
brand as mat_brand,'' as wh_id, '' as wh_name,'' as rg_id,'' as rg_name,'' as pn_id,'' as pn_name,''
lot_no,short_name,0 as storage_ok_qty
from base_material as mat where not exists(select id from v_storage_material_now where id=mat.id)
from base_material as mat where virtual_part='N' and not exists(select id from v_storage_material_now where id=mat.id)
) t
<where>
<if test="matCode != null and matCode != ''">
@ -65,9 +65,6 @@
<if test="matType != null and matType != ''">
AND mat_type = #{matType}
</if>
<if test="whId != null and whId != ''">
AND wh_id = #{whId}
</if>
</where>
</select>
</mapper>

@ -114,7 +114,7 @@
<template #header> <span class="hl-table_header">*</span>库区 </template>
<template #default="scope">
<el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!">
<el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)">
<el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="(val)=>handleRg(val,scope)">
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rg_name" :value="dict.id" />
</el-select>
</el-form-item>
@ -124,32 +124,32 @@
<template #header> <span class="hl-table_header">*</span>库位 </template>
<template #default="scope">
<el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!">
<el-select v-model="scope.row.pnId" placeholder="" style="width: 100%">
<el-select v-model="scope.row.pnId" placeholder="" style="width: 100%" @change="(val)=>handlePn(val,scope)">
<el-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pn_name"
:value="dict.id" />
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="lotNo" min-width="120" label="批次号" align="center" />
<el-table-column prop="matRest" label="库存数量" min-width="120" align="center" />
<el-table-column prop="storageOkQty" min-width="120" align="center">
<template #header> <span class="hl-table_header">*</span>盘点数量</template>
<template #default="scope">
<el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty"
class="mb-0px!">
<el-input v-model="scope.row.storageOkQty" />
<el-input v-model="scope.row.storageOkQty" @change="(val)=>handleSub(val,scope)" />
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="matSub" label="盈亏差异" min-width="120" align="center" />
<el-table-column prop="matUnit" label="库存单位" min-width="120" align="center" />
<el-table-column label="操作" align="center" width="240">
<template #default="scope">
<el-button link type="danger" size="small" @click.prevent="handleDelete2(scope.$index)"
v-if="isShowBtnDelete">
v-if="scope.row.isCopy==1">
删除
</el-button>
<el-button link type="primary" @click="handleCopy(scope.$index, scope.row)">复制</el-button>
<el-button link type="primary" v-if="scope.row.isCopy==0" @click="handleCopy(scope.$index, scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
@ -355,23 +355,34 @@ const getList = async (arrMat) => {
arrMat.forEach(row => {
row.cid = matCount
if(formData.value.matItemDOList){
formData.value.matItemDOList.forEach(item =>{
if(item.matId !== row.matId || item.wh_id!==row.wh_id || item.rg_id !== row.rg_id || item.pn_id!== row.pn_id){
item.push(row)
matCount = matCount+1
}
})
}else{
formData.value.matItemDOList= []
if(formData.value.matItemDOList.filter(item =>{item.matId == row.matId && item.whId==row.whId && item.rgId == row.rgId && item.pnId== row.pnId})==0){
row.pnlist = ref([])
row.pnlist = pnList.value.filter(pn => pn.rg_id === row.rg_id)
row.pnlist = pnList.value.filter(pn => pn.rg_id == row.rgId)
if(row.pnlist.length==0){
row.rgId =''
row.pnId = ''
row.matRest = 0
}
formData.value.matItemDOList.push(row)
matCount = matCount +1
}
});
formData.value.matItemDOList = arrMat
}
//
const handleCopy = (index, item) => {
const data: any = formData.value.matItemDOList[index]
//
const newData: any = {
...data,
isCopy: 1,
cid:matCount
}
//
formData.value.matItemDOList.splice(index + 1, 0, newData)
matCount = matCount +1
}
const userList = ref<UserApi.UserVO[]>([]) //
// ==================== =======================================
@ -486,32 +497,6 @@ const submitForm = async () => {
}
var matCount = 1
const onAddItem = () => {
const newData = {
//
cid: matCount,
isCopy: 0,
stockId: 0,
matId: '',
matName: '',
matCode: '',
matType: '',
matSpec: '',
matUnit: '',
matRest: '',
whId: '',
rgId: '',
pnId: '',
pnlist: ref([]),
storageOkQty: '',
lotNo: '',
description: '',
productBomItemValueDOList: []
}
matCount = matCount + 1
formData.value.matItemDOList.push(newData)
}
//
const handleDelete2 = (index: number) => {
@ -530,13 +515,24 @@ var rgList = ref([])
//
var pnList = ref([])
const handleRg = async (scope) => {
const handleRg = async (rgid,scope) => {
//-------------------
scope.row.pnid = ''
scope.row.pnlist = pnList.value.filter(pn => pn.rg_id === scope.row.rgId)
scope.row.pnId = ''
scope.row.pnlist = pnList.value.filter(pn => pn.rg_id === rgid)
//-------------------
}
const handlePn = async (pnid,scope) => {
//-------------------
if(formData.value.matItemDOList.filter(item =>item.id == scope.row.id && item.whId==scope.row.whId && item.rgId == scope.row.rgId && item.pnId== pnid).length>1){
message.alertWarning('物料编码'+scope.row.matCode+',当前库位已存在,请修改,避免重复盘点')
}
//-------------------
}
const handleSub = async (pNum,scope) => {
//-------------------
scope.row.matSub = Number(pNum)- Number(scope.row.matRest)
//-----------------
}
const isShowBtnOther = ref(false)
const isShowBtnDelete = ref(true)
@ -546,11 +542,13 @@ const init_page_wh = (async ()=>{
})
//
const init_page_rg = (async ()=>{
rgList.value = (await RgApi.getSimpList()).filter(item =>item.wh_id== formData.value.whId)
var rgData = await RgApi.getSimpList()
rgList.value = rgData.filter(item =>item.wh_id== formData.value.whId)
})
//
const init_page_pn = (async ()=>{
pnList.value = (await PnApi.getSimpList()).filter(item =>item.wh_id== formData.value.whId)
var pnData = await PnApi.getSimpList()
pnList.value = pnData.filter(item =>item.wh_id== formData.value.whId)
})
/** 初始化 **/
onMounted(async () => {
@ -558,6 +556,8 @@ onMounted(async () => {
formData.value = await CheckApi.getStorageCheck(query.id)
if(formData.value.matItemDOList==undefined){formData.value.matItemDOList=[]}
await init_page_wh()
await init_page_rg()
await init_page_pn()

Loading…
Cancel
Save