feat(heli): 实现新中大入出库单功能模块
This commit is contained in:
parent
bba1f91d83
commit
ea8ae8451f
@ -182,4 +182,9 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode MAT_CAT_CODE_DISABLED = new ErrorCode(1_014_003, "该物料大类没有维护物料大类编码,请维护!");
|
||||
ErrorCode MAT_CAT_CODE_ERROR = new ErrorCode(1_014_004, "该物料大类编码不正确,请检查!");
|
||||
|
||||
ErrorCode WMS_STORAGE_NOT_EXISTS = new ErrorCode(1_015_001, "当前数据不存在");
|
||||
ErrorCode WMS_STORAGE_IS_EXPORT = new ErrorCode(1_015_002, "存在已导出的数据,请刷新界面。");
|
||||
ErrorCode WMS_STORAGE_NOT_EXPORT = new ErrorCode(1_015_003, "当前数据不能删除!");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,164 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.converters.longconverter.LongStringConverter;
|
||||
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||
import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo.*;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.wmsstoragedetail.vo.DetailInExcelVO;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.wmsstoragedetail.vo.DetailOutExcelVO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.wmsstorage.WmsStorageDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.wmsstoragedetail.WmsStorageDetailDO;
|
||||
import com.chanko.yunxi.mes.module.heli.service.wmsstorage.WmsStorageService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
|
||||
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 新中大入/出库主")
|
||||
@RestController
|
||||
@RequestMapping("/heli/wms-storage")
|
||||
@Validated
|
||||
public class WmsStorageController {
|
||||
|
||||
@Resource
|
||||
private WmsStorageService wmsStorageService;
|
||||
|
||||
@Resource
|
||||
private com.chanko.yunxi.mes.module.heli.dal.mysql.wmsstoragedetail.WmsStorageDetailMapper wmsStorageDetailMapper;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建新中大入/出库主")
|
||||
@PreAuthorize("@ss.hasPermission('heli:wms-storage:create')")
|
||||
public CommonResult<Long> createWmsStorage(@Valid @RequestBody WmsStorageSaveReqVO createReqVO) {
|
||||
return success(wmsStorageService.createWmsStorage(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新新中大入/出库主")
|
||||
@PreAuthorize("@ss.hasPermission('heli:wms-storage:update')")
|
||||
public CommonResult<Boolean> updateWmsStorage(@Valid @RequestBody WmsStorageSaveReqVO updateReqVO) {
|
||||
wmsStorageService.updateWmsStorage(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除新中大入/出库主")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('heli:wms-storage:delete')")
|
||||
public CommonResult<Boolean> deleteWmsStorage(@RequestParam("id") Long id) {
|
||||
wmsStorageService.deleteWmsStorage(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得新中大入/出库主")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('heli:wms-storage:query')")
|
||||
public CommonResult<WmsStorageRespVO> getWmsStorage(@RequestParam("id") Long id) {
|
||||
WmsStorageDO wmsStorage = wmsStorageService.getWmsStorage(id);
|
||||
return success(BeanUtils.toBean(wmsStorage, WmsStorageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得新中大入/出库主分页")
|
||||
@PreAuthorize("@ss.hasPermission('heli:wms-storage:query')")
|
||||
public CommonResult<PageResult<WmsStorageRespVO>> getWmsStoragePage(@Valid WmsStoragePageReqVO pageReqVO) {
|
||||
PageResult<WmsStorageDO> pageResult = wmsStorageService.getWmsStoragePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, WmsStorageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出新中大入/出库主 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('heli:wms-storage:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void exportWmsStorageExcel(@RequestParam("stockType") Integer stockType,
|
||||
@RequestParam("ids") String ids,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<WmsStorageDO> list = wmsStorageService.processWsmStorage(ids);
|
||||
|
||||
// 导出 Excel - 两个sheet
|
||||
try {
|
||||
// 设置响应头
|
||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
|
||||
// 判断入库还是出库,确定文件名和VO类型
|
||||
boolean isInbound = stockType == 1;
|
||||
String typeName = isInbound ? "入库" : "出库";
|
||||
String fileName = URLEncoder.encode("新中大" + typeName + "单导出").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
|
||||
// 创建ExcelWriter
|
||||
com.alibaba.excel.ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream())
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||
.registerConverter(new LongStringConverter())
|
||||
.build();
|
||||
|
||||
// 写入第一个sheet - 主表数据(根据stockType选择不同的VO)
|
||||
com.alibaba.excel.write.metadata.WriteSheet writeSheet1;
|
||||
if (isInbound) {
|
||||
// 入库:使用InExcelVO
|
||||
List<WmsStorageInExcelVO> mainData = BeanUtils.toBean(list, WmsStorageInExcelVO.class);
|
||||
writeSheet1 = EasyExcel.writerSheet(0, typeName + "表头")
|
||||
.head(WmsStorageInExcelVO.class).build();
|
||||
excelWriter.write(mainData, writeSheet1);
|
||||
} else {
|
||||
// 出库:使用OutExcelVO
|
||||
List<WmsStorageOutExcelVO> mainData = BeanUtils.toBean(list, WmsStorageOutExcelVO.class);
|
||||
writeSheet1 = EasyExcel.writerSheet(0, typeName + "表头")
|
||||
.head(WmsStorageOutExcelVO.class).build();
|
||||
excelWriter.write(mainData, writeSheet1);
|
||||
}
|
||||
|
||||
// 写入第二个sheet - 明细数据(根据stockType选择不同的VO)
|
||||
List<WmsStorageDetailDO> detailList = new ArrayList<>();
|
||||
for (WmsStorageDO wmsStorage : list) {
|
||||
if (wmsStorage.getDetailList() != null) {
|
||||
detailList.addAll(wmsStorage.getDetailList());
|
||||
}
|
||||
}
|
||||
com.alibaba.excel.write.metadata.WriteSheet writeSheet2;
|
||||
if (isInbound) {
|
||||
// 入库明细:包含单价
|
||||
List<DetailInExcelVO> detailData = BeanUtils.toBean(detailList, DetailInExcelVO.class);
|
||||
writeSheet2 = EasyExcel.writerSheet(1, typeName + "表体")
|
||||
.head(DetailInExcelVO.class).build();
|
||||
excelWriter.write(detailData, writeSheet2);
|
||||
} else {
|
||||
// 出库明细:不包含单价
|
||||
List<DetailOutExcelVO> detailData = BeanUtils.toBean(detailList, DetailOutExcelVO.class);
|
||||
writeSheet2 = EasyExcel.writerSheet(1, typeName + "表体")
|
||||
.head(DetailOutExcelVO.class).build();
|
||||
excelWriter.write(detailData, writeSheet2);
|
||||
}
|
||||
|
||||
|
||||
// 关闭writer
|
||||
excelWriter.finish();
|
||||
} catch (Exception e) {
|
||||
response.reset();
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
response.getWriter().println("{\"code\":500,\"msg\":\"导出Excel失败: " + e.getMessage() + "\"}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo;
|
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author: zhoupeng
|
||||
* @date: 2026/3/30
|
||||
*/
|
||||
public class WmsStorageInDetailExcelVO {
|
||||
@ExcelProperty("系统编号")
|
||||
private Long id = 1L;
|
||||
|
||||
@ExcelProperty("仓库")
|
||||
private String whName;
|
||||
|
||||
@ExcelProperty("业务日期")
|
||||
private LocalDate busiDate;
|
||||
|
||||
@ExcelProperty("部门")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty("业务类型")
|
||||
private String busiType;
|
||||
|
||||
@ExcelProperty("辅助项")
|
||||
private String auItem;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo;
|
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author: zhoupeng
|
||||
* @date: 2026/3/30
|
||||
*/
|
||||
@Schema(description = "管理后台 - 新中大入出库单子 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsStorageInExcelVO {
|
||||
@ExcelProperty("系统编号")
|
||||
private Long systemID = 1L;
|
||||
|
||||
@ExcelProperty("业务类型")
|
||||
private String busiType;
|
||||
|
||||
@ExcelProperty("仓库")
|
||||
private String whName;
|
||||
|
||||
@ExcelProperty("业务日期")
|
||||
private LocalDate busiDate;
|
||||
|
||||
@ExcelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
@ExcelProperty("价格类型")
|
||||
private String priceType;
|
||||
|
||||
@ExcelProperty("部门")
|
||||
private String deptName;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo;
|
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author: zhoupeng
|
||||
* @date: 2026/3/30
|
||||
*/
|
||||
@Schema(description = "管理后台 - 新中大入出库单子 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsStorageOutExcelVO {
|
||||
@ExcelProperty("系统编号")
|
||||
private Long systemID = 1L;
|
||||
|
||||
@ExcelProperty("仓库")
|
||||
private String whName;
|
||||
|
||||
@ExcelProperty("业务日期")
|
||||
private LocalDate busiDate;
|
||||
|
||||
@ExcelProperty("部门")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty("业务类型")
|
||||
private String busiType;
|
||||
|
||||
@ExcelProperty("辅助项")
|
||||
private String auItem;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
@Schema(description = "管理后台 - 新中大入/出库主分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class WmsStoragePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "业务类型", example = "1")
|
||||
private String busiType;
|
||||
|
||||
@Schema(description = "业务日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate[] busiDate;
|
||||
|
||||
@Schema(description = "状态:1 未导出;2 已导出", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "单据类型:1为入库,2为出库", example = "1")
|
||||
private Integer stockType;
|
||||
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.wmsstoragedetail.vo.WmsStorageDetailRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 新中大入/出库主 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsStorageRespVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30772")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "入/出库单号")
|
||||
@ExcelProperty("单据编号")
|
||||
private String stockNo;
|
||||
|
||||
@Schema(description = "业务类型", example = "1")
|
||||
@ExcelProperty("业务类型")
|
||||
private String busiType;
|
||||
|
||||
@Schema(description = "仓库", example = "赵六")
|
||||
@ExcelProperty("仓库")
|
||||
private String whName;
|
||||
|
||||
@Schema(description = "业务日期")
|
||||
@ExcelProperty("业务日期")
|
||||
private LocalDate busiDate;
|
||||
|
||||
@Schema(description = "供应商名称", example = "张三")
|
||||
@ExcelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
@Schema(description = "价格类型", example = "1")
|
||||
@ExcelProperty("价格类型")
|
||||
private String priceType;
|
||||
|
||||
@Schema(description = "部门", example = "张三")
|
||||
@ExcelProperty("部门")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "状态:1 未导出;2 已导出", example = "2")
|
||||
@ExcelProperty("单据状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "单据类型:1为入库,2为出库", example = "1")
|
||||
@ExcelProperty("单据类型")
|
||||
private Integer stockType;
|
||||
|
||||
@Schema(description = "辅助项")
|
||||
@ExcelProperty("辅助项")
|
||||
private String auItem;
|
||||
|
||||
@Schema(description = "发票编码")
|
||||
@ExcelProperty("发票编码")
|
||||
private String incoiceCode;
|
||||
|
||||
@Schema(description = "生成人,对应员工表中的 Id")
|
||||
@ExcelProperty("生成人,对应员工表中的 Id")
|
||||
private String stockEmp;
|
||||
|
||||
@Schema(description = "生成时间")
|
||||
@ExcelProperty("生成时间")
|
||||
private LocalDateTime stockTime;
|
||||
|
||||
@Schema(description = "导出人,对应员工表中的 Id")
|
||||
@ExcelProperty("导出人,对应员工表中的 Id")
|
||||
private Long exportEmp;
|
||||
|
||||
private String exportEmpName;
|
||||
|
||||
@Schema(description = "导出时间")
|
||||
@ExcelProperty("导出时间")
|
||||
private LocalDateTime exprotTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<WmsStorageDetailRespVO> detailList;
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 新中大入/出库主新增/修改 Request VO")
|
||||
@Data
|
||||
public class WmsStorageSaveReqVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30772")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "入/出库单号")
|
||||
private String stockNo;
|
||||
|
||||
@Schema(description = "业务类型", example = "1")
|
||||
private String busiType;
|
||||
|
||||
@Schema(description = "仓库", example = "赵六")
|
||||
private String whName;
|
||||
|
||||
@Schema(description = "业务日期")
|
||||
private LocalDate busiDate;
|
||||
|
||||
@Schema(description = "供应商名称", example = "张三")
|
||||
private String supplierName;
|
||||
|
||||
@Schema(description = "价格类型", example = "1")
|
||||
private String priceType;
|
||||
|
||||
@Schema(description = "部门", example = "张三")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "状态:1 未导出;2 已导出", example = "2")
|
||||
private Boolean status;
|
||||
|
||||
@Schema(description = "单据类型:1为入库,2为出库", example = "1")
|
||||
private Boolean stockType;
|
||||
|
||||
@Schema(description = "辅助项")
|
||||
private String auItem;
|
||||
|
||||
@Schema(description = "发票编码")
|
||||
private String incoiceCode;
|
||||
|
||||
@Schema(description = "生成人,对应员工表中的 Id")
|
||||
private String stockEmp;
|
||||
|
||||
@Schema(description = "生成时间")
|
||||
private LocalDateTime stockTime;
|
||||
|
||||
@Schema(description = "导出人,对应员工表中的 Id")
|
||||
private String exportEmp;
|
||||
|
||||
@Schema(description = "导出时间")
|
||||
private LocalDateTime exprotTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstoragedetail.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 新中大入出库单子 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DetailInExcelVO {
|
||||
@ExcelProperty("系统编号")
|
||||
private Long systemID = 1L;
|
||||
|
||||
@ExcelProperty("物料编码")
|
||||
private String matCode;
|
||||
|
||||
@ExcelProperty("库位")
|
||||
private String rgName;
|
||||
|
||||
@ExcelProperty("数量")
|
||||
private BigDecimal stockNum;
|
||||
|
||||
@ExcelProperty("单价")
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstoragedetail.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 新中大入出库单子 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DetailOutExcelVO {
|
||||
|
||||
@ExcelProperty("系统编号")
|
||||
private Long systemID = 1L;
|
||||
|
||||
@ExcelProperty("物料编码")
|
||||
private String matCode;
|
||||
|
||||
@ExcelProperty("库位")
|
||||
private String rgName;
|
||||
|
||||
@ExcelProperty("数量")
|
||||
private BigDecimal stockNum;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstoragedetail.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 新中大入出库单子分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class WmsStorageDetailPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "新中大入出单主表", example = "13239")
|
||||
private Long xzdWmsId;
|
||||
|
||||
@Schema(description = "入/出库单号")
|
||||
private String stockNo;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
private String matCode;
|
||||
|
||||
@Schema(description = "库位", example = "李四")
|
||||
private String rgName;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private BigDecimal stockNum;
|
||||
|
||||
@Schema(description = "单价", example = "32559")
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstoragedetail.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 新中大入出库单子 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsStorageDetailRespVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18059")
|
||||
@ExcelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "新中大入出单主表", requiredMode = Schema.RequiredMode.REQUIRED, example = "13239")
|
||||
@ExcelProperty("新中大入出单主表")
|
||||
private Long xzdWmsId;
|
||||
|
||||
@Schema(description = "入/出库单号")
|
||||
@ExcelProperty("入/出库单号")
|
||||
private String stockNo;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
@ExcelProperty("物料编码")
|
||||
private String matCode;
|
||||
|
||||
@Schema(description = "库位", example = "李四")
|
||||
@ExcelProperty("库位")
|
||||
private String rgName;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "数量")
|
||||
@ExcelProperty("数量")
|
||||
private BigDecimal stockNum;
|
||||
|
||||
@Schema(description = "单价", example = "32559")
|
||||
@ExcelProperty("单价")
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.chanko.yunxi.mes.module.heli.controller.admin.wmsstoragedetail.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 新中大入出库单子新增/修改 Request VO")
|
||||
@Data
|
||||
public class WmsStorageDetailSaveReqVO {
|
||||
|
||||
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18059")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "新中大入出单主表", requiredMode = Schema.RequiredMode.REQUIRED, example = "13239")
|
||||
@NotNull(message = "新中大入出单主表不能为空")
|
||||
private Long xzdWmsId;
|
||||
|
||||
@Schema(description = "入/出库单号")
|
||||
private String stockNo;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
private String matCode;
|
||||
|
||||
@Schema(description = "库位", example = "李四")
|
||||
private String rgName;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private BigDecimal stockNum;
|
||||
|
||||
@Schema(description = "单价", example = "32559")
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
||||
@ -1,13 +1,15 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelog;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 入/出库日志 DO
|
||||
@ -95,4 +97,8 @@ public class StorageLogDO extends BaseDO {
|
||||
@TableField(exist = false)
|
||||
private List<MaterialDO> materialDOList;
|
||||
|
||||
private Long xzdStockId;
|
||||
private String xzdStockNo;
|
||||
private String incoiceCode;
|
||||
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.dataobject.wmsstorage;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.wmsstoragedetail.WmsStorageDetailDO;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新中大入/出库主 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("xzd_wms_storage")
|
||||
@KeySequence("xzd_wms_storage_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WmsStorageDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 入/出库单号
|
||||
*/
|
||||
private String stockNo;
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private String busiType;
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
private String whName;
|
||||
/**
|
||||
* 业务日期
|
||||
*/
|
||||
private LocalDate busiDate;
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
private String supplierName;
|
||||
/**
|
||||
* 价格类型
|
||||
*/
|
||||
private String priceType;
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
private String deptName;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 状态:1 未导出;2 已导出
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 单据类型:1为入库,2为出库
|
||||
*/
|
||||
private Integer stockType;
|
||||
/**
|
||||
* 辅助项
|
||||
*/
|
||||
private String auItem;
|
||||
/**
|
||||
* 发票编码
|
||||
*/
|
||||
private String incoiceCode;
|
||||
/**
|
||||
* 生成人,对应员工表中的 Id
|
||||
*/
|
||||
private String stockEmp;
|
||||
/**
|
||||
* 生成时间
|
||||
*/
|
||||
private LocalDateTime stockTime;
|
||||
/**
|
||||
* 导出人,对应员工表中的 Id
|
||||
*/
|
||||
private Long exportEmp;
|
||||
/**
|
||||
* 导出时间
|
||||
*/
|
||||
private LocalDateTime exprotTime;
|
||||
|
||||
|
||||
// 明细,冗余字段
|
||||
@TableField(exist = false)
|
||||
private String exportEmpName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<WmsStorageDetailDO> detailList;
|
||||
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.dataobject.wmsstoragedetail;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 新中大入出库单子 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("xzd_wms_storage_detail")
|
||||
@KeySequence("xzd_wms_storage_detail_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WmsStorageDetailDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 新中大入出单主表
|
||||
*/
|
||||
private Long xzdWmsId;
|
||||
/**
|
||||
* 入/出库单号
|
||||
*/
|
||||
private String stockNo;
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String matCode;
|
||||
/**
|
||||
* 库位
|
||||
*/
|
||||
private String rgName;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal stockNum;
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.mysql.wmsstorage;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo.WmsStoragePageReqVO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.wmsstorage.WmsStorageDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 新中大入/出库主 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface WmsStorageMapper extends BaseMapperX<WmsStorageDO> {
|
||||
|
||||
default PageResult<WmsStorageDO> selectPage(WmsStoragePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<WmsStorageDO>()
|
||||
.eqIfPresent(WmsStorageDO::getBusiType, reqVO.getBusiType())
|
||||
.betweenIfPresent(WmsStorageDO::getBusiDate, reqVO.getBusiDate())
|
||||
.eqIfPresent(WmsStorageDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(WmsStorageDO::getStockType, reqVO.getStockType())
|
||||
.orderByDesc(WmsStorageDO::getId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.chanko.yunxi.mes.module.heli.dal.mysql.wmsstoragedetail;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.wmsstoragedetail.vo.WmsStorageDetailPageReqVO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.wmsstoragedetail.WmsStorageDetailDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 新中大入出库单子 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface WmsStorageDetailMapper extends BaseMapperX<WmsStorageDetailDO> {
|
||||
|
||||
default PageResult<WmsStorageDetailDO> selectPage(WmsStorageDetailPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<WmsStorageDetailDO>()
|
||||
.eqIfPresent(WmsStorageDetailDO::getXzdWmsId, reqVO.getXzdWmsId())
|
||||
.eqIfPresent(WmsStorageDetailDO::getStockNo, reqVO.getStockNo())
|
||||
.eqIfPresent(WmsStorageDetailDO::getMatCode, reqVO.getMatCode())
|
||||
.likeIfPresent(WmsStorageDetailDO::getRgName, reqVO.getRgName())
|
||||
.eqIfPresent(WmsStorageDetailDO::getDescription, reqVO.getDescription())
|
||||
.betweenIfPresent(WmsStorageDetailDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(WmsStorageDetailDO::getStockNum, reqVO.getStockNum())
|
||||
.eqIfPresent(WmsStorageDetailDO::getPrice, reqVO.getPrice())
|
||||
.orderByDesc(WmsStorageDetailDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -171,9 +171,6 @@ public class DataAcquisitionServiceImpl implements DataAcquisitionService {
|
||||
private static String getString(String runningDuration) {
|
||||
// 2. 解析时间 28863H41M32S
|
||||
Matcher matcher = TIME_PATTERN.matcher(runningDuration);
|
||||
if (!matcher.matches()) {
|
||||
return runningDuration;
|
||||
}
|
||||
int hour = Integer.parseInt(matcher.group(1));
|
||||
int min = Integer.parseInt(matcher.group(2));
|
||||
int sec = Integer.parseInt(matcher.group(3));
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.wmsstorage;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo.WmsStoragePageReqVO;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo.WmsStorageSaveReqVO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.wmsstorage.WmsStorageDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新中大入/出库主 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface WmsStorageService {
|
||||
|
||||
/**
|
||||
* 创建新中大入/出库主
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createWmsStorage(@Valid WmsStorageSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新新中大入/出库主
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateWmsStorage(@Valid WmsStorageSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除新中大入/出库主
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteWmsStorage(Long id);
|
||||
|
||||
/**
|
||||
* 获得新中大入/出库主
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 新中大入/出库主
|
||||
*/
|
||||
WmsStorageDO getWmsStorage(Long id);
|
||||
|
||||
/**
|
||||
* 获得新中大入/出库主分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 新中大入/出库主分页
|
||||
*/
|
||||
PageResult<WmsStorageDO> getWmsStoragePage(WmsStoragePageReqVO pageReqVO);
|
||||
|
||||
List<WmsStorageDO> processWsmStorage(String ids);
|
||||
}
|
||||
@ -0,0 +1,147 @@
|
||||
package com.chanko.yunxi.mes.module.heli.service.wmsstorage;
|
||||
|
||||
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
|
||||
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
|
||||
import com.chanko.yunxi.mes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo.WmsStoragePageReqVO;
|
||||
import com.chanko.yunxi.mes.module.heli.controller.admin.wmsstorage.vo.WmsStorageSaveReqVO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagelog.StorageLogDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.wmsstorage.WmsStorageDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.dataobject.wmsstoragedetail.WmsStorageDetailDO;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.mysql.storagelog.StorageLogMapper;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.mysql.wmsstorage.WmsStorageMapper;
|
||||
import com.chanko.yunxi.mes.module.heli.dal.mysql.wmsstoragedetail.WmsStorageDetailMapper;
|
||||
import com.chanko.yunxi.mes.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.chanko.yunxi.mes.module.system.service.user.AdminUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 新中大入/出库主 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
public class WmsStorageServiceImpl implements WmsStorageService {
|
||||
|
||||
private final WmsStorageMapper wmsStorageMapper;
|
||||
|
||||
private final WmsStorageDetailMapper wmsStorageDetailMapper;
|
||||
|
||||
private final AdminUserService userService;
|
||||
|
||||
private final StorageLogMapper storageLogMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Long createWmsStorage(WmsStorageSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
WmsStorageDO wmsStorage = BeanUtils.toBean(createReqVO, WmsStorageDO.class);
|
||||
wmsStorageMapper.insert(wmsStorage);
|
||||
// 返回
|
||||
return wmsStorage.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWmsStorage(WmsStorageSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateWmsStorageExists(updateReqVO.getId());
|
||||
// 更新
|
||||
WmsStorageDO updateObj = BeanUtils.toBean(updateReqVO, WmsStorageDO.class);
|
||||
wmsStorageMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteWmsStorage(Long id) {
|
||||
// 校验存在
|
||||
validateWmsStorageExists(id);
|
||||
// 校验状态
|
||||
WmsStorageDO wmsStorage = wmsStorageMapper.selectById(id);
|
||||
if (wmsStorage.getStatus() == 1) {
|
||||
throw exception(WMS_STORAGE_NOT_EXPORT);
|
||||
}
|
||||
// 删除
|
||||
wmsStorageMapper.deleteById(id);
|
||||
wmsStorageDetailMapper.delete(WmsStorageDetailDO::getXzdWmsId, id);
|
||||
|
||||
// storageLogService
|
||||
StorageLogDO storageLogDO = storageLogMapper.selectOne(StorageLogDO::getXzdStockId, wmsStorage.getId());
|
||||
if (storageLogDO != null){
|
||||
storageLogDO.setIsExport(0);
|
||||
storageLogDO.setUpdater("");
|
||||
storageLogDO.setUpdateTime(LocalDateTime.now());
|
||||
storageLogDO.setXzdStockId(null);
|
||||
storageLogDO.setXzdStockNo(null);
|
||||
storageLogDO.setIncoiceCode(null);
|
||||
storageLogMapper.updateById(storageLogDO);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateWmsStorageExists(Long id) {
|
||||
if (wmsStorageMapper.selectById(id) == null) {
|
||||
throw exception(WMS_STORAGE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WmsStorageDO getWmsStorage(Long id) {
|
||||
WmsStorageDO wmsStorage = wmsStorageMapper.selectById(id);
|
||||
if (wmsStorage != null) {
|
||||
List<WmsStorageDetailDO> detailList = wmsStorageDetailMapper.selectList(
|
||||
WmsStorageDetailDO::getXzdWmsId, wmsStorage.getId());
|
||||
wmsStorage.setDetailList(detailList);
|
||||
// 查询用户信息
|
||||
AdminUserDO user = userService.getUser(wmsStorage.getExportEmp());
|
||||
if (user != null){
|
||||
wmsStorage.setExportEmpName(user.getNickname());
|
||||
}
|
||||
}
|
||||
return wmsStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<WmsStorageDO> getWmsStoragePage(WmsStoragePageReqVO pageReqVO) {
|
||||
return wmsStorageMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public List<WmsStorageDO> processWsmStorage(String ids) {
|
||||
// 分割并转换为 Long 类型
|
||||
List<Long> idList = Arrays.stream(ids.split(",")).map(Long::valueOf).collect(Collectors.toList());
|
||||
if (!idList.isEmpty()) {
|
||||
// 根据ID查询出所有数据,批量更新导出人,导出状态
|
||||
List<WmsStorageDO> wmsStorageDOS = wmsStorageMapper.selectList(WmsStorageDO::getId, idList);
|
||||
// 如果状态为已导出,则remove
|
||||
for (WmsStorageDO wmsStorageDO : wmsStorageDOS) {
|
||||
if (wmsStorageDO.getStatus() == 2) {
|
||||
throw exception(WMS_STORAGE_IS_EXPORT);
|
||||
}
|
||||
// 获取当前用户信息
|
||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||
wmsStorageDO.setExportEmp(loginUserId);
|
||||
wmsStorageDO.setExprotTime(LocalDateTime.now());
|
||||
wmsStorageDO.setStatus(2);
|
||||
wmsStorageMapper.updateById(wmsStorageDO);
|
||||
List<WmsStorageDetailDO> wmsStorageDetailDOS = wmsStorageDetailMapper.selectList(WmsStorageDetailDO::getXzdWmsId, wmsStorageDO.getId());
|
||||
wmsStorageDO.setDetailList(wmsStorageDetailDOS);
|
||||
}
|
||||
return wmsStorageDOS;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
101
mes-ui/mes-ui-admin-vue3/src/api/heli/wmsstorage/index.ts
Normal file
101
mes-ui/mes-ui-admin-vue3/src/api/heli/wmsstorage/index.ts
Normal file
@ -0,0 +1,101 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export interface WmsStorageDetailVO {
|
||||
id: number
|
||||
xzdWmsId: number
|
||||
stockNo: string
|
||||
matCode: string
|
||||
rgName: string
|
||||
description: string
|
||||
createTime: number
|
||||
stockNum: number
|
||||
price: number
|
||||
}
|
||||
|
||||
export interface WmsStorageVO {
|
||||
id: number
|
||||
stockNo: string
|
||||
busiType: string
|
||||
whName: string
|
||||
busiDate: localdate
|
||||
supplierName: string
|
||||
priceType: string
|
||||
deptName: string
|
||||
description: string
|
||||
status: boolean
|
||||
stockType: boolean
|
||||
auItem: string
|
||||
incoiceCode: string
|
||||
stockEmp: string
|
||||
stockTime: Date
|
||||
exportEmp: string
|
||||
exprotTime: Date
|
||||
exportEmpName: string
|
||||
detailList?: WmsStorageDetailVO[]
|
||||
}
|
||||
|
||||
// 查询新中大入/出库主分页
|
||||
export const getWmsStoragePage = async (params) => {
|
||||
return await request.get({ url: `/heli/wms-storage/page`, params })
|
||||
}
|
||||
|
||||
// 查询新中大入/出库主详情
|
||||
export const getWmsStorage = async (id: number) => {
|
||||
return await request.get({ url: `/heli/wms-storage/get?id=` + id })
|
||||
}
|
||||
|
||||
// 新增新中大入/出库主
|
||||
export const createWmsStorage = async (data: WmsStorageVO) => {
|
||||
return await request.post({ url: `/heli/wms-storage/create`, data })
|
||||
}
|
||||
|
||||
// 修改新中大入/出库主
|
||||
export const updateWmsStorage = async (data: WmsStorageVO) => {
|
||||
return await request.put({ url: `/heli/wms-storage/update`, data })
|
||||
}
|
||||
|
||||
// 删除新中大入/出库主
|
||||
export const deleteWmsStorage = async (id: number) => {
|
||||
return await request.delete({ url: `/heli/wms-storage/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 导出新中大入/出库主 Excel
|
||||
export const exportWmsStorage = async (stockType: Number, ids: String) => {
|
||||
return await request.download({
|
||||
url: `/heli/wms-storage/export-excel`,
|
||||
params: { stockType, ids }
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 入库库存业务类型
|
||||
*/
|
||||
export const HeliStockTypeDict = [
|
||||
{ label: '入库', value: 1 },
|
||||
{ label: '出库', value: 2 }
|
||||
]
|
||||
|
||||
/**
|
||||
* 单据状态
|
||||
*/
|
||||
export const HeliStorageStatusDict = [
|
||||
{ label: '未导出', value: 1 },
|
||||
{ label: '已导出', value: 2 }
|
||||
]
|
||||
|
||||
/**
|
||||
* 根据值获取库存业务类型标签
|
||||
*/
|
||||
export const getHeliStockTypeLabel = (value: number): string => {
|
||||
const item = HeliStockTypeDict.find((item) => item.value === value)
|
||||
return item?.label || ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据值获取单据状态标签
|
||||
*/
|
||||
export const getHeliStorageStatusLabel = (value: number): string => {
|
||||
const item = HeliStorageStatusDict.find((item) => item.value === value)
|
||||
return item?.label || ''
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<Dialog title="基础信息" v-model="dialogVisible" width="1200px" @close="handleClose">
|
||||
<div v-loading="formLoading" style="min-height: 200px;">
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="单据类型">
|
||||
{{ getHeliStockTypeLabel(formData.stockType) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单据状态">
|
||||
{{ getHeliStorageStatusLabel(formData.status) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单据编号">
|
||||
{{ formData.stockNo }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="业务日期">
|
||||
{{ formatDate(formData.busiDate, 'YYYY-MM-DD') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="仓库" :span="2">
|
||||
{{ formData.whName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="供应商名称" :span="2">
|
||||
{{ formData.supplierName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="价格类型">
|
||||
{{ formData.priceType }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="辅助项">
|
||||
{{ formData.auItem }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="部门" :span="2">
|
||||
{{ formData.deptName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="发票编码">
|
||||
{{ formData.incoiceCode }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="生成人">
|
||||
{{ formData.stockEmp }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="生成时间">
|
||||
{{ formatDate(formData.stockTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="导出人" :span="2">
|
||||
{{ formData.exportEmpName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="导出时间">
|
||||
{{ formatDate(formData.exprotTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注" :span="2">
|
||||
{{ formData.description }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
|
||||
<!-- 明细列表 -->
|
||||
<div style="margin-top: 20px;">
|
||||
<div style="font-weight: bold; margin-bottom: 10px; font-size: 14px;">入出库明细</div>
|
||||
<el-table
|
||||
:data="formData.detailList || []"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
border
|
||||
max-height="300"
|
||||
>
|
||||
<el-table-column type="index" width="80" label="序号" align="center" />
|
||||
<el-table-column label="物料编码" align="center" prop="matCode" min-width="120" />
|
||||
<el-table-column label="库位" align="center" prop="rgName" min-width="120" />
|
||||
<el-table-column label="数量" align="center" prop="stockNum" min-width="100" />
|
||||
<el-table-column label="单价" align="center" prop="price" min-width="100" />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">关 闭</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as WmsStorageApi from '@/api/heli/wmsstorage'
|
||||
import {
|
||||
getHeliStockTypeLabel,
|
||||
getHeliStorageStatusLabel
|
||||
} from '@/api/heli/wmsstorage'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
stockNo: undefined,
|
||||
busiType: undefined,
|
||||
whName: undefined,
|
||||
busiDate: undefined,
|
||||
supplierName: undefined,
|
||||
priceType: undefined,
|
||||
deptName: undefined,
|
||||
description: undefined,
|
||||
status: undefined,
|
||||
stockType: undefined,
|
||||
auItem: undefined,
|
||||
incoiceCode: undefined,
|
||||
stockEmp: undefined,
|
||||
stockTime: undefined,
|
||||
exportEmp: undefined,
|
||||
exportEmpName: undefined,
|
||||
exprotTime: undefined,
|
||||
detailList: []
|
||||
})
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await WmsStorageApi.getWmsStorage(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
|
||||
/** 关闭弹窗 */
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false
|
||||
emit('success')
|
||||
}
|
||||
|
||||
</script>
|
||||
270
mes-ui/mes-ui-admin-vue3/src/views/heli/wmsstorage/index.vue
Normal file
270
mes-ui/mes-ui-admin-vue3/src/views/heli/wmsstorage/index.vue
Normal file
@ -0,0 +1,270 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="单据日期" prop="busiDate">
|
||||
<el-date-picker
|
||||
v-model="queryParams.busiDate"
|
||||
value-format="YYYY-MM-DD"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
class="!w-260px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable class="!w-240px">
|
||||
<el-option
|
||||
v-for="item in HeliStorageStatusDict"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据类型" prop="stockType">
|
||||
<el-select
|
||||
v-model="queryParams.stockType"
|
||||
placeholder="请选择单据类型"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in HeliStockTypeDict"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="handleExportSelected"
|
||||
:disabled="selectedRows.length === 0"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 单据导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
height="600px"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column
|
||||
fixed
|
||||
type="selection"
|
||||
width="30"
|
||||
align="center"
|
||||
:selectable="isRowSelectable"
|
||||
/>
|
||||
<el-table-column fixed type="index" width="60" label="序号" align="center" />
|
||||
<el-table-column label="单据类型" width="100" align="center" prop="stockType">
|
||||
<template #default="scope">
|
||||
{{ getHeliStockTypeLabel(scope.row.stockType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单据状态" width="100" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status === 1" type="success">
|
||||
<Icon icon="ep:check" class="mr-5px" />未导出
|
||||
</el-tag>
|
||||
<el-tag v-if="scope.row.status === 2" type="warning">
|
||||
<Icon icon="ep:close" class="mr-5px" />已导出
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单据编号" align="center" prop="stockNo" />
|
||||
<el-table-column label="仓库" align="center" prop="whName" />
|
||||
<el-table-column label="业务日期" width="120" align="center" prop="busiDate">
|
||||
<template #default="scope">
|
||||
{{ formatDate(scope.row.busiDate, 'YYYY-MM-DD') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="供应商名称" align="center" prop="supplierName" />
|
||||
<el-table-column label="价格类型" align="center" prop="priceType" />
|
||||
<el-table-column label="部门" align="center" prop="deptName" />
|
||||
<!-- <el-table-column label="业务类型" align="center" prop="busiType" />-->
|
||||
<!-- <el-table-column label="备注" align="center" prop="description" />-->
|
||||
<el-table-column label="辅助项" align="center" prop="auItem" />
|
||||
<el-table-column label="操作" align="center" width="150" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="scope.row.status === 2"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button link type="primary" @click="openForm('detail', scope.row.id)">
|
||||
详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<WmsStorageForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import download from '@/utils/download'
|
||||
import * as WmsStorageApi from '@/api/heli/wmsstorage'
|
||||
import WmsStorageForm from './WmsStorageForm.vue'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
|
||||
import {
|
||||
HeliStockTypeDict,
|
||||
HeliStorageStatusDict,
|
||||
getHeliStockTypeLabel
|
||||
} from '@/api/heli/wmsstorage'
|
||||
|
||||
defineOptions({ name: 'WmsStorage' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(false) // 列表的加载中
|
||||
const list = ref([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const selectedRows = ref([]) // 选中的行
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
busiDate: [],
|
||||
status: 1, // 默认未导出
|
||||
stockType: undefined
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await WmsStorageApi.getWmsStoragePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
// 重置后恢复默认日期和状态
|
||||
queryParams.status = 1
|
||||
queryParams.busiDate = getDefaultDateRange()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 获取默认日期范围 */
|
||||
const getDefaultDateRange = () => {
|
||||
const now = new Date()
|
||||
const year = now.getFullYear()
|
||||
const month = String(now.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(now.getDate()).padStart(2, '0')
|
||||
|
||||
const startDate = `${year}-${month}-01`
|
||||
const endDate = `${year}-${month}-${day}`
|
||||
|
||||
return [startDate, endDate]
|
||||
}
|
||||
|
||||
/** 查看详情操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 表格选择变化 */
|
||||
const handleSelectionChange = (selection: any[]) => {
|
||||
selectedRows.value = selection
|
||||
}
|
||||
|
||||
/** 判断行是否可选择 */
|
||||
const isRowSelectable = (row: any): boolean => {
|
||||
// 已导出的单据不能选择
|
||||
return row.status !== 2
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await WmsStorageApi.deleteWmsStorage(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 单据导出 - 后端导出 */
|
||||
const handleExportSelected = async () => {
|
||||
if (selectedRows.value.length === 0) {
|
||||
message.warning('请选择要导出的数据')
|
||||
return
|
||||
}
|
||||
// stockType 必须是同一类型的
|
||||
if (selectedRows.value.some((row) => row.stockType !== selectedRows.value[0].stockType)) {
|
||||
message.warning('请选择同一单据类型的数据')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
// 提取选中的ID列表,用,分隔拼接
|
||||
|
||||
const ids = selectedRows.value.map((row) => row.id).join(',')
|
||||
// 调用后端导出接口
|
||||
const data = await WmsStorageApi.exportWmsStorage(selectedRows.value[0].stockType, ids)
|
||||
download.excel(data, `新中大单据_${new Date().getTime()}.xls`)
|
||||
message.success(`成功导出 ${selectedRows.value.length} 条数据`)
|
||||
// 刷新列表,显示最新状态
|
||||
await getList()
|
||||
} catch (error) {
|
||||
console.error('导出失败:', error)
|
||||
message.error('导出失败,请稍后重试')
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
// 设置默认日期范围:当月1号到当天
|
||||
queryParams.busiDate = getDefaultDateRange()
|
||||
// 不自动加载数据,需要点击查询按钮
|
||||
})
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user