出库管理 批次号处理

出库管理 批次号处理
pull/2/head
siontion 9 months ago
parent f856436e96
commit 933919ceab

@ -23,6 +23,6 @@
<result property="storageOkQty" column="storage_ok_qty"/>
</resultMap>
<select id="selectStorageMatValid" resultType="com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.StorageMatValidRespVO">
select mat_id,mat_name,mat_code,mat_rest,material_type,wh_id,rg_id,pn_id,spec as mat_spec,unit as mat_unit,lot_no,storage_ok_qty from v_storage_material_amount where mat_rest > 0
select mat_id,mat_name,mat_code,mat_rest,material_type,wh_id,rg_id,pn_id,spec as mat_spec,unit as mat_unit,'' as lot_no,storage_ok_qty from v_storage_material_amount where mat_rest > 0
</select>
</mapper>

@ -155,7 +155,7 @@
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="lotNo" label="批次号" align="center" min-width="120">
<el-table-column prop="lotNo" label="批次号" align="center" min-width="120" v-if="false">
<template #default="scope">
<el-input v-model="scope.row.lotNo" v-bind:disabled="btnView || btnSave"/>
</template>

@ -141,7 +141,7 @@
<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%" v-bind:disabled="btnView || btnSave">
<el-select v-model="scope.row.pnId" placeholder="" style="width: 100%" v-bind:disabled="btnView || btnSave" @change="handlePn(scope)">
<el-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pnName"
:value="dict.id" />
</el-select>
@ -158,7 +158,7 @@
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="lotNo" min-width="120" label="批次号" align="center" />
<el-table-column prop="lotNo" min-width="120" label="批次号" align="center" v-if="false" />
<el-table-column prop="description" min-width="180" label="备注" align="center">
<template #default="scope">
<el-input v-model="scope.row.description" v-bind:disabled="btnView || btnSave"/>
@ -622,6 +622,28 @@ const handleRg = async (scope) => {
//-------------------
}
const handlePn = async (scope) =>{
if (matLastData.value.find((item) => item.matId === scope.row.matId && item.whId== formData.value.whId && item.rgId == scope.row.rgId && item.pnId == scope.row.pnId)) {
const matVo = matLastData.value.find((item) => item.matId === scope.row.matId && item.whId== formData.value.whId && item.rgId == scope.row.rgId && item.pnId == scope.row.pnId)
scope.row.matId = matVo.matId
scope.row.matName = matVo.matName
scope.row.matCode = matVo.matCode
scope.row.matSpec = matVo.matSpec
scope.row.matType = matVo.materialType
scope.row.matUnit = matVo.matUnit
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
} else {
scope.row.matRest = ''
}
}
const matList = ref<MaterialApi.MaterialVO[]>([]) //
const matSelectLoading = ref(false)
const remoteMatCodeSearch = async (name) => {
@ -648,8 +670,8 @@ const remoteMatCodeSearch = async (name) => {
}
const handleMatCode = async (scope, matid) => {
if (matid && matLastData.value.find((item) => item.matId === matid)) {
const matVo = matLastData.value.find((item) => item.matId === matid)
if (matid && matLastData.value.find((item) => item.matId === matid && item.whId== formData.value.whId)) {
const matVo = matLastData.value.find((item) => item.matId === matid && item.whId== formData.value.whId)
scope.row.matId = matVo.matId
scope.row.matName = matVo.matName
scope.row.matCode = matVo.matCode

@ -20,7 +20,7 @@
:value="dict.label" />
</el-select>
</el-form-item>
<el-form-item label="批次号" prop="lotNo">
<el-form-item label="批次号" prop="lotNo" v-if="false">
<el-input v-model="queryParams.lotNo" placeholder="批次号" clearable @keyup.enter="handleQuery" class="!w-240px" />
</el-form-item>
<el-form-item label="仓库" prop="whId">
@ -65,7 +65,7 @@
<el-table-column label="仓库" align="center" prop="whName" min-width="120"/>
<el-table-column label="库区" align="center" prop="rgName" min-width="120"/>
<el-table-column label="库位" align="center" prop="pnName" min-width="120"/>
<el-table-column label="批次号" align="center" prop="lotNo" min-width="120"/>
<el-table-column label="批次号" align="center" prop="lotNo" min-width="120" v-if="false"/>
<el-table-column label="库存数量" align="center" prop="storageOkQty" min-width="120"/>
<el-table-column label="库存单位" align="center" prop="matUnit" min-width="120"/>
</el-table>

@ -45,7 +45,7 @@
/>
</el-select>
</el-form-item>
<el-form-item label="批次号" prop="lotNo">
<el-form-item label="批次号" prop="lotNo" v-if="false">
<el-input
v-model="queryParams.lotNo"
placeholder="批次号"
@ -114,7 +114,7 @@
<el-table-column label="仓库" align="center" prop="whName" min-width="120"/>
<el-table-column label="库区" align="center" prop="rgName" min-width="120"/>
<el-table-column label="库位" align="center" prop="pnName" min-width="120"/>
<el-table-column label="批次号" align="center" prop="lotNo" min-width="120"/>
<el-table-column label="批次号" align="center" prop="lotNo" min-width="120" v-if="false"/>
<el-table-column label="变动数量" align="center" prop="storageOkQty" fixed="right" min-width="120"/>
<el-table-column label="库存单位" align="center" prop="matUnit" fixed="right" min-width="120"/>
</el-table>

@ -130,31 +130,42 @@ from (((((`wms_storage_log` `lg`
where ((`st`.`deleted` = 0) and (`mat`.`deleted` = 0) and (`wh`.`deleted` = 0) and (`rg`.`deleted` = 0) and (`pn`.`deleted` = 0));
CREATE OR REPLACE VIEW v_storage_material_now AS
select `t`.`deleted` AS `deleted`,`t`.`id` AS `id`,`t`.`creator` AS `creator`,`t`.`create_time` AS `create_time`,`t`.`updater` AS `updater`,`t`.`update_time` AS `update_time`,`t`.`tenant_id` AS `tenant_id`,
`t`.`mat_code` AS `mat_code`,`t`.`mat_name` AS `mat_name`,`t`.`mat_type` AS `mat_type`,`t`.`mat_spec` AS `mat_spec`,`t`.`mat_unit` AS `mat_unit`,`t`.`mat_brand` AS `mat_brand`,
`t`.`wh_id` AS `wh_id`,`t`.`wh_name` AS `wh_name`,`t`.`rg_id` AS `rg_id`,`t`.`rg_name` AS `rg_name`,`t`.`pn_id` AS `pn_id`,`t`.`pn_name` AS `pn_name`,`t`.`lot_no` AS `lot_no`,`t`.`short_name` AS `short_name`,
sum(`t`.`storage_ok_qty`) AS `storage_ok_qty`
select `t`.`deleted` AS `deleted`,`t`.`id` AS `id`,`t`.`creator` AS `creator`,`t`.`updater` AS `updater`,cast('2000-01-01 00:00' as date) AS `create_time`,cast('2000-01-01 00:00' as date) AS `update_time`,
`t`.`tenant_id` AS `tenant_id`,`t`.`mat_code` AS `mat_code`,`t`.`mat_name` AS `mat_name`,
`t`.`mat_type` AS `mat_type`,`t`.`mat_spec` AS `mat_spec`,`t`.`mat_unit` AS `mat_unit`,`t`.`mat_brand` AS `mat_brand`,`t`.`wh_id` AS `wh_id`,`t`.`wh_name` AS `wh_name`,`t`.`rg_id` AS `rg_id`,
`t`.`rg_name` AS `rg_name`,`t`.`pn_id` AS `pn_id`,`t`.`pn_name` AS `pn_name`,'' AS `lot_no`,`t`.`short_name` AS `short_name`,sum(`t`.`storage_ok_qty`) AS `storage_ok_qty`
from (
select 0 AS `deleted`,`mat`.`id` AS `id`,`mat`.`creator` AS `creator`,`mat`.`create_time` AS `create_time`,`mat`.`updater` AS `updater`,`mat`.`update_time` AS `update_time`,`mat`.`tenant_id` AS `tenant_id`,
`mat`.`code` AS `mat_code`,`mat`.`name` AS `mat_name`,(select `mes-heli`.`system_dict_data`.`label`
from `mes-heli`.`system_dict_data`
where ((`mes-heli`.`system_dict_data`.`dict_type` = 'heli_material_type') and (`mes-heli`.`system_dict_data`.`value` = `mat`.`material_type`))) AS `mat_type`,
(case when (isnull(`mat`.`short_name`) = TRUE) then '' else `mat`.`short_name` end) AS `short_name`,(case when (isnull(`mat`.`spec`) = TRUE) then '' else `mat`.`spec` end) AS `mat_spec`,
(case when (isnull(`mat`.`brand`) = TRUE) then '' else `mat`.`brand` end) AS `mat_brand`,(select `mes-heli`.`system_dict_data`.`label` from `mes-heli`.`system_dict_data` where ((`mes-heli`.`system_dict_data`.`dict_type` = 'heli_material_unit') and (`mes-heli`.`system_dict_data`.`value` = `mat`.`unit`))) AS `mat_unit`,
select 0 AS `deleted`,`mat`.`id` AS `id`,`mat`.`creator` AS `creator`,`mat`.`updater` AS `updater`,`mat`.`tenant_id` AS `tenant_id`,`mat`.`code` AS `mat_code`,`mat`.`name` AS `mat_name`,
(select `mes-heli`.`system_dict_data`.`label` from `mes-heli`.`system_dict_data` where ((`mes-heli`.`system_dict_data`.`dict_type` = 'heli_material_type') and (`mes-heli`.`system_dict_data`.`value` = `mat`.`material_type`))) AS `mat_type`,
(case when (isnull(`mat`.`short_name`) = TRUE) then '' else `mat`.`short_name` end) AS `short_name`,
(case when (isnull(`mat`.`spec`) = TRUE) then '' else `mat`.`spec` end) AS `mat_spec`,
(case when (isnull(`mat`.`brand`) = TRUE) then '' else `mat`.`brand` end) AS `mat_brand`,
(select `mes-heli`.`system_dict_data`.`label` from `mes-heli`.`system_dict_data` where ((`mes-heli`.`system_dict_data`.`dict_type` = 'heli_material_unit') and (`mes-heli`.`system_dict_data`.`value` = `mat`.`unit`))) AS `mat_unit`,
`wh`.`id` AS `wh_id`,`wh`.`wh_name` AS `wh_name`,`rg`.`id` AS `rg_id`,`rg`.`rg_name` AS `rg_name`,`pn`.`id` AS `pn_id`,`pn`.`pn_name` AS `pn_name`,
(case when (isnull(`lg`.`lot_no`) = 1) then '' else `lg`.`lot_no` end) AS `lot_no`,(case when ((`st`.`stock_type` = 1) and (`lg`.`status` = 2)) then `lg`.`storage_ok_qty` when ((`st`.`stock_type` = 1) and (`lg`.`status` = 3)) then (-(1) * `lg`.`storage_ok_qty`) when ((`st`.`stock_type` = 2) and (`lg`.`status` = 2)) then (-(1) * `lg`.`storage_ok_qty`) when ((`st`.`stock_type` = 2) and (`lg`.`status` = 3)) then `lg`.`storage_ok_qty` else `lg`.`storage_ok_qty` end) AS `storage_ok_qty`
from (((((`mes-heli`.`wms_storage_log` `lg` left join `mes-heli`.`wms_storage` `st` on((`lg`.`stock_id` = `st`.`id`))) left join `mes-heli`.`base_material` `mat` on((`lg`.`mat_id` = `mat`.`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_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`
group by `t`.`deleted`,`t`.`id`,`t`.`creator`,`t`.`create_time`,`t`.`updater`,`t`.`update_time`,`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`.`lot_no`,`t`.`short_name`;
(case when (isnull(`lg`.`lot_no`) = 1) then '' else `lg`.`lot_no` end) AS `lot_no`,
(case when ((`st`.`stock_type` = 1) and (`lg`.`status` = 2)) then `lg`.`storage_ok_qty` when ((`st`.`stock_type` = 1) and (`lg`.`status` = 3)) then (-(1) * `lg`.`storage_ok_qty`) when ((`st`.`stock_type` = 2) and (`lg`.`status` = 2)) then (-(1) * `lg`.`storage_ok_qty`) when ((`st`.`stock_type` = 2) and (`lg`.`status` = 3)) then `lg`.`storage_ok_qty` else `lg`.`storage_ok_qty` end) AS `storage_ok_qty`
from (((((`mes-heli`.`wms_storage_log` `lg`
left join `mes-heli`.`wms_storage` `st` on((`lg`.`stock_id` = `st`.`id`)))
left join `mes-heli`.`base_material` `mat` on((`lg`.`mat_id` = `mat`.`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_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`
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
select `t`.`tenant_id` AS `tenant_id`,`t`.`mat_id` AS `mat_id`,`t`.`mat_name` AS `mat_name`,`t`.`mat_code` AS `mat_code`,`t`.`wh_id` AS `wh_id`,`t`.`rg_id` AS `rg_id`,`t`.`pn_id` AS `pn_id`,
`t`.`spec` AS `spec`,`t`.`unit` AS `unit`,`t`.`material_type` AS `material_type`,`t`.`lot_no` AS `lot_no`,'' AS `storage_ok_qty`,sum(`t`.`storage_ok_qty`) AS `mat_rest`
select `t`.`deleted` AS `deleted`,`t`.`id` AS `mat_id`,`t`.`creator` AS `creator`,`t`.`updater` AS `updater`,`t`.`tenant_id` AS `tenant_id`,`t`.`mat_code` AS `mat_code`,`t`.`mat_name` AS `mat_name`,
`t`.`material_type` AS `material_type`,`t`.`spec` AS `spec`,`t`.`unit` AS `unit`,`t`.`wh_id` AS `wh_id`,`t`.`rg_id` AS `rg_id`,`t`.`pn_id` AS `pn_id`,`t`.`short_name` AS `short_name`,
0 AS `storage_ok_qty`,sum(`t`.`storage_ok_qty`) AS `mat_rest`
from (
select `st`.`stock_type` AS `stock_type`,`mat`.`tenant_id` AS `tenant_id`,`mat`.`mat_id` AS `mat_id`,`bm`.`code` AS `mat_code`,`bm`.`name` AS `mat_name`,`mat`.`wh_id` AS `wh_id`,`mat`.`rg_id` AS `rg_id`,`mat`.`pn_id` AS `pn_id`,`mat`.`lot_no` AS `lot_no`,`bm`.`spec` AS `spec`,`bm`.`unit` AS `unit`,`bm`.`material_type` AS `material_type`,
(case when ((`st`.`status` = 2) and (`st`.`stock_type` = 1)) then `mat`.`storage_ok_qty` when ((`st`.`status` = 3) and (`st`.`stock_type` = 1)) then (-(1) * `mat`.`storage_ok_qty`) when ((`st`.`status` = 2) and (`st`.`stock_type` = 2)) then (-(1) * `mat`.`storage_ok_qty`) when ((`st`.`status` = 3) and (`st`.`stock_type` = 2)) then `mat`.`storage_ok_qty` else 0 end) AS `storage_ok_qty`
from ((`mes-heli`.`wms_storage_mat` `mat`
left join `mes-heli`.`wms_storage` `st` on((`mat`.`stock_id` = `st`.`id`)))
left join `mes-heli`.`base_material` `bm` on((`mat`.`mat_id` = `bm`.`id`)))
where ((`mat`.`deleted` = 0) and (`st`.`status` <> 1) and (`st`.`deleted` = 0) and (`bm`.`deleted` = 0) and (`bm`.`status` = 1))
) `t` group by `t`.`mat_id`;
select 0 AS `deleted`,`mat`.`id` AS `id`,`mat`.`creator` AS `creator`,`mat`.`updater` AS `updater`,`mat`.`tenant_id` AS `tenant_id`,`mat`.`code` AS `mat_code`,`mat`.`name` AS `mat_name`,
`mat`.`material_type` AS `material_type`,(case when (isnull(`mat`.`short_name`) = TRUE) then '' else `mat`.`short_name` end) AS `short_name`,
`mat`.`spec` AS `spec`,`mat`.`unit` AS `unit`,`lg`.`wh_id` AS `wh_id`,`lg`.`rg_id` AS `rg_id`,`lg`.`pn_id` AS `pn_id`,
(case when (isnull(`lg`.`lot_no`) = 1) then '' else `lg`.`lot_no` end) AS `lot_no`,
(case when ((`st`.`stock_type` = 1) and (`lg`.`status` = 2)) then `lg`.`storage_ok_qty` when ((`st`.`stock_type` = 1) and (`lg`.`status` = 3)) then (-(1) * `lg`.`storage_ok_qty`) when ((`st`.`stock_type` = 2) and (`lg`.`status` = 2)) then (-(1) * `lg`.`storage_ok_qty`) when ((`st`.`stock_type` = 2) and (`lg`.`status` = 3)) then `lg`.`storage_ok_qty` else `lg`.`storage_ok_qty` end) AS `storage_ok_qty`
from ((`mes-heli`.`wms_storage_log` `lg`
left join `mes-heli`.`wms_storage` `st` on((`lg`.`stock_id` = `st`.`id`)))
left join `mes-heli`.`base_material` `mat` on((`lg`.`mat_id` = `mat`.`id`)))
where ((`st`.`deleted` = 0) and (`mat`.`deleted` = 0) and (`lg`.`deleted` = 0))
) `t`
group by `t`.`deleted`,`t`.`id`,`t`.`creator`,`t`.`updater`,`t`.`tenant_id`,`t`.`mat_code`,`t`.`mat_name`,`t`.`material_type`,`t`.`spec`,`t`.`unit`,`t`.`wh_id`,`t`.`rg_id`,`t`.`pn_id`,`t`.`short_name`;
Loading…
Cancel
Save