This commit is contained in:
parent
3ccc377c3a
commit
76b9b901ea
@ -161,6 +161,8 @@ public class ApplyFormController {
|
|||||||
.setSql(!detail.getAssignRule(),
|
.setSql(!detail.getAssignRule(),
|
||||||
"m_stock = m_stock + " + detail.getQuantity())
|
"m_stock = m_stock + " + detail.getQuantity())
|
||||||
));
|
));
|
||||||
|
} else if (applyType == ApplyTypeEnum.SCRAP_OUT) {
|
||||||
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +348,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();
|
||||||
|
@ -20,6 +20,7 @@ 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.BarcodeUtil;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -39,6 +40,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)
|
||||||
@ -65,21 +67,25 @@ public class MaterialController {
|
|||||||
@Parameter(description = "搜索关键词") @RequestParam(required = false, defaultValue = "") String key) {
|
@Parameter(description = "搜索关键词") @RequestParam(required = false, defaultValue = "") String key) {
|
||||||
boolean hasLike = Strings.isNotBlank(key);
|
boolean hasLike = Strings.isNotBlank(key);
|
||||||
key = String.format("%%%s%%", key);
|
key = String.format("%%%s%%", key);
|
||||||
return materialService.page(Page.of(page, size), Wrappers.<Material>lambdaQuery()
|
Page<Material> result = materialService.page(Page.of(page, size), Wrappers.<Material>lambdaQuery()
|
||||||
|
|
||||||
.like(hasLike, Material::getName, key)
|
.like(hasLike, Material::getName, key)
|
||||||
.or()
|
.or()
|
||||||
.like(hasLike, Material::getCode, key)
|
.like(hasLike, Material::getCode, key)
|
||||||
.or()
|
.or()
|
||||||
.like(hasLike, Material::getType, key)
|
.like(hasLike, Material::getType, key)
|
||||||
.orderByDesc(Material::getUpdatedTime));
|
.orderByDesc(Material::getUpdatedTime));
|
||||||
|
result.getRecords().forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("material/list")
|
@GetMapping("material/list")
|
||||||
@Operation(summary = "查询所有物料列表")
|
@Operation(summary = "查询所有物料列表")
|
||||||
public List<Material> all(@Parameter(description = "类型") @RequestParam(required = false, defaultValue = "") String type) {
|
public List<Material> all(@Parameter(description = "类型") @RequestParam(required = false, defaultValue = "") String type) {
|
||||||
return materialService.list(Wrappers.<Material>lambdaQuery()
|
List<Material> all = materialService.list(Wrappers.<Material>lambdaQuery()
|
||||||
.likeLeft(StringUtils.isNotBlank(type), Material::getType, type));
|
.likeRight(StringUtils.isNotBlank(type), Material::getType, type));
|
||||||
|
|
||||||
|
all.forEach(item -> item.setTypeName(typeService.getTypeName(item.getType())));
|
||||||
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("material/{id}")
|
@GetMapping("material/{id}")
|
||||||
|
@ -77,6 +77,6 @@ public class TypeController {
|
|||||||
.parentNo(area.getParentNo())
|
.parentNo(area.getParentNo())
|
||||||
.build())
|
.build())
|
||||||
.toList();
|
.toList();
|
||||||
return TypeTree.buildTree(data, null);
|
return TypeTree.buildTree(data, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,9 @@ public class Material extends IdBaseEntity {
|
|||||||
@ColDefine(notNull = false, width = 128, precision = 0)
|
@ColDefine(notNull = false, width = 128, precision = 0)
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
@Schema(description = "价格", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "价格", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@TableField("m_price")
|
@TableField("m_price")
|
||||||
@Column("m_price")
|
@Column("m_price")
|
||||||
|
@ -70,8 +70,8 @@ public class Type extends IdBaseEntity {
|
|||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum Level implements ICodeBook {
|
public enum Level implements ICodeBook {
|
||||||
ONE("town", "一级"),
|
ONE("ONE", "一级"),
|
||||||
TWO("village", "二级"),
|
TWO("TWO", "二级"),
|
||||||
;
|
;
|
||||||
|
|
||||||
@EnumValue
|
@EnumValue
|
||||||
|
@ -14,7 +14,7 @@ import lombok.Getter;
|
|||||||
public enum AuditTypeEnum implements ICodeBook {
|
public enum AuditTypeEnum implements ICodeBook {
|
||||||
|
|
||||||
SCAN("1", "扫码盘点"),
|
SCAN("1", "扫码盘点"),
|
||||||
PARTIAL("2", "人工盘点"),
|
MANUAL("2", "人工盘点"),
|
||||||
;
|
;
|
||||||
|
|
||||||
@EnumValue
|
@EnumValue
|
||||||
|
@ -9,4 +9,6 @@ import tech.riemann.ims.entity.material.Type;
|
|||||||
* @since 2024/11/27 15:40
|
* @since 2024/11/27 15:40
|
||||||
*/
|
*/
|
||||||
public interface ITypeService extends IService<Type>, IdNameEntityService<Type> {
|
public interface ITypeService extends IService<Type>, IdNameEntityService<Type> {
|
||||||
|
|
||||||
|
String getTypeName(String type);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
package tech.riemann.ims.service.material.impl;
|
package tech.riemann.ims.service.material.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import tech.riemann.ims.entity.material.Type;
|
import tech.riemann.ims.entity.material.Type;
|
||||||
import tech.riemann.ims.mapper.material.TypeMapper;
|
import tech.riemann.ims.mapper.material.TypeMapper;
|
||||||
import tech.riemann.ims.service.material.ITypeService;
|
import tech.riemann.ims.service.material.ITypeService;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author mayong
|
* @author mayong
|
||||||
* @since 2024/11/27 15:41
|
* @since 2024/11/27 15:41
|
||||||
@ -16,9 +21,25 @@ import tech.riemann.ims.service.material.ITypeService;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type> implements ITypeService {
|
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type> implements ITypeService {
|
||||||
private final Dao dao;
|
private final Dao dao;
|
||||||
|
Map<String, String> names = new HashMap<>();
|
||||||
@Override
|
@Override
|
||||||
public Dao dao() {
|
public Dao dao() {
|
||||||
return 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user