fix(biz): 修复入库退料相关功能
This commit is contained in:
parent
8c0e19372c
commit
cb588a8386
@ -74,8 +74,8 @@ public class RawStorageMatController {
|
|||||||
@Operation(summary = "获得原料入/出库物料分页")
|
@Operation(summary = "获得原料入/出库物料分页")
|
||||||
@PreAuthorize("@ss.hasPermission('twm:raw-storage-mat:query')")
|
@PreAuthorize("@ss.hasPermission('twm:raw-storage-mat:query')")
|
||||||
public CommonResult<PageResult<RawStorageMatRespVO>> getRawStorageMatPage(@Valid RawStorageMatPageReqVO pageReqVO) {
|
public CommonResult<PageResult<RawStorageMatRespVO>> getRawStorageMatPage(@Valid RawStorageMatPageReqVO pageReqVO) {
|
||||||
PageResult<RawStorageMatDO> pageResult = rawStorageMatService.getRawStorageMatPage(pageReqVO);
|
PageResult<RawStorageMatRespVO> pageResult = rawStorageMatService.getRawStorageMatPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, RawStorageMatRespVO.class));
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@ -85,7 +85,7 @@ public class RawStorageMatController {
|
|||||||
public void exportRawStorageMatExcel(@Valid RawStorageMatPageReqVO pageReqVO,
|
public void exportRawStorageMatExcel(@Valid RawStorageMatPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
List<RawStorageMatDO> list = rawStorageMatService.getRawStorageMatPage(pageReqVO).getList();
|
List<RawStorageMatRespVO> list = rawStorageMatService.getRawStorageMatPage(pageReqVO).getList();
|
||||||
// 导出 Excel
|
// 导出 Excel
|
||||||
ExcelUtils.write(response, "原料入/出库物料.xls", "数据", RawStorageMatRespVO.class,
|
ExcelUtils.write(response, "原料入/出库物料.xls", "数据", RawStorageMatRespVO.class,
|
||||||
BeanUtils.toBean(list, RawStorageMatRespVO.class));
|
BeanUtils.toBean(list, RawStorageMatRespVO.class));
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 原料入/出库物料 Response VO")
|
@Schema(description = "管理后台 - 原料入/出库物料 Response VO")
|
||||||
@ -22,6 +23,23 @@ public class RawStorageMatRespVO {
|
|||||||
@ExcelProperty("入/出库Id")
|
@ExcelProperty("入/出库Id")
|
||||||
private Long stockId;
|
private Long stockId;
|
||||||
|
|
||||||
|
@Schema(description = "操作类型")
|
||||||
|
@ExcelProperty("操作类型")
|
||||||
|
private String operatorType;
|
||||||
|
|
||||||
|
@Schema(description = "业务类型")
|
||||||
|
@ExcelProperty("业务类型")
|
||||||
|
private String businessType;
|
||||||
|
|
||||||
|
@Schema(description = "单据编号")
|
||||||
|
@ExcelProperty("单据编号")
|
||||||
|
private String billNo;
|
||||||
|
|
||||||
|
@Schema(description = "单据日期")
|
||||||
|
@ExcelProperty("单据日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
|
private LocalDate billDate;
|
||||||
|
|
||||||
@Schema(description = "备注", example = "你猜")
|
@Schema(description = "备注", example = "你猜")
|
||||||
@ExcelProperty("备注")
|
@ExcelProperty("备注")
|
||||||
private String description;
|
private String description;
|
||||||
@ -103,4 +121,6 @@ public class RawStorageMatRespVO {
|
|||||||
@ExcelProperty("存货账单号")
|
@ExcelProperty("存货账单号")
|
||||||
private String inventBillNo;
|
private String inventBillNo;
|
||||||
|
|
||||||
|
private BigDecimal returnQty;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,15 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.rawstoragemat;
|
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.rawstoragemat;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.mapper.BaseMapperX;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.ningxia.yunxi.chemmes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.ningxia.yunxi.chemmes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatPageReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatRespVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.rawstorage.RawStorageDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.rawstoragemat.RawStorageMatDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.rawstoragemat.RawStorageMatDO;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -17,30 +22,40 @@ import java.util.List;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface RawStorageMatMapper extends BaseMapperX<RawStorageMatDO> {
|
public interface RawStorageMatMapper extends BaseMapperX<RawStorageMatDO> {
|
||||||
|
|
||||||
default PageResult<RawStorageMatDO> selectPage(RawStorageMatPageReqVO reqVO) {
|
default PageResult<RawStorageMatRespVO> selectPage(RawStorageMatPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<RawStorageMatDO>()
|
MPJLambdaWrapper<RawStorageMatDO> wrapper = new MPJLambdaWrapper<RawStorageMatDO>()
|
||||||
.eqIfPresent(RawStorageMatDO::getStockId, reqVO.getStockId())
|
// 选择子表字段
|
||||||
.eqIfPresent(RawStorageMatDO::getDescription, reqVO.getDescription())
|
.selectAll(RawStorageMatDO.class)
|
||||||
.betweenIfPresent(RawStorageMatDO::getCreateTime, reqVO.getCreateTime())
|
// 选择主表字段
|
||||||
.eqIfPresent(RawStorageMatDO::getStoreHouseId, reqVO.getStoreHouseId())
|
.selectAs(RawStorageDO::getBillNo, RawStorageMatRespVO::getBillNo)
|
||||||
.eqIfPresent(RawStorageMatDO::getStoreAreaId, reqVO.getStoreAreaId())
|
.selectAs(RawStorageDO::getOperatorType, RawStorageMatRespVO::getOperatorType)
|
||||||
.eqIfPresent(RawStorageMatDO::getStoreHouseCd, reqVO.getStoreHouseCd())
|
.selectAs(RawStorageDO::getBusinessType, RawStorageMatRespVO::getBusinessType)
|
||||||
.likeIfPresent(RawStorageMatDO::getStoreHouseName, reqVO.getStoreHouseName())
|
.selectAs(RawStorageDO::getBillDate, RawStorageMatRespVO::getBillDate)
|
||||||
.eqIfPresent(RawStorageMatDO::getStoreAreCd, reqVO.getStoreAreCd())
|
// LEFT JOIN 主表
|
||||||
.likeIfPresent(RawStorageMatDO::getStoreAreaName, reqVO.getStoreAreaName())
|
.leftJoin(RawStorageDO.class, RawStorageDO::getId, RawStorageMatDO::getStockId)
|
||||||
.eqIfPresent(RawStorageMatDO::getMaterialId, reqVO.getMaterialId())
|
// 查询条件 - 子表
|
||||||
.likeIfPresent(RawStorageMatDO::getMatName, reqVO.getMatName())
|
.eq(reqVO.getStoreHouseId() != null, RawStorageMatDO::getStoreHouseId, reqVO.getStoreHouseId())
|
||||||
.eqIfPresent(RawStorageMatDO::getMatCode, reqVO.getMatCode())
|
.eq(reqVO.getStoreAreaId() != null, RawStorageMatDO::getStoreAreaId, reqVO.getStoreAreaId())
|
||||||
.eqIfPresent(RawStorageMatDO::getSpec, reqVO.getSpec())
|
.eq(StringUtils.isNotBlank(reqVO.getStoreHouseCd()), RawStorageMatDO::getStoreHouseCd, reqVO.getStoreHouseCd())
|
||||||
.eqIfPresent(RawStorageMatDO::getUnit, reqVO.getUnit())
|
.like(StringUtils.isNotBlank(reqVO.getStoreHouseName()), RawStorageMatDO::getStoreHouseName, reqVO.getStoreHouseName())
|
||||||
.eqIfPresent(RawStorageMatDO::getLotNo, reqVO.getLotNo())
|
.eq(StringUtils.isNotBlank(reqVO.getStoreAreCd()), RawStorageMatDO::getStoreAreCd, reqVO.getStoreAreCd())
|
||||||
.eqIfPresent(RawStorageMatDO::getOperatorQty, reqVO.getOperatorQty())
|
.like(StringUtils.isNotBlank(reqVO.getStoreAreaName()), RawStorageMatDO::getStoreAreaName, reqVO.getStoreAreaName())
|
||||||
.eqIfPresent(RawStorageMatDO::getPurQty, reqVO.getPurQty())
|
.like(StringUtils.isNotBlank(reqVO.getMatName()), RawStorageMatDO::getMatName, reqVO.getMatName())
|
||||||
.eqIfPresent(RawStorageMatDO::getSourceQty, reqVO.getSourceQty())
|
.eq(StringUtils.isNotBlank(reqVO.getMatCode()), RawStorageMatDO::getMatCode, reqVO.getMatCode())
|
||||||
.eqIfPresent(RawStorageMatDO::getSourceId, reqVO.getSourceId())
|
.eq(StringUtils.isNotBlank(reqVO.getInventBillNo()), RawStorageMatDO::getInventBillNo, reqVO.getInventBillNo())
|
||||||
.eqIfPresent(RawStorageMatDO::getRelarionId, reqVO.getRelarionId())
|
// 查询条件 - 主表
|
||||||
.eqIfPresent(RawStorageMatDO::getInventBillNo, reqVO.getInventBillNo())
|
.like(StringUtils.isNotBlank(reqVO.getBillNo()), RawStorageDO::getBillNo, reqVO.getBillNo())
|
||||||
.orderByDesc(RawStorageMatDO::getId));
|
.orderByDesc(RawStorageMatDO::getId);
|
||||||
|
|
||||||
|
return selectJoinPage(reqVO, RawStorageMatRespVO.class, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联分页查询
|
||||||
|
*/
|
||||||
|
default <V> PageResult<V> selectJoinPage(RawStorageMatPageReqVO reqVO, Class<V> clazz, MPJLambdaWrapper<RawStorageMatDO> wrapper) {
|
||||||
|
Page<V> page = selectJoinPage(new Page<>(reqVO.getPageNo(), reqVO.getPageSize()), clazz, wrapper);
|
||||||
|
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
default int deleteByStockId(Integer stockId) {
|
default int deleteByStockId(Integer stockId) {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.ningxia.yunxi.chemmes.module.biz.service.rawstoragemat;
|
|||||||
|
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatPageReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatRespVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatSaveReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatSaveReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.rawstoragemat.RawStorageMatDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.rawstoragemat.RawStorageMatDO;
|
||||||
|
|
||||||
@ -50,6 +51,6 @@ public interface RawStorageMatService {
|
|||||||
* @param pageReqVO 分页查询
|
* @param pageReqVO 分页查询
|
||||||
* @return 原料入/出库物料分页
|
* @return 原料入/出库物料分页
|
||||||
*/
|
*/
|
||||||
PageResult<RawStorageMatDO> getRawStorageMatPage(RawStorageMatPageReqVO pageReqVO);
|
PageResult<RawStorageMatRespVO> getRawStorageMatPage(RawStorageMatPageReqVO pageReqVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ningxia.yunxi.chemmes.module.biz.service.rawstoragemat;
|
|||||||
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
import com.ningxia.yunxi.chemmes.framework.common.pojo.PageResult;
|
||||||
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
import com.ningxia.yunxi.chemmes.framework.common.util.object.BeanUtils;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatPageReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatRespVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatSaveReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.rawstoragemat.vo.RawStorageMatSaveReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.rawstoragemat.RawStorageMatDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.rawstoragemat.RawStorageMatDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.rawstoragemat.RawStorageMatMapper;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.rawstoragemat.RawStorageMatMapper;
|
||||||
@ -63,7 +64,7 @@ public class RawStorageMatServiceImpl implements RawStorageMatService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<RawStorageMatDO> getRawStorageMatPage(RawStorageMatPageReqVO pageReqVO) {
|
public PageResult<RawStorageMatRespVO> getRawStorageMatPage(RawStorageMatPageReqVO pageReqVO) {
|
||||||
return rawStorageMatMapper.selectPage(pageReqVO);
|
return rawStorageMatMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,51 +1,66 @@
|
|||||||
import request from '@/config/axios'
|
import request from '@/config/axios'
|
||||||
|
|
||||||
export interface RawStorageVO {
|
export interface RawStorageVO {
|
||||||
id: number
|
id: number
|
||||||
billNo: string
|
billNo: string
|
||||||
operatorType: boolean
|
operatorType: boolean
|
||||||
businessType: number
|
businessType: number
|
||||||
remark: string
|
remark: string
|
||||||
status: boolean
|
status: boolean
|
||||||
supplierNo: string
|
supplierNo: string
|
||||||
supplierName: string
|
supplierName: string
|
||||||
supplierId: number
|
supplierId: number
|
||||||
billDate: localdate
|
billDate: localdate
|
||||||
operatorId: number
|
operatorId: number
|
||||||
operatorName: string
|
operatorName: string
|
||||||
relarionNo: string
|
relarionNo: string
|
||||||
relarionId: number
|
relarionId: number
|
||||||
billType: string
|
billType: string
|
||||||
sourceNo: string
|
sourceNo: string
|
||||||
sourceId: number
|
sourceId: number
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询原料入/出库分页
|
// 查询原料入/出库分页
|
||||||
export const getRawStoragePage = async (params) => {
|
export const getRawStoragePage = async (params) => {
|
||||||
return await request.get({ url: `/twm/raw-storage/page`, params })
|
return await request.get({ url: `/twm/raw-storage/page`, params })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询原料入/出库详情
|
// 查询原料入/出库详情
|
||||||
export const getRawStorage = async (id: number) => {
|
export const getRawStorage = async (id: number) => {
|
||||||
return await request.get({ url: `/twm/raw-storage/get?id=` + id })
|
return await request.get({ url: `/twm/raw-storage/get?id=` + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增原料入/出库
|
// 新增原料入/出库
|
||||||
export const createRawStorage = async (data: RawStorageVO) => {
|
export const createRawStorage = async (data: RawStorageVO) => {
|
||||||
return await request.post({ url: `/twm/raw-storage/create`, data })
|
return await request.post({ url: `/twm/raw-storage/create`, data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改原料入/出库
|
// 修改原料入/出库
|
||||||
export const updateRawStorage = async (data: RawStorageVO) => {
|
export const updateRawStorage = async (data: RawStorageVO) => {
|
||||||
return await request.put({ url: `/twm/raw-storage/update`, data })
|
return await request.put({ url: `/twm/raw-storage/update`, data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除原料入/出库
|
// 删除原料入/出库
|
||||||
export const deleteRawStorage = async (id: number) => {
|
export const deleteRawStorage = async (id: number) => {
|
||||||
return await request.delete({ url: `/twm/raw-storage/delete?id=` + id })
|
return await request.delete({ url: `/twm/raw-storage/delete?id=` + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出原料入/出库 Excel
|
// 导出原料入/出库 Excel
|
||||||
export const exportRawStorage = async (params) => {
|
export const exportRawStorage = async (params) => {
|
||||||
return await request.download({ url: `/twm/raw-storage/export-excel`, params })
|
return await request.download({ url: `/twm/raw-storage/export-excel`, params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确认原料入/出库
|
||||||
|
export const confirmRawStorage = async (data: RawStorageVO) => {
|
||||||
|
return await request.post({ url: `/twm/raw-storage/confirm`, data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取仓储下拉列表
|
||||||
|
export const getWarehouseSelect = async () => {
|
||||||
|
return await request.get({ url: `/twm/store-house/list`, params: { enabledStatus: 1 } })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取供应商下拉列表
|
||||||
|
export const getSupplierSelect = async () => {
|
||||||
|
return await request.get({ url: `/ims/supplier/getPopupListByOsm`, params: { enabledStatus: 1 } })
|
||||||
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ declare module 'vue' {
|
|||||||
DocAlert: typeof import('./../components/DocAlert/index.vue')['default']
|
DocAlert: typeof import('./../components/DocAlert/index.vue')['default']
|
||||||
Echart: typeof import('./../components/Echart/src/Echart.vue')['default']
|
Echart: typeof import('./../components/Echart/src/Echart.vue')['default']
|
||||||
Editor: typeof import('./../components/Editor/src/Editor.vue')['default']
|
Editor: typeof import('./../components/Editor/src/Editor.vue')['default']
|
||||||
|
ElAlert: typeof import('element-plus/es')['ElAlert']
|
||||||
ElAvatar: typeof import('element-plus/es')['ElAvatar']
|
ElAvatar: typeof import('element-plus/es')['ElAvatar']
|
||||||
ElButton: typeof import('element-plus/es')['ElButton']
|
ElButton: typeof import('element-plus/es')['ElButton']
|
||||||
ElCard: typeof import('element-plus/es')['ElCard']
|
ElCard: typeof import('element-plus/es')['ElCard']
|
||||||
@ -53,10 +54,12 @@ declare module 'vue' {
|
|||||||
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
||||||
ElIcon: typeof import('element-plus/es')['ElIcon']
|
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||||
ElInput: typeof import('element-plus/es')['ElInput']
|
ElInput: typeof import('element-plus/es')['ElInput']
|
||||||
|
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
||||||
ElOption: typeof import('element-plus/es')['ElOption']
|
ElOption: typeof import('element-plus/es')['ElOption']
|
||||||
ElPagination: typeof import('element-plus/es')['ElPagination']
|
ElPagination: typeof import('element-plus/es')['ElPagination']
|
||||||
ElPopover: typeof import('element-plus/es')['ElPopover']
|
ElPopover: typeof import('element-plus/es')['ElPopover']
|
||||||
ElRadio: typeof import('element-plus/es')['ElRadio']
|
ElRadio: typeof import('element-plus/es')['ElRadio']
|
||||||
|
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
|
||||||
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
||||||
ElRow: typeof import('element-plus/es')['ElRow']
|
ElRow: typeof import('element-plus/es')['ElRow']
|
||||||
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
||||||
|
|||||||
@ -58,26 +58,8 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="16">
|
||||||
<el-form-item label="供应商" prop="supplierName">
|
<el-form-item label="其它入库单" prop="relarionNo">
|
||||||
<el-select
|
|
||||||
v-model="formData.supplierName"
|
|
||||||
placeholder="请选择"
|
|
||||||
:disabled="formType === 'detail'"
|
|
||||||
class="!w-full"
|
|
||||||
filterable
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in supplierOptions"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.supplierName"
|
|
||||||
:value="item.supplierName"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="采购入库单" prop="relarionNo">
|
|
||||||
<el-input
|
<el-input
|
||||||
v-model="formData.relarionNo"
|
v-model="formData.relarionNo"
|
||||||
placeholder="点击选择入库单"
|
placeholder="点击选择入库单"
|
||||||
@ -108,12 +90,7 @@
|
|||||||
|
|
||||||
<!-- 明细信息 -->
|
<!-- 明细信息 -->
|
||||||
<div>
|
<div>
|
||||||
<div style="font-weight: bold; margin-bottom: 15px; display: flex; align-items: center;">
|
<div style="font-weight: bold; margin-bottom: 15px;">明细信息</div>
|
||||||
<el-button type="primary" @click="openMaterialSelect" v-if="formType !== 'detail'">
|
|
||||||
<Icon icon="ep:plus" class="mr-1" /> 选择物料
|
|
||||||
</el-button>
|
|
||||||
<span style="margin-left: 10px;">明细信息</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
:data="detailList"
|
:data="detailList"
|
||||||
@ -138,7 +115,7 @@
|
|||||||
<span>{{ scope.row.spec || '-' }}</span>
|
<span>{{ scope.row.spec || '-' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="收货数量" min-width="100px" align="center">
|
<el-table-column label="入库数量" min-width="100px" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ scope.row.sourceQty || '0' }}</span>
|
<span>{{ scope.row.sourceQty || '0' }}</span>
|
||||||
</template>
|
</template>
|
||||||
@ -227,9 +204,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
<!-- 物料选择弹窗 -->
|
|
||||||
<MaterialSelectDialog ref="materialSelectRef" @confirm="handleMaterialConfirm" />
|
|
||||||
|
|
||||||
<!-- 入库单选择弹窗 -->
|
<!-- 入库单选择弹窗 -->
|
||||||
<StorageSelectDialog ref="storageSelectRef" @confirm="handleStorageConfirm" />
|
<StorageSelectDialog ref="storageSelectRef" @confirm="handleStorageConfirm" />
|
||||||
</template>
|
</template>
|
||||||
@ -237,10 +211,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import Dialog from '@/components/Dialog/src/Dialog.vue'
|
import Dialog from '@/components/Dialog/src/Dialog.vue'
|
||||||
import MoneyInput from '@/components/MoneyInput/src/MoneyInput.vue'
|
import MoneyInput from '@/views/biz/components/MoneyInput.vue'
|
||||||
import MaterialSelectDialog from './MaterialSelectDialog.vue'
|
|
||||||
import StorageSelectDialog from './StorageSelectDialog.vue'
|
import StorageSelectDialog from './StorageSelectDialog.vue'
|
||||||
import * as ReturnStorageApi from '@/api/biz/returnstorage'
|
import * as RawStorageApi from '@/api/biz/rawstorage'
|
||||||
import { getUnitName } from '@/utils/dict'
|
import { getUnitName } from '@/utils/dict'
|
||||||
|
|
||||||
defineOptions({ name: 'ReturnStorageForm' })
|
defineOptions({ name: 'ReturnStorageForm' })
|
||||||
@ -261,8 +235,6 @@ const formData = reactive({
|
|||||||
businessType: "3",
|
businessType: "3",
|
||||||
billDate: new Date().toISOString().split('T')[0],
|
billDate: new Date().toISOString().split('T')[0],
|
||||||
status: '1',
|
status: '1',
|
||||||
supplierName: undefined,
|
|
||||||
supplierId: undefined,
|
|
||||||
relarionNo: undefined,
|
relarionNo: undefined,
|
||||||
relarionId: undefined,
|
relarionId: undefined,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
@ -279,11 +251,8 @@ const detailList = ref<any[]>([])
|
|||||||
|
|
||||||
// 仓储选项
|
// 仓储选项
|
||||||
const warehouseOptions = ref([])
|
const warehouseOptions = ref([])
|
||||||
// 供应商选项
|
|
||||||
const supplierOptions = ref([])
|
|
||||||
|
|
||||||
// 子组件 Ref
|
// 子组件 Ref
|
||||||
const materialSelectRef = ref()
|
|
||||||
const storageSelectRef = ref()
|
const storageSelectRef = ref()
|
||||||
|
|
||||||
/** 弹窗关闭时通知父组件 */
|
/** 弹窗关闭时通知父组件 */
|
||||||
@ -305,7 +274,7 @@ const open = async (type: string, id?: number) => {
|
|||||||
if (id) {
|
if (id) {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
const data = await ReturnStorageApi.getReturnStorage(id)
|
const data = await RawStorageApi.getRawStorage(id)
|
||||||
Object.assign(formData, data)
|
Object.assign(formData, data)
|
||||||
detailList.value = data.items || []
|
detailList.value = data.items || []
|
||||||
} finally {
|
} finally {
|
||||||
@ -318,69 +287,18 @@ defineExpose({ open })
|
|||||||
/** 加载仓储列表 */
|
/** 加载仓储列表 */
|
||||||
const loadWarehouseList = async () => {
|
const loadWarehouseList = async () => {
|
||||||
try {
|
try {
|
||||||
const data = await ReturnStorageApi.getWarehouseSelect()
|
const data = await RawStorageApi.getWarehouseSelect()
|
||||||
warehouseOptions.value = data.list || []
|
warehouseOptions.value = data.list || []
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载仓储列表失败:', error)
|
console.error('加载仓储列表失败:', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 加载供应商列表 */
|
|
||||||
const loadSupplierList = async () => {
|
|
||||||
try {
|
|
||||||
const data = await ReturnStorageApi.getSupplierSelect()
|
|
||||||
supplierOptions.value = data.list || []
|
|
||||||
} catch (error) {
|
|
||||||
console.error('加载供应商列表失败:', error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开物料选择弹窗 */
|
|
||||||
const openMaterialSelect = () => {
|
|
||||||
materialSelectRef.value.open()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开入库单选择弹窗 */
|
/** 打开入库单选择弹窗 */
|
||||||
const openStorageSelect = () => {
|
const openStorageSelect = () => {
|
||||||
storageSelectRef.value.open()
|
storageSelectRef.value.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 处理物料确认选择 */
|
|
||||||
const handleMaterialConfirm = (selectedMaterials: any[]) => {
|
|
||||||
selectedMaterials.forEach((material) => {
|
|
||||||
const exists = detailList.value.some(
|
|
||||||
(item) => item.materialId === material.id,
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!exists) {
|
|
||||||
detailList.value.push({
|
|
||||||
id: undefined,
|
|
||||||
description: undefined,
|
|
||||||
storeHouseId: undefined,
|
|
||||||
storeAreaId: undefined,
|
|
||||||
storeHouseCd: undefined,
|
|
||||||
storeHouseName: undefined,
|
|
||||||
storeAreCd: undefined,
|
|
||||||
storeAreaName: undefined,
|
|
||||||
materialId: material.id,
|
|
||||||
matName: material.matName,
|
|
||||||
matCode: material.matCode,
|
|
||||||
spec: material.spec,
|
|
||||||
unit: material.unit,
|
|
||||||
lotNo: undefined,
|
|
||||||
returnQty: undefined,
|
|
||||||
sourceQty: material.purQty || 0,
|
|
||||||
returnedQty: 0,
|
|
||||||
inDate: material.inDate,
|
|
||||||
inventBillNo: material.inventBillNo,
|
|
||||||
sourceId: undefined,
|
|
||||||
relarionId: undefined,
|
|
||||||
areaOptions: [],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 处理入库单确认选择 */
|
/** 处理入库单确认选择 */
|
||||||
const handleStorageConfirm = (storages: any[]) => {
|
const handleStorageConfirm = (storages: any[]) => {
|
||||||
// 清空之前的明细数据
|
// 清空之前的明细数据
|
||||||
@ -503,19 +421,19 @@ const handleSubmit = async (action: string) => {
|
|||||||
|
|
||||||
if (action === 'save') {
|
if (action === 'save') {
|
||||||
if (formType.value === 'create') {
|
if (formType.value === 'create') {
|
||||||
await ReturnStorageApi.createReturnStorage(submitData)
|
await RawStorageApi.createRawStorage(submitData)
|
||||||
message.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
} else {
|
} else {
|
||||||
await ReturnStorageApi.updateReturnStorage(submitData)
|
await RawStorageApi.updateRawStorage(submitData)
|
||||||
message.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 确认操作
|
// 确认操作
|
||||||
if (formType.value === 'create') {
|
if (formType.value === 'create') {
|
||||||
await ReturnStorageApi.confirmReturnStorage(submitData)
|
await RawStorageApi.confirmRawStorage(submitData)
|
||||||
message.success('确认成功')
|
message.success('确认成功')
|
||||||
} else {
|
} else {
|
||||||
await ReturnStorageApi.confirmReturnStorage(submitData)
|
await RawStorageApi.confirmRawStorage(submitData)
|
||||||
message.success('确认成功')
|
message.success('确认成功')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -537,8 +455,6 @@ const resetForm = () => {
|
|||||||
businessType: "3",
|
businessType: "3",
|
||||||
billDate: new Date().toISOString().split('T')[0],
|
billDate: new Date().toISOString().split('T')[0],
|
||||||
status: '1',
|
status: '1',
|
||||||
supplierName: undefined,
|
|
||||||
supplierId: undefined,
|
|
||||||
relarionNo: undefined,
|
relarionNo: undefined,
|
||||||
relarionId: undefined,
|
relarionId: undefined,
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
@ -549,7 +465,6 @@ const resetForm = () => {
|
|||||||
|
|
||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadWarehouseList()
|
// loadWarehouseList()
|
||||||
loadSupplierList()
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -27,15 +27,7 @@
|
|||||||
class="!w-200px"
|
class="!w-200px"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="供应商" prop="supplierName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.supplierName"
|
|
||||||
placeholder="请输入"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
class="!w-200px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="单据状态" prop="status">
|
<el-form-item label="单据状态" prop="status">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="queryParams.status"
|
v-model="queryParams.status"
|
||||||
@ -170,16 +162,16 @@
|
|||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 表单弹窗:添加/修改/详情 -->
|
<!-- 表单弹窗:添加/修改/详情 -->
|
||||||
<RawStorageForm ref="formRef" @success="getList" @close="handleQuery"/>
|
<ReturnStorageForm ref="formRef" @success="getList" @close="handleQuery"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import * as ReturnStorageApi from '@/api/biz/returnstorage'
|
import * as RawStorageApi from '@/api/biz/rawstorage'
|
||||||
import ReturnStorageForm from './ReturnStorageForm.vue'
|
import ReturnStorageForm from './ReturnStorageForm.vue'
|
||||||
import { getUnitName } from '@/utils/dict'
|
import { getUnitName } from '@/utils/dict'
|
||||||
|
|
||||||
defineOptions({ name: 'ReturnStorage' })
|
defineOptions({ name: 'RawStorage' })
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
@ -203,7 +195,7 @@ const queryFormRef = ref() // 搜索的表单
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const data = await ReturnStorageApi.getReturnStoragePage(queryParams)
|
const data = await RawStorageApi.getRawStoragePage(queryParams)
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
// 默认选中第一行并加载详情
|
// 默认选中第一行并加载详情
|
||||||
@ -220,7 +212,7 @@ const getDetailList = async (id: number) => {
|
|||||||
detailLoading.value = true
|
detailLoading.value = true
|
||||||
try {
|
try {
|
||||||
// 根据退料单ID查询明细
|
// 根据退料单ID查询明细
|
||||||
const data = await ReturnStorageApi.getReturnStorage(id)
|
const data = await RawStorageApi.getRawStorage(id)
|
||||||
// 后端返回的数据中,明细在items字段中
|
// 后端返回的数据中,明细在items字段中
|
||||||
detailList.value = data?.items || []
|
detailList.value = data?.items || []
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user