出库管理 修改

出库管理 修改
pull/3/head
siontion 9 months ago
parent 9ad27ce94e
commit 635398f64d

@ -43,12 +43,13 @@
AND wh_id = #{whId} AND wh_id = #{whId}
</if> </if>
</where> </where>
order by mat_code
</select> </select>
<select id="selectNowList" <select id="selectNowList"
parameterType="com.chanko.yunxi.mes.module.heli.controller.admin.storagelog.vo.StorageNowAllReqVO" parameterType="com.chanko.yunxi.mes.module.heli.controller.admin.storagelog.vo.StorageNowAllReqVO"
resultType="com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogNow.StorageLogNowDO"> resultType="com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogNow.StorageLogNowDO">
select * from ( select * from (
select * from v_storage_material_now select * from v_storage_material_now where wh_id=#{whId}
union all union all
select deleted,id,creator,updater,create_time,update_time,tenant_id,code as mat_code,name as mat_name, select deleted,id,creator,updater,create_time,update_time,tenant_id,code as mat_code,name as mat_name,
(select label from system_dict_data where dict_type='heli_material_type' and value= mat.material_type) as (select label from system_dict_data where dict_type='heli_material_type' and value= mat.material_type) as
@ -56,7 +57,7 @@
(select label from system_dict_data where dict_type='heli_material_unit' and value= mat.unit) as mat_unit, (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,'' 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 lot_no,short_name,0 as storage_ok_qty
from base_material as mat where virtual_part='N' and 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 wh_id=#{whId} and id=mat.id)
) t ) t
<where> <where>
<if test="matCode != null and matCode != ''"> <if test="matCode != null and matCode != ''">
@ -66,9 +67,10 @@
AND mat_type = #{matType} AND mat_type = #{matType}
</if> </if>
</where> </where>
order by t.mat_code
</select> </select>
<select id="selectNowByMatPnId" resultType="com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogNow.StorageLogNowDO"> <select id="selectNowByMatPnId" resultType="com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelogNow.StorageLogNowDO">
select * from v_storage_material_now where id=#{matId} and pn_id=#{pnId} select * from v_storage_material_now where id=#{matId} and pn_id=#{pnId} order by mat_code
</select> </select>
</mapper> </mapper>

@ -106,7 +106,7 @@
<el-select v-model="scope.row.matId" placeholder="物料名称" :remote-method="remoteMatCodeSearch" v-bind:disabled="ctrView || ctrSave" <el-select v-model="scope.row.matId" placeholder="物料名称" :remote-method="remoteMatCodeSearch" v-bind:disabled="ctrView || ctrSave"
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading" remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading"
@change="(val) => handleMatCode(scope, val)" class="!w-180px"> @change="(val) => handleMatCode(scope, val)" class="!w-180px">
<el-option v-for="item in matList" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in scope.row.matList" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
@ -563,6 +563,7 @@ const submitForm = async () => {
var matCount = 1 var matCount = 1
const onAddItem = () => { const onAddItem = () => {
if (formData.value.whId) { if (formData.value.whId) {
const newData = { const newData = {
// //
@ -581,7 +582,8 @@ const onAddItem = () => {
storageOkQty: '', storageOkQty: '',
lotNo: '', lotNo: '',
description: '', description: '',
productBomItemValueDOList: [] productBomItemValueDOList: [],
matList : matList.value
} }
matCount = matCount + 1 matCount = matCount + 1
@ -612,6 +614,31 @@ const handleWh = async (wid) => {
// //
pnList.value = (await PnApi.getSimpList()).filter( pn => pn.wh_id == wid) pnList.value = (await PnApi.getSimpList()).filter( pn => pn.wh_id == wid)
//await getMatList()
}
const getMatList = async (name) =>{
//
let matParams = {
pageNo: 1,
pageSize: 10,
status: '1'
}
if(name){
matParams.name = name
}
//const matLastRemoteData = await StorageMatApi.getStorageMatList(0)
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = dataMat.list
// matList.value = dataMat.list.filter(
// (item) =>
// matLastRemoteData.find(
// (fish) => fish.matId === item.id && fish.whId == formData.value.whId
// ) !== undefined
// )
} }
const handlePn = async (scope) =>{ const handlePn = async (scope) =>{
@ -638,68 +665,29 @@ const handlePn = async (scope) =>{
} else{ } else{
scope.row.rgId = '' scope.row.rgId = ''
scope.row.matRest = '' scope.row.matRest = '0'
message.alertWarning('当前库位无库存数量可出库') message.alertWarning('当前库位无库存数量可出库')
} }
} }
const matList = ref<MaterialApi.MaterialVO[]>([]) //
const matSelectLoading = ref(false) const matSelectLoading = ref(false)
const remoteMatCodeSearch = async (name) => { const remoteMatCodeSearch = async (name) => {
matSelectLoading.value = true matSelectLoading.value = true
// //
let matParams = { await getMatList(name)
pageNo: 1,
pageSize: 10,
name: name,
status: '1'
}
const matLastRemoteData = await StorageMatApi.getStorageMatList(0)
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = []
matList.value = dataMat.list.filter(
(item) =>
matLastRemoteData.find(
(fish) => fish.matId === item.id && fish.whId == formData.value.whId
) !== undefined
)
matSelectLoading.value = false matSelectLoading.value = false
} }
const handleMatCode = async (scope, matid) => { const handleMatCode = async (scope, matid) => {
if (matid && matLastData.value.find((item) => item.matId === matid && item.whId== formData.value.whId)) { scope.row.matId = scope.row.matList.find((item) => item.id === matid)?.id
const matVo = matLastData.value.find((item) => item.matId === matid && item.whId== formData.value.whId) scope.row.matName = scope.row.matList.find((item) => item.id === matid)?.name
scope.row.matId = matVo.matId scope.row.matCode = scope.row.matList.find((item) => item.id === matid)?.code
scope.row.matName = matVo.matName scope.row.matSpec = scope.row.matList.find((item) => item.id === matid)?.spec
scope.row.matCode = matVo.matCode scope.row.matType = scope.row.matList.find((item) => item.id === matid)?.materialType
scope.row.matSpec = matVo.matSpec scope.row.matUnit = scope.row.matList.find((item) => item.id === matid)?.unit
scope.row.matType = matVo.materialType
scope.row.matUnit = matVo.matUnit scope.row.pnlist = pnList.value.filter(pn => pn.wh_id == formData.value.whId && matLastData.value.filter( mat => mat.matId == matid).length>0)
// scope.row.rgId = matVo.rgId
// scope.row.pnId = matVo.pnId
// scope.row.matRest = matVo.matRest
// scope.row.storageOkQty = matVo.storageOkQty
// scope.row.lotNo = matVo.lotNo
// scope.row.description = matVo.description
scope.row.pnlist = pnList.value.filter(row => row.id == row.rgId)
} else {
scope.row.matId = ''
scope.row.matName = ''
scope.row.matCode = ''
scope.row.matSpec = ''
scope.row.matType = ''
scope.row.matUnit = ''
scope.row.rgId = ''
scope.row.pnId = ''
scope.row.matRest = ''
scope.row.storageOkQty = ''
scope.row.lotNo = ''
scope.row.description = ''
scope.row.pnlist = []
}
} }
const matLastData = ref([]) const matLastData = ref([])
@ -753,32 +741,41 @@ const initStatus = async (status) => {
btnCancel.value = false btnCancel.value = false
} }
} }
const matList = ref<MaterialApi.MaterialVO[]>([]) //
const matEditList = ref<MaterialApi.MaterialVO[]>([]) //
const userList = ref<UserApi.UserVO[]>([]) // const userList = ref<UserApi.UserVO[]>([]) //
const matSimpList = ref([]) // const matSimpList = ref([]) //
const matSimpVirtualList = ref([]) // const matSimpVirtualList = ref([]) //
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
//
matLastData.value = await StorageMatApi.getStorageMatList(0)
// //
dialogTitle.value = query.type === 'review' ? '查看' : t('action.' + query.type) dialogTitle.value = query.type === 'review' ? '查看' : t('action.' + query.type)
//- //-
whList.value = await WarehouseApi.getWarehouseSimpList() whList.value = await WarehouseApi.getWarehouseSimpList()
//
await getMatList(name)
//
matLastData.value = await StorageMatApi.getStorageMatList(0)
//
if (query.id) {
// //
matSimpList.value = await MaterialApi.getSimpList() matSimpList.value = await MaterialApi.getSimpList()
matSimpVirtualList.value = await MaterialApi.getSimpVirtualList() matSimpVirtualList.value = await MaterialApi.getSimpVirtualList()
matEditList.value = matSimpList.value //matSimpList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0)
matList.value = matSimpList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0)
//
if (query.id) {
// //
formData.value = await StorageApi.getStorage(query.id) formData.value = await StorageApi.getStorage(query.id)
if(formData.value.vmatName){
matEditList.value = matSimpVirtualList.value
}
// //
await initStatus(formData.value.status) await initStatus(formData.value.status)
@ -802,22 +799,23 @@ onMounted(async () => {
// //
formData.value.matItemDOList.forEach((item) => { formData.value.matItemDOList.forEach((item) => {
item.cid = matCount item.cid = matCount
item.matId = matSimpList.value.find((record) => record.id === item.matId)?.id item.matId = matEditList.value.find((record) => record.id === item.matId)?.id
item.matCode = matSimpList.value.find( (record) => record.id === item.matId)?.code item.matCode = matEditList.value.find( (record) => record.id === item.matId)?.code
item.matName = matSimpList.value.find((record) => record.id === item.matId)?.name item.matName = matEditList.value.find((record) => record.id === item.matId)?.name
item.matSpec = matSimpList.value.find((record) => record.id === item.matId)?.spec item.matSpec = matEditList.value.find((record) => record.id === item.matId)?.spec
item.matType = matSimpList.value.find((record) => record.id === item.matId)?.material_type item.matType = matEditList.value.find((record) => record.id === item.matId)?.material_type
item.matUnit = matSimpList.value.find((record) => record.id === item.matId)?.unit item.matUnit = matEditList.value.find((record) => record.id === item.matId)?.unit
item.matRest = matLastData.value.find( row => row.matId == item.matId && row.pnId == item.pnId)?.matRest item.matRest = matLastData.value.find( row => row.matId == item.matId && row.pnId == item.pnId)?.matRest
item.matRest = (item.matRest==undefined || item.matRest.length==0)?0:item.matRest item.matRest = (item.matRest==undefined || item.matRest.length==0)?0:item.matRest
item.pnlist = pnList.value.filter((pn) => pn.rg_id === item.rgId) item.pnlist = pnList.value.filter((pn) => pn.wh_id === item.whId)
item.matList = matEditList.value.filter((record) => record.id === item.matId)
matCount = matCount + 1 matCount = matCount + 1
}) })
matList.value = matSimpList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0 || formData.value.matItemDOList.filter(fan => fan.matId == mat.id).length>0) // matList.value = matSimpList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0 || formData.value.matItemDOList.filter(fan => fan.matId == mat.id).length>0)
if(matList.value.length == 0){ // if(matList.value.length == 0){
matList.value = matSimpVirtualList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0 || formData.value.matItemDOList.filter(fan => fan.matId == mat.id).length>0) // matList.value = matSimpVirtualList.value.filter( mat => matLastData.value.filter( row => row.matId == mat.id).length>0 || formData.value.matItemDOList.filter(fan => fan.matId == mat.id).length>0)
} // }
// //
let attParams = { let attParams = {

@ -171,7 +171,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="180" fixed="right"> <el-table-column label="操作" align="center" width="180" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="openDetail('update', scope.row.id)"> <el-button link type="primary" @click="openDetail('update', scope.row.id)" v-if="scope.row.vmatName ==null">
编辑 编辑
</el-button> </el-button>
<el-button link type="primary" @click="openDetail('review', scope.row.id)"> <el-button link type="primary" @click="openDetail('review', scope.row.id)">

@ -152,7 +152,7 @@ from (
left join `mes-heli`.`wms_wh` `wh` on((`lg`.`wh_id` = `wh`.`id`))) left join `mes-heli`.`wms_wh` `wh` on((`lg`.`wh_id` = `wh`.`id`)))
left join `mes-heli`.`wms_rg` `rg` on((`lg`.`rg_id` = `rg`.`id`))) left join `mes-heli`.`wms_rg` `rg` on((`lg`.`rg_id` = `rg`.`id`)))
left join `mes-heli`.`wms_pn` `pn` on((`lg`.`pn_id` = `pn`.`id`))) left join `mes-heli`.`wms_pn` `pn` on((`lg`.`pn_id` = `pn`.`id`)))
where ((`st`.`deleted` = 0) and (`mat`.`deleted` = 0) and (`wh`.`deleted` = 0) and (`rg`.`deleted` = 0) and (`pn`.`deleted` = 0))) `t` where ((`st`.`deleted` = 0) and (`mat`.`deleted` = 0) and (`wh`.`deleted` = 0) and (`rg`.`deleted` = 0) and (`pn`.`deleted` = 0))) `t` where `t`.`storage_ok_qty` > 0
group by `t`.`deleted`,`t`.`id`,`t`.`creator`,`t`.`updater`,`t`.`tenant_id`,`t`.`mat_code`,`t`.`mat_name`,`t`.`mat_type`,`t`.`mat_spec`,`t`.`mat_unit`,`t`.`mat_brand`,`t`.`wh_id`,`t`.`wh_name`,`t`.`rg_id`,`t`.`rg_name`,`t`.`pn_id`,`t`.`pn_name`,`t`.`short_name` group by `t`.`deleted`,`t`.`id`,`t`.`creator`,`t`.`updater`,`t`.`tenant_id`,`t`.`mat_code`,`t`.`mat_name`,`t`.`mat_type`,`t`.`mat_spec`,`t`.`mat_unit`,`t`.`mat_brand`,`t`.`wh_id`,`t`.`wh_name`,`t`.`rg_id`,`t`.`rg_name`,`t`.`pn_id`,`t`.`pn_name`,`t`.`short_name`
CREATE OR REPLACE VIEW v_storage_material_amount AS CREATE OR REPLACE VIEW v_storage_material_amount AS

Loading…
Cancel
Save