入库出库 页面接口调整

入库出库 页面接口调整
pull/1/head
siontion 9 months ago
parent e377490c90
commit 97a69bce8b

@ -106,4 +106,14 @@ public class StorageMatController {
BeanUtils.toBean(list, StorageMatRespVO.class));
}
@GetMapping("/get-materials")
@Operation(summary = "获得入/出库物料")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('heli:storage-mat:query')")
public CommonResult<List<StorageMatValidRespVO>> getStorageMatList() {
List<StorageMatValidRespVO> list = storageMatService.getStorageMatList();
return success(BeanUtils.toBean(list, StorageMatValidRespVO.class));
}
}

@ -0,0 +1,37 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class StorageMatValidRespVO {
private Long matId;
private String matName;
private String matCode;
private String materialType;
private Long whId;
private Long rgId;
private Long pnId;
private BigDecimal matRest;
private String lotNo;
private String spec;
private String unit;
private String storageOkQty;
}

@ -33,5 +33,5 @@ public interface StorageMatMapper extends BaseMapperX<StorageMatDO> {
.betweenIfPresent(StorageMatDO::getUpdateTime, reqVO.getUpdateTime())
.orderByDesc(StorageMatDO::getId));
}
List<StorageMatValidRespVO> selectStorageMatValid();
}

@ -1,55 +1,62 @@
package com.chanko.yunxi.mes.module.heli.service.storagemat;
import java.util.*;
import javax.validation.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
/**
* / Service
*
* @author
*/
public interface StorageMatService {
/**
* /
*
* @param createReqVO
* @return
*/
Long createStorageMat(@Valid StorageMatSaveReqVO createReqVO);
/**
* /
*
* @param updateReqVO
*/
void updateStorageMat(@Valid StorageMatSaveReqVO updateReqVO);
/**
* /
*
* @param id
*/
void deleteStorageMat(Long id);
/**
* /
*
* @param id
* @return /
*/
StorageMatDO getStorageMat(Long id);
/**
* /
*
* @param pageReqVO
* @return /
*/
PageResult<StorageMatDO> getStorageMatPage(StorageMatPageReqVO pageReqVO);
}
package com.chanko.yunxi.mes.module.heli.service.storagemat;
import java.util.*;
import javax.validation.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
/**
* / Service
*
* @author
*/
public interface StorageMatService {
/**
* /
*
* @param createReqVO
* @return
*/
Long createStorageMat(@Valid StorageMatSaveReqVO createReqVO);
/**
* /
*
* @param updateReqVO
*/
void updateStorageMat(@Valid StorageMatSaveReqVO updateReqVO);
/**
* /
*
* @param id
*/
void deleteStorageMat(Long id);
/**
* /
*
* @param id
* @return /
*/
StorageMatDO getStorageMat(Long id);
/**
* /
*
* @param pageReqVO
* @return /
*/
PageResult<StorageMatDO> getStorageMatPage(StorageMatPageReqVO pageReqVO);
/**
* /
*
* @return /
*/
List<StorageMatValidRespVO> getStorageMatList();
}

@ -1,74 +1,84 @@
package com.chanko.yunxi.mes.module.heli.service.storagemat;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.dal.mysql.storagemat.StorageMatMapper;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/**
* / Service
*
* @author
*/
@Service
@Validated
public class StorageMatServiceImpl implements StorageMatService {
@Resource
private StorageMatMapper storageMatMapper;
@Override
public Long createStorageMat(StorageMatSaveReqVO createReqVO) {
// 插入
StorageMatDO storageMat = BeanUtils.toBean(createReqVO, StorageMatDO.class);
storageMatMapper.insert(storageMat);
// 返回
return storageMat.getId();
}
@Override
public void updateStorageMat(StorageMatSaveReqVO updateReqVO) {
// 校验存在
validateStorageMatExists(updateReqVO.getId());
// 更新
StorageMatDO updateObj = BeanUtils.toBean(updateReqVO, StorageMatDO.class);
storageMatMapper.updateById(updateObj);
}
@Override
public void deleteStorageMat(Long id) {
// 校验存在
validateStorageMatExists(id);
// 删除
storageMatMapper.deleteById(id);
}
private void validateStorageMatExists(Long id) {
if (storageMatMapper.selectById(id) == null) {
throw exception(STORAGE_MAT_NOT_EXISTS);
}
}
@Override
public StorageMatDO getStorageMat(Long id) {
return storageMatMapper.selectById(id);
}
@Override
public PageResult<StorageMatDO> getStorageMatPage(StorageMatPageReqVO pageReqVO) {
return storageMatMapper.selectPage(pageReqVO);
}
}
package com.chanko.yunxi.mes.module.heli.service.storagemat;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.dal.mysql.storagemat.StorageMatMapper;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/**
* / Service
*
* @author
*/
@Service
@Validated
public class StorageMatServiceImpl implements StorageMatService {
@Resource
private StorageMatMapper storageMatMapper;
@Resource
private StorageMatMapper storageMatGlobalMapper;
@Override
public Long createStorageMat(StorageMatSaveReqVO createReqVO) {
// 插入
StorageMatDO storageMat = BeanUtils.toBean(createReqVO, StorageMatDO.class);
storageMatMapper.insert(storageMat);
// 返回
return storageMat.getId();
}
@Override
public void updateStorageMat(StorageMatSaveReqVO updateReqVO) {
// 校验存在
validateStorageMatExists(updateReqVO.getId());
// 更新
StorageMatDO updateObj = BeanUtils.toBean(updateReqVO, StorageMatDO.class);
storageMatMapper.updateById(updateObj);
}
@Override
public void deleteStorageMat(Long id) {
// 校验存在
validateStorageMatExists(id);
// 删除
storageMatMapper.deleteById(id);
}
private void validateStorageMatExists(Long id) {
if (storageMatMapper.selectById(id) == null) {
throw exception(STORAGE_MAT_NOT_EXISTS);
}
}
@Override
public StorageMatDO getStorageMat(Long id) {
return storageMatMapper.selectById(id);
}
@Override
public PageResult<StorageMatDO> getStorageMatPage(StorageMatPageReqVO pageReqVO) {
return storageMatMapper.selectPage(pageReqVO);
}
@Override
public List<StorageMatValidRespVO> getStorageMatList() {
return storageMatMapper.selectStorageMatValid();
}
}

@ -8,5 +8,21 @@
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<resultMap id="StorageMatValidRespVO" type="com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.StorageMatValidRespVO">
<result property="matId" column="mat_id"/>
<result property="matName" column="mat_name"/>
<result property="matCode" column="mat_code"/>
<result property="materialType" column="material_type"/>
<result property="whId" column="wh_id"/>
<result property="rgId" column="rg_id"/>
<result property="pnId" column="pn_id"/>
<result property="spec" column="spec"/>
<result property="unit" column="unit"/>
<result property="lotNo" column="lot_no"/>
<result property="matRest" column="mat_rest"/>
<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,unit,lot_no,storage_ok_qty from v_storage_material_amount where mat_rest > 0
</select>
</mapper>

@ -13,6 +13,11 @@ export interface StorageMatVO {
description: string
}
// 查询入/出库物料详情
export const getStorageMatList = async () => {
return await request.get({ url: `/heli/storage-mat/get-materials`})
}
// 查询入/出库物料分页
export const getStorageMatPage = async (params) => {
return await request.get({ url: `/heli/storage-mat/page`, params })

@ -400,9 +400,6 @@ const matUploadChange = (file, files) => {
}
const refreshAttachments = (files, type) => {
formData.value.attachments = formData.value.attachments.filter((value, index, array) => {
return value.businessFileType != type;
});
for (let i = 0; i < files.length; i++) {
let file = files[i];
file.businessFileType = type;
@ -514,37 +511,6 @@ const onAddItem = () => {
}
//
const handlefuke = (index, item) => {
const data: any = formData.value.matItemDOList[index]
//
const newData: any = {
...data,
cid: matCount,
stockId: item.stockId,
matId: item.matId,
matName: item.matName,
matCode: item.matCode,
matType: item.matType,
matSpec: item.matSpec,
matUnit: item.matUnit,
whId: item.whId,
rgId: item.rgId,
pnId: item.pnId,
pnlist: item.pnlist,
storageOkQty: item.storageOkQty,
lotNo: item.lotNo,
projectNo: '',
description: item.description,
productBomItemValueDOList: []
}
matCount = matCount + 1
//
formData.value.matItemDOList.splice(index + 1, 0, newData)
}
//
const handleDelete2 = (index: number) => {
formData.value.matItemDOList.splice(index, 1)

@ -3,7 +3,7 @@
<template #header>
<span v-text="dialogTitle"></span>
</template>
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading">
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading" v-bind:disabled="isShowBtnOther">
<!-- 基础信息 -->
<el-card class="hl-card-info">
<template #header>
@ -62,7 +62,7 @@
<el-row>
<el-col :span="24">
<el-form-item prop="whId" label="出库仓库" required>
<el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh">
<el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh" v-bind:disabled="btnWhClickable">
<el-option v-for="dict in warehouseList" :key="dict.id" :label="dict.whName" :value="dict.id" />
</el-select>
</el-form-item>
@ -106,19 +106,7 @@
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="matCode" label="物料编码">
<!-- <template #default="scope">
<el-input v-model="scope.row.matName"
:disabled="!scope.row.editable" />
<el-select v-model="scope.row.matName" placeholder="物料名称" :remote-method="remoteMatSearch"
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading" @click="handleMatName"
class="!w-180px">
<el-option v-for="item in matList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</template> -->
</el-table-column>
<el-table-column prop="matCode" label="物料编码" />
<el-table-column prop="matType" label="物料类型">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType"
@ -133,10 +121,10 @@
v-if="scope.row.matUnit ? true : false" />
</template>
</el-table-column>
<el-table-column prop="rgId" width="140" label="出库库区" required>
<el-table-column prop="rgId" width="140" label="出库库区" required >
<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="handleRg(scope)" disabled>
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" />
</el-select>
</el-form-item>
@ -152,16 +140,13 @@
</el-form-item>
</template>
</el-table-column>
<el-table-column prop="storageOkQty" width="120" label="出库数量" required>
<el-table-column prop="matRest" label="库存数量" />
<el-table-column prop="matRest" width="120" label="出库数量" required>
<template #default="scope">
<el-input v-model="scope.row.storageOkQty" />
</template>
</el-table-column>
<el-table-column prop="lotNo" width="120" label="批次号">
<template #default="scope">
<el-input v-model="scope.row.lotNo" />
</template>
</el-table-column>
<el-table-column prop="lotNo" width="120" label="批次号" />
<el-table-column prop="description" width="150" label="备注">
<template #default="scope">
<el-input v-model="scope.row.description" />
@ -178,7 +163,7 @@
</el-button>
<el-button link type="primary" @click="handlefuke(scope.$index, scope.row)">复制</el-button> -->
<el-button link type="danger" size="small" @click.prevent="handleDelete2(scope.$index)">
<el-button link type="danger" size="small" @click.prevent="handleDelete2(scope.$index)" v-bind:disabled="isShowBtnOther">
删除
</el-button>
</template>
@ -220,7 +205,7 @@
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button link type="danger" size="small"
<el-button link type="danger" size="small" v-bind:disabled="isShowBtnOther"
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)">
删除
</el-button>
@ -394,9 +379,6 @@ const matUploadChange = (file, files) => {
}
const refreshAttachments = (files, type) => {
formData.value.attachments = formData.value.attachments.filter((value, index, array) => {
return value.businessFileType != type;
});
for (let i = 0; i < files.length; i++) {
let file = files[i];
file.businessFileType = type;
@ -507,36 +489,6 @@ const onAddItem = () => {
}
//
const handlefuke = (index, item) => {
const data: any = formData.value.matItemDOList[index]
//
const newData: any = {
...data,
cid: matCount,
stockId: item.stockId,
matId: item.matId,
matName: item.matName,
matCode: item.matCode,
matType: item.matType,
matSpec: item.matSpec,
matUnit: item.matUnit,
whId: item.whId,
rgId: item.rgId,
pnId: item.pnId,
pnlist: item.pnlist,
storageOkQty: item.storageOkQty,
lotNo: item.lotNo,
description: item.description,
productBomItemValueDOList: []
}
matCount = matCount + 1
//
formData.value.matItemDOList.splice(index + 1, 0, newData)
}
//
const handleDelete2 = (index: number) => {
formData.value.matItemDOList.splice(index, 1)
@ -584,18 +536,21 @@ const handleRg = (async (scope) => {
const matList = ref<MaterialApi.MaterialVO[]>([]) //
const matSelectLoading = ref(false);
const remoteMatCodeSearch = async (code) => {
const remoteMatCodeSearch = async (name) => {
matSelectLoading.value = true
//
let matParams = {
pageNo: 1,
pageSize: 10,
name: code,
name: name,
status: "1"
}
const matLastRemoteData = await StorageMatApi.getStorageMatList()
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = []
matList.value = dataMat.list
matList.value = dataMat.list.filter( (item) => matLastRemoteData.find( (fish) =>fish.matId === item.id ) !== undefined)
matSelectLoading.value = false
}
@ -606,6 +561,7 @@ const handleMatCode = async (scope, matid) => {
const matVo = await MaterialApi.getMaterial(scope.row.matId)
scope.row.matId = matVo.id
scope.row.matName = matVo.name
scope.row.matCode = matVo.code
scope.row.matSpec = matVo.spec
scope.row.matType = matVo.materialType
scope.row.matUnit = matVo.unit
@ -621,9 +577,15 @@ const handleMatCode = async (scope, matid) => {
const isShowBtnGroup = ref(true)
const isShowBtnCancel = ref(false)
const isShowBtnOther = ref(false)
const btnWhClickable = ref(false)
/** 初始化 **/
onMounted(async () => {
btnWhClickable.value = query.type === 'update'?true:false
const matLastData = await StorageMatApi.getStorageMatList()
//
let matParams = {
pageNo: 1,
@ -663,6 +625,12 @@ onMounted(async () => {
default:
break
}
//
if(query.type === 'review'){
isShowBtnGroup.value = false;
isShowBtnCancel.value = false;
isShowBtnOther.value = true;
}
//
const queryParamsRg = reactive({
@ -711,6 +679,7 @@ onMounted(async () => {
item.matType = matVos.list.find((record) => record.id === item.matId)?.materialType
item.matUnit = matVos.list.find((record) => record.id === item.matId)?.unit
item.pnlist = pnList.value.filter((pn) => pn.rgId === item.rgId)
item.matRest = matLastData.find((rest) => rest.rgId === item.rgId && rest.pnId === item.pnId)?.matRest
matCount = matCount + 1
})

Loading…
Cancel
Save