Compare commits
41 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
741b5fff04 | ||
![]() |
d995f4962a | ||
![]() |
3744403e1e | ||
![]() |
7bc066b5b8 | ||
57f6fb52a5 | |||
![]() |
9039b3c731 | ||
![]() |
6e9edd706c | ||
![]() |
8ecc84a7c3 | ||
![]() |
54a2a4e089 | ||
![]() |
f8663453d2 | ||
![]() |
6d13c8a996 | ||
![]() |
7422bec2e3 | ||
![]() |
06470796c2 | ||
![]() |
a7c4b93e7c | ||
![]() |
96bb9c2bcd | ||
![]() |
b0b2ad64f9 | ||
![]() |
57ea2b3996 | ||
![]() |
2c9fe3cbe9 | ||
![]() |
d25749424e | ||
![]() |
0a5cef4f6f | ||
![]() |
fa39990202 | ||
![]() |
904c01bdbd | ||
![]() |
18f67ef62a | ||
![]() |
76b9b901ea | ||
![]() |
3ccc377c3a | ||
![]() |
a96a9e571e | ||
![]() |
00ae026f8a | ||
![]() |
9478a5f1f7 | ||
![]() |
6841981621 | ||
![]() |
d1e0abf345 | ||
![]() |
f562388f73 | ||
![]() |
79d6ec9a5d | ||
![]() |
9f0ac9b075 | ||
![]() |
31244295b4 | ||
![]() |
5191e10885 | ||
![]() |
4328fc5bac | ||
![]() |
7d28aab41f | ||
![]() |
0e4a1e2b73 | ||
![]() |
2e46b796cb | ||
![]() |
cad9484ec0 | ||
![]() |
4beeac3268 |
@ -21,7 +21,7 @@ jobs:
|
|||||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
ARGS: "-rlgoDzvc -i"
|
ARGS: "-rlgoDzvc -i"
|
||||||
SOURCE: target/${{ steps.maven.outputs.artifact-id }}.jar
|
SOURCE: target/${{ steps.maven.outputs.artifact-id }}.jar
|
||||||
REMOTE_HOST: 10.100.130.80
|
REMOTE_HOST: 192.168.88.44
|
||||||
REMOTE_USER: root
|
REMOTE_USER: root
|
||||||
TARGET: /root/apps
|
TARGET: /root/apps
|
||||||
EXCLUDE: ""
|
EXCLUDE: ""
|
||||||
|
7
pom.xml
7
pom.xml
@ -110,10 +110,11 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>cn.idev.excel</groupId>
|
||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>fastexcel</artifactId>
|
||||||
<version>4.0.3</version>
|
<version>1.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
70
springboot.sh
Normal file
70
springboot.sh
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 定义变量
|
||||||
|
APP_NAME="ims"
|
||||||
|
APP_JAR="/ims/app/ims.jar" # 替换为你的 JAR 包路径
|
||||||
|
CONFIG_FILE="/ims/app/application.yml" # 替换为你的配置文件路径
|
||||||
|
LOG_FILE="/ims/app/ims.log" # 日志文件路径
|
||||||
|
PID_FILE="/ims/app/ims.pid" # 保存进程 ID 的文件
|
||||||
|
|
||||||
|
# 启动函数
|
||||||
|
start() {
|
||||||
|
if [ -f "$PID_FILE" ]; then
|
||||||
|
PID=$(cat "$PID_FILE")
|
||||||
|
if ps -p "$PID" > /dev/null; then
|
||||||
|
echo "Application $APP_NAME is already running with PID $PID."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
rm -f "$PID_FILE"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting $APP_NAME..."
|
||||||
|
nohup java -jar "$APP_JAR" --spring.config.location="$CONFIG_FILE" > "$LOG_FILE" 2>&1 &
|
||||||
|
echo $! > "$PID_FILE"
|
||||||
|
echo "Application $APP_NAME started with PID $!."
|
||||||
|
}
|
||||||
|
|
||||||
|
# 停止函数
|
||||||
|
stop() {
|
||||||
|
if [ -f "$PID_FILE" ]; then
|
||||||
|
PID=$(cat "$PID_FILE")
|
||||||
|
if ps -p "$PID" > /dev/null; then
|
||||||
|
echo "Stopping $APP_NAME with PID $PID..."
|
||||||
|
kill "$PID"
|
||||||
|
rm -f "$PID_FILE"
|
||||||
|
echo "Application $APP_NAME stopped."
|
||||||
|
else
|
||||||
|
echo "Application $APP_NAME is not running."
|
||||||
|
rm -f "$PID_FILE"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "PID file not found. Application $APP_NAME may not be running."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 重启函数
|
||||||
|
restart() {
|
||||||
|
stop
|
||||||
|
sleep 2
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
# 脚本入口
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
restart
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
@ -1,34 +1,25 @@
|
|||||||
package tech.riemann.ims.controller.platform.acl;
|
package tech.riemann.ims.controller.platform.acl;
|
||||||
|
|
||||||
import java.util.List;
|
import club.zhcs.lina.starter.exception.BizException;
|
||||||
|
|
||||||
import org.nutz.lang.Strings;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
import club.zhcs.lina.starter.exception.BizException;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nutz.lang.Strings;
|
||||||
|
import org.nutz.lang.random.R;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
import tech.riemann.ims.dto.response.PermissionInfo;
|
import tech.riemann.ims.dto.response.PermissionInfo;
|
||||||
import tech.riemann.ims.entity.acl.Permission;
|
import tech.riemann.ims.entity.acl.Permission;
|
||||||
import tech.riemann.ims.entity.acl.Role;
|
import tech.riemann.ims.entity.acl.Role;
|
||||||
import tech.riemann.ims.service.acl.IRoleService;
|
import tech.riemann.ims.service.acl.IRoleService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 角色 前端控制器
|
* 角色 前端控制器
|
||||||
@ -81,6 +72,7 @@ public class RoleController {
|
|||||||
throw BizException.create("更新角色失败!");
|
throw BizException.create("更新角色失败!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
role.setKey(R.UU16());
|
||||||
if (roleService.save(role)) {
|
if (roleService.save(role)) {
|
||||||
return role;
|
return role;
|
||||||
} else {
|
} else {
|
||||||
|
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@ -86,6 +87,7 @@ public class UserController {
|
|||||||
public User saveOrUpdateUser(@Validated @Parameter(description = "用户") @RequestBody User user) {
|
public User saveOrUpdateUser(@Validated @Parameter(description = "用户") @RequestBody User user) {
|
||||||
if (user.getId() == null || user.getId() <= 0) {
|
if (user.getId() == null || user.getId() <= 0) {
|
||||||
user.setPassword(PasswordUtils.randomSaltEncode(user.getPassword()));
|
user.setPassword(PasswordUtils.randomSaltEncode(user.getPassword()));
|
||||||
|
if(existName(user.getName())) throw BizException.create("用户名已经存在");
|
||||||
if (userService.save(user)) {
|
if (userService.save(user)) {
|
||||||
return user;
|
return user;
|
||||||
} else {
|
} else {
|
||||||
@ -100,6 +102,13 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("user/exist-name")
|
||||||
|
@Operation(summary = "检查用户名是否存在,true存在,false不存在")
|
||||||
|
public boolean existName(@NotBlank String name) {
|
||||||
|
User one = userService.getOne(Wrappers.<User>lambdaQuery().eq(User::getName, name));
|
||||||
|
return one != null;
|
||||||
|
}
|
||||||
|
|
||||||
@DeleteMapping("user/{id}")
|
@DeleteMapping("user/{id}")
|
||||||
@Operation(summary = "删除用户")
|
@Operation(summary = "删除用户")
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
|
@ -1,27 +1,31 @@
|
|||||||
package tech.riemann.ims.controller.platform.material;
|
package tech.riemann.ims.controller.platform.material;
|
||||||
|
|
||||||
|
import club.zhcs.lina.starter.exception.BizException;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.poi.util.StringUtil;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import tech.riemann.ims.dto.request.ApplyInfo;
|
import tech.riemann.ims.dto.request.ApplyInfo;
|
||||||
import tech.riemann.ims.dto.request.AuditApplyInfo;
|
import tech.riemann.ims.dto.request.AuditApplyInfo;
|
||||||
import tech.riemann.ims.dto.request.ReviewDTO;
|
import tech.riemann.ims.dto.request.ReviewDTO;
|
||||||
import tech.riemann.ims.dto.response.ApplyDTO;
|
import tech.riemann.ims.dto.response.*;
|
||||||
import tech.riemann.ims.dto.response.ComparisonResDTO;
|
|
||||||
import tech.riemann.ims.dto.response.StockDetailInfo;
|
|
||||||
import tech.riemann.ims.entity.material.*;
|
import tech.riemann.ims.entity.material.*;
|
||||||
import tech.riemann.ims.enums.*;
|
import tech.riemann.ims.enums.*;
|
||||||
import tech.riemann.ims.service.material.*;
|
import tech.riemann.ims.service.material.*;
|
||||||
|
import tech.riemann.ims.utils.ExcelUtil;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -41,7 +45,11 @@ public class ApplyFormController {
|
|||||||
private final IMaterialService materialService;
|
private final IMaterialService materialService;
|
||||||
private final IStocktakingScanDetailService stocktakingScanDetailService;
|
private final IStocktakingScanDetailService stocktakingScanDetailService;
|
||||||
private final IStocktakingScanExceptionalDataService stocktakingScanExceptionalDataService;
|
private final IStocktakingScanExceptionalDataService stocktakingScanExceptionalDataService;
|
||||||
|
private final ITypeService typeService;
|
||||||
|
private final IManualStockDetailService manualStockDetailService;
|
||||||
|
|
||||||
|
// 缓存需要审核的报废出库数据 key是申请id,value是材料库存详情列表
|
||||||
|
private final Map<String, List<String>> scrapOutCacheMap = new HashMap<>();
|
||||||
|
|
||||||
@GetMapping("applies")
|
@GetMapping("applies")
|
||||||
@Operation(summary = "分页查询申请列表")
|
@Operation(summary = "分页查询申请列表")
|
||||||
@ -50,9 +58,32 @@ public class ApplyFormController {
|
|||||||
@Parameter(description = "页面大小") @RequestParam(name = "size", required = false, defaultValue = "10") int size,
|
@Parameter(description = "页面大小") @RequestParam(name = "size", required = false, defaultValue = "10") int size,
|
||||||
@Parameter(description = "申请类型(1入库 3出库 4盘点)") @RequestParam(name = "applyType") Integer applyType,
|
@Parameter(description = "申请类型(1入库 3出库 4盘点)") @RequestParam(name = "applyType") Integer applyType,
|
||||||
@Parameter(description = "物料类型") @RequestParam(name = "type", required = false) String type,
|
@Parameter(description = "物料类型") @RequestParam(name = "type", required = false) String type,
|
||||||
@Parameter(description = "物料编码") @RequestParam(name = "code", required = false) String code,
|
@Parameter(description = "编码/名称") @RequestParam(name = "key", required = false) String key) {
|
||||||
@Parameter(description = "物料名称") @RequestParam(name = "name", required = false) String name) {
|
String[] types = StringUtils.isNotBlank(type) ? type.split(",") : new String[0];
|
||||||
return applyFormService.search(page, size, applyType, type, code, name);
|
IPage<ApplyDTO> result = applyFormService.search(page, size, applyType, List.of(types), key);
|
||||||
|
result.getRecords().forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("apply/download-excel")
|
||||||
|
@Operation(summary = "导出申请单列表")
|
||||||
|
public void downloadExcel(@Parameter(description = "申请类型(1入库 3出库 4盘点)") @RequestParam(name = "applyType") Integer applyType,
|
||||||
|
@Parameter(description = "物料类型") @RequestParam(name = "type", required = false) String type,
|
||||||
|
@Parameter(description = "编码/名称") @RequestParam(name = "key", required = false) String key,
|
||||||
|
HttpServletResponse response) {
|
||||||
|
IPage<ApplyDTO> applyDTOIPage = searchPage(1, 10000, applyType, type, key);
|
||||||
|
List<ApplyDTO> applyDTOList = applyDTOIPage.getRecords();
|
||||||
|
// 导出excel
|
||||||
|
String sheetName = "申请单列表";
|
||||||
|
String excelName = "申请单列表";
|
||||||
|
if (applyType == 1) {
|
||||||
|
excelName = "入库申请单列表";
|
||||||
|
sheetName = "入库";
|
||||||
|
} else if (applyType == 3) {
|
||||||
|
excelName = "出库申请单列表";
|
||||||
|
sheetName = "出库";
|
||||||
|
}
|
||||||
|
ExcelUtil.exportExcel(response, excelName, sheetName, ApplyDTO.class, applyDTOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("audit-applies")
|
@GetMapping("audit-applies")
|
||||||
@ -67,13 +98,30 @@ public class ApplyFormController {
|
|||||||
return applyFormService.page(Page.of(page, size), Wrappers.<ApplyForm>lambdaQuery()
|
return applyFormService.page(Page.of(page, size), Wrappers.<ApplyForm>lambdaQuery()
|
||||||
.eq(auditType != null, ApplyForm::getAuditType, auditType)
|
.eq(auditType != null, ApplyForm::getAuditType, auditType)
|
||||||
.eq(ApplyForm::getType, ApplyTypeEnum.AUDIT)
|
.eq(ApplyForm::getType, ApplyTypeEnum.AUDIT)
|
||||||
.eq(taker != null, ApplyForm::getTaker, taker)
|
.like(StringUtil.isNotBlank(taker), ApplyForm::getTaker, "%" + taker + "%")
|
||||||
.eq(createDate != null, ApplyForm::getCreatedTime, createDate)
|
.ge(createDate != null, ApplyForm::getCreatedTime, createDate)
|
||||||
.in(reviewResults != null && !reviewResults.isEmpty(), ApplyForm::getReviewResult, reviewResults)
|
.in(reviewResults != null && !reviewResults.isEmpty(), ApplyForm::getReviewResult, reviewResults)
|
||||||
.orderByDesc(ApplyForm::getCreatedTime)
|
.orderByDesc(ApplyForm::getCreatedTime)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("apply/audit/download-excel")
|
||||||
|
@Operation(summary = "导出盘点申请单列表")
|
||||||
|
public void downloadAuditExcel(@Parameter(description = "盘点类型") @RequestParam(name = "auditType", required = false) AuditTypeEnum auditType,
|
||||||
|
@Parameter(description = "盘点人") @RequestParam(name = "taker", required = false) String taker,
|
||||||
|
@Parameter(description = "创建日期") @RequestParam(name = "createDate", required = false) LocalDateTime createDate,
|
||||||
|
@Parameter(description = "审核状态") @RequestParam(name = "reviewResults", required = false) List<ReviewResultEnum> reviewResults,
|
||||||
|
HttpServletResponse response) {
|
||||||
|
IPage<ApplyForm> applyFormIPage = searchAuditPage(1, 10000, auditType, taker, createDate, reviewResults);
|
||||||
|
List<ApplyForm> applyFormList = applyFormIPage.getRecords();
|
||||||
|
// 导出excel
|
||||||
|
String excelName = "盘点申请单列表";
|
||||||
|
String sheetName = "盘点";
|
||||||
|
ExcelUtil.exportExcel(response, excelName, sheetName, ApplyForm.class, applyFormList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("apply/{applyId}")
|
@GetMapping("apply/{applyId}")
|
||||||
@Operation(summary = "查询申请单详情")
|
@Operation(summary = "查询申请单详情")
|
||||||
public ApplyInfo detail(@Parameter(description = "申请单ID") @PathVariable(name = "applyId") Integer applyId) {
|
public ApplyInfo detail(@Parameter(description = "申请单ID") @PathVariable(name = "applyId") Integer applyId) {
|
||||||
@ -93,20 +141,24 @@ public class ApplyFormController {
|
|||||||
|
|
||||||
// 校验物料数量
|
// 校验物料数量
|
||||||
Map<Long, Integer> confirmMap = applyInfo.getApplyDetails().stream()
|
Map<Long, Integer> confirmMap = applyInfo.getApplyDetails().stream()
|
||||||
.filter(item -> item.getAssignRule() != AssignRuleEnum.LOW_VALUE)
|
.filter(ApplyDetail::getAssignRule)
|
||||||
.collect(Collectors.toMap(ApplyDetail::getMaterialId, ApplyDetail::getConfirmQuantity));
|
.collect(Collectors.toMap(ApplyDetail::getMaterialId, ApplyDetail::getConfirmQuantity));
|
||||||
Map<Long, Long> dataMap = applyInfo.getDetailList().stream()
|
Map<Long, Long> dataMap = applyInfo.getDetailList().stream()
|
||||||
.collect(Collectors.groupingBy(MaterialStockDetail::getMaterialId, Collectors.counting()));
|
.collect(Collectors.groupingBy(MaterialStockDetail::getMaterialId, Collectors.counting()));
|
||||||
confirmMap.forEach((k, v) -> {
|
confirmMap.forEach((k, v) -> {
|
||||||
Long l = dataMap.get(k);
|
Long l = dataMap.get(k);
|
||||||
if (l == null || l.intValue() != v) {
|
if (l == null || l.intValue() != v) {
|
||||||
throw new IllegalArgumentException("[" + k + "]物料数量不匹配");
|
throw BizException.create("[" + k + "]物料数量不匹配");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 新增申请单
|
// 新增申请单
|
||||||
applyFormService.save(applyInfo.getApplyForm());
|
applyFormService.save(applyInfo.getApplyForm());
|
||||||
for (ApplyDetail applyDetail : applyInfo.getApplyDetails()) {
|
for (ApplyDetail applyDetail : applyInfo.getApplyDetails()) {
|
||||||
applyDetail.setApplyId(applyInfo.getApplyForm().getId());
|
applyDetail.setApplyId(applyInfo.getApplyForm().getId());
|
||||||
|
// 如果市无须赋码的情况,设置确认数量为申请数量
|
||||||
|
if (!applyDetail.getAssignRule()) {
|
||||||
|
applyDetail.setConfirmQuantity(applyDetail.getQuantity());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
applyDetailService.saveBatch(applyInfo.getApplyDetails());
|
applyDetailService.saveBatch(applyInfo.getApplyDetails());
|
||||||
|
|
||||||
@ -123,9 +175,9 @@ public class ApplyFormController {
|
|||||||
applyInfo.getApplyDetails().forEach(detail ->
|
applyInfo.getApplyDetails().forEach(detail ->
|
||||||
materialService.update(Wrappers.<Material>lambdaUpdate()
|
materialService.update(Wrappers.<Material>lambdaUpdate()
|
||||||
.eq(Material::getId, detail.getMaterialId())
|
.eq(Material::getId, detail.getMaterialId())
|
||||||
.setSql(detail.getAssignRule() == AssignRuleEnum.HIGH_VALUE,
|
.setSql(detail.getAssignRule(),
|
||||||
"m_stock = m_stock + " + detail.getConfirmQuantity())
|
"m_stock = m_stock + " + detail.getConfirmQuantity())
|
||||||
.setSql(detail.getAssignRule() == AssignRuleEnum.LOW_VALUE,
|
.setSql(!detail.getAssignRule(),
|
||||||
"m_stock = m_stock + " + detail.getQuantity())
|
"m_stock = m_stock + " + detail.getQuantity())
|
||||||
));
|
));
|
||||||
} else if (applyType == ApplyTypeEnum.LOAN_OUT) {
|
} else if (applyType == ApplyTypeEnum.LOAN_OUT) {
|
||||||
@ -138,9 +190,9 @@ public class ApplyFormController {
|
|||||||
//修改物料库存数据
|
//修改物料库存数据
|
||||||
applyInfo.getApplyDetails().forEach(detail -> materialService.update(Wrappers.<Material>lambdaUpdate()
|
applyInfo.getApplyDetails().forEach(detail -> materialService.update(Wrappers.<Material>lambdaUpdate()
|
||||||
.eq(Material::getId, detail.getMaterialId())
|
.eq(Material::getId, detail.getMaterialId())
|
||||||
.setSql(detail.getAssignRule() == AssignRuleEnum.HIGH_VALUE,
|
.setSql(detail.getAssignRule(),
|
||||||
"m_stock = m_stock - " + detail.getConfirmQuantity())
|
"m_stock = m_stock - " + detail.getConfirmQuantity())
|
||||||
.setSql(detail.getAssignRule() == AssignRuleEnum.LOW_VALUE,
|
.setSql(!detail.getAssignRule(),
|
||||||
"m_stock = m_stock - " + detail.getQuantity())
|
"m_stock = m_stock - " + detail.getQuantity())
|
||||||
));
|
));
|
||||||
} else if (applyType == ApplyTypeEnum.RETURN_RECEIPT) {
|
} else if (applyType == ApplyTypeEnum.RETURN_RECEIPT) {
|
||||||
@ -153,15 +205,64 @@ public class ApplyFormController {
|
|||||||
//修改物料库存数据
|
//修改物料库存数据
|
||||||
applyInfo.getApplyDetails().forEach(detail -> materialService.update(Wrappers.<Material>lambdaUpdate()
|
applyInfo.getApplyDetails().forEach(detail -> materialService.update(Wrappers.<Material>lambdaUpdate()
|
||||||
.eq(Material::getId, detail.getMaterialId())
|
.eq(Material::getId, detail.getMaterialId())
|
||||||
.setSql(detail.getAssignRule() == AssignRuleEnum.HIGH_VALUE,
|
.setSql(detail.getAssignRule(),
|
||||||
"m_stock = m_stock + " + detail.getConfirmQuantity())
|
"m_stock = m_stock + " + detail.getConfirmQuantity())
|
||||||
.setSql(detail.getAssignRule() == AssignRuleEnum.LOW_VALUE,
|
.setSql(!detail.getAssignRule(),
|
||||||
"m_stock = m_stock + " + detail.getQuantity())
|
"m_stock = m_stock + " + detail.getQuantity())
|
||||||
));
|
));
|
||||||
|
} else if (applyType == ApplyTypeEnum.SCRAP_OUT) {
|
||||||
|
// 将扫码的数据缓存起来方便下次使用
|
||||||
|
List<String> list = applyInfo.getDetailList().stream().map(MaterialStockDetail::getBarcode).toList();
|
||||||
|
scrapOutCacheMap.put(applyInfo.getApplyForm().getId().toString(), list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("scrap-out/{applyId}")
|
||||||
|
@Operation(summary = "获取报废出库申请单")
|
||||||
|
public List<ScrapOutApplyDTO> getScrapOutById(@Parameter(description = "申请单ID") @PathVariable(name = "applyId") Integer applyId) {
|
||||||
|
List<ScrapOutApplyDTO> result = applyDetailService.getScrapOutById(applyId);
|
||||||
|
result.forEach(item -> item
|
||||||
|
.setTypeName(typeService.getTypeName(item.getType()))
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("scrap-out-review")
|
||||||
|
@Operation(summary = "提交报废出库审核")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void submitScrapOutReview(@Parameter(description = "异常数据列表") @RequestBody ReviewDTO reviewDTO) {
|
||||||
|
//修改申请状态
|
||||||
|
applyFormService.update(Wrappers.<ApplyForm>lambdaUpdate()
|
||||||
|
.set(ApplyForm::getReviewResult, reviewDTO.getReviewResult())
|
||||||
|
.set(ApplyForm::getReviewRemark, reviewDTO.getRemark())
|
||||||
|
.set(ApplyForm::getConfirm, Boolean.TRUE)
|
||||||
|
.eq(ApplyForm::getId, reviewDTO.getApplyId()));
|
||||||
|
if (reviewDTO.getReviewResult() == ReviewResultEnum.PASS) {
|
||||||
|
// 修改物料状态
|
||||||
|
List<String> barcodeList = scrapOutCacheMap.get(reviewDTO.getApplyId());
|
||||||
|
if (barcodeList != null) {
|
||||||
|
barcodeList.forEach(barcode -> materialStockDetailService.update(Wrappers.<MaterialStockDetail>lambdaUpdate()
|
||||||
|
.set(MaterialStockDetail::getStatus, StockStatusEnum.SCRAP_OUT)
|
||||||
|
.eq(MaterialStockDetail::getBarcode, barcode)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 处理报废扣减库存
|
||||||
|
List<ApplyDetail> applyDetails = applyDetailService.list(Wrappers.<ApplyDetail>lambdaQuery()
|
||||||
|
.eq(ApplyDetail::getApplyId, reviewDTO.getApplyId()));
|
||||||
|
if (!applyDetails.isEmpty()) {
|
||||||
|
// 直接扣库存
|
||||||
|
applyDetails.forEach(detail ->
|
||||||
|
materialService.update(Wrappers.<Material>lambdaUpdate()
|
||||||
|
.setSql("m_stock = m_stock - " + detail.getQuantity())
|
||||||
|
.eq(Material::getId, detail.getMaterialId())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// 删除缓存
|
||||||
|
scrapOutCacheMap.remove(reviewDTO.getApplyId());
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("audit-apply")
|
@PostMapping("audit-apply")
|
||||||
@Operation(summary = "提交盘点申请单")
|
@Operation(summary = "提交盘点申请单")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ -169,14 +270,55 @@ public class ApplyFormController {
|
|||||||
ApplyForm applyForm = applyInfo.to();
|
ApplyForm applyForm = applyInfo.to();
|
||||||
applyForm.setType(ApplyTypeEnum.AUDIT);
|
applyForm.setType(ApplyTypeEnum.AUDIT);
|
||||||
applyFormService.save(applyForm);
|
applyFormService.save(applyForm);
|
||||||
|
|
||||||
List<Material> materials = materialService.listByIds(applyInfo.getIds());
|
List<Material> materials = materialService.listByIds(applyInfo.getIds());
|
||||||
|
|
||||||
materials.forEach(material -> applyDetailService.save(ApplyDetail.builder()
|
materials.forEach(material -> applyDetailService.save(ApplyDetail.builder()
|
||||||
.applyId(applyForm.getId())
|
.applyId(applyForm.getId())
|
||||||
.materialId(material.getId())
|
.materialId(material.getId())
|
||||||
.quantity(material.getStock())
|
.quantity(material.getStock())
|
||||||
.build()));
|
.build()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("manual/check-data/{applyId}")
|
||||||
|
@Operation(summary = "查询人工盘点选中物料的待核查数据")
|
||||||
|
public List<Material> getManualCheckData(@Parameter(description = "申请单ID") @PathVariable(name = "applyId") Long applyId){
|
||||||
|
List<ApplyDetail> details = applyDetailService.list(Wrappers.<ApplyDetail>lambdaQuery().eq(ApplyDetail::getApplyId, applyId));
|
||||||
|
List<Long> materialIds = details.stream().map(ApplyDetail::getMaterialId).toList();
|
||||||
|
if(materialIds.isEmpty()){
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<Material> result = materialService.listByIds(materialIds);
|
||||||
|
result.stream().filter(i -> !i.getAssignRule()).forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("manual/audit-apply")
|
||||||
|
@Operation(summary = "提交人工盘点数据")
|
||||||
|
public void submitManualStock(@Validated @Parameter(description = "人工盘点数据") @RequestBody List<ManualStockDetail> details) {
|
||||||
|
if (details.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
manualStockDetailService.saveBatch(details);
|
||||||
|
//修改状态
|
||||||
|
applyFormService.update(Wrappers.<ApplyForm>lambdaUpdate()
|
||||||
|
.eq(ApplyForm::getId, details.get(0).getApplyId())
|
||||||
|
.set(ApplyForm::getReviewResult, ReviewResultEnum.WAIT_REVIEW));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("manual/data/{applyId}")
|
||||||
|
@Operation(summary = "获取人工盘点数据")
|
||||||
|
public List<ManualStockDTO> getManualStock(@Parameter(description = "申请单ID") @PathVariable(name = "applyId") Long applyId) {
|
||||||
|
List<ManualStockDTO> result = manualStockDetailService.getByApplyId(applyId);
|
||||||
|
result.forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("wait-scan-data/{applyId}")
|
||||||
|
@Operation(summary = "获取盘点的待扫码信息")
|
||||||
|
public List<WaitScanInfo> getWaitScanData(@Parameter(description = "申请单ID") @PathVariable(name = "applyId") Long applyId) {
|
||||||
|
return applyDetailService.getWaitScanData(applyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("scan-data/{applyId}")
|
@PostMapping("scan-data/{applyId}")
|
||||||
@ -242,20 +384,52 @@ public class ApplyFormController {
|
|||||||
|
|
||||||
@PostMapping("submit-review")
|
@PostMapping("submit-review")
|
||||||
@Operation(summary = "提交审核")
|
@Operation(summary = "提交审核")
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void submitReview(@Parameter(description = "异常数据列表") @RequestBody ReviewDTO reviewDTO) {
|
public void submitReview(@Parameter(description = "异常数据列表") @RequestBody ReviewDTO reviewDTO) {
|
||||||
applyFormService.update(Wrappers.<ApplyForm>lambdaUpdate()
|
applyFormService.update(Wrappers.<ApplyForm>lambdaUpdate()
|
||||||
.set(ApplyForm::getReviewResult, reviewDTO.getReviewResult())
|
.set(ApplyForm::getReviewResult, reviewDTO.getReviewResult())
|
||||||
.set(reviewDTO.getReviewResult() == ReviewResultEnum.PASS, ApplyForm::getConfirm, Boolean.TRUE)
|
.set(reviewDTO.getReviewResult() == ReviewResultEnum.PASS, ApplyForm::getConfirm, Boolean.TRUE)
|
||||||
.set(ApplyForm::getReviewRemark, reviewDTO.getRemark())
|
.set(ApplyForm::getReviewRemark, reviewDTO.getRemark())
|
||||||
.eq(ApplyForm::getId, reviewDTO.getApplyId()));
|
.eq(ApplyForm::getId, reviewDTO.getApplyId()));
|
||||||
if(reviewDTO.getReviewResult() == ReviewResultEnum.PASS){
|
ApplyForm byId = applyFormService.getById(reviewDTO.getApplyId());
|
||||||
|
if (byId.getAuditType() == AuditTypeEnum.MANUAL) {
|
||||||
|
if (reviewDTO.getReviewResult() != ReviewResultEnum.PASS) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<ManualStockDetail> details = manualStockDetailService.list(Wrappers.<ManualStockDetail>lambdaQuery()
|
||||||
|
.eq(ManualStockDetail::getApplyId, reviewDTO.getApplyId()));
|
||||||
|
details.forEach(detail -> materialService.update(Wrappers.<Material>lambdaUpdate()
|
||||||
|
.set(Material::getStock, detail.getManualStock())
|
||||||
|
.eq(Material::getId, detail.getMaterialId())));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (reviewDTO.getReviewResult() == ReviewResultEnum.PASS) {
|
||||||
//修改库存明细状态和库存数量
|
//修改库存明细状态和库存数量
|
||||||
List<StocktakingScanExceptionalData> list = stocktakingScanExceptionalDataService.list(Wrappers.<StocktakingScanExceptionalData>lambdaQuery()
|
List<StocktakingScanExceptionalData> list = stocktakingScanExceptionalDataService.list(Wrappers.<StocktakingScanExceptionalData>lambdaQuery()
|
||||||
.eq(StocktakingScanExceptionalData::getApplyId, reviewDTO.getApplyId()));
|
.eq(StocktakingScanExceptionalData::getApplyId, reviewDTO.getApplyId()));
|
||||||
list.forEach(data -> {
|
list.forEach(data -> {
|
||||||
// if(data.getExceptionHandle() == StocktakingExceptonalStatusEnum.SOCK_OUT_BUT_SCAN_EXIST){
|
// 新入库 归还 丢失 需要处理
|
||||||
//
|
if (data.getExceptionHandle() == HandleEnum.MARK_NEW) {
|
||||||
// }
|
// 新增库存明细 和 增加库存数量
|
||||||
|
materialStockDetailService.save(MaterialStockDetail.builder()
|
||||||
|
.applyId(null)
|
||||||
|
.materialId(data.getMaterialId())
|
||||||
|
.barcode(data.getBarcode())
|
||||||
|
.status(StockStatusEnum.IN)
|
||||||
|
.build());
|
||||||
|
materialService.update(Wrappers.<Material>lambdaUpdate()
|
||||||
|
.setSql("m_stock = m_stock + " + 1)
|
||||||
|
.eq(Material::getId, data.getMaterialId()));
|
||||||
|
} else if (data.getExceptionHandle() == HandleEnum.MARK_RETURN || data.getExceptionHandle() == HandleEnum.MARK_LOST) {
|
||||||
|
materialStockDetailService.update(Wrappers.<MaterialStockDetail>lambdaUpdate()
|
||||||
|
.set(MaterialStockDetail::getStatus, data.getExceptionHandle() == HandleEnum.MARK_RETURN
|
||||||
|
? StockStatusEnum.IN : StockStatusEnum.LOST)
|
||||||
|
.eq(MaterialStockDetail::getBarcode, data.getBarcode()));
|
||||||
|
materialService.update(Wrappers.<Material>lambdaUpdate()
|
||||||
|
.setSql(data.getExceptionHandle() == HandleEnum.MARK_RETURN, "m_stock = m_stock + " + 1)
|
||||||
|
.setSql(data.getExceptionHandle() == HandleEnum.MARK_LOST, "m_stock = m_stock - " + 1)
|
||||||
|
.eq(Material::getId, data.getMaterialId()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,7 +487,7 @@ public class ApplyFormController {
|
|||||||
private Map<Long, List<MaterialStockDetail>> getStockMap(Long applyId) {
|
private Map<Long, List<MaterialStockDetail>> getStockMap(Long applyId) {
|
||||||
ApplyForm applyForm = applyFormService.getById(applyId);
|
ApplyForm applyForm = applyFormService.getById(applyId);
|
||||||
List<Long> materialIds = new ArrayList<>();
|
List<Long> materialIds = new ArrayList<>();
|
||||||
if (applyForm.getAuditType() == AuditTypeEnum.PARTIAL) {
|
if (applyForm.getAuditType() == AuditTypeEnum.MANUAL) {
|
||||||
// 部分盘点
|
// 部分盘点
|
||||||
List<ApplyDetail> applyDetails = applyDetailService.list(Wrappers.<ApplyDetail>lambdaQuery().eq(ApplyDetail::getApplyId, applyId));
|
List<ApplyDetail> applyDetails = applyDetailService.list(Wrappers.<ApplyDetail>lambdaQuery().eq(ApplyDetail::getApplyId, applyId));
|
||||||
materialIds = applyDetails.stream().map(ApplyDetail::getMaterialId).toList();
|
materialIds = applyDetails.stream().map(ApplyDetail::getMaterialId).toList();
|
||||||
|
@ -10,8 +10,10 @@ import com.google.common.cache.LoadingCache;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nutz.lang.Strings;
|
import org.nutz.lang.Strings;
|
||||||
import org.nutz.lang.random.R;
|
import org.nutz.lang.random.R;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@ -19,8 +21,12 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import tech.riemann.ims.entity.material.Material;
|
import tech.riemann.ims.entity.material.Material;
|
||||||
import tech.riemann.ims.service.material.IMaterialService;
|
import tech.riemann.ims.service.material.IMaterialService;
|
||||||
|
import tech.riemann.ims.service.material.ITypeService;
|
||||||
|
import tech.riemann.ims.utils.BarcodeUtil;
|
||||||
|
import tech.riemann.ims.utils.ExcelUtil;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -36,6 +42,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class MaterialController {
|
public class MaterialController {
|
||||||
|
|
||||||
private final IMaterialService materialService;
|
private final IMaterialService materialService;
|
||||||
|
private final ITypeService typeService;
|
||||||
|
|
||||||
LoadingCache<String, String> cache = CacheBuilder.newBuilder()
|
LoadingCache<String, String> cache = CacheBuilder.newBuilder()
|
||||||
.concurrencyLevel(8)
|
.concurrencyLevel(8)
|
||||||
@ -43,7 +50,7 @@ public class MaterialController {
|
|||||||
.initialCapacity(10)
|
.initialCapacity(10)
|
||||||
.maximumSize(300)
|
.maximumSize(300)
|
||||||
.recordStats()
|
.recordStats()
|
||||||
.build(new CacheLoader<String,String>() {
|
.build(new CacheLoader<String, String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@ -58,23 +65,36 @@ public class MaterialController {
|
|||||||
public IPage<Material> materials(
|
public IPage<Material> materials(
|
||||||
@Parameter(description = "页码") @RequestParam(required = false, defaultValue = "1") int page,
|
@Parameter(description = "页码") @RequestParam(required = false, defaultValue = "1") int page,
|
||||||
@Parameter(description = "页面大小") @RequestParam(required = false, defaultValue = "10") int size,
|
@Parameter(description = "页面大小") @RequestParam(required = false, defaultValue = "10") int size,
|
||||||
@Parameter(description = "类型") @RequestParam(required = false, defaultValue = "") Integer type,
|
@Parameter(description = "类型") @RequestParam(required = false, defaultValue = "") String type,
|
||||||
@Parameter(description = "搜索关键词") @RequestParam(required = false, defaultValue = "") String key) {
|
@Parameter(description = "搜索关键词") @RequestParam(required = false, defaultValue = "") String key) {
|
||||||
boolean hasLike = Strings.isNotBlank(key);
|
String[] types = StringUtils.isNotBlank(type) ? type.split(",") : new String[0];
|
||||||
key = String.format("%%%s%%", key);
|
Page<Material> result = materialService.getPage(Page.of(page, size), List.of(types),key);
|
||||||
return materialService.page(Page.of(page, size),Wrappers.<Material>lambdaQuery()
|
result.getRecords().forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
|
||||||
|
return result;
|
||||||
.like(hasLike, Material::getName, key)
|
|
||||||
.or()
|
|
||||||
.like(hasLike, Material::getCode, key)
|
|
||||||
.eq(type != null, Material::getType, type)
|
|
||||||
.orderByDesc(Material::getUpdatedTime));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("material/list")
|
@GetMapping("material/download-excel")
|
||||||
|
@Operation(summary = "导出物料列表")
|
||||||
|
public void downloadExcel(@Parameter(description = "类型") @RequestParam(required = false, defaultValue = "") String type,
|
||||||
|
@Parameter(description = "搜索关键词") @RequestParam(required = false, defaultValue = "") String key,
|
||||||
|
HttpServletResponse response) {
|
||||||
|
String[] types = StringUtils.isNotBlank(type) ? type.split(",") : new String[0];
|
||||||
|
Page<Material> result = materialService.getPage(Page.of(1, 10000), List.of(types),key);
|
||||||
|
result.getRecords().forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
|
||||||
|
ExcelUtil.exportExcel(response, "物料列表-" + System.currentTimeMillis(), "库存", Material.class, result.getRecords());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("material/list")
|
||||||
@Operation(summary = "查询所有物料列表")
|
@Operation(summary = "查询所有物料列表")
|
||||||
public List<Material> all(){
|
public List<Material> all(@Parameter(description = "类型") @RequestParam(required = false, defaultValue = "") String type,
|
||||||
return materialService.list();
|
@Parameter(description = "是否赋码") @RequestParam(required = false) Boolean assignRule) {
|
||||||
|
String[] types = StringUtils.isNotBlank(type) ? type.split(",") : new String[0];
|
||||||
|
List<Material> materials = materialService.queryLikeRight(List.of(types));
|
||||||
|
if (assignRule != null) {
|
||||||
|
materials.removeIf(item -> assignRule != item.getAssignRule());
|
||||||
|
}
|
||||||
|
materials.forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
|
||||||
|
return materials;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("material/{id}")
|
@GetMapping("material/{id}")
|
||||||
@ -95,7 +115,7 @@ public class MaterialController {
|
|||||||
throw BizException.create("保存物料失败!");
|
throw BizException.create("保存物料失败!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (materialService.update(material, Wrappers.<Material> lambdaUpdate().eq(Material::getId, material.getId()))) {
|
if (materialService.update(material, Wrappers.<Material>lambdaUpdate().eq(Material::getId, material.getId()))) {
|
||||||
return material;
|
return material;
|
||||||
} else {
|
} else {
|
||||||
throw BizException.create("更新物料失败!");
|
throw BizException.create("更新物料失败!");
|
||||||
@ -106,7 +126,8 @@ public class MaterialController {
|
|||||||
private String getCode() {
|
private String getCode() {
|
||||||
String code;
|
String code;
|
||||||
while (true) {
|
while (true) {
|
||||||
code = String.valueOf(R.random(100000, 999999));
|
code = String.valueOf(R.random(10000, 99999));
|
||||||
|
// 需要和前端scan-form.vue中的autoInsertOneRow方法的切割联动修改
|
||||||
try {
|
try {
|
||||||
// 如果代码已经存在,继续循环
|
// 如果代码已经存在,继续循环
|
||||||
if (Strings.isBlank(cache.get(code))) {
|
if (Strings.isBlank(cache.get(code))) {
|
||||||
@ -127,4 +148,21 @@ public class MaterialController {
|
|||||||
throw BizException.create("删除物料失败!");
|
throw BizException.create("删除物料失败!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 批量生成条形码
|
||||||
|
@PostMapping("material/{id}/generate-barcodes")
|
||||||
|
@Operation(summary = "批量生成条形码")
|
||||||
|
public List<String> generateBarcodes(@Parameter(description = "物料id", required = true) @PathVariable Long id,
|
||||||
|
@Parameter(description = "条形码数量", required = true) @RequestParam(name = "count") int count) {
|
||||||
|
List<String> res = new ArrayList<>();
|
||||||
|
Material byId = materialService.getById(id);
|
||||||
|
if (byId != null && count > 0) {
|
||||||
|
String code = byId.getCode();
|
||||||
|
while (count-- > 0) {
|
||||||
|
res.add(code + BarcodeUtil.generateBarcode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("生成条形码成功,条形码列表:{}", res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
package tech.riemann.ims.controller.platform.material;
|
||||||
|
|
||||||
|
import club.zhcs.lina.starter.exception.BizException;
|
||||||
|
import club.zhcs.lina.utils.enums.Codebook;
|
||||||
|
import club.zhcs.lina.utils.enums.ICodeBook;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nutz.lang.Strings;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import tech.riemann.ims.dto.response.TypeTree;
|
||||||
|
import tech.riemann.ims.entity.material.Type;
|
||||||
|
import tech.riemann.ims.service.material.ITypeService;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2025/3/2 14:14
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@Tag(name = "Type", description = "物料类型管理")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TypeController {
|
||||||
|
|
||||||
|
private final ITypeService typeService;
|
||||||
|
|
||||||
|
@GetMapping("areas")
|
||||||
|
@Operation(summary = "查询类型")
|
||||||
|
public List<Type> areas(
|
||||||
|
@Parameter(description = "搜索关键词") @RequestParam(required = false, defaultValue = "") String key) {
|
||||||
|
boolean hasLike = Strings.isNotBlank(key);
|
||||||
|
key = String.format("%%%s%%", key);
|
||||||
|
return typeService.list(
|
||||||
|
Wrappers.<Type>lambdaQuery()
|
||||||
|
.like(hasLike, Type::getName, key));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("area")
|
||||||
|
@Operation(summary = "增加/更新地区")
|
||||||
|
public Type addAndModify(@Validated @Parameter(description = "类型") @RequestBody Type area) {
|
||||||
|
if (area.getId() == null) {
|
||||||
|
typeService.save(area);
|
||||||
|
} else {
|
||||||
|
typeService.updateById(area);
|
||||||
|
}
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("area/{id}")
|
||||||
|
@Operation(summary = "删除类型")
|
||||||
|
public void deleteArea(@Parameter(description = "id", required = true) @PathVariable long id) {
|
||||||
|
if (!typeService.removeById(id)) {
|
||||||
|
throw BizException.create("删除失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("area/levels")
|
||||||
|
@Operation(summary = "级别")
|
||||||
|
public List<Codebook> levels() {
|
||||||
|
return Arrays.stream(Type.Level.values()).map(ICodeBook::build).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("area/trees")
|
||||||
|
@Operation(summary = "类型树")
|
||||||
|
public List<TypeTree> trees() {
|
||||||
|
List<Type> all = typeService.list();
|
||||||
|
List<TypeTree> data = all.stream().map(area -> TypeTree.builder()
|
||||||
|
.value(area.getNo())
|
||||||
|
.label(area.getName())
|
||||||
|
.parentNo(area.getParentNo())
|
||||||
|
.build())
|
||||||
|
.toList();
|
||||||
|
return TypeTree.buildTree(data, "0");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package tech.riemann.ims.converter;
|
||||||
|
|
||||||
|
import cn.idev.excel.converters.Converter;
|
||||||
|
import cn.idev.excel.metadata.GlobalConfiguration;
|
||||||
|
import cn.idev.excel.metadata.data.WriteCellData;
|
||||||
|
import cn.idev.excel.metadata.property.ExcelContentProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2025/3/15 18:23
|
||||||
|
*/
|
||||||
|
public class BooleanConverter implements Converter<Boolean> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WriteCellData<?> convertToExcelData(Boolean value,
|
||||||
|
ExcelContentProperty contentProperty,
|
||||||
|
GlobalConfiguration globalConfiguration) {
|
||||||
|
|
||||||
|
return new WriteCellData<>(Boolean.TRUE.equals(value) ? "是" : "否");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package tech.riemann.ims.converter;
|
||||||
|
|
||||||
|
import club.zhcs.lina.utils.enums.ICodeBook;
|
||||||
|
import cn.idev.excel.converters.Converter;
|
||||||
|
import cn.idev.excel.metadata.GlobalConfiguration;
|
||||||
|
import cn.idev.excel.metadata.data.WriteCellData;
|
||||||
|
import cn.idev.excel.metadata.property.ExcelContentProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2025/3/15 18:23
|
||||||
|
*/
|
||||||
|
public class ICodeBookConverter implements Converter<ICodeBook> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WriteCellData<?> convertToExcelData(ICodeBook value,
|
||||||
|
ExcelContentProperty contentProperty,
|
||||||
|
GlobalConfiguration globalConfiguration) {
|
||||||
|
|
||||||
|
return new WriteCellData<>(value.getDescription());
|
||||||
|
}
|
||||||
|
}
|
@ -23,6 +23,9 @@ public class AuditApplyInfo extends ApplyForm {
|
|||||||
@Schema(description = "物料ids")
|
@Schema(description = "物料ids")
|
||||||
private List<String> ids;
|
private List<String> ids;
|
||||||
|
|
||||||
|
@Schema(description = "物料类型")
|
||||||
|
private List<String> types;
|
||||||
|
|
||||||
|
|
||||||
public ApplyForm to(){
|
public ApplyForm to(){
|
||||||
return Json.fromJson(ApplyForm.class, Json.toJson(this));
|
return Json.fromJson(ApplyForm.class, Json.toJson(this));
|
||||||
|
@ -1,11 +1,20 @@
|
|||||||
package tech.riemann.ims.dto.response;
|
package tech.riemann.ims.dto.response;
|
||||||
|
|
||||||
|
import club.zhcs.lina.utils.enums.Codebook;
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnore;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.nutz.json.JsonField;
|
||||||
|
import tech.riemann.ims.converter.BooleanConverter;
|
||||||
|
import tech.riemann.ims.converter.ICodeBookConverter;
|
||||||
import tech.riemann.ims.enums.ApplyTypeEnum;
|
import tech.riemann.ims.enums.ApplyTypeEnum;
|
||||||
|
import tech.riemann.ims.enums.ReviewResultEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
@ -17,34 +26,87 @@ import tech.riemann.ims.enums.ApplyTypeEnum;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class ApplyDTO {
|
public class ApplyDTO {
|
||||||
|
|
||||||
|
@Schema(description = "申请id")
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long applyId;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "申请类型")
|
@Schema(description = "申请类型")
|
||||||
|
@ExcelProperty(value = "申请类型", converter = ICodeBookConverter.class)
|
||||||
|
@ColumnWidth(40)
|
||||||
private ApplyTypeEnum applyType;
|
private ApplyTypeEnum applyType;
|
||||||
|
|
||||||
@Schema(description = "物料名称")
|
@Schema(description = "物料名称")
|
||||||
|
@ExcelProperty("物料名称")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "物料编码")
|
@Schema(description = "物料编码")
|
||||||
|
@ExcelProperty("物料编码")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@Schema(description = "物料类型")
|
@Schema(description = "物料类型")
|
||||||
|
@ExcelIgnore
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "类型名称")
|
||||||
|
@ExcelProperty("类型名称")
|
||||||
|
@ColumnWidth(40)
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
@Schema(description = "物料规格")
|
@Schema(description = "物料规格")
|
||||||
|
@ExcelProperty("物料规格")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String spec;
|
private String spec;
|
||||||
|
|
||||||
@Schema(description = "申请人")
|
@Schema(description = "申请人")
|
||||||
|
@ExcelProperty("申请人")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String applicant;
|
private String applicant;
|
||||||
|
|
||||||
|
@Schema(description = "审核人")
|
||||||
|
@ExcelProperty("审核人")
|
||||||
|
@ColumnWidth(40)
|
||||||
|
private String reviewer;
|
||||||
|
|
||||||
@Schema(description = "申请日期")
|
@Schema(description = "申请日期")
|
||||||
|
@ExcelProperty("申请日期")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String applyDate;
|
private String applyDate;
|
||||||
|
|
||||||
@Schema(description = "申请数量")
|
@Schema(description = "申请数量")
|
||||||
|
@ExcelProperty("申请数量")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String applyNum;
|
private String applyNum;
|
||||||
|
|
||||||
@Schema(description = "确认数量")
|
@Schema(description = "确认数量")
|
||||||
|
@ExcelProperty("确认数量")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String confirmNum;
|
private String confirmNum;
|
||||||
|
|
||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "是否确认")
|
||||||
|
@ExcelProperty(value = "是否确认",converter = BooleanConverter.class)
|
||||||
|
@ColumnWidth(40)
|
||||||
|
private Boolean confirm;
|
||||||
|
|
||||||
|
@Schema(description = "审核状态")
|
||||||
|
@ExcelProperty(value = "审核状态", converter = ICodeBookConverter.class)
|
||||||
|
@ColumnWidth(40)
|
||||||
|
private ReviewResultEnum reviewResult;
|
||||||
|
|
||||||
|
@JsonGetter
|
||||||
|
@JsonField
|
||||||
|
public Codebook getApplyTypeInfo() {
|
||||||
|
return applyType == null ? null : applyType.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplyTypeInfo(Codebook areaUnitInfo) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
package tech.riemann.ims.dto.response;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2025/3/9 19:16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ManualStockDTO {
|
||||||
|
|
||||||
|
@Schema(description = "编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "名称" )
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
@Schema(description = "价格")
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
@Schema(description = "规格" )
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
@Schema(description = "申请id")
|
||||||
|
private Long applyId;
|
||||||
|
|
||||||
|
@Schema(description = "物料id")
|
||||||
|
private Long materialId;
|
||||||
|
|
||||||
|
@Schema(description = "库存数量")
|
||||||
|
private Integer stock;
|
||||||
|
|
||||||
|
@Schema(description = "手动核实库存数量")
|
||||||
|
private Integer manualStock;
|
||||||
|
|
||||||
|
@Schema(description = "异常原因")
|
||||||
|
private String msg;
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package tech.riemann.ims.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2025/3/15 10:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class ScrapOutApplyDTO {
|
||||||
|
|
||||||
|
@Schema(description = "物料名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
@Schema(description = "物料规格")
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
@Schema(description = "单价")
|
||||||
|
private String price;
|
||||||
|
|
||||||
|
@Schema(description = "申请人")
|
||||||
|
private String applicant;
|
||||||
|
|
||||||
|
@Schema(description = "确认数量")
|
||||||
|
private Integer confirmQuantity;
|
||||||
|
|
||||||
|
@Schema(description = "条码集合")
|
||||||
|
private String barcodeList;
|
||||||
|
|
||||||
|
@Schema(description = "报废原因")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
36
src/main/java/tech/riemann/ims/dto/response/TypeTree.java
Normal file
36
src/main/java/tech/riemann/ims/dto/response/TypeTree.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package tech.riemann.ims.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2025/1/18 19:20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TypeTree {
|
||||||
|
@Schema(description = "类型编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String value;
|
||||||
|
@Schema(description = "类型名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private String label;
|
||||||
|
private String parentNo;
|
||||||
|
private List<TypeTree> children;
|
||||||
|
|
||||||
|
|
||||||
|
public static List<TypeTree> buildTree(List<TypeTree> data, String root) {
|
||||||
|
return data.stream()
|
||||||
|
.filter(t -> Objects.equals(t.getParentNo(), root))
|
||||||
|
.peek(t -> t.setChildren(buildTree(data, t.getValue()))).
|
||||||
|
collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package tech.riemann.ims.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2024/12/11 14:07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class WaitScanInfo {
|
||||||
|
|
||||||
|
@Schema(description = "物料名称")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
@Schema(description = "物料数量")
|
||||||
|
private Integer count;
|
||||||
|
}
|
@ -1,17 +1,10 @@
|
|||||||
package tech.riemann.ims.entity;
|
package tech.riemann.ims.entity;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import cn.idev.excel.annotation.ExcelIgnore;
|
||||||
|
|
||||||
import org.nutz.dao.entity.annotation.Column;
|
|
||||||
import org.nutz.dao.entity.annotation.Comment;
|
|
||||||
import org.nutz.dao.entity.annotation.Id;
|
|
||||||
import org.nutz.spring.boot.service.entity.Entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder.Default;
|
import lombok.Builder.Default;
|
||||||
@ -20,6 +13,13 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.nutz.dao.entity.annotation.Column;
|
||||||
|
import org.nutz.dao.entity.annotation.Comment;
|
||||||
|
import org.nutz.dao.entity.annotation.Id;
|
||||||
|
import org.nutz.spring.boot.service.entity.Entity;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -37,22 +37,26 @@ public class IdBaseEntity extends Entity {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
|
@ExcelIgnore
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Column("created_time")
|
@Column("created_time")
|
||||||
@Comment("创建时间")
|
@Comment("创建时间")
|
||||||
@TableField("created_time")
|
@TableField("created_time")
|
||||||
@Default
|
@Default
|
||||||
|
@ExcelIgnore
|
||||||
protected LocalDateTime createdTime = LocalDateTime.now();
|
protected LocalDateTime createdTime = LocalDateTime.now();
|
||||||
|
|
||||||
@Column("updated_time")
|
@Column("updated_time")
|
||||||
@TableField("updated_time")
|
@TableField("updated_time")
|
||||||
@Comment("最后更新时间")
|
@Comment("最后更新时间")
|
||||||
@Default
|
@Default
|
||||||
|
@ExcelIgnore
|
||||||
protected LocalDateTime updatedTime = LocalDateTime.now();
|
protected LocalDateTime updatedTime = LocalDateTime.now();
|
||||||
|
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
@ -60,6 +64,7 @@ public class IdBaseEntity extends Entity {
|
|||||||
@TableField("created_by")
|
@TableField("created_by")
|
||||||
@Comment("创建人")
|
@Comment("创建人")
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
|
@ExcelIgnore
|
||||||
protected String createdBy;
|
protected String createdBy;
|
||||||
|
|
||||||
@Schema(description = "更新人")
|
@Schema(description = "更新人")
|
||||||
@ -67,6 +72,7 @@ public class IdBaseEntity extends Entity {
|
|||||||
@TableField("updated_by")
|
@TableField("updated_by")
|
||||||
@Comment("更新人")
|
@Comment("更新人")
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
|
@ExcelIgnore
|
||||||
protected String updatedBy;
|
protected String updatedBy;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class Role extends IdBaseEntity {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "角色key,英文,用来做业务", requiredMode = RequiredMode.REQUIRED)
|
@Schema(description = "角色key,英文,用来做业务")
|
||||||
@TableField("r_key")
|
@TableField("r_key")
|
||||||
@Column("r_key")
|
@Column("r_key")
|
||||||
@Comment("角色key,英文,用来做业务")
|
@Comment("角色key,英文,用来做业务")
|
||||||
|
@ -12,7 +12,6 @@ import lombok.experimental.FieldNameConstants;
|
|||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.nutz.dao.entity.annotation.*;
|
import org.nutz.dao.entity.annotation.*;
|
||||||
import tech.riemann.ims.entity.IdBaseEntity;
|
import tech.riemann.ims.entity.IdBaseEntity;
|
||||||
import tech.riemann.ims.enums.AssignRuleEnum;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
@ -44,8 +43,12 @@ public class ApplyDetail extends IdBaseEntity {
|
|||||||
@ColDefine(notNull = false)
|
@ColDefine(notNull = false)
|
||||||
private Long applyId;
|
private Long applyId;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@Schema(description = "是否需要赋码", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
private AssignRuleEnum assignRule;
|
@TableField("ad_assign_rule")
|
||||||
|
@Column("ad_assign_rule")
|
||||||
|
@Comment("是否需要赋码")
|
||||||
|
@ColDefine(notNull = false)
|
||||||
|
private Boolean assignRule;
|
||||||
|
|
||||||
@Schema(description = "物料Id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "物料Id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@TableField("ad_material_id")
|
@TableField("ad_material_id")
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package tech.riemann.ims.entity.material;
|
package tech.riemann.ims.entity.material;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnore;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -11,6 +14,7 @@ import lombok.experimental.Accessors;
|
|||||||
import lombok.experimental.FieldNameConstants;
|
import lombok.experimental.FieldNameConstants;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.nutz.dao.entity.annotation.*;
|
import org.nutz.dao.entity.annotation.*;
|
||||||
|
import tech.riemann.ims.converter.ICodeBookConverter;
|
||||||
import tech.riemann.ims.entity.IdBaseEntity;
|
import tech.riemann.ims.entity.IdBaseEntity;
|
||||||
import tech.riemann.ims.enums.ApplyTypeEnum;
|
import tech.riemann.ims.enums.ApplyTypeEnum;
|
||||||
import tech.riemann.ims.enums.AuditTypeEnum;
|
import tech.riemann.ims.enums.AuditTypeEnum;
|
||||||
@ -45,13 +49,16 @@ public class ApplyForm extends IdBaseEntity {
|
|||||||
@Column("af_type")
|
@Column("af_type")
|
||||||
@Comment("类型")
|
@Comment("类型")
|
||||||
@ColDefine(type = ColType.INT)
|
@ColDefine(type = ColType.INT)
|
||||||
|
@ExcelIgnore
|
||||||
private ApplyTypeEnum type;
|
private ApplyTypeEnum type;
|
||||||
|
|
||||||
@Schema(description = "盘点类型(1: 全盘 2: 部分盘点)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "盘点类型(1: 扫码 2: 人工)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@TableField("af_audit_type")
|
@TableField("af_audit_type")
|
||||||
@Column("af_audit_type")
|
@Column("af_audit_type")
|
||||||
@Comment("盘点类型")
|
@Comment("盘点类型")
|
||||||
@ColDefine(type = ColType.INT)
|
@ColDefine(type = ColType.INT)
|
||||||
|
@ExcelProperty(value = "盘点类型",converter = ICodeBookConverter.class)
|
||||||
|
@ColumnWidth(40)
|
||||||
private AuditTypeEnum auditType;
|
private AuditTypeEnum auditType;
|
||||||
|
|
||||||
@Schema(description = "申请人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "申请人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@ -59,6 +66,8 @@ public class ApplyForm extends IdBaseEntity {
|
|||||||
@Column("af_applicant")
|
@Column("af_applicant")
|
||||||
@Comment("申请人")
|
@Comment("申请人")
|
||||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||||
|
@ExcelProperty("申请人")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String applicant;
|
private String applicant;
|
||||||
|
|
||||||
@Schema(description = "盘点审核人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "盘点审核人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@ -66,6 +75,8 @@ public class ApplyForm extends IdBaseEntity {
|
|||||||
@Column("af_reviewer")
|
@Column("af_reviewer")
|
||||||
@Comment("盘点审核人")
|
@Comment("盘点审核人")
|
||||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||||
|
@ExcelProperty("盘点审核人")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String reviewer;
|
private String reviewer;
|
||||||
|
|
||||||
@Schema(description = "盘点人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "盘点人", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@ -73,6 +84,8 @@ public class ApplyForm extends IdBaseEntity {
|
|||||||
@Column("af_taker")
|
@Column("af_taker")
|
||||||
@Comment("盘点人")
|
@Comment("盘点人")
|
||||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||||
|
@ExcelProperty("盘点人")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String taker;
|
private String taker;
|
||||||
|
|
||||||
@Schema(description = "申请日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "申请日期", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@ -80,6 +93,8 @@ public class ApplyForm extends IdBaseEntity {
|
|||||||
@Column("af_apply_date")
|
@Column("af_apply_date")
|
||||||
@Comment("申请日期")
|
@Comment("申请日期")
|
||||||
@ColDefine(type = ColType.DATETIME, notNull = false, width = 128, precision = 0)
|
@ColDefine(type = ColType.DATETIME, notNull = false, width = 128, precision = 0)
|
||||||
|
@ExcelProperty("申请日期")
|
||||||
|
@ColumnWidth(40)
|
||||||
private LocalDateTime applyDate;
|
private LocalDateTime applyDate;
|
||||||
|
|
||||||
@Schema(description = "是否确认(0: 未确认 1: 已确认)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "是否确认(0: 未确认 1: 已确认)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@ -87,6 +102,7 @@ public class ApplyForm extends IdBaseEntity {
|
|||||||
@Column("af_is_confirm")
|
@Column("af_is_confirm")
|
||||||
@Comment("是否确认")
|
@Comment("是否确认")
|
||||||
@ColDefine(type = ColType.BOOLEAN, notNull = false, width = 128, precision = 0)
|
@ColDefine(type = ColType.BOOLEAN, notNull = false, width = 128, precision = 0)
|
||||||
|
@ExcelIgnore
|
||||||
private Boolean confirm;
|
private Boolean confirm;
|
||||||
|
|
||||||
@Schema(description = "审核意见", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "审核意见", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@ -94,6 +110,8 @@ public class ApplyForm extends IdBaseEntity {
|
|||||||
@Column("af_review_remark")
|
@Column("af_review_remark")
|
||||||
@Comment("审核意见")
|
@Comment("审核意见")
|
||||||
@ColDefine(type = ColType.TEXT)
|
@ColDefine(type = ColType.TEXT)
|
||||||
|
@ExcelProperty("审核意见")
|
||||||
|
@ColumnWidth(80)
|
||||||
private String reviewRemark;
|
private String reviewRemark;
|
||||||
|
|
||||||
@Schema(description = "审核结果(1-待扫码 2-待提交 3-待审核 4-审核通过 5退回)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "审核结果(1-待扫码 2-待提交 3-待审核 4-审核通过 5退回)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@ -101,6 +119,8 @@ public class ApplyForm extends IdBaseEntity {
|
|||||||
@Column("af_review_result")
|
@Column("af_review_result")
|
||||||
@Comment("审核结果(1-待扫码 2-待提交 3-待审核 4-审核通过 5退回)")
|
@Comment("审核结果(1-待扫码 2-待提交 3-待审核 4-审核通过 5退回)")
|
||||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||||
|
@ExcelProperty(value = "审核结果", converter = ICodeBookConverter.class)
|
||||||
|
@ColumnWidth(40)
|
||||||
private ReviewResultEnum reviewResult;
|
private ReviewResultEnum reviewResult;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,72 @@
|
|||||||
|
package tech.riemann.ims.entity.material;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import lombok.experimental.FieldNameConstants;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.nutz.dao.entity.annotation.*;
|
||||||
|
import tech.riemann.ims.entity.IdBaseEntity;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2025/3/9 18:53
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@FieldNameConstants
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("t_manual_stock_detail")
|
||||||
|
@Table("t_manual_stock_detail")
|
||||||
|
@Comment("物料")
|
||||||
|
@Schema(name = "ManualStockDetail", description = "人工手动核实物料库存明细")
|
||||||
|
public class ManualStockDetail extends IdBaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "申请id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
@TableField("m_apply_id")
|
||||||
|
@Column("m_apply_id")
|
||||||
|
@Comment("申请id")
|
||||||
|
@ColDefine(notNull = false, width = 19, precision = 0)
|
||||||
|
private Long applyId;
|
||||||
|
|
||||||
|
@Schema(description = "物料id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
@TableField("m_material_id")
|
||||||
|
@Column("m_material_id")
|
||||||
|
@Comment("物料id")
|
||||||
|
@ColDefine(notNull = false, width = 19, precision = 0)
|
||||||
|
private Long materialId;
|
||||||
|
|
||||||
|
@Schema(description = "库存数量", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
@TableField("m_stock")
|
||||||
|
@Column("m_stock")
|
||||||
|
@Comment("库存数量")
|
||||||
|
@ColDefine(notNull = false, type = ColType.INT)
|
||||||
|
private Integer stock;
|
||||||
|
|
||||||
|
@Schema(description = "手动核实库存数量", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
@TableField("m_manual_stock")
|
||||||
|
@Column("m_manual_stock")
|
||||||
|
@Comment("手动核实库存数量")
|
||||||
|
@ColDefine(notNull = false, type = ColType.INT)
|
||||||
|
private Integer manualStock;
|
||||||
|
|
||||||
|
@Schema(description = "异常原因", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
@TableField("m_msg")
|
||||||
|
@Column("m_msg")
|
||||||
|
@Comment("异常原因")
|
||||||
|
@ColDefine(notNull = false)
|
||||||
|
private String msg;
|
||||||
|
}
|
@ -1,5 +1,8 @@
|
|||||||
package tech.riemann.ims.entity.material;
|
package tech.riemann.ims.entity.material;
|
||||||
|
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnore;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -11,10 +14,11 @@ import lombok.experimental.Accessors;
|
|||||||
import lombok.experimental.FieldNameConstants;
|
import lombok.experimental.FieldNameConstants;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.nutz.dao.entity.annotation.*;
|
import org.nutz.dao.entity.annotation.*;
|
||||||
|
import tech.riemann.ims.converter.BooleanConverter;
|
||||||
import tech.riemann.ims.entity.IdBaseEntity;
|
import tech.riemann.ims.entity.IdBaseEntity;
|
||||||
import tech.riemann.ims.enums.AssignRuleEnum;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@ -37,6 +41,8 @@ public class Material extends IdBaseEntity {
|
|||||||
@Column("m_code")
|
@Column("m_code")
|
||||||
@Comment("编码")
|
@Comment("编码")
|
||||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||||
|
@ExcelProperty("物料编码")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@ -44,27 +50,48 @@ public class Material extends IdBaseEntity {
|
|||||||
@Column("m_name")
|
@Column("m_name")
|
||||||
@Comment("名称")
|
@Comment("名称")
|
||||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||||
|
@ExcelProperty("物料名称")
|
||||||
|
@ColumnWidth(60)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "赋码规则(2-低值易耗品(不参与赋码) 1-高价值工具类(参与唯一赋码)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "是否赋码", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@TableField("m_assign_rule")
|
@TableField("m_assign_rule")
|
||||||
@Column("m_assign_rule")
|
@Column("m_assign_rule")
|
||||||
@Comment("赋码规则")
|
@Comment("赋码规则")
|
||||||
@ColDefine(notNull = false, type = ColType.INT)
|
@ColDefine(notNull = false, type = ColType.INT)
|
||||||
private AssignRuleEnum assignRule; // 0-低值易耗品(不参与赋码) 1-高价值工具类(参与唯一赋码)
|
@ExcelProperty(value = "是否赋码",converter = BooleanConverter.class)
|
||||||
|
@ColumnWidth(40)
|
||||||
|
private Boolean assignRule; // 0-低值易耗品(不参与赋码) 1-高价值工具类(参与唯一赋码)
|
||||||
|
|
||||||
@Schema(description = "类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@TableField("m_type")
|
@TableField("m_type")
|
||||||
@Column("m_type")
|
@Column("m_type")
|
||||||
@Comment("类型")
|
@Comment("类型")
|
||||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||||
|
@ExcelIgnore
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
@ExcelProperty("物料类型")
|
||||||
|
@ColumnWidth(40)
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
@Schema(description = "价格", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
@TableField("m_price")
|
||||||
|
@Column("m_price")
|
||||||
|
@Comment("价格")
|
||||||
|
@ColDefine(notNull = false, width = 18, precision = 0)
|
||||||
|
@ExcelProperty("价格")
|
||||||
|
@ColumnWidth(40)
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
@Schema(description = "规格", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "规格", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@TableField("m_spec")
|
@TableField("m_spec")
|
||||||
@Column("m_spec")
|
@Column("m_spec")
|
||||||
@Comment("规格")
|
@Comment("规格")
|
||||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||||
|
@ExcelProperty("物料型号")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String spec;
|
private String spec;
|
||||||
|
|
||||||
|
|
||||||
@ -73,6 +100,8 @@ public class Material extends IdBaseEntity {
|
|||||||
@Column("m_stock")
|
@Column("m_stock")
|
||||||
@Comment("库存数量")
|
@Comment("库存数量")
|
||||||
@ColDefine(notNull = false, type = ColType.INT)
|
@ColDefine(notNull = false, type = ColType.INT)
|
||||||
|
@ExcelProperty("库存数量")
|
||||||
|
@ColumnWidth(40)
|
||||||
private Integer stock;
|
private Integer stock;
|
||||||
|
|
||||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@ -80,6 +109,8 @@ public class Material extends IdBaseEntity {
|
|||||||
@Column("m_description")
|
@Column("m_description")
|
||||||
@Comment("备注")
|
@Comment("备注")
|
||||||
@ColDefine(notNull = false, width = 500, precision = 0)
|
@ColDefine(notNull = false, width = 500, precision = 0)
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
@ColumnWidth(40)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
90
src/main/java/tech/riemann/ims/entity/material/Type.java
Normal file
90
src/main/java/tech/riemann/ims/entity/material/Type.java
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
package tech.riemann.ims.entity.material;
|
||||||
|
|
||||||
|
import club.zhcs.lina.utils.enums.Codebook;
|
||||||
|
import club.zhcs.lina.utils.enums.ICodeBook;
|
||||||
|
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import lombok.experimental.FieldNameConstants;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.nutz.dao.entity.annotation.ColDefine;
|
||||||
|
import org.nutz.dao.entity.annotation.Column;
|
||||||
|
import org.nutz.dao.entity.annotation.Comment;
|
||||||
|
import org.nutz.dao.entity.annotation.Table;
|
||||||
|
import org.nutz.json.JsonField;
|
||||||
|
import tech.riemann.ims.entity.IdBaseEntity;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2025/3/2 14:07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@FieldNameConstants
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("t_type")
|
||||||
|
@Table("t_type")
|
||||||
|
@Comment("类型")
|
||||||
|
@Schema(name = "Type", description = "类型")
|
||||||
|
public class Type extends IdBaseEntity {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "类型编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@TableField("a_no")
|
||||||
|
@Column("a_no")
|
||||||
|
@Comment("类型编码")
|
||||||
|
@ColDefine(notNull = true, width = 10, precision = 0)
|
||||||
|
private String no;
|
||||||
|
|
||||||
|
@Schema(description = "类型名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@TableField("a_name")
|
||||||
|
@Column("a_name")
|
||||||
|
@Comment("类型名称")
|
||||||
|
@ColDefine(notNull = true, width = 255, precision = 0)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "类型级别", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@TableField("a_level")
|
||||||
|
@Column("a_level")
|
||||||
|
@Comment("类型级别")
|
||||||
|
@ColDefine(notNull = true, width = 10, precision = 0)
|
||||||
|
private Level level;
|
||||||
|
|
||||||
|
@Schema(description = "上级类型编码", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
@TableField("a_parent_no")
|
||||||
|
@Column("a_parent_no")
|
||||||
|
@Comment("上级类型编码")
|
||||||
|
@ColDefine(notNull = false, width = 10, precision = 0)
|
||||||
|
private String parentNo;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum Level implements ICodeBook {
|
||||||
|
ONE("ONE", "一级"),
|
||||||
|
TWO("TWO", "二级"),
|
||||||
|
;
|
||||||
|
|
||||||
|
@EnumValue
|
||||||
|
final String code;
|
||||||
|
final String description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonGetter
|
||||||
|
@JsonField
|
||||||
|
public Codebook getLevelInfo() {
|
||||||
|
return level == null ? null : level.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevelInfo(Codebook areaLevel) {
|
||||||
|
}
|
||||||
|
}
|
@ -13,10 +13,11 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum ApplyTypeEnum implements ICodeBook {
|
public enum ApplyTypeEnum implements ICodeBook {
|
||||||
|
|
||||||
PURCHASE_RECEIPT("1", "采购入库申请"),
|
PURCHASE_RECEIPT("1", "采购入库"),
|
||||||
RETURN_RECEIPT("2", "归还入库申请"),
|
RETURN_RECEIPT("2", "归还入库"),
|
||||||
LOAN_OUT("3", "外借出库申请"),
|
LOAN_OUT("3", "外借出库"),
|
||||||
AUDIT("4", "盘点申请"),
|
AUDIT("4", "盘点"),
|
||||||
|
SCRAP_OUT("5", "报废出库"),
|
||||||
;
|
;
|
||||||
|
|
||||||
@EnumValue
|
@EnumValue
|
||||||
|
@ -13,8 +13,8 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum AuditTypeEnum implements ICodeBook {
|
public enum AuditTypeEnum implements ICodeBook {
|
||||||
|
|
||||||
ALL("1", "全部盘点"),
|
SCAN("1", "扫码盘点"),
|
||||||
PARTIAL("2", "部分盘点")
|
MANUAL("2", "人工盘点"),
|
||||||
;
|
;
|
||||||
|
|
||||||
@EnumValue
|
@EnumValue
|
||||||
|
@ -14,13 +14,25 @@ import lombok.Getter;
|
|||||||
public enum HandleEnum implements ICodeBook {
|
public enum HandleEnum implements ICodeBook {
|
||||||
|
|
||||||
|
|
||||||
MARK_KEEP("1", "保持在库状态不变"), //SOCK_IN_BUT_SCAN_NOT_EXIST("1", "库房在库状态但是扫码不存在")
|
//SOCK_IN_BUT_SCAN_NOT_EXIST("1", "库房在库状态但是扫码不存在")
|
||||||
MARK_LOST("2", "标记为丢失状态"),
|
|
||||||
|
|
||||||
DISCARD("3", "丢弃-1"),
|
MARK_LOST("1", "标记为丢失"),
|
||||||
|
MARK_KEEP("2", "保持不变"),
|
||||||
|
|
||||||
|
//SOCK_OUT_BUT_SCAN_EXIST("2", "库房不是在库状态但是扫码存在"),
|
||||||
|
MARK_RETURN("3", "标记为归还"),
|
||||||
|
MARK_DISCARD("4", "标记为舍弃"),
|
||||||
|
|
||||||
|
//SOCK_NOT_EXIST_BUT_SCAN_EXIST("3", "库房不存在该条码但是扫码存在"),
|
||||||
|
MARK_NEW("5", "标记为新入库"),
|
||||||
;
|
;
|
||||||
|
|
||||||
@EnumValue
|
@EnumValue
|
||||||
final String code;
|
final String code;
|
||||||
final String description;
|
final String description;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ public enum StockStatusEnum implements ICodeBook {
|
|||||||
OUT("1", "外借"),
|
OUT("1", "外借"),
|
||||||
OFF("2", "下架"),
|
OFF("2", "下架"),
|
||||||
LOST("3", "丢失"),
|
LOST("3", "丢失"),
|
||||||
|
SCRAP_OUT("4", "报废"),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
package tech.riemann.ims.mapper.material;
|
package tech.riemann.ims.mapper.material;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import tech.riemann.ims.dto.response.ScrapOutApplyDTO;
|
||||||
|
import tech.riemann.ims.dto.response.WaitScanInfo;
|
||||||
import tech.riemann.ims.entity.material.ApplyDetail;
|
import tech.riemann.ims.entity.material.ApplyDetail;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
* @since 2024/11/28 15:38
|
* @since 2024/11/28 15:38
|
||||||
*/
|
*/
|
||||||
public interface ApplyDetailMapper extends BaseMapper<ApplyDetail> {
|
public interface ApplyDetailMapper extends BaseMapper<ApplyDetail> {
|
||||||
|
List<WaitScanInfo> getWaitScanData(@Param("applyId") Long applyId);
|
||||||
|
|
||||||
|
List<ScrapOutApplyDTO> getScrapOutById(Integer applyId);
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import tech.riemann.ims.dto.response.ApplyDTO;
|
import tech.riemann.ims.dto.response.ApplyDTO;
|
||||||
import tech.riemann.ims.entity.material.ApplyForm;
|
import tech.riemann.ims.entity.material.ApplyForm;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
* @since 2024/11/28 15:38
|
* @since 2024/11/28 15:38
|
||||||
*/
|
*/
|
||||||
public interface ApplyFormMapper extends BaseMapper<ApplyForm> {
|
public interface ApplyFormMapper extends BaseMapper<ApplyForm> {
|
||||||
|
|
||||||
IPage<ApplyDTO> searchPage(IPage<ApplyDTO> page, Integer applyType, String type, String code, String name);
|
IPage<ApplyDTO> searchPage(IPage<ApplyDTO> page, Integer applyType, List<String> types, String key);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package tech.riemann.ims.mapper.material;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import tech.riemann.ims.dto.response.ManualStockDTO;
|
||||||
|
import tech.riemann.ims.entity.material.ManualStockDetail;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2024/11/28 15:38
|
||||||
|
*/
|
||||||
|
public interface ManualStockDetailMapper extends BaseMapper<ManualStockDetail> {
|
||||||
|
List<ManualStockDTO> getByApplyId(@Param("applyId") Long applyId);
|
||||||
|
}
|
@ -1,11 +1,18 @@
|
|||||||
package tech.riemann.ims.mapper.material;
|
package tech.riemann.ims.mapper.material;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import tech.riemann.ims.entity.material.Material;
|
import tech.riemann.ims.entity.material.Material;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
* @since 2024/11/27 15:42
|
* @since 2024/11/27 15:42
|
||||||
*/
|
*/
|
||||||
public interface MaterialMapper extends BaseMapper<Material> {
|
public interface MaterialMapper extends BaseMapper<Material> {
|
||||||
|
List<Material> queryLikeRight( @Param("types") List<String> types);
|
||||||
|
|
||||||
|
Page<Material> getPage(Page<Object> page, List<String> types, String key);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package tech.riemann.ims.mapper.material;
|
package tech.riemann.ims.mapper.material;
|
||||||
|
|
||||||
import tech.riemann.ims.entity.material.MaterialStockDetail;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import tech.riemann.ims.entity.material.MaterialStockDetail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料明细数据表 Mapper 接口
|
* 物料明细数据表 Mapper 接口
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package tech.riemann.ims.mapper.material;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import tech.riemann.ims.entity.material.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2024/11/27 15:42
|
||||||
|
*/
|
||||||
|
public interface TypeMapper extends BaseMapper<Type> {
|
||||||
|
}
|
@ -2,11 +2,19 @@ package tech.riemann.ims.service.material;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
||||||
|
import tech.riemann.ims.dto.response.ScrapOutApplyDTO;
|
||||||
|
import tech.riemann.ims.dto.response.WaitScanInfo;
|
||||||
import tech.riemann.ims.entity.material.ApplyDetail;
|
import tech.riemann.ims.entity.material.ApplyDetail;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
* @since 2024/11/28 15:41
|
* @since 2024/11/28 15:41
|
||||||
*/
|
*/
|
||||||
public interface IApplyDetailService extends IService<ApplyDetail>, IdNameEntityService<ApplyDetail> {
|
public interface IApplyDetailService extends IService<ApplyDetail>, IdNameEntityService<ApplyDetail> {
|
||||||
|
|
||||||
|
List<WaitScanInfo> getWaitScanData(Long applyId);
|
||||||
|
|
||||||
|
List<ScrapOutApplyDTO> getScrapOutById(Integer applyId);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
|||||||
import tech.riemann.ims.dto.response.ApplyDTO;
|
import tech.riemann.ims.dto.response.ApplyDTO;
|
||||||
import tech.riemann.ims.entity.material.ApplyForm;
|
import tech.riemann.ims.entity.material.ApplyForm;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
* @since 2024/11/28 15:35
|
* @since 2024/11/28 15:35
|
||||||
@ -17,10 +19,8 @@ public interface IApplyFormService extends IService<ApplyForm>, IdNameEntityServ
|
|||||||
* @param page 页码
|
* @param page 页码
|
||||||
* @param size 每页数量
|
* @param size 每页数量
|
||||||
* @param applyType 申请类型
|
* @param applyType 申请类型
|
||||||
* @param type 申请材料类型
|
* @param key 编码或名称关键字
|
||||||
* @param code 申请材料编码
|
|
||||||
* @param name 申请材料名称
|
|
||||||
* @return IPage<ApplyDTO>
|
* @return IPage<ApplyDTO>
|
||||||
*/
|
*/
|
||||||
IPage<ApplyDTO> search(int page, int size, Integer applyType, String type, String code, String name);
|
IPage<ApplyDTO> search(int page, int size, Integer applyType, List<String> types, String key);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package tech.riemann.ims.service.material;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
||||||
|
import tech.riemann.ims.dto.response.ManualStockDTO;
|
||||||
|
import tech.riemann.ims.entity.material.ManualStockDetail;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2024/11/28 15:41
|
||||||
|
*/
|
||||||
|
public interface IManualStockDetailService extends IService<ManualStockDetail>, IdNameEntityService<ManualStockDetail> {
|
||||||
|
|
||||||
|
List<ManualStockDTO> getByApplyId(Long applyId);
|
||||||
|
}
|
@ -1,12 +1,19 @@
|
|||||||
package tech.riemann.ims.service.material;
|
package tech.riemann.ims.service.material;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
||||||
import tech.riemann.ims.entity.material.Material;
|
import tech.riemann.ims.entity.material.Material;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
* @since 2024/11/27 15:40
|
* @since 2024/11/27 15:40
|
||||||
*/
|
*/
|
||||||
public interface IMaterialService extends IService<Material>, IdNameEntityService<Material> {
|
public interface IMaterialService extends IService<Material>, IdNameEntityService<Material> {
|
||||||
|
|
||||||
|
List<Material> queryLikeRight(List<String> types);
|
||||||
|
|
||||||
|
Page<Material> getPage(Page<Object> page, List<String> types, String key);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package tech.riemann.ims.service.material;
|
package tech.riemann.ims.service.material;
|
||||||
|
|
||||||
import tech.riemann.ims.entity.material.MaterialStockDetail;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
||||||
|
import tech.riemann.ims.entity.material.MaterialStockDetail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package tech.riemann.ims.service.material;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.nutz.spring.boot.service.interfaces.IdNameEntityService;
|
||||||
|
import tech.riemann.ims.entity.material.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2024/11/27 15:40
|
||||||
|
*/
|
||||||
|
public interface ITypeService extends IService<Type>, IdNameEntityService<Type> {
|
||||||
|
|
||||||
|
String getTypeName(String type);
|
||||||
|
}
|
@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import tech.riemann.ims.dto.response.ScrapOutApplyDTO;
|
||||||
|
import tech.riemann.ims.dto.response.WaitScanInfo;
|
||||||
import tech.riemann.ims.entity.material.ApplyDetail;
|
import tech.riemann.ims.entity.material.ApplyDetail;
|
||||||
import tech.riemann.ims.mapper.material.ApplyDetailMapper;
|
import tech.riemann.ims.mapper.material.ApplyDetailMapper;
|
||||||
import tech.riemann.ims.service.material.IApplyDetailService;
|
import tech.riemann.ims.service.material.IApplyDetailService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
* @since 2024/11/28 15:36
|
* @since 2024/11/28 15:36
|
||||||
@ -22,4 +26,14 @@ public class ApplyDetailServiceImpl extends ServiceImpl<ApplyDetailMapper, Apply
|
|||||||
public Dao dao() {
|
public Dao dao() {
|
||||||
return dao;
|
return dao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WaitScanInfo> getWaitScanData(Long applyId) {
|
||||||
|
return baseMapper.getWaitScanData(applyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ScrapOutApplyDTO> getScrapOutById(Integer applyId) {
|
||||||
|
return baseMapper.getScrapOutById(applyId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ import tech.riemann.ims.entity.material.ApplyForm;
|
|||||||
import tech.riemann.ims.mapper.material.ApplyFormMapper;
|
import tech.riemann.ims.mapper.material.ApplyFormMapper;
|
||||||
import tech.riemann.ims.service.material.IApplyFormService;
|
import tech.riemann.ims.service.material.IApplyFormService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
* @since 2024/11/28 15:36
|
* @since 2024/11/28 15:36
|
||||||
@ -28,7 +30,7 @@ public class ApplyFormServiceImpl extends ServiceImpl<ApplyFormMapper, ApplyForm
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<ApplyDTO> search(int page, int size, Integer applyType, String type, String code, String name) {
|
public IPage<ApplyDTO> search(int page, int size, Integer applyType, List<String> types, String key) {
|
||||||
return applyFormMapper.searchPage(Page.of(page, size), applyType, type, code, name);
|
return applyFormMapper.searchPage(Page.of(page, size), applyType, types, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package tech.riemann.ims.service.material.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import tech.riemann.ims.dto.response.ManualStockDTO;
|
||||||
|
import tech.riemann.ims.entity.material.ManualStockDetail;
|
||||||
|
import tech.riemann.ims.mapper.material.ManualStockDetailMapper;
|
||||||
|
import tech.riemann.ims.service.material.IManualStockDetailService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2024/11/28 15:36
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ManualStockDetailServiceImpl extends ServiceImpl<ManualStockDetailMapper, ManualStockDetail> implements IManualStockDetailService {
|
||||||
|
|
||||||
|
private final Dao dao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dao dao() {
|
||||||
|
return dao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ManualStockDTO> getByApplyId(Long applyId) {
|
||||||
|
return baseMapper.getByApplyId(applyId);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package tech.riemann.ims.service.material.impl;
|
package tech.riemann.ims.service.material.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
@ -8,6 +9,8 @@ import tech.riemann.ims.entity.material.Material;
|
|||||||
import tech.riemann.ims.mapper.material.MaterialMapper;
|
import tech.riemann.ims.mapper.material.MaterialMapper;
|
||||||
import tech.riemann.ims.service.material.IMaterialService;
|
import tech.riemann.ims.service.material.IMaterialService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
* @since 2024/11/27 15:41
|
* @since 2024/11/27 15:41
|
||||||
@ -21,4 +24,14 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|||||||
public Dao dao() {
|
public Dao dao() {
|
||||||
return dao;
|
return dao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Material> queryLikeRight(List<String> types) {
|
||||||
|
return baseMapper.queryLikeRight(types);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<Material> getPage(Page<Object> page, List<String> types, String key) {
|
||||||
|
return baseMapper.getPage(page, types, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package tech.riemann.ims.service.material.impl;
|
package tech.riemann.ims.service.material.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
import tech.riemann.ims.entity.material.MaterialStockDetail;
|
import tech.riemann.ims.entity.material.MaterialStockDetail;
|
||||||
import tech.riemann.ims.mapper.material.MaterialStockDetailMapper;
|
import tech.riemann.ims.mapper.material.MaterialStockDetailMapper;
|
||||||
import tech.riemann.ims.service.material.IMaterialStockDetailService;
|
import tech.riemann.ims.service.material.IMaterialStockDetailService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
import org.nutz.dao.Dao;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -42,4 +40,5 @@ public class MaterialStockDetailServiceImpl extends ServiceImpl<MaterialStockDet
|
|||||||
public Class<MaterialStockDetail> getEntityType() {
|
public Class<MaterialStockDetail> getEntityType() {
|
||||||
return MaterialStockDetail.class;
|
return MaterialStockDetail.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
package tech.riemann.ims.service.material.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import tech.riemann.ims.entity.material.Type;
|
||||||
|
import tech.riemann.ims.mapper.material.TypeMapper;
|
||||||
|
import tech.riemann.ims.service.material.ITypeService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2024/11/27 15:41
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type> implements ITypeService {
|
||||||
|
private final Dao dao;
|
||||||
|
Map<String, String> names = new HashMap<>();
|
||||||
|
@Override
|
||||||
|
public Dao dao() {
|
||||||
|
return dao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeName(String no) {
|
||||||
|
String name = names.get(no);
|
||||||
|
if(StringUtils.isEmpty(name)){
|
||||||
|
|
||||||
|
Type type = this.baseMapper.selectOne(Wrappers.<Type>lambdaQuery().eq(Type::getNo, no));
|
||||||
|
if(type != null){
|
||||||
|
names.put(no, type.getName());
|
||||||
|
return type.getName();
|
||||||
|
}else{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
60
src/main/java/tech/riemann/ims/utils/BarcodeUtil.java
Normal file
60
src/main/java/tech/riemann/ims/utils/BarcodeUtil.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package tech.riemann.ims.utils;
|
||||||
|
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2024/12/12 20:39
|
||||||
|
*/
|
||||||
|
@UtilityClass
|
||||||
|
public class BarcodeUtil {
|
||||||
|
|
||||||
|
// 用于存储每天已经生成的条码的最后三位
|
||||||
|
private static final ConcurrentHashMap<String, Set<Integer>> dailySequences = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
// 日期格式化为年份后两位和一年中的某一天
|
||||||
|
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyDDD");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成一个7位数字条码,前4位表示年份后两位和一年中的某一天,后3位随机且当天不重复
|
||||||
|
*/
|
||||||
|
public static synchronized String generateBarcode() {
|
||||||
|
// 获取当前日期部分(简化为年份后两位和一年中的第几天)
|
||||||
|
String datePart = sdf.format(new Date());
|
||||||
|
|
||||||
|
// 如果当天的序列号集合不存在,则初始化一个新的集合
|
||||||
|
dailySequences.putIfAbsent(datePart, Collections.synchronizedSet(new HashSet<>()));
|
||||||
|
|
||||||
|
// 获取当天的序列号集合
|
||||||
|
Set<Integer> sequencesToday = dailySequences.get(datePart);
|
||||||
|
|
||||||
|
// 生成随机且不重复的三位数
|
||||||
|
int sequence;
|
||||||
|
do {
|
||||||
|
sequence = ThreadLocalRandom.current().nextInt(0, 9999);
|
||||||
|
} while (sequencesToday.contains(sequence));
|
||||||
|
|
||||||
|
// 将新生成的序列号添加到当天的集合中
|
||||||
|
sequencesToday.add(sequence);
|
||||||
|
|
||||||
|
// 格式化序列号为3位字符串,不足前面补0
|
||||||
|
String sequencePart = String.format("%04d", sequence);
|
||||||
|
|
||||||
|
return datePart + sequencePart;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模拟新的一天开始,重置当天的序列号集合
|
||||||
|
*/
|
||||||
|
public static void resetDailySequence() {
|
||||||
|
dailySequences.clear();
|
||||||
|
}
|
||||||
|
}
|
39
src/main/java/tech/riemann/ims/utils/ExcelUtil.java
Normal file
39
src/main/java/tech/riemann/ims/utils/ExcelUtil.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package tech.riemann.ims.utils;
|
||||||
|
|
||||||
|
import club.zhcs.lina.starter.exception.BizException;
|
||||||
|
import cn.idev.excel.FastExcel;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mayong
|
||||||
|
* @since 2025/3/15 16:17
|
||||||
|
*/
|
||||||
|
@UtilityClass
|
||||||
|
public class ExcelUtil {
|
||||||
|
|
||||||
|
|
||||||
|
public void exportExcel(HttpServletResponse response,
|
||||||
|
String excelName,
|
||||||
|
String sheetName,
|
||||||
|
Class<?> clazz,
|
||||||
|
Collection<?> result) {
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
String fileName = URLEncoder.encode(excelName, StandardCharsets.UTF_8).replaceAll("\\+", "%20");
|
||||||
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||||
|
try {
|
||||||
|
FastExcel.write(response.getOutputStream(), clazz)
|
||||||
|
.sheet(sheetName)
|
||||||
|
.doWrite(result);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw BizException.create("导出Excel失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -16,7 +16,7 @@ management:
|
|||||||
include:
|
include:
|
||||||
- "*"
|
- "*"
|
||||||
server:
|
server:
|
||||||
port: 7777 # 改端口号后swagger文档访问不到
|
port: 8888 # 改端口号后swagger文档访问不到
|
||||||
http2:
|
http2:
|
||||||
enabled: true
|
enabled: true
|
||||||
undertow:
|
undertow:
|
||||||
@ -69,8 +69,8 @@ spring:
|
|||||||
name: ims
|
name: ims
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://mysql.riemann.tech:13307/hx_jxc?characterEncoding=UTF-8
|
url: jdbc:mysql://mysql.riemann.tech:13307/hx_jxc?characterEncoding=UTF-8
|
||||||
username: hx_jxc
|
username: root
|
||||||
password: BBSzc7cnbAhLAenT
|
password: G00dl^ck
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
druid:
|
druid:
|
||||||
filters: stat,wall,log4j2
|
filters: stat,wall,log4j2
|
||||||
@ -110,10 +110,10 @@ springdoc:
|
|||||||
customer:
|
customer:
|
||||||
theme: feeling-blue
|
theme: feeling-blue
|
||||||
title: 库管系统
|
title: 库管系统
|
||||||
url: https://www.riemann.tech
|
url: https://ims.riemann.tech
|
||||||
config-url: /v3/api-docs/swagger-config
|
config-url: /v3/api-docs/swagger-config
|
||||||
server:
|
server:
|
||||||
url: http://localhost:7777
|
url: http://localhost:8888
|
||||||
description: 物料库存管理系统
|
description: 物料库存管理系统
|
||||||
info:
|
info:
|
||||||
title: 库管系统
|
title: 库管系统
|
||||||
@ -126,7 +126,7 @@ springdoc:
|
|||||||
contact:
|
contact:
|
||||||
email: product@ipmt.online
|
email: product@ipmt.online
|
||||||
name: ETP
|
name: ETP
|
||||||
url: https://www.riemann.tech
|
url: https://ims.riemann.tech
|
||||||
swagger-ui:
|
swagger-ui:
|
||||||
enabled: true
|
enabled: true
|
||||||
group-configs:
|
group-configs:
|
||||||
|
47
src/main/resources/mapper/ApplyDetailMapper.xml
Normal file
47
src/main/resources/mapper/ApplyDetailMapper.xml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="tech.riemann.ims.mapper.material.ApplyDetailMapper">
|
||||||
|
|
||||||
|
<resultMap id="resultMap" type="tech.riemann.ims.dto.response.WaitScanInfo">
|
||||||
|
<result property="count" column="m_stock" />
|
||||||
|
<result property="materialName" column="m_name" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getWaitScanData" resultMap="resultMap">
|
||||||
|
SELECT
|
||||||
|
m.m_name,
|
||||||
|
m.m_stock
|
||||||
|
FROM
|
||||||
|
t_apply_detail d
|
||||||
|
LEFT JOIN t_material m ON m.id = d.ad_material_id
|
||||||
|
WHERE
|
||||||
|
d.ad_apply_id = #{applyId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="resultMap2" type="tech.riemann.ims.dto.response.ScrapOutApplyDTO">
|
||||||
|
<result property="name" column="m_name" />
|
||||||
|
<result property="type" column="m_type" />
|
||||||
|
<result property="spec" column="m_spec" />
|
||||||
|
<result property="price" column="m_price" />
|
||||||
|
<result property="confirmQuantity" column="ad_confirm_quantity" />
|
||||||
|
<result property="remark" column="ad_exception_remark" />
|
||||||
|
<result property="applicant" column="af_applicant" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getScrapOutById" resultMap="resultMap2">
|
||||||
|
SELECT
|
||||||
|
m.m_name,
|
||||||
|
m.m_type,
|
||||||
|
m.m_spec,
|
||||||
|
m.m_price,
|
||||||
|
d.ad_confirm_quantity,
|
||||||
|
d.ad_exception_remark,
|
||||||
|
a.af_applicant
|
||||||
|
FROM
|
||||||
|
t_apply_detail d
|
||||||
|
LEFT JOIN t_material m ON m.id = d.ad_material_id
|
||||||
|
LEFT JOIN t_apply_form a ON a.id = d.ad_apply_id
|
||||||
|
WHERE
|
||||||
|
d.ad_apply_id = #{applyId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -3,9 +3,11 @@
|
|||||||
<mapper namespace="tech.riemann.ims.mapper.material.ApplyFormMapper">
|
<mapper namespace="tech.riemann.ims.mapper.material.ApplyFormMapper">
|
||||||
|
|
||||||
<resultMap id="resultMap" type="tech.riemann.ims.dto.response.ApplyDTO">
|
<resultMap id="resultMap" type="tech.riemann.ims.dto.response.ApplyDTO">
|
||||||
|
<id property="applyId" column="id" />
|
||||||
<result property="applyNum" column="ad_quantity" />
|
<result property="applyNum" column="ad_quantity" />
|
||||||
<result property="applyDate" column="af_apply_date" />
|
<result property="applyDate" column="af_apply_date" />
|
||||||
<result property="applicant" column="af_applicant" />
|
<result property="applicant" column="af_applicant" />
|
||||||
|
<result property="reviewer" column="af_reviewer" />
|
||||||
<result property="confirmNum" column="ad_confirm_quantity" />
|
<result property="confirmNum" column="ad_confirm_quantity" />
|
||||||
<result property="type" column="m_type" />
|
<result property="type" column="m_type" />
|
||||||
<result property="code" column="m_code" />
|
<result property="code" column="m_code" />
|
||||||
@ -13,20 +15,26 @@
|
|||||||
<result property="spec" column="m_spec" />
|
<result property="spec" column="m_spec" />
|
||||||
<result property="applyType" column="af_type" />
|
<result property="applyType" column="af_type" />
|
||||||
<result property="remark" column="ad_exception_remark" />
|
<result property="remark" column="ad_exception_remark" />
|
||||||
|
<result property="confirm" column="af_is_confirm" />
|
||||||
|
<result property="reviewResult" column="af_review_result" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="searchPage" resultMap="resultMap">
|
<select id="searchPage" resultMap="resultMap">
|
||||||
SELECT
|
SELECT
|
||||||
|
f.id,
|
||||||
d.ad_quantity,
|
d.ad_quantity,
|
||||||
f.af_apply_date,
|
f.af_apply_date,
|
||||||
d.ad_exception_remark,
|
d.ad_exception_remark,
|
||||||
d.ad_confirm_quantity,
|
d.ad_confirm_quantity,
|
||||||
f.af_applicant,
|
f.af_applicant,
|
||||||
|
f.af_reviewer,
|
||||||
m.m_type,
|
m.m_type,
|
||||||
m.m_code,
|
m.m_code,
|
||||||
m.m_name,
|
m.m_name,
|
||||||
m.m_spec,
|
m.m_spec,
|
||||||
f.af_type
|
f.af_type,
|
||||||
|
f.af_is_confirm,
|
||||||
|
f.af_review_result
|
||||||
FROM
|
FROM
|
||||||
t_apply_form f
|
t_apply_form f
|
||||||
LEFT JOIN t_apply_detail d ON f.id = d.ad_apply_id
|
LEFT JOIN t_apply_detail d ON f.id = d.ad_apply_id
|
||||||
@ -34,22 +42,32 @@
|
|||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
<if test="applyType!= null and applyType!= ''">
|
<if test="applyType!= null and applyType!= ''">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="applyType == '1'">
|
<!-- <when test="applyType == '3'"> Mybatis会将 “2” 解析为字符类型-->
|
||||||
|
<when test='applyType == "1"'>
|
||||||
and f.af_type in ('1', '2')
|
and f.af_type in ('1', '2')
|
||||||
</when>
|
</when>
|
||||||
|
<when test='applyType == "3"'>
|
||||||
|
and f.af_type in ('3', '5')
|
||||||
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
and f.af_type = #{applyType}
|
and f.af_type = #{applyType}
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
<if test="type!= null and type!= ''">
|
<if test="types != null and types.size() > 0">
|
||||||
AND m.m_type = #{type}
|
and (
|
||||||
|
<foreach collection="types" item="item" separator="or">
|
||||||
|
( m_type like concat(#{item},'%') )
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="code!= null and code!= ''">
|
|
||||||
AND m.m_code LIKE CONCAT('%', #{code}, '%')
|
<if test="key != null and key.trim().length() > 0">
|
||||||
</if>
|
and (
|
||||||
<if test="name!= null and name!= ''">
|
m_code like concat('%',#{key},'%')
|
||||||
AND m.m_name LIKE CONCAT('%', #{name}, '%')
|
or m_name like concat('%',#{key},'%')
|
||||||
|
or m_spec like concat('%',#{key},'%')
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
ORDER BY f.af_apply_date DESC
|
ORDER BY f.af_apply_date DESC
|
||||||
|
|
||||||
|
35
src/main/resources/mapper/ManualStockDetailMapper.xml
Normal file
35
src/main/resources/mapper/ManualStockDetailMapper.xml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="tech.riemann.ims.mapper.material.ManualStockDetailMapper">
|
||||||
|
|
||||||
|
<resultMap id="resultMap" type="tech.riemann.ims.dto.response.ManualStockDTO">
|
||||||
|
<result property="code" column="m_code"/>
|
||||||
|
<result property="name" column="m_name"/>
|
||||||
|
<result property="type" column="m_type"/>
|
||||||
|
<result property="price" column="m_price"/>
|
||||||
|
<result property="spec" column="m_spec"/>
|
||||||
|
<result property="applyId" column="m_apply_id"/>
|
||||||
|
<result property="materialId" column="m_material_id"/>
|
||||||
|
<result property="stock" column="m_stock"/>
|
||||||
|
<result property="manualStock" column="m_manual_stock"/>
|
||||||
|
<result property="msg" column="m_msg"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getByApplyId" resultMap="resultMap">
|
||||||
|
SELECT
|
||||||
|
ms.m_apply_id,
|
||||||
|
ms.m_material_id,
|
||||||
|
ms.m_manual_stock,
|
||||||
|
ms.m_msg,
|
||||||
|
m.m_spec,
|
||||||
|
ms.m_stock,
|
||||||
|
m.m_name,
|
||||||
|
m.m_type,
|
||||||
|
m.m_code,
|
||||||
|
m.m_price
|
||||||
|
FROM
|
||||||
|
t_manual_stock_detail ms
|
||||||
|
left join t_material m on m.id = ms.m_material_id
|
||||||
|
where ms.m_apply_id = #{applyId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
70
src/main/resources/mapper/MaterialMapper.xml
Normal file
70
src/main/resources/mapper/MaterialMapper.xml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="tech.riemann.ims.mapper.material.MaterialMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="tech.riemann.ims.entity.material.Material">
|
||||||
|
|
||||||
|
</resultMap>
|
||||||
|
<select id="queryLikeRight" resultType="tech.riemann.ims.entity.material.Material">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
m_code AS `code`,
|
||||||
|
m_name AS `name`,
|
||||||
|
m_assign_rule AS `assignRule`,
|
||||||
|
m_type AS `type`,
|
||||||
|
m_price AS `price`,
|
||||||
|
m_spec AS `spec`,
|
||||||
|
m_stock AS `stock`,
|
||||||
|
m_description AS `description`,
|
||||||
|
created_time,
|
||||||
|
updated_time,
|
||||||
|
created_by,
|
||||||
|
updated_by
|
||||||
|
FROM
|
||||||
|
t_material
|
||||||
|
<where>
|
||||||
|
<foreach collection="types" item="item" separator="or">
|
||||||
|
( m_type like concat(#{item},'%') )
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<select id="getPage" resultType="tech.riemann.ims.entity.material.Material">
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
m_code AS `code`,
|
||||||
|
m_name AS `name`,
|
||||||
|
m_assign_rule AS `assignRule`,
|
||||||
|
m_type AS `type`,
|
||||||
|
m_price AS `price`,
|
||||||
|
m_spec AS `spec`,
|
||||||
|
m_stock AS `stock`,
|
||||||
|
m_description AS `description`,
|
||||||
|
created_time,
|
||||||
|
updated_time,
|
||||||
|
created_by,
|
||||||
|
updated_by
|
||||||
|
FROM
|
||||||
|
t_material
|
||||||
|
<where>
|
||||||
|
<if test="types != null and types.size() > 0">
|
||||||
|
and (
|
||||||
|
<foreach collection="types" item="item" separator="or">
|
||||||
|
( m_type like concat(#{item},'%') )
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="key != null and key.trim().length() > 0">
|
||||||
|
and (
|
||||||
|
m_code like concat('%',#{key},'%')
|
||||||
|
or m_name like concat('%',#{key},'%')
|
||||||
|
or m_spec like concat('%',#{key},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by updated_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user