Browse Source

BUG修改

master
parent
commit
cbd0bcda5b
  1. 3
      win-module-eam/win-module-eam-api/src/main/java/com/win/module/eam/enums/ErrorCodeConstants.java
  2. 109
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/InventoryWarningController.java
  3. 95
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningBaseVO.java
  4. 14
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningCreateReqVO.java
  5. 96
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningExcelVO.java
  6. 90
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningExportReqVO.java
  7. 91
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningPageReqVO.java
  8. 19
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningRespVO.java
  9. 18
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningUpdateReqVO.java
  10. 36
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/inventorywarning/InventoryWarningConvert.java
  11. 123
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/inventorywarning/InventoryWarningDO.java
  12. 75
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/inventorywarning/InventoryWarningMapper.java
  13. 41
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/enums/transactionType/ProcureStatusEnum.java
  14. 72
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/inventorywarning/InventoryWarningService.java
  15. 84
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/inventorywarning/InventoryWarningServiceImpl.java
  16. 68
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemoutlocation/ItemOutLocationServiceImpl.java
  17. 12
      win-module-eam/win-module-eam-biz/src/main/resources/mapper/inventorywarning/InventoryWarningMapper.xml

3
win-module-eam/win-module-eam-api/src/main/java/com/win/module/eam/enums/ErrorCodeConstants.java

@ -167,5 +167,8 @@ public interface ErrorCodeConstants {
ErrorCode LOCATION_EXISTS = new ErrorCode(1_000_020_021, "该库位已与备件绑定不可重复绑定");
ErrorCode ITEM_EXISTS = new ErrorCode(1_000_020_021, "该备件已绑定不可重复绑定");
ErrorCode INVENTORY_WARNING_NOT_EXISTS = new ErrorCode(1_000_020_022, "库存预警不存在");
}

109
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/InventoryWarningController.java

@ -0,0 +1,109 @@
package com.win.module.eam.controller.inventorywarning;
import com.win.framework.common.pojo.CommonResult;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.eam.controller.inventorywarning.vo.*;
import com.win.module.eam.convert.inventorywarning.InventoryWarningConvert;
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO;
import com.win.module.eam.service.inventorywarning.InventoryWarningService;
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.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.util.Arrays;
import java.util.Collection;
import java.util.List;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 库存预警记录")
@RestController
@RequestMapping("/record/inventory-warning")
@Validated
public class InventoryWarningController {
@Resource
private InventoryWarningService inventoryWarningService;
@PostMapping("/create")
@Operation(summary = "创建库存预警记录")
@PreAuthorize("@ss.hasPermission('record:inventory-warning:create')")
public CommonResult<Integer> createInventoryWarning(@Valid @RequestBody InventoryWarningCreateReqVO createReqVO) {
return success(inventoryWarningService.createInventoryWarning(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新库存预警记录")
@PreAuthorize("@ss.hasPermission('record:inventory-warning:update')")
public CommonResult<Boolean> updateInventoryWarning(@Valid @RequestBody InventoryWarningUpdateReqVO updateReqVO) {
int result = inventoryWarningService.updateInventoryWarning(updateReqVO);
return success(result > 0);
}
@DeleteMapping("/delete")
@Operation(summary = "删除库存预警记录")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('record:inventory-warning:delete')")
public CommonResult<Boolean> deleteInventoryWarning(@RequestParam("id") Integer id) {
int result = inventoryWarningService.deleteInventoryWarning(id);
return success(result > 0);
}
@GetMapping("/get")
@Operation(summary = "获得库存预警记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('record:inventory-warning:query')")
public CommonResult<InventoryWarningRespVO> getInventoryWarning(@RequestParam("id") Integer id) {
InventoryWarningDO inventoryWarning = inventoryWarningService.getInventoryWarning(id);
return success(InventoryWarningConvert.INSTANCE.convert(inventoryWarning));
}
@GetMapping("/list")
@Operation(summary = "获得库存预警记录列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('record:inventory-warning:query')")
public CommonResult<List<InventoryWarningRespVO>> getInventoryWarningList(@RequestParam("ids") Collection<Integer> ids) {
List<InventoryWarningDO> list = inventoryWarningService.getInventoryWarningList(ids);
return success(InventoryWarningConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得库存预警记录分页")
@PreAuthorize("@ss.hasPermission('record:inventory-warning:query')")
public CommonResult<PageResult<InventoryWarningRespVO>> getInventoryWarningPage(@Valid InventoryWarningPageReqVO pageVO) {
PageResult<InventoryWarningDO> pageResult = inventoryWarningService.getInventoryWarningPage(pageVO);
return success(InventoryWarningConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出库存预警记录 Excel")
@PreAuthorize("@ss.hasPermission('record:inventory-warning:export')")
@OperateLog(type = EXPORT)
public void exportInventoryWarningExcel(@Valid InventoryWarningExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<InventoryWarningDO> list = inventoryWarningService.getInventoryWarningList(exportReqVO);
// 导出 Excel
List<InventoryWarningExcelVO> datas = InventoryWarningConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "库存预警记录.xls", "数据", InventoryWarningExcelVO.class, datas);
}
@GetMapping("/get-import-template")
@Operation(summary = "获得导入库存预警记录模板")
public void importTemplate(HttpServletResponse response) throws IOException {
List<InventoryWarningExcelVO> list = Arrays.asList();
// 输出
ExcelUtils.write(response, "库存预警记录基本信息导入模板.xls", "库存预警记录基本信息列表", InventoryWarningExcelVO.class, list);
}
}

95
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningBaseVO.java

@ -0,0 +1,95 @@
package com.win.module.eam.controller.inventorywarning.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 库存预警记录 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class InventoryWarningBaseVO {
@Schema(description = "零件编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "零件编码不能为空")
private String number;
@Schema(description = "零件名称", example = "赵六")
private String name;
@Schema(description = "库位名称")
private String locationNumber;
@Schema(description = "规格型号")
private String specifications;
@Schema(description = "单位")
private String uom;
@Schema(description = "供应商名称", example = "王五")
private String supplierName;
@Schema(description = "生产厂家")
private String brand;
@Schema(description = "最高库存")
private BigDecimal maxInventory;
@Schema(description = "最低库存")
private BigDecimal minInventory;
@Schema(description = "最低库存")
private BigDecimal nowInventory;
@Schema(description = "采购周期(周)")
private Integer procurementCycle;
@Schema(description = "ABC分类")
private String classification;
@Schema(description = "使用地点")
private String usePlace;
@Schema(description = "项目")
private String project;
@Schema(description = "价格", example = "29930")
private BigDecimal price;
@Schema(description = "采购状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "采购状态不能为空")
private String procureStatus;
@Schema(description = "备注")
private String describes;
@Schema(description = "删除时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime deletionTime;
@Schema(description = "删除者ID", example = "21341")
private String deleterId;
@Schema(description = "扩展属性")
private String extraProperties;
@Schema(description = "并发乐观锁", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "并发乐观锁不能为空")
private Integer concurrencyStamp;
@Schema(description = "地点id", example = "12691")
private String siteId;
}

14
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningCreateReqVO.java

@ -0,0 +1,14 @@
package com.win.module.eam.controller.inventorywarning.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 库存预警记录创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class InventoryWarningCreateReqVO extends InventoryWarningBaseVO {
}

96
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningExcelVO.java

@ -0,0 +1,96 @@
package com.win.module.eam.controller.inventorywarning.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* 库存预警记录 Excel VO
*
* @author 超级管理员
*/
@Data
public class InventoryWarningExcelVO {
@ExcelProperty("id")
private Integer id;
@ExcelProperty("零件编码")
private String number;
@ExcelProperty("零件名称")
private String name;
@ExcelProperty("库位名称")
private String locationNumber;
@ExcelProperty("规格型号")
private String specifications;
@ExcelProperty("单位")
private String uom;
@ExcelProperty("供应商名称")
private String supplierName;
@ExcelProperty("生产厂家")
private String brand;
@ExcelProperty("最高库存")
private BigDecimal maxInventory;
@ExcelProperty("最低库存")
private BigDecimal minInventory;
@ExcelProperty("最低库存")
private BigDecimal nowInventory;
@ExcelProperty("采购周期(周)")
private Integer procurementCycle;
@ExcelProperty("ABC分类")
private String classification;
@ExcelProperty("使用地点")
private String usePlace;
@ExcelProperty("项目")
private String project;
@ExcelProperty("价格")
private BigDecimal price;
@ExcelProperty("采购状态")
private String procureStatus;
@ExcelProperty("备注")
private String describes;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty("删除时间")
private LocalDateTime deletionTime;
@ExcelProperty("删除者ID")
private String deleterId;
@ExcelProperty("扩展属性")
private String extraProperties;
@ExcelProperty("并发乐观锁")
private Integer concurrencyStamp;
@ExcelProperty("地点id")
private String siteId;
}

90
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningExportReqVO.java

@ -0,0 +1,90 @@
package com.win.module.eam.controller.inventorywarning.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.win.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 库存预警记录 Excel 导出 Request VO,参数和 InventoryWarningPageReqVO 是一致的")
@Data
public class InventoryWarningExportReqVO {
@Schema(description = "零件编码")
private String number;
@Schema(description = "零件名称", example = "赵六")
private String name;
@Schema(description = "库位名称")
private String locationNumber;
@Schema(description = "规格型号")
private String specifications;
@Schema(description = "单位")
private String uom;
@Schema(description = "供应商名称", example = "王五")
private String supplierName;
@Schema(description = "生产厂家")
private String brand;
@Schema(description = "最高库存")
private BigDecimal maxInventory;
@Schema(description = "最低库存")
private BigDecimal minInventory;
@Schema(description = "最低库存")
private BigDecimal nowInventory;
@Schema(description = "采购周期(周)")
private Integer procurementCycle;
@Schema(description = "ABC分类")
private String classification;
@Schema(description = "使用地点")
private String usePlace;
@Schema(description = "项目")
private String project;
@Schema(description = "价格", example = "29930")
private BigDecimal price;
@Schema(description = "采购状态", example = "1")
private String procureStatus;
@Schema(description = "备注")
private String describes;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "删除时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] deletionTime;
@Schema(description = "删除者ID", example = "21341")
private String deleterId;
@Schema(description = "扩展属性")
private String extraProperties;
@Schema(description = "并发乐观锁")
private Integer concurrencyStamp;
@Schema(description = "地点id", example = "12691")
private String siteId;
}

91
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningPageReqVO.java

@ -0,0 +1,91 @@
package com.win.module.eam.controller.inventorywarning.vo;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.win.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.win.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 InventoryWarningPageReqVO extends PageParam {
@Schema(description = "零件编码")
private String number;
@Schema(description = "零件名称", example = "赵六")
private String name;
@Schema(description = "库位名称")
private String locationNumber;
@Schema(description = "规格型号")
private String specifications;
@Schema(description = "单位")
private String uom;
@Schema(description = "供应商名称", example = "王五")
private String supplierName;
@Schema(description = "生产厂家")
private String brand;
@Schema(description = "最高库存")
private BigDecimal maxInventory;
@Schema(description = "最低库存")
private BigDecimal minInventory;
@Schema(description = "最低库存")
private BigDecimal nowInventory;
@Schema(description = "采购周期(周)")
private Integer procurementCycle;
@Schema(description = "ABC分类")
private String classification;
@Schema(description = "使用地点")
private String usePlace;
@Schema(description = "项目")
private String project;
@Schema(description = "价格", example = "29930")
private BigDecimal price;
@Schema(description = "采购状态", example = "1")
private String procureStatus;
@Schema(description = "备注")
private String describes;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "删除时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] deletionTime;
@Schema(description = "删除者ID", example = "21341")
private String deleterId;
@Schema(description = "扩展属性")
private String extraProperties;
@Schema(description = "并发乐观锁")
private Integer concurrencyStamp;
@Schema(description = "地点id", example = "12691")
private String siteId;
}

19
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningRespVO.java

@ -0,0 +1,19 @@
package com.win.module.eam.controller.inventorywarning.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 库存预警记录 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class InventoryWarningRespVO extends InventoryWarningBaseVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11773")
private Integer id;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

18
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/inventorywarning/vo/InventoryWarningUpdateReqVO.java

@ -0,0 +1,18 @@
package com.win.module.eam.controller.inventorywarning.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 库存预警记录更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class InventoryWarningUpdateReqVO extends InventoryWarningBaseVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11773")
@NotNull(message = "id不能为空")
private Integer id;
}

36
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/inventorywarning/InventoryWarningConvert.java

@ -0,0 +1,36 @@
package com.win.module.eam.convert.inventorywarning;
import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningCreateReqVO;
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningExcelVO;
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningRespVO;
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningUpdateReqVO;
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 库存预警记录 Convert
*
* @author 超级管理员
*/
@Mapper
public interface InventoryWarningConvert {
InventoryWarningConvert INSTANCE = Mappers.getMapper(InventoryWarningConvert.class);
InventoryWarningDO convert(InventoryWarningCreateReqVO bean);
InventoryWarningDO convert(InventoryWarningUpdateReqVO bean);
InventoryWarningRespVO convert(InventoryWarningDO bean);
List<InventoryWarningRespVO> convertList(List<InventoryWarningDO> list);
PageResult<InventoryWarningRespVO> convertPage(PageResult<InventoryWarningDO> page);
List<InventoryWarningExcelVO> convertList02(List<InventoryWarningDO> list);
}

123
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/inventorywarning/InventoryWarningDO.java

@ -0,0 +1,123 @@
package com.win.module.eam.dal.dataobject.inventorywarning;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.win.framework.mybatis.core.dataobject.BaseDO;
/**
* 库存预警记录 DO
*
* @author 超级管理员
*/
@TableName("record_inventory_warning")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InventoryWarningDO extends BaseDO {
/**
* id
*/
@TableId
private Integer id;
/**
* 零件编码
*/
private String number;
/**
* 零件名称
*/
private String name;
/**
* 库位代码
*/
private String locationNumber;
/**
* 规格型号
*/
private String specifications;
/**
* 单位
*/
private String uom;
/**
* 供应商名称
*/
private String supplierName;
/**
* 生产厂家
*/
private String brand;
/**
* 最高库存
*/
private BigDecimal maxInventory;
/**
* 最低库存
*/
private BigDecimal minInventory;
/**
* 最低库存
*/
private BigDecimal nowInventory;
/**
* 采购周期
*/
private Integer procurementCycle;
/**
* ABC分类
*/
private String classification;
/**
* 使用地点
*/
private String usePlace;
/**
* 项目
*/
private String project;
/**
* 价格
*/
private BigDecimal price;
/**
* 采购状态
*/
private String procureStatus;
/**
* 备注
*/
private String describes;
/**
* 删除时间
*/
private LocalDateTime deletionTime;
/**
* 删除者ID
*/
private String deleterId;
/**
* 扩展属性
*/
private String extraProperties;
/**
* 并发乐观锁
*/
private Integer concurrencyStamp;
/**
* 地点id
*/
private String siteId;
}

75
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/inventorywarning/InventoryWarningMapper.java

@ -0,0 +1,75 @@
package com.win.module.eam.dal.mysql.inventorywarning;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.mybatis.core.mapper.BaseMapperX;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningExportReqVO;
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningPageReqVO;
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 库存预警记录 Mapper
*
* @author 超级管理员
*/
@Mapper
public interface InventoryWarningMapper extends BaseMapperX<InventoryWarningDO> {
default PageResult<InventoryWarningDO> selectPage(InventoryWarningPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<InventoryWarningDO>()
.eqIfPresent(InventoryWarningDO::getNumber, reqVO.getNumber())
.likeIfPresent(InventoryWarningDO::getName, reqVO.getName())
.eqIfPresent(InventoryWarningDO::getSpecifications, reqVO.getSpecifications())
.eqIfPresent(InventoryWarningDO::getUom, reqVO.getUom())
.likeIfPresent(InventoryWarningDO::getSupplierName, reqVO.getSupplierName())
.eqIfPresent(InventoryWarningDO::getBrand, reqVO.getBrand())
.eqIfPresent(InventoryWarningDO::getMaxInventory, reqVO.getMaxInventory())
.eqIfPresent(InventoryWarningDO::getMinInventory, reqVO.getMinInventory())
.eqIfPresent(InventoryWarningDO::getNowInventory, reqVO.getNowInventory())
.eqIfPresent(InventoryWarningDO::getProcurementCycle, reqVO.getProcurementCycle())
.eqIfPresent(InventoryWarningDO::getClassification, reqVO.getClassification())
.eqIfPresent(InventoryWarningDO::getUsePlace, reqVO.getUsePlace())
.eqIfPresent(InventoryWarningDO::getProject, reqVO.getProject())
.eqIfPresent(InventoryWarningDO::getPrice, reqVO.getPrice())
.eqIfPresent(InventoryWarningDO::getProcureStatus, reqVO.getProcureStatus())
.eqIfPresent(InventoryWarningDO::getDescribes, reqVO.getDescribes())
.betweenIfPresent(InventoryWarningDO::getCreateTime, reqVO.getCreateTime())
.betweenIfPresent(InventoryWarningDO::getDeletionTime, reqVO.getDeletionTime())
.eqIfPresent(InventoryWarningDO::getDeleterId, reqVO.getDeleterId())
.eqIfPresent(InventoryWarningDO::getExtraProperties, reqVO.getExtraProperties())
.eqIfPresent(InventoryWarningDO::getConcurrencyStamp, reqVO.getConcurrencyStamp())
.eqIfPresent(InventoryWarningDO::getSiteId, reqVO.getSiteId())
.orderByDesc(InventoryWarningDO::getId));
}
default List<InventoryWarningDO> selectList(InventoryWarningExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<InventoryWarningDO>()
.eqIfPresent(InventoryWarningDO::getNumber, reqVO.getNumber())
.likeIfPresent(InventoryWarningDO::getName, reqVO.getName())
.eqIfPresent(InventoryWarningDO::getSpecifications, reqVO.getSpecifications())
.eqIfPresent(InventoryWarningDO::getUom, reqVO.getUom())
.likeIfPresent(InventoryWarningDO::getSupplierName, reqVO.getSupplierName())
.eqIfPresent(InventoryWarningDO::getBrand, reqVO.getBrand())
.eqIfPresent(InventoryWarningDO::getMaxInventory, reqVO.getMaxInventory())
.eqIfPresent(InventoryWarningDO::getMinInventory, reqVO.getMinInventory())
.eqIfPresent(InventoryWarningDO::getNowInventory, reqVO.getNowInventory())
.eqIfPresent(InventoryWarningDO::getProcurementCycle, reqVO.getProcurementCycle())
.eqIfPresent(InventoryWarningDO::getClassification, reqVO.getClassification())
.eqIfPresent(InventoryWarningDO::getUsePlace, reqVO.getUsePlace())
.eqIfPresent(InventoryWarningDO::getProject, reqVO.getProject())
.eqIfPresent(InventoryWarningDO::getPrice, reqVO.getPrice())
.eqIfPresent(InventoryWarningDO::getProcureStatus, reqVO.getProcureStatus())
.eqIfPresent(InventoryWarningDO::getDescribes, reqVO.getDescribes())
.betweenIfPresent(InventoryWarningDO::getCreateTime, reqVO.getCreateTime())
.betweenIfPresent(InventoryWarningDO::getDeletionTime, reqVO.getDeletionTime())
.eqIfPresent(InventoryWarningDO::getDeleterId, reqVO.getDeleterId())
.eqIfPresent(InventoryWarningDO::getExtraProperties, reqVO.getExtraProperties())
.eqIfPresent(InventoryWarningDO::getConcurrencyStamp, reqVO.getConcurrencyStamp())
.eqIfPresent(InventoryWarningDO::getSiteId, reqVO.getSiteId())
.orderByDesc(InventoryWarningDO::getId));
}
}

41
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/enums/transactionType/ProcureStatusEnum.java

@ -0,0 +1,41 @@
package com.win.module.eam.enums.transactionType;
public enum ProcureStatusEnum {
//设备模具报修申请
YESPURCHASED("YESPURCHASED", "采购完成"),
PURCHASEDING("PURCHASEDING", "采购中"),
NOPURCHASED("NOPURCHASED", "待采购"),
;
private String code;
private String name;
ProcureStatusEnum(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return this.code;
}
public String getName() {
return this.name;
}
/**
* 用状态值获取枚举
*
* @param code
* @return
*/
static ProcureStatusEnum getTransactionTypeEnum(String code) {
for (ProcureStatusEnum orderStatusEnum : values()) {
if (orderStatusEnum.getCode().equals(code)) {
return orderStatusEnum;
}
}
return null;
}
}

72
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/inventorywarning/InventoryWarningService.java

@ -0,0 +1,72 @@
package com.win.module.eam.service.inventorywarning;
import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.inventorywarning.vo.*;
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* 库存预警记录 Service 接口
*
* @author 超级管理员
*/
public interface InventoryWarningService {
/**
* 创建库存预警记录
*
* @param createReqVO 创建信息
* @return 编号
*/
Integer createInventoryWarning(@Valid InventoryWarningCreateReqVO createReqVO);
/**
* 更新库存预警记录
*
* @param updateReqVO 更新信息
*/
Integer updateInventoryWarning(@Valid InventoryWarningUpdateReqVO updateReqVO);
/**
* 删除库存预警记录
*
* @param id 编号
*/
Integer deleteInventoryWarning(Integer id);
/**
* 获得库存预警记录
*
* @param id 编号
* @return 库存预警记录
*/
InventoryWarningDO getInventoryWarning(Integer id);
/**
* 获得库存预警记录列表
*
* @param ids 编号
* @return 库存预警记录列表
*/
List<InventoryWarningDO> getInventoryWarningList(Collection<Integer> ids);
/**
* 获得库存预警记录分页
*
* @param pageReqVO 分页查询
* @return 库存预警记录分页
*/
PageResult<InventoryWarningDO> getInventoryWarningPage(InventoryWarningPageReqVO pageReqVO);
/**
* 获得库存预警记录列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 库存预警记录列表
*/
List<InventoryWarningDO> getInventoryWarningList(InventoryWarningExportReqVO exportReqVO);
}

84
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/inventorywarning/InventoryWarningServiceImpl.java

@ -0,0 +1,84 @@
package com.win.module.eam.service.inventorywarning;
import cn.hutool.core.collection.CollUtil;
import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.inventorywarning.vo.*;
import com.win.module.eam.convert.inventorywarning.InventoryWarningConvert;
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO;
import com.win.module.eam.dal.mysql.inventorywarning.InventoryWarningMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.module.eam.enums.ErrorCodeConstants.INVENTORY_WARNING_NOT_EXISTS;
/**
* 库存预警记录 Service 实现类
*
* @author 超级管理员
*/
@Service
@Validated
public class InventoryWarningServiceImpl implements InventoryWarningService {
@Resource
private InventoryWarningMapper inventoryWarningMapper;
@Override
public Integer createInventoryWarning(InventoryWarningCreateReqVO createReqVO) {
// 插入
InventoryWarningDO inventoryWarning = InventoryWarningConvert.INSTANCE.convert(createReqVO);
inventoryWarningMapper.insert(inventoryWarning);
// 返回
return inventoryWarning.getId();
}
@Override
public Integer updateInventoryWarning(InventoryWarningUpdateReqVO updateReqVO) {
// 校验存在
validateInventoryWarningExists(updateReqVO.getId());
// 更新
InventoryWarningDO updateObj = InventoryWarningConvert.INSTANCE.convert(updateReqVO);
return inventoryWarningMapper.updateById(updateObj);
}
@Override
public Integer deleteInventoryWarning(Integer id) {
// 校验存在
validateInventoryWarningExists(id);
// 删除
return inventoryWarningMapper.deleteById(id);
}
private void validateInventoryWarningExists(Integer id) {
if (inventoryWarningMapper.selectById(id) == null) {
throw exception(INVENTORY_WARNING_NOT_EXISTS);
}
}
@Override
public InventoryWarningDO getInventoryWarning(Integer id) {
return inventoryWarningMapper.selectById(id);
}
@Override
public List<InventoryWarningDO> getInventoryWarningList(Collection<Integer> ids) {
return inventoryWarningMapper.selectBatchIds(ids);
}
@Override
public PageResult<InventoryWarningDO> getInventoryWarningPage(InventoryWarningPageReqVO pageReqVO) {
return inventoryWarningMapper.selectPage(pageReqVO);
}
@Override
public List<InventoryWarningDO> getInventoryWarningList(InventoryWarningExportReqVO exportReqVO) {
return inventoryWarningMapper.selectList(exportReqVO);
}
}

68
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemoutlocation/ItemOutLocationServiceImpl.java

@ -1,5 +1,6 @@
package com.win.module.eam.service.itemoutlocation;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationCreateReqVO;
@ -9,14 +10,22 @@ import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationUpdateReq
import com.win.module.eam.controller.transaction.vo.TransactionCreateReqVO;
import com.win.module.eam.convert.iteminlocation.ItemInLocationConvert;
import com.win.module.eam.convert.itemoutlocation.ItemOutLocationConvert;
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO;
import com.win.module.eam.dal.dataobject.item.ItemDO;
import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO;
import com.win.module.eam.dal.dataobject.iteminlocation.ItemInLocationDO;
import com.win.module.eam.dal.dataobject.itemoutlocation.ItemOutLocationDO;
import com.win.module.eam.dal.dataobject.location.LocationDO;
import com.win.module.eam.dal.mysql.inventorywarning.InventoryWarningMapper;
import com.win.module.eam.dal.mysql.item.ItemMapper;
import com.win.module.eam.dal.mysql.itemaccounts.ItemAccountsMapper;
import com.win.module.eam.dal.mysql.itemoutlocation.ItemOutLocationMapper;
import com.win.module.eam.dal.mysql.location.LocationMapper;
import com.win.module.eam.enums.itemAccount.ItemAccountStatusEnum;
import com.win.module.eam.enums.transaction.TransactionEnum;
import com.win.module.eam.enums.transactionType.ProcureStatusEnum;
import com.win.module.eam.service.transaction.TransactionService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@ -50,6 +59,15 @@ public class ItemOutLocationServiceImpl implements ItemOutLocationService {
@Resource
private LocationMapper locationMapper;
@Resource
private ItemMapper itemMapper;
@Resource
private ItemAccountsMapper itemAccountsMapper;
@Resource
private InventoryWarningMapper inventoryWarningMapper;
@Override
@Transactional
public Long createItemOutLocation(ItemOutLocationCreateReqVO createReqVO) {
@ -73,17 +91,55 @@ public class ItemOutLocationServiceImpl implements ItemOutLocationService {
transactionCreateReqVO.setType(ItemAccountStatusEnum.IN.getCode());
list.add(transactionCreateReqVO);
transactionService.create(list);
//创建库存预警记录
this.createInventoryWarning(createReqVO.getItemNumber(), createReqVO.getLocationNumber());
// 返回
return itemOutLocation.getId();
}
@Transactional
public Integer createInventoryWarning(String number, String locationNumber) {
int result = 0;
QueryWrapper<ItemDO> itemDOQueryWrapper = new QueryWrapper<>();
itemDOQueryWrapper.eq("number", number);
itemDOQueryWrapper.eq("available", "TRUE");
ItemDO itemDO = itemMapper.selectOne(itemDOQueryWrapper);
InventoryWarningDO inventoryWarningDO = new InventoryWarningDO();
BeanUtils.copyProperties(itemDO, inventoryWarningDO);
inventoryWarningDO.setLocationNumber(locationNumber);
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("item_number", number);
queryWrapper.eq("available", "TRUE");
List<ItemAccountsDO> itemAccountsDOList = itemAccountsMapper.selectList(queryWrapper);
BigDecimal allCount = BigDecimal.ZERO;
for (ItemAccountsDO itemAccountsDO : itemAccountsDOList) {
allCount = allCount.add(itemAccountsDO.getQty());
}
//如果各种类型的备件库存数量总数低于最低库存数量
if (allCount.compareTo(itemDO.getMinInventory()) == -1) {
inventoryWarningDO.setNowInventory(allCount);
QueryWrapper<InventoryWarningDO> inventoryWarningDOQueryWrapper = new QueryWrapper<>();
inventoryWarningDOQueryWrapper.eq("item_number", number);
inventoryWarningDOQueryWrapper.eq("item_location", locationNumber);
inventoryWarningDOQueryWrapper.ne("procure_status", ProcureStatusEnum.YESPURCHASED.getCode());
List<InventoryWarningDO> inventoryWarningDOList = inventoryWarningMapper.selectList(inventoryWarningDOQueryWrapper);
if(inventoryWarningDOList.isEmpty()){
result = inventoryWarningMapper.insert(inventoryWarningDO);
}
}
return result;
}
@Override
public Long createPDA(ItemOutLocationCreateReqVO createReqVO) {
long i=0l;
long i = 0l;
List<Map<String, Object>> itemList = createReqVO.getItemNumbers();//备件号集合
List<TransactionCreateReqVO> list = new ArrayList<>();
if(createReqVO.getItemNumbers()!=null&& !createReqVO.getItemNumbers().isEmpty()){
if (createReqVO.getItemNumbers() != null && !createReqVO.getItemNumbers().isEmpty()) {
for (Map<String, Object> map : itemList) {
List<TransactionCreateReqVO> list = new ArrayList<>();
String itemNumber = map.get("itemNumber").toString();//备件号
String qty = map.get("qty").toString();//入库数量
String locationNumber = map.get("locationNumber").toString();//库位
@ -111,10 +167,12 @@ public class ItemOutLocationServiceImpl implements ItemOutLocationService {
transactionCreateReqVO.setInventoryAction(TransactionEnum.REQUISITION_OUT.getCode());
transactionCreateReqVO.setType(ItemAccountStatusEnum.IN.getCode());
list.add(transactionCreateReqVO);
transactionService.create(list);
//创建库存预警记录
this.createInventoryWarning(createReqVO.getItemNumber(), createReqVO.getLocationNumber());
}
transactionService.create(list);
}
return i;
return i;
}
@Override

12
win-module-eam/win-module-eam-biz/src/main/resources/mapper/inventorywarning/InventoryWarningMapper.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.win.module.record.dal.mysql.inventorywarning.InventoryWarningMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
Loading…
Cancel
Save