feat(biz): 优化采购退料和入库明细功能
This commit is contained in:
parent
1820d623ce
commit
70c8bebf0e
@ -75,8 +75,8 @@ public class PurReceiptDetailController {
|
|||||||
@Operation(summary = "获得采购入库单子分页")
|
@Operation(summary = "获得采购入库单子分页")
|
||||||
@PreAuthorize("@ss.hasPermission('tsc:pur-receipt-detail:query')")
|
@PreAuthorize("@ss.hasPermission('tsc:pur-receipt-detail:query')")
|
||||||
public CommonResult<PageResult<PurReceiptDetailRespVO>> getPurReceiptDetailPage(@Valid PurReceiptDetailPageReqVO pageReqVO) {
|
public CommonResult<PageResult<PurReceiptDetailRespVO>> getPurReceiptDetailPage(@Valid PurReceiptDetailPageReqVO pageReqVO) {
|
||||||
PageResult<PurReceiptDetailDO> pageResult = purReceiptDetailService.getPurReceiptDetailPage(pageReqVO);
|
PageResult<PurReceiptDetailRespVO> pageResult = purReceiptDetailService.getPurReceiptDetailPageWithMaster(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, PurReceiptDetailRespVO.class));
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@ -86,10 +86,10 @@ public class PurReceiptDetailController {
|
|||||||
public void exportPurReceiptDetailExcel(@Valid PurReceiptDetailPageReqVO pageReqVO,
|
public void exportPurReceiptDetailExcel(@Valid PurReceiptDetailPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
List<PurReceiptDetailDO> list = purReceiptDetailService.getPurReceiptDetailPage(pageReqVO).getList();
|
List<PurReceiptDetailRespVO> list = purReceiptDetailService.getPurReceiptDetailPageWithMaster(pageReqVO).getList();
|
||||||
// 导出 Excel
|
// 导出 Excel
|
||||||
ExcelUtils.write(response, "采购入库单子.xls", "数据", PurReceiptDetailRespVO.class,
|
ExcelUtils.write(response, "采购入库单子.xls", "数据", PurReceiptDetailRespVO.class,
|
||||||
BeanUtils.toBean(list, PurReceiptDetailRespVO.class));
|
list);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,4 +84,24 @@ public class PurReceiptDetailPageReqVO extends PageParam {
|
|||||||
@Schema(description = "已退料数量")
|
@Schema(description = "已退料数量")
|
||||||
private BigDecimal returnQty;
|
private BigDecimal returnQty;
|
||||||
|
|
||||||
|
// ==================== 关联主表查询条件 ====================
|
||||||
|
|
||||||
|
@Schema(description = "采购入库单号(SCR+年份+月份+3位流水号)")
|
||||||
|
private String purReceiptNo;
|
||||||
|
|
||||||
|
@Schema(description = "供应商名称", example = "王五")
|
||||||
|
private String supplierName;
|
||||||
|
|
||||||
|
@Schema(description = "单据状态(1 已创建 2 已确认 )", example = "2")
|
||||||
|
private String purStatus;
|
||||||
|
|
||||||
|
@Schema(description = "采购订单编号")
|
||||||
|
private String purOrdNo;
|
||||||
|
|
||||||
|
@Schema(description = "入库人名称", example = "王五")
|
||||||
|
private String receiptEmpName;
|
||||||
|
|
||||||
|
@Schema(description = "单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)", example = "2")
|
||||||
|
private String billType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -112,5 +112,47 @@ public class PurReceiptDetailRespVO {
|
|||||||
@ExcelProperty("采购数量")
|
@ExcelProperty("采购数量")
|
||||||
private BigDecimal purQty;
|
private BigDecimal purQty;
|
||||||
|
|
||||||
|
// ==================== 关联主表字段 ====================
|
||||||
|
|
||||||
|
@Schema(description = "采购入库单号(SCR+年份+月份+3位流水号)")
|
||||||
|
@ExcelProperty("采购入库单号(SCR+年份+月份+3位流水号)")
|
||||||
|
private String purReceiptNo;
|
||||||
|
|
||||||
|
@Schema(description = "单据日期")
|
||||||
|
@ExcelProperty("单据日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate receiptDate;
|
||||||
|
|
||||||
|
@Schema(description = "供应商id", example = "6653")
|
||||||
|
@ExcelProperty("供应商id")
|
||||||
|
private Integer supplierId;
|
||||||
|
|
||||||
|
@Schema(description = "供应商名称", example = "王五")
|
||||||
|
@ExcelProperty("供应商名称")
|
||||||
|
private String supplierName;
|
||||||
|
|
||||||
|
@Schema(description = "单据状态(1 已创建 2 已确认 )", example = "2")
|
||||||
|
@ExcelProperty("单据状态(1 已创建 2 已确认 )")
|
||||||
|
private String purStatus;
|
||||||
|
|
||||||
|
@Schema(description = "采购订单主表id", example = "3872")
|
||||||
|
@ExcelProperty("采购订单主表id")
|
||||||
|
private Integer purOrdId;
|
||||||
|
|
||||||
|
@Schema(description = "采购订单编号")
|
||||||
|
@ExcelProperty("采购订单编号")
|
||||||
|
private String purOrdNo;
|
||||||
|
|
||||||
|
@Schema(description = "入库人id", example = "2172")
|
||||||
|
@ExcelProperty("入库人id")
|
||||||
|
private Long receiptEmpId;
|
||||||
|
|
||||||
|
@Schema(description = "入库人名称", example = "王五")
|
||||||
|
@ExcelProperty("入库人名称")
|
||||||
|
private String receiptEmpName;
|
||||||
|
|
||||||
|
@Schema(description = "单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)", example = "2")
|
||||||
|
@ExcelProperty("单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)")
|
||||||
|
private String billType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,8 +67,8 @@ public class PurReturnController {
|
|||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('biz:pur-return:query')")
|
@PreAuthorize("@ss.hasPermission('biz:pur-return:query')")
|
||||||
public CommonResult<PurReturnRespVO> getPurReturn(@RequestParam("id") Integer id) {
|
public CommonResult<PurReturnRespVO> getPurReturn(@RequestParam("id") Integer id) {
|
||||||
PurReturnDO purReturn = purReturnService.getPurReturn(id);
|
PurReturnRespVO purReturn = purReturnService.getPurReturnWithDetails(id);
|
||||||
return success(BeanUtils.toBean(purReturn, PurReturnRespVO.class));
|
return success(purReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
import static com.ningxia.yunxi.chemmes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static com.ningxia.yunxi.chemmes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 采购退料单主分页 Request VO")
|
@Schema(description = "管理后台 - 采购退料单主分页 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@ -21,7 +21,7 @@ public class PurReturnPageReqVO extends PageParam {
|
|||||||
private String purReturnNo;
|
private String purReturnNo;
|
||||||
|
|
||||||
@Schema(description = "单据日期")
|
@Schema(description = "单据日期")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDate[] receiptDate;
|
private LocalDate[] receiptDate;
|
||||||
|
|
||||||
@Schema(description = "供应商id", example = "6653")
|
@Schema(description = "供应商id", example = "6653")
|
||||||
|
|||||||
@ -2,11 +2,14 @@ package com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturn.vo;
|
|||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailRespVO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 采购退料单主 Response VO")
|
@Schema(description = "管理后台 - 采购退料单主 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@ -27,6 +30,7 @@ public class PurReturnRespVO {
|
|||||||
|
|
||||||
@Schema(description = "单据日期")
|
@Schema(description = "单据日期")
|
||||||
@ExcelProperty("单据日期")
|
@ExcelProperty("单据日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private LocalDate receiptDate;
|
private LocalDate receiptDate;
|
||||||
|
|
||||||
@Schema(description = "供应商id", example = "6653")
|
@Schema(description = "供应商id", example = "6653")
|
||||||
@ -69,4 +73,7 @@ public class PurReturnRespVO {
|
|||||||
@ExcelProperty("单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)")
|
@ExcelProperty("单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)")
|
||||||
private String billType;
|
private String billType;
|
||||||
|
|
||||||
|
@Schema(description = "采购退料单子表列表")
|
||||||
|
private List<PurReturnDetailRespVO> returnDetailList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,8 +75,8 @@ public class PurReturnDetailController {
|
|||||||
@Operation(summary = "获得采购退料单子分页")
|
@Operation(summary = "获得采购退料单子分页")
|
||||||
@PreAuthorize("@ss.hasPermission('tsc:pur-return-detail:query')")
|
@PreAuthorize("@ss.hasPermission('tsc:pur-return-detail:query')")
|
||||||
public CommonResult<PageResult<PurReturnDetailRespVO>> getPurReturnDetailPage(@Valid PurReturnDetailPageReqVO pageReqVO) {
|
public CommonResult<PageResult<PurReturnDetailRespVO>> getPurReturnDetailPage(@Valid PurReturnDetailPageReqVO pageReqVO) {
|
||||||
PageResult<PurReturnDetailDO> pageResult = purReturnDetailService.getPurReturnDetailPage(pageReqVO);
|
PageResult<PurReturnDetailRespVO> pageResult = purReturnDetailService.getPurReturnDetailPageWithMaster(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, PurReturnDetailRespVO.class));
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@ -86,10 +86,10 @@ public class PurReturnDetailController {
|
|||||||
public void exportPurReturnDetailExcel(@Valid PurReturnDetailPageReqVO pageReqVO,
|
public void exportPurReturnDetailExcel(@Valid PurReturnDetailPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
List<PurReturnDetailDO> list = purReturnDetailService.getPurReturnDetailPage(pageReqVO).getList();
|
List<PurReturnDetailRespVO> list = purReturnDetailService.getPurReturnDetailPageWithMaster(pageReqVO).getList();
|
||||||
// 导出 Excel
|
// 导出 Excel
|
||||||
ExcelUtils.write(response, "采购退料单子.xls", "数据", PurReturnDetailRespVO.class,
|
ExcelUtils.write(response, "采购退料单子.xls", "数据", PurReturnDetailRespVO.class,
|
||||||
BeanUtils.toBean(list, PurReturnDetailRespVO.class));
|
list);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,4 +80,24 @@ public class PurReturnDetailPageReqVO extends PageParam {
|
|||||||
@Schema(description = "仓储名称", example = "王五")
|
@Schema(description = "仓储名称", example = "王五")
|
||||||
private String storeHouseName;
|
private String storeHouseName;
|
||||||
|
|
||||||
|
// ==================== 关联主表查询条件 ====================
|
||||||
|
|
||||||
|
@Schema(description = "采购退料单号(SCT+年份+月份+3位流水号)")
|
||||||
|
private String purReturnNo;
|
||||||
|
|
||||||
|
@Schema(description = "供应商名称", example = "王五")
|
||||||
|
private String supplierName;
|
||||||
|
|
||||||
|
@Schema(description = "单据状态(1 已创建 2 已确认 )", example = "2")
|
||||||
|
private String purStatus;
|
||||||
|
|
||||||
|
@Schema(description = "采购入库单号")
|
||||||
|
private String purReceiptNo;
|
||||||
|
|
||||||
|
@Schema(description = "退料人名称", example = "王五")
|
||||||
|
private String returnEmpName;
|
||||||
|
|
||||||
|
@Schema(description = "单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)", example = "2")
|
||||||
|
private String billType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,10 @@ import java.util.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import com.alibaba.excel.annotation.*;
|
import com.alibaba.excel.annotation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 采购退料单子 Response VO")
|
@Schema(description = "管理后台 - 采购退料单子 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@ -102,4 +104,47 @@ public class PurReturnDetailRespVO {
|
|||||||
@ExcelProperty("仓储名称")
|
@ExcelProperty("仓储名称")
|
||||||
private String storeHouseName;
|
private String storeHouseName;
|
||||||
|
|
||||||
|
// ==================== 关联主表字段 ====================
|
||||||
|
|
||||||
|
@Schema(description = "采购退料单号(SCT+年份+月份+3位流水号)")
|
||||||
|
@ExcelProperty("采购退料单号(SCT+年份+月份+3位流水号)")
|
||||||
|
private String purReturnNo;
|
||||||
|
|
||||||
|
@Schema(description = "单据日期")
|
||||||
|
@ExcelProperty("单据日期")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate receiptDate;
|
||||||
|
|
||||||
|
@Schema(description = "供应商id", example = "6653")
|
||||||
|
@ExcelProperty("供应商id")
|
||||||
|
private Integer supplierId;
|
||||||
|
|
||||||
|
@Schema(description = "供应商名称", example = "王五")
|
||||||
|
@ExcelProperty("供应商名称")
|
||||||
|
private String supplierName;
|
||||||
|
|
||||||
|
@Schema(description = "单据状态(1 已创建 2 已确认 )", example = "2")
|
||||||
|
@ExcelProperty("单据状态(1 已创建 2 已确认 )")
|
||||||
|
private String purStatus;
|
||||||
|
|
||||||
|
@Schema(description = "采购入库单主表id", example = "3872")
|
||||||
|
@ExcelProperty("采购入库单主表id")
|
||||||
|
private Integer purReceiptId;
|
||||||
|
|
||||||
|
@Schema(description = "采购入库单号")
|
||||||
|
@ExcelProperty("采购入库单号")
|
||||||
|
private String purReceiptNo;
|
||||||
|
|
||||||
|
@Schema(description = "退料人id", example = "2172")
|
||||||
|
@ExcelProperty("退料人id")
|
||||||
|
private Integer returnEmpId;
|
||||||
|
|
||||||
|
@Schema(description = "退料人名称", example = "王五")
|
||||||
|
@ExcelProperty("退料人名称")
|
||||||
|
private String returnEmpName;
|
||||||
|
|
||||||
|
@Schema(description = "单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)", example = "2")
|
||||||
|
@ExcelProperty("单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)")
|
||||||
|
private String billType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreceiptdetail;
|
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreceiptdetail;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
|
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.purreceiptdetail.vo.PurReceiptDetailPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreceiptdetail.vo.PurReceiptDetailPageReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreceiptdetail.vo.PurReceiptDetailRespVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreceipt.PurReceiptDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreceiptdetail.PurReceiptDetailDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreceiptdetail.PurReceiptDetailDO;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.ibatis.annotations.Delete;
|
import org.apache.ibatis.annotations.Delete;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@ -62,4 +66,46 @@ public interface PurReceiptDetailMapper extends BaseMapperX<PurReceiptDetailDO>
|
|||||||
@InterceptorIgnore(tenantLine = "true")
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
int physicalDeleteByPurReceiptId(@Param("purReceiptId") Integer purReceiptId);
|
int physicalDeleteByPurReceiptId(@Param("purReceiptId") Integer purReceiptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得采购入库单子分页(关联主表)
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 采购入库单子分页(包含主表信息)
|
||||||
|
*/
|
||||||
|
default PageResult<PurReceiptDetailRespVO> selectPurReceiptDetailPageWithMaster(PurReceiptDetailPageReqVO pageReqVO) {
|
||||||
|
MPJLambdaWrapper<PurReceiptDetailDO> wrapper = new MPJLambdaWrapper<PurReceiptDetailDO>()
|
||||||
|
// 选择子表字段
|
||||||
|
.selectAll(PurReceiptDetailDO.class)
|
||||||
|
// 选择主表字段
|
||||||
|
.selectAs(PurReceiptDO::getPurReceiptNo, PurReceiptDetailRespVO::getPurReceiptNo)
|
||||||
|
.selectAs(PurReceiptDO::getReceiptDate, PurReceiptDetailRespVO::getReceiptDate)
|
||||||
|
.selectAs(PurReceiptDO::getSupplierId, PurReceiptDetailRespVO::getSupplierId)
|
||||||
|
.selectAs(PurReceiptDO::getSupplierName, PurReceiptDetailRespVO::getSupplierName)
|
||||||
|
.selectAs(PurReceiptDO::getPurStatus, PurReceiptDetailRespVO::getPurStatus)
|
||||||
|
.selectAs(PurReceiptDO::getPurOrdId, PurReceiptDetailRespVO::getPurOrdId)
|
||||||
|
.selectAs(PurReceiptDO::getPurOrdNo, PurReceiptDetailRespVO::getPurOrdNo)
|
||||||
|
.selectAs(PurReceiptDO::getReceiptEmpId, PurReceiptDetailRespVO::getReceiptEmpId)
|
||||||
|
.selectAs(PurReceiptDO::getReceiptEmpName, PurReceiptDetailRespVO::getReceiptEmpName)
|
||||||
|
.selectAs(PurReceiptDO::getBillType, PurReceiptDetailRespVO::getBillType)
|
||||||
|
// LEFT JOIN 主表
|
||||||
|
.leftJoin(PurReceiptDO.class, PurReceiptDO::getId, PurReceiptDetailDO::getPurReceiptId)
|
||||||
|
// 查询条件 - 子表
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getStoreAreCd()), PurReceiptDetailDO::getStoreAreCd, pageReqVO.getStoreAreCd())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getStoreAreaName()), PurReceiptDetailDO::getStoreAreaName, pageReqVO.getStoreAreaName())
|
||||||
|
.eq(pageReqVO.getInventBillNo() != null, PurReceiptDetailDO::getInventBillNo, pageReqVO.getInventBillNo())
|
||||||
|
.eq(pageReqVO.getMaterialId() != null, PurReceiptDetailDO::getMaterialId, pageReqVO.getMaterialId())
|
||||||
|
.like(pageReqVO.getMaterialCode() != null, PurReceiptDetailDO::getMaterialCode, pageReqVO.getMaterialCode())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getMaterialName()), PurReceiptDetailDO::getMaterialName, pageReqVO.getMaterialName())
|
||||||
|
// 查询条件 - 主表
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getPurReceiptNo()), PurReceiptDO::getPurReceiptNo, pageReqVO.getPurReceiptNo())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getSupplierName()), PurReceiptDO::getSupplierName, pageReqVO.getSupplierName())
|
||||||
|
.eq(pageReqVO.getPurStatus() != null, PurReceiptDO::getPurStatus, pageReqVO.getPurStatus())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getPurOrdNo()), PurReceiptDO::getPurOrdNo, pageReqVO.getPurOrdNo())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getReceiptEmpName()), PurReceiptDO::getReceiptEmpName, pageReqVO.getReceiptEmpName())
|
||||||
|
.eq(pageReqVO.getBillType() != null, PurReceiptDO::getBillType, pageReqVO.getBillType())
|
||||||
|
.orderByDesc(PurReceiptDetailDO::getId);
|
||||||
|
|
||||||
|
return selectJoinPage(pageReqVO, PurReceiptDetailRespVO.class, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreturndetail;
|
package com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreturndetail;
|
||||||
|
|
||||||
|
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.purreturndetail.vo.PurReturnDetailPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailPageReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailRespVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreturn.PurReturnDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreturndetail.PurReturnDetailDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreturndetail.PurReturnDetailDO;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,4 +45,48 @@ public interface PurReturnDetailMapper extends BaseMapperX<PurReturnDetailDO> {
|
|||||||
.orderByDesc(PurReturnDetailDO::getId));
|
.orderByDesc(PurReturnDetailDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得采购退料单子分页(关联主表)
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 采购退料单子分页(包含主表信息)
|
||||||
|
*/
|
||||||
|
default PageResult<PurReturnDetailRespVO> selectPurReturnDetailPageWithMaster(PurReturnDetailPageReqVO pageReqVO) {
|
||||||
|
MPJLambdaWrapper<PurReturnDetailDO> wrapper = new MPJLambdaWrapper<PurReturnDetailDO>()
|
||||||
|
// 选择子表字段
|
||||||
|
.selectAll(PurReturnDetailDO.class)
|
||||||
|
// 选择主表字段
|
||||||
|
.selectAs(PurReturnDO::getPurReturnNo, PurReturnDetailRespVO::getPurReturnNo)
|
||||||
|
.selectAs(PurReturnDO::getReceiptDate, PurReturnDetailRespVO::getReceiptDate)
|
||||||
|
.selectAs(PurReturnDO::getSupplierId, PurReturnDetailRespVO::getSupplierId)
|
||||||
|
.selectAs(PurReturnDO::getSupplierName, PurReturnDetailRespVO::getSupplierName)
|
||||||
|
.selectAs(PurReturnDO::getPurStatus, PurReturnDetailRespVO::getPurStatus)
|
||||||
|
.selectAs(PurReturnDO::getPurReceiptId, PurReturnDetailRespVO::getPurReceiptId)
|
||||||
|
.selectAs(PurReturnDO::getPurReceiptNo, PurReturnDetailRespVO::getPurReceiptNo)
|
||||||
|
.selectAs(PurReturnDO::getReturnEmpId, PurReturnDetailRespVO::getReturnEmpId)
|
||||||
|
.selectAs(PurReturnDO::getReturnEmpName, PurReturnDetailRespVO::getReturnEmpName)
|
||||||
|
.selectAs(PurReturnDO::getBillType, PurReturnDetailRespVO::getBillType)
|
||||||
|
// LEFT JOIN 主表
|
||||||
|
.leftJoin(PurReturnDO.class, PurReturnDO::getId, PurReturnDetailDO::getPurReturnId)
|
||||||
|
// 查询条件 - 子表
|
||||||
|
.eq(StringUtils.isNotBlank(pageReqVO.getStoreAreCd()), PurReturnDetailDO::getStoreAreCd, pageReqVO.getStoreAreCd())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getStoreAreaName()), PurReturnDetailDO::getStoreAreaName, pageReqVO.getStoreAreaName())
|
||||||
|
.eq(pageReqVO.getInventBillNo() != null, PurReturnDetailDO::getInventBillNo, pageReqVO.getInventBillNo())
|
||||||
|
.eq(pageReqVO.getMaterialId() != null, PurReturnDetailDO::getMaterialId, pageReqVO.getMaterialId())
|
||||||
|
.eq(pageReqVO.getMaterialCode() != null, PurReturnDetailDO::getMaterialCode, pageReqVO.getMaterialCode())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getMaterialName()), PurReturnDetailDO::getMaterialName, pageReqVO.getMaterialName())
|
||||||
|
.eq(pageReqVO.getStoreHouseId() != null, PurReturnDetailDO::getStoreHouseId, pageReqVO.getStoreHouseId())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getStoreHouseCd()), PurReturnDetailDO::getStoreHouseCd, pageReqVO.getStoreHouseCd())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getStoreHouseName()), PurReturnDetailDO::getStoreHouseName, pageReqVO.getStoreHouseName())
|
||||||
|
// 查询条件 - 主表
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getSupplierName()), PurReturnDO::getSupplierName, pageReqVO.getSupplierName())
|
||||||
|
.eq(pageReqVO.getPurStatus() != null, PurReturnDO::getPurStatus, pageReqVO.getPurStatus())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getPurReceiptNo()), PurReturnDO::getPurReceiptNo, pageReqVO.getPurReceiptNo())
|
||||||
|
.like(StringUtils.isNotBlank(pageReqVO.getReturnEmpName()), PurReturnDO::getReturnEmpName, pageReqVO.getReturnEmpName())
|
||||||
|
.eq(pageReqVO.getBillType() != null, PurReturnDO::getBillType, pageReqVO.getBillType())
|
||||||
|
.orderByDesc(PurReturnDetailDO::getId);
|
||||||
|
|
||||||
|
return selectJoinPage(pageReqVO, PurReturnDetailRespVO.class, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.ningxia.yunxi.chemmes.module.biz.service.purreceiptdetail;
|
|||||||
|
|
||||||
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.purreceiptdetail.vo.PurReceiptDetailPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreceiptdetail.vo.PurReceiptDetailPageReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreceiptdetail.vo.PurReceiptDetailRespVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreceiptdetail.vo.PurReceiptDetailSaveReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreceiptdetail.vo.PurReceiptDetailSaveReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreceiptdetail.PurReceiptDetailDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreceiptdetail.PurReceiptDetailDO;
|
||||||
|
|
||||||
@ -52,4 +53,12 @@ public interface PurReceiptDetailService {
|
|||||||
*/
|
*/
|
||||||
PageResult<PurReceiptDetailDO> getPurReceiptDetailPage(PurReceiptDetailPageReqVO pageReqVO);
|
PageResult<PurReceiptDetailDO> getPurReceiptDetailPage(PurReceiptDetailPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得采购入库单子分页(关联主表)
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 采购入库单子分页(包含主表信息)
|
||||||
|
*/
|
||||||
|
PageResult<PurReceiptDetailRespVO> getPurReceiptDetailPageWithMaster(PurReceiptDetailPageReqVO pageReqVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ningxia.yunxi.chemmes.module.biz.service.purreceiptdetail;
|
|||||||
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.purreceiptdetail.vo.PurReceiptDetailPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreceiptdetail.vo.PurReceiptDetailPageReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreceiptdetail.vo.PurReceiptDetailRespVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreceiptdetail.vo.PurReceiptDetailSaveReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreceiptdetail.vo.PurReceiptDetailSaveReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreceiptdetail.PurReceiptDetailDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreceiptdetail.PurReceiptDetailDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreceiptdetail.PurReceiptDetailMapper;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreceiptdetail.PurReceiptDetailMapper;
|
||||||
@ -67,4 +68,9 @@ public class PurReceiptDetailServiceImpl implements PurReceiptDetailService {
|
|||||||
return purReceiptDetailMapper.selectPage(pageReqVO);
|
return purReceiptDetailMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<PurReceiptDetailRespVO> getPurReceiptDetailPageWithMaster(PurReceiptDetailPageReqVO pageReqVO) {
|
||||||
|
return purReceiptDetailMapper.selectPurReceiptDetailPageWithMaster(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,14 @@ public interface PurReturnService {
|
|||||||
*/
|
*/
|
||||||
PurReturnDO getPurReturn(Integer id);
|
PurReturnDO getPurReturn(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得采购退料单主(包含子表数据)
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 采购退料单主(包含子表数据)
|
||||||
|
*/
|
||||||
|
PurReturnRespVO getPurReturnWithDetails(Integer id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得采购退料单主分页
|
* 获得采购退料单主分页
|
||||||
*
|
*
|
||||||
|
|||||||
@ -3,13 +3,19 @@ package com.ningxia.yunxi.chemmes.module.biz.service.purreturn;
|
|||||||
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.purreturn.vo.PurReturnPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturn.vo.PurReturnPageReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturn.vo.PurReturnRespVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturn.vo.PurReturnSaveReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturn.vo.PurReturnSaveReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailRespVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreturn.PurReturnDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreturn.PurReturnDO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreturndetail.PurReturnDetailDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreturn.PurReturnMapper;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreturn.PurReturnMapper;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreturndetail.PurReturnDetailMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static com.ningxia.yunxi.chemmes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.ningxia.yunxi.chemmes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
|
||||||
@ -25,6 +31,9 @@ public class PurReturnServiceImpl implements PurReturnService {
|
|||||||
@Resource
|
@Resource
|
||||||
private PurReturnMapper purReturnMapper;
|
private PurReturnMapper purReturnMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PurReturnDetailMapper purReturnDetailMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer createPurReturn(PurReturnSaveReqVO createReqVO) {
|
public Integer createPurReturn(PurReturnSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@ -62,6 +71,30 @@ public class PurReturnServiceImpl implements PurReturnService {
|
|||||||
return purReturnMapper.selectById(id);
|
return purReturnMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PurReturnRespVO getPurReturnWithDetails(Integer id) {
|
||||||
|
// 查询主表数据
|
||||||
|
PurReturnDO purReturn = purReturnMapper.selectById(id);
|
||||||
|
if (purReturn == null) {
|
||||||
|
throw exception("采购退料单主不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为VO
|
||||||
|
PurReturnRespVO respVO = BeanUtils.toBean(purReturn, PurReturnRespVO.class);
|
||||||
|
|
||||||
|
// 查询子表数据
|
||||||
|
List<PurReturnDetailDO> detailList = purReturnDetailMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<PurReturnDetailDO>()
|
||||||
|
.eq(PurReturnDetailDO::getPurReturnId, id)
|
||||||
|
);
|
||||||
|
|
||||||
|
// 转换子表数据
|
||||||
|
List<PurReturnDetailRespVO> detailRespVOList = BeanUtils.toBean(detailList, PurReturnDetailRespVO.class);
|
||||||
|
respVO.setReturnDetailList(detailRespVOList);
|
||||||
|
|
||||||
|
return respVO;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<PurReturnDO> getPurReturnPage(PurReturnPageReqVO pageReqVO) {
|
public PageResult<PurReturnDO> getPurReturnPage(PurReturnPageReqVO pageReqVO) {
|
||||||
return purReturnMapper.selectPage(pageReqVO);
|
return purReturnMapper.selectPage(pageReqVO);
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.ningxia.yunxi.chemmes.module.biz.service.purreturndetail;
|
|||||||
|
|
||||||
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.purreturndetail.vo.PurReturnDetailPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailPageReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailRespVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailSaveReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailSaveReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreturndetail.PurReturnDetailDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreturndetail.PurReturnDetailDO;
|
||||||
|
|
||||||
@ -52,4 +53,12 @@ public interface PurReturnDetailService {
|
|||||||
*/
|
*/
|
||||||
PageResult<PurReturnDetailDO> getPurReturnDetailPage(PurReturnDetailPageReqVO pageReqVO);
|
PageResult<PurReturnDetailDO> getPurReturnDetailPage(PurReturnDetailPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得采购退料单子分页(关联主表)
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 采购退料单子分页(包含主表信息)
|
||||||
|
*/
|
||||||
|
PageResult<PurReturnDetailRespVO> getPurReturnDetailPageWithMaster(PurReturnDetailPageReqVO pageReqVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ningxia.yunxi.chemmes.module.biz.service.purreturndetail;
|
|||||||
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.purreturndetail.vo.PurReturnDetailPageReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailPageReqVO;
|
||||||
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailRespVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailSaveReqVO;
|
import com.ningxia.yunxi.chemmes.module.biz.controller.admin.purreturndetail.vo.PurReturnDetailSaveReqVO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreturndetail.PurReturnDetailDO;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.dataobject.purreturndetail.PurReturnDetailDO;
|
||||||
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreturndetail.PurReturnDetailMapper;
|
import com.ningxia.yunxi.chemmes.module.biz.dal.mysql.purreturndetail.PurReturnDetailMapper;
|
||||||
@ -67,4 +68,9 @@ public class PurReturnDetailServiceImpl implements PurReturnDetailService {
|
|||||||
return purReturnDetailMapper.selectPage(pageReqVO);
|
return purReturnDetailMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<PurReturnDetailRespVO> getPurReturnDetailPageWithMaster(PurReturnDetailPageReqVO pageReqVO) {
|
||||||
|
return purReturnDetailMapper.selectPurReturnDetailPageWithMaster(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,6 +108,8 @@ public class RawStorageServiceImpl implements RawStorageService {
|
|||||||
purReceiptDetailMapper.updateById(detail);
|
purReceiptDetailMapper.updateById(detail);
|
||||||
|
|
||||||
updateOrderItem(detail);
|
updateOrderItem(detail);
|
||||||
|
//更新库存
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -245,6 +245,7 @@ public class SaleDeliveryServiceImpl implements SaleDeliveryService {
|
|||||||
.inventBillNo(saleDeliveryDetailDO.getInventBillNo())
|
.inventBillNo(saleDeliveryDetailDO.getInventBillNo())
|
||||||
.build();
|
.build();
|
||||||
proStorageLogService.saveProStorageLog(proStorageLogDO);
|
proStorageLogService.saveProStorageLog(proStorageLogDO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -264,21 +265,21 @@ public class SaleDeliveryServiceImpl implements SaleDeliveryService {
|
|||||||
// .build();
|
// .build();
|
||||||
// proStorageMapper.insert(proStorage);
|
// proStorageMapper.insert(proStorage);
|
||||||
//
|
//
|
||||||
// for (SaleDeliveryDetailDO detail : detailList) {
|
for (SaleDeliveryDetailDO detail : detailList) {
|
||||||
// ProStorageInventoryDO inventory = proStorageInventoryMapper.selectById(detail.getTwmStorageDetailId());
|
ProStorageInventoryDO inventory = proStorageInventoryMapper.selectById(detail.getTwmStorageDetailId());
|
||||||
// if (inventory == null) {
|
if (inventory == null) {
|
||||||
// throw exception("库存不存在:仓库[" + detail.getStoreHouseName() + "] 批次[" + detail.getLotNo() + "]");
|
throw exception("库存不存在:仓库[" + detail.getStoreHouseName() + "] 批次[" + detail.getLotNo() + "]");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// BigDecimal deliveriedQty = detail.getDeliveriedQty() != null ? detail.getDeliveriedQty() : BigDecimal.ZERO;
|
BigDecimal deliveriedQty = detail.getDeliveriedQty() != null ? detail.getDeliveriedQty() : BigDecimal.ZERO;
|
||||||
// if (inventory.getUseQty().compareTo(deliveriedQty) < 0) {
|
if (inventory.getUseQty().compareTo(deliveriedQty) < 0) {
|
||||||
// throw exception("库存不足:当前可用数量[" + inventory.getUseQty() + "] < 发货数量[" + deliveriedQty + "]");
|
throw exception("库存不足:当前可用数量[" + inventory.getUseQty() + "] < 发货数量[" + deliveriedQty + "]");
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// inventory.setUseQty(inventory.getUseQty().subtract(deliveriedQty));
|
inventory.setUseQty(inventory.getUseQty().subtract(deliveriedQty));
|
||||||
// inventory.setYardQty(inventory.getYardQty().subtract(deliveriedQty));
|
inventory.setYardQty(inventory.getYardQty().subtract(deliveriedQty));
|
||||||
// inventory.setPackQty(inventory.getPackQty() - (detail.getDeliveriedBagQty()));
|
inventory.setPackQty(inventory.getPackQty() - (detail.getDeliveriedBagQty()));
|
||||||
// proStorageInventoryMapper.updateById(inventory);
|
proStorageInventoryMapper.updateById(inventory);
|
||||||
// ProStorageMatDO storageMat = ProStorageMatDO.builder()
|
// ProStorageMatDO storageMat = ProStorageMatDO.builder()
|
||||||
// .stockId(proStorage.getId().longValue())
|
// .stockId(proStorage.getId().longValue())
|
||||||
// .storeHouseId(detail.getStoreHouseId())
|
// .storeHouseId(detail.getStoreHouseId())
|
||||||
@ -304,7 +305,7 @@ public class SaleDeliveryServiceImpl implements SaleDeliveryService {
|
|||||||
// .inventBillNo(inventory.getInventBillNo())
|
// .inventBillNo(inventory.getInventBillNo())
|
||||||
// .build();
|
// .build();
|
||||||
// proStorageMatMapper.insert(storageMat);
|
// proStorageMatMapper.insert(storageMat);
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
if (saleDelivery.getSaleOrdId() != null && saleDelivery.getSaleOrdDetailId() != null) {
|
if (saleDelivery.getSaleOrdId() != null && saleDelivery.getSaleOrdDetailId() != null) {
|
||||||
|
|||||||
@ -19,6 +19,7 @@ declare module 'vue' {
|
|||||||
ContentDetailWrap: typeof import('./../components/ContentDetailWrap/src/ContentDetailWrap.vue')['default']
|
ContentDetailWrap: typeof import('./../components/ContentDetailWrap/src/ContentDetailWrap.vue')['default']
|
||||||
ContentWrap: typeof import('./../components/ContentWrap/src/ContentWrap.vue')['default']
|
ContentWrap: typeof import('./../components/ContentWrap/src/ContentWrap.vue')['default']
|
||||||
CopperModal: typeof import('./../components/Cropper/src/CopperModal.vue')['default']
|
CopperModal: typeof import('./../components/Cropper/src/CopperModal.vue')['default']
|
||||||
|
copy: typeof import('./../views/biz/purreceipt copy/index.vue')['default']
|
||||||
CountTo: typeof import('./../components/CountTo/src/CountTo.vue')['default']
|
CountTo: typeof import('./../components/CountTo/src/CountTo.vue')['default']
|
||||||
Crontab: typeof import('./../components/Crontab/src/Crontab.vue')['default']
|
Crontab: typeof import('./../components/Crontab/src/Crontab.vue')['default']
|
||||||
Cropper: typeof import('./../components/Cropper/src/Cropper.vue')['default']
|
Cropper: typeof import('./../components/Cropper/src/Cropper.vue')['default']
|
||||||
@ -35,6 +36,8 @@ declare module 'vue' {
|
|||||||
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']
|
||||||
|
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
|
||||||
|
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
|
||||||
ElCol: typeof import('element-plus/es')['ElCol']
|
ElCol: typeof import('element-plus/es')['ElCol']
|
||||||
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
||||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||||
@ -53,12 +56,14 @@ declare module 'vue' {
|
|||||||
ElForm: typeof import('element-plus/es')['ElForm']
|
ElForm: typeof import('element-plus/es')['ElForm']
|
||||||
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']
|
||||||
|
ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
|
||||||
ElInput: typeof import('element-plus/es')['ElInput']
|
ElInput: typeof import('element-plus/es')['ElInput']
|
||||||
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
|
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']
|
||||||
@ -91,6 +96,9 @@ declare module 'vue' {
|
|||||||
ProcessPalette: typeof import('./../components/bpmnProcessDesigner/package/palette/ProcessPalette.vue')['default']
|
ProcessPalette: typeof import('./../components/bpmnProcessDesigner/package/palette/ProcessPalette.vue')['default']
|
||||||
ProcessViewer: typeof import('./../components/bpmnProcessDesigner/package/designer/ProcessViewer.vue')['default']
|
ProcessViewer: typeof import('./../components/bpmnProcessDesigner/package/designer/ProcessViewer.vue')['default']
|
||||||
PropertiesPanel: typeof import('./../components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue')['default']
|
PropertiesPanel: typeof import('./../components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue')['default']
|
||||||
|
PurOrderSelectDialog: typeof import('./../views/biz/purreceipt copy/PurOrderSelectDialog.vue')['default']
|
||||||
|
PurReceiptForm: typeof import('./../views/biz/purreceipt copy/PurReceiptForm.vue')['default']
|
||||||
|
PurReceiptSelectDialog: typeof import('./../views/biz/purreturn/PurReceiptSelectDialog.vue')['default']
|
||||||
Qrcode: typeof import('./../components/Qrcode/src/Qrcode.vue')['default']
|
Qrcode: typeof import('./../components/Qrcode/src/Qrcode.vue')['default']
|
||||||
ReceiveTask: typeof import('./../components/bpmnProcessDesigner/package/penal/task/task-components/ReceiveTask.vue')['default']
|
ReceiveTask: typeof import('./../components/bpmnProcessDesigner/package/penal/task/task-components/ReceiveTask.vue')['default']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
|
|||||||
@ -0,0 +1,218 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="'选择采购入库单'" v-model="dialogVisible" width="1500px">
|
||||||
|
<!-- 搜索区域 -->
|
||||||
|
<el-form :model="queryParams" inline class="mb-4">
|
||||||
|
<el-form-item label="供应商">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.supplierName"
|
||||||
|
disabled
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-300px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="入库单号">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.purReceiptNo"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-200px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料名称">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.materialName"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-200px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 入库单列表 -->
|
||||||
|
<el-table
|
||||||
|
ref="receiptTableRef"
|
||||||
|
v-loading="loading"
|
||||||
|
:data="receiptList"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
row-key="id"
|
||||||
|
highlight-current-row
|
||||||
|
@row-click="handleRowClick"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
style="width: 100%;"
|
||||||
|
:height="400"
|
||||||
|
border
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="50px" align="center" />
|
||||||
|
<el-table-column label="序号" type="index" width="60px" align="center" fixed="left" />
|
||||||
|
<el-table-column label="入库单号" align="center" prop="purReceiptNo" width="150px" fixed="left" />
|
||||||
|
<el-table-column label="单据类型" align="center" prop="billType" width="125px">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.billType === '1'">标准采购入库</span>
|
||||||
|
<span v-else-if="scope.row.billType === '2'">设备采购入库</span>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="入库日期" align="center" prop="receiptDate" width="110px" />
|
||||||
|
<el-table-column label="供应商名称" align="center" prop="supplierName" width="250px" />
|
||||||
|
<el-table-column label="物料编码" align="center" prop="materialCode" width="120px" />
|
||||||
|
<el-table-column label="物料名称" align="center" prop="materialName" width="120px" />
|
||||||
|
<el-table-column label="采购数量" align="center" prop="ordQty" width="90px" />
|
||||||
|
<el-table-column label="收货数量" align="center" prop="receiptQty" width="90px" />
|
||||||
|
<el-table-column label="规格型号" align="center" prop="spec" width="110px" />
|
||||||
|
<el-table-column label="仓储名称" align="center" prop="storeHouseName" width="120px" />
|
||||||
|
<el-table-column label="库区名称" align="center" prop="storeAreaName" width="120px" />
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<div class="pagination-container">
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
class="mb-4 mt-4"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 底部按钮 -->
|
||||||
|
<template #footer>
|
||||||
|
<div style="text-align: right; padding-right: 20px;">
|
||||||
|
<el-button @click="handleSave" type="primary" style="margin-right: 10px;">保存</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import * as PurReceiptApi from '@/api/biz/purreceipt'
|
||||||
|
import Dialog from '@/components/Dialog/src/Dialog.vue'
|
||||||
|
import Pagination from '@/components/Pagination/index.vue'
|
||||||
|
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const loading = ref(false)
|
||||||
|
const receiptList = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
const receiptTableRef = ref(null)
|
||||||
|
|
||||||
|
const emit = defineEmits(['select', 'close'])
|
||||||
|
const message = useMessage()
|
||||||
|
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
supplierName: undefined,
|
||||||
|
purReceiptNo: undefined,
|
||||||
|
purStatus: '2', // 只查询已确认的入库单
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 获取入库单列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await PurReceiptApi.getPurReceiptPage(queryParams)
|
||||||
|
receiptList.value = data.list || []
|
||||||
|
total.value = data.total || 0
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryParams.purReceiptNo = undefined
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 点击行 */
|
||||||
|
const handleRowClick = (row) => {
|
||||||
|
if (receiptTableRef.value) {
|
||||||
|
receiptTableRef.value.toggleRowSelection(row)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 选择变更事件处理 */
|
||||||
|
const handleSelectionChange = (selectedItems: any[]) => {
|
||||||
|
// 允许自由选择
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 保存按钮 */
|
||||||
|
const handleSave = () => {
|
||||||
|
if (!receiptTableRef.value) return
|
||||||
|
|
||||||
|
// 获取选中的行
|
||||||
|
const selectedRows = receiptTableRef.value.getSelectionRows ? receiptTableRef.value.getSelectionRows() : []
|
||||||
|
|
||||||
|
if (selectedRows.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否选中了多个不同的入库单号
|
||||||
|
const uniqueReceiptNos = [...new Set(selectedRows.map(row => row.purReceiptNo))]
|
||||||
|
if (uniqueReceiptNos.length > 1) {
|
||||||
|
message.warning('只能选择一个入库单进行退料,请确认!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换数据格式
|
||||||
|
const selectData = selectedRows.map(row => ({
|
||||||
|
id: row.id,
|
||||||
|
purReceiptNo: row.purReceiptNo,
|
||||||
|
billType: row.billType,
|
||||||
|
receiptDate: row.receiptDate,
|
||||||
|
supplierName: row.supplierName,
|
||||||
|
materialCode: row.materialCode,
|
||||||
|
materialName: row.materialName,
|
||||||
|
receiptQty: row.receiptQty,
|
||||||
|
returnedQty: row.returnedQty || 0,
|
||||||
|
spec: row.spec,
|
||||||
|
storeHouseName: row.storeHouseName,
|
||||||
|
storeAreaName: row.storeAreaName,
|
||||||
|
unit: row.unit,
|
||||||
|
supplierId: row.supplierId,
|
||||||
|
materialId: row.materialId,
|
||||||
|
purReceiptId: row.purReceiptId,
|
||||||
|
}))
|
||||||
|
|
||||||
|
emit('select', selectData)
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = (supplierName?: string) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
// 设置查询参数,携带供应商信息
|
||||||
|
queryParams.supplierName = supplierName
|
||||||
|
queryParams.purReceiptNo = undefined
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
import { watch } from 'vue'
|
||||||
|
watch(dialogVisible, (val) => {
|
||||||
|
if (!val) {
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.pagination-container {
|
||||||
|
margin-bottom: 60px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,160 +1,430 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
<Dialog :title="dialogTitle" v-model="dialogVisible" width="90%">
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
:rules="formRules"
|
:rules="formRules"
|
||||||
label-width="110px"
|
label-width="110px"
|
||||||
v-loading="formLoading"
|
v-loading="formLoading"
|
||||||
>
|
>
|
||||||
<el-form-item label="采购退料单号(SCT+年份+月份+3位流水号)" prop="purReturnNo">
|
<!-- 基本信息 -->
|
||||||
<el-input v-model="formData.purReturnNo" placeholder="请输入采购退料单号(SCT+年份+月份+3位流水号)" />
|
<div class="mb-6">
|
||||||
</el-form-item>
|
<div style="font-weight: bold; margin-bottom: 15px;">基本信息</div>
|
||||||
<el-form-item label="单据日期" prop="receiptDate">
|
|
||||||
<el-date-picker
|
<el-row :gutter="20">
|
||||||
v-model="formData.receiptDate"
|
<el-col :span="8">
|
||||||
type="date"
|
<el-form-item label="单据类型" prop="billType">
|
||||||
value-format="x"
|
<el-select
|
||||||
placeholder="选择单据日期"
|
v-model="formData.billType"
|
||||||
/>
|
placeholder="请选择"
|
||||||
</el-form-item>
|
:disabled="formType === 'detail'"
|
||||||
<el-form-item label="供应商id" prop="supplierId">
|
class="!w-full"
|
||||||
<el-input v-model="formData.supplierId" placeholder="请输入供应商id" />
|
>
|
||||||
</el-form-item>
|
<el-option label="标准采购退料" value="3" />
|
||||||
<el-form-item label="供应商名称" prop="supplierName">
|
<el-option label="设备采购退料" value="4" />
|
||||||
<el-input v-model="formData.supplierName" placeholder="请输入供应商名称" />
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="单据状态(1 已创建 2 已确认 )" prop="purStatus">
|
</el-col>
|
||||||
<el-radio-group v-model="formData.purStatus">
|
<el-col :span="8">
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
<el-form-item label="退料单号" prop="purReturnNo">
|
||||||
</el-radio-group>
|
<el-input
|
||||||
</el-form-item>
|
v-model="formData.purReturnNo"
|
||||||
<el-form-item label="备注" prop="remark">
|
placeholder="保存时自动生成"
|
||||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
disabled
|
||||||
</el-form-item>
|
class="!w-full"
|
||||||
<el-form-item label="采购入库单主表id" prop="purReceiptId">
|
/>
|
||||||
<el-input v-model="formData.purReceiptId" placeholder="请输入采购入库单主表id" />
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
<el-form-item label="采购入库单号" prop="purReceiptNo">
|
<el-col :span="8">
|
||||||
<el-input v-model="formData.purReceiptNo" placeholder="请输入采购入库单号" />
|
<el-form-item label="退料日期" prop="receiptDate">
|
||||||
</el-form-item>
|
<el-date-picker
|
||||||
<el-form-item label="退料人id" prop="returnEmpId">
|
v-model="formData.receiptDate"
|
||||||
<el-input v-model="formData.returnEmpId" placeholder="请输入退料人id" />
|
type="date"
|
||||||
</el-form-item>
|
value-format="YYYY-MM-DD"
|
||||||
<el-form-item label="退料人名称" prop="returnEmpName">
|
placeholder="请选择日期"
|
||||||
<el-input v-model="formData.returnEmpName" placeholder="请输入退料人名称" />
|
:disabled="formType === 'detail'"
|
||||||
</el-form-item>
|
class="!w-full"
|
||||||
<el-form-item label="入出库主表id" prop="twmStorageId">
|
/>
|
||||||
<el-input v-model="formData.twmStorageId" placeholder="请输入入出库主表id" />
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
<el-form-item label="单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)" prop="billType">
|
</el-row>
|
||||||
<el-select v-model="formData.billType" placeholder="请选择单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)">
|
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-row :gutter="20">
|
||||||
</el-select>
|
<el-col :span="8">
|
||||||
</el-form-item>
|
<el-form-item label="单据状态" prop="purStatus">
|
||||||
</el-form>
|
<el-select v-model="formData.purStatus" disabled class="!w-full">
|
||||||
<template #footer>
|
<el-option label="已创建" value="1" />
|
||||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
<el-option label="已确认" value="2" />
|
||||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
</el-select>
|
||||||
</template>
|
</el-form-item>
|
||||||
</Dialog>
|
</el-col>
|
||||||
</template>
|
<el-col :span="8">
|
||||||
<script setup lang="ts">
|
<el-form-item label="供应商" prop="supplierId">
|
||||||
import * as PurReturnApi from '@/api/biz/purreturn'
|
<el-select
|
||||||
import { watch } from 'vue'
|
v-model="formData.supplierId"
|
||||||
|
placeholder="请选择"
|
||||||
const { t } = useI18n() // 国际化
|
:disabled="formType === 'detail'"
|
||||||
const message = useMessage() // 消息弹窗
|
class="!w-full"
|
||||||
|
@change="handleSupplierChange"
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
>
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
<el-option
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
v-for="item in supplierOptions"
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
:key="item.id"
|
||||||
const formData = ref({
|
:label="item.supplierName"
|
||||||
id: undefined,
|
:value="item.id"
|
||||||
purReturnNo: undefined,
|
/>
|
||||||
receiptDate: undefined,
|
</el-select>
|
||||||
supplierId: undefined,
|
</el-form-item>
|
||||||
supplierName: undefined,
|
</el-col>
|
||||||
purStatus: undefined,
|
<el-col :span="8">
|
||||||
remark: undefined,
|
<el-form-item label="采购入库单" prop="purReceiptId">
|
||||||
purReceiptId: undefined,
|
<el-input
|
||||||
purReceiptNo: undefined,
|
v-model="formData.purReceiptNo"
|
||||||
returnEmpId: undefined,
|
placeholder="弹出窗体"
|
||||||
returnEmpName: undefined,
|
class="!w-full"
|
||||||
twmStorageId: undefined,
|
:disabled="formType === 'detail'"
|
||||||
billType: undefined,
|
@click="openPurReceiptDialog"
|
||||||
})
|
style="cursor: pointer;"
|
||||||
/** 弹窗关闭时通知父组件 */
|
/>
|
||||||
watch(dialogVisible, (val) => {
|
</el-form-item>
|
||||||
if (!val) {
|
</el-col>
|
||||||
emit('close')
|
</el-row>
|
||||||
}
|
|
||||||
})
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
const formRules = reactive({
|
v-model="formData.remark"
|
||||||
})
|
placeholder="请输入"
|
||||||
const formRef = ref() // 表单 Ref
|
:disabled="formType === 'detail'"
|
||||||
|
class="!w-full"
|
||||||
/** 打开弹窗 */
|
/>
|
||||||
const open = async (type: string, id?: number) => {
|
</el-form-item>
|
||||||
dialogVisible.value = true
|
</div>
|
||||||
dialogTitle.value = t('action.' + type)
|
|
||||||
formType.value = type
|
<!-- 明细信息 -->
|
||||||
resetForm()
|
<div>
|
||||||
// 修改时,设置数据
|
<div style="font-weight: bold; margin-bottom: 15px;">明细信息</div>
|
||||||
if (id) {
|
|
||||||
formLoading.value = true
|
<el-table
|
||||||
try {
|
:data="detailList"
|
||||||
formData.value = await PurReturnApi.getPurReturn(id)
|
:stripe="true"
|
||||||
} finally {
|
:show-overflow-tooltip="true"
|
||||||
formLoading.value = false
|
border
|
||||||
}
|
style="width: 100%;"
|
||||||
}
|
>
|
||||||
}
|
<el-table-column label="序号" type="index" min-width="60px" align="center" />
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
<el-table-column label="物料编码" prop="materialCode" min-width="120px" align="center" />
|
||||||
|
<el-table-column label="物料名称" prop="materialName" min-width="150px" align="center" />
|
||||||
/** 提交表单 */
|
<el-table-column label="规格型号" prop="spec" min-width="100px" align="center" />
|
||||||
const emit = defineEmits(['success', 'close']) // 定义 success 事件,用于操作成功后的回调
|
<el-table-column label="收货数量" prop="receiptQty" min-width="100px" align="center" />
|
||||||
const submitForm = async () => {
|
<el-table-column label="已退料数量" prop="returnedQty" min-width="100px" align="center" />
|
||||||
// 校验表单
|
<el-table-column label="*退料数量" prop="returnQty" min-width="100px" align="center">
|
||||||
await formRef.value.validate()
|
<template #default="scope">
|
||||||
// 提交请求
|
<el-input
|
||||||
formLoading.value = true
|
v-model="scope.row.returnQty"
|
||||||
try {
|
type="number"
|
||||||
const data = formData.value as unknown as PurReturnApi.PurReturnVO
|
placeholder="手动输入"
|
||||||
if (formType.value === 'create') {
|
:disabled="formType === 'detail'"
|
||||||
await PurReturnApi.createPurReturn(data)
|
class="!w-80px"
|
||||||
message.success(t('common.createSuccess'))
|
/>
|
||||||
} else {
|
</template>
|
||||||
await PurReturnApi.updatePurReturn(data)
|
</el-table-column>
|
||||||
message.success(t('common.updateSuccess'))
|
<el-table-column label="批次号" prop="lotNo" min-width="100px" align="center">
|
||||||
}
|
<template #default="scope">
|
||||||
dialogVisible.value = false
|
<el-input
|
||||||
// 发送操作成功的事件
|
v-model="scope.row.lotNo"
|
||||||
emit('success')
|
placeholder="请输入"
|
||||||
} finally {
|
:disabled="formType === 'detail'"
|
||||||
formLoading.value = false
|
class="!w-120px"
|
||||||
}
|
/>
|
||||||
}
|
</template>
|
||||||
|
</el-table-column>
|
||||||
/** 重置表单 */
|
<el-table-column label="仓储名称" prop="storeHouseName" min-width="120px" align="center" />
|
||||||
const resetForm = () => {
|
<el-table-column label="库区名称" prop="storeAreaName" min-width="120px" align="center" />
|
||||||
formData.value = {
|
<el-table-column label="入库日期" prop="receiptDate" min-width="100px" align="center" />
|
||||||
id: undefined,
|
<el-table-column label="单位" prop="unit" min-width="60px" align="center" :formatter="getUnitName" />
|
||||||
purReturnNo: undefined,
|
<el-table-column label="操作" min-width="80px" align="center">
|
||||||
receiptDate: undefined,
|
<template #default="scope">
|
||||||
supplierId: undefined,
|
<el-button
|
||||||
supplierName: undefined,
|
link
|
||||||
purStatus: undefined,
|
type="danger"
|
||||||
remark: undefined,
|
@click="removeItem(scope.$index)"
|
||||||
purReceiptId: undefined,
|
v-if="formType !== 'detail'"
|
||||||
purReceiptNo: undefined,
|
>
|
||||||
returnEmpId: undefined,
|
删除
|
||||||
returnEmpName: undefined,
|
</el-button>
|
||||||
twmStorageId: undefined,
|
</template>
|
||||||
billType: undefined,
|
</el-table-column>
|
||||||
}
|
</el-table>
|
||||||
formRef.value?.resetFields()
|
</div>
|
||||||
}
|
</el-form>
|
||||||
</script>
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="handleSave"
|
||||||
|
:disabled="formLoading"
|
||||||
|
v-if="formType !== 'detail'"
|
||||||
|
>保存</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="handleConfirm"
|
||||||
|
:disabled="formLoading || formData.purStatus === '2'"
|
||||||
|
v-if="formType !== 'detail'"
|
||||||
|
>确认</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<!-- 采购入库单选择弹窗 -->
|
||||||
|
<PurReceiptSelectDialog ref="purReceiptDialogRef" @select="handlePurReceiptSelect" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, onMounted, watch } from 'vue'
|
||||||
|
import Dialog from '@/components/Dialog/src/Dialog.vue'
|
||||||
|
import PurReceiptSelectDialog from './PurReceiptSelectDialog.vue'
|
||||||
|
import * as PurReturnApi from '@/api/biz/purreturn'
|
||||||
|
import * as SupplierApi from '@/api/biz/supplier'
|
||||||
|
import * as PurReceiptApi from '@/api/biz/purreceipt'
|
||||||
|
import { getUnitName } from '@/utils/dict'
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const message = useMessage()
|
||||||
|
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const dialogTitle = ref('')
|
||||||
|
const formLoading = ref(false)
|
||||||
|
const formType = ref('')
|
||||||
|
const formRef = ref()
|
||||||
|
const purReceiptDialogRef = ref()
|
||||||
|
|
||||||
|
// 供应商选项
|
||||||
|
const supplierOptions = ref([])
|
||||||
|
|
||||||
|
const formData = reactive({
|
||||||
|
id: undefined,
|
||||||
|
purReturnNo: '保存时自动生成',
|
||||||
|
receiptDate: new Date().toISOString().split('T')[0],
|
||||||
|
supplierId: undefined,
|
||||||
|
supplierName: undefined,
|
||||||
|
purStatus: '1',
|
||||||
|
remark: undefined,
|
||||||
|
purReceiptId: undefined,
|
||||||
|
purReceiptNo: undefined,
|
||||||
|
returnEmpId: undefined,
|
||||||
|
returnEmpName: undefined,
|
||||||
|
twmStorageId: undefined,
|
||||||
|
billType: '3',
|
||||||
|
})
|
||||||
|
|
||||||
|
const detailList = ref([])
|
||||||
|
|
||||||
|
const formRules = reactive({
|
||||||
|
billType: [{ required: true, message: '请选择单据类型', trigger: 'blur' }],
|
||||||
|
receiptDate: [{ required: true, message: '请选择退料日期', trigger: 'blur' }],
|
||||||
|
supplierId: [{ required: true, message: '请选择供应商', trigger: 'blur' }],
|
||||||
|
purReceiptId: [{ required: true, message: '请选择采购入库单', trigger: 'blur' }],
|
||||||
|
})
|
||||||
|
|
||||||
|
// 监听弹窗关闭
|
||||||
|
watch(dialogVisible, (val) => {
|
||||||
|
if (!val) {
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 打开表单 */
|
||||||
|
const emit = defineEmits(['success', 'close'])
|
||||||
|
const open = async (type: string, id?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = type === 'create' ? '新增' : type === 'update' ? '编辑' : '详情'
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
|
||||||
|
// 加载供应商列表
|
||||||
|
await loadSupplierList()
|
||||||
|
|
||||||
|
if (id) {
|
||||||
|
// 修改或详情时加载数据
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = await PurReturnApi.getPurReturn(id)
|
||||||
|
Object.assign(formData, data)
|
||||||
|
// 加载明细数据
|
||||||
|
detailList.value = data?.items || data?.detailList || []
|
||||||
|
// 设置供应商名称
|
||||||
|
const supplier = supplierOptions.value.find(s => s.id === formData.supplierId)
|
||||||
|
if (supplier) {
|
||||||
|
formData.supplierName = supplier.supplierName
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
/** 加载供应商列表 */
|
||||||
|
const loadSupplierList = async () => {
|
||||||
|
try {
|
||||||
|
const suppliers = await SupplierApi.dropdown()
|
||||||
|
supplierOptions.value = suppliers || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载供应商列表失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 供应商变更处理 */
|
||||||
|
const handleSupplierChange = (value: number) => {
|
||||||
|
const supplier = supplierOptions.value.find(s => s.id === value)
|
||||||
|
formData.supplierName = supplier ? supplier.supplierName : undefined
|
||||||
|
formData.purReceiptId = undefined
|
||||||
|
formData.purReceiptNo = undefined
|
||||||
|
detailList.value = []
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打开采购入库单选择弹窗 */
|
||||||
|
const openPurReceiptDialog = () => {
|
||||||
|
// 验证:必须先选择供应商
|
||||||
|
if (!formData.supplierId || !formData.supplierName) {
|
||||||
|
message.warning('请先输入供应商信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 传递供应商名称作为查询参数
|
||||||
|
purReceiptDialogRef.value?.open(formData.supplierName)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 处理采购入库单选择 */
|
||||||
|
const handlePurReceiptSelect = async (selectedData: any[]) => {
|
||||||
|
if (selectedData && selectedData.length > 0) {
|
||||||
|
// 设置入库单信息
|
||||||
|
const firstItem = selectedData[0]
|
||||||
|
formData.purReceiptId = firstItem.purReceiptId || firstItem.id
|
||||||
|
formData.purReceiptNo = firstItem.purReceiptNo
|
||||||
|
|
||||||
|
// 设置明细
|
||||||
|
detailList.value = selectedData.map(item => ({
|
||||||
|
...item,
|
||||||
|
receiptQty: item.receiptQty || item.purQty,
|
||||||
|
returnedQty: item.returnedQty || 0,
|
||||||
|
returnQty: (Number(item.receiptQty || item.purQty) || 0) - (Number(item.returnedQty) || 0) // 默认退料数量 = 收货数量 - 已退料数量
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除明细项 */
|
||||||
|
const removeItem = (index: number) => {
|
||||||
|
detailList.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 保存 */
|
||||||
|
const handleSave = async () => {
|
||||||
|
try {
|
||||||
|
await formRef.value.validate()
|
||||||
|
|
||||||
|
// 校验明细
|
||||||
|
if (detailList.value.length === 0) {
|
||||||
|
message.warning('请至少添加一条物料明细')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验退料数量
|
||||||
|
for (let i = 0; i < detailList.value.length; i++) {
|
||||||
|
const item = detailList.value[i]
|
||||||
|
if (!item.returnQty || Number(item.returnQty) <= 0) {
|
||||||
|
message.warning(`第${i + 1}行物料的退料数量不能为空且必须大于0`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
formLoading.value = true
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
...formData,
|
||||||
|
items: detailList.value,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await PurReturnApi.createPurReturn(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await PurReturnApi.updatePurReturn(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 确认 */
|
||||||
|
const handleConfirm = async () => {
|
||||||
|
try {
|
||||||
|
await formRef.value.validate()
|
||||||
|
|
||||||
|
// 校验明细
|
||||||
|
if (detailList.value.length === 0) {
|
||||||
|
message.warning('请至少添加一条物料明细')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验退料数量
|
||||||
|
for (let i = 0; i < detailList.value.length; i++) {
|
||||||
|
const item = detailList.value[i]
|
||||||
|
if (!item.returnQty || Number(item.returnQty) <= 0) {
|
||||||
|
message.warning(`第${i + 1}行物料的退料数量不能为空且必须大于0`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
formLoading.value = true
|
||||||
|
|
||||||
|
formData.purStatus = '2'
|
||||||
|
const data = {
|
||||||
|
...formData,
|
||||||
|
items: detailList.value,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await PurReturnApi.createPurReturn(data)
|
||||||
|
} else {
|
||||||
|
await PurReturnApi.updatePurReturn(data)
|
||||||
|
}
|
||||||
|
message.success('确认成功')
|
||||||
|
|
||||||
|
dialogVisible.value = false
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
Object.assign(formData, {
|
||||||
|
id: undefined,
|
||||||
|
purReturnNo: '保存时自动生成',
|
||||||
|
receiptDate: new Date().toISOString().split('T')[0],
|
||||||
|
supplierId: undefined,
|
||||||
|
supplierName: undefined,
|
||||||
|
purStatus: '1',
|
||||||
|
remark: undefined,
|
||||||
|
purReceiptId: undefined,
|
||||||
|
purReceiptNo: undefined,
|
||||||
|
returnEmpId: undefined,
|
||||||
|
returnEmpName: undefined,
|
||||||
|
twmStorageId: undefined,
|
||||||
|
billType: '3',
|
||||||
|
})
|
||||||
|
detailList.value = []
|
||||||
|
purReceiptOptions.value = []
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
|
onMounted(() => {
|
||||||
|
loadSupplierList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@ -1,269 +1,341 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form
|
<el-form
|
||||||
class="-mb-15px"
|
class="-mb-15px"
|
||||||
:model="queryParams"
|
:model="queryParams"
|
||||||
ref="queryFormRef"
|
ref="queryFormRef"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
>
|
>
|
||||||
<el-form-item label="采购退料单号(SCT+年份+月份+3位流水号)" prop="purReturnNo">
|
<el-form-item label="退料日期" prop="receiptDate">
|
||||||
<el-input
|
<el-date-picker
|
||||||
v-model="queryParams.purReturnNo"
|
v-model="queryParams.receiptDate"
|
||||||
placeholder="请输入采购退料单号(SCT+年份+月份+3位流水号)"
|
value-format="YYYY-MM-DD"
|
||||||
clearable
|
type="daterange"
|
||||||
@keyup.enter="handleQuery"
|
start-placeholder="开始日期"
|
||||||
class="!w-240px"
|
end-placeholder="结束日期"
|
||||||
/>
|
class="!w-240px"
|
||||||
</el-form-item>
|
/>
|
||||||
<el-form-item label="单据日期" prop="receiptDate">
|
</el-form-item>
|
||||||
<el-date-picker
|
<el-form-item label="单据类型" prop="billType">
|
||||||
v-model="queryParams.receiptDate"
|
<el-select
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
v-model="queryParams.billType"
|
||||||
type="daterange"
|
placeholder="请选择单据类型"
|
||||||
start-placeholder="开始日期"
|
clearable
|
||||||
end-placeholder="结束日期"
|
class="!w-200px"
|
||||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
>
|
||||||
class="!w-240px"
|
<el-option label="标准采购退料" value="3" />
|
||||||
/>
|
<el-option label="设备采购退料" value="4" />
|
||||||
</el-form-item>
|
</el-select>
|
||||||
<el-form-item label="供应商id" prop="supplierId">
|
</el-form-item>
|
||||||
<el-input
|
<el-form-item label="退料单号" prop="purReturnNo">
|
||||||
v-model="queryParams.supplierId"
|
<el-input
|
||||||
placeholder="请输入供应商id"
|
v-model="queryParams.purReturnNo"
|
||||||
clearable
|
placeholder="请输入退料单号"
|
||||||
@keyup.enter="handleQuery"
|
clearable
|
||||||
class="!w-240px"
|
@keyup.enter="handleQuery"
|
||||||
/>
|
class="!w-200px"
|
||||||
</el-form-item>
|
/>
|
||||||
<el-form-item label="供应商名称" prop="supplierName">
|
</el-form-item>
|
||||||
<el-input
|
<el-form-item label="供应商" prop="supplierName">
|
||||||
v-model="queryParams.supplierName"
|
<el-input
|
||||||
placeholder="请输入供应商名称"
|
v-model="queryParams.supplierName"
|
||||||
clearable
|
placeholder="请输入供应商名称"
|
||||||
@keyup.enter="handleQuery"
|
clearable
|
||||||
class="!w-240px"
|
@keyup.enter="handleQuery"
|
||||||
/>
|
class="!w-200px"
|
||||||
</el-form-item>
|
/>
|
||||||
<el-form-item label="单据状态(1 已创建 2 已确认 )" prop="purStatus">
|
</el-form-item>
|
||||||
<el-select
|
<el-form-item label="单据状态" prop="purStatus">
|
||||||
v-model="queryParams.purStatus"
|
<el-select
|
||||||
placeholder="请选择单据状态(1 已创建 2 已确认 )"
|
v-model="queryParams.purStatus"
|
||||||
clearable
|
placeholder="请选择单据状态"
|
||||||
class="!w-240px"
|
clearable
|
||||||
>
|
class="!w-150px"
|
||||||
<el-option label="请选择字典生成" value="" />
|
>
|
||||||
</el-select>
|
<el-option label="已创建" value="1" />
|
||||||
</el-form-item>
|
<el-option label="已确认" value="2" />
|
||||||
<el-form-item label="采购入库单主表id" prop="purReceiptId">
|
</el-select>
|
||||||
<el-input
|
</el-form-item>
|
||||||
v-model="queryParams.purReceiptId"
|
<el-form-item>
|
||||||
placeholder="请输入采购入库单主表id"
|
<el-button type="primary" @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
clearable
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
@keyup.enter="handleQuery"
|
<el-button
|
||||||
class="!w-240px"
|
type="primary"
|
||||||
/>
|
@click="openForm('create')"
|
||||||
</el-form-item>
|
v-hasPermi="['biz:pur-return:create']"
|
||||||
<el-form-item label="采购入库单号" prop="purReceiptNo">
|
>
|
||||||
<el-input
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
v-model="queryParams.purReceiptNo"
|
</el-button>
|
||||||
placeholder="请输入采购入库单号"
|
</el-form-item>
|
||||||
clearable
|
</el-form>
|
||||||
@keyup.enter="handleQuery"
|
</ContentWrap>
|
||||||
class="!w-240px"
|
|
||||||
/>
|
<!-- 退料单信息表格 -->
|
||||||
</el-form-item>
|
<ContentWrap class="!p-10px">
|
||||||
<el-form-item label="入出库主表id" prop="twmStorageId">
|
<div style="display: flex; flex-direction: column; height: calc(50vh - 180px);">
|
||||||
<el-input
|
<div style="flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;">
|
||||||
v-model="queryParams.twmStorageId"
|
<div style="font-weight: bold; margin-bottom: 8px;">退料单信息</div>
|
||||||
placeholder="请输入入出库主表id"
|
<el-table
|
||||||
clearable
|
v-loading="loading"
|
||||||
@keyup.enter="handleQuery"
|
:data="list"
|
||||||
class="!w-240px"
|
:stripe="true"
|
||||||
/>
|
:show-overflow-tooltip="true"
|
||||||
</el-form-item>
|
border
|
||||||
<el-form-item label="单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)" prop="billType">
|
@row-click="handleRowClick"
|
||||||
<el-select
|
:highlight-current-row="true"
|
||||||
v-model="queryParams.billType"
|
style="flex: 1;"
|
||||||
placeholder="请选择单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)"
|
max-height="100%"
|
||||||
clearable
|
>
|
||||||
class="!w-240px"
|
<el-table-column label="序号" align="center" type="index" width="60px"/>
|
||||||
>
|
<el-table-column label="单据类型" align="center" prop="billType" >
|
||||||
<el-option label="请选择字典生成" value="" />
|
<template #default="scope">
|
||||||
</el-select>
|
<span v-if="scope.row.billType === '3'">标准采购退料</span>
|
||||||
</el-form-item>
|
<span v-else-if="scope.row.billType === '4'">设备采购退料</span>
|
||||||
<el-form-item>
|
<span v-else>-</span>
|
||||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
</template>
|
||||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
</el-table-column>
|
||||||
<el-button
|
<el-table-column label="退料单号" align="center" prop="purReturnNo" />
|
||||||
type="primary"
|
<el-table-column label="供应商" align="center" prop="supplierName" width="300px" />
|
||||||
plain
|
<el-table-column label="单据状态" align="center" prop="purStatus" >
|
||||||
@click="openForm('create')"
|
<template #default="scope">
|
||||||
v-hasPermi="['biz:pur-return:create']"
|
<span v-if="scope.row.purStatus === '1'" class="text-blue">已创建</span>
|
||||||
>
|
<span v-else-if="scope.row.purStatus === '2'" class="text-green">已确认</span>
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
<span v-else>-</span>
|
||||||
</el-button>
|
</template>
|
||||||
<el-button
|
</el-table-column>
|
||||||
type="success"
|
<el-table-column label="退料日期" align="center" prop="receiptDate" />
|
||||||
plain
|
<el-table-column label="退料人员" align="center" prop="returnEmpName" />
|
||||||
@click="handleExport"
|
<el-table-column label="采购入库单号" align="center" prop="purReceiptNo" />
|
||||||
:loading="exportLoading"
|
<el-table-column label="操作" align="center" >
|
||||||
v-hasPermi="['biz:pur-return:export']"
|
<template #default="scope">
|
||||||
>
|
<el-button
|
||||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
link
|
||||||
</el-button>
|
type="primary"
|
||||||
</el-form-item>
|
@click="openForm('update', scope.row.id)"
|
||||||
</el-form>
|
v-hasPermi="['biz:pur-return:update']"
|
||||||
</ContentWrap>
|
v-if="scope.row.purStatus === '1' "
|
||||||
|
>
|
||||||
<!-- 列表 -->
|
编辑
|
||||||
<ContentWrap>
|
</el-button>
|
||||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<el-button
|
||||||
<el-table-column label="序号" align="center" type="index" width="60px"/>
|
link
|
||||||
<el-table-column
|
type="danger"
|
||||||
label="创建时间"
|
@click="handleDelete(scope.row.id)"
|
||||||
align="center"
|
v-hasPermi="['biz:pur-return:delete']"
|
||||||
prop="createTime"
|
v-if="scope.row.purStatus === '1' "
|
||||||
:formatter="dateFormatter"
|
>
|
||||||
width="180px"
|
删除
|
||||||
/>
|
</el-button>
|
||||||
<el-table-column label="采购退料单号(SCT+年份+月份+3位流水号)" align="center" prop="purReturnNo" />
|
<el-button
|
||||||
<el-table-column label="单据日期" align="center" prop="receiptDate" />
|
link
|
||||||
<el-table-column label="供应商id" align="center" prop="supplierId" />
|
type="info"
|
||||||
<el-table-column label="供应商名称" align="center" prop="supplierName" />
|
@click="openForm('detail', scope.row.id)"
|
||||||
<el-table-column label="单据状态(1 已创建 2 已确认 )" align="center" prop="purStatus" />
|
>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
详情
|
||||||
<el-table-column label="采购入库单主表id" align="center" prop="purReceiptId" />
|
</el-button>
|
||||||
<el-table-column label="采购入库单号" align="center" prop="purReceiptNo" />
|
</template>
|
||||||
<el-table-column label="退料人id" align="center" prop="returnEmpId" />
|
</el-table-column>
|
||||||
<el-table-column label="退料人名称" align="center" prop="returnEmpName" />
|
</el-table>
|
||||||
<el-table-column label="入出库主表id" align="center" prop="twmStorageId" />
|
<div style="display: flex; justify-content: flex-end; margin-top: 1px; flex-shrink: 0;">
|
||||||
<el-table-column label="单据类型(1 标准采购 2设备采购 3 标准采购退料 4设备采购退料)" align="center" prop="billType" />
|
<Pagination
|
||||||
<el-table-column label="操作" align="center">
|
:total="total"
|
||||||
<template #default="scope">
|
v-model:page="queryParams.pageNo"
|
||||||
<el-button
|
v-model:limit="queryParams.pageSize"
|
||||||
link
|
@pagination="getList"
|
||||||
type="primary"
|
/>
|
||||||
@click="openForm('update', scope.row.id)"
|
</div>
|
||||||
v-hasPermi="['biz:pur-return:update']"
|
</div>
|
||||||
>
|
</div>
|
||||||
编辑
|
</ContentWrap>
|
||||||
</el-button>
|
|
||||||
<el-button
|
<!-- 退料明细信息表格 -->
|
||||||
link
|
<ContentWrap class="!p-15px" style="height: calc(50vh - 60px);">
|
||||||
type="danger"
|
<div style="font-weight: bold; margin-bottom: 8px;">退料明细信息</div>
|
||||||
@click="handleDelete(scope.row.id)"
|
<div style="height: calc(100% - 40px); overflow: auto;">
|
||||||
v-hasPermi="['biz:pur-return:delete']"
|
<el-table
|
||||||
>
|
v-loading="detailLoading"
|
||||||
删除
|
:data="detailList"
|
||||||
</el-button>
|
:stripe="true"
|
||||||
</template>
|
:show-overflow-tooltip="true"
|
||||||
</el-table-column>
|
show-summary
|
||||||
</el-table>
|
border
|
||||||
<!-- 分页 -->
|
:summary-method="getDetailSummary"
|
||||||
<Pagination
|
style="width: 100%;"
|
||||||
:total="total"
|
>
|
||||||
v-model:page="queryParams.pageNo"
|
<el-table-column label="序号" align="center" type="index" width="60px"/>
|
||||||
v-model:limit="queryParams.pageSize"
|
<el-table-column label="物料编码" align="center" prop="materialCode" />
|
||||||
@pagination="getList"
|
<el-table-column label="物料名称" align="center" prop="materialName" />
|
||||||
/>
|
<el-table-column label="规格型号" align="center" prop="spec" />
|
||||||
</ContentWrap>
|
<el-table-column label="收货数量" align="center" prop="receiptQty" />
|
||||||
|
<el-table-column label="已退料数量" align="center" prop="returnedQty" />
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<el-table-column label="退料数量" align="center" prop="returnQty" />
|
||||||
<PurReturnForm ref="formRef" @success="getList" @close="handleQuery"/>
|
<el-table-column label="批次号" align="center" prop="lotNo" />
|
||||||
</template>
|
<el-table-column label="仓储名称" align="center" prop="storeHouseName" />
|
||||||
|
<el-table-column label="库区名称" align="center" prop="storeAreaName" />
|
||||||
<script setup lang="ts">
|
<el-table-column label="单位" align="center" prop="unit" :formatter="getUnitName" />
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
</el-table>
|
||||||
import download from '@/utils/download'
|
</div>
|
||||||
import * as PurReturnApi from '@/api/biz/purreturn'
|
</ContentWrap>
|
||||||
import PurReturnForm from './PurReturnForm.vue'
|
|
||||||
|
<!-- 表单弹窗:添加/修改/详情 -->
|
||||||
defineOptions({ name: 'PurReturn' })
|
<PurReturnForm ref="formRef" @success="getList" @close="handleQuery"/>
|
||||||
|
</template>
|
||||||
const message = useMessage() // 消息弹窗
|
|
||||||
const { t } = useI18n() // 国际化
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
const loading = ref(false) // 列表的加载中(默认不加载)
|
import * as PurReturnApi from '@/api/biz/purreturn'
|
||||||
const list = ref([]) // 列表的数据
|
import PurReturnForm from './PurReturnForm.vue'
|
||||||
const total = ref(0) // 列表的总页数
|
import { getUnitName } from '@/utils/dict'
|
||||||
const queryParams = reactive({
|
import { getCurrentSimMonthRange } from '@/utils/formatTime'
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 10,
|
defineOptions({ name: 'PurReturn' })
|
||||||
purReturnNo: undefined,
|
|
||||||
receiptDate: [],
|
const message = useMessage() // 消息弹窗
|
||||||
supplierId: undefined,
|
const { t } = useI18n() // 国际化
|
||||||
supplierName: undefined,
|
|
||||||
purStatus: undefined,
|
const loading = ref(false) // 列表的加载中(默认不加载)
|
||||||
purReceiptId: undefined,
|
const detailLoading = ref(false) // 详情列表的加载中
|
||||||
purReceiptNo: undefined,
|
const list = ref([]) // 列表的数据
|
||||||
twmStorageId: undefined,
|
const total = ref(0) // 列表的总页数
|
||||||
billType: undefined,
|
const detailList = ref([]) // 退料明细信息列表
|
||||||
})
|
const mainInfo = ref<any>({}) // 主信息
|
||||||
const queryFormRef = ref() // 搜索的表单
|
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
/** 查询列表 */
|
pageSize: 10,
|
||||||
const getList = async () => {
|
purReturnNo: undefined,
|
||||||
loading.value = true
|
receiptDate: getCurrentSimMonthRange(),
|
||||||
try {
|
supplierName: undefined,
|
||||||
const data = await PurReturnApi.getPurReturnPage(queryParams)
|
purStatus: undefined,
|
||||||
list.value = data.list
|
billType: undefined,
|
||||||
total.value = data.total
|
})
|
||||||
} finally {
|
const queryFormRef = ref() // 搜索的表单
|
||||||
loading.value = false
|
|
||||||
}
|
/** 查询列表 */
|
||||||
}
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
/** 搜索按钮操作 */
|
try {
|
||||||
const handleQuery = () => {
|
const data = await PurReturnApi.getPurReturnPage(queryParams)
|
||||||
queryParams.pageNo = 1
|
list.value = data.list
|
||||||
getList()
|
total.value = data.total
|
||||||
}
|
// 默认选中第一行并加载详情
|
||||||
|
if (list.value.length > 0) {
|
||||||
/** 重置按钮操作 */
|
handleRowClick(list.value[0])
|
||||||
const resetQuery = () => {
|
}
|
||||||
queryFormRef.value.resetFields()
|
} finally {
|
||||||
handleQuery()
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/** 添加/修改操作 */
|
|
||||||
const formRef = ref()
|
/** 获取详情列表 */
|
||||||
const openForm = (type: string, id?: number) => {
|
const getDetailList = async (id: number) => {
|
||||||
formRef.value.open(type, id)
|
detailLoading.value = true
|
||||||
}
|
try {
|
||||||
|
// 根据退料单ID查询物料详情
|
||||||
/** 删除按钮操作 */
|
const data = await PurReturnApi.getPurReturn(id)
|
||||||
const handleDelete = async (id: number) => {
|
// 保存主信息
|
||||||
try {
|
mainInfo.value = {
|
||||||
// 删除的二次确认
|
storeHouseName: data.storeHouseName
|
||||||
await message.delConfirm()
|
}
|
||||||
// 发起删除
|
// 后端返回的数据中,明细在items字段中
|
||||||
await PurReturnApi.deletePurReturn(id)
|
detailList.value = data?.items || data || []
|
||||||
message.success(t('common.delSuccess'))
|
// 将主信息中的仓储名称和库区名称填充到每个明细项中
|
||||||
// 刷新列表
|
detailList.value.forEach(item => {
|
||||||
await getList()
|
item.storeHouseName = mainInfo.value.storeHouseName
|
||||||
} catch {}
|
})
|
||||||
}
|
} catch (error) {
|
||||||
|
console.error('获取退料物料详情失败:', error)
|
||||||
/** 导出按钮操作 */
|
detailList.value = []
|
||||||
const handleExport = async () => {
|
mainInfo.value = {}
|
||||||
try {
|
} finally {
|
||||||
// 导出的二次确认
|
detailLoading.value = false
|
||||||
await message.exportConfirm()
|
}
|
||||||
// 发起导出
|
}
|
||||||
exportLoading.value = true
|
|
||||||
const data = await PurReturnApi.exportPurReturn(queryParams)
|
/** 点击行加载详情 */
|
||||||
download.excel(data, '采购退料单主.xls')
|
const handleRowClick = (row: any) => {
|
||||||
} catch {
|
if (row.id) {
|
||||||
} finally {
|
getDetailList(row.id)
|
||||||
exportLoading.value = false
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
/** 初始化 **/
|
const handleQuery = () => {
|
||||||
onMounted(() => {
|
queryParams.pageNo = 1
|
||||||
// 默认不自动查询,需手动点击搜索按钮
|
getList()
|
||||||
})
|
}
|
||||||
</script>
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改/详情操作 */
|
||||||
|
const formRef = ref()
|
||||||
|
const openForm = (type: string, id?: number) => {
|
||||||
|
formRef.value.open(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await PurReturnApi.deletePurReturn(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 详情表格合计方法 */
|
||||||
|
const getDetailSummary = (param: any) => {
|
||||||
|
const { columns, data } = param
|
||||||
|
const sums: any = []
|
||||||
|
|
||||||
|
// 安全检查:确保 columns 是数组
|
||||||
|
if (!columns || !Array.isArray(columns)) {
|
||||||
|
return sums
|
||||||
|
}
|
||||||
|
|
||||||
|
columns.forEach((column: any, index: number) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = '合计'
|
||||||
|
} else if (index === 4) {
|
||||||
|
// 第5列:收货数量
|
||||||
|
const total = data.reduce((sum: number, item: any) => sum + (Number(item.receiptQty) || 0), 0)
|
||||||
|
sums[index] = total
|
||||||
|
} else if (index === 5) {
|
||||||
|
// 第6列:已退料数量
|
||||||
|
const total = data.reduce((sum: number, item: any) => sum + (Number(item.returnedQty) || 0), 0)
|
||||||
|
sums[index] = total
|
||||||
|
} else if (index === 6) {
|
||||||
|
// 第7列:退料数量
|
||||||
|
const total = data.reduce((sum: number, item: any) => sum + (Number(item.returnQty) || 0), 0)
|
||||||
|
sums[index] = total
|
||||||
|
} else {
|
||||||
|
sums[index] = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return sums
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
// 默认不自动查询,需手动点击搜索按钮
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.text-blue {
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-green {
|
||||||
|
color: #67c23a;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user