Browse Source

完成计划出和计划入接口

master
刘忱 2 years ago
parent
commit
1374c9a79b
  1. 96
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/expectin/ExpectinController.java
  2. 6
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/expectin/vo/ExpectinBaseVO.java
  3. 98
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/expectout/ExpectoutController.java
  4. 13
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/expectin/ExpectinDO.java
  5. 13
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/expectout/ExpectoutDO.java
  6. 10
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/expectin/ExpectinMapper.java
  7. 10
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/expectout/ExpectoutMapper.java
  8. 50
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectin/ExpectinService.java
  9. 70
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectin/ExpectinServiceImpl.java
  10. 47
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectout/ExpectoutService.java
  11. 80
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectout/ExpectoutServiceImpl.java

96
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/expectin/ExpectinController.java

@ -1,34 +1,34 @@
package com.win.module.wms.controller.expectin;
import com.win.framework.common.pojo.CommonResult;
import com.win.framework.common.pojo.CustomConditions;
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.system.api.user.AdminUserApi;
import com.win.module.system.api.user.dto.AdminUserRespDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import com.win.module.wms.controller.expectin.vo.ExpectinExcelVO;
import com.win.module.wms.controller.expectin.vo.ExpectinExportReqVO;
import com.win.module.wms.controller.expectin.vo.ExpectinPageReqVO;
import com.win.module.wms.controller.expectin.vo.ExpectinRespVO;
import com.win.module.wms.convert.expectin.ExpectinConvert;
import com.win.module.wms.dal.dataobject.expectin.ExpectinDO;
import com.win.module.wms.service.expectin.ExpectinService;
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.validation.*;
import javax.servlet.http.*;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.pojo.CommonResult;
import static com.win.framework.common.pojo.CommonResult.success;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.win.module.wms.controller.expectin.vo.*;
import com.win.module.wms.dal.dataobject.expectin.ExpectinDO;
import com.win.module.wms.convert.expectin.ExpectinConvert;
import com.win.module.wms.service.expectin.ExpectinService;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 预计入库存")
@RestController
@ -42,28 +42,22 @@ public class ExpectinController {
@Resource
private AdminUserApi userApi;
@PostMapping("/create")
@Operation(summary = "创建预计入库存")
@PreAuthorize("@ss.hasPermission('wms:expectin:create')")
public CommonResult<String> createExpectin(@Valid @RequestBody ExpectinCreateReqVO createReqVO) {
return success(expectinService.createExpectin(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新预计入库存")
@PreAuthorize("@ss.hasPermission('wms:expectin:update')")
public CommonResult<Boolean> updateExpectin(@Valid @RequestBody ExpectinUpdateReqVO updateReqVO) {
expectinService.updateExpectin(updateReqVO);
return success(true);
@DeleteMapping("/delete")
@Operation(summary = "根据任务号删除预计入库存")
@Parameter(name = "jobNumber", description = "任务号", required = true)
@PreAuthorize("@ss.hasPermission('wms:expectin:delete')")
public CommonResult<Boolean> deleteExpectin(@RequestParam("jobNumber") String jobNumber) {
Integer result = expectinService.deleteExpectinByJobNumber(jobNumber);
return success(result > 0);
}
@DeleteMapping("/delete")
@DeleteMapping("/deleteByJobNumber")
@Operation(summary = "删除预计入库存")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('wms:expectin:delete')")
public CommonResult<Boolean> deleteExpectin(@RequestParam("id") Long id) {
expectinService.deleteExpectin(id);
return success(true);
Integer result = expectinService.deleteExpectin(id);
return success(result > 0);
}
@GetMapping("/get")
@ -75,15 +69,6 @@ public class ExpectinController {
return success(ExpectinConvert.INSTANCE.convert(expectin));
}
@GetMapping("/list")
@Operation(summary = "获得预计入库存列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('wms:expectin:query')")
public CommonResult<List<ExpectinRespVO>> getExpectinList(@RequestParam("ids") Collection<String> ids) {
List<ExpectinDO> list = expectinService.getExpectinList(ids);
return success(ExpectinConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得预计入库存分页")
@PreAuthorize("@ss.hasPermission('wms:expectin:query')")
@ -110,14 +95,25 @@ public class ExpectinController {
@Operation(summary = "导出预计入库存 Excel")
@PreAuthorize("@ss.hasPermission('wms:expectin:export')")
@OperateLog(type = EXPORT)
public void exportExpectinExcel(@Valid ExpectinExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
public void exportExpectinExcel(@Valid ExpectinExportReqVO exportReqVO, HttpServletResponse response) throws IOException {
List<ExpectinDO> list = expectinService.getExpectinList(exportReqVO);
// 导出 Excel
List<ExpectinExcelVO> datas = ExpectinConvert.INSTANCE.convertList02(list);
for(ExpectinExcelVO vo : datas) {
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator()));
//后端创建个字段作为前端展示的虚拟字段
vo.setCreator(user.getNickname());
}
ExcelUtils.write(response, "预计入库存.xls", "数据", ExpectinExcelVO.class, datas);
}
@PostMapping("/export-excel-senior")
@Operation(summary = "导出预计入库存 Excel")
@PreAuthorize("@ss.hasPermission('wms:expectin:export')")
@OperateLog(type = EXPORT)
public void exportExpectinExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException {
List<ExpectinDO> list = expectinService.getExpectinList(conditions);
List<ExpectinExcelVO> datas = ExpectinConvert.INSTANCE.convertList02(list);
for(ExpectinExcelVO vo : datas) {
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator()));
vo.setCreator(user.getNickname());
}
ExcelUtils.write(response, "预计入库存.xls", "数据", ExpectinExcelVO.class, datas);

6
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/expectin/vo/ExpectinBaseVO.java

@ -1,10 +1,10 @@
package com.win.module.wms.controller.expectin.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import javax.validation.constraints.*;
/**
* 预计入库存 Base VO提供给添加修改详细的子 VO 使用

98
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/expectout/ExpectoutController.java

@ -1,34 +1,34 @@
package com.win.module.wms.controller.expectout;
import com.win.framework.common.pojo.CommonResult;
import com.win.framework.common.pojo.CustomConditions;
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.system.api.user.AdminUserApi;
import com.win.module.system.api.user.dto.AdminUserRespDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import com.win.module.wms.controller.expectout.vo.ExpectoutExcelVO;
import com.win.module.wms.controller.expectout.vo.ExpectoutExportReqVO;
import com.win.module.wms.controller.expectout.vo.ExpectoutPageReqVO;
import com.win.module.wms.controller.expectout.vo.ExpectoutRespVO;
import com.win.module.wms.convert.expectout.ExpectoutConvert;
import com.win.module.wms.dal.dataobject.expectout.ExpectoutDO;
import com.win.module.wms.service.expectout.ExpectoutService;
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.validation.*;
import javax.servlet.http.*;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.pojo.CommonResult;
import static com.win.framework.common.pojo.CommonResult.success;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.win.module.wms.controller.expectout.vo.*;
import com.win.module.wms.dal.dataobject.expectout.ExpectoutDO;
import com.win.module.wms.convert.expectout.ExpectoutConvert;
import com.win.module.wms.service.expectout.ExpectoutService;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 预计出库存")
@RestController
@ -42,28 +42,22 @@ public class ExpectoutController {
@Resource
private AdminUserApi userApi;
@PostMapping("/create")
@Operation(summary = "创建预计出库存")
@PreAuthorize("@ss.hasPermission('wms:expectout:create')")
public CommonResult<String> createExpectout(@Valid @RequestBody ExpectoutCreateReqVO createReqVO) {
return success(expectoutService.createExpectout(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新预计出库存")
@PreAuthorize("@ss.hasPermission('wms:expectout:update')")
public CommonResult<Boolean> updateExpectout(@Valid @RequestBody ExpectoutUpdateReqVO updateReqVO) {
expectoutService.updateExpectout(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除预计出库存")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('wms:expectout:delete')")
public CommonResult<Boolean> deleteExpectout(@RequestParam("id") Long id) {
expectoutService.deleteExpectout(id);
return success(true);
int result = expectoutService.deleteExpectout(id);
return success(result > 0);
}
@DeleteMapping("/deleteByJobNumber")
@Operation(summary = "根据任务号删除预计出库存")
@Parameter(name = "jobNumber", description = "任务号", required = true)
@PreAuthorize("@ss.hasPermission('wms:expectout:delete')")
public CommonResult<Boolean> deleteExpectout(@RequestParam("jobNumber") String jobNumber) {
int result = expectoutService.deleteExpectoutByJobNumber(jobNumber);
return success(result > 0);
}
@GetMapping("/get")
@ -75,15 +69,6 @@ public class ExpectoutController {
return success(ExpectoutConvert.INSTANCE.convert(expectout));
}
@GetMapping("/list")
@Operation(summary = "获得预计出库存列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('wms:expectout:query')")
public CommonResult<List<ExpectoutRespVO>> getExpectoutList(@RequestParam("ids") Collection<String> ids) {
List<ExpectoutDO> list = expectoutService.getExpectoutList(ids);
return success(ExpectoutConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得预计出库存分页")
@PreAuthorize("@ss.hasPermission('wms:expectout:query')")
@ -110,14 +95,25 @@ public class ExpectoutController {
@Operation(summary = "导出预计出库存 Excel")
@PreAuthorize("@ss.hasPermission('wms:expectout:export')")
@OperateLog(type = EXPORT)
public void exportExpectoutExcel(@Valid ExpectoutExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
public void exportExpectoutExcel(@Valid ExpectoutExportReqVO exportReqVO, HttpServletResponse response) throws IOException {
List<ExpectoutDO> list = expectoutService.getExpectoutList(exportReqVO);
// 导出 Excel
List<ExpectoutExcelVO> datas = ExpectoutConvert.INSTANCE.convertList02(list);
for(ExpectoutExcelVO vo : datas) {
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator()));
//后端创建个字段作为前端展示的虚拟字段
vo.setCreator(user.getNickname());
}
ExcelUtils.write(response, "预计出库存.xls", "数据", ExpectoutExcelVO.class, datas);
}
@GetMapping("/export-excel-senior")
@Operation(summary = "导出预计出库存 Excel")
@PreAuthorize("@ss.hasPermission('wms:expectout:export')")
@OperateLog(type = EXPORT)
public void exportExpectoutExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException {
List<ExpectoutDO> list = expectoutService.getExpectoutList(conditions);
List<ExpectoutExcelVO> datas = ExpectoutConvert.INSTANCE.convertList02(list);
for(ExpectoutExcelVO vo : datas) {
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator()));
vo.setCreator(user.getNickname());
}
ExcelUtils.write(response, "预计出库存.xls", "数据", ExpectoutExcelVO.class, datas);

13
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/expectin/ExpectinDO.java

@ -1,10 +1,13 @@
package com.win.module.wms.dal.dataobject.expectin;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sun.xml.bind.v2.TODO;
import com.win.framework.mybatis.core.dataobject.BaseDO;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import com.win.framework.mybatis.core.dataobject.BaseDO;
/**
* 预计入库存 DO
@ -23,8 +26,8 @@ public class ExpectinDO extends BaseDO {
/**
* id
*/
@TableId(type = IdType.INPUT)
private String id;
@TableId(type = IdType.AUTO)
private Long id;
/**
* 任务号
*/

13
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/expectout/ExpectoutDO.java

@ -1,10 +1,13 @@
package com.win.module.wms.dal.dataobject.expectout;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sun.xml.bind.v2.TODO;
import com.win.framework.mybatis.core.dataobject.BaseDO;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import com.win.framework.mybatis.core.dataobject.BaseDO;
/**
* 预计出库存 DO
@ -23,8 +26,8 @@ public class ExpectoutDO extends BaseDO {
/**
* id
*/
@TableId(type = IdType.INPUT)
private String id;
@TableId(type = IdType.AUTO)
private Long id;
/**
* 任务号
*/

10
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/expectin/ExpectinMapper.java

@ -1,17 +1,17 @@
package com.win.module.wms.dal.mysql.expectin;
import java.util.*;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.framework.mybatis.core.mapper.BaseMapperX;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.framework.mybatis.core.util.QueryWrapperUtils;
import com.win.module.wms.controller.expectin.vo.ExpectinExportReqVO;
import com.win.module.wms.controller.expectin.vo.ExpectinPageReqVO;
import com.win.module.wms.dal.dataobject.expectin.ExpectinDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 预计入库存 Mapper
*
@ -52,4 +52,8 @@ public interface ExpectinMapper extends BaseMapperX<ExpectinDO> {
.orderByDesc(ExpectinDO::getId));
}
default List<ExpectinDO> selectSeniorList(CustomConditions conditions) {
return selectList(QueryWrapperUtils.structure(conditions));
}
}

10
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/expectout/ExpectoutMapper.java

@ -1,17 +1,17 @@
package com.win.module.wms.dal.mysql.expectout;
import java.util.*;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.framework.mybatis.core.mapper.BaseMapperX;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.framework.mybatis.core.util.QueryWrapperUtils;
import com.win.module.wms.controller.expectout.vo.ExpectoutExportReqVO;
import com.win.module.wms.controller.expectout.vo.ExpectoutPageReqVO;
import com.win.module.wms.dal.dataobject.expectout.ExpectoutDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 预计出库存 Mapper
*
@ -54,4 +54,8 @@ public interface ExpectoutMapper extends BaseMapperX<ExpectoutDO> {
.orderByDesc(ExpectoutDO::getId));
}
default List<ExpectoutDO> selectSeniorList(CustomConditions conditions) {
return selectList(QueryWrapperUtils.structure(conditions));
}
}

50
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectin/ExpectinService.java

@ -1,15 +1,13 @@
package com.win.module.wms.service.expectin;
import java.util.*;
import javax.validation.*;
import com.win.framework.common.pojo.CustomConditions;
import com.win.module.wms.controller.expectin.vo.ExpectinCreateReqVO;
import com.win.framework.common.pojo.PageResult;
import com.win.module.wms.controller.expectin.vo.ExpectinExportReqVO;
import com.win.module.wms.controller.expectin.vo.ExpectinPageReqVO;
import com.win.module.wms.controller.expectin.vo.ExpectinUpdateReqVO;
import com.win.module.wms.dal.dataobject.expectin.ExpectinDO;
import com.win.framework.common.pojo.PageResult;
import java.math.BigDecimal;
import java.util.List;
/**
* 预计入库存 Service 接口
@ -20,25 +18,33 @@ public interface ExpectinService {
/**
* 创建预计入库存
*
* @param createReqVO 创建信息
* @return 编号
* @param jobNumber 任务号
* @param businessType 业务类型
* @param itemCode 物料代码
* @param batch 批次
* @param inventoryStatus 库存状态
* @param uom 计量单位
* @param qty 数量
* @param locationCode 库位代码
* @param warehouseCode 仓库代码
* @param ownerCode 货主代码
* @return
*/
String createExpectin(@Valid ExpectinCreateReqVO createReqVO);
Long createExpectin(String jobNumber, String businessType, String itemCode, String batch, String inventoryStatus, String uom, BigDecimal qty, String locationCode, String warehouseCode, String ownerCode);
/**
* 更新预计入库存
* 删除预计入库存
*
* @param updateReqVO 更新信息
* @param id 编号
*/
void updateExpectin(@Valid ExpectinUpdateReqVO updateReqVO);
Integer deleteExpectin(Long id);
/**
* 删除预计入库存
*
* @param id
* @param jobNumber 任务
*/
void deleteExpectin(Long id);
Integer deleteExpectinByJobNumber(String jobNumber);
/**
* 获得预计入库存
@ -48,14 +54,6 @@ public interface ExpectinService {
*/
ExpectinDO getExpectin(String id);
/**
* 获得预计入库存列表
*
* @param ids 编号
* @return 预计入库存列表
*/
List<ExpectinDO> getExpectinList(Collection<String> ids);
/**
* 获得预计入库存分页
*
@ -81,4 +79,10 @@ public interface ExpectinService {
*/
List<ExpectinDO> getExpectinList(ExpectinExportReqVO exportReqVO);
/**
* 获得预计入库存列表, 用于 Excel 导出
* @param conditions
* @return
*/
List<ExpectinDO> getExpectinList(CustomConditions conditions);
}

70
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectin/ExpectinServiceImpl.java

@ -1,24 +1,24 @@
package com.win.module.wms.service.expectin;
import com.win.framework.common.pojo.CustomConditions;
import com.win.module.wms.controller.expectin.vo.ExpectinCreateReqVO;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.util.validation.ValidationUtils;
import com.win.module.wms.controller.expectin.vo.ExpectinExportReqVO;
import com.win.module.wms.controller.expectin.vo.ExpectinPageReqVO;
import com.win.module.wms.controller.expectin.vo.ExpectinUpdateReqVO;
import com.win.module.wms.dal.dataobject.expectin.ExpectinDO;
import com.win.module.wms.dal.mysql.expectin.ExpectinMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import com.win.module.wms.dal.dataobject.expectin.ExpectinDO;
import com.win.framework.common.pojo.PageResult;
import com.win.module.wms.convert.expectin.ExpectinConvert;
import com.win.module.wms.dal.mysql.expectin.ExpectinMapper;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.module.wms.enums.ErrorCodeConstants.*;
import static com.win.module.wms.enums.ErrorCodeConstants.EXPECTIN_NOT_EXISTS;
/**
* 预计入库存 Service 实现类
@ -31,31 +31,41 @@ public class ExpectinServiceImpl implements ExpectinService {
@Resource
private ExpectinMapper expectinMapper;
@Resource
private Validator validator;
@Override
public String createExpectin(ExpectinCreateReqVO createReqVO) {
public Long createExpectin(String jobNumber, String businessType, String itemCode, String batch, String inventoryStatus, String uom, BigDecimal qty, String locationCode, String warehouseCode, String ownerCode) {
ExpectinDO expectinDO = new ExpectinDO();
expectinDO.setJobNumber(jobNumber);
expectinDO.setItemCode(itemCode);
expectinDO.setBatch(batch);
expectinDO.setInventoryStatus(inventoryStatus);
expectinDO.setUom(uom);
expectinDO.setQty(qty);
expectinDO.setLocationCode(locationCode);
expectinDO.setWarehouseCode(warehouseCode);
expectinDO.setOwnerCode(ownerCode);
ValidationUtils.validate(validator, expectinDO);
// 插入
ExpectinDO expectin = ExpectinConvert.INSTANCE.convert(createReqVO);
expectinMapper.insert(expectin);
expectinMapper.insert(expectinDO);
// 返回
return expectin.getId();
return expectinDO.getId();
}
@Override
public void updateExpectin(ExpectinUpdateReqVO updateReqVO) {
public Integer deleteExpectin(Long id) {
// 校验存在
validateExpectinExists(updateReqVO.getId());
// 更新
ExpectinDO updateObj = ExpectinConvert.INSTANCE.convert(updateReqVO);
expectinMapper.updateById(updateObj);
validateExpectinExists(id);
// 删除
return expectinMapper.deleteById(id);
}
@Override
public void deleteExpectin(Long id) {
// 校验存在
validateExpectinExists(id);
// 删除
expectinMapper.deleteById(id);
public Integer deleteExpectinByJobNumber(String jobNumber) {
Map<String, Object> map = new HashMap<>();
map.put("job_number", jobNumber);
return expectinMapper.deleteByMap(map);
}
private void validateExpectinExists(Long id) {
@ -69,11 +79,6 @@ public class ExpectinServiceImpl implements ExpectinService {
return expectinMapper.selectById(id);
}
@Override
public List<ExpectinDO> getExpectinList(Collection<String> ids) {
return expectinMapper.selectBatchIds(ids);
}
@Override
public PageResult<ExpectinDO> getExpectinPage(ExpectinPageReqVO pageReqVO) {
return expectinMapper.selectPage(pageReqVO);
@ -89,4 +94,9 @@ public class ExpectinServiceImpl implements ExpectinService {
return expectinMapper.selectList(exportReqVO);
}
@Override
public List<ExpectinDO> getExpectinList(CustomConditions conditions) {
return expectinMapper.selectSeniorList(conditions);
}
}

47
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectout/ExpectoutService.java

@ -1,15 +1,13 @@
package com.win.module.wms.service.expectout;
import java.util.*;
import javax.validation.*;
import com.win.framework.common.pojo.CustomConditions;
import com.win.module.wms.controller.expectout.vo.ExpectoutCreateReqVO;
import com.win.framework.common.pojo.PageResult;
import com.win.module.wms.controller.expectout.vo.ExpectoutExportReqVO;
import com.win.module.wms.controller.expectout.vo.ExpectoutPageReqVO;
import com.win.module.wms.controller.expectout.vo.ExpectoutUpdateReqVO;
import com.win.module.wms.dal.dataobject.expectout.ExpectoutDO;
import com.win.framework.common.pojo.PageResult;
import java.math.BigDecimal;
import java.util.List;
/**
* 预计出库存 Service 接口
@ -21,24 +19,33 @@ public interface ExpectoutService {
/**
* 创建预计出库存
*
* @param createReqVO 创建信息
* @param jobNumber 任务号
* @param businessType 业务类型
* @param itemCode 物料代码
* @param batch 批次
* @param inventoryStatus 库存状态
* @param uom 计量单位
* @param qty 数量
* @param locationCode 库位代码
* @param warehouseCode 仓库代码
* @param ownerCode 货主代码
* @return 编号
*/
String createExpectout(@Valid ExpectoutCreateReqVO createReqVO);
Long createExpectout(String jobNumber, String businessType, String itemCode, String batch, String inventoryStatus, String uom, BigDecimal qty, String locationCode, String warehouseCode, String ownerCode);
/**
* 更新预计出库存
* 删除预计出库存
*
* @param updateReqVO 更新信息
* @param id 编号
*/
void updateExpectout(@Valid ExpectoutUpdateReqVO updateReqVO);
int deleteExpectout(Long id);
/**
* 删除预计出库存
*
* @param id
* @param jobNumber 任务
*/
void deleteExpectout(Long id);
int deleteExpectoutByJobNumber(String jobNumber);
/**
* 获得预计出库存
@ -48,14 +55,6 @@ public interface ExpectoutService {
*/
ExpectoutDO getExpectout(String id);
/**
* 获得预计出库存列表
*
* @param ids 编号
* @return 预计出库存列表
*/
List<ExpectoutDO> getExpectoutList(Collection<String> ids);
/**
* 获得预计出库存分页
*
@ -124,4 +123,10 @@ public interface ExpectoutService {
*/
public List<ExpectoutDO> selectUniqeIdNew(String packingnumber, String locationcode, List<String> inventorystatus);
/**
* 获得预计入库存列表, 用于 Excel 导出
* @param conditions
* @return
*/
List<ExpectoutDO> getExpectoutList(CustomConditions conditions);
}

80
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectout/ExpectoutServiceImpl.java

@ -2,25 +2,25 @@ package com.win.module.wms.service.expectout;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.win.framework.common.pojo.CustomConditions;
import com.win.module.wms.controller.expectout.vo.ExpectoutCreateReqVO;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.util.validation.ValidationUtils;
import com.win.module.wms.controller.expectout.vo.ExpectoutExportReqVO;
import com.win.module.wms.controller.expectout.vo.ExpectoutPageReqVO;
import com.win.module.wms.controller.expectout.vo.ExpectoutUpdateReqVO;
import com.win.module.wms.dal.dataobject.expectout.ExpectoutDO;
import com.win.module.wms.dal.mysql.expectout.ExpectoutMapper;
import com.win.module.wms.service.rule.RuleService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import com.win.module.wms.dal.dataobject.expectout.ExpectoutDO;
import com.win.framework.common.pojo.PageResult;
import com.win.module.wms.convert.expectout.ExpectoutConvert;
import com.win.module.wms.dal.mysql.expectout.ExpectoutMapper;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.module.wms.enums.ErrorCodeConstants.*;
import static com.win.module.wms.enums.ErrorCodeConstants.EXPECTOUT_NOT_EXISTS;
/**
* 预计出库存 Service 实现类
@ -36,31 +36,40 @@ public class ExpectoutServiceImpl implements ExpectoutService {
@Resource
private RuleService ruleService;
@Resource
private Validator validator;
@Override
public String createExpectout(ExpectoutCreateReqVO createReqVO) {
// 插入
ExpectoutDO expectout = ExpectoutConvert.INSTANCE.convert(createReqVO);
expectoutMapper.insert(expectout);
public Long createExpectout(String jobNumber, String businessType, String itemCode, String batch, String inventoryStatus, String uom, BigDecimal qty, String locationCode, String warehouseCode, String ownerCode) {
ExpectoutDO expectoutDO = new ExpectoutDO();
expectoutDO.setJobNumber(jobNumber);
expectoutDO.setItemCode(itemCode);
expectoutDO.setBatch(batch);
expectoutDO.setInventoryStatus(inventoryStatus);
expectoutDO.setUom(uom);
expectoutDO.setQty(qty);
expectoutDO.setLocationCode(locationCode);
expectoutDO.setWarehouseCode(warehouseCode);
expectoutDO.setOwnerCode(ownerCode);
ValidationUtils.validate(validator, expectoutDO);
expectoutMapper.insert(expectoutDO);
// 返回
return expectout.getId();
return expectoutDO.getId();
}
@Override
public void updateExpectout(ExpectoutUpdateReqVO updateReqVO) {
public int deleteExpectout(Long id) {
// 校验存在
validateExpectoutExists(updateReqVO.getId());
// 更新
ExpectoutDO updateObj = ExpectoutConvert.INSTANCE.convert(updateReqVO);
expectoutMapper.updateById(updateObj);
validateExpectoutExists(id);
// 删除
return expectoutMapper.deleteById(id);
}
@Override
public void deleteExpectout(Long id) {
// 校验存在
validateExpectoutExists(id);
// 删除
expectoutMapper.deleteById(id);
public int deleteExpectoutByJobNumber(String jobNumber) {
Map<String, Object> map = new HashMap<>();
map.put("job_number", jobNumber);
return expectoutMapper.deleteByMap(map);
}
private void validateExpectoutExists(Long id) {
@ -74,11 +83,6 @@ public class ExpectoutServiceImpl implements ExpectoutService {
return expectoutMapper.selectById(id);
}
@Override
public List<ExpectoutDO> getExpectoutList(Collection<String> ids) {
return expectoutMapper.selectBatchIds(ids);
}
@Override
public PageResult<ExpectoutDO> getExpectoutPage(ExpectoutPageReqVO pageReqVO) {
return expectoutMapper.selectPage(pageReqVO);
@ -97,7 +101,7 @@ public class ExpectoutServiceImpl implements ExpectoutService {
//按数量查找 BY_BATCH
@Override
public List<ExpectoutDO> selectNumberNew(String itemcode, List<String> inventorystatus, String locationcode) {
QueryWrapper queryWrapper = new QueryWrapper();
QueryWrapper<ExpectoutDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("item_code", itemcode);
queryWrapper.eq("inventory_status", inventorystatus);
queryWrapper.eq("location_code", locationcode);
@ -112,7 +116,7 @@ public class ExpectoutServiceImpl implements ExpectoutService {
//按批次查询 BY_BATCH
@Override
public List<ExpectoutDO> selectBatchNew(String itemcode, String batch, List<String> inventorystatus, String locationcode) {
QueryWrapper queryWrapper = new QueryWrapper();
QueryWrapper<ExpectoutDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("item_code", itemcode);
queryWrapper.eq("batch", batch);
queryWrapper.eq("inventory_status", inventorystatus);
@ -128,7 +132,7 @@ public class ExpectoutServiceImpl implements ExpectoutService {
//按包裝 BY_PACKAGING
@Override
public List<ExpectoutDO> selectPackingNew(String itemcode, String packingnumber, String batch, List<String> inventorystatus, String locationcode) {
QueryWrapper queryWrapper = new QueryWrapper();
QueryWrapper<ExpectoutDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("item_code", itemcode);
queryWrapper.eq("batch", batch);
queryWrapper.eq("packing_number", packingnumber);
@ -145,7 +149,7 @@ public class ExpectoutServiceImpl implements ExpectoutService {
//按唯一码查询 BY_UNIQUE_ID
@Override
public List<ExpectoutDO> selectUniqeIdNew(String packingnumber, String locationcode, List<String> inventorystatus) {
QueryWrapper queryWrapper = new QueryWrapper();
QueryWrapper<ExpectoutDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("packing_number", packingnumber);
queryWrapper.eq("inventory_status", inventorystatus);
queryWrapper.eq("location_code", locationcode);
@ -156,4 +160,10 @@ public class ExpectoutServiceImpl implements ExpectoutService {
return null;
}
}
@Override
public List<ExpectoutDO> getExpectoutList(CustomConditions conditions) {
return expectoutMapper.selectSeniorList(conditions);
}
}

Loading…
Cancel
Save